contensis-cli 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +15 -0
- package/README.md +631 -0
- package/cli.js +7 -0
- package/dist/commands/connect.js +44 -0
- package/dist/commands/connect.js.map +7 -0
- package/dist/commands/create.js +55 -0
- package/dist/commands/create.js.map +7 -0
- package/dist/commands/get.js +121 -0
- package/dist/commands/get.js.map +7 -0
- package/dist/commands/globalOptions.js +139 -0
- package/dist/commands/globalOptions.js.map +7 -0
- package/dist/commands/import.js +95 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/index.js +81 -0
- package/dist/commands/index.js.map +7 -0
- package/dist/commands/list.js +88 -0
- package/dist/commands/list.js.map +7 -0
- package/dist/commands/login.js +56 -0
- package/dist/commands/login.js.map +7 -0
- package/dist/commands/push.js +133 -0
- package/dist/commands/push.js.map +7 -0
- package/dist/commands/remove.js +77 -0
- package/dist/commands/remove.js.map +7 -0
- package/dist/commands/set.js +55 -0
- package/dist/commands/set.js.map +7 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +7 -0
- package/dist/localisation/en-GB.js +203 -0
- package/dist/localisation/en-GB.js.map +7 -0
- package/dist/models/AppError.d.js +2 -0
- package/dist/models/AppError.d.js.map +7 -0
- package/dist/models/Cache.d.js +2 -0
- package/dist/models/Cache.d.js.map +7 -0
- package/dist/models/JsModules.d.js +2 -0
- package/dist/models/JsModules.d.js.map +7 -0
- package/dist/providers/CredentialProvider.js +87 -0
- package/dist/providers/CredentialProvider.js.map +7 -0
- package/dist/providers/SessionCacheProvider.js +91 -0
- package/dist/providers/SessionCacheProvider.js.map +7 -0
- package/dist/providers/file-provider.js +113 -0
- package/dist/providers/file-provider.js.map +7 -0
- package/dist/services/ContensisAuthService.js +75 -0
- package/dist/services/ContensisAuthService.js.map +7 -0
- package/dist/services/ContensisCliService.js +1110 -0
- package/dist/services/ContensisCliService.js.map +7 -0
- package/dist/shell.js +261 -0
- package/dist/shell.js.map +7 -0
- package/dist/util/console.printer.js +194 -0
- package/dist/util/console.printer.js.map +7 -0
- package/dist/util/csv.formatter.js +50 -0
- package/dist/util/csv.formatter.js.map +7 -0
- package/dist/util/index.js +94 -0
- package/dist/util/index.js.map +7 -0
- package/dist/util/json.formatter.js +29 -0
- package/dist/util/json.formatter.js.map +7 -0
- package/dist/util/logger.js +184 -0
- package/dist/util/logger.js.map +7 -0
- package/dist/util/xml.formatter.js +51 -0
- package/dist/util/xml.formatter.js.map +7 -0
- package/dist/version.js +29 -0
- package/dist/version.js.map +7 -0
- package/esbuild.config.js +49 -0
- package/headless-setup.sh +7 -0
- package/package.json +59 -0
- package/patches/inquirer-command-prompt+0.1.0.patch +27 -0
- package/src/commands/connect.ts +23 -0
- package/src/commands/create.ts +41 -0
- package/src/commands/get.ts +139 -0
- package/src/commands/globalOptions.ts +126 -0
- package/src/commands/import.ts +89 -0
- package/src/commands/index.ts +72 -0
- package/src/commands/list.ts +90 -0
- package/src/commands/login.ts +33 -0
- package/src/commands/push.ts +120 -0
- package/src/commands/remove.ts +77 -0
- package/src/commands/set.ts +40 -0
- package/src/index.ts +19 -0
- package/src/localisation/en-GB.ts +211 -0
- package/src/models/AppError.d.ts +40 -0
- package/src/models/Cache.d.ts +25 -0
- package/src/models/JsModules.d.ts +1 -0
- package/src/providers/CredentialProvider.ts +88 -0
- package/src/providers/SessionCacheProvider.ts +74 -0
- package/src/providers/file-provider.ts +72 -0
- package/src/services/ContensisAuthService.ts +70 -0
- package/src/services/ContensisCliService.ts +1390 -0
- package/src/shell.ts +250 -0
- package/src/util/console.printer.ts +203 -0
- package/src/util/csv.formatter.ts +21 -0
- package/src/util/index.ts +67 -0
- package/src/util/json.formatter.ts +1 -0
- package/src/util/logger.ts +165 -0
- package/src/util/xml.formatter.ts +20 -0
- package/src/version.ts +1 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "pwa-node",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Launch Program",
|
|
11
|
+
"skipFiles": ["<node_internals>/**"],
|
|
12
|
+
"program": "${workspaceFolder}\\dist\\index.js"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
# Contensis CLI
|
|
2
|
+
|
|
3
|
+
Use Contensis from your favourite terminal with NodeJS
|
|
4
|
+
|
|
5
|
+
Install the package via `npm` as a global module
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm i contensis-cli --global
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI usage
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
contensis-cli connect example-dev
|
|
15
|
+
```
|
|
16
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
### Pass connection details anywhere
|
|
20
|
+
|
|
21
|
+
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
|
|
22
|
+
|
|
23
|
+
You can supply the following options with any command - although they don't appear in help text:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
-a --alias
|
|
27
|
+
-p --project-id
|
|
28
|
+
-u --user
|
|
29
|
+
-pw --password
|
|
30
|
+
-id --client-id
|
|
31
|
+
-s --shared-secret
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Running headless?
|
|
35
|
+
|
|
36
|
+
Most lightweight CI environments will likely not ship with the ability to easily load and unlock an encrypted keychain.
|
|
37
|
+
|
|
38
|
+
In these environments you will see a warning message when using the cli with any credentials
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
[WARN] Could not connect to local keystore - your password could be stored unencrypted!
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
~~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
|
+
|
|
46
|
+
```shell
|
|
47
|
+
sudo apt-get update && sudo apt-get install -y libsecret-1-0 dbus-x11 gnome-keyring
|
|
48
|
+
export $(dbus-launch)
|
|
49
|
+
dbus-launch
|
|
50
|
+
gnome-keyring-daemon --start --daemonize --components=secrets
|
|
51
|
+
echo 'neil' | gnome-keyring-daemon -r -d --unlock
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
~~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`~~
|
|
55
|
+
|
|
56
|
+
~~An executable script is available to test: `contensis-cli-headless` you will need sudo access to install additional libraries with `apt-get`~~
|
|
57
|
+
|
|
58
|
+
# Contensis Shell
|
|
59
|
+
|
|
60
|
+
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`.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
~$ contensis
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
_|_|_| _| _|
|
|
67
|
+
_| _|_| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_| _|_|_|
|
|
68
|
+
_| _| _| _| _| _| _|_|_|_| _| _| _|_| _| _|_|
|
|
69
|
+
_| _| _| _| _| _| _| _| _| _|_| _| _|_|
|
|
70
|
+
_|_|_| _|_| _| _| _|_| _|_|_| _| _| _|_|_| _| _|_|_|
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
© 2001-2022 Zengenti 🇬🇧.
|
|
74
|
+
- Creators of Contensis and purveyors of other fine software
|
|
75
|
+
|
|
76
|
+
👋 Welcome to the contensis-cli
|
|
77
|
+
|
|
78
|
+
Press [CTRL]+[C] or type "quit" to return to your system shell
|
|
79
|
+
Press [TAB] for suggestions
|
|
80
|
+
|
|
81
|
+
-------------------------------------
|
|
82
|
+
contensis >
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Get started
|
|
86
|
+
|
|
87
|
+
Press `[tab]` key at any time to show suggested commands or to attempt to auto-complete the command you are typign
|
|
88
|
+
|
|
89
|
+
```shell
|
|
90
|
+
>> Available commands:
|
|
91
|
+
connect list envs quit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Add `--help` to any command to show the available options and arguments e.g.
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
contensis > connect --help
|
|
98
|
+
Usage: contensis connect <alias>
|
|
99
|
+
|
|
100
|
+
Arguments:
|
|
101
|
+
alias the Contensis Cloud alias to connect with
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
-h, --help display help for command
|
|
105
|
+
|
|
106
|
+
Example call:
|
|
107
|
+
> connect example-dev
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Connect to a Contensis Cloud environment
|
|
111
|
+
|
|
112
|
+
Use the connect command followed by the cloud alias of your environment
|
|
113
|
+
|
|
114
|
+
```shell
|
|
115
|
+
contensis > connect example-dev
|
|
116
|
+
[cli] ✅ Current environment set to "example-dev"
|
|
117
|
+
[cli] ⚠️ Cannot retrieve projects list
|
|
118
|
+
[cli] ⏩ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
|
|
119
|
+
|
|
120
|
+
-------------------------------------
|
|
121
|
+
contensis example-dev>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
After connecting you will notice the shell prompt will now contain the current "connected" environment - `contensis example-dev> `
|
|
125
|
+
|
|
126
|
+
The CMS must be online and available in order to connect to it
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
contensis > connect exemple-dev
|
|
130
|
+
[cli] ❌ Cannot reach https://cms-exemple-dev.cloud.contensis.com
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Login to a connected Contensis environment
|
|
134
|
+
|
|
135
|
+
If you wish to use your normal username and password you will issue the command `login {username}`
|
|
136
|
+
|
|
137
|
+
```shell
|
|
138
|
+
contensis example-dev> login t.durden
|
|
139
|
+
? Enter password for t.durden@example-dev: ********
|
|
140
|
+
[cli] ✅ User t.durden connected to example-dev successfully
|
|
141
|
+
|
|
142
|
+
[cli] ℹ Saved credentials for contensis-cli_example-dev
|
|
143
|
+
|
|
144
|
+
-------------------------------------
|
|
145
|
+
contensis t.durden@example-dev>
|
|
146
|
+
```
|
|
147
|
+
|
|
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}`
|
|
149
|
+
|
|
150
|
+
## List projects
|
|
151
|
+
|
|
152
|
+
Issuing the command `list projects` will fetch a list of projects from the connected Contensis environment
|
|
153
|
+
|
|
154
|
+
```shell
|
|
155
|
+
contensis t.durden@example-dev> list projects
|
|
156
|
+
[cli] ✅ Available projects:
|
|
157
|
+
- [en-GB] intranet
|
|
158
|
+
- [en-GB] marketingSite
|
|
159
|
+
- [en-GB] microsite
|
|
160
|
+
- * [en-GB] website
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Or if you are not logged in you should be given useful tips
|
|
164
|
+
|
|
165
|
+
```shell
|
|
166
|
+
contensis example-dev> list projects
|
|
167
|
+
[cli] ℹ Introduce yourself with "login {username}" or "login {clientId} -s {secret}"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Set current project
|
|
171
|
+
|
|
172
|
+
Set your current working project with the `set project {projectId}` command
|
|
173
|
+
|
|
174
|
+
```shell
|
|
175
|
+
contensis t.durden@example-dev> set project intranet
|
|
176
|
+
[cli] ✅ Current project is "intranet"
|
|
177
|
+
-------------------------------------
|
|
178
|
+
intranet t.durden@example-dev> list projects
|
|
179
|
+
[cli] ✅ Available projects:
|
|
180
|
+
- * [en-GB] intranet
|
|
181
|
+
- [en-GB] marketingSite
|
|
182
|
+
- [en-GB] microsite
|
|
183
|
+
- [en-GB] website
|
|
184
|
+
|
|
185
|
+
intranet t.durden@example-dev>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
You will notice the `contensis` prompt has been updated to show your current connected project
|
|
189
|
+
|
|
190
|
+
## List content types, components
|
|
191
|
+
|
|
192
|
+
```shell
|
|
193
|
+
contensis t.durden@example-dev> list contenttypes
|
|
194
|
+
[cli] ✅ Content types in "website":
|
|
195
|
+
- accessibleVideo [4 fields]
|
|
196
|
+
- blogListing [4 fields]
|
|
197
|
+
- blogPost [12 fields]
|
|
198
|
+
- callToAction [5 fields]
|
|
199
|
+
- category [2 fields]
|
|
200
|
+
- contentPage [11 fields]
|
|
201
|
+
- event [5 fields]
|
|
202
|
+
- externalLink [2 fields]
|
|
203
|
+
- growingConditions [3 fields]
|
|
204
|
+
- homepage [8 fields]
|
|
205
|
+
- landingPage [13 fields]
|
|
206
|
+
- person [2 fields]
|
|
207
|
+
- plant [13 fields]
|
|
208
|
+
- plantType [3 fields]
|
|
209
|
+
- pot [10 fields]
|
|
210
|
+
- productListing [2 fields]
|
|
211
|
+
- review [5 fields]
|
|
212
|
+
- tag [1 field]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Examine a content type or component
|
|
216
|
+
|
|
217
|
+
```shell
|
|
218
|
+
contensis t.durden@example-dev> get contenttype pot
|
|
219
|
+
[cli] ✅ [website] Content type "pot"
|
|
220
|
+
uuid: adc051ee-d584-4f2a-ba42-5e6190edadb8
|
|
221
|
+
id: pot
|
|
222
|
+
projectId: website
|
|
223
|
+
name:
|
|
224
|
+
en-GB: Pot
|
|
225
|
+
description:
|
|
226
|
+
entryTitleField: productName
|
|
227
|
+
entryDescriptionField: description
|
|
228
|
+
fields:
|
|
229
|
+
productName: string
|
|
230
|
+
description: string
|
|
231
|
+
externalPromotion: object
|
|
232
|
+
colour: string
|
|
233
|
+
material: string
|
|
234
|
+
potVariant: objectArray
|
|
235
|
+
primaryImage: object
|
|
236
|
+
photos: objectArray
|
|
237
|
+
externalCardImage: object
|
|
238
|
+
tags: objectArray
|
|
239
|
+
defaultLanguage: en-GB
|
|
240
|
+
supportedLanguages:
|
|
241
|
+
0: en-GB
|
|
242
|
+
workflowId: contensisEntryBasic
|
|
243
|
+
dataFormat: entry
|
|
244
|
+
groups:
|
|
245
|
+
main
|
|
246
|
+
photos
|
|
247
|
+
tags
|
|
248
|
+
includeInDelivery: true
|
|
249
|
+
|
|
250
|
+
contensis t.durden@example-dev>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Get entries
|
|
254
|
+
|
|
255
|
+
Use the `get entries` command
|
|
256
|
+
|
|
257
|
+
The simplest usage is `get entries {keyword}` or `get entries "{search phrase}"`
|
|
258
|
+
|
|
259
|
+
```shell
|
|
260
|
+
website t.durden@example-dev> get entries "good plants"
|
|
261
|
+
-------------------------------------
|
|
262
|
+
[24/07 01:48:58] [INFO] Fetching initial entries in project 'website'
|
|
263
|
+
Fetch [website] >> 100% 8 0.0s/0.0s Infinityp/s
|
|
264
|
+
|
|
265
|
+
Found 8 entries in [website]
|
|
266
|
+
--------------------------------------------
|
|
267
|
+
|
|
268
|
+
id contentTypeId entryTitle entryDescription
|
|
269
|
+
----------------------------------------------------------------------------------------------------------------------
|
|
270
|
+
b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
|
|
271
|
+
63b19aac-e5b5-44e5-a6bb-f49e466f2afb blogPost The best plants for looking af Did you know that houseplants
|
|
272
|
+
89bcc566-e9c8-427b-aa56-226c826353f3 blogPost Why plants are good for your m There’s plenty of research to
|
|
273
|
+
3fe3cebe-8c09-429e-a1af-b636ffc008a4 review Great plant – not so great del null
|
|
274
|
+
a116716b-7249-4d00-8c93-e57861d984a6 blogPost The best houseplants for your Houseplants are growing in pop
|
|
275
|
+
f2c98349-28e4-42f3-8677-e6b5c04948c5 landingPage Register for our new subscript Leif Club, our new subscriptio
|
|
276
|
+
d931f2d3-d852-49d6-9137-a7d12ae672a6 blogPost How to look after your plants It doesn’t matter if you’ve be
|
|
277
|
+
0e79c27b-d1bf-4545-a40d-daa17d8726a4 homepage Find the perfect plant null
|
|
278
|
+
----------------------------------------------------------------------------------------------------------------------
|
|
279
|
+
|
|
280
|
+
website t.durden@example-dev>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Get an entry by id
|
|
284
|
+
|
|
285
|
+
```shell
|
|
286
|
+
website t.durden@example-dev> get entries --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
|
|
287
|
+
-------------------------------------
|
|
288
|
+
[24/07 01:54:01] [INFO] Fetching initial entries in project 'website'
|
|
289
|
+
Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
|
|
290
|
+
|
|
291
|
+
Found 1 entries in [website]
|
|
292
|
+
--------------------------------------------
|
|
293
|
+
|
|
294
|
+
id contentTypeId entryTitle entryDescription
|
|
295
|
+
-------------------------------------------------------------------------------------------------
|
|
296
|
+
7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
|
|
297
|
+
-------------------------------------------------------------------------------------------------
|
|
298
|
+
|
|
299
|
+
website t.durden@example-dev>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Get an entry with all of its dependents
|
|
303
|
+
|
|
304
|
+
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
|
+
|
|
306
|
+
```shell
|
|
307
|
+
website t.durden@example-dev> get entries --dependents --id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
|
|
308
|
+
-------------------------------------
|
|
309
|
+
[24/07 01:55:43] [INFO] Fetching initial entries in project 'website'
|
|
310
|
+
Fetch [website] >> 100% 1 0.0s/0.0s Infinityp/s
|
|
311
|
+
Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
|
|
312
|
+
Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
|
|
313
|
+
|
|
314
|
+
Found 12 entries in [website]
|
|
315
|
+
--------------------------------------------
|
|
316
|
+
|
|
317
|
+
id contentTypeId entryTitle entryDescription
|
|
318
|
+
------------------------------------------------------------------------------------------------------------
|
|
319
|
+
7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have
|
|
320
|
+
51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
|
|
321
|
+
c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
|
|
322
|
+
ccbc4dd0-7bd6-4295-ab8e-da9f529fe5e0 image succulents-collection null
|
|
323
|
+
f2022069-7a92-491d-b197-a3564ab9a8ca pot Grå small grey pot Grå is a small grey concr
|
|
324
|
+
452a4ee5-611b-4382-b7c7-06d810b5e698 pot Vit mid-sized white pot Vit is a mid-sized white
|
|
325
|
+
70149568-9725-4c39-8ff5-ef69221a0899 plantType Succulents Succulent plants store wa
|
|
326
|
+
711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions Partial shade This plant likes bright i
|
|
327
|
+
d815819d-61c6-4037-95d3-c503acf52153 growingConditions Prefers dry conditions This plant prefers dry co
|
|
328
|
+
3659a333-8d10-4325-9ea6-2f49ae47e7fe tag Promoted null
|
|
329
|
+
2a62ab2a-6a79-4917-b611-c69f0640760d image gra-pot null
|
|
330
|
+
43fdab9f-e687-4d1f-a283-3fa25af437fc image vit-pot null
|
|
331
|
+
------------------------------------------------------------------------------------------------------------
|
|
332
|
+
|
|
333
|
+
website t.durden@example-dev>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Get entries with a ZenQL statement
|
|
337
|
+
|
|
338
|
+
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
|
+
|
|
340
|
+
```shell
|
|
341
|
+
website t.durden@example-dev> get entries --zenql "sys.contentTypeId = plant"
|
|
342
|
+
-------------------------------------
|
|
343
|
+
[24/07 01:52:37] [INFO] Fetching initial entries in project 'website'
|
|
344
|
+
Fetch [website] >> 100% 21 0.0s/0.0s Infinityp/s
|
|
345
|
+
|
|
346
|
+
Found 21 entries in [website]
|
|
347
|
+
--------------------------------------------
|
|
348
|
+
|
|
349
|
+
id contentTypeId entryTitle entryDescription
|
|
350
|
+
--------------------------------------------------------------------------------------------------------------
|
|
351
|
+
7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitchen should have an a
|
|
352
|
+
0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-care for palm that
|
|
353
|
+
43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up your bath time wit
|
|
354
|
+
f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautiful foliage plant h
|
|
355
|
+
d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-care for palm that
|
|
356
|
+
b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care for and air purif
|
|
357
|
+
6dc1cb96-cee3-4fef-acde-54fb395bcf4b plant Chinese money plant The Chinese money plant’s mini
|
|
358
|
+
8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great option for beginner pl
|
|
359
|
+
329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear plants are a grea
|
|
360
|
+
504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Central America and
|
|
361
|
+
a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily identified by its brigh
|
|
362
|
+
9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of Central America i
|
|
363
|
+
ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic choice for adding a
|
|
364
|
+
6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut flowers when you c
|
|
365
|
+
50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its name, this popular
|
|
366
|
+
4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy with help from a s
|
|
367
|
+
76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging plant that requires
|
|
368
|
+
61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-back central Americ
|
|
369
|
+
8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants are a great choic
|
|
370
|
+
b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut flowers when you c
|
|
371
|
+
0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut flowers when you c
|
|
372
|
+
--------------------------------------------------------------------------------------------------------------
|
|
373
|
+
|
|
374
|
+
website t.durden@example-dev>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## Choose entry fields to output
|
|
378
|
+
|
|
379
|
+
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
|
+
|
|
381
|
+
```shell
|
|
382
|
+
website t.durden@example-dev> get entries --fields productName colour material externalPromotion --zenql "sys.contentTypeId = pot"
|
|
383
|
+
-------------------------------------
|
|
384
|
+
[24/07 02:05:42] [INFO] Fetching initial entries in project 'website'
|
|
385
|
+
Fetch [website] >> 100% 12 0.0s/0.0s Infinityp/s
|
|
386
|
+
|
|
387
|
+
Found 12 entries in [website]
|
|
388
|
+
--------------------------------------------
|
|
389
|
+
|
|
390
|
+
productName colour material externalPromotion
|
|
391
|
+
----------------------------------------------------------------------------------------------------------------
|
|
392
|
+
Barro decorated terracotta pot Brown Clay {externalTitle:Buy a Barro decorated terracott
|
|
393
|
+
Bianco white pot White Porcelain {externalTitle:Buy a Bianco small white pot fr
|
|
394
|
+
Canasta mid-sized pot Cream Clay {externalTitle:Buy a Canasta mid-sized clay po
|
|
395
|
+
Geo mid-sized pot Grey Concrete {externalTitle:Buy a Geo mid-sized concrete po
|
|
396
|
+
Grå small grey pot Grey Concrete {externalTitle:Buy a Grå small grey pot from L
|
|
397
|
+
Luna round pot White Ceramic {externalTitle:Buy a Luna round pot from Leif,
|
|
398
|
+
Marmo terrazzo-style pot White Concrete {externalTitle:Buy a Marmo terrazzo-style pot
|
|
399
|
+
Milano dipped pot Multicoloured Ceramic {externalTitle:Buy a Milano dipped pot from Le
|
|
400
|
+
Roja red pot Red Fibrestone {externalTitle:Buy a medium or large Rosa red
|
|
401
|
+
Rosa pot Pink Clay {externalTitle:Buy a Rosa coral pink pot from
|
|
402
|
+
Terra large terracotta pot Brown Clay {externalTitle:Buy a Terra large terracotta po
|
|
403
|
+
Vit mid-sized white pot White Ceramic {externalTitle:Buy a Vit mid-sized white pot f
|
|
404
|
+
----------------------------------------------------------------------------------------------------------------
|
|
405
|
+
|
|
406
|
+
website t.durden@example-dev>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Output results to a file
|
|
410
|
+
|
|
411
|
+
Use the `--output` or `-o` option followed by the file name you wish for command output to be written to
|
|
412
|
+
|
|
413
|
+
```shell
|
|
414
|
+
website t.durden@example-dev> get entries --zenql "sys.contentTypeId = pot" --output products-pot.json
|
|
415
|
+
-------------------------------------
|
|
416
|
+
[24/07 02:12:27] [INFO] Fetching initial entries in project 'website'
|
|
417
|
+
Fetch [website] >> 100% 12 0.0s/0.0s 100000p/s
|
|
418
|
+
[cli] ✅ Output file: C:\dev\contensis-cli\products-pot.json
|
|
419
|
+
website t.durden@example-dev>
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Combine other options and mobilise your data to consume elsewhere
|
|
423
|
+
|
|
424
|
+
```shell
|
|
425
|
+
get entries -d -o aloe-complete-entry.json -id 7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8
|
|
426
|
+
-------------------------------------
|
|
427
|
+
[24/07 02:16:04] [INFO] Fetching initial entries in project 'website'
|
|
428
|
+
Fetch [website] >> 100% 1 0.0s/0.0s 100000p/s
|
|
429
|
+
Fetch [website] >> 100% 9 0.0s/0.0s Infinityp/s
|
|
430
|
+
Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
|
|
431
|
+
[cli] ✅ Output file: C:\dev\contensis-cli\aloe-complete-entry.json
|
|
432
|
+
website t.durden@example-dev>
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
## Format output
|
|
436
|
+
|
|
437
|
+
Override the output format with the `--format` or `-f` option.
|
|
438
|
+
|
|
439
|
+
Available options are: `json`, `xml` or `csv`
|
|
440
|
+
|
|
441
|
+
The `--format` and `--output` options are available with most commands (check command `--help`)
|
|
442
|
+
|
|
443
|
+
Output will normally default to JSON when saved with the `--output` flag.
|
|
444
|
+
|
|
445
|
+
## Manage API keys
|
|
446
|
+
|
|
447
|
+
You can use the cli or shell to manage API keys that are used to provide access to external application integrations
|
|
448
|
+
|
|
449
|
+
### List keys
|
|
450
|
+
|
|
451
|
+
```shell
|
|
452
|
+
website t.durden@example-dev> list keys
|
|
453
|
+
[cli] ✅ [example-dev] API keys:
|
|
454
|
+
- Slack webhooks [2021-09-22 zengenti]
|
|
455
|
+
144ea36d-3cb1-406e-b6d1-931162780d0b
|
|
456
|
+
6fad017d75ce434eb0b0703bf40d4dac-842394737615483e95a22eee6cdcff1d-a238f992b45640708336781029838ec9
|
|
457
|
+
- Contensis blocks [2021-10-26 zengenti]
|
|
458
|
+
e4376db2-ed3e-49d3-a799-a6ec733a3611
|
|
459
|
+
a8590f6b4630404186b72fea198d3c12-c6f1f565eb86428ea0170e1b4b8a4b7f-de88eb42e46c4d548a8c36f490f34866
|
|
460
|
+
- Content migration API [2022-03-01 t.durden]
|
|
461
|
+
5bea0a71-cd21-41a9-84a3-2f64a2c4394a
|
|
462
|
+
22c7808a109749c8b37723a8572e5323-ea79651f111a464d980db162e5254b02-954790ca475a4fa186e91f76ce38b4c6
|
|
463
|
+
|
|
464
|
+
website t.durden@example-dev>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Create key
|
|
468
|
+
|
|
469
|
+
```shell
|
|
470
|
+
website t.durden@example-dev> create key "Test key" "Key to demonstrate cli"
|
|
471
|
+
[cli] ✅ [example-dev] Created API key "Test key"
|
|
472
|
+
- Test key (Key to demonstrate cli) [2022-07-27 t.durden]
|
|
473
|
+
- id: af645b8b-fa3b-4196-a1b7-ac035f7598a3
|
|
474
|
+
- sharedSecret: 1ff8b259423c4be08589a63f180c1bdc-63bd3a4f421c44c2afd0ba61e837d671-6aa9532442f149e6a9a837326a9a98e9
|
|
475
|
+
|
|
476
|
+
website t.durden@example-dev>
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
Run `list keys` again and you will see your new API key added to the returned list of keys
|
|
480
|
+
|
|
481
|
+
### Remove key
|
|
482
|
+
|
|
483
|
+
```shell
|
|
484
|
+
website t.durden@example-dev> remove key af645b8b-fa3b-4196-a1b7-ac035f7598a3
|
|
485
|
+
[cli] ✅ [example-dev] Deleted API key "af645b8b-fa3b-4196-a1b7-ac035f7598a3"
|
|
486
|
+
|
|
487
|
+
website t.durden@example-dev>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Run `list keys` again and you will see your new API key has been removed from the list of keys
|
|
491
|
+
|
|
492
|
+
## Manage Content Blocks
|
|
493
|
+
|
|
494
|
+
You can manage blocks for any Contensis project using the following commands
|
|
495
|
+
|
|
496
|
+
### List blocks
|
|
497
|
+
|
|
498
|
+
```shell
|
|
499
|
+
website t.durden@example-dev> list blocks
|
|
500
|
+
[cli] ✅ [example-dev] Blocks in project website:
|
|
501
|
+
- cli-test-block
|
|
502
|
+
[master]: running
|
|
503
|
+
- simple-block +9
|
|
504
|
+
[feature-test-feature-branch]: running
|
|
505
|
+
[master]: running
|
|
506
|
+
|
|
507
|
+
website t.durden@example-dev>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Get block
|
|
511
|
+
|
|
512
|
+
```shell
|
|
513
|
+
website t.durden@example-dev> get block simple-block master
|
|
514
|
+
[cli] ✅ [example-dev:website] Block versions:
|
|
515
|
+
v15 simple-block
|
|
516
|
+
state: available
|
|
517
|
+
released: [03/11/2022 17:06] zengenti
|
|
518
|
+
source:
|
|
519
|
+
commit: 16b04ecb
|
|
520
|
+
message: Update index.html
|
|
521
|
+
committed: [03/11/2022 17:03] b.macka@zengenti.com
|
|
522
|
+
pushed: [03/11/2022 17:04] Gitlab CI block push
|
|
523
|
+
https://gitlab.example-org.com/product-dev/simple-block/-/commit/16b04ecb
|
|
524
|
+
staging url: https://staging-example-dev.cloud.contensis.com?block-simple-block-versionstatus=released
|
|
525
|
+
|
|
526
|
+
v14 simple-block
|
|
527
|
+
state: stopped
|
|
528
|
+
released: [03/11/2022 17:01] zengenti
|
|
529
|
+
source:
|
|
530
|
+
commit: fbad8514
|
|
531
|
+
message: Added v16 to demo homepage
|
|
532
|
+
committed: [03/11/2022 16:57] b.macka@zengenti.com
|
|
533
|
+
pushed: [03/11/2022 16:58] Gitlab CI block push
|
|
534
|
+
https://gitlab.example-org.com/product-dev/simple-block/-/commit/fbad8514
|
|
535
|
+
|
|
536
|
+
website t.durden@example-dev>
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Get block logs
|
|
540
|
+
|
|
541
|
+
```shell
|
|
542
|
+
website t.durden@example-dev> get block logs contensis-website master
|
|
543
|
+
|
|
544
|
+
[cli] ✅ [example-dev] Blocks in project website:
|
|
545
|
+
|
|
546
|
+
- contensis-website master latest [hq]
|
|
547
|
+
-------------------------------------
|
|
548
|
+
2022-11-04T14:36:28.137625120Z [launcher] startup file: ./start.website.example-dev.js - exists?: true
|
|
549
|
+
2022-11-04T14:36:28.138080818Z [launcher set default] /usr/src/app/dist/server/start.website.example-dev.js
|
|
550
|
+
2022-11-04T14:36:28.725514880Z
|
|
551
|
+
2022-11-04T14:36:28.725610953Z Serving static assets from: "/dist/static/"
|
|
552
|
+
2022-11-04T14:36:28.732830052Z HTTP server is listening @ port 3001
|
|
553
|
+
|
|
554
|
+
website t.durden@example-dev>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### Push block
|
|
558
|
+
|
|
559
|
+
```shell
|
|
560
|
+
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
|
|
561
|
+
[cli] ✅ [example-dev] Created block "cli-test-block" in project website
|
|
562
|
+
|
|
563
|
+
website t.durden@example-dev>
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
## Use in Docker
|
|
567
|
+
|
|
568
|
+
Running the container with the `-it` docker options will launch a shell session
|
|
569
|
+
|
|
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
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Run cli commands
|
|
576
|
+
|
|
577
|
+
Add the cli command and any options after the container image in the `docker run` command e.g.
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
docker run --rm ghcr.io/contensis/node-cli/main/app:latest get entries "test"
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Persist connections to a local file
|
|
584
|
+
|
|
585
|
+
To use the cli container for multiple commands or to save connections for future sessions, map a volume to the docker container
|
|
586
|
+
|
|
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.
|
|
589
|
+
|
|
590
|
+
</aside>
|
|
591
|
+
|
|
592
|
+
Linux
|
|
593
|
+
|
|
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
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Windows
|
|
600
|
+
|
|
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
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
## Use in GitLab CI
|
|
607
|
+
|
|
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
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
## Use in GitHub CI
|
|
620
|
+
|
|
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 }}
|
|
631
|
+
```
|