Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS-43482- Added the case when empty entry is passed #1247

Merged
merged 7 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading