From bf6d3cebe288e3dec8aff08dea17278ab0222e23 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Thu, 5 Dec 2024 19:25:50 +0530 Subject: [PATCH 01/12] [DX-1781] - added consoles to check/reproduce the error --- .../src/import/experiences.ts | 15 +++++++++++++-- .../contentstack-variants/src/import/project.ts | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 184f3dbe1f..778f27c04a 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -45,7 +45,7 @@ export default class Experiences extends PersonalizationAdapter { const conf: APIConfig = { config, baseURL: config.modules.personalize.baseURL[config.region.name], - headers: { 'X-Project-Uid': config.modules.personalize.project_id}, + headers: { 'X-Project-Uid': config.modules.personalize.project_id }, cmaConfig: { baseURL: config.region.cma + `/v3`, headers: { api_key: config.apiKey }, @@ -162,7 +162,11 @@ export default class Experiences extends PersonalizationAdapter { * function import experience versions from a JSON file and creates them in the project. */ async importExperienceVersions(experience: ExperienceStruct, oldExperienceUid: string) { - const versionsPath = resolve(sanitizePath(this.experiencesDirPath), 'versions', `${sanitizePath(oldExperienceUid)}.json`); + const versionsPath = resolve( + sanitizePath(this.experiencesDirPath), + 'versions', + `${sanitizePath(oldExperienceUid)}.json`, + ); if (!existsSync(versionsPath)) { return; @@ -231,6 +235,7 @@ export default class Experiences extends PersonalizationAdapter { try { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); + console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes); if (expRes?._cms) { this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; @@ -299,10 +304,16 @@ export default class Experiences extends PersonalizationAdapter { const experienceVariantIds: any = fsUtil.readFile(this.experienceVariantsIdsPath, true) || []; const variantUIDMapper: Record = {}; for (let experienceVariantId of experienceVariantIds) { + console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ experienceVariantId:', experienceVariantId); const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; + console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ latestVariantId:', latestVariantId); if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; + console.log( + '🚀 ~ Experiences ~ createVariantIdMapper ~ variantUIDMapper[oldVariantId]:', + variantUIDMapper[oldVariantId], + ); } } diff --git a/packages/contentstack-variants/src/import/project.ts b/packages/contentstack-variants/src/import/project.ts index c052492ad9..7125fd2912 100644 --- a/packages/contentstack-variants/src/import/project.ts +++ b/packages/contentstack-variants/src/import/project.ts @@ -28,8 +28,13 @@ export default class Project extends PersonalizationAdapter { async import() { const personalize = this.config.modules.personalize; const { dirName, fileName } = personalize.projects; - const projectPath = join(sanitizePath(this.config.data), sanitizePath(personalize.dirName), sanitizePath(dirName), sanitizePath(fileName)); - + const projectPath = join( + sanitizePath(this.config.data), + sanitizePath(personalize.dirName), + sanitizePath(dirName), + sanitizePath(fileName), + ); + if (existsSync(projectPath)) { const projects = JSON.parse(readFileSync(projectPath, 'utf8')) as CreateProjectInput[]; @@ -41,12 +46,16 @@ export default class Project extends PersonalizationAdapter { await this.init(); for (const project of projects) { const createProject = async (newName: void | string): Promise => { + console.log('🚀 ~ Project ~ createProject ~ project.name:', project.name); return await this.createProject({ name: newName || project.name, description: project.description, connectedStackApiKey: this.config.apiKey, }).catch(async (error) => { - if (error.includes('personalization.PROJECTS.DUPLICATE_NAME') || error.includes('personalize.PROJECTS.DUPLICATE_NAME')) { + if ( + error.includes('personalization.PROJECTS.DUPLICATE_NAME') || + error.includes('personalize.PROJECTS.DUPLICATE_NAME') + ) { const projectName = await askProjectName('Copy Of ' + (newName || project.name)); return await createProject(projectName); } From 89c21f8655c8b691f9285debb574aea2a6119fcc Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Fri, 6 Dec 2024 11:54:28 +0530 Subject: [PATCH 02/12] [DX-1781] - added consoles to check/reproduce the error --- packages/contentstack-variants/src/import/experiences.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 778f27c04a..2ce8768481 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -141,8 +141,12 @@ export default class Experiences extends PersonalizationAdapter { const jobRes = await this.validateVariantGroupAndVariantsCreated(); fsUtil.writeFile(this.cmsVariantPath, this.cmsVariants); fsUtil.writeFile(this.cmsVariantGroupPath, this.cmsVariantGroups); - if (jobRes) + if (jobRes) { this.log(this.config, this.$t(this.messages.CREATE_SUCCESS, { module: 'Variant & Variant groups' }), 'info'); + } else { + console.log('🚀 ~ Experiences ~ import ~ jobRes:', jobRes); + this.personalizeConfig.importData = false; + } if (this.personalizeConfig.importData) { this.log(this.config, this.messages.UPDATING_CT_IN_EXP, 'info'); From 48dc32dc9898438dd2dda8548b16d13b21ef9b88 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Fri, 6 Dec 2024 14:48:55 +0530 Subject: [PATCH 03/12] [DX-1781] - added consoles to confirm the error --- packages/contentstack-variants/src/import/experiences.ts | 5 ++--- packages/contentstack-variants/src/import/project.ts | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 2ce8768481..5544b5e2d0 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -144,7 +144,6 @@ export default class Experiences extends PersonalizationAdapter { if (jobRes) { this.log(this.config, this.$t(this.messages.CREATE_SUCCESS, { module: 'Variant & Variant groups' }), 'info'); } else { - console.log('🚀 ~ Experiences ~ import ~ jobRes:', jobRes); this.personalizeConfig.importData = false; } @@ -239,7 +238,6 @@ export default class Experiences extends PersonalizationAdapter { try { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); - console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes); if (expRes?._cms) { this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; @@ -308,9 +306,10 @@ export default class Experiences extends PersonalizationAdapter { const experienceVariantIds: any = fsUtil.readFile(this.experienceVariantsIdsPath, true) || []; const variantUIDMapper: Record = {}; for (let experienceVariantId of experienceVariantIds) { - console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ experienceVariantId:', experienceVariantId); const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; + console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.experiencesUidMapper:', this.experiencesUidMapper); + console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.cmsVariants:', this.cmsVariants); console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ latestVariantId:', latestVariantId); if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; diff --git a/packages/contentstack-variants/src/import/project.ts b/packages/contentstack-variants/src/import/project.ts index 7125fd2912..05c59c3a8d 100644 --- a/packages/contentstack-variants/src/import/project.ts +++ b/packages/contentstack-variants/src/import/project.ts @@ -46,7 +46,6 @@ export default class Project extends PersonalizationAdapter { await this.init(); for (const project of projects) { const createProject = async (newName: void | string): Promise => { - console.log('🚀 ~ Project ~ createProject ~ project.name:', project.name); return await this.createProject({ name: newName || project.name, description: project.description, From 6d66f06c89277dd31ee54e529b7906407bc724da Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Fri, 6 Dec 2024 16:29:05 +0530 Subject: [PATCH 04/12] [DX-1781] - added fix and console to check fix is working or not --- .../src/import/experiences.ts | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 5544b5e2d0..14e11ae04e 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -252,9 +252,18 @@ export default class Experiences extends PersonalizationAdapter { if (retryCount !== this.maxValidateRetry) { await this.delay(this.expCheckIntervalDuration); // Filter out the processed elements + console.log( + '🚀 ~ Experiences ~ validateVariantGroupAndVariantsCreated ~ this.pendingVariantAndVariantGrpForExperience:', + this.pendingVariantAndVariantGrpForExperience, + ); this.pendingVariantAndVariantGrpForExperience = this.pendingVariantAndVariantGrpForExperience.filter( (uid) => !this.cmsVariants[uid], ); + console.log( + '🚀 ~ Experiences ~ validateVariantGroupAndVariantsCreated ~ this.pendingVariantAndVariantGrpForExperience: AFTER FILTER', + this.pendingVariantAndVariantGrpForExperience, + ); + return this.validateVariantGroupAndVariantsCreated(retryCount); } else { this.log(this.config, this.messages.PERSONALIZE_JOB_FAILURE, 'error'); @@ -305,22 +314,21 @@ export default class Experiences extends PersonalizationAdapter { try { const experienceVariantIds: any = fsUtil.readFile(this.experienceVariantsIdsPath, true) || []; const variantUIDMapper: Record = {}; + let isLatestVariantIdValid = false; for (let experienceVariantId of experienceVariantIds) { const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; - console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.experiencesUidMapper:', this.experiencesUidMapper); - console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.cmsVariants:', this.cmsVariants); - console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ latestVariantId:', latestVariantId); if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; - console.log( - '🚀 ~ Experiences ~ createVariantIdMapper ~ variantUIDMapper[oldVariantId]:', - variantUIDMapper[oldVariantId], - ); + isLatestVariantIdValid = true; + } else { + isLatestVariantIdValid = false; + this.log(this.config, `Variant ID ${experienceId} not found`, 'info'); } } - - fsUtil.writeFile(this.variantUidMapperFilePath, variantUIDMapper); + if (isLatestVariantIdValid) { + fsUtil.writeFile(this.variantUidMapperFilePath, variantUIDMapper); + } } catch (error) { throw error; } From faec90010a00ee46eb80e95afe053ff8bf880aba Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Fri, 6 Dec 2024 19:28:05 +0530 Subject: [PATCH 05/12] [DX-1781] - added consoles to check the error --- .../contentstack-variants/src/import/experiences.ts | 10 ++-------- .../src/import/variant-entries.ts | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 14e11ae04e..1a1ed2f98a 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -314,21 +314,15 @@ export default class Experiences extends PersonalizationAdapter { try { const experienceVariantIds: any = fsUtil.readFile(this.experienceVariantsIdsPath, true) || []; const variantUIDMapper: Record = {}; - let isLatestVariantIdValid = false; for (let experienceVariantId of experienceVariantIds) { const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; - isLatestVariantIdValid = true; - } else { - isLatestVariantIdValid = false; - this.log(this.config, `Variant ID ${experienceId} not found`, 'info'); } } - if (isLatestVariantIdValid) { - fsUtil.writeFile(this.variantUidMapperFilePath, variantUIDMapper); - } + + fsUtil.writeFile(this.variantUidMapperFilePath, variantUIDMapper); } catch (error) { throw error; } diff --git a/packages/contentstack-variants/src/import/variant-entries.ts b/packages/contentstack-variants/src/import/variant-entries.ts index 7934b61fbf..91a2cf1a10 100644 --- a/packages/contentstack-variants/src/import/variant-entries.ts +++ b/packages/contentstack-variants/src/import/variant-entries.ts @@ -229,6 +229,8 @@ export default class VariantEntries extends VariantAdapter Date: Fri, 6 Dec 2024 20:15:32 +0530 Subject: [PATCH 06/12] [DX-1781] - added consoles to check the error --- packages/contentstack-variants/src/import/variant-entries.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/contentstack-variants/src/import/variant-entries.ts b/packages/contentstack-variants/src/import/variant-entries.ts index 91a2cf1a10..6ad3202b02 100644 --- a/packages/contentstack-variants/src/import/variant-entries.ts +++ b/packages/contentstack-variants/src/import/variant-entries.ts @@ -195,11 +195,13 @@ export default class VariantEntries extends VariantAdapter Date: Mon, 9 Dec 2024 14:25:35 +0530 Subject: [PATCH 07/12] [DX-1781] - added consoles to check the error --- packages/contentstack-variants/src/import/experiences.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 1a1ed2f98a..49a026d37e 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -115,15 +115,21 @@ export default class Experiences extends PersonalizationAdapter { const experiences = fsUtil.readFile(this.experiencesPath, true) as ExperienceStruct[]; for (const experience of experiences) { + console.log('🚀 ~ Experiences ~ import ~ experience:', experience); const { uid, ...restExperienceData } = experience; + console.log('🚀 ~ Experiences ~ import ~ restExperienceData:', restExperienceData); + console.log('🚀 ~ Experiences ~ import ~ uid:', uid); //check whether reference audience exists or not that referenced in variations having __type equal to AudienceBasedVariation & targeting let experienceReqObj: CreateExperienceInput = lookUpAudiences(restExperienceData, this.audiencesUid); //check whether events exists or not that referenced in metrics experienceReqObj = lookUpEvents(experienceReqObj, this.eventsUid); + console.log('🚀 ~ Experiences ~ import ~ experienceReqObj:', experienceReqObj); const expRes = (await this.createExperience(experienceReqObj)) as ExperienceStruct; //map old experience uid to new experience uid + console.log('🚀 ~ Experiences ~ import ~ expRes:', expRes); this.experiencesUidMapper[uid] = expRes?.uid ?? ''; + console.log('🚀 ~ Experiences ~ import ~ this.experiencesUidMapper:', this.experiencesUidMapper); try { // import versions of experience From 105866cb4d4e32d72fa0bdef5e71317e4b049649 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Mon, 9 Dec 2024 14:28:24 +0530 Subject: [PATCH 08/12] [DX-1781] - added consoles to check the error --- packages/contentstack-variants/src/import/experiences.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 49a026d37e..1827388a16 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -293,6 +293,10 @@ export default class Experiences extends PersonalizationAdapter { return; } const experienceCTsMap = fsUtil.readFile(this.experienceCTsPath, true) as Record; + console.log( + '🚀 ~ Experiences ~ Object.entries ~ this.experiencesUidMapper: BEFORE MAP', + this.experiencesUidMapper, + ); return await Promise.allSettled( Object.entries(this.experiencesUidMapper).map(async ([oldExpUid, newExpUid]) => { if (experienceCTsMap[oldExpUid]?.length) { @@ -314,6 +318,7 @@ export default class Experiences extends PersonalizationAdapter { this.log(this.config, `Error while attaching content type with experience`, 'error'); this.log(this.config, error, 'error'); } + console.log('🚀 ~ Experiences ~ Object.entries ~ this.experiencesUidMapper: AFTER MAP', this.experiencesUidMapper); } async createVariantIdMapper() { From 893abc0acbc08621cf38f60a116fddcca25bf092 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Mon, 9 Dec 2024 15:16:48 +0530 Subject: [PATCH 09/12] [DX-1781] - added consoles to check the error --- .../src/import/experiences.ts | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 1827388a16..a3d1966c35 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -115,21 +115,15 @@ export default class Experiences extends PersonalizationAdapter { const experiences = fsUtil.readFile(this.experiencesPath, true) as ExperienceStruct[]; for (const experience of experiences) { - console.log('🚀 ~ Experiences ~ import ~ experience:', experience); const { uid, ...restExperienceData } = experience; - console.log('🚀 ~ Experiences ~ import ~ restExperienceData:', restExperienceData); - console.log('🚀 ~ Experiences ~ import ~ uid:', uid); //check whether reference audience exists or not that referenced in variations having __type equal to AudienceBasedVariation & targeting let experienceReqObj: CreateExperienceInput = lookUpAudiences(restExperienceData, this.audiencesUid); //check whether events exists or not that referenced in metrics experienceReqObj = lookUpEvents(experienceReqObj, this.eventsUid); - console.log('🚀 ~ Experiences ~ import ~ experienceReqObj:', experienceReqObj); const expRes = (await this.createExperience(experienceReqObj)) as ExperienceStruct; //map old experience uid to new experience uid - console.log('🚀 ~ Experiences ~ import ~ expRes:', expRes); this.experiencesUidMapper[uid] = expRes?.uid ?? ''; - console.log('🚀 ~ Experiences ~ import ~ this.experiencesUidMapper:', this.experiencesUidMapper); try { // import versions of experience @@ -244,7 +238,10 @@ export default class Experiences extends PersonalizationAdapter { try { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); - if (expRes?._cms) { + if (expRes?._cms && expRes?._cms?.variantGroup && expRes?._cms?.variants) { + console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes._cms.variants); + console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes._cms.variantGroup); + this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; return expUid; // Return the expUid for filtering later @@ -258,18 +255,9 @@ export default class Experiences extends PersonalizationAdapter { if (retryCount !== this.maxValidateRetry) { await this.delay(this.expCheckIntervalDuration); // Filter out the processed elements - console.log( - '🚀 ~ Experiences ~ validateVariantGroupAndVariantsCreated ~ this.pendingVariantAndVariantGrpForExperience:', - this.pendingVariantAndVariantGrpForExperience, - ); this.pendingVariantAndVariantGrpForExperience = this.pendingVariantAndVariantGrpForExperience.filter( (uid) => !this.cmsVariants[uid], ); - console.log( - '🚀 ~ Experiences ~ validateVariantGroupAndVariantsCreated ~ this.pendingVariantAndVariantGrpForExperience: AFTER FILTER', - this.pendingVariantAndVariantGrpForExperience, - ); - return this.validateVariantGroupAndVariantsCreated(retryCount); } else { this.log(this.config, this.messages.PERSONALIZE_JOB_FAILURE, 'error'); @@ -293,10 +281,6 @@ export default class Experiences extends PersonalizationAdapter { return; } const experienceCTsMap = fsUtil.readFile(this.experienceCTsPath, true) as Record; - console.log( - '🚀 ~ Experiences ~ Object.entries ~ this.experiencesUidMapper: BEFORE MAP', - this.experiencesUidMapper, - ); return await Promise.allSettled( Object.entries(this.experiencesUidMapper).map(async ([oldExpUid, newExpUid]) => { if (experienceCTsMap[oldExpUid]?.length) { @@ -318,7 +302,6 @@ export default class Experiences extends PersonalizationAdapter { this.log(this.config, `Error while attaching content type with experience`, 'error'); this.log(this.config, error, 'error'); } - console.log('🚀 ~ Experiences ~ Object.entries ~ this.experiencesUidMapper: AFTER MAP', this.experiencesUidMapper); } async createVariantIdMapper() { @@ -328,6 +311,7 @@ export default class Experiences extends PersonalizationAdapter { for (let experienceVariantId of experienceVariantIds) { const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; + console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.experiencesUidMapper:', this.experiencesUidMapper); if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; } From 68d64b02da2b13e22be25dea3f96fda7911939d5 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Mon, 9 Dec 2024 16:31:10 +0530 Subject: [PATCH 10/12] [DX-1781] - added consoles to check the error --- packages/contentstack-variants/src/import/experiences.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index a3d1966c35..38cb2aca24 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -238,9 +238,9 @@ export default class Experiences extends PersonalizationAdapter { try { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); - if (expRes?._cms && expRes?._cms?.variantGroup && expRes?._cms?.variants) { - console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes._cms.variants); - console.log('🚀 ~ Experiences ~ promises ~ expRes:', expRes._cms.variantGroup); + if (expRes?._cms && expRes?._cms?.variantGroup && Object.keys(expRes._cms.variants).length > 0) { + console.log('🚀 ~ Experiences ~ promises ~ expRes:Variant', expRes._cms.variants); + console.log('🚀 ~ Experiences ~ promises ~ expRes:Group', expRes._cms.variantGroup); this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; From 4153ecff5cf30cda065b0c491fc223f803819008 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Mon, 9 Dec 2024 16:55:39 +0530 Subject: [PATCH 11/12] [DX-1781] - removed consoles --- packages/contentstack-variants/src/import/experiences.ts | 4 ---- packages/contentstack-variants/src/import/variant-entries.ts | 4 ---- 2 files changed, 8 deletions(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 38cb2aca24..52479d7f18 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -239,9 +239,6 @@ export default class Experiences extends PersonalizationAdapter { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); if (expRes?._cms && expRes?._cms?.variantGroup && Object.keys(expRes._cms.variants).length > 0) { - console.log('🚀 ~ Experiences ~ promises ~ expRes:Variant', expRes._cms.variants); - console.log('🚀 ~ Experiences ~ promises ~ expRes:Group', expRes._cms.variantGroup); - this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; return expUid; // Return the expUid for filtering later @@ -311,7 +308,6 @@ export default class Experiences extends PersonalizationAdapter { for (let experienceVariantId of experienceVariantIds) { const [experienceId, variantShortId, oldVariantId] = experienceVariantId.split('-'); const latestVariantId = this.cmsVariants[this.experiencesUidMapper[experienceId]]?.[variantShortId]; - console.log('🚀 ~ Experiences ~ createVariantIdMapper ~ this.experiencesUidMapper:', this.experiencesUidMapper); if (latestVariantId) { variantUIDMapper[oldVariantId] = latestVariantId; } diff --git a/packages/contentstack-variants/src/import/variant-entries.ts b/packages/contentstack-variants/src/import/variant-entries.ts index 6ad3202b02..7934b61fbf 100644 --- a/packages/contentstack-variants/src/import/variant-entries.ts +++ b/packages/contentstack-variants/src/import/variant-entries.ts @@ -195,13 +195,11 @@ export default class VariantEntries extends VariantAdapter Date: Mon, 9 Dec 2024 18:01:30 +0530 Subject: [PATCH 12/12] DX-1781- updated packages --- package-lock.json | 8 ++++---- packages/contentstack-export/package.json | 2 +- packages/contentstack-import/package.json | 2 +- packages/contentstack-variants/package.json | 2 +- packages/contentstack/package.json | 2 +- pnpm-lock.yaml | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9302ca916..a5222bf0a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26472,7 +26472,7 @@ "@contentstack/cli-launch": "~1.3.0", "@contentstack/cli-migration": "~1.6.4", "@contentstack/cli-utilities": "~1.8.0", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@contentstack/management": "~1.18.4", "@oclif/core": "^3.27.0", "@oclif/plugin-help": "^5", @@ -27452,7 +27452,7 @@ "dependencies": { "@contentstack/cli-command": "~1.3.2", "@contentstack/cli-utilities": "~1.8.0", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@oclif/core": "^3.27.0", "async": "^3.2.6", "big-json": "^3.2.0", @@ -27816,7 +27816,7 @@ "@contentstack/cli-audit": "~1.7.3", "@contentstack/cli-command": "~1.3.2", "@contentstack/cli-utilities": "~1.8.0", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@contentstack/management": "~1.18.4", "@oclif/core": "^3.27.0", "big-json": "^3.2.0", @@ -28589,7 +28589,7 @@ }, "packages/contentstack-variants": { "name": "@contentstack/cli-variants", - "version": "1.1.3", + "version": "1.1.4", "license": "MIT", "dependencies": { "@contentstack/cli-utilities": "^1.8.0", diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index d23f1ef2f1..059aac95e2 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-command": "~1.3.2", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@contentstack/cli-utilities": "~1.8.0", "@oclif/core": "^3.27.0", "async": "^3.2.6", diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index ad69946e14..433775e73f 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -9,7 +9,7 @@ "@contentstack/cli-command": "~1.3.2", "@contentstack/cli-utilities": "~1.8.0", "@contentstack/management": "~1.18.4", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@oclif/core": "^3.27.0", "big-json": "^3.2.0", "bluebird": "^3.7.2", diff --git a/packages/contentstack-variants/package.json b/packages/contentstack-variants/package.json index c98c7e990c..f079a08aaf 100644 --- a/packages/contentstack-variants/package.json +++ b/packages/contentstack-variants/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-variants", - "version": "1.1.3", + "version": "1.1.4", "description": "Variants plugin", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index 6417fbac01..11c026af93 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -39,7 +39,7 @@ "@contentstack/cli-migration": "~1.6.4", "@contentstack/cli-utilities": "~1.8.0", "@contentstack/management": "~1.18.4", - "@contentstack/cli-variants": "~1.1.3", + "@contentstack/cli-variants": "~1.1.4", "@contentstack/cli-cm-import-setup": "1.0.0-beta.1", "@oclif/core": "^3.27.0", "@oclif/plugin-help": "^5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a963f87e2..53cb3947a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,7 +27,7 @@ importers: '@contentstack/cli-launch': ~1.3.0 '@contentstack/cli-migration': ~1.6.4 '@contentstack/cli-utilities': ~1.8.0 - '@contentstack/cli-variants': ~1.1.3 + '@contentstack/cli-variants': ~1.1.4 '@contentstack/management': ~1.18.4 '@oclif/core': ^3.27.0 '@oclif/plugin-help': ^5 @@ -619,7 +619,7 @@ importers: '@contentstack/cli-config': ~1.9.0 '@contentstack/cli-dev-dependencies': ~1.2.4 '@contentstack/cli-utilities': ~1.8.0 - '@contentstack/cli-variants': ~1.1.3 + '@contentstack/cli-variants': ~1.1.4 '@oclif/core': ^3.27.0 '@oclif/plugin-help': ^5.2.20 '@oclif/test': ^4.1.3 @@ -743,7 +743,7 @@ importers: '@contentstack/cli-audit': ~1.7.3 '@contentstack/cli-command': ~1.3.2 '@contentstack/cli-utilities': ~1.8.0 - '@contentstack/cli-variants': ~1.1.3 + '@contentstack/cli-variants': ~1.1.4 '@contentstack/management': ~1.18.4 '@oclif/core': ^3.27.0 '@oclif/test': ^4.1.3