Skip to content

Commit 1deb30a

Browse files
committed
fix: unaddressed child metadata child does not include parent
1 parent 3dbd9ed commit 1deb30a

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

packages/salesforce/src/deploymentPackageBuilder.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ export class SalesforcePackageBuilder {
322322
const parentPackagePath = await this.getPackagePath(parentComponentMetaFile, parentType);
323323

324324
// Whether the component is supported by the Metadata API and therefore should be included within a manifest.
325-
// When not set defaults to true in metadata registry.
326-
const isAddressable = fragmentType.isAddressable !== false; // defaults to true
325+
// When not set defaults to true in metadata registry -
326+
// When `isAddressable = false` the parent is added to the manifest instead of the child
327+
const isAddressable = fragmentType.isAddressable !== false;
327328

328329
// Merge child metadata into parent metadata
329330
if (this.type === SalesforcePackageType.deploy) {
@@ -332,10 +333,14 @@ export class SalesforcePackageBuilder {
332333

333334
// Add as member to the package when not yet mentioned
334335
if (this.type === SalesforcePackageType.destruct) {
335-
this.mdPackage.addDestructiveChange(fragmentTypeName, `${parentComponentName}.${childComponentName}`);
336+
this.mdPackage.addDestructiveChange(fragmentType.name, `${parentComponentName}.${childComponentName}`);
336337
} else {
337-
isAddressable && this.mdPackage.addManifestEntry(fragmentTypeName, `${parentComponentName}.${childComponentName}`);
338-
this.mdPackage.addSourceMap(sourceFile, { componentType: fragmentTypeName, componentName: `${parentComponentName}.${childComponentName}`, packagePath: parentPackagePath });
338+
if (isAddressable) {
339+
this.mdPackage.addManifestEntry(fragmentType.name, `${parentComponentName}.${childComponentName}`);
340+
} else {
341+
this.mdPackage.addManifestEntry(parentType.name, parentComponentName);
342+
}
343+
this.mdPackage.addSourceMap(sourceFile, { componentType: fragmentType.name, componentName: `${parentComponentName}.${childComponentName}`, packagePath: parentPackagePath });
339344
}
340345

341346
this.logger.verbose(`Added %s (%s.%s) as [%s]`, path.basename(sourceFile), parentComponentName, childComponentName, chalk.green(fragmentTypeName));

packages/salesforce/src/metadataRegistry.ts

-32
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,6 @@ export interface MetadataUrlFormat {
1111
strategy: 'tooling' | 'standard';
1212
}
1313

14-
// '{
15-
// "directoryName": "customMetadata",
16-
// "inFolder": false,
17-
// "metaFile": false,
18-
// "suffix": "md",
19-
// "xmlName": "CustomMetadata",
20-
// "id": "custommetadata",
21-
// "name": "CustomMetadata",
22-
// "strictDirectoryName": false,
23-
// "isBundle": false,
24-
// "metadataName": "CustomMetadata",
25-
// "isAddressable": true,
26-
// "isSourceTracked": true,
27-
// "ext": "md",
28-
// "hasContent": false,
29-
// "defaultDirectory": "customMetadata",
30-
// "nameForMsgs": "Custom Metadata",
31-
// "nameForMsgsPlural": "Custom Metadatas",
32-
// "contentIsBinary": false,
33-
// "hasStandardMembers": false,
34-
// "deleteSupported": true,
35-
// "decompositionConfig": {
36-
// "strategy": "nonDecomposed",
37-
// "workspaceStrategy": "nonDecomposed",
38-
// "commitStrategy": "fineGrainTracking",
39-
// "metadataName": "CustomMetadata",
40-
// "useSparseComposition": false,
41-
// "decompositions": [],
42-
// "contentStrategy": "nonDecomposedContent"
43-
// },
44-
// "hasVirtualSubtypes": false
45-
// }'
4614
export interface MetadataType extends RegistryMetadataType {
4715
isBundle: boolean;
4816
/**

0 commit comments

Comments
 (0)