@contentstack/cli-audit 1.9.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 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.9.0 linux-x64 node-v22.14.0
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 [COMMANDS]`](#csdx-help-commands)
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> | ] [--sort
57
- <value>] [--filter <value>] [--csv | --no-truncate]
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: content-types|global-fields|entries|extensions|workflows|custom-roles|assets>
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> Show only the specified columns (comma-separated)
66
- --csv The output is in the CSV format [alias: --output=csv]
67
- --filter=<value> Filter property by partial string matching. For example: name=foo
68
- --no-truncate The output is not truncated to fit the screen
69
- --sort=<value> Property to sort by (prepend '-' for descending)
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> --copy-dir]
98
- [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types] [--columns <value> | ]
99
- [--sort <value>] [--filter <value>] [--csv | --no-truncate]
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: content-types|global-fields|entries|extensions|workflows|custom-roles|assets>
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> Show only the specified columns (comma-separated)
112
- --csv The output is in the CSV format [alias: --output=csv]
113
- --filter=<value> Filter property by partial string matching. For example: name=foo
114
- --no-truncate The output is not truncated to fit the screen
115
- --sort=<value> Property to sort by (prepend '-' for descending)
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> | ] [--sort
146
- <value>] [--filter <value>] [--csv | --no-truncate]
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: content-types|global-fields|entries|extensions|workflows|custom-roles|assets>
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> Show only the specified columns (comma-separated)
155
- --csv The output is in the CSV format [alias: --output=csv]
156
- --filter=<value> Filter property by partial string matching. For example: name=foo
157
- --no-truncate The output is not truncated to fit the screen
158
- --sort=<value> Property to sort by (prepend '-' for descending)
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> --copy-dir]
189
- [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types] [--columns <value> | ]
190
- [--sort <value>] [--filter <value>] [--csv | --no-truncate]
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: content-types|global-fields|entries|extensions|workflows|custom-roles|assets>
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> Show only the specified columns (comma-separated)
203
- --csv The output is in the CSV format [alias: --output=csv]
204
- --filter=<value> Filter property by partial string matching. For example: name=foo
205
- --no-truncate The output is not truncated to fit the screen
206
- --sort=<value> Property to sort by (prepend '-' for descending)
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 [COMMANDS]`
263
+ ## `csdx help [COMMAND]`
232
264
 
233
265
  Display help for csdx.
234
266
 
235
267
  ```
236
268
  USAGE
237
- $ csdx help [COMMANDS] [-n]
269
+ $ csdx help [COMMAND...] [-n]
238
270
 
239
271
  ARGUMENTS
240
- COMMANDS Command to show help for.
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/v5.2.20/src/commands/help.ts)_
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 Show CLI help.
441
+ -h, --help Show CLI help.
410
442
  -v, --verbose
411
- --[no-]install Install dependencies after linking the plugin.
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,10 @@ 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;
39
+ missingMultipleFields: Record<string, any> | undefined;
38
40
  }>;
39
41
  /**
40
42
  * The `promptQueue` function prompts the user to enter a data directory path if the `data-dir` flag
@@ -80,7 +82,7 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
80
82
  * reference name and the value represents additional information about the missing reference.
81
83
  * @returns The function `prepareReport` returns a Promise that resolves to `void`.
82
84
  */
83
- 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>;
84
86
  /**
85
87
  * The function `prepareCSV` takes a module name and a list of missing references, and generates a
86
88
  * CSV file with the specified columns and filtered rows.
@@ -91,5 +93,5 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
91
93
  * corresponding value is an array of objects that contain details about the missing reference.
92
94
  * @returns The function `prepareCSV` returns a Promise that resolves to `void`.
93
95
  */
94
- 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>;
95
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 } = 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,12 @@ 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 }]);
61
+ this.showOutputOnScreenWorkflowsAndExtension([{ module: 'Entries Changed Multiple Fields', missingRefs: missingMultipleFields }]);
62
62
  if (!(0, isEmpty_1.default)(missingCtRefs) ||
63
63
  !(0, isEmpty_1.default)(missingGfRefs) ||
64
64
  !(0, isEmpty_1.default)(missingEntryRefs) ||
@@ -68,7 +68,9 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
68
68
  !(0, isEmpty_1.default)(missingTitleFields) ||
69
69
  !(0, isEmpty_1.default)(missingRefInCustomRoles) ||
70
70
  !(0, isEmpty_1.default)(missingEnvLocalesInAssets) ||
71
- !(0, isEmpty_1.default)(missingEnvLocalesInEntries)) {
71
+ !(0, isEmpty_1.default)(missingEnvLocalesInEntries) ||
72
+ !(0, isEmpty_1.default)(missingFieldRules) ||
73
+ !(0, isEmpty_1.default)(missingMultipleFields)) {
72
74
  if (this.currentCommand === 'cm:stacks:audit') {
73
75
  this.log(this.$t(messages_1.auditMsg.FINAL_REPORT_PATH, { path: this.sharedConfig.reportPath }), 'warn');
74
76
  }
@@ -94,7 +96,8 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
94
96
  !(0, isEmpty_1.default)(missingSelectFeild) ||
95
97
  !(0, isEmpty_1.default)(missingRefInCustomRoles) ||
96
98
  !(0, isEmpty_1.default)(missingEnvLocalesInAssets) ||
97
- !(0, isEmpty_1.default)(missingEnvLocalesInEntries));
99
+ !(0, isEmpty_1.default)(missingEnvLocalesInEntries) ||
100
+ !(0, isEmpty_1.default)(missingFieldRules));
98
101
  }
99
102
  /**
100
103
  * The `scan` function performs an audit on different modules (content-types, global-fields, and
@@ -103,9 +106,9 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
103
106
  * and `missingEntryRefs`.
104
107
  */
105
108
  async scanAndFix() {
106
- var _a, _b, _c, _d, _e;
109
+ var _a, _b, _c, _d, _e, _f;
107
110
  let { ctSchema, gfSchema } = this.getCtAndGfSchema();
108
- let missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingEntry, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries;
111
+ let missingCtRefs, missingGfRefs, missingEntryRefs, missingCtRefsInExtensions, missingCtRefsInWorkflow, missingSelectFeild, missingEntry, missingMandatoryFields, missingTitleFields, missingRefInCustomRoles, missingEnvLocalesInAssets, missingEnvLocalesInEntries, missingFieldRules, missingMultipleFields;
109
112
  for (const module of this.sharedConfig.flags.modules || this.sharedConfig.modules) {
110
113
  (0, log_1.print)([
111
114
  {
@@ -142,11 +145,13 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
142
145
  missingMandatoryFields = (_c = missingEntry.missingMandatoryFields) !== null && _c !== void 0 ? _c : {};
143
146
  missingTitleFields = (_d = missingEntry.missingTitleFields) !== null && _d !== void 0 ? _d : {};
144
147
  missingEnvLocalesInEntries = (_e = missingEntry.missingEnvLocale) !== null && _e !== void 0 ? _e : {};
148
+ missingMultipleFields = (_f = missingEntry.missingMultipleFields) !== null && _f !== void 0 ? _f : {};
145
149
  await this.prepareReport(module, missingEntryRefs);
146
150
  await this.prepareReport(`Entries_Select_feild`, missingSelectFeild);
147
151
  await this.prepareReport('Entries_Mandatory_feild', missingMandatoryFields);
148
152
  await this.prepareReport('Entries_Title_feild', missingTitleFields);
149
153
  await this.prepareReport('Entry_Missing_Locale_and_Env_in_Publish_Details', missingEnvLocalesInEntries);
154
+ await this.prepareReport('Entry_Multiple_Fields', missingMultipleFields);
150
155
  break;
151
156
  case 'workflows':
152
157
  missingCtRefsInWorkflow = await new modules_1.Workflows({
@@ -166,6 +171,10 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
166
171
  missingRefInCustomRoles = await new custom_roles_1.default((0, cloneDeep_1.default)(constructorParam)).run();
167
172
  await this.prepareReport(module, missingRefInCustomRoles);
168
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;
169
178
  }
170
179
  (0, log_1.print)([
171
180
  {
@@ -191,7 +200,9 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
191
200
  missingTitleFields,
192
201
  missingRefInCustomRoles,
193
202
  missingEnvLocalesInAssets,
194
- missingEnvLocalesInEntries
203
+ missingEnvLocalesInEntries,
204
+ missingFieldRules,
205
+ missingMultipleFields
195
206
  };
196
207
  }
197
208
  /**
@@ -248,7 +259,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
248
259
  * objects, where each object has two properties:
249
260
  */
250
261
  showOutputOnScreen(allMissingRefs) {
251
- var _a, _b;
262
+ var _a;
252
263
  if (this.sharedConfig.showTerminalOutput && !((_a = this.flags['external-config']) === null || _a === void 0 ? void 0 : _a.noTerminalOutput)) {
253
264
  this.log(''); // NOTE adding new line
254
265
  for (const { module, missingRefs } of allMissingRefs) {
@@ -261,31 +272,40 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
261
272
  },
262
273
  ]);
263
274
  const tableValues = Object.values(missingRefs).flat();
264
- cli_utilities_1.ux.table(tableValues, Object.assign(Object.assign({ name: {
265
- minWidth: 7,
266
- header: 'Title',
267
- }, ct: {
268
- minWidth: 7,
269
- header: "Content Type"
270
- }, locale: {
271
- minWidth: 7,
272
- header: "Locale"
273
- }, display_name: {
274
- minWidth: 7,
275
- header: 'Field name',
276
- }, data_type: {
277
- minWidth: 7,
278
- header: 'Field type',
279
- }, missingRefs: {
280
- minWidth: 7,
281
- header: 'Missing references',
282
- get: (row) => {
283
- return chalk_1.default.red(typeof row.missingRefs === 'object' ? JSON.stringify(row.missingRefs) : row.missingRefs);
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);
284
301
  },
285
- } }, (((_b = tableValues[0]) === null || _b === void 0 ? void 0 : _b.fixStatus) ? this.fixStatus : {})), { treeStr: {
286
- minWidth: 7,
287
- header: 'Path',
288
- } }), Object.assign({}, this.flags));
302
+ },
303
+ {
304
+ value: 'treeStr',
305
+ alias: 'Path',
306
+ },
307
+ ];
308
+ cli_utilities_1.cliux.table(tableHeaders, tableValues, Object.assign({}, this.flags));
289
309
  this.log(''); // NOTE adding new line
290
310
  }
291
311
  }
@@ -306,33 +326,27 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
306
326
  const tableValues = Object.values(missingRefs).flat();
307
327
  missingRefs = Object.values(missingRefs).flat();
308
328
  const tableKeys = Object.keys(missingRefs[0]);
309
- const arrayOfObjects = tableKeys.map((key) => {
310
- if (config_1.default.OutputTableKeys.includes(key)) {
311
- return {
312
- [key]: {
313
- minWidth: 7,
314
- header: key,
315
- get: (row) => {
316
- if (key === 'fixStatus') {
317
- return chalk_1.default.green(typeof row[key] === 'object' ? JSON.stringify(row[key]) : row[key]);
318
- }
319
- else if (key === 'content_types' ||
320
- key === 'branches' ||
321
- key === 'missingCTSelectFieldValues' ||
322
- key === 'missingFieldUid') {
323
- return chalk_1.default.red(typeof row[key] === 'object' ? JSON.stringify(row[key]) : row[key]);
324
- }
325
- else {
326
- return chalk_1.default.white(typeof row[key] === 'object' ? JSON.stringify(row[key]) : row[key]);
327
- }
328
- },
329
- },
330
- };
331
- }
332
- return {};
333
- });
334
- const mergedObject = Object.assign({}, ...arrayOfObjects);
335
- 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));
336
350
  this.log(''); // Adding a new line
337
351
  }
338
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() }, (0, util_1.getTableFlags)());
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
- }) }, (0, util_1.getTableFlags)());
44
+ }) }, util_1.tableFlags);
45
+ exports.default = Audit;
@@ -61,6 +61,7 @@ declare const config: {
61
61
  Entries_Title_feild: string;
62
62
  Entry_Missing_Locale_and_Env: string;
63
63
  Entry_Missing_Locale_and_Env_in_Publish_Details: string;
64
+ Entry_Multiple_Fields: string;
64
65
  };
65
66
  feild_level_modules: string[];
66
67
  fixSelectField: boolean;