@salesforce/plugin-schema 2.1.19 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/lib/commands/sobject/describe.d.ts +16 -0
- package/lib/commands/sobject/describe.js +46 -0
- package/lib/commands/sobject/describe.js.map +1 -0
- package/lib/commands/sobject/list.d.ts +20 -0
- package/lib/commands/sobject/list.js +67 -0
- package/lib/commands/sobject/list.js.map +1 -0
- package/messages/describe.md +31 -0
- package/messages/list.md +29 -0
- package/oclif.manifest.json +1 -1
- package/package.json +22 -23
- package/lib/commands/force/schema/sobject/describe.d.ts +0 -9
- package/lib/commands/force/schema/sobject/describe.js +0 -42
- package/lib/commands/force/schema/sobject/describe.js.map +0 -1
- package/lib/commands/force/schema/sobject/list.d.ts +0 -13
- package/lib/commands/force/schema/sobject/list.js +0 -66
- package/lib/commands/force/schema/sobject/list.js.map +0 -1
- package/messages/describe.json +0 -12
- package/messages/list.json +0 -13
package/LICENSE.txt
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { DescribeSObjectResult } from 'jsforce';
|
|
3
|
+
export declare class SObjectDescribe extends SfCommand<DescribeSObjectResult> {
|
|
4
|
+
static readonly summary: string;
|
|
5
|
+
static readonly description: string;
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly aliases: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
10
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
|
+
sobject: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
13
|
+
'use-tooling-api': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<DescribeSObjectResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.SObjectDescribe = void 0;
|
|
10
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-schema', 'describe');
|
|
14
|
+
class SObjectDescribe extends sf_plugins_core_1.SfCommand {
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(SObjectDescribe);
|
|
17
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
18
|
+
const description = flags['use-tooling-api']
|
|
19
|
+
? await conn.tooling.describe(flags.sobject)
|
|
20
|
+
: await conn.describe(flags.sobject);
|
|
21
|
+
this.styledJSON(description);
|
|
22
|
+
return description;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.SObjectDescribe = SObjectDescribe;
|
|
26
|
+
SObjectDescribe.summary = messages.getMessage('summary');
|
|
27
|
+
SObjectDescribe.description = messages.getMessage('description');
|
|
28
|
+
SObjectDescribe.examples = messages.getMessages('examples');
|
|
29
|
+
SObjectDescribe.aliases = ['force:schema:sobject:describe'];
|
|
30
|
+
SObjectDescribe.flags = {
|
|
31
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
32
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
33
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
34
|
+
sobject: sf_plugins_core_1.Flags.string({
|
|
35
|
+
char: 's',
|
|
36
|
+
required: true,
|
|
37
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
38
|
+
aliases: ['sobjecttype'],
|
|
39
|
+
}),
|
|
40
|
+
'use-tooling-api': sf_plugins_core_1.Flags.boolean({
|
|
41
|
+
char: 't',
|
|
42
|
+
summary: messages.getMessage('flags.tooling-api.summary'),
|
|
43
|
+
aliases: ['usetoolingapi'],
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../src/commands/sobject/describe.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iEAMqC;AAErC,2CAA4C;AAG5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,UAAU,CAAC,CAAC;AAEhF,MAAa,eAAgB,SAAQ,2BAAgC;IAsB5D,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QAErE,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC;YAC1C,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5C,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,UAAU,CAAC,WAAsB,CAAC,CAAC;QAExC,OAAO,WAAW,CAAC;IACrB,CAAC;;AAjCH,0CAkCC;AAjCwB,uBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,2BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,wBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,uBAAO,GAAG,CAAC,+BAA+B,CAAC,CAAC;AACrD,qBAAK,GAAG;IACpB,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;IACR,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;QACrD,OAAO,EAAE,CAAC,aAAa,CAAC;KACzB,CAAC;IACF,iBAAiB,EAAE,uBAAK,CAAC,OAAO,CAAC;QAC/B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;QACzD,OAAO,EAAE,CAAC,eAAe,CAAC;KAC3B,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export declare enum SObjectType {
|
|
3
|
+
ALL = 0,
|
|
4
|
+
STANDARD = 1,
|
|
5
|
+
CUSTOM = 2
|
|
6
|
+
}
|
|
7
|
+
export type SObjectListResult = string[];
|
|
8
|
+
export declare class SObjectList extends SfCommand<SObjectListResult> {
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly aliases: string[];
|
|
13
|
+
static flags: {
|
|
14
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
15
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
17
|
+
sobject: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<SObjectListResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SObjectList = exports.SObjectType = 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 = require("node:os");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const core_1 = require("@salesforce/core");
|
|
13
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-schema', 'list');
|
|
15
|
+
var SObjectType;
|
|
16
|
+
(function (SObjectType) {
|
|
17
|
+
SObjectType[SObjectType["ALL"] = 0] = "ALL";
|
|
18
|
+
SObjectType[SObjectType["STANDARD"] = 1] = "STANDARD";
|
|
19
|
+
SObjectType[SObjectType["CUSTOM"] = 2] = "CUSTOM";
|
|
20
|
+
})(SObjectType = exports.SObjectType || (exports.SObjectType = {}));
|
|
21
|
+
class SObjectList extends sf_plugins_core_1.SfCommand {
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(SObjectList);
|
|
24
|
+
const category = flags.sobject.toUpperCase();
|
|
25
|
+
const type = SObjectType[category];
|
|
26
|
+
const allDescriptions = await flags['target-org'].getConnection(flags['api-version']).describeGlobal();
|
|
27
|
+
const sobjects = allDescriptions.sobjects
|
|
28
|
+
.filter((sobject) => {
|
|
29
|
+
const isCustom = sobject.custom;
|
|
30
|
+
return (type === SObjectType.ALL ||
|
|
31
|
+
(type === SObjectType.CUSTOM && isCustom) ||
|
|
32
|
+
(type === SObjectType.STANDARD && !isCustom));
|
|
33
|
+
})
|
|
34
|
+
.map((sobject) => sobject.name);
|
|
35
|
+
if (sobjects.length) {
|
|
36
|
+
this.log(sobjects.join(os.EOL));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.log(messages.getMessage('noTypeFound', [SObjectType[type]]));
|
|
40
|
+
}
|
|
41
|
+
return sobjects;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.SObjectList = SObjectList;
|
|
45
|
+
SObjectList.summary = messages.getMessage('summary');
|
|
46
|
+
SObjectList.description = messages.getMessage('description');
|
|
47
|
+
SObjectList.examples = messages.getMessages('examples');
|
|
48
|
+
SObjectList.aliases = ['force:schema:sobject:list'];
|
|
49
|
+
SObjectList.flags = {
|
|
50
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
51
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
52
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
53
|
+
sobject: sf_plugins_core_1.Flags.string({
|
|
54
|
+
char: 's',
|
|
55
|
+
default: 'ALL',
|
|
56
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
57
|
+
aliases: ['sobjecttypecategory', 'c'],
|
|
58
|
+
parse: (val) => {
|
|
59
|
+
const lowercasedType = val.toLowerCase();
|
|
60
|
+
if (!['all', 'standard', 'custom'].includes(lowercasedType)) {
|
|
61
|
+
throw messages.createError('invalid-sobject-type');
|
|
62
|
+
}
|
|
63
|
+
return Promise.resolve(lowercasedType);
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/sobject/list.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,8B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+
# description
|
|
6
|
+
|
|
7
|
+
The metadata is displayed in JSON format. See this topic for a description of each property: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm.
|
|
8
|
+
|
|
9
|
+
This command displays metadata for Salesforce objects by default. Use the --use-tooling-api flag to view metadata for a Tooling API object.
|
|
10
|
+
|
|
11
|
+
# examples
|
|
12
|
+
|
|
13
|
+
- Display the metadata of the "Account" standard object in your default org:
|
|
14
|
+
|
|
15
|
+
<%= config.bin %> <%= command.id %> --sobject Account
|
|
16
|
+
|
|
17
|
+
- Display the metadata of the "MyObject__c" custom object in the org with alias "my-scratch-org":
|
|
18
|
+
|
|
19
|
+
<%= config.bin %> <%= command.id %> --sobject MyObject__c --target-org my-scratch-org
|
|
20
|
+
|
|
21
|
+
- Display the metadata of the ApexCodeCoverage Tooling API object in your default org:
|
|
22
|
+
|
|
23
|
+
<%= config.bin %> <%= command.id %> --sobject ApexCodeCoverage --use-tooling-api
|
|
24
|
+
|
|
25
|
+
# flags.sobject.summary
|
|
26
|
+
|
|
27
|
+
API name of the object to describe.
|
|
28
|
+
|
|
29
|
+
# flags.tooling-api.summary
|
|
30
|
+
|
|
31
|
+
Use Tooling API to display metadata for Tooling API objects.
|
package/messages/list.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
List all Salesforce objects of a specified category.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
You can list the standard objects, custom objects, or all. The lists include only Salesforce objects, not Tooling API objects.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- List all objects in your default org:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %> --sobject all
|
|
14
|
+
|
|
15
|
+
- List only custom objects in the org with alias "my-scratch-org":
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --sobject custom --target-org my-scratch-org
|
|
18
|
+
|
|
19
|
+
# flags.sobject.summary
|
|
20
|
+
|
|
21
|
+
Category of objects to list.
|
|
22
|
+
|
|
23
|
+
# invalid-sobject-type
|
|
24
|
+
|
|
25
|
+
"--sobject" flag can be set only to <all|custom|standard>."
|
|
26
|
+
|
|
27
|
+
# noTypeFound
|
|
28
|
+
|
|
29
|
+
No %s objects found.
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.2.0","commands":{"sobject:describe":{"id":"sobject:describe","summary":"Display the metadata for a standard or custom object or a Tooling API object.","description":"The metadata is displayed in JSON format. See this topic for a description of each property: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_describesobjects_describesobjectresult.htm.\n\nThis command displays metadata for Salesforce objects by default. Use the --use-tooling-api flag to view metadata for a Tooling API object.","strict":true,"pluginName":"@salesforce/plugin-schema","pluginAlias":"@salesforce/plugin-schema","pluginType":"core","aliases":["force:schema:sobject:describe"],"examples":["Display the metadata of the \"Account\" standard object in your default org:\n<%= config.bin %> <%= command.id %> --sobject Account","Display the metadata of the \"MyObject__c\" custom object in the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --sobject MyObject__c --target-org my-scratch-org","Display the metadata of the ApexCodeCoverage Tooling API object in your default org:\n<%= config.bin %> <%= command.id %> --sobject ApexCodeCoverage --use-tooling-api"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"target-org":{"name":"target-org","type":"option","char":"o","summary":"Username or alias of the target org.","multiple":false,"aliases":["targetusername","u"]},"api-version":{"name":"api-version","type":"option","description":"Override the api version used for api requests made by this command","multiple":false,"aliases":["apiversion"]},"loglevel":{"name":"loglevel","type":"option","hidden":true,"multiple":false,"deprecated":{"message":"The loglevel flag is no longer in use on this command. You may use it without error, but it will be ignored."}},"sobject":{"name":"sobject","type":"option","char":"s","summary":"API name of the object to describe.","required":true,"multiple":false,"aliases":["sobjecttype"]},"use-tooling-api":{"name":"use-tooling-api","type":"boolean","char":"t","summary":"Use Tooling API to display metadata for Tooling API objects.","allowNo":false,"aliases":["usetoolingapi"]}},"args":[],"hasDynamicHelp":true},"sobject:list":{"id":"sobject:list","summary":"List all Salesforce objects of a specified category.","description":"You can list the standard objects, custom objects, or all. The lists include only Salesforce objects, not Tooling API objects.","strict":true,"pluginName":"@salesforce/plugin-schema","pluginAlias":"@salesforce/plugin-schema","pluginType":"core","aliases":["force:schema:sobject:list"],"examples":["List all objects in your default org:\n<%= config.bin %> <%= command.id %> --sobject all","List only custom objects in the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --sobject custom --target-org my-scratch-org"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"target-org":{"name":"target-org","type":"option","char":"o","summary":"Username or alias of the target org.","multiple":false,"aliases":["targetusername","u"]},"api-version":{"name":"api-version","type":"option","description":"Override the api version used for api requests made by this command","multiple":false,"aliases":["apiversion"]},"loglevel":{"name":"loglevel","type":"option","hidden":true,"multiple":false,"deprecated":{"message":"The loglevel flag is no longer in use on this command. You may use it without error, but it will be ignored."}},"sobject":{"name":"sobject","type":"option","char":"s","summary":"Category of objects to list.","multiple":false,"default":"ALL","aliases":["sobjecttypecategory","c"]}},"args":[],"hasDynamicHelp":true}}}
|
package/package.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-schema",
|
|
3
3
|
"description": "Commands to interact with salesforce sobject schemas",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@oclif/core": "^1.
|
|
10
|
-
"@salesforce/
|
|
11
|
-
"@salesforce/core": "^
|
|
9
|
+
"@oclif/core": "^1.20.4",
|
|
10
|
+
"@salesforce/core": "^3.32.8",
|
|
11
|
+
"@salesforce/sf-plugins-core": "^1.19.2",
|
|
12
12
|
"tslib": "^2"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@oclif/plugin-command-snapshot": "^3.2.
|
|
16
|
-
"@
|
|
15
|
+
"@oclif/plugin-command-snapshot": "^3.2.16",
|
|
16
|
+
"@oclif/plugin-help": "^5.1.22",
|
|
17
|
+
"@salesforce/cli-plugins-testkit": "^3.2.15",
|
|
17
18
|
"@salesforce/dev-config": "^3.0.1",
|
|
18
19
|
"@salesforce/dev-scripts": "^3.1.0",
|
|
19
|
-
"@salesforce/plugin-command-reference": "^
|
|
20
|
+
"@salesforce/plugin-command-reference": "^2.2.8",
|
|
20
21
|
"@salesforce/prettier-config": "^0.0.2",
|
|
21
22
|
"@salesforce/ts-sinon": "1.4.2",
|
|
22
|
-
"@swc/core": "^1.3.
|
|
23
|
+
"@swc/core": "^1.3.24",
|
|
23
24
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
24
|
-
"@typescript-eslint/parser": "^5.
|
|
25
|
+
"@typescript-eslint/parser": "^5.47.0",
|
|
25
26
|
"chai": "^4.3.7",
|
|
26
|
-
"eslint": "^8.
|
|
27
|
+
"eslint": "^8.30.0",
|
|
27
28
|
"eslint-config-prettier": "^8.5.0",
|
|
28
29
|
"eslint-config-salesforce": "^1.1.0",
|
|
29
30
|
"eslint-config-salesforce-license": "^0.1.6",
|
|
@@ -31,10 +32,11 @@
|
|
|
31
32
|
"eslint-plugin-header": "^3.0.0",
|
|
32
33
|
"eslint-plugin-import": "2.26.0",
|
|
33
34
|
"eslint-plugin-jsdoc": "^39.6.4",
|
|
35
|
+
"eslint-plugin-sf-plugin": "^1.1.5",
|
|
34
36
|
"husky": "^7.0.4",
|
|
35
37
|
"mocha": "^9.1.3",
|
|
36
38
|
"nyc": "^15.1.0",
|
|
37
|
-
"oclif": "^3.3
|
|
39
|
+
"oclif": "^3.4.3",
|
|
38
40
|
"prettier": "^2.8.1",
|
|
39
41
|
"pretty-quick": "^3.1.0",
|
|
40
42
|
"shx": "0.3.4",
|
|
@@ -69,17 +71,14 @@
|
|
|
69
71
|
"@salesforce/plugin-command-reference"
|
|
70
72
|
],
|
|
71
73
|
"topics": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
+
"sobject": {
|
|
75
|
+
"description": "Commands to interact with Salesforce objects.",
|
|
74
76
|
"subtopics": {
|
|
75
|
-
"
|
|
76
|
-
"description": "List
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"description": "list standard object metadata types"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
77
|
+
"list": {
|
|
78
|
+
"description": "List all Salesforce objects of a specified category."
|
|
79
|
+
},
|
|
80
|
+
"describe": {
|
|
81
|
+
"description": "Displays the metadata for a standard or custom object."
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"access": "public"
|
|
111
110
|
},
|
|
112
111
|
"sfdx": {
|
|
113
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-schema/2.
|
|
114
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-schema/2.
|
|
112
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-schema/2.2.0.crt",
|
|
113
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-schema/2.2.0.sig"
|
|
115
114
|
}
|
|
116
115
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlagsConfig, SfdxCommand } from '@salesforce/command';
|
|
2
|
-
import { DescribeSObjectResult } from 'jsforce';
|
|
3
|
-
export declare class SchemaSObjectDescribe extends SfdxCommand {
|
|
4
|
-
static readonly description: string;
|
|
5
|
-
static readonly examples: string[];
|
|
6
|
-
static readonly flagsConfig: FlagsConfig;
|
|
7
|
-
static readonly requiresUsername = true;
|
|
8
|
-
run(): Promise<DescribeSObjectResult>;
|
|
9
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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.SchemaSObjectDescribe = void 0;
|
|
10
|
-
const os = require("os");
|
|
11
|
-
const command_1 = require("@salesforce/command");
|
|
12
|
-
const core_1 = require("@salesforce/core");
|
|
13
|
-
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-schema', 'describe');
|
|
15
|
-
class SchemaSObjectDescribe extends command_1.SfdxCommand {
|
|
16
|
-
async run() {
|
|
17
|
-
const conn = this.org.getConnection();
|
|
18
|
-
const description = this.flags.usetoolingapi
|
|
19
|
-
? await conn.tooling.describe(this.flags.sobjecttype)
|
|
20
|
-
: await conn.describe(this.flags.sobjecttype);
|
|
21
|
-
if (!this.flags.json) {
|
|
22
|
-
this.ux.logJson(description);
|
|
23
|
-
}
|
|
24
|
-
return description;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.SchemaSObjectDescribe = SchemaSObjectDescribe;
|
|
28
|
-
SchemaSObjectDescribe.description = messages.getMessage('description');
|
|
29
|
-
SchemaSObjectDescribe.examples = messages.getMessage('examples').split(os.EOL);
|
|
30
|
-
SchemaSObjectDescribe.flagsConfig = {
|
|
31
|
-
sobjecttype: command_1.flags.string({
|
|
32
|
-
char: 's',
|
|
33
|
-
required: true,
|
|
34
|
-
description: messages.getMessage('flags.objectType'),
|
|
35
|
-
}),
|
|
36
|
-
usetoolingapi: command_1.flags.boolean({
|
|
37
|
-
char: 't',
|
|
38
|
-
description: messages.getMessage('flags.useTooling'),
|
|
39
|
-
}),
|
|
40
|
-
};
|
|
41
|
-
SchemaSObjectDescribe.requiresUsername = true;
|
|
42
|
-
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../../../../src/commands/force/schema/sobject/describe.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,iDAAsE;AACtE,2CAAwD;AAGxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,UAAU,CAAC,CAAC;AAEhF,MAAa,qBAAsB,SAAQ,qBAAW;IAgB7C,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,GAAe,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAClD,MAAM,WAAW,GAA0B,IAAI,CAAC,KAAK,CAAC,aAAa;YACjE,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAqB,CAAC;YAC/D,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAqB,CAAC,CAAC;QAE1D,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA3BH,sDA4BC;AA3BwB,iCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,8BAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,iCAAW,GAAgB;IAChD,WAAW,EAAE,eAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC;KACrD,CAAC;IACF,aAAa,EAAE,eAAK,CAAC,OAAO,CAAC;QAC3B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC;KACrD,CAAC;CACH,CAAC;AAEqB,sCAAgB,GAAG,IAAI,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FlagsConfig, SfdxCommand } from '@salesforce/command';
|
|
2
|
-
export declare enum SObjectType {
|
|
3
|
-
ALL = 0,
|
|
4
|
-
STANDARD = 1,
|
|
5
|
-
CUSTOM = 2
|
|
6
|
-
}
|
|
7
|
-
export declare class SchemaSobjectList extends SfdxCommand {
|
|
8
|
-
static readonly description: string;
|
|
9
|
-
static readonly examples: string[];
|
|
10
|
-
static readonly flagsConfig: FlagsConfig;
|
|
11
|
-
static readonly requiresUsername = true;
|
|
12
|
-
run(): Promise<string[]>;
|
|
13
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchemaSobjectList = exports.SObjectType = 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 command_1 = require("@salesforce/command");
|
|
12
|
-
const core_1 = require("@salesforce/core");
|
|
13
|
-
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
-
const messages = core_1.Messages.loadMessages('@salesforce/plugin-schema', 'list');
|
|
15
|
-
// eslint-disable-next-line no-shadow
|
|
16
|
-
var SObjectType;
|
|
17
|
-
(function (SObjectType) {
|
|
18
|
-
SObjectType[SObjectType["ALL"] = 0] = "ALL";
|
|
19
|
-
SObjectType[SObjectType["STANDARD"] = 1] = "STANDARD";
|
|
20
|
-
SObjectType[SObjectType["CUSTOM"] = 2] = "CUSTOM";
|
|
21
|
-
})(SObjectType = exports.SObjectType || (exports.SObjectType = {}));
|
|
22
|
-
class SchemaSobjectList extends command_1.SfdxCommand {
|
|
23
|
-
async run() {
|
|
24
|
-
const category = this.flags.sobjecttypecategory.toUpperCase();
|
|
25
|
-
const type = SObjectType[category];
|
|
26
|
-
const typeDescriptions = [];
|
|
27
|
-
const conn = this.org.getConnection();
|
|
28
|
-
const allDescriptions = await conn.describeGlobal();
|
|
29
|
-
let havePrinted = false;
|
|
30
|
-
allDescriptions.sobjects.forEach((sobject) => {
|
|
31
|
-
const isCustom = sobject.custom === true;
|
|
32
|
-
const doPrint = type === SObjectType.ALL ||
|
|
33
|
-
(type === SObjectType.CUSTOM && isCustom) ||
|
|
34
|
-
(type === SObjectType.STANDARD && !isCustom);
|
|
35
|
-
if (doPrint) {
|
|
36
|
-
havePrinted = true;
|
|
37
|
-
this.ux.log(sobject.name);
|
|
38
|
-
typeDescriptions.push(sobject.name);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
if (!havePrinted) {
|
|
42
|
-
this.ux.log(messages.getMessage('noTypeFound', [SObjectType[type]]));
|
|
43
|
-
}
|
|
44
|
-
return typeDescriptions;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.SchemaSobjectList = SchemaSobjectList;
|
|
48
|
-
SchemaSobjectList.description = messages.getMessage('description');
|
|
49
|
-
SchemaSobjectList.examples = messages.getMessage('examples').split(os_1.EOL);
|
|
50
|
-
SchemaSobjectList.flagsConfig = {
|
|
51
|
-
sobjecttypecategory: command_1.flags.string({
|
|
52
|
-
char: 'c',
|
|
53
|
-
default: 'ALL',
|
|
54
|
-
validate: (val) => {
|
|
55
|
-
const capitalized = val.toUpperCase();
|
|
56
|
-
const result = capitalized === 'ALL' || capitalized === 'STANDARD' || capitalized === 'CUSTOM';
|
|
57
|
-
if (!result) {
|
|
58
|
-
throw messages.createError('flags.invalidTypeError');
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
61
|
-
},
|
|
62
|
-
description: messages.getMessage('flags.typeDescription'),
|
|
63
|
-
}),
|
|
64
|
-
};
|
|
65
|
-
SchemaSobjectList.requiresUsername = true;
|
|
66
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands/force/schema/sobject/list.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2BAAyB;AACzB,iDAAsE;AACtE,2CAAwD;AAGxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;AAE5E,qCAAqC;AACrC,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,2CAAG,CAAA;IACH,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,MAAa,iBAAkB,SAAQ,qBAAW;IAoBzC,KAAK,CAAC,GAAG;QACd,MAAM,QAAQ,GAAI,IAAI,CAAC,KAAK,CAAC,mBAA8B,CAAC,WAAW,EAA8B,CAAC;QACtG,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEnC,MAAM,gBAAgB,GAAa,EAAE,CAAC;QAEtC,MAAM,IAAI,GAAe,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAClD,MAAM,eAAe,GAAyB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE1E,IAAI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,WAAW,KAAK,QAAQ,CAAC;YAC/F,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;aACtD;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;KAC1D,CAAC;CACH,CAAC;AACqB,kCAAgB,GAAG,IAAI,CAAC"}
|
package/messages/describe.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "displays the metadata for a standard or custom object",
|
|
3
|
-
"examples": [
|
|
4
|
-
"$ sfdx force:schema:sobject:describe -s Account",
|
|
5
|
-
"$ sfdx force:schema:sobject:describe -s MyObject__c",
|
|
6
|
-
"$ sfdx force:schema:sobject:describe -s ApexClass -t"
|
|
7
|
-
],
|
|
8
|
-
"flags": {
|
|
9
|
-
"objectType": "the API name of the object to describe",
|
|
10
|
-
"useTooling": "execute with Tooling API"
|
|
11
|
-
}
|
|
12
|
-
}
|
package/messages/list.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "list all objects of a specified category",
|
|
3
|
-
"flags": {
|
|
4
|
-
"typeDescription": "the type of objects to list (all|custom|standard)",
|
|
5
|
-
"invalidTypeError": "\"Type\" flag can be set only to <all|custom|standard>."
|
|
6
|
-
},
|
|
7
|
-
"examples": [
|
|
8
|
-
"$ sfdx force:schema:sobject:list -c all",
|
|
9
|
-
"$ sfdx force:schema:sobject:list -c custom",
|
|
10
|
-
"$ sfdx force:schema:sobject:list -c standard"
|
|
11
|
-
],
|
|
12
|
-
"noTypeFound": "No %s objects found."
|
|
13
|
-
}
|