@salesforce/source-deploy-retrieve 5.0.1 → 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 +33 -46
- 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 +98 -108
- 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 +57 -72
- 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 +2 -2
- package/lib/src/client/metadataApiRetrieve.js +86 -106
- package/lib/src/client/metadataApiRetrieve.js.map +1 -1
- package/lib/src/client/metadataTransfer.d.ts +2 -2
- package/lib/src/client/metadataTransfer.js +101 -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 +3 -1
- package/lib/src/collections/componentSet.js +70 -88
- 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/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 +8 -10
- package/lib/src/convert/convertContext.js +162 -197
- 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 +2 -17
- package/lib/src/convert/metadataConverter.js +106 -111
- 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 -1
- package/lib/src/convert/transformers/decomposedMetadataTransformer.js +125 -133
- 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 -132
- 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} +0 -0
- package/lib/src/registry/nonSupportedTypes.js +5 -7
- package/lib/src/registry/nonSupportedTypes.js.map +1 -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 +2 -0
- package/lib/src/registry/registryAccess.js +3 -1
- package/lib/src/registry/registryAccess.js.map +1 -1
- 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 +2 -2
- package/lib/src/resolve/adapters/baseSourceAdapter.js +20 -16
- 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 +6 -13
- 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.js +9 -14
- 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.js +25 -36
- package/lib/src/resolve/manifestResolver.js.map +1 -1
- package/lib/src/resolve/metadataResolver.d.ts +6 -5
- package/lib/src/resolve/metadataResolver.js +18 -23
- package/lib/src/resolve/metadataResolver.js.map +1 -1
- package/lib/src/resolve/sourceComponent.d.ts +4 -4
- package/lib/src/resolve/sourceComponent.js +32 -44
- 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 +1 -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 +5 -1
- package/lib/src/utils/path.js +8 -4
- package/lib/src/utils/path.js.map +1 -1
- package/package.json +39 -34
|
@@ -23,8 +23,7 @@ function buildQuery(mdComponent, namespace = '') {
|
|
|
23
23
|
queryString = `Select Id, ApiVersion, Name, NamespacePrefix, Markup from ${typeName} where Name = '${fullName}' and NamespacePrefix = '${namespace}'`;
|
|
24
24
|
break;
|
|
25
25
|
case 'AuraDefinitionBundle':
|
|
26
|
-
queryString =
|
|
27
|
-
'Select Id, AuraDefinitionBundle.ApiVersion, AuraDefinitionBundle.DeveloperName, ';
|
|
26
|
+
queryString = 'Select Id, AuraDefinitionBundle.ApiVersion, AuraDefinitionBundle.DeveloperName, ';
|
|
28
27
|
queryString += `AuraDefinitionBundle.NamespacePrefix, DefType, Source from AuraDefinition where AuraDefinitionBundle.DeveloperName = '${fullName}' and AuraDefinitionBundle.NamespacePrefix = '${namespace}'`;
|
|
29
28
|
break;
|
|
30
29
|
case 'LightningComponentBundle':
|
|
@@ -39,7 +38,7 @@ function buildQuery(mdComponent, namespace = '') {
|
|
|
39
38
|
}
|
|
40
39
|
exports.buildQuery = buildQuery;
|
|
41
40
|
function getAuraSourceName(componentPath, fileNamePrefix, defType) {
|
|
42
|
-
const cmpParentName = path_1.join(path_1.dirname(componentPath), fileNamePrefix);
|
|
41
|
+
const cmpParentName = (0, path_1.join)((0, path_1.dirname)(componentPath), fileNamePrefix);
|
|
43
42
|
switch (defType) {
|
|
44
43
|
case 'APPLICATION':
|
|
45
44
|
return `${cmpParentName}.app`;
|
|
@@ -73,26 +72,25 @@ function queryToFileMap(queryResult, mdComponent, overrideOutputPath) {
|
|
|
73
72
|
const typeName = mdComponent.type.name;
|
|
74
73
|
let apiVersion;
|
|
75
74
|
let status;
|
|
75
|
+
let record;
|
|
76
76
|
// If output is defined it overrides where the component will be stored
|
|
77
|
-
const mdSourcePath = overrideOutputPath
|
|
78
|
-
? utils_1.trimMetaXmlSuffix(overrideOutputPath)
|
|
79
|
-
: mdComponent.walkContent()[0];
|
|
77
|
+
const mdSourcePath = overrideOutputPath ? (0, utils_1.trimMetaXmlSuffix)(overrideOutputPath) : mdComponent.walkContent()[0];
|
|
80
78
|
const saveFilesMap = new Map();
|
|
81
79
|
switch (typeName) {
|
|
82
80
|
case 'ApexClass':
|
|
83
81
|
case 'ApexTrigger':
|
|
84
|
-
|
|
85
|
-
status =
|
|
86
|
-
apiVersion =
|
|
87
|
-
saveFilesMap.set(mdSourcePath,
|
|
82
|
+
record = queryResult.records[0];
|
|
83
|
+
status = record.Status;
|
|
84
|
+
apiVersion = record.ApiVersion;
|
|
85
|
+
saveFilesMap.set(mdSourcePath, record.Body);
|
|
88
86
|
break;
|
|
89
87
|
case 'ApexComponent':
|
|
90
88
|
case 'ApexPage':
|
|
91
|
-
|
|
92
|
-
apiVersion =
|
|
93
|
-
saveFilesMap.set(mdSourcePath,
|
|
89
|
+
record = queryResult.records[0];
|
|
90
|
+
apiVersion = record.ApiVersion;
|
|
91
|
+
saveFilesMap.set(mdSourcePath, record.Markup);
|
|
94
92
|
break;
|
|
95
|
-
case 'AuraDefinitionBundle':
|
|
93
|
+
case 'AuraDefinitionBundle': {
|
|
96
94
|
const auraRecord = queryResult.records;
|
|
97
95
|
apiVersion = auraRecord[0].AuraDefinitionBundle.ApiVersion;
|
|
98
96
|
auraRecord.forEach((item) => {
|
|
@@ -100,19 +98,21 @@ function queryToFileMap(queryResult, mdComponent, overrideOutputPath) {
|
|
|
100
98
|
saveFilesMap.set(cmpName, item.Source);
|
|
101
99
|
});
|
|
102
100
|
break;
|
|
103
|
-
|
|
101
|
+
}
|
|
102
|
+
case 'LightningComponentBundle': {
|
|
104
103
|
const lwcRecord = queryResult.records;
|
|
105
104
|
const bundleParentPath = mdSourcePath.substring(0, mdSourcePath.lastIndexOf(`${path_1.sep}lwc`));
|
|
106
105
|
lwcRecord.forEach((item) => {
|
|
107
|
-
const cmpName = path_1.join(bundleParentPath, item.FilePath);
|
|
106
|
+
const cmpName = (0, path_1.join)(bundleParentPath, item.FilePath);
|
|
108
107
|
saveFilesMap.set(cmpName, item.Source);
|
|
109
108
|
});
|
|
110
109
|
break;
|
|
110
|
+
}
|
|
111
111
|
default:
|
|
112
112
|
}
|
|
113
113
|
// NOTE: LightningComponentBundle query results returns the -meta.xml file
|
|
114
114
|
if (typeName !== 'LightningComponentBundle') {
|
|
115
|
-
saveFilesMap.set(utils_1.generateMetaXMLPath(mdSourcePath), utils_1.generateMetaXML(typeName, apiVersion, status));
|
|
115
|
+
saveFilesMap.set((0, utils_1.generateMetaXMLPath)(mdSourcePath), (0, utils_1.generateMetaXML)(typeName, apiVersion, status));
|
|
116
116
|
}
|
|
117
117
|
return saveFilesMap;
|
|
118
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieveUtil.js","sourceRoot":"","sources":["../../../src/client/retrieveUtil.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,+BAA0C;AAC1C,oCAAmF;AAInF,SAAgB,UAAU,CAAC,WAA4B,EAAE,SAAS,GAAG,EAAE;IACrE,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;IACvC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEtC,QAAQ,QAAQ,EAAE;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa;YAChB,WAAW,GAAG,mEAAmE,QAAQ,kBAAkB,QAAQ,4BAA4B,SAAS,GAAG,CAAC;YAC5J,MAAM;QACR,KAAK,eAAe,CAAC;QACrB,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gBACtD,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,MAAM;SACP;QACD,QAAQ;KACT;IAED,0EAA0E;IAC1E,IAAI,QAAQ,KAAK,0BAA0B,EAAE;QAC3C,YAAY,CAAC,GAAG,CAAC,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAE,IAAA,uBAAe,EAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;KACpG;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArDD,wCAqDC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
1
2
|
import { SourcePath } from '../common';
|
|
2
3
|
import { MetadataResolver, SourceComponent } from '../resolve';
|
|
3
|
-
import { SourceDeployResult, SourceRetrieveResult } from './types';
|
|
4
4
|
import { ComponentSet } from '../collections';
|
|
5
|
-
import { Connection } from '@salesforce/core';
|
|
6
5
|
import { RegistryAccess } from '../registry';
|
|
6
|
+
import { SourceDeployResult, SourceRetrieveResult } from './types';
|
|
7
7
|
declare type WithNamespace = {
|
|
8
8
|
namespace?: string;
|
|
9
9
|
};
|
|
@@ -1,29 +1,14 @@
|
|
|
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.ToolingApi = exports.deployTypes = void 0;
|
|
13
|
-
/*
|
|
14
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
15
|
-
* All rights reserved.
|
|
16
|
-
* Licensed under the BSD 3-Clause license.
|
|
17
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
18
|
-
*/
|
|
19
|
-
const deployStrategies_1 = require("./deployStrategies");
|
|
20
4
|
const errors_1 = require("../errors");
|
|
21
5
|
const i18n_1 = require("../i18n");
|
|
22
|
-
const retrieveUtil_1 = require("./retrieveUtil");
|
|
23
6
|
const utils_1 = require("../utils");
|
|
24
|
-
const types_1 = require("./types");
|
|
25
7
|
const collections_1 = require("../collections");
|
|
26
8
|
const registry_1 = require("../registry");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const retrieveUtil_1 = require("./retrieveUtil");
|
|
11
|
+
const deployStrategies_1 = require("./deployStrategies");
|
|
27
12
|
const retrieveTypes = new Set([
|
|
28
13
|
'ApexClass',
|
|
29
14
|
'ApexTrigger',
|
|
@@ -46,90 +31,82 @@ class ToolingApi {
|
|
|
46
31
|
this.resolver = resolver;
|
|
47
32
|
this.registry = registry;
|
|
48
33
|
}
|
|
49
|
-
retrieveWithPaths(options) {
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
components: collections_1.ComponentSet.fromSource({ fsPaths: [options.paths[0]], registry: this.registry }),
|
|
55
|
-
});
|
|
34
|
+
async retrieveWithPaths(options) {
|
|
35
|
+
return this.retrieve({
|
|
36
|
+
output: options.output,
|
|
37
|
+
namespace: options.namespace,
|
|
38
|
+
components: collections_1.ComponentSet.fromSource({ fsPaths: [options.paths[0]], registry: this.registry }),
|
|
56
39
|
});
|
|
57
40
|
}
|
|
58
|
-
retrieve(options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type: mdComponent.type,
|
|
86
|
-
},
|
|
87
|
-
message: i18n_1.nls.localize('error_md_not_present_in_org', mdComponent.fullName),
|
|
41
|
+
async retrieve(options) {
|
|
42
|
+
let retrieveResult;
|
|
43
|
+
if (options.components.size > 1) {
|
|
44
|
+
const retrieveError = new Error();
|
|
45
|
+
retrieveError.message = i18n_1.nls.localize('tapi_retrieve_component_limit_error');
|
|
46
|
+
retrieveError.name = 'MetadataRetrieveLimit';
|
|
47
|
+
throw retrieveError;
|
|
48
|
+
}
|
|
49
|
+
const mdComponent = options.components.getSourceComponents().first();
|
|
50
|
+
if (!retrieveTypes.has(mdComponent.type.name)) {
|
|
51
|
+
const retrieveError = new Error();
|
|
52
|
+
retrieveError.message = i18n_1.nls.localize('beta_tapi_membertype_unsupported_error', mdComponent.type.name);
|
|
53
|
+
retrieveError.name = 'MetadataTypeUnsupported';
|
|
54
|
+
throw retrieveError;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const queryResult = (await this.connection.tooling.query((0, retrieveUtil_1.buildQuery)(mdComponent, options.namespace)));
|
|
58
|
+
if (queryResult && queryResult.records.length === 0) {
|
|
59
|
+
return {
|
|
60
|
+
status: types_1.RequestStatus.Failed,
|
|
61
|
+
success: false,
|
|
62
|
+
successes: [],
|
|
63
|
+
failures: [
|
|
64
|
+
{
|
|
65
|
+
component: {
|
|
66
|
+
fullName: mdComponent.fullName,
|
|
67
|
+
type: mdComponent.type,
|
|
88
68
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const saveFilesMap = retrieveUtil_1.queryToFileMap(queryResult, mdComponent, options.output);
|
|
93
|
-
utils_1.createFiles(saveFilesMap);
|
|
94
|
-
retrieveResult = {
|
|
95
|
-
status: types_1.RequestStatus.Succeeded,
|
|
96
|
-
success: true,
|
|
97
|
-
successes: [{ component: mdComponent }],
|
|
98
|
-
failures: [],
|
|
69
|
+
message: i18n_1.nls.localize('error_md_not_present_in_org', mdComponent.fullName),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
99
72
|
};
|
|
100
73
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
74
|
+
const saveFilesMap = (0, retrieveUtil_1.queryToFileMap)(queryResult, mdComponent, options.output);
|
|
75
|
+
(0, utils_1.createFiles)(saveFilesMap);
|
|
76
|
+
retrieveResult = {
|
|
77
|
+
status: types_1.RequestStatus.Succeeded,
|
|
78
|
+
success: true,
|
|
79
|
+
successes: [{ component: mdComponent }],
|
|
80
|
+
failures: [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
throw new Error(i18n_1.nls.localize('error_in_tooling_retrieve', err));
|
|
85
|
+
}
|
|
86
|
+
return retrieveResult;
|
|
106
87
|
}
|
|
107
|
-
deploy(components, options) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
throw deployError;
|
|
114
|
-
}
|
|
115
|
-
mdComponent = components[0];
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
mdComponent = components;
|
|
88
|
+
async deploy(components, options) {
|
|
89
|
+
let mdComponent;
|
|
90
|
+
if (Array.isArray(components)) {
|
|
91
|
+
if (components.length > 1) {
|
|
92
|
+
const deployError = new errors_1.SourceClientError('tapi_deploy_component_limit_error');
|
|
93
|
+
throw deployError;
|
|
119
94
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
95
|
+
mdComponent = components[0];
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
mdComponent = components;
|
|
99
|
+
}
|
|
100
|
+
const metadataType = mdComponent.type.name;
|
|
101
|
+
if (!exports.deployTypes.get(metadataType)) {
|
|
102
|
+
throw new errors_1.SourceClientError('beta_tapi_membertype_unsupported_error', metadataType);
|
|
103
|
+
}
|
|
104
|
+
const deployStrategy = (0, deployStrategies_1.getDeployStrategy)(metadataType, this.connection);
|
|
105
|
+
const namespace = options && options.namespace ? options.namespace : '';
|
|
106
|
+
return deployStrategy.deploy(mdComponent, namespace);
|
|
128
107
|
}
|
|
129
|
-
deployWithPaths(path, options) {
|
|
130
|
-
return
|
|
131
|
-
return this.deploy(this.resolver.getComponentsFromPath(path), options);
|
|
132
|
-
});
|
|
108
|
+
async deployWithPaths(path, options) {
|
|
109
|
+
return this.deploy(this.resolver.getComponentsFromPath(path), options);
|
|
133
110
|
}
|
|
134
111
|
}
|
|
135
112
|
exports.ToolingApi = ToolingApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolingApi.js","sourceRoot":"","sources":["../../../src/client/toolingApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolingApi.js","sourceRoot":"","sources":["../../../src/client/toolingApi.ts"],"names":[],"mappings":";;;AAOA,sCAA8C;AAE9C,kCAA8B;AAC9B,oCAAuC;AAEvC,gDAA8C;AAC9C,0CAA6C;AAC7C,mCAA+F;AAC/F,iDAA4D;AAC5D,yDAAuD;AAMvD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,WAAW;IACX,aAAa;IACb,UAAU;IACV,eAAe;IACf,sBAAsB;IACtB,0BAA0B;CAC3B,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,IAAI,GAAG,CAAC;IACjC,CAAC,WAAW,EAAE,iBAAiB,CAAC;IAChC,CAAC,aAAa,EAAE,mBAAmB,CAAC;IACpC,CAA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
+
exports.RequestStatus = exports.ComponentStatus = void 0;
|
|
4
4
|
var ComponentStatus;
|
|
5
5
|
(function (ComponentStatus) {
|
|
6
6
|
ComponentStatus["Created"] = "Created";
|
|
@@ -30,17 +30,4 @@ var ManageableState;
|
|
|
30
30
|
ManageableState["Released"] = "released";
|
|
31
31
|
ManageableState["Unmanaged"] = "unmanaged";
|
|
32
32
|
})(ManageableState || (ManageableState = {}));
|
|
33
|
-
var ToolingDeployStatus;
|
|
34
|
-
(function (ToolingDeployStatus) {
|
|
35
|
-
// ContainerAsyncRequest states
|
|
36
|
-
ToolingDeployStatus["Queued"] = "Queued";
|
|
37
|
-
ToolingDeployStatus["Invalidated"] = "Invalidated";
|
|
38
|
-
ToolingDeployStatus["Error"] = "Error";
|
|
39
|
-
ToolingDeployStatus["Aborted"] = "Aborted";
|
|
40
|
-
// Shared
|
|
41
|
-
ToolingDeployStatus["Completed"] = "Completed";
|
|
42
|
-
ToolingDeployStatus["Failed"] = "Failed";
|
|
43
|
-
// unique to bundle requests
|
|
44
|
-
ToolingDeployStatus["CompletedPartial"] = "CompletedPartial";
|
|
45
|
-
})(ToolingDeployStatus = exports.ToolingDeployStatus || (exports.ToolingDeployStatus = {}));
|
|
46
33
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":";;;AAiBA,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,0CAAuB,CAAA;IACvB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AA+DD,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,kCAAiB,CAAA;IACjB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;AACvB,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB;AAkJD,IAAK,eASJ;AATD,WAAK,eAAe;IAClB,gCAAa,CAAA;IACb,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;IACzB,4DAAyC,CAAA;IACzC,0CAAuB,CAAA;IACvB,0DAAuC,CAAA;IACvC,wCAAqB,CAAA;IACrB,0CAAuB,CAAA;AACzB,CAAC,EATI,eAAe,KAAf,eAAe,QASnB
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":";;;AAiBA,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,0CAAuB,CAAA;IACvB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AA+DD,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,kCAAiB,CAAA;IACjB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;AACvB,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB;AAkJD,IAAK,eASJ;AATD,WAAK,eAAe;IAClB,gCAAa,CAAA;IACb,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;IACzB,4DAAyC,CAAA;IACzC,0CAAuB,CAAA;IACvB,0DAAuC,CAAA;IACvC,wCAAqB,CAAA;IACrB,0CAAuB,CAAA;AACzB,CAAC,EATI,eAAe,KAAf,eAAe,QASnB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MetadataApiDeploy, MetadataApiDeployOptions, MetadataApiRetrieve, MetadataApiRetrieveOptions } from '../client';
|
|
2
2
|
import { ComponentLike, MetadataComponent, SourceComponent } from '../resolve';
|
|
3
|
+
import { RegistryAccess } from '../registry';
|
|
3
4
|
import { DestructiveChangesType, FromManifestOptions, FromSourceOptions, PackageManifestObject } from './types';
|
|
4
5
|
import { LazyCollection } from './lazyCollection';
|
|
5
|
-
import { RegistryAccess } from '../registry';
|
|
6
6
|
export declare type DeploySetOptions = Omit<MetadataApiDeployOptions, 'components'>;
|
|
7
7
|
export declare type RetrieveSetOptions = Omit<MetadataApiRetrieveOptions, 'components'>;
|
|
8
8
|
/**
|
|
@@ -100,6 +100,7 @@ export declare class ComponentSet extends LazyCollection<MetadataComponent> {
|
|
|
100
100
|
retrieve(options: RetrieveSetOptions): Promise<MetadataApiRetrieve>;
|
|
101
101
|
/**
|
|
102
102
|
* Get an object representation of a package manifest based on the set components.
|
|
103
|
+
*
|
|
103
104
|
* @param destructiveType Optional value for generating objects representing destructive change manifests
|
|
104
105
|
* @returns Object representation of a package manifest
|
|
105
106
|
*/
|
|
@@ -156,6 +157,7 @@ export declare class ComponentSet extends LazyCollection<MetadataComponent> {
|
|
|
156
157
|
/**
|
|
157
158
|
* Will return the types of destructive changes in the component set
|
|
158
159
|
* or an empty array if there aren't destructive components present
|
|
160
|
+
*
|
|
159
161
|
* @return DestructiveChangesType[]
|
|
160
162
|
*/
|
|
161
163
|
getTypesOfDestructiveChanges(): DestructiveChangesType[];
|
|
@@ -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.ComponentSet = void 0;
|
|
13
4
|
/*
|
|
@@ -16,15 +7,16 @@ exports.ComponentSet = void 0;
|
|
|
16
7
|
* Licensed under the BSD 3-Clause license.
|
|
17
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
18
9
|
*/
|
|
10
|
+
/* eslint @typescript-eslint/unified-signatures:0 */
|
|
11
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
12
|
+
const core_1 = require("@salesforce/core");
|
|
19
13
|
const client_1 = require("../client");
|
|
20
14
|
const common_1 = require("../common");
|
|
21
15
|
const errors_1 = require("../errors");
|
|
22
16
|
const resolve_1 = require("../resolve");
|
|
17
|
+
const registry_1 = require("../registry");
|
|
23
18
|
const types_1 = require("./types");
|
|
24
19
|
const lazyCollection_1 = require("./lazyCollection");
|
|
25
|
-
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
26
|
-
const core_1 = require("@salesforce/core");
|
|
27
|
-
const registry_1 = require("../registry");
|
|
28
20
|
/**
|
|
29
21
|
* A collection containing no duplicate metadata members (`fullName` and `type` pairs). `ComponentSets`
|
|
30
22
|
* are a convinient way of constructing a unique collection of components to perform operations such as
|
|
@@ -50,9 +42,7 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
50
42
|
this.apiVersion = this.registry.apiVersion;
|
|
51
43
|
this.logger = core_1.Logger.childFromRoot(this.constructor.name);
|
|
52
44
|
for (const component of components) {
|
|
53
|
-
const destructiveType = component instanceof resolve_1.SourceComponent
|
|
54
|
-
? component.getDestructiveChangesType()
|
|
55
|
-
: this.destructiveChangesType;
|
|
45
|
+
const destructiveType = component instanceof resolve_1.SourceComponent ? component.getDestructiveChangesType() : this.destructiveChangesType;
|
|
56
46
|
this.add(component, destructiveType);
|
|
57
47
|
}
|
|
58
48
|
}
|
|
@@ -90,56 +80,52 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
90
80
|
set.forceIgnoredPaths = resolver.forceIgnoredPaths;
|
|
91
81
|
return set;
|
|
92
82
|
}
|
|
93
|
-
static fromManifest(input) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const addComponent = (component, deletionType) => {
|
|
106
|
-
if (resolveIncludeSet) {
|
|
107
|
-
resolveIncludeSet.add(component, deletionType);
|
|
108
|
-
}
|
|
109
|
-
const memberIsWildcard = component.fullName === ComponentSet.WILDCARD;
|
|
110
|
-
if (!memberIsWildcard || options.forceAddWildcards || !options.resolveSourcePaths) {
|
|
111
|
-
result.add(component, deletionType);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const resolveDestructiveChanges = (path, destructiveChangeType) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const manifest = yield manifestResolver.resolve(path);
|
|
116
|
-
for (const comp of manifest.components) {
|
|
117
|
-
addComponent(new resolve_1.SourceComponent({ type: comp.type, name: comp.fullName }), destructiveChangeType);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
if (options.destructivePre) {
|
|
121
|
-
yield resolveDestructiveChanges(options.destructivePre, types_1.DestructiveChangesType.PRE);
|
|
83
|
+
static async fromManifest(input) {
|
|
84
|
+
const manifestPath = typeof input === 'string' ? input : input.manifestPath;
|
|
85
|
+
const options = (typeof input === 'object' ? input : {});
|
|
86
|
+
const manifestResolver = new resolve_1.ManifestResolver(options.tree, options.registry);
|
|
87
|
+
const manifest = await manifestResolver.resolve(manifestPath);
|
|
88
|
+
const resolveIncludeSet = options.resolveSourcePaths ? new ComponentSet([], options.registry) : undefined;
|
|
89
|
+
const result = new ComponentSet([], options.registry);
|
|
90
|
+
result.apiVersion = manifest.apiVersion;
|
|
91
|
+
result.fullName = manifest.fullName;
|
|
92
|
+
const addComponent = (component, deletionType) => {
|
|
93
|
+
if (resolveIncludeSet) {
|
|
94
|
+
resolveIncludeSet.add(component, deletionType);
|
|
122
95
|
}
|
|
123
|
-
|
|
124
|
-
|
|
96
|
+
const memberIsWildcard = component.fullName === ComponentSet.WILDCARD;
|
|
97
|
+
if (!memberIsWildcard || options.forceAddWildcards || !options.resolveSourcePaths) {
|
|
98
|
+
result.add(component, deletionType);
|
|
125
99
|
}
|
|
126
|
-
|
|
127
|
-
|
|
100
|
+
};
|
|
101
|
+
const resolveDestructiveChanges = async (path, destructiveChangeType) => {
|
|
102
|
+
const destructiveManifest = await manifestResolver.resolve(path);
|
|
103
|
+
for (const comp of destructiveManifest.components) {
|
|
104
|
+
addComponent(new resolve_1.SourceComponent({ type: comp.type, name: comp.fullName }), destructiveChangeType);
|
|
128
105
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
106
|
+
};
|
|
107
|
+
if (options.destructivePre) {
|
|
108
|
+
await resolveDestructiveChanges(options.destructivePre, types_1.DestructiveChangesType.PRE);
|
|
109
|
+
}
|
|
110
|
+
if (options.destructivePost) {
|
|
111
|
+
await resolveDestructiveChanges(options.destructivePost, types_1.DestructiveChangesType.POST);
|
|
112
|
+
}
|
|
113
|
+
for (const component of manifest.components) {
|
|
114
|
+
addComponent(component);
|
|
115
|
+
}
|
|
116
|
+
if (options.resolveSourcePaths) {
|
|
117
|
+
const components = ComponentSet.fromSource({
|
|
118
|
+
fsPaths: options.resolveSourcePaths,
|
|
119
|
+
tree: options.tree,
|
|
120
|
+
include: resolveIncludeSet,
|
|
121
|
+
registry: options.registry,
|
|
122
|
+
});
|
|
123
|
+
result.forceIgnoredPaths = components.forceIgnoredPaths;
|
|
124
|
+
for (const component of components) {
|
|
125
|
+
result.add(component);
|
|
140
126
|
}
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
143
129
|
}
|
|
144
130
|
/**
|
|
145
131
|
* Constructs a deploy operation using the components in the set and starts
|
|
@@ -149,21 +135,19 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
149
135
|
* @param options
|
|
150
136
|
* @returns Metadata API deploy operation
|
|
151
137
|
*/
|
|
152
|
-
deploy(options) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
apiVersion: this.apiVersion,
|
|
162
|
-
});
|
|
163
|
-
const mdapiDeploy = new client_1.MetadataApiDeploy(operationOptions);
|
|
164
|
-
yield mdapiDeploy.start();
|
|
165
|
-
return mdapiDeploy;
|
|
138
|
+
async deploy(options) {
|
|
139
|
+
const toDeploy = Array.from(this.getSourceComponents());
|
|
140
|
+
if (toDeploy.length === 0) {
|
|
141
|
+
throw new errors_1.ComponentSetError('error_no_source_to_deploy');
|
|
142
|
+
}
|
|
143
|
+
const operationOptions = Object.assign({}, options, {
|
|
144
|
+
components: this,
|
|
145
|
+
registry: this.registry,
|
|
146
|
+
apiVersion: this.apiVersion,
|
|
166
147
|
});
|
|
148
|
+
const mdapiDeploy = new client_1.MetadataApiDeploy(operationOptions);
|
|
149
|
+
await mdapiDeploy.start();
|
|
150
|
+
return mdapiDeploy;
|
|
167
151
|
}
|
|
168
152
|
/**
|
|
169
153
|
* Constructs a retrieve operation using the components in the set and
|
|
@@ -172,20 +156,19 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
172
156
|
* @param options
|
|
173
157
|
* @returns Metadata API retrieve operation
|
|
174
158
|
*/
|
|
175
|
-
retrieve(options) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
apiVersion: this.apiVersion,
|
|
181
|
-
});
|
|
182
|
-
const mdapiRetrieve = new client_1.MetadataApiRetrieve(operationOptions);
|
|
183
|
-
yield mdapiRetrieve.start();
|
|
184
|
-
return mdapiRetrieve;
|
|
159
|
+
async retrieve(options) {
|
|
160
|
+
const operationOptions = Object.assign({}, options, {
|
|
161
|
+
components: this,
|
|
162
|
+
registry: this.registry,
|
|
163
|
+
apiVersion: this.apiVersion,
|
|
185
164
|
});
|
|
165
|
+
const mdapiRetrieve = new client_1.MetadataApiRetrieve(operationOptions);
|
|
166
|
+
await mdapiRetrieve.start();
|
|
167
|
+
return mdapiRetrieve;
|
|
186
168
|
}
|
|
187
169
|
/**
|
|
188
170
|
* Get an object representation of a package manifest based on the set components.
|
|
171
|
+
*
|
|
189
172
|
* @param destructiveType Optional value for generating objects representing destructive change manifests
|
|
190
173
|
* @returns Object representation of a package manifest
|
|
191
174
|
*/
|
|
@@ -195,9 +178,7 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
195
178
|
// all other components in the regular manifest.
|
|
196
179
|
let components = this.components;
|
|
197
180
|
if (this.getTypesOfDestructiveChanges().length) {
|
|
198
|
-
components = destructiveType
|
|
199
|
-
? this.destructiveComponents[destructiveType]
|
|
200
|
-
: this.manifestComponents;
|
|
181
|
+
components = destructiveType ? this.destructiveComponents[destructiveType] : this.manifestComponents;
|
|
201
182
|
}
|
|
202
183
|
const typeMap = new Map();
|
|
203
184
|
const addToTypeMap = (type, fullName) => {
|
|
@@ -404,6 +385,7 @@ class ComponentSet extends lazyCollection_1.LazyCollection {
|
|
|
404
385
|
/**
|
|
405
386
|
* Will return the types of destructive changes in the component set
|
|
406
387
|
* or an empty array if there aren't destructive components present
|
|
388
|
+
*
|
|
407
389
|
* @return DestructiveChangesType[]
|
|
408
390
|
*/
|
|
409
391
|
getTypesOfDestructiveChanges() {
|