@salesforce/plugin-limits 2.1.0 → 2.1.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/README.md CHANGED
@@ -50,11 +50,11 @@ yarn install
50
50
  yarn build
51
51
  ```
52
52
 
53
- To use your plugin, run using the local `./bin/run` or `./bin/run.cmd` file.
53
+ To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
54
54
 
55
55
  ```bash
56
56
  # Run using local run file.
57
- ./bin/run force:limits
57
+ ./bin/dev force:limits
58
58
  ```
59
59
 
60
60
  There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
@@ -0,0 +1,13 @@
1
+ import { SfdxCommand } from '@salesforce/command';
2
+ type ApiLimit = {
3
+ name: string;
4
+ max: number;
5
+ remaining: number;
6
+ };
7
+ export declare class LimitsApiDisplayCommand extends SfdxCommand {
8
+ static readonly description: string;
9
+ static readonly examples: string[];
10
+ static readonly requiresUsername = true;
11
+ run(): Promise<ApiLimit[]>;
12
+ }
13
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LimitsApiDisplayCommand = 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("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-limits', 'display');
15
+ class LimitsApiDisplayCommand extends command_1.SfdxCommand {
16
+ async run() {
17
+ try {
18
+ const conn = this.org.getConnection();
19
+ const geturl = `${conn.instanceUrl}/services/data/v${conn.version}/limits`;
20
+ const result = await conn.request(geturl);
21
+ const limits = [];
22
+ Object.keys(result).map((limitName) => {
23
+ limits.push({
24
+ name: limitName,
25
+ max: result[limitName].Max,
26
+ remaining: result[limitName].Remaining,
27
+ });
28
+ });
29
+ this.ux.table(limits, { name: { header: 'Name' }, remaining: { header: 'Remaining' }, max: { header: 'Max' } });
30
+ return limits;
31
+ }
32
+ catch (err) {
33
+ if (err instanceof Error || typeof err === 'string') {
34
+ throw core_1.SfError.wrap(err);
35
+ }
36
+ throw err;
37
+ }
38
+ }
39
+ }
40
+ exports.LimitsApiDisplayCommand = LimitsApiDisplayCommand;
41
+ LimitsApiDisplayCommand.description = messages.getMessage('description');
42
+ LimitsApiDisplayCommand.examples = messages.getMessage('examples').split(os.EOL);
43
+ LimitsApiDisplayCommand.requiresUsername = true;
44
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../../src/commands/force/limits/api/display.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAkD;AAClD,2CAAqD;AAErD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC;AAe/E,MAAa,uBAAwB,SAAQ,qBAAW;IAK/C,KAAK,CAAC,GAAG;QACd,IAAI;YACF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,mBAAmB,IAAI,CAAC,OAAO,SAAS,CAAC;YAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAS,MAAM,CAAC,CAAC;YAClD,MAAM,MAAM,GAAe,EAAE,CAAC;YAE9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;gBACpC,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,SAAS;oBACf,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG;oBAC1B,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAEhH,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,KAAK,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBACnD,MAAM,cAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;YACD,MAAM,GAAG,CAAC;SACX;IACH,CAAC;;AA7BH,0DA8BC;AA7BwB,mCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,gCAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,wCAAgB,GAAG,IAAI,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { FlagsConfig, SfdxCommand, SfdxResult } from '@salesforce/command';
2
+ export interface RecordCount {
3
+ name: string;
4
+ count: number;
5
+ }
6
+ export declare class LimitsRecordCountsDisplayCommand extends SfdxCommand {
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly requiresUsername = true;
10
+ static readonly result: SfdxResult;
11
+ protected static readonly flagsConfig: FlagsConfig;
12
+ run(): Promise<RecordCount[]>;
13
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LimitsRecordCountsDisplayCommand = 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("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-limits', 'recordcounts');
15
+ class LimitsRecordCountsDisplayCommand extends command_1.SfdxCommand {
16
+ async run() {
17
+ try {
18
+ const sobjectsPassed = this.flags.sobjecttype;
19
+ const sobjectsQuery = sobjectsPassed ? `=${sobjectsPassed.join()}` : '';
20
+ const conn = this.org.getConnection();
21
+ const geturl = `${conn.baseUrl()}/limits/recordCount?sObjects${sobjectsQuery}`;
22
+ const result = await conn.request(geturl);
23
+ // if an object is requested, but there's 0 of them on the server, append that object to the result
24
+ if (sobjectsPassed) {
25
+ sobjectsPassed.forEach((name) => {
26
+ if (!result.sObjects.find((record) => record.name === name)) {
27
+ result.sObjects.push({ name, count: 0 });
28
+ }
29
+ });
30
+ }
31
+ return result.sObjects;
32
+ }
33
+ catch (err) {
34
+ if (err instanceof Error || typeof err === 'string') {
35
+ throw core_1.SfError.wrap(err);
36
+ }
37
+ throw err;
38
+ }
39
+ }
40
+ }
41
+ exports.LimitsRecordCountsDisplayCommand = LimitsRecordCountsDisplayCommand;
42
+ LimitsRecordCountsDisplayCommand.description = messages.getMessage('commandDescription');
43
+ LimitsRecordCountsDisplayCommand.examples = messages.getMessage('examples').split(os.EOL);
44
+ LimitsRecordCountsDisplayCommand.requiresUsername = true;
45
+ LimitsRecordCountsDisplayCommand.result = {
46
+ tableColumnData: {
47
+ name: { header: 'sObject' },
48
+ count: { header: 'Record Count' },
49
+ },
50
+ display() {
51
+ if (Array.isArray(this.data) && this.data.length) {
52
+ this.ux.table(this.data, this.tableColumnData);
53
+ }
54
+ },
55
+ };
56
+ LimitsRecordCountsDisplayCommand.flagsConfig = {
57
+ sobjecttype: command_1.flags.array({
58
+ char: 's',
59
+ description: messages.getMessage('sobjecttypeFlagDescription'),
60
+ }),
61
+ };
62
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../../src/commands/force/limits/recordcounts/display.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAkF;AAClF,2CAAqD;AAErD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;AAWpF,MAAa,gCAAiC,SAAQ,qBAAW;IAuBxD,KAAK,CAAC,GAAG;QACd,IAAI;YACF,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAuB,CAAC;YAC1D,MAAM,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAExE,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,+BAA+B,aAAa,EAAE,CAAC;YAC/E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAS,MAAM,CAAC,CAAC;YAElD,mGAAmG;YACnG,IAAI,cAAc,EAAE;gBAClB,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE;wBAC3D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;qBAC1C;gBACH,CAAC,CAAC,CAAC;aACJ;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC;SACxB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,KAAK,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBACnD,MAAM,cAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;YACD,MAAM,GAAG,CAAC;SACX;IACH,CAAC;;AAhDH,4EAiDC;AAhDwB,4CAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACxD,yCAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,iDAAgB,GAAG,IAAI,CAAC;AACxB,uCAAM,GAAe;IAC1C,eAAe,EAAE;QACf,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;KAClC;IACD,OAAO;QACL,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;SAChD;IACH,CAAC;CACF,CAAC;AAEwB,4CAAW,GAAgB;IACnD,WAAW,EAAE,eAAK,CAAC,KAAK,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;KAC/D,CAAC;CACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "display current org’s limits\nWhen you execute this command in a project, it provides limit information for your default scratch org.",
3
+ "examples": ["$ sfdx force:limits:api:display", "$ sfdx force:limits:api:display -u me@my.org"]
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "commandDescription": "display record counts for the specified standard and custom objects\nUse this command to get an approximate count of the records in standard or custom objects in your org. These record counts are the same as the counts listed in the Storage Usage page in Setup. The record counts are approximate because they're calculated asynchronously and your org's storage usage isn't updated immediately. To display all available record counts, run the command without the '--sobjecttype' parameter.",
3
+ "examples": [
4
+ "$ sfdx force:limits:recordcounts:display",
5
+ "$ sfdx force:limits:recordcounts:display -s Account,Contact,Lead,Opportunity",
6
+ "$ sfdx force:limits:recordcounts:display -s Account,Contact -u me@my.org"
7
+ ],
8
+ "sobjecttypeFlagDescription": "comma-separated list of API names of standard or custom objects for which to display record counts"
9
+ }
@@ -1 +1 @@
1
- {"version":"2.1.0","commands":{"limits:api:display":{"id":"limits:api:display","description":"display current org’s limits\nWhen you execute this command in a project, it provides limit information for your default scratch org.\",","pluginName":"@salesforce/plugin-limits","pluginType":"core","aliases":["force:limits:api:display","org:list:api-limits"],"examples":["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --target-org me@my.org"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","allowNo":false},"target-org":{"name":"target-org","type":"option","char":"o","default":{}}},"args":[]},"limits:recordcounts:display":{"id":"limits:recordcounts:display","description":"display record counts for the specified standard and custom objects\\nUse this command to get an approximate count of the records in standard or custom objects in your org. These record counts are the same as the counts listed in the Storage Usage page in Setup. The record counts are approximate because they're calculated asynchronously and your org's storage usage isn't updated immediately. To display all available record counts, run the command without the '--sobjecttype' parameter.\",","pluginName":"@salesforce/plugin-limits","pluginType":"core","aliases":["force:limits:recordcounts:display","org:list:sobject:record-counts"],"examples":["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --sobject Account --sobject Contact,Lead,Opportunity","<%= config.bin %> <%= command.id %> --sobject Account,Contact --target-org me@my.org"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","allowNo":false},"sobject":{"name":"sobject","type":"option","char":"s","default":[]},"target-org":{"name":"target-org","type":"option","char":"o","default":{}}},"args":[]}}}
1
+ {"version":"2.1.2","commands":{"force:limits:api:display":{"id":"force:limits:api:display","description":"display current org’s limits\nWhen you execute this command in a project, it provides limit information for your default scratch org.","strict":true,"usage":"<%= command.id %> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-limits","pluginAlias":"@salesforce/plugin-limits","pluginType":"core","aliases":[],"examples":["$ sfdx force:limits:api:display","$ sfdx force:limits:api:display -u me@my.org"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org","multiple":false},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command","multiple":false}},"args":[],"requiresUsername":true},"force:limits:recordcounts:display":{"id":"force:limits:recordcounts:display","description":"display record counts for the specified standard and custom objects\nUse this command to get an approximate count of the records in standard or custom objects in your org. These record counts are the same as the counts listed in the Storage Usage page in Setup. The record counts are approximate because they're calculated asynchronously and your org's storage usage isn't updated immediately. To display all available record counts, run the command without the '--sobjecttype' parameter.","strict":true,"usage":"<%= command.id %> [-s <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-limits","pluginAlias":"@salesforce/plugin-limits","pluginType":"core","aliases":[],"examples":["$ sfdx force:limits:recordcounts:display","$ sfdx force:limits:recordcounts:display -s Account,Contact,Lead,Opportunity","$ sfdx force:limits:recordcounts:display -s Account,Contact -u me@my.org"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org","multiple":false},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command","multiple":false},"sobjecttype":{"name":"sobjecttype","type":"option","char":"s","description":"comma-separated list of API names of standard or custom objects for which to display record counts","multiple":false}},"args":[],"requiresUsername":true,"result":{"tableColumnData":{"name":{"header":"sObject"},"count":{"header":"Record Count"}}},"flagsConfig":{"sobjecttype":{"kind":"array","char":"s","description":"comma-separated list of API names of standard or custom objects for which to display record counts","input":[],"multiple":false,"type":"option"}}}}}
package/package.json CHANGED
@@ -1,48 +1,46 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-limits",
3
3
  "description": "commands to display api limits to your org",
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "main": "lib/index.js",
8
8
  "dependencies": {
9
- "@salesforce/core": "^3.31.18",
10
- "@salesforce/kit": "^1.8.0",
11
- "@salesforce/sf-plugins-core": "^1.17.4",
12
- "@salesforce/ts-types": "^1.7.1",
9
+ "@oclif/core": "^1.20.4",
10
+ "@salesforce/command": "^5.2.22",
11
+ "@salesforce/core": "^3.32.2",
13
12
  "tslib": "^2"
14
13
  },
15
14
  "devDependencies": {
16
- "@oclif/plugin-command-snapshot": "^3",
17
- "@oclif/test": "^2.2.10",
18
- "@salesforce/cli-plugins-testkit": "^3.2.6",
19
- "@salesforce/dev-config": "^3.1.0",
15
+ "@oclif/plugin-command-snapshot": "^3.2.11",
16
+ "@salesforce/cli-plugins-testkit": "^3.2.9",
17
+ "@salesforce/dev-config": "^3.0.0",
20
18
  "@salesforce/dev-scripts": "^3.1.0",
21
- "@salesforce/plugin-command-reference": "^2.2.8",
19
+ "@salesforce/plugin-command-reference": "^1.5.2",
22
20
  "@salesforce/prettier-config": "^0.0.2",
23
- "@salesforce/ts-sinon": "^1.4.2",
24
- "@typescript-eslint/eslint-plugin": "^5.42.1",
25
- "@typescript-eslint/parser": "^5.42.1",
21
+ "@salesforce/ts-sinon": "1.4.0",
22
+ "@swc/core": "^1.3.16",
23
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
24
+ "@typescript-eslint/parser": "^5.42.0",
26
25
  "chai": "^4.3.7",
27
- "eslint": "^8.27.0",
26
+ "eslint": "^8.28.0",
28
27
  "eslint-config-prettier": "^8.5.0",
29
28
  "eslint-config-salesforce": "^1.1.0",
30
29
  "eslint-config-salesforce-license": "^0.1.6",
31
30
  "eslint-config-salesforce-typescript": "^1.1.1",
32
- "eslint-plugin-header": "^3.1.1",
31
+ "eslint-plugin-header": "^3.0.0",
33
32
  "eslint-plugin-import": "2.26.0",
34
- "eslint-plugin-jsdoc": "^39.3.14",
35
- "eslint-plugin-sf-plugin": "^1.1.5",
33
+ "eslint-plugin-jsdoc": "^39.6.2",
36
34
  "husky": "^7.0.4",
37
35
  "mocha": "^9.1.3",
38
36
  "nyc": "^15.1.0",
37
+ "oclif": "^3.2.28",
39
38
  "prettier": "^2.7.1",
40
39
  "pretty-quick": "^3.1.0",
41
40
  "shx": "0.3.4",
42
41
  "sinon": "10.0.0",
43
- "swc": "^1.0.11",
44
- "ts-node": "^10.4.0",
45
- "typescript": "^4.8.4"
42
+ "ts-node": "^10.0.0",
43
+ "typescript": "^4.9.3"
46
44
  },
47
45
  "config": {},
48
46
  "engines": {
@@ -51,8 +49,7 @@
51
49
  "files": [
52
50
  "/lib",
53
51
  "/messages",
54
- "/oclif.manifest.json",
55
- "/schemas"
52
+ "/oclif.manifest.json"
56
53
  ],
57
54
  "homepage": "https://github.com/salesforcecli/plugin-limits",
58
55
  "keywords": [
@@ -75,14 +72,16 @@
75
72
  "@salesforce/plugin-command-reference"
76
73
  ],
77
74
  "topics": {
78
- "limits": {
79
- "description": "display current org’s limits",
75
+ "force": {
76
+ "external": true,
80
77
  "subtopics": {
81
- "api": {
82
- "description": "display current org’s api limits"
83
- },
84
- "recordcounts": {
85
- "description": "display record counts for the current"
78
+ "limits": {
79
+ "description": "display current org’s limits",
80
+ "subtopics": {
81
+ "api": {
82
+ "description": "display current org’s api limits"
83
+ }
84
+ }
86
85
  }
87
86
  }
88
87
  }
@@ -99,14 +98,13 @@
99
98
  "format": "sf-format",
100
99
  "lint": "sf-lint",
101
100
  "postpack": "shx rm -f oclif.manifest.json",
102
- "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference && yarn test:json-schema",
101
+ "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference",
103
102
  "prepack": "sf-prepack",
104
103
  "prepare": "sf-install",
105
104
  "pretest": "sf-compile-test",
106
105
  "test": "sf-test",
107
106
  "test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
108
107
  "test:deprecation-policy": "./bin/dev snapshot:compare",
109
- "test:json-schema": "./bin/dev schema:compare",
110
108
  "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
111
109
  "version": "oclif-dev readme"
112
110
  },
@@ -114,7 +112,7 @@
114
112
  "access": "public"
115
113
  },
116
114
  "sfdx": {
117
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.0.crt",
118
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.0.sig"
115
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.2.crt",
116
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.2.sig"
119
117
  }
120
118
  }
@@ -1,18 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- declare type ApiLimit = {
3
- name: string;
4
- max: number;
5
- remaining: number;
6
- };
7
- export declare type ApiLimits = ApiLimit[];
8
- export declare class LimitsApiDisplayCommand extends SfCommand<ApiLimits> {
9
- static aliases: string[];
10
- static readonly summary: string;
11
- static readonly description: string;
12
- static readonly examples: string[];
13
- static flags: {
14
- 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
15
- };
16
- run(): Promise<ApiLimits>;
17
- }
18
- export {};
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimitsApiDisplayCommand = 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("os");
11
- const core_1 = require("@salesforce/core");
12
- const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
13
- core_1.Messages.importMessagesDirectory(__dirname);
14
- const messages = core_1.Messages.loadMessages('@salesforce/plugin-limits', 'display');
15
- class LimitsApiDisplayCommand extends sf_plugins_core_1.SfCommand {
16
- async run() {
17
- try {
18
- const { flags } = await this.parse(LimitsApiDisplayCommand);
19
- const conn = flags['target-org'].getConnection();
20
- const getUrl = `${conn.instanceUrl}/services/data/v${conn.version}/limits`;
21
- const result = await conn.request(getUrl);
22
- const limits = Object.entries(result).map(([name, { Max, Remaining }]) => ({
23
- name,
24
- max: Max,
25
- remaining: Remaining,
26
- }));
27
- this.table(limits, { name: { header: 'Name' }, remaining: { header: 'Remaining' }, max: { header: 'Max' } });
28
- return limits;
29
- }
30
- catch (err) {
31
- if (err instanceof Error || typeof err === 'string') {
32
- throw core_1.SfError.wrap(err);
33
- }
34
- throw err;
35
- }
36
- }
37
- }
38
- exports.LimitsApiDisplayCommand = LimitsApiDisplayCommand;
39
- LimitsApiDisplayCommand.aliases = ['force:limits:api:display', 'org:list:api-limits'];
40
- LimitsApiDisplayCommand.summary = messages.getMessage('description');
41
- LimitsApiDisplayCommand.description = messages.getMessage('description');
42
- LimitsApiDisplayCommand.examples = messages.getMessage('examples').split(os.EOL);
43
- LimitsApiDisplayCommand.flags = {
44
- 'target-org': sf_plugins_core_1.Flags.requiredOrg({
45
- char: 'o',
46
- aliases: ['targetusername', 'u'],
47
- summary: messages.getMessage('targetOrg'),
48
- }),
49
- };
50
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../src/commands/limits/api/display.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,2CAAqD;AACrD,iEAA+D;AAE/D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC;AAiB/E,MAAa,uBAAwB,SAAQ,2BAAoB;IAaxD,KAAK,CAAC,GAAG;QACd,IAAI;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,EAAE,CAAC;YACjD,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,mBAAmB,IAAI,CAAC,OAAO,SAAS,CAAC;YAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAS,MAAM,CAAC,CAAC;YAClD,MAAM,MAAM,GAAc,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;gBACpF,IAAI;gBACJ,GAAG,EAAE,GAAG;gBACR,SAAS,EAAE,SAAS;aACrB,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAE7G,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,KAAK,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBACnD,MAAM,cAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;YACD,MAAM,GAAG,CAAC;SACX;IACH,CAAC;;AAlCH,0DAmCC;AAlCe,+BAAO,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;AACrD,+BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC7C,mCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,gCAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AAClE,6BAAK,GAAG;IACpB,YAAY,EAAE,uBAAK,CAAC,WAAW,CAAC;QAC9B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,CAAC,gBAAgB,EAAE,GAAG,CAAC;QAChC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC1C,CAAC;CACH,CAAC"}
@@ -1,17 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- export declare type RecordCount = {
3
- name: string;
4
- count: number;
5
- };
6
- export declare type RecordCounts = RecordCount[];
7
- export declare class LimitsRecordCountsDisplayCommand extends SfCommand<RecordCounts> {
8
- static readonly aliases: string[];
9
- static readonly summary: string;
10
- static readonly description: string;
11
- static readonly examples: string[];
12
- static flags: {
13
- sobject: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
14
- 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
15
- };
16
- run(): Promise<RecordCounts>;
17
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimitsRecordCountsDisplayCommand = 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("os");
11
- const core_1 = require("@salesforce/core");
12
- const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
13
- core_1.Messages.importMessagesDirectory(__dirname);
14
- const messages = core_1.Messages.loadMessages('@salesforce/plugin-limits', 'recordcounts');
15
- class LimitsRecordCountsDisplayCommand extends sf_plugins_core_1.SfCommand {
16
- async run() {
17
- try {
18
- const { flags } = await this.parse(LimitsRecordCountsDisplayCommand);
19
- const conn = flags['target-org'].getConnection();
20
- const sobjectsPassed = flags.sobject.map((sobject) => sobject.split(',')).flat();
21
- const sobjectsQuery = sobjectsPassed.length > 0 ? `=${sobjectsPassed.join()}` : '';
22
- const geturl = `${conn.baseUrl()}/limits/recordCount?sObjects${sobjectsQuery}`;
23
- const result = await conn.request(geturl);
24
- const recordCounts = result.sObjects
25
- .filter((record) => (sobjectsPassed.length > 0 ? sobjectsPassed.includes(record.name) : result.sObjects))
26
- .sort((a, b) => a.name.localeCompare(b.name));
27
- this.table(recordCounts, {
28
- name: { header: 'sObject' },
29
- count: { header: 'Record Count' },
30
- });
31
- return recordCounts;
32
- }
33
- catch (err) {
34
- if (err instanceof Error || typeof err === 'string') {
35
- throw core_1.SfError.wrap(err);
36
- }
37
- throw err;
38
- }
39
- }
40
- }
41
- exports.LimitsRecordCountsDisplayCommand = LimitsRecordCountsDisplayCommand;
42
- LimitsRecordCountsDisplayCommand.aliases = ['force:limits:recordcounts:display', 'org:list:sobject:record-counts'];
43
- LimitsRecordCountsDisplayCommand.summary = messages.getMessage('description');
44
- LimitsRecordCountsDisplayCommand.description = messages.getMessage('description');
45
- LimitsRecordCountsDisplayCommand.examples = messages.getMessage('examples').split(os.EOL);
46
- LimitsRecordCountsDisplayCommand.flags = {
47
- sobject: sf_plugins_core_1.Flags.string({
48
- char: 's',
49
- summary: messages.getMessage('sobjectFlagDescription'),
50
- aliases: ['sobjecttype'],
51
- multiple: true,
52
- default: [],
53
- }),
54
- 'target-org': sf_plugins_core_1.Flags.requiredOrg({
55
- char: 'o',
56
- aliases: ['targetusername', 'u'],
57
- summary: messages.getMessage('targetOrg'),
58
- }),
59
- };
60
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../src/commands/limits/recordcounts/display.ts"],"names":[],"mappings":"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"}
@@ -1,13 +0,0 @@
1
- # description
2
-
3
- display current org’s limits
4
- When you execute this command in a project, it provides limit information for your default scratch org.",
5
-
6
- # examples
7
-
8
- - <%= config.bin %> <%= command.id %>
9
- - <%= config.bin %> <%= command.id %> --target-org me@my.org
10
-
11
- # targetOrg
12
-
13
- Login username or alias for the target org.
@@ -1,17 +0,0 @@
1
- # description
2
-
3
- display record counts for the specified standard and custom objects\nUse this command to get an approximate count of the records in standard or custom objects in your org. These record counts are the same as the counts listed in the Storage Usage page in Setup. The record counts are approximate because they're calculated asynchronously and your org's storage usage isn't updated immediately. To display all available record counts, run the command without the '--sobjecttype' parameter.",
4
-
5
- # examples
6
-
7
- - <%= config.bin %> <%= command.id %>
8
- - <%= config.bin %> <%= command.id %> --sobject Account --sobject Contact,Lead,Opportunity
9
- - <%= config.bin %> <%= command.id %> --sobject Account,Contact --target-org me@my.org
10
-
11
- # sobjectFlagDescription
12
-
13
- comma-separated list of API names of standard or custom objects for which to display record counts
14
-
15
- # targetOrg
16
-
17
- Login username or alias for the target org.
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/ApiLimits",
4
- "definitions": {
5
- "ApiLimits": {
6
- "type": "array",
7
- "items": {
8
- "type": "object",
9
- "properties": {
10
- "name": {
11
- "type": "string"
12
- },
13
- "max": {
14
- "type": "number"
15
- },
16
- "remaining": {
17
- "type": "number"
18
- }
19
- },
20
- "required": ["name", "max", "remaining"],
21
- "additionalProperties": false
22
- }
23
- }
24
- }
25
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/RecordCounts",
4
- "definitions": {
5
- "RecordCounts": {
6
- "type": "array",
7
- "items": {
8
- "$ref": "#/definitions/RecordCount"
9
- }
10
- },
11
- "RecordCount": {
12
- "type": "object",
13
- "properties": {
14
- "name": {
15
- "type": "string"
16
- },
17
- "count": {
18
- "type": "number"
19
- }
20
- },
21
- "required": ["name", "count"],
22
- "additionalProperties": false
23
- }
24
- }
25
- }