@knocklabs/cli 0.1.19 → 0.1.21
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 +51 -29
- package/dist/commands/message-type/get.js +124 -0
- package/dist/commands/message-type/list.js +101 -0
- package/dist/commands/message-type/pull.js +218 -0
- package/dist/commands/message-type/push.js +171 -0
- package/dist/commands/message-type/validate.js +148 -0
- package/dist/commands/partial/pull.js +2 -2
- package/dist/commands/workflow/generate-types.js +138 -0
- package/dist/lib/api-v1.js +47 -0
- package/dist/lib/base-command.js +1 -4
- package/dist/lib/helpers/const.js +3 -3
- package/dist/lib/helpers/error.js +3 -6
- package/dist/lib/helpers/flag.js +16 -0
- package/dist/lib/helpers/page.js +3 -3
- package/dist/lib/marshal/guide/index.js +19 -0
- package/dist/lib/marshal/guide/processor.isomorphic.js +85 -0
- package/dist/lib/marshal/guide/types.js +4 -0
- package/dist/lib/marshal/index.isomorphic.js +12 -8
- package/dist/lib/marshal/message-type/helpers.js +135 -0
- package/dist/lib/marshal/message-type/index.js +3 -0
- package/dist/lib/marshal/message-type/reader.js +198 -0
- package/dist/lib/marshal/message-type/writer.js +175 -0
- package/dist/lib/marshal/partial/reader.js +3 -3
- package/dist/lib/marshal/partial/types.js +3 -3
- package/dist/lib/marshal/workflow/types.js +3 -3
- package/dist/lib/run-context/loader.js +35 -31
- package/dist/lib/type-generator.js +100 -0
- package/oclif.manifest.json +446 -1
- package/package.json +16 -15
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.21 linux-x64 node-v18.20.8
|
|
20
20
|
$ knock --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ knock COMMAND
|
|
@@ -49,6 +49,7 @@ USAGE
|
|
|
49
49
|
* [`knock translation validate [TRANSLATIONREF]`](#knock-translation-validate-translationref)
|
|
50
50
|
* [`knock whoami`](#knock-whoami)
|
|
51
51
|
* [`knock workflow activate WORKFLOWKEY`](#knock-workflow-activate-workflowkey)
|
|
52
|
+
* [`knock workflow generate-types`](#knock-workflow-generate-types)
|
|
52
53
|
* [`knock workflow get WORKFLOWKEY`](#knock-workflow-get-workflowkey)
|
|
53
54
|
* [`knock workflow list`](#knock-workflow-list)
|
|
54
55
|
* [`knock workflow pull [WORKFLOWKEY]`](#knock-workflow-pull-workflowkey)
|
|
@@ -73,7 +74,7 @@ FLAGS
|
|
|
73
74
|
--service-token=<value> (required) The service token to authenticate with.
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
77
|
+
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/commit/index.ts)_
|
|
77
78
|
|
|
78
79
|
## `knock commit get ID`
|
|
79
80
|
|
|
@@ -90,7 +91,7 @@ GLOBAL FLAGS
|
|
|
90
91
|
--json Format output as json.
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
94
|
+
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/commit/get.ts)_
|
|
94
95
|
|
|
95
96
|
## `knock commit list`
|
|
96
97
|
|
|
@@ -114,7 +115,7 @@ GLOBAL FLAGS
|
|
|
114
115
|
--json Format output as json.
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
118
|
+
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/commit/list.ts)_
|
|
118
119
|
|
|
119
120
|
## `knock commit promote`
|
|
120
121
|
|
|
@@ -131,7 +132,7 @@ FLAGS
|
|
|
131
132
|
--to=<value> The destination environment to promote all changes from the preceding environment.
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
135
|
+
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/commit/promote.ts)_
|
|
135
136
|
|
|
136
137
|
## `knock help [COMMAND]`
|
|
137
138
|
|
|
@@ -151,7 +152,7 @@ DESCRIPTION
|
|
|
151
152
|
Display help for knock.
|
|
152
153
|
```
|
|
153
154
|
|
|
154
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
155
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.28/src/commands/help.ts)_
|
|
155
156
|
|
|
156
157
|
## `knock layout get EMAILLAYOUTKEY`
|
|
157
158
|
|
|
@@ -171,7 +172,7 @@ GLOBAL FLAGS
|
|
|
171
172
|
--json Format output as json.
|
|
172
173
|
```
|
|
173
174
|
|
|
174
|
-
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
175
|
+
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/layout/get.ts)_
|
|
175
176
|
|
|
176
177
|
## `knock layout list`
|
|
177
178
|
|
|
@@ -194,7 +195,7 @@ GLOBAL FLAGS
|
|
|
194
195
|
--json Format output as json.
|
|
195
196
|
```
|
|
196
197
|
|
|
197
|
-
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
198
|
+
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/layout/list.ts)_
|
|
198
199
|
|
|
199
200
|
## `knock layout pull [EMAILLAYOUTKEY]`
|
|
200
201
|
|
|
@@ -214,7 +215,7 @@ FLAGS
|
|
|
214
215
|
--service-token=<value> (required) The service token to authenticate with.
|
|
215
216
|
```
|
|
216
217
|
|
|
217
|
-
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
218
|
+
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/layout/pull.ts)_
|
|
218
219
|
|
|
219
220
|
## `knock layout push [EMAILLAYOUTKEY]`
|
|
220
221
|
|
|
@@ -236,7 +237,7 @@ FLAGS
|
|
|
236
237
|
--service-token=<value> (required) The service token to authenticate with.
|
|
237
238
|
```
|
|
238
239
|
|
|
239
|
-
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
240
|
+
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/layout/push.ts)_
|
|
240
241
|
|
|
241
242
|
## `knock layout validate [EMAILLAYOUTKEY]`
|
|
242
243
|
|
|
@@ -255,7 +256,7 @@ FLAGS
|
|
|
255
256
|
--service-token=<value> (required) The service token to authenticate with.
|
|
256
257
|
```
|
|
257
258
|
|
|
258
|
-
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
259
|
+
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/layout/validate.ts)_
|
|
259
260
|
|
|
260
261
|
## `knock partial get PARTIALKEY`
|
|
261
262
|
|
|
@@ -275,7 +276,7 @@ GLOBAL FLAGS
|
|
|
275
276
|
--json Format output as json.
|
|
276
277
|
```
|
|
277
278
|
|
|
278
|
-
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
279
|
+
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/partial/get.ts)_
|
|
279
280
|
|
|
280
281
|
## `knock partial list`
|
|
281
282
|
|
|
@@ -298,7 +299,7 @@ GLOBAL FLAGS
|
|
|
298
299
|
--json Format output as json.
|
|
299
300
|
```
|
|
300
301
|
|
|
301
|
-
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
302
|
+
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/partial/list.ts)_
|
|
302
303
|
|
|
303
304
|
## `knock partial pull [PARTIALKEY]`
|
|
304
305
|
|
|
@@ -318,7 +319,7 @@ FLAGS
|
|
|
318
319
|
--service-token=<value> (required) The service token to authenticate with.
|
|
319
320
|
```
|
|
320
321
|
|
|
321
|
-
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
322
|
+
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/partial/pull.ts)_
|
|
322
323
|
|
|
323
324
|
## `knock partial push [PARTIALKEY]`
|
|
324
325
|
|
|
@@ -339,7 +340,7 @@ FLAGS
|
|
|
339
340
|
--service-token=<value> (required) The service token to authenticate with.
|
|
340
341
|
```
|
|
341
342
|
|
|
342
|
-
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
343
|
+
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/partial/push.ts)_
|
|
343
344
|
|
|
344
345
|
## `knock partial validate [PARTIALKEY]`
|
|
345
346
|
|
|
@@ -358,7 +359,7 @@ FLAGS
|
|
|
358
359
|
--service-token=<value> (required) The service token to authenticate with.
|
|
359
360
|
```
|
|
360
361
|
|
|
361
|
-
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
362
|
+
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/partial/validate.ts)_
|
|
362
363
|
|
|
363
364
|
## `knock translation get TRANSLATIONREF`
|
|
364
365
|
|
|
@@ -385,7 +386,7 @@ GLOBAL FLAGS
|
|
|
385
386
|
--json Format output as json.
|
|
386
387
|
```
|
|
387
388
|
|
|
388
|
-
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
389
|
+
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/translation/get.ts)_
|
|
389
390
|
|
|
390
391
|
## `knock translation list`
|
|
391
392
|
|
|
@@ -408,7 +409,7 @@ GLOBAL FLAGS
|
|
|
408
409
|
--json Format output as json.
|
|
409
410
|
```
|
|
410
411
|
|
|
411
|
-
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
412
|
+
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/translation/list.ts)_
|
|
412
413
|
|
|
413
414
|
## `knock translation pull [TRANSLATIONREF]`
|
|
414
415
|
|
|
@@ -435,7 +436,7 @@ FLAGS
|
|
|
435
436
|
--translations-dir=<value> The target directory path to pull all translations into.
|
|
436
437
|
```
|
|
437
438
|
|
|
438
|
-
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
439
|
+
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/translation/pull.ts)_
|
|
439
440
|
|
|
440
441
|
## `knock translation push [TRANSLATIONREF]`
|
|
441
442
|
|
|
@@ -462,7 +463,7 @@ FLAGS
|
|
|
462
463
|
--translations-dir=<value> The target directory path to find all translations to push.
|
|
463
464
|
```
|
|
464
465
|
|
|
465
|
-
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
466
|
+
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/translation/push.ts)_
|
|
466
467
|
|
|
467
468
|
## `knock translation validate [TRANSLATIONREF]`
|
|
468
469
|
|
|
@@ -487,7 +488,7 @@ FLAGS
|
|
|
487
488
|
--translations-dir=<value> The target directory path to find all translations to validate.
|
|
488
489
|
```
|
|
489
490
|
|
|
490
|
-
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
491
|
+
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/translation/validate.ts)_
|
|
491
492
|
|
|
492
493
|
## `knock whoami`
|
|
493
494
|
|
|
@@ -504,7 +505,7 @@ GLOBAL FLAGS
|
|
|
504
505
|
--json Format output as json.
|
|
505
506
|
```
|
|
506
507
|
|
|
507
|
-
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
508
|
+
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/whoami.ts)_
|
|
508
509
|
|
|
509
510
|
## `knock workflow activate WORKFLOWKEY`
|
|
510
511
|
|
|
@@ -531,7 +532,28 @@ DESCRIPTION
|
|
|
531
532
|
with `false` in order to deactivate it.
|
|
532
533
|
```
|
|
533
534
|
|
|
534
|
-
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
535
|
+
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/activate.ts)_
|
|
536
|
+
|
|
537
|
+
## `knock workflow generate-types`
|
|
538
|
+
|
|
539
|
+
Generate types for all workflows in the development environment and write them to a file.
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
USAGE
|
|
543
|
+
$ knock workflow generate-types --service-token <value> --output-file <value> [--environment <value>]
|
|
544
|
+
|
|
545
|
+
FLAGS
|
|
546
|
+
--environment=<value> [default: development] Select the environment to generate types for.
|
|
547
|
+
--output-file=<value> (required) The output file to write the generated types to. We currently support .ts, .rb,
|
|
548
|
+
.go, .py files only. Your file extension will determine the target language for the generated
|
|
549
|
+
types.
|
|
550
|
+
--service-token=<value> (required) The service token to authenticate with.
|
|
551
|
+
|
|
552
|
+
DESCRIPTION
|
|
553
|
+
Generate types for all workflows in the development environment and write them to a file.
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/generate-types.ts)_
|
|
535
557
|
|
|
536
558
|
## `knock workflow get WORKFLOWKEY`
|
|
537
559
|
|
|
@@ -551,7 +573,7 @@ GLOBAL FLAGS
|
|
|
551
573
|
--json Format output as json.
|
|
552
574
|
```
|
|
553
575
|
|
|
554
|
-
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
576
|
+
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/get.ts)_
|
|
555
577
|
|
|
556
578
|
## `knock workflow list`
|
|
557
579
|
|
|
@@ -574,7 +596,7 @@ GLOBAL FLAGS
|
|
|
574
596
|
--json Format output as json.
|
|
575
597
|
```
|
|
576
598
|
|
|
577
|
-
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
599
|
+
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/list.ts)_
|
|
578
600
|
|
|
579
601
|
## `knock workflow pull [WORKFLOWKEY]`
|
|
580
602
|
|
|
@@ -594,7 +616,7 @@ FLAGS
|
|
|
594
616
|
--workflows-dir=<value> The target directory path to pull all workflows into.
|
|
595
617
|
```
|
|
596
618
|
|
|
597
|
-
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
619
|
+
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/pull.ts)_
|
|
598
620
|
|
|
599
621
|
## `knock workflow push [WORKFLOWKEY]`
|
|
600
622
|
|
|
@@ -615,7 +637,7 @@ FLAGS
|
|
|
615
637
|
--workflows-dir=<value> The target directory path to find all workflows to push.
|
|
616
638
|
```
|
|
617
639
|
|
|
618
|
-
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
640
|
+
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/push.ts)_
|
|
619
641
|
|
|
620
642
|
## `knock workflow run WORKFLOWKEY`
|
|
621
643
|
|
|
@@ -636,7 +658,7 @@ FLAGS
|
|
|
636
658
|
--tenant=<value> A tenant id for the workflow run.
|
|
637
659
|
```
|
|
638
660
|
|
|
639
|
-
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
661
|
+
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/run.ts)_
|
|
640
662
|
|
|
641
663
|
## `knock workflow validate [WORKFLOWKEY]`
|
|
642
664
|
|
|
@@ -655,5 +677,5 @@ FLAGS
|
|
|
655
677
|
--workflows-dir=<value> The target directory path to find all workflows to validate.
|
|
656
678
|
```
|
|
657
679
|
|
|
658
|
-
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.
|
|
680
|
+
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.21/src/commands/workflow/validate.ts)_
|
|
659
681
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,124 @@
|
|
|
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 MessageTypeGet;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@oclif/core");
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _date = require("../../lib/helpers/date");
|
|
14
|
+
const _error = require("../../lib/helpers/error");
|
|
15
|
+
const _request = require("../../lib/helpers/request");
|
|
16
|
+
const _ux = require("../../lib/helpers/ux");
|
|
17
|
+
function _define_property(obj, key, value) {
|
|
18
|
+
if (key in obj) {
|
|
19
|
+
Object.defineProperty(obj, key, {
|
|
20
|
+
value: value,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
obj[key] = value;
|
|
27
|
+
}
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
class MessageTypeGet extends _basecommand.default {
|
|
36
|
+
async run() {
|
|
37
|
+
_ux.spinner.start("‣ Loading");
|
|
38
|
+
const { messageType } = await this.loadMessageType();
|
|
39
|
+
_ux.spinner.stop();
|
|
40
|
+
const { flags } = this.props;
|
|
41
|
+
if (flags.json) return messageType;
|
|
42
|
+
this.render(messageType);
|
|
43
|
+
}
|
|
44
|
+
async loadMessageType() {
|
|
45
|
+
const messageTypeResp = await this.apiV1.getMessageType(this.props);
|
|
46
|
+
if (!(0, _request.isSuccessResp)(messageTypeResp)) {
|
|
47
|
+
const message = (0, _request.formatErrorRespMessage)(messageTypeResp);
|
|
48
|
+
_core.ux.error(new _error.ApiError(message));
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
messageType: messageTypeResp.data
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
render(messageType) {
|
|
55
|
+
const { messageTypeKey } = this.props.args;
|
|
56
|
+
const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
|
|
57
|
+
const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
|
|
58
|
+
this.log(`‣ Showing in-app message type \`${messageTypeKey}\` in \`${env}\` environment ${qualifier}\n`);
|
|
59
|
+
/*
|
|
60
|
+
* Message type table
|
|
61
|
+
*/ const rows = [
|
|
62
|
+
{
|
|
63
|
+
key: "Name",
|
|
64
|
+
value: messageType.name
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "Key",
|
|
68
|
+
value: messageType.key
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "Description",
|
|
72
|
+
value: messageType.description || "-"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "Owner",
|
|
76
|
+
value: messageType.owner
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: "Created at",
|
|
80
|
+
value: (0, _date.formatDateTime)(messageType.created_at)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "Updated at",
|
|
84
|
+
value: (0, _date.formatDateTime)(messageType.updated_at)
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: "Schema",
|
|
88
|
+
value: (messageType.variants || []).length > 0 ? "\n" + JSON.stringify(messageType.variants, null, 2) : "-"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "Preview template",
|
|
92
|
+
value: messageType.preview ? "\n" + messageType.preview : "-"
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
_core.ux.table(rows, {
|
|
96
|
+
key: {
|
|
97
|
+
header: "Message type",
|
|
98
|
+
minWidth: 24
|
|
99
|
+
},
|
|
100
|
+
value: {
|
|
101
|
+
header: "",
|
|
102
|
+
minWidth: 24
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Hide until guides are released in GA.
|
|
108
|
+
_define_property(MessageTypeGet, "hidden", true);
|
|
109
|
+
_define_property(MessageTypeGet, "summary", "Display a single in-app message type from an environment.");
|
|
110
|
+
_define_property(MessageTypeGet, "flags", {
|
|
111
|
+
environment: _core.Flags.string({
|
|
112
|
+
default: "development",
|
|
113
|
+
summary: "The environment to use."
|
|
114
|
+
}),
|
|
115
|
+
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
116
|
+
summary: "Hide any uncommitted changes."
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
_define_property(MessageTypeGet, "args", {
|
|
120
|
+
messageTypeKey: _core.Args.string({
|
|
121
|
+
required: true
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
_define_property(MessageTypeGet, "enableJsonFlag", true);
|
|
@@ -0,0 +1,101 @@
|
|
|
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 MessageTypeList;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@oclif/core");
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _date = require("../../lib/helpers/date");
|
|
14
|
+
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
15
|
+
const _page = require("../../lib/helpers/page");
|
|
16
|
+
const _request = require("../../lib/helpers/request");
|
|
17
|
+
function _define_property(obj, key, value) {
|
|
18
|
+
if (key in obj) {
|
|
19
|
+
Object.defineProperty(obj, key, {
|
|
20
|
+
value: value,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
obj[key] = value;
|
|
27
|
+
}
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
class MessageTypeList extends _basecommand.default {
|
|
36
|
+
async run() {
|
|
37
|
+
const resp = await this.request();
|
|
38
|
+
const { flags } = this.props;
|
|
39
|
+
if (flags.json) return resp.data;
|
|
40
|
+
this.render(resp.data);
|
|
41
|
+
}
|
|
42
|
+
async request(pageParams = {}) {
|
|
43
|
+
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
44
|
+
flags: {
|
|
45
|
+
...pageParams
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return (0, _request.withSpinner)(()=>this.apiV1.listMessageTypes(props));
|
|
49
|
+
}
|
|
50
|
+
async render(data) {
|
|
51
|
+
const { entries } = data;
|
|
52
|
+
const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
|
|
53
|
+
const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
|
|
54
|
+
this.log(`‣ Showing ${entries.length} in-app message types in \`${env}\` environment ${qualifier}\n`);
|
|
55
|
+
/*
|
|
56
|
+
* Message types list table
|
|
57
|
+
*/ _core.ux.table(entries, {
|
|
58
|
+
key: {
|
|
59
|
+
header: "Key"
|
|
60
|
+
},
|
|
61
|
+
name: {
|
|
62
|
+
header: "Name"
|
|
63
|
+
},
|
|
64
|
+
description: {
|
|
65
|
+
header: "Description"
|
|
66
|
+
},
|
|
67
|
+
owner: {
|
|
68
|
+
header: "Owner"
|
|
69
|
+
},
|
|
70
|
+
updated_at: {
|
|
71
|
+
header: "Updated at",
|
|
72
|
+
get: (entry)=>(0, _date.formatDate)(entry.updated_at)
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return this.prompt(data);
|
|
76
|
+
}
|
|
77
|
+
async prompt(data) {
|
|
78
|
+
const { page_info } = data;
|
|
79
|
+
const pageAction = await (0, _page.maybePromptPageAction)(page_info);
|
|
80
|
+
const pageParams = pageAction && (0, _page.paramsForPageAction)(pageAction, page_info);
|
|
81
|
+
if (pageParams) {
|
|
82
|
+
this.log("\n");
|
|
83
|
+
const resp = await this.request(pageParams);
|
|
84
|
+
return this.render(resp.data);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Hide until guides are released in GA.
|
|
89
|
+
_define_property(MessageTypeList, "hidden", true);
|
|
90
|
+
_define_property(MessageTypeList, "summary", "Display all in-app message types for an environment.");
|
|
91
|
+
_define_property(MessageTypeList, "flags", {
|
|
92
|
+
environment: _core.Flags.string({
|
|
93
|
+
default: "development",
|
|
94
|
+
summary: "The environment to use."
|
|
95
|
+
}),
|
|
96
|
+
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
97
|
+
summary: "Hide any uncommitted changes."
|
|
98
|
+
}),
|
|
99
|
+
..._page.pageFlags
|
|
100
|
+
});
|
|
101
|
+
_define_property(MessageTypeList, "enableJsonFlag", true);
|