@salesforce/source-deploy-retrieve 5.0.0 → 5.1.0
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 +50 -44
- 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 +5 -2
- package/lib/src/collections/componentSet.js +77 -91
- 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} +35 -2
- package/lib/src/registry/nonSupportedTypes.js +5 -7
- package/lib/src/registry/nonSupportedTypes.js.map +1 -1
- package/lib/src/registry/registry.d.ts +33 -0
- 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 +9 -1
- package/lib/src/resolve/treeContainers.js +46 -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 +40 -38
|
@@ -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.MetadataApiRetrieve = exports.RetrieveResult = void 0;
|
|
13
4
|
/*
|
|
@@ -16,14 +7,14 @@ exports.MetadataApiRetrieve = exports.RetrieveResult = 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
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
19
11
|
const convert_1 = require("../convert");
|
|
20
12
|
const collections_1 = require("../collections");
|
|
21
13
|
const resolve_1 = require("../resolve");
|
|
22
|
-
const types_1 = require("./types");
|
|
23
|
-
const metadataTransfer_1 = require("./metadataTransfer");
|
|
24
14
|
const errors_1 = require("../errors");
|
|
25
15
|
const utils_1 = require("../utils");
|
|
26
|
-
const
|
|
16
|
+
const metadataTransfer_1 = require("./metadataTransfer");
|
|
17
|
+
const types_1 = require("./types");
|
|
27
18
|
class RetrieveResult {
|
|
28
19
|
/**
|
|
29
20
|
* @param response The metadata retrieve response from the server
|
|
@@ -42,10 +33,10 @@ class RetrieveResult {
|
|
|
42
33
|
this.fileResponses = [];
|
|
43
34
|
// construct failures
|
|
44
35
|
if (this.response.messages) {
|
|
45
|
-
const retrieveMessages = utils_1.normalizeToArray(this.response.messages);
|
|
36
|
+
const retrieveMessages = (0, utils_1.normalizeToArray)(this.response.messages);
|
|
46
37
|
for (const message of retrieveMessages) {
|
|
47
38
|
// match type name and fullname of problem component
|
|
48
|
-
const matches =
|
|
39
|
+
const matches = new RegExp(/.+'(.+)'.+'(.+)'/).exec(message.problem);
|
|
49
40
|
if (matches) {
|
|
50
41
|
const [typeName, fullName] = matches.slice(1);
|
|
51
42
|
this.fileResponses.push({
|
|
@@ -73,9 +64,7 @@ class RetrieveResult {
|
|
|
73
64
|
const baseResponse = {
|
|
74
65
|
fullName,
|
|
75
66
|
type: type.name,
|
|
76
|
-
state: this.localComponents.has(retrievedComponent)
|
|
77
|
-
? types_1.ComponentStatus.Changed
|
|
78
|
-
: types_1.ComponentStatus.Created,
|
|
67
|
+
state: this.localComponents.has(retrievedComponent) ? types_1.ComponentStatus.Changed : types_1.ComponentStatus.Created,
|
|
79
68
|
};
|
|
80
69
|
if (!type.children) {
|
|
81
70
|
for (const filePath of retrievedComponent.walkContent()) {
|
|
@@ -100,25 +89,23 @@ class MetadataApiRetrieve extends metadataTransfer_1.MetadataTransfer {
|
|
|
100
89
|
*
|
|
101
90
|
* @returns Status of the retrieve
|
|
102
91
|
*/
|
|
103
|
-
checkStatus() {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
async checkStatus() {
|
|
93
|
+
if (!this.id) {
|
|
94
|
+
throw new errors_1.MissingJobIdError('retrieve');
|
|
95
|
+
}
|
|
96
|
+
const coerceBoolean = (field) => {
|
|
97
|
+
if ((0, ts_types_1.isString)(field)) {
|
|
98
|
+
return field.toLowerCase() === 'true';
|
|
107
99
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
status.fileProperties = utils_1.normalizeToArray(status.fileProperties);
|
|
118
|
-
status.success = coerceBoolean(status.success);
|
|
119
|
-
status.done = coerceBoolean(status.done);
|
|
120
|
-
return status;
|
|
121
|
-
});
|
|
100
|
+
return (0, ts_types_1.asBoolean)(field, false);
|
|
101
|
+
};
|
|
102
|
+
const connection = await this.getConnection();
|
|
103
|
+
// Cast RetrieveResult returned by jsForce to MetadataApiRetrieveStatus
|
|
104
|
+
const status = (await connection.metadata.checkRetrieveStatus(this.id));
|
|
105
|
+
status.fileProperties = (0, utils_1.normalizeToArray)(status.fileProperties);
|
|
106
|
+
status.success = coerceBoolean(status.success);
|
|
107
|
+
status.done = coerceBoolean(status.done);
|
|
108
|
+
return status;
|
|
122
109
|
}
|
|
123
110
|
/**
|
|
124
111
|
* Cancel the retrieve operation.
|
|
@@ -126,41 +113,37 @@ class MetadataApiRetrieve extends metadataTransfer_1.MetadataTransfer {
|
|
|
126
113
|
* Canceling a retrieve occurs immediately and requires no additional status
|
|
127
114
|
* checks to the org, unlike {@link MetadataApiDeploy.cancel}.
|
|
128
115
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
117
|
+
async cancel() {
|
|
118
|
+
this.canceled = true;
|
|
133
119
|
}
|
|
134
|
-
pre() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
120
|
+
async pre() {
|
|
121
|
+
const packageNames = this.getPackageNames();
|
|
122
|
+
if (this.components.size === 0 && !(packageNames === null || packageNames === void 0 ? void 0 : packageNames.length)) {
|
|
123
|
+
throw new errors_1.MetadataApiRetrieveError('error_no_components_to_retrieve');
|
|
124
|
+
}
|
|
125
|
+
const connection = await this.getConnection();
|
|
126
|
+
const requestBody = {
|
|
127
|
+
apiVersion: this.components.apiVersion,
|
|
128
|
+
unpackaged: this.components.getObject().Package,
|
|
129
|
+
};
|
|
130
|
+
// if we're retrieving with packageNames add it
|
|
131
|
+
// otherwise don't - it causes errors if undefined or an empty array
|
|
132
|
+
if (packageNames === null || packageNames === void 0 ? void 0 : packageNames.length) {
|
|
133
|
+
requestBody.packageNames = packageNames;
|
|
134
|
+
}
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
136
|
+
// @ts-ignore required callback
|
|
137
|
+
return connection.metadata.retrieve(requestBody);
|
|
153
138
|
}
|
|
154
|
-
post(result) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return new RetrieveResult(result, components, this.components);
|
|
163
|
-
});
|
|
139
|
+
async post(result) {
|
|
140
|
+
let components;
|
|
141
|
+
if (result.status === types_1.RequestStatus.Succeeded) {
|
|
142
|
+
components = await this.extract(Buffer.from(result.zipFile, 'base64'));
|
|
143
|
+
}
|
|
144
|
+
components = components !== null && components !== void 0 ? components : new collections_1.ComponentSet(undefined, this.options.registry);
|
|
145
|
+
await this.maybeSaveTempDirectory('source', components);
|
|
146
|
+
return new RetrieveResult(result, components, this.components);
|
|
164
147
|
}
|
|
165
148
|
getPackageNames() {
|
|
166
149
|
var _a;
|
|
@@ -169,7 +152,7 @@ class MetadataApiRetrieve extends metadataTransfer_1.MetadataTransfer {
|
|
|
169
152
|
getPackageOptions() {
|
|
170
153
|
const { packageOptions } = this.options;
|
|
171
154
|
if (packageOptions === null || packageOptions === void 0 ? void 0 : packageOptions.length) {
|
|
172
|
-
if (ts_types_1.isString(packageOptions[0])) {
|
|
155
|
+
if ((0, ts_types_1.isString)(packageOptions[0])) {
|
|
173
156
|
const packageNames = packageOptions;
|
|
174
157
|
return packageNames.map((pkg) => ({ name: pkg, outputDir: pkg }));
|
|
175
158
|
}
|
|
@@ -180,46 +163,43 @@ class MetadataApiRetrieve extends metadataTransfer_1.MetadataTransfer {
|
|
|
180
163
|
}
|
|
181
164
|
}
|
|
182
165
|
}
|
|
183
|
-
extract(zip) {
|
|
166
|
+
async extract(zip) {
|
|
184
167
|
var _a;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
defaultDirectory: pkg.outputDir,
|
|
203
|
-
forceIgnoredPaths: (_a = this.components.forceIgnoredPaths) !== null && _a !== void 0 ? _a : new Set(),
|
|
204
|
-
}
|
|
205
|
-
: {
|
|
206
|
-
type: 'directory',
|
|
207
|
-
outputDirectory: pkg.outputDir,
|
|
208
|
-
};
|
|
209
|
-
const zipComponents = collections_1.ComponentSet.fromSource({
|
|
210
|
-
fsPaths: [pkg.zipTreeLocation],
|
|
211
|
-
registry,
|
|
212
|
-
tree,
|
|
213
|
-
})
|
|
214
|
-
.getSourceComponents()
|
|
215
|
-
.toArray();
|
|
216
|
-
const convertResult = yield converter.convert(zipComponents, 'source', outputConfig);
|
|
217
|
-
if (convertResult) {
|
|
218
|
-
components.push(...convertResult.converted);
|
|
168
|
+
const components = [];
|
|
169
|
+
const { merge, output, registry } = this.options;
|
|
170
|
+
const converter = new convert_1.MetadataConverter(registry);
|
|
171
|
+
const tree = await resolve_1.ZipTreeContainer.create(zip);
|
|
172
|
+
const packages = [{ zipTreeLocation: 'unpackaged', outputDir: output }];
|
|
173
|
+
const packageOpts = this.getPackageOptions();
|
|
174
|
+
// eslint-disable-next-line no-unused-expressions
|
|
175
|
+
packageOpts === null || packageOpts === void 0 ? void 0 : packageOpts.forEach(({ name, outputDir }) => {
|
|
176
|
+
packages.push({ zipTreeLocation: name, outputDir });
|
|
177
|
+
});
|
|
178
|
+
for (const pkg of packages) {
|
|
179
|
+
const outputConfig = merge
|
|
180
|
+
? {
|
|
181
|
+
type: 'merge',
|
|
182
|
+
mergeWith: this.components.getSourceComponents(),
|
|
183
|
+
defaultDirectory: pkg.outputDir,
|
|
184
|
+
forceIgnoredPaths: (_a = this.components.forceIgnoredPaths) !== null && _a !== void 0 ? _a : new Set(),
|
|
219
185
|
}
|
|
186
|
+
: {
|
|
187
|
+
type: 'directory',
|
|
188
|
+
outputDirectory: pkg.outputDir,
|
|
189
|
+
};
|
|
190
|
+
const zipComponents = collections_1.ComponentSet.fromSource({
|
|
191
|
+
fsPaths: [pkg.zipTreeLocation],
|
|
192
|
+
registry,
|
|
193
|
+
tree,
|
|
194
|
+
})
|
|
195
|
+
.getSourceComponents()
|
|
196
|
+
.toArray();
|
|
197
|
+
const convertResult = await converter.convert(zipComponents, 'source', outputConfig);
|
|
198
|
+
if (convertResult) {
|
|
199
|
+
components.push(...convertResult.converted);
|
|
220
200
|
}
|
|
221
|
-
|
|
222
|
-
|
|
201
|
+
}
|
|
202
|
+
return new collections_1.ComponentSet(components, registry);
|
|
223
203
|
}
|
|
224
204
|
}
|
|
225
205
|
exports.MetadataApiRetrieve = MetadataApiRetrieve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadataApiRetrieve.js","sourceRoot":"","sources":["../../../src/client/metadataApiRetrieve.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2
|
+
import { SfdxFileFormat } from '../convert';
|
|
2
3
|
import { ComponentSet } from '../collections';
|
|
3
4
|
import { AsyncResult, MetadataRequestStatus, MetadataTransferResult } from './types';
|
|
4
|
-
import { SfdxFileFormat } from '../convert';
|
|
5
5
|
export interface MetadataTransferOptions {
|
|
6
6
|
usernameOrConnection: string | Connection;
|
|
7
7
|
components?: ComponentSet;
|
|
@@ -12,7 +12,7 @@ export declare abstract class MetadataTransfer<Status extends MetadataRequestSta
|
|
|
12
12
|
protected components: ComponentSet;
|
|
13
13
|
protected logger: Logger;
|
|
14
14
|
protected canceled: boolean;
|
|
15
|
-
private
|
|
15
|
+
private transferId?;
|
|
16
16
|
private event;
|
|
17
17
|
private usernameOrConnection;
|
|
18
18
|
private apiVersion;
|
|
@@ -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,16 +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");
|
|
28
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");
|
|
29
20
|
class MetadataTransfer {
|
|
30
21
|
constructor({ usernameOrConnection, components, apiVersion, id }) {
|
|
31
22
|
this.canceled = false;
|
|
@@ -33,69 +24,67 @@ class MetadataTransfer {
|
|
|
33
24
|
this.usernameOrConnection = usernameOrConnection;
|
|
34
25
|
this.components = components;
|
|
35
26
|
this.apiVersion = apiVersion;
|
|
36
|
-
this.
|
|
27
|
+
this.transferId = id;
|
|
37
28
|
this.logger = core_1.Logger.childFromRoot(this.constructor.name);
|
|
38
29
|
}
|
|
39
30
|
get id() {
|
|
40
|
-
return this.
|
|
31
|
+
return this.transferId;
|
|
41
32
|
}
|
|
42
33
|
/**
|
|
43
34
|
* Send the metadata transfer request to the org.
|
|
44
35
|
*
|
|
45
36
|
* @returns AsyncResult from the deploy or retrieve response.
|
|
46
37
|
*/
|
|
47
|
-
start() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return asyncResult;
|
|
54
|
-
});
|
|
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;
|
|
55
44
|
}
|
|
56
|
-
pollStatus(frequencyOrOptions, timeout) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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);
|
|
65
70
|
}
|
|
66
|
-
else
|
|
67
|
-
|
|
71
|
+
else {
|
|
72
|
+
this.event.emit('finish', result);
|
|
68
73
|
}
|
|
69
|
-
|
|
70
|
-
|
|
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}`;
|
|
71
82
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.logger.debug(`Polling for metadata transfer status. ID = ${this.id}`);
|
|
75
|
-
this.logger.debug(`Polling frequency (ms): ${pollingOptions.frequency.milliseconds}`);
|
|
76
|
-
this.logger.debug(`Polling timeout (min): ${pollingOptions.timeout.minutes}`);
|
|
77
|
-
const completedMdapiStatus = (yield pollingClient.subscribe());
|
|
78
|
-
const result = yield this.post(completedMdapiStatus);
|
|
79
|
-
if (completedMdapiStatus.status === types_1.RequestStatus.Canceled) {
|
|
80
|
-
this.event.emit('cancel', completedMdapiStatus);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.event.emit('finish', result);
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
83
|
+
if (this.event.listenerCount('error') === 0) {
|
|
84
|
+
throw error;
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (error.stack && e.stack) {
|
|
90
|
-
// append the original stack to this new error
|
|
91
|
-
error.stack += `\nDUE TO:\n${e.stack}`;
|
|
92
|
-
}
|
|
93
|
-
if (this.event.listenerCount('error') === 0) {
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
this.event.emit('error', error);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
86
|
+
this.event.emit('error', error);
|
|
87
|
+
}
|
|
99
88
|
}
|
|
100
89
|
onUpdate(subscriber) {
|
|
101
90
|
this.event.on('update', subscriber);
|
|
@@ -109,68 +98,62 @@ class MetadataTransfer {
|
|
|
109
98
|
onError(subscriber) {
|
|
110
99
|
this.event.on('error', subscriber);
|
|
111
100
|
}
|
|
112
|
-
maybeSaveTempDirectory(target, cs) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
fs.writeFileSync(path_1.join(mdapiTempDir, 'package.xml'), source.getPackageXml());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
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());
|
|
132
116
|
}
|
|
133
117
|
}
|
|
134
|
-
|
|
118
|
+
catch (e) {
|
|
119
|
+
this.logger.debug(e);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
135
122
|
}
|
|
136
|
-
getConnection() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.logger.debug(`Overriding apiVersion to: ${this.apiVersion}`);
|
|
145
|
-
}
|
|
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}`);
|
|
146
131
|
}
|
|
147
|
-
|
|
148
|
-
|
|
132
|
+
}
|
|
133
|
+
return this.usernameOrConnection;
|
|
149
134
|
}
|
|
150
|
-
poll() {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
mdapiStatus = { id: this.id, success: false, done: true };
|
|
159
|
-
}
|
|
160
|
-
mdapiStatus.status = types_1.RequestStatus.Canceled;
|
|
161
|
-
completed = true;
|
|
162
|
-
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 };
|
|
163
143
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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);
|
|
170
153
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
154
|
+
}
|
|
155
|
+
this.logger.debug(`MDAPI status update: ${mdapiStatus.status}`);
|
|
156
|
+
return { completed, payload: mdapiStatus };
|
|
174
157
|
}
|
|
175
158
|
}
|
|
176
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,UAAU,GAAG,WAAW,CAAC,EAAE,CAAC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
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>;
|