Skip to content

Commit 05db59e

Browse files
committed
fix: sourceMember excepton for nondecomposed children
1 parent 554c766 commit 05db59e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/shared/metadataKeys.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import * as path from 'path';
8+
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
89
import { RemoteSyncInput } from './types';
910
import { getMetadataKey } from './functions';
1011

@@ -39,7 +40,14 @@ export const getMetadataKeyFromFileResponse = (fileResponse: RemoteSyncInput): s
3940
getMetadataKey(fileResponse.type, fileResponse.fullName),
4041
];
4142
}
42-
// standard key
43+
// CustomLabels (file) => CustomLabel[] (how they're storedin SourceMembers)
44+
if (fileResponse.type === 'CustomLabels' && fileResponse.filePath) {
45+
return ComponentSet.fromSource(fileResponse.filePath)
46+
.getSourceComponents()
47+
.toArray()
48+
.flatMap((component) => component.getChildren().map((child) => getMetadataKey('CustomLabel', child.fullName)));
49+
}
50+
// standard key for everything else
4351
return [getMetadataKey(fileResponse.type, fileResponse.fullName)];
4452
};
4553

0 commit comments

Comments
 (0)