@jayree/sfdx-plugin-org 1.0.4 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.1.1](https://github.com/jayree/sfdx-plugin-org/compare/v1.1.0...v1.1.1) (2023-05-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** bump @salesforce/sf-plugins-core from 2.4.3 to 3.0.1 ([#34](https://github.com/jayree/sfdx-plugin-org/issues/34)) ([40b03fa](https://github.com/jayree/sfdx-plugin-org/commit/40b03fa09b372513681291c9296819244fbc7b9d))
7
+ * **deps:** bump @salesforce/source-deploy-retrieve from 8.5.1 to 8.5.3 ([#41](https://github.com/jayree/sfdx-plugin-org/issues/41)) ([95ab659](https://github.com/jayree/sfdx-plugin-org/commit/95ab659677688169e1094fddfc9c09090a4f71cf))
8
+ * **deps:** bump playwright-chromium from 1.33.0 to 1.34.1 ([#37](https://github.com/jayree/sfdx-plugin-org/issues/37)) ([0d65e31](https://github.com/jayree/sfdx-plugin-org/commit/0d65e319c7520875a647c85712f96a8201dd5f6b))
9
+
10
+ # [1.1.0](https://github.com/jayree/sfdx-plugin-org/compare/v1.0.4...v1.1.0) (2023-05-22)
11
+
12
+
13
+ ### Features
14
+
15
+ * add org and flow commands ([3d507fe](https://github.com/jayree/sfdx-plugin-org/commit/3d507fe84303c6591c6a78d58a8ea22df0a28a2b))
16
+
1
17
  ## [1.0.4](https://github.com/jayree/sfdx-plugin-org/compare/v1.0.3...v1.0.4) (2023-05-19)
2
18
 
3
19
 
package/README.md CHANGED
@@ -17,13 +17,43 @@ sfdx plugins:install @jayree/sfdx-plugin-org
17
17
  ## Commands
18
18
 
19
19
  <!-- commands -->
20
+ * [`sfdx jayree:flow:get:coverage`](#sfdx-jayreeflowgetcoverage)
20
21
  * [`sfdx jayree:org:configure`](#sfdx-jayreeorgconfigure)
21
22
  * [`sfdx jayree:org:configure:country`](#sfdx-jayreeorgconfigurecountry)
22
23
  * [`sfdx jayree:org:configure:state`](#sfdx-jayreeorgconfigurestate)
24
+ * [`sfdx jayree:org:get:settings`](#sfdx-jayreeorggetsettings)
25
+ * [`sfdx jayree:org:stream`](#sfdx-jayreeorgstream)
26
+
27
+ ### `sfdx jayree:flow:get:coverage`
28
+
29
+ Check the flow test coverage of an Org.
30
+
31
+ ```
32
+ USAGE
33
+ $ sfdx jayree:flow:get:coverage -o <value> [--json] [--api-version <value>]
34
+
35
+ FLAGS
36
+ -o, --target-org=<value> (required) Username or alias of the target org.
37
+ --api-version=<value> Override the api version used for api requests made by this command
38
+
39
+ GLOBAL FLAGS
40
+ --json Format output as json.
41
+
42
+ ALIASES
43
+ $ sfdx jayree:flowtestcoverage
44
+
45
+ EXAMPLES
46
+ $ sfdx jayree:flowtestcoverage
47
+ === Flow Test Coverage
48
+ Coverage: 82%
49
+ ...
50
+ ```
51
+
52
+ _See code: [src/commands/jayree/flow/get/coverage.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/flow/get/coverage.ts)_
23
53
 
24
54
  ### `sfdx jayree:org:configure`
25
55
 
26
- make configuration changes that are not covered by the metadata API
56
+ Make configuration changes that are not covered by the metadata API.
27
57
 
28
58
  ```
29
59
  USAGE
@@ -31,18 +61,18 @@ USAGE
31
61
 
32
62
  FLAGS
33
63
  -o, --target-org=<value> (required) Username or alias of the target org.
34
- -t, --tasks=<value>... list of task titles, if no tasks are specified, all tasks marked as active will be executed
64
+ -t, --tasks=<value>... List of task titles, if no tasks are specified, all tasks marked as active will be executed.
35
65
  --api-version=<value> Override the api version used for api requests made by this command
36
- --concurrent execute tasks in parallel
66
+ --concurrent Execute tasks in parallel.
37
67
 
38
68
  GLOBAL FLAGS
39
69
  --json Format output as json.
40
70
 
41
71
  DESCRIPTION
42
- make configuration changes that are not covered by the metadata API
72
+ Make configuration changes that are not covered by the metadata API.
43
73
  See example configuration on how to define tasks
44
74
 
45
- make configuration changes that are not covered by the metadata API
75
+ Make configuration changes that are not covered by the metadata API.
46
76
  See example configuration on how to define tasks
47
77
 
48
78
  EXAMPLES
@@ -52,7 +82,7 @@ EXAMPLES
52
82
  $ sfdx jayree:org:configure --concurrent --tasks="Asset Settings","Activity Settings"
53
83
  ```
54
84
 
55
- _See code: [src/commands/jayree/org/configure/index.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.0.4/src/commands/jayree/org/configure/index.ts)_
85
+ _See code: [src/commands/jayree/org/configure/index.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/org/configure/index.ts)_
56
86
 
57
87
  ### `sfdx jayree:org:configure:country`
58
88
 
@@ -75,7 +105,7 @@ DESCRIPTION
75
105
  update country integration values in the State/Country Picklists
76
106
  ```
77
107
 
78
- _See code: [src/commands/jayree/org/configure/country.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.0.4/src/commands/jayree/org/configure/country.ts)_
108
+ _See code: [src/commands/jayree/org/configure/country.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/org/configure/country.ts)_
79
109
 
80
110
  ### `sfdx jayree:org:configure:state`
81
111
 
@@ -89,10 +119,10 @@ USAGE
89
119
  FLAGS
90
120
  -o, --target-org=<value> (required) Username or alias of the target org.
91
121
  --api-version=<value> Override the api version used for api requests made by this command
92
- --category=<value> Subdivision category
93
- --concurrent=<value> [default: 1] execute tasks in parallel
94
- --country-code=<value> Alpha-2 code
95
- --language=<value> Language code
122
+ --category=<value> Subdivision category.
123
+ --concurrent=<value> [default: 1] execute tasks in parallel.
124
+ --country-code=<value> Alpha-2 code.
125
+ --language=<value> Language code.
96
126
 
97
127
  GLOBAL FLAGS
98
128
  --json Format output as json.
@@ -103,5 +133,63 @@ DESCRIPTION
103
133
  import (create/update) states into the State/Country Picklists
104
134
  ```
105
135
 
106
- _See code: [src/commands/jayree/org/configure/state.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.0.4/src/commands/jayree/org/configure/state.ts)_
136
+ _See code: [src/commands/jayree/org/configure/state.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/org/configure/state.ts)_
137
+
138
+ ### `sfdx jayree:org:get:settings`
139
+
140
+ Write the current settings from an Org to a scratch org def file.
141
+
142
+ ```
143
+ USAGE
144
+ $ sfdx jayree:org:get:settings -o <value> [--json] [--api-version <value>] [-w] [-f <value>]
145
+
146
+ FLAGS
147
+ -f, --file=<value> Write to 'file' instead of project-scratch-def.json.
148
+ -o, --target-org=<value> (required) Username or alias of the target org.
149
+ -w, --writetoprojectscratchdeffile Write output to project-scratch-def.json file.
150
+ --api-version=<value> Override the api version used for api requests made by this command
151
+
152
+ GLOBAL FLAGS
153
+ --json Format output as json.
154
+
155
+ ALIASES
156
+ $ sfdx jayree:org:settings
157
+
158
+ EXAMPLES
159
+ $ sfdx jayree:org:settings
160
+ $ sfdx jayree:org:settings -u me@my.org
161
+ $ sfdx jayree:org:settings -u MyTestOrg1 -w
162
+ ```
163
+
164
+ _See code: [src/commands/jayree/org/get/settings.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/org/get/settings.ts)_
165
+
166
+ ### `sfdx jayree:org:stream`
167
+
168
+ Listen to streaming api and platform events.
169
+
170
+ ```
171
+ USAGE
172
+ $ sfdx jayree:org:stream -o <value> -c <value> [--json] [--api-version <value>] [-r <value>]
173
+
174
+ FLAGS
175
+ -c, --channel=<value> (required) The event name.
176
+ -o, --target-org=<value> (required) Username or alias of the target org.
177
+ -r, --replay-id=<value> Receive all stored events after the event specified by the replayId value and new events.
178
+ [default: -1] Receive new events that are broadcast after the command subscribes. [-2]
179
+ Receive all event, including past events that are within the retention window and new
180
+ events.
181
+ --api-version=<value> Override the api version used for api requests made by this command
182
+
183
+ GLOBAL FLAGS
184
+ --json Format output as json.
185
+
186
+ ALIASES
187
+ $ sfdx jayree:org:streaming
188
+
189
+ EXAMPLES
190
+ $ sfdx jayree org stream --channel=/event/eventName__e
191
+ ...
192
+ ```
193
+
194
+ _See code: [src/commands/jayree/org/stream.ts](https://github.com/jayree/sfdx-plugin-org/blob/v1.1.1/src/commands/jayree/org/stream.ts)_
107
195
  <!-- commandsstop -->
@@ -0,0 +1,13 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class FlowTestCoverage extends SfCommand<AnyJson> {
4
+ static readonly summary: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ 'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ static readonly deprecateAliases = true;
11
+ static readonly aliases: string[];
12
+ run(): Promise<AnyJson>;
13
+ }
@@ -0,0 +1,82 @@
1
+ /*
2
+ * Copyright (c) 2021, jayree
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { dirname } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, } from '@salesforce/sf-plugins-core';
10
+ import { Messages } from '@salesforce/core';
11
+ // eslint-disable-next-line no-underscore-dangle
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ // eslint-disable-next-line no-underscore-dangle
14
+ const __dirname = dirname(__filename);
15
+ Messages.importMessagesDirectory(__dirname);
16
+ const messages = Messages.loadMessages('@jayree/sfdx-plugin-org', 'flowtestcoverage');
17
+ class FlowTestCoverage extends SfCommand {
18
+ async run() {
19
+ const { flags } = await this.parse(FlowTestCoverage);
20
+ const org = flags['target-org'];
21
+ const conn = org.getConnection(flags['api-version']);
22
+ const query1 = await conn.tooling.query("SELECT count_distinct(DefinitionId) FROM Flow WHERE Status = 'Active' AND(ProcessType = 'AutolaunchedFlow' OR ProcessType = 'Workflow' OR ProcessType = 'CustomEvent' OR ProcessType = 'InvocableProcess')");
23
+ const numberOfActiveAutolaunchedFlowsAndProcesses = query1.records[0]['expr0'];
24
+ const query2 = await conn.tooling.query('SELECT count_distinct(FlowVersionId) FROM FlowTestCoverage');
25
+ const numberOfCoveredActiveAutolaunchedFlowsAndProcesses = query2.records[0]['expr0'];
26
+ const query3 = await conn.tooling.query("SELECT Definition.DeveloperName FROM Flow WHERE Status = 'Active' AND(ProcessType = 'AutolaunchedFlow' OR ProcessType = 'Workflow' OR ProcessType = 'CustomEvent' OR ProcessType = 'InvocableProcess') AND Id NOT IN(SELECT FlowVersionId FROM FlowTestCoverage)");
27
+ const uncovered = query3.records.map((value) => value.Definition.DeveloperName);
28
+ const query4 = await conn.tooling.query('SELECT FlowVersion.Definition.DeveloperName FROM FlowTestCoverage GROUP BY FlowVersion.Definition.DeveloperName');
29
+ const covered = query4.records.map((value) => value.DeveloperName);
30
+ this.styledHeader('Flow Test Coverage');
31
+ this.styledObject({
32
+ 'number of active autolaunched flows and processes': numberOfActiveAutolaunchedFlowsAndProcesses,
33
+ 'number of covered active autolaunched flows and processes': numberOfCoveredActiveAutolaunchedFlowsAndProcesses,
34
+ Coverage: `${Math.floor((numberOfCoveredActiveAutolaunchedFlowsAndProcesses / numberOfActiveAutolaunchedFlowsAndProcesses) * 100)}%'`,
35
+ });
36
+ const x = [];
37
+ const length = uncovered.length > covered.length ? uncovered.length : covered.length;
38
+ for (let i = 0; i < length; i++) {
39
+ x.push({
40
+ 'all active autolaunched flows and processes that don’t have test coverage': uncovered[i],
41
+ 'all flows and processes that have test coverage': covered[i],
42
+ });
43
+ }
44
+ this.table(x, {
45
+ TESTCOVERAGE: {
46
+ header: 'all flows and processes that have test coverage',
47
+ get: (row) => row['all flows and processes that have test coverage'],
48
+ },
49
+ NOTESTCOVERAGE: {
50
+ header: 'all active autolaunched flows and processes that don’t have test coverage',
51
+ get: (row) => row['all active autolaunched flows and processes that don’t have test coverage'],
52
+ },
53
+ });
54
+ if (covered.length !== numberOfCoveredActiveAutolaunchedFlowsAndProcesses) {
55
+ this.warn('Error in the FlowTestCoverage table found, please delete all records in the FlowTestCoverage table, then run all tests, and use this command to check the Flow Test Coverage again');
56
+ }
57
+ return {
58
+ orgId: org.getOrgId(),
59
+ Coverage: `${Math.floor((numberOfCoveredActiveAutolaunchedFlowsAndProcesses / numberOfActiveAutolaunchedFlowsAndProcesses) * 100)}%'`,
60
+ numberOfActiveAutolaunchedFlowsAndProcesses,
61
+ numberOfCoveredActiveAutolaunchedFlowsAndProcesses,
62
+ 'all active autolaunched flows and processes that don’t have test coverage': uncovered,
63
+ 'all flows and processes that have test coverage': covered,
64
+ };
65
+ }
66
+ }
67
+ FlowTestCoverage.summary = messages.getMessage('commandDescription');
68
+ FlowTestCoverage.examples = [
69
+ `$ sfdx jayree:flowtestcoverage
70
+ === Flow Test Coverage
71
+ Coverage: 82%
72
+ ...
73
+ `,
74
+ ];
75
+ FlowTestCoverage.flags = {
76
+ 'target-org': requiredOrgFlagWithDeprecations,
77
+ 'api-version': orgApiVersionFlagWithDeprecations,
78
+ };
79
+ FlowTestCoverage.deprecateAliases = true;
80
+ FlowTestCoverage.aliases = ['jayree:flowtestcoverage'];
81
+ export default FlowTestCoverage;
82
+ //# sourceMappingURL=coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/flow/get/coverage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBA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C;SACH;QAED,OAAO;YACL,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE;YACrB,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CACrB,CAAC,kDAAkD,GAAG,2CAA2C,CAAC,GAAG,GAAG,CACzG,IAAI;YACL,2CAA2C;YAC3C,kDAAkD;YAClD,2EAA2E,EAAE,SAAS;YACtF,iDAAiD,EAAE,OAAO;SAC3D,CAAC;IACJ,CAAC;;AA1FsB,wBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAEpD,yBAAQ,GAAG;IAChC;;;;CAIH;CACE,CAAC;AAEqB,sBAAK,GAAG;IAC7B,YAAY,EAAE,+BAA+B;IAC7C,aAAa,EAAE,iCAAiC;CACjD,CAAC;AAEqB,iCAAgB,GAAG,IAAI,CAAC;AACxB,wBAAO,GAAG,CAAC,yBAAyB,CAAC,CAAC;eAjB1C,gBAAgB"}
@@ -0,0 +1,16 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class ScratchOrgSettings extends SfCommand<AnyJson> {
4
+ static readonly summary: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ 'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ writetoprojectscratchdeffile: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ };
12
+ static readonly requiresProject = true;
13
+ static readonly deprecateAliases = true;
14
+ static readonly aliases: string[];
15
+ run(): Promise<AnyJson>;
16
+ }
@@ -0,0 +1,233 @@
1
+ /*
2
+ * Copyright (c) 2021, jayree
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import os from 'os';
8
+ import { dirname, join } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { Flags, SfCommand, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, } from '@salesforce/sf-plugins-core';
11
+ import { Messages, SfProject } from '@salesforce/core';
12
+ import createDebug from 'debug';
13
+ import fs from 'fs-extra';
14
+ import { ComponentSet, MetadataResolver, NodeFSTreeContainer, RegistryAccess, } from '@salesforce/source-deploy-retrieve';
15
+ // eslint-disable-next-line no-underscore-dangle
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ // eslint-disable-next-line no-underscore-dangle
18
+ const __dirname = dirname(__filename);
19
+ Messages.importMessagesDirectory(__dirname);
20
+ const messages = Messages.loadMessages('@jayree/sfdx-plugin-org', 'scratchorgsettings');
21
+ function camelize(str) {
22
+ return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, (match, index) => {
23
+ if (+match === 0)
24
+ return ''; // or if (/\s+/.test(match)) for white spaces
25
+ return index === 0 ? match.toLowerCase() : match.toUpperCase();
26
+ });
27
+ }
28
+ async function resolve(fpath) {
29
+ const resolver = new MetadataResolver(new RegistryAccess(), new NodeFSTreeContainer());
30
+ const [c] = resolver.getComponentsFromPath(fpath);
31
+ return c.parseXml();
32
+ }
33
+ class ScratchOrgSettings extends SfCommand {
34
+ // eslint-disable-next-line complexity
35
+ async run() {
36
+ const { flags } = await this.parse(ScratchOrgSettings);
37
+ const debug = createDebug('jayree:scratchorg:settings');
38
+ const removeEmpty = (obj) => {
39
+ Object.entries(obj).forEach(([key, val]) => {
40
+ if (val && typeof val === 'object') {
41
+ val = removeEmpty(val);
42
+ }
43
+ if (val === null || val === '' || (typeof val === 'object' && !Object.keys(val).length)) {
44
+ delete obj[key];
45
+ }
46
+ });
47
+ return obj;
48
+ };
49
+ const sortKeys = (obj) => {
50
+ const ordered = {};
51
+ Object.keys(obj)
52
+ .sort()
53
+ .forEach((key) => {
54
+ ordered[key] = obj[key];
55
+ });
56
+ return ordered;
57
+ };
58
+ let settings = {};
59
+ const targetDir = process.env.SFDX_MDAPI_TEMP_DIR ?? os.tmpdir();
60
+ const destRoot = join(targetDir, 'RetrieveSettings');
61
+ process.once('exit', () => {
62
+ fs.removeSync(destRoot);
63
+ });
64
+ const sfdxProject = await SfProject.resolve();
65
+ const sfdxProjectJson = await sfdxProject.retrieveSfProjectJson();
66
+ const sfdxProjectVersion = sfdxProjectJson.getContents().sourceApiVersion;
67
+ const apiVersion = flags['api-version'] ?? sfdxProjectVersion ?? (await flags['target-org'].retrieveMaxApiVersion());
68
+ this.log(`Using ${destRoot} and apiVersion=${apiVersion}`);
69
+ const componentSet = new ComponentSet([{ fullName: '*', type: 'Settings' }]);
70
+ const mdapiRetrieve = await componentSet.retrieve({
71
+ usernameOrConnection: flags['target-org'].getUsername(),
72
+ output: destRoot,
73
+ apiVersion,
74
+ });
75
+ const retrieveResult = await mdapiRetrieve.pollStatus(1000);
76
+ for await (const setting of retrieveResult
77
+ .getFileResponses()
78
+ .filter((component) => component.type === 'Settings')) {
79
+ const settingsXml = await resolve(setting.filePath);
80
+ Object.keys(settingsXml).forEach((key) => {
81
+ Object.entries(settingsXml[key]).forEach(([property, value]) => {
82
+ if (!settings[camelize(key)]) {
83
+ settings[camelize(key)] = {};
84
+ }
85
+ if (property !== '@_xmlns') {
86
+ settings[camelize(key)][property] = value;
87
+ }
88
+ });
89
+ });
90
+ }
91
+ if (typeof settings['addressSettings'] !== 'undefined') {
92
+ delete settings['addressSettings'];
93
+ debug('delete ' + 'addressSettings');
94
+ }
95
+ if (typeof settings['searchSettings'] !== 'undefined') {
96
+ delete settings['searchSettings'];
97
+ debug('delete ' + 'searchSettings');
98
+ }
99
+ if (typeof settings['analyticsSettings'] !== 'undefined') {
100
+ delete settings['analyticsSettings'];
101
+ debug('delete ' + 'analyticsSettings');
102
+ }
103
+ if (typeof settings['activitiesSettings'] !== 'undefined') {
104
+ if (typeof settings['activitiesSettings']['allowUsersToRelateMultipleContactsToTasksAndEvents'] !== 'undefined') {
105
+ delete settings['activitiesSettings']['allowUsersToRelateMultipleContactsToTasksAndEvents'];
106
+ debug('delete ' + 'activitiesSettings:allowUsersToRelateMultipleContactsToTasksAndEvents');
107
+ this.warn("You can't use the Tooling API or Metadata API to enable or disable Shared Activities.To enable this feature, visit the Activity Settings page in Setup.To disable this feature, contact Salesforce.");
108
+ }
109
+ }
110
+ if (typeof settings['territory2Settings'] !== 'undefined') {
111
+ if (typeof settings['territory2Settings']['enableTerritoryManagement2'] !== 'undefined') {
112
+ settings['territory2Settings'] = {
113
+ enableTerritoryManagement2: settings['territory2Settings']['enableTerritoryManagement2'],
114
+ };
115
+ debug('set ' + 'enableTerritoryManagement2');
116
+ }
117
+ }
118
+ if (typeof settings['forecastingSettings'] !== 'undefined') {
119
+ if (typeof settings['forecastingSettings']['forecastingCategoryMappings'] !== 'undefined') {
120
+ delete settings['forecastingSettings']['forecastingCategoryMappings'];
121
+ debug('delete ' + 'forecastingSettings:forecastingCategoryMappings');
122
+ }
123
+ if (typeof settings['forecastingSettings']['forecastingTypeSettings'] !== 'undefined') {
124
+ delete settings['forecastingSettings']['forecastingTypeSettings'];
125
+ debug('delete ' + 'forecastingSettings:forecastingTypeSettings');
126
+ }
127
+ }
128
+ if (typeof settings['caseSettings'] !== 'undefined') {
129
+ if (typeof settings['caseSettings']['caseFeedItemSettings'] !== 'undefined') {
130
+ if (typeof settings['caseSettings']['caseFeedItemSettings'][0] !== 'undefined') {
131
+ if (typeof settings['caseSettings']['caseFeedItemSettings'][0]['feedItemType'] !==
132
+ 'undefined') {
133
+ if (settings['caseSettings']['caseFeedItemSettings'][0]['feedItemType'] ===
134
+ 'EMAIL_MESSAGE_EVENT') {
135
+ settings['caseSettings']['caseFeedItemSettings'][0]['feedItemType'] =
136
+ 'EmailMessageEvent';
137
+ debug('set ' + 'caseSettings:caseFeedItemSettings:feedItemType');
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ settings = removeEmpty(settings);
144
+ settings = sortKeys(settings);
145
+ if (flags.writetoprojectscratchdeffile) {
146
+ const deffilepath =
147
+ // eslint-disable-next-line @typescript-eslint/await-thenable
148
+ flags.file ?? join(await this.project.getPath(), 'config', 'project-scratch-def.json');
149
+ let deffile = {};
150
+ await fs
151
+ .readFile(deffilepath, 'utf8')
152
+ .then((data) => {
153
+ deffile = JSON.parse(data);
154
+ if (deffile['edition'] === 'Enterprise') {
155
+ if (!deffile['features'].includes('LiveAgent')) {
156
+ if (typeof settings['liveAgentSettings'] !== 'undefined') {
157
+ if (typeof settings['liveAgentSettings']['enableLiveAgent'] !== 'undefined') {
158
+ if (settings['liveAgentSettings']['enableLiveAgent'] === 'false') {
159
+ delete settings['liveAgentSettings'];
160
+ debug('delete ' + 'liveAgentSettings');
161
+ this.warn('liveAgentSettings: Not available for deploy for this organization');
162
+ }
163
+ }
164
+ }
165
+ }
166
+ if (typeof settings['knowledgeSettings'] !== 'undefined') {
167
+ if (typeof settings['knowledgeSettings']['enableKnowledge'] !== 'undefined') {
168
+ if (settings['knowledgeSettings']['enableKnowledge'] === 'false') {
169
+ delete settings['knowledgeSettings'];
170
+ debug('delete ' + 'knowledgeSettings');
171
+ this.warn("knowledgeSettings: Once enabled, Salesforce Knowledge can't be disabled.");
172
+ }
173
+ }
174
+ }
175
+ if (typeof settings['caseSettings'] !== 'undefined') {
176
+ if (typeof settings['caseSettings']['emailToCase'] !== 'undefined') {
177
+ if (typeof settings['caseSettings']['emailToCase']['enableEmailToCase'] !== 'undefined') {
178
+ if (settings['caseSettings']['emailToCase']['enableEmailToCase'] === 'false') {
179
+ delete settings['caseSettings']['emailToCase'];
180
+ debug('delete ' + 'caseSettings:emailToCase');
181
+ this.warn('EmailToCaseSettings: Email to case cannot be disabled once it has been enabled.');
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ deffile['settings'] = settings;
188
+ })
189
+ .catch((err) => {
190
+ const error = err;
191
+ if (error.code === 'ENOENT' && !flags.file) {
192
+ throw Error("default file 'project-scratch-def.json' not found, please use --file flag");
193
+ }
194
+ else {
195
+ throw error;
196
+ }
197
+ });
198
+ await fs.writeFile(deffilepath, JSON.stringify(deffile, null, 2));
199
+ }
200
+ else {
201
+ this.styledHeader(`received settings from Org: ${flags['target-org'].getUsername()} (${flags['target-org'].getOrgId()})`);
202
+ this.styledJSON(settings);
203
+ }
204
+ return {
205
+ settings,
206
+ orgId: flags['target-org'].getOrgId(),
207
+ username: flags['target-org'].getUsername(),
208
+ };
209
+ }
210
+ }
211
+ ScratchOrgSettings.summary = messages.getMessage('commandDescription');
212
+ ScratchOrgSettings.examples = [
213
+ `$ sfdx jayree:org:settings
214
+ $ sfdx jayree:org:settings -u me@my.org
215
+ $ sfdx jayree:org:settings -u MyTestOrg1 -w`,
216
+ ];
217
+ ScratchOrgSettings.flags = {
218
+ 'target-org': requiredOrgFlagWithDeprecations,
219
+ 'api-version': orgApiVersionFlagWithDeprecations,
220
+ writetoprojectscratchdeffile: Flags.boolean({
221
+ char: 'w',
222
+ summary: messages.getMessage('writetoprojectscratchdeffile'),
223
+ }),
224
+ file: Flags.string({
225
+ char: 'f',
226
+ summary: messages.getMessage('fileFlagDescription'),
227
+ }),
228
+ };
229
+ ScratchOrgSettings.requiresProject = true;
230
+ ScratchOrgSettings.deprecateAliases = true;
231
+ ScratchOrgSettings.aliases = ['jayree:org:settings'];
232
+ export default ScratchOrgSettings;
233
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/org/get/settings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MA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C;CACH,CAAC;AAEqB,kCAAe,GAAG,IAAI,CAAC;AAEvB,mCAAgB,GAAG,IAAI,CAAC;AACxB,0BAAO,GAAG,CAAC,qBAAqB,CAAC,CAAC;eAzBtC,kBAAkB"}
@@ -0,0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export default class Streaming extends SfCommand<void> {
3
+ static readonly summary: string;
4
+ static readonly examples: string[];
5
+ static readonly flags: {
6
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ 'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ channel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ 'replay-id': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ static readonly deprecateAliases = true;
12
+ static readonly aliases: string[];
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2021, jayree
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { dirname } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { Flags, SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, } from '@salesforce/sf-plugins-core';
10
+ import { Messages } from '@salesforce/core';
11
+ import { StreamingExtension } from 'jsforce/lib/api/streaming.js';
12
+ // eslint-disable-next-line no-underscore-dangle
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ // eslint-disable-next-line no-underscore-dangle
15
+ const __dirname = dirname(__filename);
16
+ Messages.importMessagesDirectory(__dirname);
17
+ const messages = Messages.loadMessages('@jayree/sfdx-plugin-org', 'streaming');
18
+ class Streaming extends SfCommand {
19
+ async run() {
20
+ const { flags } = await this.parse(Streaming);
21
+ const conn = flags['target-org'].getConnection(flags['api-version']);
22
+ const channel = flags.channel;
23
+ const replayId = flags['replay-id'] ?? -1;
24
+ const replayExt = new StreamingExtension.Replay(channel, replayId);
25
+ const fayeClient = conn.streaming.createClient([replayExt]);
26
+ const subscription = fayeClient.subscribe(channel, (data) => {
27
+ this.styledJSON(data);
28
+ });
29
+ subscription.cancel();
30
+ }
31
+ }
32
+ Streaming.summary = messages.getMessage('commandDescription');
33
+ Streaming.examples = [
34
+ `$ sfdx jayree org stream --channel=/event/eventName__e
35
+ ...
36
+ `,
37
+ ];
38
+ Streaming.flags = {
39
+ 'target-org': requiredOrgFlagWithDeprecations,
40
+ 'api-version': orgApiVersionFlagWithDeprecations,
41
+ channel: Flags.string({
42
+ char: 'c',
43
+ required: true,
44
+ summary: messages.getMessage('topicFlagDescription'),
45
+ deprecateAliases: true,
46
+ aliases: ['topic', 'p'],
47
+ }),
48
+ 'replay-id': Flags.integer({
49
+ char: 'r',
50
+ summary: messages.getMessage('replayIdFlagDescription'),
51
+ }),
52
+ };
53
+ Streaming.deprecateAliases = true;
54
+ Streaming.aliases = ['jayree:org:streaming'];
55
+ export default Streaming;
56
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../../src/commands/jayree/org/stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,KAAK,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAoB,MAAM,8BAA8B,CAAC;AAGpF,gDAAgD;AACh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AAO,EAAE,KAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;QACpD,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;KACxB,CAAC;IACF,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;KACxD,CAAC;CACH,CAAC;AAEqB,0BAAgB,GAAG,IAAI,CAAC;AACxB,iBAAO,GAAG,CAAC,sBAAsB,CAAC,CAAC;eA1BvC,SAAS"}
@@ -1,12 +1,12 @@
1
1
  # commandDescription
2
2
 
3
- make configuration changes that are not covered by the metadata API
3
+ Make configuration changes that are not covered by the metadata API.
4
4
  See example configuration on how to define tasks
5
5
 
6
6
  # tasks
7
7
 
8
- list of task titles, if no tasks are specified, all tasks marked as active will be executed
8
+ List of task titles, if no tasks are specified, all tasks marked as active will be executed.
9
9
 
10
10
  # concurrent
11
11
 
12
- execute tasks in parallel
12
+ Execute tasks in parallel.
@@ -8,20 +8,20 @@ update country integration values in the State/Country Picklists
8
8
 
9
9
  # countrycodeFlagDescription
10
10
 
11
- Alpha-2 code
11
+ Alpha-2 code.
12
12
 
13
13
  # categoryFlagDescription
14
14
 
15
- Subdivision category
15
+ Subdivision category.
16
16
 
17
17
  # languageFlagDescription
18
18
 
19
- Language code
19
+ Language code.
20
20
 
21
21
  # silentFlagDescription
22
22
 
23
- silent mode
23
+ silent mode.
24
24
 
25
25
  # concurrentFlagDescription
26
26
 
27
- execute tasks in parallel
27
+ execute tasks in parallel.
@@ -0,0 +1,3 @@
1
+ # commandDescription
2
+
3
+ Check the flow test coverage of an Org.
@@ -0,0 +1,11 @@
1
+ # commandDescription
2
+
3
+ Write the current settings from an Org to a scratch org def file.
4
+
5
+ # writetoprojectscratchdeffile
6
+
7
+ Write output to project-scratch-def.json file.
8
+
9
+ # fileFlagDescription
10
+
11
+ Write to 'file' instead of project-scratch-def.json.
@@ -0,0 +1,11 @@
1
+ # commandDescription
2
+
3
+ Listen to streaming api and platform events.
4
+
5
+ # topicFlagDescription
6
+
7
+ The event name.
8
+
9
+ # replayIdFlagDescription
10
+
11
+ Receive all stored events after the event specified by the replayId value and new events. [default: -1] Receive new events that are broadcast after the command subscribes. [-2] Receive all event, including past events that are within the retention window and new events.
@@ -1,6 +1,127 @@
1
1
  {
2
- "version": "1.0.4",
2
+ "version": "1.1.1",
3
3
  "commands": {
4
+ "jayree:org:stream": {
5
+ "id": "jayree:org:stream",
6
+ "summary": "Listen to streaming api and platform events.",
7
+ "strict": true,
8
+ "pluginName": "@jayree/sfdx-plugin-org",
9
+ "pluginAlias": "@jayree/sfdx-plugin-org",
10
+ "pluginType": "core",
11
+ "aliases": [
12
+ "jayree:org:streaming"
13
+ ],
14
+ "examples": [
15
+ "$ sfdx jayree org stream --channel=/event/eventName__e\n...\n"
16
+ ],
17
+ "deprecateAliases": true,
18
+ "flags": {
19
+ "json": {
20
+ "name": "json",
21
+ "type": "boolean",
22
+ "description": "Format output as json.",
23
+ "helpGroup": "GLOBAL",
24
+ "allowNo": false,
25
+ "deprecateAliases": true
26
+ },
27
+ "target-org": {
28
+ "name": "target-org",
29
+ "type": "option",
30
+ "char": "o",
31
+ "summary": "Username or alias of the target org.",
32
+ "required": true,
33
+ "multiple": false,
34
+ "deprecateAliases": true,
35
+ "aliases": [
36
+ "targetusername",
37
+ "u"
38
+ ]
39
+ },
40
+ "api-version": {
41
+ "name": "api-version",
42
+ "type": "option",
43
+ "description": "Override the api version used for api requests made by this command",
44
+ "multiple": false,
45
+ "deprecateAliases": true,
46
+ "aliases": [
47
+ "apiversion"
48
+ ]
49
+ },
50
+ "channel": {
51
+ "name": "channel",
52
+ "type": "option",
53
+ "char": "c",
54
+ "summary": "The event name.",
55
+ "required": true,
56
+ "multiple": false,
57
+ "deprecateAliases": true,
58
+ "aliases": [
59
+ "topic",
60
+ "p"
61
+ ]
62
+ },
63
+ "replay-id": {
64
+ "name": "replay-id",
65
+ "type": "option",
66
+ "char": "r",
67
+ "summary": "Receive all stored events after the event specified by the replayId value and new events. [default: -1] Receive new events that are broadcast after the command subscribes. [-2] Receive all event, including past events that are within the retention window and new events.",
68
+ "multiple": false,
69
+ "deprecateAliases": true
70
+ }
71
+ },
72
+ "args": {},
73
+ "hasDynamicHelp": true
74
+ },
75
+ "jayree:flow:get:coverage": {
76
+ "id": "jayree:flow:get:coverage",
77
+ "summary": "Check the flow test coverage of an Org.",
78
+ "strict": true,
79
+ "pluginName": "@jayree/sfdx-plugin-org",
80
+ "pluginAlias": "@jayree/sfdx-plugin-org",
81
+ "pluginType": "core",
82
+ "aliases": [
83
+ "jayree:flowtestcoverage"
84
+ ],
85
+ "examples": [
86
+ "$ sfdx jayree:flowtestcoverage\n=== Flow Test Coverage\nCoverage: 82%\n...\n"
87
+ ],
88
+ "deprecateAliases": true,
89
+ "flags": {
90
+ "json": {
91
+ "name": "json",
92
+ "type": "boolean",
93
+ "description": "Format output as json.",
94
+ "helpGroup": "GLOBAL",
95
+ "allowNo": false,
96
+ "deprecateAliases": true
97
+ },
98
+ "target-org": {
99
+ "name": "target-org",
100
+ "type": "option",
101
+ "char": "o",
102
+ "summary": "Username or alias of the target org.",
103
+ "required": true,
104
+ "multiple": false,
105
+ "deprecateAliases": true,
106
+ "aliases": [
107
+ "targetusername",
108
+ "u"
109
+ ]
110
+ },
111
+ "api-version": {
112
+ "name": "api-version",
113
+ "type": "option",
114
+ "description": "Override the api version used for api requests made by this command",
115
+ "multiple": false,
116
+ "deprecateAliases": true,
117
+ "aliases": [
118
+ "apiversion"
119
+ ]
120
+ }
121
+ },
122
+ "args": {},
123
+ "hasDynamicHelp": true
124
+ },
4
125
  "jayree:org:configure:country": {
5
126
  "id": "jayree:org:configure:country",
6
127
  "summary": "update country integration values in the State/Country Picklists",
@@ -42,7 +163,7 @@
42
163
  "silent": {
43
164
  "name": "silent",
44
165
  "type": "boolean",
45
- "summary": "silent mode",
166
+ "summary": "silent mode.",
46
167
  "hidden": true,
47
168
  "required": false,
48
169
  "allowNo": false
@@ -53,8 +174,8 @@
53
174
  },
54
175
  "jayree:org:configure": {
55
176
  "id": "jayree:org:configure",
56
- "summary": "make configuration changes that are not covered by the metadata API\nSee example configuration on how to define tasks",
57
- "description": "make configuration changes that are not covered by the metadata API\nSee example configuration on how to define tasks",
177
+ "summary": "Make configuration changes that are not covered by the metadata API.\nSee example configuration on how to define tasks",
178
+ "description": "Make configuration changes that are not covered by the metadata API.\nSee example configuration on how to define tasks",
58
179
  "strict": true,
59
180
  "pluginName": "@jayree/sfdx-plugin-org",
60
181
  "pluginAlias": "@jayree/sfdx-plugin-org",
@@ -96,14 +217,14 @@
96
217
  "name": "tasks",
97
218
  "type": "option",
98
219
  "char": "t",
99
- "summary": "list of task titles, if no tasks are specified, all tasks marked as active will be executed",
220
+ "summary": "List of task titles, if no tasks are specified, all tasks marked as active will be executed.",
100
221
  "multiple": true,
101
222
  "delimiter": ","
102
223
  },
103
224
  "concurrent": {
104
225
  "name": "concurrent",
105
226
  "type": "boolean",
106
- "summary": "execute tasks in parallel",
227
+ "summary": "Execute tasks in parallel.",
107
228
  "allowNo": false
108
229
  }
109
230
  },
@@ -151,7 +272,7 @@
151
272
  "country-code": {
152
273
  "name": "country-code",
153
274
  "type": "option",
154
- "summary": "Alpha-2 code",
275
+ "summary": "Alpha-2 code.",
155
276
  "multiple": false,
156
277
  "aliases": [
157
278
  "countrycode"
@@ -160,25 +281,92 @@
160
281
  "category": {
161
282
  "name": "category",
162
283
  "type": "option",
163
- "summary": "Subdivision category",
284
+ "summary": "Subdivision category.",
164
285
  "multiple": false
165
286
  },
166
287
  "language": {
167
288
  "name": "language",
168
289
  "type": "option",
169
- "summary": "Language code",
290
+ "summary": "Language code.",
170
291
  "multiple": false
171
292
  },
172
293
  "concurrent": {
173
294
  "name": "concurrent",
174
295
  "type": "option",
175
- "summary": "execute tasks in parallel",
296
+ "summary": "execute tasks in parallel.",
176
297
  "multiple": false,
177
298
  "default": 1
178
299
  }
179
300
  },
180
301
  "args": {},
181
302
  "hasDynamicHelp": true
303
+ },
304
+ "jayree:org:get:settings": {
305
+ "id": "jayree:org:get:settings",
306
+ "summary": "Write the current settings from an Org to a scratch org def file.",
307
+ "strict": true,
308
+ "pluginName": "@jayree/sfdx-plugin-org",
309
+ "pluginAlias": "@jayree/sfdx-plugin-org",
310
+ "pluginType": "core",
311
+ "aliases": [
312
+ "jayree:org:settings"
313
+ ],
314
+ "examples": [
315
+ "$ sfdx jayree:org:settings\n$ sfdx jayree:org:settings -u me@my.org\n$ sfdx jayree:org:settings -u MyTestOrg1 -w"
316
+ ],
317
+ "deprecateAliases": true,
318
+ "flags": {
319
+ "json": {
320
+ "name": "json",
321
+ "type": "boolean",
322
+ "description": "Format output as json.",
323
+ "helpGroup": "GLOBAL",
324
+ "allowNo": false,
325
+ "deprecateAliases": true
326
+ },
327
+ "target-org": {
328
+ "name": "target-org",
329
+ "type": "option",
330
+ "char": "o",
331
+ "summary": "Username or alias of the target org.",
332
+ "required": true,
333
+ "multiple": false,
334
+ "deprecateAliases": true,
335
+ "aliases": [
336
+ "targetusername",
337
+ "u"
338
+ ]
339
+ },
340
+ "api-version": {
341
+ "name": "api-version",
342
+ "type": "option",
343
+ "description": "Override the api version used for api requests made by this command",
344
+ "multiple": false,
345
+ "deprecateAliases": true,
346
+ "aliases": [
347
+ "apiversion"
348
+ ]
349
+ },
350
+ "writetoprojectscratchdeffile": {
351
+ "name": "writetoprojectscratchdeffile",
352
+ "type": "boolean",
353
+ "char": "w",
354
+ "summary": "Write output to project-scratch-def.json file.",
355
+ "allowNo": false,
356
+ "deprecateAliases": true
357
+ },
358
+ "file": {
359
+ "name": "file",
360
+ "type": "option",
361
+ "char": "f",
362
+ "summary": "Write to 'file' instead of project-scratch-def.json.",
363
+ "multiple": false,
364
+ "deprecateAliases": true
365
+ }
366
+ },
367
+ "args": {},
368
+ "requiresProject": true,
369
+ "hasDynamicHelp": true
182
370
  }
183
371
  }
184
372
  }
package/package.json CHANGED
@@ -1,49 +1,48 @@
1
1
  {
2
2
  "name": "@jayree/sfdx-plugin-org",
3
3
  "description": "A Salesforce CLI plugin containing commands to configure State and Country/Territory Picklists and other org settings.",
4
- "version": "1.0.4",
4
+ "version": "1.1.1",
5
5
  "author": "jayree",
6
6
  "type": "module",
7
7
  "bugs": "https://github.com/jayree/sfdx-plugin-org/issues",
8
8
  "dependencies": {
9
9
  "@jayree/changelog": "^1.1.1",
10
- "@oclif/core": "^2.8.2",
11
- "@salesforce/kit": "^1.9.2",
12
- "@salesforce/sf-plugins-core": "^2.4.3",
13
- "@salesforce/ts-types": "^1.7.3",
10
+ "@salesforce/sf-plugins-core": "^3.0.1",
11
+ "@salesforce/source-deploy-retrieve": "^8.5.3",
12
+ "@salesforce/ts-types": "^2.0.2",
14
13
  "debug": "^4.3.4",
15
14
  "enquirer": "^2.3.6",
16
15
  "fs-extra": "^11.1.1",
17
16
  "is-docker": "^3.0.0",
18
17
  "is-wsl": "^2.2.0",
19
18
  "listr2": "^6.6.0",
20
- "playwright-chromium": "^1.33.0",
19
+ "playwright-chromium": "^1.34.1",
21
20
  "tabletojson": "^2.0.7",
22
21
  "tslib": "^2.5.2"
23
22
  },
24
23
  "devDependencies": {
25
- "@oclif/plugin-command-snapshot": "^3.3.15",
24
+ "@oclif/plugin-command-snapshot": "^4.0.2",
26
25
  "@oclif/plugin-help": "^5.2.9",
27
- "@salesforce/dev-config": "^3.1.0",
28
- "@salesforce/dev-scripts": "^4.3.0",
26
+ "@salesforce/dev-config": "^4.0.1",
27
+ "@salesforce/dev-scripts": "^5.0.1",
29
28
  "@salesforce/prettier-config": "^0.0.3",
30
- "@salesforce/ts-sinon": "^1.4.6",
31
- "@types/debug": "^4.1.7",
29
+ "@salesforce/ts-sinon": "^1.4.7",
30
+ "@types/debug": "^4.1.8",
32
31
  "@types/fs-extra": "^11.0.1",
33
32
  "@types/wrap-ansi": "^8.0.1",
34
- "@typescript-eslint/eslint-plugin": "^5.59.6",
35
- "@typescript-eslint/parser": "^5.59.6",
33
+ "@typescript-eslint/eslint-plugin": "^5.59.7",
34
+ "@typescript-eslint/parser": "^5.59.7",
36
35
  "c8": "^7.13.0",
37
36
  "chai": "^4.3.7",
38
- "eslint": "^8.40.0",
37
+ "eslint": "^8.41.0",
39
38
  "eslint-config-oclif": "^4.0",
40
39
  "eslint-config-prettier": "^8.8.0",
41
- "eslint-config-salesforce": "^1.2.0",
40
+ "eslint-config-salesforce": "^2.0.1",
42
41
  "eslint-config-salesforce-license": "^0.2.0",
43
42
  "eslint-config-salesforce-typescript": "^1.1.1",
44
43
  "eslint-plugin-header": "^3.1.1",
45
44
  "eslint-plugin-import": "2.27.5",
46
- "eslint-plugin-jsdoc": "^43.2.0",
45
+ "eslint-plugin-jsdoc": "^44.2.5",
47
46
  "eslint-plugin-prettier": "^4.2.1",
48
47
  "eslint-plugin-sf-plugin": "^1.15.3",
49
48
  "husky": "^8.0.3",
@@ -51,7 +50,7 @@
51
50
  "mocha": "^10.2.0",
52
51
  "nyc": "^15.1.0",
53
52
  "oclif": "^3.9.0",
54
- "patch-package": "^6.5.1",
53
+ "patch-package": "^7.0.0",
55
54
  "prettier": "^2.8.8",
56
55
  "pretty-quick": "^3.1.3",
57
56
  "shx": "^0.3.4",
@@ -61,7 +60,7 @@
61
60
  "wireit": "^0.9.5"
62
61
  },
63
62
  "engines": {
64
- "node": ">=14.0.0"
63
+ "node": ">=16.0.0"
65
64
  },
66
65
  "files": [
67
66
  "/lib",
@@ -94,10 +93,10 @@
94
93
  "description": "manifest, source, and org automation toolset",
95
94
  "subtopics": {
96
95
  "org": {
97
- "description": "manage your orgs",
96
+ "description": "Commands to manage orgs.",
98
97
  "subtopics": {
99
98
  "configure": {
100
- "description": "manage state and country picklist values"
99
+ "description": "Manage org settings and state and country picklist values."
101
100
  }
102
101
  }
103
102
  }