@salesforce/plugin-deploy-retrieve 1.2.1 → 1.4.1
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 +22 -0
- package/README.md +385 -7
- package/lib/commands/deploy/metadata/cancel.d.ts +18 -0
- package/lib/commands/deploy/metadata/cancel.js +86 -0
- package/lib/commands/deploy/metadata/cancel.js.map +1 -0
- package/lib/commands/deploy/metadata/quick.d.ts +23 -0
- package/lib/commands/deploy/metadata/quick.js +116 -0
- package/lib/commands/deploy/metadata/quick.js.map +1 -0
- package/lib/commands/deploy/metadata/report.d.ts +14 -0
- package/lib/commands/deploy/metadata/report.js +54 -0
- package/lib/commands/deploy/metadata/report.js.map +1 -0
- package/lib/commands/deploy/metadata/resume.d.ts +21 -0
- package/lib/commands/deploy/metadata/resume.js +89 -0
- package/lib/commands/deploy/metadata/resume.js.map +1 -0
- package/lib/commands/deploy/metadata/validate.d.ts +27 -0
- package/lib/commands/deploy/metadata/validate.js +136 -0
- package/lib/commands/deploy/metadata/validate.js.map +1 -0
- package/lib/commands/deploy/metadata.d.ts +8 -9
- package/lib/commands/deploy/metadata.js +41 -15
- package/lib/commands/deploy/metadata.js.map +1 -1
- package/lib/commands/deploy.d.ts +2 -0
- package/lib/commands/deploy.js +19 -0
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/retrieve/metadata.d.ts +5 -6
- package/lib/commands/retrieve/metadata.js +12 -25
- package/lib/commands/retrieve/metadata.js.map +1 -1
- package/lib/configMeta.d.ts +17 -0
- package/lib/configMeta.js +31 -0
- package/lib/configMeta.js.map +1 -0
- package/lib/utils/deploy.d.ts +26 -7
- package/lib/utils/deploy.js +114 -24
- package/lib/utils/deploy.js.map +1 -1
- package/lib/utils/errorCodes.d.ts +3 -0
- package/lib/utils/errorCodes.js +26 -0
- package/lib/utils/errorCodes.js.map +1 -0
- package/lib/utils/metadataDeployer.js +7 -4
- package/lib/utils/metadataDeployer.js.map +1 -1
- package/lib/utils/output.d.ts +65 -8
- package/lib/utils/output.js +320 -169
- package/lib/utils/output.js.map +1 -1
- package/lib/utils/types.d.ts +11 -5
- package/lib/utils/types.js.map +1 -1
- package/messages/cache.md +7 -0
- package/messages/config.md +7 -0
- package/messages/deploy.async.md +19 -0
- package/messages/deploy.md +8 -0
- package/messages/deploy.metadata.cancel.md +62 -0
- package/messages/deploy.metadata.md +17 -3
- package/messages/deploy.metadata.quick.md +81 -0
- package/messages/deploy.metadata.report.md +42 -0
- package/messages/deploy.metadata.resume.md +58 -0
- package/messages/deploy.metadata.validate.md +123 -0
- package/messages/errorCodes.md +27 -0
- package/oclif.manifest.json +1 -1
- package/package.json +16 -9
- package/schemas/deploy-metadata-cancel.json +664 -0
- package/schemas/deploy-metadata-quick.json +664 -0
- package/schemas/deploy-metadata-report.json +664 -0
- package/schemas/deploy-metadata-resume.json +664 -0
- package/schemas/deploy-metadata-validate.json +664 -0
- package/schemas/deploy-metadata.json +592 -29
- package/schemas/hooks/sf-deploy.json +15 -5
- package/schemas/retrieve-metadata.json +178 -11
|
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
* Licensed under the BSD 3-Clause license.
|
|
7
7
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
8
|
*/
|
|
9
|
+
const chalk_1 = require("chalk");
|
|
9
10
|
const core_1 = require("@salesforce/core");
|
|
10
|
-
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
11
11
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
12
|
const output_1 = require("../../utils/output");
|
|
13
13
|
const progressBar_1 = require("../../utils/progressBar");
|
|
14
14
|
const types_1 = require("../../utils/types");
|
|
15
15
|
const deploy_1 = require("../../utils/deploy");
|
|
16
|
+
const errorCodes_1 = require("../../utils/errorCodes");
|
|
17
|
+
const configMeta_1 = require("../../configMeta");
|
|
16
18
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
19
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata');
|
|
18
20
|
class DeployMetadata extends sf_plugins_core_1.SfCommand {
|
|
@@ -21,7 +23,7 @@ class DeployMetadata extends sf_plugins_core_1.SfCommand {
|
|
|
21
23
|
if (!(0, deploy_1.validateTests)(flags['test-level'], flags.tests)) {
|
|
22
24
|
throw messages.createError('error.NoTestsSpecified');
|
|
23
25
|
}
|
|
24
|
-
const api = (0, deploy_1.
|
|
26
|
+
const api = await (0, deploy_1.resolveApi)();
|
|
25
27
|
const { deploy, componentSet } = await (0, deploy_1.executeDeploy)({
|
|
26
28
|
...flags,
|
|
27
29
|
'target-org': flags['target-org'].getUsername(),
|
|
@@ -29,25 +31,36 @@ class DeployMetadata extends sf_plugins_core_1.SfCommand {
|
|
|
29
31
|
});
|
|
30
32
|
const action = flags['dry-run'] ? 'Deploying (dry-run)' : 'Deploying';
|
|
31
33
|
this.log((0, output_1.getVersionMessage)(action, componentSet, api));
|
|
32
|
-
this.log(`Deploy ID: ${deploy.id}`);
|
|
34
|
+
this.log(`Deploy ID: ${(0, chalk_1.bold)(deploy.id)}`);
|
|
35
|
+
if (flags.async) {
|
|
36
|
+
const asyncFormatter = new output_1.AsyncDeployResultFormatter(deploy.id);
|
|
37
|
+
if (!this.jsonEnabled())
|
|
38
|
+
asyncFormatter.display();
|
|
39
|
+
return asyncFormatter.getJson();
|
|
40
|
+
}
|
|
33
41
|
new progressBar_1.DeployProgress(deploy, this.jsonEnabled()).start();
|
|
34
|
-
const result = await deploy.pollStatus(
|
|
42
|
+
const result = await deploy.pollStatus({ timeout: flags.wait });
|
|
35
43
|
this.setExitCode(result);
|
|
44
|
+
const formatter = new output_1.DeployResultFormatter(result, flags);
|
|
36
45
|
if (!this.jsonEnabled()) {
|
|
37
|
-
|
|
46
|
+
formatter.display();
|
|
38
47
|
if (flags['dry-run'])
|
|
39
|
-
this.
|
|
48
|
+
this.logSuccess('Dry-run complete.');
|
|
49
|
+
}
|
|
50
|
+
if ((0, deploy_1.shouldRemoveFromCache)(result.response.status)) {
|
|
51
|
+
await deploy_1.DeployCache.unset(deploy.id);
|
|
40
52
|
}
|
|
41
|
-
return
|
|
42
|
-
jobId: result.response.id,
|
|
43
|
-
files: result.getFileResponses() || [],
|
|
44
|
-
tests: (0, deploy_1.getTestResults)(result),
|
|
45
|
-
};
|
|
53
|
+
return formatter.getJson();
|
|
46
54
|
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
|
|
55
|
+
catch(error) {
|
|
56
|
+
if (error.message.includes('client has timed out')) {
|
|
57
|
+
const err = messages.createError('error.ClientTimeout');
|
|
58
|
+
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
|
|
50
59
|
}
|
|
60
|
+
return super.catch(error);
|
|
61
|
+
}
|
|
62
|
+
setExitCode(result) {
|
|
63
|
+
process.exitCode = (0, deploy_1.determineExitCode)(result);
|
|
51
64
|
}
|
|
52
65
|
}
|
|
53
66
|
exports.default = DeployMetadata;
|
|
@@ -55,12 +68,22 @@ DeployMetadata.description = messages.getMessage('description');
|
|
|
55
68
|
DeployMetadata.summary = messages.getMessage('summary');
|
|
56
69
|
DeployMetadata.examples = messages.getMessages('examples');
|
|
57
70
|
DeployMetadata.requiresProject = true;
|
|
71
|
+
DeployMetadata.state = 'beta';
|
|
58
72
|
DeployMetadata.flags = {
|
|
59
73
|
'api-version': sf_plugins_core_1.Flags.orgApiVersion({
|
|
60
74
|
char: 'a',
|
|
61
75
|
summary: messages.getMessage('flags.api-version.summary'),
|
|
62
76
|
description: messages.getMessage('flags.api-version.description'),
|
|
63
77
|
}),
|
|
78
|
+
async: sf_plugins_core_1.Flags.boolean({
|
|
79
|
+
summary: messages.getMessage('flags.async.summary'),
|
|
80
|
+
description: messages.getMessage('flags.async.description'),
|
|
81
|
+
exclusive: ['wait'],
|
|
82
|
+
}),
|
|
83
|
+
concise: sf_plugins_core_1.Flags.boolean({
|
|
84
|
+
summary: messages.getMessage('flags.concise.summary'),
|
|
85
|
+
exclusive: ['verbose'],
|
|
86
|
+
}),
|
|
64
87
|
'dry-run': sf_plugins_core_1.Flags.boolean({
|
|
65
88
|
summary: messages.getMessage('flags.dry-run.summary'),
|
|
66
89
|
default: false,
|
|
@@ -115,6 +138,7 @@ DeployMetadata.flags = {
|
|
|
115
138
|
}),
|
|
116
139
|
verbose: sf_plugins_core_1.Flags.boolean({
|
|
117
140
|
summary: messages.getMessage('flags.verbose.summary'),
|
|
141
|
+
exclusive: ['concise'],
|
|
118
142
|
}),
|
|
119
143
|
wait: sf_plugins_core_1.Flags.duration({
|
|
120
144
|
char: 'w',
|
|
@@ -124,8 +148,10 @@ DeployMetadata.flags = {
|
|
|
124
148
|
defaultValue: 33,
|
|
125
149
|
helpValue: '<minutes>',
|
|
126
150
|
min: 1,
|
|
151
|
+
exclusive: ['async'],
|
|
127
152
|
}),
|
|
128
153
|
};
|
|
129
|
-
DeployMetadata.configurationVariablesSection = (0, sf_plugins_core_1.toHelpSection)('CONFIGURATION VARIABLES', core_1.OrgConfigProperties.TARGET_ORG, core_1.
|
|
154
|
+
DeployMetadata.configurationVariablesSection = (0, sf_plugins_core_1.toHelpSection)('CONFIGURATION VARIABLES', core_1.OrgConfigProperties.TARGET_ORG, core_1.OrgConfigProperties.ORG_API_VERSION, configMeta_1.ConfigVars.ORG_METADATA_REST_DEPLOY);
|
|
130
155
|
DeployMetadata.envVariablesSection = (0, sf_plugins_core_1.toHelpSection)('ENVIRONMENT VARIABLES', core_1.EnvironmentVariable.SF_TARGET_ORG, core_1.EnvironmentVariable.SF_USE_PROGRESS_BAR);
|
|
156
|
+
DeployMetadata.errorCodes = (0, sf_plugins_core_1.toHelpSection)('ERROR CODES', errorCodes_1.DEPLOY_STATUS_CODES_DESCRIPTIONS);
|
|
131
157
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/commands/deploy/metadata.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/commands/deploy/metadata.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,iCAA6B;AAC7B,2CAAsF;AAEtF,iEAA8E;AAC9E,+CAA0G;AAC1G,yDAAyD;AACzD,6CAAgE;AAChE,+CAQ4B;AAC5B,uDAA0E;AAC1E,iDAA8C;AAE9C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,iBAAiB,CAAC,CAAC;AAEhG,MAAqB,cAAe,SAAQ,2BAA2B;IAyG9D,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,IAAA,sBAAa,EAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;YACpD,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;SACtD;QAED,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,sBAAa,EAAC;YACnD,GAAG,KAAK;YACR,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE;YAC/C,GAAG;SACJ,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,WAAW,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,IAAA,0BAAiB,EAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,GAAG,CAAC,c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uBAAU,CAAC,wBAAwB,CACpC,CAAC;AAEY,kCAAmB,GAAG,IAAA,+BAAa,EAC/C,uBAAuB,EACvB,0BAAmB,CAAC,aAAa,EACjC,0BAAmB,CAAC,mBAAmB,CACxC,CAAC;AAEY,yBAAU,GAAG,IAAA,+BAAa,EAAC,aAAa,EAAE,6CAAgC,CAAC,CAAC"}
|
package/lib/commands/deploy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Hook } from '@oclif/core';
|
|
1
2
|
import { Deployer, SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
3
|
export declare const DEPLOY_OPTIONS_FILE = "deploy-options.json";
|
|
3
4
|
export default class Deploy extends SfCommand<void> {
|
|
@@ -19,4 +20,5 @@ export default class Deploy extends SfCommand<void> {
|
|
|
19
20
|
shouldCommit(): Promise<boolean>;
|
|
20
21
|
askToSave(): Promise<boolean>;
|
|
21
22
|
selectDeployers(deployers: Deployer[]): Promise<Deployer[]>;
|
|
23
|
+
checkForHookFailures(hookResults: Hook.Result<Deployer[]>): void;
|
|
22
24
|
}
|
package/lib/commands/deploy.js
CHANGED
|
@@ -29,6 +29,7 @@ class Deploy extends sf_plugins_core_1.SfCommand {
|
|
|
29
29
|
this.log(`Using options found in ${exports.DEPLOY_OPTIONS_FILE}`);
|
|
30
30
|
}
|
|
31
31
|
const hookResults = await sf_plugins_core_1.SfHook.run(this.config, 'sf:deploy', options);
|
|
32
|
+
this.checkForHookFailures(hookResults);
|
|
32
33
|
let deployers = hookResults.successes.flatMap((s) => s.result);
|
|
33
34
|
if (deployers.length === 0) {
|
|
34
35
|
this.log('Found nothing in the project to deploy');
|
|
@@ -137,6 +138,24 @@ class Deploy extends sf_plugins_core_1.SfCommand {
|
|
|
137
138
|
}
|
|
138
139
|
return final;
|
|
139
140
|
}
|
|
141
|
+
checkForHookFailures(hookResults) {
|
|
142
|
+
var _a;
|
|
143
|
+
if ((_a = hookResults.failures) === null || _a === void 0 ? void 0 : _a.length) {
|
|
144
|
+
// display a table of the errors encountered; Plugin Name, Error Message
|
|
145
|
+
const columns = {
|
|
146
|
+
errorName: { header: 'Error Name' },
|
|
147
|
+
errorMessage: { header: 'Error Message' },
|
|
148
|
+
};
|
|
149
|
+
const failureData = hookResults.failures.map((failure) => {
|
|
150
|
+
return { errorName: failure.error.name, errorMessage: failure.error.message };
|
|
151
|
+
});
|
|
152
|
+
this.styledHeader(messages.getMessage('error.initialization.title'));
|
|
153
|
+
this.table(failureData, columns);
|
|
154
|
+
const err = messages.createError('error.initialization');
|
|
155
|
+
err.data = hookResults.failures;
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
140
159
|
}
|
|
141
160
|
exports.default = Deploy;
|
|
142
161
|
Deploy.summary = messages.getMessage('summary');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2BAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2BAAyB;AACzB,sCAA0C;AAC1C,2CAA4C;AAC5C,uCAAsE;AACtE,yCAAoD;AACpD,iEAAsH;AACtH,qCAA+B;AAE/B,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,QAAQ,CAAC,CAAC;AAE1E,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,MAAqB,MAAO,SAAQ,2BAAe;IAY1C,KAAK,CAAC,GAAG;;QACd,OAAO,CAAC,eAAe,CAAC,IAAI,SAAG,EAAE,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAA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A2B,CAAC;KAC1D,CAAC;CACH,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RetrieveResult } from '@salesforce/source-deploy-retrieve';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
-
|
|
4
|
-
export default class RetrieveMetadata extends SfCommand<
|
|
3
|
+
import { RetrieveResultJson } from '../../utils/types';
|
|
4
|
+
export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
|
|
5
5
|
static readonly summary: string;
|
|
6
6
|
static readonly description: string;
|
|
7
7
|
static readonly examples: string[];
|
|
8
8
|
static readonly requiresProject = true;
|
|
9
|
+
static readonly state = "beta";
|
|
9
10
|
static flags: {
|
|
10
11
|
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
12
|
manifest: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
@@ -18,7 +19,5 @@ export default class RetrieveMetadata extends SfCommand<RetrieveMetadataResult>
|
|
|
18
19
|
static configurationVariablesSection: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
19
20
|
static envVariablesSection: import("@salesforce/sf-plugins-core/lib/util").HelpSection;
|
|
20
21
|
protected retrieveResult: RetrieveResult;
|
|
21
|
-
run(): Promise<
|
|
22
|
-
private displayResults;
|
|
23
|
-
private getPackages;
|
|
22
|
+
run(): Promise<RetrieveResultJson>;
|
|
24
23
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const path = require("path");
|
|
10
9
|
const core_1 = require("@salesforce/core");
|
|
11
10
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
12
11
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
@@ -18,7 +17,7 @@ const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retriev
|
|
|
18
17
|
const mdTrasferMessages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'metadata.transfer');
|
|
19
18
|
class RetrieveMetadata extends sf_plugins_core_1.SfCommand {
|
|
20
19
|
async run() {
|
|
21
|
-
const flags =
|
|
20
|
+
const { flags } = await this.parse(RetrieveMetadata);
|
|
22
21
|
this.spinner.start(messages.getMessage('spinner.start'));
|
|
23
22
|
const componentSet = await source_deploy_retrieve_1.ComponentSetBuilder.build({
|
|
24
23
|
apiversion: flags['api-version'],
|
|
@@ -56,29 +55,16 @@ class RetrieveMetadata extends sf_plugins_core_1.SfCommand {
|
|
|
56
55
|
await retrieve.start();
|
|
57
56
|
const result = await retrieve.pollStatus(500, flags.wait.seconds);
|
|
58
57
|
this.spinner.stop();
|
|
59
|
-
const
|
|
58
|
+
const formatter = new output_1.RetrieveResultFormatter(result, flags['package-name']);
|
|
60
59
|
if (!this.jsonEnabled()) {
|
|
61
|
-
|
|
60
|
+
if (result.response.status === 'Succeeded') {
|
|
61
|
+
await formatter.display();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
throw new core_1.SfError((0, ts_types_1.getString)(result.response, 'errorMessage', result.response.status), (0, ts_types_1.getString)(result.response, 'errorStatusCode', 'unknown'));
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
async displayResults(result, packageNames = []) {
|
|
66
|
-
if (result.response.status === 'Succeeded') {
|
|
67
|
-
(0, output_1.displaySuccesses)(result);
|
|
68
|
-
(0, output_1.displayPackages)(result, await this.getPackages(result, packageNames));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new core_1.SfError((0, ts_types_1.getString)(result.response, 'errorMessage', result.response.status), (0, ts_types_1.getString)(result.response, 'errorStatusCode', 'unknown'));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async getPackages(result, packageNames = []) {
|
|
75
|
-
const packages = [];
|
|
76
|
-
const projectPath = await core_1.SfProject.resolveProjectPath();
|
|
77
|
-
packageNames.forEach((name) => {
|
|
78
|
-
const packagePath = path.join(projectPath, name);
|
|
79
|
-
packages.push({ name, path: packagePath, fullPath: path.resolve(packagePath) });
|
|
80
|
-
});
|
|
81
|
-
return packages;
|
|
67
|
+
return formatter.getJson();
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
exports.default = RetrieveMetadata;
|
|
@@ -86,6 +72,7 @@ RetrieveMetadata.summary = messages.getMessage('summary');
|
|
|
86
72
|
RetrieveMetadata.description = messages.getMessage('description');
|
|
87
73
|
RetrieveMetadata.examples = messages.getMessages('examples');
|
|
88
74
|
RetrieveMetadata.requiresProject = true;
|
|
75
|
+
RetrieveMetadata.state = 'beta';
|
|
89
76
|
RetrieveMetadata.flags = {
|
|
90
77
|
'api-version': sf_plugins_core_1.Flags.orgApiVersion({
|
|
91
78
|
char: 'a',
|
|
@@ -130,6 +117,6 @@ RetrieveMetadata.flags = {
|
|
|
130
117
|
description: messages.getMessage('flags.wait.description'),
|
|
131
118
|
}),
|
|
132
119
|
};
|
|
133
|
-
RetrieveMetadata.configurationVariablesSection = (0, sf_plugins_core_1.toHelpSection)('CONFIGURATION VARIABLES', core_1.OrgConfigProperties.TARGET_ORG, core_1.
|
|
134
|
-
RetrieveMetadata.envVariablesSection = (0, sf_plugins_core_1.toHelpSection)('ENVIRONMENT VARIABLES', core_1.EnvironmentVariable.SF_TARGET_ORG, core_1.EnvironmentVariable.
|
|
120
|
+
RetrieveMetadata.configurationVariablesSection = (0, sf_plugins_core_1.toHelpSection)('CONFIGURATION VARIABLES', core_1.OrgConfigProperties.TARGET_ORG, core_1.OrgConfigProperties.ORG_API_VERSION);
|
|
121
|
+
RetrieveMetadata.envVariablesSection = (0, sf_plugins_core_1.toHelpSection)('ENVIRONMENT VARIABLES', core_1.EnvironmentVariable.SF_TARGET_ORG, core_1.EnvironmentVariable.SF_USE_PROGRESS_BAR);
|
|
135
122
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/commands/retrieve/metadata.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/commands/retrieve/metadata.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA+F;AAC/F,+EAAyF;AAEzF,iEAA8E;AAC9E,mDAAiD;AACjD,+CAA6D;AAC7D,iDAAqD;AAGrD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,mBAAmB,CAAC,CAAC;AAClG,MAAM,iBAAiB,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,mBAAmB,CAAC,CAAC;AAE3G,MAAqB,gBAAiB,SAAQ,2BAA6B;IAiElE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,MAAM,4CAAmB,CAAC,KAAK,CAAC;YACnD,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;YAChC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC;YAC/B,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC;YACnC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI;gBAC1B,YAAY,EAAE,KAAK,CAAC,QAAQ;gBAC5B,cAAc,EAAE,MAAM,IAAA,wBAAc,GAAE;aACvC;YACD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI;gBAC1B,eAAe,EAAE,KAAK,CAAC,QAAQ;gBAC/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AE,EAAE;QAChB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QAClD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;KAC3D,CAAC;CACH,CAAC;AAEY,8CAA6B,GAAG,IAAA,+BAAa,EACzD,yBAAyB,EACzB,0BAAmB,CAAC,UAAU,EAC9B,0BAAmB,CAAC,eAAe,CACpC,CAAC;AACY,oCAAmB,GAAG,IAAA,+BAAa,EAC/C,uBAAuB,EACvB,0BAAmB,CAAC,aAAa,EACjC,0BAAmB,CAAC,mBAAmB,CACxC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConfigValue } from '@salesforce/core';
|
|
2
|
+
export declare enum ConfigVars {
|
|
3
|
+
/**
|
|
4
|
+
* Allow users to use the REST api for deployments.
|
|
5
|
+
*/
|
|
6
|
+
ORG_METADATA_REST_DEPLOY = "org-metadata-rest-deploy"
|
|
7
|
+
}
|
|
8
|
+
declare const _default: {
|
|
9
|
+
key: ConfigVars;
|
|
10
|
+
description: string;
|
|
11
|
+
hidden: boolean;
|
|
12
|
+
input: {
|
|
13
|
+
validator: (value: ConfigValue) => boolean;
|
|
14
|
+
failedMessage: string;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ConfigVars = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'config');
|
|
13
|
+
var ConfigVars;
|
|
14
|
+
(function (ConfigVars) {
|
|
15
|
+
/**
|
|
16
|
+
* Allow users to use the REST api for deployments.
|
|
17
|
+
*/
|
|
18
|
+
ConfigVars["ORG_METADATA_REST_DEPLOY"] = "org-metadata-rest-deploy";
|
|
19
|
+
})(ConfigVars = exports.ConfigVars || (exports.ConfigVars = {}));
|
|
20
|
+
exports.default = [
|
|
21
|
+
{
|
|
22
|
+
key: ConfigVars.ORG_METADATA_REST_DEPLOY,
|
|
23
|
+
description: messages.getMessage(ConfigVars.ORG_METADATA_REST_DEPLOY),
|
|
24
|
+
hidden: true,
|
|
25
|
+
input: {
|
|
26
|
+
validator: (value) => value != null && ['true', 'false'].includes(value.toString()),
|
|
27
|
+
failedMessage: messages.getMessage('error.invalidBooleanConfigValue'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
//# sourceMappingURL=configMeta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configMeta.js","sourceRoot":"","sources":["../src/configMeta.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAyD;AAEzD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,QAAQ,CAAC,CAAC;AAEvF,IAAY,UAKX;AALD,WAAY,UAAU;IACpB;;OAEG;IACH,mEAAqD,CAAA;AACvD,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB;AAED,kBAAe;IACb;QACE,GAAG,EAAE,UAAU,CAAC,wBAAwB;QACxC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,wBAAwB,CAAC;QACrE,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE;YACL,SAAS,EAAE,CAAC,KAAkB,EAAW,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzG,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,iCAAiC,CAAC;SACtE;KACF;CACF,CAAC"}
|
package/lib/utils/deploy.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Interfaces } from '@oclif/core';
|
|
2
|
+
import { Org, TTLConfig } from '@salesforce/core';
|
|
2
3
|
import { Duration } from '@salesforce/kit';
|
|
3
4
|
import { Nullable } from '@salesforce/ts-types';
|
|
4
|
-
import { ComponentSet, DeployResult, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
|
|
5
|
-
import { API, TestLevel
|
|
6
|
-
declare type
|
|
5
|
+
import { ComponentSet, DeployResult, MetadataApiDeploy, RequestStatus } from '@salesforce/source-deploy-retrieve';
|
|
6
|
+
import { API, TestLevel } from './types';
|
|
7
|
+
export declare type DeployOptions = {
|
|
7
8
|
api: API;
|
|
8
9
|
'target-org': string;
|
|
9
10
|
'test-level': TestLevel;
|
|
11
|
+
async?: boolean;
|
|
10
12
|
'api-version'?: string;
|
|
11
13
|
'dry-run'?: boolean;
|
|
12
14
|
'ignore-errors'?: boolean;
|
|
@@ -17,13 +19,30 @@ declare type Options = {
|
|
|
17
19
|
tests?: string[];
|
|
18
20
|
wait?: Duration;
|
|
19
21
|
verbose?: boolean;
|
|
22
|
+
concise?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare type CachedOptions = Omit<DeployOptions, 'wait'> & {
|
|
25
|
+
wait: number;
|
|
20
26
|
};
|
|
21
27
|
export declare function validateTests(testLevel: TestLevel, tests: Nullable<string[]>): boolean;
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
28
|
+
export declare function resolveApi(): Promise<API>;
|
|
29
|
+
export declare function buildComponentSet(opts: Partial<DeployOptions>): Promise<ComponentSet>;
|
|
30
|
+
export declare function executeDeploy(opts: Partial<DeployOptions>, id?: string): Promise<{
|
|
24
31
|
deploy: MetadataApiDeploy;
|
|
25
32
|
componentSet: ComponentSet;
|
|
26
33
|
}>;
|
|
34
|
+
export declare function cancelDeploy(opts: Partial<DeployOptions>, id: string): Promise<DeployResult>;
|
|
35
|
+
export declare function cancelDeployAsync(opts: Partial<DeployOptions>, id: string): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function poll(org: Org, id: string, wait: Duration, componentSet: ComponentSet): Promise<DeployResult>;
|
|
27
39
|
export declare const testLevelFlag: (opts?: Partial<Interfaces.OptionFlag<TestLevel | undefined>>) => Interfaces.OptionFlag<TestLevel | undefined>;
|
|
28
|
-
export declare function
|
|
29
|
-
export
|
|
40
|
+
export declare function determineExitCode(result: DeployResult, async?: boolean): number;
|
|
41
|
+
export declare function shouldRemoveFromCache(status: RequestStatus): boolean;
|
|
42
|
+
export declare class DeployCache extends TTLConfig<TTLConfig.Options, CachedOptions> {
|
|
43
|
+
static getFileName(): string;
|
|
44
|
+
static getDefaultOptions(): TTLConfig.Options;
|
|
45
|
+
static set(key: string, value: Partial<CachedOptions>): Promise<void>;
|
|
46
|
+
static unset(key: string): Promise<void>;
|
|
47
|
+
resolveLatest(useMostRecent: boolean, key: Nullable<string>, throwOnNotFound?: boolean): string;
|
|
48
|
+
}
|
package/lib/utils/deploy.js
CHANGED
|
@@ -6,33 +6,32 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DeployCache = exports.shouldRemoveFromCache = exports.determineExitCode = exports.testLevelFlag = exports.poll = exports.cancelDeployAsync = exports.cancelDeploy = exports.executeDeploy = exports.buildComponentSet = exports.resolveApi = exports.validateTests = void 0;
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const core_2 = require("@salesforce/core");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
12
13
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
14
|
+
const configMeta_1 = require("../configMeta");
|
|
13
15
|
const project_1 = require("./project");
|
|
14
16
|
const types_1 = require("./types");
|
|
17
|
+
const errorCodes_1 = require("./errorCodes");
|
|
18
|
+
core_2.Messages.importMessagesDirectory(__dirname);
|
|
19
|
+
const messages = core_2.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'cache');
|
|
15
20
|
function validateTests(testLevel, tests) {
|
|
16
21
|
if (testLevel === types_1.TestLevel.RunSpecifiedTests && (tests !== null && tests !== void 0 ? tests : []).length === 0)
|
|
17
22
|
return false;
|
|
18
23
|
return true;
|
|
19
24
|
}
|
|
20
25
|
exports.validateTests = validateTests;
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
else if (restDeployConfig === 'true') {
|
|
27
|
-
return types_1.API.REST;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return types_1.API.SOAP;
|
|
31
|
-
}
|
|
26
|
+
async function resolveApi() {
|
|
27
|
+
var _a;
|
|
28
|
+
const agg = await core_2.ConfigAggregator.create({ customConfigMeta: configMeta_1.default });
|
|
29
|
+
const restDeployConfig = (_a = agg.getInfo(configMeta_1.ConfigVars.ORG_METADATA_REST_DEPLOY)) === null || _a === void 0 ? void 0 : _a.value;
|
|
30
|
+
return restDeployConfig === 'true' ? types_1.API.REST : types_1.API.SOAP;
|
|
32
31
|
}
|
|
33
|
-
exports.
|
|
34
|
-
async function
|
|
35
|
-
|
|
32
|
+
exports.resolveApi = resolveApi;
|
|
33
|
+
async function buildComponentSet(opts) {
|
|
34
|
+
return source_deploy_retrieve_1.ComponentSetBuilder.build({
|
|
36
35
|
apiversion: opts['api-version'],
|
|
37
36
|
sourceapiversion: await (0, project_1.getSourceApiVersion)(),
|
|
38
37
|
sourcepath: opts['source-dir'],
|
|
@@ -45,8 +44,14 @@ async function executeDeploy(opts) {
|
|
|
45
44
|
directoryPaths: await (0, project_1.getPackageDirs)(),
|
|
46
45
|
},
|
|
47
46
|
});
|
|
47
|
+
}
|
|
48
|
+
exports.buildComponentSet = buildComponentSet;
|
|
49
|
+
async function executeDeploy(opts, id) {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const componentSet = await buildComponentSet(opts);
|
|
48
52
|
const deploy = await componentSet.deploy({
|
|
49
53
|
usernameOrConnection: opts['target-org'],
|
|
54
|
+
id,
|
|
50
55
|
apiOptions: {
|
|
51
56
|
checkOnly: opts['dry-run'] || false,
|
|
52
57
|
ignoreWarnings: opts['ignore-warnings'] || false,
|
|
@@ -56,9 +61,52 @@ async function executeDeploy(opts) {
|
|
|
56
61
|
testLevel: opts['test-level'],
|
|
57
62
|
},
|
|
58
63
|
});
|
|
64
|
+
await DeployCache.set(deploy.id, { ...opts, wait: (_b = (_a = opts.wait) === null || _a === void 0 ? void 0 : _a.minutes) !== null && _b !== void 0 ? _b : 33 });
|
|
59
65
|
return { deploy, componentSet };
|
|
60
66
|
}
|
|
61
67
|
exports.executeDeploy = executeDeploy;
|
|
68
|
+
async function cancelDeploy(opts, id) {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const org = await core_2.Org.create({ aliasOrUsername: opts['target-org'] });
|
|
71
|
+
const deploy = new source_deploy_retrieve_1.MetadataApiDeploy({ usernameOrConnection: org.getUsername(), id });
|
|
72
|
+
const componentSet = await buildComponentSet({ ...opts });
|
|
73
|
+
await DeployCache.set(deploy.id, { ...opts, wait: (_b = (_a = opts.wait) === null || _a === void 0 ? void 0 : _a.minutes) !== null && _b !== void 0 ? _b : 33 });
|
|
74
|
+
await deploy.cancel();
|
|
75
|
+
return poll(org, deploy.id, opts.wait, componentSet);
|
|
76
|
+
}
|
|
77
|
+
exports.cancelDeploy = cancelDeploy;
|
|
78
|
+
async function cancelDeployAsync(opts, id) {
|
|
79
|
+
const org = await core_2.Org.create({ aliasOrUsername: opts['target-org'] });
|
|
80
|
+
const deploy = new source_deploy_retrieve_1.MetadataApiDeploy({ usernameOrConnection: org.getUsername(), id });
|
|
81
|
+
await deploy.cancel();
|
|
82
|
+
return { id: deploy.id };
|
|
83
|
+
}
|
|
84
|
+
exports.cancelDeployAsync = cancelDeployAsync;
|
|
85
|
+
async function poll(org, id, wait, componentSet) {
|
|
86
|
+
const report = async () => {
|
|
87
|
+
const res = await org.getConnection().metadata.checkDeployStatus(id, true);
|
|
88
|
+
const deployStatus = res;
|
|
89
|
+
return new source_deploy_retrieve_1.DeployResult(deployStatus, componentSet);
|
|
90
|
+
};
|
|
91
|
+
const opts = {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
frequency: kit_1.Duration.milliseconds(1000),
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
timeout: wait,
|
|
98
|
+
poll: async () => {
|
|
99
|
+
const deployResult = await report();
|
|
100
|
+
return {
|
|
101
|
+
completed: deployResult.response.done,
|
|
102
|
+
payload: deployResult,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const pollingClient = await core_2.PollingClient.create(opts);
|
|
107
|
+
return pollingClient.subscribe();
|
|
108
|
+
}
|
|
109
|
+
exports.poll = poll;
|
|
62
110
|
const testLevelFlag = (opts = {}) => {
|
|
63
111
|
return core_1.Flags.build({
|
|
64
112
|
char: 'l',
|
|
@@ -68,14 +116,56 @@ const testLevelFlag = (opts = {}) => {
|
|
|
68
116
|
})();
|
|
69
117
|
};
|
|
70
118
|
exports.testLevelFlag = testLevelFlag;
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
119
|
+
function determineExitCode(result, async = false) {
|
|
120
|
+
if (async) {
|
|
121
|
+
return result.response.status === source_deploy_retrieve_1.RequestStatus.Succeeded ? 0 : 1;
|
|
122
|
+
}
|
|
123
|
+
return errorCodes_1.DEPLOY_STATUS_CODES.get(result.response.status);
|
|
124
|
+
}
|
|
125
|
+
exports.determineExitCode = determineExitCode;
|
|
126
|
+
function shouldRemoveFromCache(status) {
|
|
127
|
+
return [
|
|
128
|
+
source_deploy_retrieve_1.RequestStatus.Succeeded,
|
|
129
|
+
source_deploy_retrieve_1.RequestStatus.Failed,
|
|
130
|
+
source_deploy_retrieve_1.RequestStatus.SucceededPartial,
|
|
131
|
+
source_deploy_retrieve_1.RequestStatus.Canceled,
|
|
132
|
+
].includes(status);
|
|
133
|
+
}
|
|
134
|
+
exports.shouldRemoveFromCache = shouldRemoveFromCache;
|
|
135
|
+
class DeployCache extends core_2.TTLConfig {
|
|
136
|
+
static getFileName() {
|
|
137
|
+
return 'deploy-cache.json';
|
|
138
|
+
}
|
|
139
|
+
static getDefaultOptions() {
|
|
140
|
+
return {
|
|
141
|
+
isGlobal: false,
|
|
142
|
+
isState: true,
|
|
143
|
+
filename: DeployCache.getFileName(),
|
|
144
|
+
stateFolder: core_2.Global.SF_STATE_FOLDER,
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
ttl: kit_1.Duration.days(3),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
static async set(key, value) {
|
|
151
|
+
const cache = await DeployCache.create();
|
|
152
|
+
cache.set(key, value);
|
|
153
|
+
await cache.write();
|
|
154
|
+
}
|
|
155
|
+
static async unset(key) {
|
|
156
|
+
const cache = await DeployCache.create();
|
|
157
|
+
cache.unset(key);
|
|
158
|
+
await cache.write();
|
|
159
|
+
}
|
|
160
|
+
resolveLatest(useMostRecent, key, throwOnNotFound = true) {
|
|
161
|
+
const jobId = useMostRecent ? this.getLatestKey() : key;
|
|
162
|
+
if (!jobId && useMostRecent)
|
|
163
|
+
throw messages.createError('error.NoRecentJobId');
|
|
164
|
+
if (throwOnNotFound && !this.has(jobId)) {
|
|
165
|
+
throw messages.createError('error.InvalidJobId', [jobId]);
|
|
166
|
+
}
|
|
167
|
+
return jobId;
|
|
168
|
+
}
|
|
79
169
|
}
|
|
80
|
-
exports.
|
|
170
|
+
exports.DeployCache = DeployCache;
|
|
81
171
|
//# sourceMappingURL=deploy.js.map
|