@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,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.MetadataTransfer = void 0;
|
|
13
4
|
/*
|
|
@@ -16,15 +7,16 @@ exports.MetadataTransfer = 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
|
*/
|
|
19
|
-
const core_1 = require("@salesforce/core");
|
|
20
10
|
const events_1 = require("events");
|
|
21
|
-
const collections_1 = require("../collections");
|
|
22
|
-
const errors_1 = require("../errors");
|
|
23
|
-
const types_1 = require("./types");
|
|
24
|
-
const convert_1 = require("../convert");
|
|
25
11
|
const path_1 = require("path");
|
|
12
|
+
const core_1 = require("@salesforce/core");
|
|
26
13
|
const kit_1 = require("@salesforce/kit");
|
|
27
14
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
|
+
const fs = require("graceful-fs");
|
|
16
|
+
const convert_1 = require("../convert");
|
|
17
|
+
const errors_1 = require("../errors");
|
|
18
|
+
const collections_1 = require("../collections");
|
|
19
|
+
const types_1 = require("./types");
|
|
28
20
|
class MetadataTransfer {
|
|
29
21
|
constructor({ usernameOrConnection, components, apiVersion, id }) {
|
|
30
22
|
this.canceled = false;
|
|
@@ -32,69 +24,67 @@ class MetadataTransfer {
|
|
|
32
24
|
this.usernameOrConnection = usernameOrConnection;
|
|
33
25
|
this.components = components;
|
|
34
26
|
this.apiVersion = apiVersion;
|
|
35
|
-
this.
|
|
27
|
+
this.transferId = id;
|
|
36
28
|
this.logger = core_1.Logger.childFromRoot(this.constructor.name);
|
|
37
29
|
}
|
|
38
30
|
get id() {
|
|
39
|
-
return this.
|
|
31
|
+
return this.transferId;
|
|
40
32
|
}
|
|
41
33
|
/**
|
|
42
34
|
* Send the metadata transfer request to the org.
|
|
43
35
|
*
|
|
44
36
|
* @returns AsyncResult from the deploy or retrieve response.
|
|
45
37
|
*/
|
|
46
|
-
start() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return asyncResult;
|
|
53
|
-
});
|
|
38
|
+
async start() {
|
|
39
|
+
this.canceled = false;
|
|
40
|
+
const asyncResult = await this.pre();
|
|
41
|
+
this.transferId = asyncResult.id;
|
|
42
|
+
this.logger.debug(`Started metadata transfer. ID = ${this.id}`);
|
|
43
|
+
return asyncResult;
|
|
54
44
|
}
|
|
55
|
-
pollStatus(frequencyOrOptions, timeout) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
async pollStatus(frequencyOrOptions, timeout) {
|
|
46
|
+
let pollingOptions = {
|
|
47
|
+
frequency: kit_1.Duration.milliseconds(100),
|
|
48
|
+
timeout: kit_1.Duration.minutes(60),
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
50
|
+
poll: this.poll.bind(this),
|
|
51
|
+
};
|
|
52
|
+
if ((0, ts_types_1.isNumber)(frequencyOrOptions)) {
|
|
53
|
+
pollingOptions.frequency = kit_1.Duration.milliseconds(frequencyOrOptions);
|
|
54
|
+
}
|
|
55
|
+
else if (frequencyOrOptions !== undefined) {
|
|
56
|
+
pollingOptions = { ...pollingOptions, ...frequencyOrOptions };
|
|
57
|
+
}
|
|
58
|
+
if ((0, ts_types_1.isNumber)(timeout)) {
|
|
59
|
+
pollingOptions.timeout = kit_1.Duration.seconds(timeout);
|
|
60
|
+
}
|
|
61
|
+
const pollingClient = await core_1.PollingClient.create(pollingOptions);
|
|
62
|
+
try {
|
|
63
|
+
this.logger.debug(`Polling for metadata transfer status. ID = ${this.id}`);
|
|
64
|
+
this.logger.debug(`Polling frequency (ms): ${pollingOptions.frequency.milliseconds}`);
|
|
65
|
+
this.logger.debug(`Polling timeout (min): ${pollingOptions.timeout.minutes}`);
|
|
66
|
+
const completedMdapiStatus = (await pollingClient.subscribe());
|
|
67
|
+
const result = await this.post(completedMdapiStatus);
|
|
68
|
+
if (completedMdapiStatus.status === types_1.RequestStatus.Canceled) {
|
|
69
|
+
this.event.emit('cancel', completedMdapiStatus);
|
|
64
70
|
}
|
|
65
|
-
else
|
|
66
|
-
|
|
71
|
+
else {
|
|
72
|
+
this.event.emit('finish', result);
|
|
67
73
|
}
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
const err = e;
|
|
78
|
+
const error = new errors_1.MetadataTransferError('md_request_fail', err.message);
|
|
79
|
+
if (error.stack && err.stack) {
|
|
80
|
+
// append the original stack to this new error
|
|
81
|
+
error.stack += `\nDUE TO:\n${err.stack}`;
|
|
70
82
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.logger.debug(`Polling for metadata transfer status. ID = ${this.id}`);
|
|
74
|
-
this.logger.debug(`Polling frequency (ms): ${pollingOptions.frequency.milliseconds}`);
|
|
75
|
-
this.logger.debug(`Polling timeout (min): ${pollingOptions.timeout.minutes}`);
|
|
76
|
-
const completedMdapiStatus = (yield pollingClient.subscribe());
|
|
77
|
-
const result = yield this.post(completedMdapiStatus);
|
|
78
|
-
if (completedMdapiStatus.status === types_1.RequestStatus.Canceled) {
|
|
79
|
-
this.event.emit('cancel', completedMdapiStatus);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.event.emit('finish', result);
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
83
|
+
if (this.event.listenerCount('error') === 0) {
|
|
84
|
+
throw error;
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (error.stack && e.stack) {
|
|
89
|
-
// append the original stack to this new error
|
|
90
|
-
error.stack += `\nDUE TO:\n${e.stack}`;
|
|
91
|
-
}
|
|
92
|
-
if (this.event.listenerCount('error') === 0) {
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
this.event.emit('error', error);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
86
|
+
this.event.emit('error', error);
|
|
87
|
+
}
|
|
98
88
|
}
|
|
99
89
|
onUpdate(subscriber) {
|
|
100
90
|
this.event.on('update', subscriber);
|
|
@@ -108,68 +98,62 @@ class MetadataTransfer {
|
|
|
108
98
|
onError(subscriber) {
|
|
109
99
|
this.event.on('error', subscriber);
|
|
110
100
|
}
|
|
111
|
-
maybeSaveTempDirectory(target, cs) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
core_1.fs.writeFileSync(path_1.join(mdapiTempDir, 'package.xml'), source.getPackageXml());
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
this.logger.debug(e);
|
|
101
|
+
async maybeSaveTempDirectory(target, cs) {
|
|
102
|
+
const mdapiTempDir = process.env.SFDX_MDAPI_TEMP_DIR;
|
|
103
|
+
if (mdapiTempDir) {
|
|
104
|
+
process.emitWarning('The SFDX_MDAPI_TEMP_DIR environment variable is set, which may degrade performance');
|
|
105
|
+
this.logger.debug(`Converting metadata to: ${mdapiTempDir} because the SFDX_MDAPI_TEMP_DIR environment variable is set`);
|
|
106
|
+
try {
|
|
107
|
+
const source = cs || this.components || new collections_1.ComponentSet();
|
|
108
|
+
const converter = new convert_1.MetadataConverter();
|
|
109
|
+
await converter.convert(source, target, {
|
|
110
|
+
type: 'directory',
|
|
111
|
+
outputDirectory: mdapiTempDir,
|
|
112
|
+
});
|
|
113
|
+
if (target === 'source') {
|
|
114
|
+
// for source convert the package.xml isn't included so write it separately
|
|
115
|
+
fs.writeFileSync((0, path_1.join)(mdapiTempDir, 'package.xml'), source.getPackageXml());
|
|
131
116
|
}
|
|
132
117
|
}
|
|
133
|
-
|
|
118
|
+
catch (e) {
|
|
119
|
+
this.logger.debug(e);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
134
122
|
}
|
|
135
|
-
getConnection() {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.logger.debug(`Overriding apiVersion to: ${this.apiVersion}`);
|
|
144
|
-
}
|
|
123
|
+
async getConnection() {
|
|
124
|
+
if (typeof this.usernameOrConnection === 'string') {
|
|
125
|
+
this.usernameOrConnection = await core_1.Connection.create({
|
|
126
|
+
authInfo: await core_1.AuthInfo.create({ username: this.usernameOrConnection }),
|
|
127
|
+
});
|
|
128
|
+
if (this.apiVersion && this.apiVersion !== this.usernameOrConnection.version) {
|
|
129
|
+
this.usernameOrConnection.setApiVersion(this.apiVersion);
|
|
130
|
+
this.logger.debug(`Overriding apiVersion to: ${this.apiVersion}`);
|
|
145
131
|
}
|
|
146
|
-
|
|
147
|
-
|
|
132
|
+
}
|
|
133
|
+
return this.usernameOrConnection;
|
|
148
134
|
}
|
|
149
|
-
poll() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
mdapiStatus = { id: this.id, success: false, done: true };
|
|
158
|
-
}
|
|
159
|
-
mdapiStatus.status = types_1.RequestStatus.Canceled;
|
|
160
|
-
completed = true;
|
|
161
|
-
this.canceled = false;
|
|
135
|
+
async poll() {
|
|
136
|
+
let completed = false;
|
|
137
|
+
let mdapiStatus;
|
|
138
|
+
if (this.canceled) {
|
|
139
|
+
// This only happens for a canceled retrieve. Canceled deploys are
|
|
140
|
+
// handled via checkStatus response.
|
|
141
|
+
if (!mdapiStatus) {
|
|
142
|
+
mdapiStatus = { id: this.id, success: false, done: true };
|
|
162
143
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
144
|
+
mdapiStatus.status = types_1.RequestStatus.Canceled;
|
|
145
|
+
completed = true;
|
|
146
|
+
this.canceled = false;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
mdapiStatus = await this.checkStatus();
|
|
150
|
+
completed = mdapiStatus === null || mdapiStatus === void 0 ? void 0 : mdapiStatus.done;
|
|
151
|
+
if (!completed) {
|
|
152
|
+
this.event.emit('update', mdapiStatus);
|
|
169
153
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
154
|
+
}
|
|
155
|
+
this.logger.debug(`MDAPI status update: ${mdapiStatus.status}`);
|
|
156
|
+
return { completed, payload: mdapiStatus };
|
|
173
157
|
}
|
|
174
158
|
}
|
|
175
159
|
exports.MetadataTransfer = MetadataTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadataTransfer.js","sourceRoot":"","sources":["../../../src/client/metadataTransfer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadataTransfer.js","sourceRoot":"","sources":["../../../src/client/metadataTransfer.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,mCAAsC;AACtC,+BAA4B;AAC5B,2CAA6F;AAC7F,yCAA2C;AAC3C,mDAAyD;AACzD,kCAAkC;AAClC,wCAA+D;AAC/D,sCAAkD;AAClD,gDAA8C;AAC9C,mCAAoG;AASpG,MAAsB,gBAAgB;IASpC,YAAmB,EAAE,oBAAoB,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAA2B;QANtF,aAAQ,GAAG,KAAK,CAAC;QAEnB,UAAK,GAAG,IAAI,qBAAY,EAAE,CAAC;QAKjC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,aAAM,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,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ve';
|
|
2
|
+
import { QueryResult } from './types';
|
|
3
3
|
export declare function buildQuery(mdComponent: SourceComponent, namespace?: string): string;
|
|
4
4
|
export declare function queryToFileMap(queryResult: QueryResult, mdComponent: SourceComponent, overrideOutputPath?: string): Map<string, string>;
|
|
@@ -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,KAAK,UAAU;YACb,WAAW,GAAG,6DAA6D,QAAQ,kBAAkB,QAAQ,4BAA4B,SAAS,GAAG,CAAC;YACtJ,MAAM;QACR,KAAK,sBAAsB;YACzB,WAAW
|
|
1
|
+
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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;
|