contensis-cli 1.6.1-beta.8 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE +674 -0
  3. package/dist/index.js +58362 -11
  4. package/dist/index.js.map +4 -4
  5. package/dist/shell.js +58100 -52
  6. package/dist/shell.js.map +4 -4
  7. package/docs/copy_field_templates.md +112 -0
  8. package/esbuild.config.js +8 -13
  9. package/package.json +3 -3
  10. package/src/commands/create.ts +48 -0
  11. package/src/commands/dev.ts +6 -0
  12. package/src/commands/push.ts +38 -6
  13. package/src/commands/set.ts +70 -1
  14. package/src/factories/RequestHandlerFactory.ts +6 -3
  15. package/src/localisation/en-GB.ts +12 -0
  16. package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +3 -0
  17. package/src/models/CliService.d.ts +5 -1
  18. package/src/providers/GitHubCliModuleProvider.ts +8 -8
  19. package/src/services/ContensisCliService.ts +189 -7
  20. package/src/shell.ts +6 -1
  21. package/src/util/logger.ts +3 -4
  22. package/src/util/os.ts +5 -3
  23. package/src/version.ts +1 -1
  24. package/dist/commands/connect.js +0 -44
  25. package/dist/commands/connect.js.map +0 -7
  26. package/dist/commands/copy.js +0 -78
  27. package/dist/commands/copy.js.map +0 -7
  28. package/dist/commands/create.js +0 -170
  29. package/dist/commands/create.js.map +0 -7
  30. package/dist/commands/dev.js +0 -81
  31. package/dist/commands/dev.js.map +0 -7
  32. package/dist/commands/diff.js +0 -57
  33. package/dist/commands/diff.js.map +0 -7
  34. package/dist/commands/execute.js +0 -103
  35. package/dist/commands/execute.js.map +0 -7
  36. package/dist/commands/get.js +0 -330
  37. package/dist/commands/get.js.map +0 -7
  38. package/dist/commands/globalOptions.js +0 -252
  39. package/dist/commands/globalOptions.js.map +0 -7
  40. package/dist/commands/import.js +0 -256
  41. package/dist/commands/import.js.map +0 -7
  42. package/dist/commands/index.js +0 -107
  43. package/dist/commands/index.js.map +0 -7
  44. package/dist/commands/list.js +0 -195
  45. package/dist/commands/list.js.map +0 -7
  46. package/dist/commands/login.js +0 -55
  47. package/dist/commands/login.js.map +0 -7
  48. package/dist/commands/push.js +0 -234
  49. package/dist/commands/push.js.map +0 -7
  50. package/dist/commands/remove.js +0 -193
  51. package/dist/commands/remove.js.map +0 -7
  52. package/dist/commands/set.js +0 -180
  53. package/dist/commands/set.js.map +0 -7
  54. package/dist/commands/update.js +0 -70
  55. package/dist/commands/update.js.map +0 -7
  56. package/dist/factories/RequestHandlerFactory.js +0 -227
  57. package/dist/factories/RequestHandlerFactory.js.map +0 -7
  58. package/dist/localisation/en-GB.js +0 -559
  59. package/dist/localisation/en-GB.js.map +0 -7
  60. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
  61. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
  62. package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
  63. package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
  64. package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
  65. package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
  66. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -168
  67. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
  68. package/dist/mappers/MixedFileData.js +0 -83
  69. package/dist/mappers/MixedFileData.js.map +0 -7
  70. package/dist/models/AppError.d.js +0 -2
  71. package/dist/models/AppError.d.js.map +0 -7
  72. package/dist/models/Cache.d.js +0 -2
  73. package/dist/models/Cache.d.js.map +0 -7
  74. package/dist/models/CliService.d.js +0 -17
  75. package/dist/models/CliService.d.js.map +0 -7
  76. package/dist/models/DevService.d.js +0 -17
  77. package/dist/models/DevService.d.js.map +0 -7
  78. package/dist/models/JsModules.d.js +0 -2
  79. package/dist/models/JsModules.d.js.map +0 -7
  80. package/dist/providers/CredentialProvider.js +0 -126
  81. package/dist/providers/CredentialProvider.js.map +0 -7
  82. package/dist/providers/GitHubCliModuleProvider.js +0 -115
  83. package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
  84. package/dist/providers/HttpProvider.js +0 -73
  85. package/dist/providers/HttpProvider.js.map +0 -7
  86. package/dist/providers/ManifestProvider.js +0 -50
  87. package/dist/providers/ManifestProvider.js.map +0 -7
  88. package/dist/providers/SessionCacheProvider.js +0 -132
  89. package/dist/providers/SessionCacheProvider.js.map +0 -7
  90. package/dist/providers/file-provider.js +0 -177
  91. package/dist/providers/file-provider.js.map +0 -7
  92. package/dist/services/ContensisAuthService.js +0 -88
  93. package/dist/services/ContensisAuthService.js.map +0 -7
  94. package/dist/services/ContensisCliService.js +0 -2661
  95. package/dist/services/ContensisCliService.js.map +0 -7
  96. package/dist/services/ContensisDevService.js +0 -435
  97. package/dist/services/ContensisDevService.js.map +0 -7
  98. package/dist/services/ContensisRoleService.js +0 -112
  99. package/dist/services/ContensisRoleService.js.map +0 -7
  100. package/dist/util/api-ids.js +0 -110
  101. package/dist/util/api-ids.js.map +0 -7
  102. package/dist/util/assert.js +0 -62
  103. package/dist/util/assert.js.map +0 -7
  104. package/dist/util/console.printer.js +0 -461
  105. package/dist/util/console.printer.js.map +0 -7
  106. package/dist/util/csv.formatter.js +0 -118
  107. package/dist/util/csv.formatter.js.map +0 -7
  108. package/dist/util/debug.js +0 -29
  109. package/dist/util/debug.js.map +0 -7
  110. package/dist/util/diff.js +0 -118
  111. package/dist/util/diff.js.map +0 -7
  112. package/dist/util/dotenv.js +0 -56
  113. package/dist/util/dotenv.js.map +0 -7
  114. package/dist/util/error.js +0 -36
  115. package/dist/util/error.js.map +0 -7
  116. package/dist/util/fetch.js +0 -69
  117. package/dist/util/fetch.js.map +0 -7
  118. package/dist/util/find.js +0 -39
  119. package/dist/util/find.js.map +0 -7
  120. package/dist/util/git.js +0 -145
  121. package/dist/util/git.js.map +0 -7
  122. package/dist/util/gitignore.js +0 -61
  123. package/dist/util/gitignore.js.map +0 -7
  124. package/dist/util/html.formatter.js +0 -70
  125. package/dist/util/html.formatter.js.map +0 -7
  126. package/dist/util/index.js +0 -68
  127. package/dist/util/index.js.map +0 -7
  128. package/dist/util/json.formatter.js +0 -66
  129. package/dist/util/json.formatter.js.map +0 -7
  130. package/dist/util/logger.js +0 -304
  131. package/dist/util/logger.js.map +0 -7
  132. package/dist/util/os.js +0 -46
  133. package/dist/util/os.js.map +0 -7
  134. package/dist/util/timers.js +0 -49
  135. package/dist/util/timers.js.map +0 -7
  136. package/dist/util/xml.formatter.js +0 -62
  137. package/dist/util/xml.formatter.js.map +0 -7
  138. package/dist/util/yaml.js +0 -44
  139. package/dist/util/yaml.js.map +0 -7
  140. package/dist/version.js +0 -29
  141. package/dist/version.js.map +0 -7
@@ -352,3 +352,115 @@ Or we can refer to other fields in the `entry` variable
352
352
  ```handlebars
353
353
  {{entry.text}}{% if entry.heading %} - {{entry.heading}}{% endif %}
354
354
  ```
355
+
356
+ ### Transforming fields inside Canvas blocks
357
+
358
+ Canvas fields contain an array of blocks (objects with `id`, `type`, `value`, `properties`). Some blocks are components (`_component` type with `properties.component`) that hold nested fields inside `value`. To transform those inner fields - for example converting a rich text field inside a component to canvas format - you need to rebuild the canvas array by iterating over the blocks and selectively transforming the ones you need.
359
+
360
+ This is done using the `capture` tag to build the output as a JSON string, then `from_json | json` to validate and minify the result.
361
+
362
+ #### Example: Convert rich text to canvas inside a component block
363
+
364
+ Given a canvas field containing a `linkedComponent` block with a `richText` field:
365
+
366
+ ```json
367
+ {
368
+ "id": "5b03fe6a",
369
+ "type": "_component",
370
+ "properties": { "component": "linkedComponent" },
371
+ "value": {
372
+ "entry": [{ "sys": { "id": "abc123", "dataFormat": "entry" } }],
373
+ "title": "My component",
374
+ "richText": "<h2>Original rich text</h2>",
375
+ "canvas": null
376
+ }
377
+ }
378
+ ```
379
+
380
+ This template converts `richText` to canvas via `html_to_canvas`, storing it in the `canvas` field. Other blocks pass through unchanged:
381
+
382
+ ```handlebars
383
+ {% capture out %}
384
+ [
385
+ {%- for b in value -%}
386
+ {%- if forloop.index0 > 0 %},{% endif -%}
387
+ {%- if b.properties.component == "linkedComponent" -%}
388
+ {
389
+ "id": {{ b.id | json }},
390
+ "type": {{ b.type | json }},
391
+ "properties": {{ b.properties | json }},
392
+ "value": {
393
+ "entry": {{ b.value.entry | json }},
394
+ "title": {{ b.value.title | json }},
395
+ "richText": {{ b.value.richText | json }},
396
+ "canvas": {% if b.value.richText and b.value.richText != "" %}{{ b.value.richText | html_to_canvas | json }}{% else %}{{ b.value.canvas | json }}{% endif %}
397
+ }
398
+ }
399
+ {%- else -%}
400
+ {{ b | json }}
401
+ {%- endif -%}
402
+ {%- endfor -%}
403
+ ]
404
+ {% endcapture %}
405
+ {{ out | from_json | json }}
406
+ ```
407
+
408
+ #### How it works
409
+
410
+ 1. `{% capture out %}` starts building the output as a JSON string
411
+ 2. The outer `[` opens the canvas array
412
+ 3. `{% for b in value %}` iterates over every block in the canvas
413
+ 4. `{% if b.properties.component == "linkedComponent" %}` matches the block we want to transform
414
+ 5. Each field in the block is mapped with `|json` to ensure valid JSON output (strings get quotes, objects serialize correctly)
415
+ 6. The `canvas` field conditionally applies `html_to_canvas` when `richText` exists, otherwise passes the existing value through
416
+ 7. `{% else %}` passes non-matching blocks through unchanged via `{{ b | json }}`
417
+ 8. `{% endcapture %}` closes the string, then `{{ out | from_json | json }}` parses and re-serializes to validate the JSON
418
+
419
+ #### Why `|json` is needed on every mapped field
420
+
421
+ Without it, strings would render bare (invalid JSON: `hello` instead of `"hello"`) and objects would render as `[object Object]`. The `|json` filter handles strings, objects, arrays, nulls, and booleans correctly.
422
+
423
+ #### Handling nested component blocks
424
+
425
+ If a canvas block contains a repeatable array of sub-components, you can nest the same pattern. For example, a `nestingLinkedComponent` block has `linkedComponent[]` items, each with their own `richText` and `canvas`:
426
+
427
+ ```handlebars
428
+ {% capture out %}
429
+ [
430
+ {%- for b in value -%}
431
+ {%- if forloop.index0 > 0 %},{% endif -%}
432
+ {%- if b.properties.component == "nestingLinkedComponent" -%}
433
+ {
434
+ "id": {{ b.id | json }},
435
+ "type": {{ b.type | json }},
436
+ "properties": {{ b.properties | json }},
437
+ "value": {
438
+ "linkedComponent": [
439
+ {%- for it in b.value.linkedComponent -%}
440
+ {%- if forloop.index0 > 0 %},{% endif -%}
441
+ {
442
+ "entry": {{ it.entry | json }},
443
+ "title": {{ it.title | json }},
444
+ "richText": {{ it.richText | json }},
445
+ "canvas": {% if it.richText and it.richText != "" %}{{ it.richText | html_to_canvas | json }}{% else %}{{ it.canvas | json }}{% endif %}
446
+ }
447
+ {%- endfor -%}
448
+ ],
449
+ "singleLinkedComponent": {
450
+ "entry": {{ b.value.singleLinkedComponent.entry | json }},
451
+ "title": {{ b.value.singleLinkedComponent.title | json }},
452
+ "richText": {{ b.value.singleLinkedComponent.richText | json }},
453
+ "canvas": {% if b.value.singleLinkedComponent.richText and b.value.singleLinkedComponent.richText != "" %}{{ b.value.singleLinkedComponent.richText | html_to_canvas | json }}{% else %}{{ b.value.singleLinkedComponent.canvas | json }}{% endif %}
454
+ }
455
+ }
456
+ }
457
+ {%- else -%}
458
+ {{ b | json }}
459
+ {%- endif -%}
460
+ {%- endfor -%}
461
+ ]
462
+ {% endcapture %}
463
+ {{ out | from_json | json }}
464
+ ```
465
+
466
+ The same `richText` to `canvas` conversion is applied to each item in the repeatable `linkedComponent` array and to the singular `singleLinkedComponent` block.
package/esbuild.config.js CHANGED
@@ -5,7 +5,6 @@ const { globPlugin } = require('esbuild-plugin-glob');
5
5
  const { nodeExternalsPlugin } = require('esbuild-node-externals');
6
6
  const { replaceTscAliasPaths } = require('tsc-alias');
7
7
 
8
- // const watch = !!process.argv.includes('--watch');
9
8
  const completed = `${chalk.green('[contensis-cli]')} Build successful 👍\n`;
10
9
 
11
10
  console.time(completed);
@@ -16,9 +15,9 @@ rimraf('./dist').then(() => {
16
15
  console.time(' - esbuild complete');
17
16
  esbuild
18
17
  .build({
19
- entryPoints: ['src/**/*.[jt]s'],
18
+ entryPoints: ['src/index.ts', 'src/shell.ts'],
20
19
  outdir: 'dist',
21
- bundle: false,
20
+ bundle: true,
22
21
  minify: false,
23
22
  platform: 'node',
24
23
  format: 'cjs',
@@ -26,16 +25,12 @@ rimraf('./dist').then(() => {
26
25
  // needs to be node12 to transform dynamic imports into requires
27
26
  // so the bundles are compatible with the pkg exe builds
28
27
  target: 'node12',
29
- plugins: [globPlugin(), nodeExternalsPlugin()],
30
- // watch: watch && {
31
- // onRebuild(error) {
32
- // if (error) console.error('esbuild watch build failed:', error);
33
- // else
34
- // console.log(
35
- // 'esbuild watch build succeeded, waiting for changes...'
36
- // );
37
- // },
38
- // },
28
+ plugins: [globPlugin(), nodeExternalsPlugin({
29
+ allowList: [/^@inquirer\//],
30
+ dependencies: true,
31
+ forceExternalList: ['enterprise-fetch']
32
+ // forceExternalList: ['keytar', '@action-validator/core', 'figlet', 'node-fetch', 'enterprise-fetch']
33
+ })],
39
34
  })
40
35
  .then(() => {
41
36
  console.timeEnd(' - esbuild complete');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.6.1-beta.8",
3
+ "version": "1.7.0",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "package-lock": "npm i --package-lock-only --workspaces false"
26
26
  },
27
27
  "author": "Zengenti",
28
- "license": "ISC",
28
+ "license": "GPL-3.0",
29
29
  "dependencies": {
30
30
  "@action-validator/core": "^0.6.0",
31
31
  "@inquirer/prompts": "^8.2.0",
@@ -43,7 +43,7 @@
43
43
  "inquirer-command-prompt": "^0.1.0",
44
44
  "keytar": "^7.9.0",
45
45
  "lodash": "^4.17.21",
46
- "migratortron": "^1.0.0-beta.86",
46
+ "migratortron": "^1.0.0-beta.89",
47
47
  "nanospinner": "^1.2.0",
48
48
  "node-fetch": "^2.6.7",
49
49
  "parse-git-config": "^3.0.0",
@@ -71,6 +71,54 @@ Example call:
71
71
  );
72
72
  });
73
73
 
74
+ create
75
+ .command('node')
76
+ .description('create a new site view node')
77
+ .argument('<"node path or id">', 'the path or id of the node to create')
78
+ .argument(
79
+ '["display name"]',
80
+ 'provide a separate display name for the node (optional)'
81
+ )
82
+ .argument(
83
+ '["slug"]',
84
+ 'provide a slug for the node (defaults to slug from provided node path)'
85
+ )
86
+ .option(
87
+ '--include-in-menu',
88
+ 'set include in menu flag on the created node',
89
+ false
90
+ )
91
+ .option(
92
+ '--language <language>',
93
+ 'language of the node to create (defaults to current project primary language)'
94
+ )
95
+ .option('--entry-id <entryId>', 'attach an entry to the node')
96
+ .usage(
97
+ '<"node path or id"> ["display name"] (both args in "double quotes")'
98
+ )
99
+ .addHelpText(
100
+ 'after',
101
+ `
102
+ Example call:
103
+ > create node /test "Test Node" --include-in-menu\n`
104
+ )
105
+ .action(
106
+ async (
107
+ pathOrId: string,
108
+ displayName: string,
109
+ slug: string,
110
+ opts: any
111
+ ) => {
112
+ await cliCommand(['create', 'node', pathOrId], opts).CreateOrUpdateNode(
113
+ pathOrId,
114
+ opts,
115
+ displayName,
116
+ slug,
117
+ opts.language
118
+ );
119
+ }
120
+ );
121
+
74
122
  create
75
123
  .command('role')
76
124
  .description('create a new role')
@@ -62,6 +62,12 @@ Example call:
62
62
  '--override [override...]',
63
63
  'override configurations for other blocks'
64
64
  )
65
+ .addOption(
66
+ new Option(
67
+ '-ll --log-level <logLevel>',
68
+ 'set the request handler logging level'
69
+ ).choices(['debug', 'information', 'warning', 'error', 'none'])
70
+ )
65
71
  .usage('[block-id] [local-uri]')
66
72
  .addHelpText(
67
73
  'after',
@@ -212,6 +212,13 @@ Example call:
212
212
  },
213
213
  projectId: () => cli.env.currentProject || '',
214
214
  source: {
215
+ // Provenance resolution order per field:
216
+ // 1. explicit cli flag (camelCase key from commander opts)
217
+ // 2. CONTENSIS_* env var - a safe channel for CI actions to supply
218
+ // values without embedding them in the command string (where mapped)
219
+ // 3. generic CI variables the runner exports
220
+ // The mapper skips empty/undefined candidates and uses the first
221
+ // non-empty value, so unset optional vars never mask a fallback.
215
222
  provider: {
216
223
  $path: ['provider'],
217
224
  $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {
@@ -221,9 +228,15 @@ Example call:
221
228
  },
222
229
  },
223
230
  repositoryUrl: {
224
- $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],
231
+ $path: [
232
+ 'repositoryUrl',
233
+ 'CONTENSIS_REPOSITORY_URL',
234
+ 'CI_PROJECT_URL',
235
+ 'GITHUB_REPOSITORY',
236
+ ],
225
237
  $formatting: (url: string, { GITHUB_ACTIONS }) => {
226
- if (GITHUB_ACTIONS) url = `https://github.com/${url}`;
238
+ if (GITHUB_ACTIONS && !url.startsWith(`https://`))
239
+ url = `https://github.com/${url}`;
227
240
 
228
241
  if (url && !url.endsWith('.git')) return `${url}.git`;
229
242
  return url;
@@ -231,16 +244,35 @@ Example call:
231
244
  },
232
245
  branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],
233
246
  commit: {
234
- id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],
247
+ id: [
248
+ 'commitId',
249
+ 'CONTENSIS_COMMIT_ID',
250
+ 'CI_COMMIT_SHORT_SHA',
251
+ 'GITHUB_SHA',
252
+ ],
235
253
  message: {
236
- $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}
254
+ $path: [
255
+ 'commitMessage',
256
+ 'CONTENSIS_COMMIT_MESSAGE',
257
+ 'CI_COMMIT_MESSAGE',
258
+ ], // ${{ github.event.head_commit.message }}
237
259
  $formatting: (msg?: string) =>
238
260
  msg?.replace(/\\n/g, ' ').replace(/\\n/g, ' ').trim(),
239
261
  },
240
- dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}
241
- authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}
262
+ dateTime: [
263
+ 'commitDatetime',
264
+ 'CONTENSIS_COMMIT_DATETIME',
265
+ 'CI_COMMIT_TIMESTAMP',
266
+ ], // ${{ github.event.head_commit.timestamp }}
267
+ authorEmail: [
268
+ 'authorEmail',
269
+ 'CONTENSIS_AUTHOR_EMAIL',
270
+ 'GITLAB_USER_EMAIL',
271
+ 'GITHUB_ACTOR',
272
+ ], // ${{ github.event.head_commit.author.email }}
242
273
  committerEmail: [
243
274
  'committerEmail',
275
+ 'CONTENSIS_COMMITTER_EMAIL',
244
276
  'GITLAB_USER_EMAIL',
245
277
  'GITHUB_TRIGGERING_ACTOR',
246
278
  ], // ${{ github.event.head_commit.committer.email }}
@@ -1,4 +1,4 @@
1
- import { Argument, Command } from 'commander';
1
+ import { Argument, Command, Option } from 'commander';
2
2
  import { cliCommand } from '~/services/ContensisCliService';
3
3
  import { shell } from '~/shell';
4
4
 
@@ -10,6 +10,57 @@ export const makeSetCommand = () => {
10
10
  .showHelpAfterError(true)
11
11
  .exitOverride();
12
12
 
13
+ const node = set.command('node').description('update a site view node');
14
+
15
+ node
16
+ .command('entry')
17
+ .description('assign an entry to a node')
18
+ .argument('<"node path or id">', 'the path or id of the node to update')
19
+ .argument('<entryId>', 'the new entry id to assign to the node')
20
+ .usage('<"node path or id"> <entryId>')
21
+ .addHelpText(
22
+ 'after',
23
+ `
24
+ Example call:
25
+ > set node entry /path 1502f64e-e9b1-436b-b62f-e273f639ecb6\n`
26
+ )
27
+ .action(async (nodePathOrId: string, entryId: string, opts) => {
28
+ await cliCommand(['set', 'node', 'entry'], opts).CreateOrUpdateNode(
29
+ nodePathOrId,
30
+ { entryId }
31
+ );
32
+ });
33
+
34
+ node
35
+ .command('renderer')
36
+ .description('assign a renderer to a node')
37
+ .argument('<"node path or id">', 'the path or id of the node to update')
38
+ .argument('<rendererUuidOrName>', 'the renderer uuid, id or name to assign to the node')
39
+ .option(
40
+ '--is-partial-match-root',
41
+ 'should the renderer be used as the partial match root for the node',
42
+ false
43
+ )
44
+ .usage('<"node path or id"> <rendererUuidOrName>')
45
+ .addHelpText(
46
+ 'after',
47
+ `
48
+ Example call:
49
+ > set node renderer /path 1502f64e-e9b1-436b-b62f-e273f639ecb6 --is-partial-match-root
50
+ > set node renderer /path my-block --is-partial-match-root\n`
51
+ )
52
+ .action(async (nodePathOrId: string, rendererId: string, opts) => {
53
+ await cliCommand(['set', 'node', 'renderer'], opts).CreateOrUpdateNode(
54
+ nodePathOrId,
55
+ {
56
+ renderer: {
57
+ id: rendererId,
58
+ isPartialMatchRoot: opts.isPartialMatchRoot,
59
+ },
60
+ }
61
+ );
62
+ });
63
+
13
64
  const project = set
14
65
  .command('project')
15
66
  .description('set current working project')
@@ -178,6 +229,21 @@ Example call:
178
229
  '--entry-languages [entry-languages...]',
179
230
  'the entry languages to add to the role permissions'
180
231
  )
232
+ .addOption(
233
+ new Option(
234
+ '--block-actions [block-actions...]',
235
+ 'the block actions to add to the role permissions'
236
+ ).choices([
237
+ 'push',
238
+ 'release',
239
+ 'manageLive',
240
+ 'manualStartStop',
241
+ 'markAsBroken',
242
+ 'delete',
243
+ 'view',
244
+ '*',
245
+ ])
246
+ )
181
247
  .addHelpText(
182
248
  'after',
183
249
  `
@@ -194,6 +260,9 @@ Example call:
194
260
  actions: opts.entryActions || [],
195
261
  languages: opts.entryLanguages || [],
196
262
  })),
263
+ blocks: opts.blockActions
264
+ ? { actions: opts.blockActions }
265
+ : undefined,
197
266
  },
198
267
  }
199
268
  );
@@ -177,9 +177,12 @@ export class RequestHandlerFactory {
177
177
  path: downloadPath,
178
178
  // Map NodeJS os platform to release asset name
179
179
  platforms: [
180
- ['win32', 'win-x64'],
181
- ['darwin', 'osx-x64'],
182
- ['linux', 'linux-x64'],
180
+ ['win32', 'arm64', 'win-arm64'],
181
+ ['win32', 'x64', 'win-x64'],
182
+ ['darwin', 'arm64', 'osx-arm64'],
183
+ ['darwin', 'x64', 'osx-x64'],
184
+ ['linux', 'arm64', 'linux-arm64'],
185
+ ['linux', 'x64', 'linux-x64'],
183
186
  ],
184
187
  });
185
188
  } catch (ex: any) {
@@ -188,6 +188,14 @@ export const LogMessages = {
188
188
  depth ? ` to a depth of ${depth}` : ``
189
189
  }\n`,
190
190
  noChange: (env: string) => `[${env}] No changes to be made`,
191
+ setPayload: () => `Updating node with details\n`,
192
+ set: (env: string) => `[${env}] Succesfully updated node\n`,
193
+ failedSet: (env: string, name?: string) =>
194
+ `[${env}] Unable to update node ${Logger.highlightText(name)}`,
195
+ created: (env: string, name: string) =>
196
+ `[${env}] Created node ${Logger.highlightText(name)}\n`,
197
+ failedCreate: (env: string, name?: string) =>
198
+ `[${env}] Unable to create node ${Logger.highlightText(name)}`,
191
199
  },
192
200
  contenttypes: {
193
201
  list: (projectId: string) =>
@@ -317,6 +325,10 @@ export const LogMessages = {
317
325
  `[${env}] Unable to find renderer ${Logger.highlightText(
318
326
  name
319
327
  )} in project ${projectId}`,
328
+ resolved: (env: string, name: string, uuid: string) =>
329
+ `[${env}] Resolved renderer ${Logger.highlightText(
330
+ name
331
+ )} to uuid ${Logger.highlightText(uuid)}`,
320
332
  created: (env: string, name: string, projectId: string) =>
321
333
  `[${env}] Created renderer ${Logger.highlightText(
322
334
  name
@@ -179,6 +179,9 @@ class RequestHandlerArgs {
179
179
  args.push('--password', client.password);
180
180
  }
181
181
 
182
+ if (cli.logLevel && !args.find(a => a === '--log-level'))
183
+ args.push('--log-level', cli.logLevel);
184
+
182
185
  return args;
183
186
  };
184
187
 
@@ -1,3 +1,5 @@
1
+ import ContensisCli from '~/services/ContensisCliService';
2
+
1
3
  export type CliUrls =
2
4
  | {
3
5
  api: string;
@@ -33,7 +35,9 @@ export interface IImportOptions {
33
35
  sourceProjectId?: string;
34
36
  }
35
37
 
36
- export type OutputOptionsConstructorArg = OutputOptions &
38
+ export type OutputOptionsConstructorArg = {
39
+ logLevel?: ContensisCli['logLevel'];
40
+ } & OutputOptions &
37
41
  IConnectOptions &
38
42
  IImportOptions;
39
43
 
@@ -10,6 +10,7 @@ import {
10
10
  removeFile,
11
11
  } from './file-provider';
12
12
  import { doRetry } from '~/util/fetch';
13
+ import { isWindows } from '~/util/os';
13
14
 
14
15
  type GitHubApiRelease =
15
16
  Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']['data'];
@@ -85,17 +86,16 @@ class GitHubCliModuleProvider {
85
86
  cmd: string;
86
87
  path: string;
87
88
  unzip?: boolean;
88
- platforms: [NodeJS.Platform, string][];
89
+ platforms: [NodeJS.Platform, NodeJS.Architecture, string][];
89
90
  }
90
91
  ) {
91
92
  // find os-specific asset
92
- const platform = platforms.find(p => p[0] === os.platform()) || [
93
- os.platform(),
94
- os.platform(),
95
- ];
93
+ const platform = platforms.find(
94
+ p => p[0] === os.platform() && p[1] === os.arch()
95
+ ) || [os.platform(), os.arch(), `${os.platform()}-${os.arch()}`];
96
96
 
97
97
  const asset = release.assets.find(r =>
98
- r.name.toLowerCase().includes(platform[1])
98
+ r.name.toLowerCase().includes(platform[2])
99
99
  );
100
100
 
101
101
  // download asset
@@ -114,12 +114,12 @@ class GitHubCliModuleProvider {
114
114
  removeFile(filePath);
115
115
  }
116
116
 
117
- if (os.platform() !== 'win32') addExecutePermission(joinPath(path, cmd));
117
+ if (!isWindows()) addExecutePermission(joinPath(path, cmd));
118
118
  } else
119
119
  throw new Error(
120
120
  `no asset found in release ${
121
121
  release.tag_name
122
- } for platform ${os.platform()}\n${release.html_url}`
122
+ } for platform ${os.platform()} and architecture ${os.arch()}\n${release.html_url}`
123
123
  );
124
124
  }
125
125
  }