Skip to content

Commit

Permalink
Merge pull request #1362 from contentstack/bugfix/CS-44364
Browse files Browse the repository at this point in the history
CS-44364- Fixed the issue where the reference was coming in as string
  • Loading branch information
cs-raj authored Apr 3, 2024
2 parents 7c94830 + 9b389a0 commit dcfd0f1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
10 changes: 5 additions & 5 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.5.1",
"version": "1.5.2",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand Down
10 changes: 10 additions & 0 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ export default class Entries {
fieldStructure: ReferenceFieldDataType,
field: EntryReferenceFieldDataType[],
) {
if (typeof field === 'string') {
let stringReference = field as string;
stringReference = stringReference.replace(/'/g, '"');
field = JSON.parse(stringReference);
}
return this.validateReferenceValues(tree, fieldStructure, field);
}

Expand Down Expand Up @@ -826,6 +831,11 @@ export default class Entries {
entry: EntryReferenceFieldDataType[],
) {
const missingRefs: Record<string, any>[] = [];
if (typeof entry === 'string') {
let stringReference = entry as string;
stringReference = stringReference.replace(/'/g, '"');
entry = JSON.parse(stringReference);
}
entry = entry
?.map((reference) => {
const { uid } = reference;
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.5.1",
"@contentstack/cli-audit": "~1.5.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.6.0",
"@contentstack/management": "~1.15.3",
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.17.0",
"version": "1.17.1",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run"
Expand All @@ -22,7 +22,7 @@
"prepack": "pnpm compile && oclif manifest && oclif readme"
},
"dependencies": {
"@contentstack/cli-audit": "~1.5.1",
"@contentstack/cli-audit": "~1.5.2",
"@contentstack/cli-auth": "~1.3.17",
"@contentstack/cli-cm-bootstrap": "~1.9.0",
"@contentstack/cli-cm-branches": "~1.0.24",
Expand Down
4 changes: 2 additions & 2 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 dcfd0f1

Please sign in to comment.