sf-raven 1.0.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 ADDED
@@ -0,0 +1,370 @@
1
+ # sf-raven
2
+
3
+ A plugin for the Salesforce CLI built by Tom Carman.
4
+
5
+ [sf-raven](https://github.com/tomcarman/sf-raven) now replaces [sfdx-raven](https://github.com/tomcarman/sfdx-raven/).
6
+
7
+ ## Why a new plugin?
8
+
9
+ [sfdx-raven](https://github.com/tomcarman/sfdx-raven/) was originally built in 2020, but the Salesforce CLI landscape has changed a lot since then. Rather than attempting to [migrate the original plugin from sfdx to sf](https://github.com/salesforcecli/cli/wiki/Migrate-Plugins-Built-for-sfdx), it felt cleaner to start a new project and leverage the new architecture and scaffolding tools that come with the new sf cli.
10
+
11
+ ## Improvements over sfdx-raven
12
+
13
+ - Built on [sf not sfdx](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_move_to_sf_v2.htm).
14
+ - Uses the latest version of [oclif](https://oclif.io/blog/2022/01/12/announcing-oclif-v2/).
15
+ - Commands now follow the [sf command structure](https://github.com/salesforcecli/cli/wiki/Design-Guidelines#Command-Structure) guidelines - `<topic> <action> <resource | sub-action> [flags]`. For example:
16
+ - `info:fields` becomes `object display fields`
17
+ - `utils:event:listen` becomes `event subscribe`
18
+ - Code now meets ESlint rules for TypeScript, including the Salesforce CLI Plugin custom rules.
19
+ - The [Salesforce tooling / documentation](https://github.com/salesforcecli/cli/wiki/Code-Your-Plugin) for building custom plugins has matured a lot over the past couple years, which will make it easier to update the plugin going forward.
20
+
21
+ More commands will be ported/added over time - see [Todo](#Todo).
22
+
23
+ ## Command Quick Reference
24
+
25
+ Full details, usage, examples etc are further down, or can be accessed via `--help` on the commands.
26
+
27
+ #### sf raven object display
28
+
29
+ - [sf raven object display fields](#sf-raven-object-display-fields)
30
+ - Show field information for a given sObject.
31
+ - [sf raven object display recordtypes](#sf-raven-object-display-recordtypes)
32
+ - Show RecordType information for a given sObject.
33
+
34
+ #### sf raven event
35
+
36
+ - [sf raven event subscribe](#sf-raven-event-subscribe)
37
+ - Subscribe to Platform Events.
38
+
39
+ <!-- #### sfdx:raven:utils
40
+ * [sfdx raven:utils:deploy:branch2org](#sfdx-ravenutilsdeploybranch2org)
41
+ * Deploy a git branch to an org
42
+ * [sfdx raven:utils:diff](#sfdx-ravenutilsdiff)
43
+ * Diff individual metadata items (class, object etc) between orgs
44
+ * [sfdx raven:utils:dashboarduser:update](#sfdx-ravenutilsdashboarduserupdate)
45
+ * Change the running user of Dashboards -->
46
+
47
+ ## Setup
48
+
49
+ ### Quick Install
50
+
51
+ Assuming you already have the [SDFX CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm) installed, just run:
52
+
53
+ `sf plugins install sf-raven`
54
+
55
+ Note: You'll be prompted that this is not officially code-signed by Salesforce - like any custom plugin. You can just accept this when prompted, or alternatively you can [whitelist it](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_allowlist.htm)
56
+
57
+ ### Updating the plugin
58
+
59
+ The plugin can be updated to the latest version using
60
+
61
+ `sf plugins update`
62
+
63
+ ### Install from source
64
+
65
+ 1. Install the [SDFX CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm)
66
+ 2. Clone the repository: `git clone git@github.com:tomcarman/sf-raven.git`
67
+ 3. Install npm modules: `npm install`
68
+ 4. Link the plugin: `sfdx plugins:link .`
69
+
70
+ ## Compatibility
71
+
72
+ - **macOS**
73
+ - Plugin has been built on macOS and will always run on macOS
74
+
75
+ <!-- * **Windows**
76
+ * Work on Windows 10 1803+ (this is that latest build I have access to)
77
+ * Known Issues:
78
+ * Emoji will not work in cmd.exe / powershell - so you may seem some funny characters when running the plugin - this can be ignored. Emoji may work in Windows Terminal, but I have not managed to test yet
79
+ * I don't think 'diff' is available on windows cli, so `sfdx:raven:utils:diff` is not likely to work.
80
+
81
+ * **Linux**
82
+ * Only tested on an Ubuntu installation on [WSL](https://docs.microsoft.com/en-us/windows/wsl/about), but should work. -->
83
+
84
+ ## Todo
85
+
86
+ - Migrate remaining commands from [sfdx-raven](https://github.com/tomcarman/sfdx-raven/)
87
+ - sfdx raven:utils:deploy:branch2org
88
+ - sfdx raven:utils:diff
89
+ - sfdx raven:utils:dashboarduser:update - tbc
90
+ - Audit Trail inspector
91
+ - Allow you to quickly search audit trail by username, metadata item, most recent 50 etc.
92
+ - Get the sObject Type for a given Id
93
+ - Get the picklist values for a given picklist
94
+ - Clone a record
95
+
96
+ ## sf raven object display fields
97
+
98
+ Show field information for a given sObject.
99
+
100
+ ```
101
+ USAGE
102
+ $ sf object display fields -o <value> -s <value> [--json]
103
+
104
+ FLAGS
105
+ -o, --target-org=<value> (required) Login username or alias for the target org.
106
+ -s, --sobject=<value> (required) The API name of the sObject that you want to view fields for.
107
+
108
+ GLOBAL FLAGS
109
+ --json Format output as json.
110
+
111
+ DESCRIPTION
112
+ Show field information for a given sObject.
113
+
114
+ FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.
115
+
116
+ EXAMPLES
117
+ $ sf object display fields --target-org dev --sobject Account
118
+
119
+ $ sf object display fields --target-org dev --sobject My_Custom_Object__c
120
+
121
+
122
+ OUTPUT
123
+
124
+ Name Developer Name Type
125
+ ────────────────── ─────────────── ─────────────────
126
+ Account Number AccountNumber Text(40)
127
+ Account Source AccountSource Picklist
128
+ Annual Revenue AnnualRevenue Currency(18, 0)
129
+ ...
130
+ ```
131
+
132
+ ## sf raven object display recordtypes
133
+
134
+ Show RecordType information for a given sObject.
135
+
136
+ ```
137
+ USAGE
138
+ $ sf object display recordtypes -o <value> -s <value> [--json]
139
+
140
+ FLAGS
141
+ -o, --target-org=<value> (required) Login username or alias for the target org.
142
+ -s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for.
143
+
144
+ GLOBAL FLAGS
145
+ --json Format output as json.
146
+
147
+ DESCRIPTION
148
+ Show RecordType information for a given sObject.
149
+
150
+ RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.
151
+
152
+ EXAMPLES
153
+ $ sf object display recordtypes --target-org dev --sobject Account
154
+
155
+ $ sf object display recordtypes --target-org dev --sobject My_Custom_Object__c
156
+
157
+
158
+ OUTPUT
159
+
160
+ Name Developer Name Id
161
+ ─────────────────── ─────────────────────── ──────────────────
162
+ Business Account Business_Account 0124J000000XXXXABC
163
+ Person Account PersonAccount 0124J000000YYYYDEF
164
+ ...
165
+ ```
166
+
167
+ ## sf raven event subscribe
168
+
169
+ Subscribe to Platform Events.
170
+
171
+ ```
172
+ USAGE
173
+ $ sf event subscribe -o <value> -e <value> [--json] [-r <value>] [-t <value>]
174
+
175
+ FLAGS
176
+ -e, --event=<value> (required) The name of the Platform Event that you want to subscribe with '/event/' prefix eg. /event/My_Event__e.
177
+ -o, --target-org=<value> (required) Login username or alias for the target org.
178
+ -r, --replayid=<value> The replay id to replay events from eg. 21980378.
179
+ -t, --timeout=<value> [default: 3] How long to subscribe for before timing out in minutes eg. 10. Default is 3 minutes.
180
+
181
+ GLOBAL FLAGS
182
+ --json Format output as json.
183
+
184
+ DESCRIPTION
185
+ Subscribe to Platform Events.
186
+
187
+ Platform Events are printed to the terminal. An optional flag can be used to relay events from a given relayid. Defaut timeout is 3 minutes, but can be extended to 30 minutes.
188
+
189
+ EXAMPLES
190
+ $ sf event subscribe --target-org dev --event /event/My_Event__e
191
+
192
+ $ sf event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378
193
+
194
+ $ sf event subscribe --target-org dev --event /event/My_Event__e --timeout 10
195
+
196
+ $ sf event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378 --timeout 10
197
+
198
+
199
+ OUTPUT
200
+
201
+ ❯ 🔌 Connecting to org... done
202
+ ❯ 📡 Listening for events...
203
+
204
+ {
205
+ "schema": "XdDXhymeO5NOxuhzFpgDJA",
206
+ "payload": {
207
+ "Some_Event_Field__c": "Hello World",
208
+ "CreatedDate": "2021-03-15T19:16:54.929Z",
209
+ },
210
+ "event": {
211
+ "replayId": 21980379
212
+ }
213
+ }
214
+ ```
215
+
216
+ <!-- ## sfdx raven:utils:deploy:branch2org
217
+
218
+ Deploys a git branch to an org. Assumes you have git installed the neccessary access to the repo you are trying to clone (eg. you can run `git clone ...`), and that the branch is in a source-format sfdx project structure.
219
+
220
+ ```
221
+ USAGE
222
+ $ sfdx raven:utils:deploy:branch2org
223
+
224
+ OPTIONS
225
+ -u, --targetusername
226
+ (required) sets a username or alias for the target org that you wish to deploy to. overrides the default target org.
227
+
228
+ -r, --repository
229
+ (required) URL of the repo. It can either be an HTTPs URL (eg. 'https://github.com/user/some-repo.git') and you
230
+ will be prompted to enter a username and password, or an SSH URL (eg. 'git@github.com:user/some-repo.git')
231
+ which assumes you have SSH keys configured for this repo.
232
+
233
+ -b, --branch
234
+ (required) the branch you wish to deploy
235
+
236
+ -c, --checkonly
237
+ (optional) Validates the deployed metadata and runs all Apex tests, but prevents the
238
+ deployment from being saved to the org.
239
+
240
+ -h, --help
241
+ show CLI help
242
+
243
+ --json
244
+ format output as json
245
+
246
+ --loglevel l
247
+ ogging level for this command invocation
248
+
249
+ EXAMPLE
250
+ $ sfdx raven:utils:deploy:branch2org -r git@github.com:user/some-repo.git -b branchName -u orgName`
251
+ or
252
+ $ sfdx raven:utils:deploy:branch2org -r https://github.com/user/some-repo.git -b branchName -u orgName`
253
+
254
+
255
+ OUTPUT
256
+
257
+ ❯ Cloning repo & checking out 'branchName'... done
258
+ ❯ Converting from source format to metadata format... done
259
+ ❯ Initiating deployment... done
260
+
261
+ ❯ The deployment has been requested with id: 0Af4K00000BHVuAXXX
262
+
263
+ ❯ Deployment InProgress (0/31) Processing Type: CustomObject
264
+ ❯ Deployment InProgress (21/31) Processing Type: CustomTab
265
+ ❯ Deployment InProgress (30/31) Processing Type: Profile
266
+ ❯ Deployment Succeeded
267
+
268
+ ❯ Link to deployment page in Salesforce:
269
+ https://wise-hawk-22uzds-dev-ed.my.salesforce.com/lightning/setup/DeployStatus/page?address=%2Fchangemgmt%2FmonitorDeploymentsDetails.apexp%3FasyncId%3D0Af4K00000BHVuASAX
270
+ ```
271
+
272
+ ## sfdx raven:utils:diff
273
+
274
+ Allows you to quickly compare metadata of files between two orgs. Intended to be used for quick compares of single
275
+ (or possibly a few) files of the same metadata type, rather than a full org compare (there are better tools for
276
+ that) The results are stored in a diff_{timestamp}.html file wherever you run the command from, and automatically
277
+ opened in a browser.
278
+
279
+ ```
280
+ USAGE
281
+ $ sfdx raven:utils:diff -s <string> -t <string> -o <string> -i <string> [--filename <string>] [-f <string>]
282
+ [--silent] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
283
+
284
+ OPTIONS
285
+ -f, --format=format
286
+ (optional) Format of the diff. Options are 'line' (inline diff) or 'side' (side-by-side diff). Defaults to 'line'
287
+
288
+ -i, --items=items
289
+ (required) The items you wish to compare eg. MyCoolClass or Account. Can be multiple items comma delimted eg.
290
+ MyClass,MyController or Account,Opportunity (but can only be of one 'type')
291
+
292
+ -o, --type=type
293
+ (required) The type of metadata you want to compare eg. ApexClass or CustomObject
294
+
295
+ -s, --source=source
296
+ (required) Alias / Username of the org you want to use as the SOURCE of the diff eg. projectDev
297
+
298
+ -t, --target=target
299
+ (required) Alias / Username of the org you want to use as the TARGET of the diff eg. projectQA
300
+
301
+ --filename=filename
302
+ (optional) The filename of the diff.html. Defaults to diff_{timestamp}.html
303
+
304
+ --json
305
+ format output as json
306
+
307
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
308
+ [default: warn] logging level for this command invocation
309
+
310
+ --silent
311
+ use this to not auto open browser with results
312
+
313
+ EXAMPLES
314
+ $ sfdx raven:utils:diff --source dev_org --target qa_org --type CustomObject --items Account
315
+ $ sfdx raven:utils:diff --source dev_org --target qa_org --type CustomObject --items 'Account,Opportunity'
316
+ $ sfdx raven:utils:diff --source dev_org --target qa_org --type ApexClass --items MyClass
317
+ $ sfdx raven:utils:diff --source dev_org --target qa_org --type ApexClass --items 'MyClass,MyTestClass,MyController
318
+ $ sfdx raven:utils:diff -s dev_org -t qa_org -o CustomObject -i 'Account'
319
+ $ sfdx raven:utils:diff -s dev_org -t qa_org -o ApexClass -i 'MyClass'
320
+ $ sfdx raven:utils:diff -s dev_org -t qa_org -o ApexClass -i 'MyClass' --silent
321
+
322
+ OUTPUT
323
+
324
+ ❯ sfdx raven:utils:diff --source trailhead --target dev --type ApexClass --items 'HelloWorld'
325
+ 🗂️ Building package.xml... done
326
+ ⏬ Retrieving from trailhead... done
327
+ ⏬ Retrieving from dev... done
328
+ 📂 Unzipping metadata... done
329
+ 👨‍🍳 Preparing diff... done
330
+ ✨ Cleaning up... done
331
+ 🌐 Opening with diff2html in browser... done
332
+ ```
333
+ <img width="795" alt="diff" src="https://user-images.githubusercontent.com/1554713/111902572-057edf80-8a36-11eb-8c45-56c09c290e89.png">
334
+
335
+
336
+ ## sfdx raven:utils:dashboarduser:update
337
+
338
+ Updates the "Running User" of Dashboards from a given user, to an alternate given user. Useful for mass-updating Dashboards when a user is deactivated.
339
+
340
+ You will have the following additional options when running -
341
+
342
+ * A list of Dashboards that will be affected as part of the script will be displayed, with the option to abort if desired.
343
+ * The final step to deploy the changes back to the org can be skipped when prompted, allowing for the manual deploy of the patched metadata files - this might be desirable when running against Production environments with strict deployment practices, or if you maintain Dashboard metadata in source control and want to commit the files.
344
+
345
+ ```
346
+ USAGE
347
+ $ sfdx raven:utils:dashboarduser:update
348
+
349
+ OPTIONS
350
+ -u, --targetusername
351
+ (required) sets a username or alias for the target org. overrides the default target org.
352
+
353
+ -f, --from
354
+ (required) the username of the user which is currently the 'running user' of the Dashboards eg. 'tom.carman@ecorp.com'
355
+
356
+ -t, --to.
357
+ (required) the username of the user which you want to make the new 'running user' of the Dashboards eg. 'james.moriarty@ecorp.com'
358
+
359
+ -h, --help
360
+ show CLI help
361
+
362
+ --json
363
+ format output as json
364
+
365
+ --loglevel
366
+ logging level for this command invocation
367
+
368
+ EXAMPLE
369
+ $ sfdx raven:utils:dashboarduser:update -u ecorp-dev --from tom.carman@ecorp.com --to james.moriarty@ecorp.com`
370
+ ``` -->
@@ -0,0 +1,16 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type EventSubscribeResult = {
3
+ status: string;
4
+ };
5
+ export default class EventSubscribe extends SfCommand<EventSubscribeResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly flags: {
10
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ event: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ replayid: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
+ };
15
+ run(): Promise<EventSubscribeResult>;
16
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
4
+ const core_1 = require("@salesforce/core");
5
+ const lib_1 = require("@salesforce/kit/lib");
6
+ const emoji = require("node-emoji");
7
+ core_1.Messages.importMessagesDirectory(__dirname);
8
+ const messages = core_1.Messages.loadMessages('sf-raven', 'event.subscribe');
9
+ class EventSubscribe extends sf_plugins_core_1.SfCommand {
10
+ async run() {
11
+ const { flags } = await this.parse(EventSubscribe);
12
+ const ux = new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() });
13
+ // Set up stream client and stream processor
14
+ ux.spinner.start(`${emoji.get('electric_plug')} Connecting to org`);
15
+ const streamProcessor = (message) => {
16
+ ux.log(JSON.stringify(message, null, 2) + '\n');
17
+ return {
18
+ completed: false,
19
+ };
20
+ };
21
+ const options = new core_1.StreamingClient.DefaultOptions(flags['target-org'], flags.event, streamProcessor);
22
+ if (flags.timeout != null) {
23
+ options.setSubscribeTimeout(lib_1.Duration.minutes(flags.timeout));
24
+ }
25
+ // Connect to the org
26
+ const asyncStatusClient = await core_1.StreamingClient.create(options);
27
+ await asyncStatusClient.handshake();
28
+ ux.spinner.stop();
29
+ // Set the relay id if one has been supplied
30
+ if (flags.replayid != null) {
31
+ ux.log(`${emoji.get('leftwards_arrow_with_hook')} Replaying from ${flags.replayid}`);
32
+ asyncStatusClient.replay(flags.replayid);
33
+ }
34
+ // Start listening for events
35
+ ux.log(`${emoji.get('ear')} Listening for events...\n`);
36
+ await asyncStatusClient.subscribe(async () => {
37
+ // Nothing to do
38
+ });
39
+ return {
40
+ status: 'Exiting',
41
+ };
42
+ }
43
+ }
44
+ EventSubscribe.summary = messages.getMessage('summary');
45
+ EventSubscribe.description = messages.getMessage('description');
46
+ EventSubscribe.examples = messages.getMessages('examples');
47
+ EventSubscribe.flags = {
48
+ 'target-org': sf_plugins_core_1.Flags.requiredOrg({
49
+ summary: messages.getMessage('flags.target-org.summary'),
50
+ char: 'o',
51
+ required: true,
52
+ }),
53
+ event: sf_plugins_core_1.Flags.string({
54
+ summary: messages.getMessage('flags.event.summary'),
55
+ char: 'e',
56
+ required: true,
57
+ }),
58
+ replayid: sf_plugins_core_1.Flags.integer({
59
+ summary: messages.getMessage('flags.replayid.summary'),
60
+ char: 'r',
61
+ }),
62
+ timeout: sf_plugins_core_1.Flags.integer({
63
+ summary: messages.getMessage('flags.timeout.summary'),
64
+ char: 't',
65
+ min: 1,
66
+ max: 30,
67
+ default: 3,
68
+ }),
69
+ };
70
+ exports.default = EventSubscribe;
71
+ //# sourceMappingURL=subscribe.js.map
@@ -0,0 +1 @@
1
+ {"version":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,CAAC,wBAAwB,CAAC;QACtD,IAAI,EAAE,GAAG;KACV,CAAC;IACF,OAAO,EAAE,uBAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;QACrD,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,CAAC;KACX,CAAC;CACH,CAAC;kBA3BiB,cAAc"}
@@ -0,0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type HelloWorldResult = {
3
+ name: string;
4
+ time: string;
5
+ };
6
+ export default class World extends SfCommand<HelloWorldResult> {
7
+ static readonly summary: string;
8
+ static readonly description: string;
9
+ static readonly examples: string[];
10
+ static readonly flags: {
11
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ };
13
+ run(): Promise<HelloWorldResult>;
14
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
4
+ const core_1 = require("@salesforce/core");
5
+ core_1.Messages.importMessagesDirectory(__dirname);
6
+ const messages = core_1.Messages.loadMessages('sf-raven', 'hello.world');
7
+ class World extends sf_plugins_core_1.SfCommand {
8
+ async run() {
9
+ const { flags } = await this.parse(World);
10
+ const time = new Date().toDateString();
11
+ this.log(messages.getMessage('info.hello', [flags.name, time]));
12
+ return {
13
+ name: flags.name,
14
+ time,
15
+ };
16
+ }
17
+ }
18
+ World.summary = messages.getMessage('summary');
19
+ World.description = messages.getMessage('description');
20
+ World.examples = messages.getMessages('examples');
21
+ World.flags = {
22
+ name: sf_plugins_core_1.Flags.string({
23
+ char: 'n',
24
+ summary: messages.getMessage('flags.name.summary'),
25
+ description: messages.getMessage('flags.name.description'),
26
+ default: 'World',
27
+ }),
28
+ };
29
+ exports.default = World;
30
+ //# sourceMappingURL=world.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world.js","sourceRoot":"","sources":["../../../src/commands/hello/world.ts"],"names":[],"mappings":";;AAAA,iEAA+D;AAC/D,2CAA4C;AAE5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAOlE,MAAqB,KAAM,SAAQ,2BAA2B;IAcrD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAChE,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI;SACL,CAAC;IACJ,CAAC;;AArBsB,aAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,iBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,cAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C,WAAK,GAAG;IAC7B,IAAI,EAAE,uBAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QAClD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;QAC1D,OAAO,EAAE,OAAO;KACjB,CAAC;CACH,CAAC;kBAZiB,KAAK"}
@@ -0,0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type ObjectDisplayFieldsResult = {
3
+ result: object;
4
+ };
5
+ export default class ObjectDisplayFields extends SfCommand<ObjectDisplayFieldsResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly flags: {
10
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ sobject: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ };
13
+ run(): Promise<ObjectDisplayFieldsResult>;
14
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
4
+ const core_1 = require("@salesforce/core");
5
+ core_1.Messages.importMessagesDirectory(__dirname);
6
+ const messages = core_1.Messages.loadMessages('sf-raven', 'object.display.fields');
7
+ class ObjectDisplayFields extends sf_plugins_core_1.SfCommand {
8
+ async run() {
9
+ this.spinner.start('Loading...');
10
+ const { flags } = await this.parse(ObjectDisplayFields);
11
+ const ux = new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() });
12
+ const org = flags['target-org'];
13
+ const conn = org.getConnection();
14
+ const query = `SELECT Label, QualifiedApiName, DataType FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = '${flags.sobject}' ORDER BY QualifiedApiName`;
15
+ const result = (await conn.query(query));
16
+ this.spinner.stop();
17
+ // Return table of fields
18
+ ux.table(result.records, {
19
+ label: {
20
+ header: 'Name',
21
+ get: (row) => row.Label,
22
+ },
23
+ qualifiedApiName: {
24
+ header: 'Developer Name',
25
+ get: (row) => row.QualifiedApiName,
26
+ },
27
+ dataType: {
28
+ header: 'Type',
29
+ get: (row) => row.DataType,
30
+ },
31
+ });
32
+ // Return url
33
+ ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${flags.sobject}/FieldsAndRelationships/view`);
34
+ // Return an object to be displayed with --json
35
+ return result;
36
+ }
37
+ }
38
+ ObjectDisplayFields.summary = messages.getMessage('summary');
39
+ ObjectDisplayFields.description = messages.getMessage('description');
40
+ ObjectDisplayFields.examples = messages.getMessages('examples');
41
+ ObjectDisplayFields.flags = {
42
+ 'target-org': sf_plugins_core_1.Flags.requiredOrg({
43
+ summary: messages.getMessage('flags.target-org.summary'),
44
+ char: 'o',
45
+ required: true,
46
+ }),
47
+ sobject: sf_plugins_core_1.Flags.string({
48
+ summary: messages.getMessage('flags.sobject.summary'),
49
+ char: 's',
50
+ required: true,
51
+ }),
52
+ };
53
+ exports.default = ObjectDisplayFields;
54
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/commands/object/display/fields.ts"],"names":[],"mappings":";;AAAA,iEAAmE;AACnE,2CAA4C;AAE5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;AAM5E,MAAqB,mBAAoB,SAAQ,2BAAoC;IAkB5E,KAAK,CAAC,GAAG;QACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAgBjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACxD,MAAM,EAAE,GAAG,IAAI,oBAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAEvD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,4GAA4G,KAAK,CAAC,OAAO,6BAA6B,CAAC;QACrK,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAgB,C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0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type ObjectDisplayRecordtypesResult = {
3
+ result: object;
4
+ };
5
+ export default class ObjectDisplayRecordtypes extends SfCommand<ObjectDisplayRecordtypesResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly flags: {
10
+ 'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ sobject: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ };
13
+ run(): Promise<ObjectDisplayRecordtypesResult>;
14
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
4
+ const core_1 = require("@salesforce/core");
5
+ core_1.Messages.importMessagesDirectory(__dirname);
6
+ const messages = core_1.Messages.loadMessages('sf-raven', 'object.display.recordtypes');
7
+ class ObjectDisplayRecordtypes extends sf_plugins_core_1.SfCommand {
8
+ async run() {
9
+ this.spinner.start('Loading...');
10
+ const { flags } = await this.parse(ObjectDisplayRecordtypes);
11
+ const ux = new sf_plugins_core_1.Ux({ jsonEnabled: this.jsonEnabled() });
12
+ const org = flags['target-org'];
13
+ const conn = org.getConnection();
14
+ const query = `SELECT Name, DeveloperName, Id FROM RecordType WHERE SObjectType = '${flags.sobject}'`;
15
+ const result = (await conn.query(query));
16
+ this.spinner.stop();
17
+ // Return table of fields
18
+ ux.table(result.records, {
19
+ label: {
20
+ header: 'Name',
21
+ get: (row) => row.Name,
22
+ },
23
+ qualifiedApiName: {
24
+ header: 'Developer Name',
25
+ get: (row) => row.DeveloperName,
26
+ },
27
+ dataType: {
28
+ header: 'Id',
29
+ get: (row) => row.Id,
30
+ },
31
+ });
32
+ // Return url
33
+ ux.log(`\n${conn.instanceUrl}/lightning/setup/ObjectManager/${flags.sobject}/RecordTypes/view`);
34
+ // Return an object to be displayed with --json
35
+ return result;
36
+ }
37
+ }
38
+ ObjectDisplayRecordtypes.summary = messages.getMessage('summary');
39
+ ObjectDisplayRecordtypes.description = messages.getMessage('description');
40
+ ObjectDisplayRecordtypes.examples = messages.getMessages('examples');
41
+ ObjectDisplayRecordtypes.flags = {
42
+ 'target-org': sf_plugins_core_1.Flags.requiredOrg({
43
+ summary: messages.getMessage('flags.target-org.summary'),
44
+ char: 'o',
45
+ required: true,
46
+ }),
47
+ sobject: sf_plugins_core_1.Flags.string({
48
+ summary: messages.getMessage('flags.sobject.summary'),
49
+ char: 's',
50
+ required: true,
51
+ }),
52
+ };
53
+ exports.default = ObjectDisplayRecordtypes;
54
+ //# sourceMappingURL=recordtypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordtypes.js","sourceRoot":"","sources":["../../../../src/commands/object/display/recordtypes.ts"],"names":[],"mappings":";;AAAA,iEAAmE;AACnE,2CAA4C;AAE5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;AAMjF,MAAqB,wBAAyB,SAAQ,2BAAyC;IAkBtF,KAAK,CAAC,GAAG;QACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAgBjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC7D,MAAM,EAAE,GAAG,IAAI,oBAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAEvD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,uEAAuE,KAAK,CAAC,OAAO,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D,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;kBAhBiB,wBAAwB"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export = _default;
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ module.exports = {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iBAAS,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ # summary
2
+
3
+ Subscribe to Platform Events.
4
+
5
+ # description
6
+
7
+ Platform Events are printed to the terminal. An optional flag can be used to relay events from a given relayid. Defaut timeout is 3 minutes, but can be extended to 30 minutes.
8
+
9
+ # flags.target-org.summary
10
+
11
+ Login username or alias for the target org.
12
+
13
+ # flags.event.summary
14
+
15
+ The name of the Platform Event that you want to subscribe with '/event/' prefix eg. /event/My_Event\_\_e.
16
+
17
+ # flags.replayid.summary
18
+
19
+ The replay id to replay events from eg. 21980378.
20
+
21
+ # flags.timeout.summary
22
+
23
+ How long to subscribe for before timing out in minutes eg. 10. Default is 3 minutes.
24
+
25
+ # examples
26
+
27
+ - <%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\_\_e
28
+ - <%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\_\_e --replayid 21980378
29
+ - <%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\_\_e --timeout 10
30
+ - <%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\_\_e --replayid 21980378 --timeout 10
@@ -0,0 +1,29 @@
1
+ # summary
2
+
3
+ Say hello.
4
+
5
+ # description
6
+
7
+ Say hello either to the world or someone you know.
8
+
9
+ # flags.name.summary
10
+
11
+ The name of the person you'd like to say hello to.
12
+
13
+ # flags.name.description
14
+
15
+ This person can be anyone in the world!
16
+
17
+ # examples
18
+
19
+ - Say hello to the world:
20
+
21
+ <%= config.bin %> <%= command.id %>
22
+
23
+ - Say hello to someone you know:
24
+
25
+ <%= config.bin %> <%= command.id %> --name Astro
26
+
27
+ # info.hello
28
+
29
+ Hello %s at %s.
@@ -0,0 +1,21 @@
1
+ # summary
2
+
3
+ Show field information for a given sObject.
4
+
5
+ # description
6
+
7
+ FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.
8
+
9
+ # flags.target-org.summary
10
+
11
+ Login username or alias for the target org.
12
+
13
+ # flags.sobject.summary
14
+
15
+ The API name of the sObject that you want to view fields for.
16
+
17
+ # examples
18
+
19
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account
20
+
21
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\_\_c
@@ -0,0 +1,21 @@
1
+ # summary
2
+
3
+ Show RecordType information for a given sObject.
4
+
5
+ # description
6
+
7
+ RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.
8
+
9
+ # flags.target-org.summary
10
+
11
+ Login username or alias for the target org.
12
+
13
+ # flags.sobject.summary
14
+
15
+ The API name of the sObject that you want to view Record Types for.
16
+
17
+ # examples
18
+
19
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject Account
20
+
21
+ - <%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\_\_c
@@ -0,0 +1,178 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "commands": {
4
+ "event:subscribe": {
5
+ "id": "event:subscribe",
6
+ "summary": "Subscribe to Platform Events.",
7
+ "description": "Platform Events are printed to the terminal. An optional flag can be used to relay events from a given relayid. Defaut timeout is 3 minutes, but can be extended to 30 minutes.",
8
+ "strict": true,
9
+ "pluginName": "sf-raven",
10
+ "pluginAlias": "sf-raven",
11
+ "pluginType": "core",
12
+ "aliases": [],
13
+ "examples": [
14
+ "<%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\\_\\_e",
15
+ "<%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\\_\\_e --replayid 21980378",
16
+ "<%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\\_\\_e --timeout 10",
17
+ "<%= config.bin %> <%= command.id %> --target-org dev --event /event/My_Event\\_\\_e --replayid 21980378 --timeout 10"
18
+ ],
19
+ "flags": {
20
+ "json": {
21
+ "name": "json",
22
+ "type": "boolean",
23
+ "description": "Format output as json.",
24
+ "helpGroup": "GLOBAL",
25
+ "allowNo": false
26
+ },
27
+ "target-org": {
28
+ "name": "target-org",
29
+ "type": "option",
30
+ "char": "o",
31
+ "summary": "Login username or alias for the target org.",
32
+ "required": true,
33
+ "multiple": false
34
+ },
35
+ "event": {
36
+ "name": "event",
37
+ "type": "option",
38
+ "char": "e",
39
+ "summary": "The name of the Platform Event that you want to subscribe with '/event/' prefix eg. /event/My_Event\\_\\_e.",
40
+ "required": true,
41
+ "multiple": false
42
+ },
43
+ "replayid": {
44
+ "name": "replayid",
45
+ "type": "option",
46
+ "char": "r",
47
+ "summary": "The replay id to replay events from eg. 21980378.",
48
+ "multiple": false
49
+ },
50
+ "timeout": {
51
+ "name": "timeout",
52
+ "type": "option",
53
+ "char": "t",
54
+ "summary": "How long to subscribe for before timing out in minutes eg. 10. Default is 3 minutes.",
55
+ "multiple": false,
56
+ "default": 3
57
+ }
58
+ },
59
+ "args": {},
60
+ "hasDynamicHelp": true
61
+ },
62
+ "hello:world": {
63
+ "id": "hello:world",
64
+ "summary": "Say hello.",
65
+ "description": "Say hello either to the world or someone you know.",
66
+ "strict": true,
67
+ "pluginName": "sf-raven",
68
+ "pluginAlias": "sf-raven",
69
+ "pluginType": "core",
70
+ "aliases": [],
71
+ "examples": [
72
+ "Say hello to the world:\n<%= config.bin %> <%= command.id %>",
73
+ "Say hello to someone you know:\n<%= config.bin %> <%= command.id %> --name Astro"
74
+ ],
75
+ "flags": {
76
+ "json": {
77
+ "name": "json",
78
+ "type": "boolean",
79
+ "description": "Format output as json.",
80
+ "helpGroup": "GLOBAL",
81
+ "allowNo": false
82
+ },
83
+ "name": {
84
+ "name": "name",
85
+ "type": "option",
86
+ "char": "n",
87
+ "summary": "The name of the person you'd like to say hello to.",
88
+ "description": "This person can be anyone in the world!",
89
+ "multiple": false,
90
+ "default": "World"
91
+ }
92
+ },
93
+ "args": {}
94
+ },
95
+ "object:display:fields": {
96
+ "id": "object:display:fields",
97
+ "summary": "Show field information for a given sObject.",
98
+ "description": "FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.",
99
+ "strict": true,
100
+ "pluginName": "sf-raven",
101
+ "pluginAlias": "sf-raven",
102
+ "pluginType": "core",
103
+ "aliases": [],
104
+ "examples": [
105
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account",
106
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c"
107
+ ],
108
+ "flags": {
109
+ "json": {
110
+ "name": "json",
111
+ "type": "boolean",
112
+ "description": "Format output as json.",
113
+ "helpGroup": "GLOBAL",
114
+ "allowNo": false
115
+ },
116
+ "target-org": {
117
+ "name": "target-org",
118
+ "type": "option",
119
+ "char": "o",
120
+ "summary": "Login username or alias for the target org.",
121
+ "required": true,
122
+ "multiple": false
123
+ },
124
+ "sobject": {
125
+ "name": "sobject",
126
+ "type": "option",
127
+ "char": "s",
128
+ "summary": "The API name of the sObject that you want to view fields for.",
129
+ "required": true,
130
+ "multiple": false
131
+ }
132
+ },
133
+ "args": {},
134
+ "hasDynamicHelp": true
135
+ },
136
+ "object:display:recordtypes": {
137
+ "id": "object:display:recordtypes",
138
+ "summary": "Show RecordType information for a given sObject.",
139
+ "description": "RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.",
140
+ "strict": true,
141
+ "pluginName": "sf-raven",
142
+ "pluginAlias": "sf-raven",
143
+ "pluginType": "core",
144
+ "aliases": [],
145
+ "examples": [
146
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject Account",
147
+ "<%= config.bin %> <%= command.id %> --target-org dev --sobject My_Custom_Object\\_\\_c"
148
+ ],
149
+ "flags": {
150
+ "json": {
151
+ "name": "json",
152
+ "type": "boolean",
153
+ "description": "Format output as json.",
154
+ "helpGroup": "GLOBAL",
155
+ "allowNo": false
156
+ },
157
+ "target-org": {
158
+ "name": "target-org",
159
+ "type": "option",
160
+ "char": "o",
161
+ "summary": "Login username or alias for the target org.",
162
+ "required": true,
163
+ "multiple": false
164
+ },
165
+ "sobject": {
166
+ "name": "sobject",
167
+ "type": "option",
168
+ "char": "s",
169
+ "summary": "The API name of the sObject that you want to view Record Types for.",
170
+ "required": true,
171
+ "multiple": false
172
+ }
173
+ },
174
+ "args": {},
175
+ "hasDynamicHelp": true
176
+ }
177
+ }
178
+ }
package/package.json ADDED
@@ -0,0 +1,209 @@
1
+ {
2
+ "name": "sf-raven",
3
+ "description": "A custom sf plugin built by @tomcarman",
4
+ "version": "1.0.0",
5
+ "dependencies": {
6
+ "@oclif/core": "^2.11.8",
7
+ "@salesforce/core": "^5.2.10",
8
+ "@salesforce/kit": "^3.0.8",
9
+ "@salesforce/sf-plugins-core": "^3.1.14",
10
+ "node-emoji": "^2.1.0",
11
+ "tslib": "^2"
12
+ },
13
+ "devDependencies": {
14
+ "@salesforce/cli-plugins-testkit": "^4.3.0",
15
+ "@salesforce/dev-config": "^4.0.1",
16
+ "@salesforce/dev-scripts": "^5.7.0",
17
+ "@salesforce/prettier-config": "^0.0.3",
18
+ "@salesforce/ts-sinon": "^1.4.14",
19
+ "@swc/core": "^1.3.19",
20
+ "@types/inquirer": "^9.0.3",
21
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
22
+ "@typescript-eslint/parser": "^5.62.0",
23
+ "chai": "^4.3.6",
24
+ "eslint": "^8.50.0",
25
+ "eslint-config-prettier": "^8.5.0",
26
+ "eslint-config-salesforce": "^2.0.2",
27
+ "eslint-config-salesforce-typescript": "^1.1.2",
28
+ "eslint-plugin-import": "2.28.1",
29
+ "eslint-plugin-jsdoc": "^46.4.6",
30
+ "eslint-plugin-sf-plugin": "^1.16.2",
31
+ "husky": "^7.0.4",
32
+ "mocha": "^9.2.2",
33
+ "nyc": "^15.1.0",
34
+ "oclif": "^3.17.1",
35
+ "prettier": "^2.8.8",
36
+ "pretty-quick": "^3.1.3",
37
+ "shx": "0.3.4",
38
+ "sinon": "10.0.0",
39
+ "ts-node": "^10.9.1",
40
+ "typescript": "^5.1.6",
41
+ "wireit": "^0.10.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=16.0.0"
45
+ },
46
+ "files": [
47
+ "/lib",
48
+ "/messages",
49
+ "/oclif.manifest.json"
50
+ ],
51
+ "keywords": [
52
+ "force",
53
+ "salesforce",
54
+ "sfdx",
55
+ "salesforcedx",
56
+ "sfdx-plugin",
57
+ "sf-plugin",
58
+ "sf"
59
+ ],
60
+ "license": "BSD-3-Clause",
61
+ "main": "lib/index.js",
62
+ "oclif": {
63
+ "commands": "./lib/commands",
64
+ "bin": "sf",
65
+ "topicSeparator": " ",
66
+ "devPlugins": [
67
+ "@oclif/plugin-help"
68
+ ],
69
+ "topics": {
70
+ "hello": {
71
+ "description": "Commands to say hello."
72
+ },
73
+ "object": {
74
+ "description": "description for object",
75
+ "subtopics": {
76
+ "display": {
77
+ "description": "description for object.display"
78
+ }
79
+ }
80
+ },
81
+ "event": {
82
+ "description": "description for event"
83
+ }
84
+ }
85
+ },
86
+ "scripts": {
87
+ "build": "wireit",
88
+ "clean": "sf-clean",
89
+ "clean-all": "sf-clean all",
90
+ "clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
91
+ "compile": "wireit",
92
+ "docs": "sf-docs",
93
+ "format": "wireit",
94
+ "lint": "wireit",
95
+ "postinstall": "yarn husky install",
96
+ "postpack": "shx rm -f oclif.manifest.json",
97
+ "prepack": "sf-prepack",
98
+ "test": "wireit",
99
+ "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
100
+ "test:only": "wireit",
101
+ "version": "oclif readme"
102
+ },
103
+ "publishConfig": {
104
+ "access": "public"
105
+ },
106
+ "wireit": {
107
+ "build": {
108
+ "dependencies": [
109
+ "compile",
110
+ "lint"
111
+ ]
112
+ },
113
+ "compile": {
114
+ "command": "tsc -p . --pretty --incremental",
115
+ "files": [
116
+ "src/**/*.ts",
117
+ "**/tsconfig.json",
118
+ "messages/**"
119
+ ],
120
+ "output": [
121
+ "lib/**",
122
+ "*.tsbuildinfo"
123
+ ],
124
+ "clean": "if-file-deleted"
125
+ },
126
+ "format": {
127
+ "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
128
+ "files": [
129
+ "src/**/*.ts",
130
+ "test/**/*.ts",
131
+ "schemas/**/*.json",
132
+ "command-snapshot.json",
133
+ ".prettier*"
134
+ ],
135
+ "output": []
136
+ },
137
+ "lint": {
138
+ "command": "eslint src test --color --cache --cache-location .eslintcache",
139
+ "files": [
140
+ "src/**/*.ts",
141
+ "test/**/*.ts",
142
+ "messages/**",
143
+ "**/.eslint*",
144
+ "**/tsconfig.json"
145
+ ],
146
+ "output": []
147
+ },
148
+ "test:compile": {
149
+ "command": "tsc -p \"./test\" --pretty",
150
+ "files": [
151
+ "test/**/*.ts",
152
+ "**/tsconfig.json"
153
+ ],
154
+ "output": []
155
+ },
156
+ "test": {
157
+ "dependencies": [
158
+ "test:compile",
159
+ "test:only",
160
+ "lint"
161
+ ]
162
+ },
163
+ "test:only": {
164
+ "command": "nyc mocha \"test/**/*.test.ts\"",
165
+ "env": {
166
+ "FORCE_COLOR": "2"
167
+ },
168
+ "files": [
169
+ "test/**/*.ts",
170
+ "src/**/*.ts",
171
+ "**/tsconfig.json",
172
+ ".mocha*",
173
+ "!*.nut.ts",
174
+ ".nycrc"
175
+ ],
176
+ "output": []
177
+ },
178
+ "test:command-reference": {
179
+ "command": "\"./bin/dev\" commandreference:generate --erroronwarnings",
180
+ "files": [
181
+ "src/**/*.ts",
182
+ "messages/**",
183
+ "package.json"
184
+ ],
185
+ "output": [
186
+ "tmp/root"
187
+ ]
188
+ },
189
+ "test:deprecation-policy": {
190
+ "command": "\"./bin/dev\" snapshot:compare",
191
+ "files": [
192
+ "src/**/*.ts"
193
+ ],
194
+ "output": [],
195
+ "dependencies": [
196
+ "compile"
197
+ ]
198
+ },
199
+ "test:json-schema": {
200
+ "command": "\"./bin/dev\" schema:compare",
201
+ "files": [
202
+ "src/**/*.ts",
203
+ "schemas"
204
+ ],
205
+ "output": []
206
+ }
207
+ },
208
+ "author": "@tomcarman"
209
+ }