@salesforce/plugin-deploy-retrieve 1.0.5 → 1.1.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 +47 -47
- package/LICENSE.txt +1 -1
- package/README.md +214 -2
- package/lib/commands/deploy/metadata.d.ts +36 -0
- package/lib/commands/deploy/metadata.js +123 -0
- package/lib/commands/deploy/metadata.js.map +1 -0
- package/lib/commands/deploy.js +11 -10
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/retrieve/metadata.d.ts +29 -0
- package/lib/commands/retrieve/metadata.js +134 -0
- package/lib/commands/retrieve/metadata.js.map +1 -0
- package/lib/hooks/deploy.d.ts +4 -0
- package/lib/hooks/deploy.js +17 -0
- package/lib/hooks/deploy.js.map +1 -0
- package/lib/utils/componentSetBuilder.d.ts +28 -0
- package/lib/utils/componentSetBuilder.js +124 -0
- package/lib/utils/componentSetBuilder.js.map +1 -0
- package/lib/utils/config.d.ts +1 -0
- package/lib/utils/config.js +18 -0
- package/lib/utils/config.js.map +1 -0
- package/lib/utils/metadataDeployer.d.ts +30 -0
- package/lib/utils/metadataDeployer.js +178 -0
- package/lib/utils/metadataDeployer.js.map +1 -0
- package/lib/utils/orgs.d.ts +4 -0
- package/lib/utils/orgs.js +39 -0
- package/lib/utils/orgs.js.map +1 -0
- package/lib/utils/output.d.ts +18 -0
- package/lib/utils/output.js +152 -0
- package/lib/utils/output.js.map +1 -0
- package/lib/utils/progressBar.d.ts +8 -0
- package/lib/utils/progressBar.js +55 -0
- package/lib/utils/progressBar.js.map +1 -0
- package/lib/utils/requiredFlagValidator.d.ts +3 -0
- package/lib/utils/requiredFlagValidator.js +19 -0
- package/lib/utils/requiredFlagValidator.js.map +1 -0
- package/lib/utils/testLevel.d.ts +6 -0
- package/lib/utils/testLevel.js +17 -0
- package/lib/utils/testLevel.js.map +1 -0
- package/messages/deploy.metadata.md +114 -0
- package/messages/metadata.transfer.md +27 -0
- package/messages/required.flag.md +3 -0
- package/messages/retrieve.metadata.md +100 -0
- package/oclif.manifest.json +1 -1
- package/package.json +26 -21
- package/schemas/deploy-metadata.json +98 -0
- package/schemas/hooks/sf-deploy.json +106 -0
- package/schemas/retrieve-metadata.json +69 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021, 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.MetadataDeployer = exports.DeployablePackage = void 0;
|
|
10
|
+
const os_1 = require("os");
|
|
11
|
+
const chalk_1 = require("chalk");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const core_1 = require("@salesforce/core");
|
|
14
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
15
|
+
const componentSetBuilder_1 = require("./componentSetBuilder");
|
|
16
|
+
const output_1 = require("./output");
|
|
17
|
+
const testLevel_1 = require("./testLevel");
|
|
18
|
+
const progressBar_1 = require("./progressBar");
|
|
19
|
+
const config_1 = require("./config");
|
|
20
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
21
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata');
|
|
22
|
+
const compareOrgs = (a, b) => {
|
|
23
|
+
// scratch orgs before other orgs
|
|
24
|
+
if (a.isScratchOrg && !b.isScratchOrg) {
|
|
25
|
+
// all scratch orgs come before non-scratch orgs
|
|
26
|
+
return -1;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// sort scratch orgs by timestamp - descending
|
|
30
|
+
if (a.isScratchOrg && b.isScratchOrg) {
|
|
31
|
+
const aTimestamp = new Date(a.timestamp);
|
|
32
|
+
const bTimestamp = new Date(b.timestamp);
|
|
33
|
+
return bTimestamp.getTime() - aTimestamp.getTime();
|
|
34
|
+
}
|
|
35
|
+
// dev hubs after scratch but before remaining orgs
|
|
36
|
+
if (a.isDevHub && !b.isScratchOrg && !b.isDevHub) {
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
// not a scratch org and not a devhub means "other" sorts last
|
|
40
|
+
if (!a.isDevHub) {
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// orgs are equal by type - sort by name ascending
|
|
45
|
+
return a.username.localeCompare(b.username);
|
|
46
|
+
};
|
|
47
|
+
class DeployablePackage extends sf_plugins_core_1.Deployable {
|
|
48
|
+
constructor(pkg, parent) {
|
|
49
|
+
super();
|
|
50
|
+
this.pkg = pkg;
|
|
51
|
+
this.parent = parent;
|
|
52
|
+
}
|
|
53
|
+
getName() {
|
|
54
|
+
return this.pkg.name;
|
|
55
|
+
}
|
|
56
|
+
getType() {
|
|
57
|
+
return 'Salesforce App';
|
|
58
|
+
}
|
|
59
|
+
getPath() {
|
|
60
|
+
return this.pkg.path;
|
|
61
|
+
}
|
|
62
|
+
getParent() {
|
|
63
|
+
return this.parent;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.DeployablePackage = DeployablePackage;
|
|
67
|
+
class MetadataDeployer extends sf_plugins_core_1.Deployer {
|
|
68
|
+
constructor(packages) {
|
|
69
|
+
super();
|
|
70
|
+
this.packages = packages;
|
|
71
|
+
this.testLevel = testLevel_1.TestLevel.NoTestRun;
|
|
72
|
+
this.deployables = this.packages.map((pkg) => new DeployablePackage(pkg, this));
|
|
73
|
+
}
|
|
74
|
+
getName() {
|
|
75
|
+
return MetadataDeployer.NAME;
|
|
76
|
+
}
|
|
77
|
+
async setup(flags, options) {
|
|
78
|
+
var _a;
|
|
79
|
+
if (flags.interactive) {
|
|
80
|
+
this.testLevel = await this.promptForTestLevel();
|
|
81
|
+
this.username = await this.promptForUsername();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if ((_a = options.directories) === null || _a === void 0 ? void 0 : _a.length) {
|
|
85
|
+
const directories = options.directories || [];
|
|
86
|
+
const selected = this.deployables.filter((d) => directories.includes(d.getPath()));
|
|
87
|
+
this.selectDeployables(selected);
|
|
88
|
+
}
|
|
89
|
+
this.testLevel = options.testLevel || (await this.promptForTestLevel());
|
|
90
|
+
this.username = options.username || (await this.promptForUsername());
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
testLevel: this.testLevel,
|
|
94
|
+
username: this.username,
|
|
95
|
+
apps: this.deployables.map((d) => d.getPath()),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
async deploy() {
|
|
99
|
+
const directories = this.deployables.map((d) => d.pkg.fullPath);
|
|
100
|
+
const name = this.deployables.map((p) => chalk_1.cyan.bold(p.getPath())).join(', ');
|
|
101
|
+
this.log(`${os_1.EOL}Deploying ${name} to ${this.username} using ${(0, config_1.resolveRestDeploy)()} API`);
|
|
102
|
+
const componentSet = await componentSetBuilder_1.ComponentSetBuilder.build({ sourcepath: directories });
|
|
103
|
+
const deploy = await componentSet.deploy({
|
|
104
|
+
usernameOrConnection: this.username,
|
|
105
|
+
apiOptions: { testLevel: this.testLevel },
|
|
106
|
+
});
|
|
107
|
+
new progressBar_1.DeployProgress(deploy).start();
|
|
108
|
+
const result = await deploy.pollStatus(500, kit_1.Duration.minutes(33).seconds);
|
|
109
|
+
(0, output_1.displaySuccesses)(result);
|
|
110
|
+
(0, output_1.displayFailures)(result);
|
|
111
|
+
(0, output_1.displayTestResults)(result, this.testLevel);
|
|
112
|
+
}
|
|
113
|
+
async promptForUsername() {
|
|
114
|
+
var _a;
|
|
115
|
+
const aliasOrUsername = (_a = core_1.ConfigAggregator.getValue(core_1.OrgConfigProperties.TARGET_ORG)) === null || _a === void 0 ? void 0 : _a.value;
|
|
116
|
+
const globalInfo = await core_1.GlobalInfo.getInstance();
|
|
117
|
+
const allAliases = globalInfo.aliases.getAll();
|
|
118
|
+
if (!aliasOrUsername) {
|
|
119
|
+
const authorizations = (await core_1.AuthInfo.listAllAuthorizations((orgAuth) => !orgAuth.error && orgAuth.isExpired !== true)).map((orgAuth) => {
|
|
120
|
+
const org = globalInfo.orgs.get(orgAuth.username);
|
|
121
|
+
const timestamp = org.timestamp ? new Date(org.timestamp) : new Date();
|
|
122
|
+
return { ...orgAuth, timestamp };
|
|
123
|
+
});
|
|
124
|
+
if (authorizations.length > 0) {
|
|
125
|
+
const newestAuths = authorizations.sort(compareOrgs);
|
|
126
|
+
const options = newestAuths.map((auth) => ({
|
|
127
|
+
name: auth.username,
|
|
128
|
+
aliases: Object.entries(allAliases)
|
|
129
|
+
.filter(([, usernameOrAlias]) => usernameOrAlias === auth.username)
|
|
130
|
+
.map(([alias]) => alias)
|
|
131
|
+
.join(', '),
|
|
132
|
+
isScratchOrg: auth.isScratchOrg ? 'Yes' : 'No',
|
|
133
|
+
value: auth.username,
|
|
134
|
+
}));
|
|
135
|
+
const columns = { name: 'Org', aliases: 'Aliases', isScratchOrg: 'Scratch Org' };
|
|
136
|
+
const { username } = await this.prompt([
|
|
137
|
+
{
|
|
138
|
+
name: 'username',
|
|
139
|
+
message: 'Select the org you want to deploy to:',
|
|
140
|
+
type: 'list',
|
|
141
|
+
choices: (0, sf_plugins_core_1.generateTableChoices)(columns, options, false),
|
|
142
|
+
},
|
|
143
|
+
]);
|
|
144
|
+
return username;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
throw messages.createError('errors.NoOrgsToSelect');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return globalInfo.aliases.resolveUsername(aliasOrUsername);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async promptForTestLevel() {
|
|
155
|
+
const { testLevel } = await this.prompt([
|
|
156
|
+
{
|
|
157
|
+
name: 'testLevel',
|
|
158
|
+
message: 'Select the test level you would like to run:',
|
|
159
|
+
type: 'list',
|
|
160
|
+
loop: false,
|
|
161
|
+
pageSize: 4,
|
|
162
|
+
choices: [
|
|
163
|
+
{ name: "Don't run tests", value: testLevel_1.TestLevel.NoTestRun, short: "Don't run tests" },
|
|
164
|
+
{ name: 'Run local tests', value: testLevel_1.TestLevel.RunLocalTests, short: 'Run local tests' },
|
|
165
|
+
{
|
|
166
|
+
name: 'Run all tests in environment',
|
|
167
|
+
value: testLevel_1.TestLevel.RunAllTestsInOrg,
|
|
168
|
+
short: 'Run all tests in environment',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
return testLevel;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.MetadataDeployer = MetadataDeployer;
|
|
177
|
+
MetadataDeployer.NAME = 'Salesforce Apps';
|
|
178
|
+
//# sourceMappingURL=metadataDeployer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataDeployer.js","sourceRoot":"","sources":["../../src/utils/metadataDeployer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2BAAyB;AACzB,iCAA6B;AAC7B,yCAA2C;AAC3C,2CAQ0B;AAC1B,iEAAyF;AAEzF,+DAA4D;AAC5D,qCAAiF;AACjF,2CAAwC;AACxC,+CAA+C;AAC/C,qCAA6C;AAE7C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,iBAAiB,CAAC,CAAC;AAIhG,MAAM,WAAW,GAAG,CAAC,CAAuB,EAAE,CAAuB,EAAU,EAAE;IAC/E,iCAAiC;IACjC,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE;QACrC,gDAAgD;QAChD,OAAO,CAAC,CAAC,CAAC;KACX;SAAM;QACL,8CAA8C;QAC9C,IAAI,CAAC,CAAC,YAAY,IAA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F,CAAC,CAAC;QACH,OAAO,SAAsB,CAAC;IAChC,CAAC;;AApHH,4CAqHC;AApHe,qBAAI,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, 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.getSourceApiVersion = exports.getPackageDirs = exports.resolveTargetOrg = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
+
const resolveTargetOrg = async (targetOrg) => {
|
|
13
|
+
const configuredTargetOrg = getConfigValue(core_1.OrgConfigProperties.TARGET_ORG);
|
|
14
|
+
const aliasOrUsername = targetOrg || configuredTargetOrg;
|
|
15
|
+
if (!aliasOrUsername) {
|
|
16
|
+
throw new core_1.SfdxError('no target environment specified', 'NoTargetEnv', [
|
|
17
|
+
'specify target environment with the --target-org flag',
|
|
18
|
+
'set the default environment with "sf config set target-org"',
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
return (await core_1.GlobalInfo.getInstance()).aliases.resolveUsername(aliasOrUsername);
|
|
22
|
+
};
|
|
23
|
+
exports.resolveTargetOrg = resolveTargetOrg;
|
|
24
|
+
const getPackageDirs = async () => {
|
|
25
|
+
const project = await core_1.SfdxProject.resolve();
|
|
26
|
+
return project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
|
|
27
|
+
};
|
|
28
|
+
exports.getPackageDirs = getPackageDirs;
|
|
29
|
+
const getConfigValue = (key) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return (_a = core_1.ConfigAggregator.getValue(key)) === null || _a === void 0 ? void 0 : _a.value;
|
|
32
|
+
};
|
|
33
|
+
const getSourceApiVersion = async () => {
|
|
34
|
+
const project = await core_1.SfdxProject.resolve();
|
|
35
|
+
const projectConfig = await project.resolveProjectConfig();
|
|
36
|
+
return (0, ts_types_1.getString)(projectConfig, 'sourceApiVersion');
|
|
37
|
+
};
|
|
38
|
+
exports.getSourceApiVersion = getSourceApiVersion;
|
|
39
|
+
//# sourceMappingURL=orgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orgs.js","sourceRoot":"","sources":["../../src/utils/orgs.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAA6G;AAC7G,mDAAoE;AAE7D,MAAM,gBAAgB,GAAG,KAAK,EAAE,SAA2B,EAAmB,EAAE;IACrF,MAAM,mBAAmB,GAAG,cAAc,CAAS,0BAAmB,CAAC,UAAU,CAAC,CAAC;IACnF,MAAM,eAAe,GAAG,SAAS,IAAI,mBAAmB,CAAC;IAEzD,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,gBAAS,CAAC,iCAAiC,EAAE,aAAa,EAAE;YACpE,uDAAuD;YACvD,6DAA6D;SAC9D,CAAC,CAAC;KACJ;IACD,OAAO,CAAC,MAAM,iBAAU,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;AACnF,CAAC,CAAC;AAXW,QAAA,gBAAgB,oBAW3B;AAEK,MAAM,cAAc,GAAG,KAAK,IAAuB,EAAE;IAC1D,MAAM,OAAO,GAAG,MAAM,kBAAW,CAAC,OAAO,EAAE,CAAC;IAC5C,OAAO,OAAO,CAAC,2BAA2B,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,MAAM,cAAc,GAAG,CAAoB,GAAW,EAAK,EAAE;;IAC3D,OAAO,MAAA,uBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,0CAAE,KAAU,CAAC;AACpD,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,KAAK,IAAqB,EAAE;IAC7D,MAAM,OAAO,GAAG,MAAM,kBAAW,CAAC,OAAO,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAC3D,OAAO,IAAA,oBAAS,EAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AACtD,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DeployResult, FileResponse, RetrieveResult } from '@sf/sdr';
|
|
2
|
+
import { Failures, Successes } from '@sf/sdr/lib/src/client/types';
|
|
3
|
+
import { TestLevel } from './testLevel';
|
|
4
|
+
export declare type PackageRetrieval = {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function asRelativePaths(fileResponses: FileResponse[]): FileResponse[];
|
|
9
|
+
/**
|
|
10
|
+
* Sorts file responds by type, then by filePath, then by fullName
|
|
11
|
+
*/
|
|
12
|
+
export declare function sortFileResponses(fileResponses: FileResponse[]): FileResponse[];
|
|
13
|
+
export declare function sortTestResults(results?: Failures[] | Successes[]): Failures[] | Successes[];
|
|
14
|
+
export declare function toArray<T>(entryOrArray: T | T[] | undefined): T[];
|
|
15
|
+
export declare function displaySuccesses(result: DeployResult | RetrieveResult): void;
|
|
16
|
+
export declare function displayPackages(result: RetrieveResult, packages: PackageRetrieval[]): void;
|
|
17
|
+
export declare function displayTestResults(result: DeployResult, testLevel: TestLevel): void;
|
|
18
|
+
export declare function displayFailures(result: DeployResult | RetrieveResult): void;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021, 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.displayFailures = exports.displayTestResults = exports.displayPackages = exports.displaySuccesses = exports.toArray = exports.sortTestResults = exports.sortFileResponses = exports.asRelativePaths = void 0;
|
|
10
|
+
const os = require("os");
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const core_1 = require("@oclif/core");
|
|
13
|
+
const chalk_1 = require("chalk");
|
|
14
|
+
const sdr_1 = require("@sf/sdr");
|
|
15
|
+
const types_1 = require("@sf/sdr/lib/src/client/types");
|
|
16
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
17
|
+
const testLevel_1 = require("./testLevel");
|
|
18
|
+
function info(message) {
|
|
19
|
+
return (0, chalk_1.blue)((0, chalk_1.bold)(message));
|
|
20
|
+
}
|
|
21
|
+
function error(message) {
|
|
22
|
+
return (0, chalk_1.red)((0, chalk_1.bold)(message));
|
|
23
|
+
}
|
|
24
|
+
function table(responses, columns, options) {
|
|
25
|
+
// Interfaces cannot be casted to Record<string, unknown> so we have to cast to unknown first
|
|
26
|
+
// See https://github.com/microsoft/TypeScript/issues/15300
|
|
27
|
+
core_1.CliUx.ux.table(responses, columns, options);
|
|
28
|
+
}
|
|
29
|
+
function asRelativePaths(fileResponses) {
|
|
30
|
+
fileResponses.forEach((file) => {
|
|
31
|
+
if (file.filePath) {
|
|
32
|
+
file.filePath = path.relative(process.cwd(), file.filePath);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return fileResponses;
|
|
36
|
+
}
|
|
37
|
+
exports.asRelativePaths = asRelativePaths;
|
|
38
|
+
/**
|
|
39
|
+
* Sorts file responds by type, then by filePath, then by fullName
|
|
40
|
+
*/
|
|
41
|
+
function sortFileResponses(fileResponses) {
|
|
42
|
+
return fileResponses.sort((i, j) => {
|
|
43
|
+
if (i.type === j.type && i.filePath && j.filePath) {
|
|
44
|
+
if (i.filePath === j.filePath) {
|
|
45
|
+
return i.fullName > j.fullName ? 1 : -1;
|
|
46
|
+
}
|
|
47
|
+
return (i === null || i === void 0 ? void 0 : i.filePath) > (j === null || j === void 0 ? void 0 : j.filePath) ? 1 : -1;
|
|
48
|
+
}
|
|
49
|
+
return i.type > j.type ? 1 : -1;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.sortFileResponses = sortFileResponses;
|
|
53
|
+
function sortTestResults(results = []) {
|
|
54
|
+
return results.sort((a, b) => {
|
|
55
|
+
if (a.methodName === b.methodName) {
|
|
56
|
+
return a.name.localeCompare(b.name);
|
|
57
|
+
}
|
|
58
|
+
return a.methodName.localeCompare(b.methodName);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.sortTestResults = sortTestResults;
|
|
62
|
+
function toArray(entryOrArray) {
|
|
63
|
+
if (entryOrArray) {
|
|
64
|
+
return Array.isArray(entryOrArray) ? entryOrArray : [entryOrArray];
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
exports.toArray = toArray;
|
|
69
|
+
function displaySuccesses(result) {
|
|
70
|
+
var _a;
|
|
71
|
+
const fileResponses = asRelativePaths((_a = result.getFileResponses()) !== null && _a !== void 0 ? _a : []);
|
|
72
|
+
const successes = sortFileResponses(fileResponses.filter((f) => f.state !== 'Failed'));
|
|
73
|
+
if (!successes.length)
|
|
74
|
+
return;
|
|
75
|
+
const columns = {
|
|
76
|
+
state: { header: 'State' },
|
|
77
|
+
fullName: { header: 'Name' },
|
|
78
|
+
type: { header: 'Type' },
|
|
79
|
+
filePath: { header: 'Path' },
|
|
80
|
+
};
|
|
81
|
+
const title = result instanceof sdr_1.DeployResult ? 'Deployed Source' : 'Retrieved Source';
|
|
82
|
+
const options = { title: info(title) };
|
|
83
|
+
core_1.CliUx.ux.log();
|
|
84
|
+
table(successes, columns, options);
|
|
85
|
+
}
|
|
86
|
+
exports.displaySuccesses = displaySuccesses;
|
|
87
|
+
function displayPackages(result, packages) {
|
|
88
|
+
if (packages === null || packages === void 0 ? void 0 : packages.length) {
|
|
89
|
+
const columns = {
|
|
90
|
+
name: { header: 'Package Name' },
|
|
91
|
+
path: { header: 'Converted Location' },
|
|
92
|
+
};
|
|
93
|
+
const title = 'Retrieved Packages';
|
|
94
|
+
const options = { title: info(title) };
|
|
95
|
+
core_1.CliUx.ux.log();
|
|
96
|
+
table(packages, columns, options);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.displayPackages = displayPackages;
|
|
100
|
+
function displayTestResults(result, testLevel) {
|
|
101
|
+
var _a, _b, _c, _d;
|
|
102
|
+
if (testLevel === testLevel_1.TestLevel.NoTestRun) {
|
|
103
|
+
core_1.CliUx.ux.log();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if ((_a = result === null || result === void 0 ? void 0 : result.response) === null || _a === void 0 ? void 0 : _a.numberTestErrors) {
|
|
107
|
+
const failures = toArray((_c = (_b = result.response.details) === null || _b === void 0 ? void 0 : _b.runTestResult) === null || _c === void 0 ? void 0 : _c.failures);
|
|
108
|
+
const failureCount = (_d = result.response.details.runTestResult) === null || _d === void 0 ? void 0 : _d.numFailures;
|
|
109
|
+
const tests = sortTestResults(failures);
|
|
110
|
+
core_1.CliUx.ux.log();
|
|
111
|
+
core_1.CliUx.ux.log(error(`Test Failures [${failureCount}]`));
|
|
112
|
+
for (const test of tests) {
|
|
113
|
+
const testName = (0, chalk_1.underline)(`${test.name}.${test.methodName}`);
|
|
114
|
+
const stackTrace = test.stackTrace.replace(/\n/g, `${os.EOL} `);
|
|
115
|
+
core_1.CliUx.ux.log(`• ${testName}`);
|
|
116
|
+
core_1.CliUx.ux.log(` ${(0, chalk_1.dim)('message')}: ${test.message}`);
|
|
117
|
+
core_1.CliUx.ux.log(` ${(0, chalk_1.dim)('stacktrace')}: ${os.EOL} ${stackTrace}`);
|
|
118
|
+
core_1.CliUx.ux.log();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
core_1.CliUx.ux.log();
|
|
122
|
+
core_1.CliUx.ux.log(info('Test Results Summary'));
|
|
123
|
+
const passing = (0, ts_types_1.get)(result, 'response.numberTestsCompleted', 0);
|
|
124
|
+
const failing = (0, ts_types_1.get)(result, 'response.numberTestErrors', 0);
|
|
125
|
+
const total = (0, ts_types_1.get)(result, 'response.numberTestsTotal', 0);
|
|
126
|
+
const time = (0, ts_types_1.get)(result, 'response.details.runTestResult.totalTime', 0);
|
|
127
|
+
core_1.CliUx.ux.log(`Passing: ${passing}`);
|
|
128
|
+
core_1.CliUx.ux.log(`Failing: ${failing}`);
|
|
129
|
+
core_1.CliUx.ux.log(`Total: ${total}`);
|
|
130
|
+
if (time)
|
|
131
|
+
core_1.CliUx.ux.log(`Time: ${time}`);
|
|
132
|
+
}
|
|
133
|
+
exports.displayTestResults = displayTestResults;
|
|
134
|
+
function displayFailures(result) {
|
|
135
|
+
var _a;
|
|
136
|
+
if (result.response.status === types_1.RequestStatus.Succeeded)
|
|
137
|
+
return;
|
|
138
|
+
const fileResponses = asRelativePaths((_a = result.getFileResponses()) !== null && _a !== void 0 ? _a : []);
|
|
139
|
+
const failures = sortFileResponses(fileResponses.filter((f) => f.state === 'Failed'));
|
|
140
|
+
if (!failures.length)
|
|
141
|
+
return;
|
|
142
|
+
const columns = {
|
|
143
|
+
problemType: { header: 'Type' },
|
|
144
|
+
fullName: { header: 'Name' },
|
|
145
|
+
error: { header: 'Problem' },
|
|
146
|
+
};
|
|
147
|
+
const options = { title: error(`Component Failures [${failures.length}]`) };
|
|
148
|
+
core_1.CliUx.ux.log();
|
|
149
|
+
table(failures, columns, options);
|
|
150
|
+
}
|
|
151
|
+
exports.displayFailures = displayFailures;
|
|
152
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],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O,GAAG;QACd,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QAC/B,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QAC5B,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;KAC7B,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IAC5E,YAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;IACf,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAfD,0CAeC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MetadataApiDeploy } from '@sf/sdr';
|
|
2
|
+
import { Progress } from '@salesforce/sf-plugins-core';
|
|
3
|
+
export declare class DeployProgress extends Progress {
|
|
4
|
+
private deploy;
|
|
5
|
+
private static OPTIONS;
|
|
6
|
+
constructor(deploy: MetadataApiDeploy, jsonEnabled?: boolean);
|
|
7
|
+
start(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.DeployProgress = void 0;
|
|
10
|
+
const kit_1 = require("@salesforce/kit");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const mdTrasferMessages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'metadata.transfer');
|
|
15
|
+
class DeployProgress extends sf_plugins_core_1.Progress {
|
|
16
|
+
constructor(deploy, jsonEnabled = false) {
|
|
17
|
+
super(!jsonEnabled && kit_1.env.getBoolean('SF_USE_PROGRESS_BAR', true));
|
|
18
|
+
this.deploy = deploy;
|
|
19
|
+
}
|
|
20
|
+
start() {
|
|
21
|
+
this.deploy.onUpdate((data) => {
|
|
22
|
+
var _a;
|
|
23
|
+
// the numCompTot. isn't computed right away, wait to start until we know how many we have
|
|
24
|
+
if (data.numberComponentsTotal) {
|
|
25
|
+
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
|
|
26
|
+
this.update(data.numberComponentsDeployed + data.numberTestsCompleted, {
|
|
27
|
+
status: mdTrasferMessages.getMessage(data.status),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
super.start(0, { status: (_a = mdTrasferMessages.getMessage(data.status)) !== null && _a !== void 0 ? _a : 'Waiting' }, DeployProgress.OPTIONS);
|
|
32
|
+
}
|
|
33
|
+
// the numTestsTot. isn't computed until validated as tests by the server, update the PB once we know
|
|
34
|
+
if (data.numberTestsTotal && data.numberComponentsTotal) {
|
|
35
|
+
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// any thing else should stop the progress bar
|
|
39
|
+
this.deploy.onFinish((data) => this.finish({ status: mdTrasferMessages.getMessage(data.response.status) }));
|
|
40
|
+
this.deploy.onCancel(() => this.stop());
|
|
41
|
+
this.deploy.onError((error) => {
|
|
42
|
+
this.stop();
|
|
43
|
+
throw error;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.DeployProgress = DeployProgress;
|
|
48
|
+
DeployProgress.OPTIONS = {
|
|
49
|
+
title: 'Status',
|
|
50
|
+
format: '%s: {status} | {bar} | {value}/{total} Components',
|
|
51
|
+
barCompleteChar: '\u2588',
|
|
52
|
+
barIncompleteChar: '\u2591',
|
|
53
|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AAgB,IAAI,IAAI,CAAC,qBAAqB,EAAE;gBACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnE;QACH,CAAC,CAAC,CAAC;QAEH,8CAA8C;QAC9C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAE5G,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;;AAxCH,wCAyCC;AAxCgB,sBAAO,GAAG;IACvB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,mDAAmD;IAC3D,eAAe,EAAE,QAAQ;IACzB,iBAAiB,EAAE,QAAQ;IAC3B,QAAQ,EAAE,IAAI;CACf,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateOneOfCommandFlags = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'required.flag');
|
|
13
|
+
function validateOneOfCommandFlags(oneOf, flags) {
|
|
14
|
+
if (!Object.keys(flags).some((flag) => oneOf.includes(flag))) {
|
|
15
|
+
throw messages.createError('errors.RequiredOneOfFlagsMissing', [oneOf.join(', ')]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.validateOneOfCommandFlags = validateOneOfCommandFlags;
|
|
19
|
+
//# sourceMappingURL=requiredFlagValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requiredFlagValidator.js","sourceRoot":"","sources":["../../src/utils/requiredFlagValidator.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2CAA4C;AAE5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,eAAe,CAAC,CAAC;AAE9F,SAAgB,yBAAyB,CAAC,KAAe,EAAE,KAAkC;IAC3F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE;QAC5D,MAAM,QAAQ,CAAC,WAAW,CAAC,kCAAkC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACpF;AACH,CAAC;AAJD,8DAIC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021, 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.TestLevel = void 0;
|
|
10
|
+
var TestLevel;
|
|
11
|
+
(function (TestLevel) {
|
|
12
|
+
TestLevel["NoTestRun"] = "NoTestRun";
|
|
13
|
+
TestLevel["RunSpecifiedTests"] = "RunSpecifiedTests";
|
|
14
|
+
TestLevel["RunLocalTests"] = "RunLocalTests";
|
|
15
|
+
TestLevel["RunAllTestsInOrg"] = "RunAllTestsInOrg";
|
|
16
|
+
})(TestLevel = exports.TestLevel || (exports.TestLevel = {}));
|
|
17
|
+
//# sourceMappingURL=testLevel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testLevel.js","sourceRoot":"","sources":["../../src/utils/testLevel.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,kDAAqC,CAAA;AACvC,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB"}
|