@knocklabs/cli 0.1.22 → 0.1.23

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 (55) hide show
  1. package/README.md +102 -43
  2. package/dist/commands/commit/list.js +21 -1
  3. package/dist/commands/guide/activate.js +121 -0
  4. package/dist/commands/guide/generate-types.js +148 -0
  5. package/dist/commands/guide/get.js +139 -0
  6. package/dist/commands/guide/list.js +112 -0
  7. package/dist/commands/guide/pull.js +209 -0
  8. package/dist/commands/guide/push.js +171 -0
  9. package/dist/commands/guide/validate.js +148 -0
  10. package/dist/commands/workflow/generate-types.js +6 -5
  11. package/dist/lib/api-v1.js +61 -0
  12. package/dist/lib/helpers/const.js +4 -4
  13. package/dist/lib/helpers/date.js +3 -3
  14. package/dist/lib/helpers/error.js +8 -8
  15. package/dist/lib/helpers/flag.js +7 -7
  16. package/dist/lib/helpers/json.js +5 -5
  17. package/dist/lib/helpers/object.isomorphic.js +8 -8
  18. package/dist/lib/helpers/page.js +9 -9
  19. package/dist/lib/helpers/request.js +4 -4
  20. package/dist/lib/helpers/string.js +3 -3
  21. package/dist/lib/helpers/typegen.js +59 -0
  22. package/dist/lib/helpers/ux.js +3 -3
  23. package/dist/lib/marshal/email-layout/helpers.js +5 -5
  24. package/dist/lib/marshal/email-layout/processor.isomorphic.js +3 -3
  25. package/dist/lib/marshal/email-layout/reader.js +5 -5
  26. package/dist/lib/marshal/email-layout/writer.js +4 -4
  27. package/dist/lib/marshal/guide/helpers.js +283 -0
  28. package/dist/lib/marshal/guide/index.js +3 -0
  29. package/dist/lib/marshal/guide/processor.isomorphic.js +3 -3
  30. package/dist/lib/marshal/guide/reader.js +193 -0
  31. package/dist/lib/marshal/guide/writer.js +175 -0
  32. package/dist/lib/marshal/index.isomorphic.js +7 -7
  33. package/dist/lib/marshal/message-type/helpers.js +5 -5
  34. package/dist/lib/marshal/message-type/processor.isomorphic.js +3 -3
  35. package/dist/lib/marshal/message-type/reader.js +5 -5
  36. package/dist/lib/marshal/message-type/writer.js +4 -4
  37. package/dist/lib/marshal/partial/helpers.js +5 -5
  38. package/dist/lib/marshal/partial/processor.isomorphic.js +3 -3
  39. package/dist/lib/marshal/partial/reader.js +5 -5
  40. package/dist/lib/marshal/partial/writer.js +4 -4
  41. package/dist/lib/marshal/shared/const.isomorphic.js +3 -3
  42. package/dist/lib/marshal/shared/helpers.isomorphic.js +9 -2
  43. package/dist/lib/marshal/shared/helpers.js +4 -4
  44. package/dist/lib/marshal/translation/helpers.js +10 -10
  45. package/dist/lib/marshal/translation/processor.isomorphic.js +6 -6
  46. package/dist/lib/marshal/translation/writer.js +3 -3
  47. package/dist/lib/marshal/workflow/generator.js +4 -4
  48. package/dist/lib/marshal/workflow/helpers.js +53 -10
  49. package/dist/lib/marshal/workflow/processor.isomorphic.js +5 -5
  50. package/dist/lib/marshal/workflow/reader.js +5 -5
  51. package/dist/lib/marshal/workflow/writer.js +5 -5
  52. package/dist/lib/resources.js +3 -3
  53. package/oclif.manifest.json +615 -54
  54. package/package.json +8 -8
  55. package/dist/lib/type-generator.js +0 -100
package/README.md CHANGED
@@ -16,7 +16,7 @@ $ npm install -g @knocklabs/cli
16
16
  $ knock COMMAND
17
17
  running command...
18
18
  $ knock (--version)
19
- @knocklabs/cli/0.1.22 linux-x64 node-v18.20.8
19
+ @knocklabs/cli/0.1.23 linux-x64 node-v18.20.8
20
20
  $ knock --help [COMMAND]
21
21
  USAGE
22
22
  $ knock COMMAND
@@ -31,6 +31,8 @@ USAGE
31
31
  * [`knock commit get ID`](#knock-commit-get-id)
32
32
  * [`knock commit list`](#knock-commit-list)
33
33
  * [`knock commit promote`](#knock-commit-promote)
34
+ * [`knock guide activate GUIDEKEY`](#knock-guide-activate-guidekey)
35
+ * [`knock guide generate-types`](#knock-guide-generate-types)
34
36
  * [`knock help [COMMAND]`](#knock-help-command)
35
37
  * [`knock layout get EMAILLAYOUTKEY`](#knock-layout-get-emaillayoutkey)
36
38
  * [`knock layout list`](#knock-layout-list)
@@ -76,7 +78,7 @@ FLAGS
76
78
  --service-token=<value> (required) The service token to authenticate with.
77
79
  ```
78
80
 
79
- _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/index.ts)_
81
+ _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/index.ts)_
80
82
 
81
83
  ## `knock commit get ID`
82
84
 
@@ -93,7 +95,7 @@ GLOBAL FLAGS
93
95
  --json Format output as json.
94
96
  ```
95
97
 
96
- _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/get.ts)_
98
+ _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/get.ts)_
97
99
 
98
100
  ## `knock commit list`
99
101
 
@@ -101,23 +103,29 @@ Display all commits in an environment
101
103
 
102
104
  ```
103
105
  USAGE
104
- $ knock commit list --service-token <value> [--json] [--environment <value>] [--promoted] [--after <value>]
105
- [--before <value>] [--limit <value>]
106
+ $ knock commit list --service-token <value> [--json] [--environment <value>] [--promoted] [--resource-type
107
+ email_layout|guide|message_type|partial|translation|workflow] [--resource-id <value>] [--after <value>] [--before
108
+ <value>] [--limit <value>]
106
109
 
107
110
  FLAGS
108
- --after=<value> The cursor after which to fetch the next page.
109
- --before=<value> The cursor before which to fetch the previous page.
110
- --environment=<value> [default: development] The environment to use.
111
- --limit=<value> The total number of entries to fetch per page.
112
- --[no-]promoted Show only promoted or unpromoted changes between the given environment and the subsequent
113
- environment.
114
- --service-token=<value> (required) The service token to authenticate with.
111
+ --after=<value> The cursor after which to fetch the next page.
112
+ --before=<value> The cursor before which to fetch the previous page.
113
+ --environment=<value> [default: development] The environment to use.
114
+ --limit=<value> The total number of entries to fetch per page.
115
+ --[no-]promoted Show only promoted or unpromoted changes between the given environment and the subsequent
116
+ environment.
117
+ --resource-id=<value> Filter commits by resource identifier. Must be used together with resource-type. For most
118
+ resources, this will be the resource key. In the case of translations, this will be the
119
+ locale code and namespace, separated by a /. For example, en/courses or en.
120
+ --resource-type=<option> Filter commits by resource type. Must be used together with resource-id.
121
+ <options: email_layout|guide|message_type|partial|translation|workflow>
122
+ --service-token=<value> (required) The service token to authenticate with.
115
123
 
116
124
  GLOBAL FLAGS
117
125
  --json Format output as json.
118
126
  ```
119
127
 
120
- _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/list.ts)_
128
+ _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/list.ts)_
121
129
 
122
130
  ## `knock commit promote`
123
131
 
@@ -134,7 +142,58 @@ FLAGS
134
142
  --to=<value> The destination environment to promote all changes from the preceding environment.
135
143
  ```
136
144
 
137
- _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/promote.ts)_
145
+ _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/promote.ts)_
146
+
147
+ ## `knock guide activate GUIDEKEY`
148
+
149
+ Activate or deactivate a guide in a given environment.
150
+
151
+ ```
152
+ USAGE
153
+ $ knock guide activate GUIDEKEY --service-token <value> --environment <value> [--status true|false | --from
154
+ <value> | --until <value>] [--force]
155
+
156
+ FLAGS
157
+ --environment=<value> (required) The environment to use.
158
+ --force Remove the confirmation prompt.
159
+ --from=<value> Activate the guide from this ISO8601 UTC datetime (e.g., '2024-01-15T10:30:00Z').
160
+ --service-token=<value> (required) The service token to authenticate with.
161
+ --status=<option> The guide active status to set. Cannot be used with --from/--until.
162
+ <options: true|false>
163
+ --until=<value> Deactivate the guide at this ISO8601 UTC datetime (e.g., '2024-01-15T18:30:00Z').
164
+
165
+ DESCRIPTION
166
+ Activate or deactivate a guide in a given environment.
167
+
168
+ This enables or disables a guide in a given environment without
169
+ needing to go through environment promotion.
170
+
171
+ You can activate or deactivate a guide immediately or schedule it to be activated
172
+ or deactivated at a later time using the --from and --until flags.
173
+ ```
174
+
175
+ _See code: [src/commands/guide/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/guide/activate.ts)_
176
+
177
+ ## `knock guide generate-types`
178
+
179
+ Generate types for all guides in an environment and write them to a file.
180
+
181
+ ```
182
+ USAGE
183
+ $ knock guide generate-types --service-token <value> --output-file <value> [--environment <value>]
184
+
185
+ FLAGS
186
+ --environment=<value> [default: development] Select the environment to generate types for.
187
+ --output-file=<value> (required) The output file to write the generated types to. We currently support .ts, .py,
188
+ .go, .rb files only. Your file extension will determine the target language for the generated
189
+ types.
190
+ --service-token=<value> (required) The service token to authenticate with.
191
+
192
+ DESCRIPTION
193
+ Generate types for all guides in an environment and write them to a file.
194
+ ```
195
+
196
+ _See code: [src/commands/guide/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/guide/generate-types.ts)_
138
197
 
139
198
  ## `knock help [COMMAND]`
140
199
 
@@ -154,7 +213,7 @@ DESCRIPTION
154
213
  Display help for knock.
155
214
  ```
156
215
 
157
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.28/src/commands/help.ts)_
216
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.32/src/commands/help.ts)_
158
217
 
159
218
  ## `knock layout get EMAILLAYOUTKEY`
160
219
 
@@ -174,7 +233,7 @@ GLOBAL FLAGS
174
233
  --json Format output as json.
175
234
  ```
176
235
 
177
- _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/get.ts)_
236
+ _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/get.ts)_
178
237
 
179
238
  ## `knock layout list`
180
239
 
@@ -197,7 +256,7 @@ GLOBAL FLAGS
197
256
  --json Format output as json.
198
257
  ```
199
258
 
200
- _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/list.ts)_
259
+ _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/list.ts)_
201
260
 
202
261
  ## `knock layout pull [EMAILLAYOUTKEY]`
203
262
 
@@ -217,7 +276,7 @@ FLAGS
217
276
  --service-token=<value> (required) The service token to authenticate with.
218
277
  ```
219
278
 
220
- _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/pull.ts)_
279
+ _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/pull.ts)_
221
280
 
222
281
  ## `knock layout push [EMAILLAYOUTKEY]`
223
282
 
@@ -239,7 +298,7 @@ FLAGS
239
298
  --service-token=<value> (required) The service token to authenticate with.
240
299
  ```
241
300
 
242
- _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/push.ts)_
301
+ _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/push.ts)_
243
302
 
244
303
  ## `knock layout validate [EMAILLAYOUTKEY]`
245
304
 
@@ -258,7 +317,7 @@ FLAGS
258
317
  --service-token=<value> (required) The service token to authenticate with.
259
318
  ```
260
319
 
261
- _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/validate.ts)_
320
+ _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/validate.ts)_
262
321
 
263
322
  ## `knock partial get PARTIALKEY`
264
323
 
@@ -278,7 +337,7 @@ GLOBAL FLAGS
278
337
  --json Format output as json.
279
338
  ```
280
339
 
281
- _See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/get.ts)_
340
+ _See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/get.ts)_
282
341
 
283
342
  ## `knock partial list`
284
343
 
@@ -301,7 +360,7 @@ GLOBAL FLAGS
301
360
  --json Format output as json.
302
361
  ```
303
362
 
304
- _See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/list.ts)_
363
+ _See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/list.ts)_
305
364
 
306
365
  ## `knock partial pull [PARTIALKEY]`
307
366
 
@@ -321,7 +380,7 @@ FLAGS
321
380
  --service-token=<value> (required) The service token to authenticate with.
322
381
  ```
323
382
 
324
- _See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/pull.ts)_
383
+ _See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/pull.ts)_
325
384
 
326
385
  ## `knock partial push [PARTIALKEY]`
327
386
 
@@ -342,7 +401,7 @@ FLAGS
342
401
  --service-token=<value> (required) The service token to authenticate with.
343
402
  ```
344
403
 
345
- _See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/push.ts)_
404
+ _See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/push.ts)_
346
405
 
347
406
  ## `knock partial validate [PARTIALKEY]`
348
407
 
@@ -361,7 +420,7 @@ FLAGS
361
420
  --service-token=<value> (required) The service token to authenticate with.
362
421
  ```
363
422
 
364
- _See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/validate.ts)_
423
+ _See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/validate.ts)_
365
424
 
366
425
  ## `knock pull`
367
426
 
@@ -380,7 +439,7 @@ FLAGS
380
439
  --service-token=<value> (required) The service token to authenticate with.
381
440
  ```
382
441
 
383
- _See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/pull.ts)_
442
+ _See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/pull.ts)_
384
443
 
385
444
  ## `knock push`
386
445
 
@@ -400,7 +459,7 @@ FLAGS
400
459
  --service-token=<value> (required) The service token to authenticate with.
401
460
  ```
402
461
 
403
- _See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/push.ts)_
462
+ _See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/push.ts)_
404
463
 
405
464
  ## `knock translation get TRANSLATIONREF`
406
465
 
@@ -427,7 +486,7 @@ GLOBAL FLAGS
427
486
  --json Format output as json.
428
487
  ```
429
488
 
430
- _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/get.ts)_
489
+ _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/get.ts)_
431
490
 
432
491
  ## `knock translation list`
433
492
 
@@ -450,7 +509,7 @@ GLOBAL FLAGS
450
509
  --json Format output as json.
451
510
  ```
452
511
 
453
- _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/list.ts)_
512
+ _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/list.ts)_
454
513
 
455
514
  ## `knock translation pull [TRANSLATIONREF]`
456
515
 
@@ -477,7 +536,7 @@ FLAGS
477
536
  --translations-dir=<value> The target directory path to pull all translations into.
478
537
  ```
479
538
 
480
- _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/pull.ts)_
539
+ _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/pull.ts)_
481
540
 
482
541
  ## `knock translation push [TRANSLATIONREF]`
483
542
 
@@ -504,7 +563,7 @@ FLAGS
504
563
  --translations-dir=<value> The target directory path to find all translations to push.
505
564
  ```
506
565
 
507
- _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/push.ts)_
566
+ _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/push.ts)_
508
567
 
509
568
  ## `knock translation validate [TRANSLATIONREF]`
510
569
 
@@ -529,7 +588,7 @@ FLAGS
529
588
  --translations-dir=<value> The target directory path to find all translations to validate.
530
589
  ```
531
590
 
532
- _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/validate.ts)_
591
+ _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/validate.ts)_
533
592
 
534
593
  ## `knock whoami`
535
594
 
@@ -546,7 +605,7 @@ GLOBAL FLAGS
546
605
  --json Format output as json.
547
606
  ```
548
607
 
549
- _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/whoami.ts)_
608
+ _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/whoami.ts)_
550
609
 
551
610
  ## `knock workflow activate WORKFLOWKEY`
552
611
 
@@ -573,11 +632,11 @@ DESCRIPTION
573
632
  with `false` in order to deactivate it.
574
633
  ```
575
634
 
576
- _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/activate.ts)_
635
+ _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/activate.ts)_
577
636
 
578
637
  ## `knock workflow generate-types`
579
638
 
580
- Generate types for all workflows in the development environment and write them to a file.
639
+ Generate types for all workflows in an environment and write them to a file.
581
640
 
582
641
  ```
583
642
  USAGE
@@ -591,10 +650,10 @@ FLAGS
591
650
  --service-token=<value> (required) The service token to authenticate with.
592
651
 
593
652
  DESCRIPTION
594
- Generate types for all workflows in the development environment and write them to a file.
653
+ Generate types for all workflows in an environment and write them to a file.
595
654
  ```
596
655
 
597
- _See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/generate-types.ts)_
656
+ _See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/generate-types.ts)_
598
657
 
599
658
  ## `knock workflow get WORKFLOWKEY`
600
659
 
@@ -614,7 +673,7 @@ GLOBAL FLAGS
614
673
  --json Format output as json.
615
674
  ```
616
675
 
617
- _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/get.ts)_
676
+ _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/get.ts)_
618
677
 
619
678
  ## `knock workflow list`
620
679
 
@@ -637,7 +696,7 @@ GLOBAL FLAGS
637
696
  --json Format output as json.
638
697
  ```
639
698
 
640
- _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/list.ts)_
699
+ _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/list.ts)_
641
700
 
642
701
  ## `knock workflow pull [WORKFLOWKEY]`
643
702
 
@@ -657,7 +716,7 @@ FLAGS
657
716
  --workflows-dir=<value> The target directory path to pull all workflows into.
658
717
  ```
659
718
 
660
- _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/pull.ts)_
719
+ _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/pull.ts)_
661
720
 
662
721
  ## `knock workflow push [WORKFLOWKEY]`
663
722
 
@@ -678,7 +737,7 @@ FLAGS
678
737
  --workflows-dir=<value> The target directory path to find all workflows to push.
679
738
  ```
680
739
 
681
- _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/push.ts)_
740
+ _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/push.ts)_
682
741
 
683
742
  ## `knock workflow run WORKFLOWKEY`
684
743
 
@@ -699,7 +758,7 @@ FLAGS
699
758
  --tenant=<value> A tenant id for the workflow run.
700
759
  ```
701
760
 
702
- _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/run.ts)_
761
+ _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/run.ts)_
703
762
 
704
763
  ## `knock workflow validate [WORKFLOWKEY]`
705
764
 
@@ -718,5 +777,5 @@ FLAGS
718
777
  --workflows-dir=<value> The target directory path to find all workflows to validate.
719
778
  ```
720
779
 
721
- _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/validate.ts)_
780
+ _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/validate.ts)_
722
781
  <!-- commandsstop -->
@@ -35,8 +35,14 @@ function _interop_require_default(obj) {
35
35
  }
36
36
  class CommitList extends _basecommand.default {
37
37
  async run() {
38
- const resp = await this.request();
38
+ // Validate that resource-type and resource-id are used together
39
39
  const { flags } = this.props;
40
+ const hasResourceType = Boolean(flags["resource-type"]);
41
+ const hasResourceId = Boolean(flags["resource-id"]);
42
+ if (hasResourceType !== hasResourceId) {
43
+ this.error("The --resource-type and --resource-id flags must be used together. " + "You cannot use one without the other.");
44
+ }
45
+ const resp = await this.request();
40
46
  if (flags.json) return resp.data;
41
47
  this.render(resp.data);
42
48
  }
@@ -109,6 +115,20 @@ _define_property(CommitList, "flags", {
109
115
  summary: "Show only promoted or unpromoted changes between the given environment and the subsequent environment.",
110
116
  allowNo: true
111
117
  }),
118
+ "resource-type": _core.Flags.string({
119
+ summary: "Filter commits by resource type. Must be used together with resource-id.",
120
+ options: [
121
+ "email_layout",
122
+ "guide",
123
+ "message_type",
124
+ "partial",
125
+ "translation",
126
+ "workflow"
127
+ ]
128
+ }),
129
+ "resource-id": _core.Flags.string({
130
+ summary: "Filter commits by resource identifier. Must be used together with resource-type. For most resources, this will be the resource key. In the case of translations, this will be the locale code and namespace, separated by a /. For example, en/courses or en."
131
+ }),
112
132
  ..._page.pageFlags
113
133
  });
114
134
  _define_property(CommitList, "enableJsonFlag", true);
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return GuideActivate;
9
+ }
10
+ });
11
+ const _core = require("@oclif/core");
12
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
+ const _flag = require("../../lib/helpers/flag");
14
+ const _request = require("../../lib/helpers/request");
15
+ const _ux = require("../../lib/helpers/ux");
16
+ function _define_property(obj, key, value) {
17
+ if (key in obj) {
18
+ Object.defineProperty(obj, key, {
19
+ value: value,
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true
23
+ });
24
+ } else {
25
+ obj[key] = value;
26
+ }
27
+ return obj;
28
+ }
29
+ function _interop_require_default(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ class GuideActivate extends _basecommand.default {
35
+ async run() {
36
+ const { args, flags } = this.props;
37
+ // Validate that either status OR from/until is provided
38
+ const hasStatus = flags.status !== undefined;
39
+ const hasFrom = Boolean(flags.from);
40
+ const hasUntil = Boolean(flags.until);
41
+ if (!hasStatus && !hasFrom && !hasUntil) {
42
+ this.error("Either --status or --from/--until must be provided");
43
+ }
44
+ let action;
45
+ if (hasStatus) {
46
+ action = flags.status ? "Activate" : "Deactivate";
47
+ } else if (hasFrom && hasUntil) {
48
+ action = `Schedule activation from ${flags.from} until ${flags.until}`;
49
+ } else if (hasFrom) {
50
+ action = `Activate from ${flags.from}`;
51
+ } else {
52
+ action = `Deactivate at ${flags.until}`;
53
+ }
54
+ // 1. Confirm before activating or deactivating the guide, unless forced.
55
+ const prompt = `${action} \`${args.guideKey}\` guide in \`${flags.environment}\` environment?`;
56
+ const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
57
+ if (!input) return;
58
+ // 2. Proceed to make a request to set the guide status.
59
+ let actioning;
60
+ if (hasStatus) {
61
+ actioning = flags.status ? "Activating" : "Deactivating";
62
+ } else {
63
+ actioning = "Scheduling activation";
64
+ }
65
+ await (0, _request.withSpinner)(()=>{
66
+ return this.apiV1.activateGuide(this.props);
67
+ }, {
68
+ action: `‣ ${actioning}`
69
+ });
70
+ let actioned;
71
+ if (hasStatus) {
72
+ actioned = flags.status ? "activated" : "deactivated";
73
+ } else {
74
+ actioned = "scheduled";
75
+ }
76
+ this.log(`‣ Successfully ${actioned} \`${args.guideKey}\` guide in \`${flags.environment}\` environment`);
77
+ }
78
+ }
79
+ _define_property(GuideActivate, "summary", "Activate or deactivate a guide in a given environment.");
80
+ _define_property(GuideActivate, "description", `
81
+ This enables or disables a guide in a given environment without
82
+ needing to go through environment promotion.
83
+
84
+ You can activate or deactivate a guide immediately or schedule it to be activated
85
+ or deactivated at a later time using the --from and --until flags.
86
+ `.trim());
87
+ _define_property(GuideActivate, "flags", {
88
+ // Do not default to any env for this command, since this action runs
89
+ // directly in each environment outside the commit and promote flow.
90
+ environment: _core.Flags.string({
91
+ required: true,
92
+ summary: "The environment to use."
93
+ }),
94
+ status: (0, _flag.booleanStr)({
95
+ summary: "The guide active status to set. Cannot be used with --from/--until.",
96
+ exclusive: [
97
+ "from",
98
+ "until"
99
+ ]
100
+ }),
101
+ from: _core.Flags.string({
102
+ summary: "Activate the guide from this ISO8601 UTC datetime (e.g., '2024-01-15T10:30:00Z').",
103
+ exclusive: [
104
+ "status"
105
+ ]
106
+ }),
107
+ until: _core.Flags.string({
108
+ summary: "Deactivate the guide at this ISO8601 UTC datetime (e.g., '2024-01-15T18:30:00Z').",
109
+ exclusive: [
110
+ "status"
111
+ ]
112
+ }),
113
+ force: _core.Flags.boolean({
114
+ summary: "Remove the confirmation prompt."
115
+ })
116
+ });
117
+ _define_property(GuideActivate, "args", {
118
+ guideKey: _core.Args.string({
119
+ required: true
120
+ })
121
+ });