@knocklabs/cli 0.1.15 → 0.1.17

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.15 linux-x64 node-v18.20.2
19
+ @knocklabs/cli/0.1.17 linux-x64 node-v18.20.3
20
20
  $ knock --help [COMMAND]
21
21
  USAGE
22
22
  $ knock COMMAND
@@ -37,16 +37,6 @@ USAGE
37
37
  * [`knock layout pull [EMAILLAYOUTKEY]`](#knock-layout-pull-emaillayoutkey)
38
38
  * [`knock layout push [EMAILLAYOUTKEY]`](#knock-layout-push-emaillayoutkey)
39
39
  * [`knock layout validate [EMAILLAYOUTKEY]`](#knock-layout-validate-emaillayoutkey)
40
- * [`knock plugins`](#knock-plugins)
41
- * [`knock plugins:install PLUGIN...`](#knock-pluginsinstall-plugin)
42
- * [`knock plugins:inspect PLUGIN...`](#knock-pluginsinspect-plugin)
43
- * [`knock plugins:install PLUGIN...`](#knock-pluginsinstall-plugin-1)
44
- * [`knock plugins:link PLUGIN`](#knock-pluginslink-plugin)
45
- * [`knock plugins:uninstall PLUGIN...`](#knock-pluginsuninstall-plugin)
46
- * [`knock plugins reset`](#knock-plugins-reset)
47
- * [`knock plugins:uninstall PLUGIN...`](#knock-pluginsuninstall-plugin-1)
48
- * [`knock plugins:uninstall PLUGIN...`](#knock-pluginsuninstall-plugin-2)
49
- * [`knock plugins update`](#knock-plugins-update)
50
40
  * [`knock translation get TRANSLATIONREF`](#knock-translation-get-translationref)
51
41
  * [`knock translation list`](#knock-translation-list)
52
42
  * [`knock translation pull [TRANSLATIONREF]`](#knock-translation-pull-translationref)
@@ -78,7 +68,7 @@ FLAGS
78
68
  --service-token=<value> (required) The service token to authenticate with.
79
69
  ```
80
70
 
81
- _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/commit/index.ts)_
71
+ _See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/commit/index.ts)_
82
72
 
83
73
  ## `knock commit get ID`
84
74
 
@@ -95,7 +85,7 @@ GLOBAL FLAGS
95
85
  --json Format output as json.
96
86
  ```
97
87
 
98
- _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/commit/get.ts)_
88
+ _See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/commit/get.ts)_
99
89
 
100
90
  ## `knock commit list`
101
91
 
@@ -119,7 +109,7 @@ GLOBAL FLAGS
119
109
  --json Format output as json.
120
110
  ```
121
111
 
122
- _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/commit/list.ts)_
112
+ _See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/commit/list.ts)_
123
113
 
124
114
  ## `knock commit promote`
125
115
 
@@ -136,7 +126,7 @@ FLAGS
136
126
  --to=<value> The destination environment to promote all changes from the preceding environment.
137
127
  ```
138
128
 
139
- _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/commit/promote.ts)_
129
+ _See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/commit/promote.ts)_
140
130
 
141
131
  ## `knock help [COMMAND]`
142
132
 
@@ -156,7 +146,7 @@ DESCRIPTION
156
146
  Display help for knock.
157
147
  ```
158
148
 
159
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.21/src/commands/help.ts)_
149
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.3/src/commands/help.ts)_
160
150
 
161
151
  ## `knock layout get EMAILLAYOUTKEY`
162
152
 
@@ -176,7 +166,7 @@ GLOBAL FLAGS
176
166
  --json Format output as json.
177
167
  ```
178
168
 
179
- _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/layout/get.ts)_
169
+ _See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/layout/get.ts)_
180
170
 
181
171
  ## `knock layout list`
182
172
 
@@ -199,7 +189,7 @@ GLOBAL FLAGS
199
189
  --json Format output as json.
200
190
  ```
201
191
 
202
- _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/layout/list.ts)_
192
+ _See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/layout/list.ts)_
203
193
 
204
194
  ## `knock layout pull [EMAILLAYOUTKEY]`
205
195
 
@@ -219,7 +209,7 @@ FLAGS
219
209
  --service-token=<value> (required) The service token to authenticate with.
220
210
  ```
221
211
 
222
- _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/layout/pull.ts)_
212
+ _See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/layout/pull.ts)_
223
213
 
224
214
  ## `knock layout push [EMAILLAYOUTKEY]`
225
215
 
@@ -241,7 +231,7 @@ FLAGS
241
231
  --service-token=<value> (required) The service token to authenticate with.
242
232
  ```
243
233
 
244
- _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/layout/push.ts)_
234
+ _See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/layout/push.ts)_
245
235
 
246
236
  ## `knock layout validate [EMAILLAYOUTKEY]`
247
237
 
@@ -260,286 +250,7 @@ FLAGS
260
250
  --service-token=<value> (required) The service token to authenticate with.
261
251
  ```
262
252
 
263
- _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/layout/validate.ts)_
264
-
265
- ## `knock plugins`
266
-
267
- List installed plugins.
268
-
269
- ```
270
- USAGE
271
- $ knock plugins [--json] [--core]
272
-
273
- FLAGS
274
- --core Show core plugins.
275
-
276
- GLOBAL FLAGS
277
- --json Format output as json.
278
-
279
- DESCRIPTION
280
- List installed plugins.
281
-
282
- EXAMPLES
283
- $ knock plugins
284
- ```
285
-
286
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/index.ts)_
287
-
288
- ## `knock plugins:install PLUGIN...`
289
-
290
- Installs a plugin into the CLI.
291
-
292
- ```
293
- USAGE
294
- $ knock plugins add plugins:install PLUGIN...
295
-
296
- ARGUMENTS
297
- PLUGIN... Plugin to install.
298
-
299
- FLAGS
300
- -f, --force Run yarn install with force flag.
301
- -h, --help Show CLI help.
302
- -s, --silent Silences yarn output.
303
- -v, --verbose Show verbose yarn output.
304
-
305
- GLOBAL FLAGS
306
- --json Format output as json.
307
-
308
- DESCRIPTION
309
- Installs a plugin into the CLI.
310
- Can be installed from npm or a git url.
311
-
312
- Installation of a user-installed plugin will override a core plugin.
313
-
314
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
315
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
316
- the CLI without the need to patch and update the whole CLI.
317
-
318
-
319
- ALIASES
320
- $ knock plugins add
321
-
322
- EXAMPLES
323
- $ knock plugins add myplugin
324
-
325
- $ knock plugins add https://github.com/someuser/someplugin
326
-
327
- $ knock plugins add someuser/someplugin
328
- ```
329
-
330
- ## `knock plugins:inspect PLUGIN...`
331
-
332
- Displays installation properties of a plugin.
333
-
334
- ```
335
- USAGE
336
- $ knock plugins inspect PLUGIN...
337
-
338
- ARGUMENTS
339
- PLUGIN... [default: .] Plugin to inspect.
340
-
341
- FLAGS
342
- -h, --help Show CLI help.
343
- -v, --verbose
344
-
345
- GLOBAL FLAGS
346
- --json Format output as json.
347
-
348
- DESCRIPTION
349
- Displays installation properties of a plugin.
350
-
351
- EXAMPLES
352
- $ knock plugins inspect myplugin
353
- ```
354
-
355
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/inspect.ts)_
356
-
357
- ## `knock plugins:install PLUGIN...`
358
-
359
- Installs a plugin into the CLI.
360
-
361
- ```
362
- USAGE
363
- $ knock plugins install PLUGIN...
364
-
365
- ARGUMENTS
366
- PLUGIN... Plugin to install.
367
-
368
- FLAGS
369
- -f, --force Run yarn install with force flag.
370
- -h, --help Show CLI help.
371
- -s, --silent Silences yarn output.
372
- -v, --verbose Show verbose yarn output.
373
-
374
- GLOBAL FLAGS
375
- --json Format output as json.
376
-
377
- DESCRIPTION
378
- Installs a plugin into the CLI.
379
- Can be installed from npm or a git url.
380
-
381
- Installation of a user-installed plugin will override a core plugin.
382
-
383
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
384
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
385
- the CLI without the need to patch and update the whole CLI.
386
-
387
-
388
- ALIASES
389
- $ knock plugins add
390
-
391
- EXAMPLES
392
- $ knock plugins install myplugin
393
-
394
- $ knock plugins install https://github.com/someuser/someplugin
395
-
396
- $ knock plugins install someuser/someplugin
397
- ```
398
-
399
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/install.ts)_
400
-
401
- ## `knock plugins:link PLUGIN`
402
-
403
- Links a plugin into the CLI for development.
404
-
405
- ```
406
- USAGE
407
- $ knock plugins link PLUGIN
408
-
409
- ARGUMENTS
410
- PATH [default: .] path to plugin
411
-
412
- FLAGS
413
- -h, --help Show CLI help.
414
- -v, --verbose
415
- --[no-]install Install dependencies after linking the plugin.
416
-
417
- DESCRIPTION
418
- Links a plugin into the CLI for development.
419
- Installation of a linked plugin will override a user-installed or core plugin.
420
-
421
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
422
- command will override the user-installed or core plugin implementation. This is useful for development work.
423
-
424
-
425
- EXAMPLES
426
- $ knock plugins link myplugin
427
- ```
428
-
429
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/link.ts)_
430
-
431
- ## `knock plugins:uninstall PLUGIN...`
432
-
433
- Removes a plugin from the CLI.
434
-
435
- ```
436
- USAGE
437
- $ knock plugins remove plugins:uninstall PLUGIN...
438
-
439
- ARGUMENTS
440
- PLUGIN... plugin to uninstall
441
-
442
- FLAGS
443
- -h, --help Show CLI help.
444
- -v, --verbose
445
-
446
- DESCRIPTION
447
- Removes a plugin from the CLI.
448
-
449
- ALIASES
450
- $ knock plugins unlink
451
- $ knock plugins remove
452
-
453
- EXAMPLES
454
- $ knock plugins remove myplugin
455
- ```
456
-
457
- ## `knock plugins reset`
458
-
459
- Remove all user-installed and linked plugins.
460
-
461
- ```
462
- USAGE
463
- $ knock plugins reset [--hard] [--reinstall]
464
-
465
- FLAGS
466
- --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
467
- --reinstall Reinstall all plugins after uninstalling.
468
- ```
469
-
470
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/reset.ts)_
471
-
472
- ## `knock plugins:uninstall PLUGIN...`
473
-
474
- Removes a plugin from the CLI.
475
-
476
- ```
477
- USAGE
478
- $ knock plugins uninstall PLUGIN...
479
-
480
- ARGUMENTS
481
- PLUGIN... plugin to uninstall
482
-
483
- FLAGS
484
- -h, --help Show CLI help.
485
- -v, --verbose
486
-
487
- DESCRIPTION
488
- Removes a plugin from the CLI.
489
-
490
- ALIASES
491
- $ knock plugins unlink
492
- $ knock plugins remove
493
-
494
- EXAMPLES
495
- $ knock plugins uninstall myplugin
496
- ```
497
-
498
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/uninstall.ts)_
499
-
500
- ## `knock plugins:uninstall PLUGIN...`
501
-
502
- Removes a plugin from the CLI.
503
-
504
- ```
505
- USAGE
506
- $ knock plugins unlink plugins:uninstall PLUGIN...
507
-
508
- ARGUMENTS
509
- PLUGIN... plugin to uninstall
510
-
511
- FLAGS
512
- -h, --help Show CLI help.
513
- -v, --verbose
514
-
515
- DESCRIPTION
516
- Removes a plugin from the CLI.
517
-
518
- ALIASES
519
- $ knock plugins unlink
520
- $ knock plugins remove
521
-
522
- EXAMPLES
523
- $ knock plugins unlink myplugin
524
- ```
525
-
526
- ## `knock plugins update`
527
-
528
- Update installed plugins.
529
-
530
- ```
531
- USAGE
532
- $ knock plugins update [-h] [-v]
533
-
534
- FLAGS
535
- -h, --help Show CLI help.
536
- -v, --verbose
537
-
538
- DESCRIPTION
539
- Update installed plugins.
540
- ```
541
-
542
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.3.3/src/commands/plugins/update.ts)_
253
+ _See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/layout/validate.ts)_
543
254
 
544
255
  ## `knock translation get TRANSLATIONREF`
545
256
 
@@ -566,7 +277,7 @@ GLOBAL FLAGS
566
277
  --json Format output as json.
567
278
  ```
568
279
 
569
- _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/translation/get.ts)_
280
+ _See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/translation/get.ts)_
570
281
 
571
282
  ## `knock translation list`
572
283
 
@@ -589,7 +300,7 @@ GLOBAL FLAGS
589
300
  --json Format output as json.
590
301
  ```
591
302
 
592
- _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/translation/list.ts)_
303
+ _See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/translation/list.ts)_
593
304
 
594
305
  ## `knock translation pull [TRANSLATIONREF]`
595
306
 
@@ -616,7 +327,7 @@ FLAGS
616
327
  --translations-dir=<value> The target directory path to pull all translations into.
617
328
  ```
618
329
 
619
- _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/translation/pull.ts)_
330
+ _See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/translation/pull.ts)_
620
331
 
621
332
  ## `knock translation push [TRANSLATIONREF]`
622
333
 
@@ -643,7 +354,7 @@ FLAGS
643
354
  --translations-dir=<value> The target directory path to find all translations to push.
644
355
  ```
645
356
 
646
- _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/translation/push.ts)_
357
+ _See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/translation/push.ts)_
647
358
 
648
359
  ## `knock translation validate [TRANSLATIONREF]`
649
360
 
@@ -668,7 +379,7 @@ FLAGS
668
379
  --translations-dir=<value> The target directory path to find all translations to validate.
669
380
  ```
670
381
 
671
- _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/translation/validate.ts)_
382
+ _See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/translation/validate.ts)_
672
383
 
673
384
  ## `knock whoami`
674
385
 
@@ -685,7 +396,7 @@ GLOBAL FLAGS
685
396
  --json Format output as json.
686
397
  ```
687
398
 
688
- _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/whoami.ts)_
399
+ _See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/whoami.ts)_
689
400
 
690
401
  ## `knock workflow activate WORKFLOWKEY`
691
402
 
@@ -712,7 +423,7 @@ DESCRIPTION
712
423
  with `false` in order to deactivate it.
713
424
  ```
714
425
 
715
- _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/activate.ts)_
426
+ _See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/activate.ts)_
716
427
 
717
428
  ## `knock workflow get WORKFLOWKEY`
718
429
 
@@ -732,7 +443,7 @@ GLOBAL FLAGS
732
443
  --json Format output as json.
733
444
  ```
734
445
 
735
- _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/get.ts)_
446
+ _See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/get.ts)_
736
447
 
737
448
  ## `knock workflow list`
738
449
 
@@ -755,7 +466,7 @@ GLOBAL FLAGS
755
466
  --json Format output as json.
756
467
  ```
757
468
 
758
- _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/list.ts)_
469
+ _See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/list.ts)_
759
470
 
760
471
  ## `knock workflow pull [WORKFLOWKEY]`
761
472
 
@@ -775,7 +486,7 @@ FLAGS
775
486
  --workflows-dir=<value> The target directory path to pull all workflows into.
776
487
  ```
777
488
 
778
- _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/pull.ts)_
489
+ _See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/pull.ts)_
779
490
 
780
491
  ## `knock workflow push [WORKFLOWKEY]`
781
492
 
@@ -796,7 +507,7 @@ FLAGS
796
507
  --workflows-dir=<value> The target directory path to find all workflows to push.
797
508
  ```
798
509
 
799
- _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/push.ts)_
510
+ _See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/push.ts)_
800
511
 
801
512
  ## `knock workflow run WORKFLOWKEY`
802
513
 
@@ -817,7 +528,7 @@ FLAGS
817
528
  --tenant=<value> A tenant id for the workflow run.
818
529
  ```
819
530
 
820
- _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/run.ts)_
531
+ _See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/run.ts)_
821
532
 
822
533
  ## `knock workflow validate [WORKFLOWKEY]`
823
534
 
@@ -836,5 +547,5 @@ FLAGS
836
547
  --workflows-dir=<value> The target directory path to find all workflows to validate.
837
548
  ```
838
549
 
839
- _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.15/src/commands/workflow/validate.ts)_
550
+ _See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.17/src/commands/workflow/validate.ts)_
840
551
  <!-- commandsstop -->
@@ -19,6 +19,7 @@ const disabled = {
19
19
  throw new Error(`"${token.name}" tag is not supported in Knock`);
20
20
  }
21
21
  };
22
+ // TODO(KNO-6058) - Enable render tag for partials
22
23
  engine.registerTag("render", disabled);
23
24
  engine.registerTag("include", disabled);
24
25
  function validateLiquidSyntax(input) {
@@ -14,13 +14,17 @@ _export(exports, {
14
14
  buildEmailLayoutDirBundle: function() {
15
15
  return _processorisomorphic.buildEmailLayoutDirBundle;
16
16
  },
17
+ buildPartialDirBundle: function() {
18
+ return _processorisomorphic1.buildPartialDirBundle;
19
+ },
17
20
  buildTranslationDirBundle: function() {
18
- return _processorisomorphic1.buildTranslationDirBundle;
21
+ return _processorisomorphic2.buildTranslationDirBundle;
19
22
  },
20
23
  buildWorkflowDirBundle: function() {
21
- return _processorisomorphic2.buildWorkflowDirBundle;
24
+ return _processorisomorphic3.buildWorkflowDirBundle;
22
25
  }
23
26
  });
24
27
  const _processorisomorphic = require("./email-layout/processor.isomorphic");
25
- const _processorisomorphic1 = require("./translation/processor.isomorphic");
26
- const _processorisomorphic2 = require("./workflow/processor.isomorphic");
28
+ const _processorisomorphic1 = require("./partial/processor.isomorphic");
29
+ const _processorisomorphic2 = require("./translation/processor.isomorphic");
30
+ const _processorisomorphic3 = require("./workflow/processor.isomorphic");
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./processor.isomorphic"), exports);
6
+ _export_star(require("./types"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }
@@ -0,0 +1,122 @@
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
+ PARTIAL_JSON: function() {
13
+ return PARTIAL_JSON;
14
+ },
15
+ buildPartialDirBundle: function() {
16
+ return buildPartialDirBundle;
17
+ },
18
+ toPartialJson: function() {
19
+ return toPartialJson;
20
+ }
21
+ });
22
+ const _lodash = require("lodash");
23
+ const _objectisomorphic = require("../../helpers/object.isomorphic");
24
+ const _constisomorphic = require("../shared/const.isomorphic");
25
+ const _types = require("./types");
26
+ const PARTIAL_JSON = "partial.json";
27
+ /*
28
+ * Sanitize the partial content into a format that's appropriate for reading
29
+ * and writing, by stripping out any annotation fields and handling readonly
30
+ * fields.
31
+ */ const toPartialJson = (partial)=>{
32
+ var _partial___annotation;
33
+ // Move read only field under the dedicated field "__readonly".
34
+ const readonlyFields = ((_partial___annotation = partial.__annotation) === null || _partial___annotation === void 0 ? void 0 : _partial___annotation.readonly_fields) || [];
35
+ const [readonly, remainder] = (0, _objectisomorphic.split)(partial, readonlyFields);
36
+ const partialjson = {
37
+ ...remainder,
38
+ __readonly: readonly
39
+ };
40
+ // Strip out all schema annotations, so not to expose them to end users.
41
+ return (0, _objectisomorphic.omitDeep)(partialjson, [
42
+ "__annotation"
43
+ ]);
44
+ };
45
+ // Maps the partial type to the correct file extension. Defaults to 'txt'
46
+ const partialTypeToFileExt = (type)=>{
47
+ switch(type){
48
+ case _types.PartialType.Html:
49
+ return "html";
50
+ case _types.PartialType.Json:
51
+ return "json";
52
+ case _types.PartialType.Markdown:
53
+ return "md";
54
+ case _types.PartialType.Text:
55
+ default:
56
+ return "txt";
57
+ }
58
+ };
59
+ const compileExtractionSettings = (partial)=>{
60
+ const extractableFields = (0, _lodash.get)(partial, [
61
+ "__annotation",
62
+ "extractable_fields"
63
+ ], {});
64
+ const map = new Map();
65
+ for (const key of Object.keys(partial)){
66
+ // If the field we are on is extractable, then add its extraction
67
+ // settings to the map with the current object path.
68
+ //
69
+ // NOTE: Partial content type is dynamically set based on the partial type
70
+ // rather than being explicitly set in the annotation.
71
+ if (key in extractableFields) {
72
+ const file_ext = partialTypeToFileExt(partial.type);
73
+ const extractable_settings = {
74
+ ...extractableFields[key],
75
+ file_ext
76
+ };
77
+ map.set([
78
+ key
79
+ ], extractable_settings);
80
+ }
81
+ }
82
+ return map;
83
+ };
84
+ const buildPartialDirBundle = (remotePartial, localPartial = {})=>{
85
+ const bundle = {};
86
+ const mutRemotePartial = (0, _lodash.cloneDeep)(remotePartial);
87
+ // A map of extraction settings of every field in the partial
88
+ const compiledExtractionSettings = compileExtractionSettings(mutRemotePartial);
89
+ // Iterate through each extractable field, determine whether we need to
90
+ // extract the field content, and if so, perform the
91
+ // extraction.
92
+ for (const [objPathParts, extractionSettings] of compiledExtractionSettings){
93
+ // If this partial doesn't have this field path, then we don't extract.
94
+ if (!(0, _lodash.has)(mutRemotePartial, objPathParts)) continue;
95
+ // If the field at this path is extracted in the local partial, then
96
+ // always extract; otherwise extract based on the field settings default.
97
+ const objPathStr = _objectisomorphic.ObjPath.stringify(objPathParts);
98
+ const extractedFilePath = (0, _lodash.get)(localPartial, `${objPathStr}${_constisomorphic.FILEPATH_MARKER}`);
99
+ const { default: extractByDefault, file_ext: fileExt } = extractionSettings;
100
+ if (!extractedFilePath && !extractByDefault) continue;
101
+ // By this point, we have a field where we need to extract its content.
102
+ const data = (0, _lodash.get)(mutRemotePartial, objPathParts);
103
+ const fileName = objPathParts.pop();
104
+ // If we have an extracted file path from the local partial, we use that.
105
+ // In the other case we use the default path.
106
+ const relpath = typeof extractedFilePath === "string" ? extractedFilePath : `${fileName}.${fileExt}`;
107
+ // Perform the extraction by adding the content and its file path to the
108
+ // bundle for writing to the file system later. Then replace the field
109
+ // content with the extracted file path and mark the field as extracted
110
+ // with @ suffix.
111
+ (0, _lodash.set)(bundle, [
112
+ relpath
113
+ ], data);
114
+ (0, _lodash.set)(mutRemotePartial, `${objPathStr}${_constisomorphic.FILEPATH_MARKER}`, relpath);
115
+ (0, _lodash.unset)(mutRemotePartial, objPathStr);
116
+ }
117
+ // At this point the bundle contains all extractable files, so we finally add
118
+ // the partial JSON relative path + the file content.
119
+ return (0, _lodash.set)(bundle, [
120
+ PARTIAL_JSON
121
+ ], toPartialJson(mutRemotePartial));
122
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "PartialType", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return PartialType;
9
+ }
10
+ });
11
+ var PartialType;
12
+ (function(PartialType) {
13
+ PartialType["Html"] = "html";
14
+ PartialType["Json"] = "json";
15
+ PartialType["Markdown"] = "markdown";
16
+ PartialType["Text"] = "text";
17
+ })(PartialType || (PartialType = {}));
@@ -1782,5 +1782,5 @@
1782
1782
  ]
1783
1783
  }
1784
1784
  },
1785
- "version": "0.1.15"
1785
+ "version": "0.1.17"
1786
1786
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Knock CLI",
5
5
  "author": "@knocklabs",
6
6
  "bin": {
@@ -19,13 +19,12 @@
19
19
  "dependencies": {
20
20
  "@oclif/core": "^3",
21
21
  "@oclif/plugin-help": "^6",
22
- "@oclif/plugin-plugins": "^4",
23
22
  "@prantlf/jsonlint": "^14.0.3",
24
23
  "axios": "^1.6.8",
25
24
  "date-fns": "^2.30.0",
26
25
  "enquirer": "^2.4.1",
27
26
  "fs-extra": "^11.2.0",
28
- "liquidjs": "^10.12.0",
27
+ "liquidjs": "^10.13.1",
29
28
  "locale-codes": "^1.3.1",
30
29
  "lodash": "^4.17.21",
31
30
  "yup": "^1.4.0"
@@ -33,12 +32,12 @@
33
32
  "devDependencies": {
34
33
  "@oclif/test": "^3",
35
34
  "@swc/cli": "^0.3.12",
36
- "@swc/core": "^1.4.6",
37
- "@swc/helpers": "^0.5.6",
35
+ "@swc/core": "^1.5.7",
36
+ "@swc/helpers": "^0.5.11",
38
37
  "@types/chai": "^4",
39
38
  "@types/fs-extra": "^11.0.4",
40
39
  "@types/mocha": "^10.0.6",
41
- "@types/node": "^20.12.7",
40
+ "@types/node": "^20.14.8",
42
41
  "chai": "^4",
43
42
  "eslint": "^7.32.0",
44
43
  "eslint-config-oclif": "^4",
@@ -54,16 +53,15 @@
54
53
  "sinon": "^16.1.3",
55
54
  "ts-node": "^10.9.1",
56
55
  "tsconfig-paths": "^4.2.0",
57
- "tslib": "^2.6.2",
58
- "typescript": "^5.1.6"
56
+ "tslib": "^2.6.3",
57
+ "typescript": "^5.5.2"
59
58
  },
60
59
  "oclif": {
61
60
  "bin": "knock",
62
61
  "dirname": "knock",
63
62
  "commands": "./dist/commands",
64
63
  "plugins": [
65
- "@oclif/plugin-help",
66
- "@oclif/plugin-plugins"
64
+ "@oclif/plugin-help"
67
65
  ],
68
66
  "topicSeparator": " ",
69
67
  "topics": {