diff --git a/package-lock.json b/package-lock.json index c2af8b3cfc..c589e071da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23522,10 +23522,10 @@ }, "packages/contentstack": { "name": "@contentstack/cli", - "version": "1.12.1", + "version": "1.12.2", "license": "MIT", "dependencies": { - "@contentstack/cli-audit": "~1.3.2", + "@contentstack/cli-audit": "~1.3.3", "@contentstack/cli-auth": "~1.3.17", "@contentstack/cli-cm-bootstrap": "~1.7.1", "@contentstack/cli-cm-branches": "~1.0.20", @@ -23590,7 +23590,7 @@ }, "packages/contentstack-audit": { "name": "@contentstack/cli-audit", - "version": "1.3.2", + "version": "1.3.3", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", @@ -25309,7 +25309,7 @@ "version": "1.13.0", "license": "MIT", "dependencies": { - "@contentstack/cli-audit": "^1.3.2", + "@contentstack/cli-audit": "^1.3.3", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.10", "@contentstack/management": "~1.13.0", diff --git a/packages/contentstack-audit/package.json b/packages/contentstack-audit/package.json index 7d2d083eca..0e56cf4aa9 100644 --- a/packages/contentstack-audit/package.json +++ b/packages/contentstack-audit/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-audit", - "version": "1.3.2", + "version": "1.3.3", "description": "Contentstack audit plugin", "author": "Contentstack CLI", "homepage": "https://github.com/contentstack/cli", diff --git a/packages/contentstack-audit/src/modules/entries.ts b/packages/contentstack-audit/src/modules/entries.ts index 586d4071b6..c21b52cdbb 100644 --- a/packages/contentstack-audit/src/modules/entries.ts +++ b/packages/contentstack-audit/src/modules/entries.ts @@ -488,6 +488,9 @@ export default class Entries { field as ReferenceFieldDataType, entry[uid] as EntryReferenceFieldDataType[], ); + if (!entry[uid]) { + delete entry[uid]; + } break; case 'blocks': entry[uid] = this.fixModularBlocksReferences( @@ -504,6 +507,7 @@ export default class Entries { ) as EntryGroupFieldDataType; break; } + }); return entry; @@ -546,12 +550,12 @@ export default class Entries { entry: EntryModularBlocksDataType[], ) { entry = entry - .map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index)) + ?.map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index)) .filter((val) => !isEmpty(val)); blocks.forEach((block) => { entry = entry - .map((eBlock) => { + ?.map((eBlock) => { if (!isEmpty(block.schema)) { if (eBlock[block.uid]) { eBlock[block.uid] = this.runFixOnSchema( @@ -666,9 +670,9 @@ export default class Entries { field: ReferenceFieldDataType | JsonRTEFieldDataType, entry: EntryReferenceFieldDataType[], ) { + const missingRefs: Record[] = []; - entry = entry - .map((reference) => { + entry = entry?.map((reference) => { const { uid } = reference; const refExist = find(this.entryMetaData, { uid }); @@ -678,8 +682,7 @@ export default class Entries { } return reference; - }) - .filter((val) => val) as EntryReferenceFieldDataType[]; + }).filter((val) => val) as EntryReferenceFieldDataType[]; if (!isEmpty(missingRefs)) { this.missingRefs[this.currentUid].push({ diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 185e5a6515..ec13b7aec3 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -5,7 +5,7 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-audit": "^1.3.2", + "@contentstack/cli-audit": "^1.3.3", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.10", "@contentstack/management": "~1.13.0", diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index 9e4921c8d7..7d99546675 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli", "description": "Command-line tool (CLI) to interact with Contentstack", - "version": "1.12.1", + "version": "1.12.2", "author": "Contentstack", "bin": { "csdx": "./bin/run" @@ -22,7 +22,7 @@ "prepack": "pnpm compile && oclif manifest && oclif readme" }, "dependencies": { - "@contentstack/cli-audit": "~1.3.2", + "@contentstack/cli-audit": "~1.3.3", "@contentstack/cli-auth": "~1.3.17", "@contentstack/cli-cm-bootstrap": "~1.7.1", "@contentstack/cli-cm-branches": "~1.0.20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f1ff7b9ab..8635038122 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: packages/contentstack: specifiers: - '@contentstack/cli-audit': ~1.3.2 + '@contentstack/cli-audit': ~1.3.3 '@contentstack/cli-auth': ~1.3.17 '@contentstack/cli-cm-bootstrap': ~1.7.1 '@contentstack/cli-cm-branches': ~1.0.20 @@ -726,7 +726,7 @@ importers: packages/contentstack-import: specifiers: - '@contentstack/cli-audit': ^1.3.2 + '@contentstack/cli-audit': ^1.3.3 '@contentstack/cli-command': ~1.2.16 '@contentstack/cli-utilities': ~1.5.10 '@contentstack/management': ~1.13.0 @@ -4698,7 +4698,7 @@ packages: /axios/1.6.2_debug@4.3.4: resolution: {integrity: sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==} dependencies: - follow-redirects: 1.15.3_debug@4.3.4 + follow-redirects: 1.15.5_debug@4.3.4 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -4707,7 +4707,7 @@ packages: /axios/1.6.5: resolution: {integrity: sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==} dependencies: - follow-redirects: 1.15.4 + follow-redirects: 1.15.5 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -4717,7 +4717,7 @@ packages: /axios/1.6.5_debug@4.3.4: resolution: {integrity: sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==} dependencies: - follow-redirects: 1.15.4_debug@4.3.4 + follow-redirects: 1.15.5_debug@4.3.4 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -7444,19 +7444,8 @@ packages: /fn.name/1.1.0: resolution: {integrity: sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==} - /follow-redirects/1.15.3_debug@4.3.4: - resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dependencies: - debug: 4.3.4 - - /follow-redirects/1.15.4: - resolution: {integrity: sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==} + /follow-redirects/1.15.5: + resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} engines: {node: '>=4.0'} peerDependencies: debug: '*' @@ -7465,8 +7454,8 @@ packages: optional: true dev: true - /follow-redirects/1.15.4_debug@4.3.4: - resolution: {integrity: sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==} + /follow-redirects/1.15.5_debug@4.3.4: + resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} engines: {node: '>=4.0'} peerDependencies: debug: '*'