@@ -1026,8 +1026,27 @@ const writeGlobalField = async (schema: any, globalSave: string) => {
10261026 }
10271027} ;
10281028
1029- const existingCtMapper = async ( { keyMapper, contentTypeUid, projectId, region, user_id, type} : any ) => {
1029+ const resolveIsSsoFlag = ( is_sso : any ) : boolean => {
1030+ if ( typeof is_sso === 'boolean' ) {
1031+ return is_sso ;
1032+ }
1033+
1034+ if ( is_sso === 'true' ) {
1035+ return true ;
1036+ }
1037+
1038+ if ( is_sso === 'false' ) {
1039+ return false ;
1040+ }
1041+
1042+ throw new Error (
1043+ `Invalid token_payload.is_sso in existingCtMapper; expected boolean, received: ${ JSON . stringify ( is_sso ) } `
1044+ ) ;
1045+ } ;
1046+
1047+ const existingCtMapper = async ( { keyMapper, contentTypeUid, projectId, region, user_id, is_sso, type} : any ) => {
10301048 try {
1049+ const normalizedIsSso = resolveIsSsoFlag ( is_sso ) ;
10311050 const ctUid = keyMapper ?. [ contentTypeUid ] ;
10321051
10331052 if ( type === 'global_field' ) {
@@ -1040,7 +1059,8 @@ const existingCtMapper = async ({ keyMapper, contentTypeUid, projectId, region,
10401059 body : {
10411060 token_payload : {
10421061 region,
1043- user_id
1062+ user_id,
1063+ is_sso : normalizedIsSso
10441064 }
10451065 }
10461066 }
@@ -1055,7 +1075,8 @@ const existingCtMapper = async ({ keyMapper, contentTypeUid, projectId, region,
10551075 body : {
10561076 token_payload : {
10571077 region,
1058- user_id
1078+ user_id,
1079+ is_sso : normalizedIsSso
10591080 }
10601081 }
10611082 }
@@ -1141,7 +1162,7 @@ const mergeTwoCts = async (ct: any, mergeCts: any) => {
11411162 return ctData ;
11421163}
11431164
1144- export const contenTypeMaker = async ( { contentType, destinationStackId, projectId, newStack, keyMapper, region, user_id } : any ) => {
1165+ export const contenTypeMaker = async ( { contentType, destinationStackId, projectId, newStack, keyMapper, region, user_id, is_sso } : any ) => {
11451166 const marketPlacePath = path . join ( process . cwd ( ) , MIGRATION_DATA_CONFIG . DATA , destinationStackId ) ;
11461167 const srcFunc = 'contenTypeMaker' ;
11471168
@@ -1155,7 +1176,7 @@ export const contenTypeMaker = async ({ contentType, destinationStackId, project
11551176 if ( Object ?. keys ?.( keyMapper ) ?. length &&
11561177 keyMapper ?. [ contentType ?. contentstackUid ] !== "" &&
11571178 keyMapper ?. [ contentType ?. contentstackUid ] !== undefined ) {
1158- currentCt = await existingCtMapper ( { keyMapper, contentTypeUid : contentType ?. contentstackUid , projectId, region, user_id , type : contentType ?. type } ) ;
1179+ currentCt = await existingCtMapper ( { keyMapper, contentTypeUid : contentType ?. contentstackUid , projectId, region, user_id, is_sso , type : contentType ?. type } ) ;
11591180 }
11601181
11611182 // Safe: ensures we never pass undefined to the builder
0 commit comments