From a38946d757e1c3ba399a0fdd50a3c8a2dd7693f2 Mon Sep 17 00:00:00 2001 From: Aishwarya Date: Wed, 8 Jul 2026 15:45:28 +0530 Subject: [PATCH 1/4] feat(extractEntries, extractItems, schemaMapper): enhance UID generation and filtering logic for WordPress migration --- .../libs/extractEntries.ts | 10 ++- .../migration-wordpress/libs/extractItems.ts | 8 +- .../migration-wordpress/libs/schemaMapper.ts | 78 ++++++++++++++----- 3 files changed, 70 insertions(+), 26 deletions(-) diff --git a/upload-api/migration-wordpress/libs/extractEntries.ts b/upload-api/migration-wordpress/libs/extractEntries.ts index 783cea92f..d6ae80cd9 100644 --- a/upload-api/migration-wordpress/libs/extractEntries.ts +++ b/upload-api/migration-wordpress/libs/extractEntries.ts @@ -7,6 +7,8 @@ const contentTypeFolderPath = path.resolve(config?.data, contentTypesConfig?.dir const EXCLUDED_POST_TYPES = new Set(['attachment', 'wp_global_styles', 'wp_navigation']); +const ALLOWED_POST_STATUSES = new Set(['publish', 'inherit']); + const normalizeArray = (value: T | T[] | undefined): T[] => { if (!value) return []; return Array.isArray(value) ? value : [value]; @@ -59,12 +61,12 @@ const getSourceEntryUid = (item: any): string => { const authorId = item?.['wp:author_id']; if (authorId != null && String(authorId).trim() !== '') { - return idCorrector(`posts_${authorId}`); + return idCorrector(`authors_${authorId}`); } const termId = item?.['wp:term_id']; if (termId != null && String(termId).trim() !== '') { - return idCorrector(`posts_${termId}`); + return idCorrector(`terms_${termId}`); } const candidate = @@ -102,6 +104,8 @@ const extractEntries = async (filePath: string, contentTypeData: any[] = []) => const groupedByType = items?.reduce((acc: Record, item: any) => { const postType = item?.['wp:post_type'] || 'unknown'; if (EXCLUDED_POST_TYPES.has(postType)) return acc; + const postStatus = String(item?.['wp:status'] || '').toLowerCase(); + if (!ALLOWED_POST_STATUSES.has(postStatus)) return acc; if (!acc[postType]) acc[postType] = []; acc[postType].push(item); return acc; @@ -112,7 +116,7 @@ const extractEntries = async (filePath: string, contentTypeData: any[] = []) => if (authorData) { const authorEntries = normalizeArray(authorData).map((author: any) => ({ 'wp:post_type': 'author', - 'wp:post_id': author?.['wp:author_id'], + 'wp:author_id': author?.['wp:author_id'], title: author?.['wp:author_display_name'] || author?.['wp:author_login'], 'wp:author_login': author?.['wp:author_login'], 'wp:author_email': author?.['wp:author_email'], diff --git a/upload-api/migration-wordpress/libs/extractItems.ts b/upload-api/migration-wordpress/libs/extractItems.ts index 594fe6179..0b16aa336 100644 --- a/upload-api/migration-wordpress/libs/extractItems.ts +++ b/upload-api/migration-wordpress/libs/extractItems.ts @@ -5,7 +5,7 @@ import * as cheerio from 'cheerio'; import { setupWordPressBlocks } from "../utils/parseUtil"; -import { clientIdForUid, getFieldName, getFieldUid, schemaMapper } from "./schemaMapper"; +import { stableSuffix, getFieldName, getFieldUid, schemaMapper } from "./schemaMapper"; import helper from "../utils/helper"; import config from '../config/index.json'; import extractTaxonomy from './extractTaxonomy'; @@ -365,7 +365,7 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // Track processed similar blocks to avoid duplicates for (const field of blocksJson) { - const fieldUid = getFieldUid(`${field?.name}_${clientIdForUid(field?.clientId)}`|| '', affix || ''); + const fieldUid = getFieldUid(`${field?.name}${stableSuffix(field)}`|| '', affix || ''); const contentstackFieldName = getFieldName(resolveBlockName(field)); const similarBlocks = findSimilarBlocks(result, field?.clientId); @@ -428,7 +428,7 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // No duplicate found - add the modular block child if(Schema?.length > 0){ CT?.push?.({ - "uid": `modular_blocks.${getFieldUid(`${field?.name}_${clientIdForUid(field?.clientId)}`, affix)}`, + "uid": `modular_blocks.${getFieldUid(`${field?.name}${stableSuffix(field)}`, affix)}`, "backupFieldUid": `modular_blocks.${fieldUid}`, "contentstackFieldUid": `modular_blocks.${fieldUid}`, "otherCmsField": contentstackFieldName, @@ -484,7 +484,7 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // No duplicate found - add the modular block child if(Schema?.length > 0){ CT?.push?.({ - "uid": `modular_blocks.${getFieldUid(`${field?.name}_${clientIdForUid(field?.clientId)}`, affix)}`, + "uid": `modular_blocks.${getFieldUid(`${field?.name}${stableSuffix(field)}`, affix)}`, "backupFieldUid": `modular_blocks.${fieldUid}`, "contentstackFieldUid": `modular_blocks.${fieldUid}`, "otherCmsField": contentstackFieldName, diff --git a/upload-api/migration-wordpress/libs/schemaMapper.ts b/upload-api/migration-wordpress/libs/schemaMapper.ts index 81fedd442..8b90bd418 100644 --- a/upload-api/migration-wordpress/libs/schemaMapper.ts +++ b/upload-api/migration-wordpress/libs/schemaMapper.ts @@ -50,6 +50,46 @@ export function clientIdForUid(clientId: string | undefined): string { const compact = clientId?.replace?.(/-/g, '')?.toLowerCase(); return compact?.slice?.(0, 4) || '0'; } + +/** Slugify an author-supplied identifier into a UID-safe token (lowercase, `_`-joined). */ +const slugifyIdentifier = (value: unknown): string => { + if (value == null) return ''; + return String(value) + .toLowerCase() + .replace(/[^a-z0-9]+/g, '_') + .replace(/^_+|_+$/g, ''); +}; + +/** Cap for the identity suffix so UIDs stay short. */ +const MAX_SUFFIX_LEN = 40; + +/** + * Deterministic, iteration-stable suffix for a block's field UID. + * + * The UID used to embed `clientIdForUid(block.clientId)`, but Gutenberg's parse() + * mints a fresh random clientId on every parse — so the UID changed on each + * re-migration and Contentstack treated the field as brand new, never updating + * the existing content on a 2nd iteration. + * + * This keys off `attributes.metadata.name` — the explicit author "Rename block" + * label — which survives re-parse, content edits, and reordering. It is the ONLY + * attribute the block de-duplication (`resolveBlockName`) uses to decide whether + * two same-named blocks are separate fields, so it is the correct — and only + * meaningful — disambiguator. + * + * We deliberately do NOT use `anchor`/`id`: those don't affect field separation + * and are frequently auto-derived from the block's text, which would make UIDs + * long and couple them to content (an edit would change the UID). Anonymous + * blocks therefore get NO suffix — the block name alone is a stable, unique UID + * within its scope. + * + * Returns a leading-underscore token (e.g. "_hero") or "" when anonymous, so + * callers can append it directly after the block name. + */ +export function stableSuffix(key: any): string { + const identity = slugifyIdentifier(key?.attributes?.metadata?.name).slice(0, MAX_SUFFIX_LEN); + return identity ? `_${identity}` : ''; +} async function processInnerBlocks(key: WordPressBlock, parentUid: string | null = null, parentFieldName: string | null = null, affix: string | null = null): Promise { @@ -207,8 +247,8 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/verse': case 'core/code': { const rteUid = parentUid ? - `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` - : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` + : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: rteUid, otherCmsField: getFieldName(key?.name), @@ -223,8 +263,8 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: } case 'core/missing': const rteUid = parentUid ? - `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` - : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` + : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); if(key?.attributes?.originalName === 'jetpack/markdown'){ return { uid: rteUid, @@ -296,7 +336,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/audio': case 'core/video': case 'core/file': { - const fileUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const fileUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: fileUid, @@ -314,7 +354,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/heading': case 'core/accordion-heading': case 'core/list-item': { - const textUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const textUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: textUid, otherCmsField: getFieldName(key?.name), @@ -331,7 +371,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/social-link': case 'core/navigation-link': { - const LinkUid = parentUid ? `${parentUid}.${getFieldUid(key?.name, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const LinkUid = parentUid ? `${parentUid}.${getFieldUid(key?.name, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: LinkUid, otherCmsField: getFieldName(key?.name), @@ -377,7 +417,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: } const groupSchema: Field[] = []; - const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); const innerBlocks = await processInnerBlocks( key, @@ -423,7 +463,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/accordion-panel': case 'core/navigation': { const groupSchema: Field[] = []; - const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); const innerBlocks = await processInnerBlocks( key, @@ -465,14 +505,14 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: const coverSchema: Field[] = [] if(key?.attributes?.url){ coverSchema.push({ - uid: `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`, + uid: `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`, otherCmsField: 'media', otherCmsType: getFieldName(key?.attributes?.metadata?.name ?? key?.name), contentstackField: 'media', - contentstackFieldUid: `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`, + contentstackFieldUid: `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`, contentstackFieldType: 'file', backupFieldType: 'file', - backupFieldUid: `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`, + backupFieldUid: `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`, advanced: {} }); } @@ -498,7 +538,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/search': { - const searchEleUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const searchEleUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); const searchEle = await processAttributes(key, searchEleUid,fieldName, affix); const groupSchema: Field[] = []; searchEle?.length > 0 && groupSchema?.push({ @@ -526,7 +566,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/button': { const fieldName = parentFieldName ? `${parentFieldName} > ${getFieldName(key?.attributes?.metadata?.name ?? key?.name)}` : `${getFieldName(key?.attributes?.metadata?.name ?? key?.name)}` ; - const buttonUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const buttonUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: buttonUid, @@ -544,7 +584,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/buttons': { const groupSchema: Field[] = []; - const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const groupUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); const innerBlocks = await processInnerBlocks( key, @@ -556,12 +596,12 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: const items = Array.isArray(innerBlocks[0]) ? innerBlocks[0] : [innerBlocks[0]]; items?.forEach((item: Field) => { - item.uid = `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`; + item.uid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; item.otherCmsField = getFieldName(resolveBlockName(key)); item.otherCmsType = getFieldName(resolveBlockName(key)); item.contentstackField = `${parentFieldName} > ${getFieldName(resolveBlockName(key))}`; - item.contentstackFieldUid = `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`; - item.backupFieldUid = `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}`; + item.contentstackFieldUid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; + item.backupFieldUid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; }); return items; } @@ -596,7 +636,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/media-text': { const mediaTextSchema: Field[] = []; - const mediaTextUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix)}` : getFieldUid(`${key?.name}_${clientIdForUid(key?.clientId)}`, affix); + const mediaTextUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); const innerBlocks = key?.innerBlocks && key?.innerBlocks?.length > 0 ? await processInnerBlocks(key, parentUid, parentFieldName, affix) From d97e459d732baebc8f568a543791077adb4c36f0 Mon Sep 17 00:00:00 2001 From: Aishwarya Date: Wed, 8 Jul 2026 16:01:04 +0530 Subject: [PATCH 2/4] fix: correct UID generation for core/buttons and update test expectations --- .../tests/unit/migration-wordpress/schemaMapper.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upload-api/tests/unit/migration-wordpress/schemaMapper.test.ts b/upload-api/tests/unit/migration-wordpress/schemaMapper.test.ts index f44cab33b..1d8ebf6e0 100644 --- a/upload-api/tests/unit/migration-wordpress/schemaMapper.test.ts +++ b/upload-api/tests/unit/migration-wordpress/schemaMapper.test.ts @@ -212,9 +212,9 @@ describe('schemaMapper', () => { const result = await schemaMapper(block, 'page', 'Page', affix); result.forEach((field: any) => { - expect(field.contentstackFieldUid).toBe(`page.${getFieldUid('core/buttons_btns', affix)}`); - expect(field.uid).toBe(`page.${getFieldUid('core/buttons_btns', affix)}`); - expect(field.backupFieldUid).toBe(`page.${getFieldUid('core/buttons_btns', affix)}`); + expect(field.contentstackFieldUid).toBe(`page.${getFieldUid('core/buttons', affix)}`); + expect(field.uid).toBe(`page.${getFieldUid('core/buttons', affix)}`); + expect(field.backupFieldUid).toBe(`page.${getFieldUid('core/buttons', affix)}`); expect(field.contentstackField).toContain('Page > '); }); }); @@ -259,7 +259,7 @@ describe('schemaMapper', () => { expect(Array.isArray(result)).toBe(true); const p = result[0] as any; - expect(p.uid).toMatch(/^panel_uid\.paragraph_/); + expect(p.uid).toBe('panel_uid.paragraph'); expect(p.contentstackField).toBe('Panel > paragraph'); }); From fd3ff1b44da00df930c5f17e8a67e56d97bf77dd Mon Sep 17 00:00:00 2001 From: Aishwarya Date: Wed, 8 Jul 2026 16:13:33 +0530 Subject: [PATCH 3/4] refactor: improve UID generation logic in extractEntries, extractItems, and schemaMapper --- upload-api/migration-wordpress/libs/extractEntries.ts | 5 +---- upload-api/migration-wordpress/libs/extractItems.ts | 9 ++++++--- upload-api/migration-wordpress/libs/schemaMapper.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/upload-api/migration-wordpress/libs/extractEntries.ts b/upload-api/migration-wordpress/libs/extractEntries.ts index d6ae80cd9..bdca8ddf0 100644 --- a/upload-api/migration-wordpress/libs/extractEntries.ts +++ b/upload-api/migration-wordpress/libs/extractEntries.ts @@ -49,10 +49,7 @@ const getEntryName = (item: any): string => { return 'Untitled Entry'; }; -/** - * All WordPress source entry keys use `posts_${...}` (any content type) so they align with - * wordpress.service export JSON and CLI uid-mapping. - */ + const getSourceEntryUid = (item: any): string => { const postId = item?.['wp:post_id']; if (postId != null && String(postId).trim() !== '') { diff --git a/upload-api/migration-wordpress/libs/extractItems.ts b/upload-api/migration-wordpress/libs/extractItems.ts index 0b16aa336..173b6ca48 100644 --- a/upload-api/migration-wordpress/libs/extractItems.ts +++ b/upload-api/migration-wordpress/libs/extractItems.ts @@ -365,7 +365,10 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // Track processed similar blocks to avoid duplicates for (const field of blocksJson) { - const fieldUid = getFieldUid(`${field?.name}${stableSuffix(field)}`|| '', affix || ''); + // Guard a missing block name (freeform/whitespace separators parse with name: null) + // so the UID never gets a literal "undefined" prefix. + const blockName = field?.name || 'block'; + const fieldUid = getFieldUid(`${blockName}${stableSuffix(field)}`, affix || ''); const contentstackFieldName = getFieldName(resolveBlockName(field)); const similarBlocks = findSimilarBlocks(result, field?.clientId); @@ -428,7 +431,7 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // No duplicate found - add the modular block child if(Schema?.length > 0){ CT?.push?.({ - "uid": `modular_blocks.${getFieldUid(`${field?.name}${stableSuffix(field)}`, affix)}`, + "uid": `modular_blocks.${getFieldUid(`${blockName}${stableSuffix(field)}`, affix)}`, "backupFieldUid": `modular_blocks.${fieldUid}`, "contentstackFieldUid": `modular_blocks.${fieldUid}`, "otherCmsField": contentstackFieldName, @@ -484,7 +487,7 @@ const extractItems = async (item: any, config: DataConfig, type: string, affix: // No duplicate found - add the modular block child if(Schema?.length > 0){ CT?.push?.({ - "uid": `modular_blocks.${getFieldUid(`${field?.name}${stableSuffix(field)}`, affix)}`, + "uid": `modular_blocks.${getFieldUid(`${blockName}${stableSuffix(field)}`, affix)}`, "backupFieldUid": `modular_blocks.${fieldUid}`, "contentstackFieldUid": `modular_blocks.${fieldUid}`, "otherCmsField": contentstackFieldName, diff --git a/upload-api/migration-wordpress/libs/schemaMapper.ts b/upload-api/migration-wordpress/libs/schemaMapper.ts index 8b90bd418..1c059dee6 100644 --- a/upload-api/migration-wordpress/libs/schemaMapper.ts +++ b/upload-api/migration-wordpress/libs/schemaMapper.ts @@ -371,7 +371,7 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: case 'core/social-link': case 'core/navigation-link': { - const LinkUid = parentUid ? `${parentUid}.${getFieldUid(key?.name, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); + const LinkUid = parentUid ? `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}` : getFieldUid(`${key?.name}${stableSuffix(key)}`, affix); return { uid: LinkUid, otherCmsField: getFieldName(key?.name), From c207fecb111c0b2930ffac5b3979040bc424c909 Mon Sep 17 00:00:00 2001 From: Aishwarya Date: Wed, 8 Jul 2026 20:12:09 +0530 Subject: [PATCH 4/4] fix: update UID assignment logic in extractEntries and schemaMapper for consistency --- upload-api/migration-wordpress/libs/extractEntries.ts | 1 - upload-api/migration-wordpress/libs/schemaMapper.ts | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/upload-api/migration-wordpress/libs/extractEntries.ts b/upload-api/migration-wordpress/libs/extractEntries.ts index bdca8ddf0..1153da2a5 100644 --- a/upload-api/migration-wordpress/libs/extractEntries.ts +++ b/upload-api/migration-wordpress/libs/extractEntries.ts @@ -131,7 +131,6 @@ const extractEntries = async (filePath: string, contentTypeData: any[] = []) => if (termData) { const termEntries = normalizeArray(termData).map((term: any) => ({ 'wp:post_type': 'terms', - 'wp:post_id': term?.['wp:term_id'], title: term?.['wp:term_name'] || term?.['wp:term_slug'], 'wp:term_id': term?.['wp:term_id'], 'wp:term_taxonomy': term?.['wp:term_taxonomy'], diff --git a/upload-api/migration-wordpress/libs/schemaMapper.ts b/upload-api/migration-wordpress/libs/schemaMapper.ts index 1c059dee6..2bfe6b484 100644 --- a/upload-api/migration-wordpress/libs/schemaMapper.ts +++ b/upload-api/migration-wordpress/libs/schemaMapper.ts @@ -595,13 +595,13 @@ async function schemaMapper (key: WordPressBlock | WordPressBlock[], parentUid: if (innerBlocks?.length === 1) { const items = Array.isArray(innerBlocks[0]) ? innerBlocks[0] : [innerBlocks[0]]; items?.forEach((item: Field) => { - - item.uid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; + + item.uid = groupUid; item.otherCmsField = getFieldName(resolveBlockName(key)); item.otherCmsType = getFieldName(resolveBlockName(key)); item.contentstackField = `${parentFieldName} > ${getFieldName(resolveBlockName(key))}`; - item.contentstackFieldUid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; - item.backupFieldUid = `${parentUid}.${getFieldUid(`${key?.name}${stableSuffix(key)}`, affix)}`; + item.contentstackFieldUid = groupUid; + item.backupFieldUid = groupUid; }); return items; }