diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 5018a7ab1b..72b2374897 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -251,6 +251,13 @@ export default abstract class BaseClass { apiData: includeParamOnCompletion ? apiData : undefined, }); + if ( + !apiData || + (entity === 'publish-entries' && !apiData.entryUid) || + (entity === 'update-extensions' && !apiData.uid) + ) { + return Promise.resolve(); + } switch (entity) { case 'create-assets-folder': return this.stack @@ -284,7 +291,6 @@ export default abstract class BaseClass { .then(onSuccess) .catch(onReject); case 'update-extensions': - if (!apiData.uid) return Promise.resolve(); return this.stack .extension(apiData.uid) .fetch() @@ -309,14 +315,8 @@ export default abstract class BaseClass { case 'create-cts': return this.stack.contentType().create(apiData).then(onSuccess).catch(onReject); case 'update-cts': - if (!apiData) { - return Promise.resolve(); - } return apiData.update().then(onSuccess).catch(onReject); case 'update-gfs': - if (!apiData) { - return Promise.resolve(); - } return apiData.update().then(onSuccess).catch(onReject); case 'create-environments': return this.stack @@ -358,9 +358,6 @@ export default abstract class BaseClass { .then(onSuccess) .catch(onReject); case 'create-entries': - if (!apiData) { - return Promise.resolve(); - } if (additionalInfo[apiData?.uid]?.isLocalized) { return apiData.update({ locale: additionalInfo.locale }).then(onSuccess).catch(onReject); } @@ -371,14 +368,8 @@ export default abstract class BaseClass { .then(onSuccess) .catch(onReject); case 'update-entries': - if (!apiData) { - return Promise.resolve(); - } return apiData.update({ locale: additionalInfo.locale }).then(onSuccess).catch(onReject); case 'publish-entries': - if (!apiData || !apiData.entryUid) { - return Promise.resolve(); - } return this.stack .contentType(additionalInfo.cTUid) .entry(apiData.entryUid) diff --git a/packages/contentstack-import/src/import/modules/extensions.ts b/packages/contentstack-import/src/import/modules/extensions.ts index c8228aa85c..9d467b9e90 100644 --- a/packages/contentstack-import/src/import/modules/extensions.ts +++ b/packages/contentstack-import/src/import/modules/extensions.ts @@ -5,7 +5,7 @@ import { join } from 'node:path'; import { log, formatError, fsUtil, fileHelper } from '../../utils'; import BaseClass, { ApiOptions } from './base-class'; -import { ModuleClassParams, Extensions, extensionType } from '../../types'; +import { ModuleClassParams, Extensions, ExtensionType } from '../../types'; export default class ImportExtensions extends BaseClass { private mapperDirPath: string; @@ -222,10 +222,10 @@ export default class ImportExtensions extends BaseClass { getContentTypesInScope() { const extension = values(this.extensions); - extension.forEach((ext: extensionType) => { + extension.forEach((ext: ExtensionType) => { let ct: any = ext?.scope?.content_types || []; if ((ct.length === 1 && ct[0] !== '$all') || ct?.length > 1) { - log(this.importConfig, `Removing the Content-types ${ct.join(',')} from Extension ${ext.title}`, 'success'); + log(this.importConfig, `Removing the Content-types ${ct.join(',')} from Extension ${ext.title}`, 'info'); const { uid, scope } = ext; this.extensionObject.push({ uid, scope }); delete ext.scope; diff --git a/packages/contentstack-import/src/types/index.ts b/packages/contentstack-import/src/types/index.ts index a780516919..16b6785a88 100644 --- a/packages/contentstack-import/src/types/index.ts +++ b/packages/contentstack-import/src/types/index.ts @@ -108,7 +108,7 @@ export { default as ImportConfig } from './import-config'; export * from './entries' export * from './marketplace-app' -export type extensionType = { +export type ExtensionType = { uid: string, scope: Record, title: string