@salesforce/source-deploy-retrieve 5.0.0-orb.2 → 5.0.2
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 +186 -101
- package/LICENSE.txt +12 -0
- package/README.md +2 -2
- package/lib/src/client/deployStrategies/auraDeploy.d.ts +2 -2
- package/lib/src/client/deployStrategies/auraDeploy.js +99 -109
- package/lib/src/client/deployStrategies/auraDeploy.js.map +1 -1
- package/lib/src/client/deployStrategies/baseDeploy.d.ts +1 -1
- package/lib/src/client/deployStrategies/baseDeploy.js +37 -38
- package/lib/src/client/deployStrategies/baseDeploy.js.map +1 -1
- package/lib/src/client/deployStrategies/containerDeploy.d.ts +2 -2
- package/lib/src/client/deployStrategies/containerDeploy.js +58 -73
- package/lib/src/client/deployStrategies/containerDeploy.js.map +1 -1
- package/lib/src/client/deployStrategies/index.js +4 -3
- package/lib/src/client/deployStrategies/index.js.map +1 -1
- package/lib/src/client/deployStrategies/lwcDeploy.d.ts +2 -2
- package/lib/src/client/deployStrategies/lwcDeploy.js +98 -109
- package/lib/src/client/deployStrategies/lwcDeploy.js.map +1 -1
- package/lib/src/client/diagnosticUtil.d.ts +1 -1
- package/lib/src/client/diagnosticUtil.js +11 -11
- package/lib/src/client/diagnosticUtil.js.map +1 -1
- package/lib/src/client/index.d.ts +1 -1
- package/lib/src/client/index.js +1 -1
- package/lib/src/client/index.js.map +1 -1
- package/lib/src/client/metadataApiDeploy.d.ts +4 -4
- package/lib/src/client/metadataApiDeploy.js +57 -73
- package/lib/src/client/metadataApiDeploy.js.map +1 -1
- package/lib/src/client/metadataApiRetrieve.d.ts +10 -3
- package/lib/src/client/metadataApiRetrieve.js +102 -111
- package/lib/src/client/metadataApiRetrieve.js.map +1 -1
- package/lib/src/client/metadataTransfer.d.ts +2 -2
- package/lib/src/client/metadataTransfer.js +102 -118
- package/lib/src/client/metadataTransfer.js.map +1 -1
- package/lib/src/client/retrieveUtil.d.ts +1 -1
- package/lib/src/client/retrieveUtil.js +17 -17
- package/lib/src/client/retrieveUtil.js.map +1 -1
- package/lib/src/client/toolingApi.d.ts +2 -2
- package/lib/src/client/toolingApi.js +71 -94
- package/lib/src/client/toolingApi.js.map +1 -1
- package/lib/src/client/types.js +1 -14
- package/lib/src/client/types.js.map +1 -1
- package/lib/src/collections/componentSet.d.ts +16 -10
- package/lib/src/collections/componentSet.js +160 -114
- package/lib/src/collections/componentSet.js.map +1 -1
- package/lib/src/collections/index.js +1 -0
- package/lib/src/collections/index.js.map +1 -1
- package/lib/src/collections/lazyCollection.js +5 -1
- package/lib/src/collections/lazyCollection.js.map +1 -1
- package/lib/src/collections/types.d.ts +8 -0
- package/lib/src/common/constants.js +1 -1
- package/lib/src/common/constants.js.map +1 -1
- package/lib/src/common/index.d.ts +1 -1
- package/lib/src/common/index.js +1 -0
- package/lib/src/common/index.js.map +1 -1
- package/lib/src/convert/convertContext.d.ts +9 -10
- package/lib/src/convert/convertContext.js +165 -173
- package/lib/src/convert/convertContext.js.map +1 -1
- package/lib/src/convert/index.js +1 -0
- package/lib/src/convert/index.js.map +1 -1
- package/lib/src/convert/metadataConverter.d.ts +3 -18
- package/lib/src/convert/metadataConverter.js +112 -110
- package/lib/src/convert/metadataConverter.js.map +1 -1
- package/lib/src/convert/streams.d.ts +4 -4
- package/lib/src/convert/streams.js +111 -147
- package/lib/src/convert/streams.js.map +1 -1
- package/lib/src/convert/transformers/baseMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/decomposedMetadataTransformer.d.ts +2 -2
- package/lib/src/convert/transformers/decomposedMetadataTransformer.js +124 -149
- package/lib/src/convert/transformers/decomposedMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/defaultMetadataTransformer.d.ts +1 -1
- package/lib/src/convert/transformers/defaultMetadataTransformer.js +11 -23
- package/lib/src/convert/transformers/defaultMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/index.js +1 -0
- package/lib/src/convert/transformers/index.js.map +1 -1
- package/lib/src/convert/transformers/metadataTransformerFactory.js +1 -1
- package/lib/src/convert/transformers/metadataTransformerFactory.js.map +1 -1
- package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.d.ts +1 -1
- package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js +18 -29
- package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/staticResourceMetadataTransformer.d.ts +1 -1
- package/lib/src/convert/transformers/staticResourceMetadataTransformer.js +78 -135
- package/lib/src/convert/transformers/staticResourceMetadataTransformer.js.map +1 -1
- package/lib/src/convert/types.d.ts +1 -1
- package/lib/src/errors/index.js.map +1 -1
- package/lib/src/i18n/i18n.js +3 -2
- package/lib/src/i18n/i18n.js.map +1 -1
- package/lib/src/i18n/index.js +3 -4
- package/lib/src/i18n/index.js.map +1 -1
- package/lib/src/i18n/localization.js +4 -4
- package/lib/src/i18n/localization.js.map +1 -1
- package/lib/src/index.js +1 -4
- package/lib/src/index.js.map +1 -1
- package/lib/src/registry/index.js +1 -4
- package/lib/src/registry/index.js.map +1 -1
- package/lib/src/registry/{registry.json → metadataRegistry.json} +376 -20
- package/lib/src/registry/nonSupportedTypes.d.ts +11 -0
- package/lib/src/registry/nonSupportedTypes.js +53 -0
- package/lib/src/registry/nonSupportedTypes.js.map +1 -0
- package/lib/src/registry/registry.d.ts +357 -1
- package/lib/src/registry/registry.js +2 -2
- package/lib/src/registry/registry.js.map +1 -1
- package/lib/src/registry/registryAccess.d.ts +12 -0
- package/lib/src/registry/registryAccess.js +25 -2
- package/lib/src/registry/registryAccess.js.map +1 -1
- package/lib/src/registry/types.d.ts +47 -0
- package/lib/src/registry/types.js +0 -35
- package/lib/src/registry/types.js.map +1 -1
- package/lib/src/resolve/adapters/baseSourceAdapter.d.ts +3 -2
- package/lib/src/resolve/adapters/baseSourceAdapter.js +55 -19
- package/lib/src/resolve/adapters/baseSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/bundleSourceAdapter.d.ts +1 -1
- package/lib/src/resolve/adapters/bundleSourceAdapter.js +0 -6
- package/lib/src/resolve/adapters/bundleSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/decomposedSourceAdapter.d.ts +1 -1
- package/lib/src/resolve/adapters/decomposedSourceAdapter.js +8 -14
- package/lib/src/resolve/adapters/decomposedSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/defaultSourceAdapter.d.ts +1 -1
- package/lib/src/resolve/adapters/defaultSourceAdapter.js +0 -6
- package/lib/src/resolve/adapters/defaultSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/index.js +1 -0
- package/lib/src/resolve/adapters/index.js.map +1 -1
- package/lib/src/resolve/adapters/matchingContentSourceAdapter.d.ts +1 -1
- package/lib/src/resolve/adapters/matchingContentSourceAdapter.js +2 -2
- package/lib/src/resolve/adapters/matchingContentSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/mixedContentSourceAdapter.d.ts +1 -1
- package/lib/src/resolve/adapters/mixedContentSourceAdapter.js +6 -6
- package/lib/src/resolve/adapters/mixedContentSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/sourceAdapterFactory.js +2 -2
- package/lib/src/resolve/adapters/sourceAdapterFactory.js.map +1 -1
- package/lib/src/resolve/forceIgnore.d.ts +0 -5
- package/lib/src/resolve/forceIgnore.js +14 -100
- package/lib/src/resolve/forceIgnore.js.map +1 -1
- package/lib/src/resolve/index.d.ts +1 -1
- package/lib/src/resolve/index.js +1 -0
- package/lib/src/resolve/index.js.map +1 -1
- package/lib/src/resolve/manifestResolver.d.ts +1 -0
- package/lib/src/resolve/manifestResolver.js +42 -31
- package/lib/src/resolve/manifestResolver.js.map +1 -1
- package/lib/src/resolve/metadataResolver.d.ts +12 -7
- package/lib/src/resolve/metadataResolver.js +39 -19
- package/lib/src/resolve/metadataResolver.js.map +1 -1
- package/lib/src/resolve/sourceComponent.d.ts +46 -7
- package/lib/src/resolve/sourceComponent.js +126 -65
- package/lib/src/resolve/sourceComponent.js.map +1 -1
- package/lib/src/resolve/treeContainers.d.ts +1 -1
- package/lib/src/resolve/treeContainers.js +21 -32
- package/lib/src/resolve/treeContainers.js.map +1 -1
- package/lib/src/resolve/types.d.ts +2 -2
- package/lib/src/utils/collections.js +1 -1
- package/lib/src/utils/collections.js.map +1 -1
- package/lib/src/utils/fileSystemHandler.js +1 -1
- package/lib/src/utils/fileSystemHandler.js.map +1 -1
- package/lib/src/utils/index.d.ts +1 -1
- package/lib/src/utils/index.js +2 -0
- package/lib/src/utils/index.js.map +1 -1
- package/lib/src/utils/metadata.js +1 -3
- package/lib/src/utils/metadata.js.map +1 -1
- package/lib/src/utils/path.d.ts +26 -1
- package/lib/src/utils/path.js +40 -5
- package/lib/src/utils/path.js.map +1 -1
- package/package.json +44 -35
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { ForceIgnore } from './forceIgnore';
|
|
2
|
-
import { TreeContainer } from './treeContainers';
|
|
3
|
-
import { MetadataComponent, VirtualDirectory } from './types';
|
|
4
1
|
import { JsonMap } from '@salesforce/ts-types';
|
|
5
2
|
import { SfdxFileFormat } from '../convert';
|
|
6
3
|
import { MetadataType } from '../registry';
|
|
4
|
+
import { DestructiveChangesType } from '../collections';
|
|
5
|
+
import { MetadataComponent, VirtualDirectory } from './types';
|
|
6
|
+
import { TreeContainer } from './treeContainers';
|
|
7
|
+
import { ForceIgnore } from './forceIgnore';
|
|
7
8
|
export declare type ComponentProperties = {
|
|
8
9
|
name: string;
|
|
9
10
|
type: MetadataType;
|
|
10
11
|
xml?: string;
|
|
11
12
|
content?: string;
|
|
12
13
|
parent?: SourceComponent;
|
|
14
|
+
parentType?: MetadataType;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* Representation of a MetadataComponent in a file tree.
|
|
@@ -19,26 +21,63 @@ export declare class SourceComponent implements MetadataComponent {
|
|
|
19
21
|
readonly type: MetadataType;
|
|
20
22
|
readonly xml?: string;
|
|
21
23
|
readonly parent?: SourceComponent;
|
|
24
|
+
parentType?: MetadataType;
|
|
22
25
|
content?: string;
|
|
23
|
-
private
|
|
26
|
+
private treeContainer;
|
|
24
27
|
private forceIgnore;
|
|
25
28
|
private markedForDelete;
|
|
29
|
+
private destructiveChangesType;
|
|
26
30
|
constructor(props: ComponentProperties, tree?: TreeContainer, forceIgnore?: ForceIgnore);
|
|
27
31
|
static createVirtualComponent(props: ComponentProperties, fs: VirtualDirectory[], forceIgnore?: ForceIgnore): SourceComponent;
|
|
28
32
|
walkContent(): string[];
|
|
33
|
+
/**
|
|
34
|
+
* returns the children of a parent SourceComponent
|
|
35
|
+
*
|
|
36
|
+
* Ensures that the children of SourceComponent are valid child types.
|
|
37
|
+
* Invalid child types can occur when projects are structured in an atypical way such as having
|
|
38
|
+
* ApexClasses or Layouts within a CustomObject folder.
|
|
39
|
+
*
|
|
40
|
+
* @return SourceComponent[] containing valid children
|
|
41
|
+
*/
|
|
29
42
|
getChildren(): SourceComponent[];
|
|
30
|
-
parseXml<T = JsonMap>(): Promise<T>;
|
|
31
|
-
parseXmlSync<T = JsonMap>(): T;
|
|
43
|
+
parseXml<T = JsonMap>(xmlFilePath?: string): Promise<T>;
|
|
44
|
+
parseXmlSync<T = JsonMap>(xmlFilePath?: string): T;
|
|
45
|
+
/**
|
|
46
|
+
* As a performance enhancement, use the already parsed parent xml source
|
|
47
|
+
* to return the child section of xml source. This is useful for non-decomposed
|
|
48
|
+
* transformers where all child source components reference the parent's
|
|
49
|
+
* xml file to prevent re-reading the same file multiple times.
|
|
50
|
+
*
|
|
51
|
+
* @param parentXml parsed parent XMl source as an object
|
|
52
|
+
* @returns child section of the parent's xml
|
|
53
|
+
*/
|
|
54
|
+
parseFromParentXml<T = JsonMap>(parentXml: T): T;
|
|
32
55
|
getPackageRelativePath(fsPath: string, format: SfdxFileFormat): string;
|
|
33
56
|
/**
|
|
34
57
|
* @returns whether this component should be part of destructive changes.
|
|
35
58
|
*/
|
|
36
59
|
isMarkedForDelete(): boolean;
|
|
37
|
-
|
|
60
|
+
getDestructiveChangesType(): DestructiveChangesType;
|
|
61
|
+
setMarkedForDelete(destructiveChangeType?: DestructiveChangesType | boolean): void;
|
|
62
|
+
private calculateRelativePath;
|
|
38
63
|
private parse;
|
|
39
64
|
private getDecomposedChildren;
|
|
40
65
|
private getNonDecomposedChildren;
|
|
41
66
|
private walk;
|
|
42
67
|
get fullName(): string;
|
|
43
68
|
get tree(): TreeContainer;
|
|
69
|
+
/**
|
|
70
|
+
* Returns whether this component type is supported by the Metadata API
|
|
71
|
+
* and therefore should have an entry added to the manifest.
|
|
72
|
+
*
|
|
73
|
+
* This is defined on the type in the registry. The type is required to
|
|
74
|
+
* be in the registry for proper classification and for possible use in
|
|
75
|
+
* decomposition/recomposition.
|
|
76
|
+
*
|
|
77
|
+
* Default value is true, so the only way to return false is to explicitly
|
|
78
|
+
* set it in the registry as false.
|
|
79
|
+
*
|
|
80
|
+
* E.g., CustomFieldTranslation.
|
|
81
|
+
*/
|
|
82
|
+
get isAddressable(): boolean;
|
|
44
83
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SourceComponent = void 0;
|
|
13
4
|
/*
|
|
@@ -18,12 +9,13 @@ exports.SourceComponent = void 0;
|
|
|
18
9
|
*/
|
|
19
10
|
const path_1 = require("path");
|
|
20
11
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
21
|
-
const
|
|
22
|
-
const treeContainers_1 = require("./treeContainers");
|
|
12
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
23
13
|
const utils_1 = require("../utils");
|
|
24
14
|
const common_1 = require("../common");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
15
|
+
const errors_1 = require("../errors");
|
|
16
|
+
const collections_1 = require("../collections");
|
|
17
|
+
const treeContainers_1 = require("./treeContainers");
|
|
18
|
+
const forceIgnore_1 = require("./forceIgnore");
|
|
27
19
|
/**
|
|
28
20
|
* Representation of a MetadataComponent in a file tree.
|
|
29
21
|
*/
|
|
@@ -35,7 +27,8 @@ class SourceComponent {
|
|
|
35
27
|
this.xml = props.xml;
|
|
36
28
|
this.parent = props.parent;
|
|
37
29
|
this.content = props.content;
|
|
38
|
-
this.
|
|
30
|
+
this.parentType = props.parentType;
|
|
31
|
+
this.treeContainer = tree;
|
|
39
32
|
this.forceIgnore = forceIgnore;
|
|
40
33
|
}
|
|
41
34
|
static createVirtualComponent(props, fs, forceIgnore) {
|
|
@@ -53,50 +46,67 @@ class SourceComponent {
|
|
|
53
46
|
}
|
|
54
47
|
return sources;
|
|
55
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* returns the children of a parent SourceComponent
|
|
51
|
+
*
|
|
52
|
+
* Ensures that the children of SourceComponent are valid child types.
|
|
53
|
+
* Invalid child types can occur when projects are structured in an atypical way such as having
|
|
54
|
+
* ApexClasses or Layouts within a CustomObject folder.
|
|
55
|
+
*
|
|
56
|
+
* @return SourceComponent[] containing valid children
|
|
57
|
+
*/
|
|
56
58
|
getChildren() {
|
|
59
|
+
var _a, _b, _c, _d;
|
|
57
60
|
if (!this.parent && this.type.children) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const children = this.content ? this.getDecomposedChildren(this.content) : this.getNonDecomposedChildren();
|
|
62
|
+
const validChildTypes = ((_a = this.type) === null || _a === void 0 ? void 0 : _a.children) ? Object.keys((_c = (_b = this.type) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.types) : [];
|
|
63
|
+
for (const child of children) {
|
|
64
|
+
// Ensure only valid child types are included with the parent.
|
|
65
|
+
if (!validChildTypes.includes((_d = child.type) === null || _d === void 0 ? void 0 : _d.id)) {
|
|
66
|
+
const filePath = child.xml || child.content;
|
|
67
|
+
throw new errors_1.TypeInferenceError('error_unexpected_child_type', [filePath, this.type.name]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return children;
|
|
61
71
|
}
|
|
62
72
|
return [];
|
|
63
73
|
}
|
|
64
|
-
parseXml() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return this.parse(contents.toString());
|
|
69
|
-
}
|
|
70
|
-
return {};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
parseXmlSync() {
|
|
74
|
-
if (this.xml) {
|
|
75
|
-
const contents = this.tree.readFileSync(this.xml);
|
|
74
|
+
async parseXml(xmlFilePath) {
|
|
75
|
+
const xml = xmlFilePath !== null && xmlFilePath !== void 0 ? xmlFilePath : this.xml;
|
|
76
|
+
if (xml) {
|
|
77
|
+
const contents = await this.tree.readFile(xml);
|
|
76
78
|
return this.parse(contents.toString());
|
|
77
79
|
}
|
|
78
80
|
return {};
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
let relativePath;
|
|
86
|
-
if (!suffix) {
|
|
87
|
-
relativePath = path_2.trimUntil(fsPath, directoryName);
|
|
88
|
-
}
|
|
89
|
-
else if (folderType || inFolder) {
|
|
90
|
-
const folderName = this.fullName.split('/')[0];
|
|
91
|
-
relativePath = path_1.join(directoryName, folderName, path_1.basename(fsPath));
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
relativePath = path_1.join(directoryName, path_1.basename(fsPath));
|
|
82
|
+
parseXmlSync(xmlFilePath) {
|
|
83
|
+
const xml = xmlFilePath !== null && xmlFilePath !== void 0 ? xmlFilePath : this.xml;
|
|
84
|
+
if (xml) {
|
|
85
|
+
const contents = this.tree.readFileSync(xml);
|
|
86
|
+
return this.parse(contents.toString());
|
|
95
87
|
}
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* As a performance enhancement, use the already parsed parent xml source
|
|
92
|
+
* to return the child section of xml source. This is useful for non-decomposed
|
|
93
|
+
* transformers where all child source components reference the parent's
|
|
94
|
+
* xml file to prevent re-reading the same file multiple times.
|
|
95
|
+
*
|
|
96
|
+
* @param parentXml parsed parent XMl source as an object
|
|
97
|
+
* @returns child section of the parent's xml
|
|
98
|
+
*/
|
|
99
|
+
parseFromParentXml(parentXml) {
|
|
100
|
+
if (!this.parent) {
|
|
101
|
+
return parentXml;
|
|
98
102
|
}
|
|
99
|
-
|
|
103
|
+
const children = (0, utils_1.normalizeToArray)((0, ts_types_1.get)(parentXml, `${this.parent.type.name}.${this.type.xmlElementName || this.type.directoryName}`));
|
|
104
|
+
return children.find((c) => (0, ts_types_1.getString)(c, this.type.uniqueIdElement) === this.name);
|
|
105
|
+
}
|
|
106
|
+
getPackageRelativePath(fsPath, format) {
|
|
107
|
+
return format === 'source'
|
|
108
|
+
? (0, path_1.join)(common_1.DEFAULT_PACKAGE_ROOT_SFDX, this.calculateRelativePath(fsPath))
|
|
109
|
+
: this.calculateRelativePath(fsPath);
|
|
100
110
|
}
|
|
101
111
|
/**
|
|
102
112
|
* @returns whether this component should be part of destructive changes.
|
|
@@ -104,12 +114,46 @@ class SourceComponent {
|
|
|
104
114
|
isMarkedForDelete() {
|
|
105
115
|
return this.markedForDelete;
|
|
106
116
|
}
|
|
107
|
-
|
|
108
|
-
this.
|
|
117
|
+
getDestructiveChangesType() {
|
|
118
|
+
return this.destructiveChangesType;
|
|
119
|
+
}
|
|
120
|
+
setMarkedForDelete(destructiveChangeType) {
|
|
121
|
+
if (destructiveChangeType === false) {
|
|
122
|
+
this.markedForDelete = false;
|
|
123
|
+
// unset destructiveChangesType if it was already set
|
|
124
|
+
delete this.destructiveChangesType;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.markedForDelete = true;
|
|
128
|
+
// eslint-disable-next-line no-unused-expressions
|
|
129
|
+
destructiveChangeType === collections_1.DestructiveChangesType.PRE
|
|
130
|
+
? (this.destructiveChangesType = collections_1.DestructiveChangesType.PRE)
|
|
131
|
+
: (this.destructiveChangesType = collections_1.DestructiveChangesType.POST);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
calculateRelativePath(fsPath) {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
const { directoryName, suffix, inFolder, folderType, folderContentType } = this.type;
|
|
137
|
+
// if there isn't a suffix, assume this is a mixed content component that must
|
|
138
|
+
// reside in the directoryName of its type. trimUntil maintains the folder structure
|
|
139
|
+
// the file resides in for the new destination. This also applies to inFolder types:
|
|
140
|
+
// (report, dashboard, emailTemplate, document) and their folder container types:
|
|
141
|
+
// (reportFolder, dashboardFolder, emailFolder, documentFolder)
|
|
142
|
+
if (!suffix || inFolder || folderContentType) {
|
|
143
|
+
return (0, utils_1.trimUntil)(fsPath, directoryName);
|
|
144
|
+
}
|
|
145
|
+
if (folderType) {
|
|
146
|
+
// types like Territory2Model have child types inside them. We have to preserve those folder structures
|
|
147
|
+
if (((_a = this.parentType) === null || _a === void 0 ? void 0 : _a.folderType) && ((_b = this.parentType) === null || _b === void 0 ? void 0 : _b.folderType) !== this.type.id) {
|
|
148
|
+
return (0, utils_1.trimUntil)(fsPath, this.parentType.directoryName);
|
|
149
|
+
}
|
|
150
|
+
return (0, path_1.join)(directoryName, this.fullName.split('/')[0], (0, path_1.basename)(fsPath));
|
|
151
|
+
}
|
|
152
|
+
return (0, path_1.join)(directoryName, (0, path_1.basename)(fsPath));
|
|
109
153
|
}
|
|
110
154
|
parse(contents) {
|
|
111
155
|
// include tag attributes and don't parse text node as number
|
|
112
|
-
const parsed = fast_xml_parser_1.parse(contents.toString(), {
|
|
156
|
+
const parsed = (0, fast_xml_parser_1.parse)(contents.toString(), {
|
|
113
157
|
ignoreAttributes: false,
|
|
114
158
|
parseNodeValue: false,
|
|
115
159
|
});
|
|
@@ -118,8 +162,7 @@ class SourceComponent {
|
|
|
118
162
|
return parsed;
|
|
119
163
|
}
|
|
120
164
|
else if (this.parent) {
|
|
121
|
-
|
|
122
|
-
return children.find((c) => ts_types_1.getString(c, this.type.uniqueIdElement) === this.name);
|
|
165
|
+
return this.parseFromParentXml(parsed);
|
|
123
166
|
}
|
|
124
167
|
else {
|
|
125
168
|
return parsed;
|
|
@@ -128,39 +171,41 @@ class SourceComponent {
|
|
|
128
171
|
getDecomposedChildren(dirPath) {
|
|
129
172
|
const children = [];
|
|
130
173
|
for (const fsPath of this.walk(dirPath)) {
|
|
131
|
-
const childXml = utils_1.parseMetadataXml(fsPath);
|
|
174
|
+
const childXml = (0, utils_1.parseMetadataXml)(fsPath);
|
|
132
175
|
const fileIsRootXml = (childXml === null || childXml === void 0 ? void 0 : childXml.suffix) === this.type.suffix;
|
|
133
176
|
if (childXml && !fileIsRootXml) {
|
|
134
177
|
// TODO: Log warning if missing child type definition
|
|
135
178
|
const childTypeId = this.type.children.suffixes[childXml.suffix];
|
|
136
179
|
const childComponent = new SourceComponent({
|
|
137
|
-
name: utils_1.baseName(fsPath),
|
|
180
|
+
name: (0, utils_1.baseName)(fsPath),
|
|
138
181
|
type: this.type.children.types[childTypeId],
|
|
139
182
|
xml: fsPath,
|
|
140
183
|
parent: this,
|
|
141
|
-
}, this.
|
|
184
|
+
}, this.treeContainer, this.forceIgnore);
|
|
142
185
|
children.push(childComponent);
|
|
143
186
|
}
|
|
144
187
|
}
|
|
145
188
|
return children;
|
|
146
189
|
}
|
|
190
|
+
// Get the children for non-decomposed types that have an xmlElementName
|
|
191
|
+
// and uniqueIdElement defined in the registry.
|
|
192
|
+
// E.g., CustomLabels, Workflows, SharingRules, AssignmentRules.
|
|
147
193
|
getNonDecomposedChildren() {
|
|
148
|
-
// this method only applies to customlabels type
|
|
149
194
|
const parsed = this.parseXmlSync();
|
|
150
|
-
const xmlPathToChildren = `${this.type.name}.${this.type.directoryName}`;
|
|
151
195
|
const children = [];
|
|
152
196
|
for (const childTypeId of Object.keys(this.type.children.types)) {
|
|
153
197
|
const childType = this.type.children.types[childTypeId];
|
|
154
198
|
const uniqueIdElement = childType.uniqueIdElement;
|
|
155
199
|
if (uniqueIdElement) {
|
|
156
|
-
const
|
|
200
|
+
const xmlPathToChildren = `${this.type.name}.${childType.xmlElementName}`;
|
|
201
|
+
const elements = (0, utils_1.normalizeToArray)((0, ts_types_1.get)(parsed, xmlPathToChildren, []));
|
|
157
202
|
const childComponents = elements.map((element) => {
|
|
158
203
|
return new SourceComponent({
|
|
159
|
-
name: ts_types_1.getString(element, uniqueIdElement),
|
|
204
|
+
name: (0, ts_types_1.getString)(element, uniqueIdElement),
|
|
160
205
|
type: childType,
|
|
161
206
|
xml: this.xml,
|
|
162
207
|
parent: this,
|
|
163
|
-
}, this.
|
|
208
|
+
}, this.treeContainer, this.forceIgnore);
|
|
164
209
|
});
|
|
165
210
|
children.push(...childComponents);
|
|
166
211
|
}
|
|
@@ -168,16 +213,16 @@ class SourceComponent {
|
|
|
168
213
|
return children;
|
|
169
214
|
}
|
|
170
215
|
*walk(fsPath) {
|
|
171
|
-
if (!this.
|
|
216
|
+
if (!this.treeContainer.isDirectory(fsPath)) {
|
|
172
217
|
yield fsPath;
|
|
173
218
|
}
|
|
174
219
|
else {
|
|
175
|
-
for (const child of this.
|
|
176
|
-
const childPath = path_1.join(fsPath, child);
|
|
220
|
+
for (const child of this.treeContainer.readDirectory(fsPath)) {
|
|
221
|
+
const childPath = (0, path_1.join)(fsPath, child);
|
|
177
222
|
if (this.forceIgnore.denies(childPath)) {
|
|
178
223
|
continue;
|
|
179
224
|
}
|
|
180
|
-
else if (this.
|
|
225
|
+
else if (this.treeContainer.isDirectory(childPath)) {
|
|
181
226
|
yield* this.walk(childPath);
|
|
182
227
|
}
|
|
183
228
|
else {
|
|
@@ -198,7 +243,23 @@ class SourceComponent {
|
|
|
198
243
|
}
|
|
199
244
|
}
|
|
200
245
|
get tree() {
|
|
201
|
-
return this.
|
|
246
|
+
return this.treeContainer;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Returns whether this component type is supported by the Metadata API
|
|
250
|
+
* and therefore should have an entry added to the manifest.
|
|
251
|
+
*
|
|
252
|
+
* This is defined on the type in the registry. The type is required to
|
|
253
|
+
* be in the registry for proper classification and for possible use in
|
|
254
|
+
* decomposition/recomposition.
|
|
255
|
+
*
|
|
256
|
+
* Default value is true, so the only way to return false is to explicitly
|
|
257
|
+
* set it in the registry as false.
|
|
258
|
+
*
|
|
259
|
+
* E.g., CustomFieldTranslation.
|
|
260
|
+
*/
|
|
261
|
+
get isAddressable() {
|
|
262
|
+
return this.type.isAddressable !== false;
|
|
202
263
|
}
|
|
203
264
|
}
|
|
204
265
|
exports.SourceComponent = SourceComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceComponent.js","sourceRoot":"","sources":["../../../src/resolve/sourceComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sourceComponent.js","sourceRoot":"","sources":["../../../src/resolve/sourceComponent.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,+BAAsC;AACtC,qDAAwC;AACxC,mDAA+D;AAC/D,oCAAmF;AACnF,sCAAsD;AAGtD,sCAA+C;AAC/C,gDAAwD;AAExD,qDAA4F;AAC5F,+CAA4C;AAW5C;;GAEG;AACH,MAAa,eAAe;IAY1B,YACE,KAA0B,EAC1B,OAAsB,IAAI,oCAAmB,EAAE,EAC/C,WAAW,GAAG,IAAI,yBAAW,EAAE;QANzB,oBAA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AAC;SACd;aAAM;YACL,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;gBAC5D,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACtC,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;oBACtC,SAAS;iBACV;qBAAM,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;oBACpD,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC7B;qBAAM;oBACL,MAAM,SAAS,CAAC;iBACjB;aACF;SACF;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;SACvB;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,OAAO,IAAI,CAAC,IAAI,CAAC;SAClB;aAAM;YACL,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;SACvE;IACH,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC;IAC3C,CAAC;CACF;AAzRD,0CAyRC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { SourcePath } from '../common';
|
|
3
2
|
import { Readable } from 'stream';
|
|
3
|
+
import { SourcePath } from '../common';
|
|
4
4
|
import { VirtualDirectory } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* A container for interacting with a file system. Operations such as component resolution,
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.VirtualTreeContainer = exports.ZipTreeContainer = exports.NodeFSTreeContainer = exports.TreeContainer = void 0;
|
|
13
4
|
/*
|
|
@@ -17,10 +8,10 @@ exports.VirtualTreeContainer = exports.ZipTreeContainer = exports.NodeFSTreeCont
|
|
|
17
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
18
9
|
*/
|
|
19
10
|
const path_1 = require("path");
|
|
11
|
+
const graceful_fs_1 = require("graceful-fs");
|
|
12
|
+
const unzipper = require("unzipper");
|
|
20
13
|
const utils_1 = require("../utils");
|
|
21
|
-
const fs_1 = require("fs");
|
|
22
14
|
const errors_1 = require("../errors");
|
|
23
|
-
const unzipper = require("unzipper");
|
|
24
15
|
/**
|
|
25
16
|
* A container for interacting with a file system. Operations such as component resolution,
|
|
26
17
|
* conversion, and packaging perform I/O against `TreeContainer` abstractions.
|
|
@@ -38,12 +29,12 @@ class TreeContainer {
|
|
|
38
29
|
*/
|
|
39
30
|
find(fileType, name, directory) {
|
|
40
31
|
const fileName = this.readDirectory(directory).find((entry) => {
|
|
41
|
-
const parsed = utils_1.parseMetadataXml(path_1.join(directory, entry));
|
|
32
|
+
const parsed = (0, utils_1.parseMetadataXml)((0, path_1.join)(directory, entry));
|
|
42
33
|
const metaXmlCondition = fileType === 'metadataXml' ? !!parsed : !parsed;
|
|
43
|
-
return utils_1.baseName(entry) === name && metaXmlCondition;
|
|
34
|
+
return (0, utils_1.baseName)(entry) === name && metaXmlCondition;
|
|
44
35
|
});
|
|
45
36
|
if (fileName) {
|
|
46
|
-
return path_1.join(directory, fileName);
|
|
37
|
+
return (0, path_1.join)(directory, fileName);
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
}
|
|
@@ -53,23 +44,23 @@ exports.TreeContainer = TreeContainer;
|
|
|
53
44
|
*/
|
|
54
45
|
class NodeFSTreeContainer extends TreeContainer {
|
|
55
46
|
isDirectory(fsPath) {
|
|
56
|
-
return
|
|
47
|
+
return (0, graceful_fs_1.lstatSync)(fsPath).isDirectory();
|
|
57
48
|
}
|
|
58
49
|
exists(fsPath) {
|
|
59
|
-
return
|
|
50
|
+
return (0, graceful_fs_1.existsSync)(fsPath);
|
|
60
51
|
}
|
|
61
52
|
readDirectory(fsPath) {
|
|
62
|
-
return
|
|
53
|
+
return (0, graceful_fs_1.readdirSync)(fsPath);
|
|
63
54
|
}
|
|
64
55
|
readFile(fsPath) {
|
|
65
56
|
// significant enough performance increase using sync instead of fs.promise version
|
|
66
|
-
return Promise.resolve(
|
|
57
|
+
return Promise.resolve((0, graceful_fs_1.readFileSync)(fsPath));
|
|
67
58
|
}
|
|
68
59
|
readFileSync(fsPath) {
|
|
69
|
-
return
|
|
60
|
+
return (0, graceful_fs_1.readFileSync)(fsPath);
|
|
70
61
|
}
|
|
71
62
|
stream(fsPath) {
|
|
72
|
-
return
|
|
63
|
+
return (0, graceful_fs_1.createReadStream)(fsPath);
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
66
|
exports.NodeFSTreeContainer = NodeFSTreeContainer;
|
|
@@ -89,11 +80,9 @@ class ZipTreeContainer extends TreeContainer {
|
|
|
89
80
|
* @param buffer - Buffer of the zip file
|
|
90
81
|
* @returns A Promise of a `ZipTreeContainer`
|
|
91
82
|
*/
|
|
92
|
-
static create(buffer) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return new ZipTreeContainer(directory);
|
|
96
|
-
});
|
|
83
|
+
static async create(buffer) {
|
|
84
|
+
const directory = await unzipper.Open.buffer(buffer);
|
|
85
|
+
return new ZipTreeContainer(directory);
|
|
97
86
|
}
|
|
98
87
|
exists(fsPath) {
|
|
99
88
|
return this.tree.has(fsPath);
|
|
@@ -106,7 +95,7 @@ class ZipTreeContainer extends TreeContainer {
|
|
|
106
95
|
}
|
|
107
96
|
readDirectory(fsPath) {
|
|
108
97
|
if (this.isDirectory(fsPath)) {
|
|
109
|
-
return this.tree.get(fsPath).map((entry) => path_1.basename(entry.path));
|
|
98
|
+
return this.tree.get(fsPath).map((entry) => (0, path_1.basename)(entry.path));
|
|
110
99
|
}
|
|
111
100
|
throw new errors_1.LibraryError('error_expected_directory_path', fsPath);
|
|
112
101
|
}
|
|
@@ -130,14 +119,14 @@ class ZipTreeContainer extends TreeContainer {
|
|
|
130
119
|
for (const { path, type, stream, buffer } of directory.files) {
|
|
131
120
|
if (type === 'File') {
|
|
132
121
|
// normalize path to use OS separator since zip entries always use forward slash
|
|
133
|
-
const entry = { path: path_1.normalize(path), stream, buffer };
|
|
122
|
+
const entry = { path: (0, path_1.normalize)(path), stream, buffer };
|
|
134
123
|
this.tree.set(entry.path, entry);
|
|
135
124
|
this.ensureDirPathExists(entry);
|
|
136
125
|
}
|
|
137
126
|
}
|
|
138
127
|
}
|
|
139
128
|
ensureDirPathExists(entry) {
|
|
140
|
-
const dirPath = path_1.dirname(entry.path);
|
|
129
|
+
const dirPath = (0, path_1.dirname)(entry.path);
|
|
141
130
|
if (dirPath === entry.path) {
|
|
142
131
|
return;
|
|
143
132
|
}
|
|
@@ -168,13 +157,13 @@ class VirtualTreeContainer extends TreeContainer {
|
|
|
168
157
|
throw new errors_1.LibraryError('error_path_not_found', fsPath);
|
|
169
158
|
}
|
|
170
159
|
exists(fsPath) {
|
|
171
|
-
const files = this.tree.get(path_1.dirname(fsPath));
|
|
160
|
+
const files = this.tree.get((0, path_1.dirname)(fsPath));
|
|
172
161
|
const isFile = files && files.has(fsPath);
|
|
173
162
|
return isFile || this.tree.has(fsPath);
|
|
174
163
|
}
|
|
175
164
|
readDirectory(fsPath) {
|
|
176
165
|
if (this.isDirectory(fsPath)) {
|
|
177
|
-
return Array.from(this.tree.get(fsPath)).map((p) => path_1.basename(p));
|
|
166
|
+
return Array.from(this.tree.get(fsPath)).map((p) => (0, path_1.basename)(p));
|
|
178
167
|
}
|
|
179
168
|
throw new errors_1.LibraryError('error_expected_directory_path', fsPath);
|
|
180
169
|
}
|
|
@@ -204,10 +193,10 @@ class VirtualTreeContainer extends TreeContainer {
|
|
|
204
193
|
let childPath;
|
|
205
194
|
let childData;
|
|
206
195
|
if (typeof child === 'string') {
|
|
207
|
-
childPath = path_1.join(dirPath, child);
|
|
196
|
+
childPath = (0, path_1.join)(dirPath, child);
|
|
208
197
|
}
|
|
209
198
|
else {
|
|
210
|
-
childPath = path_1.join(dirPath, child.name);
|
|
199
|
+
childPath = (0, path_1.join)(dirPath, child.name);
|
|
211
200
|
childData = child.data;
|
|
212
201
|
}
|
|
213
202
|
this.tree.get(dirPath).add(childPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeContainers.js","sourceRoot":"","sources":["../../../src/resolve/treeContainers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"treeContainers.js","sourceRoot":"","sources":["../../../src/resolve/treeContainers.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,+BAA0D;AAE1D,6CAAiG;AACjG,qCAAqC;AACrC,oCAAsD;AACtD,sCAAyC;AAIzC;;;;;GAKG;AACH,MAAsB,aAAa;IACjC;;;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AC,CAAC;iBAClC;qBAAM;oBACL,SAAS,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;oBACtC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;iBACxB;gBAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACtC,IAAI,SAAS,EAAE;oBACb,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;iBAC7C;aACF;SACF;IACH,CAAC;CACF;AAvED,oDAuEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { SourcePath } from '../common/types';
|
|
3
|
-
import { SourceComponent } from '.';
|
|
4
3
|
import { MetadataType } from '../registry';
|
|
4
|
+
import { SourceComponent } from '.';
|
|
5
5
|
export interface MetadataComponent {
|
|
6
6
|
fullName: string;
|
|
7
7
|
type: MetadataType;
|
|
@@ -26,7 +26,7 @@ export declare type VirtualFile = {
|
|
|
26
26
|
};
|
|
27
27
|
export declare type VirtualDirectory = {
|
|
28
28
|
dirPath: SourcePath;
|
|
29
|
-
children:
|
|
29
|
+
children: Array<VirtualFile | string>;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Infers the source format structure of a metadata component when given a file path.
|
|
@@ -29,7 +29,7 @@ exports.normalizeToArray = normalizeToArray;
|
|
|
29
29
|
function deepFreeze(object) {
|
|
30
30
|
const propNames = Object.getOwnPropertyNames(object);
|
|
31
31
|
for (const name of propNames) {
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
33
33
|
const val = object[name];
|
|
34
34
|
if (val && typeof val === 'object') {
|
|
35
35
|
deepFreeze(val);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/utils/collections.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAI,YAAiC;IACnE,IAAI,YAAY,EAAE;QAChB,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;KACpE;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AALD,4CAKC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAI,MAAS;IACrC,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/utils/collections.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAI,YAAiC;IACnE,IAAI,YAAY,EAAE;QAChB,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;KACpE;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AALD,4CAKC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAI,MAAS;IACrC,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,mEAAmE;QACnE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAClC,UAAU,CAAC,GAAG,CAAC,CAAC;SACjB;KACF;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAVD,gCAUC"}
|