@contentstack/cli-audit 1.7.2 → 1.7.4

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.7.2 linux-x64 node-v18.20.4
22
+ @contentstack/cli-audit/1.7.4 linux-x64 node-v18.20.5
23
23
  $ csdx --help [COMMAND]
24
24
  USAGE
25
25
  $ csdx COMMAND
@@ -269,7 +269,7 @@ EXAMPLES
269
269
  $ csdx plugins
270
270
  ```
271
271
 
272
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/index.ts)_
272
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/index.ts)_
273
273
 
274
274
  ## `csdx plugins:add PLUGIN`
275
275
 
@@ -343,7 +343,7 @@ EXAMPLES
343
343
  $ csdx plugins:inspect myplugin
344
344
  ```
345
345
 
346
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/inspect.ts)_
346
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/inspect.ts)_
347
347
 
348
348
  ## `csdx plugins:install PLUGIN`
349
349
 
@@ -392,7 +392,7 @@ EXAMPLES
392
392
  $ csdx plugins:install someuser/someplugin
393
393
  ```
394
394
 
395
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/install.ts)_
395
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/install.ts)_
396
396
 
397
397
  ## `csdx plugins:link PATH`
398
398
 
@@ -412,6 +412,7 @@ FLAGS
412
412
 
413
413
  DESCRIPTION
414
414
  Links a plugin into the CLI for development.
415
+
415
416
  Installation of a linked plugin will override a user-installed or core plugin.
416
417
 
417
418
  e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
@@ -422,7 +423,7 @@ EXAMPLES
422
423
  $ csdx plugins:link myplugin
423
424
  ```
424
425
 
425
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/link.ts)_
426
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/link.ts)_
426
427
 
427
428
  ## `csdx plugins:remove [PLUGIN]`
428
429
 
@@ -463,7 +464,7 @@ FLAGS
463
464
  --reinstall Reinstall all plugins after uninstalling.
464
465
  ```
465
466
 
466
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/reset.ts)_
467
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/reset.ts)_
467
468
 
468
469
  ## `csdx plugins:uninstall [PLUGIN]`
469
470
 
@@ -491,7 +492,7 @@ EXAMPLES
491
492
  $ csdx plugins:uninstall myplugin
492
493
  ```
493
494
 
494
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/uninstall.ts)_
495
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/uninstall.ts)_
495
496
 
496
497
  ## `csdx plugins:unlink [PLUGIN]`
497
498
 
@@ -535,5 +536,5 @@ DESCRIPTION
535
536
  Update installed plugins.
536
537
  ```
537
538
 
538
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/update.ts)_
539
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/update.ts)_
539
540
  <!-- commandsstop -->
@@ -250,6 +250,12 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
250
250
  cli_utilities_1.ux.table(tableValues, Object.assign(Object.assign({ name: {
251
251
  minWidth: 7,
252
252
  header: 'Title',
253
+ }, ct: {
254
+ minWidth: 7,
255
+ header: "Content Type"
256
+ }, locale: {
257
+ minWidth: 7,
258
+ header: "Locale"
253
259
  }, display_name: {
254
260
  minWidth: 7,
255
261
  header: 'Field name',
@@ -221,7 +221,7 @@ export default class Entries {
221
221
  treeStr: string;
222
222
  }[];
223
223
  /**
224
- *
224
+ * this is called in case the select field has multiple optins to chose from
225
225
  * @param field It contains the value to be searched
226
226
  * @param selectOptions It contains the options that were added in CT
227
227
  * @returns An Array of entry containing only the values that were present in CT, An array of not present entries
@@ -42,7 +42,7 @@ class Entries {
42
42
  * @returns the `missingRefs` object.
43
43
  */
44
44
  async run() {
45
- var _a;
45
+ var _a, _b, _c, _d;
46
46
  if (!(0, fs_1.existsSync)(this.folderPath)) {
47
47
  this.log(`Skipping ${this.moduleName} audit`, 'warn');
48
48
  this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
@@ -76,8 +76,26 @@ class Entries {
76
76
  this.removeMissingKeysOnEntry(ctSchema.schema, this.entries[entryUid]);
77
77
  }
78
78
  this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
79
+ if ((_a = this.missingRefs[this.currentUid]) === null || _a === void 0 ? void 0 : _a.length) {
80
+ this.missingRefs[this.currentUid].forEach((entry) => {
81
+ entry.ct = ctSchema.uid;
82
+ entry.locale = code;
83
+ });
84
+ }
85
+ if ((_b = this.missingSelectFeild[this.currentUid]) === null || _b === void 0 ? void 0 : _b.length) {
86
+ this.missingSelectFeild[this.currentUid].forEach((entry) => {
87
+ entry.ct = ctSchema.uid;
88
+ entry.locale = code;
89
+ });
90
+ }
91
+ if ((_c = this.missingMandatoryFields[this.currentUid]) === null || _c === void 0 ? void 0 : _c.length) {
92
+ this.missingMandatoryFields[this.currentUid].forEach((entry) => {
93
+ entry.ct = ctSchema.uid;
94
+ entry.locale = code;
95
+ });
96
+ }
79
97
  const fields = this.missingMandatoryFields[uid];
80
- const isPublished = ((_a = entry.publish_details) === null || _a === void 0 ? void 0 : _a.length) > 0;
98
+ const isPublished = ((_d = entry.publish_details) === null || _d === void 0 ? void 0 : _d.length) > 0;
81
99
  if ((this.fix && fields.length && isPublished) || (!this.fix && fields)) {
82
100
  const fixStatus = this.fix ? 'Fixed' : '';
83
101
  fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
@@ -693,12 +711,15 @@ class Entries {
693
711
  return [];
694
712
  }
695
713
  /**
696
- *
714
+ * this is called in case the select field has multiple optins to chose from
697
715
  * @param field It contains the value to be searched
698
716
  * @param selectOptions It contains the options that were added in CT
699
717
  * @returns An Array of entry containing only the values that were present in CT, An array of not present entries
700
718
  */
701
719
  findNotPresentSelectField(field, selectOptions) {
720
+ if (!field) {
721
+ field = [];
722
+ }
702
723
  let present = [];
703
724
  let notPresent = [];
704
725
  const choicesMap = new Map(selectOptions.choices.map((choice) => [choice.value, choice]));
@@ -103,6 +103,8 @@ declare enum OutputColumn {
103
103
  'isPublished' = "isPublished",
104
104
  'Entry UID' = "Entry UID",
105
105
  'Content Type UID' = "Content Type UID",
106
- "Locale" = "Locale"
106
+ "Locale" = "Locale",
107
+ "Content Type" = "ct",
108
+ "locale" = "locale"
107
109
  }
108
110
  export { CtConstructorParam, ContentTypeStruct, ModuleConstructorParam, ReferenceFieldDataType, GlobalFieldDataType, ExtensionOrAppFieldDataType, JsonRTEFieldDataType, GroupFieldDataType, ModularBlocksDataType, RefErrorReturnType, ModularBlocksSchemaTypes, ModularBlockType, OutputColumn, ContentTypeSchemaType, GlobalFieldSchemaTypes, WorkflowExtensionsRefErrorReturnType, SelectFeildStruct, };
@@ -20,5 +20,7 @@ var OutputColumn;
20
20
  OutputColumn["Entry UID"] = "Entry UID";
21
21
  OutputColumn["Content Type UID"] = "Content Type UID";
22
22
  OutputColumn["Locale"] = "Locale";
23
+ OutputColumn["Content Type"] = "ct";
24
+ OutputColumn["locale"] = "locale";
23
25
  })(OutputColumn || (OutputColumn = {}));
24
26
  exports.OutputColumn = OutputColumn;
package/lib/util/log.js CHANGED
@@ -54,7 +54,7 @@ class Logger {
54
54
  if (logType === 'error') {
55
55
  consoleOptions.level = logType;
56
56
  }
57
- const filename = (0, path_1.normalize)((0, path_1.resolve)(this.config.basePath, 'logs', `${logType}.log`)).replace(/^(\.\.(\/|\\|$))+/, '');
57
+ const filename = (0, path_1.normalize)((0, path_1.resolve)(this.config.basePath, 'Audit logs', `${logType}.log`)).replace(/^(\.\.(\/|\\|$))+/, '');
58
58
  const transports = [
59
59
  new winston_1.default.transports.File(Object.assign(Object.assign({}, this.loggerOptions), { level: logType, filename })),
60
60
  ];
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.2",
2
+ "version": "1.7.4",
3
3
  "commands": {
4
4
  "cm:stacks:audit:fix": {
5
5
  "id": "cm:stacks:audit:fix",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/cli-audit",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "Contentstack audit plugin",
5
5
  "author": "Contentstack CLI",
6
6
  "homepage": "https://github.com/contentstack/cli",
@@ -20,36 +20,36 @@
20
20
  "dependencies": {
21
21
  "@contentstack/cli-command": "~1.3.2",
22
22
  "@contentstack/cli-utilities": "~1.8.0",
23
- "@oclif/plugin-help": "^5",
24
- "@oclif/plugin-plugins": "^5.0.0",
23
+ "@oclif/plugin-help": "^5.2.20",
24
+ "@oclif/plugin-plugins": "^5.4.22",
25
25
  "chalk": "^4.1.2",
26
26
  "fast-csv": "^4.3.6",
27
- "fs-extra": "^11.1.1",
27
+ "fs-extra": "^11.2.0",
28
28
  "lodash": "^4.17.21",
29
29
  "uuid": "^9.0.1",
30
- "winston": "^3.10.0"
30
+ "winston": "^3.17.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@contentstack/cli-dev-dependencies": "^1.2.4",
34
- "@oclif/test": "^2.5.6",
35
- "@types/chai": "^4.3.5",
36
- "@types/fs-extra": "^11.0.2",
37
- "@types/mocha": "^10.0.6",
38
- "@types/node": "^20.3.1",
39
- "@types/uuid": "^9.0.4",
40
- "chai": "^4.3.7",
41
- "eslint": "^8.43.0",
34
+ "@oclif/test": "^4.1.4",
35
+ "@types/chai": "^4.3.20",
36
+ "@types/fs-extra": "^11.0.4",
37
+ "@types/mocha": "^10.0.10",
38
+ "@types/node": "^20.17.10",
39
+ "@types/uuid": "^9.0.8",
40
+ "chai": "^4.5.0",
41
+ "eslint": "^8.57.1",
42
42
  "eslint-config-oclif": "^4.0.0",
43
- "eslint-config-oclif-typescript": "^3.0.8",
44
- "mocha": "^10.2.0",
43
+ "eslint-config-oclif-typescript": "^3.1.13",
44
+ "mocha": "^10.8.2",
45
45
  "nyc": "^15.1.0",
46
- "oclif": "^3",
46
+ "oclif": "^3.17.2",
47
47
  "shx": "^0.3.4",
48
- "sinon": "^19.0.0",
49
- "ts-jest": "^29.1.1",
50
- "ts-node": "^10.9.1",
51
- "tslib": "^2.5.3",
52
- "typescript": "^5.1.3"
48
+ "sinon": "^19.0.2",
49
+ "ts-jest": "^29.2.5",
50
+ "ts-node": "^10.9.2",
51
+ "tslib": "^2.8.1",
52
+ "typescript": "^5.7.2"
53
53
  },
54
54
  "oclif": {
55
55
  "bin": "csdx",