contensis-cli 1.0.0-beta.53 → 1.0.0-beta.55

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 (68) hide show
  1. package/.vscode/launch.json +15 -15
  2. package/README.md +1226 -1226
  3. package/dist/commands/connect.js.map +1 -1
  4. package/dist/commands/create.js.map +1 -1
  5. package/dist/commands/diff.js.map +1 -1
  6. package/dist/commands/get.js.map +1 -1
  7. package/dist/commands/globalOptions.js.map +1 -1
  8. package/dist/commands/import.js.map +1 -1
  9. package/dist/commands/index.js.map +1 -1
  10. package/dist/commands/list.js.map +1 -1
  11. package/dist/commands/login.js.map +1 -1
  12. package/dist/commands/push.js.map +1 -1
  13. package/dist/commands/release.js.map +1 -1
  14. package/dist/commands/remove.js.map +1 -1
  15. package/dist/commands/set.js.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/localisation/en-GB.js.map +1 -1
  18. package/dist/providers/CredentialProvider.js.map +1 -1
  19. package/dist/providers/SessionCacheProvider.js.map +1 -1
  20. package/dist/providers/file-provider.js.map +1 -1
  21. package/dist/services/ContensisAuthService.js.map +1 -1
  22. package/dist/services/ContensisCliService.js +4 -0
  23. package/dist/services/ContensisCliService.js.map +2 -2
  24. package/dist/shell.js.map +1 -1
  25. package/dist/util/console.printer.js +5 -5
  26. package/dist/util/console.printer.js.map +2 -2
  27. package/dist/util/csv.formatter.js.map +1 -1
  28. package/dist/util/index.js.map +1 -1
  29. package/dist/util/json.formatter.js.map +1 -1
  30. package/dist/util/logger.js.map +1 -1
  31. package/dist/util/xml.formatter.js.map +1 -1
  32. package/dist/version.js +1 -1
  33. package/dist/version.js.map +1 -1
  34. package/esbuild.config.js +49 -49
  35. package/headless-setup.sh +6 -6
  36. package/package.json +59 -59
  37. package/src/commands/connect.ts +24 -24
  38. package/src/commands/create.ts +70 -70
  39. package/src/commands/diff.ts +41 -41
  40. package/src/commands/get.ts +214 -214
  41. package/src/commands/globalOptions.ts +127 -127
  42. package/src/commands/import.ts +128 -128
  43. package/src/commands/index.ts +80 -80
  44. package/src/commands/list.ts +116 -116
  45. package/src/commands/login.ts +34 -34
  46. package/src/commands/push.ts +127 -127
  47. package/src/commands/release.ts +32 -32
  48. package/src/commands/remove.ts +85 -85
  49. package/src/commands/set.ts +96 -96
  50. package/src/index.ts +19 -19
  51. package/src/localisation/en-GB.ts +289 -289
  52. package/src/models/AppError.d.ts +40 -40
  53. package/src/models/Cache.d.ts +25 -25
  54. package/src/models/JsModules.d.ts +1 -1
  55. package/src/providers/CredentialProvider.ts +121 -121
  56. package/src/providers/SessionCacheProvider.ts +101 -101
  57. package/src/providers/file-provider.ts +76 -76
  58. package/src/services/ContensisAuthService.ts +70 -70
  59. package/src/services/ContensisCliService.ts +1749 -1745
  60. package/src/shell.ts +270 -270
  61. package/src/util/console.printer.ts +371 -371
  62. package/src/util/csv.formatter.ts +21 -21
  63. package/src/util/index.ts +73 -73
  64. package/src/util/json.formatter.ts +1 -1
  65. package/src/util/logger.ts +234 -234
  66. package/src/util/xml.formatter.ts +20 -20
  67. package/src/version.ts +1 -1
  68. package/tsconfig.json +22 -22
package/README.md CHANGED
@@ -1,1226 +1,1226 @@
1
- # Contensis CLI
2
-
3
- Use Contensis from your favourite terminal
4
-
5
- Install the package via `npm` as a global module (requires NodeJS)
6
-
7
- ```shell
8
- npm i contensis-cli --global
9
- ```
10
-
11
- Alternatively, download the executable for your operating system from the [Releases page](https://github.com/contensis/node-cli/releases)
12
-
13
- ## Skip to section
14
-
15
- - [Contensis Shell](#contensis-shell)
16
- - [Use in Terminal](#cli-usage)
17
- - [Pass connection details anywhere](#pass-connection-details-anywhere)
18
- - [Use in Docker](#use-in-docker)
19
- - [Run cli commands](#run-cli-commands)
20
- - [Persist connections to a local file](#persist-connections-to-a-local-file)
21
- - [Use in GitLab CI](#use-in-gitlab-ci)
22
- - [Use in GitHub CI](#use-in-github-ci)
23
- - [Running headless?](#running-headless-)
24
-
25
- ## Use in Terminal
26
-
27
- Try
28
-
29
- ```shell
30
- contensis connect example-dev
31
- ```
32
-
33
- or
34
-
35
- ```shell
36
- contensis help
37
- ```
38
-
39
- 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.
40
-
41
- ### Pass connection details anywhere
42
-
43
- If you need to, you can supply all the necessary options to connect to a Contensis project and perform an operation in a single command
44
-
45
- You can supply the following options with any command - although they don't appear in help text:
46
-
47
- ```
48
- -a --alias
49
- -p --project-id
50
- -u --user
51
- -pw --password
52
- -id --client-id
53
- -s --shared-secret
54
- ```
55
-
56
- 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
57
-
58
- ## Use in Docker
59
-
60
- Running the container with the `-it` docker options will launch a shell session
61
-
62
- ```bash
63
- docker pull ghcr.io/contensis/node-cli/main/app:latest
64
- docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
65
- ```
66
-
67
- ### Run cli commands
68
-
69
- Add the cli command and any options after the container image in the `docker run` command e.g.
70
-
71
- ```bash
72
- docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
73
- ```
74
-
75
- ### Persist connections to a local file
76
-
77
- To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
78
-
79
- <aside>
80
- ⚠️ 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.
81
-
82
- </aside>
83
-
84
- Linux
85
-
86
- ```bash
87
- touch environments.json
88
- docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
89
- ```
90
-
91
- Windows
92
-
93
- ```powershell
94
- echo {} > environments.json
95
- docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
96
- ```
97
-
98
- ## Use in GitLab CI
99
-
100
- ```yaml
101
- push-to-contensis-block:
102
- stage: push-to-contensis
103
- only:
104
- - master
105
- image: ghcr.io/contensis/node-cli/main/app:release
106
- script:
107
- # Create CI/CD Variables in repo settings called CONTENSIS_CLIENT_ID and CONTENSIS_SHARED_SECRET
108
- - contensis connect example-dev --project-id website --client-id $CONTENSIS_CLIENT_ID --shared-secret $CONTENSIS_SHARED_SECRET
109
- - contensis push block example-website-block $APP_IMAGE:latest --release
110
- ```
111
-
112
- ## Use in GitHub CI
113
-
114
- ```yaml
115
- - name: Push block to Contensis
116
- uses: contensis/cli-action@v1
117
- with:
118
- block-id: example-website-block
119
- # auto-release: true # release the block straight away
120
- alias: example-dev
121
- project-id: website
122
- client-id: ${{ secrets.CONTENSIS_CLIENT_ID }} # create secrets for actions
123
- shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }} # in repo settings
124
- tag-repo: true # tag commit with block version
125
- git-token: ${{ github.token }} # to allow the git tag
126
- ```
127
-
128
- ## Running headless?
129
-
130
- Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
131
-
132
- 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.
133
-
134
- ```shell
135
- [WARN] Could not connect to local keystore - your password could be stored unencrypted!
136
- ```
137
-
138
- > **Note**
139
- > 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
140
-
141
- ~~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`~~
142
-
143
- ```shell
144
- sudo apt-get update && sudo apt-get install -y libsecret-1-0 dbus-x11 gnome-keyring
145
- export $(dbus-launch)
146
- dbus-launch
147
- gnome-keyring-daemon --start --daemonize --components=secrets
148
- echo 'neil' | gnome-keyring-daemon -r -d --unlock
149
- ```
150
-
151
- ~~Also, if you are running within a docker container, it requires `--cap-add=IPC_LOCK` option when running the container. Otherwise gnome-keyring-daemon will fail with: `gnome-keyring-daemon: Operation not permitted`~~
152
-
153
- ~~An executable script is available to test: `contensis-cli-headless` you will need sudo access to install additional libraries with `apt-get`~~
154
-
155
- # Contensis Shell
156
-
157
- The shell is the preferred way to use the cli, if the package is installed to your global `node_modules` you can start it by opening your terminal and typing `contensis`.
158
-
159
- ```
160
- ~$ contensis
161
-
162
-
163
- _|_|_| _| _|
164
- _| _|_| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_| _|_|_|
165
- _| _| _| _| _| _| _|_|_|_| _| _| _|_| _| _|_|
166
- _| _| _| _| _| _| _| _| _| _|_| _| _|_|
167
- _|_|_| _|_| _| _| _|_| _|_|_| _| _| _|_|_| _| _|_|_|
168
-
169
-
170
- © 2001-2022 Zengenti 🇬🇧.
171
- - Creators of Contensis and purveyors of other fine software
172
-
173
- 👋 Welcome to the contensis-cli
174
-
175
- Press [CTRL]+[C] or type "quit" to return to your system shell
176
- Press [TAB] for suggestions
177
-
178
- -------------------------------------
179
- contensis >
180
- ```
181
-
182
- ## Skip to section
183
-
184
- - [Get started](#get-started)
185
- - [Connect to a Contensis Cloud environment](#connect-to-a-contensis-cloud-environment)
186
- - [Login to a connected Contensis environment](#login-to-a-connected-contensis-environment)
187
- - [Manage Projects](#manage-projects)
188
- - [List projects](#list-projects)
189
- - [Set current project](#set-current-project)
190
- - [Get project metadata](#get-project-metadata)
191
- - [Set project metadata](#set-project-metadata)
192
- - [Create a new project](#create-a-new-project)
193
- - [Content Models](#content-models)
194
- - [List content models](#list-content-models)
195
- - [Examine a content model](#examine-a-content-model)
196
- - [List content types, components](#list-content-types--components)
197
- - [Examine a content type or component](#examine-a-content-type-or-component)
198
- - [Entries](#entries)
199
- - [Get entries](#get-entries)
200
- - [Get an entry by id](#get-an-entry-by-id)
201
- - [Get an entry with all of its dependents](#get-an-entry-with-all-of-its-dependents)
202
- - [Get entries with a ZenQL statement](#get-entries-with-a-zenql-statement)
203
- - [Choose entry fields to output](#choose-entry-fields-to-output)
204
- - [Output results to a file](#output-results-to-a-file)
205
- - [Format output](#format-output)
206
- - [Manage API keys](#manage-api-keys)
207
- - [List keys](#list-keys)
208
- - [Create key](#create-key)
209
- - [Remove key](#remove-key)
210
- - [Manage content Blocks](#manage-content-blocks)
211
- - [List blocks](#list-blocks)
212
- - [Get block](#get-block)
213
- - [Get block logs](#get-block-logs)
214
- - [Push a block](#push-a-block)
215
- - [Release a block version](#release-a-block-version)
216
- - [Import content models](#import-content-models)
217
- - [Import from another Contensis environment](#import-from-another-contensis-environment)
218
- - [From a file](#from-a-file)
219
- - [Import entries](#import-entries)
220
- - [Import from another Contensis environment](#import-from-another-contensis-environment-1)
221
- - [Import from a file](#import-from-a-file)
222
-
223
- ## Get started
224
-
225
- Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
226
-
227
- ```shell
228
- >> Available commands:
229
- connect list envs quit
230
- ```
231
-
232
- Add `--help` to any command to show the available options and arguments e.g.
233
-
234
- ```shell
235
- contensis > connect --help
236
- Usage: contensis connect <alias>
237
-
238
- Arguments:
239
- alias the Contensis Cloud alias to connect with
240
-
241
- Options:
242
- -h, --help display help for command
243
-
244
- Example call:
245
- > connect example-dev
246
- ```
247
-
248
- Just type `help` to show the cli command help
249
-
250
- ## Connect to a Contensis Cloud environment
251
-
252
- Use the connect command followed by the cloud alias of your environment
253
-
254
- ```shell
255
- contensis > connect example-dev
256
- [cli] ✅ Current environment set to "example-dev"
257
- [cli] ⚠️ Cannot retrieve projects list
258
- [cli] ⏩ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
259
-
260
- -------------------------------------
261
- contensis example-dev>
262
- ```
263
-
264
- After connecting you will notice the shell prompt will now contain the current "connected" environment e.g. `contensis example-dev> `
265
-
266
- Contensis must be online and available in order to connect to it
267
-
268
- ```shell
269
- contensis > connect exemple-dev
270
- [cli] ❌ Cannot reach https://cms-exemple-dev.cloud.contensis.com
271
- ```
272
-
273
- ## Login to a connected Contensis environment
274
-
275
- If you wish to use your normal username and password you will issue the command `login {username}`
276
-
277
- ```shell
278
- contensis example-dev> login t.durden
279
- ? Enter password for t.durden@example-dev: ********
280
- [cli] ✅ User t.durden connected to example-dev successfully
281
-
282
- [cli] ℹ Saved credentials for contensis-cli_example-dev
283
-
284
- -------------------------------------
285
- contensis t.durden@example-dev>
286
- ```
287
-
288
- 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}`.
289
-
290
- If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
291
-
292
- ## Manage Projects
293
-
294
- ### List projects
295
-
296
- Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
297
-
298
- ```shell
299
- contensis t.durden@example-dev> list projects
300
- [cli] ✅ Available projects:
301
- - [en-GB] intranet
302
- - [en-GB] marketingSite
303
- - [en-GB] microsite
304
- - * [en-GB] website
305
- ```
306
-
307
- Or if you are not logged in you should be given useful tips
308
-
309
- ```shell
310
- contensis example-dev> list projects
311
- [cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
312
- ```
313
-
314
- ### Set current project
315
-
316
- Set your current working project with the `set project {projectId}` command
317
-
318
- ```shell
319
- contensis t.durden@example-dev> set project intranet
320
- [cli] ✅ Current project is "intranet"
321
- -------------------------------------
322
- intranet t.durden@example-dev> list projects
323
- [cli] ✅ Available projects:
324
- - * [en-GB] intranet
325
- - [en-GB] marketingSite
326
- - [en-GB] microsite
327
- - [en-GB] website
328
-
329
- intranet t.durden@example-dev>
330
- ```
331
-
332
- You will notice the `contensis` prompt has been updated to show your current connected project
333
-
334
- ### Get project metadata
335
-
336
- ```shell
337
- contensis t.durden@example-dev> get project
338
-
339
- id: contensis
340
- uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
341
- name: Contensis
342
- description:
343
- primaryLanguage: en-GB
344
- supportedLanguages:
345
- en-GB
346
- color: cobalt
347
-
348
- contensis t.durden@example-dev>
349
- ```
350
-
351
- ### Set project metadata
352
-
353
- Update a project name
354
-
355
- ```shell
356
- contensis t.durden@example-dev> set project name "Contensis website"
357
- [cli] ✅ [example-dev] Updated project contensis
358
- id: contensis
359
- uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
360
- name: Contensis website
361
- description:
362
- primaryLanguage: en-GB
363
- supportedLanguages:
364
- en-GB
365
- color: cobalt
366
-
367
- contensis t.durden@example-dev>
368
- ```
369
-
370
- Update a project's description
371
-
372
- ```shell
373
- contensis t.durden@example-dev> set project description "Main product site"
374
- [cli] ✅ [example-dev] Updated project contensis
375
- id: contensis
376
- uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
377
- name: Contensis website
378
- description: Main product site
379
- primaryLanguage: en-GB
380
- supportedLanguages:
381
- en-GB
382
- color: cobalt
383
-
384
- contensis t.durden@example-dev>
385
- ```
386
-
387
- ### Create a new project
388
-
389
- ```shell
390
- website t.durden@example-dev> create project testProject "Test project" --supported-languages cy
391
- [cli] ✅ [example-dev] Created project testProject
392
-
393
- [cli] ✅ Available projects:
394
-
395
- >> testProject [cy *en-GB]
396
- website [*en-GB]
397
- wordPressSite [*en-GB]
398
-
399
- [cli] ✅ Current project is set to testProject
400
-
401
- testProject t.durden@example-dev>
402
- ```
403
-
404
- ## Content Models
405
-
406
- Manage your content models like you are the chosen one
407
-
408
- ### List content models
409
-
410
- ```shell
411
- contensis t.durden@example-dev> list models
412
- [cli] ✅ [website] Content models [ 19 ]
413
-
414
- - accessibleVideo { required by: 3 }
415
- - blogListing { components: 1, contentTypes: 2, references: 33, required by: 4 }
416
- - blogPost { components: 2, contentTypes: 6, references: 33, required by: 9 }
417
- - callToAction { contentTypes: 9, references: 33, required by: 5 }
418
- - category { required by: 1 }
419
- - contentPage { components: 5, contentTypes: 6, references: 33, required by: 7 }
420
- - externalLink { required by: 2 }
421
- - growingConditions { components: 1, references: 1, required by: 1 }
422
- - homepage { components: 4, contentTypes: 8, references: 33, required by: 3 }
423
- - landingPage { components: 9, contentTypes: 12, references: 33, required by: 7 }
424
- - person { required by: 2 }
425
- - plant { components: 2, contentTypes: 3, references: 8, required by: 10 }
426
- - plantType { required by: 2 }
427
- - pot { components: 2, contentTypes: 1, references: 3, required by: 11 }
428
- - productListing { components: 1, references: 1, required by: 4 }
429
- - review { contentTypes: 3, references: 10, required by: 1 }
430
- - siteSettings
431
- - tag { required by: 5 }
432
-
433
- contensis t.durden@example-dev>
434
- ```
435
-
436
- ### Examine a content model
437
-
438
- A `model` is a complete view of a content type that includes all of its dependents - and the dependents of those dependents
439
-
440
- - `contentTypes` are the content types that have content linked to the model directly from this content type
441
- - `components` are the content types that have content linked to the model directly from this content type
442
- - `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]
443
- - `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
444
-
445
- ```shell
446
- contensis t.durden@example-dev> get model plant
447
- [cli] ✅ Content models in contensis:
448
-
449
- id: plant
450
- dataFormat: model
451
- name:
452
- en-GB: Plant
453
- description:
454
- en-GB: Use this content type to store information about individual plants.
455
- contentTypes:
456
- growingConditions
457
- plantType
458
- tag
459
- components:
460
- externalPromotion
461
- plantVariant
462
- dependencyOf:
463
- callToAction
464
- homepage
465
- landingPage
466
- review
467
- button
468
- cardRow
469
- curatedProductSlider
470
- featuredBlogPosts
471
- featuredProduct
472
- promotedProduct
473
- dependencies:
474
- growingConditions
475
- [plant]
476
- plantType
477
- [plant]
478
- pot
479
- [plantVariant]
480
- tag
481
- [plant, pot]
482
- externalPromotion
483
- [plant, pot]
484
- icon
485
- [growingConditions]
486
- plantVariant
487
- [plant]
488
- potVariant
489
- [pot]
490
-
491
-
492
- contensis t.durden@example-dev>
493
- ```
494
-
495
- ### List content types, components
496
-
497
- ```shell
498
- contensis t.durden@example-dev> list contenttypes
499
- [cli] ✅ Content types in "website":
500
- - accessibleVideo [4 fields]
501
- - blogListing [4 fields]
502
- - blogPost [12 fields]
503
- - callToAction [5 fields]
504
- - category [2 fields]
505
- - contentPage [11 fields]
506
- - event [5 fields]
507
- - externalLink [2 fields]
508
- - growingConditions [3 fields]
509
- - homepage [8 fields]
510
- - landingPage [13 fields]
511
- - person [2 fields]
512
- - plant [13 fields]
513
- - plantType [3 fields]
514
- - pot [10 fields]
515
- - productListing [2 fields]
516
- - review [5 fields]
517
- - tag [1 field]
518
- ```
519
-
520
- ### Examine a content type or component
521
-
522
- ```shell
523
- contensis t.durden@example-dev> get contenttype pot
524
- [cli] ✅ [website] Content type "pot"
525
- uuid: 929a99d2-fe5c-4781-84fa-f5a3738aa96d
526
- id: pot
527
- projectId: website
528
- name:
529
- en-GB: Pot
530
- description:
531
- entryTitleField: productName
532
- entryDescriptionField: description
533
- fields:
534
- productName**: string
535
- description: string
536
- externalPromotion: object<component.externalpromotion>
537
- colour: string
538
- material: string
539
- potVariant: objectArray<component.potvariant>
540
- primaryImage: object<image>
541
- photos: objectArray<image>
542
- externalCardImage: object<image>
543
- tags: objectArray<entry, tag>
544
- defaultLanguage: en-GB
545
- supportedLanguages:
546
- en-GB
547
- workflowId: contensisEntryBasic
548
- dataFormat: entry
549
- groups:
550
- main
551
- photos
552
- tags
553
- includeInDelivery: true
554
-
555
- contensis t.durden@example-dev>
556
- ```
557
-
558
- ## Entries
559
-
560
- ### Get entries
561
-
562
- Use the `get entries` command
563
-
564
- The simplest usage is `get entries {keyword}` or `get entries "{search phrase}"`
565
-
566
- ```shell
567
- website t.durden@example-dev> get entries "good plants"
568
- -------------------------------------
569
- [24/07 01:48:58] [INFO] Fetching initial entries in project 'website'
570
- Fetch [website] >> 100% 8 0.0s/0.0s Infinityp/s
571
-
572
- Found 8 entries in [website]
573
- --------------------------------------------
574
-
575
- id contentTypeId entryTitle entryDescription
576
- ----------------------------------------------------------------------------------------------------------------------
577
- b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
578
- 63b19aac-e5b5-44e5-a6bb-f49e466f2afb blogPost The best plants for looking af Did you know that houseplants
579
- 89bcc566-e9c8-427b-aa56-226c826353f3 blogPost Why plants are good for your m There’s plenty of research to
580
- 3fe3cebe-8c09-429e-a1af-b636ffc008a4 review Great plant – not so great del null
581
- a116716b-7249-4d00-8c93-e57861d984a6 blogPost The best houseplants for your Houseplants are growing in pop
582
- f2c98349-28e4-42f3-8677-e6b5c04948c5 landingPage Register for our new subscript Leif Club, our new subscriptio
583
- d931f2d3-d852-49d6-9137-a7d12ae672a6 blogPost How to look after your plants It doesn’t matter if you’ve be
584
- 0e79c27b-d1bf-4545-a40d-daa17d8726a4 homepage Find the perfect plant null
585
- ----------------------------------------------------------------------------------------------------------------------
586
-
587
- website t.durden@example-dev>
588
- ```
589
-
590
- ### Get an entry by id
591
-
592
- ```shell
593
- website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
594
- -------------------------------------
595
- [24/07 01:54:01] [INFO] Fetching initial entries in project 'website'
596
- Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
597
-
598
- Found 1 entries in [website]
599
- --------------------------------------------
600
-
601
- id contentTypeId entryTitle entryDescription
602
- -------------------------------------------------------------------------------------------------
603
- 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
604
- -------------------------------------------------------------------------------------------------
605
-
606
- website t.durden@example-dev>
607
- ```
608
-
609
- ### Get an entry with all of its dependents
610
-
611
- 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.
612
-
613
- ```shell
614
- website t.durden@example-dev> get entries --dependents --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
615
- -------------------------------------
616
- [24/07 01:55:43] [INFO] Fetching initial entries in project 'website'
617
- Fetch [website] >> 100% 1 0.0s/0.0s Infinityp/s
618
- Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
619
- Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
620
-
621
- Found 12 entries in [website]
622
- --------------------------------------------
623
-
624
- id contentTypeId entryTitle entryDescription
625
- ------------------------------------------------------------------------------------------------------------
626
- 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have
627
- 51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
628
- c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
629
- ccbc4dd0-7bd6-4295-ab8e-da9f529fe5e0 image succulents-collection null
630
- f2022069-7a92-491d-b197-a3564ab9a8ca pot Grå small grey pot Grå is a small grey concr
631
- 452a4ee5-611b-4382-b7c7-06d810b5e698 pot Vit mid-sized white pot Vit is a mid-sized white
632
- 70149568-9725-4c39-8ff5-ef69221a0899 plantType Succulents Succulent plants store wa
633
- 711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions Partial shade This plant likes bright i
634
- d815819d-61c6-4037-95d3-c503acf52153 growingConditions Prefers dry conditions This plant prefers dry co
635
- 3659a333-8d10-4325-9ea6-2f49ae47e7fe tag Promoted null
636
- 2a62ab2a-6a79-4917-b611-c69f0640760d image gra-pot null
637
- 43fdab9f-e687-4d1f-a283-3fa25af437fc image vit-pot null
638
- ------------------------------------------------------------------------------------------------------------
639
-
640
- website t.durden@example-dev>
641
- ```
642
-
643
- ### Get entries with a ZenQL statement
644
-
645
- 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.
646
-
647
- ```shell
648
- website t.durden@example-dev> get entries --zenql "sys.contentTypeId = plant"
649
- -------------------------------------
650
- [24/07 01:52:37] [INFO] Fetching initial entries in project 'website'
651
- Fetch [website] >> 100% 21 0.0s/0.0s Infinityp/s
652
-
653
- Found 21 entries in [website]
654
- --------------------------------------------
655
-
656
- id contentTypeId entryTitle entryDescription
657
- --------------------------------------------------------------------------------------------------------------
658
- 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
659
- 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-care for palm that
660
- 43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up your bath time wit
661
- f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautiful foliage plant h
662
- d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-care for palm that
663
- b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
664
- 6dc1cb96-cee3-4fef-acde-54fb395bcf4b plant Chinese money plant The Chinese money plant’s mini
665
- 8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great option for beginner pl
666
- 329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear plants are a grea
667
- 504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Central America and
668
- a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily identified by its brigh
669
- 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of Central America i
670
- ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic choice for adding a
671
- 6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut flowers when you c
672
- 50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its name, this popular
673
- 4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy with help from a s
674
- 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging plant that requires
675
- 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-back central Americ
676
- 8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants are a great choic
677
- b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut flowers when you c
678
- 0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut flowers when you c
679
- --------------------------------------------------------------------------------------------------------------
680
-
681
- website t.durden@example-dev>
682
- ```
683
-
684
- ### Choose entry fields to output
685
-
686
- 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
687
-
688
- ```shell
689
- website t.durden@example-dev> get entries --fields productName colour material externalPromotion --zenql "sys.contentTypeId = pot"
690
- -------------------------------------
691
- [24/07 02:05:42] [INFO] Fetching initial entries in project 'website'
692
- Fetch [website] >> 100% 12 0.0s/0.0s Infinityp/s
693
-
694
- Found 12 entries in [website]
695
- --------------------------------------------
696
-
697
- productName colour material externalPromotion
698
- ----------------------------------------------------------------------------------------------------------------
699
- Barro decorated terracotta pot Brown Clay {externalTitle:Buy a Barro decorated terracott
700
- Bianco white pot White Porcelain {externalTitle:Buy a Bianco small white pot fr
701
- Canasta mid-sized pot Cream Clay {externalTitle:Buy a Canasta mid-sized clay po
702
- Geo mid-sized pot Grey Concrete {externalTitle:Buy a Geo mid-sized concrete po
703
- Grå small grey pot Grey Concrete {externalTitle:Buy a Grå small grey pot from L
704
- Luna round pot White Ceramic {externalTitle:Buy a Luna round pot from Leif,
705
- Marmo terrazzo-style pot White Concrete {externalTitle:Buy a Marmo terrazzo-style pot
706
- Milano dipped pot Multicoloured Ceramic {externalTitle:Buy a Milano dipped pot from Le
707
- Roja red pot Red Fibrestone {externalTitle:Buy a medium or large Rosa red
708
- Rosa pot Pink Clay {externalTitle:Buy a Rosa coral pink pot from
709
- Terra large terracotta pot Brown Clay {externalTitle:Buy a Terra large terracotta po
710
- Vit mid-sized white pot White Ceramic {externalTitle:Buy a Vit mid-sized white pot f
711
- ----------------------------------------------------------------------------------------------------------------
712
-
713
- website t.durden@example-dev>
714
- ```
715
-
716
- ### Output results to a file
717
-
718
- Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
719
-
720
- ```shell
721
- website t.durden@example-dev> get entries --zenql "sys.contentTypeId = pot" --output products-pot.json
722
- -------------------------------------
723
- [24/07 02:12:27] [INFO] Fetching initial entries in project 'website'
724
- Fetch [website] >> 100% 12 0.0s/0.0s 100000p/s
725
- [cli] ✅ Output file: C:\dev\contensis-cli\products-pot.json
726
- website t.durden@example-dev>
727
- ```
728
-
729
- Combine other options and mobilise your data to consume elsewhere
730
-
731
- ```shell
732
- get entries -d -o aloe-complete-entry.json -id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
733
- -------------------------------------
734
- [24/07 02:16:04] [INFO] Fetching initial entries in project 'website'
735
- Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
736
- Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
737
- Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
738
- [cli] ✅ Output file: C:\dev\contensis-cli\aloe-complete-entry.json
739
- website t.durden@example-dev>
740
- ```
741
-
742
- ## Format output
743
-
744
- Override the output format with the `--format` or `-f` option.
745
-
746
- Available options are: `json`, `xml` or `csv`
747
-
748
- The `--format` and `--output` options are available with most commands (check command `--help`)
749
-
750
- Output will normally default to JSON when saved with the `--output` flag.
751
-
752
- ## Manage API keys
753
-
754
- You can use the cli or shell to manage API keys that are used to provide access to external application integrations
755
-
756
- ### List keys
757
-
758
- ```shell
759
- website t.durden@example-dev> list keys
760
- [cli] ✅ [example-dev] API keys:
761
- - Slack webhooks [2021-09-22 zengenti]
762
- 144ea36d-3cb1-406e-b6d1-931162780d0b
763
- 6fad017d75ce434eb0b0703bf40d4dac-842394737615483e95a22eee6cdcff1d-a238f992b45640708336781029838ec9
764
- - Contensis blocks [2021-10-26 zengenti]
765
- e4376db2-ed3e-49d3-a799-a6ec733a3611
766
- a8590f6b4630404186b72fea198d3c12-c6f1f565eb86428ea0170e1b4b8a4b7f-de88eb42e46c4d548a8c36f490f34866
767
- - Content migration API [2022-03-01 t.durden]
768
- 5bea0a71-cd21-41a9-84a3-2f64a2c4394a
769
- 22c7808a109749c8b37723a8572e5323-ea79651f111a464d980db162e5254b02-954790ca475a4fa186e91f76ce38b4c6
770
-
771
- website t.durden@example-dev>
772
- ```
773
-
774
- ### Create key
775
-
776
- ```shell
777
- website t.durden@example-dev> create key "Test key" "Key to demonstrate cli"
778
- [cli] ✅ [example-dev] Created API key "Test key"
779
- - Test key (Key to demonstrate cli) [2022-07-27 t.durden]
780
- - id: af645b8b-fa3b-4196-a1b7-ac035f7598a3
781
- - sharedSecret: 1ff8b259423c4be08589a63f180c1bdc-63bd3a4f421c44c2afd0ba61e837d671-6aa9532442f149e6a9a837326a9a98e9
782
-
783
- website t.durden@example-dev>
784
- ```
785
-
786
- Run `list keys` again and you will see your new API key added to the returned list of keys
787
-
788
- ### Remove key
789
-
790
- ```shell
791
- website t.durden@example-dev> remove key af645b8b-fa3b-4196-a1b7-ac035f7598a3
792
- [cli] ✅ [example-dev] Deleted API key "af645b8b-fa3b-4196-a1b7-ac035f7598a3"
793
-
794
- website t.durden@example-dev>
795
- ```
796
-
797
- Run `list keys` again and you will see your new API key has been removed from the list of keys
798
-
799
- ## Manage content Blocks
800
-
801
- You can manage blocks for any Contensis project using the following commands
802
-
803
- ### List blocks
804
-
805
- ```shell
806
- website t.durden@example-dev> list blocks
807
- [cli] ✅ [example-dev] Blocks in project website:
808
- - cli-test-block
809
- [master]: running
810
- - simple-block +9
811
- [feature-test-feature-branch]: running
812
- [master]: running
813
-
814
- website t.durden@example-dev>
815
- ```
816
-
817
- ### Get block
818
-
819
- ```shell
820
- website t.durden@example-dev> get block simple-block master
821
- [cli] ✅ [example-dev:website] Block versions:
822
- v15 simple-block
823
- state: available
824
- released: [03/11/2022 17:06] zengenti
825
- source:
826
- commit: 16b04ecb
827
- message: Update index.html
828
- committed: [03/11/2022 17:03] b.macka@zengenti.com
829
- pushed: [03/11/2022 17:04] Gitlab CI block push
830
- https://gitlab.example-org.com/product-dev/simple-block/-/commit/16b04ecb
831
- staging url: https://staging-example-dev.cloud.contensis.com?block-simple-block-versionstatus=released
832
-
833
- v14 simple-block
834
- state: stopped
835
- released: [03/11/2022 17:01] zengenti
836
- source:
837
- commit: fbad8514
838
- message: Added v16 to demo homepage
839
- committed: [03/11/2022 16:57] b.macka@zengenti.com
840
- pushed: [03/11/2022 16:58] Gitlab CI block push
841
- https://gitlab.example-org.com/product-dev/simple-block/-/commit/fbad8514
842
-
843
- website t.durden@example-dev>
844
- ```
845
-
846
- ### Get block logs
847
-
848
- ```shell
849
- website t.durden@example-dev> get block logs contensis-website master
850
-
851
- [cli] ✅ [example-dev] Blocks in project website:
852
-
853
- - contensis-website master latest [hq]
854
- -------------------------------------
855
- 2022-11-04T14:36:28.137625120Z [launcher] startup file: ./start.website.example-dev.js - exists?: true
856
- 2022-11-04T14:36:28.138080818Z [launcher set default] /usr/src/app/dist/server/start.website.example-dev.js
857
- 2022-11-04T14:36:28.725514880Z
858
- 2022-11-04T14:36:28.725610953Z Serving static assets from: "/dist/static/"
859
- 2022-11-04T14:36:28.732830052Z HTTP server is listening @ port 3001
860
-
861
- website t.durden@example-dev>
862
- ```
863
-
864
- ### Push a block
865
-
866
- > **Note**
867
- > It is far simpler doing this in [GitLab CI](#use-in-gitlab-ci) or [GitHub CI Actions](#use-in-github-ci)
868
-
869
- ```shell
870
- 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
871
- [cli] ✅ [example-dev] Created block "cli-test-block" in project website
872
-
873
- website t.durden@example-dev>
874
- ```
875
-
876
- ### Release a block version
877
-
878
- First get the latest block version number
879
-
880
- ```shell
881
- website t.durden@example-dev>get block contensis-website master latest
882
- [cli] ✅ [example-dev] Block contensis-website in project website:
883
- v78 contensis-website
884
- state: available
885
- released: no
886
- status:
887
- deployment: deployed
888
- workflow: draft
889
- running status: available
890
- datacentres:
891
- hq: available
892
- london: available
893
- manchester: faulted
894
- source:
895
- commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
896
- message: build: syntax [nobuild]
897
- committed: [22/11/2022 06:50] t.durden@zengenti.com
898
- pushed: [22/11/2022 06:52] Gitlab CI block push
899
- https://github.com/contensis/contensis-website/commit/b946c1029c1b35aefee2e1a6b5780ddaf205ee74
900
- image:
901
- uri: ghcr.io/contensis/contensis-website/main/app
902
- tag: latest
903
- staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=draft
904
-
905
- website t.durden@example-dev>
906
- ```
907
-
908
- Add the block version number to the `release block` command
909
-
910
- ```shell
911
-
912
- website t.durden@example-dev> release block contensis-website 78
913
- [cli] ✅ [example-dev] Released block contensis-website in project website
914
- v78 contensis-website
915
- state: available
916
- released: [23/11/2022 01:42] n.flatley
917
- status:
918
- deployment: deployed
919
- workflow: released
920
- running status: available
921
- datacentres:
922
- hq: available
923
- london: available
924
- manchester: faulted
925
- source:
926
- commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
927
- message: build: syntax [nobuild]
928
- committed: [22/11/2022 06:50] t.durden@zengenti.com
929
- pushed: [22/11/2022 06:52] Gitlab CI block push
930
- null
931
- image:
932
- uri: ghcr.io/contensis/contensis-website/main/app
933
- tag: latest
934
- staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=released
935
-
936
- website t.durden@example-dev>
937
- ```
938
-
939
- ## Import content models
940
-
941
- Connect to your "source" environment first, ensure you can fetch the models and these models contain the dependencies you plan on importing from here with the `get models` command. Add the `--dependents` option to fetch all of the entries that will eventually be imported.
942
-
943
- When you are happy your models contain the right dependencies for your import, connect to the "target" environment (and project) then use the same arguments as before except with the `import entries` command
944
-
945
- ### Import from another Contensis environment
946
-
947
- Specify a list of models to import
948
-
949
- ```shell
950
- website t.durden@example-dev> import models plant --source-alias example-dev --source-project-id leif
951
-
952
- -------------------------------------
953
- -- IMPORT PREVIEW --
954
-
955
- Content types:
956
- - growingConditions [website: no change] v1.0
957
- required by: [plant]
958
- references: [icon]
959
- - plant [website: update] v2.0
960
- references: [growingConditions, plantGenus, plantType, tag]
961
- 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'}...
962
- - plantGenus [website: create] v0.1
963
- required by: [plant]
964
- - plantType [website: no change] v1.0
965
- required by: [plant]
966
- - pot [website: no change] v2.0
967
- required by: [plantVariant]
968
- references: [externalPromotion, potVariant, tag]
969
- - tag [website: no change] v1.0
970
- required by: [plant, pot]
971
-
972
- Components:
973
- - externalPromotion [website: no change] v1.0
974
- required by: [plant, pot]
975
- - icon [website: no change] v1.0
976
- required by: [growingConditions]
977
- - plantVariant [website: no change] v2.0
978
- required by: [plant]
979
- references: [pot]
980
- - potVariant [website: no change] v1.0
981
- required by: [pot]
982
-
983
- website t.durden@example-dev>
984
- ```
985
-
986
- Or import every model from the source
987
-
988
- ```shell
989
- website t.durden@example-dev> import models --source-alias example-dev --source-project-id leif
990
- -------------------------------------
991
- -- IMPORT PREVIEW --
992
-
993
- Content types:
994
- - accessibleVideo [website: no change] v1.0
995
- required by: [blogPost, contentPage, landingPage]
996
- - alert [website: create] v0.1
997
- - blogListing [website: no change] v2.0
998
- required by: [button, callToAction, homepage, landingPage]
999
- references: [blogPost, callToAction, pageMetadata]
1000
- - blogPost [website: update] v3.0
1001
- required by: [blogListing, blogPost, button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1002
- references: [accessibleVideo, blogPost, callToAction, category, externalPromotion, featuredProduct, person, tag]
1003
- diff: ...
1004
- - callToAction [website: no change] v2.0
1005
- required by: [blogListing, blogPost, contentPage, homepage, landingPage]
1006
- references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1007
- - campus [website: create] v0.1
1008
- - category [website: no change] v1.0
1009
- required by: [blogPost, department, listing]
1010
- - contentPage [website: no change] v2.0
1011
- required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1012
- references: [accessibleVideo, blogPost, callToAction, callout, cardRow, contentPage, featuredProduct, formPicker, landingPage, pageMetadata, tag]
1013
- - department [website: two-pass] v0.1
1014
- references: [category]
1015
- - event [website: create] v0.1
1016
- - externalLink [website: no change] v1.0
1017
- required by: [button, callToAction]
1018
- - form [website: create] v0.1
1019
- - growingConditions [website: no change] v1.0
1020
- required by: [listing, plant]
1021
- references: [icon]
1022
- - homepage [website: update] v2.0
1023
- required by: [button, callToAction, landingPage]
1024
- references: [blogListing, blogPost, callToAction, contentPage, curatedProductSlider, filteredProductSlider, landingPage, pageMetadata, plant, pot, productListing, promotedProduct]
1025
- diff: ...
1026
- - landingPage [website: update] v2.0
1027
- required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1028
- references: [accessibleVideo, blogListing, blogPost, bodyCopy, callToAction, contentBlock, contentPage, curatedProductSlider, featuredBlogPosts, featuredProduct, filteredProductSlider, formPicker, homepage, landingPage, pageMetadata, plant, pot, productListing, promotedProduct, review, tag]
1029
- diff: ...
1030
- - listing [website: two-pass] v0.1
1031
- references: [category, growingConditions, plantType, tag]
1032
- - newsArticle [website: two-pass] v0.1
1033
- references: [person]
1034
- - newsTest [website: two-pass] v0.1
1035
- references: [person]
1036
- - person [website: no change] v1.0
1037
- required by: [blogPost, newsArticle, newsTest, review]
1038
- - plant [website: update] v2.0
1039
- required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, promotedProduct, review]
1040
- references: [externalPromotion, growingConditions, plantGenus, plantType, plantVariant, tag]
1041
- diff: ...
1042
- - plantFamily [website: two-pass] v0.1
1043
- required by: [plantOrder]
1044
- references: [plantGenus]
1045
- - plantGenus [website: create] v0.1
1046
- required by: [plant, plantFamily]
1047
- - plantOrder [website: two-pass] v0.1
1048
- references: [plantFamily]
1049
- - plantType [website: no change] v1.0
1050
- required by: [filteredProductSlider, listing, plant]
1051
- - pot [website: no change] v2.0
1052
- required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, plantVariant, promotedProduct, review]
1053
- references: [externalPromotion, potVariant, tag]
1054
- - productListing [website: no change] v1.0
1055
- required by: [button, callToAction, homepage, landingPage]
1056
- references: [pageMetadata]
1057
- - review [website: no change] v2.0
1058
- required by: [landingPage]
1059
- references: [person, plant, pot]
1060
- - siteSettings [website: no change] v1.0
1061
- - tag [website: no change] v1.0
1062
- required by: [blogPost, contentPage, landingPage, listing, plant, pot]
1063
- - testLang [website: create] v0.1
1064
-
1065
- Components:
1066
- - bodyCopy [website: no change] v1.0
1067
- required by: [landingPage]
1068
- - button [website: no change] v2.0
1069
- required by: [promotedProduct]
1070
- references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1071
- - callout [website: no change] v1.0
1072
- required by: [contentPage, event]
1073
- - cardRow [website: no change] v2.0
1074
- required by: [contentPage]
1075
- references: [blogPost, contentPage, landingPage, plant, pot]
1076
- - contentBlock [website: no change] v1.0
1077
- required by: [landingPage]
1078
- - curatedProductSlider [website: no change] v2.0
1079
- required by: [homepage, landingPage]
1080
- references: [plant, pot]
1081
- - externalPromotion [website: no change] v1.0
1082
- required by: [blogPost, plant, pot]
1083
- - featuredBlogPosts [website: no change] v2.0
1084
- required by: [landingPage]
1085
- references: [blogPost, contentPage, landingPage, plant, pot]
1086
- - featuredProduct [website: no change] v2.0
1087
- required by: [blogPost, contentPage, landingPage]
1088
- references: [plant, pot]
1089
- - filteredProductSlider [website: no change] v2.0
1090
- required by: [homepage, landingPage]
1091
- references: [plantType]
1092
- - formPicker [website: no change] v1.0
1093
- required by: [contentPage, landingPage]
1094
- - icon [website: no change] v1.0
1095
- required by: [growingConditions]
1096
- - pageMetadata [website: no change] v1.0
1097
- required by: [blogListing, contentPage, homepage, landingPage, productListing]
1098
- - plantVariant [website: no change] v2.0
1099
- required by: [plant]
1100
- references: [pot]
1101
- - potVariant [website: no change] v1.0
1102
- required by: [pot]
1103
- - promotedProduct [website: update] v2.0
1104
- required by: [homepage, landingPage]
1105
- references: [button, plant, pot]
1106
- diff: ...
1107
-
1108
- website t.durden@example-dev>
1109
- ```
1110
-
1111
- ### Import from a file
1112
-
1113
- ```shell
1114
- website t.durden@example-dev> import models --from-file ./content-models.json
1115
- ```
1116
-
1117
- The output will be the same as the previous command
1118
-
1119
- <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1120
-
1121
- ## Import entries
1122
-
1123
- The import commands are made possible by using the `migratortron` library. There is further documentation here:
1124
-
1125
- - [`migratortron` on npmjs](https://www.npmjs.com/package/migratortron)
1126
- - [`contensis-importer` on npmjs](https://www.npmjs.com/package/contensis-importer)
1127
-
1128
- ### Import from another Contensis environment
1129
-
1130
- 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.
1131
-
1132
- 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
1133
-
1134
- ```shell
1135
- website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
1136
- -------------------------------------
1137
- -- IMPORT PREVIEW --
1138
- [23/11 02:10:48] [INFO] Fetching initial entries in project 'leif'
1139
- [23/11 02:10:48] [INFO] Finding entries in project 'website'
1140
- [23/11 02:10:49] [INFO] Building asset entries
1141
- [23/11 02:10:49] [INFO] Building content entries
1142
- --------------------------------------------
1143
-
1144
- 1 errors
1145
-
1146
- id error
1147
- -----------------------------------------------------------
1148
- 0 Content type 'plantGenus' does not exist in
1149
- project 'website'
1150
- -----------------------------------------------------------
1151
- [23/11 02:10:49] [OK] Done migrating entries
1152
-
1153
- growingConditions Likes high humidity
1154
- 636b925b-a386-4c56-9f33-96cd99cc391c no change
1155
- growingConditions Needs plenty of light
1156
- 2d80e638-eb0d-4bc5-bc96-42b7b8f20678 no change
1157
- growingConditions Partial shade
1158
- 711251f9-f9c6-473b-8b62-0ec8a0d4978c no change
1159
- growingConditions Prefers dry conditions
1160
- d815819d-61c6-4037-95d3-c503acf52153 no change
1161
-
1162
- plant Aloe vera
1163
- 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 no change
1164
- plant Areca palm
1165
- 0d94dbf2-89f8-45fb-96d5-175ae1f382ce no change
1166
- plant Boston fern
1167
- 43a60005-ea92-4b32-9af3-79560e48ecec no change
1168
- plant Calathea orbifolia
1169
- f0cac96c-39a1-4b85-b14b-e8d7d3d08767 no change
1170
- plant Canary Island Date Palm
1171
- d647012b-897e-4b6b-bfb5-b9844ef3d648 no change
1172
-
1173
- plantGenus Aglaonema
1174
- 98347340-a11c-4ee5-b4e7-1ae3b75496a2 error
1175
- [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1176
-
1177
- plantGenus Alocasia
1178
- fa464489-6476-4694-b3d4-e77d0c00a185 error
1179
- [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1180
-
1181
- plantGenus Aloe
1182
- 309d5fd7-a21f-45a8-8abb-f01f820b8f16 error
1183
- [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1184
-
1185
- plantGenus Beaucarnea
1186
- 4ebdcc63-929f-4b06-8848-fe046468a63d error
1187
- [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1188
-
1189
-
1190
- plantType Ferns
1191
- 90e128f5-582c-4430-a232-72022271ec8b no change
1192
- plantType Foliage
1193
- 25f5a78b-9274-4cc9-9a58-03d8dcd4cd17 no change
1194
- plantType Orchids
1195
- 44abca5b-a49b-48a1-8823-811ab31983c0 no change
1196
- plantType Palm
1197
- d66447c5-2198-4b19-bad3-c921e9ef0db0 no change
1198
- plantType Succulents
1199
- 70149568-9725-4c39-8ff5-ef69221a0899 no change
1200
-
1201
- pot Barro decorated terracotta pot
1202
- fa67e1c6-0637-4548-bd4f-c207ec62af0e no change
1203
- pot Bianco white pot
1204
- e3b7907c-f524-45e4-ba5f-e62d1557b477 no change
1205
- pot Canasta mid-sized pot
1206
- 058b20ba-99f7-49ec-9017-a0df35b00dcc no change
1207
- pot Geo mid-sized pot
1208
- dafc4810-a62e-43e5-a056-ab1248181eaf no change
1209
- pot Grå small grey pot
1210
- f2022069-7a92-491d-b197-a3564ab9a8ca no change
1211
-
1212
- tag Promoted
1213
- 3659a333-8d10-4325-9ea6-2f49ae47e7fe no change
1214
-
1215
- website t.durden@example-dev>
1216
- ```
1217
-
1218
- ### Import from a file
1219
-
1220
- ```shell
1221
- website t.durden@example-dev> import entries --preserve-guids --from-file ./content-entries.json
1222
- ```
1223
-
1224
- The output will be the same as the previous command
1225
-
1226
- <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1
+ # Contensis CLI
2
+
3
+ Use Contensis from your favourite terminal
4
+
5
+ Install the package via `npm` as a global module (requires NodeJS)
6
+
7
+ ```shell
8
+ npm i contensis-cli@preprelease --global
9
+ ```
10
+
11
+ Alternatively, download the executable for your operating system from the [Releases page](https://github.com/contensis/node-cli/releases)
12
+
13
+ ## Skip to section
14
+
15
+ - [Contensis Shell](#contensis-shell)
16
+ - [Use in Terminal](#cli-usage)
17
+ - [Pass connection details anywhere](#pass-connection-details-anywhere)
18
+ - [Use in Docker](#use-in-docker)
19
+ - [Run cli commands](#run-cli-commands)
20
+ - [Persist connections to a local file](#persist-connections-to-a-local-file)
21
+ - [Use in GitLab CI](#use-in-gitlab-ci)
22
+ - [Use in GitHub CI](#use-in-github-ci)
23
+ - [Running headless?](#running-headless-)
24
+
25
+ ## Use in Terminal
26
+
27
+ Try
28
+
29
+ ```shell
30
+ contensis connect example-dev
31
+ ```
32
+
33
+ or
34
+
35
+ ```shell
36
+ contensis help
37
+ ```
38
+
39
+ 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.
40
+
41
+ ### Pass connection details anywhere
42
+
43
+ If you need to, you can supply all the necessary options to connect to a Contensis project and perform an operation in a single command
44
+
45
+ You can supply the following options with any command - although they don't appear in help text:
46
+
47
+ ```
48
+ -a --alias
49
+ -p --project-id
50
+ -u --user
51
+ -pw --password
52
+ -id --client-id
53
+ -s --shared-secret
54
+ ```
55
+
56
+ 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
57
+
58
+ ## Use in Docker
59
+
60
+ Running the container with the `-it` docker options will launch a shell session
61
+
62
+ ```bash
63
+ docker pull ghcr.io/contensis/node-cli/main/app:latest
64
+ docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
65
+ ```
66
+
67
+ ### Run cli commands
68
+
69
+ Add the cli command and any options after the container image in the `docker run` command e.g.
70
+
71
+ ```bash
72
+ docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
73
+ ```
74
+
75
+ ### Persist connections to a local file
76
+
77
+ To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
78
+
79
+ <aside>
80
+ ⚠️ 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.
81
+
82
+ </aside>
83
+
84
+ Linux
85
+
86
+ ```bash
87
+ touch environments.json
88
+ docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
89
+ ```
90
+
91
+ Windows
92
+
93
+ ```powershell
94
+ echo {} > environments.json
95
+ docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
96
+ ```
97
+
98
+ ## Use in GitLab CI
99
+
100
+ ```yaml
101
+ push-to-contensis-block:
102
+ stage: push-to-contensis
103
+ only:
104
+ - master
105
+ image: ghcr.io/contensis/node-cli/main/app:release
106
+ script:
107
+ # Create CI/CD Variables in repo settings called CONTENSIS_CLIENT_ID and CONTENSIS_SHARED_SECRET
108
+ - contensis connect example-dev --project-id website --client-id $CONTENSIS_CLIENT_ID --shared-secret $CONTENSIS_SHARED_SECRET
109
+ - contensis push block example-website-block $APP_IMAGE:latest --release
110
+ ```
111
+
112
+ ## Use in GitHub CI
113
+
114
+ ```yaml
115
+ - name: Push block to Contensis
116
+ uses: contensis/cli-action@v1
117
+ with:
118
+ block-id: example-website-block
119
+ # auto-release: true # release the block straight away
120
+ alias: example-dev
121
+ project-id: website
122
+ client-id: ${{ secrets.CONTENSIS_CLIENT_ID }} # create secrets for actions
123
+ shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }} # in repo settings
124
+ tag-repo: true # tag commit with block version
125
+ git-token: ${{ github.token }} # to allow the git tag
126
+ ```
127
+
128
+ ## Running headless?
129
+
130
+ Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
131
+
132
+ 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.
133
+
134
+ ```shell
135
+ [WARN] Could not connect to local keystore - your password could be stored unencrypted!
136
+ ```
137
+
138
+ > **Note**
139
+ > 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
140
+
141
+ ~~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`~~
142
+
143
+ ```shell
144
+ sudo apt-get update && sudo apt-get install -y libsecret-1-0 dbus-x11 gnome-keyring
145
+ export $(dbus-launch)
146
+ dbus-launch
147
+ gnome-keyring-daemon --start --daemonize --components=secrets
148
+ echo 'neil' | gnome-keyring-daemon -r -d --unlock
149
+ ```
150
+
151
+ ~~Also, if you are running within a docker container, it requires `--cap-add=IPC_LOCK` option when running the container. Otherwise gnome-keyring-daemon will fail with: `gnome-keyring-daemon: Operation not permitted`~~
152
+
153
+ ~~An executable script is available to test: `contensis-cli-headless` you will need sudo access to install additional libraries with `apt-get`~~
154
+
155
+ # Contensis Shell
156
+
157
+ The shell is the preferred way to use the cli, if the package is installed to your global `node_modules` you can start it by opening your terminal and typing `contensis`.
158
+
159
+ ```
160
+ ~$ contensis
161
+
162
+
163
+ _|_|_| _| _|
164
+ _| _|_| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_| _|_|_|
165
+ _| _| _| _| _| _| _|_|_|_| _| _| _|_| _| _|_|
166
+ _| _| _| _| _| _| _| _| _| _|_| _| _|_|
167
+ _|_|_| _|_| _| _| _|_| _|_|_| _| _| _|_|_| _| _|_|_|
168
+
169
+
170
+ © 2001-2022 Zengenti 🇬🇧.
171
+ - Creators of Contensis and purveyors of other fine software
172
+
173
+ 👋 Welcome to the contensis-cli
174
+
175
+ Press [CTRL]+[C] or type "quit" to return to your system shell
176
+ Press [TAB] for suggestions
177
+
178
+ -------------------------------------
179
+ contensis >
180
+ ```
181
+
182
+ ## Skip to section
183
+
184
+ - [Get started](#get-started)
185
+ - [Connect to a Contensis Cloud environment](#connect-to-a-contensis-cloud-environment)
186
+ - [Login to a connected Contensis environment](#login-to-a-connected-contensis-environment)
187
+ - [Manage Projects](#manage-projects)
188
+ - [List projects](#list-projects)
189
+ - [Set current project](#set-current-project)
190
+ - [Get project metadata](#get-project-metadata)
191
+ - [Set project metadata](#set-project-metadata)
192
+ - [Create a new project](#create-a-new-project)
193
+ - [Content Models](#content-models)
194
+ - [List content models](#list-content-models)
195
+ - [Examine a content model](#examine-a-content-model)
196
+ - [List content types, components](#list-content-types--components)
197
+ - [Examine a content type or component](#examine-a-content-type-or-component)
198
+ - [Entries](#entries)
199
+ - [Get entries](#get-entries)
200
+ - [Get an entry by id](#get-an-entry-by-id)
201
+ - [Get an entry with all of its dependents](#get-an-entry-with-all-of-its-dependents)
202
+ - [Get entries with a ZenQL statement](#get-entries-with-a-zenql-statement)
203
+ - [Choose entry fields to output](#choose-entry-fields-to-output)
204
+ - [Output results to a file](#output-results-to-a-file)
205
+ - [Format output](#format-output)
206
+ - [Manage API keys](#manage-api-keys)
207
+ - [List keys](#list-keys)
208
+ - [Create key](#create-key)
209
+ - [Remove key](#remove-key)
210
+ - [Manage content Blocks](#manage-content-blocks)
211
+ - [List blocks](#list-blocks)
212
+ - [Get block](#get-block)
213
+ - [Get block logs](#get-block-logs)
214
+ - [Push a block](#push-a-block)
215
+ - [Release a block version](#release-a-block-version)
216
+ - [Import content models](#import-content-models)
217
+ - [Import from another Contensis environment](#import-from-another-contensis-environment)
218
+ - [From a file](#from-a-file)
219
+ - [Import entries](#import-entries)
220
+ - [Import from another Contensis environment](#import-from-another-contensis-environment-1)
221
+ - [Import from a file](#import-from-a-file)
222
+
223
+ ## Get started
224
+
225
+ Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
226
+
227
+ ```shell
228
+ >> Available commands:
229
+ connect list envs quit
230
+ ```
231
+
232
+ Add `--help` to any command to show the available options and arguments e.g.
233
+
234
+ ```shell
235
+ contensis > connect --help
236
+ Usage: contensis connect <alias>
237
+
238
+ Arguments:
239
+ alias the Contensis Cloud alias to connect with
240
+
241
+ Options:
242
+ -h, --help display help for command
243
+
244
+ Example call:
245
+ > connect example-dev
246
+ ```
247
+
248
+ Just type `help` to show the cli command help
249
+
250
+ ## Connect to a Contensis Cloud environment
251
+
252
+ Use the connect command followed by the cloud alias of your environment
253
+
254
+ ```shell
255
+ contensis > connect example-dev
256
+ [cli] ✅ Current environment set to "example-dev"
257
+ [cli] ⚠️ Cannot retrieve projects list
258
+ [cli] ⏩ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
259
+
260
+ -------------------------------------
261
+ contensis example-dev>
262
+ ```
263
+
264
+ After connecting you will notice the shell prompt will now contain the current "connected" environment e.g. `contensis example-dev> `
265
+
266
+ Contensis must be online and available in order to connect to it
267
+
268
+ ```shell
269
+ contensis > connect exemple-dev
270
+ [cli] ❌ Cannot reach https://cms-exemple-dev.cloud.contensis.com
271
+ ```
272
+
273
+ ## Login to a connected Contensis environment
274
+
275
+ If you wish to use your normal username and password you will issue the command `login {username}`
276
+
277
+ ```shell
278
+ contensis example-dev> login t.durden
279
+ ? Enter password for t.durden@example-dev: ********
280
+ [cli] ✅ User t.durden connected to example-dev successfully
281
+
282
+ [cli] ℹ Saved credentials for contensis-cli_example-dev
283
+
284
+ -------------------------------------
285
+ contensis t.durden@example-dev>
286
+ ```
287
+
288
+ 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}`.
289
+
290
+ If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
291
+
292
+ ## Manage Projects
293
+
294
+ ### List projects
295
+
296
+ Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
297
+
298
+ ```shell
299
+ contensis t.durden@example-dev> list projects
300
+ [cli] ✅ Available projects:
301
+ - [en-GB] intranet
302
+ - [en-GB] marketingSite
303
+ - [en-GB] microsite
304
+ - * [en-GB] website
305
+ ```
306
+
307
+ Or if you are not logged in you should be given useful tips
308
+
309
+ ```shell
310
+ contensis example-dev> list projects
311
+ [cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
312
+ ```
313
+
314
+ ### Set current project
315
+
316
+ Set your current working project with the `set project {projectId}` command
317
+
318
+ ```shell
319
+ contensis t.durden@example-dev> set project intranet
320
+ [cli] ✅ Current project is "intranet"
321
+ -------------------------------------
322
+ intranet t.durden@example-dev> list projects
323
+ [cli] ✅ Available projects:
324
+ - * [en-GB] intranet
325
+ - [en-GB] marketingSite
326
+ - [en-GB] microsite
327
+ - [en-GB] website
328
+
329
+ intranet t.durden@example-dev>
330
+ ```
331
+
332
+ You will notice the `contensis` prompt has been updated to show your current connected project
333
+
334
+ ### Get project metadata
335
+
336
+ ```shell
337
+ contensis t.durden@example-dev> get project
338
+
339
+ id: contensis
340
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
341
+ name: Contensis
342
+ description:
343
+ primaryLanguage: en-GB
344
+ supportedLanguages:
345
+ en-GB
346
+ color: cobalt
347
+
348
+ contensis t.durden@example-dev>
349
+ ```
350
+
351
+ ### Set project metadata
352
+
353
+ Update a project name
354
+
355
+ ```shell
356
+ contensis t.durden@example-dev> set project name "Contensis website"
357
+ [cli] ✅ [example-dev] Updated project contensis
358
+ id: contensis
359
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
360
+ name: Contensis website
361
+ description:
362
+ primaryLanguage: en-GB
363
+ supportedLanguages:
364
+ en-GB
365
+ color: cobalt
366
+
367
+ contensis t.durden@example-dev>
368
+ ```
369
+
370
+ Update a project's description
371
+
372
+ ```shell
373
+ contensis t.durden@example-dev> set project description "Main product site"
374
+ [cli] ✅ [example-dev] Updated project contensis
375
+ id: contensis
376
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
377
+ name: Contensis website
378
+ description: Main product site
379
+ primaryLanguage: en-GB
380
+ supportedLanguages:
381
+ en-GB
382
+ color: cobalt
383
+
384
+ contensis t.durden@example-dev>
385
+ ```
386
+
387
+ ### Create a new project
388
+
389
+ ```shell
390
+ website t.durden@example-dev> create project testProject "Test project" --supported-languages cy
391
+ [cli] ✅ [example-dev] Created project testProject
392
+
393
+ [cli] ✅ Available projects:
394
+
395
+ >> testProject [cy *en-GB]
396
+ website [*en-GB]
397
+ wordPressSite [*en-GB]
398
+
399
+ [cli] ✅ Current project is set to testProject
400
+
401
+ testProject t.durden@example-dev>
402
+ ```
403
+
404
+ ## Content Models
405
+
406
+ Manage your content models like you are the chosen one
407
+
408
+ ### List content models
409
+
410
+ ```shell
411
+ contensis t.durden@example-dev> list models
412
+ [cli] ✅ [website] Content models [ 19 ]
413
+
414
+ - accessibleVideo { required by: 3 }
415
+ - blogListing { components: 1, contentTypes: 2, references: 33, required by: 4 }
416
+ - blogPost { components: 2, contentTypes: 6, references: 33, required by: 9 }
417
+ - callToAction { contentTypes: 9, references: 33, required by: 5 }
418
+ - category { required by: 1 }
419
+ - contentPage { components: 5, contentTypes: 6, references: 33, required by: 7 }
420
+ - externalLink { required by: 2 }
421
+ - growingConditions { components: 1, references: 1, required by: 1 }
422
+ - homepage { components: 4, contentTypes: 8, references: 33, required by: 3 }
423
+ - landingPage { components: 9, contentTypes: 12, references: 33, required by: 7 }
424
+ - person { required by: 2 }
425
+ - plant { components: 2, contentTypes: 3, references: 8, required by: 10 }
426
+ - plantType { required by: 2 }
427
+ - pot { components: 2, contentTypes: 1, references: 3, required by: 11 }
428
+ - productListing { components: 1, references: 1, required by: 4 }
429
+ - review { contentTypes: 3, references: 10, required by: 1 }
430
+ - siteSettings
431
+ - tag { required by: 5 }
432
+
433
+ contensis t.durden@example-dev>
434
+ ```
435
+
436
+ ### Examine a content model
437
+
438
+ A `model` is a complete view of a content type that includes all of its dependents - and the dependents of those dependents
439
+
440
+ - `contentTypes` are the content types that have content linked to the model directly from this content type
441
+ - `components` are the content types that have content linked to the model directly from this content type
442
+ - `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]
443
+ - `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
444
+
445
+ ```shell
446
+ contensis t.durden@example-dev> get model plant
447
+ [cli] ✅ Content models in contensis:
448
+
449
+ id: plant
450
+ dataFormat: model
451
+ name:
452
+ en-GB: Plant
453
+ description:
454
+ en-GB: Use this content type to store information about individual plants.
455
+ contentTypes:
456
+ growingConditions
457
+ plantType
458
+ tag
459
+ components:
460
+ externalPromotion
461
+ plantVariant
462
+ dependencyOf:
463
+ callToAction
464
+ homepage
465
+ landingPage
466
+ review
467
+ button
468
+ cardRow
469
+ curatedProductSlider
470
+ featuredBlogPosts
471
+ featuredProduct
472
+ promotedProduct
473
+ dependencies:
474
+ growingConditions
475
+ [plant]
476
+ plantType
477
+ [plant]
478
+ pot
479
+ [plantVariant]
480
+ tag
481
+ [plant, pot]
482
+ externalPromotion
483
+ [plant, pot]
484
+ icon
485
+ [growingConditions]
486
+ plantVariant
487
+ [plant]
488
+ potVariant
489
+ [pot]
490
+
491
+
492
+ contensis t.durden@example-dev>
493
+ ```
494
+
495
+ ### List content types, components
496
+
497
+ ```shell
498
+ contensis t.durden@example-dev> list contenttypes
499
+ [cli] ✅ Content types in "website":
500
+ - accessibleVideo [4 fields]
501
+ - blogListing [4 fields]
502
+ - blogPost [12 fields]
503
+ - callToAction [5 fields]
504
+ - category [2 fields]
505
+ - contentPage [11 fields]
506
+ - event [5 fields]
507
+ - externalLink [2 fields]
508
+ - growingConditions [3 fields]
509
+ - homepage [8 fields]
510
+ - landingPage [13 fields]
511
+ - person [2 fields]
512
+ - plant [13 fields]
513
+ - plantType [3 fields]
514
+ - pot [10 fields]
515
+ - productListing [2 fields]
516
+ - review [5 fields]
517
+ - tag [1 field]
518
+ ```
519
+
520
+ ### Examine a content type or component
521
+
522
+ ```shell
523
+ contensis t.durden@example-dev> get contenttype pot
524
+ [cli] ✅ [website] Content type "pot"
525
+ uuid: 929a99d2-fe5c-4781-84fa-f5a3738aa96d
526
+ id: pot
527
+ projectId: website
528
+ name:
529
+ en-GB: Pot
530
+ description:
531
+ entryTitleField: productName
532
+ entryDescriptionField: description
533
+ fields:
534
+ productName**: string
535
+ description: string
536
+ externalPromotion: object<component.externalpromotion>
537
+ colour: string
538
+ material: string
539
+ potVariant: objectArray<component.potvariant>
540
+ primaryImage: object<image>
541
+ photos: objectArray<image>
542
+ externalCardImage: object<image>
543
+ tags: objectArray<entry, tag>
544
+ defaultLanguage: en-GB
545
+ supportedLanguages:
546
+ en-GB
547
+ workflowId: contensisEntryBasic
548
+ dataFormat: entry
549
+ groups:
550
+ main
551
+ photos
552
+ tags
553
+ includeInDelivery: true
554
+
555
+ contensis t.durden@example-dev>
556
+ ```
557
+
558
+ ## Entries
559
+
560
+ ### Get entries
561
+
562
+ Use the `get entries` command
563
+
564
+ The simplest usage is `get entries {keyword}` or `get entries "{search phrase}"`
565
+
566
+ ```shell
567
+ website t.durden@example-dev> get entries "good plants"
568
+ -------------------------------------
569
+ [24/07 01:48:58] [INFO] Fetching initial entries in project 'website'
570
+ Fetch [website] >> 100% 8 0.0s/0.0s Infinityp/s
571
+
572
+ Found 8 entries in [website]
573
+ --------------------------------------------
574
+
575
+ id contentTypeId entryTitle entryDescription
576
+ ----------------------------------------------------------------------------------------------------------------------
577
+ b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
578
+ 63b19aac-e5b5-44e5-a6bb-f49e466f2afb blogPost The best plants for looking af Did you know that houseplants
579
+ 89bcc566-e9c8-427b-aa56-226c826353f3 blogPost Why plants are good for your m There’s plenty of research to
580
+ 3fe3cebe-8c09-429e-a1af-b636ffc008a4 review Great plant – not so great del null
581
+ a116716b-7249-4d00-8c93-e57861d984a6 blogPost The best houseplants for your Houseplants are growing in pop
582
+ f2c98349-28e4-42f3-8677-e6b5c04948c5 landingPage Register for our new subscript Leif Club, our new subscriptio
583
+ d931f2d3-d852-49d6-9137-a7d12ae672a6 blogPost How to look after your plants It doesn’t matter if you’ve be
584
+ 0e79c27b-d1bf-4545-a40d-daa17d8726a4 homepage Find the perfect plant null
585
+ ----------------------------------------------------------------------------------------------------------------------
586
+
587
+ website t.durden@example-dev>
588
+ ```
589
+
590
+ ### Get an entry by id
591
+
592
+ ```shell
593
+ website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
594
+ -------------------------------------
595
+ [24/07 01:54:01] [INFO] Fetching initial entries in project 'website'
596
+ Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
597
+
598
+ Found 1 entries in [website]
599
+ --------------------------------------------
600
+
601
+ id contentTypeId entryTitle entryDescription
602
+ -------------------------------------------------------------------------------------------------
603
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
604
+ -------------------------------------------------------------------------------------------------
605
+
606
+ website t.durden@example-dev>
607
+ ```
608
+
609
+ ### Get an entry with all of its dependents
610
+
611
+ 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.
612
+
613
+ ```shell
614
+ website t.durden@example-dev> get entries --dependents --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
615
+ -------------------------------------
616
+ [24/07 01:55:43] [INFO] Fetching initial entries in project 'website'
617
+ Fetch [website] >> 100% 1 0.0s/0.0s Infinityp/s
618
+ Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
619
+ Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
620
+
621
+ Found 12 entries in [website]
622
+ --------------------------------------------
623
+
624
+ id contentTypeId entryTitle entryDescription
625
+ ------------------------------------------------------------------------------------------------------------
626
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have
627
+ 51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
628
+ c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
629
+ ccbc4dd0-7bd6-4295-ab8e-da9f529fe5e0 image succulents-collection null
630
+ f2022069-7a92-491d-b197-a3564ab9a8ca pot Grå small grey pot Grå is a small grey concr
631
+ 452a4ee5-611b-4382-b7c7-06d810b5e698 pot Vit mid-sized white pot Vit is a mid-sized white
632
+ 70149568-9725-4c39-8ff5-ef69221a0899 plantType Succulents Succulent plants store wa
633
+ 711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions Partial shade This plant likes bright i
634
+ d815819d-61c6-4037-95d3-c503acf52153 growingConditions Prefers dry conditions This plant prefers dry co
635
+ 3659a333-8d10-4325-9ea6-2f49ae47e7fe tag Promoted null
636
+ 2a62ab2a-6a79-4917-b611-c69f0640760d image gra-pot null
637
+ 43fdab9f-e687-4d1f-a283-3fa25af437fc image vit-pot null
638
+ ------------------------------------------------------------------------------------------------------------
639
+
640
+ website t.durden@example-dev>
641
+ ```
642
+
643
+ ### Get entries with a ZenQL statement
644
+
645
+ 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.
646
+
647
+ ```shell
648
+ website t.durden@example-dev> get entries --zenql "sys.contentTypeId = plant"
649
+ -------------------------------------
650
+ [24/07 01:52:37] [INFO] Fetching initial entries in project 'website'
651
+ Fetch [website] >> 100% 21 0.0s/0.0s Infinityp/s
652
+
653
+ Found 21 entries in [website]
654
+ --------------------------------------------
655
+
656
+ id contentTypeId entryTitle entryDescription
657
+ --------------------------------------------------------------------------------------------------------------
658
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
659
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-care for palm that
660
+ 43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up your bath time wit
661
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautiful foliage plant h
662
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-care for palm that
663
+ b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
664
+ 6dc1cb96-cee3-4fef-acde-54fb395bcf4b plant Chinese money plant The Chinese money plant’s mini
665
+ 8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great option for beginner pl
666
+ 329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear plants are a grea
667
+ 504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Central America and
668
+ a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily identified by its brigh
669
+ 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of Central America i
670
+ ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic choice for adding a
671
+ 6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut flowers when you c
672
+ 50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its name, this popular
673
+ 4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy with help from a s
674
+ 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging plant that requires
675
+ 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-back central Americ
676
+ 8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants are a great choic
677
+ b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut flowers when you c
678
+ 0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut flowers when you c
679
+ --------------------------------------------------------------------------------------------------------------
680
+
681
+ website t.durden@example-dev>
682
+ ```
683
+
684
+ ### Choose entry fields to output
685
+
686
+ 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
687
+
688
+ ```shell
689
+ website t.durden@example-dev> get entries --fields productName colour material externalPromotion --zenql "sys.contentTypeId = pot"
690
+ -------------------------------------
691
+ [24/07 02:05:42] [INFO] Fetching initial entries in project 'website'
692
+ Fetch [website] >> 100% 12 0.0s/0.0s Infinityp/s
693
+
694
+ Found 12 entries in [website]
695
+ --------------------------------------------
696
+
697
+ productName colour material externalPromotion
698
+ ----------------------------------------------------------------------------------------------------------------
699
+ Barro decorated terracotta pot Brown Clay {externalTitle:Buy a Barro decorated terracott
700
+ Bianco white pot White Porcelain {externalTitle:Buy a Bianco small white pot fr
701
+ Canasta mid-sized pot Cream Clay {externalTitle:Buy a Canasta mid-sized clay po
702
+ Geo mid-sized pot Grey Concrete {externalTitle:Buy a Geo mid-sized concrete po
703
+ Grå small grey pot Grey Concrete {externalTitle:Buy a Grå small grey pot from L
704
+ Luna round pot White Ceramic {externalTitle:Buy a Luna round pot from Leif,
705
+ Marmo terrazzo-style pot White Concrete {externalTitle:Buy a Marmo terrazzo-style pot
706
+ Milano dipped pot Multicoloured Ceramic {externalTitle:Buy a Milano dipped pot from Le
707
+ Roja red pot Red Fibrestone {externalTitle:Buy a medium or large Rosa red
708
+ Rosa pot Pink Clay {externalTitle:Buy a Rosa coral pink pot from
709
+ Terra large terracotta pot Brown Clay {externalTitle:Buy a Terra large terracotta po
710
+ Vit mid-sized white pot White Ceramic {externalTitle:Buy a Vit mid-sized white pot f
711
+ ----------------------------------------------------------------------------------------------------------------
712
+
713
+ website t.durden@example-dev>
714
+ ```
715
+
716
+ ### Output results to a file
717
+
718
+ Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
719
+
720
+ ```shell
721
+ website t.durden@example-dev> get entries --zenql "sys.contentTypeId = pot" --output products-pot.json
722
+ -------------------------------------
723
+ [24/07 02:12:27] [INFO] Fetching initial entries in project 'website'
724
+ Fetch [website] >> 100% 12 0.0s/0.0s 100000p/s
725
+ [cli] ✅ Output file: C:\dev\contensis-cli\products-pot.json
726
+ website t.durden@example-dev>
727
+ ```
728
+
729
+ Combine other options and mobilise your data to consume elsewhere
730
+
731
+ ```shell
732
+ get entries -d -o aloe-complete-entry.json -id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
733
+ -------------------------------------
734
+ [24/07 02:16:04] [INFO] Fetching initial entries in project 'website'
735
+ Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
736
+ Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
737
+ Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
738
+ [cli] ✅ Output file: C:\dev\contensis-cli\aloe-complete-entry.json
739
+ website t.durden@example-dev>
740
+ ```
741
+
742
+ ## Format output
743
+
744
+ Override the output format with the `--format` or `-f` option.
745
+
746
+ Available options are: `json`, `xml` or `csv`
747
+
748
+ The `--format` and `--output` options are available with most commands (check command `--help`)
749
+
750
+ Output will normally default to JSON when saved with the `--output` flag.
751
+
752
+ ## Manage API keys
753
+
754
+ You can use the cli or shell to manage API keys that are used to provide access to external application integrations
755
+
756
+ ### List keys
757
+
758
+ ```shell
759
+ website t.durden@example-dev> list keys
760
+ [cli] ✅ [example-dev] API keys:
761
+ - Slack webhooks [2021-09-22 zengenti]
762
+ 144ea36d-3cb1-406e-b6d1-931162780d0b
763
+ 6fad017d75ce434eb0b0703bf40d4dac-842394737615483e95a22eee6cdcff1d-a238f992b45640708336781029838ec9
764
+ - Contensis blocks [2021-10-26 zengenti]
765
+ e4376db2-ed3e-49d3-a799-a6ec733a3611
766
+ a8590f6b4630404186b72fea198d3c12-c6f1f565eb86428ea0170e1b4b8a4b7f-de88eb42e46c4d548a8c36f490f34866
767
+ - Content migration API [2022-03-01 t.durden]
768
+ 5bea0a71-cd21-41a9-84a3-2f64a2c4394a
769
+ 22c7808a109749c8b37723a8572e5323-ea79651f111a464d980db162e5254b02-954790ca475a4fa186e91f76ce38b4c6
770
+
771
+ website t.durden@example-dev>
772
+ ```
773
+
774
+ ### Create key
775
+
776
+ ```shell
777
+ website t.durden@example-dev> create key "Test key" "Key to demonstrate cli"
778
+ [cli] ✅ [example-dev] Created API key "Test key"
779
+ - Test key (Key to demonstrate cli) [2022-07-27 t.durden]
780
+ - id: af645b8b-fa3b-4196-a1b7-ac035f7598a3
781
+ - sharedSecret: 1ff8b259423c4be08589a63f180c1bdc-63bd3a4f421c44c2afd0ba61e837d671-6aa9532442f149e6a9a837326a9a98e9
782
+
783
+ website t.durden@example-dev>
784
+ ```
785
+
786
+ Run `list keys` again and you will see your new API key added to the returned list of keys
787
+
788
+ ### Remove key
789
+
790
+ ```shell
791
+ website t.durden@example-dev> remove key af645b8b-fa3b-4196-a1b7-ac035f7598a3
792
+ [cli] ✅ [example-dev] Deleted API key "af645b8b-fa3b-4196-a1b7-ac035f7598a3"
793
+
794
+ website t.durden@example-dev>
795
+ ```
796
+
797
+ Run `list keys` again and you will see your new API key has been removed from the list of keys
798
+
799
+ ## Manage content Blocks
800
+
801
+ You can manage blocks for any Contensis project using the following commands
802
+
803
+ ### List blocks
804
+
805
+ ```shell
806
+ website t.durden@example-dev> list blocks
807
+ [cli] ✅ [example-dev] Blocks in project website:
808
+ - cli-test-block
809
+ [master]: running
810
+ - simple-block +9
811
+ [feature-test-feature-branch]: running
812
+ [master]: running
813
+
814
+ website t.durden@example-dev>
815
+ ```
816
+
817
+ ### Get block
818
+
819
+ ```shell
820
+ website t.durden@example-dev> get block simple-block master
821
+ [cli] ✅ [example-dev:website] Block versions:
822
+ v15 simple-block
823
+ state: available
824
+ released: [03/11/2022 17:06] zengenti
825
+ source:
826
+ commit: 16b04ecb
827
+ message: Update index.html
828
+ committed: [03/11/2022 17:03] b.macka@zengenti.com
829
+ pushed: [03/11/2022 17:04] Gitlab CI block push
830
+ https://gitlab.example-org.com/product-dev/simple-block/-/commit/16b04ecb
831
+ staging url: https://staging-example-dev.cloud.contensis.com?block-simple-block-versionstatus=released
832
+
833
+ v14 simple-block
834
+ state: stopped
835
+ released: [03/11/2022 17:01] zengenti
836
+ source:
837
+ commit: fbad8514
838
+ message: Added v16 to demo homepage
839
+ committed: [03/11/2022 16:57] b.macka@zengenti.com
840
+ pushed: [03/11/2022 16:58] Gitlab CI block push
841
+ https://gitlab.example-org.com/product-dev/simple-block/-/commit/fbad8514
842
+
843
+ website t.durden@example-dev>
844
+ ```
845
+
846
+ ### Get block logs
847
+
848
+ ```shell
849
+ website t.durden@example-dev> get block logs contensis-website master
850
+
851
+ [cli] ✅ [example-dev] Blocks in project website:
852
+
853
+ - contensis-website master latest [hq]
854
+ -------------------------------------
855
+ 2022-11-04T14:36:28.137625120Z [launcher] startup file: ./start.website.example-dev.js - exists?: true
856
+ 2022-11-04T14:36:28.138080818Z [launcher set default] /usr/src/app/dist/server/start.website.example-dev.js
857
+ 2022-11-04T14:36:28.725514880Z
858
+ 2022-11-04T14:36:28.725610953Z Serving static assets from: "/dist/static/"
859
+ 2022-11-04T14:36:28.732830052Z HTTP server is listening @ port 3001
860
+
861
+ website t.durden@example-dev>
862
+ ```
863
+
864
+ ### Push a block
865
+
866
+ > **Note**
867
+ > It is far simpler doing this in [GitLab CI](#use-in-gitlab-ci) or [GitHub CI Actions](#use-in-github-ci)
868
+
869
+ ```shell
870
+ 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
871
+ [cli] ✅ [example-dev] Created block "cli-test-block" in project website
872
+
873
+ website t.durden@example-dev>
874
+ ```
875
+
876
+ ### Release a block version
877
+
878
+ First get the latest block version number
879
+
880
+ ```shell
881
+ website t.durden@example-dev>get block contensis-website master latest
882
+ [cli] ✅ [example-dev] Block contensis-website in project website:
883
+ v78 contensis-website
884
+ state: available
885
+ released: no
886
+ status:
887
+ deployment: deployed
888
+ workflow: draft
889
+ running status: available
890
+ datacentres:
891
+ hq: available
892
+ london: available
893
+ manchester: faulted
894
+ source:
895
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
896
+ message: build: syntax [nobuild]
897
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
898
+ pushed: [22/11/2022 06:52] Gitlab CI block push
899
+ https://github.com/contensis/contensis-website/commit/b946c1029c1b35aefee2e1a6b5780ddaf205ee74
900
+ image:
901
+ uri: ghcr.io/contensis/contensis-website/main/app
902
+ tag: latest
903
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=draft
904
+
905
+ website t.durden@example-dev>
906
+ ```
907
+
908
+ Add the block version number to the `release block` command
909
+
910
+ ```shell
911
+
912
+ website t.durden@example-dev> release block contensis-website 78
913
+ [cli] ✅ [example-dev] Released block contensis-website in project website
914
+ v78 contensis-website
915
+ state: available
916
+ released: [23/11/2022 01:42] n.flatley
917
+ status:
918
+ deployment: deployed
919
+ workflow: released
920
+ running status: available
921
+ datacentres:
922
+ hq: available
923
+ london: available
924
+ manchester: faulted
925
+ source:
926
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
927
+ message: build: syntax [nobuild]
928
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
929
+ pushed: [22/11/2022 06:52] Gitlab CI block push
930
+ null
931
+ image:
932
+ uri: ghcr.io/contensis/contensis-website/main/app
933
+ tag: latest
934
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=released
935
+
936
+ website t.durden@example-dev>
937
+ ```
938
+
939
+ ## Import content models
940
+
941
+ Connect to your "source" environment first, ensure you can fetch the models and these models contain the dependencies you plan on importing from here with the `get models` command. Add the `--dependents` option to fetch all of the entries that will eventually be imported.
942
+
943
+ When you are happy your models contain the right dependencies for your import, connect to the "target" environment (and project) then use the same arguments as before except with the `import entries` command
944
+
945
+ ### Import from another Contensis environment
946
+
947
+ Specify a list of models to import
948
+
949
+ ```shell
950
+ website t.durden@example-dev> import models plant --source-alias example-dev --source-project-id leif
951
+
952
+ -------------------------------------
953
+ -- IMPORT PREVIEW --
954
+
955
+ Content types:
956
+ - growingConditions [website: no change] v1.0
957
+ required by: [plant]
958
+ references: [icon]
959
+ - plant [website: update] v2.0
960
+ references: [growingConditions, plantGenus, plantType, tag]
961
+ 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'}...
962
+ - plantGenus [website: create] v0.1
963
+ required by: [plant]
964
+ - plantType [website: no change] v1.0
965
+ required by: [plant]
966
+ - pot [website: no change] v2.0
967
+ required by: [plantVariant]
968
+ references: [externalPromotion, potVariant, tag]
969
+ - tag [website: no change] v1.0
970
+ required by: [plant, pot]
971
+
972
+ Components:
973
+ - externalPromotion [website: no change] v1.0
974
+ required by: [plant, pot]
975
+ - icon [website: no change] v1.0
976
+ required by: [growingConditions]
977
+ - plantVariant [website: no change] v2.0
978
+ required by: [plant]
979
+ references: [pot]
980
+ - potVariant [website: no change] v1.0
981
+ required by: [pot]
982
+
983
+ website t.durden@example-dev>
984
+ ```
985
+
986
+ Or import every model from the source
987
+
988
+ ```shell
989
+ website t.durden@example-dev> import models --source-alias example-dev --source-project-id leif
990
+ -------------------------------------
991
+ -- IMPORT PREVIEW --
992
+
993
+ Content types:
994
+ - accessibleVideo [website: no change] v1.0
995
+ required by: [blogPost, contentPage, landingPage]
996
+ - alert [website: create] v0.1
997
+ - blogListing [website: no change] v2.0
998
+ required by: [button, callToAction, homepage, landingPage]
999
+ references: [blogPost, callToAction, pageMetadata]
1000
+ - blogPost [website: update] v3.0
1001
+ required by: [blogListing, blogPost, button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1002
+ references: [accessibleVideo, blogPost, callToAction, category, externalPromotion, featuredProduct, person, tag]
1003
+ diff: ...
1004
+ - callToAction [website: no change] v2.0
1005
+ required by: [blogListing, blogPost, contentPage, homepage, landingPage]
1006
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1007
+ - campus [website: create] v0.1
1008
+ - category [website: no change] v1.0
1009
+ required by: [blogPost, department, listing]
1010
+ - contentPage [website: no change] v2.0
1011
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1012
+ references: [accessibleVideo, blogPost, callToAction, callout, cardRow, contentPage, featuredProduct, formPicker, landingPage, pageMetadata, tag]
1013
+ - department [website: two-pass] v0.1
1014
+ references: [category]
1015
+ - event [website: create] v0.1
1016
+ - externalLink [website: no change] v1.0
1017
+ required by: [button, callToAction]
1018
+ - form [website: create] v0.1
1019
+ - growingConditions [website: no change] v1.0
1020
+ required by: [listing, plant]
1021
+ references: [icon]
1022
+ - homepage [website: update] v2.0
1023
+ required by: [button, callToAction, landingPage]
1024
+ references: [blogListing, blogPost, callToAction, contentPage, curatedProductSlider, filteredProductSlider, landingPage, pageMetadata, plant, pot, productListing, promotedProduct]
1025
+ diff: ...
1026
+ - landingPage [website: update] v2.0
1027
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1028
+ references: [accessibleVideo, blogListing, blogPost, bodyCopy, callToAction, contentBlock, contentPage, curatedProductSlider, featuredBlogPosts, featuredProduct, filteredProductSlider, formPicker, homepage, landingPage, pageMetadata, plant, pot, productListing, promotedProduct, review, tag]
1029
+ diff: ...
1030
+ - listing [website: two-pass] v0.1
1031
+ references: [category, growingConditions, plantType, tag]
1032
+ - newsArticle [website: two-pass] v0.1
1033
+ references: [person]
1034
+ - newsTest [website: two-pass] v0.1
1035
+ references: [person]
1036
+ - person [website: no change] v1.0
1037
+ required by: [blogPost, newsArticle, newsTest, review]
1038
+ - plant [website: update] v2.0
1039
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, promotedProduct, review]
1040
+ references: [externalPromotion, growingConditions, plantGenus, plantType, plantVariant, tag]
1041
+ diff: ...
1042
+ - plantFamily [website: two-pass] v0.1
1043
+ required by: [plantOrder]
1044
+ references: [plantGenus]
1045
+ - plantGenus [website: create] v0.1
1046
+ required by: [plant, plantFamily]
1047
+ - plantOrder [website: two-pass] v0.1
1048
+ references: [plantFamily]
1049
+ - plantType [website: no change] v1.0
1050
+ required by: [filteredProductSlider, listing, plant]
1051
+ - pot [website: no change] v2.0
1052
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, plantVariant, promotedProduct, review]
1053
+ references: [externalPromotion, potVariant, tag]
1054
+ - productListing [website: no change] v1.0
1055
+ required by: [button, callToAction, homepage, landingPage]
1056
+ references: [pageMetadata]
1057
+ - review [website: no change] v2.0
1058
+ required by: [landingPage]
1059
+ references: [person, plant, pot]
1060
+ - siteSettings [website: no change] v1.0
1061
+ - tag [website: no change] v1.0
1062
+ required by: [blogPost, contentPage, landingPage, listing, plant, pot]
1063
+ - testLang [website: create] v0.1
1064
+
1065
+ Components:
1066
+ - bodyCopy [website: no change] v1.0
1067
+ required by: [landingPage]
1068
+ - button [website: no change] v2.0
1069
+ required by: [promotedProduct]
1070
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1071
+ - callout [website: no change] v1.0
1072
+ required by: [contentPage, event]
1073
+ - cardRow [website: no change] v2.0
1074
+ required by: [contentPage]
1075
+ references: [blogPost, contentPage, landingPage, plant, pot]
1076
+ - contentBlock [website: no change] v1.0
1077
+ required by: [landingPage]
1078
+ - curatedProductSlider [website: no change] v2.0
1079
+ required by: [homepage, landingPage]
1080
+ references: [plant, pot]
1081
+ - externalPromotion [website: no change] v1.0
1082
+ required by: [blogPost, plant, pot]
1083
+ - featuredBlogPosts [website: no change] v2.0
1084
+ required by: [landingPage]
1085
+ references: [blogPost, contentPage, landingPage, plant, pot]
1086
+ - featuredProduct [website: no change] v2.0
1087
+ required by: [blogPost, contentPage, landingPage]
1088
+ references: [plant, pot]
1089
+ - filteredProductSlider [website: no change] v2.0
1090
+ required by: [homepage, landingPage]
1091
+ references: [plantType]
1092
+ - formPicker [website: no change] v1.0
1093
+ required by: [contentPage, landingPage]
1094
+ - icon [website: no change] v1.0
1095
+ required by: [growingConditions]
1096
+ - pageMetadata [website: no change] v1.0
1097
+ required by: [blogListing, contentPage, homepage, landingPage, productListing]
1098
+ - plantVariant [website: no change] v2.0
1099
+ required by: [plant]
1100
+ references: [pot]
1101
+ - potVariant [website: no change] v1.0
1102
+ required by: [pot]
1103
+ - promotedProduct [website: update] v2.0
1104
+ required by: [homepage, landingPage]
1105
+ references: [button, plant, pot]
1106
+ diff: ...
1107
+
1108
+ website t.durden@example-dev>
1109
+ ```
1110
+
1111
+ ### Import from a file
1112
+
1113
+ ```shell
1114
+ website t.durden@example-dev> import models --from-file ./content-models.json
1115
+ ```
1116
+
1117
+ The output will be the same as the previous command
1118
+
1119
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1120
+
1121
+ ## Import entries
1122
+
1123
+ The import commands are made possible by using the `migratortron` library. There is further documentation here:
1124
+
1125
+ - [`migratortron` on npmjs](https://www.npmjs.com/package/migratortron)
1126
+ - [`contensis-importer` on npmjs](https://www.npmjs.com/package/contensis-importer)
1127
+
1128
+ ### Import from another Contensis environment
1129
+
1130
+ 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.
1131
+
1132
+ 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
1133
+
1134
+ ```shell
1135
+ website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
1136
+ -------------------------------------
1137
+ -- IMPORT PREVIEW --
1138
+ [23/11 02:10:48] [INFO] Fetching initial entries in project 'leif'
1139
+ [23/11 02:10:48] [INFO] Finding entries in project 'website'
1140
+ [23/11 02:10:49] [INFO] Building asset entries
1141
+ [23/11 02:10:49] [INFO] Building content entries
1142
+ --------------------------------------------
1143
+
1144
+ 1 errors
1145
+
1146
+ id error
1147
+ -----------------------------------------------------------
1148
+ 0 Content type 'plantGenus' does not exist in
1149
+ project 'website'
1150
+ -----------------------------------------------------------
1151
+ [23/11 02:10:49] [OK] Done migrating entries
1152
+
1153
+ growingConditions Likes high humidity
1154
+ 636b925b-a386-4c56-9f33-96cd99cc391c no change
1155
+ growingConditions Needs plenty of light
1156
+ 2d80e638-eb0d-4bc5-bc96-42b7b8f20678 no change
1157
+ growingConditions Partial shade
1158
+ 711251f9-f9c6-473b-8b62-0ec8a0d4978c no change
1159
+ growingConditions Prefers dry conditions
1160
+ d815819d-61c6-4037-95d3-c503acf52153 no change
1161
+
1162
+ plant Aloe vera
1163
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 no change
1164
+ plant Areca palm
1165
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce no change
1166
+ plant Boston fern
1167
+ 43a60005-ea92-4b32-9af3-79560e48ecec no change
1168
+ plant Calathea orbifolia
1169
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 no change
1170
+ plant Canary Island Date Palm
1171
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 no change
1172
+
1173
+ plantGenus Aglaonema
1174
+ 98347340-a11c-4ee5-b4e7-1ae3b75496a2 error
1175
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1176
+
1177
+ plantGenus Alocasia
1178
+ fa464489-6476-4694-b3d4-e77d0c00a185 error
1179
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1180
+
1181
+ plantGenus Aloe
1182
+ 309d5fd7-a21f-45a8-8abb-f01f820b8f16 error
1183
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1184
+
1185
+ plantGenus Beaucarnea
1186
+ 4ebdcc63-929f-4b06-8848-fe046468a63d error
1187
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1188
+
1189
+
1190
+ plantType Ferns
1191
+ 90e128f5-582c-4430-a232-72022271ec8b no change
1192
+ plantType Foliage
1193
+ 25f5a78b-9274-4cc9-9a58-03d8dcd4cd17 no change
1194
+ plantType Orchids
1195
+ 44abca5b-a49b-48a1-8823-811ab31983c0 no change
1196
+ plantType Palm
1197
+ d66447c5-2198-4b19-bad3-c921e9ef0db0 no change
1198
+ plantType Succulents
1199
+ 70149568-9725-4c39-8ff5-ef69221a0899 no change
1200
+
1201
+ pot Barro decorated terracotta pot
1202
+ fa67e1c6-0637-4548-bd4f-c207ec62af0e no change
1203
+ pot Bianco white pot
1204
+ e3b7907c-f524-45e4-ba5f-e62d1557b477 no change
1205
+ pot Canasta mid-sized pot
1206
+ 058b20ba-99f7-49ec-9017-a0df35b00dcc no change
1207
+ pot Geo mid-sized pot
1208
+ dafc4810-a62e-43e5-a056-ab1248181eaf no change
1209
+ pot Grå small grey pot
1210
+ f2022069-7a92-491d-b197-a3564ab9a8ca no change
1211
+
1212
+ tag Promoted
1213
+ 3659a333-8d10-4325-9ea6-2f49ae47e7fe no change
1214
+
1215
+ website t.durden@example-dev>
1216
+ ```
1217
+
1218
+ ### Import from a file
1219
+
1220
+ ```shell
1221
+ website t.durden@example-dev> import entries --preserve-guids --from-file ./content-entries.json
1222
+ ```
1223
+
1224
+ The output will be the same as the previous command
1225
+
1226
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>