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
@@ -1,289 +1,289 @@
1
- import {
2
- BlockRunningStatus,
3
- MigrateModelsResult,
4
- MigrateStatus,
5
- } from 'migratortron';
6
- import { Logger } from '~/util/logger';
7
-
8
- export const LogMessages = {
9
- app: {
10
- contensis: () => 'Contensis',
11
- quit: () => `Goodbye šŸ‘‹\n`,
12
- startup: (version: string) =>
13
- `v${version} Ā© 2001-${new Date().getFullYear()} Zengenti šŸ‡¬šŸ‡§. \n - Creators of Contensis and purveyors of other fine software\n\nšŸ‘‹ Welcome to the contensis-cli\n`,
14
- help: () =>
15
- 'Press [CTRL]+[C] or type "quit" to return to your system shell\nPress [TAB] for suggestions\n',
16
- suggestions: () =>
17
- `\n${Logger.errorText('>>')} Press [TAB] for suggestions\n`,
18
- autocomplete: () => `\n${Logger.errorText('>>')} Available commands:`,
19
- unknownError: () => `Something went wrong...`,
20
- fileOutput: (format = 'json', path?: string) =>
21
- `Output ${format} file: ${Logger.infoText(path)}\n`,
22
- noFileOutput: () => `No output written\n`,
23
- },
24
- command: {
25
- notKnown: (command: string) => `${command} is not known`,
26
- },
27
- envs: {
28
- found: (num: number) =>
29
- `environments store found containing ${num} environment${
30
- num === 1 ? '' : 's'
31
- }`,
32
- tip: () =>
33
- `Connect to a Contensis cloud instance using "contensis connect {cms alias}"`,
34
- },
35
- connect: {
36
- command: {
37
- name: () => 'connect',
38
- example: () => `Example call:\n > connect example-dev`,
39
- },
40
- args: {
41
- alias: {
42
- name: () => '<alias>',
43
- description: () => 'the Contensis Cloud alias to connect with',
44
- },
45
- },
46
- noEnv: () => `Cannot connect - no environment alias specified`,
47
- unreachable: (url: string, status: number) =>
48
- `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,
49
- connected: (env: string) => `Current environment set to "${env}"`,
50
- help: () =>
51
- `Connect to a Contensis cloud instance using "contensis connect {cms alias}"`,
52
- projects: () => `Available projects:`,
53
- noProjects: () => `Cannot retrieve projects list`,
54
- tip: () =>
55
- `Introduce yourself with "login {username}" or "login {clientId} -s {secret}" or by passing credentials as options with your command`,
56
- },
57
- login: {
58
- command: {
59
- name: () => 'login',
60
- usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,
61
- example: () =>
62
- `Example call:\n > login myuserid\n -- or --\n > login {clientId} -s {sharedSecret}`,
63
- },
64
- args: {
65
- user: {
66
- name: () => '<user/clientId>',
67
- description: () => 'the username to login with',
68
- },
69
- password: {
70
- name: () => '[password]',
71
- description: () =>
72
- 'the password to use to login with (optional/insecure)',
73
- },
74
- secret: {
75
- name: () => '-s --sharedSecret <sharedSecret>',
76
- description: () =>
77
- 'the shared secret to use when logging in with a client id',
78
- },
79
- },
80
- passwordPrompt: (env?: string, userId?: string) =>
81
- userId
82
- ? `Enter password for ${userId}@${env}:`
83
- : `Please enter a password`,
84
- failed: (env: string, userId: string) =>
85
- `Unable to login to ${env} as ${userId}`,
86
- success: (env: string, userId: string) =>
87
- `User ${userId} connected to ${env} successfully\n`,
88
- insecurePassword: () =>
89
- `Could not connect to local keystore - your password could be stored unencrypted!`,
90
- noEnv: () => `No environment set, use "contensis connect {alias}" first`,
91
- noUserId: () => `No user id specified`,
92
- },
93
- projects: {
94
- list: () => `Available projects:`,
95
- noList: () => `Cannot retrieve projects list`,
96
- set: (projectId: string) =>
97
- `Current project is set to ${Logger.highlightText(projectId)}`,
98
- failedSet: (projectId: string) =>
99
- `Project ${Logger.highlightText(projectId)} not found`,
100
- tip: () =>
101
- `You need to set your current working project with "set project {projectId}"`,
102
- created: (env: string, id: string) =>
103
- `[${env}] Created project ${Logger.highlightText(id)}`,
104
- failedCreate: (env: string, id: string) =>
105
- `[${env}] Unable to create project ${Logger.highlightText(id)}`,
106
- updated: (env: string, id: string) =>
107
- `[${env}] Updated project ${Logger.highlightText(id)}`,
108
- failedUpdate: (env: string, id: string) =>
109
- `[${env}] Unable to update project ${Logger.highlightText(id)}`,
110
- },
111
- migrate: {
112
- models: {
113
- result: (
114
- status: keyof MigrateModelsResult['project']['contentTypes']
115
- ) => {
116
- switch (status) {
117
- case 'created':
118
- case 'updated':
119
- return Logger.successText;
120
- case 'errors':
121
- return Logger.errorText;
122
- default:
123
- return Logger.infoText;
124
- }
125
- },
126
- },
127
- status: (status: MigrateStatus) => {
128
- switch (status) {
129
- case 'no change':
130
- return Logger.successText;
131
- case 'create':
132
- case 'two-pass':
133
- case 'update':
134
- case 'delete':
135
- return Logger.warningText;
136
- case 'error':
137
- case 'not found':
138
- return Logger.errorText;
139
- default:
140
- return Logger.infoText;
141
- }
142
- },
143
- },
144
- models: {
145
- list: (projectId: string) =>
146
- `Content models in ${Logger.highlightText(projectId)}:`,
147
- noList: (projectId: string) =>
148
- `[${projectId}] Cannot retrieve content models`,
149
- get: (projectId: string, id: string) =>
150
- `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,
151
- failedGet: (projectId: string, id: string) =>
152
- `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,
153
- },
154
- contenttypes: {
155
- list: (projectId: string) =>
156
- `Content types in ${Logger.highlightText(projectId)}:`,
157
- get: (projectId: string, id: string) =>
158
- `[${projectId}] Content type ${Logger.highlightText(id)}`,
159
- failedGet: (projectId: string, id: string) =>
160
- `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,
161
- created: (projectId: string, id: string, status?: string) =>
162
- `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,
163
- removed: (env: string, id: string, commit: boolean) =>
164
- `[${env}] ${
165
- commit ? `Deleted` : `Will delete`
166
- } content type ${Logger.highlightText(id)}`,
167
- failedRemove: (env: string, id: string) =>
168
- `[${env}] Unable to delete content type ${Logger.highlightText(id)}`,
169
- },
170
- components: {
171
- list: (projectId: string) =>
172
- `Components in ${Logger.highlightText(projectId)}:`,
173
- get: (projectId: string, id: string) =>
174
- `[${projectId}] Component ${Logger.highlightText(id)}`,
175
- failedGet: (projectId: string, id: string) =>
176
- `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,
177
- created: (projectId: string, id: string, status?: string) =>
178
- `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,
179
- removed: (env: string, id: string, commit: boolean) =>
180
- `[${env}] ${
181
- commit ? `Deleted` : `Will delete`
182
- } component ${Logger.highlightText(id)}`,
183
- failedRemove: (env: string, id: string) =>
184
- `[${env}] Unable to delete component ${Logger.highlightText(id)}`,
185
- },
186
- version: {
187
- set: (env: string, versionStatus: string) =>
188
- `[${env}] Content version status set to "${versionStatus}"`,
189
- invalid: (versionStatus: string) =>
190
- `Content version status "${versionStatus}" is not valid, allowed values are "published" or "latest".`,
191
- noEnv: () =>
192
- `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`,
193
- },
194
- entries: {
195
- removed: (env: string, commit: boolean) =>
196
- `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
197
- failedRemove: (env: string) => `[${env}] Unable to delete entries`,
198
- notFound: (env: string) => `[${env}] Entries were not found`,
199
- commitTip: () => ` Add --commit flag to commit the previewed changes`,
200
- },
201
- keys: {
202
- list: (env: string) => `[${env}] API keys:`,
203
- noList: (env: string) => `[${env}] Cannot retrieve API`,
204
- created: (env: string, name: string) =>
205
- `[${env}] Created API key ${Logger.highlightText(name)}`,
206
- failedCreate: (env: string, name: string) =>
207
- `[${env}] Unable to create API key ${Logger.highlightText(name)}`,
208
- removed: (env: string, id: string) =>
209
- `[${env}] Deleted API key ${Logger.highlightText(id)}`,
210
- failedRemove: (env: string, id: string) =>
211
- `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,
212
- },
213
- blocks: {
214
- runningStatus: (status: BlockRunningStatus | 'broken') => {
215
- switch (status) {
216
- case 'available':
217
- return Logger.successText(status);
218
- case 'pending':
219
- case 'starting':
220
- case 'stopped':
221
- return Logger.warningText(status);
222
- case 'degraded':
223
- case 'faulted':
224
- case 'broken':
225
- return Logger.errorText(status);
226
- default:
227
- return Logger.infoText(status);
228
- }
229
- },
230
- get: (id: string, env: string, projectId?: string) =>
231
- `[${env}] Block ${id} in project ${projectId}:`,
232
- list: (env: string, projectId?: string) =>
233
- `[${env}] Blocks in project ${projectId}:`,
234
- noList: (env: string, projectId?: string) =>
235
- `[${env}] Cannot retrieve blocks in project ${projectId}`,
236
- getLogs: (id: string, branch: string, env: string, projectId?: string) =>
237
- `[${env}] Requesting logs from block ${Logger.highlightText(
238
- id
239
- )} in branch ${branch} in project ${projectId}`,
240
- failedGetLogs: (id: string, env: string, projectId?: string) =>
241
- `[${env}] Unable to fetch block logs for ${Logger.highlightText(
242
- id
243
- )} in project ${projectId}`,
244
- tryPush: (id: string, branch: string, env: string, projectId?: string) =>
245
- `[${env}] Request to push block ${Logger.highlightText(
246
- id
247
- )} in branch ${branch} in project ${projectId}`,
248
- pushed: (id: string, branch: string, env: string, projectId?: string) =>
249
- `[${env}] Pushed block ${Logger.highlightText(
250
- id
251
- )} in branch ${branch} in project ${projectId}`,
252
- failedPush: (id: string, env: string, projectId?: string) =>
253
- `[${env}] Unable to push block ${Logger.highlightText(
254
- id
255
- )} in project ${projectId}`,
256
- released: (id: string, env: string, projectId?: string) =>
257
- `[${env}] Released block ${Logger.highlightText(
258
- id
259
- )} in project ${projectId}`,
260
- failedRelease: (id: string, env: string, projectId?: string) =>
261
- `[${env}] Unable to release block ${Logger.highlightText(
262
- id
263
- )} in project ${projectId}`,
264
- deleted: (id: string, env: string, projectId?: string) =>
265
- `[${env}] Deleted block ${Logger.highlightText(
266
- id
267
- )} in project ${projectId}`,
268
- failedDelete: (id: string, env: string, projectId?: string) =>
269
- `[${env}] Unable to delete block ${Logger.highlightText(
270
- id
271
- )} in project ${projectId}`,
272
- },
273
- webhooks: {
274
- list: (env: string) => `[${env}] Webhook subscriptions:`,
275
- noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,
276
- created: (env: string, name: string) =>
277
- `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,
278
- failedCreate: (env: string, name: string) =>
279
- `[${env}] Unable to create Webhook subscription ${Logger.highlightText(
280
- name
281
- )}`,
282
- deleted: (env: string, id: string) =>
283
- `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,
284
- failedDelete: (env: string, id: string) =>
285
- `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(
286
- id
287
- )}`,
288
- },
289
- };
1
+ import {
2
+ BlockRunningStatus,
3
+ MigrateModelsResult,
4
+ MigrateStatus,
5
+ } from 'migratortron';
6
+ import { Logger } from '~/util/logger';
7
+
8
+ export const LogMessages = {
9
+ app: {
10
+ contensis: () => 'Contensis',
11
+ quit: () => `Goodbye šŸ‘‹\n`,
12
+ startup: (version: string) =>
13
+ `v${version} Ā© 2001-${new Date().getFullYear()} Zengenti šŸ‡¬šŸ‡§. \n - Creators of Contensis and purveyors of other fine software\n\nšŸ‘‹ Welcome to the contensis-cli\n`,
14
+ help: () =>
15
+ 'Press [CTRL]+[C] or type "quit" to return to your system shell\nPress [TAB] for suggestions\n',
16
+ suggestions: () =>
17
+ `\n${Logger.errorText('>>')} Press [TAB] for suggestions\n`,
18
+ autocomplete: () => `\n${Logger.errorText('>>')} Available commands:`,
19
+ unknownError: () => `Something went wrong...`,
20
+ fileOutput: (format = 'json', path?: string) =>
21
+ `Output ${format} file: ${Logger.infoText(path)}\n`,
22
+ noFileOutput: () => `No output written\n`,
23
+ },
24
+ command: {
25
+ notKnown: (command: string) => `${command} is not known`,
26
+ },
27
+ envs: {
28
+ found: (num: number) =>
29
+ `environments store found containing ${num} environment${
30
+ num === 1 ? '' : 's'
31
+ }`,
32
+ tip: () =>
33
+ `Connect to a Contensis cloud instance using "contensis connect {cms alias}"`,
34
+ },
35
+ connect: {
36
+ command: {
37
+ name: () => 'connect',
38
+ example: () => `Example call:\n > connect example-dev`,
39
+ },
40
+ args: {
41
+ alias: {
42
+ name: () => '<alias>',
43
+ description: () => 'the Contensis Cloud alias to connect with',
44
+ },
45
+ },
46
+ noEnv: () => `Cannot connect - no environment alias specified`,
47
+ unreachable: (url: string, status: number) =>
48
+ `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,
49
+ connected: (env: string) => `Current environment set to "${env}"`,
50
+ help: () =>
51
+ `Connect to a Contensis cloud instance using "contensis connect {cms alias}"`,
52
+ projects: () => `Available projects:`,
53
+ noProjects: () => `Cannot retrieve projects list`,
54
+ tip: () =>
55
+ `Introduce yourself with "login {username}" or "login {clientId} -s {secret}" or by passing credentials as options with your command`,
56
+ },
57
+ login: {
58
+ command: {
59
+ name: () => 'login',
60
+ usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,
61
+ example: () =>
62
+ `Example call:\n > login myuserid\n -- or --\n > login {clientId} -s {sharedSecret}`,
63
+ },
64
+ args: {
65
+ user: {
66
+ name: () => '<user/clientId>',
67
+ description: () => 'the username to login with',
68
+ },
69
+ password: {
70
+ name: () => '[password]',
71
+ description: () =>
72
+ 'the password to use to login with (optional/insecure)',
73
+ },
74
+ secret: {
75
+ name: () => '-s --sharedSecret <sharedSecret>',
76
+ description: () =>
77
+ 'the shared secret to use when logging in with a client id',
78
+ },
79
+ },
80
+ passwordPrompt: (env?: string, userId?: string) =>
81
+ userId
82
+ ? `Enter password for ${userId}@${env}:`
83
+ : `Please enter a password`,
84
+ failed: (env: string, userId: string) =>
85
+ `Unable to login to ${env} as ${userId}`,
86
+ success: (env: string, userId: string) =>
87
+ `User ${userId} connected to ${env} successfully\n`,
88
+ insecurePassword: () =>
89
+ `Could not connect to local keystore - your password could be stored unencrypted!`,
90
+ noEnv: () => `No environment set, use "contensis connect {alias}" first`,
91
+ noUserId: () => `No user id specified`,
92
+ },
93
+ projects: {
94
+ list: () => `Available projects:`,
95
+ noList: () => `Cannot retrieve projects list`,
96
+ set: (projectId: string) =>
97
+ `Current project is set to ${Logger.highlightText(projectId)}`,
98
+ failedSet: (projectId: string) =>
99
+ `Project ${Logger.highlightText(projectId)} not found`,
100
+ tip: () =>
101
+ `You need to set your current working project with "set project {projectId}"`,
102
+ created: (env: string, id: string) =>
103
+ `[${env}] Created project ${Logger.highlightText(id)}`,
104
+ failedCreate: (env: string, id: string) =>
105
+ `[${env}] Unable to create project ${Logger.highlightText(id)}`,
106
+ updated: (env: string, id: string) =>
107
+ `[${env}] Updated project ${Logger.highlightText(id)}`,
108
+ failedUpdate: (env: string, id: string) =>
109
+ `[${env}] Unable to update project ${Logger.highlightText(id)}`,
110
+ },
111
+ migrate: {
112
+ models: {
113
+ result: (
114
+ status: keyof MigrateModelsResult['project']['contentTypes']
115
+ ) => {
116
+ switch (status) {
117
+ case 'created':
118
+ case 'updated':
119
+ return Logger.successText;
120
+ case 'errors':
121
+ return Logger.errorText;
122
+ default:
123
+ return Logger.infoText;
124
+ }
125
+ },
126
+ },
127
+ status: (status: MigrateStatus) => {
128
+ switch (status) {
129
+ case 'no change':
130
+ return Logger.successText;
131
+ case 'create':
132
+ case 'two-pass':
133
+ case 'update':
134
+ case 'delete':
135
+ return Logger.warningText;
136
+ case 'error':
137
+ case 'not found':
138
+ return Logger.errorText;
139
+ default:
140
+ return Logger.infoText;
141
+ }
142
+ },
143
+ },
144
+ models: {
145
+ list: (projectId: string) =>
146
+ `Content models in ${Logger.highlightText(projectId)}:`,
147
+ noList: (projectId: string) =>
148
+ `[${projectId}] Cannot retrieve content models`,
149
+ get: (projectId: string, id: string) =>
150
+ `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,
151
+ failedGet: (projectId: string, id: string) =>
152
+ `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,
153
+ },
154
+ contenttypes: {
155
+ list: (projectId: string) =>
156
+ `Content types in ${Logger.highlightText(projectId)}:`,
157
+ get: (projectId: string, id: string) =>
158
+ `[${projectId}] Content type ${Logger.highlightText(id)}`,
159
+ failedGet: (projectId: string, id: string) =>
160
+ `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,
161
+ created: (projectId: string, id: string, status?: string) =>
162
+ `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,
163
+ removed: (env: string, id: string, commit: boolean) =>
164
+ `[${env}] ${
165
+ commit ? `Deleted` : `Will delete`
166
+ } content type ${Logger.highlightText(id)}`,
167
+ failedRemove: (env: string, id: string) =>
168
+ `[${env}] Unable to delete content type ${Logger.highlightText(id)}`,
169
+ },
170
+ components: {
171
+ list: (projectId: string) =>
172
+ `Components in ${Logger.highlightText(projectId)}:`,
173
+ get: (projectId: string, id: string) =>
174
+ `[${projectId}] Component ${Logger.highlightText(id)}`,
175
+ failedGet: (projectId: string, id: string) =>
176
+ `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,
177
+ created: (projectId: string, id: string, status?: string) =>
178
+ `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,
179
+ removed: (env: string, id: string, commit: boolean) =>
180
+ `[${env}] ${
181
+ commit ? `Deleted` : `Will delete`
182
+ } component ${Logger.highlightText(id)}`,
183
+ failedRemove: (env: string, id: string) =>
184
+ `[${env}] Unable to delete component ${Logger.highlightText(id)}`,
185
+ },
186
+ version: {
187
+ set: (env: string, versionStatus: string) =>
188
+ `[${env}] Content version status set to "${versionStatus}"`,
189
+ invalid: (versionStatus: string) =>
190
+ `Content version status "${versionStatus}" is not valid, allowed values are "published" or "latest".`,
191
+ noEnv: () =>
192
+ `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`,
193
+ },
194
+ entries: {
195
+ removed: (env: string, commit: boolean) =>
196
+ `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
197
+ failedRemove: (env: string) => `[${env}] Unable to delete entries`,
198
+ notFound: (env: string) => `[${env}] Entries were not found`,
199
+ commitTip: () => ` Add --commit flag to commit the previewed changes`,
200
+ },
201
+ keys: {
202
+ list: (env: string) => `[${env}] API keys:`,
203
+ noList: (env: string) => `[${env}] Cannot retrieve API`,
204
+ created: (env: string, name: string) =>
205
+ `[${env}] Created API key ${Logger.highlightText(name)}`,
206
+ failedCreate: (env: string, name: string) =>
207
+ `[${env}] Unable to create API key ${Logger.highlightText(name)}`,
208
+ removed: (env: string, id: string) =>
209
+ `[${env}] Deleted API key ${Logger.highlightText(id)}`,
210
+ failedRemove: (env: string, id: string) =>
211
+ `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,
212
+ },
213
+ blocks: {
214
+ runningStatus: (status: BlockRunningStatus | 'broken') => {
215
+ switch (status) {
216
+ case 'available':
217
+ return Logger.successText(status);
218
+ case 'pending':
219
+ case 'starting':
220
+ case 'stopped':
221
+ return Logger.warningText(status);
222
+ case 'degraded':
223
+ case 'faulted':
224
+ case 'broken':
225
+ return Logger.errorText(status);
226
+ default:
227
+ return Logger.infoText(status);
228
+ }
229
+ },
230
+ get: (id: string, env: string, projectId?: string) =>
231
+ `[${env}] Block ${id} in project ${projectId}:`,
232
+ list: (env: string, projectId?: string) =>
233
+ `[${env}] Blocks in project ${projectId}:`,
234
+ noList: (env: string, projectId?: string) =>
235
+ `[${env}] Cannot retrieve blocks in project ${projectId}`,
236
+ getLogs: (id: string, branch: string, env: string, projectId?: string) =>
237
+ `[${env}] Requesting logs from block ${Logger.highlightText(
238
+ id
239
+ )} in branch ${branch} in project ${projectId}`,
240
+ failedGetLogs: (id: string, env: string, projectId?: string) =>
241
+ `[${env}] Unable to fetch block logs for ${Logger.highlightText(
242
+ id
243
+ )} in project ${projectId}`,
244
+ tryPush: (id: string, branch: string, env: string, projectId?: string) =>
245
+ `[${env}] Request to push block ${Logger.highlightText(
246
+ id
247
+ )} in branch ${branch} in project ${projectId}`,
248
+ pushed: (id: string, branch: string, env: string, projectId?: string) =>
249
+ `[${env}] Pushed block ${Logger.highlightText(
250
+ id
251
+ )} in branch ${branch} in project ${projectId}`,
252
+ failedPush: (id: string, env: string, projectId?: string) =>
253
+ `[${env}] Unable to push block ${Logger.highlightText(
254
+ id
255
+ )} in project ${projectId}`,
256
+ released: (id: string, env: string, projectId?: string) =>
257
+ `[${env}] Released block ${Logger.highlightText(
258
+ id
259
+ )} in project ${projectId}`,
260
+ failedRelease: (id: string, env: string, projectId?: string) =>
261
+ `[${env}] Unable to release block ${Logger.highlightText(
262
+ id
263
+ )} in project ${projectId}`,
264
+ deleted: (id: string, env: string, projectId?: string) =>
265
+ `[${env}] Deleted block ${Logger.highlightText(
266
+ id
267
+ )} in project ${projectId}`,
268
+ failedDelete: (id: string, env: string, projectId?: string) =>
269
+ `[${env}] Unable to delete block ${Logger.highlightText(
270
+ id
271
+ )} in project ${projectId}`,
272
+ },
273
+ webhooks: {
274
+ list: (env: string) => `[${env}] Webhook subscriptions:`,
275
+ noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,
276
+ created: (env: string, name: string) =>
277
+ `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,
278
+ failedCreate: (env: string, name: string) =>
279
+ `[${env}] Unable to create Webhook subscription ${Logger.highlightText(
280
+ name
281
+ )}`,
282
+ deleted: (env: string, id: string) =>
283
+ `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,
284
+ failedDelete: (env: string, id: string) =>
285
+ `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(
286
+ id
287
+ )}`,
288
+ },
289
+ };
@@ -1,40 +1,40 @@
1
- type AppError = (Error & ApiErrorResponse) | ApiErrorResponse;
2
-
3
- type InnerDataArray = [
4
- {
5
- field: string;
6
- message: string;
7
- }
8
- ];
9
-
10
- type ApiErrorResponse = {
11
- name?: string;
12
- error?: { code: string; message: string };
13
- code?: string;
14
- type?: string;
15
- timeout?: number;
16
- status?: number;
17
- statusText?: string;
18
- url?: string;
19
- data?:
20
- | {
21
- logId: string;
22
- message: string;
23
- data: InnerDataArray;
24
- type: string;
25
- }
26
- | any;
27
- };
28
-
29
- type MappedError = {
30
- status: number;
31
- statusText?: string;
32
- url?: string;
33
- message: string;
34
- name?: string;
35
- code?: string;
36
- type?: string;
37
- logId?: string;
38
- data?: InnerDataArray | any;
39
- stack?: string;
40
- };
1
+ type AppError = (Error & ApiErrorResponse) | ApiErrorResponse;
2
+
3
+ type InnerDataArray = [
4
+ {
5
+ field: string;
6
+ message: string;
7
+ }
8
+ ];
9
+
10
+ type ApiErrorResponse = {
11
+ name?: string;
12
+ error?: { code: string; message: string };
13
+ code?: string;
14
+ type?: string;
15
+ timeout?: number;
16
+ status?: number;
17
+ statusText?: string;
18
+ url?: string;
19
+ data?:
20
+ | {
21
+ logId: string;
22
+ message: string;
23
+ data: InnerDataArray;
24
+ type: string;
25
+ }
26
+ | any;
27
+ };
28
+
29
+ type MappedError = {
30
+ status: number;
31
+ statusText?: string;
32
+ url?: string;
33
+ message: string;
34
+ name?: string;
35
+ code?: string;
36
+ type?: string;
37
+ logId?: string;
38
+ data?: InnerDataArray | any;
39
+ stack?: string;
40
+ };