From b0e19717db4f4547a4af6a73994ba56766c67885 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Thu, 31 Mar 2022 11:37:10 -0600 Subject: [PATCH 1/3] fix: resolve strictDirectoryName types in mdapi format --- src/resolve/metadataResolver.ts | 4 +-- test/resolve/metadataResolver.test.ts | 40 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/resolve/metadataResolver.ts b/src/resolve/metadataResolver.ts index a3423fbace..53ead0b320 100644 --- a/src/resolve/metadataResolver.ts +++ b/src/resolve/metadataResolver.ts @@ -174,8 +174,8 @@ export class MetadataResolver { // any of the following 3 options is considered a good match // mixedContent and bundles don't have a suffix to match ['mixedContent', 'bundle'].includes(type.strategies?.adapter) || - // the suffix matches the type we think it is - (type.suffix && fsPath.endsWith(`${type.suffix}${META_XML_SUFFIX}`)) || + // the file suffix (in source or mdapi format) matches the type suffix we think it is + (type.suffix && [type.suffix, `${type.suffix}${META_XML_SUFFIX}`].some((s) => fsPath.endsWith(s))) || // the type has children and the path also includes THAT directory (type.children?.types && Object.values(type.children?.types) diff --git a/test/resolve/metadataResolver.test.ts b/test/resolve/metadataResolver.test.ts index 436d7fb8ec..3ed289c6a4 100644 --- a/test/resolve/metadataResolver.test.ts +++ b/test/resolve/metadataResolver.test.ts @@ -142,6 +142,46 @@ describe('MetadataResolver', () => { expect(access.getComponentsFromPath(path)).to.deep.equal([matchingContentFile.COMPONENT]); }); + it('Should determine type for metadata file with known suffix and strictDirectoryName', () => { + // CustomSite is an example. The conditions are: + // 1. Type has "strictDirectoryName": true + // 2. Type strategy adapter is neither "mixedContent" nor "bundle" + // 3. Type doesn't have children + // 4. mdapi format file path (E_Bikes.site) + const path = join('unpackaged', 'sites', 'E_Bikes.site'); + const treeContainer = VirtualTreeContainer.fromFilePaths([path]); + const mdResolver = new MetadataResolver(undefined, treeContainer); + const expectedComponent = new SourceComponent( + { + name: 'E_Bikes', + type: registry.types.customsite, + xml: path, + }, + treeContainer + ); + expect(mdResolver.getComponentsFromPath(path)).to.deep.equal([expectedComponent]); + }); + + it('Should determine type for source file with known suffix and strictDirectoryName', () => { + // CustomSite is an example. The conditions are: + // 1. Type has "strictDirectoryName": true + // 2. Type strategy adapter is neither "mixedContent" nor "bundle" + // 3. Type doesn't have children + // 4. source format file path (E_Bikes.site-meta.xml) + const path = join('unpackaged', 'sites', 'E_Bikes.site-meta.xml'); + const treeContainer = VirtualTreeContainer.fromFilePaths([path]); + const mdResolver = new MetadataResolver(undefined, treeContainer); + const expectedComponent = new SourceComponent( + { + name: 'E_Bikes', + type: registry.types.customsite, + xml: path, + }, + treeContainer + ); + expect(mdResolver.getComponentsFromPath(path)).to.deep.equal([expectedComponent]); + }); + it('Should determine type for path of mixed content type', () => { const path = mixedContentDirectory.MIXED_CONTENT_DIRECTORY_SOURCE_PATHS[1]; const access = testUtil.createMetadataResolver([ From 5acc74e02d9ab71b9d29af1fffa669685b564b15 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Thu, 31 Mar 2022 11:38:58 -0600 Subject: [PATCH 2/3] chore: adding types for SDR --- METADATA_SUPPORT.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/METADATA_SUPPORT.md b/METADATA_SUPPORT.md index 5fae33be63..20734954eb 100644 --- a/METADATA_SUPPORT.md +++ b/METADATA_SUPPORT.md @@ -499,8 +499,6 @@ v55 introduces the following new types. Here's their current level of support |ExpressionSetDefinition|✅|| |ExpressionSetDefinitionVersion|✅|| |ExternalDataSrcDescriptor|❌|Not supported, but support could be added| -|ExternalDataTranField|❌|Not supported, but support could be added| -|ExternalDataTranObject|❌|Not supported, but support could be added| |FlowTest|✅|| |ForecastingFilter|❌|Not supported, but support could be added| |ForecastingFilterCondition|❌|Not supported, but support could be added| @@ -511,10 +509,11 @@ v55 introduces the following new types. Here's their current level of support |MessagingChannel|undefined|undefined| |PaymentsManagementEnabledSettings|✅|| |RegisteredExternalService|❌|Not supported, but support could be added| -|SchedulingObjective|❌|Not supported, but support could be added| +|SchedulingObjective|undefined|undefined| |StreamingAppDataConnector|❌|Not supported, but support could be added| |SubscriptionManagementSettings|✅|| |VoiceSettings|✅|| +|WarrantyLifecycleMgmtSettings|✅|| ## Additional Types From 2636f9f9978dd1356a5d6a33012726cc5b233dbd Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Thu, 31 Mar 2022 13:37:04 -0600 Subject: [PATCH 3/3] fix: add test for EmailServicesFunction --- test/resolve/metadataResolver.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/resolve/metadataResolver.test.ts b/test/resolve/metadataResolver.test.ts index 3ed289c6a4..501095e995 100644 --- a/test/resolve/metadataResolver.test.ts +++ b/test/resolve/metadataResolver.test.ts @@ -182,6 +182,21 @@ describe('MetadataResolver', () => { expect(mdResolver.getComponentsFromPath(path)).to.deep.equal([expectedComponent]); }); + it('Should determine type for EmailServicesFunction metadata file (mdapi format)', () => { + const path = join('unpackaged', 'emailservices', 'MyEmailServices.xml'); + const treeContainer = VirtualTreeContainer.fromFilePaths([path]); + const mdResolver = new MetadataResolver(undefined, treeContainer); + const expectedComponent = new SourceComponent( + { + name: 'MyEmailServices', + type: registry.types.emailservicesfunction, + xml: path, + }, + treeContainer + ); + expect(mdResolver.getComponentsFromPath(path)).to.deep.equal([expectedComponent]); + }); + it('Should determine type for path of mixed content type', () => { const path = mixedContentDirectory.MIXED_CONTENT_DIRECTORY_SOURCE_PATHS[1]; const access = testUtil.createMetadataResolver([