@salesforce/plugin-limits 2.1.7 → 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.
@@ -0,0 +1,20 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ type ApiLimit = {
3
+ name: string;
4
+ max: number;
5
+ remaining: number;
6
+ };
7
+ export 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 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<ApiLimits>;
19
+ }
20
+ export {};
@@ -0,0 +1,46 @@
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 core_1 = require("@salesforce/core");
11
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
12
+ core_1.Messages.importMessagesDirectory(__dirname);
13
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-limits', 'display');
14
+ class LimitsApiDisplayCommand extends sf_plugins_core_1.SfCommand {
15
+ async run() {
16
+ try {
17
+ const { flags } = await this.parse(LimitsApiDisplayCommand);
18
+ const conn = flags['target-org'].getConnection(flags['api-version']);
19
+ const result = await conn.request('/limits');
20
+ const limits = Object.entries(result).map(([name, { Max, Remaining }]) => ({
21
+ name,
22
+ max: Max,
23
+ remaining: Remaining,
24
+ }));
25
+ this.table(limits, { name: { header: 'Name' }, remaining: { header: 'Remaining' }, max: { header: 'Max' } });
26
+ return limits;
27
+ }
28
+ catch (err) {
29
+ if (err instanceof Error || typeof err === 'string') {
30
+ throw core_1.SfError.wrap(err);
31
+ }
32
+ throw err;
33
+ }
34
+ }
35
+ }
36
+ exports.LimitsApiDisplayCommand = LimitsApiDisplayCommand;
37
+ LimitsApiDisplayCommand.aliases = ['force:limits:api:display', 'org:list:limits'];
38
+ LimitsApiDisplayCommand.summary = messages.getMessage('summary');
39
+ LimitsApiDisplayCommand.description = messages.getMessage('description');
40
+ LimitsApiDisplayCommand.examples = messages.getMessages('examples');
41
+ LimitsApiDisplayCommand.flags = {
42
+ 'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
43
+ 'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
44
+ loglevel: sf_plugins_core_1.loglevel,
45
+ };
46
+ //# 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,2CAAqD;AACrD,iEAKqC;AAErC,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;IAWxD,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,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAS,SAAS,CAAC,CAAC;YACrD,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;;AA/BH,0DAgCC;AA/Be,+BAAO,GAAG,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAC;AACjD,+BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,mCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,gCAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,6BAAK,GAAG;IAC7B,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type RecordCount = {
3
+ name: string;
4
+ count: number;
5
+ };
6
+ export 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 readonly flags: {
13
+ sobject: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
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<RecordCounts>;
19
+ }
@@ -0,0 +1,55 @@
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 core_1 = require("@salesforce/core");
11
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
12
+ core_1.Messages.importMessagesDirectory(__dirname);
13
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-limits', 'recordcounts');
14
+ class LimitsRecordCountsDisplayCommand extends sf_plugins_core_1.SfCommand {
15
+ async run() {
16
+ try {
17
+ const { flags } = await this.parse(LimitsRecordCountsDisplayCommand);
18
+ const conn = flags['target-org'].getConnection(flags['api-version']);
19
+ const sobjectsQuery = flags.sobject.length > 0 ? `=${flags.sobject.join()}` : '';
20
+ const geturl = `/limits/recordCount?sObjects${sobjectsQuery}`;
21
+ const result = await conn.request(geturl);
22
+ const recordCounts = result.sObjects
23
+ .filter((record) => (flags.sobject.length > 0 ? flags.sobject.includes(record.name) : result.sObjects))
24
+ .sort((a, b) => a.name.localeCompare(b.name));
25
+ this.table(recordCounts, {
26
+ name: { header: 'sObject' },
27
+ count: { header: 'Record Count' },
28
+ });
29
+ return recordCounts;
30
+ }
31
+ catch (err) {
32
+ if (err instanceof Error || typeof err === 'string') {
33
+ throw core_1.SfError.wrap(err);
34
+ }
35
+ throw err;
36
+ }
37
+ }
38
+ }
39
+ exports.LimitsRecordCountsDisplayCommand = LimitsRecordCountsDisplayCommand;
40
+ LimitsRecordCountsDisplayCommand.aliases = ['force:limits:recordcounts:display', 'org:list:sobject:record-counts'];
41
+ LimitsRecordCountsDisplayCommand.summary = messages.getMessage('summary');
42
+ LimitsRecordCountsDisplayCommand.description = messages.getMessage('description');
43
+ LimitsRecordCountsDisplayCommand.examples = messages.getMessages('examples');
44
+ LimitsRecordCountsDisplayCommand.flags = {
45
+ sobject: (0, sf_plugins_core_1.arrayWithDeprecation)({
46
+ char: 's',
47
+ summary: messages.getMessage('sobjectFlagDescription'),
48
+ aliases: ['sobjecttype'],
49
+ default: [],
50
+ }),
51
+ 'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
52
+ 'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
53
+ loglevel: sf_plugins_core_1.loglevel,
54
+ };
55
+ //# 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,2CAAqD;AACrD,iEAMqC;AAErC,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;IAkBpE,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,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,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AG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C,sCAAK,GAAG;IAC7B,OAAO,EAAE,IAAA,sCAAoB,EAAC;QAC5B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;QACtD,OAAO,EAAE,CAAC,aAAa,CAAC;QACxB,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC"}
@@ -0,0 +1,21 @@
1
+ # summary
2
+
3
+ Display information about limits in your org.
4
+
5
+ # description
6
+
7
+ For each limit, this command returns the maximum allocation and the remaining allocation based on usage. See this topic for a description of each limit: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm.
8
+
9
+ # examples
10
+
11
+ - Display limits in your default org:
12
+
13
+ <%= config.bin %> <%= command.id %>
14
+
15
+ - Display limits in the org with alias "my-scratch-org":
16
+
17
+ <%= config.bin %> <%= command.id %> --target-org my-scratch-org
18
+
19
+ # targetOrg
20
+
21
+ Login username or alias for the target org.
@@ -0,0 +1,29 @@
1
+ # summary
2
+
3
+ Display record counts for the specified standard or custom objects.
4
+
5
+ # description
6
+
7
+ Use 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 the Setup UI. 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 --sobject flag.
8
+
9
+ # examples
10
+
11
+ - Display all available record counts in your default org:
12
+
13
+ <%= config.bin %> <%= command.id %>
14
+
15
+ - Display record counts for the Account, Contact, Lead, and Opportunity objects in your default org:
16
+
17
+ <%= config.bin %> <%= command.id %> --sobject Account --sobject Contact --sobject Lead --sobject Opportunity
18
+
19
+ - Display record counts for the Account and Lead objects for the org with alias "my-scratch-org":
20
+
21
+ <%= config.bin %> <%= command.id %> --sobject Account --sobject Lead --target-org my-scratch-org
22
+
23
+ # sobjectFlagDescription
24
+
25
+ API name of the standard or custom object for which to display record counts.
26
+
27
+ # targetOrg
28
+
29
+ Login username or alias for the target org.
@@ -1 +1 @@
1
- {"version":"2.1.7","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"}}}}}
1
+ {"version":"2.2.0","commands":{"limits:api:display":{"id":"limits:api:display","summary":"Display information about limits in your org.","description":"For each limit, this command returns the maximum allocation and the remaining allocation based on usage. See this topic for a description of each limit: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm.","strict":true,"pluginName":"@salesforce/plugin-limits","pluginAlias":"@salesforce/plugin-limits","pluginType":"core","aliases":["force:limits:api:display","org:list:limits"],"examples":["Display limits in your default org:\n<%= config.bin %> <%= command.id %>","Display limits in the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --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.","required":true,"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.\nSet the log level using the `SFDX_LOG_LEVEL` environment variable."}}},"args":[],"hasDynamicHelp":true},"limits:recordcounts:display":{"id":"limits:recordcounts:display","summary":"Display record counts for the specified standard or custom objects.","description":"Use 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 the Setup UI. 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 --sobject flag.","strict":true,"pluginName":"@salesforce/plugin-limits","pluginAlias":"@salesforce/plugin-limits","pluginType":"core","aliases":["force:limits:recordcounts:display","org:list:sobject:record-counts"],"examples":["Display all available record counts in your default org:\n<%= config.bin %> <%= command.id %>","Display record counts for the Account, Contact, Lead, and Opportunity objects in your default org:\n<%= config.bin %> <%= command.id %> --sobject Account --sobject Contact --sobject Lead --sobject Opportunity","Display record counts for the Account and Lead objects for the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --sobject Account --sobject Lead --target-org my-scratch-org"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"sobject":{"name":"sobject","type":"option","char":"s","summary":"API name of the standard or custom object for which to display record counts.","multiple":true,"default":[],"aliases":["sobjecttype"]},"target-org":{"name":"target-org","type":"option","char":"o","summary":"Username or alias of the target org.","required":true,"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.\nSet the log level using the `SFDX_LOG_LEVEL` environment variable."}}},"args":[],"hasDynamicHelp":true}}}
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-limits",
3
3
  "description": "commands to display api limits to your org",
4
- "version": "2.1.7",
4
+ "version": "2.2.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "main": "lib/index.js",
8
8
  "dependencies": {
9
9
  "@oclif/core": "^1.20.4",
10
- "@salesforce/command": "^5.2.37",
11
10
  "@salesforce/core": "^3.32.11",
11
+ "@salesforce/kit": "^1.8.0",
12
+ "@salesforce/sf-plugins-core": "^1.21.3",
13
+ "@salesforce/ts-types": "^1.7.1",
12
14
  "tslib": "^2"
13
15
  },
14
16
  "devDependencies": {
15
17
  "@oclif/plugin-command-snapshot": "^3.2.16",
18
+ "@oclif/test": "^2.2.17",
16
19
  "@salesforce/cli-plugins-testkit": "^3.2.15",
17
- "@salesforce/dev-config": "^3.0.0",
20
+ "@salesforce/dev-config": "^3.1.0",
18
21
  "@salesforce/dev-scripts": "^3.1.0",
19
- "@salesforce/plugin-command-reference": "^1.5.6",
22
+ "@salesforce/plugin-command-reference": "^2.2.8",
20
23
  "@salesforce/prettier-config": "^0.0.2",
21
- "@salesforce/ts-sinon": "1.4.2",
24
+ "@salesforce/ts-sinon": "^1.4.2",
22
25
  "@swc/core": "^1.3.22",
23
- "@typescript-eslint/eslint-plugin": "^5.45.0",
26
+ "@typescript-eslint/eslint-plugin": "^5.47.1",
24
27
  "@typescript-eslint/parser": "^5.47.0",
25
28
  "chai": "^4.3.7",
26
29
  "eslint": "^8.29.0",
@@ -28,9 +31,10 @@
28
31
  "eslint-config-salesforce": "^1.1.0",
29
32
  "eslint-config-salesforce-license": "^0.1.6",
30
33
  "eslint-config-salesforce-typescript": "^1.1.1",
31
- "eslint-plugin-header": "^3.0.0",
34
+ "eslint-plugin-header": "^3.1.1",
32
35
  "eslint-plugin-import": "2.26.0",
33
36
  "eslint-plugin-jsdoc": "^39.6.4",
37
+ "eslint-plugin-sf-plugin": "^1.3.1",
34
38
  "husky": "^7.0.4",
35
39
  "mocha": "^9.1.3",
36
40
  "nyc": "^15.1.0",
@@ -39,7 +43,8 @@
39
43
  "pretty-quick": "^3.1.0",
40
44
  "shx": "0.3.4",
41
45
  "sinon": "10.0.0",
42
- "ts-node": "^10.0.0",
46
+ "swc": "^1.0.11",
47
+ "ts-node": "^10.4.0",
43
48
  "typescript": "^4.9.4"
44
49
  },
45
50
  "config": {},
@@ -49,7 +54,8 @@
49
54
  "files": [
50
55
  "/lib",
51
56
  "/messages",
52
- "/oclif.manifest.json"
57
+ "/oclif.manifest.json",
58
+ "/schemas"
53
59
  ],
54
60
  "homepage": "https://github.com/salesforcecli/plugin-limits",
55
61
  "keywords": [
@@ -72,16 +78,14 @@
72
78
  "@salesforce/plugin-command-reference"
73
79
  ],
74
80
  "topics": {
75
- "force": {
76
- "external": true,
81
+ "limits": {
82
+ "description": "display current org’s limits",
77
83
  "subtopics": {
78
- "limits": {
79
- "description": "display current org’s limits",
80
- "subtopics": {
81
- "api": {
82
- "description": "display current org’s api limits"
83
- }
84
- }
84
+ "api": {
85
+ "description": "display current org’s api limits"
86
+ },
87
+ "recordcounts": {
88
+ "description": "display record counts for the current"
85
89
  }
86
90
  }
87
91
  }
@@ -98,13 +102,14 @@
98
102
  "format": "sf-format",
99
103
  "lint": "sf-lint",
100
104
  "postpack": "shx rm -f oclif.manifest.json",
101
- "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference",
105
+ "posttest": "yarn lint && yarn test:deprecation-policy && yarn test:command-reference && yarn test:json-schema",
102
106
  "prepack": "sf-prepack",
103
107
  "prepare": "sf-install",
104
108
  "pretest": "sf-compile-test",
105
109
  "test": "sf-test",
106
110
  "test:command-reference": "./bin/dev commandreference:generate --erroronwarnings",
107
111
  "test:deprecation-policy": "./bin/dev snapshot:compare",
112
+ "test:json-schema": "./bin/dev schema:compare",
108
113
  "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
109
114
  "version": "oclif-dev readme"
110
115
  },
@@ -112,7 +117,7 @@
112
117
  "access": "public"
113
118
  },
114
119
  "sfdx": {
115
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.7.crt",
116
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.1.7.sig"
120
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.2.0.crt",
121
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-limits/2.2.0.sig"
117
122
  }
118
123
  }
@@ -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
- 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,CAA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;AACjD,gCAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACzD,wCAAgB,GAAG,IAAI,CAAC"}
@@ -1,13 +0,0 @@
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
- }
@@ -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,GAA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,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"}
@@ -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
- }