@salesforce/source-deploy-retrieve 5.9.2 → 5.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [5.9.3](https://github.com/forcedotcom/source-deploy-retrieve/compare/v5.9.2...v5.9.3) (2022-01-20)
6
+
7
+ ### Bug Fixes
8
+
9
+ - custom label merging ([2d5ded2](https://github.com/forcedotcom/source-deploy-retrieve/commit/2d5ded2f45242535061d545dc7de56d12630bce2))
10
+
5
11
  ### [5.9.2](https://github.com/forcedotcom/source-deploy-retrieve/compare/v5.9.1...v5.9.2) (2022-01-12)
6
12
 
7
13
  ### [5.9.1](https://github.com/forcedotcom/source-deploy-retrieve/compare/v5.9.0...v5.9.1) (2022-01-05)
@@ -41,7 +41,7 @@ export interface FromManifestOptions extends OptionalTreeRegistryOptions {
41
41
  */
42
42
  resolveSourcePaths?: string[];
43
43
  /**
44
- * By default, wildcard members encoutered in the manifest are added to the set
44
+ * By default, wildcard members encountered in the manifest are added to the set
45
45
  * e.g. `{ fullName: '*', type: 'ApexClass' }`. If `resolveSourcePaths` is set,
46
46
  * wildcard components are not added to the final set, but are used in the filter
47
47
  * when resolving source-backed components to match all components with the wildcard
@@ -1,6 +1,6 @@
1
1
  import { JsonMap } from '@salesforce/ts-types';
2
2
  import { ComponentSet } from '../collections';
3
- import { MetadataComponent, SourceComponent } from '../resolve';
3
+ import { MetadataComponent, SourceComponent, NodeFSTreeContainer, TreeContainer } from '../resolve';
4
4
  import { WriteInfo, WriterFormat } from './types';
5
5
  declare abstract class ConvertTransactionFinalizer<T> {
6
6
  protected abstract transactionState: T;
@@ -47,17 +47,9 @@ declare class DecompositionFinalizer extends ConvertTransactionFinalizer<Decompo
47
47
  finalize(): Promise<WriterFormat[]>;
48
48
  }
49
49
  export interface NonDecompositionState {
50
- claimed: ChildIndex;
51
- unclaimed: ChildIndex;
50
+ childrenByUniqueElement: Map<string, JsonMap>;
51
+ exampleComponent: SourceComponent;
52
52
  }
53
- declare type ChildIndex = {
54
- [componentKey: string]: {
55
- parent: SourceComponent;
56
- children: {
57
- [childName: string]: JsonMap;
58
- };
59
- };
60
- };
61
53
  /**
62
54
  * Merges child components that share the same parent in the conversion pipeline
63
55
  * into a single file.
@@ -66,33 +58,37 @@ declare type ChildIndex = {
66
58
  */
67
59
  declare class NonDecompositionFinalizer extends ConvertTransactionFinalizer<NonDecompositionState> {
68
60
  protected transactionState: NonDecompositionState;
69
- finalize(defaultDirectory: string): Promise<WriterFormat[]>;
61
+ protected mergeMap: Map<string, Map<string, JsonMap>>;
62
+ protected parentComponentMap: Map<string, SourceComponent>;
63
+ protected tree: TreeContainer;
64
+ finalize(defaultDirectory: string, tree?: NodeFSTreeContainer): Promise<WriterFormat[]>;
65
+ private initChildMapping;
70
66
  /**
71
- * This method finalizes the state by:
72
- * - finding any "unprocessed components" (nondecomposed metadata types can exist in multiple locations under the same name so we have to find all components that could potentially claim children)
73
- * - removing any children from the unclaimed state that have been claimed by the unprocessed components
74
- * - removing any children from the unclaimed state that have already been claimed by a prent in the claimed state
75
- * - merging the remaining unclaimed children into the default parent component (either the component that matches the defaultDirectory or the first parent component)
67
+ * check both top-level maps and make sure there are defaults
76
68
  */
77
- private finalizeState;
69
+ private ensureDefaults;
78
70
  /**
79
- * Returns the "unprocessed components"
71
+ * Returns all the components of the incoming type in the project.
80
72
  *
81
- * An unprocessed component is a component that was not resolved during component resolution.
73
+ * Some components are not resolved during component resolution.
82
74
  * This typically only happens when a specific source path was resolved. This is problematic for
83
75
  * nondecomposed metadata types (like CustomLabels) because we need to know the location of each
84
- * child type before recomposing the final xml. So in order for each of the children to be properly
85
- * claimed, we have to create new ComponentSet that will have all the parent components.
76
+ * child type before recomposing the final xml.
77
+ * The labels could belong in any of the files OR need to go in the default location which already contains labels
78
+ */
79
+ private getAllComponentsOfType;
80
+ /**
81
+ * Populate the mergeMap with all the children of all the local components
86
82
  */
87
- private getUnprocessedComponents;
83
+ private initMergeMap;
88
84
  /**
89
- * Returns the children of "unprocessed components"
85
+ * Return a json object that's built up from the mergeMap children
90
86
  */
91
- private getChildrenOfUnprocessedComponents;
92
87
  private recompose;
88
+ /**
89
+ * Return the default filepath for new metadata of this type
90
+ */
93
91
  private getDefaultOutput;
94
- private getClaimedChildrenNames;
95
- private getParentsOfClaimedChildren;
96
92
  }
97
93
  /**
98
94
  * A state manager over the course of a single metadata conversion call.
@@ -9,10 +9,10 @@ exports.ConvertContext = void 0;
9
9
  */
10
10
  const path_1 = require("path");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
- const kit_1 = require("@salesforce/kit");
13
12
  const common_1 = require("../common");
14
13
  const collections_1 = require("../collections");
15
14
  const utils_1 = require("../utils");
15
+ const resolve_1 = require("../resolve");
16
16
  const streams_1 = require("./streams");
17
17
  class ConvertTransactionFinalizer {
18
18
  setState(props) {
@@ -132,142 +132,135 @@ class NonDecompositionFinalizer extends ConvertTransactionFinalizer {
132
132
  constructor() {
133
133
  super(...arguments);
134
134
  this.transactionState = {
135
- unclaimed: {},
136
- claimed: {},
135
+ childrenByUniqueElement: new Map(),
136
+ exampleComponent: undefined,
137
137
  };
138
+ // filename => (childName => childXml)
139
+ this.mergeMap = new Map();
140
+ // filename => sourceComponent
141
+ this.parentComponentMap = new Map();
138
142
  }
139
- async finalize(defaultDirectory) {
140
- await this.finalizeState(defaultDirectory);
143
+ async finalize(defaultDirectory, tree = new resolve_1.NodeFSTreeContainer()) {
141
144
  const writerData = [];
142
- for (const { parent, children } of Object.values(this.state.claimed)) {
143
- const recomposedXmlObj = await this.recompose(Object.values(children), parent);
144
- writerData.push({
145
- component: parent,
146
- writeInfos: [{ source: new streams_1.JsToXml(recomposedXmlObj), output: parent.xml }],
147
- });
148
- }
149
- for (const { parent, children } of Object.values(this.state.unclaimed)) {
150
- const recomposedXmlObj = await this.recompose(Object.values(children), parent);
151
- writerData.push({
152
- component: parent,
153
- writeInfos: [{ source: new streams_1.JsToXml(recomposedXmlObj), output: this.getDefaultOutput(parent) }],
154
- });
145
+ if (this.transactionState.childrenByUniqueElement.size === 0) {
146
+ return writerData;
155
147
  }
148
+ this.tree = tree;
149
+ // nondecomposed metadata types can exist in multiple locations under the same name
150
+ // so we have to find all components that could potentially match inbound components
151
+ const allNonDecomposed = this.getAllComponentsOfType(defaultDirectory, this.transactionState.exampleComponent.type.name);
152
+ // prepare 3 maps to simplify component merging
153
+ await this.initMergeMap(allNonDecomposed);
154
+ this.parentComponentMap = new Map(allNonDecomposed.map((c) => [c.xml, c]));
155
+ const childNameToParentFilePath = this.initChildMapping();
156
+ // we'll merge any new labels into the default location
157
+ const defaultKey = (0, path_1.join)(defaultDirectory, this.getDefaultOutput(this.transactionState.exampleComponent));
158
+ this.ensureDefaults(defaultKey);
159
+ // put the incoming components into the mergeMap. Keep track of any files we need to write
160
+ const filesToWrite = new Set();
161
+ this.state.childrenByUniqueElement.forEach((child, childUniqueElement) => {
162
+ var _a;
163
+ const parentKey = (_a = childNameToParentFilePath.get(childUniqueElement)) !== null && _a !== void 0 ? _a : defaultKey;
164
+ const parentItemMap = this.mergeMap.get(parentKey);
165
+ parentItemMap.set(childUniqueElement, child);
166
+ filesToWrite.add(parentKey);
167
+ });
168
+ // use the mergeMap to return the writables
169
+ this.mergeMap.forEach((children, parentKey) => {
170
+ if (filesToWrite.has(parentKey)) {
171
+ const parentSourceComponent = this.parentComponentMap.get(parentKey);
172
+ const recomposedXmlObj = this.recompose(children, parentSourceComponent);
173
+ writerData.push({
174
+ component: parentSourceComponent,
175
+ writeInfos: [{ source: new streams_1.JsToXml(recomposedXmlObj), output: parentKey }],
176
+ });
177
+ }
178
+ });
156
179
  return writerData;
157
180
  }
181
+ initChildMapping() {
182
+ const output = new Map();
183
+ this.mergeMap.forEach((children, parentKey) => {
184
+ children.forEach((child, childName) => {
185
+ output.set(childName, parentKey);
186
+ });
187
+ });
188
+ return output;
189
+ }
158
190
  /**
159
- * This method finalizes the state by:
160
- * - finding any "unprocessed components" (nondecomposed metadata types can exist in multiple locations under the same name so we have to find all components that could potentially claim children)
161
- * - removing any children from the unclaimed state that have been claimed by the unprocessed components
162
- * - removing any children from the unclaimed state that have already been claimed by a prent in the claimed state
163
- * - merging the remaining unclaimed children into the default parent component (either the component that matches the defaultDirectory or the first parent component)
191
+ * check both top-level maps and make sure there are defaults
164
192
  */
165
- async finalizeState(defaultDirectory) {
166
- if ((0, kit_1.isEmpty)(this.state.claimed)) {
167
- return;
193
+ ensureDefaults(defaultKey) {
194
+ if (!this.mergeMap.has(defaultKey)) {
195
+ // If project has no files of this type, there won't be anything from allNonDecomposed.
196
+ this.mergeMap.set(defaultKey, new Map());
168
197
  }
169
- const unprocessedComponents = this.getUnprocessedComponents(defaultDirectory);
170
- const parentPaths = Object.keys(this.state.claimed).concat(unprocessedComponents.map((c) => c.xml));
171
- const defaultComponentKey = parentPaths.find((p) => p.startsWith(defaultDirectory)) || parentPaths[0];
172
- const claimedChildren = [
173
- ...this.getClaimedChildrenNames(),
174
- ...(await this.getChildrenOfUnprocessedComponents(unprocessedComponents)),
175
- ];
176
- // merge unclaimed children into default parent component
177
- for (const [key, childIndex] of Object.entries(this.state.unclaimed)) {
178
- const pruned = Object.entries(childIndex.children).reduce((result, [childName, childXml]) => {
179
- return !claimedChildren.includes(childName) ? Object.assign(result, { [childName]: childXml }) : result;
180
- }, {});
181
- delete this.state.unclaimed[key];
182
- if (this.state.claimed[defaultComponentKey]) {
183
- this.state.claimed[defaultComponentKey].children = Object.assign({}, this.state.claimed[defaultComponentKey].children, pruned);
184
- }
198
+ if (!this.parentComponentMap.has(defaultKey)) {
199
+ // it's possible to get here if there are no files of this type in the project.
200
+ // we don't have any SourceComponent to reference except the new incoming ones
201
+ // so this creates a "default" component with the correct path for the xml file
202
+ this.parentComponentMap.set(defaultKey, {
203
+ ...this.transactionState.exampleComponent,
204
+ xml: defaultKey,
205
+ });
185
206
  }
186
207
  }
187
208
  /**
188
- * Returns the "unprocessed components"
209
+ * Returns all the components of the incoming type in the project.
189
210
  *
190
- * An unprocessed component is a component that was not resolved during component resolution.
211
+ * Some components are not resolved during component resolution.
191
212
  * This typically only happens when a specific source path was resolved. This is problematic for
192
213
  * nondecomposed metadata types (like CustomLabels) because we need to know the location of each
193
- * child type before recomposing the final xml. So in order for each of the children to be properly
194
- * claimed, we have to create new ComponentSet that will have all the parent components.
214
+ * child type before recomposing the final xml.
215
+ * The labels could belong in any of the files OR need to go in the default location which already contains labels
195
216
  */
196
- getUnprocessedComponents(defaultDirectory) {
197
- if ((0, kit_1.isEmpty)(this.state.unclaimed)) {
198
- return [];
199
- }
200
- const parents = this.getParentsOfClaimedChildren();
201
- const filterSet = new collections_1.ComponentSet(parents);
202
- const { tree } = parents[0];
217
+ getAllComponentsOfType(defaultDirectory, componentType) {
218
+ // assumes that defaultDir is one level below project dir
203
219
  const projectDir = (0, path_1.resolve)((0, path_1.dirname)(defaultDirectory));
204
- const parentDirs = Object.keys(this.state.claimed).map((k) => {
205
- const parts = k.split(path_1.sep);
206
- const partIndex = parts.findIndex((p) => (0, path_1.basename)(projectDir) === p);
207
- return parts[partIndex + 1];
208
- });
209
- const fsPaths = tree
210
- .readDirectory(projectDir)
211
- .map((p) => (0, path_1.join)(projectDir, p))
212
- .filter((p) => {
213
- const dirName = (0, path_1.basename)(p);
214
- // Only return directories that are likely to be a project directory
215
- return (tree.isDirectory(p) &&
216
- !dirName.startsWith('.') &&
217
- dirName !== 'config' &&
218
- dirName !== 'node_modules' &&
219
- !parentDirs.includes(dirName));
220
- });
221
- const unprocessedComponents = collections_1.ComponentSet.fromSource({ fsPaths, include: filterSet })
222
- .getSourceComponents()
223
- .filter((component) => !this.state.claimed[component.xml]);
220
+ const unprocessedComponents = collections_1.ComponentSet.fromSource({
221
+ fsPaths: [projectDir],
222
+ include: new collections_1.ComponentSet([{ fullName: '*', type: componentType }]),
223
+ tree: this.tree,
224
+ }).getSourceComponents();
224
225
  return unprocessedComponents.toArray();
225
226
  }
226
227
  /**
227
- * Returns the children of "unprocessed components"
228
+ * Populate the mergeMap with all the children of all the local components
228
229
  */
229
- async getChildrenOfUnprocessedComponents(unprocessedComponents) {
230
- const childrenOfUnprocessed = [];
231
- for (const component of unprocessedComponents) {
232
- for (const child of component.getChildren()) {
233
- const xml = await child.parseXml();
234
- const childName = (0, ts_types_1.getString)(xml, child.type.uniqueIdElement);
235
- childrenOfUnprocessed.push(childName);
236
- }
237
- }
238
- return childrenOfUnprocessed;
230
+ async initMergeMap(allComponentsOfType) {
231
+ // A function we can parallelize since we have to parseXml for each local file
232
+ const getMappedChildren = async (component) => {
233
+ const results = await Promise.all(component.getChildren().map(async (child) => {
234
+ const childXml = await child.parseXml();
235
+ return [(0, ts_types_1.getString)(childXml, child.type.uniqueIdElement), childXml];
236
+ }));
237
+ return new Map(results);
238
+ };
239
+ const result = await Promise.all(allComponentsOfType.map(async (c) => [c.xml, await getMappedChildren(c)]));
240
+ this.mergeMap = new Map(result);
239
241
  }
240
- async recompose(children, parentSourceComponent) {
241
- const parentXmlObj = parentSourceComponent.type.strategies.recomposition === "startEmpty" /* StartEmpty */
242
- ? {}
243
- : await parentSourceComponent.parseXml();
242
+ /**
243
+ * Return a json object that's built up from the mergeMap children
244
+ */
245
+ recompose(children, parentSourceComponent) {
246
+ // for CustomLabels, that's `labels`
244
247
  const groupName = parentSourceComponent.type.directoryName;
245
- const parentName = parentSourceComponent.type.name;
246
- for (const child of children) {
247
- if (!parentXmlObj[parentName]) {
248
- parentXmlObj[parentName] = { [common_1.XML_NS_KEY]: common_1.XML_NS_URL };
249
- }
250
- const parent = parentXmlObj[parentName];
251
- if (!parent[groupName]) {
252
- parent[groupName] = [];
253
- }
254
- const group = (0, utils_1.normalizeToArray)(parent[groupName]);
255
- group.push(child);
256
- }
257
- return parentXmlObj;
248
+ return {
249
+ [parentSourceComponent.type.name]: {
250
+ [common_1.XML_NS_KEY]: common_1.XML_NS_URL,
251
+ [groupName]: Array.from(children.values()),
252
+ },
253
+ };
258
254
  }
255
+ /**
256
+ * Return the default filepath for new metadata of this type
257
+ */
259
258
  getDefaultOutput(component) {
260
259
  const { fullName } = component;
261
260
  const [baseName] = fullName.split('.');
262
261
  const output = `${baseName}.${component.type.suffix}${common_1.META_XML_SUFFIX}`;
263
262
  return (0, path_1.join)(component.getPackageRelativePath('', 'source'), output);
264
263
  }
265
- getClaimedChildrenNames() {
266
- return Object.values(this.state.claimed).reduce((x, y) => x.concat(Object.keys(y.children)), []);
267
- }
268
- getParentsOfClaimedChildren() {
269
- return Object.values(this.state.claimed).reduce((x, y) => x.concat([y.parent]), []);
270
- }
271
264
  }
272
265
  /**
273
266
  * A state manager over the course of a single metadata conversion call.
@@ -1 +1 @@
1
- {"version":3,"file":"convertContext.js","sourceRoot":"","sources":["../../../src/convert/convertContext.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,+BAA6D;AAC7D,mDAAqE;AACrE,yCAA0C;AAC1C,sCAAoE;AACpE,gDAA8C;AAC9C,oCAA4C;AAG5C,uCAAoC;AAGpC,MAAe,2BAA2B;IAGjC,QAAQ,CAAC,KAAyB;QACvC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC/B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAGF;AAeD;;;GAGG;AACH,MAAM,sBAAuB,SAAQ,2BAA+C;IAApF;;QACY,qBAAgB,GAAuB,EAAE,CAAC;QAEpD,2FAA2F;QAC3F,gDAAgD;QACxC,mBAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;IA2EtD,CAAC;IAzEQ,KAAK,CAAC,QAAQ;QACnB,MAAM,UAAU,GAAmB,EAAE,CAAC;QACtC,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,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AC,aAAa,CAAC;QAC3D,OAAO;YACL,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjC,CAAC,mBAAU,CAAC,EAAE,mBAAU;gBACxB,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aAC3C;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,SAA0B;QACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;QAC/B,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,GAAG,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,wBAAe,EAAE,CAAC;QAExE,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;CACF;AAED;;GAEG;AACH,MAAa,cAAc;IAA3B;QACkB,kBAAa,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAC7C,kBAAa,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAC7C,qBAAgB,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAUrE,CAAC;IARC,4DAA4D;IACrD,KAAK,CAAC,CAAC,iBAAiB,CAAC,gBAAyB;QACvD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACxC,IAAI,MAAM,YAAY,2BAA2B,EAAE;gBACjD,MAAM,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;aACzC;SACF;IACH,CAAC;CACF;AAbD,wCAaC"}
@@ -9,6 +9,4 @@ import { DecomposedMetadataTransformer } from './decomposedMetadataTransformer';
9
9
  */
10
10
  export declare class NonDecomposedMetadataTransformer extends DecomposedMetadataTransformer {
11
11
  toSourceFormat(component: SourceComponent, mergeWith?: SourceComponent): Promise<WriteInfo[]>;
12
- private setStateForClaimed;
13
- private setStateForUnclaimed;
14
12
  }
@@ -17,47 +17,27 @@ const decomposedMetadataTransformer_1 = require("./decomposedMetadataTransformer
17
17
  * - CustomLabels
18
18
  */
19
19
  class NonDecomposedMetadataTransformer extends decomposedMetadataTransformer_1.DecomposedMetadataTransformer {
20
+ // streams uses mergeWith for all types. Removing it would break the interface
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
22
  async toSourceFormat(component, mergeWith) {
21
- var _a;
23
+ // this will only include the incoming (retrieved) labels, not the local file
22
24
  const parentXml = await component.parseXml();
23
25
  const xmlPathToChildren = `${component.type.name}.${component.type.directoryName}`;
24
26
  const incomingChildrenXml = (0, utils_1.normalizeToArray)((0, ts_types_1.get)(parentXml, xmlPathToChildren));
25
- const children = (_a = mergeWith === null || mergeWith === void 0 ? void 0 : mergeWith.getChildren()) !== null && _a !== void 0 ? _a : [];
26
- const claimedChildren = children.map((c) => c.name);
27
+ // presumes they only have 1 child!
27
28
  const [childTypeId] = Object.keys(component.type.children.types);
28
29
  const { uniqueIdElement } = component.type.children.types[childTypeId];
29
- for (const child of incomingChildrenXml) {
30
- const childName = (0, ts_types_1.getString)(child, uniqueIdElement);
31
- if (claimedChildren.includes(childName)) {
32
- this.setStateForClaimed(mergeWith, childName, child);
33
- }
34
- else {
35
- this.setStateForUnclaimed(component, childName, child);
36
- }
37
- }
38
- return [];
39
- }
40
- setStateForClaimed(parent, childName, child) {
41
30
  this.context.nonDecomposition.setState((state) => {
42
- var _a, _b, _c;
43
- const existingChildren = (_b = (_a = state.claimed[parent.xml]) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : {};
44
- const updatedChildren = Object.assign({}, existingChildren, { [childName]: child });
45
- state.claimed[parent.xml] = Object.assign((_c = state.claimed[parent.xml]) !== null && _c !== void 0 ? _c : {}, {
46
- parent,
47
- children: updatedChildren,
48
- });
31
+ var _a;
32
+ (_a = state.exampleComponent) !== null && _a !== void 0 ? _a : (state.exampleComponent = component);
49
33
  });
50
- }
51
- setStateForUnclaimed(parent, childName, child) {
52
- this.context.nonDecomposition.setState((state) => {
53
- var _a, _b, _c;
54
- const existingChildren = (_b = (_a = state.unclaimed[parent.xml]) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : {};
55
- const updatedChildren = Object.assign({}, existingChildren, { [childName]: child });
56
- state.unclaimed[parent.xml] = Object.assign((_c = state.unclaimed[parent.xml]) !== null && _c !== void 0 ? _c : {}, {
57
- parent,
58
- children: updatedChildren,
34
+ incomingChildrenXml.map((child) => {
35
+ const childName = (0, ts_types_1.getString)(child, uniqueIdElement);
36
+ this.context.nonDecomposition.setState((state) => {
37
+ state.childrenByUniqueElement.set(childName, child);
59
38
  });
60
39
  });
40
+ return [];
61
41
  }
62
42
  }
63
43
  exports.NonDecomposedMetadataTransformer = NonDecomposedMetadataTransformer;
@@ -1 +1 @@
1
- {"version":3,"file":"nonDecomposedMetadataTransformer.js","sourceRoot":"","sources":["../../../../src/convert/transformers/nonDecomposedMetadataTransformer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mDAA+D;AAE/D,uCAA+C;AAE/C,mFAAgF;AAEhF;;;;;GAKG;AACH,MAAa,gCAAiC,SAAQ,6DAA6B;IAC1E,KAAK,CAAC,cAAc,CAAC,SAA0B,EAAE,SAA2B;;QACjF,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC7C,MAAM,iBAAiB,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnF,MAAM,mBAAmB,GAAG,IAAA,wBAAgB,EAAC,IAAA,cAAG,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAc,CAAC;QAE7F,MAAM,QAAQ,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,EA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AC,MAAM,CAAC,GAAG,CAAC,mCAAI,EAAE,EAAE;gBACzE,MAAM;gBACN,QAAQ,EAAE,eAAe;aAC1B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,oBAAoB,CAAC,MAAuB,EAAE,SAAiB,EAAE,KAAc;QACrF,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;;YAC/C,MAAM,gBAAgB,GAAG,MAAA,MAAA,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,0CAAE,QAAQ,mCAAI,EAAE,CAAC;YACrE,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACpF,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,mCAAI,EAAE,EAAE;gBAC7E,MAAM;gBACN,QAAQ,EAAE,eAAe;aAC1B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,4EA4CC"}
1
+ {"version":3,"file":"nonDecomposedMetadataTransformer.js","sourceRoot":"","sources":["../../../../src/convert/transformers/nonDecomposedMetadataTransformer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mDAA+D;AAE/D,uCAA+C;AAE/C,mFAAgF;AAEhF;;;;;GAKG;AACH,MAAa,gCAAiC,SAAQ,6DAA6B;IACjF,+EAA+E;IAC/E,6DAA6D;IACtD,KAAK,CAAC,cAAc,CAAC,SAA0B,EAAE,SAA2B;QACjF,6EAA6E;QAC7E,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC7C,MAAM,iBAAiB,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnF,MAAM,mBAAmB,GAAG,IAAA,wBAAgB,EAAC,IAAA,cAAG,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAc,CAAC;QAC7F,mCAAmC;QACnC,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEvE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;;YAC/C,MAAA,KAAK,CAAC,gBAAgB,oCAAtB,KAAK,CAAC,gBAAgB,GAAK,SAAS,EAAC;QACvC,CAAC,CAAC,CAAC;QAEH,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAChC,MAAM,SAAS,GAAG,IAAA,oBAAS,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;YACpD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC/C,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAzBD,4EAyBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/source-deploy-retrieve",
3
- "version": "5.9.2",
3
+ "version": "5.9.3",
4
4
  "description": "JavaScript library to run Salesforce metadata deploys and retrieves",
5
5
  "main": "lib/src/index.js",
6
6
  "author": "Salesforce",
@@ -24,7 +24,7 @@
24
24
  "node": ">=12.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@salesforce/core": "2.31.0",
27
+ "@salesforce/core": "2.33.1",
28
28
  "@salesforce/kit": "^1.5.0",
29
29
  "@salesforce/ts-types": "^1.4.2",
30
30
  "archiver": "^5.3.0",
@@ -42,6 +42,7 @@
42
42
  "@salesforce/ts-sinon": "^1.1.2",
43
43
  "@types/archiver": "^5.1.1",
44
44
  "@types/deep-equal-in-any-order": "^1.0.1",
45
+ "@types/jsforce": "^1.9.38",
45
46
  "@types/mime": "2.0.3",
46
47
  "@types/mkdirp": "0.5.2",
47
48
  "@types/shelljs": "^0.8.9",
@@ -70,7 +71,7 @@
70
71
  "nyc": "^15.1.0",
71
72
  "prettier": "^2.0.5",
72
73
  "pretty-quick": "^3.1.0",
73
- "shelljs": "0.8.4",
74
+ "shelljs": "0.8.5",
74
75
  "shx": "^0.3.2",
75
76
  "sinon": "10.0.0",
76
77
  "ts-node": "^10.3.0",