@@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
66import { JSDOM } from "jsdom" ;
77import { htmlToJson } from '@contentstack/json-rte-serializer' ;
88import { buildSchemaTree } from '../utils/content-type-creator.utils.js' ;
9- import { MIGRATION_DATA_CONFIG , LOCALE_MAPPER } from '../constants/index.js' ;
9+ import { MIGRATION_DATA_CONFIG , LOCALE_MAPPER , RESERVED_FIELD_MAPPINGS } from '../constants/index.js' ;
1010import { getLogMessage } from '../utils/index.js' ;
1111import customLogger from '../utils/custom-logger.utils.js' ;
1212import { orgService } from './org.service.js' ;
@@ -144,6 +144,17 @@ function getFieldValue(items: any, fieldName: string): any {
144144 return undefined ;
145145}
146146
147+
148+ function getActualFieldUid ( uid : string , fieldUid : string ) : string {
149+ if ( RESERVED_FIELD_MAPPINGS [ uid ] ) {
150+ return RESERVED_FIELD_MAPPINGS [ uid ] ;
151+ }
152+ if ( RESERVED_FIELD_MAPPINGS [ fieldUid ] ) {
153+ return RESERVED_FIELD_MAPPINGS [ fieldUid ] ;
154+ }
155+ return uid ;
156+ }
157+
147158/**
148159 * Finds and returns the asset object from assetJsonData where assetPath matches the given string.
149160 * @param assetJsonData - The asset JSON data object.
@@ -613,15 +624,16 @@ function processFieldsRecursive(
613624 }
614625
615626 case 'single_line_text' : {
616- const aemFieldName = field ?. otherCmsField ? getLastKey ( field . otherCmsField , ' > ' ) : getLastKey ( field ?. uid ) ;
627+ const aemFieldName = field ?. otherCmsField ? getLastKey ( field ? .otherCmsField , ' > ' ) : getLastKey ( field ?. uid ) ;
617628 let value = getFieldValue ( items , aemFieldName ) ;
618629 const uid = getLastKey ( field ?. contentstackFieldUid ) ;
619630
631+ const actualUid = getActualFieldUid ( uid , field ?. uid ) ;
620632 if ( value && typeof value === 'string' && / < [ ^ > ] + > / . test ( value ) ) {
621633 value = stripHtmlTags ( value ) ;
622634 }
623635
624- obj [ uid ] = value !== null && value !== undefined ? String ( value ) : "" ;
636+ obj [ actualUid ] = value !== null && value !== undefined ? String ( value ) : "" ;
625637 break ;
626638 }
627639
0 commit comments