@salesforce/plugin-limits 2.0.12 → 2.1.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # plugin-limits
2
2
 
3
- [![NPM](https://img.shields.io/npm/v/@salesforce/plugin-limits.svg?label=@salesforce/plugin-limits)](https://www.npmjs.com/package/@salesforce/plugin-limits) [![CircleCI](https://circleci.com/gh/salesforcecli/plugin-limits/tree/main.svg?style=shield)](https://circleci.com/gh/salesforcecli/plugin-limits/tree/main) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-limits.svg)](https://npmjs.org/package/@salesforce/plugin-limits) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/plugin-limits/main/LICENSE.txt)
3
+ [![NPM](https://img.shields.io/npm/v/@salesforce/plugin-limits.svg?label=@salesforce/plugin-limits)](https://www.npmjs.com/package/@salesforce/plugin-limits) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-limits.svg)](https://npmjs.org/package/@salesforce/plugin-limits) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/plugin-limits/main/LICENSE.txt)
4
4
 
5
5
  A command to display the api limits of your org
6
6
 
@@ -0,0 +1,18 @@
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 {};
@@ -0,0 +1,50 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,60 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../src/commands/limits/recordcounts/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,cAAc,CAAC,CAAC;AAapF,MAAa,gCAAiC,SAAQ,2BAAuB;IAqBpE,KAAK,CAAC,GAAG;QACd,IAAI;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACrE,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,EAAE,CAAC;YACjD,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACjF,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,+BAA+B,aAAa,EAAE,CAAC;YAC/E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAS,MA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ACtD,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,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"}
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,17 @@
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 +1 @@
1
- {"version":"2.0.12","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.","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","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)","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"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"}},"args":[]},"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.","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","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)","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"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"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"}},"args":[]}}}
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":[]}}}
package/package.json CHANGED
@@ -1,35 +1,38 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-limits",
3
3
  "description": "commands to display api limits to your org",
4
- "version": "2.0.12",
4
+ "version": "2.1.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "main": "lib/index.js",
8
8
  "dependencies": {
9
- "@oclif/core": "^1.20.0",
10
- "@salesforce/command": "^5.2.22",
11
- "@salesforce/core": "^3.31.16",
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",
12
13
  "tslib": "^2"
13
14
  },
14
15
  "devDependencies": {
15
16
  "@oclif/plugin-command-snapshot": "^3",
17
+ "@oclif/test": "^2.2.10",
16
18
  "@salesforce/cli-plugins-testkit": "^3.2.6",
17
- "@salesforce/dev-config": "^3.0.0",
19
+ "@salesforce/dev-config": "^3.1.0",
18
20
  "@salesforce/dev-scripts": "^3.1.0",
19
- "@salesforce/plugin-command-reference": "^1.4.7",
21
+ "@salesforce/plugin-command-reference": "^2.2.8",
20
22
  "@salesforce/prettier-config": "^0.0.2",
21
- "@salesforce/ts-sinon": "1.4.0",
22
- "@typescript-eslint/eslint-plugin": "^5.41.0",
23
- "@typescript-eslint/parser": "^5.42.0",
24
- "chai": "^4.2.0",
25
- "eslint": "^8.26.0",
23
+ "@salesforce/ts-sinon": "^1.4.2",
24
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
25
+ "@typescript-eslint/parser": "^5.42.1",
26
+ "chai": "^4.3.7",
27
+ "eslint": "^8.27.0",
26
28
  "eslint-config-prettier": "^8.5.0",
27
29
  "eslint-config-salesforce": "^1.1.0",
28
30
  "eslint-config-salesforce-license": "^0.1.6",
29
31
  "eslint-config-salesforce-typescript": "^1.1.1",
30
- "eslint-plugin-header": "^3.0.0",
32
+ "eslint-plugin-header": "^3.1.1",
31
33
  "eslint-plugin-import": "2.26.0",
32
34
  "eslint-plugin-jsdoc": "^39.3.14",
35
+ "eslint-plugin-sf-plugin": "^1.1.5",
33
36
  "husky": "^7.0.4",
34
37
  "mocha": "^9.1.3",
35
38
  "nyc": "^15.1.0",
@@ -37,7 +40,8 @@
37
40
  "pretty-quick": "^3.1.0",
38
41
  "shx": "0.3.4",
39
42
  "sinon": "10.0.0",
40
- "ts-node": "^10.0.0",
43
+ "swc": "^1.0.11",
44
+ "ts-node": "^10.4.0",
41
45
  "typescript": "^4.8.4"
42
46
  },
43
47
  "config": {},
@@ -47,7 +51,8 @@
47
51
  "files": [
48
52
  "/lib",
49
53
  "/messages",
50
- "/oclif.manifest.json"
54
+ "/oclif.manifest.json",
55
+ "/schemas"
51
56
  ],
52
57
  "homepage": "https://github.com/salesforcecli/plugin-limits",
53
58
  "keywords": [
@@ -70,16 +75,14 @@
70
75
  "@salesforce/plugin-command-reference"
71
76
  ],
72
77
  "topics": {
73
- "force": {
74
- "external": true,
78
+ "limits": {
79
+ "description": "display current org’s limits",
75
80
  "subtopics": {
76
- "limits": {
77
- "description": "display current org’s limits",
78
- "subtopics": {
79
- "api": {
80
- "description": "display current org’s api limits"
81
- }
82
- }
81
+ "api": {
82
+ "description": "display current org’s api limits"
83
+ },
84
+ "recordcounts": {
85
+ "description": "display record counts for the current"
83
86
  }
84
87
  }
85
88
  }
@@ -96,13 +99,14 @@
96
99
  "format": "sf-format",
97
100
  "lint": "sf-lint",
98
101
  "postpack": "shx rm -f oclif.manifest.json",
99
- "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference",
102
+ "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference && yarn test:json-schema",
100
103
  "prepack": "sf-prepack",
101
104
  "prepare": "sf-install",
102
105
  "pretest": "sf-compile-test",
103
106
  "test": "sf-test",
104
107
  "test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
105
108
  "test:deprecation-policy": "./bin/dev snapshot:compare",
109
+ "test:json-schema": "./bin/dev schema:compare",
106
110
  "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
107
111
  "version": "oclif-dev readme"
108
112
  },
@@ -110,7 +114,7 @@
110
114
  "access": "public"
111
115
  },
112
116
  "sfdx": {
113
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.0.12.crt",
114
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.0.12.sig"
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
119
  }
116
120
  }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -1,13 +0,0 @@
1
- import { SfdxCommand } from '@salesforce/command';
2
- declare 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 {};
@@ -1,44 +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 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
@@ -1 +0,0 @@
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,G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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
- }
@@ -1,62 +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 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
@@ -1 +0,0 @@
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,CA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/D,CAAC;CACH,CAAC"}
@@ -1,4 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
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
- }