@knocklabs/cli 0.1.21 → 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 +70 -29
- package/dist/commands/pull.js +157 -0
- package/dist/commands/push.js +175 -0
- package/dist/lib/resources.js +32 -0
- package/oclif.manifest.json +303 -163
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ npm install -g @knocklabs/cli
|
|
|
16
16
|
$ knock COMMAND
|
|
17
17
|
running command...
|
|
18
18
|
$ knock (--version)
|
|
19
|
-
@knocklabs/cli/0.1.
|
|
19
|
+
@knocklabs/cli/0.1.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)
|
|
@@ -74,7 +76,7 @@ FLAGS
|
|
|
74
76
|
--service-token=<value> (required) The service token to authenticate with.
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
79
|
+
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/index.ts)_
|
|
78
80
|
|
|
79
81
|
## `knock commit get ID`
|
|
80
82
|
|
|
@@ -91,7 +93,7 @@ GLOBAL FLAGS
|
|
|
91
93
|
--json Format output as json.
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
96
|
+
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/get.ts)_
|
|
95
97
|
|
|
96
98
|
## `knock commit list`
|
|
97
99
|
|
|
@@ -115,7 +117,7 @@ GLOBAL FLAGS
|
|
|
115
117
|
--json Format output as json.
|
|
116
118
|
```
|
|
117
119
|
|
|
118
|
-
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
120
|
+
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/list.ts)_
|
|
119
121
|
|
|
120
122
|
## `knock commit promote`
|
|
121
123
|
|
|
@@ -132,7 +134,7 @@ FLAGS
|
|
|
132
134
|
--to=<value> The destination environment to promote all changes from the preceding environment.
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
137
|
+
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/commit/promote.ts)_
|
|
136
138
|
|
|
137
139
|
## `knock help [COMMAND]`
|
|
138
140
|
|
|
@@ -172,7 +174,7 @@ GLOBAL FLAGS
|
|
|
172
174
|
--json Format output as json.
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
177
|
+
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/get.ts)_
|
|
176
178
|
|
|
177
179
|
## `knock layout list`
|
|
178
180
|
|
|
@@ -195,7 +197,7 @@ GLOBAL FLAGS
|
|
|
195
197
|
--json Format output as json.
|
|
196
198
|
```
|
|
197
199
|
|
|
198
|
-
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
200
|
+
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/list.ts)_
|
|
199
201
|
|
|
200
202
|
## `knock layout pull [EMAILLAYOUTKEY]`
|
|
201
203
|
|
|
@@ -215,7 +217,7 @@ FLAGS
|
|
|
215
217
|
--service-token=<value> (required) The service token to authenticate with.
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
220
|
+
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/pull.ts)_
|
|
219
221
|
|
|
220
222
|
## `knock layout push [EMAILLAYOUTKEY]`
|
|
221
223
|
|
|
@@ -237,7 +239,7 @@ FLAGS
|
|
|
237
239
|
--service-token=<value> (required) The service token to authenticate with.
|
|
238
240
|
```
|
|
239
241
|
|
|
240
|
-
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
242
|
+
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/push.ts)_
|
|
241
243
|
|
|
242
244
|
## `knock layout validate [EMAILLAYOUTKEY]`
|
|
243
245
|
|
|
@@ -256,7 +258,7 @@ FLAGS
|
|
|
256
258
|
--service-token=<value> (required) The service token to authenticate with.
|
|
257
259
|
```
|
|
258
260
|
|
|
259
|
-
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
261
|
+
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/layout/validate.ts)_
|
|
260
262
|
|
|
261
263
|
## `knock partial get PARTIALKEY`
|
|
262
264
|
|
|
@@ -276,7 +278,7 @@ GLOBAL FLAGS
|
|
|
276
278
|
--json Format output as json.
|
|
277
279
|
```
|
|
278
280
|
|
|
279
|
-
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
281
|
+
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/get.ts)_
|
|
280
282
|
|
|
281
283
|
## `knock partial list`
|
|
282
284
|
|
|
@@ -299,7 +301,7 @@ GLOBAL FLAGS
|
|
|
299
301
|
--json Format output as json.
|
|
300
302
|
```
|
|
301
303
|
|
|
302
|
-
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
304
|
+
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/list.ts)_
|
|
303
305
|
|
|
304
306
|
## `knock partial pull [PARTIALKEY]`
|
|
305
307
|
|
|
@@ -319,7 +321,7 @@ FLAGS
|
|
|
319
321
|
--service-token=<value> (required) The service token to authenticate with.
|
|
320
322
|
```
|
|
321
323
|
|
|
322
|
-
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
324
|
+
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/pull.ts)_
|
|
323
325
|
|
|
324
326
|
## `knock partial push [PARTIALKEY]`
|
|
325
327
|
|
|
@@ -340,7 +342,7 @@ FLAGS
|
|
|
340
342
|
--service-token=<value> (required) The service token to authenticate with.
|
|
341
343
|
```
|
|
342
344
|
|
|
343
|
-
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
345
|
+
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/partial/push.ts)_
|
|
344
346
|
|
|
345
347
|
## `knock partial validate [PARTIALKEY]`
|
|
346
348
|
|
|
@@ -359,7 +361,46 @@ FLAGS
|
|
|
359
361
|
--service-token=<value> (required) The service token to authenticate with.
|
|
360
362
|
```
|
|
361
363
|
|
|
362
|
-
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
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)_
|
|
363
404
|
|
|
364
405
|
## `knock translation get TRANSLATIONREF`
|
|
365
406
|
|
|
@@ -386,7 +427,7 @@ GLOBAL FLAGS
|
|
|
386
427
|
--json Format output as json.
|
|
387
428
|
```
|
|
388
429
|
|
|
389
|
-
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
430
|
+
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/get.ts)_
|
|
390
431
|
|
|
391
432
|
## `knock translation list`
|
|
392
433
|
|
|
@@ -409,7 +450,7 @@ GLOBAL FLAGS
|
|
|
409
450
|
--json Format output as json.
|
|
410
451
|
```
|
|
411
452
|
|
|
412
|
-
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
453
|
+
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/list.ts)_
|
|
413
454
|
|
|
414
455
|
## `knock translation pull [TRANSLATIONREF]`
|
|
415
456
|
|
|
@@ -436,7 +477,7 @@ FLAGS
|
|
|
436
477
|
--translations-dir=<value> The target directory path to pull all translations into.
|
|
437
478
|
```
|
|
438
479
|
|
|
439
|
-
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
480
|
+
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/pull.ts)_
|
|
440
481
|
|
|
441
482
|
## `knock translation push [TRANSLATIONREF]`
|
|
442
483
|
|
|
@@ -463,7 +504,7 @@ FLAGS
|
|
|
463
504
|
--translations-dir=<value> The target directory path to find all translations to push.
|
|
464
505
|
```
|
|
465
506
|
|
|
466
|
-
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
507
|
+
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/push.ts)_
|
|
467
508
|
|
|
468
509
|
## `knock translation validate [TRANSLATIONREF]`
|
|
469
510
|
|
|
@@ -488,7 +529,7 @@ FLAGS
|
|
|
488
529
|
--translations-dir=<value> The target directory path to find all translations to validate.
|
|
489
530
|
```
|
|
490
531
|
|
|
491
|
-
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
532
|
+
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/translation/validate.ts)_
|
|
492
533
|
|
|
493
534
|
## `knock whoami`
|
|
494
535
|
|
|
@@ -505,7 +546,7 @@ GLOBAL FLAGS
|
|
|
505
546
|
--json Format output as json.
|
|
506
547
|
```
|
|
507
548
|
|
|
508
|
-
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
549
|
+
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/whoami.ts)_
|
|
509
550
|
|
|
510
551
|
## `knock workflow activate WORKFLOWKEY`
|
|
511
552
|
|
|
@@ -532,7 +573,7 @@ DESCRIPTION
|
|
|
532
573
|
with `false` in order to deactivate it.
|
|
533
574
|
```
|
|
534
575
|
|
|
535
|
-
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
576
|
+
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/activate.ts)_
|
|
536
577
|
|
|
537
578
|
## `knock workflow generate-types`
|
|
538
579
|
|
|
@@ -553,7 +594,7 @@ DESCRIPTION
|
|
|
553
594
|
Generate types for all workflows in the development environment and write them to a file.
|
|
554
595
|
```
|
|
555
596
|
|
|
556
|
-
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
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)_
|
|
557
598
|
|
|
558
599
|
## `knock workflow get WORKFLOWKEY`
|
|
559
600
|
|
|
@@ -573,7 +614,7 @@ GLOBAL FLAGS
|
|
|
573
614
|
--json Format output as json.
|
|
574
615
|
```
|
|
575
616
|
|
|
576
|
-
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
617
|
+
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/get.ts)_
|
|
577
618
|
|
|
578
619
|
## `knock workflow list`
|
|
579
620
|
|
|
@@ -596,7 +637,7 @@ GLOBAL FLAGS
|
|
|
596
637
|
--json Format output as json.
|
|
597
638
|
```
|
|
598
639
|
|
|
599
|
-
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
640
|
+
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/list.ts)_
|
|
600
641
|
|
|
601
642
|
## `knock workflow pull [WORKFLOWKEY]`
|
|
602
643
|
|
|
@@ -616,7 +657,7 @@ FLAGS
|
|
|
616
657
|
--workflows-dir=<value> The target directory path to pull all workflows into.
|
|
617
658
|
```
|
|
618
659
|
|
|
619
|
-
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
660
|
+
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/pull.ts)_
|
|
620
661
|
|
|
621
662
|
## `knock workflow push [WORKFLOWKEY]`
|
|
622
663
|
|
|
@@ -637,7 +678,7 @@ FLAGS
|
|
|
637
678
|
--workflows-dir=<value> The target directory path to find all workflows to push.
|
|
638
679
|
```
|
|
639
680
|
|
|
640
|
-
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
681
|
+
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/push.ts)_
|
|
641
682
|
|
|
642
683
|
## `knock workflow run WORKFLOWKEY`
|
|
643
684
|
|
|
@@ -658,7 +699,7 @@ FLAGS
|
|
|
658
699
|
--tenant=<value> A tenant id for the workflow run.
|
|
659
700
|
```
|
|
660
701
|
|
|
661
|
-
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
702
|
+
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/run.ts)_
|
|
662
703
|
|
|
663
704
|
## `knock workflow validate [WORKFLOWKEY]`
|
|
664
705
|
|
|
@@ -677,5 +718,5 @@ FLAGS
|
|
|
677
718
|
--workflows-dir=<value> The target directory path to find all workflows to validate.
|
|
678
719
|
```
|
|
679
720
|
|
|
680
|
-
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
721
|
+
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.22/src/commands/workflow/validate.ts)_
|
|
681
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,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
|
+
};
|