From 951f533dba3457e7c93bcf3b18a11b4c5f20061c Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 8 Aug 2024 12:36:36 -0500 Subject: [PATCH] fix: things snapshots uncovered --- src/convert/transformers/decomposeLabelsTransformer.ts | 5 +++-- src/registry/presets/decomposeCustomLabelsBeta2.json | 8 ++++++-- src/registry/presets/presetMap.ts | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/convert/transformers/decomposeLabelsTransformer.ts b/src/convert/transformers/decomposeLabelsTransformer.ts index b870dd1f6e..df9d5c57b7 100644 --- a/src/convert/transformers/decomposeLabelsTransformer.ts +++ b/src/convert/transformers/decomposeLabelsTransformer.ts @@ -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 */ @@ -21,7 +22,7 @@ export class LabelsMetadataTransformer extends DefaultMetadataTransformer { const partiallyAppliedPathCalculator = calculateRelativePath('source')({ self: labelType, }); - const xml = await component.parseXml(); + 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: diff --git a/src/registry/presets/decomposeCustomLabelsBeta2.json b/src/registry/presets/decomposeCustomLabelsBeta2.json index aee6b9bf9f..ea65af0b74 100644 --- a/src/registry/presets/decomposeCustomLabelsBeta2.json +++ b/src/registry/presets/decomposeCustomLabelsBeta2.json @@ -1,4 +1,8 @@ { + "childTypes": { + "customlabel": "" + }, + "strictDirectoryNames": {}, "suffixes": { "label": "customlabel", "labels": "customlabels" @@ -10,7 +14,7 @@ "name": "CustomLabel", "strategies": { "adapter": "default", - "transformer": "label" + "transformer": "decomposedLabels" }, "suffix": "label" }, @@ -20,7 +24,7 @@ "name": "CustomLabels", "strategies": { "adapter": "default", - "transformer": "labels" + "transformer": "decomposedLabels" }, "suffix": "labels" } diff --git a/src/registry/presets/presetMap.ts b/src/registry/presets/presetMap.ts index 2a0353bb68..9a195c52ea 100644 --- a/src/registry/presets/presetMap.ts +++ b/src/registry/presets/presetMap.ts @@ -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([ ['decomposeCustomLabelsBeta', decomposeCustomLabelsBeta as MetadataRegistry], + ['decomposeCustomLabelsBeta2', decomposeCustomLabelsBeta2 as MetadataRegistry], ['decomposePermissionSetBeta', decomposePermissionSetBeta as MetadataRegistry], ['decomposeSharingRulesBeta', decomposeSharingRulesBeta as MetadataRegistry], ['decomposeWorkflowBeta', decomposeWorkflowBeta as MetadataRegistry],