@contentstack/cli-audit 1.10.0 → 1.11.0
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/README.md +89 -57
- package/lib/audit-base-command.d.ts +6 -5
- package/lib/audit-base-command.js +67 -58
- package/lib/commands/cm/stacks/audit/fix.js +2 -2
- package/lib/commands/cm/stacks/audit/index.js +2 -2
- package/lib/config/index.js +26 -8
- package/lib/messages/index.d.ts +5 -0
- package/lib/messages/index.js +7 -2
- package/lib/modules/assets.d.ts +1 -1
- package/lib/modules/assets.js +1 -1
- package/lib/modules/content-types.d.ts +1 -1
- package/lib/modules/content-types.js +1 -1
- package/lib/modules/custom-roles.js +1 -1
- package/lib/modules/entries.d.ts +1 -0
- package/lib/modules/entries.js +6 -2
- package/lib/modules/extensions.js +2 -2
- package/lib/modules/field_rules.d.ts +54 -0
- package/lib/modules/field_rules.js +265 -0
- package/lib/modules/global-fields.d.ts +1 -1
- package/lib/modules/index.d.ts +2 -1
- package/lib/modules/index.js +3 -1
- package/lib/modules/workflows.js +2 -2
- package/lib/types/common.d.ts +1 -3
- package/lib/types/content-types.d.ts +17 -2
- package/lib/types/content-types.js +3 -2
- package/lib/util/flags.d.ts +3 -10
- package/lib/util/flags.js +4 -24
- package/lib/util/log.js +1 -2
- package/oclif.manifest.json +198 -105
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
|
|
|
19
19
|
$ csdx COMMAND
|
|
20
20
|
running command...
|
|
21
21
|
$ csdx (--version|-v)
|
|
22
|
-
@contentstack/cli-audit/1.
|
|
22
|
+
@contentstack/cli-audit/1.11.0 linux-x64 node-v22.14.0
|
|
23
23
|
$ csdx --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ csdx COMMAND
|
|
@@ -34,7 +34,7 @@ USAGE
|
|
|
34
34
|
* [`csdx audit:fix`](#csdx-auditfix)
|
|
35
35
|
* [`csdx cm:stacks:audit`](#csdx-cmstacksaudit)
|
|
36
36
|
* [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix)
|
|
37
|
-
* [`csdx help [
|
|
37
|
+
* [`csdx help [COMMAND]`](#csdx-help-command)
|
|
38
38
|
* [`csdx plugins`](#csdx-plugins)
|
|
39
39
|
* [`csdx plugins:add PLUGIN`](#csdx-pluginsadd-plugin)
|
|
40
40
|
* [`csdx plugins:inspect PLUGIN...`](#csdx-pluginsinspect-plugin)
|
|
@@ -52,21 +52,29 @@ Perform audits and find possible errors in the exported Contentstack data
|
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
USAGE
|
|
55
|
-
$ csdx audit [--report-path <value>] [--modules
|
|
56
|
-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets] [--columns <value>
|
|
57
|
-
<value>] [--filter <value>] [--csv
|
|
55
|
+
$ csdx audit [-c <value>] [-d <value>] [--report-path <value>] [--modules
|
|
56
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--columns <value>]
|
|
57
|
+
[--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
|
|
58
58
|
|
|
59
59
|
FLAGS
|
|
60
60
|
--modules=<option>... Provide the list of modules to be audited
|
|
61
|
-
<options:
|
|
61
|
+
<options:
|
|
62
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
|
|
62
63
|
--report-path=<value> Path to store the audit reports
|
|
63
64
|
|
|
65
|
+
COMMON FLAGS
|
|
66
|
+
-c, --config=<value> Path of the external config
|
|
67
|
+
-d, --data-dir=<value> Path where the data is stored
|
|
68
|
+
|
|
64
69
|
TABLE FLAGS
|
|
65
|
-
--columns=<value>
|
|
66
|
-
--csv
|
|
67
|
-
--filter=<value> Filter
|
|
68
|
-
--no-
|
|
69
|
-
--
|
|
70
|
+
--columns=<value> Specify columns to display, comma-separated.
|
|
71
|
+
--csv Output results in CSV format.
|
|
72
|
+
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
73
|
+
--no-header Hide table headers in output.
|
|
74
|
+
--no-truncate Prevent truncation of long text in columns.
|
|
75
|
+
--output=<option> Specify output format: csv, json, or yaml.
|
|
76
|
+
<options: csv|json|yaml>
|
|
77
|
+
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
70
78
|
|
|
71
79
|
DESCRIPTION
|
|
72
80
|
Perform audits and find possible errors in the exported Contentstack data
|
|
@@ -93,10 +101,10 @@ Perform audits and fix possible errors in the exported Contentstack data.
|
|
|
93
101
|
|
|
94
102
|
```
|
|
95
103
|
USAGE
|
|
96
|
-
$ csdx audit:fix [--report-path <value>] [--modules
|
|
97
|
-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets] [--copy-path <value>
|
|
98
|
-
[--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types] [--columns
|
|
99
|
-
[--sort <value>] [--filter <value>] [--csv
|
|
104
|
+
$ csdx audit:fix [-c <value>] [-d <value>] [--report-path <value>] [--modules
|
|
105
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--copy-path <value>
|
|
106
|
+
--copy-dir] [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns
|
|
107
|
+
<value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
|
|
100
108
|
|
|
101
109
|
FLAGS
|
|
102
110
|
--copy-dir Create backup from the original data.
|
|
@@ -104,15 +112,23 @@ FLAGS
|
|
|
104
112
|
--fix-only=<option>... Provide the list of fix options
|
|
105
113
|
<options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
|
|
106
114
|
--modules=<option>... Provide the list of modules to be audited
|
|
107
|
-
<options:
|
|
115
|
+
<options:
|
|
116
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
|
|
108
117
|
--report-path=<value> Path to store the audit reports
|
|
109
118
|
|
|
119
|
+
COMMON FLAGS
|
|
120
|
+
-c, --config=<value> Path of the external config
|
|
121
|
+
-d, --data-dir=<value> Path where the data is stored
|
|
122
|
+
|
|
110
123
|
TABLE FLAGS
|
|
111
|
-
--columns=<value>
|
|
112
|
-
--csv
|
|
113
|
-
--filter=<value> Filter
|
|
114
|
-
--no-
|
|
115
|
-
--
|
|
124
|
+
--columns=<value> Specify columns to display, comma-separated.
|
|
125
|
+
--csv Output results in CSV format.
|
|
126
|
+
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
127
|
+
--no-header Hide table headers in output.
|
|
128
|
+
--no-truncate Prevent truncation of long text in columns.
|
|
129
|
+
--output=<option> Specify output format: csv, json, or yaml.
|
|
130
|
+
<options: csv|json|yaml>
|
|
131
|
+
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
116
132
|
|
|
117
133
|
DESCRIPTION
|
|
118
134
|
Perform audits and fix possible errors in the exported Contentstack data.
|
|
@@ -141,21 +157,29 @@ Perform audits and find possible errors in the exported Contentstack data
|
|
|
141
157
|
|
|
142
158
|
```
|
|
143
159
|
USAGE
|
|
144
|
-
$ csdx cm:stacks:audit [--report-path <value>] [--modules
|
|
145
|
-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets] [--columns <value>
|
|
146
|
-
<value>] [--filter <value>] [--csv
|
|
160
|
+
$ csdx cm:stacks:audit [-c <value>] [-d <value>] [--report-path <value>] [--modules
|
|
161
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--columns <value>]
|
|
162
|
+
[--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
|
|
147
163
|
|
|
148
164
|
FLAGS
|
|
149
165
|
--modules=<option>... Provide the list of modules to be audited
|
|
150
|
-
<options:
|
|
166
|
+
<options:
|
|
167
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
|
|
151
168
|
--report-path=<value> Path to store the audit reports
|
|
152
169
|
|
|
170
|
+
COMMON FLAGS
|
|
171
|
+
-c, --config=<value> Path of the external config
|
|
172
|
+
-d, --data-dir=<value> Path where the data is stored
|
|
173
|
+
|
|
153
174
|
TABLE FLAGS
|
|
154
|
-
--columns=<value>
|
|
155
|
-
--csv
|
|
156
|
-
--filter=<value> Filter
|
|
157
|
-
--no-
|
|
158
|
-
--
|
|
175
|
+
--columns=<value> Specify columns to display, comma-separated.
|
|
176
|
+
--csv Output results in CSV format.
|
|
177
|
+
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
178
|
+
--no-header Hide table headers in output.
|
|
179
|
+
--no-truncate Prevent truncation of long text in columns.
|
|
180
|
+
--output=<option> Specify output format: csv, json, or yaml.
|
|
181
|
+
<options: csv|json|yaml>
|
|
182
|
+
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
159
183
|
|
|
160
184
|
DESCRIPTION
|
|
161
185
|
Perform audits and find possible errors in the exported Contentstack data
|
|
@@ -184,10 +208,10 @@ Perform audits and fix possible errors in the exported Contentstack data.
|
|
|
184
208
|
|
|
185
209
|
```
|
|
186
210
|
USAGE
|
|
187
|
-
$ csdx cm:stacks:audit:fix [--report-path <value>] [--modules
|
|
188
|
-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets] [--copy-path <value>
|
|
189
|
-
[--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types] [--columns
|
|
190
|
-
[--sort <value>] [--filter <value>] [--csv
|
|
211
|
+
$ csdx cm:stacks:audit:fix [-c <value>] [-d <value>] [--report-path <value>] [--modules
|
|
212
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--copy-path <value>
|
|
213
|
+
--copy-dir] [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns
|
|
214
|
+
<value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
|
|
191
215
|
|
|
192
216
|
FLAGS
|
|
193
217
|
--copy-dir Create backup from the original data.
|
|
@@ -195,15 +219,23 @@ FLAGS
|
|
|
195
219
|
--fix-only=<option>... Provide the list of fix options
|
|
196
220
|
<options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
|
|
197
221
|
--modules=<option>... Provide the list of modules to be audited
|
|
198
|
-
<options:
|
|
222
|
+
<options:
|
|
223
|
+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
|
|
199
224
|
--report-path=<value> Path to store the audit reports
|
|
200
225
|
|
|
226
|
+
COMMON FLAGS
|
|
227
|
+
-c, --config=<value> Path of the external config
|
|
228
|
+
-d, --data-dir=<value> Path where the data is stored
|
|
229
|
+
|
|
201
230
|
TABLE FLAGS
|
|
202
|
-
--columns=<value>
|
|
203
|
-
--csv
|
|
204
|
-
--filter=<value> Filter
|
|
205
|
-
--no-
|
|
206
|
-
--
|
|
231
|
+
--columns=<value> Specify columns to display, comma-separated.
|
|
232
|
+
--csv Output results in CSV format.
|
|
233
|
+
--filter=<value> Filter rows by a column value (e.g., name=foo).
|
|
234
|
+
--no-header Hide table headers in output.
|
|
235
|
+
--no-truncate Prevent truncation of long text in columns.
|
|
236
|
+
--output=<option> Specify output format: csv, json, or yaml.
|
|
237
|
+
<options: csv|json|yaml>
|
|
238
|
+
--sort=<value> Sort the table by a column. Use "-" for descending.
|
|
207
239
|
|
|
208
240
|
DESCRIPTION
|
|
209
241
|
Perform audits and fix possible errors in the exported Contentstack data.
|
|
@@ -228,16 +260,16 @@ EXAMPLES
|
|
|
228
260
|
|
|
229
261
|
_See code: [src/commands/cm/stacks/audit/fix.ts](https://github.com/contentstack/audit/blob/main/packages/contentstack-audit/src/commands/cm/stacks/audit/fix.ts)_
|
|
230
262
|
|
|
231
|
-
## `csdx help [
|
|
263
|
+
## `csdx help [COMMAND]`
|
|
232
264
|
|
|
233
265
|
Display help for csdx.
|
|
234
266
|
|
|
235
267
|
```
|
|
236
268
|
USAGE
|
|
237
|
-
$ csdx help [
|
|
269
|
+
$ csdx help [COMMAND...] [-n]
|
|
238
270
|
|
|
239
271
|
ARGUMENTS
|
|
240
|
-
|
|
272
|
+
COMMAND... Command to show help for.
|
|
241
273
|
|
|
242
274
|
FLAGS
|
|
243
275
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -246,7 +278,7 @@ DESCRIPTION
|
|
|
246
278
|
Display help for csdx.
|
|
247
279
|
```
|
|
248
280
|
|
|
249
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/
|
|
281
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.27/src/commands/help.ts)_
|
|
250
282
|
|
|
251
283
|
## `csdx plugins`
|
|
252
284
|
|
|
@@ -277,10 +309,10 @@ Installs a plugin into csdx.
|
|
|
277
309
|
|
|
278
310
|
```
|
|
279
311
|
USAGE
|
|
280
|
-
$ csdx plugins:add PLUGIN [--json] [-f] [-h] [-s | -v]
|
|
312
|
+
$ csdx plugins:add PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
281
313
|
|
|
282
314
|
ARGUMENTS
|
|
283
|
-
PLUGIN Plugin to install.
|
|
315
|
+
PLUGIN... Plugin to install.
|
|
284
316
|
|
|
285
317
|
FLAGS
|
|
286
318
|
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
@@ -327,7 +359,7 @@ USAGE
|
|
|
327
359
|
$ csdx plugins:inspect PLUGIN...
|
|
328
360
|
|
|
329
361
|
ARGUMENTS
|
|
330
|
-
PLUGIN [default: .] Plugin to inspect.
|
|
362
|
+
PLUGIN... [default: .] Plugin to inspect.
|
|
331
363
|
|
|
332
364
|
FLAGS
|
|
333
365
|
-h, --help Show CLI help.
|
|
@@ -351,10 +383,10 @@ Installs a plugin into csdx.
|
|
|
351
383
|
|
|
352
384
|
```
|
|
353
385
|
USAGE
|
|
354
|
-
$ csdx plugins:install PLUGIN [--json] [-f] [-h] [-s | -v]
|
|
386
|
+
$ csdx plugins:install PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
355
387
|
|
|
356
388
|
ARGUMENTS
|
|
357
|
-
PLUGIN Plugin to install.
|
|
389
|
+
PLUGIN... Plugin to install.
|
|
358
390
|
|
|
359
391
|
FLAGS
|
|
360
392
|
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
@@ -406,9 +438,9 @@ ARGUMENTS
|
|
|
406
438
|
PATH [default: .] path to plugin
|
|
407
439
|
|
|
408
440
|
FLAGS
|
|
409
|
-
-h, --help
|
|
441
|
+
-h, --help Show CLI help.
|
|
410
442
|
-v, --verbose
|
|
411
|
-
|
|
443
|
+
--[no-]install Install dependencies after linking the plugin.
|
|
412
444
|
|
|
413
445
|
DESCRIPTION
|
|
414
446
|
Links a plugin into the CLI for development.
|
|
@@ -431,10 +463,10 @@ Removes a plugin from the CLI.
|
|
|
431
463
|
|
|
432
464
|
```
|
|
433
465
|
USAGE
|
|
434
|
-
$ csdx plugins:remove [PLUGIN] [-h] [-v]
|
|
466
|
+
$ csdx plugins:remove [PLUGIN...] [-h] [-v]
|
|
435
467
|
|
|
436
468
|
ARGUMENTS
|
|
437
|
-
PLUGIN plugin to uninstall
|
|
469
|
+
PLUGIN... plugin to uninstall
|
|
438
470
|
|
|
439
471
|
FLAGS
|
|
440
472
|
-h, --help Show CLI help.
|
|
@@ -472,10 +504,10 @@ Removes a plugin from the CLI.
|
|
|
472
504
|
|
|
473
505
|
```
|
|
474
506
|
USAGE
|
|
475
|
-
$ csdx plugins:uninstall [PLUGIN] [-h] [-v]
|
|
507
|
+
$ csdx plugins:uninstall [PLUGIN...] [-h] [-v]
|
|
476
508
|
|
|
477
509
|
ARGUMENTS
|
|
478
|
-
PLUGIN plugin to uninstall
|
|
510
|
+
PLUGIN... plugin to uninstall
|
|
479
511
|
|
|
480
512
|
FLAGS
|
|
481
513
|
-h, --help Show CLI help.
|
|
@@ -500,10 +532,10 @@ Removes a plugin from the CLI.
|
|
|
500
532
|
|
|
501
533
|
```
|
|
502
534
|
USAGE
|
|
503
|
-
$ csdx plugins:unlink [PLUGIN] [-h] [-v]
|
|
535
|
+
$ csdx plugins:unlink [PLUGIN...] [-h] [-v]
|
|
504
536
|
|
|
505
537
|
ARGUMENTS
|
|
506
|
-
PLUGIN plugin to uninstall
|
|
538
|
+
PLUGIN... plugin to uninstall
|
|
507
539
|
|
|
508
540
|
FLAGS
|
|
509
541
|
-h, --help Show CLI help.
|
|
@@ -24,8 +24,8 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
|
|
|
24
24
|
* and `missingEntryRefs`.
|
|
25
25
|
*/
|
|
26
26
|
scanAndFix(): Promise<{
|
|
27
|
-
missingCtRefs: Record<string, any> | undefined;
|
|
28
|
-
missingGfRefs: Record<string, any> | undefined;
|
|
27
|
+
missingCtRefs: Record<string, any> | ContentTypeStruct[] | undefined;
|
|
28
|
+
missingGfRefs: Record<string, any> | ContentTypeStruct[] | undefined;
|
|
29
29
|
missingEntryRefs: Record<string, any> | undefined;
|
|
30
30
|
missingCtRefsInExtensions: {} | undefined;
|
|
31
31
|
missingCtRefsInWorkflow: {} | undefined;
|
|
@@ -33,8 +33,9 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
|
|
|
33
33
|
missingMandatoryFields: Record<string, any> | undefined;
|
|
34
34
|
missingTitleFields: Record<string, any> | undefined;
|
|
35
35
|
missingRefInCustomRoles: {} | undefined;
|
|
36
|
-
missingEnvLocalesInAssets: Record<string, any> | undefined;
|
|
36
|
+
missingEnvLocalesInAssets: Record<string, any> | ContentTypeStruct[] | undefined;
|
|
37
37
|
missingEnvLocalesInEntries: Record<string, any> | undefined;
|
|
38
|
+
missingFieldRules: Record<string, any> | undefined;
|
|
38
39
|
missingMultipleFields: Record<string, any> | undefined;
|
|
39
40
|
}>;
|
|
40
41
|
/**
|
|
@@ -81,7 +82,7 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
|
|
|
81
82
|
* reference name and the value represents additional information about the missing reference.
|
|
82
83
|
* @returns The function `prepareReport` returns a Promise that resolves to `void`.
|
|
83
84
|
*/
|
|
84
|
-
prepareReport(moduleName: keyof typeof config.moduleConfig | keyof typeof config.ReportTitleForEntries, listOfMissingRefs: Record<string, any>): Promise<void>;
|
|
85
|
+
prepareReport(moduleName: keyof typeof config.moduleConfig | keyof typeof config.ReportTitleForEntries | 'field-rules', listOfMissingRefs: Record<string, any>): Promise<void>;
|
|
85
86
|
/**
|
|
86
87
|
* The function `prepareCSV` takes a module name and a list of missing references, and generates a
|
|
87
88
|
* CSV file with the specified columns and filtered rows.
|
|
@@ -92,5 +93,5 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
|
|
|
92
93
|
* corresponding value is an array of objects that contain details about the missing reference.
|
|
93
94
|
* @returns The function `prepareCSV` returns a Promise that resolves to `void`.
|
|
94
95
|
*/
|
|
95
|
-
prepareCSV(moduleName: keyof typeof config.moduleConfig | keyof typeof config.ReportTitleForEntries, listOfMissingRefs: Record<string, any>): Promise<void>;
|
|
96
|
+
prepareCSV(moduleName: keyof typeof config.moduleConfig | keyof typeof config.ReportTitleForEntries | 'field-rules', listOfMissingRefs: Record<string, any>): Promise<void>;
|
|
96
97
|
}
|
|
@@ -41,7 +41,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
41
41
|
await this.promptQueue();
|
|
42
42
|
await this.createBackUp();
|
|
43
43
|
this.sharedConfig.reportPath = (0, path_1.resolve)(this.flags['report-path'] || process.cwd(), 'audit-report');
|
|
44
|
-
const { missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries, missingMultipleFields } = await this.scanAndFix();
|
|
44
|
+
const { missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries, missingFieldRules, missingMultipleFields } = await this.scanAndFix();
|
|
45
45
|
this.showOutputOnScreen([
|
|
46
46
|
{ module: 'Content types', missingRefs: missingCtRefs },
|
|
47
47
|
{ module: 'Global Fields', missingRefs: missingGfRefs },
|
|
@@ -53,12 +53,11 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
53
53
|
this.showOutputOnScreenWorkflowsAndExtension([
|
|
54
54
|
{ module: 'Entries Mandatory Field', missingRefs: missingMandatoryFields },
|
|
55
55
|
]);
|
|
56
|
-
this.showOutputOnScreenWorkflowsAndExtension([
|
|
57
|
-
{ module: 'Entries Title Field', missingRefs: missingTitleFields },
|
|
58
|
-
]);
|
|
56
|
+
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Entries Title Field', missingRefs: missingTitleFields }]);
|
|
59
57
|
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Custom Roles', missingRefs: missingRefInCustomRoles }]);
|
|
60
58
|
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Assets', missingRefs: missingEnvLocalesInAssets }]);
|
|
61
59
|
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Entries Missing Locale and Environments', missingRefs: missingEnvLocalesInEntries }]);
|
|
60
|
+
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Field Rules', missingRefs: missingFieldRules }]);
|
|
62
61
|
this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Entries Changed Multiple Fields', missingRefs: missingMultipleFields }]);
|
|
63
62
|
if (!(0, isEmpty_1.default)(missingCtRefs) ||
|
|
64
63
|
!(0, isEmpty_1.default)(missingGfRefs) ||
|
|
@@ -70,6 +69,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
70
69
|
!(0, isEmpty_1.default)(missingRefInCustomRoles) ||
|
|
71
70
|
!(0, isEmpty_1.default)(missingEnvLocalesInAssets) ||
|
|
72
71
|
!(0, isEmpty_1.default)(missingEnvLocalesInEntries) ||
|
|
72
|
+
!(0, isEmpty_1.default)(missingFieldRules) ||
|
|
73
73
|
!(0, isEmpty_1.default)(missingMultipleFields)) {
|
|
74
74
|
if (this.currentCommand === 'cm:stacks:audit') {
|
|
75
75
|
this.log(this.$t(messages_1.auditMsg.FINAL_REPORT_PATH, { path: this.sharedConfig.reportPath }), 'warn');
|
|
@@ -96,7 +96,8 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
96
96
|
!(0, isEmpty_1.default)(missingSelectFeild) ||
|
|
97
97
|
!(0, isEmpty_1.default)(missingRefInCustomRoles) ||
|
|
98
98
|
!(0, isEmpty_1.default)(missingEnvLocalesInAssets) ||
|
|
99
|
-
!(0, isEmpty_1.default)(missingEnvLocalesInEntries)
|
|
99
|
+
!(0, isEmpty_1.default)(missingEnvLocalesInEntries) ||
|
|
100
|
+
!(0, isEmpty_1.default)(missingFieldRules));
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
102
103
|
* The `scan` function performs an audit on different modules (content-types, global-fields, and
|
|
@@ -107,7 +108,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
107
108
|
async scanAndFix() {
|
|
108
109
|
var _a, _b, _c, _d, _e, _f;
|
|
109
110
|
let { ctSchema, gfSchema } = this.getCtAndGfSchema();
|
|
110
|
-
let missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingEntry, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries, missingMultipleFields;
|
|
111
|
+
let missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingEntry, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries, missingFieldRules, missingMultipleFields;
|
|
111
112
|
for (const module of this.sharedConfig.flags.modules || this.sharedConfig.modules) {
|
|
112
113
|
(0, log_1.print)([
|
|
113
114
|
{
|
|
@@ -170,6 +171,10 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
170
171
|
missingRefInCustomRoles = await new custom_roles_1.default((0, cloneDeep_1.default)(constructorParam)).run();
|
|
171
172
|
await this.prepareReport(module, missingRefInCustomRoles);
|
|
172
173
|
break;
|
|
174
|
+
case 'field-rules':
|
|
175
|
+
missingFieldRules = await new modules_1.FieldRule((0, cloneDeep_1.default)(constructorParam)).run();
|
|
176
|
+
await this.prepareReport(module, missingFieldRules);
|
|
177
|
+
break;
|
|
173
178
|
}
|
|
174
179
|
(0, log_1.print)([
|
|
175
180
|
{
|
|
@@ -196,6 +201,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
196
201
|
missingRefInCustomRoles,
|
|
197
202
|
missingEnvLocalesInAssets,
|
|
198
203
|
missingEnvLocalesInEntries,
|
|
204
|
+
missingFieldRules,
|
|
199
205
|
missingMultipleFields
|
|
200
206
|
};
|
|
201
207
|
}
|
|
@@ -253,7 +259,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
253
259
|
* objects, where each object has two properties:
|
|
254
260
|
*/
|
|
255
261
|
showOutputOnScreen(allMissingRefs) {
|
|
256
|
-
var _a
|
|
262
|
+
var _a;
|
|
257
263
|
if (this.sharedConfig.showTerminalOutput && !((_a = this.flags['external-config']) === null || _a === void 0 ? void 0 : _a.noTerminalOutput)) {
|
|
258
264
|
this.log(''); // NOTE adding new line
|
|
259
265
|
for (const { module, missingRefs } of allMissingRefs) {
|
|
@@ -266,31 +272,40 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
266
272
|
},
|
|
267
273
|
]);
|
|
268
274
|
const tableValues = Object.values(missingRefs).flat();
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
275
|
+
const tableHeaders = [
|
|
276
|
+
{
|
|
277
|
+
value: 'name',
|
|
278
|
+
alias: 'Title',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
value: 'ct',
|
|
282
|
+
alias: 'Content Type',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
value: 'locale',
|
|
286
|
+
alias: 'Locale',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
value: 'display_name',
|
|
290
|
+
alias: 'Field name',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
value: 'data_type',
|
|
294
|
+
alias: 'Field type',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
value: 'missingRefs',
|
|
298
|
+
alias: 'Missing references',
|
|
299
|
+
formatter: (cellValue) => {
|
|
300
|
+
return chalk_1.default.red(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
|
|
289
301
|
},
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
value: 'treeStr',
|
|
305
|
+
alias: 'Path',
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
cli_utilities_1.cliux.table(tableHeaders, tableValues, Object.assign({}, this.flags));
|
|
294
309
|
this.log(''); // NOTE adding new line
|
|
295
310
|
}
|
|
296
311
|
}
|
|
@@ -311,33 +326,27 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
311
326
|
const tableValues = Object.values(missingRefs).flat();
|
|
312
327
|
missingRefs = Object.values(missingRefs).flat();
|
|
313
328
|
const tableKeys = Object.keys(missingRefs[0]);
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
return {};
|
|
338
|
-
});
|
|
339
|
-
const mergedObject = Object.assign({}, ...arrayOfObjects);
|
|
340
|
-
cli_utilities_1.ux.table(tableValues, mergedObject, Object.assign({}, this.flags));
|
|
329
|
+
const tableHeaders = tableKeys
|
|
330
|
+
.filter((key) => config_1.default.OutputTableKeys.includes(key)) // Remove invalid keys early
|
|
331
|
+
.map((key) => ({
|
|
332
|
+
value: key,
|
|
333
|
+
formatter: (cellValue) => {
|
|
334
|
+
if (key === 'fixStatus') {
|
|
335
|
+
return chalk_1.default.green(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
|
|
336
|
+
}
|
|
337
|
+
else if (key === 'content_types' ||
|
|
338
|
+
key === 'branches' ||
|
|
339
|
+
key === 'missingCTSelectFieldValues' ||
|
|
340
|
+
key === 'missingFieldUid' ||
|
|
341
|
+
key === 'action') {
|
|
342
|
+
return chalk_1.default.red(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
return chalk_1.default.white(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
}));
|
|
349
|
+
cli_utilities_1.cliux.table(tableHeaders, tableValues, Object.assign({}, this.flags));
|
|
341
350
|
this.log(''); // Adding a new line
|
|
342
351
|
}
|
|
343
352
|
}
|
|
@@ -28,7 +28,6 @@ class AuditFix extends audit_base_command_1.AuditBaseCommand {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
exports.default = AuditFix;
|
|
32
31
|
AuditFix.aliases = ['audit:fix', 'cm:stacks:audit:fix'];
|
|
33
32
|
AuditFix.description = messages_1.auditFixMsg.AUDIT_FIX_CMD_DESCRIPTION;
|
|
34
33
|
AuditFix.examples = [
|
|
@@ -61,4 +60,5 @@ AuditFix.flags = Object.assign({ 'report-path': cli_utilities_1.Flags.string({
|
|
|
61
60
|
char: 'y',
|
|
62
61
|
hidden: true,
|
|
63
62
|
description: 'Use this flag to skip confirmation',
|
|
64
|
-
}), 'external-config': jsonFlag() },
|
|
63
|
+
}), 'external-config': jsonFlag() }, util_1.tableFlags);
|
|
64
|
+
exports.default = AuditFix;
|
|
@@ -23,7 +23,6 @@ class Audit extends audit_base_command_1.AuditBaseCommand {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
exports.default = Audit;
|
|
27
26
|
Audit.aliases = ['audit', 'cm:stacks:audit'];
|
|
28
27
|
Audit.description = messages_1.auditMsg.AUDIT_CMD_DESCRIPTION;
|
|
29
28
|
Audit.examples = [
|
|
@@ -42,4 +41,5 @@ Audit.flags = Object.assign({ 'report-path': cli_utilities_1.Flags.string({
|
|
|
42
41
|
multiple: true,
|
|
43
42
|
options: config_1.default.modules,
|
|
44
43
|
description: messages_1.auditMsg.MODULES,
|
|
45
|
-
}) },
|
|
44
|
+
}) }, util_1.tableFlags);
|
|
45
|
+
exports.default = Audit;
|
package/lib/config/index.js
CHANGED
|
@@ -4,7 +4,16 @@ const config = {
|
|
|
4
4
|
showTerminalOutput: true,
|
|
5
5
|
skipRefs: ['sys_assets'],
|
|
6
6
|
skipFieldTypes: ['taxonomy', 'group'],
|
|
7
|
-
modules: [
|
|
7
|
+
modules: [
|
|
8
|
+
'content-types',
|
|
9
|
+
'global-fields',
|
|
10
|
+
'entries',
|
|
11
|
+
'extensions',
|
|
12
|
+
'workflows',
|
|
13
|
+
'custom-roles',
|
|
14
|
+
'assets',
|
|
15
|
+
'field-rules',
|
|
16
|
+
],
|
|
8
17
|
'fix-fields': ['reference', 'global_field', 'json:rte', 'json:extension', 'blocks', 'group', 'content_types'],
|
|
9
18
|
moduleConfig: {
|
|
10
19
|
'content-types': {
|
|
@@ -42,16 +51,16 @@ const config = {
|
|
|
42
51
|
dirName: 'custom-roles',
|
|
43
52
|
fileName: 'custom-roles.json',
|
|
44
53
|
},
|
|
45
|
-
|
|
54
|
+
assets: {
|
|
46
55
|
name: 'assets',
|
|
47
56
|
dirName: 'assets',
|
|
48
57
|
fileName: 'assets.json',
|
|
49
58
|
},
|
|
50
|
-
|
|
59
|
+
environments: {
|
|
51
60
|
name: 'environments',
|
|
52
61
|
dirName: 'environments',
|
|
53
62
|
fileName: 'environments.json',
|
|
54
|
-
}
|
|
63
|
+
},
|
|
55
64
|
},
|
|
56
65
|
entries: {
|
|
57
66
|
systemKeys: [
|
|
@@ -96,7 +105,9 @@ const config = {
|
|
|
96
105
|
'publish_locale',
|
|
97
106
|
'publish_environment',
|
|
98
107
|
'asset_uid',
|
|
99
|
-
'selectedValue'
|
|
108
|
+
'selectedValue',
|
|
109
|
+
'ct_uid',
|
|
110
|
+
'action',
|
|
100
111
|
],
|
|
101
112
|
ReportTitleForEntries: {
|
|
102
113
|
Entries_Select_feild: 'Entries_Select_feild',
|
|
@@ -104,9 +115,16 @@ const config = {
|
|
|
104
115
|
Entries_Title_feild: 'Entries_Title_feild',
|
|
105
116
|
Entry_Missing_Locale_and_Env: 'Entry_Missing_Locale_and_Env',
|
|
106
117
|
Entry_Missing_Locale_and_Env_in_Publish_Details: 'Entry_Missing_Locale_and_Env_in_Publish_Details',
|
|
107
|
-
Entry_Multiple_Fields:
|
|
118
|
+
Entry_Multiple_Fields: "Entry_Multiple_Fields"
|
|
108
119
|
},
|
|
109
|
-
feild_level_modules: [
|
|
110
|
-
|
|
120
|
+
feild_level_modules: [
|
|
121
|
+
'Entries_Title_feild',
|
|
122
|
+
'Entries_Mandatory_feild',
|
|
123
|
+
'Entries_Select_feild',
|
|
124
|
+
'Entry_Missing_Locale_and_Env_in_Publish_Details',
|
|
125
|
+
'field-rules',
|
|
126
|
+
'Entry_Multiple_Fields'
|
|
127
|
+
],
|
|
128
|
+
fixSelectField: false,
|
|
111
129
|
};
|
|
112
130
|
exports.default = config;
|
package/lib/messages/index.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ declare const auditMsg: {
|
|
|
38
38
|
CT_REFERENCE_FIELD: string;
|
|
39
39
|
ASSET_NOT_EXIST: string;
|
|
40
40
|
ENTRY_PUBLISH_DETAILS_NOT_EXIST: string;
|
|
41
|
+
FIELD_RULE_CONDITION_ABSENT: string;
|
|
42
|
+
FIELD_RULE_TARGET_ABSENT: string;
|
|
43
|
+
FIELD_RULE_CONDITION_SCAN_MESSAGE: string;
|
|
44
|
+
FIELD_RULE_TARGET_SCAN_MESSAGE: string;
|
|
41
45
|
};
|
|
42
46
|
declare const auditFixMsg: {
|
|
43
47
|
COPY_DATA: string;
|
|
@@ -50,6 +54,7 @@ declare const auditFixMsg: {
|
|
|
50
54
|
ENTRY_MANDATORY_FIELD_FIX: string;
|
|
51
55
|
ENTRY_SELECT_FIELD_FIX: string;
|
|
52
56
|
ASSET_FIX: string;
|
|
57
|
+
FIELD_RULE_FIX_MESSAGE: string;
|
|
53
58
|
};
|
|
54
59
|
declare const messages: typeof errors & typeof commonMsg & typeof auditMsg & typeof auditFixMsg & typeof tableColumnDescriptions;
|
|
55
60
|
/**
|