contensis-cli 1.0.0-beta.9 → 1.0.0-beta.90

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 (125) hide show
  1. package/README.md +1146 -78
  2. package/cli.js +3 -0
  3. package/dist/commands/connect.js +3 -3
  4. package/dist/commands/connect.js.map +2 -2
  5. package/dist/commands/create.js +45 -10
  6. package/dist/commands/create.js.map +2 -2
  7. package/dist/commands/dev.js +75 -0
  8. package/dist/commands/dev.js.map +7 -0
  9. package/dist/commands/diff.js +57 -0
  10. package/dist/commands/diff.js.map +7 -0
  11. package/dist/commands/execute.js +103 -0
  12. package/dist/commands/execute.js.map +7 -0
  13. package/dist/commands/get.js +169 -32
  14. package/dist/commands/get.js.map +3 -3
  15. package/dist/commands/globalOptions.js +37 -12
  16. package/dist/commands/globalOptions.js.map +2 -2
  17. package/dist/commands/import.js +47 -12
  18. package/dist/commands/import.js.map +2 -2
  19. package/dist/commands/index.js +22 -2
  20. package/dist/commands/index.js.map +2 -2
  21. package/dist/commands/list.js +53 -10
  22. package/dist/commands/list.js.map +2 -2
  23. package/dist/commands/login.js +2 -2
  24. package/dist/commands/login.js.map +2 -2
  25. package/dist/commands/push.js +17 -13
  26. package/dist/commands/push.js.map +2 -2
  27. package/dist/commands/remove.js +51 -8
  28. package/dist/commands/remove.js.map +2 -2
  29. package/dist/commands/set.js +139 -12
  30. package/dist/commands/set.js.map +2 -2
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.map +2 -2
  33. package/dist/localisation/en-GB.js +259 -49
  34. package/dist/localisation/en-GB.js.map +2 -2
  35. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +56 -0
  36. package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +7 -0
  37. package/dist/mappers/DevInit-to-CIWorkflow.js +127 -0
  38. package/dist/mappers/DevInit-to-CIWorkflow.js.map +7 -0
  39. package/dist/mappers/DevInit-to-RolePermissions.js +54 -0
  40. package/dist/mappers/DevInit-to-RolePermissions.js.map +7 -0
  41. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js +56 -0
  42. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js.map +7 -0
  43. package/dist/models/CliService.d.js +17 -0
  44. package/dist/models/CliService.d.js.map +7 -0
  45. package/dist/models/DevService.d.js +17 -0
  46. package/dist/models/DevService.d.js.map +7 -0
  47. package/dist/providers/CredentialProvider.js +46 -14
  48. package/dist/providers/CredentialProvider.js.map +3 -3
  49. package/dist/providers/SessionCacheProvider.js +21 -1
  50. package/dist/providers/SessionCacheProvider.js.map +2 -2
  51. package/dist/providers/file-provider.js +12 -6
  52. package/dist/providers/file-provider.js.map +3 -3
  53. package/dist/services/ContensisCliService.js +1148 -421
  54. package/dist/services/ContensisCliService.js.map +3 -3
  55. package/dist/services/ContensisDevService.js +309 -0
  56. package/dist/services/ContensisDevService.js.map +7 -0
  57. package/dist/services/ContensisRoleService.js +87 -0
  58. package/dist/services/ContensisRoleService.js.map +7 -0
  59. package/dist/shell.js +58 -18
  60. package/dist/shell.js.map +3 -3
  61. package/dist/util/console.printer.js +171 -55
  62. package/dist/util/console.printer.js.map +2 -2
  63. package/dist/util/diff.js +102 -0
  64. package/dist/util/diff.js.map +7 -0
  65. package/dist/util/dotenv.js +57 -0
  66. package/dist/util/dotenv.js.map +7 -0
  67. package/dist/util/find.js +31 -0
  68. package/dist/util/find.js.map +7 -0
  69. package/dist/util/git.js +126 -0
  70. package/dist/util/git.js.map +7 -0
  71. package/dist/util/index.js +8 -2
  72. package/dist/util/index.js.map +3 -3
  73. package/dist/util/logger.js +90 -29
  74. package/dist/util/logger.js.map +3 -3
  75. package/dist/util/os.js +39 -0
  76. package/dist/util/os.js.map +7 -0
  77. package/dist/util/timers.js +49 -0
  78. package/dist/util/timers.js.map +7 -0
  79. package/dist/util/yaml.js +45 -0
  80. package/dist/util/yaml.js.map +7 -0
  81. package/dist/version.js +1 -1
  82. package/dist/version.js.map +1 -1
  83. package/esbuild.config.js +3 -1
  84. package/package.json +12 -3
  85. package/src/commands/connect.ts +3 -2
  86. package/src/commands/create.ts +61 -8
  87. package/src/commands/dev.ts +69 -0
  88. package/src/commands/diff.ts +41 -0
  89. package/src/commands/execute.ts +117 -0
  90. package/src/commands/get.ts +242 -28
  91. package/src/commands/globalOptions.ts +42 -12
  92. package/src/commands/import.ts +58 -8
  93. package/src/commands/index.ts +22 -1
  94. package/src/commands/list.ts +85 -11
  95. package/src/commands/login.ts +2 -1
  96. package/src/commands/push.ts +18 -11
  97. package/src/commands/remove.ts +66 -4
  98. package/src/commands/set.ts +189 -9
  99. package/src/index.ts +1 -4
  100. package/src/localisation/en-GB.ts +374 -66
  101. package/src/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.ts +44 -0
  102. package/src/mappers/DevInit-to-CIWorkflow.ts +150 -0
  103. package/src/mappers/DevInit-to-RolePermissions.ts +33 -0
  104. package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +44 -0
  105. package/src/models/CliService.d.ts +36 -0
  106. package/src/models/DevService.d.ts +5 -0
  107. package/src/models/JsModules.d.ts +1 -0
  108. package/src/providers/CredentialProvider.ts +51 -18
  109. package/src/providers/SessionCacheProvider.ts +29 -2
  110. package/src/providers/file-provider.ts +17 -6
  111. package/src/services/ContensisCliService.ts +1458 -518
  112. package/src/services/ContensisDevService.ts +365 -0
  113. package/src/services/ContensisRoleService.ts +76 -0
  114. package/src/shell.ts +68 -18
  115. package/src/util/console.printer.ts +240 -78
  116. package/src/util/diff.ts +113 -0
  117. package/src/util/dotenv.ts +37 -0
  118. package/src/util/find.ts +8 -0
  119. package/src/util/git.ts +130 -0
  120. package/src/util/index.ts +16 -7
  121. package/src/util/logger.ts +145 -31
  122. package/src/util/os.ts +7 -0
  123. package/src/util/timers.ts +24 -0
  124. package/src/util/yaml.ts +13 -0
  125. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -1,20 +1,83 @@
1
1
  # Contensis CLI
2
2
 
3
- Use Contensis from your favourite terminal with NodeJS
3
+ Use Contensis from your favourite terminal
4
4
 
5
- Install the package via `npm` as a global module
5
+ Download the executable for your operating system from the [Releases page](https://github.com/contensis/node-cli/releases) and add it to a folder in your local `PATH`
6
+
7
+ or use your preferred installation method below
8
+
9
+ ## Install with package manager
10
+
11
+ ### Windows ([Chocolatey](https://chocolatey.org/install))
12
+
13
+ ```shell
14
+ choco install contensis-cli --pre
15
+ ```
16
+
17
+ - [Choco package docs and source](https://github.com/contensis/node-cli/tree/main/installers/chocolatey)
18
+ - [Contensis CLI on the Chocolatey Community Repository](https://community.chocolatey.org/packages/contensis-cli)
19
+
20
+ ### Mac ([Homebrew](https://docs.brew.sh/Installation))
21
+
22
+ ```shell
23
+ brew tap contensis/cli
24
+ brew install contensis-cli
25
+ ```
26
+
27
+ - [Homebrew tap on GitHub](https://github.com/contensis/homebrew-cli)
28
+
29
+ ### Linux ([Homebrew](https://docs.brew.sh/Homebrew-on-Linux))
6
30
 
7
31
  ```shell
8
- npm i contensis-cli --global
32
+ brew tap contensis/cli
33
+ brew install contensis-cli-linux
9
34
  ```
10
35
 
11
- ## CLI usage
36
+ - [Homebrew tap on GitHub](https://github.com/contensis/homebrew-cli)
37
+
38
+ ## Install as Node.js global module
39
+
40
+ Install the package via [`npm`](https://www.npmjs.com/package/contensis-cli) as a global module (requires [Node.js](https://nodejs.org/en/download/))
12
41
 
13
42
  ```shell
14
- contensis-cli connect example-dev
43
+ npm i --global contensis-cli@prelease
15
44
  ```
16
45
 
17
- The CLI uses the same commands and arguments as the shell. It is recommended you use and familiarise yourself with the cli via the shell and use the `contensis-cli` command to use the same cli commands in script-based context such as continuous integration.
46
+ If you use `nvm` and are frequently switching your local `node` version it will also switch your global `node_modules` each time, it is recommended use one of the binary installations instead.
47
+
48
+ ## Install from source
49
+
50
+ Clone the [repository](https://github.com/contensis/node-cli) and follow the instructions in the [`README`](https://github.com/contensis/node-cli#readme)
51
+
52
+ # Skip to section
53
+
54
+ - [Contensis Shell](#contensis-shell)
55
+ - [Use in Terminal](#cli-usage)
56
+ - [Pass connection details anywhere](#pass-connection-details-anywhere)
57
+ - [Use in Docker](#use-in-docker)
58
+ - [Run cli commands](#run-cli-commands)
59
+ - [Persist connections to a local file](#persist-connections-to-a-local-file)
60
+ - [Use in GitLab CI](#use-in-gitlab-ci)
61
+ - [Use in GitHub CI](#use-in-github-ci)
62
+ - [Running headless?](#running-headless-)
63
+
64
+ ## Use in Terminal
65
+
66
+ Try
67
+
68
+ ```shell
69
+ contensis connect example-dev
70
+ ```
71
+
72
+ or
73
+
74
+ ```shell
75
+ contensis help
76
+ ```
77
+
78
+ The CLI uses exactly the same commands as the shell. It is recommended you use and familiarise yourself with the cli by using the shell and then use the same cli commands when you need to in script-based context such as continuous integration environments.
79
+
80
+ Launch the [shell](#contensis-shell) by running just the command `contensis`
18
81
 
19
82
  ### Pass connection details anywhere
20
83
 
@@ -31,16 +94,91 @@ You can supply the following options with any command - although they don't appe
31
94
  -s --shared-secret
32
95
  ```
33
96
 
34
- ### Running headless?
97
+ Using this approach in the cli or the shell will assume these credentials are for your current envioronment and will set the local environment cache for subsequent commands
98
+
99
+ ## Use in Docker
100
+
101
+ Running the container with the `-it` docker options will launch a shell session
102
+
103
+ ```bash
104
+ docker pull ghcr.io/contensis/node-cli/main/app:latest
105
+ docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
106
+ ```
107
+
108
+ ### Run cli commands
109
+
110
+ Add the cli command and any options after the container image in the `docker run` command e.g.
111
+
112
+ ```bash
113
+ docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
114
+ ```
115
+
116
+ ### Persist connections to a local file
117
+
118
+ To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
119
+
120
+ <aside>
121
+ ⚠️ Ensure a file called `environments.json` exists before mapping the volume to the docker container. If it doesn’t exist, create this empty file first.
122
+
123
+ </aside>
124
+
125
+ Linux
126
+
127
+ ```bash
128
+ touch environments.json
129
+ docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
130
+ ```
131
+
132
+ Windows
133
+
134
+ ```powershell
135
+ echo {} > environments.json
136
+ docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
137
+ ```
138
+
139
+ ## Use in GitLab CI
140
+
141
+ ```yaml
142
+ push-to-contensis-block:
143
+ stage: push-to-contensis
144
+ only:
145
+ - master
146
+ image: ghcr.io/contensis/node-cli/main/app:release
147
+ script:
148
+ # Create CI/CD Variables in repo settings called CONTENSIS_CLIENT_ID and CONTENSIS_SHARED_SECRET
149
+ - contensis connect example-dev --project-id website --client-id $CONTENSIS_CLIENT_ID --shared-secret $CONTENSIS_SHARED_SECRET
150
+ - contensis push block example-website-block $APP_IMAGE:latest --release
151
+ ```
152
+
153
+ ## Use in GitHub CI
154
+
155
+ ```yaml
156
+ - name: Push block to Contensis
157
+ uses: contensis/cli-action@v1
158
+ with:
159
+ block-id: example-website-block
160
+ # auto-release: true # release the block straight away
161
+ alias: example-dev
162
+ project-id: website
163
+ client-id: ${{ secrets.CONTENSIS_CLIENT_ID }} # create secrets for actions
164
+ shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }} # in repo settings
165
+ tag-repo: true # tag commit with block version
166
+ git-token: ${{ github.token }} # to allow the git tag
167
+ ```
168
+
169
+ ## Running headless?
35
170
 
36
171
  Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
37
172
 
38
- In these environments you will see a warning message when using the cli with any credentials
173
+ In these environments you will see a warning message when using the cli with any credentials, in most cases this type of envioronment is normally disposed of after the command/session has completed and the warning can be safely ignored.
39
174
 
40
175
  ```shell
41
176
  [WARN] Could not connect to local keystore - your password could be stored unencrypted!
42
177
  ```
43
178
 
179
+ > **Note**
180
+ > There is a workaround for installing a secret store and launching an X11 session with an unlocked keyring which has been left in here below for anyone who wishes to try it
181
+
44
182
  ~~The required credentials to run commands are stored and read from a secret store `libsecret`. Without the secret store running and unlocked we receive an error `Cannot autolaunch D-Bus without X11 $DISPLAY`~~
45
183
 
46
184
  ```shell
@@ -82,6 +220,64 @@ Press [TAB] for suggestions
82
220
  contensis >
83
221
  ```
84
222
 
223
+ ## Skip to section
224
+
225
+ - [Get started](#get-started)
226
+ - [Connect to a Contensis Cloud environment](#connect-to-a-contensis-cloud-environment)
227
+ - [Login to a connected Contensis environment](#login-to-a-connected-contensis-environment)
228
+ - [Manage Projects](#manage-projects)
229
+ - [List projects](#list-projects)
230
+ - [Set current project](#set-current-project)
231
+ - [Get project metadata](#get-project-metadata)
232
+ - [Set project metadata](#set-project-metadata)
233
+ - [Create a new project](#create-a-new-project)
234
+ - [Content Models](#content-models)
235
+ - [List content models](#list-content-models)
236
+ - [Examine a content model](#examine-a-content-model)
237
+ - [List content types, components](#list-content-types--components)
238
+ - [Examine a content type or component](#examine-a-content-type-or-component)
239
+ - [Entries](#entries)
240
+ - [Get entries](#get-entries)
241
+ - [Get an entry by id](#get-an-entry-by-id)
242
+ - [Get an entry with all of its dependents](#get-an-entry-with-all-of-its-dependents)
243
+ - [Get entries with a ZenQL statement](#get-entries-with-a-zenql-statement)
244
+ - [Choose entry fields to output](#choose-entry-fields-to-output)
245
+ - [Output results to a file](#output-results-to-a-file)
246
+ - [Format output](#format-output)
247
+ - [Manage API keys](#manage-api-keys)
248
+ - [List keys](#list-keys)
249
+ - [Create key](#create-key)
250
+ - [Remove key](#remove-key)
251
+ - [Manage roles](#manage-roles)
252
+ - [List roles](#list-roles)
253
+ - [Create role](#create-role)
254
+ - [Set role details](#set-role-details)
255
+ - [Disable role](#disable-role)
256
+ - [Remove role](#remove-role)
257
+ - [Manage content Blocks](#manage-content-blocks)
258
+ - [List blocks](#list-blocks)
259
+ - [Get block](#get-block)
260
+ - [Get block logs](#get-block-logs)
261
+ - [Push a block](#push-a-block)
262
+ - [Execute block actions](#execute-block-actions)
263
+ - [Release a block version](#release-a-block-version)
264
+ - [Make a block version live](#make-a-block-version-live)
265
+ - [Mark a block version as broken](#mark-a-block-version-as-broken)
266
+ - [Rollback a live block version](#rollback-a-live-block-version)
267
+ - [Manage renderers](#manage-renderers)
268
+ - [List renderers](#list-renderers)
269
+ - [Manage proxies](#manage-proxies)
270
+ - [List proxies](#list-proxies)
271
+ - [View webhook subscriptions](#view-webhook-subscriptions)
272
+ - [Import content models](#import-content-models)
273
+ - [Import from another Contensis environment](#import-from-another-contensis-environment)
274
+ - [From a file](#from-a-file)
275
+ - [Import entries](#import-entries)
276
+ - [Import from another Contensis environment](#import-from-another-contensis-environment-1)
277
+ - [Import from a file](#import-from-a-file-1)
278
+ - [Import entries further reading](#import-entries-further-reading)
279
+ - [Remove entries](#remove-entries)
280
+
85
281
  ## Get started
86
282
 
87
283
  Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
@@ -107,6 +303,8 @@ Example call:
107
303
  > connect example-dev
108
304
  ```
109
305
 
306
+ Just type `help` to show the cli command help
307
+
110
308
  ## Connect to a Contensis Cloud environment
111
309
 
112
310
  Use the connect command followed by the cloud alias of your environment
@@ -121,9 +319,9 @@ contensis > connect example-dev
121
319
  contensis example-dev>
122
320
  ```
123
321
 
124
- After connecting you will notice the shell prompt will now contain the current "connected" environment - `contensis example-dev> `
322
+ After connecting you will notice the shell prompt will now contain the current "connected" environment e.g. `contensis example-dev> `
125
323
 
126
- The CMS must be online and available in order to connect to it
324
+ Contensis must be online and available in order to connect to it
127
325
 
128
326
  ```shell
129
327
  contensis > connect exemple-dev
@@ -145,9 +343,13 @@ contensis example-dev> login t.durden
145
343
  contensis t.durden@example-dev>
146
344
  ```
147
345
 
148
- If you are logging in via a script or service you will likely be using an API key set up in Contensis, you would provide the full credentials with the command `login {clientId} -s {sharedSecret}`
346
+ If you are logging in via a script or service you will likely be using an API key set up in Contensis, you would provide the full credentials with the command `login {clientId} -s {sharedSecret}`.
347
+
348
+ If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
149
349
 
150
- ## List projects
350
+ ## Manage Projects
351
+
352
+ ### List projects
151
353
 
152
354
  Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
153
355
 
@@ -167,7 +369,7 @@ contensis example-dev> list projects
167
369
  [cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
168
370
  ```
169
371
 
170
- ## Set current project
372
+ ### Set current project
171
373
 
172
374
  Set your current working project with the `set project {projectId}` command
173
375
 
@@ -187,7 +389,168 @@ intranet t.durden@example-dev>
187
389
 
188
390
  You will notice the `contensis` prompt has been updated to show your current connected project
189
391
 
190
- ## List content types, components
392
+ ### Get project metadata
393
+
394
+ ```shell
395
+ contensis t.durden@example-dev> get project
396
+
397
+ id: contensis
398
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
399
+ name: Contensis
400
+ description:
401
+ primaryLanguage: en-GB
402
+ supportedLanguages:
403
+ en-GB
404
+ color: cobalt
405
+
406
+ contensis t.durden@example-dev>
407
+ ```
408
+
409
+ ### Set project metadata
410
+
411
+ Update a project name
412
+
413
+ ```shell
414
+ contensis t.durden@example-dev> set project name "Contensis website"
415
+ [cli] ✅ [example-dev] Updated project contensis
416
+ id: contensis
417
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
418
+ name: Contensis website
419
+ description:
420
+ primaryLanguage: en-GB
421
+ supportedLanguages:
422
+ en-GB
423
+ color: cobalt
424
+
425
+ contensis t.durden@example-dev>
426
+ ```
427
+
428
+ Update a project's description
429
+
430
+ ```shell
431
+ contensis t.durden@example-dev> set project description "Main product site"
432
+ [cli] ✅ [example-dev] Updated project contensis
433
+ id: contensis
434
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
435
+ name: Contensis website
436
+ description: Main product site
437
+ primaryLanguage: en-GB
438
+ supportedLanguages:
439
+ en-GB
440
+ color: cobalt
441
+
442
+ contensis t.durden@example-dev>
443
+ ```
444
+
445
+ ### Create a new project
446
+
447
+ ```shell
448
+ website t.durden@example-dev> create project testProject "Test project" --supported-languages cy
449
+ [cli] ✅ [example-dev] Created project testProject
450
+
451
+ [cli] ✅ Available projects:
452
+
453
+ >> testProject [cy *en-GB]
454
+ website [*en-GB]
455
+ wordPressSite [*en-GB]
456
+
457
+ [cli] ✅ Current project is set to testProject
458
+
459
+ testProject t.durden@example-dev>
460
+ ```
461
+
462
+ ## Content Models
463
+
464
+ Manage your content models like you are the chosen one
465
+
466
+ ### List content models
467
+
468
+ ```shell
469
+ contensis t.durden@example-dev> list models
470
+ [cli] ✅ [website] Content models [ 19 ]
471
+
472
+ - accessibleVideo { required by: 3 }
473
+ - blogListing { components: 1, contentTypes: 2, references: 33, required by: 4 }
474
+ - blogPost { components: 2, contentTypes: 6, references: 33, required by: 9 }
475
+ - callToAction { contentTypes: 9, references: 33, required by: 5 }
476
+ - category { required by: 1 }
477
+ - contentPage { components: 5, contentTypes: 6, references: 33, required by: 7 }
478
+ - externalLink { required by: 2 }
479
+ - growingConditions { components: 1, references: 1, required by: 1 }
480
+ - homepage { components: 4, contentTypes: 8, references: 33, required by: 3 }
481
+ - landingPage { components: 9, contentTypes: 12, references: 33, required by: 7 }
482
+ - person { required by: 2 }
483
+ - plant { components: 2, contentTypes: 3, references: 8, required by: 10 }
484
+ - plantType { required by: 2 }
485
+ - pot { components: 2, contentTypes: 1, references: 3, required by: 11 }
486
+ - productListing { components: 1, references: 1, required by: 4 }
487
+ - review { contentTypes: 3, references: 10, required by: 1 }
488
+ - siteSettings
489
+ - tag { required by: 5 }
490
+
491
+ contensis t.durden@example-dev>
492
+ ```
493
+
494
+ ### Examine a content model
495
+
496
+ A `model` is a complete view of a content type that includes all of its dependents - and the dependents of those dependents
497
+
498
+ - `contentTypes` are the content types that have content linked to the model directly from this content type
499
+ - `components` are the content types that have content linked to the model directly from this content type
500
+ - `dependencies` is an exhaustive list of dependencies and inner dependents [the values in brackets are the models that have required it to make it a dependency]
501
+ - `dependencyOf` is a list of all the other content types (or components) that reference this content type directly, this model is a dependency of those
502
+
503
+ ```shell
504
+ contensis t.durden@example-dev> get model plant
505
+ [cli] ✅ Content models in contensis:
506
+
507
+ id: plant
508
+ dataFormat: model
509
+ name:
510
+ en-GB: Plant
511
+ description:
512
+ en-GB: Use this content type to store information about individual plants.
513
+ contentTypes:
514
+ growingConditions
515
+ plantType
516
+ tag
517
+ components:
518
+ externalPromotion
519
+ plantVariant
520
+ dependencyOf:
521
+ callToAction
522
+ homepage
523
+ landingPage
524
+ review
525
+ button
526
+ cardRow
527
+ curatedProductSlider
528
+ featuredBlogPosts
529
+ featuredProduct
530
+ promotedProduct
531
+ dependencies:
532
+ growingConditions
533
+ [plant]
534
+ plantType
535
+ [plant]
536
+ pot
537
+ [plantVariant]
538
+ tag
539
+ [plant, pot]
540
+ externalPromotion
541
+ [plant, pot]
542
+ icon
543
+ [growingConditions]
544
+ plantVariant
545
+ [plant]
546
+ potVariant
547
+ [pot]
548
+
549
+
550
+ contensis t.durden@example-dev>
551
+ ```
552
+
553
+ ### List content types, components
191
554
 
192
555
  ```shell
193
556
  contensis t.durden@example-dev> list contenttypes
@@ -212,12 +575,12 @@ contensis t.durden@example-dev> list contenttypes
212
575
  - tag [1 field]
213
576
  ```
214
577
 
215
- ## Examine a content type or component
578
+ ### Examine a content type or component
216
579
 
217
580
  ```shell
218
581
  contensis t.durden@example-dev> get contenttype pot
219
582
  [cli] ✅ [website] Content type "pot"
220
- uuid: adc051ee-d584-4f2a-ba42-5e6190edadb8
583
+ uuid: 929a99d2-fe5c-4781-84fa-f5a3738aa96d
221
584
  id: pot
222
585
  projectId: website
223
586
  name:
@@ -226,19 +589,19 @@ contensis t.durden@example-dev> get contenttype pot
226
589
  entryTitleField: productName
227
590
  entryDescriptionField: description
228
591
  fields:
229
- productName: string
592
+ productName**: string
230
593
  description: string
231
- externalPromotion: object
594
+ externalPromotion: object<component.externalpromotion>
232
595
  colour: string
233
596
  material: string
234
- potVariant: objectArray
235
- primaryImage: object
236
- photos: objectArray
237
- externalCardImage: object
238
- tags: objectArray
597
+ potVariant: objectArray<component.potvariant>
598
+ primaryImage: object<image>
599
+ photos: objectArray<image>
600
+ externalCardImage: object<image>
601
+ tags: objectArray<entry, tag>
239
602
  defaultLanguage: en-GB
240
603
  supportedLanguages:
241
- 0: en-GB
604
+ en-GB
242
605
  workflowId: contensisEntryBasic
243
606
  dataFormat: entry
244
607
  groups:
@@ -250,7 +613,9 @@ contensis t.durden@example-dev> get contenttype pot
250
613
  contensis t.durden@example-dev>
251
614
  ```
252
615
 
253
- ## Get entries
616
+ ## Entries
617
+
618
+ ### Get entries
254
619
 
255
620
  Use the `get entries` command
256
621
 
@@ -280,7 +645,7 @@ Found 8 entries in [website]
280
645
  website t.durden@example-dev>
281
646
  ```
282
647
 
283
- ## Get an entry by id
648
+ ### Get an entry by id
284
649
 
285
650
  ```shell
286
651
  website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
@@ -299,7 +664,7 @@ Found 1 entries in [website]
299
664
  website t.durden@example-dev>
300
665
  ```
301
666
 
302
- ## Get an entry with all of its dependents
667
+ ### Get an entry with all of its dependents
303
668
 
304
669
  Add the `--dependents` or `-d` flag to your `get entries` command to also find and fetch all dependent (linked) entries, recursively finding and including any dependent entries found inside those dependents.
305
670
 
@@ -333,7 +698,7 @@ Found 12 entries in [website]
333
698
  website t.durden@example-dev>
334
699
  ```
335
700
 
336
- ## Get entries with a ZenQL statement
701
+ ### Get entries with a ZenQL statement
337
702
 
338
703
  Use a ZenQL statement to find entries with the `--zenql` or `-q` option, add your statement inside `"double quotes"`. Refer to [ZenQL documentation](https://www.contensis.com/help-and-docs/user-guides/zenql-search) and test your statement for the right results in the Contensis web UI.
339
704
 
@@ -374,7 +739,7 @@ Found 21 entries in [website]
374
739
  website t.durden@example-dev>
375
740
  ```
376
741
 
377
- ## Choose entry fields to output
742
+ ### Choose entry fields to output
378
743
 
379
744
  Add the `--fields` or `-f` option to your `get entries` command to limit and order the entry fields that are returned, add the api key of each field to be returned separated by a space
380
745
 
@@ -406,7 +771,7 @@ Found 12 entries in [website]
406
771
  website t.durden@example-dev>
407
772
  ```
408
773
 
409
- ## Output results to a file
774
+ ### Output results to a file
410
775
 
411
776
  Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
412
777
 
@@ -469,9 +834,12 @@ website t.durden@example-dev>
469
834
  ```shell
470
835
  website t.durden@example-dev> create key "Test key" "Key to demonstrate cli"
471
836
  [cli] ✅ [example-dev] Created API key "Test key"
472
- - Test key (Key to demonstrate cli) [2022-07-27 t.durden]
473
- - id: af645b8b-fa3b-4196-a1b7-ac035f7598a3
474
- - sharedSecret: 1ff8b259423c4be08589a63f180c1bdc-63bd3a4f421c44c2afd0ba61e837d671-6aa9532442f149e6a9a837326a9a98e9
837
+ - Test key [2022-12-13 t.durden]
838
+ Key to demonstrate cli
839
+ id: 05a0922f-53e7-4a19-a92c-c9567dbe3246
840
+ sharedSecret: 63d2828363f74fc1958f0d60c2306aae-02e8bc50271c479f82dba92a08d3ad16-64b93a3bb8eb4f428a1dddaecc9a84d3
841
+
842
+ [cli] ⏩ Assign your new key to a role with "set role assignments", or create a new role with "create role"
475
843
 
476
844
  website t.durden@example-dev>
477
845
  ```
@@ -489,7 +857,253 @@ website t.durden@example-dev>
489
857
 
490
858
  Run `list keys` again and you will see your new API key has been removed from the list of keys
491
859
 
492
- ## Manage Content Blocks
860
+ ## Manage roles
861
+
862
+ You can use the cli or shell to manage roles that are used to provide access to resources in your Contensis project
863
+
864
+ ### List roles
865
+
866
+ ```shell
867
+ website t.durden@example-dev> list roles
868
+ [cli] ✅ [example-dev] Retrieved roles
869
+ - Webinar administrators 058ad55d-bf54-4eb2-b74d-2e8ebd93a400
870
+ groups: System Administrators, Zengenti Marketing Team
871
+ users: t.turner, j.smith, s.harris
872
+ keys: Webinar integration
873
+ entries:
874
+ webinar: *
875
+ formWebinarSignUp: *
876
+ person: *
877
+ accessibleVideo: *
878
+ - Entry Administrators 88babee8-9d65-4bd2-93f7-735e2c016911
879
+ Users assigned to this role can perform all actions on all entries.
880
+ groups: System Administrators
881
+ keys: companySync, Docs import, Development, Content administrator
882
+ entries:
883
+ *: *
884
+ - System content syncing 0eca0043-9b91-462a-3007-c5a5b6e6d15d
885
+ allows background processes to sync content
886
+ groups: User Administrators
887
+ keys: Docs import, companySync, User management
888
+ entries:
889
+ *: contensisEntryBasic.*
890
+ - Media service 16d8947c-7571-4c31-b906-d628de8963a8
891
+ Create and publish media asset entries
892
+ keys: block-contensis-media-service
893
+ entries:
894
+ mediaAsset: *
895
+
896
+ website t.durden@example-dev>
897
+ ```
898
+
899
+ ### Create role
900
+
901
+ ```shell
902
+ website t.durden@example-dev> create role "Test role" "Role to demonstrate cli"
903
+ [cli] ✅ [example-dev] Created role "Test role"
904
+
905
+ id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
906
+ projectId: website
907
+ name: Test role
908
+ description: Role to demonstrate cli
909
+ enabled: true
910
+ permissions:
911
+ webhookSubscriptions:
912
+ proxies:
913
+ eventStreams:
914
+ blocks:
915
+ renderers:
916
+ views:
917
+ assignments:
918
+
919
+ [cli] ⏩ Give access to your role with "set role assignments", allow your role to do things with "set role permissions"
920
+
921
+ website t.durden@example-dev>
922
+ ```
923
+
924
+ Run `list roles` again and you will see your new role added to the returned list
925
+
926
+ ### Set role details
927
+
928
+ #### Assignments
929
+
930
+ Assign users, groups or keys to your role. We will make assignments using their name or user id for users.
931
+
932
+ ```shell
933
+ website t.durden@example-dev> set role assignments "Test role" --assign-keys "Test key"
934
+ [cli] ✅ [example-dev] Retrieved roles
935
+ [cli] ℹ Updating role with details
936
+
937
+ assignments:
938
+ - apiKeys:
939
+ Test key
940
+
941
+ [cli] ✅ Succesfully updated role
942
+
943
+ id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
944
+ projectId: website
945
+ name: Test role
946
+ description: Role to demonstrate cli
947
+ enabled: true
948
+ permissions:
949
+ webhookSubscriptions:
950
+ proxies:
951
+ eventStreams:
952
+ blocks:
953
+ renderers:
954
+ views:
955
+ assignments:
956
+ apiKeys:
957
+ Test key
958
+
959
+ website t.durden@example-dev>
960
+ ```
961
+
962
+ #### Permissions
963
+
964
+ Set permissions to give the assignees of your role access to your project resources.
965
+
966
+ We can set permissions for entries.
967
+
968
+ ```shell
969
+ website t.durden@example-dev> set role permissions "Test role" --content-type-ids simpleContent linkedContent
970
+ [cli] ✅ [example-dev] Retrieved roles
971
+ [cli] ℹ Updating role with details
972
+
973
+ permissions:
974
+ - entries:
975
+ id: simpleContent
976
+ id: linkedContent
977
+
978
+ [cli] ✅ Succesfully updated role
979
+
980
+ id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
981
+ projectId: website
982
+ name: Test role
983
+ description: Role to demonstrate cli
984
+ enabled: true
985
+ permissions:
986
+ entries:
987
+ - languages:
988
+ *
989
+ id: simpleContent
990
+ actions:
991
+ *
992
+ - languages:
993
+ *
994
+ id: linkedContent
995
+ actions:
996
+ *
997
+ webhookSubscriptions:
998
+ proxies:
999
+ eventStreams:
1000
+ blocks:
1001
+ renderers:
1002
+ views:
1003
+ assignments:
1004
+ apiKeys:
1005
+ Test key
1006
+
1007
+ website t.durden@example-dev>
1008
+ ```
1009
+
1010
+ ### Disable role
1011
+
1012
+ Disable a role by using the command `set role enabled` with the `--disabled` flag
1013
+
1014
+ ```shell
1015
+ website t.durden@example-dev> set role enabled "Test role" --disabled
1016
+ [cli] ✅ [example-dev] Retrieved roles
1017
+ [cli] ℹ Updating role with details
1018
+
1019
+ enabled: false
1020
+
1021
+ [cli] ✅ Succesfully updated role
1022
+
1023
+ id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
1024
+ projectId: website
1025
+ name: Test role
1026
+ description: Role to demonstrate cli
1027
+ enabled: false
1028
+
1029
+ website t.durden@example-dev>
1030
+ ```
1031
+
1032
+ Enable the role again by calling the same command without the `--disabled` flag
1033
+
1034
+ ```shell
1035
+ website t.durden@example-dev> set role enabled "Test role"
1036
+ [cli] ✅ [example-dev] Retrieved roles
1037
+ [cli] ℹ Updating role with details
1038
+
1039
+ enabled: true
1040
+
1041
+ [cli] ✅ Succesfully updated role
1042
+
1043
+ id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
1044
+ projectId: migratortron
1045
+ name: Test role
1046
+ description: Role to demonstrate cli
1047
+ enabled: true
1048
+
1049
+ website t.durden@example-dev>
1050
+ ```
1051
+
1052
+ ### Remove role
1053
+
1054
+ ```shell
1055
+ website t.durden@example-dev> remove role "Test role"
1056
+ [cli] ✅ [example-dev] Retrieved roles
1057
+ [cli] ✅ [example-dev] Deleted role Test role
1058
+
1059
+ website t.durden@example-dev>
1060
+ ```
1061
+
1062
+ Run `list roles` again and you will see your new role has been removed from the list of role
1063
+
1064
+ ## View webhook subscriptions
1065
+
1066
+ ```shell
1067
+ website t.durden@example-dev> list webhooks
1068
+ [cli] ✅ [example-dev] Webhook subscriptions:
1069
+ - Test webhook 43969978-f9c1-4ee6-a515-11e0ceaddfeb [2022-12-13 t.durden]
1070
+ [POST] https://webhook.site/dede53b3-f044-4640-8634-5f0061ade5c7
1071
+ headers:
1072
+ test: true
1073
+ credential: 🤐
1074
+ topics: resourceType:entry event:[created updated]
1075
+ - More Testing 52e6bac1-1d81-462e-b483-d22034173cb4 [2022-07-15 b.feaver]
1076
+ [POST] https://webhook.site/cd0e99b5-d658-423c-acf5-47af7dfcaa06
1077
+ topics: resourceType:entry event:[published] contentTypeId:[blogPost]
1078
+
1079
+ website t.durden@example-dev>
1080
+ ```
1081
+
1082
+ ```shell
1083
+ website t.durden@example-dev> get webhook "Slack"
1084
+ [cli] ✅ [example-dev] Webhook subscriptions:
1085
+ - Slack 5a8dfee1-238f-44fe-b8aa-4b932099500c [2021-07-28 g.moore]
1086
+ Send a notification to a channel
1087
+ [POST] https://webhook.site/5ac0d1c4-8e2e-42c2-a055-66dc7e04843a
1088
+ topics:
1089
+ - resourceType: entry
1090
+ event:
1091
+ published
1092
+ unpublished
1093
+ contentTypeId:
1094
+ article
1095
+ - resourceType: entry
1096
+ event:
1097
+ workflowStateChanged
1098
+ workflowState:
1099
+ contensisEntryApproval.awaitingApproval
1100
+ contensisEntryApproval.declined
1101
+ templates: entry
1102
+
1103
+ website t.durden@example-dev>
1104
+ ```
1105
+
1106
+ ## Manage content Blocks
493
1107
 
494
1108
  You can manage blocks for any Contensis project using the following commands
495
1109
 
@@ -536,6 +1150,9 @@ website t.durden@example-dev> get block simple-block master
536
1150
  website t.durden@example-dev>
537
1151
  ```
538
1152
 
1153
+ > **Tip**
1154
+ > Add a version number or `latest` to the end of your `get block {block-id} {branch} {version}` command to output a complete set of details for that block version
1155
+
539
1156
  ### Get block logs
540
1157
 
541
1158
  ```shell
@@ -554,7 +1171,10 @@ website t.durden@example-dev> get block logs contensis-website master
554
1171
  website t.durden@example-dev>
555
1172
  ```
556
1173
 
557
- ### Push block
1174
+ ### Push a block
1175
+
1176
+ > **Note**
1177
+ > It is far simpler doing this in [GitLab CI](#use-in-gitlab-ci) or [GitHub CI Actions](#use-in-github-ci)
558
1178
 
559
1179
  ```shell
560
1180
  website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/contensis-app:build-4359 master --release --commit-id 9ee20333 --commit-message "chore: sample commit message" --commit-datetime 2022-11-03T22:34 --author-email b.macka@zengenti.com --committer-email b.macka@zengenti.com --repository-url https://github.com/contensis/contensis-app.git --provider GitlabSelfHosted
@@ -563,69 +1183,517 @@ website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/conten
563
1183
  website t.durden@example-dev>
564
1184
  ```
565
1185
 
566
- ## Use in Docker
1186
+ ### Execute block actions
567
1187
 
568
- Running the container with the `-it` docker options will launch a shell session
1188
+ We can perform certain actions on a specific version of a block with the `execute block action {type}` command
569
1189
 
570
- ```bash
571
- docker pull ghcr.io/contensis/node-cli/main/app:latest
572
- docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
1190
+ To execute an action on a specific block version, first you can find the the latest block version number with `get block {block-id} {branch} latest` or leave out the `latest` argument to see a short list of recent versions.
1191
+
1192
+ ```shell
1193
+ website t.durden@example-dev>get block contensis-website master latest
1194
+ [cli] ✅ [example-dev] Block contensis-website in project website:
1195
+ v78 contensis-website
1196
+ state: available
1197
+ released: no
1198
+ status:
1199
+ deployment: deployed
1200
+ workflow: draft
1201
+ running status: available
1202
+ datacentres:
1203
+ hq: available
1204
+ london: available
1205
+ manchester: faulted
1206
+ source:
1207
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
1208
+ message: build: syntax [nobuild]
1209
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
1210
+ pushed: [22/11/2022 06:52] Gitlab CI block push
1211
+ https://github.com/contensis/contensis-website/commit/b946c1029c1b35aefee2e1a6b5780ddaf205ee74
1212
+ image:
1213
+ uri: ghcr.io/contensis/contensis-website/main/app
1214
+ tag: latest
1215
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=draft
1216
+
1217
+ website t.durden@example-dev>
573
1218
  ```
574
1219
 
575
- ### Run cli commands
1220
+ Add the block version number to the `execute block action {type} {block-id} {version}` command - further examples are below
576
1221
 
577
- Add the cli command and any options after the container image in the `docker run` command e.g.
1222
+ #### Release a block version
578
1223
 
579
- ```bash
580
- docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
1224
+ To mark a block version as "released"
1225
+
1226
+ ```shell
1227
+
1228
+ website t.durden@example-dev> execute block action release contensis-website 78
1229
+ [cli] ✅ [example-dev] Action release on contensis-website in project website requested successfully
1230
+ v78 contensis-website
1231
+ state: available
1232
+ released: [23/11/2022 01:42] n.flatley
1233
+ status:
1234
+ deployment: deployed
1235
+ workflow: released
1236
+ running status: available
1237
+ datacentres:
1238
+ hq: available
1239
+ london: available
1240
+ manchester: faulted
1241
+ source:
1242
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
1243
+ message: build: syntax [nobuild]
1244
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
1245
+ pushed: [22/11/2022 06:52] Gitlab CI block push
1246
+ null
1247
+ image:
1248
+ uri: ghcr.io/contensis/contensis-website/main/app
1249
+ tag: latest
1250
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=released
1251
+
1252
+ website t.durden@example-dev>
581
1253
  ```
582
1254
 
583
- ### Persist connections to a local file
1255
+ > **Note**
1256
+ > you can leave out the `version` argument to release the last pushed version of the block
584
1257
 
585
- To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
1258
+ #### Make a block version live
586
1259
 
587
- <aside>
588
- ⚠️ Ensure a file called `environments.json` exists before mapping the volume to the docker container. If it doesn’t exist, create this empty file first.
1260
+ Follow the examples for [releasing a block version](#release-a-block-version) except target your command to this action
589
1261
 
590
- </aside>
1262
+ ```shell
1263
+ execute block action makelive {block-id} {version}
1264
+ ```
591
1265
 
592
- Linux
1266
+ #### Mark a block version as broken
593
1267
 
594
- ```bash
595
- touch environments.json
596
- docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
1268
+ Follow the examples for [releasing a block version](#release-a-block-version) except target your command to this action
1269
+
1270
+ ```shell
1271
+ execute block action markasbroken {block-id} {version}
597
1272
  ```
598
1273
 
599
- Windows
1274
+ #### Rollback a live block version
600
1275
 
601
- ```powershell
602
- echo {} > environments.json
603
- docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
1276
+ Follow the examples for [releasing a block version](#release-a-block-version) except target your command to this action
1277
+
1278
+ ```shell
1279
+ execute block action rollback {block-id} {version}
604
1280
  ```
605
1281
 
606
- ## Use in GitLab CI
1282
+ ## Manage renderers
607
1283
 
608
- ```yaml
609
- push-to-contensis-block:
610
- stage: push-to-contensis
611
- only:
612
- - master
613
- image: ghcr.io/contensis/node-cli/main/app:latest
614
- script:
615
- # - contensis connect zenhub-dev --project-id migratortron --client-id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 --shared-secret 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
616
- - contensis push block example-website-block $APP_IMAGE:latest --release -a example-dev -p website -id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 -s 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
1284
+ You can manage renderers for any Contensis project using the following commands
1285
+
1286
+ ### List renderers
1287
+
1288
+ ### Get a renderer
1289
+
1290
+ Append the renderer id to the `get renderer` command e.g. `get renderer contensis-website`
1291
+
1292
+ ## Manage proxies
1293
+
1294
+ You can manage proxies for any Contensis project using the following commands
1295
+
1296
+ ### List proxies
1297
+
1298
+ ```shell
1299
+ website t.durden@example-dev> list proxies
1300
+ [cli] ✅ [example-dev] Retrieved proxies in project website:
1301
+ - Get work requests [4.0] b8b6958f-6ae2-41d5-876a-abc86755fd7b Reverse proxy helpdesk endpoints
1302
+ - language: en-GB
1303
+ server: 10.0.46.200
1304
+ headers.host: account-id.zendesk.com
1305
+ ssl: true
1306
+ - HelpDesk Webservice [5.0] fd04d8ad-b1ec-4b0c-95d9-a7a6aec6d05d Used to support the helpdesk
1307
+ - language: en-GB
1308
+ server: 10.0.46.200
1309
+ headers.host: account-id.zendesk.com
1310
+ ssl: true
1311
+
1312
+ website t.durden@example-dev>
617
1313
  ```
618
1314
 
619
- ## Use in GitHub CI
1315
+ ### Get a proxy
620
1316
 
621
- ```yaml
622
- - name: Push block to Contensis
623
- uses: contensis/cli-action@v1
624
- with:
625
- block-id: example-website-block
626
- # auto-release: true
627
- alias: zenhub-dev
628
- project-id: contensis
629
- client-id: ${{ secrets.CONTENSIS_CLIENT_ID }}
630
- shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }}
1317
+ Append the proxy id to the `get proxy` command e.g. `get proxy b8b6958f-6ae2-41d5-876a-abc86755fd7b`
1318
+
1319
+ ## Import content models
1320
+
1321
+ ### Import from another Contensis environment
1322
+
1323
+ Connect to your "source" environment, ensure you can fetch the models from this environment first and that these models contain the dependencies you plan on importing to your "target" environment.
1324
+
1325
+ Check that the right assets will eventually be imported with the `list models` or `get model {modelIds...}` command
1326
+
1327
+ When you are happy the expected models are being returned for your import, you should then `connect` to your "target" environment (and `set project`) and when we are successfully connected to our target project, call the `import models` command, ensuring you add any arguments you used with your `get model` check earlier.
1328
+
1329
+ #### Specify a list of models to import
1330
+
1331
+ ```shell
1332
+ website t.durden@example-dev> import models plant --source-alias example-dev --source-project-id leif
1333
+
1334
+ -------------------------------------
1335
+ -- IMPORT PREVIEW --
1336
+
1337
+ Content types:
1338
+ - growingConditions [website: no change] v1.0
1339
+ required by: [plant]
1340
+ references: [icon]
1341
+ - plant [website: update] v2.0
1342
+ references: [growingConditions, plantGenus, plantType, tag]
1343
+ diff: ...{'id':'<+>genus','name':{'en-GB':'Genus'},'dataType':'object','dataFormat':'entry','description':{},'default':null,'validations':{'allowedContentTypes':{'contentTypes':['plantGenus'],'message':null}},'editor':null,'groupId':'main'},{'id':'</+>plantVariant','name':{'en-GB':'Plant variant'}...
1344
+ - plantGenus [website: create] v0.1
1345
+ required by: [plant]
1346
+ - plantType [website: no change] v1.0
1347
+ required by: [plant]
1348
+ - pot [website: no change] v2.0
1349
+ required by: [plantVariant]
1350
+ references: [externalPromotion, potVariant, tag]
1351
+ - tag [website: no change] v1.0
1352
+ required by: [plant, pot]
1353
+
1354
+ Components:
1355
+ - externalPromotion [website: no change] v1.0
1356
+ required by: [plant, pot]
1357
+ - icon [website: no change] v1.0
1358
+ required by: [growingConditions]
1359
+ - plantVariant [website: no change] v2.0
1360
+ required by: [plant]
1361
+ references: [pot]
1362
+ - potVariant [website: no change] v1.0
1363
+ required by: [pot]
1364
+
1365
+ website t.durden@example-dev>
1366
+ ```
1367
+
1368
+ #### Import all models from the source project
1369
+
1370
+ ```shell
1371
+ website t.durden@example-dev> import models --source-alias example-dev --source-project-id leif
1372
+ -------------------------------------
1373
+ -- IMPORT PREVIEW --
1374
+
1375
+ Content types:
1376
+ - accessibleVideo [website: no change] v1.0
1377
+ required by: [blogPost, contentPage, landingPage]
1378
+ - alert [website: create] v0.1
1379
+ - blogListing [website: no change] v2.0
1380
+ required by: [button, callToAction, homepage, landingPage]
1381
+ references: [blogPost, callToAction, pageMetadata]
1382
+ - blogPost [website: update] v3.0
1383
+ required by: [blogListing, blogPost, button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1384
+ references: [accessibleVideo, blogPost, callToAction, category, externalPromotion, featuredProduct, person, tag]
1385
+ diff: ...
1386
+ - callToAction [website: no change] v2.0
1387
+ required by: [blogListing, blogPost, contentPage, homepage, landingPage]
1388
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1389
+ - campus [website: create] v0.1
1390
+ - category [website: no change] v1.0
1391
+ required by: [blogPost, department, listing]
1392
+ - contentPage [website: no change] v2.0
1393
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1394
+ references: [accessibleVideo, blogPost, callToAction, callout, cardRow, contentPage, featuredProduct, formPicker, landingPage, pageMetadata, tag]
1395
+ - department [website: two-pass] v0.1
1396
+ references: [category]
1397
+ - event [website: create] v0.1
1398
+ - externalLink [website: no change] v1.0
1399
+ required by: [button, callToAction]
1400
+ - form [website: create] v0.1
1401
+ - growingConditions [website: no change] v1.0
1402
+ required by: [listing, plant]
1403
+ references: [icon]
1404
+ - homepage [website: update] v2.0
1405
+ required by: [button, callToAction, landingPage]
1406
+ references: [blogListing, blogPost, callToAction, contentPage, curatedProductSlider, filteredProductSlider, landingPage, pageMetadata, plant, pot, productListing, promotedProduct]
1407
+ diff: ...
1408
+ - landingPage [website: update] v2.0
1409
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1410
+ references: [accessibleVideo, blogListing, blogPost, bodyCopy, callToAction, contentBlock, contentPage, curatedProductSlider, featuredBlogPosts, featuredProduct, filteredProductSlider, formPicker, homepage, landingPage, pageMetadata, plant, pot, productListing, promotedProduct, review, tag]
1411
+ diff: ...
1412
+ - listing [website: two-pass] v0.1
1413
+ references: [category, growingConditions, plantType, tag]
1414
+ - newsArticle [website: two-pass] v0.1
1415
+ references: [person]
1416
+ - newsTest [website: two-pass] v0.1
1417
+ references: [person]
1418
+ - person [website: no change] v1.0
1419
+ required by: [blogPost, newsArticle, newsTest, review]
1420
+ - plant [website: update] v2.0
1421
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, promotedProduct, review]
1422
+ references: [externalPromotion, growingConditions, plantGenus, plantType, plantVariant, tag]
1423
+ diff: ...
1424
+ - plantFamily [website: two-pass] v0.1
1425
+ required by: [plantOrder]
1426
+ references: [plantGenus]
1427
+ - plantGenus [website: create] v0.1
1428
+ required by: [plant, plantFamily]
1429
+ - plantOrder [website: two-pass] v0.1
1430
+ references: [plantFamily]
1431
+ - plantType [website: no change] v1.0
1432
+ required by: [filteredProductSlider, listing, plant]
1433
+ - pot [website: no change] v2.0
1434
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, plantVariant, promotedProduct, review]
1435
+ references: [externalPromotion, potVariant, tag]
1436
+ - productListing [website: no change] v1.0
1437
+ required by: [button, callToAction, homepage, landingPage]
1438
+ references: [pageMetadata]
1439
+ - review [website: no change] v2.0
1440
+ required by: [landingPage]
1441
+ references: [person, plant, pot]
1442
+ - siteSettings [website: no change] v1.0
1443
+ - tag [website: no change] v1.0
1444
+ required by: [blogPost, contentPage, landingPage, listing, plant, pot]
1445
+ - testLang [website: create] v0.1
1446
+
1447
+ Components:
1448
+ - bodyCopy [website: no change] v1.0
1449
+ required by: [landingPage]
1450
+ - button [website: no change] v2.0
1451
+ required by: [promotedProduct]
1452
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1453
+ - callout [website: no change] v1.0
1454
+ required by: [contentPage, event]
1455
+ - cardRow [website: no change] v2.0
1456
+ required by: [contentPage]
1457
+ references: [blogPost, contentPage, landingPage, plant, pot]
1458
+ - contentBlock [website: no change] v1.0
1459
+ required by: [landingPage]
1460
+ - curatedProductSlider [website: no change] v2.0
1461
+ required by: [homepage, landingPage]
1462
+ references: [plant, pot]
1463
+ - externalPromotion [website: no change] v1.0
1464
+ required by: [blogPost, plant, pot]
1465
+ - featuredBlogPosts [website: no change] v2.0
1466
+ required by: [landingPage]
1467
+ references: [blogPost, contentPage, landingPage, plant, pot]
1468
+ - featuredProduct [website: no change] v2.0
1469
+ required by: [blogPost, contentPage, landingPage]
1470
+ references: [plant, pot]
1471
+ - filteredProductSlider [website: no change] v2.0
1472
+ required by: [homepage, landingPage]
1473
+ references: [plantType]
1474
+ - formPicker [website: no change] v1.0
1475
+ required by: [contentPage, landingPage]
1476
+ - icon [website: no change] v1.0
1477
+ required by: [growingConditions]
1478
+ - pageMetadata [website: no change] v1.0
1479
+ required by: [blogListing, contentPage, homepage, landingPage, productListing]
1480
+ - plantVariant [website: no change] v2.0
1481
+ required by: [plant]
1482
+ references: [pot]
1483
+ - potVariant [website: no change] v1.0
1484
+ required by: [pot]
1485
+ - promotedProduct [website: update] v2.0
1486
+ required by: [homepage, landingPage]
1487
+ references: [button, plant, pot]
1488
+ diff: ...
1489
+
1490
+ website t.durden@example-dev>
631
1491
  ```
1492
+
1493
+ ### Import from a file
1494
+
1495
+ ```shell
1496
+ website t.durden@example-dev> import models --from-file ./content-models.json
1497
+ ```
1498
+
1499
+ The output will be the same as the `import models` examples above
1500
+
1501
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1502
+
1503
+ ## Import entries
1504
+
1505
+ ### Import from another Contensis environment
1506
+
1507
+ Connect to your "source" environment first, ensure you can fetch the entries you plan on importing from here and your query / filters are working to fetch exactly the data you are expecting with the `get entries` command. Add the `--dependents` option to fetch all of the entries that will eventually be imported.
1508
+
1509
+ When you are happy you can fetch only the data you intend to import, connect to the "target" environment (and project) then use the same query as before except with the `import entries` command
1510
+
1511
+ ```shell
1512
+ website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
1513
+ -------------------------------------
1514
+ -- IMPORT PREVIEW --
1515
+ [26/11 02:16:29] [INFO] Fetching initial entries in project 'leif'
1516
+ Fetch [leif] >> 100% 21 0.0s/0.0s 100000p/s
1517
+ Fetch [leif] >> 100% 79 0.0s/0.0s Infinityp/s
1518
+ Fetch [leif] >> 100% 13 0.0s/0.0s Infinityp/s
1519
+
1520
+ Found 113 entries in leif
1521
+ --------------------------------------------
1522
+
1523
+ id contentTypeId entryTitle entryDescrip
1524
+ ------------------------------------------------------------------------------------------------------
1525
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitche
1526
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-c
1527
+ 43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up
1528
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautif
1529
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-c
1530
+ b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care
1531
+ a3339124-4340-4f31-a209-5a6413a89f15 plant Chinese money plant The Chinese
1532
+ 8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great opti
1533
+ 329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear
1534
+ 504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Ce
1535
+ a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily ident
1536
+ 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of
1537
+ ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic ch
1538
+ 6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut
1539
+ 50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its
1540
+ 4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy
1541
+ 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging pl
1542
+ 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-b
1543
+ 8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants
1544
+ b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut
1545
+ 0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut
1546
+ 51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
1547
+ c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
1548
+ 3b830d97-e976-467c-a833-1b4abcab65d0 image areca-palm-in-room null
1549
+ ed0300b0-e841-4c0f-bd1d-9ecd6bc2a354 image areca-palm-leaf null
1550
+ 00119ef1-c3c4-4a49-9076-27eee5605515 image areca-palm-plant-collection null
1551
+ 248e2817-6241-4de7-ac5d-75411be4339d image boston-fern-close-up null
1552
+
1553
+ - and 87 more...
1554
+
1555
+ [26/11 02:16:29] [INFO] Finding 113 entries in project 'website'
1556
+ Fetch [website] >> 100% 113 0.2s/0.0s 897p/s
1557
+ Fetch [website] >> 100% 4 0.0s/0.0s Infinityp/s
1558
+ [26/11 02:16:30] [INFO] Building 66 asset entries
1559
+ [26/11 02:16:30] [INFO] Building 47 content entries
1560
+
1561
+ 37/113 entries to migrate into [website]
1562
+
1563
+ contentTypeId status total
1564
+ ----------------------------------------------
1565
+ plantGenus error 4
1566
+ growingConditions update 4
1567
+ plant update 21
1568
+ pot update 12
1569
+ image no change 66
1570
+ plantType no change 5
1571
+ tag no change 1
1572
+ ----------------------------------------------
1573
+
1574
+ id contentTypeId status updates entryTitle
1575
+ ------------------------------------------------------------------------------------------------------
1576
+ 98347340-a11c-4ee5-b4e7-1ae3b75496a2 plantGenus error Aglaonema
1577
+ fa464489-6476-4694-b3d4-e77d0c00a185 plantGenus error Alocasia
1578
+ 309d5fd7-a21f-45a8-8abb-f01f820b8f16 plantGenus error Aloe
1579
+ 4ebdcc63-929f-4b06-8848-fe046468a63d plantGenus error Beaucarnea
1580
+ 636b925b-a386-4c56-9f33-96cd99cc391c growingConditions update -1,+0 Likes high humidity
1581
+ 2d80e638-eb0d-4bc5-bc96-42b7b8f20678 growingConditions update -1,+0 Needs plenty of light
1582
+ 711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions update -1,+0 Partial shade
1583
+ d815819d-61c6-4037-95d3-c503acf52153 growingConditions update -1,+0 Prefers dry conditions
1584
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant update -1,+0 Aloe vera
1585
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant update -1,+0 Areca palm
1586
+ 43a60005-ea92-4b32-9af3-79560e48ecec plant update -1,+0 Boston fern
1587
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant update -1,+0 Calathea orbifolia
1588
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 plant update -1,+0 Canary Island Date Pal
1589
+ b7129080-692c-4550-9e2b-28f8ec978651 plant update -1,+0 Chinese evergreen
1590
+ a3339124-4340-4f31-a209-5a6413a89f15 plant update -1,+0 Chinese money plant
1591
+ 8c284599-b615-40a7-9d26-0ddd586fff51 plant update -1,+0 Dracaena fragrans
1592
+ 329e3104-332f-48a4-b43a-de852df796b3 plant update -1,+0 Elephant ear
1593
+ 504f7b7f-af03-4711-94ca-07edb90fbe00 plant update -1,+0 Heartleaf philodendron
1594
+ a9a537e8-5508-4166-878c-d5fcd0d9a723 plant update -1,+0 Maidenhair fern
1595
+ 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant update -1,+0 Parlour palm
1596
+ ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant update -1,+0 Peace lily
1597
+ 6a71a864-6f61-471a-8cdd-f80237408666 plant update -1,+0 Pink moth orchid
1598
+ 50868245-3e53-4d9f-86ed-403593da67f6 plant update -1,+0 Ponytail palm
1599
+ 4f05979f-d8cf-4568-9045-05731a33f243 plant update -1,+0 Spider plant
1600
+ 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant update -1,+0 String of nickels
1601
+ 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant update -1,+0 Swiss cheese plant
1602
+ 8174fb53-b955-4e36-8f87-646bf286e396 plant update -1,+0 Variegated snake plant
1603
+
1604
+ - and 15 more...
1605
+
1606
+ --------------------------------------------
1607
+ [26/11 02:16:30] [OK] Done migrating entries
1608
+
1609
+ [cli] ⏩ import from project leif to website
1610
+
1611
+ - growingConditions: 4 [existing: 100%] [needs update: 100%]
1612
+ - image: 66 up to date
1613
+ - plant: 21 [existing: 100%] [needs update: 100%]
1614
+ - plantGenus: 4 [existing: 0%]
1615
+ - plantType: 5 up to date
1616
+ - pot: 12 [existing: 100%] [needs update: 100%]
1617
+ - tag: 1 up to date
1618
+ - totalCount: 37
1619
+ - errors: 1
1620
+
1621
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1622
+
1623
+ [cli] ❌ [example-dev] Unable to import entries
1624
+
1625
+ website t.durden@example-dev>
1626
+ ```
1627
+
1628
+ ### Import from a file
1629
+
1630
+ ```shell
1631
+ website t.durden@example-dev> import entries --preserve-guids --from-file ./content-entries.json
1632
+ ```
1633
+
1634
+ The output will be the same as the previous command
1635
+
1636
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1637
+
1638
+ ### Import entries further reading
1639
+
1640
+ The import commands are made possible by using the `migratortron` library. There is further documentation here:
1641
+
1642
+ - [`migratortron` on npmjs](https://www.npmjs.com/package/migratortron)
1643
+ - [`contensis-importer` on npmjs](https://www.npmjs.com/package/contensis-importer)
1644
+
1645
+ ## Remove entries
1646
+
1647
+ Delete entries by id
1648
+
1649
+ ```shell
1650
+ website t.durden@example-dev> remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-
1651
+ 8ea4ebd99aaa
1652
+ -- PREVIEW --
1653
+ [26/11 02:19:53] [INFO] Fetching initial entries in project 'website'
1654
+ Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
1655
+ [26/11 02:19:53] [INFO] Done deleting entries
1656
+
1657
+ a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
1658
+ 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
1659
+
1660
+ [cli] ⏩ delete from project website
1661
+
1662
+ - totalCount: 2 [to delete: 2]
1663
+
1664
+ [cli] ✅ [example-dev] Will delete entries
1665
+
1666
+ [cli] ⏩ Add --commit flag to commit the previewed changes
1667
+
1668
+ website t.durden@example-dev>
1669
+ ```
1670
+
1671
+ Delete entries with a supplied zenql statement
1672
+
1673
+ ```shell
1674
+ website t.durden@example-dev> remove entries --zenql "sys.version.created > 2022-11-25 14:00"
1675
+ -- PREVIEW --
1676
+ [26/11 02:20:52] [INFO] Fetching initial entries in project 'website'
1677
+ Fetch [website] >> 100% 7 0.0s/0.0s 100000p/s
1678
+ [26/11 02:20:53] [INFO] Done deleting entries
1679
+
1680
+ a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
1681
+ bb850178-c88c-50a6-8bac-844273cb19b8 delete image parlour-palm-white-room
1682
+ 1553d1c8-7a99-5dcd-b1cb-9a90d4cf1985 delete landingPage New subscription service
1683
+ f0b0ef1b-fdd1-52d6-99fc-4439e0c186e6 delete plantGenus Aglaonema
1684
+ f8f6ee36-9cc4-5d1e-be62-01ac73590947 delete plantGenus Aloe
1685
+ 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
1686
+ 4efeb0e4-dc19-5f87-ab89-47892b9c4169 delete pot Terra large terracotta pot
1687
+
1688
+ [cli] ⏩ delete from project website
1689
+
1690
+ - totalCount: 7 [to delete: 7]
1691
+
1692
+ [cli] ✅ [example-dev] Will delete entries
1693
+
1694
+ [cli] ⏩ Add --commit flag to commit the previewed changes
1695
+
1696
+ website t.durden@example-dev>
1697
+ ```
1698
+
1699
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>