Skip to content

Commit

Permalink
fix: things snapshots uncovered
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Aug 8, 2024
1 parent 5065e62 commit 951f533
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/convert/transformers/decomposeLabelsTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import type { CustomLabels, CustomLabel } from '@jsforce/jsforce-node/lib/api/metadata';
import type { CustomLabel } from '@jsforce/jsforce-node/lib/api/metadata';
import { SfError } from '@salesforce/core/sfError';
import { calculateRelativePath } from '../../utils/path';
import { SourceComponent } from '../../resolve/sourceComponent';
import { ToSourceFormatInput, WriteInfo } from '../types';
import { JsToXml } from '../streams';
import { unwrapAndOmitNS } from '../../utils/decomposed';
import { DefaultMetadataTransformer } from './defaultMetadataTransformer';

/* Use for the metadata type CustomLabels */
Expand All @@ -21,7 +22,7 @@ export class LabelsMetadataTransformer extends DefaultMetadataTransformer {
const partiallyAppliedPathCalculator = calculateRelativePath('source')({
self: labelType,
});
const xml = await component.parseXml<CustomLabels>();
const xml = unwrapAndOmitNS('CustomLabels')(await component.parseXml()) as { labels: CustomLabel[] };
// split each label into a separate label file
return xml.labels.filter(customLabelHasFullName).map((l) => ({
output:
Expand Down
8 changes: 6 additions & 2 deletions src/registry/presets/decomposeCustomLabelsBeta2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"childTypes": {
"customlabel": ""
},
"strictDirectoryNames": {},
"suffixes": {
"label": "customlabel",
"labels": "customlabels"
Expand All @@ -10,7 +14,7 @@
"name": "CustomLabel",
"strategies": {
"adapter": "default",
"transformer": "label"
"transformer": "decomposedLabels"
},
"suffix": "label"
},
Expand All @@ -20,7 +24,7 @@
"name": "CustomLabels",
"strategies": {
"adapter": "default",
"transformer": "labels"
"transformer": "decomposedLabels"
},
"suffix": "labels"
}
Expand Down
2 changes: 2 additions & 0 deletions src/registry/presets/presetMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { MetadataRegistry } from '../types';

// we have to import all presets explicitly for VSCE's esbuild bundling process
import * as decomposeCustomLabelsBeta from './decomposeCustomLabelsBeta.json';
import * as decomposeCustomLabelsBeta2 from './decomposeCustomLabelsBeta2.json';
import * as decomposePermissionSetBeta from './decomposePermissionSetBeta.json';
import * as decomposeSharingRulesBeta from './decomposeSharingRulesBeta.json';
import * as decomposeWorkflowBeta from './decomposeWorkflowBeta.json';

export const presetMap = new Map<string, MetadataRegistry>([
['decomposeCustomLabelsBeta', decomposeCustomLabelsBeta as MetadataRegistry],
['decomposeCustomLabelsBeta2', decomposeCustomLabelsBeta2 as MetadataRegistry],
['decomposePermissionSetBeta', decomposePermissionSetBeta as MetadataRegistry],
['decomposeSharingRulesBeta', decomposeSharingRulesBeta as MetadataRegistry],
['decomposeWorkflowBeta', decomposeWorkflowBeta as MetadataRegistry],
Expand Down

0 comments on commit 951f533

Please sign in to comment.