contensis-cli 1.0.0-beta.6 → 1.0.0-beta.61

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 (71) hide show
  1. package/README.md +760 -75
  2. package/dist/commands/connect.js +3 -3
  3. package/dist/commands/connect.js.map +2 -2
  4. package/dist/commands/create.js +30 -10
  5. package/dist/commands/create.js.map +2 -2
  6. package/dist/commands/diff.js +57 -0
  7. package/dist/commands/diff.js.map +7 -0
  8. package/dist/commands/get.js +61 -12
  9. package/dist/commands/get.js.map +2 -2
  10. package/dist/commands/globalOptions.js +22 -17
  11. package/dist/commands/globalOptions.js.map +2 -2
  12. package/dist/commands/import.js +46 -11
  13. package/dist/commands/import.js.map +2 -2
  14. package/dist/commands/index.js +9 -1
  15. package/dist/commands/index.js.map +2 -2
  16. package/dist/commands/list.js +19 -8
  17. package/dist/commands/list.js.map +2 -2
  18. package/dist/commands/login.js +3 -3
  19. package/dist/commands/login.js.map +2 -2
  20. package/dist/commands/push.js +8 -4
  21. package/dist/commands/push.js.map +2 -2
  22. package/dist/commands/release.js +47 -0
  23. package/dist/commands/release.js.map +7 -0
  24. package/dist/commands/remove.js +40 -8
  25. package/dist/commands/remove.js.map +2 -2
  26. package/dist/commands/set.js +53 -12
  27. package/dist/commands/set.js.map +2 -2
  28. package/dist/localisation/en-GB.js +100 -48
  29. package/dist/localisation/en-GB.js.map +2 -2
  30. package/dist/providers/CredentialProvider.js +36 -7
  31. package/dist/providers/CredentialProvider.js.map +3 -3
  32. package/dist/providers/SessionCacheProvider.js +21 -1
  33. package/dist/providers/SessionCacheProvider.js.map +2 -2
  34. package/dist/providers/file-provider.js +8 -4
  35. package/dist/providers/file-provider.js.map +3 -3
  36. package/dist/services/ContensisCliService.js +640 -375
  37. package/dist/services/ContensisCliService.js.map +3 -3
  38. package/dist/shell.js +27 -10
  39. package/dist/shell.js.map +3 -3
  40. package/dist/util/console.printer.js +171 -55
  41. package/dist/util/console.printer.js.map +2 -2
  42. package/dist/util/index.js +5 -2
  43. package/dist/util/index.js.map +3 -3
  44. package/dist/util/logger.js +47 -16
  45. package/dist/util/logger.js.map +2 -2
  46. package/dist/version.js +1 -1
  47. package/dist/version.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/commands/connect.ts +3 -2
  50. package/src/commands/create.ts +37 -8
  51. package/src/commands/diff.ts +41 -0
  52. package/src/commands/get.ts +80 -5
  53. package/src/commands/globalOptions.ts +18 -17
  54. package/src/commands/import.ts +57 -7
  55. package/src/commands/index.ts +9 -1
  56. package/src/commands/list.ts +35 -9
  57. package/src/commands/login.ts +3 -2
  58. package/src/commands/push.ts +9 -2
  59. package/src/commands/release.ts +32 -0
  60. package/src/commands/remove.ts +50 -4
  61. package/src/commands/set.ts +65 -9
  62. package/src/localisation/en-GB.ts +146 -65
  63. package/src/providers/CredentialProvider.ts +39 -6
  64. package/src/providers/SessionCacheProvider.ts +29 -2
  65. package/src/providers/file-provider.ts +12 -4
  66. package/src/services/ContensisCliService.ts +789 -426
  67. package/src/shell.ts +31 -11
  68. package/src/util/console.printer.ts +240 -78
  69. package/src/util/index.ts +12 -6
  70. package/src/util/logger.ts +87 -18
  71. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -1,20 +1,42 @@
1
1
  # Contensis CLI
2
2
 
3
- Use Contensis from your favourite terminal with NodeJS
3
+ Use Contensis from your favourite terminal
4
4
 
5
- Install the package via `npm` as a global module
5
+ Install the package via `npm` as a global module (requires NodeJS)
6
6
 
7
7
  ```shell
8
- npm i contensis-cli --global
8
+ npm i contensis-cli@preprelease --global
9
9
  ```
10
10
 
11
- ## CLI usage
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
12
34
 
13
35
  ```shell
14
- contensis-cli connect example-dev
36
+ contensis help
15
37
  ```
16
38
 
17
- The CLI uses the same commands and arguments as the shell. It is recommended you use and familiarise yourself with the cli via the shell and use the `contensis-cli` command to use the same cli commands in script-based context such as continuous integration.
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.
18
40
 
19
41
  ### Pass connection details anywhere
20
42
 
@@ -31,16 +53,91 @@ You can supply the following options with any command - although they don't appe
31
53
  -s --shared-secret
32
54
  ```
33
55
 
34
- ### Running headless?
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?
35
129
 
36
130
  Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
37
131
 
38
- In these environments you will see a warning message when using the cli with any credentials
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.
39
133
 
40
134
  ```shell
41
135
  [WARN] Could not connect to local keystore - your password could be stored unencrypted!
42
136
  ```
43
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
+
44
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`~~
45
142
 
46
143
  ```shell
@@ -82,6 +179,48 @@ Press [TAB] for suggestions
82
179
  contensis >
83
180
  ```
84
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
+ - [Remove entries](#remove-entries)
223
+
85
224
  ## Get started
86
225
 
87
226
  Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
@@ -107,6 +246,8 @@ Example call:
107
246
  > connect example-dev
108
247
  ```
109
248
 
249
+ Just type `help` to show the cli command help
250
+
110
251
  ## Connect to a Contensis Cloud environment
111
252
 
112
253
  Use the connect command followed by the cloud alias of your environment
@@ -121,9 +262,9 @@ contensis > connect example-dev
121
262
  contensis example-dev>
122
263
  ```
123
264
 
124
- After connecting you will notice the shell prompt will now contain the current "connected" environment - `contensis example-dev> `
265
+ After connecting you will notice the shell prompt will now contain the current "connected" environment e.g. `contensis example-dev> `
125
266
 
126
- The CMS must be online and available in order to connect to it
267
+ Contensis must be online and available in order to connect to it
127
268
 
128
269
  ```shell
129
270
  contensis > connect exemple-dev
@@ -145,9 +286,13 @@ contensis example-dev> login t.durden
145
286
  contensis t.durden@example-dev>
146
287
  ```
147
288
 
148
- If you are logging in via a script or service you will likely be using an API key set up in Contensis, you would provide the full credentials with the command `login {clientId} -s {sharedSecret}`
289
+ 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}`.
149
290
 
150
- ## List projects
291
+ If you need to skip this step for any reason you could [pass connection details anywhere](#pass-connection-details-anywhere)
292
+
293
+ ## Manage Projects
294
+
295
+ ### List projects
151
296
 
152
297
  Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
153
298
 
@@ -167,7 +312,7 @@ contensis example-dev> list projects
167
312
  [cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
168
313
  ```
169
314
 
170
- ## Set current project
315
+ ### Set current project
171
316
 
172
317
  Set your current working project with the `set project {projectId}` command
173
318
 
@@ -187,7 +332,168 @@ intranet t.durden@example-dev>
187
332
 
188
333
  You will notice the `contensis` prompt has been updated to show your current connected project
189
334
 
190
- ## List content types, components
335
+ ### Get project metadata
336
+
337
+ ```shell
338
+ contensis t.durden@example-dev> get project
339
+
340
+ id: contensis
341
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
342
+ name: Contensis
343
+ description:
344
+ primaryLanguage: en-GB
345
+ supportedLanguages:
346
+ en-GB
347
+ color: cobalt
348
+
349
+ contensis t.durden@example-dev>
350
+ ```
351
+
352
+ ### Set project metadata
353
+
354
+ Update a project name
355
+
356
+ ```shell
357
+ contensis t.durden@example-dev> set project name "Contensis website"
358
+ [cli] ✅ [example-dev] Updated project contensis
359
+ id: contensis
360
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
361
+ name: Contensis website
362
+ description:
363
+ primaryLanguage: en-GB
364
+ supportedLanguages:
365
+ en-GB
366
+ color: cobalt
367
+
368
+ contensis t.durden@example-dev>
369
+ ```
370
+
371
+ Update a project's description
372
+
373
+ ```shell
374
+ contensis t.durden@example-dev> set project description "Main product site"
375
+ [cli] ✅ [example-dev] Updated project contensis
376
+ id: contensis
377
+ uuid: 4df681ef-f3bc-3d79-57b8-de3f0570b9b3
378
+ name: Contensis website
379
+ description: Main product site
380
+ primaryLanguage: en-GB
381
+ supportedLanguages:
382
+ en-GB
383
+ color: cobalt
384
+
385
+ contensis t.durden@example-dev>
386
+ ```
387
+
388
+ ### Create a new project
389
+
390
+ ```shell
391
+ website t.durden@example-dev> create project testProject "Test project" --supported-languages cy
392
+ [cli] ✅ [example-dev] Created project testProject
393
+
394
+ [cli] ✅ Available projects:
395
+
396
+ >> testProject [cy *en-GB]
397
+ website [*en-GB]
398
+ wordPressSite [*en-GB]
399
+
400
+ [cli] ✅ Current project is set to testProject
401
+
402
+ testProject t.durden@example-dev>
403
+ ```
404
+
405
+ ## Content Models
406
+
407
+ Manage your content models like you are the chosen one
408
+
409
+ ### List content models
410
+
411
+ ```shell
412
+ contensis t.durden@example-dev> list models
413
+ [cli] ✅ [website] Content models [ 19 ]
414
+
415
+ - accessibleVideo { required by: 3 }
416
+ - blogListing { components: 1, contentTypes: 2, references: 33, required by: 4 }
417
+ - blogPost { components: 2, contentTypes: 6, references: 33, required by: 9 }
418
+ - callToAction { contentTypes: 9, references: 33, required by: 5 }
419
+ - category { required by: 1 }
420
+ - contentPage { components: 5, contentTypes: 6, references: 33, required by: 7 }
421
+ - externalLink { required by: 2 }
422
+ - growingConditions { components: 1, references: 1, required by: 1 }
423
+ - homepage { components: 4, contentTypes: 8, references: 33, required by: 3 }
424
+ - landingPage { components: 9, contentTypes: 12, references: 33, required by: 7 }
425
+ - person { required by: 2 }
426
+ - plant { components: 2, contentTypes: 3, references: 8, required by: 10 }
427
+ - plantType { required by: 2 }
428
+ - pot { components: 2, contentTypes: 1, references: 3, required by: 11 }
429
+ - productListing { components: 1, references: 1, required by: 4 }
430
+ - review { contentTypes: 3, references: 10, required by: 1 }
431
+ - siteSettings
432
+ - tag { required by: 5 }
433
+
434
+ contensis t.durden@example-dev>
435
+ ```
436
+
437
+ ### Examine a content model
438
+
439
+ A `model` is a complete view of a content type that includes all of its dependents - and the dependents of those dependents
440
+
441
+ - `contentTypes` are the content types that have content linked to the model directly from this content type
442
+ - `components` are the content types that have content linked to the model directly from this content type
443
+ - `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]
444
+ - `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
445
+
446
+ ```shell
447
+ contensis t.durden@example-dev> get model plant
448
+ [cli] ✅ Content models in contensis:
449
+
450
+ id: plant
451
+ dataFormat: model
452
+ name:
453
+ en-GB: Plant
454
+ description:
455
+ en-GB: Use this content type to store information about individual plants.
456
+ contentTypes:
457
+ growingConditions
458
+ plantType
459
+ tag
460
+ components:
461
+ externalPromotion
462
+ plantVariant
463
+ dependencyOf:
464
+ callToAction
465
+ homepage
466
+ landingPage
467
+ review
468
+ button
469
+ cardRow
470
+ curatedProductSlider
471
+ featuredBlogPosts
472
+ featuredProduct
473
+ promotedProduct
474
+ dependencies:
475
+ growingConditions
476
+ [plant]
477
+ plantType
478
+ [plant]
479
+ pot
480
+ [plantVariant]
481
+ tag
482
+ [plant, pot]
483
+ externalPromotion
484
+ [plant, pot]
485
+ icon
486
+ [growingConditions]
487
+ plantVariant
488
+ [plant]
489
+ potVariant
490
+ [pot]
491
+
492
+
493
+ contensis t.durden@example-dev>
494
+ ```
495
+
496
+ ### List content types, components
191
497
 
192
498
  ```shell
193
499
  contensis t.durden@example-dev> list contenttypes
@@ -212,12 +518,12 @@ contensis t.durden@example-dev> list contenttypes
212
518
  - tag [1 field]
213
519
  ```
214
520
 
215
- ## Examine a content type or component
521
+ ### Examine a content type or component
216
522
 
217
523
  ```shell
218
524
  contensis t.durden@example-dev> get contenttype pot
219
525
  [cli] ✅ [website] Content type "pot"
220
- uuid: adc051ee-d584-4f2a-ba42-5e6190edadb8
526
+ uuid: 929a99d2-fe5c-4781-84fa-f5a3738aa96d
221
527
  id: pot
222
528
  projectId: website
223
529
  name:
@@ -226,19 +532,19 @@ contensis t.durden@example-dev> get contenttype pot
226
532
  entryTitleField: productName
227
533
  entryDescriptionField: description
228
534
  fields:
229
- productName: string
535
+ productName**: string
230
536
  description: string
231
- externalPromotion: object
537
+ externalPromotion: object<component.externalpromotion>
232
538
  colour: string
233
539
  material: string
234
- potVariant: objectArray
235
- primaryImage: object
236
- photos: objectArray
237
- externalCardImage: object
238
- tags: objectArray
540
+ potVariant: objectArray<component.potvariant>
541
+ primaryImage: object<image>
542
+ photos: objectArray<image>
543
+ externalCardImage: object<image>
544
+ tags: objectArray<entry, tag>
239
545
  defaultLanguage: en-GB
240
546
  supportedLanguages:
241
- 0: en-GB
547
+ en-GB
242
548
  workflowId: contensisEntryBasic
243
549
  dataFormat: entry
244
550
  groups:
@@ -250,7 +556,9 @@ contensis t.durden@example-dev> get contenttype pot
250
556
  contensis t.durden@example-dev>
251
557
  ```
252
558
 
253
- ## Get entries
559
+ ## Entries
560
+
561
+ ### Get entries
254
562
 
255
563
  Use the `get entries` command
256
564
 
@@ -280,7 +588,7 @@ Found 8 entries in [website]
280
588
  website t.durden@example-dev>
281
589
  ```
282
590
 
283
- ## Get an entry by id
591
+ ### Get an entry by id
284
592
 
285
593
  ```shell
286
594
  website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
@@ -299,7 +607,7 @@ Found 1 entries in [website]
299
607
  website t.durden@example-dev>
300
608
  ```
301
609
 
302
- ## Get an entry with all of its dependents
610
+ ### Get an entry with all of its dependents
303
611
 
304
612
  Add the `--dependents` or `-d` flag to your `get entries` command to also find and fetch all dependent (linked) entries, recursively finding and including any dependent entries found inside those dependents.
305
613
 
@@ -333,7 +641,7 @@ Found 12 entries in [website]
333
641
  website t.durden@example-dev>
334
642
  ```
335
643
 
336
- ## Get entries with a ZenQL statement
644
+ ### Get entries with a ZenQL statement
337
645
 
338
646
  Use a ZenQL statement to find entries with the `--zenql` or `-q` option, add your statement inside `"double quotes"`. Refer to [ZenQL documentation](https://www.contensis.com/help-and-docs/user-guides/zenql-search) and test your statement for the right results in the Contensis web UI.
339
647
 
@@ -374,7 +682,7 @@ Found 21 entries in [website]
374
682
  website t.durden@example-dev>
375
683
  ```
376
684
 
377
- ## Choose entry fields to output
685
+ ### Choose entry fields to output
378
686
 
379
687
  Add the `--fields` or `-f` option to your `get entries` command to limit and order the entry fields that are returned, add the api key of each field to be returned separated by a space
380
688
 
@@ -406,7 +714,7 @@ Found 12 entries in [website]
406
714
  website t.durden@example-dev>
407
715
  ```
408
716
 
409
- ## Output results to a file
717
+ ### Output results to a file
410
718
 
411
719
  Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
412
720
 
@@ -489,7 +797,7 @@ website t.durden@example-dev>
489
797
 
490
798
  Run `list keys` again and you will see your new API key has been removed from the list of keys
491
799
 
492
- ## Manage Content Blocks
800
+ ## Manage content Blocks
493
801
 
494
802
  You can manage blocks for any Contensis project using the following commands
495
803
 
@@ -554,7 +862,10 @@ website t.durden@example-dev> get block logs contensis-website master
554
862
  website t.durden@example-dev>
555
863
  ```
556
864
 
557
- ### Push block
865
+ ### Push a block
866
+
867
+ > **Note**
868
+ > It is far simpler doing this in [GitLab CI](#use-in-gitlab-ci) or [GitHub CI Actions](#use-in-github-ci)
558
869
 
559
870
  ```shell
560
871
  website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/contensis-app:build-4359 master --release --commit-id 9ee20333 --commit-message "chore: sample commit message" --commit-datetime 2022-11-03T22:34 --author-email b.macka@zengenti.com --committer-email b.macka@zengenti.com --repository-url https://github.com/contensis/contensis-app.git --provider GitlabSelfHosted
@@ -563,69 +874,443 @@ website t.durden@example-dev> push block cli-test-block ghcr.io/contensis/conten
563
874
  website t.durden@example-dev>
564
875
  ```
565
876
 
566
- ## Use in Docker
877
+ ### Release a block version
567
878
 
568
- Running the container with the `-it` docker options will launch a shell session
879
+ First get the latest block version number
569
880
 
570
- ```bash
571
- docker pull ghcr.io/contensis/node-cli/main/app:latest
572
- docker run --rm -it ghcr.io/contensis/node-cli/main/app:latest
881
+ ```shell
882
+ website t.durden@example-dev>get block contensis-website master latest
883
+ [cli] [example-dev] Block contensis-website in project website:
884
+ v78 contensis-website
885
+ state: available
886
+ released: no
887
+ status:
888
+ deployment: deployed
889
+ workflow: draft
890
+ running status: available
891
+ datacentres:
892
+ hq: available
893
+ london: available
894
+ manchester: faulted
895
+ source:
896
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
897
+ message: build: syntax [nobuild]
898
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
899
+ pushed: [22/11/2022 06:52] Gitlab CI block push
900
+ https://github.com/contensis/contensis-website/commit/b946c1029c1b35aefee2e1a6b5780ddaf205ee74
901
+ image:
902
+ uri: ghcr.io/contensis/contensis-website/main/app
903
+ tag: latest
904
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=draft
905
+
906
+ website t.durden@example-dev>
573
907
  ```
574
908
 
575
- ### Run cli commands
909
+ Add the block version number to the `release block` command
576
910
 
577
- Add the cli command and any options after the container image in the `docker run` command e.g.
911
+ ```shell
578
912
 
579
- ```bash
580
- docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
913
+ website t.durden@example-dev> release block contensis-website 78
914
+ [cli] [example-dev] Released block contensis-website in project website
915
+ v78 contensis-website
916
+ state: available
917
+ released: [23/11/2022 01:42] n.flatley
918
+ status:
919
+ deployment: deployed
920
+ workflow: released
921
+ running status: available
922
+ datacentres:
923
+ hq: available
924
+ london: available
925
+ manchester: faulted
926
+ source:
927
+ commit: b946c1029c1b35aefee2e1a6b5780ddaf205ee74
928
+ message: build: syntax [nobuild]
929
+ committed: [22/11/2022 06:50] t.durden@zengenti.com
930
+ pushed: [22/11/2022 06:52] Gitlab CI block push
931
+ null
932
+ image:
933
+ uri: ghcr.io/contensis/contensis-website/main/app
934
+ tag: latest
935
+ staging url: https://staging-example-dev.cloud.contensis.com?block-contensis-website-versionstatus=released
936
+
937
+ website t.durden@example-dev>
581
938
  ```
582
939
 
583
- ### Persist connections to a local file
940
+ ## Import content models
584
941
 
585
- To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
942
+ 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.
586
943
 
587
- <aside>
588
- ⚠️ Ensure a file called `environments.json` exists before mapping the volume to the docker container. If it doesn’t exist, create this empty file first.
944
+ 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
589
945
 
590
- </aside>
946
+ ### Import from another Contensis environment
591
947
 
592
- Linux
948
+ Specify a list of models to import
593
949
 
594
- ```bash
595
- touch environments.json
596
- docker run --rm -v $(pwd)/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
950
+ ```shell
951
+ website t.durden@example-dev> import models plant --source-alias example-dev --source-project-id leif
952
+
953
+ -------------------------------------
954
+ -- IMPORT PREVIEW --
955
+
956
+ Content types:
957
+ - growingConditions [website: no change] v1.0
958
+ required by: [plant]
959
+ references: [icon]
960
+ - plant [website: update] v2.0
961
+ references: [growingConditions, plantGenus, plantType, tag]
962
+ 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'}...
963
+ - plantGenus [website: create] v0.1
964
+ required by: [plant]
965
+ - plantType [website: no change] v1.0
966
+ required by: [plant]
967
+ - pot [website: no change] v2.0
968
+ required by: [plantVariant]
969
+ references: [externalPromotion, potVariant, tag]
970
+ - tag [website: no change] v1.0
971
+ required by: [plant, pot]
972
+
973
+ Components:
974
+ - externalPromotion [website: no change] v1.0
975
+ required by: [plant, pot]
976
+ - icon [website: no change] v1.0
977
+ required by: [growingConditions]
978
+ - plantVariant [website: no change] v2.0
979
+ required by: [plant]
980
+ references: [pot]
981
+ - potVariant [website: no change] v1.0
982
+ required by: [pot]
983
+
984
+ website t.durden@example-dev>
597
985
  ```
598
986
 
599
- Windows
987
+ Or import every model from the source
600
988
 
601
- ```powershell
602
- echo {} > environments.json
603
- docker run --rm -v ${PWD}/environments.json:/usr/src/app/environments.json -it ghcr.io/contensis/node-cli/main/app:latest
989
+ ```shell
990
+ website t.durden@example-dev> import models --source-alias example-dev --source-project-id leif
991
+ -------------------------------------
992
+ -- IMPORT PREVIEW --
993
+
994
+ Content types:
995
+ - accessibleVideo [website: no change] v1.0
996
+ required by: [blogPost, contentPage, landingPage]
997
+ - alert [website: create] v0.1
998
+ - blogListing [website: no change] v2.0
999
+ required by: [button, callToAction, homepage, landingPage]
1000
+ references: [blogPost, callToAction, pageMetadata]
1001
+ - blogPost [website: update] v3.0
1002
+ required by: [blogListing, blogPost, button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1003
+ references: [accessibleVideo, blogPost, callToAction, category, externalPromotion, featuredProduct, person, tag]
1004
+ diff: ...
1005
+ - callToAction [website: no change] v2.0
1006
+ required by: [blogListing, blogPost, contentPage, homepage, landingPage]
1007
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1008
+ - campus [website: create] v0.1
1009
+ - category [website: no change] v1.0
1010
+ required by: [blogPost, department, listing]
1011
+ - contentPage [website: no change] v2.0
1012
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1013
+ references: [accessibleVideo, blogPost, callToAction, callout, cardRow, contentPage, featuredProduct, formPicker, landingPage, pageMetadata, tag]
1014
+ - department [website: two-pass] v0.1
1015
+ references: [category]
1016
+ - event [website: create] v0.1
1017
+ - externalLink [website: no change] v1.0
1018
+ required by: [button, callToAction]
1019
+ - form [website: create] v0.1
1020
+ - growingConditions [website: no change] v1.0
1021
+ required by: [listing, plant]
1022
+ references: [icon]
1023
+ - homepage [website: update] v2.0
1024
+ required by: [button, callToAction, landingPage]
1025
+ references: [blogListing, blogPost, callToAction, contentPage, curatedProductSlider, filteredProductSlider, landingPage, pageMetadata, plant, pot, productListing, promotedProduct]
1026
+ diff: ...
1027
+ - landingPage [website: update] v2.0
1028
+ required by: [button, callToAction, cardRow, contentPage, featuredBlogPosts, homepage, landingPage]
1029
+ references: [accessibleVideo, blogListing, blogPost, bodyCopy, callToAction, contentBlock, contentPage, curatedProductSlider, featuredBlogPosts, featuredProduct, filteredProductSlider, formPicker, homepage, landingPage, pageMetadata, plant, pot, productListing, promotedProduct, review, tag]
1030
+ diff: ...
1031
+ - listing [website: two-pass] v0.1
1032
+ references: [category, growingConditions, plantType, tag]
1033
+ - newsArticle [website: two-pass] v0.1
1034
+ references: [person]
1035
+ - newsTest [website: two-pass] v0.1
1036
+ references: [person]
1037
+ - person [website: no change] v1.0
1038
+ required by: [blogPost, newsArticle, newsTest, review]
1039
+ - plant [website: update] v2.0
1040
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, promotedProduct, review]
1041
+ references: [externalPromotion, growingConditions, plantGenus, plantType, plantVariant, tag]
1042
+ diff: ...
1043
+ - plantFamily [website: two-pass] v0.1
1044
+ required by: [plantOrder]
1045
+ references: [plantGenus]
1046
+ - plantGenus [website: create] v0.1
1047
+ required by: [plant, plantFamily]
1048
+ - plantOrder [website: two-pass] v0.1
1049
+ references: [plantFamily]
1050
+ - plantType [website: no change] v1.0
1051
+ required by: [filteredProductSlider, listing, plant]
1052
+ - pot [website: no change] v2.0
1053
+ required by: [button, callToAction, cardRow, curatedProductSlider, featuredBlogPosts, featuredProduct, homepage, landingPage, plantVariant, promotedProduct, review]
1054
+ references: [externalPromotion, potVariant, tag]
1055
+ - productListing [website: no change] v1.0
1056
+ required by: [button, callToAction, homepage, landingPage]
1057
+ references: [pageMetadata]
1058
+ - review [website: no change] v2.0
1059
+ required by: [landingPage]
1060
+ references: [person, plant, pot]
1061
+ - siteSettings [website: no change] v1.0
1062
+ - tag [website: no change] v1.0
1063
+ required by: [blogPost, contentPage, landingPage, listing, plant, pot]
1064
+ - testLang [website: create] v0.1
1065
+
1066
+ Components:
1067
+ - bodyCopy [website: no change] v1.0
1068
+ required by: [landingPage]
1069
+ - button [website: no change] v2.0
1070
+ required by: [promotedProduct]
1071
+ references: [blogListing, blogPost, contentPage, externalLink, homepage, landingPage, plant, pot, productListing]
1072
+ - callout [website: no change] v1.0
1073
+ required by: [contentPage, event]
1074
+ - cardRow [website: no change] v2.0
1075
+ required by: [contentPage]
1076
+ references: [blogPost, contentPage, landingPage, plant, pot]
1077
+ - contentBlock [website: no change] v1.0
1078
+ required by: [landingPage]
1079
+ - curatedProductSlider [website: no change] v2.0
1080
+ required by: [homepage, landingPage]
1081
+ references: [plant, pot]
1082
+ - externalPromotion [website: no change] v1.0
1083
+ required by: [blogPost, plant, pot]
1084
+ - featuredBlogPosts [website: no change] v2.0
1085
+ required by: [landingPage]
1086
+ references: [blogPost, contentPage, landingPage, plant, pot]
1087
+ - featuredProduct [website: no change] v2.0
1088
+ required by: [blogPost, contentPage, landingPage]
1089
+ references: [plant, pot]
1090
+ - filteredProductSlider [website: no change] v2.0
1091
+ required by: [homepage, landingPage]
1092
+ references: [plantType]
1093
+ - formPicker [website: no change] v1.0
1094
+ required by: [contentPage, landingPage]
1095
+ - icon [website: no change] v1.0
1096
+ required by: [growingConditions]
1097
+ - pageMetadata [website: no change] v1.0
1098
+ required by: [blogListing, contentPage, homepage, landingPage, productListing]
1099
+ - plantVariant [website: no change] v2.0
1100
+ required by: [plant]
1101
+ references: [pot]
1102
+ - potVariant [website: no change] v1.0
1103
+ required by: [pot]
1104
+ - promotedProduct [website: update] v2.0
1105
+ required by: [homepage, landingPage]
1106
+ references: [button, plant, pot]
1107
+ diff: ...
1108
+
1109
+ website t.durden@example-dev>
604
1110
  ```
605
1111
 
606
- ## Use in GitLab CI
1112
+ ### Import from a file
607
1113
 
608
- ```yaml
609
- push-to-contensis-block:
610
- stage: push-to-contensis
611
- only:
612
- - master
613
- image: ghcr.io/contensis/node-cli/main/app:latest
614
- script:
615
- # - contensis connect zenhub-dev --project-id migratortron --client-id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 --shared-secret 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
616
- - contensis push block example-website-block $APP_IMAGE:latest --release -a example-dev -p website -id 02c8fae0-1aa6-46d3-a0a4-9674fa7f10f1 -s 47a52c7755324debbcc984865e87200b-35b17f3d39ae40ee9b118358c4dd1666-a516b7c30ebb449ca26e93157588cd26
1114
+ ```shell
1115
+ website t.durden@example-dev> import models --from-file ./content-models.json
617
1116
  ```
618
1117
 
619
- ## Use in GitHub CI
1118
+ The output will be the same as the previous command
620
1119
 
621
- ```yaml
622
- - name: Push block to Contensis
623
- uses: contensis/cli-action@v1
624
- with:
625
- block-id: example-website-block
626
- # auto-release: true
627
- alias: zenhub-dev
628
- project-id: contensis
629
- client-id: ${{ secrets.CONTENSIS_CLIENT_ID }}
630
- shared-secret: ${{ secrets.CONTENSIS_SHARED_SECRET }}
1120
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1121
+
1122
+ ## Import entries
1123
+
1124
+ The import commands are made possible by using the `migratortron` library. There is further documentation here:
1125
+
1126
+ - [`migratortron` on npmjs](https://www.npmjs.com/package/migratortron)
1127
+ - [`contensis-importer` on npmjs](https://www.npmjs.com/package/contensis-importer)
1128
+
1129
+ ### Import from another Contensis environment
1130
+
1131
+ 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.
1132
+
1133
+ 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
1134
+
1135
+ ```shell
1136
+ website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
1137
+ -------------------------------------
1138
+ -- IMPORT PREVIEW --
1139
+ [26/11 02:16:29] [INFO] Fetching initial entries in project 'leif'
1140
+ Fetch [leif] >> 100% 21 0.0s/0.0s 100000p/s
1141
+ Fetch [leif] >> 100% 79 0.0s/0.0s Infinityp/s
1142
+ Fetch [leif] >> 100% 13 0.0s/0.0s Infinityp/s
1143
+
1144
+ Found 113 entries in leif
1145
+ --------------------------------------------
1146
+
1147
+ id contentTypeId entryTitle entryDescrip
1148
+ ------------------------------------------------------------------------------------------------------
1149
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitche
1150
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-c
1151
+ 43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up
1152
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautif
1153
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-c
1154
+ b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care
1155
+ a3339124-4340-4f31-a209-5a6413a89f15 plant Chinese money plant The Chinese
1156
+ 8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great opti
1157
+ 329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear
1158
+ 504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Ce
1159
+ a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily ident
1160
+ 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of
1161
+ ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic ch
1162
+ 6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut
1163
+ 50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its
1164
+ 4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy
1165
+ 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging pl
1166
+ 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-b
1167
+ 8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants
1168
+ b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut
1169
+ 0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut
1170
+ 51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
1171
+ c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
1172
+ 3b830d97-e976-467c-a833-1b4abcab65d0 image areca-palm-in-room null
1173
+ ed0300b0-e841-4c0f-bd1d-9ecd6bc2a354 image areca-palm-leaf null
1174
+ 00119ef1-c3c4-4a49-9076-27eee5605515 image areca-palm-plant-collection null
1175
+ 248e2817-6241-4de7-ac5d-75411be4339d image boston-fern-close-up null
1176
+
1177
+ - and 87 more...
1178
+
1179
+ [26/11 02:16:29] [INFO] Finding 113 entries in project 'website'
1180
+ Fetch [website] >> 100% 113 0.2s/0.0s 897p/s
1181
+ Fetch [website] >> 100% 4 0.0s/0.0s Infinityp/s
1182
+ [26/11 02:16:30] [INFO] Building 66 asset entries
1183
+ [26/11 02:16:30] [INFO] Building 47 content entries
1184
+
1185
+ 37/113 entries to migrate into [website]
1186
+
1187
+ contentTypeId status total
1188
+ ----------------------------------------------
1189
+ plantGenus error 4
1190
+ growingConditions update 4
1191
+ plant update 21
1192
+ pot update 12
1193
+ image no change 66
1194
+ plantType no change 5
1195
+ tag no change 1
1196
+ ----------------------------------------------
1197
+
1198
+ id contentTypeId status updates entryTitle
1199
+ ------------------------------------------------------------------------------------------------------
1200
+ 98347340-a11c-4ee5-b4e7-1ae3b75496a2 plantGenus error Aglaonema
1201
+ fa464489-6476-4694-b3d4-e77d0c00a185 plantGenus error Alocasia
1202
+ 309d5fd7-a21f-45a8-8abb-f01f820b8f16 plantGenus error Aloe
1203
+ 4ebdcc63-929f-4b06-8848-fe046468a63d plantGenus error Beaucarnea
1204
+ 636b925b-a386-4c56-9f33-96cd99cc391c growingConditions update -1,+0 Likes high humidity
1205
+ 2d80e638-eb0d-4bc5-bc96-42b7b8f20678 growingConditions update -1,+0 Needs plenty of light
1206
+ 711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions update -1,+0 Partial shade
1207
+ d815819d-61c6-4037-95d3-c503acf52153 growingConditions update -1,+0 Prefers dry conditions
1208
+ 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant update -1,+0 Aloe vera
1209
+ 0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant update -1,+0 Areca palm
1210
+ 43a60005-ea92-4b32-9af3-79560e48ecec plant update -1,+0 Boston fern
1211
+ f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant update -1,+0 Calathea orbifolia
1212
+ d647012b-897e-4b6b-bfb5-b9844ef3d648 plant update -1,+0 Canary Island Date Pal
1213
+ b7129080-692c-4550-9e2b-28f8ec978651 plant update -1,+0 Chinese evergreen
1214
+ a3339124-4340-4f31-a209-5a6413a89f15 plant update -1,+0 Chinese money plant
1215
+ 8c284599-b615-40a7-9d26-0ddd586fff51 plant update -1,+0 Dracaena fragrans
1216
+ 329e3104-332f-48a4-b43a-de852df796b3 plant update -1,+0 Elephant ear
1217
+ 504f7b7f-af03-4711-94ca-07edb90fbe00 plant update -1,+0 Heartleaf philodendron
1218
+ a9a537e8-5508-4166-878c-d5fcd0d9a723 plant update -1,+0 Maidenhair fern
1219
+ 9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant update -1,+0 Parlour palm
1220
+ ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant update -1,+0 Peace lily
1221
+ 6a71a864-6f61-471a-8cdd-f80237408666 plant update -1,+0 Pink moth orchid
1222
+ 50868245-3e53-4d9f-86ed-403593da67f6 plant update -1,+0 Ponytail palm
1223
+ 4f05979f-d8cf-4568-9045-05731a33f243 plant update -1,+0 Spider plant
1224
+ 76a16c87-5e6d-465b-a343-3f14cf2fea0a plant update -1,+0 String of nickels
1225
+ 61a2af3a-332c-453c-b9f6-1851d9b7d936 plant update -1,+0 Swiss cheese plant
1226
+ 8174fb53-b955-4e36-8f87-646bf286e396 plant update -1,+0 Variegated snake plant
1227
+
1228
+ - and 15 more...
1229
+
1230
+ --------------------------------------------
1231
+ [26/11 02:16:30] [OK] Done migrating entries
1232
+
1233
+ [cli] ⏩ import from project leif to website
1234
+
1235
+ - growingConditions: 4 [existing: 100%] [needs update: 100%]
1236
+ - image: 66 up to date
1237
+ - plant: 21 [existing: 100%] [needs update: 100%]
1238
+ - plantGenus: 4 [existing: 0%]
1239
+ - plantType: 5 up to date
1240
+ - pot: 12 [existing: 100%] [needs update: 100%]
1241
+ - tag: 1 up to date
1242
+ - totalCount: 37
1243
+ - errors: 1
1244
+
1245
+ [cli] ❌ Content type 'plantGenus' does not exist in project 'website'
1246
+
1247
+ [cli] ❌ [example-dev] Unable to import entries
1248
+
1249
+ website t.durden@example-dev>
1250
+ ```
1251
+
1252
+ ### Import from a file
1253
+
1254
+ ```shell
1255
+ website t.durden@example-dev> import entries --preserve-guids --from-file ./content-entries.json
631
1256
  ```
1257
+
1258
+ The output will be the same as the previous command
1259
+
1260
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
1261
+
1262
+ ## Remove entries
1263
+
1264
+ Delete entries by id
1265
+
1266
+ ```shell
1267
+ website t.durden@example-dev> remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-
1268
+ 8ea4ebd99aaa
1269
+ -- PREVIEW --
1270
+ [26/11 02:19:53] [INFO] Fetching initial entries in project 'website'
1271
+ Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
1272
+ [26/11 02:19:53] [INFO] Done deleting entries
1273
+
1274
+ a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
1275
+ 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
1276
+
1277
+ [cli] ⏩ delete from project website
1278
+
1279
+ - totalCount: 2 [to delete: 2]
1280
+
1281
+ [cli] ✅ [example-dev] Will delete entries
1282
+
1283
+ [cli] ⏩ Add --commit flag to commit the previewed changes
1284
+
1285
+ website t.durden@example-dev>
1286
+ ```
1287
+
1288
+ Delete entries with a supplied zenql statement
1289
+
1290
+ ```shell
1291
+ website t.durden@example-dev> remove entries --zenql "sys.version.created > 2022-11-25 14:00"
1292
+ -- PREVIEW --
1293
+ [26/11 02:20:52] [INFO] Fetching initial entries in project 'website'
1294
+ Fetch [website] >> 100% 7 0.0s/0.0s 100000p/s
1295
+ [26/11 02:20:53] [INFO] Done deleting entries
1296
+
1297
+ a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
1298
+ bb850178-c88c-50a6-8bac-844273cb19b8 delete image parlour-palm-white-room
1299
+ 1553d1c8-7a99-5dcd-b1cb-9a90d4cf1985 delete landingPage New subscription service
1300
+ f0b0ef1b-fdd1-52d6-99fc-4439e0c186e6 delete plantGenus Aglaonema
1301
+ f8f6ee36-9cc4-5d1e-be62-01ac73590947 delete plantGenus Aloe
1302
+ 8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
1303
+ 4efeb0e4-dc19-5f87-ab89-47892b9c4169 delete pot Terra large terracotta pot
1304
+
1305
+ [cli] ⏩ delete from project website
1306
+
1307
+ - totalCount: 7 [to delete: 7]
1308
+
1309
+ [cli] ✅ [example-dev] Will delete entries
1310
+
1311
+ [cli] ⏩ Add --commit flag to commit the previewed changes
1312
+
1313
+ website t.durden@example-dev>
1314
+ ```
1315
+
1316
+ <sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>