@knocklabs/cli 0.1.21 → 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.
- package/README.md +141 -41
- package/dist/commands/commit/list.js +21 -1
- package/dist/commands/guide/activate.js +121 -0
- package/dist/commands/guide/generate-types.js +148 -0
- package/dist/commands/guide/get.js +139 -0
- package/dist/commands/guide/list.js +112 -0
- package/dist/commands/guide/pull.js +209 -0
- package/dist/commands/guide/push.js +171 -0
- package/dist/commands/guide/validate.js +148 -0
- package/dist/commands/pull.js +157 -0
- package/dist/commands/push.js +175 -0
- package/dist/commands/workflow/generate-types.js +6 -5
- package/dist/lib/api-v1.js +61 -0
- package/dist/lib/helpers/const.js +4 -4
- package/dist/lib/helpers/date.js +3 -3
- package/dist/lib/helpers/error.js +8 -8
- package/dist/lib/helpers/flag.js +7 -7
- package/dist/lib/helpers/json.js +5 -5
- package/dist/lib/helpers/object.isomorphic.js +8 -8
- package/dist/lib/helpers/page.js +9 -9
- package/dist/lib/helpers/request.js +4 -4
- package/dist/lib/helpers/string.js +3 -3
- package/dist/lib/helpers/typegen.js +59 -0
- package/dist/lib/helpers/ux.js +3 -3
- package/dist/lib/marshal/email-layout/helpers.js +5 -5
- package/dist/lib/marshal/email-layout/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/email-layout/reader.js +5 -5
- package/dist/lib/marshal/email-layout/writer.js +4 -4
- package/dist/lib/marshal/guide/helpers.js +283 -0
- package/dist/lib/marshal/guide/index.js +3 -0
- package/dist/lib/marshal/guide/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/guide/reader.js +193 -0
- package/dist/lib/marshal/guide/writer.js +175 -0
- package/dist/lib/marshal/index.isomorphic.js +7 -7
- package/dist/lib/marshal/message-type/helpers.js +5 -5
- package/dist/lib/marshal/message-type/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/message-type/reader.js +5 -5
- package/dist/lib/marshal/message-type/writer.js +4 -4
- package/dist/lib/marshal/partial/helpers.js +5 -5
- package/dist/lib/marshal/partial/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/partial/reader.js +5 -5
- package/dist/lib/marshal/partial/writer.js +4 -4
- package/dist/lib/marshal/shared/const.isomorphic.js +3 -3
- package/dist/lib/marshal/shared/helpers.isomorphic.js +9 -2
- package/dist/lib/marshal/shared/helpers.js +4 -4
- package/dist/lib/marshal/translation/helpers.js +10 -10
- package/dist/lib/marshal/translation/processor.isomorphic.js +6 -6
- package/dist/lib/marshal/translation/writer.js +3 -3
- package/dist/lib/marshal/workflow/generator.js +4 -4
- package/dist/lib/marshal/workflow/helpers.js +53 -10
- package/dist/lib/marshal/workflow/processor.isomorphic.js +5 -5
- package/dist/lib/marshal/workflow/reader.js +5 -5
- package/dist/lib/marshal/workflow/writer.js +5 -5
- package/dist/lib/resources.js +32 -0
- package/oclif.manifest.json +961 -260
- package/package.json +8 -8
- 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.
|
|
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)
|
|
@@ -42,6 +44,8 @@ USAGE
|
|
|
42
44
|
* [`knock partial pull [PARTIALKEY]`](#knock-partial-pull-partialkey)
|
|
43
45
|
* [`knock partial push [PARTIALKEY]`](#knock-partial-push-partialkey)
|
|
44
46
|
* [`knock partial validate [PARTIALKEY]`](#knock-partial-validate-partialkey)
|
|
47
|
+
* [`knock pull`](#knock-pull)
|
|
48
|
+
* [`knock push`](#knock-push)
|
|
45
49
|
* [`knock translation get TRANSLATIONREF`](#knock-translation-get-translationref)
|
|
46
50
|
* [`knock translation list`](#knock-translation-list)
|
|
47
51
|
* [`knock translation pull [TRANSLATIONREF]`](#knock-translation-pull-translationref)
|
|
@@ -74,7 +78,7 @@ FLAGS
|
|
|
74
78
|
--service-token=<value> (required) The service token to authenticate with.
|
|
75
79
|
```
|
|
76
80
|
|
|
77
|
-
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
81
|
+
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/index.ts)_
|
|
78
82
|
|
|
79
83
|
## `knock commit get ID`
|
|
80
84
|
|
|
@@ -91,7 +95,7 @@ GLOBAL FLAGS
|
|
|
91
95
|
--json Format output as json.
|
|
92
96
|
```
|
|
93
97
|
|
|
94
|
-
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
98
|
+
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/get.ts)_
|
|
95
99
|
|
|
96
100
|
## `knock commit list`
|
|
97
101
|
|
|
@@ -99,23 +103,29 @@ Display all commits in an environment
|
|
|
99
103
|
|
|
100
104
|
```
|
|
101
105
|
USAGE
|
|
102
|
-
$ knock commit list --service-token <value> [--json] [--environment <value>] [--promoted] [--
|
|
103
|
-
[--
|
|
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>]
|
|
104
109
|
|
|
105
110
|
FLAGS
|
|
106
|
-
--after=<value>
|
|
107
|
-
--before=<value>
|
|
108
|
-
--environment=<value>
|
|
109
|
-
--limit=<value>
|
|
110
|
-
--[no-]promoted
|
|
111
|
-
|
|
112
|
-
--
|
|
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.
|
|
113
123
|
|
|
114
124
|
GLOBAL FLAGS
|
|
115
125
|
--json Format output as json.
|
|
116
126
|
```
|
|
117
127
|
|
|
118
|
-
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
128
|
+
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/commit/list.ts)_
|
|
119
129
|
|
|
120
130
|
## `knock commit promote`
|
|
121
131
|
|
|
@@ -132,7 +142,58 @@ FLAGS
|
|
|
132
142
|
--to=<value> The destination environment to promote all changes from the preceding environment.
|
|
133
143
|
```
|
|
134
144
|
|
|
135
|
-
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
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)_
|
|
136
197
|
|
|
137
198
|
## `knock help [COMMAND]`
|
|
138
199
|
|
|
@@ -152,7 +213,7 @@ DESCRIPTION
|
|
|
152
213
|
Display help for knock.
|
|
153
214
|
```
|
|
154
215
|
|
|
155
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
216
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.32/src/commands/help.ts)_
|
|
156
217
|
|
|
157
218
|
## `knock layout get EMAILLAYOUTKEY`
|
|
158
219
|
|
|
@@ -172,7 +233,7 @@ GLOBAL FLAGS
|
|
|
172
233
|
--json Format output as json.
|
|
173
234
|
```
|
|
174
235
|
|
|
175
|
-
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
236
|
+
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/get.ts)_
|
|
176
237
|
|
|
177
238
|
## `knock layout list`
|
|
178
239
|
|
|
@@ -195,7 +256,7 @@ GLOBAL FLAGS
|
|
|
195
256
|
--json Format output as json.
|
|
196
257
|
```
|
|
197
258
|
|
|
198
|
-
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
259
|
+
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/list.ts)_
|
|
199
260
|
|
|
200
261
|
## `knock layout pull [EMAILLAYOUTKEY]`
|
|
201
262
|
|
|
@@ -215,7 +276,7 @@ FLAGS
|
|
|
215
276
|
--service-token=<value> (required) The service token to authenticate with.
|
|
216
277
|
```
|
|
217
278
|
|
|
218
|
-
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
279
|
+
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/pull.ts)_
|
|
219
280
|
|
|
220
281
|
## `knock layout push [EMAILLAYOUTKEY]`
|
|
221
282
|
|
|
@@ -237,7 +298,7 @@ FLAGS
|
|
|
237
298
|
--service-token=<value> (required) The service token to authenticate with.
|
|
238
299
|
```
|
|
239
300
|
|
|
240
|
-
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
301
|
+
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/push.ts)_
|
|
241
302
|
|
|
242
303
|
## `knock layout validate [EMAILLAYOUTKEY]`
|
|
243
304
|
|
|
@@ -256,7 +317,7 @@ FLAGS
|
|
|
256
317
|
--service-token=<value> (required) The service token to authenticate with.
|
|
257
318
|
```
|
|
258
319
|
|
|
259
|
-
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
320
|
+
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/layout/validate.ts)_
|
|
260
321
|
|
|
261
322
|
## `knock partial get PARTIALKEY`
|
|
262
323
|
|
|
@@ -276,7 +337,7 @@ GLOBAL FLAGS
|
|
|
276
337
|
--json Format output as json.
|
|
277
338
|
```
|
|
278
339
|
|
|
279
|
-
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
340
|
+
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/get.ts)_
|
|
280
341
|
|
|
281
342
|
## `knock partial list`
|
|
282
343
|
|
|
@@ -299,7 +360,7 @@ GLOBAL FLAGS
|
|
|
299
360
|
--json Format output as json.
|
|
300
361
|
```
|
|
301
362
|
|
|
302
|
-
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
363
|
+
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/list.ts)_
|
|
303
364
|
|
|
304
365
|
## `knock partial pull [PARTIALKEY]`
|
|
305
366
|
|
|
@@ -319,7 +380,7 @@ FLAGS
|
|
|
319
380
|
--service-token=<value> (required) The service token to authenticate with.
|
|
320
381
|
```
|
|
321
382
|
|
|
322
|
-
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
383
|
+
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/pull.ts)_
|
|
323
384
|
|
|
324
385
|
## `knock partial push [PARTIALKEY]`
|
|
325
386
|
|
|
@@ -340,7 +401,7 @@ FLAGS
|
|
|
340
401
|
--service-token=<value> (required) The service token to authenticate with.
|
|
341
402
|
```
|
|
342
403
|
|
|
343
|
-
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
404
|
+
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/push.ts)_
|
|
344
405
|
|
|
345
406
|
## `knock partial validate [PARTIALKEY]`
|
|
346
407
|
|
|
@@ -359,7 +420,46 @@ FLAGS
|
|
|
359
420
|
--service-token=<value> (required) The service token to authenticate with.
|
|
360
421
|
```
|
|
361
422
|
|
|
362
|
-
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
423
|
+
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/partial/validate.ts)_
|
|
424
|
+
|
|
425
|
+
## `knock pull`
|
|
426
|
+
|
|
427
|
+
Pull all resources from an environment into a local file system.
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
USAGE
|
|
431
|
+
$ knock pull --service-token <value> --knock-dir <value> [--environment <value>]
|
|
432
|
+
[--hide-uncommitted-changes] [--force]
|
|
433
|
+
|
|
434
|
+
FLAGS
|
|
435
|
+
--environment=<value> [default: development] The environment to use.
|
|
436
|
+
--force Remove the confirmation prompt.
|
|
437
|
+
--hide-uncommitted-changes Hide any uncommitted changes.
|
|
438
|
+
--knock-dir=<value> (required) The target directory path to pull all resources into.
|
|
439
|
+
--service-token=<value> (required) The service token to authenticate with.
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
_See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/pull.ts)_
|
|
443
|
+
|
|
444
|
+
## `knock push`
|
|
445
|
+
|
|
446
|
+
Push all resources from a local file system to Knock.
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
USAGE
|
|
450
|
+
$ knock push --service-token <value> --knock-dir <value> [--environment development] [-m <value>
|
|
451
|
+
--commit]
|
|
452
|
+
|
|
453
|
+
FLAGS
|
|
454
|
+
-m, --commit-message=<value> Use the given value as the commit message
|
|
455
|
+
--commit Push and commit the resource(s) at the same time
|
|
456
|
+
--environment=<option> [default: development] Pushing resources is only allowed in the development environment
|
|
457
|
+
<options: development>
|
|
458
|
+
--knock-dir=<value> (required) The target directory path to find all resources to push.
|
|
459
|
+
--service-token=<value> (required) The service token to authenticate with.
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
_See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/push.ts)_
|
|
363
463
|
|
|
364
464
|
## `knock translation get TRANSLATIONREF`
|
|
365
465
|
|
|
@@ -386,7 +486,7 @@ GLOBAL FLAGS
|
|
|
386
486
|
--json Format output as json.
|
|
387
487
|
```
|
|
388
488
|
|
|
389
|
-
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
489
|
+
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/get.ts)_
|
|
390
490
|
|
|
391
491
|
## `knock translation list`
|
|
392
492
|
|
|
@@ -409,7 +509,7 @@ GLOBAL FLAGS
|
|
|
409
509
|
--json Format output as json.
|
|
410
510
|
```
|
|
411
511
|
|
|
412
|
-
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
512
|
+
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/list.ts)_
|
|
413
513
|
|
|
414
514
|
## `knock translation pull [TRANSLATIONREF]`
|
|
415
515
|
|
|
@@ -436,7 +536,7 @@ FLAGS
|
|
|
436
536
|
--translations-dir=<value> The target directory path to pull all translations into.
|
|
437
537
|
```
|
|
438
538
|
|
|
439
|
-
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
539
|
+
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/pull.ts)_
|
|
440
540
|
|
|
441
541
|
## `knock translation push [TRANSLATIONREF]`
|
|
442
542
|
|
|
@@ -463,7 +563,7 @@ FLAGS
|
|
|
463
563
|
--translations-dir=<value> The target directory path to find all translations to push.
|
|
464
564
|
```
|
|
465
565
|
|
|
466
|
-
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
566
|
+
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/push.ts)_
|
|
467
567
|
|
|
468
568
|
## `knock translation validate [TRANSLATIONREF]`
|
|
469
569
|
|
|
@@ -488,7 +588,7 @@ FLAGS
|
|
|
488
588
|
--translations-dir=<value> The target directory path to find all translations to validate.
|
|
489
589
|
```
|
|
490
590
|
|
|
491
|
-
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
591
|
+
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/translation/validate.ts)_
|
|
492
592
|
|
|
493
593
|
## `knock whoami`
|
|
494
594
|
|
|
@@ -505,7 +605,7 @@ GLOBAL FLAGS
|
|
|
505
605
|
--json Format output as json.
|
|
506
606
|
```
|
|
507
607
|
|
|
508
|
-
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
608
|
+
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/whoami.ts)_
|
|
509
609
|
|
|
510
610
|
## `knock workflow activate WORKFLOWKEY`
|
|
511
611
|
|
|
@@ -532,11 +632,11 @@ DESCRIPTION
|
|
|
532
632
|
with `false` in order to deactivate it.
|
|
533
633
|
```
|
|
534
634
|
|
|
535
|
-
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
635
|
+
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/activate.ts)_
|
|
536
636
|
|
|
537
637
|
## `knock workflow generate-types`
|
|
538
638
|
|
|
539
|
-
Generate types for all workflows in
|
|
639
|
+
Generate types for all workflows in an environment and write them to a file.
|
|
540
640
|
|
|
541
641
|
```
|
|
542
642
|
USAGE
|
|
@@ -550,10 +650,10 @@ FLAGS
|
|
|
550
650
|
--service-token=<value> (required) The service token to authenticate with.
|
|
551
651
|
|
|
552
652
|
DESCRIPTION
|
|
553
|
-
Generate types for all workflows in
|
|
653
|
+
Generate types for all workflows in an environment and write them to a file.
|
|
554
654
|
```
|
|
555
655
|
|
|
556
|
-
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
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)_
|
|
557
657
|
|
|
558
658
|
## `knock workflow get WORKFLOWKEY`
|
|
559
659
|
|
|
@@ -573,7 +673,7 @@ GLOBAL FLAGS
|
|
|
573
673
|
--json Format output as json.
|
|
574
674
|
```
|
|
575
675
|
|
|
576
|
-
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
676
|
+
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/get.ts)_
|
|
577
677
|
|
|
578
678
|
## `knock workflow list`
|
|
579
679
|
|
|
@@ -596,7 +696,7 @@ GLOBAL FLAGS
|
|
|
596
696
|
--json Format output as json.
|
|
597
697
|
```
|
|
598
698
|
|
|
599
|
-
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
699
|
+
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/list.ts)_
|
|
600
700
|
|
|
601
701
|
## `knock workflow pull [WORKFLOWKEY]`
|
|
602
702
|
|
|
@@ -616,7 +716,7 @@ FLAGS
|
|
|
616
716
|
--workflows-dir=<value> The target directory path to pull all workflows into.
|
|
617
717
|
```
|
|
618
718
|
|
|
619
|
-
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
719
|
+
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/pull.ts)_
|
|
620
720
|
|
|
621
721
|
## `knock workflow push [WORKFLOWKEY]`
|
|
622
722
|
|
|
@@ -637,7 +737,7 @@ FLAGS
|
|
|
637
737
|
--workflows-dir=<value> The target directory path to find all workflows to push.
|
|
638
738
|
```
|
|
639
739
|
|
|
640
|
-
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
740
|
+
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/push.ts)_
|
|
641
741
|
|
|
642
742
|
## `knock workflow run WORKFLOWKEY`
|
|
643
743
|
|
|
@@ -658,7 +758,7 @@ FLAGS
|
|
|
658
758
|
--tenant=<value> A tenant id for the workflow run.
|
|
659
759
|
```
|
|
660
760
|
|
|
661
|
-
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
761
|
+
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/run.ts)_
|
|
662
762
|
|
|
663
763
|
## `knock workflow validate [WORKFLOWKEY]`
|
|
664
764
|
|
|
@@ -677,5 +777,5 @@ FLAGS
|
|
|
677
777
|
--workflows-dir=<value> The target directory path to find all workflows to validate.
|
|
678
778
|
```
|
|
679
779
|
|
|
680
|
-
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
780
|
+
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.23/src/commands/workflow/validate.ts)_
|
|
681
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
|
-
|
|
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
|
+
});
|