@@ -24,7 +24,6 @@ import {
2424} from '../../utils' ;
2525import { ModuleClassParams } from '../../types' ;
2626import BaseClass , { ApiOptions } from './base-class' ;
27-
2827export default class EntriesImport extends BaseClass {
2928 private assetUidMapperPath : string ;
3029 private assetUidMapper : Record < string , any > ;
@@ -68,11 +67,25 @@ export default class EntriesImport extends BaseClass {
6867 this . entriesUIDMapperPath = path . join ( sanitizePath ( this . entriesMapperPath ) , 'uid-mapping.json' ) ;
6968 this . uniqueUidMapperPath = path . join ( sanitizePath ( this . entriesMapperPath ) , 'unique-mapping.json' ) ;
7069 this . modifiedCTsPath = path . join ( sanitizePath ( this . entriesMapperPath ) , 'modified-schemas.json' ) ;
71- this . marketplaceAppMapperPath = path . join ( sanitizePath ( this . importConfig . data ) , 'mapper' , 'marketplace_apps' , 'uid-mapping.json' ) ;
72- this . taxonomiesPath = path . join ( sanitizePath ( this . importConfig . data ) , 'mapper' , 'taxonomies' , 'terms' , 'success.json' ) ;
70+ this . marketplaceAppMapperPath = path . join (
71+ sanitizePath ( this . importConfig . data ) ,
72+ 'mapper' ,
73+ 'marketplace_apps' ,
74+ 'uid-mapping.json' ,
75+ ) ;
76+ this . taxonomiesPath = path . join (
77+ sanitizePath ( this . importConfig . data ) ,
78+ 'mapper' ,
79+ 'taxonomies' ,
80+ 'terms' ,
81+ 'success.json' ,
82+ ) ;
7383 this . entriesConfig = importConfig . modules . entries ;
7484 this . entriesPath = path . resolve ( sanitizePath ( importConfig . data ) , sanitizePath ( this . entriesConfig . dirName ) ) ;
75- this . cTsPath = path . resolve ( sanitizePath ( importConfig . data ) , sanitizePath ( importConfig . modules [ 'content-types' ] . dirName ) ) ;
85+ this . cTsPath = path . resolve (
86+ sanitizePath ( importConfig . data ) ,
87+ sanitizePath ( importConfig . modules [ 'content-types' ] . dirName ) ,
88+ ) ;
7689 this . localesPath = path . resolve (
7790 sanitizePath ( importConfig . data ) ,
7891 sanitizePath ( importConfig . modules . locales . dirName ) ,
@@ -898,23 +911,35 @@ export default class EntriesImport extends BaseClass {
898911
899912 if ( chunk ) {
900913 let apiContent = values ( chunk as Record < string , any > [ ] ) ;
901- await this . makeConcurrentCall ( {
902- apiContent,
903- processName,
904- indexerCount,
905- currentIndexer : + index ,
906- apiParams : {
907- reject : onReject ,
908- resolve : onSuccess ,
909- entity : 'publish-entries' ,
910- includeParamOnCompletion : true ,
911- serializeData : this . serializePublishEntries . bind ( this ) ,
912- additionalInfo : { contentType, locale, cTUid } ,
913- } ,
914- concurrencyLimit : this . importConcurrency ,
915- } ) . then ( ( ) => {
916- log ( this . importConfig , `Published entries for content type ${ cTUid } in locale ${ locale } ` , 'success' ) ;
914+ let apiContentDuplicate : any = [ ] ;
915+ apiContent . forEach ( ( content : Record < string , any > ) => {
916+ content ?. publish_details ?. forEach ( ( publish : Record < string , any > ) => {
917+ let c2 = { ...content } ;
918+ c2 . locale = publish . locale ;
919+ c2 . publish_details = [ publish ] ;
920+ apiContentDuplicate . push ( c2 ) ;
921+ } ) ;
917922 } ) ;
923+ for ( let i = 0 ; i < apiContentDuplicate . length ; i ++ ) {
924+ let apiContent = [ apiContentDuplicate [ i ] ] ;
925+ await this . makeConcurrentCall ( {
926+ apiContent,
927+ processName,
928+ indexerCount,
929+ currentIndexer : + index ,
930+ apiParams : {
931+ reject : onReject ,
932+ resolve : onSuccess ,
933+ entity : 'publish-entries' ,
934+ includeParamOnCompletion : true ,
935+ serializeData : this . serializePublishEntries . bind ( this ) ,
936+ additionalInfo : { contentType, locale : apiContentDuplicate [ i ] ?. locale , cTUid } ,
937+ } ,
938+ concurrencyLimit : this . importConcurrency ,
939+ } ) . then ( ( ) => {
940+ log ( this . importConfig , `Published entries for content type ${ cTUid } in locale ${ locale } ` , 'success' ) ;
941+ } ) ;
942+ }
918943 }
919944 }
920945 }
0 commit comments