@salesforce/plugin-deploy-retrieve 1.8.4 → 1.8.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/deploy.d.ts +5 -0
- package/lib/commands/deploy.js +5 -0
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/project/convert/mdapi.d.ts +32 -0
- package/lib/commands/project/convert/mdapi.js +173 -0
- package/lib/commands/project/convert/mdapi.js.map +1 -0
- package/lib/commands/project/convert/source.d.ts +29 -0
- package/lib/commands/project/convert/source.js +141 -0
- package/lib/commands/project/convert/source.js.map +1 -0
- package/lib/commands/project/delete/source.d.ts +69 -0
- package/lib/commands/project/delete/source.js +423 -0
- package/lib/commands/project/delete/source.js.map +1 -0
- package/lib/commands/project/delete/tracking.d.ts +19 -0
- package/lib/commands/project/delete/tracking.js +49 -0
- package/lib/commands/project/delete/tracking.js.map +1 -0
- package/lib/commands/{deploy/metadata → project/deploy}/cancel.d.ts +2 -0
- package/lib/commands/{deploy/metadata → project/deploy}/cancel.js +13 -3
- package/lib/commands/project/deploy/cancel.js.map +1 -0
- package/lib/commands/{deploy/metadata → project/deploy}/preview.d.ts +3 -0
- package/lib/commands/{deploy/metadata → project/deploy}/preview.js +9 -3
- package/lib/commands/project/deploy/preview.js.map +1 -0
- package/lib/commands/{deploy/metadata → project/deploy}/quick.d.ts +3 -0
- package/lib/commands/{deploy/metadata → project/deploy}/quick.js +10 -4
- package/lib/commands/project/deploy/quick.js.map +1 -0
- package/lib/commands/project/deploy/report.d.ts +22 -0
- package/lib/commands/{deploy/metadata → project/deploy}/report.js +25 -4
- package/lib/commands/project/deploy/report.js.map +1 -0
- package/lib/commands/{deploy/metadata → project/deploy}/resume.d.ts +5 -0
- package/lib/commands/{deploy/metadata → project/deploy}/resume.js +17 -2
- package/lib/commands/project/deploy/resume.js.map +1 -0
- package/lib/commands/{deploy/metadata.d.ts → project/deploy/start.d.ts} +10 -2
- package/lib/commands/{deploy/metadata.js → project/deploy/start.js} +40 -11
- package/lib/commands/project/deploy/start.js.map +1 -0
- package/lib/commands/{deploy/metadata → project/deploy}/validate.d.ts +2 -0
- package/lib/commands/{deploy/metadata → project/deploy}/validate.js +4 -4
- package/lib/commands/project/deploy/validate.js.map +1 -0
- package/lib/commands/project/manifest/create.d.ts +26 -0
- package/lib/commands/project/manifest/create.js +133 -0
- package/lib/commands/project/manifest/create.js.map +1 -0
- package/lib/commands/project/reset/tracking.d.ts +21 -0
- package/lib/commands/project/reset/tracking.js +64 -0
- package/lib/commands/project/reset/tracking.js.map +1 -0
- package/lib/commands/{retrieve/metadata → project/retrieve}/preview.d.ts +2 -0
- package/lib/commands/{retrieve/metadata → project/retrieve}/preview.js +2 -0
- package/lib/commands/project/retrieve/preview.js.map +1 -0
- package/lib/commands/{retrieve/metadata.d.ts → project/retrieve/start.d.ts} +3 -1
- package/lib/commands/{retrieve/metadata.js → project/retrieve/start.js} +8 -6
- package/lib/commands/project/retrieve/start.js.map +1 -0
- package/lib/utils/coverage.d.ts +9 -0
- package/lib/utils/coverage.js +111 -0
- package/lib/utils/coverage.js.map +1 -0
- package/lib/utils/deploy.d.ts +9 -5
- package/lib/utils/deploy.js +21 -24
- package/lib/utils/deploy.js.map +1 -1
- package/lib/utils/deployCache.d.ts +8 -2
- package/lib/utils/deployCache.js +11 -2
- package/lib/utils/deployCache.js.map +1 -1
- package/lib/utils/flags.js +1 -5
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/manifestCache.d.ts +5 -0
- package/lib/utils/manifestCache.js +38 -0
- package/lib/utils/manifestCache.js.map +1 -0
- package/lib/utils/metadataDeployer.js +1 -0
- package/lib/utils/metadataDeployer.js.map +1 -1
- package/lib/utils/output.d.ts +44 -4
- package/lib/utils/output.js +220 -38
- package/lib/utils/output.js.map +1 -1
- package/lib/utils/previewOutput.d.ts +2 -1
- package/lib/utils/previewOutput.js +14 -22
- package/lib/utils/previewOutput.js.map +1 -1
- package/lib/utils/types.d.ts +35 -0
- package/lib/utils/types.js +3 -1
- package/lib/utils/types.js.map +1 -1
- package/messages/convert.mdapi.md +78 -0
- package/messages/convert.source.md +64 -0
- package/messages/delete.source.md +122 -0
- package/messages/delete.tracking.md +34 -0
- package/messages/deploy.async.md +3 -3
- package/messages/deploy.md +5 -1
- package/messages/deploy.metadata.cancel.md +10 -6
- package/messages/deploy.metadata.md +33 -5
- package/messages/deploy.metadata.preview.md +7 -3
- package/messages/deploy.metadata.quick.md +11 -3
- package/messages/deploy.metadata.report.md +24 -4
- package/messages/deploy.metadata.resume.md +17 -5
- package/messages/deploy.metadata.validate.md +9 -5
- package/messages/manifest.create.md +61 -0
- package/messages/retrieve.metadata.md +1 -1
- package/messages/retrieve.metadata.preview.md +3 -3
- package/oclif.manifest.json +1673 -665
- package/package.json +45 -32
- package/schemas/project-convert-mdapi.json +29 -0
- package/schemas/project-delete-source.json +609 -0
- package/schemas/project-delete-tracking.json +19 -0
- package/schemas/project-manifest-create.json +19 -0
- package/schemas/project-reset-tracking.json +19 -0
- package/lib/commands/deploy/metadata/cancel.js.map +0 -1
- package/lib/commands/deploy/metadata/preview.js.map +0 -1
- package/lib/commands/deploy/metadata/quick.js.map +0 -1
- package/lib/commands/deploy/metadata/report.d.ts +0 -14
- package/lib/commands/deploy/metadata/report.js.map +0 -1
- package/lib/commands/deploy/metadata/resume.js.map +0 -1
- package/lib/commands/deploy/metadata/validate.js.map +0 -1
- package/lib/commands/deploy/metadata.js.map +0 -1
- package/lib/commands/retrieve/metadata/preview.js.map +0 -1
- package/lib/commands/retrieve/metadata.js.map +0 -1
- /package/schemas/{deploy-metadata-cancel.json → project-deploy-cancel.json} +0 -0
- /package/schemas/{deploy-metadata-preview.json → project-deploy-preview.json} +0 -0
- /package/schemas/{deploy-metadata-quick.json → project-deploy-quick.json} +0 -0
- /package/schemas/{deploy-metadata-report.json → project-deploy-report.json} +0 -0
- /package/schemas/{deploy-metadata-resume.json → project-deploy-resume.json} +0 -0
- /package/schemas/{deploy-metadata-validate.json → project-deploy-start.json} +0 -0
- /package/schemas/{deploy-metadata.json → project-deploy-validate.json} +0 -0
- /package/schemas/{retrieve-metadata-preview.json → project-retrieve-preview.json} +0 -0
- /package/schemas/{retrieve-metadata.json → project-retrieve-start.json} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Create = void 0;
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
7
|
+
* All rights reserved.
|
|
8
|
+
* Licensed under the BSD 3-Clause license.
|
|
9
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
10
|
+
*/
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const core_1 = require("@salesforce/core");
|
|
14
|
+
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
15
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
16
|
+
const project_1 = require("../../../utils/project");
|
|
17
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
18
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'manifest.create');
|
|
19
|
+
const manifestTypes = {
|
|
20
|
+
pre: 'destructiveChangesPre.xml',
|
|
21
|
+
post: 'destructiveChangesPost.xml',
|
|
22
|
+
destroy: 'destructiveChanges.xml',
|
|
23
|
+
package: 'package.xml',
|
|
24
|
+
};
|
|
25
|
+
const packageTypes = {
|
|
26
|
+
managed: ['beta', 'deleted', 'deprecated', 'installed', 'released'],
|
|
27
|
+
unlocked: ['deprecatedEditable', 'installedEditable'],
|
|
28
|
+
};
|
|
29
|
+
const xorFlags = ['metadata', 'source-path', 'from-org'];
|
|
30
|
+
class Create extends sf_plugins_core_1.SfCommand {
|
|
31
|
+
async run() {
|
|
32
|
+
const { flags } = await this.parse(Create);
|
|
33
|
+
// convert the manifesttype into one of the "official" manifest names
|
|
34
|
+
// if no manifesttype flag passed, use the manifestname?flag
|
|
35
|
+
// if no manifestname flag, default to 'package.xml'
|
|
36
|
+
const manifestTypeFromFlag = flags['manifest-type'];
|
|
37
|
+
const manifestName = ensureFileEnding(typeof manifestTypeFromFlag === 'string'
|
|
38
|
+
? manifestTypes[manifestTypeFromFlag]
|
|
39
|
+
: flags['manifest-name'] ?? 'package.xml', '.xml');
|
|
40
|
+
const componentSet = await source_deploy_retrieve_1.ComponentSetBuilder.build({
|
|
41
|
+
apiversion: flags['api-version'] ?? (await (0, project_1.getSourceApiVersion)()),
|
|
42
|
+
sourcepath: flags['source-path'],
|
|
43
|
+
metadata: flags.metadata
|
|
44
|
+
? {
|
|
45
|
+
metadataEntries: flags.metadata,
|
|
46
|
+
directoryPaths: await (0, project_1.getPackageDirs)(),
|
|
47
|
+
}
|
|
48
|
+
: undefined,
|
|
49
|
+
org: flags['from-org']
|
|
50
|
+
? {
|
|
51
|
+
username: flags['from-org'].getUsername(),
|
|
52
|
+
exclude: exclude(flags['include-packages']),
|
|
53
|
+
}
|
|
54
|
+
: undefined,
|
|
55
|
+
});
|
|
56
|
+
const outputDir = flags['output-dir'];
|
|
57
|
+
if (outputDir) {
|
|
58
|
+
await fs.promises.mkdir(outputDir, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
const outputPath = outputDir ? (0, path_1.join)(outputDir, manifestName) : manifestName;
|
|
61
|
+
await fs.promises.writeFile(outputPath, await componentSet.getPackageXml());
|
|
62
|
+
this.log(outputDir
|
|
63
|
+
? messages.getMessage('successOutputDir', [manifestName, outputDir])
|
|
64
|
+
: messages.getMessage('success', [manifestName]));
|
|
65
|
+
return { path: outputPath, name: manifestName };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Create = Create;
|
|
69
|
+
_a = Create;
|
|
70
|
+
Create.summary = messages.getMessage('description');
|
|
71
|
+
Create.description = messages.getMessage('description');
|
|
72
|
+
Create.examples = messages.getMessages('examples');
|
|
73
|
+
Create.aliases = ['force:source:manifest:create'];
|
|
74
|
+
Create.deprecateAliases = true;
|
|
75
|
+
Create.requiresProject = true;
|
|
76
|
+
Create.flags = {
|
|
77
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
78
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
79
|
+
metadata: (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
80
|
+
char: 'm',
|
|
81
|
+
description: messages.getMessage('flags.metadata'),
|
|
82
|
+
exactlyOne: xorFlags,
|
|
83
|
+
}),
|
|
84
|
+
'source-path': (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
85
|
+
char: 'p',
|
|
86
|
+
aliases: ['sourcepath'],
|
|
87
|
+
deprecateAliases: true,
|
|
88
|
+
description: messages.getMessage('flags.source-path'),
|
|
89
|
+
exactlyOne: xorFlags,
|
|
90
|
+
}),
|
|
91
|
+
'manifest-name': sf_plugins_core_1.Flags.string({
|
|
92
|
+
char: 'n',
|
|
93
|
+
aliases: ['manifestname'],
|
|
94
|
+
deprecateAliases: true,
|
|
95
|
+
summary: messages.getMessage('flags.manifest-name'),
|
|
96
|
+
exclusive: ['manifest-type'],
|
|
97
|
+
}),
|
|
98
|
+
'manifest-type': sf_plugins_core_1.Flags.string({
|
|
99
|
+
aliases: ['manifesttype'],
|
|
100
|
+
deprecateAliases: true,
|
|
101
|
+
summary: messages.getMessage('flags.manifest-type'),
|
|
102
|
+
options: Object.keys(manifestTypes),
|
|
103
|
+
char: 't',
|
|
104
|
+
}),
|
|
105
|
+
'include-packages': (0, sf_plugins_core_1.arrayWithDeprecation)({
|
|
106
|
+
aliases: ['includepackages'],
|
|
107
|
+
deprecateAliases: true,
|
|
108
|
+
description: messages.getMessage('flags.include-packages'),
|
|
109
|
+
options: Object.keys(packageTypes),
|
|
110
|
+
char: 'c',
|
|
111
|
+
dependsOn: ['fromorg'],
|
|
112
|
+
}),
|
|
113
|
+
'from-org': sf_plugins_core_1.Flags.custom({
|
|
114
|
+
summary: messages.getMessage('flags.from-org'),
|
|
115
|
+
exactlyOne: xorFlags,
|
|
116
|
+
aliases: ['fromorg'],
|
|
117
|
+
deprecateAliases: true,
|
|
118
|
+
parse: async (input) => (input ? core_1.Org.create({ aliasOrUsername: input }) : undefined),
|
|
119
|
+
})(),
|
|
120
|
+
'output-dir': sf_plugins_core_1.Flags.string({
|
|
121
|
+
char: 'd',
|
|
122
|
+
aliases: ['outputdir', 'o'],
|
|
123
|
+
deprecateAliases: true,
|
|
124
|
+
summary: messages.getMessage('flags.output-dir'),
|
|
125
|
+
}),
|
|
126
|
+
};
|
|
127
|
+
const ensureFileEnding = (fileName, fileEnding) => fileName.endsWith(fileEnding) ? fileName : `${fileName}${fileEnding}`;
|
|
128
|
+
const exclude = (includedPackages) => includedPackages
|
|
129
|
+
? Object.entries(packageTypes)
|
|
130
|
+
.filter(([type]) => !includedPackages.includes(type))
|
|
131
|
+
.flatMap(([, types]) => types)
|
|
132
|
+
: Object.values(packageTypes).flat();
|
|
133
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/project/manifest/create.ts"],"names":[],"mappings":";;;;AAAA;;;;;GAKG;AACH,+BAA4B;AAC5B,yBAAyB;AACzB,2CAAiD;AACjD,+EAAyE;AACzE,iEAMqC;AACrC,oDAA6E;AAE7E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,iBAAiB,CAAC,CAAC;AAEhG,MAAM,aAAa,GAAG;IACpB,GAAG,EAAE,2BAA2B;IAChC,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,aAAa;CACd,CAAC;AAEX,MAAM,YAAY,GAA6B;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,IAAI;QACtB,KAAK,EAAE,KAAK,EAAE,KAAyB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAG,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KACzG,CAAC,EAAE;IACJ,YAAY,EAAE,uBAAK,CAAC,MAAM,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC;QAC3B,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC;KACjD,CAAC;CACH,CAAC;AAkDJ,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,UAAkB,EAAU,EAAE,CACxE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,UAAU,EAAE,CAAC;AAExE,MAAM,OAAO,GAAG,CAAC,gBAAsC,EAAY,EAAE,CACnE,gBAAgB;IACd,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACpD,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;IAClC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type ResetTrackingResult = {
|
|
3
|
+
sourceMembersSynced: number;
|
|
4
|
+
localPathsSynced: number;
|
|
5
|
+
};
|
|
6
|
+
export declare class ResetTracking extends SfCommand<ResetTrackingResult> {
|
|
7
|
+
static readonly deprecateAliases = true;
|
|
8
|
+
static readonly aliases: string[];
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly requiresProject = true;
|
|
12
|
+
static readonly examples: never[];
|
|
13
|
+
static readonly flags: {
|
|
14
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
+
revision: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
+
'no-prompt': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<ResetTrackingResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.ResetTracking = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const chalk = require("chalk");
|
|
12
|
+
const source_tracking_1 = require("@salesforce/source-tracking");
|
|
13
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'delete.tracking');
|
|
16
|
+
class ResetTracking extends sf_plugins_core_1.SfCommand {
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(ResetTracking);
|
|
19
|
+
if (flags['no-prompt'] || (await this.confirm(chalk.dim(messages.getMessage('promptMessage'))))) {
|
|
20
|
+
const sourceTracking = await source_tracking_1.SourceTracking.create({
|
|
21
|
+
project: this.project,
|
|
22
|
+
org: flags['target-org'],
|
|
23
|
+
});
|
|
24
|
+
const [remoteResets, localResets] = await Promise.all([
|
|
25
|
+
sourceTracking.resetRemoteTracking(flags.revision),
|
|
26
|
+
sourceTracking.resetLocalTracking(),
|
|
27
|
+
]);
|
|
28
|
+
this.logSuccess(`Reset local tracking files${flags.revision ? ` to revision ${flags.revision}` : ''}.`);
|
|
29
|
+
return {
|
|
30
|
+
sourceMembersSynced: remoteResets,
|
|
31
|
+
localPathsSynced: localResets.length,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
sourceMembersSynced: 0,
|
|
36
|
+
localPathsSynced: 0,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ResetTracking = ResetTracking;
|
|
41
|
+
ResetTracking.deprecateAliases = true;
|
|
42
|
+
ResetTracking.aliases = ['force:source:beta:tracking:reset', 'force:source:tracking:reset'];
|
|
43
|
+
ResetTracking.summary = messages.getMessage('resetDescription');
|
|
44
|
+
ResetTracking.description = messages.getMessage('resetDescription');
|
|
45
|
+
ResetTracking.requiresProject = true;
|
|
46
|
+
ResetTracking.examples = [];
|
|
47
|
+
ResetTracking.flags = {
|
|
48
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
49
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
50
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
51
|
+
// eslint-disable-next-line sf-plugin/flag-min-max-default
|
|
52
|
+
revision: sf_plugins_core_1.Flags.integer({
|
|
53
|
+
char: 'r',
|
|
54
|
+
summary: messages.getMessage('revisionDescription'),
|
|
55
|
+
min: 0,
|
|
56
|
+
}),
|
|
57
|
+
'no-prompt': sf_plugins_core_1.Flags.boolean({
|
|
58
|
+
char: 'p',
|
|
59
|
+
summary: messages.getMessage('no-promptDescription'),
|
|
60
|
+
aliases: ['noprompt'],
|
|
61
|
+
deprecateAliases: true,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../../../src/commands/project/reset/tracking.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAA4C;AAC5C,+BAA+B;AAC/B,iEAA6D;AAC7D,iEAMqC;AAErC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,iBAAiB,CAAC,CAAC;AAOhG,MAAa,aAAc,SAAQ,2BAA8B;IA0BxD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAElD,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE;YAC/F,MAAM,cAAc,GAAG,MAAM,gCAAc,CAAC,MAAM,CAAC;gBACjD,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC;aACzB,CAAC,CAAC;YAEH,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACpD,cAAc,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAClD,cAAc,CAAC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
|
static readonly examples: string[];
|
|
7
7
|
static readonly requiresProject = true;
|
|
8
8
|
static readonly state = "beta";
|
|
9
|
+
static readonly aliases: string[];
|
|
10
|
+
static readonly deprecateAliases = true;
|
|
9
11
|
static readonly flags: {
|
|
10
12
|
'ignore-conflicts': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
13
|
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
@@ -47,6 +47,8 @@ RetrieveMetadataPreview.summary = messages.getMessage('summary');
|
|
|
47
47
|
RetrieveMetadataPreview.examples = messages.getMessages('examples');
|
|
48
48
|
RetrieveMetadataPreview.requiresProject = true;
|
|
49
49
|
RetrieveMetadataPreview.state = 'beta';
|
|
50
|
+
RetrieveMetadataPreview.aliases = ['retrieve:metadata:preview'];
|
|
51
|
+
RetrieveMetadataPreview.deprecateAliases = true;
|
|
50
52
|
RetrieveMetadataPreview.flags = {
|
|
51
53
|
'ignore-conflicts': sf_plugins_core_1.Flags.boolean({
|
|
52
54
|
char: 'c',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../../src/commands/project/retrieve/preview.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA4C;AAC5C,iEAA+D;AAC/D,iEAA6D;AAC7D,+EAAiE;AACjE,gEAA4G;AAE5G,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,2BAA2B,CAAC,CAAC;AAE1G,MAAqB,uBAAwB,SAAQ,2BAAwB;IAwBpE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE5D,MAAM,GAAG,GAAG,MAAM,gCAAc,CAAC,MAAM,CAA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C,CAAC;AACxC,wCAAgB,GAAG,IAAI,CAAC;AAExB,6BAAK,GAAG;IAC7B,kBAAkB,EAAE,uBAAK,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;QAC9D,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,oCAAoC,CAAC;QACtE,OAAO,EAAE,KAAK;KACf,CAAC;IACF,YAAY,EAAE,uBAAK,CAAC,WAAW,CAAC;QAC9B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC;QAChE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;QACxD,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC"}
|
|
@@ -2,13 +2,15 @@ import { SfError } from '@salesforce/core';
|
|
|
2
2
|
import { RetrieveResult } from '@salesforce/source-deploy-retrieve';
|
|
3
3
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
4
4
|
import { Duration } from '@salesforce/kit';
|
|
5
|
-
import { RetrieveResultJson } from '
|
|
5
|
+
import { RetrieveResultJson } from '../../../utils/types';
|
|
6
6
|
export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
|
|
7
7
|
static readonly summary: string;
|
|
8
8
|
static readonly description: string;
|
|
9
9
|
static readonly examples: string[];
|
|
10
10
|
static readonly requiresProject = true;
|
|
11
11
|
static readonly state = "beta";
|
|
12
|
+
static readonly aliases: string[];
|
|
13
|
+
static readonly deprecateAliases = true;
|
|
12
14
|
static readonly flags: {
|
|
13
15
|
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
16
|
'ignore-conflicts': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -14,10 +14,10 @@ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
|
14
14
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
15
|
const source_tracking_1 = require("@salesforce/source-tracking");
|
|
16
16
|
const kit_1 = require("@salesforce/kit");
|
|
17
|
-
const flags_1 = require("
|
|
18
|
-
const output_1 = require("
|
|
19
|
-
const project_1 = require("
|
|
20
|
-
const conflicts_1 = require("
|
|
17
|
+
const flags_1 = require("../../../utils/flags");
|
|
18
|
+
const output_1 = require("../../../utils/output");
|
|
19
|
+
const project_1 = require("../../../utils/project");
|
|
20
|
+
const conflicts_1 = require("../../../utils/conflicts");
|
|
21
21
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
22
22
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'retrieve.metadata');
|
|
23
23
|
const mdTransferMessages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'metadata.transfer');
|
|
@@ -93,7 +93,7 @@ class RetrieveMetadata extends sf_plugins_core_1.SfCommand {
|
|
|
93
93
|
await retrieve.start();
|
|
94
94
|
const result = await retrieve.pollStatus(500, flags.wait.seconds);
|
|
95
95
|
this.spinner.stop();
|
|
96
|
-
// reference the flag instead of `
|
|
96
|
+
// reference the flag instead of `format` so we get correct type
|
|
97
97
|
const formatter = flags['target-metadata-dir']
|
|
98
98
|
? new output_1.MetadataRetrieveResultFormatter(result, {
|
|
99
99
|
'target-metadata-dir': flags['target-metadata-dir'],
|
|
@@ -142,6 +142,8 @@ RetrieveMetadata.description = messages.getMessage('description');
|
|
|
142
142
|
RetrieveMetadata.examples = messages.getMessages('examples');
|
|
143
143
|
RetrieveMetadata.requiresProject = true;
|
|
144
144
|
RetrieveMetadata.state = 'beta';
|
|
145
|
+
RetrieveMetadata.aliases = ['retrieve:metadata'];
|
|
146
|
+
RetrieveMetadata.deprecateAliases = true;
|
|
145
147
|
RetrieveMetadata.flags = {
|
|
146
148
|
'api-version': sf_plugins_core_1.Flags.orgApiVersion({
|
|
147
149
|
char: 'a',
|
|
@@ -223,4 +225,4 @@ RetrieveMetadata.flags = {
|
|
|
223
225
|
};
|
|
224
226
|
RetrieveMetadata.configurationVariablesSection = (0, sf_plugins_core_1.toHelpSection)('CONFIGURATION VARIABLES', core_1.OrgConfigProperties.TARGET_ORG, core_1.OrgConfigProperties.ORG_API_VERSION);
|
|
225
227
|
RetrieveMetadata.envVariablesSection = (0, sf_plugins_core_1.toHelpSection)('ENVIRONMENT VARIABLES', core_1.EnvironmentVariable.SF_TARGET_ORG, core_1.EnvironmentVariable.SF_USE_PROGRESS_BAR);
|
|
226
|
-
//# sourceMappingURL=
|
|
228
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/commands/project/retrieve/start.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,0CAAiC;AACjC,+BAAqC;AAErC,2CAA+F;AAC/F,+EAA6G;AAE7G,iEAA8E;AAC9E,mDAAiD;AACjD,iEAAkF;AAClF,yCAA2C;AAC3C,gDAA0F;AAC1F,kDAAiG;AACjG,oDAAwD;AAExD,wDAA8D;AAE9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,mBAAmB,CAAC,CAAC;AAClG,MAAM,kBAAkB,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,mBAAmB,CAAC,CAAC;AAE5G,MAAqB,gBAAiB,SAAQ,2BAA6B;IAsGzE,sCAAsC;IAC/B,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC,C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ClD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;KAC3D,CAAC;IACF,KAAK,EAAE,uBAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;QACnD,SAAS,EAAE,CAAC,qBAAqB,CAAC;QAClC,SAAS,EAAE,CAAC,kBAAkB,CAAC;KAChC,CAAC;IACF,eAAe,EAAE,IAAA,mBAAW,EAAC;QAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;QAC3D,SAAS,EAAE,CAAC,qBAAqB,CAAC;QAClC,SAAS,EAAE,CAAC,kBAAkB,CAAC;KAChC,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,9 @@
|
|
|
1
|
+
import { ApexTestResultData, CoverageReporterOptions, ApexCodeCoverageAggregate } from '@salesforce/apex-node';
|
|
2
|
+
import { Successes, Failures, CodeCoverage } from '@salesforce/source-deploy-retrieve';
|
|
3
|
+
export declare const mapTestResults: (testResults: Failures[] | Successes[]) => ApexTestResultData[];
|
|
4
|
+
export declare const generateCoveredLines: (cov: CodeCoverage) => [number[], number[]];
|
|
5
|
+
export declare const getCoverageFormattersOptions: (formatters?: string[]) => CoverageReporterOptions;
|
|
6
|
+
export declare const transformCoverageToApexCoverage: (mdCoverage: CodeCoverage[]) => ApexCodeCoverageAggregate;
|
|
7
|
+
export declare const coverageOutput: (cov: CodeCoverage) => Pick<CodeCoverage, 'name' | 'numLocations'> & {
|
|
8
|
+
lineNotCovered: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coverageOutput = exports.transformCoverageToApexCoverage = exports.getCoverageFormattersOptions = exports.generateCoveredLines = exports.mapTestResults = 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 path = require("path");
|
|
11
|
+
const apex_node_1 = require("@salesforce/apex-node");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
14
|
+
const mapTestResults = (testResults) => testResults.map((successOrFailure) => {
|
|
15
|
+
const testResult = successOrFailure;
|
|
16
|
+
return {
|
|
17
|
+
apexClass: { fullName: testResult.name, id: testResult.id, name: testResult.name, namespacePrefix: '' },
|
|
18
|
+
apexLogId: '',
|
|
19
|
+
asyncApexJobId: '',
|
|
20
|
+
fullName: testResult.name,
|
|
21
|
+
id: testResult.id,
|
|
22
|
+
message: testResult.message ?? '',
|
|
23
|
+
methodName: testResult.methodName,
|
|
24
|
+
outcome: !testResult.message ? "Pass" /* ApexTestResultOutcome.Pass */ : "Fail" /* ApexTestResultOutcome.Fail */,
|
|
25
|
+
queueItemId: '',
|
|
26
|
+
runTime: parseInt(testResult.time, 10),
|
|
27
|
+
stackTrace: testResult.stackTrace || '',
|
|
28
|
+
testTimestamp: '',
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
exports.mapTestResults = mapTestResults;
|
|
32
|
+
const generateCoveredLines = (cov) => {
|
|
33
|
+
const numCovered = parseInt(cov.numLocations, 10);
|
|
34
|
+
const numUncovered = parseInt(cov.numLocationsNotCovered, 10);
|
|
35
|
+
const uncoveredLines = (0, kit_1.ensureArray)(cov.locationsNotCovered).map((location) => parseInt(location.line, 10));
|
|
36
|
+
const minLineNumber = uncoveredLines.length ? Math.min(...uncoveredLines) : 1;
|
|
37
|
+
const lines = [...Array(numCovered + numUncovered).keys()].map((i) => i + minLineNumber);
|
|
38
|
+
const coveredLines = lines.filter((line) => !uncoveredLines.includes(line));
|
|
39
|
+
return [uncoveredLines, coveredLines];
|
|
40
|
+
};
|
|
41
|
+
exports.generateCoveredLines = generateCoveredLines;
|
|
42
|
+
const getCoverageFormattersOptions = (formatters = []) => {
|
|
43
|
+
const reportFormats = formatters;
|
|
44
|
+
const reportOptions = Object.fromEntries(reportFormats.map((format) => {
|
|
45
|
+
const formatDefaults = apex_node_1.DefaultReportOptions[format];
|
|
46
|
+
return [
|
|
47
|
+
format,
|
|
48
|
+
{
|
|
49
|
+
...formatDefaults,
|
|
50
|
+
// always join any subdir from the defaults with our custom coverage dir
|
|
51
|
+
...('subdir' in formatDefaults ? { subdir: path.join('coverage', formatDefaults.subdir) } : {}),
|
|
52
|
+
// if there is no subdir, we also put the file in the coverage dir, otherwise leave it alone
|
|
53
|
+
...('file' in formatDefaults && !('subdir' in formatDefaults)
|
|
54
|
+
? { file: path.join('coverage', formatDefaults.file) }
|
|
55
|
+
: {}),
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}));
|
|
59
|
+
return {
|
|
60
|
+
reportFormats,
|
|
61
|
+
reportOptions,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
exports.getCoverageFormattersOptions = getCoverageFormattersOptions;
|
|
65
|
+
const transformCoverageToApexCoverage = (mdCoverage) => {
|
|
66
|
+
const apexCoverage = mdCoverage.map((cov) => {
|
|
67
|
+
const numCovered = parseInt(cov.numLocations, 10);
|
|
68
|
+
const numUncovered = parseInt(cov.numLocationsNotCovered, 10);
|
|
69
|
+
const [uncoveredLines, coveredLines] = (0, exports.generateCoveredLines)(cov);
|
|
70
|
+
const ac = {
|
|
71
|
+
ApexClassOrTrigger: {
|
|
72
|
+
Id: cov.id,
|
|
73
|
+
Name: cov.name,
|
|
74
|
+
},
|
|
75
|
+
NumLinesCovered: numCovered,
|
|
76
|
+
NumLinesUncovered: numUncovered,
|
|
77
|
+
Coverage: {
|
|
78
|
+
coveredLines,
|
|
79
|
+
uncoveredLines,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return ac;
|
|
83
|
+
});
|
|
84
|
+
return { done: true, totalSize: apexCoverage.length, records: apexCoverage };
|
|
85
|
+
};
|
|
86
|
+
exports.transformCoverageToApexCoverage = transformCoverageToApexCoverage;
|
|
87
|
+
const coverageOutput = (cov) => {
|
|
88
|
+
const numLocationsNum = parseInt(cov.numLocations, 10);
|
|
89
|
+
const numLocationsNotCovered = parseInt(cov.numLocationsNotCovered, 10);
|
|
90
|
+
const color = numLocationsNotCovered > 0 ? sf_plugins_core_1.StandardColors.error : sf_plugins_core_1.StandardColors.success;
|
|
91
|
+
let pctCovered = 100;
|
|
92
|
+
const coverageDecimal = parseFloat(((numLocationsNum - numLocationsNotCovered) / numLocationsNum).toFixed(2));
|
|
93
|
+
if (numLocationsNum > 0) {
|
|
94
|
+
pctCovered = coverageDecimal * 100;
|
|
95
|
+
}
|
|
96
|
+
// cov.numLocations = color(`${pctCovered}%`);
|
|
97
|
+
const base = {
|
|
98
|
+
name: cov.name,
|
|
99
|
+
numLocations: color(`${pctCovered}%`),
|
|
100
|
+
};
|
|
101
|
+
if (!cov.locationsNotCovered) {
|
|
102
|
+
return { ...base, lineNotCovered: '' };
|
|
103
|
+
}
|
|
104
|
+
const locations = (0, kit_1.ensureArray)(cov.locationsNotCovered);
|
|
105
|
+
return {
|
|
106
|
+
...base,
|
|
107
|
+
lineNotCovered: locations.map((location) => location.line).join(','),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
exports.coverageOutput = coverageOutput;
|
|
111
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AE,EAAE,CAAC,CAAC;IACvD,MAAM,sBAAsB,GAAW,QAAQ,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAChF,MAAM,KAAK,GAAG,sBAAsB,GAAG,CAAC,CAAC,CAAC,CAAC,gCAAc,CAAC,KAAK,CAAC,CAAC,CAAC,gCAAc,CAAC,OAAO,CAAC;IAEzF,IAAI,UAAU,GAAG,GAAG,CAAC;IACrB,MAAM,eAAe,GAAW,UAAU,CAAC,CAAC,CAAC,eAAe,GAAG,sBAAsB,CAAC,GAAG,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACtH,IAAI,eAAe,GAAG,CAAC,EAAE;QACvB,UAAU,GAAG,eAAe,GAAG,GAAG,CAAC;KACpC;IACD,8CAA8C;IAC9C,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,YAAY,EAAE,KAAK,CAAC,GAAG,UAAU,GAAG,CAAC;KACtC,CAAC;IAEF,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE;QAC5B,OAAO,EAAE,GAAG,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;KACxC;IACD,MAAM,SAAS,GAAG,IAAA,iBAAW,EAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAEvD,OAAO;QACL,GAAG,IAAI;QACP,cAAc,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;KACrE,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,cAAc,kBA2BzB"}
|
package/lib/utils/deploy.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Messages, Org, SfProject } from '@salesforce/core';
|
|
1
|
+
import { ConfigAggregator, Messages, Org, SfProject } from '@salesforce/core';
|
|
2
2
|
import { Duration } from '@salesforce/kit';
|
|
3
3
|
import { Nullable } from '@salesforce/ts-types';
|
|
4
4
|
import { ComponentSet, DeployResult, MetadataApiDeploy, RequestStatus } from '@salesforce/source-deploy-retrieve';
|
|
5
5
|
import { SourceTracking } from '@salesforce/source-tracking';
|
|
6
6
|
import { API, PathInfo, TestLevel } from './types';
|
|
7
|
-
export declare const cacheMessages: Messages<
|
|
7
|
+
export declare const cacheMessages: Messages<string>;
|
|
8
8
|
export type DeployOptions = {
|
|
9
9
|
api: API;
|
|
10
10
|
'target-org': string;
|
|
@@ -25,12 +25,16 @@ export type DeployOptions = {
|
|
|
25
25
|
concise?: boolean;
|
|
26
26
|
'single-package'?: boolean;
|
|
27
27
|
status?: RequestStatus;
|
|
28
|
+
'pre-destructive-changes'?: string;
|
|
29
|
+
'post-destructive-changes'?: string;
|
|
30
|
+
'purge-on-delete'?: boolean;
|
|
28
31
|
};
|
|
29
|
-
|
|
32
|
+
/** Manifest is expected. You cannot pass metadata and source-dir array--use those to get a manifest */
|
|
33
|
+
export type CachedOptions = Omit<DeployOptions, 'wait' | 'metadata' | 'source-dir'> & {
|
|
30
34
|
wait: number;
|
|
31
|
-
}
|
|
35
|
+
} & Partial<Pick<DeployOptions, 'manifest'>>;
|
|
32
36
|
export declare function validateTests(testLevel: TestLevel, tests: Nullable<string[]>): boolean;
|
|
33
|
-
export declare function resolveApi(): Promise<API>;
|
|
37
|
+
export declare function resolveApi(existingConfigAggregator?: ConfigAggregator): Promise<API>;
|
|
34
38
|
export declare function buildComponentSet(opts: Partial<DeployOptions>, stl?: SourceTracking): Promise<ComponentSet>;
|
|
35
39
|
export declare function executeDeploy(opts: Partial<DeployOptions>, project?: SfProject, id?: string): Promise<{
|
|
36
40
|
deploy: MetadataApiDeploy;
|
package/lib/utils/deploy.js
CHANGED
|
@@ -16,23 +16,16 @@ const project_1 = require("./project");
|
|
|
16
16
|
const types_1 = require("./types");
|
|
17
17
|
const errorCodes_1 = require("./errorCodes");
|
|
18
18
|
const deployCache_1 = require("./deployCache");
|
|
19
|
+
const manifestCache_1 = require("./manifestCache");
|
|
19
20
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
20
|
-
exports.cacheMessages = core_1.Messages.
|
|
21
|
-
|
|
22
|
-
'error.InvalidJobId',
|
|
23
|
-
]);
|
|
24
|
-
const deployMessages = core_1.Messages.load('@salesforce/plugin-deploy-retrieve', 'deploy.metadata', [
|
|
25
|
-
'error.nothingToDeploy',
|
|
26
|
-
'error.nothingToDeploy.Actions',
|
|
27
|
-
]);
|
|
21
|
+
exports.cacheMessages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'cache');
|
|
22
|
+
const deployMessages = core_1.Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata');
|
|
28
23
|
function validateTests(testLevel, tests) {
|
|
29
|
-
|
|
30
|
-
return false;
|
|
31
|
-
return true;
|
|
24
|
+
return !(testLevel === types_1.TestLevel.RunSpecifiedTests && (tests ?? []).length === 0);
|
|
32
25
|
}
|
|
33
26
|
exports.validateTests = validateTests;
|
|
34
|
-
async function resolveApi() {
|
|
35
|
-
const agg = await core_1.ConfigAggregator.create({ customConfigMeta: configMeta_1.default });
|
|
27
|
+
async function resolveApi(existingConfigAggregator) {
|
|
28
|
+
const agg = existingConfigAggregator ?? (await core_1.ConfigAggregator.create({ customConfigMeta: configMeta_1.default }));
|
|
36
29
|
const restDeployConfig = agg.getInfo(configMeta_1.ConfigVars.ORG_METADATA_REST_DEPLOY)?.value;
|
|
37
30
|
return restDeployConfig === 'true' ? types_1.API.REST : types_1.API.SOAP;
|
|
38
31
|
}
|
|
@@ -60,6 +53,8 @@ async function buildComponentSet(opts, stl) {
|
|
|
60
53
|
manifest: {
|
|
61
54
|
manifestPath: opts.manifest,
|
|
62
55
|
directoryPaths: await (0, project_1.getPackageDirs)(),
|
|
56
|
+
destructiveChangesPre: opts['pre-destructive-changes'],
|
|
57
|
+
destructiveChangesPost: opts['post-destructive-changes'],
|
|
63
58
|
},
|
|
64
59
|
}
|
|
65
60
|
: {}),
|
|
@@ -76,19 +71,12 @@ async function executeDeploy(opts, project, id) {
|
|
|
76
71
|
rollbackOnError: !opts['ignore-errors'] || false,
|
|
77
72
|
runTests: opts.tests ?? [],
|
|
78
73
|
testLevel: opts['test-level'],
|
|
74
|
+
purgeOnDelete: opts['purge-on-delete'] ?? false,
|
|
79
75
|
};
|
|
80
76
|
let deploy;
|
|
81
77
|
let componentSet;
|
|
82
78
|
const org = await core_1.Org.create({ aliasOrUsername: opts['target-org'] });
|
|
83
79
|
const usernameOrConnection = org.getConnection();
|
|
84
|
-
// instantiate source tracking
|
|
85
|
-
// stl will decide, based on the org's properties, what needs to be done
|
|
86
|
-
const stl = await source_tracking_1.SourceTracking.create({
|
|
87
|
-
org,
|
|
88
|
-
project,
|
|
89
|
-
subscribeSDREvents: true,
|
|
90
|
-
ignoreConflicts: opts['ignore-conflicts'],
|
|
91
|
-
});
|
|
92
80
|
if (opts['metadata-dir']) {
|
|
93
81
|
if (id) {
|
|
94
82
|
deploy = new source_deploy_retrieve_1.MetadataApiDeploy({ id, usernameOrConnection });
|
|
@@ -104,6 +92,14 @@ async function executeDeploy(opts, project, id) {
|
|
|
104
92
|
}
|
|
105
93
|
}
|
|
106
94
|
else {
|
|
95
|
+
// instantiate source tracking
|
|
96
|
+
// stl will decide, based on the org's properties, what needs to be done
|
|
97
|
+
const stl = await source_tracking_1.SourceTracking.create({
|
|
98
|
+
org,
|
|
99
|
+
project,
|
|
100
|
+
subscribeSDREvents: true,
|
|
101
|
+
ignoreConflicts: opts['ignore-conflicts'],
|
|
102
|
+
});
|
|
107
103
|
componentSet = await buildComponentSet(opts, stl);
|
|
108
104
|
if (componentSet.size === 0) {
|
|
109
105
|
throw new core_1.SfError(deployMessages.getMessage('error.nothingToDeploy'), 'NothingToDeploy', deployMessages.getMessages('error.nothingToDeploy.Actions'));
|
|
@@ -114,9 +110,10 @@ async function executeDeploy(opts, project, id) {
|
|
|
114
110
|
usernameOrConnection,
|
|
115
111
|
apiOptions,
|
|
116
112
|
});
|
|
117
|
-
await deployCache_1.DeployCache.set(deploy.id, { ...opts, wait: opts.wait?.minutes ?? 33 });
|
|
118
113
|
}
|
|
119
|
-
|
|
114
|
+
// does not apply to mdapi deploys
|
|
115
|
+
const manifestPath = componentSet ? await (0, manifestCache_1.writeManifest)(deploy.id, componentSet) : undefined;
|
|
116
|
+
await deployCache_1.DeployCache.set(deploy.id, { ...opts, manifest: manifestPath });
|
|
120
117
|
return { deploy, componentSet };
|
|
121
118
|
}
|
|
122
119
|
exports.executeDeploy = executeDeploy;
|
|
@@ -125,7 +122,7 @@ async function cancelDeploy(opts, id) {
|
|
|
125
122
|
const usernameOrConnection = org.getUsername() ?? org.getConnection();
|
|
126
123
|
const deploy = new source_deploy_retrieve_1.MetadataApiDeploy({ usernameOrConnection, id });
|
|
127
124
|
const componentSet = await buildComponentSet({ ...opts });
|
|
128
|
-
await deployCache_1.DeployCache.set(deploy.id, { ...opts
|
|
125
|
+
await deployCache_1.DeployCache.set(deploy.id, { ...opts });
|
|
129
126
|
await deploy.cancel();
|
|
130
127
|
return poll(org, deploy.id, opts.wait ?? kit_1.Duration.minutes(33), componentSet);
|
|
131
128
|
}
|