@salesforce/plugin-signups 1.2.16 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commands/org/create/shape.d.ts +19 -0
- package/lib/commands/org/create/shape.js +63 -0
- package/lib/commands/org/create/shape.js.map +1 -0
- package/lib/commands/org/create/snapshot.d.ts +18 -0
- package/lib/commands/org/create/snapshot.js +79 -0
- package/lib/commands/org/create/snapshot.js.map +1 -0
- package/lib/commands/org/delete/shape.d.ts +34 -0
- package/lib/commands/org/delete/shape.js +126 -0
- package/lib/commands/org/delete/shape.js.map +1 -0
- package/lib/commands/org/delete/snapshot.d.ts +16 -0
- package/lib/commands/org/delete/snapshot.js +52 -0
- package/lib/commands/org/delete/snapshot.js.map +1 -0
- package/lib/commands/org/get/snapshot.d.ts +16 -0
- package/lib/commands/org/get/snapshot.js +42 -0
- package/lib/commands/org/get/snapshot.js.map +1 -0
- package/lib/commands/org/list/shape.d.ts +15 -0
- package/lib/commands/org/list/shape.js +64 -0
- package/lib/commands/org/list/shape.js.map +1 -0
- package/lib/commands/org/list/snapshot.d.ts +15 -0
- package/lib/commands/org/list/snapshot.js +36 -0
- package/lib/commands/org/list/snapshot.js.map +1 -0
- package/lib/shared/orgShapeListUtils.d.ts +2 -2
- package/lib/shared/orgShapeListUtils.js +1 -1
- package/lib/shared/orgShapeListUtils.js.map +1 -1
- package/lib/shared/snapshot.d.ts +2 -2
- package/lib/shared/snapshot.js +4 -5
- package/lib/shared/snapshot.js.map +1 -1
- package/messages/shape.create.md +33 -0
- package/messages/shape.delete.md +37 -0
- package/messages/shape.list.md +29 -0
- package/messages/snapshot.create.md +37 -0
- package/messages/snapshot.delete.md +29 -0
- package/messages/snapshot.get.md +27 -0
- package/messages/snapshot.list.md +19 -0
- package/messages/snapshot.md +7 -0
- package/oclif.manifest.json +1 -1
- package/package.json +27 -31
- package/lib/commands/force/org/shape/create.d.ts +0 -14
- package/lib/commands/force/org/shape/create.js +0 -68
- package/lib/commands/force/org/shape/create.js.map +0 -1
- package/lib/commands/force/org/shape/delete.d.ts +0 -27
- package/lib/commands/force/org/shape/delete.js +0 -122
- package/lib/commands/force/org/shape/delete.js.map +0 -1
- package/lib/commands/force/org/shape/list.d.ts +0 -9
- package/lib/commands/force/org/shape/list.js +0 -63
- package/lib/commands/force/org/shape/list.js.map +0 -1
- package/lib/commands/force/org/snapshot/create.d.ts +0 -9
- package/lib/commands/force/org/snapshot/create.js +0 -64
- package/lib/commands/force/org/snapshot/create.js.map +0 -1
- package/lib/commands/force/org/snapshot/delete.d.ts +0 -9
- package/lib/commands/force/org/snapshot/delete.js +0 -47
- package/lib/commands/force/org/snapshot/delete.js.map +0 -1
- package/lib/commands/force/org/snapshot/get.d.ts +0 -9
- package/lib/commands/force/org/snapshot/get.js +0 -37
- package/lib/commands/force/org/snapshot/get.js.map +0 -1
- package/lib/commands/force/org/snapshot/list.d.ts +0 -8
- package/lib/commands/force/org/snapshot/list.js +0 -29
- package/lib/commands/force/org/snapshot/list.js.map +0 -1
- package/messages/shape.create.json +0 -16
- package/messages/shape.delete.json +0 -25
- package/messages/shape.list.json +0 -13
- package/messages/snapshot.create.json +0 -19
- package/messages/snapshot.delete.json +0 -16
- package/messages/snapshot.get.json +0 -15
- package/messages/snapshot.json +0 -4
- package/messages/snapshot.list.json +0 -9
@@ -0,0 +1,19 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
export interface ShapeCreateResult {
|
3
|
+
shapeId: string;
|
4
|
+
success: boolean;
|
5
|
+
errors: [];
|
6
|
+
}
|
7
|
+
export declare class OrgShapeCreateCommand extends SfCommand<ShapeCreateResult> {
|
8
|
+
static readonly summary: string;
|
9
|
+
static readonly description: string;
|
10
|
+
static readonly examples: string[];
|
11
|
+
static readonly aliases: string[];
|
12
|
+
static readonly deprecateAliases = true;
|
13
|
+
static readonly flags: {
|
14
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
15
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
16
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
17
|
+
};
|
18
|
+
run(): Promise<ShapeCreateResult>;
|
19
|
+
}
|
@@ -0,0 +1,63 @@
|
|
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.OrgShapeCreateCommand = void 0;
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
11
|
+
const core_1 = require("@salesforce/core");
|
12
|
+
const orgShapeListUtils_1 = require("../../../shared/orgShapeListUtils");
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'shape.create');
|
15
|
+
class OrgShapeCreateCommand extends sf_plugins_core_1.SfCommand {
|
16
|
+
async run() {
|
17
|
+
const { flags } = await this.parse(OrgShapeCreateCommand);
|
18
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
19
|
+
if (!(await (0, orgShapeListUtils_1.isShapeEnabled)(conn))) {
|
20
|
+
throw messages.createError('ShapeRepresentationNoAccess', [flags['target-org'].getUsername()]);
|
21
|
+
}
|
22
|
+
const createShapeResponse = await createShapeOrg(conn);
|
23
|
+
if (createShapeResponse.success !== true) {
|
24
|
+
(await core_1.Logger.child('OrgShapeCreateCommand')).error('Shape create failed', createShapeResponse['errors']);
|
25
|
+
throw messages.createError('ShapeCreateFailed');
|
26
|
+
}
|
27
|
+
const output = {
|
28
|
+
shapeId: createShapeResponse.id,
|
29
|
+
success: true,
|
30
|
+
errors: [],
|
31
|
+
};
|
32
|
+
this.logSuccess(messages.getMessage('success', [output.shapeId]));
|
33
|
+
return output;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
exports.OrgShapeCreateCommand = OrgShapeCreateCommand;
|
37
|
+
OrgShapeCreateCommand.summary = messages.getMessage('summary');
|
38
|
+
OrgShapeCreateCommand.description = messages.getMessage('description');
|
39
|
+
OrgShapeCreateCommand.examples = messages.getMessages('examples');
|
40
|
+
OrgShapeCreateCommand.aliases = ['force:org:shape:create'];
|
41
|
+
OrgShapeCreateCommand.deprecateAliases = true;
|
42
|
+
OrgShapeCreateCommand.flags = {
|
43
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
44
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
45
|
+
loglevel: sf_plugins_core_1.loglevel,
|
46
|
+
};
|
47
|
+
const createShapeOrg = async (conn) => {
|
48
|
+
try {
|
49
|
+
return await conn.sobject('ShapeRepresentation').create({
|
50
|
+
Description: '',
|
51
|
+
});
|
52
|
+
}
|
53
|
+
catch (err) {
|
54
|
+
const JsForceErr = err;
|
55
|
+
if (JsForceErr.errorCode && JsForceErr.errorCode === 'NOT_FOUND' && JsForceErr['name'] === 'ACCESS_DENIED') {
|
56
|
+
throw messages.createError('NoCrudAccessCreateShape');
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
throw JsForceErr;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
};
|
63
|
+
//# sourceMappingURL=shape.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"","sources":["../../../../src/commands/org/create/shape.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iEAKqC;AACrC,2CAAgE;AAEhE,yEAAiF;AAEjF,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC;AAQrF,MAAa,qBAAsB,SAAQ,2BAA4B;IAa9D,KAAK,CAAC,GAAG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C,sCAAgB,GAAG,IAAI,CAAC;AAExB,2BAAK,GAAG;IAC7B,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC;AA2BJ,MAAM,cAAc,GAAG,KAAK,EAAE,IAAgB,EAAuB,EAAE;IACrE,IAAI;QACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC;YACtD,WAAW,EAAE,EAAE;SAChB,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,UAAU,GAAG,GAAmB,CAAC;QACvC,IAAI,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,SAAS,KAAK,WAAW,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,eAAe,EAAE;YAC1G,MAAM,QAAQ,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;SACvD;aAAM;YACL,MAAM,UAAU,CAAC;SAClB;KACF;AACH,CAAC,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
import { OrgSnapshot } from '../../../shared/snapshot';
|
3
|
+
export declare class SnapshotCreate extends SfCommand<OrgSnapshot> {
|
4
|
+
static readonly summary: string;
|
5
|
+
static readonly description: string;
|
6
|
+
static readonly examples: string[];
|
7
|
+
static readonly aliases: string[];
|
8
|
+
static readonly deprecateAliases = true;
|
9
|
+
static readonly flags: {
|
10
|
+
'target-dev-hub': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
11
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
13
|
+
'source-org': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
14
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
15
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
16
|
+
};
|
17
|
+
run(): Promise<OrgSnapshot>;
|
18
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
var _a;
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.SnapshotCreate = 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 sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
12
|
+
const core_1 = require("@salesforce/core");
|
13
|
+
const snapshot_1 = require("../../../shared/snapshot");
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.create');
|
16
|
+
class SnapshotCreate extends sf_plugins_core_1.SfCommand {
|
17
|
+
async run() {
|
18
|
+
const { flags } = await this.parse(SnapshotCreate);
|
19
|
+
const conn = flags['target-dev-hub'].getConnection(flags['api-version']);
|
20
|
+
const createResponse = await conn.sobject('OrgSnapshot').create({
|
21
|
+
SourceOrg: flags['source-org'],
|
22
|
+
Description: flags.description,
|
23
|
+
SnapshotName: flags.name,
|
24
|
+
Content: 'metadatadata',
|
25
|
+
});
|
26
|
+
if (createResponse.success === false) {
|
27
|
+
throw new core_1.SfError('An error while created the org snapshot');
|
28
|
+
}
|
29
|
+
const result = await (0, snapshot_1.queryByNameOrId)(conn, createResponse.id);
|
30
|
+
if (!flags.json) {
|
31
|
+
(0, snapshot_1.printSingleRecordTable)(result);
|
32
|
+
}
|
33
|
+
return result;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
exports.SnapshotCreate = SnapshotCreate;
|
37
|
+
_a = SnapshotCreate;
|
38
|
+
SnapshotCreate.summary = messages.getMessage('summary');
|
39
|
+
SnapshotCreate.description = messages.getMessage('description');
|
40
|
+
SnapshotCreate.examples = messages.getMessages('examples');
|
41
|
+
SnapshotCreate.aliases = ['force:org:snapshot:create'];
|
42
|
+
SnapshotCreate.deprecateAliases = true;
|
43
|
+
SnapshotCreate.flags = {
|
44
|
+
'target-dev-hub': sf_plugins_core_1.requiredHubFlagWithDeprecations,
|
45
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
46
|
+
loglevel: sf_plugins_core_1.loglevel,
|
47
|
+
'source-org': sf_plugins_core_1.Flags.string({
|
48
|
+
// command doesn't use target-org, so dash-o is fine
|
49
|
+
// eslint-disable-next-line sf-plugin/dash-o
|
50
|
+
char: 'o',
|
51
|
+
summary: messages.getMessage('flags.source-org.summary'),
|
52
|
+
required: true,
|
53
|
+
aliases: ['sourceorg'],
|
54
|
+
deprecateAliases: true,
|
55
|
+
parse: async (input) => (input.startsWith('00D') ? input : resolveSourceOrgId(input)),
|
56
|
+
}),
|
57
|
+
name: sf_plugins_core_1.Flags.string({
|
58
|
+
char: 'n',
|
59
|
+
summary: messages.getMessage('flags.name.summary'),
|
60
|
+
required: true,
|
61
|
+
aliases: ['snapshotname'],
|
62
|
+
deprecateAliases: true,
|
63
|
+
}),
|
64
|
+
description: sf_plugins_core_1.Flags.string({
|
65
|
+
char: 'd',
|
66
|
+
summary: messages.getMessage('flags.description.summary'),
|
67
|
+
description: messages.getMessage('flags.description.description'),
|
68
|
+
}),
|
69
|
+
};
|
70
|
+
const resolveSourceOrgId = async (sourceOrgUsernameOrId) => {
|
71
|
+
const stateAggregator = await core_1.StateAggregator.create();
|
72
|
+
const username = stateAggregator.aliases.getValue(sourceOrgUsernameOrId) ?? sourceOrgUsernameOrId;
|
73
|
+
const org = await stateAggregator.orgs.read(username);
|
74
|
+
if (!org?.orgId) {
|
75
|
+
throw new Error(`No org found for ${sourceOrgUsernameOrId}`);
|
76
|
+
}
|
77
|
+
return org.orgId;
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=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,sBAAe,CAAC,MAAM,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,qBAAqB,CAAC;IAClG,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,oBAAoB,qBAAqB,EAAE,CAAC,CAAC;KAC9D;IACD,OAAO,GAAG,CAAC,KAAK,CAAC;AACnB,CAAC,CAAC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
import { Connection } from '@salesforce/core';
|
3
|
+
type FailureMsg = {
|
4
|
+
shapeId: string;
|
5
|
+
message: string;
|
6
|
+
};
|
7
|
+
type DeleteAllResult = {
|
8
|
+
shapeIds: string[];
|
9
|
+
failures: FailureMsg[];
|
10
|
+
};
|
11
|
+
export interface OrgShapeDeleteResult extends DeleteAllResult {
|
12
|
+
orgId: string;
|
13
|
+
}
|
14
|
+
export declare class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult | undefined> {
|
15
|
+
static readonly summary: string;
|
16
|
+
static readonly description: string;
|
17
|
+
static readonly examples: string[];
|
18
|
+
static readonly aliases: string[];
|
19
|
+
static readonly deprecateAliases = true;
|
20
|
+
static readonly flags: {
|
21
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
22
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
23
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
24
|
+
'no-prompt': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
25
|
+
};
|
26
|
+
run(): Promise<OrgShapeDeleteResult | undefined>;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Delete all ShapeRepresentation records for the shapeOrg.
|
30
|
+
*
|
31
|
+
* @return List of SR IDs that were deleted
|
32
|
+
*/
|
33
|
+
export declare const deleteAll: (conn: Connection, username: string) => Promise<DeleteAllResult>;
|
34
|
+
export {};
|
@@ -0,0 +1,126 @@
|
|
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.deleteAll = exports.OrgShapeDeleteCommand = void 0;
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
11
|
+
const core_1 = require("@salesforce/core");
|
12
|
+
const orgShapeListUtils_1 = require("../../../shared/orgShapeListUtils");
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'shape.delete');
|
15
|
+
class OrgShapeDeleteCommand extends sf_plugins_core_1.SfCommand {
|
16
|
+
async run() {
|
17
|
+
const { flags } = await this.parse(OrgShapeDeleteCommand);
|
18
|
+
const username = flags['target-org'].getUsername();
|
19
|
+
if (!username)
|
20
|
+
throw new core_1.SfError('No username found for target-org');
|
21
|
+
const orgId = flags['target-org'].getOrgId();
|
22
|
+
if (!flags['no-prompt']) {
|
23
|
+
if (!(await this.confirm(messages.getMessage('deleteCommandYesNo', [username])))) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
28
|
+
if (!(await (0, orgShapeListUtils_1.isShapeEnabled)(conn))) {
|
29
|
+
throw messages.createError('noAccess', [username]);
|
30
|
+
}
|
31
|
+
const deleteRes = await (0, exports.deleteAll)(conn, username);
|
32
|
+
if (deleteRes.shapeIds.length === 0) {
|
33
|
+
this.info(messages.getMessage('noShapesHumanSuccess', [orgId]));
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
if (deleteRes.failures.length > 0) {
|
37
|
+
setExitCode(68);
|
38
|
+
this.styledHeader('Partial Success');
|
39
|
+
this.logSuccess(messages.getMessage('humanSuccess', [orgId]));
|
40
|
+
this.log('');
|
41
|
+
this.styledHeader('Failures');
|
42
|
+
const columns = {
|
43
|
+
shapeId: { header: 'Shape ID' },
|
44
|
+
message: { header: 'Error Message' },
|
45
|
+
};
|
46
|
+
this.table(deleteRes.failures, columns);
|
47
|
+
}
|
48
|
+
else if (deleteRes.failures.length === deleteRes.shapeIds.length) {
|
49
|
+
setExitCode(1);
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
setExitCode(0);
|
53
|
+
this.logSuccess(messages.getMessage('humanSuccess', [orgId]));
|
54
|
+
}
|
55
|
+
return {
|
56
|
+
orgId,
|
57
|
+
shapeIds: deleteRes.shapeIds,
|
58
|
+
failures: deleteRes.failures,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
}
|
62
|
+
exports.OrgShapeDeleteCommand = OrgShapeDeleteCommand;
|
63
|
+
OrgShapeDeleteCommand.summary = messages.getMessage('summary');
|
64
|
+
OrgShapeDeleteCommand.description = messages.getMessage('description');
|
65
|
+
OrgShapeDeleteCommand.examples = messages.getMessages('examples');
|
66
|
+
OrgShapeDeleteCommand.aliases = ['force:org:shape:delete'];
|
67
|
+
OrgShapeDeleteCommand.deprecateAliases = true;
|
68
|
+
OrgShapeDeleteCommand.flags = {
|
69
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
70
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
71
|
+
loglevel: sf_plugins_core_1.loglevel,
|
72
|
+
'no-prompt': sf_plugins_core_1.Flags.boolean({
|
73
|
+
char: 'p',
|
74
|
+
summary: messages.getMessage('flags.no-prompt.summary'),
|
75
|
+
aliases: ['noprompt'],
|
76
|
+
deprecateAliases: true,
|
77
|
+
}),
|
78
|
+
};
|
79
|
+
/**
|
80
|
+
* Delete all ShapeRepresentation records for the shapeOrg.
|
81
|
+
*
|
82
|
+
* @return List of SR IDs that were deleted
|
83
|
+
*/
|
84
|
+
const deleteAll = async (conn, username) => {
|
85
|
+
let shapeIds = [];
|
86
|
+
const deleteAllResult = {
|
87
|
+
shapeIds: [],
|
88
|
+
failures: [],
|
89
|
+
};
|
90
|
+
try {
|
91
|
+
const result = await conn.query('SELECT Id FROM ShapeRepresentation');
|
92
|
+
if (result.totalSize === 0) {
|
93
|
+
return deleteAllResult;
|
94
|
+
}
|
95
|
+
shapeIds = result.records.map((shape) => shape.Id);
|
96
|
+
}
|
97
|
+
catch (err) {
|
98
|
+
const JsForceErr = err;
|
99
|
+
if (JsForceErr.errorCode && JsForceErr.errorCode === 'INVALID_TYPE') {
|
100
|
+
// ShapeExportPref is not enabled, or user does not have CRUD access
|
101
|
+
throw messages.createError('noAccess', [username]);
|
102
|
+
}
|
103
|
+
// non-access error
|
104
|
+
throw JsForceErr;
|
105
|
+
}
|
106
|
+
await Promise.all(shapeIds.map(async (id) => {
|
107
|
+
try {
|
108
|
+
const delResult = await conn.sobject('ShapeRepresentation').delete(id);
|
109
|
+
if (delResult.success) {
|
110
|
+
deleteAllResult.shapeIds.push(id);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
catch (err) {
|
114
|
+
deleteAllResult.failures.push({
|
115
|
+
shapeId: id,
|
116
|
+
message: err instanceof Error ? err.message : 'error contained no message',
|
117
|
+
});
|
118
|
+
}
|
119
|
+
}));
|
120
|
+
return deleteAllResult;
|
121
|
+
};
|
122
|
+
exports.deleteAll = deleteAll;
|
123
|
+
const setExitCode = (code) => {
|
124
|
+
process.exitCode = code;
|
125
|
+
};
|
126
|
+
//# sourceMappingURL=shape.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"","sources":["../../../../src/commands/org/delete/shape.ts"],"names":[],"mappings":";AAA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,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACxB,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACvE,IAAI,SAAS,CAAC,OAAO,EAAE;gBACrB,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACnC;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC5B,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B;aAC3E,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAvCW,QAAA,SAAS,aAuCpB;AACF,MAAM,WAAW,GAAG,CAAC,IAAY,EAAQ,EAAE;IACzC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
import { SaveResult } from 'jsforce';
|
3
|
+
export declare class SnapshotDelete extends SfCommand<SaveResult> {
|
4
|
+
static readonly summary: string;
|
5
|
+
static readonly description: string;
|
6
|
+
static readonly examples: string[];
|
7
|
+
static readonly aliases: string[];
|
8
|
+
static readonly deprecateAliases = true;
|
9
|
+
static readonly flags: {
|
10
|
+
'target-dev-hub': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
11
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
13
|
+
snapshot: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
14
|
+
};
|
15
|
+
run(): Promise<SaveResult>;
|
16
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SnapshotDelete = 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 os_1 = require("os");
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
12
|
+
const core_1 = require("@salesforce/core");
|
13
|
+
const snapshot_1 = require("../../../shared/snapshot");
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.delete');
|
16
|
+
// jsforce can return SaveError[] or never[]
|
17
|
+
const isSaveError = (error) => error.message !== undefined;
|
18
|
+
class SnapshotDelete extends sf_plugins_core_1.SfCommand {
|
19
|
+
async run() {
|
20
|
+
// resolve the query to an ID. This also verifies the snapshot exists in the org
|
21
|
+
const { flags } = await this.parse(SnapshotDelete);
|
22
|
+
const conn = flags['target-dev-hub'].getConnection(flags['api-version']);
|
23
|
+
const result = await (0, snapshot_1.queryByNameOrId)(conn, flags.snapshot);
|
24
|
+
const deleteResult = await conn.sobject('OrgSnapshot').delete(result.Id);
|
25
|
+
if (deleteResult.success) {
|
26
|
+
this.logSuccess(messages.getMessage('success', [flags.snapshot]));
|
27
|
+
return deleteResult;
|
28
|
+
}
|
29
|
+
throw new Error(deleteResult.errors
|
30
|
+
.filter(isSaveError)
|
31
|
+
.map((error) => error.message)
|
32
|
+
.join(os_1.EOL));
|
33
|
+
}
|
34
|
+
}
|
35
|
+
exports.SnapshotDelete = SnapshotDelete;
|
36
|
+
SnapshotDelete.summary = messages.getMessage('summary');
|
37
|
+
SnapshotDelete.description = messages.getMessage('description');
|
38
|
+
SnapshotDelete.examples = messages.getMessages('examples');
|
39
|
+
SnapshotDelete.aliases = ['force:org:snapshot:delete'];
|
40
|
+
SnapshotDelete.deprecateAliases = true;
|
41
|
+
SnapshotDelete.flags = {
|
42
|
+
'target-dev-hub': sf_plugins_core_1.requiredHubFlagWithDeprecations,
|
43
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
44
|
+
loglevel: sf_plugins_core_1.loglevel,
|
45
|
+
snapshot: sf_plugins_core_1.Flags.string({
|
46
|
+
char: 's',
|
47
|
+
summary: messages.getMessage('flags.snapshot.summary'),
|
48
|
+
description: messages.getMessage('flags.snapshot.description'),
|
49
|
+
required: true,
|
50
|
+
}),
|
51
|
+
};
|
52
|
+
//# sourceMappingURL=snapshot.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../src/commands/org/delete/snapshot.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2BAAyB;AACzB,iEAMqC;AACrC,2CAA4C;AAE5C,uDAA2D;AAE3D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,iBAAiB,CAAC,CAAC;AAExF,4CAA4C;AAC5C,MAAM,WAAW,GAAG,CAAC,KAA0B,EAAsB,EAAE,CAAE,KAAmB,CAAC,OAAO,KAAK,SAAS,CAAC;AAEnH,MAAa,cAAe,SAAQ,2BAAqB;IAmBhD,KAAK,CAAC,GAAG;QACd,iFAAiF;QACjF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACzE,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAe,EAAC,IAAI,EA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
import { OrgSnapshot } from '../../../shared/snapshot';
|
3
|
+
export declare class SnapshotGet extends SfCommand<OrgSnapshot> {
|
4
|
+
static readonly summary: string;
|
5
|
+
static readonly description: string;
|
6
|
+
static readonly examples: string[];
|
7
|
+
static readonly aliases: string[];
|
8
|
+
static readonly deprecateAliases = true;
|
9
|
+
static readonly flags: {
|
10
|
+
'target-dev-hub': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
11
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
13
|
+
snapshot: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
14
|
+
};
|
15
|
+
run(): Promise<OrgSnapshot>;
|
16
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SnapshotGet = 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 sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
11
|
+
const core_1 = require("@salesforce/core");
|
12
|
+
const snapshot_1 = require("../../../shared/snapshot");
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.get');
|
15
|
+
class SnapshotGet extends sf_plugins_core_1.SfCommand {
|
16
|
+
async run() {
|
17
|
+
const { flags } = await this.parse(SnapshotGet);
|
18
|
+
const result = await (0, snapshot_1.queryByNameOrId)(flags['target-dev-hub'].getConnection(flags['api-version']), flags.snapshot);
|
19
|
+
if (!this.jsonEnabled()) {
|
20
|
+
(0, snapshot_1.printSingleRecordTable)(result);
|
21
|
+
}
|
22
|
+
return result;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
exports.SnapshotGet = SnapshotGet;
|
26
|
+
SnapshotGet.summary = messages.getMessage('summary');
|
27
|
+
SnapshotGet.description = messages.getMessage('description');
|
28
|
+
SnapshotGet.examples = messages.getMessages('examples');
|
29
|
+
SnapshotGet.aliases = ['force:org:snapshot:get'];
|
30
|
+
SnapshotGet.deprecateAliases = true;
|
31
|
+
SnapshotGet.flags = {
|
32
|
+
'target-dev-hub': sf_plugins_core_1.requiredHubFlagWithDeprecations,
|
33
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
34
|
+
loglevel: sf_plugins_core_1.loglevel,
|
35
|
+
snapshot: sf_plugins_core_1.Flags.string({
|
36
|
+
char: 's',
|
37
|
+
summary: messages.getMessage('flags.snapshot.summary'),
|
38
|
+
description: messages.getMessage('flags.snapshot.description'),
|
39
|
+
required: true,
|
40
|
+
}),
|
41
|
+
};
|
42
|
+
//# sourceMappingURL=snapshot.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../src/commands/org/get/snapshot.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,iEAMqC;AACrC,2CAA4C;AAC5C,uDAAgG;AAEhG,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC;AAErF,MAAa,WAAY,SAAQ,2BAAsB;IAmB9C,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAe,EAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClH,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACvB,IAAA,iCAAsB,EAAC,MAAM,CAAC,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA1BH,kCA2BC;AA1BwB,mBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,uBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,oBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,mBAAO,GAAG,CAAC,wBAAwB,CAAC,CAAC;AACrC,4BAAgB,GAAG,IAAI,CAAC;AAExB,iBAAK,GAAG;IAC7B,gBAAgB,EAAE,iDAA+B;IACjD,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;IACR,QAAQ,EAAE,uBAAK,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;QACtD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;QAC9D,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
import { OrgShapeListResult } from '../../../shared/orgShapeListUtils';
|
3
|
+
export declare class OrgShapeListCommand extends SfCommand<OrgShapeListResult[]> {
|
4
|
+
static readonly summary: string;
|
5
|
+
static readonly description: string;
|
6
|
+
static readonly examples: string[];
|
7
|
+
static readonly aliases: string[];
|
8
|
+
static readonly deprecateAliases = true;
|
9
|
+
static readonly flags: {
|
10
|
+
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
11
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
12
|
+
};
|
13
|
+
run(): Promise<OrgShapeListResult[]>;
|
14
|
+
}
|
15
|
+
export declare const getAllOrgShapesFromAuthenticatedOrgs: () => Promise<OrgShapeListResult[]>;
|
@@ -0,0 +1,64 @@
|
|
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.getAllOrgShapesFromAuthenticatedOrgs = exports.OrgShapeListCommand = void 0;
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
11
|
+
const core_1 = require("@salesforce/core");
|
12
|
+
const chalk = require("chalk");
|
13
|
+
const orgShapeListUtils_1 = require("../../../shared/orgShapeListUtils");
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-signups', 'shape.list');
|
16
|
+
// default columns for the shape list
|
17
|
+
const orgShapeColumns = {
|
18
|
+
alias: {
|
19
|
+
header: 'ALIAS',
|
20
|
+
get: (data) => data.alias ?? '',
|
21
|
+
},
|
22
|
+
username: { header: 'USERNAME' },
|
23
|
+
orgId: { header: 'ORG ID' },
|
24
|
+
status: { header: 'SHAPE STATUS' },
|
25
|
+
createdBy: { header: 'CREATED BY' },
|
26
|
+
createdDate: { header: 'CREATED DATE' },
|
27
|
+
};
|
28
|
+
class OrgShapeListCommand extends sf_plugins_core_1.SfCommand {
|
29
|
+
// there were no flags being used in the original!
|
30
|
+
// eslint-disable-next-line sf-plugin/should-parse-flags
|
31
|
+
async run() {
|
32
|
+
const shapes = await (0, exports.getAllOrgShapesFromAuthenticatedOrgs)();
|
33
|
+
if (shapes.length === 0) {
|
34
|
+
this.info(messages.getMessage('noOrgShapes'));
|
35
|
+
return shapes;
|
36
|
+
}
|
37
|
+
this.styledHeader('Org Shapes');
|
38
|
+
this.table(shapes.map((shape) => (shape.status === 'Active' ? { ...shape, status: chalk.green(shape.status) } : shape)), orgShapeColumns);
|
39
|
+
return shapes;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
exports.OrgShapeListCommand = OrgShapeListCommand;
|
43
|
+
OrgShapeListCommand.summary = messages.getMessage('summary');
|
44
|
+
OrgShapeListCommand.description = messages.getMessage('description');
|
45
|
+
OrgShapeListCommand.examples = messages.getMessages('examples');
|
46
|
+
OrgShapeListCommand.aliases = ['force:org:shape:list'];
|
47
|
+
OrgShapeListCommand.deprecateAliases = true;
|
48
|
+
OrgShapeListCommand.flags = {
|
49
|
+
verbose: sf_plugins_core_1.Flags.boolean({
|
50
|
+
summary: messages.getMessage('verbose'),
|
51
|
+
hidden: true,
|
52
|
+
}),
|
53
|
+
loglevel: sf_plugins_core_1.loglevel,
|
54
|
+
};
|
55
|
+
const getAllOrgShapesFromAuthenticatedOrgs = async () => {
|
56
|
+
const orgs = await core_1.AuthInfo.listAllAuthorizations((orgAuth) => !orgAuth.error && !orgAuth.isScratchOrg);
|
57
|
+
if (orgs.length === 0) {
|
58
|
+
throw messages.createError('noAuthFound');
|
59
|
+
}
|
60
|
+
const shapes = await Promise.all(orgs.map((o) => (0, orgShapeListUtils_1.getAllShapesFromOrg)(o)));
|
61
|
+
return shapes.flat();
|
62
|
+
};
|
63
|
+
exports.getAllOrgShapesFromAuthenticatedOrgs = getAllOrgShapesFromAuthenticatedOrgs;
|
64
|
+
//# sourceMappingURL=shape.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"","sources":["../../../../src/commands/org/list/shape.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iEAAyE;AACzE,2CAAsD;AACtD,+BAA+B;AAC/B,yEAA4F;AAE5F,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CA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,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,4BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,2BAAO,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACnC,oCAAgB,GAAG,IAAI,CAAC;AAExB,yBAAK,GAAG;IAC7B,OAAO,EAAE,uBAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QACvC,MAAM,EAAE,IAAI;KACb,CAAC;IACF,QAAQ,EAAR,0BAAQ;CACT,CAAC;AAoBG,MAAM,oCAAoC,GAAG,KAAK,IAAmC,EAAE;IAC5F,MAAM,IAAI,GAAG,MAAM,eAAQ,CAAC,qBAAqB,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxG,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;KAC3C;IACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uCAAmB,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAPW,QAAA,oCAAoC,wCAO/C"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
2
|
+
import { OrgSnapshot } from '../../../shared/snapshot';
|
3
|
+
export declare class SnapshotList extends SfCommand<OrgSnapshot[]> {
|
4
|
+
static readonly summary: string;
|
5
|
+
static readonly description: string;
|
6
|
+
static readonly examples: string[];
|
7
|
+
static readonly aliases: string[];
|
8
|
+
static readonly deprecateAliases = true;
|
9
|
+
static readonly flags: {
|
10
|
+
'target-dev-hub': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
11
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
12
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
13
|
+
};
|
14
|
+
run(): Promise<OrgSnapshot[]>;
|
15
|
+
}
|