Skip to content

Commit

Permalink
Merge pull request #1247 from contentstack/bugfix/CS-43482
Browse files Browse the repository at this point in the history
CS-43482- Added the case when empty entry is passed
  • Loading branch information
cs-raj authored Jan 22, 2024
2 parents 4f28c08 + cda91a4 commit 31a4323
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 34 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 9 additions & 6 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -504,6 +507,7 @@ export default class Entries {
) as EntryGroupFieldDataType;
break;
}

});

return entry;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -666,9 +670,9 @@ export default class Entries {
field: ReferenceFieldDataType | JsonRTEFieldDataType,
entry: EntryReferenceFieldDataType[],
) {

const missingRefs: Record<string, any>[] = [];
entry = entry
.map((reference) => {
entry = entry?.map((reference) => {
const { uid } = reference;
const refExist = find(this.entryMetaData, { uid });

Expand All @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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",
Expand Down
29 changes: 9 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31a4323

Please sign in to comment.