@knocklabs/cli 0.1.20 → 0.1.22

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 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.20 linux-x64 node-v18.20.7
19
+ @knocklabs/cli/0.1.22 linux-x64 node-v18.20.8
20
20
  $ knock --help [COMMAND]
21
21
  USAGE
22
22
  $ knock COMMAND
@@ -42,6 +42,8 @@ USAGE
42
42
  * [`knock partial pull [PARTIALKEY]`](#knock-partial-pull-partialkey)
43
43
  * [`knock partial push [PARTIALKEY]`](#knock-partial-push-partialkey)
44
44
  * [`knock partial validate [PARTIALKEY]`](#knock-partial-validate-partialkey)
45
+ * [`knock pull`](#knock-pull)
46
+ * [`knock push`](#knock-push)
45
47
  * [`knock translation get TRANSLATIONREF`](#knock-translation-get-translationref)
46
48
  * [`knock translation list`](#knock-translation-list)
47
49
  * [`knock translation pull [TRANSLATIONREF]`](#knock-translation-pull-translationref)
@@ -49,6 +51,7 @@ USAGE
49
51
  * [`knock translation validate [TRANSLATIONREF]`](#knock-translation-validate-translationref)
50
52
  * [`knock whoami`](#knock-whoami)
51
53
  * [`knock workflow activate WORKFLOWKEY`](#knock-workflow-activate-workflowkey)
54
+ * [`knock workflow generate-types`](#knock-workflow-generate-types)
52
55
  * [`knock workflow get WORKFLOWKEY`](#knock-workflow-get-workflowkey)
53
56
  * [`knock workflow list`](#knock-workflow-list)
54
57
  * [`knock workflow pull [WORKFLOWKEY]`](#knock-workflow-pull-workflowkey)
@@ -73,7 +76,7 @@ FLAGS
73
76
  --service-token=<value> (required) The service token to authenticate with.
74
77
  ```
75
78
 
76
- _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/commit/index.ts)_
79
+ _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/index.ts)_
77
80
 
78
81
  ## `knock commit get ID`
79
82
 
@@ -90,7 +93,7 @@ GLOBAL FLAGS
90
93
  --json Format output as json.
91
94
  ```
92
95
 
93
- _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/commit/get.ts)_
96
+ _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/get.ts)_
94
97
 
95
98
  ## `knock commit list`
96
99
 
@@ -114,7 +117,7 @@ GLOBAL FLAGS
114
117
  --json Format output as json.
115
118
  ```
116
119
 
117
- _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/commit/list.ts)_
120
+ _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/list.ts)_
118
121
 
119
122
  ## `knock commit promote`
120
123
 
@@ -131,7 +134,7 @@ FLAGS
131
134
  --to=<value> The destination environment to promote all changes from the preceding environment.
132
135
  ```
133
136
 
134
- _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/commit/promote.ts)_
137
+ _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/promote.ts)_
135
138
 
136
139
  ## `knock help [COMMAND]`
137
140
 
@@ -151,7 +154,7 @@ DESCRIPTION
151
154
  Display help for knock.
152
155
  ```
153
156
 
154
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.20/src/commands/help.ts)_
157
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.28/src/commands/help.ts)_
155
158
 
156
159
  ## `knock layout get EMAILLAYOUTKEY`
157
160
 
@@ -171,7 +174,7 @@ GLOBAL FLAGS
171
174
  --json Format output as json.
172
175
  ```
173
176
 
174
- _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/layout/get.ts)_
177
+ _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/get.ts)_
175
178
 
176
179
  ## `knock layout list`
177
180
 
@@ -194,7 +197,7 @@ GLOBAL FLAGS
194
197
  --json Format output as json.
195
198
  ```
196
199
 
197
- _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/layout/list.ts)_
200
+ _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/list.ts)_
198
201
 
199
202
  ## `knock layout pull [EMAILLAYOUTKEY]`
200
203
 
@@ -214,7 +217,7 @@ FLAGS
214
217
  --service-token=<value> (required) The service token to authenticate with.
215
218
  ```
216
219
 
217
- _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/layout/pull.ts)_
220
+ _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/pull.ts)_
218
221
 
219
222
  ## `knock layout push [EMAILLAYOUTKEY]`
220
223
 
@@ -236,7 +239,7 @@ FLAGS
236
239
  --service-token=<value> (required) The service token to authenticate with.
237
240
  ```
238
241
 
239
- _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/layout/push.ts)_
242
+ _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/push.ts)_
240
243
 
241
244
  ## `knock layout validate [EMAILLAYOUTKEY]`
242
245
 
@@ -255,7 +258,7 @@ FLAGS
255
258
  --service-token=<value> (required) The service token to authenticate with.
256
259
  ```
257
260
 
258
- _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/layout/validate.ts)_
261
+ _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/validate.ts)_
259
262
 
260
263
  ## `knock partial get PARTIALKEY`
261
264
 
@@ -275,7 +278,7 @@ GLOBAL FLAGS
275
278
  --json Format output as json.
276
279
  ```
277
280
 
278
- _See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/partial/get.ts)_
281
+ _See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/get.ts)_
279
282
 
280
283
  ## `knock partial list`
281
284
 
@@ -298,7 +301,7 @@ GLOBAL FLAGS
298
301
  --json Format output as json.
299
302
  ```
300
303
 
301
- _See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/partial/list.ts)_
304
+ _See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/list.ts)_
302
305
 
303
306
  ## `knock partial pull [PARTIALKEY]`
304
307
 
@@ -318,7 +321,7 @@ FLAGS
318
321
  --service-token=<value> (required) The service token to authenticate with.
319
322
  ```
320
323
 
321
- _See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/partial/pull.ts)_
324
+ _See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/pull.ts)_
322
325
 
323
326
  ## `knock partial push [PARTIALKEY]`
324
327
 
@@ -339,7 +342,7 @@ FLAGS
339
342
  --service-token=<value> (required) The service token to authenticate with.
340
343
  ```
341
344
 
342
- _See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/partial/push.ts)_
345
+ _See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/push.ts)_
343
346
 
344
347
  ## `knock partial validate [PARTIALKEY]`
345
348
 
@@ -358,7 +361,46 @@ FLAGS
358
361
  --service-token=<value> (required) The service token to authenticate with.
359
362
  ```
360
363
 
361
- _See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/partial/validate.ts)_
364
+ _See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/validate.ts)_
365
+
366
+ ## `knock pull`
367
+
368
+ Pull all resources from an environment into a local file system.
369
+
370
+ ```
371
+ USAGE
372
+ $ knock pull --service-token <value> --knock-dir <value> [--environment <value>]
373
+ [--hide-uncommitted-changes] [--force]
374
+
375
+ FLAGS
376
+ --environment=<value> [default: development] The environment to use.
377
+ --force Remove the confirmation prompt.
378
+ --hide-uncommitted-changes Hide any uncommitted changes.
379
+ --knock-dir=<value> (required) The target directory path to pull all resources into.
380
+ --service-token=<value> (required) The service token to authenticate with.
381
+ ```
382
+
383
+ _See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/pull.ts)_
384
+
385
+ ## `knock push`
386
+
387
+ Push all resources from a local file system to Knock.
388
+
389
+ ```
390
+ USAGE
391
+ $ knock push --service-token <value> --knock-dir <value> [--environment development] [-m <value>
392
+ --commit]
393
+
394
+ FLAGS
395
+ -m, --commit-message=<value> Use the given value as the commit message
396
+ --commit Push and commit the resource(s) at the same time
397
+ --environment=<option> [default: development] Pushing resources is only allowed in the development environment
398
+ <options: development>
399
+ --knock-dir=<value> (required) The target directory path to find all resources to push.
400
+ --service-token=<value> (required) The service token to authenticate with.
401
+ ```
402
+
403
+ _See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/push.ts)_
362
404
 
363
405
  ## `knock translation get TRANSLATIONREF`
364
406
 
@@ -385,7 +427,7 @@ GLOBAL FLAGS
385
427
  --json Format output as json.
386
428
  ```
387
429
 
388
- _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/translation/get.ts)_
430
+ _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/get.ts)_
389
431
 
390
432
  ## `knock translation list`
391
433
 
@@ -408,7 +450,7 @@ GLOBAL FLAGS
408
450
  --json Format output as json.
409
451
  ```
410
452
 
411
- _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/translation/list.ts)_
453
+ _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/list.ts)_
412
454
 
413
455
  ## `knock translation pull [TRANSLATIONREF]`
414
456
 
@@ -435,7 +477,7 @@ FLAGS
435
477
  --translations-dir=<value> The target directory path to pull all translations into.
436
478
  ```
437
479
 
438
- _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/translation/pull.ts)_
480
+ _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/pull.ts)_
439
481
 
440
482
  ## `knock translation push [TRANSLATIONREF]`
441
483
 
@@ -462,7 +504,7 @@ FLAGS
462
504
  --translations-dir=<value> The target directory path to find all translations to push.
463
505
  ```
464
506
 
465
- _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/translation/push.ts)_
507
+ _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/push.ts)_
466
508
 
467
509
  ## `knock translation validate [TRANSLATIONREF]`
468
510
 
@@ -487,7 +529,7 @@ FLAGS
487
529
  --translations-dir=<value> The target directory path to find all translations to validate.
488
530
  ```
489
531
 
490
- _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/translation/validate.ts)_
532
+ _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/validate.ts)_
491
533
 
492
534
  ## `knock whoami`
493
535
 
@@ -504,7 +546,7 @@ GLOBAL FLAGS
504
546
  --json Format output as json.
505
547
  ```
506
548
 
507
- _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/whoami.ts)_
549
+ _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/whoami.ts)_
508
550
 
509
551
  ## `knock workflow activate WORKFLOWKEY`
510
552
 
@@ -531,7 +573,28 @@ DESCRIPTION
531
573
  with `false` in order to deactivate it.
532
574
  ```
533
575
 
534
- _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/activate.ts)_
576
+ _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/activate.ts)_
577
+
578
+ ## `knock workflow generate-types`
579
+
580
+ Generate types for all workflows in the development environment and write them to a file.
581
+
582
+ ```
583
+ USAGE
584
+ $ knock workflow generate-types --service-token <value> --output-file <value> [--environment <value>]
585
+
586
+ FLAGS
587
+ --environment=<value> [default: development] Select the environment to generate types for.
588
+ --output-file=<value> (required) The output file to write the generated types to. We currently support .ts, .rb,
589
+ .go, .py files only. Your file extension will determine the target language for the generated
590
+ types.
591
+ --service-token=<value> (required) The service token to authenticate with.
592
+
593
+ DESCRIPTION
594
+ Generate types for all workflows in the development environment and write them to a file.
595
+ ```
596
+
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)_
535
598
 
536
599
  ## `knock workflow get WORKFLOWKEY`
537
600
 
@@ -551,7 +614,7 @@ GLOBAL FLAGS
551
614
  --json Format output as json.
552
615
  ```
553
616
 
554
- _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/get.ts)_
617
+ _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/get.ts)_
555
618
 
556
619
  ## `knock workflow list`
557
620
 
@@ -574,7 +637,7 @@ GLOBAL FLAGS
574
637
  --json Format output as json.
575
638
  ```
576
639
 
577
- _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/list.ts)_
640
+ _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/list.ts)_
578
641
 
579
642
  ## `knock workflow pull [WORKFLOWKEY]`
580
643
 
@@ -594,7 +657,7 @@ FLAGS
594
657
  --workflows-dir=<value> The target directory path to pull all workflows into.
595
658
  ```
596
659
 
597
- _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/pull.ts)_
660
+ _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/pull.ts)_
598
661
 
599
662
  ## `knock workflow push [WORKFLOWKEY]`
600
663
 
@@ -615,7 +678,7 @@ FLAGS
615
678
  --workflows-dir=<value> The target directory path to find all workflows to push.
616
679
  ```
617
680
 
618
- _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/push.ts)_
681
+ _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/push.ts)_
619
682
 
620
683
  ## `knock workflow run WORKFLOWKEY`
621
684
 
@@ -636,7 +699,7 @@ FLAGS
636
699
  --tenant=<value> A tenant id for the workflow run.
637
700
  ```
638
701
 
639
- _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/run.ts)_
702
+ _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/run.ts)_
640
703
 
641
704
  ## `knock workflow validate [WORKFLOWKEY]`
642
705
 
@@ -655,5 +718,5 @@ FLAGS
655
718
  --workflows-dir=<value> The target directory path to find all workflows to validate.
656
719
  ```
657
720
 
658
- _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.20/src/commands/workflow/validate.ts)_
721
+ _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/validate.ts)_
659
722
  <!-- commandsstop -->
@@ -0,0 +1,157 @@
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 Pull;
9
+ }
10
+ });
11
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
12
+ const _core = require("@oclif/core");
13
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../lib/base-command"));
14
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../lib/helpers/flag"));
15
+ const _ux = require("../lib/helpers/ux");
16
+ const _resources = require("../lib/resources");
17
+ const _pull = /*#__PURE__*/ _interop_require_default(require("./layout/pull"));
18
+ const _pull1 = /*#__PURE__*/ _interop_require_default(require("./partial/pull"));
19
+ const _pull2 = /*#__PURE__*/ _interop_require_default(require("./translation/pull"));
20
+ const _pull3 = /*#__PURE__*/ _interop_require_default(require("./workflow/pull"));
21
+ function _define_property(obj, key, value) {
22
+ if (key in obj) {
23
+ Object.defineProperty(obj, key, {
24
+ value: value,
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true
28
+ });
29
+ } else {
30
+ obj[key] = value;
31
+ }
32
+ return obj;
33
+ }
34
+ function _interop_require_default(obj) {
35
+ return obj && obj.__esModule ? obj : {
36
+ default: obj
37
+ };
38
+ }
39
+ function _getRequireWildcardCache(nodeInterop) {
40
+ if (typeof WeakMap !== "function") return null;
41
+ var cacheBabelInterop = new WeakMap();
42
+ var cacheNodeInterop = new WeakMap();
43
+ return (_getRequireWildcardCache = function(nodeInterop) {
44
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
45
+ })(nodeInterop);
46
+ }
47
+ function _interop_require_wildcard(obj, nodeInterop) {
48
+ if (!nodeInterop && obj && obj.__esModule) {
49
+ return obj;
50
+ }
51
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
52
+ return {
53
+ default: obj
54
+ };
55
+ }
56
+ var cache = _getRequireWildcardCache(nodeInterop);
57
+ if (cache && cache.has(obj)) {
58
+ return cache.get(obj);
59
+ }
60
+ var newObj = {
61
+ __proto__: null
62
+ };
63
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
64
+ for(var key in obj){
65
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
66
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
67
+ if (desc && (desc.get || desc.set)) {
68
+ Object.defineProperty(newObj, key, desc);
69
+ } else {
70
+ newObj[key] = obj[key];
71
+ }
72
+ }
73
+ }
74
+ newObj.default = obj;
75
+ if (cache) {
76
+ cache.set(obj, newObj);
77
+ }
78
+ return newObj;
79
+ }
80
+ class Pull extends _basecommand.default {
81
+ async run() {
82
+ const { flags } = this.props;
83
+ const targetDirCtx = flags["knock-dir"];
84
+ const prompt = targetDirCtx.exists ? `Pull latest resources into ${targetDirCtx.abspath}?\n This will overwrite the contents of this directory.` : `Create a new resources directory at ${targetDirCtx.abspath}?`;
85
+ const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
86
+ if (!input) return;
87
+ const args = [
88
+ "--all",
89
+ "--environment",
90
+ flags.environment,
91
+ ...flags["hide-uncommitted-changes"] ? [
92
+ "--hide-uncommitted-changes"
93
+ ] : [],
94
+ ...flags["service-token"] ? [
95
+ "--service-token",
96
+ flags["service-token"]
97
+ ] : [],
98
+ // Always use the force flag to skip prompts
99
+ "--force"
100
+ ];
101
+ for (const resourceType of _resources.ALL_RESOURCE_TYPES){
102
+ // eslint-disable-next-line no-await-in-loop
103
+ await runResourcePullCommand(resourceType, targetDirCtx, args);
104
+ }
105
+ }
106
+ }
107
+ _define_property(Pull, "summary", "Pull all resources from an environment into a local file system.");
108
+ _define_property(Pull, "flags", {
109
+ environment: _core.Flags.string({
110
+ default: "development",
111
+ summary: "The environment to use."
112
+ }),
113
+ "knock-dir": _flag.dirPath({
114
+ summary: "The target directory path to pull all resources into.",
115
+ required: true
116
+ }),
117
+ "hide-uncommitted-changes": _core.Flags.boolean({
118
+ summary: "Hide any uncommitted changes."
119
+ }),
120
+ force: _core.Flags.boolean({
121
+ summary: "Remove the confirmation prompt."
122
+ })
123
+ });
124
+ const runResourcePullCommand = async (resourceType, targetDirCtx, args)=>{
125
+ const subdirPath = _nodepath.resolve(targetDirCtx.abspath, _resources.RESOURCE_SUBDIRS[resourceType]);
126
+ switch(resourceType){
127
+ case "email_layout":
128
+ return _pull.default.run([
129
+ ...args,
130
+ "--layouts-dir",
131
+ subdirPath
132
+ ]);
133
+ case "partial":
134
+ return _pull1.default.run([
135
+ ...args,
136
+ "--partials-dir",
137
+ subdirPath
138
+ ]);
139
+ case "translation":
140
+ return _pull2.default.run([
141
+ ...args,
142
+ "--translations-dir",
143
+ subdirPath
144
+ ]);
145
+ case "workflow":
146
+ return _pull3.default.run([
147
+ ...args,
148
+ "--workflows-dir",
149
+ subdirPath
150
+ ]);
151
+ default:
152
+ {
153
+ const invalidResourceType = resourceType;
154
+ throw new Error(`Unknown resource type: ${invalidResourceType}`);
155
+ }
156
+ }
157
+ };
@@ -0,0 +1,175 @@
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 Push;
9
+ }
10
+ });
11
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
12
+ const _core = require("@oclif/core");
13
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
14
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../lib/base-command"));
15
+ const _const = require("../lib/helpers/const");
16
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../lib/helpers/flag"));
17
+ const _resources = require("../lib/resources");
18
+ const _push = /*#__PURE__*/ _interop_require_default(require("./layout/push"));
19
+ const _push1 = /*#__PURE__*/ _interop_require_default(require("./partial/push"));
20
+ const _push2 = /*#__PURE__*/ _interop_require_default(require("./translation/push"));
21
+ const _push3 = /*#__PURE__*/ _interop_require_default(require("./workflow/push"));
22
+ function _define_property(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _interop_require_default(obj) {
36
+ return obj && obj.__esModule ? obj : {
37
+ default: obj
38
+ };
39
+ }
40
+ function _getRequireWildcardCache(nodeInterop) {
41
+ if (typeof WeakMap !== "function") return null;
42
+ var cacheBabelInterop = new WeakMap();
43
+ var cacheNodeInterop = new WeakMap();
44
+ return (_getRequireWildcardCache = function(nodeInterop) {
45
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
46
+ })(nodeInterop);
47
+ }
48
+ function _interop_require_wildcard(obj, nodeInterop) {
49
+ if (!nodeInterop && obj && obj.__esModule) {
50
+ return obj;
51
+ }
52
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
53
+ return {
54
+ default: obj
55
+ };
56
+ }
57
+ var cache = _getRequireWildcardCache(nodeInterop);
58
+ if (cache && cache.has(obj)) {
59
+ return cache.get(obj);
60
+ }
61
+ var newObj = {
62
+ __proto__: null
63
+ };
64
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
65
+ for(var key in obj){
66
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
67
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
68
+ if (desc && (desc.get || desc.set)) {
69
+ Object.defineProperty(newObj, key, desc);
70
+ } else {
71
+ newObj[key] = obj[key];
72
+ }
73
+ }
74
+ }
75
+ newObj.default = obj;
76
+ if (cache) {
77
+ cache.set(obj, newObj);
78
+ }
79
+ return newObj;
80
+ }
81
+ class Push extends _basecommand.default {
82
+ async run() {
83
+ const { flags } = this.props;
84
+ const targetDirCtx = flags["knock-dir"];
85
+ if (!targetDirCtx.exists) {
86
+ this.error(`Directory ${targetDirCtx.abspath} does not exist`);
87
+ }
88
+ const args = [
89
+ "--all",
90
+ "--environment",
91
+ flags.environment,
92
+ ...flags["service-token"] ? [
93
+ "--service-token",
94
+ flags["service-token"]
95
+ ] : [],
96
+ ...flags.commit ? [
97
+ "--commit"
98
+ ] : [],
99
+ ...flags["commit-message"] ? [
100
+ "--commit-message",
101
+ flags["commit-message"]
102
+ ] : []
103
+ ];
104
+ // Note: Because we're pushing the different resource types sequentially,
105
+ // if one of the push commands fails, we may end up in a partially pushed
106
+ // state, with only some of the resources upserted. This is the best we can
107
+ // do until we have a bulk push mAPI endpoint.
108
+ for (const resourceType of _resources.ALL_RESOURCE_TYPES){
109
+ // eslint-disable-next-line no-await-in-loop
110
+ await runResourcePushCommand(resourceType, targetDirCtx, args);
111
+ }
112
+ }
113
+ }
114
+ _define_property(Push, "summary", "Push all resources from a local file system to Knock.");
115
+ _define_property(Push, "flags", {
116
+ environment: _core.Flags.string({
117
+ summary: "Pushing resources is only allowed in the development environment",
118
+ default: _const.KnockEnv.Development,
119
+ options: [
120
+ _const.KnockEnv.Development
121
+ ]
122
+ }),
123
+ "knock-dir": _flag.dirPath({
124
+ summary: "The target directory path to find all resources to push.",
125
+ required: true
126
+ }),
127
+ commit: _core.Flags.boolean({
128
+ summary: "Push and commit the resource(s) at the same time"
129
+ }),
130
+ "commit-message": _core.Flags.string({
131
+ summary: "Use the given value as the commit message",
132
+ char: "m",
133
+ dependsOn: [
134
+ "commit"
135
+ ]
136
+ })
137
+ });
138
+ const runResourcePushCommand = async (resourceType, targetDirCtx, args)=>{
139
+ const subdirPath = _nodepath.resolve(targetDirCtx.abspath, _resources.RESOURCE_SUBDIRS[resourceType]);
140
+ const hasResources = await _fsextra.pathExists(subdirPath);
141
+ if (!hasResources) {
142
+ return;
143
+ }
144
+ switch(resourceType){
145
+ case "email_layout":
146
+ return _push.default.run([
147
+ ...args,
148
+ "--layouts-dir",
149
+ subdirPath
150
+ ]);
151
+ case "partial":
152
+ return _push1.default.run([
153
+ ...args,
154
+ "--partials-dir",
155
+ subdirPath
156
+ ]);
157
+ case "translation":
158
+ return _push2.default.run([
159
+ ...args,
160
+ "--translations-dir",
161
+ subdirPath
162
+ ]);
163
+ case "workflow":
164
+ return _push3.default.run([
165
+ ...args,
166
+ "--workflows-dir",
167
+ subdirPath
168
+ ]);
169
+ default:
170
+ {
171
+ const invalidResourceType = resourceType;
172
+ throw new Error(`Unknown resource type: ${invalidResourceType}`);
173
+ }
174
+ }
175
+ };
@@ -0,0 +1,138 @@
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 WorkflowGenerateTypes;
9
+ }
10
+ });
11
+ const _core = require("@oclif/core");
12
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
13
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
14
+ const _const = require("../../lib/helpers/const");
15
+ const _error = require("../../lib/helpers/error");
16
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
17
+ const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
18
+ const _page = require("../../lib/helpers/page");
19
+ const _request = require("../../lib/helpers/request");
20
+ const _ux = require("../../lib/helpers/ux");
21
+ const _typegenerator = require("../../lib/type-generator");
22
+ function _define_property(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _interop_require_default(obj) {
36
+ return obj && obj.__esModule ? obj : {
37
+ default: obj
38
+ };
39
+ }
40
+ function _getRequireWildcardCache(nodeInterop) {
41
+ if (typeof WeakMap !== "function") return null;
42
+ var cacheBabelInterop = new WeakMap();
43
+ var cacheNodeInterop = new WeakMap();
44
+ return (_getRequireWildcardCache = function(nodeInterop) {
45
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
46
+ })(nodeInterop);
47
+ }
48
+ function _interop_require_wildcard(obj, nodeInterop) {
49
+ if (!nodeInterop && obj && obj.__esModule) {
50
+ return obj;
51
+ }
52
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
53
+ return {
54
+ default: obj
55
+ };
56
+ }
57
+ var cache = _getRequireWildcardCache(nodeInterop);
58
+ if (cache && cache.has(obj)) {
59
+ return cache.get(obj);
60
+ }
61
+ var newObj = {
62
+ __proto__: null
63
+ };
64
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
65
+ for(var key in obj){
66
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
67
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
68
+ if (desc && (desc.get || desc.set)) {
69
+ Object.defineProperty(newObj, key, desc);
70
+ } else {
71
+ newObj[key] = obj[key];
72
+ }
73
+ }
74
+ }
75
+ newObj.default = obj;
76
+ if (cache) {
77
+ cache.set(obj, newObj);
78
+ }
79
+ return newObj;
80
+ }
81
+ class WorkflowGenerateTypes extends _basecommand.default {
82
+ async run() {
83
+ const { flags } = this.props;
84
+ const fileExtension = flags["output-file"].abspath.split(".").pop();
85
+ const targetLanguage = (0, _typegenerator.getLanguageFromExtension)(fileExtension);
86
+ if (!targetLanguage) {
87
+ this.error(new _error.ApiError(`Unsupported file extension: ${fileExtension}. We currently support .ts, .rb, .go, .py files only.`));
88
+ }
89
+ _ux.spinner.start(`‣ Loading workflows`);
90
+ // 1. List all workflows in the development environment.
91
+ const workflows = await this.listAllWorkflows();
92
+ _ux.spinner.stop();
93
+ // 2. Generate types for all workflows.
94
+ _ux.spinner.start(`‣ Generating types`);
95
+ const { result, workflows: workflowsWithValidTypes } = await (0, _typegenerator.generateWorkflowTypes)(workflows, targetLanguage);
96
+ _ux.spinner.stop();
97
+ if (!result) {
98
+ this.log(`‣ No workflows with valid trigger data JSON schema found, skipping type generation`);
99
+ return;
100
+ }
101
+ // 3. Write the generated types to the output file.
102
+ await _fsextra.writeFile(flags["output-file"].abspath, result.lines.join("\n"));
103
+ this.log(`‣ Successfully generated types for ${workflowsWithValidTypes.length} workflow(s) and wrote them to ${flags["output-file"].abspath}`);
104
+ }
105
+ async listAllWorkflows(pageParams = {}, workflowsFetchedSoFar = []) {
106
+ const props = (0, _objectisomorphic.merge)(this.props, {
107
+ flags: {
108
+ ...pageParams,
109
+ annotate: true,
110
+ limit: _page.MAX_PAGINATION_LIMIT
111
+ }
112
+ });
113
+ const resp = await this.apiV1.listWorkflows(props);
114
+ if (!(0, _request.isSuccessResp)(resp)) {
115
+ const message = (0, _request.formatErrorRespMessage)(resp);
116
+ this.error(new _error.ApiError(message));
117
+ }
118
+ const { entries, page_info: pageInfo } = resp.data;
119
+ const workflows = [
120
+ ...workflowsFetchedSoFar,
121
+ ...entries
122
+ ];
123
+ return pageInfo.after ? this.listAllWorkflows({
124
+ after: pageInfo.after
125
+ }, workflows) : workflows;
126
+ }
127
+ }
128
+ _define_property(WorkflowGenerateTypes, "description", "Generate types for all workflows in the development environment and write them to a file.");
129
+ _define_property(WorkflowGenerateTypes, "flags", {
130
+ environment: _core.Flags.string({
131
+ summary: "Select the environment to generate types for.",
132
+ default: _const.KnockEnv.Development
133
+ }),
134
+ "output-file": _flag.filePath({
135
+ summary: "The output file to write the generated types to. We currently support .ts, .rb, .go, .py files only. Your file extension will determine the target language for the generated types.",
136
+ required: true
137
+ })
138
+ });
@@ -15,6 +15,9 @@ _export(exports, {
15
15
  dirPath: function() {
16
16
  return dirPath;
17
17
  },
18
+ filePath: function() {
19
+ return filePath;
20
+ },
18
21
  jsonStr: function() {
19
22
  return jsonStr;
20
23
  },
@@ -77,6 +80,19 @@ const booleanStr = _core.Flags.custom({
77
80
  ],
78
81
  parse: async (input)=>input === "true"
79
82
  });
83
+ const filePath = _core.Flags.custom({
84
+ parse: async (input)=>{
85
+ const abspath = _nodepath.isAbsolute(input) ? input : _nodepath.resolve(process.cwd(), input);
86
+ const exists = await _fsextra.pathExists(abspath);
87
+ if (exists && !(await _fsextra.lstat(abspath)).isFile()) {
88
+ throw new Error(`${input} exists but is not a file`);
89
+ }
90
+ return {
91
+ abspath,
92
+ exists
93
+ };
94
+ }
95
+ });
80
96
  const dirPath = _core.Flags.custom({
81
97
  parse: async (input)=>{
82
98
  const abspath = _nodepath.isAbsolute(input) ? input : _nodepath.resolve(process.cwd(), input);
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ALL_RESOURCE_TYPES: function() {
13
+ return ALL_RESOURCE_TYPES;
14
+ },
15
+ RESOURCE_SUBDIRS: function() {
16
+ return RESOURCE_SUBDIRS;
17
+ }
18
+ });
19
+ const ALL_RESOURCE_TYPES = [
20
+ // Partials first, as email layouts and workflows may reference them
21
+ "partial",
22
+ // Email layouts next, as workflows with email channel steps may reference them
23
+ "email_layout",
24
+ "workflow",
25
+ "translation"
26
+ ];
27
+ const RESOURCE_SUBDIRS = {
28
+ email_layout: "layouts",
29
+ partial: "partials",
30
+ translation: "translations",
31
+ workflow: "workflows"
32
+ };
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ generateWorkflowTypes: function() {
13
+ return generateWorkflowTypes;
14
+ },
15
+ getLanguageFromExtension: function() {
16
+ return getLanguageFromExtension;
17
+ }
18
+ });
19
+ const _quicktypecore = require("quicktype-core");
20
+ function getLanguageFromExtension(extension) {
21
+ switch(extension){
22
+ case "ts":
23
+ return "typescript";
24
+ case "py":
25
+ return "python";
26
+ case "go":
27
+ return "go";
28
+ case "rb":
29
+ return "ruby";
30
+ default:
31
+ return undefined;
32
+ }
33
+ }
34
+ /**
35
+ * Transforms the schema to add additionalProperties to all objects.
36
+ *
37
+ * TODO: handle refs, union types, and more.
38
+ *
39
+ * @param schema The schema to transform
40
+ * @returns The transformed schema
41
+ */ function transformSchema(schema) {
42
+ if (schema.type === "object" && !schema.additionalProperties) {
43
+ schema.additionalProperties = false;
44
+ }
45
+ var _schema_properties;
46
+ for (const key of Object.keys((_schema_properties = schema.properties) !== null && _schema_properties !== void 0 ? _schema_properties : {})){
47
+ const property = schema.properties[key];
48
+ if (property.type === "object") {
49
+ const transformedProperty = transformSchema(property);
50
+ schema.properties[key] = transformedProperty;
51
+ }
52
+ }
53
+ return schema;
54
+ }
55
+ /**
56
+ * Given a set of workflows, will go through and generated types for each workflow.
57
+ *
58
+ * If the workflow has no trigger data JSON schema, will return empty lines.
59
+ *
60
+ * @param workflows List of workflows to generate types for
61
+ * @param targetLanguage Target programming language for type generation
62
+ * @returns Generated type definitions for the workflows
63
+ */ async function generateWorkflowTypes(workflows, targetLanguage) {
64
+ const validWorkflows = workflows.filter((workflow)=>workflow.trigger_data_json_schema);
65
+ if (validWorkflows.length === 0) {
66
+ return {
67
+ result: undefined,
68
+ workflows: []
69
+ };
70
+ }
71
+ const schemaInput = new _quicktypecore.JSONSchemaInput(new _quicktypecore.FetchingJSONSchemaStore());
72
+ for (const workflow of validWorkflows){
73
+ const pascalCaseWorkflowKey = workflow.key.split(/[_-]/).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join("");
74
+ const schema = transformSchema({
75
+ ...workflow.trigger_data_json_schema,
76
+ title: `${pascalCaseWorkflowKey}Data`
77
+ });
78
+ schemaInput.addSource({
79
+ name: `${pascalCaseWorkflowKey}Data`,
80
+ schema: JSON.stringify(schema)
81
+ });
82
+ }
83
+ const inputData = new _quicktypecore.InputData();
84
+ inputData.addInput(schemaInput);
85
+ const result = await (0, _quicktypecore.quicktype)({
86
+ inputData,
87
+ lang: targetLanguage,
88
+ allPropertiesOptional: false,
89
+ alphabetizeProperties: true,
90
+ rendererOptions: {
91
+ "just-types": true,
92
+ "no-extra-properties": true,
93
+ "no-optional-null": true
94
+ }
95
+ });
96
+ return {
97
+ result,
98
+ workflows: validWorkflows
99
+ };
100
+ }
@@ -76,6 +76,146 @@
76
76
  "ping.js"
77
77
  ]
78
78
  },
79
+ "pull": {
80
+ "aliases": [],
81
+ "args": {},
82
+ "flags": {
83
+ "service-token": {
84
+ "env": "KNOCK_SERVICE_TOKEN",
85
+ "name": "service-token",
86
+ "required": true,
87
+ "summary": "The service token to authenticate with.",
88
+ "hasDynamicHelp": false,
89
+ "multiple": false,
90
+ "type": "option"
91
+ },
92
+ "api-origin": {
93
+ "hidden": true,
94
+ "name": "api-origin",
95
+ "required": false,
96
+ "hasDynamicHelp": false,
97
+ "multiple": false,
98
+ "type": "option"
99
+ },
100
+ "environment": {
101
+ "name": "environment",
102
+ "summary": "The environment to use.",
103
+ "default": "development",
104
+ "hasDynamicHelp": false,
105
+ "multiple": false,
106
+ "type": "option"
107
+ },
108
+ "knock-dir": {
109
+ "name": "knock-dir",
110
+ "required": true,
111
+ "summary": "The target directory path to pull all resources into.",
112
+ "hasDynamicHelp": false,
113
+ "multiple": false,
114
+ "type": "option"
115
+ },
116
+ "hide-uncommitted-changes": {
117
+ "name": "hide-uncommitted-changes",
118
+ "summary": "Hide any uncommitted changes.",
119
+ "allowNo": false,
120
+ "type": "boolean"
121
+ },
122
+ "force": {
123
+ "name": "force",
124
+ "summary": "Remove the confirmation prompt.",
125
+ "allowNo": false,
126
+ "type": "boolean"
127
+ }
128
+ },
129
+ "hasDynamicHelp": false,
130
+ "hiddenAliases": [],
131
+ "id": "pull",
132
+ "pluginAlias": "@knocklabs/cli",
133
+ "pluginName": "@knocklabs/cli",
134
+ "pluginType": "core",
135
+ "strict": true,
136
+ "summary": "Pull all resources from an environment into a local file system.",
137
+ "enableJsonFlag": false,
138
+ "isESM": false,
139
+ "relativePath": [
140
+ "dist",
141
+ "commands",
142
+ "pull.js"
143
+ ]
144
+ },
145
+ "push": {
146
+ "aliases": [],
147
+ "args": {},
148
+ "flags": {
149
+ "service-token": {
150
+ "env": "KNOCK_SERVICE_TOKEN",
151
+ "name": "service-token",
152
+ "required": true,
153
+ "summary": "The service token to authenticate with.",
154
+ "hasDynamicHelp": false,
155
+ "multiple": false,
156
+ "type": "option"
157
+ },
158
+ "api-origin": {
159
+ "hidden": true,
160
+ "name": "api-origin",
161
+ "required": false,
162
+ "hasDynamicHelp": false,
163
+ "multiple": false,
164
+ "type": "option"
165
+ },
166
+ "environment": {
167
+ "name": "environment",
168
+ "summary": "Pushing resources is only allowed in the development environment",
169
+ "default": "development",
170
+ "hasDynamicHelp": false,
171
+ "multiple": false,
172
+ "options": [
173
+ "development"
174
+ ],
175
+ "type": "option"
176
+ },
177
+ "knock-dir": {
178
+ "name": "knock-dir",
179
+ "required": true,
180
+ "summary": "The target directory path to find all resources to push.",
181
+ "hasDynamicHelp": false,
182
+ "multiple": false,
183
+ "type": "option"
184
+ },
185
+ "commit": {
186
+ "name": "commit",
187
+ "summary": "Push and commit the resource(s) at the same time",
188
+ "allowNo": false,
189
+ "type": "boolean"
190
+ },
191
+ "commit-message": {
192
+ "char": "m",
193
+ "dependsOn": [
194
+ "commit"
195
+ ],
196
+ "name": "commit-message",
197
+ "summary": "Use the given value as the commit message",
198
+ "hasDynamicHelp": false,
199
+ "multiple": false,
200
+ "type": "option"
201
+ }
202
+ },
203
+ "hasDynamicHelp": false,
204
+ "hiddenAliases": [],
205
+ "id": "push",
206
+ "pluginAlias": "@knocklabs/cli",
207
+ "pluginName": "@knocklabs/cli",
208
+ "pluginType": "core",
209
+ "strict": true,
210
+ "summary": "Push all resources from a local file system to Knock.",
211
+ "enableJsonFlag": false,
212
+ "isESM": false,
213
+ "relativePath": [
214
+ "dist",
215
+ "commands",
216
+ "push.js"
217
+ ]
218
+ },
79
219
  "whoami": {
80
220
  "aliases": [],
81
221
  "args": {},
@@ -2029,6 +2169,61 @@
2029
2169
  "activate.js"
2030
2170
  ]
2031
2171
  },
2172
+ "workflow:generate-types": {
2173
+ "aliases": [],
2174
+ "args": {},
2175
+ "description": "Generate types for all workflows in the development environment and write them to a file.",
2176
+ "flags": {
2177
+ "service-token": {
2178
+ "env": "KNOCK_SERVICE_TOKEN",
2179
+ "name": "service-token",
2180
+ "required": true,
2181
+ "summary": "The service token to authenticate with.",
2182
+ "hasDynamicHelp": false,
2183
+ "multiple": false,
2184
+ "type": "option"
2185
+ },
2186
+ "api-origin": {
2187
+ "hidden": true,
2188
+ "name": "api-origin",
2189
+ "required": false,
2190
+ "hasDynamicHelp": false,
2191
+ "multiple": false,
2192
+ "type": "option"
2193
+ },
2194
+ "environment": {
2195
+ "name": "environment",
2196
+ "summary": "Select the environment to generate types for.",
2197
+ "default": "development",
2198
+ "hasDynamicHelp": false,
2199
+ "multiple": false,
2200
+ "type": "option"
2201
+ },
2202
+ "output-file": {
2203
+ "name": "output-file",
2204
+ "required": true,
2205
+ "summary": "The output file to write the generated types to. We currently support .ts, .rb, .go, .py files only. Your file extension will determine the target language for the generated types.",
2206
+ "hasDynamicHelp": false,
2207
+ "multiple": false,
2208
+ "type": "option"
2209
+ }
2210
+ },
2211
+ "hasDynamicHelp": false,
2212
+ "hiddenAliases": [],
2213
+ "id": "workflow:generate-types",
2214
+ "pluginAlias": "@knocklabs/cli",
2215
+ "pluginName": "@knocklabs/cli",
2216
+ "pluginType": "core",
2217
+ "strict": true,
2218
+ "enableJsonFlag": false,
2219
+ "isESM": false,
2220
+ "relativePath": [
2221
+ "dist",
2222
+ "commands",
2223
+ "workflow",
2224
+ "generate-types.js"
2225
+ ]
2226
+ },
2032
2227
  "workflow:get": {
2033
2228
  "aliases": [],
2034
2229
  "args": {
@@ -2557,5 +2752,5 @@
2557
2752
  ]
2558
2753
  }
2559
2754
  },
2560
- "version": "0.1.20"
2755
+ "version": "0.1.22"
2561
2756
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Knock CLI",
5
5
  "author": "@knocklabs",
6
6
  "bin": {
@@ -20,24 +20,25 @@
20
20
  "@oclif/core": "^3",
21
21
  "@oclif/plugin-help": "^6",
22
22
  "@prantlf/jsonlint": "^14.1.0",
23
- "axios": "^1.7.9",
23
+ "axios": "^1.9.0",
24
24
  "date-fns": "^2.30.0",
25
25
  "enquirer": "^2.4.1",
26
26
  "fs-extra": "^11.3.0",
27
- "liquidjs": "^10.21.0",
27
+ "liquidjs": "^10.21.1",
28
28
  "locale-codes": "^1.3.1",
29
29
  "lodash": "^4.17.21",
30
- "yup": "^1.4.0"
30
+ "quicktype-core": "^23.0.171",
31
+ "yup": "^1.6.1"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@oclif/test": "^3",
34
- "@swc/cli": "^0.4.0",
35
- "@swc/core": "^1.10.6",
36
- "@swc/helpers": "^0.5.15",
35
+ "@swc/cli": "^0.7.7",
36
+ "@swc/core": "^1.11.24",
37
+ "@swc/helpers": "^0.5.17",
37
38
  "@types/chai": "^4",
38
39
  "@types/fs-extra": "^11.0.4",
39
40
  "@types/mocha": "^10.0.10",
40
- "@types/node": "^20.17.24",
41
+ "@types/node": "^20.19.0",
41
42
  "chai": "^4",
42
43
  "eslint": "^7.32.0",
43
44
  "eslint-config-oclif": "^4",
@@ -49,12 +50,12 @@
49
50
  "nock": "^13.5.6",
50
51
  "oclif": "^4",
51
52
  "prettier": "2.8.8",
52
- "shx": "^0.3.4",
53
+ "shx": "^0.4.0",
53
54
  "sinon": "^16.1.3",
54
55
  "ts-node": "^10.9.1",
55
56
  "tsconfig-paths": "^4.2.0",
56
57
  "tslib": "^2.8.1",
57
- "typescript": "^5.5.4"
58
+ "typescript": "^5.8.3"
58
59
  },
59
60
  "oclif": {
60
61
  "bin": "knock",