@knocklabs/cli 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/dist/commands/guide/pull.js +6 -2
- package/dist/commands/guide/push.js +3 -1
- package/dist/commands/layout/pull.js +6 -2
- package/dist/commands/layout/push.js +3 -1
- package/dist/commands/message-type/pull.js +6 -2
- package/dist/commands/message-type/push.js +3 -1
- package/dist/commands/partial/pull.js +6 -2
- package/dist/commands/partial/push.js +3 -1
- package/dist/commands/workflow/pull.js +6 -2
- package/dist/commands/workflow/push.js +3 -1
- package/dist/lib/marshal/email-layout/processor.isomorphic.js +3 -2
- package/dist/lib/marshal/email-layout/writer.js +6 -4
- package/dist/lib/marshal/guide/processor.isomorphic.js +3 -2
- package/dist/lib/marshal/guide/writer.js +6 -4
- package/dist/lib/marshal/message-type/processor.isomorphic.js +3 -2
- package/dist/lib/marshal/message-type/writer.js +6 -4
- package/dist/lib/marshal/partial/processor.isomorphic.js +3 -2
- package/dist/lib/marshal/partial/writer.js +6 -4
- package/dist/lib/marshal/shared/helpers.isomorphic.js +7 -1
- package/dist/lib/marshal/workflow/processor.isomorphic.js +3 -2
- package/dist/lib/marshal/workflow/writer.js +6 -4
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
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.
|
|
19
|
+
@knocklabs/cli/0.3.0 linux-x64 node-v18.20.8
|
|
20
20
|
$ knock --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ knock COMMAND
|
|
@@ -90,7 +90,7 @@ FLAGS
|
|
|
90
90
|
--service-token=<value> The service token to authenticate with.
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
93
|
+
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/commit/index.ts)_
|
|
94
94
|
|
|
95
95
|
## `knock commit get ID`
|
|
96
96
|
|
|
@@ -107,7 +107,7 @@ GLOBAL FLAGS
|
|
|
107
107
|
--json Format output as json.
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
110
|
+
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/commit/get.ts)_
|
|
111
111
|
|
|
112
112
|
## `knock commit list`
|
|
113
113
|
|
|
@@ -138,7 +138,7 @@ GLOBAL FLAGS
|
|
|
138
138
|
--json Format output as json.
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
141
|
+
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/commit/list.ts)_
|
|
142
142
|
|
|
143
143
|
## `knock commit promote`
|
|
144
144
|
|
|
@@ -155,7 +155,7 @@ FLAGS
|
|
|
155
155
|
--to=<value> The destination environment to promote all changes from the preceding environment.
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
158
|
+
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/commit/promote.ts)_
|
|
159
159
|
|
|
160
160
|
## `knock guide activate GUIDEKEY`
|
|
161
161
|
|
|
@@ -185,7 +185,7 @@ DESCRIPTION
|
|
|
185
185
|
or deactivated at a later time using the --from and --until flags.
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
_See code: [src/commands/guide/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
188
|
+
_See code: [src/commands/guide/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/activate.ts)_
|
|
189
189
|
|
|
190
190
|
## `knock guide generate-types`
|
|
191
191
|
|
|
@@ -206,7 +206,7 @@ DESCRIPTION
|
|
|
206
206
|
Generate types for all guides in an environment and write them to a file.
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
_See code: [src/commands/guide/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
209
|
+
_See code: [src/commands/guide/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/generate-types.ts)_
|
|
210
210
|
|
|
211
211
|
## `knock guide get GUIDEKEY`
|
|
212
212
|
|
|
@@ -226,7 +226,7 @@ GLOBAL FLAGS
|
|
|
226
226
|
--json Format output as json.
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/guide/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
229
|
+
_See code: [src/commands/guide/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/get.ts)_
|
|
230
230
|
|
|
231
231
|
## `knock guide list`
|
|
232
232
|
|
|
@@ -249,7 +249,7 @@ GLOBAL FLAGS
|
|
|
249
249
|
--json Format output as json.
|
|
250
250
|
```
|
|
251
251
|
|
|
252
|
-
_See code: [src/commands/guide/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
252
|
+
_See code: [src/commands/guide/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/list.ts)_
|
|
253
253
|
|
|
254
254
|
## `knock guide pull [GUIDEKEY]`
|
|
255
255
|
|
|
@@ -269,7 +269,7 @@ FLAGS
|
|
|
269
269
|
--service-token=<value> The service token to authenticate with.
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
_See code: [src/commands/guide/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
272
|
+
_See code: [src/commands/guide/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/pull.ts)_
|
|
273
273
|
|
|
274
274
|
## `knock guide push [GUIDEKEY]`
|
|
275
275
|
|
|
@@ -289,7 +289,7 @@ FLAGS
|
|
|
289
289
|
--service-token=<value> The service token to authenticate with.
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
_See code: [src/commands/guide/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
292
|
+
_See code: [src/commands/guide/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/push.ts)_
|
|
293
293
|
|
|
294
294
|
## `knock guide validate [GUIDEKEY]`
|
|
295
295
|
|
|
@@ -306,7 +306,7 @@ FLAGS
|
|
|
306
306
|
--service-token=<value> The service token to authenticate with.
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
-
_See code: [src/commands/guide/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
309
|
+
_See code: [src/commands/guide/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/guide/validate.ts)_
|
|
310
310
|
|
|
311
311
|
## `knock help [COMMAND]`
|
|
312
312
|
|
|
@@ -346,7 +346,7 @@ GLOBAL FLAGS
|
|
|
346
346
|
--json Format output as json.
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
-
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
349
|
+
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/layout/get.ts)_
|
|
350
350
|
|
|
351
351
|
## `knock layout list`
|
|
352
352
|
|
|
@@ -369,7 +369,7 @@ GLOBAL FLAGS
|
|
|
369
369
|
--json Format output as json.
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
-
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
372
|
+
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/layout/list.ts)_
|
|
373
373
|
|
|
374
374
|
## `knock layout pull [EMAILLAYOUTKEY]`
|
|
375
375
|
|
|
@@ -389,7 +389,7 @@ FLAGS
|
|
|
389
389
|
--service-token=<value> The service token to authenticate with.
|
|
390
390
|
```
|
|
391
391
|
|
|
392
|
-
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
392
|
+
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/layout/pull.ts)_
|
|
393
393
|
|
|
394
394
|
## `knock layout push [EMAILLAYOUTKEY]`
|
|
395
395
|
|
|
@@ -411,7 +411,7 @@ FLAGS
|
|
|
411
411
|
--service-token=<value> The service token to authenticate with.
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
414
|
+
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/layout/push.ts)_
|
|
415
415
|
|
|
416
416
|
## `knock layout validate [EMAILLAYOUTKEY]`
|
|
417
417
|
|
|
@@ -430,7 +430,7 @@ FLAGS
|
|
|
430
430
|
--service-token=<value> The service token to authenticate with.
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
433
|
+
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/layout/validate.ts)_
|
|
434
434
|
|
|
435
435
|
## `knock login`
|
|
436
436
|
|
|
@@ -444,7 +444,7 @@ FLAGS
|
|
|
444
444
|
--service-token=<value> The service token to authenticate with.
|
|
445
445
|
```
|
|
446
446
|
|
|
447
|
-
_See code: [src/commands/login.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
447
|
+
_See code: [src/commands/login.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/login.ts)_
|
|
448
448
|
|
|
449
449
|
## `knock logout`
|
|
450
450
|
|
|
@@ -458,7 +458,7 @@ FLAGS
|
|
|
458
458
|
--service-token=<value> The service token to authenticate with.
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
_See code: [src/commands/logout.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
461
|
+
_See code: [src/commands/logout.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/logout.ts)_
|
|
462
462
|
|
|
463
463
|
## `knock message-type get MESSAGETYPEKEY`
|
|
464
464
|
|
|
@@ -478,7 +478,7 @@ GLOBAL FLAGS
|
|
|
478
478
|
--json Format output as json.
|
|
479
479
|
```
|
|
480
480
|
|
|
481
|
-
_See code: [src/commands/message-type/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
481
|
+
_See code: [src/commands/message-type/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/message-type/get.ts)_
|
|
482
482
|
|
|
483
483
|
## `knock message-type list`
|
|
484
484
|
|
|
@@ -501,7 +501,7 @@ GLOBAL FLAGS
|
|
|
501
501
|
--json Format output as json.
|
|
502
502
|
```
|
|
503
503
|
|
|
504
|
-
_See code: [src/commands/message-type/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
504
|
+
_See code: [src/commands/message-type/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/message-type/list.ts)_
|
|
505
505
|
|
|
506
506
|
## `knock message-type pull [MESSAGETYPEKEY]`
|
|
507
507
|
|
|
@@ -521,7 +521,7 @@ FLAGS
|
|
|
521
521
|
--service-token=<value> The service token to authenticate with.
|
|
522
522
|
```
|
|
523
523
|
|
|
524
|
-
_See code: [src/commands/message-type/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
524
|
+
_See code: [src/commands/message-type/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/message-type/pull.ts)_
|
|
525
525
|
|
|
526
526
|
## `knock message-type push [MESSAGETYPEKEY]`
|
|
527
527
|
|
|
@@ -543,7 +543,7 @@ FLAGS
|
|
|
543
543
|
--service-token=<value> The service token to authenticate with.
|
|
544
544
|
```
|
|
545
545
|
|
|
546
|
-
_See code: [src/commands/message-type/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
546
|
+
_See code: [src/commands/message-type/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/message-type/push.ts)_
|
|
547
547
|
|
|
548
548
|
## `knock message-type validate [MESSAGETYPEKEY]`
|
|
549
549
|
|
|
@@ -563,7 +563,7 @@ FLAGS
|
|
|
563
563
|
--service-token=<value> The service token to authenticate with.
|
|
564
564
|
```
|
|
565
565
|
|
|
566
|
-
_See code: [src/commands/message-type/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
566
|
+
_See code: [src/commands/message-type/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/message-type/validate.ts)_
|
|
567
567
|
|
|
568
568
|
## `knock partial get PARTIALKEY`
|
|
569
569
|
|
|
@@ -583,7 +583,7 @@ GLOBAL FLAGS
|
|
|
583
583
|
--json Format output as json.
|
|
584
584
|
```
|
|
585
585
|
|
|
586
|
-
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
586
|
+
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/partial/get.ts)_
|
|
587
587
|
|
|
588
588
|
## `knock partial list`
|
|
589
589
|
|
|
@@ -606,7 +606,7 @@ GLOBAL FLAGS
|
|
|
606
606
|
--json Format output as json.
|
|
607
607
|
```
|
|
608
608
|
|
|
609
|
-
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
609
|
+
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/partial/list.ts)_
|
|
610
610
|
|
|
611
611
|
## `knock partial pull [PARTIALKEY]`
|
|
612
612
|
|
|
@@ -626,7 +626,7 @@ FLAGS
|
|
|
626
626
|
--service-token=<value> The service token to authenticate with.
|
|
627
627
|
```
|
|
628
628
|
|
|
629
|
-
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
629
|
+
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/partial/pull.ts)_
|
|
630
630
|
|
|
631
631
|
## `knock partial push [PARTIALKEY]`
|
|
632
632
|
|
|
@@ -647,7 +647,7 @@ FLAGS
|
|
|
647
647
|
--service-token=<value> The service token to authenticate with.
|
|
648
648
|
```
|
|
649
649
|
|
|
650
|
-
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
650
|
+
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/partial/push.ts)_
|
|
651
651
|
|
|
652
652
|
## `knock partial validate [PARTIALKEY]`
|
|
653
653
|
|
|
@@ -666,7 +666,7 @@ FLAGS
|
|
|
666
666
|
--service-token=<value> The service token to authenticate with.
|
|
667
667
|
```
|
|
668
668
|
|
|
669
|
-
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
669
|
+
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/partial/validate.ts)_
|
|
670
670
|
|
|
671
671
|
## `knock pull`
|
|
672
672
|
|
|
@@ -685,7 +685,7 @@ FLAGS
|
|
|
685
685
|
--service-token=<value> The service token to authenticate with.
|
|
686
686
|
```
|
|
687
687
|
|
|
688
|
-
_See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
688
|
+
_See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/pull.ts)_
|
|
689
689
|
|
|
690
690
|
## `knock push`
|
|
691
691
|
|
|
@@ -705,7 +705,7 @@ FLAGS
|
|
|
705
705
|
--service-token=<value> The service token to authenticate with.
|
|
706
706
|
```
|
|
707
707
|
|
|
708
|
-
_See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
708
|
+
_See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/push.ts)_
|
|
709
709
|
|
|
710
710
|
## `knock translation get TRANSLATIONREF`
|
|
711
711
|
|
|
@@ -732,7 +732,7 @@ GLOBAL FLAGS
|
|
|
732
732
|
--json Format output as json.
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
735
|
+
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/translation/get.ts)_
|
|
736
736
|
|
|
737
737
|
## `knock translation list`
|
|
738
738
|
|
|
@@ -755,7 +755,7 @@ GLOBAL FLAGS
|
|
|
755
755
|
--json Format output as json.
|
|
756
756
|
```
|
|
757
757
|
|
|
758
|
-
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
758
|
+
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/translation/list.ts)_
|
|
759
759
|
|
|
760
760
|
## `knock translation pull [TRANSLATIONREF]`
|
|
761
761
|
|
|
@@ -782,7 +782,7 @@ FLAGS
|
|
|
782
782
|
--translations-dir=<value> The target directory path to pull all translations into.
|
|
783
783
|
```
|
|
784
784
|
|
|
785
|
-
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
785
|
+
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/translation/pull.ts)_
|
|
786
786
|
|
|
787
787
|
## `knock translation push [TRANSLATIONREF]`
|
|
788
788
|
|
|
@@ -809,7 +809,7 @@ FLAGS
|
|
|
809
809
|
--translations-dir=<value> The target directory path to find all translations to push.
|
|
810
810
|
```
|
|
811
811
|
|
|
812
|
-
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
812
|
+
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/translation/push.ts)_
|
|
813
813
|
|
|
814
814
|
## `knock translation validate [TRANSLATIONREF]`
|
|
815
815
|
|
|
@@ -834,7 +834,7 @@ FLAGS
|
|
|
834
834
|
--translations-dir=<value> The target directory path to find all translations to validate.
|
|
835
835
|
```
|
|
836
836
|
|
|
837
|
-
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
837
|
+
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/translation/validate.ts)_
|
|
838
838
|
|
|
839
839
|
## `knock whoami`
|
|
840
840
|
|
|
@@ -851,7 +851,7 @@ GLOBAL FLAGS
|
|
|
851
851
|
--json Format output as json.
|
|
852
852
|
```
|
|
853
853
|
|
|
854
|
-
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
854
|
+
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/whoami.ts)_
|
|
855
855
|
|
|
856
856
|
## `knock workflow activate WORKFLOWKEY`
|
|
857
857
|
|
|
@@ -878,7 +878,7 @@ DESCRIPTION
|
|
|
878
878
|
with `false` in order to deactivate it.
|
|
879
879
|
```
|
|
880
880
|
|
|
881
|
-
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
881
|
+
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/activate.ts)_
|
|
882
882
|
|
|
883
883
|
## `knock workflow generate-types`
|
|
884
884
|
|
|
@@ -899,7 +899,7 @@ DESCRIPTION
|
|
|
899
899
|
Generate types for all workflows in an environment and write them to a file.
|
|
900
900
|
```
|
|
901
901
|
|
|
902
|
-
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
902
|
+
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/generate-types.ts)_
|
|
903
903
|
|
|
904
904
|
## `knock workflow get WORKFLOWKEY`
|
|
905
905
|
|
|
@@ -919,7 +919,7 @@ GLOBAL FLAGS
|
|
|
919
919
|
--json Format output as json.
|
|
920
920
|
```
|
|
921
921
|
|
|
922
|
-
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
922
|
+
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/get.ts)_
|
|
923
923
|
|
|
924
924
|
## `knock workflow list`
|
|
925
925
|
|
|
@@ -942,7 +942,7 @@ GLOBAL FLAGS
|
|
|
942
942
|
--json Format output as json.
|
|
943
943
|
```
|
|
944
944
|
|
|
945
|
-
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
945
|
+
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/list.ts)_
|
|
946
946
|
|
|
947
947
|
## `knock workflow pull [WORKFLOWKEY]`
|
|
948
948
|
|
|
@@ -962,7 +962,7 @@ FLAGS
|
|
|
962
962
|
--workflows-dir=<value> The target directory path to pull all workflows into.
|
|
963
963
|
```
|
|
964
964
|
|
|
965
|
-
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
965
|
+
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/pull.ts)_
|
|
966
966
|
|
|
967
967
|
## `knock workflow push [WORKFLOWKEY]`
|
|
968
968
|
|
|
@@ -982,7 +982,7 @@ FLAGS
|
|
|
982
982
|
--workflows-dir=<value> The target directory path to find all workflows to push.
|
|
983
983
|
```
|
|
984
984
|
|
|
985
|
-
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
985
|
+
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/push.ts)_
|
|
986
986
|
|
|
987
987
|
## `knock workflow run WORKFLOWKEY`
|
|
988
988
|
|
|
@@ -1003,7 +1003,7 @@ FLAGS
|
|
|
1003
1003
|
--tenant=<value> A tenant id for the workflow run.
|
|
1004
1004
|
```
|
|
1005
1005
|
|
|
1006
|
-
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
1006
|
+
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/run.ts)_
|
|
1007
1007
|
|
|
1008
1008
|
## `knock workflow validate [WORKFLOWKEY]`
|
|
1009
1009
|
|
|
@@ -1021,5 +1021,5 @@ FLAGS
|
|
|
1021
1021
|
--workflows-dir=<value> The target directory path to find all workflows to validate.
|
|
1022
1022
|
```
|
|
1023
1023
|
|
|
1024
|
-
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.
|
|
1024
|
+
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.3.0/src/commands/workflow/validate.ts)_
|
|
1025
1025
|
<!-- commandsstop -->
|
|
@@ -108,7 +108,9 @@ class GuidePull extends _basecommand.default {
|
|
|
108
108
|
});
|
|
109
109
|
return this.apiV1.getGuide(props);
|
|
110
110
|
});
|
|
111
|
-
await _guide.writeGuideDirFromData(dirContext, resp.data
|
|
111
|
+
await _guide.writeGuideDirFromData(dirContext, resp.data, {
|
|
112
|
+
withSchema: true
|
|
113
|
+
});
|
|
112
114
|
const action = dirContext.exists ? "updated" : "created";
|
|
113
115
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
114
116
|
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
@@ -125,7 +127,9 @@ class GuidePull extends _basecommand.default {
|
|
|
125
127
|
if (!input) return;
|
|
126
128
|
_ux.spinner.start(`‣ Loading`);
|
|
127
129
|
const guides = await this.listAllGuides();
|
|
128
|
-
await _guide.writeGuidesIndexDir(targetDirCtx, guides
|
|
130
|
+
await _guide.writeGuidesIndexDir(targetDirCtx, guides, {
|
|
131
|
+
withSchema: true
|
|
132
|
+
});
|
|
129
133
|
_ux.spinner.stop();
|
|
130
134
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
131
135
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
@@ -121,7 +121,9 @@ class GuidePush extends _basecommand.default {
|
|
|
121
121
|
// Update the guide directory with the successfully pushed guide
|
|
122
122
|
// payload from the server.
|
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
|
124
|
-
await _guide.writeGuideDirFromData(guide, resp.data.guide
|
|
124
|
+
await _guide.writeGuideDirFromData(guide, resp.data.guide, {
|
|
125
|
+
withSchema: true
|
|
126
|
+
});
|
|
125
127
|
continue;
|
|
126
128
|
}
|
|
127
129
|
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _guide.guideJsonPath(guide), "ApiError");
|
|
@@ -109,7 +109,9 @@ class EmailLayoutPull extends _basecommand.default {
|
|
|
109
109
|
});
|
|
110
110
|
return this.apiV1.getEmailLayout(props);
|
|
111
111
|
});
|
|
112
|
-
await _emaillayout.writeEmailLayoutDirFromData(dirContext, resp.data
|
|
112
|
+
await _emaillayout.writeEmailLayoutDirFromData(dirContext, resp.data, {
|
|
113
|
+
withSchema: true
|
|
114
|
+
});
|
|
113
115
|
const action = dirContext.exists ? "updated" : "created";
|
|
114
116
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
115
117
|
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
@@ -127,7 +129,9 @@ class EmailLayoutPull extends _basecommand.default {
|
|
|
127
129
|
if (!input) return;
|
|
128
130
|
_ux.spinner.start(`‣ Loading`);
|
|
129
131
|
const emailLayouts = await this.listAllEmailLayouts();
|
|
130
|
-
await _emaillayout.writeEmailLayoutIndexDir(targetDirCtx, emailLayouts
|
|
132
|
+
await _emaillayout.writeEmailLayoutIndexDir(targetDirCtx, emailLayouts, {
|
|
133
|
+
withSchema: true
|
|
134
|
+
});
|
|
131
135
|
_ux.spinner.stop();
|
|
132
136
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
133
137
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
@@ -121,7 +121,9 @@ class EmailLayoutPush extends _basecommand.default {
|
|
|
121
121
|
// Update the layout directory with the successfully pushed layout
|
|
122
122
|
// payload from the server.
|
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
|
124
|
-
await _emaillayout.writeEmailLayoutDirFromData(layout, resp.data.email_layout
|
|
124
|
+
await _emaillayout.writeEmailLayoutDirFromData(layout, resp.data.email_layout, {
|
|
125
|
+
withSchema: true
|
|
126
|
+
});
|
|
125
127
|
continue;
|
|
126
128
|
}
|
|
127
129
|
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _emaillayout.emailLayoutJsonPath(layout), "ApiError");
|
|
@@ -112,7 +112,9 @@ class MessageTypePull extends _basecommand.default {
|
|
|
112
112
|
});
|
|
113
113
|
return this.apiV1.getMessageType(props);
|
|
114
114
|
});
|
|
115
|
-
await _messagetype.writeMessageTypeDirFromData(dirContext, resp.data
|
|
115
|
+
await _messagetype.writeMessageTypeDirFromData(dirContext, resp.data, {
|
|
116
|
+
withSchema: true
|
|
117
|
+
});
|
|
116
118
|
const action = dirContext.exists ? "updated" : "created";
|
|
117
119
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
118
120
|
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
@@ -161,7 +163,9 @@ class MessageTypePull extends _basecommand.default {
|
|
|
161
163
|
if (!input) return;
|
|
162
164
|
_ux.spinner.start(`‣ Loading`);
|
|
163
165
|
const messageTypes = await this.listAllMessageTypes();
|
|
164
|
-
await _messagetype.writeMessageTypesIndexDir(targetDirCtx, messageTypes
|
|
166
|
+
await _messagetype.writeMessageTypesIndexDir(targetDirCtx, messageTypes, {
|
|
167
|
+
withSchema: true
|
|
168
|
+
});
|
|
165
169
|
_ux.spinner.stop();
|
|
166
170
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
167
171
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
@@ -121,7 +121,9 @@ class MessageTypePush extends _basecommand.default {
|
|
|
121
121
|
// Update the message type directory with the successfully pushed message
|
|
122
122
|
// type payload from the server.
|
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
|
124
|
-
await _messagetype.writeMessageTypeDirFromData(messageType, resp.data.message_type
|
|
124
|
+
await _messagetype.writeMessageTypeDirFromData(messageType, resp.data.message_type, {
|
|
125
|
+
withSchema: true
|
|
126
|
+
});
|
|
125
127
|
continue;
|
|
126
128
|
}
|
|
127
129
|
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _messagetype.messageTypeJsonPath(messageType), "ApiError");
|
|
@@ -109,7 +109,9 @@ class PartialPull extends _basecommand.default {
|
|
|
109
109
|
});
|
|
110
110
|
return this.apiV1.getPartial(props);
|
|
111
111
|
});
|
|
112
|
-
await _partial.writePartialDirFromData(dirContext, resp.data
|
|
112
|
+
await _partial.writePartialDirFromData(dirContext, resp.data, {
|
|
113
|
+
withSchema: true
|
|
114
|
+
});
|
|
113
115
|
const action = dirContext.exists ? "updated" : "created";
|
|
114
116
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
115
117
|
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
@@ -127,7 +129,9 @@ class PartialPull extends _basecommand.default {
|
|
|
127
129
|
if (!input) return;
|
|
128
130
|
_ux.spinner.start(`‣ Loading`);
|
|
129
131
|
const partials = await this.listAllPartials();
|
|
130
|
-
await _partial.writePartialsIndexDir(targetDirCtx, partials
|
|
132
|
+
await _partial.writePartialsIndexDir(targetDirCtx, partials, {
|
|
133
|
+
withSchema: true
|
|
134
|
+
});
|
|
131
135
|
_ux.spinner.stop();
|
|
132
136
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
133
137
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
@@ -121,7 +121,9 @@ class PartialPush extends _basecommand.default {
|
|
|
121
121
|
// Update the partial directory with the successfully pushed partial
|
|
122
122
|
// payload from the server.
|
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
|
124
|
-
await _partial.writePartialDirFromData(partial, resp.data.partial
|
|
124
|
+
await _partial.writePartialDirFromData(partial, resp.data.partial, {
|
|
125
|
+
withSchema: true
|
|
126
|
+
});
|
|
125
127
|
continue;
|
|
126
128
|
}
|
|
127
129
|
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _partial.partialJsonPath(partial), "ApiError");
|
|
@@ -113,7 +113,9 @@ class WorkflowPull extends _basecommand.default {
|
|
|
113
113
|
return this.apiV1.getWorkflow(props);
|
|
114
114
|
});
|
|
115
115
|
// 3. Write the fetched workflow to create or update the workflow directory.
|
|
116
|
-
await _workflow.writeWorkflowDirFromData(dirContext, resp.data
|
|
116
|
+
await _workflow.writeWorkflowDirFromData(dirContext, resp.data, {
|
|
117
|
+
withSchema: true
|
|
118
|
+
});
|
|
117
119
|
const action = dirContext.exists ? "updated" : "created";
|
|
118
120
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
119
121
|
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
@@ -162,7 +164,9 @@ class WorkflowPull extends _basecommand.default {
|
|
|
162
164
|
// Fetch all workflows then write them to the local file system.
|
|
163
165
|
_ux.spinner.start(`‣ Loading`);
|
|
164
166
|
const workflows = await this.listAllWorkflows();
|
|
165
|
-
await _workflow.writeWorkflowsIndexDir(targetDirCtx, workflows
|
|
167
|
+
await _workflow.writeWorkflowsIndexDir(targetDirCtx, workflows, {
|
|
168
|
+
withSchema: true
|
|
169
|
+
});
|
|
166
170
|
_ux.spinner.stop();
|
|
167
171
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
168
172
|
const scope = (0, _command.formatCommandScope)(flags);
|
|
@@ -121,7 +121,9 @@ class WorkflowPush extends _basecommand.default {
|
|
|
121
121
|
// Update the workflow directory with the successfully pushed workflow
|
|
122
122
|
// payload from the server.
|
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
|
124
|
-
await _workflow.writeWorkflowDirFromData(workflow, resp.data.workflow
|
|
124
|
+
await _workflow.writeWorkflowDirFromData(workflow, resp.data.workflow, {
|
|
125
|
+
withSchema: true
|
|
126
|
+
});
|
|
125
127
|
continue;
|
|
126
128
|
}
|
|
127
129
|
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _workflow.workflowJsonPath(workflow), "ApiError");
|
|
@@ -38,8 +38,9 @@ const compileExtractionSettings = (emailLayout)=>{
|
|
|
38
38
|
}
|
|
39
39
|
return map;
|
|
40
40
|
};
|
|
41
|
-
const buildEmailLayoutDirBundle = (remoteEmailLayout, localEmailLayout
|
|
41
|
+
const buildEmailLayoutDirBundle = (remoteEmailLayout, localEmailLayout, $schema)=>{
|
|
42
42
|
const bundle = {};
|
|
43
|
+
localEmailLayout = localEmailLayout || {};
|
|
43
44
|
const mutRemoteEmailLayout = (0, _lodash.cloneDeep)(remoteEmailLayout);
|
|
44
45
|
// A map of extraction settings of every field in the email layout
|
|
45
46
|
const compiledExtractionSettings = compileExtractionSettings(mutRemoteEmailLayout);
|
|
@@ -75,5 +76,5 @@ const buildEmailLayoutDirBundle = (remoteEmailLayout, localEmailLayout = {})=>{
|
|
|
75
76
|
// the layout JSON realtive path + the file content.
|
|
76
77
|
return (0, _lodash.set)(bundle, [
|
|
77
78
|
LAYOUT_JSON
|
|
78
|
-
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteEmailLayout));
|
|
79
|
+
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteEmailLayout, $schema));
|
|
79
80
|
};
|
|
@@ -73,13 +73,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
73
73
|
}
|
|
74
74
|
return newObj;
|
|
75
75
|
}
|
|
76
|
-
const
|
|
76
|
+
const EMAIL_LAYOUT_SCHEMA = "https://schemas.knock.app/cli/email-layout.json";
|
|
77
|
+
const writeEmailLayoutDirFromData = async (emailLayoutDirCtx, remoteEmailLayout, options)=>{
|
|
78
|
+
const { withSchema = false } = options || {};
|
|
77
79
|
// If the layout directory exists on the file system (i.e. previously
|
|
78
80
|
// pulled before), then read the layout file to use as a reference.
|
|
79
81
|
const [localEmailLayout] = emailLayoutDirCtx.exists ? await (0, _reader.readEmailLayoutDir)(emailLayoutDirCtx, {
|
|
80
82
|
withExtractedFiles: true
|
|
81
83
|
}) : [];
|
|
82
|
-
const bundle = (0, _processorisomorphic.buildEmailLayoutDirBundle)(remoteEmailLayout, localEmailLayout);
|
|
84
|
+
const bundle = (0, _processorisomorphic.buildEmailLayoutDirBundle)(remoteEmailLayout, localEmailLayout, withSchema ? EMAIL_LAYOUT_SCHEMA : undefined);
|
|
83
85
|
const backupDirPath = _nodepath.default.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
84
86
|
try {
|
|
85
87
|
// We store a backup in case there's an error.
|
|
@@ -109,7 +111,7 @@ const writeEmailLayoutDirFromData = async (emailLayoutDirCtx, remoteEmailLayout)
|
|
|
109
111
|
await _fsextra.remove(backupDirPath);
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
|
-
const writeEmailLayoutIndexDir = async (indexDirCtx, remoteEmailLayouts)=>{
|
|
114
|
+
const writeEmailLayoutIndexDir = async (indexDirCtx, remoteEmailLayouts, options)=>{
|
|
113
115
|
const backupDirPath = _nodepath.default.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
114
116
|
try {
|
|
115
117
|
if (indexDirCtx.exists) {
|
|
@@ -124,7 +126,7 @@ const writeEmailLayoutIndexDir = async (indexDirCtx, remoteEmailLayouts)=>{
|
|
|
124
126
|
abspath: emailLayoutDirPath,
|
|
125
127
|
exists: indexDirCtx.exists ? await (0, _helpers.isEmailLayoutDir)(emailLayoutDirPath) : false
|
|
126
128
|
};
|
|
127
|
-
return writeEmailLayoutDirFromData(emailLayoutDirCtx, remoteEmailLayout);
|
|
129
|
+
return writeEmailLayoutDirFromData(emailLayoutDirCtx, remoteEmailLayout, options);
|
|
128
130
|
});
|
|
129
131
|
await Promise.all(writeEmailLayoutDirPromises);
|
|
130
132
|
} catch (error) {
|
|
@@ -45,8 +45,9 @@ const compileExtractionSettings = (guide)=>{
|
|
|
45
45
|
}
|
|
46
46
|
return map;
|
|
47
47
|
};
|
|
48
|
-
const buildGuideDirBundle = (remoteGuide, localGuide
|
|
48
|
+
const buildGuideDirBundle = (remoteGuide, localGuide, $schema)=>{
|
|
49
49
|
const bundle = {};
|
|
50
|
+
localGuide = localGuide || {};
|
|
50
51
|
const mutRemoteGuide = (0, _lodash.cloneDeep)(remoteGuide);
|
|
51
52
|
// A map of extraction settings of every field in the guide.
|
|
52
53
|
const compiledExtractionSettings = compileExtractionSettings(mutRemoteGuide);
|
|
@@ -81,5 +82,5 @@ const buildGuideDirBundle = (remoteGuide, localGuide = {})=>{
|
|
|
81
82
|
// the guide JSON relative path + the file content.
|
|
82
83
|
return (0, _lodash.set)(bundle, [
|
|
83
84
|
GUIDE_JSON
|
|
84
|
-
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteGuide));
|
|
85
|
+
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteGuide, $schema));
|
|
85
86
|
};
|
|
@@ -68,13 +68,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
68
68
|
}
|
|
69
69
|
return newObj;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const GUIDE_SCHEMA = "https://schemas.knock.app/cli/guide.json";
|
|
72
|
+
const writeGuideDirFromData = async (guideDirCtx, remoteGuide, options)=>{
|
|
73
|
+
const { withSchema = false } = options || {};
|
|
72
74
|
// If the guide directory exists on the file system (i.e. previously
|
|
73
75
|
// pulled before), then read the guide file to use as a reference.
|
|
74
76
|
const [localGuide] = guideDirCtx.exists ? await (0, _reader.readGuideDir)(guideDirCtx, {
|
|
75
77
|
withExtractedFiles: true
|
|
76
78
|
}) : [];
|
|
77
|
-
const bundle = (0, _processorisomorphic.buildGuideDirBundle)(remoteGuide, localGuide);
|
|
79
|
+
const bundle = (0, _processorisomorphic.buildGuideDirBundle)(remoteGuide, localGuide, withSchema ? GUIDE_SCHEMA : undefined);
|
|
78
80
|
return writeGuideDirFromBundle(guideDirCtx, bundle);
|
|
79
81
|
};
|
|
80
82
|
/*
|
|
@@ -136,7 +138,7 @@ const writeGuideDirFromData = async (guideDirCtx, remoteGuide)=>{
|
|
|
136
138
|
});
|
|
137
139
|
await Promise.all(promises);
|
|
138
140
|
};
|
|
139
|
-
const writeGuidesIndexDir = async (indexDirCtx, remoteGuides)=>{
|
|
141
|
+
const writeGuidesIndexDir = async (indexDirCtx, remoteGuides, options)=>{
|
|
140
142
|
const backupDirPath = _nodepath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
141
143
|
try {
|
|
142
144
|
// If the index directory already exists, back it up in the temp sandbox
|
|
@@ -154,7 +156,7 @@ const writeGuidesIndexDir = async (indexDirCtx, remoteGuides)=>{
|
|
|
154
156
|
abspath: guideDirPath,
|
|
155
157
|
exists: indexDirCtx.exists ? await (0, _helpers.isGuideDir)(guideDirPath) : false
|
|
156
158
|
};
|
|
157
|
-
return writeGuideDirFromData(guideDirCtx, guide);
|
|
159
|
+
return writeGuideDirFromData(guideDirCtx, guide, options);
|
|
158
160
|
});
|
|
159
161
|
await Promise.all(writeGuideDirPromises);
|
|
160
162
|
} catch (error) {
|
|
@@ -38,9 +38,10 @@ const compileExtractionSettings = (messageType)=>{
|
|
|
38
38
|
}
|
|
39
39
|
return map;
|
|
40
40
|
};
|
|
41
|
-
const buildMessageTypeDirBundle = (remoteMessageType, localMessageType
|
|
41
|
+
const buildMessageTypeDirBundle = (remoteMessageType, localMessageType, $schema)=>{
|
|
42
42
|
const bundle = {};
|
|
43
43
|
const mutRemoteMessageType = (0, _lodash.cloneDeep)(remoteMessageType);
|
|
44
|
+
localMessageType = localMessageType || {};
|
|
44
45
|
// A map of extraction settings of every field in the message type
|
|
45
46
|
const compiledExtractionSettings = compileExtractionSettings(mutRemoteMessageType);
|
|
46
47
|
// Iterate through each extractable field, determine whether we need to
|
|
@@ -74,5 +75,5 @@ const buildMessageTypeDirBundle = (remoteMessageType, localMessageType = {})=>{
|
|
|
74
75
|
// the message type JSON relative path + the file content.
|
|
75
76
|
return (0, _lodash.set)(bundle, [
|
|
76
77
|
MESSAGE_TYPE_JSON
|
|
77
|
-
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteMessageType));
|
|
78
|
+
], (0, _helpersisomorphic.prepareResourceJson)(mutRemoteMessageType, $schema));
|
|
78
79
|
};
|
|
@@ -68,13 +68,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
68
68
|
}
|
|
69
69
|
return newObj;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const MESSAGE_TYPE_SCHEMA = "https://schemas.knock.app/cli/message-type.json";
|
|
72
|
+
const writeMessageTypeDirFromData = async (messageTypeDirCtx, remoteMessageType, options)=>{
|
|
73
|
+
const { withSchema = false } = options || {};
|
|
72
74
|
// If the message type directory exists on the file system (i.e. previously
|
|
73
75
|
// pulled before), then read the message type file to use as a reference.
|
|
74
76
|
const [localMessageType] = messageTypeDirCtx.exists ? await (0, _reader.readMessageTypeDir)(messageTypeDirCtx, {
|
|
75
77
|
withExtractedFiles: true
|
|
76
78
|
}) : [];
|
|
77
|
-
const bundle = (0, _processorisomorphic.buildMessageTypeDirBundle)(remoteMessageType, localMessageType);
|
|
79
|
+
const bundle = (0, _processorisomorphic.buildMessageTypeDirBundle)(remoteMessageType, localMessageType, withSchema ? MESSAGE_TYPE_SCHEMA : undefined);
|
|
78
80
|
return writeMessageTypeDirFromBundle(messageTypeDirCtx, bundle);
|
|
79
81
|
};
|
|
80
82
|
/*
|
|
@@ -136,7 +138,7 @@ const writeMessageTypeDirFromData = async (messageTypeDirCtx, remoteMessageType)
|
|
|
136
138
|
});
|
|
137
139
|
await Promise.all(promises);
|
|
138
140
|
};
|
|
139
|
-
const writeMessageTypesIndexDir = async (indexDirCtx, remoteMessageTypes)=>{
|
|
141
|
+
const writeMessageTypesIndexDir = async (indexDirCtx, remoteMessageTypes, options)=>{
|
|
140
142
|
const backupDirPath = _nodepath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
141
143
|
try {
|
|
142
144
|
// If the index directory already exists, back it up in the temp sandbox
|
|
@@ -154,7 +156,7 @@ const writeMessageTypesIndexDir = async (indexDirCtx, remoteMessageTypes)=>{
|
|
|
154
156
|
abspath: messageTypeDirPath,
|
|
155
157
|
exists: indexDirCtx.exists ? await (0, _helpers.isMessageTypeDir)(messageTypeDirPath) : false
|
|
156
158
|
};
|
|
157
|
-
return writeMessageTypeDirFromData(messageTypeDirCtx, messageType);
|
|
159
|
+
return writeMessageTypeDirFromData(messageTypeDirCtx, messageType, options);
|
|
158
160
|
});
|
|
159
161
|
await Promise.all(promises);
|
|
160
162
|
} catch (error) {
|
|
@@ -61,8 +61,9 @@ const compileExtractionSettings = (partial)=>{
|
|
|
61
61
|
}
|
|
62
62
|
return map;
|
|
63
63
|
};
|
|
64
|
-
const buildPartialDirBundle = (remotePartial, localPartial
|
|
64
|
+
const buildPartialDirBundle = (remotePartial, localPartial, $schema)=>{
|
|
65
65
|
const bundle = {};
|
|
66
|
+
localPartial = localPartial || {};
|
|
66
67
|
const mutRemotePartial = (0, _lodash.cloneDeep)(remotePartial);
|
|
67
68
|
// A map of extraction settings of every field in the partial
|
|
68
69
|
const compiledExtractionSettings = compileExtractionSettings(mutRemotePartial);
|
|
@@ -97,5 +98,5 @@ const buildPartialDirBundle = (remotePartial, localPartial = {})=>{
|
|
|
97
98
|
// the partial JSON relative path + the file content.
|
|
98
99
|
return (0, _lodash.set)(bundle, [
|
|
99
100
|
PARTIAL_JSON
|
|
100
|
-
], (0, _helpersisomorphic.prepareResourceJson)(mutRemotePartial));
|
|
101
|
+
], (0, _helpersisomorphic.prepareResourceJson)(mutRemotePartial, $schema));
|
|
101
102
|
};
|
|
@@ -68,13 +68,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
68
68
|
}
|
|
69
69
|
return newObj;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const PARTIAL_SCHEMA = "https://schemas.knock.app/cli/partial.json";
|
|
72
|
+
const writePartialDirFromData = async (partialDirCtx, remotePartial, options)=>{
|
|
73
|
+
const { withSchema = false } = options || {};
|
|
72
74
|
// If the partial directory exists on the file system (i.e. previously
|
|
73
75
|
// pulled before), then read the partial file to use as a reference.
|
|
74
76
|
const [localPartial] = partialDirCtx.exists ? await (0, _reader.readPartialDir)(partialDirCtx, {
|
|
75
77
|
withExtractedFiles: true
|
|
76
78
|
}) : [];
|
|
77
|
-
const bundle = (0, _processorisomorphic.buildPartialDirBundle)(remotePartial, localPartial);
|
|
79
|
+
const bundle = (0, _processorisomorphic.buildPartialDirBundle)(remotePartial, localPartial, withSchema ? PARTIAL_SCHEMA : undefined);
|
|
78
80
|
return writePartialDirFromBundle(partialDirCtx, bundle);
|
|
79
81
|
};
|
|
80
82
|
/*
|
|
@@ -136,7 +138,7 @@ const writePartialDirFromData = async (partialDirCtx, remotePartial)=>{
|
|
|
136
138
|
});
|
|
137
139
|
await Promise.all(promises);
|
|
138
140
|
};
|
|
139
|
-
const writePartialsIndexDir = async (indexDirCtx, remotePartials)=>{
|
|
141
|
+
const writePartialsIndexDir = async (indexDirCtx, remotePartials, options)=>{
|
|
140
142
|
const backupDirPath = _nodepath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
141
143
|
try {
|
|
142
144
|
// If the index directory already exists, back it up in the temp sandbox
|
|
@@ -154,7 +156,7 @@ const writePartialsIndexDir = async (indexDirCtx, remotePartials)=>{
|
|
|
154
156
|
abspath: partialDirPath,
|
|
155
157
|
exists: indexDirCtx.exists ? await (0, _helpers.isPartialDir)(partialDirPath) : false
|
|
156
158
|
};
|
|
157
|
-
return writePartialDirFromData(partialDirCtx, partial);
|
|
159
|
+
return writePartialDirFromData(partialDirCtx, partial, options);
|
|
158
160
|
});
|
|
159
161
|
await Promise.all(writePartialDirPromises);
|
|
160
162
|
} catch (error) {
|
|
@@ -15,7 +15,7 @@ const REMOVED_READONLY_FIELDS = [
|
|
|
15
15
|
"sha",
|
|
16
16
|
"updated_at"
|
|
17
17
|
];
|
|
18
|
-
const prepareResourceJson = (resource)=>{
|
|
18
|
+
const prepareResourceJson = (resource, $schema)=>{
|
|
19
19
|
var _resource___annotation;
|
|
20
20
|
const readonlyFields = ((_resource___annotation = resource.__annotation) === null || _resource___annotation === void 0 ? void 0 : _resource___annotation.readonly_fields) || [];
|
|
21
21
|
const [readonly, remainder] = (0, _objectisomorphic.split)(resource, readonlyFields);
|
|
@@ -25,6 +25,12 @@ const prepareResourceJson = (resource)=>{
|
|
|
25
25
|
...remainder,
|
|
26
26
|
__readonly: filteredReadonlyFields
|
|
27
27
|
};
|
|
28
|
+
// Append the $schema property to the resource JSON if it is provided.
|
|
29
|
+
if ($schema) {
|
|
30
|
+
Object.assign(resourceJson, {
|
|
31
|
+
$schema
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
// Strip out all schema annotations, so not to expose them to end users.
|
|
29
35
|
return (0, _objectisomorphic.omitDeep)(resourceJson, [
|
|
30
36
|
"__annotation"
|
|
@@ -250,8 +250,9 @@ const recursivelyBuildWorkflowDirBundle = (bundle, steps, localWorkflowStepsByRe
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
|
-
const buildWorkflowDirBundle = (remoteWorkflow, localWorkflow
|
|
253
|
+
const buildWorkflowDirBundle = (remoteWorkflow, localWorkflow, $schema)=>{
|
|
254
254
|
const bundle = {};
|
|
255
|
+
localWorkflow = localWorkflow || {};
|
|
255
256
|
const mutWorkflow = (0, _lodash.cloneDeep)(remoteWorkflow);
|
|
256
257
|
const localWorkflowStepsByRef = keyLocalWorkflowStepsByRef(localWorkflow.steps);
|
|
257
258
|
// Recursively traverse the workflow step tree, mutating it and the bundle
|
|
@@ -260,5 +261,5 @@ const buildWorkflowDirBundle = (remoteWorkflow, localWorkflow = {})=>{
|
|
|
260
261
|
// Then, prepare the workflow data to be written into a workflow json file.
|
|
261
262
|
return (0, _lodash.set)(bundle, [
|
|
262
263
|
WORKFLOW_JSON
|
|
263
|
-
], (0, _helpersisomorphic.prepareResourceJson)(mutWorkflow));
|
|
264
|
+
], (0, _helpersisomorphic.prepareResourceJson)(mutWorkflow, $schema));
|
|
264
265
|
};
|
|
@@ -71,13 +71,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
71
71
|
}
|
|
72
72
|
return newObj;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const WORKFLOW_SCHEMA = "https://schemas.knock.app/cli/workflow.json";
|
|
75
|
+
const writeWorkflowDirFromData = async (workflowDirCtx, remoteWorkflow, options)=>{
|
|
76
|
+
const { withSchema = false } = options || {};
|
|
75
77
|
// If the workflow directory exists on the file system (i.e. previously
|
|
76
78
|
// pulled before), then read the workflow file to use as a reference.
|
|
77
79
|
const [localWorkflow] = workflowDirCtx.exists ? await (0, _reader.readWorkflowDir)(workflowDirCtx, {
|
|
78
80
|
withExtractedFiles: true
|
|
79
81
|
}) : [];
|
|
80
|
-
const bundle = (0, _processorisomorphic.buildWorkflowDirBundle)(remoteWorkflow, localWorkflow);
|
|
82
|
+
const bundle = (0, _processorisomorphic.buildWorkflowDirBundle)(remoteWorkflow, localWorkflow, withSchema ? WORKFLOW_SCHEMA : undefined);
|
|
81
83
|
return writeWorkflowDirFromBundle(workflowDirCtx, bundle);
|
|
82
84
|
};
|
|
83
85
|
const writeWorkflowDirFromBundle = async (workflowDirCtx, workflowDirBundle)=>{
|
|
@@ -132,7 +134,7 @@ const writeWorkflowDirFromBundle = async (workflowDirCtx, workflowDirBundle)=>{
|
|
|
132
134
|
});
|
|
133
135
|
await Promise.all(promises);
|
|
134
136
|
};
|
|
135
|
-
const writeWorkflowsIndexDir = async (indexDirCtx, remoteWorkflows)=>{
|
|
137
|
+
const writeWorkflowsIndexDir = async (indexDirCtx, remoteWorkflows, options)=>{
|
|
136
138
|
const backupDirPath = _nodepath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
|
|
137
139
|
try {
|
|
138
140
|
// If the index directory already exists, back it up in the temp sandbox
|
|
@@ -150,7 +152,7 @@ const writeWorkflowsIndexDir = async (indexDirCtx, remoteWorkflows)=>{
|
|
|
150
152
|
abspath: workflowDirPath,
|
|
151
153
|
exists: indexDirCtx.exists ? await (0, _helpers.isWorkflowDir)(workflowDirPath) : false
|
|
152
154
|
};
|
|
153
|
-
return writeWorkflowDirFromData(workflowDirCtx, workflow);
|
|
155
|
+
return writeWorkflowDirFromData(workflowDirCtx, workflow, options);
|
|
154
156
|
});
|
|
155
157
|
await Promise.all(writeWorkflowDirPromises);
|
|
156
158
|
} catch (error) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knocklabs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Knock CLI",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"enquirer": "^2.4.1",
|
|
27
27
|
"find-up": "^5.0.0",
|
|
28
28
|
"fs-extra": "^11.3.2",
|
|
29
|
-
"liquidjs": "^10.
|
|
29
|
+
"liquidjs": "^10.22.0",
|
|
30
30
|
"locale-codes": "^1.3.1",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"open": "8.4.2",
|