From c4f8ab27c05fe3117dab65202f3ecdda31b97358 Mon Sep 17 00:00:00 2001 From: Prashanth Josyula Date: Mon, 6 Mar 2023 17:28:40 +0530 Subject: [PATCH 1/6] fix(mixedcontentsourceadapter.ts): error - Delete operation of experiencepropertytype metadata this change is to fix the error during delete operation for experiencepropertytype metadata api. as the bundle is all json files and there is no xml file in place delete operation is failing when the metadata API is failing in the backend and this is the fix for same. --- src/resolve/adapters/mixedContentSourceAdapter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resolve/adapters/mixedContentSourceAdapter.ts b/src/resolve/adapters/mixedContentSourceAdapter.ts index b70d5c0fd2..1eaaba62cd 100644 --- a/src/resolve/adapters/mixedContentSourceAdapter.ts +++ b/src/resolve/adapters/mixedContentSourceAdapter.ts @@ -68,6 +68,7 @@ export class MixedContentSourceAdapter extends BaseSourceAdapter { name: baseName(contentPath), type: this.type, content: contentPath, + xml: this.type.id === 'experiencepropertytypebundle' ? `${contentPath}/schema.json` : undefined, }, this.tree, this.forceIgnore From bdb701f6116287748222b262eab87edffce96e99 Mon Sep 17 00:00:00 2001 From: Prashanth Josyula Date: Thu, 9 Mar 2023 16:55:57 +0530 Subject: [PATCH 2/6] feat(mixedcontentsourceadapter.ts): error during delete operation of experiencepropertytype bundle This change is to fix the error during the delete operation for experiencepropertytype metadata bundle. As the bundle is all JSON files and there is no XML file in the bundle there will be an error when the delete operation fails in the backend and this is the fix for the same. --- src/registry/metadataRegistry.json | 1 + src/resolve/adapters/mixedContentSourceAdapter.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/registry/metadataRegistry.json b/src/registry/metadataRegistry.json index cabdaa17d1..e701c6b1a3 100644 --- a/src/registry/metadataRegistry.json +++ b/src/registry/metadataRegistry.json @@ -3388,6 +3388,7 @@ "inFolder": false, "strictDirectoryName": true, "supportsPartialDelete": true, + "metaFileSuffix": "schema.json", "strategies": { "adapter": "bundle" } diff --git a/src/resolve/adapters/mixedContentSourceAdapter.ts b/src/resolve/adapters/mixedContentSourceAdapter.ts index 1eaaba62cd..5efa1b9f19 100644 --- a/src/resolve/adapters/mixedContentSourceAdapter.ts +++ b/src/resolve/adapters/mixedContentSourceAdapter.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { dirname, basename, sep } from 'path'; +import { dirname, basename, sep, join } from 'path'; import { Messages, SfError } from '@salesforce/core'; import { baseName } from '../../utils/path'; import { SourcePath } from '../../common'; @@ -68,7 +68,7 @@ export class MixedContentSourceAdapter extends BaseSourceAdapter { name: baseName(contentPath), type: this.type, content: contentPath, - xml: this.type.id === 'experiencepropertytypebundle' ? `${contentPath}/schema.json` : undefined, + xml: this.type.metaFileSuffix && join(contentPath, this.type.metaFileSuffix), }, this.tree, this.forceIgnore From 00c437662878aaadee74a2f9a0fce998dab68813 Mon Sep 17 00:00:00 2001 From: Prashanth Josyula Date: Mon, 13 Mar 2023 19:09:23 +0530 Subject: [PATCH 3/6] fix(mixedcontentsourceadapter.test.ts): error during delete operation of experiencepropertytype This change is to fix the error during the delete operation for experiencepropertytype metadata bundle. As the bundle is all JSON files and there is no XML file in the bundle there will be an error when the delete operation fails in the backend and this is the fix for the same. --- test/mock/index.ts | 1 + .../experiencePropertyTypeBundleConstants.ts | 51 +++++++++++++++++++ test/mock/type-constants/index.ts | 2 + .../mixedContentSourceAdapter.test.ts | 24 ++++++++- 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 test/mock/type-constants/experiencePropertyTypeBundleConstants.ts diff --git a/test/mock/index.ts b/test/mock/index.ts index 860d1cfe58..03e0aab844 100644 --- a/test/mock/index.ts +++ b/test/mock/index.ts @@ -13,6 +13,7 @@ export { mixedContentDirectory, mixedContentInFolder, mixedContentSingleFile, + experiencePropertyTypeContentSingleFile, decomposed, nonDecomposed, decomposedtoplevel, diff --git a/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts b/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts new file mode 100644 index 0000000000..d144b24b6c --- /dev/null +++ b/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ +import { join } from 'path'; + +import { registry, SourceComponent } from '../../../src'; + +/** Experience Property Type Bundle will be of the following shape. +experiencePropertyTypeBundles/ +prop1/ +schema.json +design.json + + schema.json is always expected to be in the bundle, while design.json is optional. + + Do note that we dont have any -meta.xml. We can consider schema.json as our meta XML file. + */ + +// This is the type defined in metadataRegistry.json +const type = registry.types.experiencepropertytypebundle; + +// This will be the root directory experiencePropertyTypeBundles.It is something like /path/to/experiencePropertyTypeBundles +export const TYPE_DIRECTORY = join('path', 'to', type.directoryName); + +// This is the name of the property type we are creating. +export const COMPONENT_NAME = 'prop1'; + +// This is the schema.json and design.json paths inside the property type. +export const CONTENT_NAMES = [type.metaFileSuffix, 'design.json']; + +// This is the complete path to the content. It is something like /path/to/experiencePropertyTypeBundles/prop1/schema.json. +export const CONTENT_PATHS = CONTENT_NAMES.map((n) => join(TYPE_DIRECTORY, join(COMPONENT_NAME, n))); + +// Finally we construct our component. +export const COMPONENT = SourceComponent.createVirtualComponent( + { + name: COMPONENT_NAME, + type, + content: join(TYPE_DIRECTORY, COMPONENT_NAME), + xml: CONTENT_PATHS[0], + }, + [ + { + dirPath: TYPE_DIRECTORY, + children: [COMPONENT_NAME], + }, + ] +); diff --git a/test/mock/type-constants/index.ts b/test/mock/type-constants/index.ts index 78fdff5daa..32342e47fb 100644 --- a/test/mock/type-constants/index.ts +++ b/test/mock/type-constants/index.ts @@ -11,6 +11,7 @@ import * as document from './documentConstants'; import * as mixedContentDirectory from './staticresourceConstant'; import * as mixedContentInFolder from './documentFolderConstant'; import * as mixedContentSingleFile from './staticresourceComponentConstant'; +import * as experiencePropertyTypeContentSingleFile from './experiencePropertyTypeBundleConstants'; import * as decomposed from './customObjectConstant'; import * as decomposedtoplevel from './customObjectTranslationConstant'; import * as nonDecomposed from './customlabelsConstant'; @@ -32,4 +33,5 @@ export { nestedTypes, lwcBundle, digitalExperienceBundle, + experiencePropertyTypeContentSingleFile, }; diff --git a/test/resolve/adapters/mixedContentSourceAdapter.test.ts b/test/resolve/adapters/mixedContentSourceAdapter.test.ts index 99b8dde7db..f67449563d 100644 --- a/test/resolve/adapters/mixedContentSourceAdapter.test.ts +++ b/test/resolve/adapters/mixedContentSourceAdapter.test.ts @@ -15,7 +15,7 @@ import { MIXED_CONTENT_DIRECTORY_CONTENT_PATH, MIXED_CONTENT_DIRECTORY_VIRTUAL_FS_NO_XML, } from '../../mock/type-constants/staticresourceConstant'; -import { mixedContentDirectory, mixedContentSingleFile } from '../../mock'; +import { mixedContentDirectory, mixedContentSingleFile, experiencePropertyTypeContentSingleFile } from '../../mock'; const messages = Messages.load('@salesforce/source-deploy-retrieve', 'sdr', ['error_expected_source_files']); @@ -77,6 +77,28 @@ describe('MixedContentSourceAdapter', () => { }); }); + describe('Experience Property Type File Content', () => { + const component = experiencePropertyTypeContentSingleFile.COMPONENT; + const adapter = new MixedContentSourceAdapter( + registry.types.experiencepropertytypebundle, + registryAccess, + undefined, + component.tree + ); + + it('Should return expected SourceComponent when given a schema.json path', () => { + const result = adapter.getComponent(component.xml); + + expect(result).to.deep.equal(component); + }); + + it('Should return expected SourceComponent when given a source path', () => { + const result = adapter.getComponent(component.content); + + expect(result).to.deep.equal(component); + }); + }); + describe('Directory Content', () => { const { MIXED_CONTENT_DIRECTORY_COMPONENT, From b69c954299f160149084176393674def1bd52983 Mon Sep 17 00:00:00 2001 From: svc-cli-bot Date: Mon, 13 Mar 2023 15:43:21 +0000 Subject: [PATCH 4/6] test: record perf --- .../eda.json | 10 +++++----- .../lotsOfClasses.json | 10 +++++----- .../lotsOfClassesOneDir.json | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json index 3de2e32fd1..9ad728ac42 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/eda.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 222.67407499998808 + "duration": 226.34448500000872 }, { "name": "sourceToMdapi", - "duration": 6166.7441540000145 + "duration": 4705.3344459999935 }, { "name": "sourceToZip", - "duration": 4826.558009000029 + "duration": 4886.161657999997 }, { "name": "mdapiToSource", - "duration": 4281.85755700001 + "duration": 4058.82406600003 } -] +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json index 084be99edf..24a4824ccf 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClasses.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 442.19902300002286 + "duration": 447.82590599998366 }, { "name": "sourceToMdapi", - "duration": 8834.219169000047 + "duration": 8922.643469000002 }, { "name": "sourceToZip", - "duration": 7419.940933000005 + "duration": 6673.310636000009 }, { "name": "mdapiToSource", - "duration": 5108.842208000016 + "duration": 4866.022824999993 } -] +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json index c23fd7c49b..b14bfd86f2 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-Platinum-8272CL-CPU-2-60GHz/lotsOfClassesOneDir.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 780.378497000027 + "duration": 774.8018560000346 }, { "name": "sourceToMdapi", - "duration": 12146.644433000009 + "duration": 12633.609111000027 }, { "name": "sourceToZip", - "duration": 10558.852648 + "duration": 10770.84330399998 }, { "name": "mdapiToSource", - "duration": 9052.254910999967 + "duration": 8976.685232000018 } -] +] \ No newline at end of file From 6baa4c37a7ae9a2caa74c6ebd0515910564c24b9 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Mon, 13 Mar 2023 13:22:53 -0600 Subject: [PATCH 5/6] fix: lint fix --- .../experiencePropertyTypeBundleConstants.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts b/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts index d144b24b6c..0f28c2d1e2 100644 --- a/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts +++ b/test/mock/type-constants/experiencePropertyTypeBundleConstants.ts @@ -8,15 +8,17 @@ import { join } from 'path'; import { registry, SourceComponent } from '../../../src'; -/** Experience Property Type Bundle will be of the following shape. -experiencePropertyTypeBundles/ -prop1/ -schema.json -design.json - - schema.json is always expected to be in the bundle, while design.json is optional. - - Do note that we dont have any -meta.xml. We can consider schema.json as our meta XML file. +/** + * Experience Property Type Bundle will be of the following shape: + * + * experiencePropertyTypeBundles/ + * ├── prop1/ + * | ├── schema.json + * | ├── design.json + * + * schema.json is always expected to be in the bundle, while design.json is optional. + * + * NOTE: there is no -meta.xml. schema.json acts as the meta XML file. */ // This is the type defined in metadataRegistry.json From 4fade87b06b405248de5acee3a5db0853a63f710 Mon Sep 17 00:00:00 2001 From: svc-cli-bot Date: Mon, 13 Mar 2023 19:37:01 +0000 Subject: [PATCH 6/6] test: record perf --- .../eda.json | 10 +++++----- .../lotsOfClasses.json | 10 +++++----- .../lotsOfClassesOneDir.json | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/eda.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/eda.json index 7bc9dc0368..fef662fc34 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/eda.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/eda.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 345.28876100000343 + "duration": 360.789472000004 }, { "name": "sourceToMdapi", - "duration": 8330.387101 + "duration": 8919.91247500002 }, { "name": "sourceToZip", - "duration": 5822.162848000007 + "duration": 6025.233091000002 }, { "name": "mdapiToSource", - "duration": 6123.899523999979 + "duration": 6253.451692000002 } -] +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClasses.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClasses.json index 7e8ad1231e..bfc6a3534e 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClasses.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClasses.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 675.3449159999727 + "duration": 744.0605729999952 }, { "name": "sourceToMdapi", - "duration": 11995.010080000007 + "duration": 13127.422728999984 }, { "name": "sourceToZip", - "duration": 9518.928809000005 + "duration": 10371.91620399995 }, { "name": "mdapiToSource", - "duration": 7432.586432000011 + "duration": 7902.201856 } -] +] \ No newline at end of file diff --git a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClassesOneDir.json b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClassesOneDir.json index 3ea9303772..f1c6a80013 100644 --- a/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClassesOneDir.json +++ b/test/nuts/perfResults/x64-linux-2xIntel-Xeon-CPU-E5-2673-v3-2-40GHz/lotsOfClassesOneDir.json @@ -1,18 +1,18 @@ [ { "name": "componentSetCreate", - "duration": 1170.5348080000258 + "duration": 1188.3639100000146 }, { "name": "sourceToMdapi", - "duration": 17969.274023000035 + "duration": 18936.191220000037 }, { "name": "sourceToZip", - "duration": 14706.58613000001 + "duration": 15125.748401999997 }, { "name": "mdapiToSource", - "duration": 13242.275161000027 + "duration": 12817.04882299999 } -] +] \ No newline at end of file