Skip to content

Commit

Permalink
Merge pull request #1093 from contentstack/fix/CS-41724
Browse files Browse the repository at this point in the history
fixed manadatory removal of CT
  • Loading branch information
netrajpatel authored Oct 10, 2023
2 parents 2aaa46c + 18c5585 commit 3122c60
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.9.1",
"version": "1.9.2",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
14 changes: 10 additions & 4 deletions packages/contentstack-import/src/import/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ export default class EntriesImport extends BaseClass {
* @returns {ApiOptions} ApiOptions
*/
serializeUpdateCTs(apiOptions: ApiOptions): ApiOptions {
const { apiData: contentType } = apiOptions;
const { apiData } = apiOptions;
const contentType = cloneDeep(apiData);
if (contentType.field_rules) {
delete contentType.field_rules;
}
Expand Down Expand Up @@ -286,7 +287,11 @@ export default class EntriesImport extends BaseClass {
const onSuccess = ({ response, apiData: entry, additionalInfo }: any) => {
if (additionalInfo[entry.uid]?.isLocalized) {
let oldUid = additionalInfo[entry.uid].entryOldUid;
log(this.importConfig, `Localized entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, 'info');
log(
this.importConfig,
`Localized entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`,
'info',
);
entry.uid = oldUid;
entry.entryOldUid = oldUid;
entry.sourceEntryFilePath = path.join(basePath, additionalInfo.entryFileName); // stores source file path temporarily
Expand Down Expand Up @@ -379,7 +384,7 @@ export default class EntriesImport extends BaseClass {
apiOptions.apiData = entryResponse;
apiOptions.additionalInfo[entryResponse.uid] = {
isLocalized: true,
entryOldUid: entry.uid
entryOldUid: entry.uid,
};
return apiOptions;
}
Expand Down Expand Up @@ -544,7 +549,8 @@ export default class EntriesImport extends BaseClass {
* @returns {ApiOptions} ApiOptions
*/
serializeUpdateCTsWithRef(apiOptions: ApiOptions): ApiOptions {
const { apiData: contentType } = apiOptions;
const { apiData } = apiOptions;
const contentType = cloneDeep(apiData);
if (contentType.field_rules) {
delete contentType.field_rules;
}
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.9.1",
"version": "1.9.2",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run"
Expand Down Expand Up @@ -30,7 +30,7 @@
"@contentstack/cli-cm-clone": "~1.5.1",
"@contentstack/cli-cm-export": "~1.9.1",
"@contentstack/cli-cm-export-to-csv": "~1.4.3",
"@contentstack/cli-cm-import": "~1.9.1",
"@contentstack/cli-cm-import": "~1.9.2",
"@contentstack/cli-cm-migrate-rte": "~1.4.12",
"@contentstack/cli-cm-seed": "~1.5.1",
"@contentstack/cli-command": "~1.2.13",
Expand Down

0 comments on commit 3122c60

Please sign in to comment.