@dishantlangayan/solace-cloud-cli 0.1.1 → 0.2.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.
Files changed (35) hide show
  1. package/README.md +370 -21
  2. package/dist/commands/missionctrl/broker/create.d.ts +1 -1
  3. package/dist/commands/missionctrl/broker/create.js +1 -3
  4. package/dist/commands/missionctrl/broker/delete.d.ts +1 -1
  5. package/dist/commands/missionctrl/broker/delete.js +1 -3
  6. package/dist/commands/missionctrl/broker/display.d.ts +1 -1
  7. package/dist/commands/missionctrl/broker/display.js +1 -3
  8. package/dist/commands/missionctrl/broker/list.d.ts +1 -1
  9. package/dist/commands/missionctrl/broker/list.js +3 -3
  10. package/dist/commands/missionctrl/broker/opstatus.d.ts +1 -1
  11. package/dist/commands/missionctrl/broker/opstatus.js +1 -3
  12. package/dist/commands/missionctrl/broker/state.d.ts +1 -1
  13. package/dist/commands/missionctrl/broker/state.js +1 -3
  14. package/dist/commands/missionctrl/broker/update.d.ts +1 -1
  15. package/dist/commands/missionctrl/broker/update.js +1 -3
  16. package/dist/commands/platform/env/create.d.ts +1 -1
  17. package/dist/commands/platform/env/create.js +2 -4
  18. package/dist/commands/platform/env/delete.d.ts +1 -1
  19. package/dist/commands/platform/env/delete.js +1 -2
  20. package/dist/commands/platform/env/display.d.ts +1 -1
  21. package/dist/commands/platform/env/display.js +1 -3
  22. package/dist/commands/platform/env/list.d.ts +1 -1
  23. package/dist/commands/platform/env/list.js +1 -3
  24. package/dist/commands/platform/env/update.d.ts +1 -1
  25. package/dist/commands/platform/env/update.js +3 -5
  26. package/oclif.manifest.json +5 -5
  27. package/package.json +26 -9
  28. package/dist/sc-command.d.ts +0 -22
  29. package/dist/sc-command.js +0 -54
  30. package/dist/util/internal.d.ts +0 -27
  31. package/dist/util/internal.js +0 -58
  32. package/dist/util/json.d.ts +0 -15
  33. package/dist/util/json.js +0 -19
  34. package/dist/util/sc-connection.d.ts +0 -13
  35. package/dist/util/sc-connection.js +0 -52
package/README.md CHANGED
@@ -11,10 +11,28 @@ The Solace Cloud CLI
11
11
 
12
12
 
13
13
  <!-- toc -->
14
+ * [Overview](#overview)
14
15
  * [Usage](#usage)
15
16
  * [Configuration](#configuration)
17
+ * [Resources](#resources)
18
+ * [Contributing](#contributing)
19
+ * [Authors](#authors)
20
+ * [License](#license)
16
21
  * [Commands](#commands)
17
22
  <!-- tocstop -->
23
+ # Overview
24
+ <!-- overview -->
25
+ The Solace Cloud CLI is a command line interface that simplifies deployment, configuration, and automation when working with your Solace Cloud org and services.
26
+
27
+ Use it to:
28
+
29
+ * Create and manage Environments
30
+ * Create and manage Mission Control and Event Broker Services
31
+ * Script deployment of Solace Cloud resources in your org
32
+
33
+ The CLI is built using the [oclif framework](https://oclif.io) that allows for plugin based development where users can add and extend the functionality of this CLI. For example, a new command can be added that can create and manage VPN Bridges, which uses the SEMP API to provision the bridges across two Message VPN on the same broker or across two brokers.
34
+
35
+ <!-- overviewstop -->
18
36
  # Usage
19
37
  <!-- usage -->
20
38
  ```sh-session
@@ -22,7 +40,7 @@ $ npm install -g @dishantlangayan/solace-cloud-cli
22
40
  $ sc COMMAND
23
41
  running command...
24
42
  $ sc (--version)
25
- @dishantlangayan/solace-cloud-cli/0.1.1 darwin-arm64 node-v24.1.0
43
+ @dishantlangayan/solace-cloud-cli/0.2.1 darwin-arm64 node-v24.1.0
26
44
  $ sc --help [COMMAND]
27
45
  USAGE
28
46
  $ sc COMMAND
@@ -42,9 +60,37 @@ The following Environment variables are optional:
42
60
  * SC_API_VERSION - The API version of the Solace Cloud REST API. Default is `v2`.
43
61
  * SC_BASE_URL - The location of your Solace Home Cloud account determines the base URL you use. Default is `https://api.solace.cloud/`
44
62
 
45
- <!-- configurationtop -->
63
+ <!-- configurationstop -->
64
+ # Resources
65
+ <!-- resources -->
66
+ This is not an officially supported Solace product.
67
+
68
+ For more information try these resources:
69
+ - Ask the [Solace Community](https://solace.community)
70
+ - The Solace Developer Portal website at: https://solace.dev
71
+
72
+ <!-- resourcesstop -->
73
+ # Contributing
74
+ <!-- contributing -->
75
+ Contributions are encouraged! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
76
+
77
+ <!-- contributingstop -->
78
+ # Authors
79
+ <!-- authors -->
80
+ See the list of [contributors](https://github.com/solacelabs/solace-cloud-cli/graphs/contributors) who participated in this project.
81
+
82
+ <!-- authorsstop -->
83
+ # License
84
+ <!-- license -->
85
+ See the [LICENSE](LICENSE) file for details.
86
+
87
+ <!-- licensestop -->
46
88
  # Commands
47
89
  <!-- commands -->
90
+ * [`sc autocomplete [SHELL]`](#sc-autocomplete-shell)
91
+ * [`sc broker queue create`](#sc-broker-queue-create)
92
+ * [`sc broker queue list`](#sc-broker-queue-list)
93
+ * [`sc commands`](#sc-commands)
48
94
  * [`sc help [COMMAND]`](#sc-help-command)
49
95
  * [`sc missionctrl broker create`](#sc-missionctrl-broker-create)
50
96
  * [`sc missionctrl broker delete`](#sc-missionctrl-broker-delete)
@@ -68,6 +114,199 @@ The following Environment variables are optional:
68
114
  * [`sc plugins uninstall [PLUGIN]`](#sc-plugins-uninstall-plugin)
69
115
  * [`sc plugins unlink [PLUGIN]`](#sc-plugins-unlink-plugin)
70
116
  * [`sc plugins update`](#sc-plugins-update)
117
+ * [`sc search`](#sc-search)
118
+ * [`sc update [CHANNEL]`](#sc-update-channel)
119
+ * [`sc version`](#sc-version)
120
+ * [`sc which`](#sc-which)
121
+
122
+ ## `sc autocomplete [SHELL]`
123
+
124
+ Display autocomplete installation instructions.
125
+
126
+ ```
127
+ USAGE
128
+ $ sc autocomplete [SHELL] [-r]
129
+
130
+ ARGUMENTS
131
+ [SHELL] (zsh|bash|powershell) Shell type
132
+
133
+ FLAGS
134
+ -r, --refresh-cache Refresh cache (ignores displaying instructions)
135
+
136
+ DESCRIPTION
137
+ Display autocomplete installation instructions.
138
+
139
+ EXAMPLES
140
+ $ sc autocomplete
141
+
142
+ $ sc autocomplete bash
143
+
144
+ $ sc autocomplete zsh
145
+
146
+ $ sc autocomplete powershell
147
+
148
+ $ sc autocomplete --refresh-cache
149
+ ```
150
+
151
+ _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_
152
+
153
+ ## `sc broker queue create`
154
+
155
+ Create a Queue on a Solace Cloud Broker.
156
+
157
+ ```
158
+ USAGE
159
+ $ sc broker queue create -q <value> [--json] [--log-level debug|warn|error|info|trace] [-a exclusive|non-exclusive] [-b
160
+ <value>] [-n <value>] [--consumer-ack-propagation-enabled] [--dead-msg-queue <value>] [--delivery-count-enabled]
161
+ [--delivery-delay <value>] [--egress-enabled] [--ingress-enabled] [--max-bind-count <value>]
162
+ [--max-delivered-unacked-msgs-per-flow <value>] [--max-msg-size <value>] [-s <value>] [--max-redelivery-count
163
+ <value>] [--max-ttl <value>] [-o <value>] [-p consume|delete|modify-topic|no-access|read-only]
164
+ [--redelivery-delay-enabled] [--redelivery-delay-initial-interval <value>] [--redelivery-delay-max-interval <value>]
165
+ [--redelivery-delay-multiplier <value>] [--redelivery-enabled] [--reject-low-priority-msg-enabled]
166
+ [--reject-low-priority-msg-limit <value>] [--reject-msg-to-sender-on-discard-behavior
167
+ always|never|when-queue-enabled] [--respect-msg-priority-enabled] [--respect-ttl-enabled]
168
+
169
+ FLAGS
170
+ -a, --access-type=<option> [default: exclusive] The access type for the queue.
171
+ <options: exclusive|non-exclusive>
172
+ -b, --broker-id=<value> Id of the event broker service.
173
+ -n, --broker-name=<value> Name of the event broker service.
174
+ -o, --owner=<value> The client username that owns the queue and has permission
175
+ equivalent to delete.
176
+ -p, --permission=<option> [default: no-access] The permission level for all consumers
177
+ of the queue, excluding the owner.
178
+ <options: consume|delete|modify-topic|no-access|read-only>
179
+ -q, --queue-name=<value> (required) The name of the queue to create.
180
+ -s, --max-msg-spool-usage=<value> The maximum message spool usage allowed by the queue, in
181
+ megabytes (MB).
182
+ --[no-]consumer-ack-propagation-enabled Enable or disable the propagation of consumer
183
+ acknowledgments.
184
+ --dead-msg-queue=<value> The name of the Dead Message Queue.
185
+ --[no-]delivery-count-enabled Enable or disable delivery count on the messages.
186
+ --delivery-delay=<value> The delay, in seconds, to apply to messages arriving on the
187
+ queue before the messages are eligible for delivery.
188
+ --[no-]egress-enabled Enable or disable egress (message consumption) from the
189
+ queue.
190
+ --[no-]ingress-enabled Enable or disable ingress (message reception) to the queue.
191
+ --max-bind-count=<value> The maximum number of consumer flows that can bind to the
192
+ queue.
193
+ --max-delivered-unacked-msgs-per-flow=<value> The maximum number of messages delivered but not acknowledged
194
+ per flow.
195
+ --max-msg-size=<value> The maximum message size allowed in the queue, in bytes.
196
+ --max-redelivery-count=<value> The maximum number of times a message will be redelivered
197
+ before it is discarded or moved to the DMQ.
198
+ --max-ttl=<value> The maximum time in seconds a message can stay in the queue
199
+ when respect-ttl-enabled is true.
200
+ --[no-]redelivery-delay-enabled Enable or disable a message redelivery delay.
201
+ --redelivery-delay-initial-interval=<value> The delay to be used between the first 2 redelivery attempts,
202
+ in milliseconds.
203
+ --redelivery-delay-max-interval=<value> The maximum delay to be used between any 2 redelivery
204
+ attempts, in milliseconds.
205
+ --redelivery-delay-multiplier=<value> The amount each delay interval is multiplied by after each
206
+ failed delivery attempt.
207
+ --[no-]redelivery-enabled Enable or disable message redelivery.
208
+ --[no-]reject-low-priority-msg-enabled Enable or disable the checking of low priority messages
209
+ against the reject-low-priority-msg-limit.
210
+ --reject-low-priority-msg-limit=<value> The number of messages of any priority above which low
211
+ priority messages are not admitted.
212
+ --reject-msg-to-sender-on-discard-behavior=<option> Determines when to return negative acknowledgments (NACKs) to
213
+ sending clients on message discards.
214
+ <options: always|never|when-queue-enabled>
215
+ --[no-]respect-msg-priority-enabled Enable or disable the respecting of message priority.
216
+ --[no-]respect-ttl-enabled Enable or disable the respecting of the time-to-live (TTL)
217
+ for messages.
218
+
219
+ GLOBAL FLAGS
220
+ --json Format output as json.
221
+ --log-level=<option> [default: info] Specify level for logging.
222
+ <options: debug|warn|error|info|trace>
223
+
224
+ DESCRIPTION
225
+ Create a Queue on a Solace Cloud Broker.
226
+
227
+ Your token must have one of the permissions listed in the Token Permissions.
228
+
229
+ Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or
230
+ services:view:self ]
231
+
232
+ EXAMPLES
233
+ $ sc broker queue create --broker-id=MyBrokerId --queue-name=myQueue
234
+
235
+ $ sc broker queue create --broker-name=MyBrokerName --queue-name=myQueue --access-type=exclusive
236
+
237
+ $ sc broker queue create --broker-name=MyBrokerName --queue-name=myQueue --owner=user1 --permission=consume
238
+
239
+ $ sc broker queue create --broker-id=MyBrokerId --queue-name=myQueue --max-spool-usage=100 --ingress-enabled --egress-enabled
240
+ ```
241
+
242
+ _See code: [@dishantlangayan/sc-plugin-queue](https://github.com/dishantlangayan/sc-plugin-queue/blob/v0.1.1/src/commands/broker/queue/create.ts)_
243
+
244
+ ## `sc broker queue list`
245
+
246
+ Get a list of Queue objects from the Solace Cloud Broker.
247
+
248
+ ```
249
+ USAGE
250
+ $ sc broker queue list [--json] [--log-level debug|warn|error|info|trace] [-b <value>] [-n <value>] [-c <value>] [-q
251
+ <value>]
252
+
253
+ FLAGS
254
+ -b, --broker-id=<value> Id of the event broker service.
255
+ -c, --count=<value> [default: 10] Limit the number of queues returned
256
+ -n, --broker-name=<value> Name of the event broker service.
257
+ -q, --queue-name=<value> Name of the queue(s) to filter.
258
+
259
+ GLOBAL FLAGS
260
+ --json Format output as json.
261
+ --log-level=<option> [default: info] Specify level for logging.
262
+ <options: debug|warn|error|info|trace>
263
+
264
+ DESCRIPTION
265
+ Get a list of Queue objects from the Solace Cloud Broker.
266
+
267
+ Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or
268
+ services:view:self ]
269
+
270
+ EXAMPLES
271
+ $ sc broker queue list --broker-id=MyBrokerId
272
+
273
+ $ sc broker queue list --broker-name=MyBrokerName
274
+
275
+ $ sc broker queue list --broker-name=MyBrokerName --count=10
276
+
277
+ $ sc broker queue list --broker-name=MyBrokerName --queue-name=test*"
278
+ ```
279
+
280
+ _See code: [@dishantlangayan/sc-plugin-queue](https://github.com/dishantlangayan/sc-plugin-queue/blob/v0.1.1/src/commands/broker/queue/list.ts)_
281
+
282
+ ## `sc commands`
283
+
284
+ List all sc commands.
285
+
286
+ ```
287
+ USAGE
288
+ $ sc commands [--json] [-c id|plugin|summary|type... | --tree] [--deprecated] [-x | ] [--hidden]
289
+ [--no-truncate | ] [--sort id|plugin|summary|type | ]
290
+
291
+ FLAGS
292
+ -c, --columns=<option>... Only show provided columns (comma-separated).
293
+ <options: id|plugin|summary|type>
294
+ -x, --extended Show extra columns.
295
+ --deprecated Show deprecated commands.
296
+ --hidden Show hidden commands.
297
+ --no-truncate Do not truncate output.
298
+ --sort=<option> [default: id] Property to sort by.
299
+ <options: id|plugin|summary|type>
300
+ --tree Show tree of commands.
301
+
302
+ GLOBAL FLAGS
303
+ --json Format output as json.
304
+
305
+ DESCRIPTION
306
+ List all sc commands.
307
+ ```
308
+
309
+ _See code: [@oclif/plugin-commands](https://github.com/oclif/plugin-commands/blob/v4.1.40/src/commands/commands.ts)_
71
310
 
72
311
  ## `sc help [COMMAND]`
73
312
 
@@ -78,7 +317,7 @@ USAGE
78
317
  $ sc help [COMMAND...] [-n]
79
318
 
80
319
  ARGUMENTS
81
- COMMAND... Command to show help for.
320
+ [COMMAND...] Command to show help for.
82
321
 
83
322
  FLAGS
84
323
  -n, --nested-commands Include all nested commands in the output.
@@ -146,7 +385,7 @@ EXAMPLES
146
385
  $ sc missionctrl broker create --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER
147
386
  ```
148
387
 
149
- _See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/create.ts)_
388
+ _See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/create.ts)_
150
389
 
151
390
  ## `sc missionctrl broker delete`
152
391
 
@@ -178,7 +417,7 @@ EXAMPLES
178
417
  $ sc missionctrl broker delete --name=MyBrokerName
179
418
  ```
180
419
 
181
- _See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/delete.ts)_
420
+ _See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/delete.ts)_
182
421
 
183
422
  ## `sc missionctrl broker display`
184
423
 
@@ -209,7 +448,7 @@ EXAMPLES
209
448
  $ sc missionctrl broker display
210
449
  ```
211
450
 
212
- _See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/display.ts)_
451
+ _See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/display.ts)_
213
452
 
214
453
  ## `sc missionctrl broker list`
215
454
 
@@ -246,6 +485,8 @@ GLOBAL FLAGS
246
485
  DESCRIPTION
247
486
  Get a listing of event broker services.
248
487
 
488
+ The maximum number of objects that can be returned in a single page is 100. Default is 10.
489
+
249
490
  Your token must have one of the permissions listed in the Token Permissions.
250
491
 
251
492
  Token Permissions: [ `mission_control:access` **or** `services:get` **or** `services:get:self` **or** `services:view`
@@ -257,7 +498,7 @@ EXAMPLES
257
498
  $ sc missionctrl broker list --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc
258
499
  ```
259
500
 
260
- _See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/list.ts)_
501
+ _See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/list.ts)_
261
502
 
262
503
  ## `sc missionctrl broker opstatus`
263
504
 
@@ -294,7 +535,7 @@ EXAMPLES
294
535
  $ sc missionctrl broker opstatus -n <broker-name>
295
536
  ```
296
537
 
297
- _See code: [src/commands/missionctrl/broker/opstatus.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/opstatus.ts)_
538
+ _See code: [src/commands/missionctrl/broker/opstatus.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/opstatus.ts)_
298
539
 
299
540
  ## `sc missionctrl broker state`
300
541
 
@@ -328,7 +569,7 @@ EXAMPLES
328
569
  $ sc missionctrl broker state --name=MyBrokerName
329
570
  ```
330
571
 
331
- _See code: [src/commands/missionctrl/broker/state.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/state.ts)_
572
+ _See code: [src/commands/missionctrl/broker/state.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/state.ts)_
332
573
 
333
574
  ## `sc missionctrl broker update`
334
575
 
@@ -368,7 +609,7 @@ EXAMPLES
368
609
  $ sc missionctrl broker update --name <name> --new-name <new-name>
369
610
  ```
370
611
 
371
- _See code: [src/commands/missionctrl/broker/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/missionctrl/broker/update.ts)_
612
+ _See code: [src/commands/missionctrl/broker/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/missionctrl/broker/update.ts)_
372
613
 
373
614
  ## `sc platform env create`
374
615
 
@@ -399,10 +640,10 @@ DESCRIPTION
399
640
  Token Permissions: [ environments:edit ]
400
641
 
401
642
  EXAMPLES
402
- $ sc platform env create --name=MyEnvironment --desc="My environment description" --isDefault --isProduction
643
+ $ sc platform env create --name=MyEnvironment --description="My environment description" --isDefault --isProduction
403
644
  ```
404
645
 
405
- _See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/platform/env/create.ts)_
646
+ _See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/platform/env/create.ts)_
406
647
 
407
648
  ## `sc platform env delete`
408
649
 
@@ -432,7 +673,7 @@ EXAMPLES
432
673
  $ sc platform env delete --env-id=MyEnvId
433
674
  ```
434
675
 
435
- _See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/platform/env/delete.ts)_
676
+ _See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/platform/env/delete.ts)_
436
677
 
437
678
  ## `sc platform env display`
438
679
 
@@ -464,7 +705,7 @@ EXAMPLES
464
705
  $ sc platform env display --env-id=MyEnvId
465
706
  ```
466
707
 
467
- _See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/platform/env/display.ts)_
708
+ _See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/platform/env/display.ts)_
468
709
 
469
710
  ## `sc platform env list`
470
711
 
@@ -497,7 +738,7 @@ EXAMPLES
497
738
  $ sc platform env list --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC
498
739
  ```
499
740
 
500
- _See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/platform/env/list.ts)_
741
+ _See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/platform/env/list.ts)_
501
742
 
502
743
  ## `sc platform env update`
503
744
 
@@ -529,12 +770,12 @@ DESCRIPTION
529
770
 
530
771
 
531
772
  EXAMPLES
532
- $ sc platform env update --name=MyEnvName --new-name=MyNewEnvName --desc="My description to update" --isDefault
773
+ $ sc platform env update --name=MyEnvName --new-name=MyNewEnvName --description="My description to update" --isDefault
533
774
 
534
- $ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault
775
+ $ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --description="My description to update" --isDefault
535
776
  ```
536
777
 
537
- _See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.1.1/src/commands/platform/env/update.ts)_
778
+ _See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.1/src/commands/platform/env/update.ts)_
538
779
 
539
780
  ## `sc plugins`
540
781
 
@@ -722,7 +963,7 @@ USAGE
722
963
  $ sc plugins remove [PLUGIN...] [-h] [-v]
723
964
 
724
965
  ARGUMENTS
725
- PLUGIN... plugin to uninstall
966
+ [PLUGIN...] plugin to uninstall
726
967
 
727
968
  FLAGS
728
969
  -h, --help Show CLI help.
@@ -763,7 +1004,7 @@ USAGE
763
1004
  $ sc plugins uninstall [PLUGIN...] [-h] [-v]
764
1005
 
765
1006
  ARGUMENTS
766
- PLUGIN... plugin to uninstall
1007
+ [PLUGIN...] plugin to uninstall
767
1008
 
768
1009
  FLAGS
769
1010
  -h, --help Show CLI help.
@@ -791,7 +1032,7 @@ USAGE
791
1032
  $ sc plugins unlink [PLUGIN...] [-h] [-v]
792
1033
 
793
1034
  ARGUMENTS
794
- PLUGIN... plugin to uninstall
1035
+ [PLUGIN...] plugin to uninstall
795
1036
 
796
1037
  FLAGS
797
1038
  -h, --help Show CLI help.
@@ -825,4 +1066,112 @@ DESCRIPTION
825
1066
  ```
826
1067
 
827
1068
  _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/update.ts)_
1069
+
1070
+ ## `sc search`
1071
+
1072
+ Search for a command.
1073
+
1074
+ ```
1075
+ USAGE
1076
+ $ sc search
1077
+
1078
+ DESCRIPTION
1079
+ Search for a command.
1080
+
1081
+ Once you select a command, hit enter and it will show the help for that command.
1082
+ ```
1083
+
1084
+ _See code: [@oclif/plugin-search](https://github.com/oclif/plugin-search/blob/v1.2.38/src/commands/search.ts)_
1085
+
1086
+ ## `sc update [CHANNEL]`
1087
+
1088
+ update the sc CLI
1089
+
1090
+ ```
1091
+ USAGE
1092
+ $ sc update [CHANNEL] [--force | | [-a | -v <value> | -i]] [-b ]
1093
+
1094
+ FLAGS
1095
+ -a, --available See available versions.
1096
+ -b, --verbose Show more details about the available versions.
1097
+ -i, --interactive Interactively select version to install. This is ignored if a channel is provided.
1098
+ -v, --version=<value> Install a specific version.
1099
+ --force Force a re-download of the requested version.
1100
+
1101
+ DESCRIPTION
1102
+ update the sc CLI
1103
+
1104
+ EXAMPLES
1105
+ Update to the stable channel:
1106
+
1107
+ $ sc update stable
1108
+
1109
+ Update to a specific version:
1110
+
1111
+ $ sc update --version 1.0.0
1112
+
1113
+ Interactively select version:
1114
+
1115
+ $ sc update --interactive
1116
+
1117
+ See available versions:
1118
+
1119
+ $ sc update --available
1120
+ ```
1121
+
1122
+ _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.19/src/commands/update.ts)_
1123
+
1124
+ ## `sc version`
1125
+
1126
+ ```
1127
+ USAGE
1128
+ $ sc version [--json] [--verbose]
1129
+
1130
+ FLAGS
1131
+ --verbose Show additional information about the CLI.
1132
+
1133
+ GLOBAL FLAGS
1134
+ --json Format output as json.
1135
+
1136
+ FLAG DESCRIPTIONS
1137
+ --verbose Show additional information about the CLI.
1138
+
1139
+ Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
1140
+ ```
1141
+
1142
+ _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.36/src/commands/version.ts)_
1143
+
1144
+ ## `sc which`
1145
+
1146
+ Show which plugin a command is in.
1147
+
1148
+ ```
1149
+ USAGE
1150
+ $ sc which [--json]
1151
+
1152
+ GLOBAL FLAGS
1153
+ --json Format output as json.
1154
+
1155
+ DESCRIPTION
1156
+ Show which plugin a command is in.
1157
+
1158
+ EXAMPLES
1159
+ See which plugin the `help` command is in:
1160
+
1161
+ $ sc which help
1162
+
1163
+ Use colon separators.
1164
+
1165
+ $ sc which foo:bar:baz
1166
+
1167
+ Use spaces as separators.
1168
+
1169
+ $ sc which foo bar baz
1170
+
1171
+ Wrap command in quotes to use spaces as separators.
1172
+
1173
+ $ sc which "foo bar baz"
1174
+ ```
1175
+
1176
+ _See code: [@oclif/plugin-which](https://github.com/oclif/plugin-which/blob/v3.2.43/src/commands/which.ts)_
828
1177
  <!-- commandsstop -->
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerCreate extends ScCommand<typeof MissionctrlBrokerCreate> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerCreate extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Create an event broker service. You must provide a unique name and select a service class and datacenter. You can optionally define other properties for the event broker service.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerDelete extends ScCommand<typeof MissionctrlBrokerDelete> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerDelete extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Delete a service using its unique identifier.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerApiResponse, EventBrokerListApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerDisplay extends ScCommand<typeof MissionctrlBrokerDisplay> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerDisplay extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Get the details of an event broker service using its identifier or name.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerListApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerList extends ScCommand<typeof MissionctrlBrokerList> {
4
4
  static args: {};
@@ -1,11 +1,11 @@
1
+ import { renderTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { renderTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerList extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Get a listing of event broker services.
8
6
 
7
+ The maximum number of objects that can be returned in a single page is 100. Default is 10.
8
+
9
9
  Your token must have one of the permissions listed in the Token Permissions.
10
10
 
11
11
  Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \`services:get:self\` **or** \`services:view\` **or** \`services:view:self\` ]`;
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerOperationDetail } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerOpstatus extends ScCommand<typeof MissionctrlBrokerOpstatus> {
4
4
  static args: {};
@@ -1,8 +1,6 @@
1
+ import { renderTable, ScCommand, ScConnection, sleep } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
3
  import { MultiBar, Presets } from 'cli-progress';
3
- import { ScCommand } from '../../../sc-command.js';
4
- import { renderTable, sleep } from '../../../util/internal.js';
5
- import { ScConnection } from '../../../util/sc-connection.js';
6
4
  export default class MissionctrlBrokerOpstatus extends ScCommand {
7
5
  static args = {};
8
6
  static description = `Get the status of all operations being performed on an event broker service.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerRedundancyApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerState extends ScCommand<typeof MissionctrlBrokerState> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerState extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Get the availability state of an event broker service and the name of the active messaging node using the service's unique identifier.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
3
3
  export default class MissionctrlBrokerUpdate extends ScCommand<typeof MissionctrlBrokerUpdate> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class MissionctrlBrokerUpdate extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Update the configuration of an existing event broker service.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EnvironmentApiResponse } from '../../../types/environment.js';
3
3
  export default class PlatformEnvCreate extends ScCommand<typeof PlatformEnvCreate> {
4
4
  static args: {};
@@ -1,14 +1,12 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class PlatformEnvCreate extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Create a new environment.
8
6
 
9
7
  Token Permissions: [ environments:edit ]`;
10
8
  static examples = [
11
- '<%= config.bin %> <%= command.id %> --name=MyEnvironment --desc="My environment description" --isDefault --isProduction',
9
+ '<%= config.bin %> <%= command.id %> --name=MyEnvironment --description="My environment description" --isDefault --isProduction',
12
10
  ];
13
11
  static flags = {
14
12
  description: Flags.string({
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  export default class PlatformEnvDelete extends ScCommand<typeof PlatformEnvDelete> {
3
3
  static args: {};
4
4
  static description: string;
@@ -1,6 +1,5 @@
1
+ import { ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { ScConnection } from '../../../util/sc-connection.js';
4
3
  export default class PlatformEnvDelete extends ScCommand {
5
4
  static args = {};
6
5
  static description = `Delete an environment using either its name or unique identifier. The default environment cannot be deleted.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EnvironmentApiResponse, EnvironmentListApiResponse } from '../../../types/environment.js';
3
3
  export default class PlatformEnvDisplay extends ScCommand<typeof PlatformEnvDisplay> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class PlatformEnvDisplay extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Display information about an Environment.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EnvironmentListApiResponse } from '../../../types/environment.js';
3
3
  export default class PlatformEnvList extends ScCommand<typeof PlatformEnvList> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { renderTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { renderTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class PlatformEnvList extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Get a list of all Environments.
@@ -1,4 +1,4 @@
1
- import { ScCommand } from '../../../sc-command.js';
1
+ import { ScCommand } from '@dishantlangayan/sc-cli-core';
2
2
  import { EnvironmentApiResponse } from '../../../types/environment.js';
3
3
  export default class PlatformEnvUpdate extends ScCommand<typeof PlatformEnvUpdate> {
4
4
  static args: {};
@@ -1,7 +1,5 @@
1
+ import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
1
2
  import { Flags } from '@oclif/core';
2
- import { ScCommand } from '../../../sc-command.js';
3
- import { printObjectAsKeyValueTable } from '../../../util/internal.js';
4
- import { ScConnection } from '../../../util/sc-connection.js';
5
3
  export default class PlatformEnvUpdate extends ScCommand {
6
4
  static args = {};
7
5
  static description = `Modify an environment's attributes
@@ -11,8 +9,8 @@ export default class PlatformEnvUpdate extends ScCommand {
11
9
  Token Permissions: [ environments:edit ]
12
10
  `;
13
11
  static examples = [
14
- '<%= config.bin %> <%= command.id %> --name=MyEnvName --new-name=MyNewEnvName --desc="My description to update" --isDefault',
15
- '<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault',
12
+ '<%= config.bin %> <%= command.id %> --name=MyEnvName --new-name=MyNewEnvName --description="My description to update" --isDefault',
13
+ '<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --description="My description to update" --isDefault',
16
14
  ];
17
15
  static flags = {
18
16
  description: Flags.string({
@@ -256,7 +256,7 @@
256
256
  "missionctrl:broker:list": {
257
257
  "aliases": [],
258
258
  "args": {},
259
- "description": "Get a listing of event broker services.\n\nYour token must have one of the permissions listed in the Token Permissions.\n\nToken Permissions: [ `mission_control:access` **or** `services:get` **or** `services:get:self` **or** `services:view` **or** `services:view:self` ]",
259
+ "description": "Get a listing of event broker services.\n\nThe maximum number of objects that can be returned in a single page is 100. Default is 10.\n\nYour token must have one of the permissions listed in the Token Permissions.\n\nToken Permissions: [ `mission_control:access` **or** `services:get` **or** `services:get:self` **or** `services:view` **or** `services:view:self` ]",
260
260
  "examples": [
261
261
  "<%= config.bin %> <%= command.id %>",
262
262
  "<%= config.bin %> <%= command.id %> --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc"
@@ -566,7 +566,7 @@
566
566
  "args": {},
567
567
  "description": "Create a new environment.\n\n Token Permissions: [ environments:edit ]",
568
568
  "examples": [
569
- "<%= config.bin %> <%= command.id %> --name=MyEnvironment --desc=\"My environment description\" --isDefault --isProduction"
569
+ "<%= config.bin %> <%= command.id %> --name=MyEnvironment --description=\"My environment description\" --isDefault --isProduction"
570
570
  ],
571
571
  "flags": {
572
572
  "json": {
@@ -857,8 +857,8 @@
857
857
  "args": {},
858
858
  "description": "Modify an environment's attributes\n \n Use either the Environment's ID (--env-id) or name of the Environment (--name).\n \n Token Permissions: [ environments:edit ]\n ",
859
859
  "examples": [
860
- "<%= config.bin %> <%= command.id %> --name=MyEnvName --new-name=MyNewEnvName --desc=\"My description to update\" --isDefault",
861
- "<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --desc=\"My description to update\" --isDefault"
860
+ "<%= config.bin %> <%= command.id %> --name=MyEnvName --new-name=MyNewEnvName --description=\"My description to update\" --isDefault",
861
+ "<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --description=\"My description to update\" --isDefault"
862
862
  ],
863
863
  "flags": {
864
864
  "json": {
@@ -940,5 +940,5 @@
940
940
  ]
941
941
  }
942
942
  },
943
- "version": "0.1.1"
943
+ "version": "0.2.1"
944
944
  }
package/package.json CHANGED
@@ -1,16 +1,26 @@
1
1
  {
2
2
  "name": "@dishantlangayan/solace-cloud-cli",
3
3
  "description": "The Solace Cloud CLI",
4
- "version": "0.1.1",
4
+ "version": "0.2.1",
5
5
  "author": "Dishant Langayan",
6
6
  "bin": {
7
7
  "sc": "./bin/run.js"
8
8
  },
9
9
  "bugs": "https://github.com/dishantlangayan/solace-cloud-cli/issues",
10
10
  "dependencies": {
11
+ "@dishantlangayan/sc-cli-core": "^0.1.0",
12
+ "@dishantlangayan/sc-plugin-queue": "^0.1.1",
11
13
  "@oclif/core": "^4",
14
+ "@oclif/plugin-autocomplete": "^3.2.40",
15
+ "@oclif/plugin-commands": "^4.1.40",
12
16
  "@oclif/plugin-help": "^6",
17
+ "@oclif/plugin-not-found": "^3.2.74",
13
18
  "@oclif/plugin-plugins": "^5",
19
+ "@oclif/plugin-search": "^1.2.38",
20
+ "@oclif/plugin-update": "^4.7.19",
21
+ "@oclif/plugin-version": "^2.2.36",
22
+ "@oclif/plugin-warn-if-update-available": "^3.1.55",
23
+ "@oclif/plugin-which": "^3.2.43",
14
24
  "@types/cli-progress": "^3.11.6",
15
25
  "axios": "^1.9.0",
16
26
  "cli-progress": "^3.12.0",
@@ -45,7 +55,10 @@
45
55
  ],
46
56
  "homepage": "https://github.com/dishantlangayan/solace-cloud-cli",
47
57
  "keywords": [
48
- "oclif"
58
+ "oclif",
59
+ "solace",
60
+ "cli",
61
+ "sc"
49
62
  ],
50
63
  "license": "Apache-2.0",
51
64
  "main": "dist/index.js",
@@ -55,15 +68,19 @@
55
68
  "dirname": "sc",
56
69
  "commands": "./dist/commands",
57
70
  "plugins": [
71
+ "@oclif/plugin-autocomplete",
72
+ "@oclif/plugin-commands",
58
73
  "@oclif/plugin-help",
59
- "@oclif/plugin-plugins"
74
+ "@oclif/plugin-not-found",
75
+ "@oclif/plugin-plugins",
76
+ "@oclif/plugin-search",
77
+ "@oclif/plugin-update",
78
+ "@oclif/plugin-version",
79
+ "@oclif/plugin-warn-if-update-available",
80
+ "@oclif/plugin-which",
81
+ "@dishantlangayan/sc-plugin-queue"
60
82
  ],
61
- "topicSeparator": " ",
62
- "topics": {
63
- "hello": {
64
- "description": "Say hello to the world and others"
65
- }
66
- }
83
+ "topicSeparator": " "
67
84
  },
68
85
  "repository": "dishantlangayan/solace-cloud-cli",
69
86
  "scripts": {
@@ -1,22 +0,0 @@
1
- import { Command, Interfaces } from '@oclif/core';
2
- export type Flags<T extends typeof Command> = Interfaces.InferredFlags<T['flags'] & typeof ScCommand['baseFlags']>;
3
- export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
4
- /**
5
- * A base command that provided common functionality for all sc commands.
6
- *
7
- * All implementations of this class need to implement the run() method.
8
- *
9
- */
10
- export declare abstract class ScCommand<T extends typeof Command> extends Command {
11
- static baseFlags: {
12
- 'log-level': Interfaces.OptionFlag<"error" | "warn" | "debug" | "info" | "trace", Interfaces.CustomOptions>;
13
- };
14
- static enableJsonFlag: boolean;
15
- protected args: Args<T>;
16
- protected flags: Flags<T>;
17
- protected catch(err: Error & {
18
- exitCode?: number;
19
- }): Promise<unknown>;
20
- protected finally(_: Error | undefined): Promise<unknown>;
21
- init(): Promise<void>;
22
- }
@@ -1,54 +0,0 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { DefaultBaseUrl, EnvironmentVariable, envVars } from './config/env-vars.js';
3
- /**
4
- * A base command that provided common functionality for all sc commands.
5
- *
6
- * All implementations of this class need to implement the run() method.
7
- *
8
- */
9
- export class ScCommand extends Command {
10
- // define flags that can be inherited by any command that extends BaseCommand
11
- static baseFlags = {
12
- 'log-level': Flags.option({
13
- default: 'info',
14
- helpGroup: 'GLOBAL',
15
- options: ['debug', 'warn', 'error', 'info', 'trace'],
16
- summary: 'Specify level for logging.',
17
- })(),
18
- };
19
- // add the --json flag
20
- static enableJsonFlag = true;
21
- args;
22
- flags;
23
- async catch(err) {
24
- // add any custom logic to handle errors from the command
25
- // or simply return the parent class error handling
26
- return super.catch(err);
27
- }
28
- async finally(_) {
29
- // called after run and catch regardless of whether or not the command errored
30
- return super.finally(_);
31
- }
32
- async init() {
33
- await super.init();
34
- const { args, flags } = await this.parse({
35
- args: this.ctor.args,
36
- baseFlags: super.ctor.baseFlags,
37
- enableJsonFlag: this.ctor.enableJsonFlag,
38
- flags: this.ctor.flags,
39
- strict: this.ctor.strict,
40
- });
41
- this.flags = flags;
42
- this.args = args;
43
- // set base url if not defined in environment variables
44
- if (!envVars.getString(EnvironmentVariable.SC_BASE_URL)) {
45
- this.debug(`Environment variable '${EnvironmentVariable.SC_BASE_URL}' not set, using default '${DefaultBaseUrl}'`);
46
- envVars.setString(EnvironmentVariable.SC_BASE_URL, DefaultBaseUrl);
47
- }
48
- // Check if Access Token is set
49
- const value = envVars.getString(EnvironmentVariable.SC_ACCESS_TOKEN);
50
- if (!value) {
51
- throw new Error(`Environment variable ${EnvironmentVariable.SC_ACCESS_TOKEN} is not set and required for any API operations.`);
52
- }
53
- }
54
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Formats a camel case style `string` into a title case.
3
- *
4
- * @param text Text to transform.
5
- */
6
- export declare function camelCaseToTitleCase(text: string): string;
7
- export interface ColumnConfig {
8
- width?: number;
9
- wrapWord?: boolean;
10
- }
11
- /**
12
- * Prints object data in a formatted key-value table.
13
- * @param data The object data to print
14
- * @returns Formatted table string
15
- */
16
- export declare function printObjectAsKeyValueTable<T extends Record<string, unknown>>(data: T): string;
17
- export declare function renderTable<T>(data: T[][], columnConfig?: Record<number, ColumnConfig>): string;
18
- export declare function renderKeyValueTable<T>(data: T[][], columnConfig?: Record<number, ColumnConfig>): string;
19
- /**
20
- * Sleep function.
21
- * @param ms Num of milliseconds to wait
22
- * @returns Promise that resolves after the specified time
23
- */
24
- export declare function sleep(ms: number): Promise<void>;
25
- export declare const sleepModule: {
26
- sleep: typeof sleep;
27
- };
@@ -1,58 +0,0 @@
1
- import { table } from 'table';
2
- /**
3
- * Formats a camel case style `string` into a title case.
4
- *
5
- * @param text Text to transform.
6
- */
7
- export function camelCaseToTitleCase(text) {
8
- return text
9
- .replaceAll(/(^\w|\s\w)/g, (m) => m.toUpperCase())
10
- .replaceAll(/([A-Z][a-z]+)/g, ' $1')
11
- .replaceAll(/\s{2,}/g, ' ')
12
- .trim();
13
- }
14
- /**
15
- * Prints object data in a formatted key-value table.
16
- * @param data The object data to print
17
- * @returns Formatted table string
18
- */
19
- export function printObjectAsKeyValueTable(data) {
20
- const tableRows = [
21
- ['Key', 'Value'],
22
- ...Object.entries(data).map(([key, value]) => [camelCaseToTitleCase(key), value]),
23
- ];
24
- return renderKeyValueTable(tableRows);
25
- }
26
- export function renderTable(data, columnConfig) {
27
- // Table config
28
- const tableConfig = {
29
- columns: columnConfig,
30
- };
31
- const tableStr = table(data, tableConfig);
32
- return tableStr;
33
- }
34
- export function renderKeyValueTable(data, columnConfig) {
35
- if (columnConfig === undefined) {
36
- columnConfig = { 1: { width: 50, wrapWord: true } };
37
- }
38
- // Table config
39
- const tableConfig = {
40
- columns: columnConfig,
41
- drawHorizontalLine(lineIndex, rowCount) {
42
- return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
43
- },
44
- };
45
- const tableStr = table(data, tableConfig);
46
- return tableStr;
47
- }
48
- /**
49
- * Sleep function.
50
- * @param ms Num of milliseconds to wait
51
- * @returns Promise that resolves after the specified time
52
- */
53
- export function sleep(ms) {
54
- return new Promise((resolve) => {
55
- setTimeout(resolve, ms);
56
- });
57
- }
58
- export const sleepModule = { sleep };
@@ -1,15 +0,0 @@
1
- /**
2
- * Parse JSON `string` data.
3
- *
4
- * @param data Data to parse.
5
- */
6
- export declare function parseJson(data: string, _throwOnEmpty?: boolean): unknown;
7
- /**
8
- * Finds a the key with the provided value in the JSON array and returns the JSON object.
9
- *
10
- * @param array The JSON array to search
11
- * @param key The key to lookup in the array
12
- * @param value The value of the key to match
13
- * @returns The JSON object that matches the key and value
14
- */
15
- export declare function findByKey<T>(array: T[], key: keyof T, value: unknown): T | undefined;
package/dist/util/json.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Parse JSON `string` data.
3
- *
4
- * @param data Data to parse.
5
- */
6
- export function parseJson(data, _throwOnEmpty = true) {
7
- return typeof data === 'string' ? JSON.parse(data) : data;
8
- }
9
- /**
10
- * Finds a the key with the provided value in the JSON array and returns the JSON object.
11
- *
12
- * @param array The JSON array to search
13
- * @param key The key to lookup in the array
14
- * @param value The value of the key to match
15
- * @returns The JSON object that matches the key and value
16
- */
17
- export function findByKey(array, key, value) {
18
- return array.find(item => item[key] === value);
19
- }
@@ -1,13 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- export declare class ScConnection {
3
- private axiosInstance;
4
- private endpointUrl;
5
- constructor(baseURL?: string, accessToken?: string, timeout?: number);
6
- delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
7
- get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
8
- patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
9
- post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
10
- put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
11
- private joinPaths;
12
- }
13
- export default ScConnection;
@@ -1,52 +0,0 @@
1
- import axios from 'axios';
2
- import { DefaultBaseUrl, EnvironmentVariable, envVars } from '../config/env-vars.js';
3
- export class ScConnection {
4
- axiosInstance;
5
- endpointUrl = '';
6
- constructor(baseURL = envVars.getString(EnvironmentVariable.SC_BASE_URL, DefaultBaseUrl), accessToken = envVars.getString(EnvironmentVariable.SC_ACCESS_TOKEN, ''), timeout = 10_000) {
7
- const apiVersion = envVars.getString(EnvironmentVariable.SC_API_VERSION, 'v2');
8
- this.endpointUrl = this.joinPaths(baseURL, `/api/${apiVersion}`);
9
- this.axiosInstance = axios.create({
10
- baseURL: this.endpointUrl,
11
- headers: {
12
- 'Authorization': `Bearer ${accessToken}`,
13
- 'Content-Type': 'application/json',
14
- },
15
- timeout,
16
- });
17
- // Add interceptors if needed
18
- this.axiosInstance.interceptors.response.use((response) => response, (error) => {
19
- console.error('API Error:', error.response?.data || error.message);
20
- return Promise.reject(error);
21
- });
22
- }
23
- // DELETE request
24
- async delete(url, config) {
25
- const response = await this.axiosInstance.delete(url, config);
26
- return response.data;
27
- }
28
- // GET request
29
- async get(url, config) {
30
- const response = await this.axiosInstance.get(url, config);
31
- return response.data;
32
- }
33
- // PATCH request
34
- async patch(url, data, config) {
35
- const response = await this.axiosInstance.patch(url, data, config);
36
- return response.data;
37
- }
38
- // POST request
39
- async post(url, data, config) {
40
- const response = await this.axiosInstance.post(url, data, config);
41
- return response.data;
42
- }
43
- // PUT request
44
- async put(url, data, config) {
45
- const response = await this.axiosInstance.put(url, data, config);
46
- return response.data;
47
- }
48
- joinPaths(base, path) {
49
- return `${base.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
50
- }
51
- }
52
- export default ScConnection;