@@ -98,59 +98,6 @@ let singleImport = async (moduleName, types, config) => {
9898 } )
9999}
100100
101- // function field_rules_update(config, ctPath) {
102- // return new Promise(function (resolve, reject) {
103- // let client = stack.Client(config)
104-
105- // fs.readFile(path.join(ctPath + '/field_rules_uid.json'), async (err, data) => {
106- // if (err) {
107- // throw err;
108- // }
109- // var ct_field_visibility_uid = JSON.parse(data)
110- // let ct_files = fs.readdirSync(ctPath)
111- // if (ct_field_visibility_uid && ct_field_visibility_uid != 'undefined') {
112- // for (let index = 0; index < ct_field_visibility_uid.length; index++) {
113- // if (ct_files.indexOf(ct_field_visibility_uid[index] + '.json') > -1) {
114- // let schema = require(path.resolve(ctPath, ct_field_visibility_uid[index]))
115- // // await field_rules_update(schema)
116- // let fieldRuleLength = schema.field_rules.length
117- // for (let k = 0; k < fieldRuleLength; k++) {
118- // let fieldRuleConditionLength = schema.field_rules[k].conditions.length
119- // for (let i = 0; i < fieldRuleConditionLength; i++) {
120- // if (schema.field_rules[k].conditions[i].operand_field === 'reference') {
121- // let entryMapperPath = path.resolve(config.data, 'mapper', 'entries')
122- // let entryUidMapperPath = path.join(entryMapperPath, 'uid-mapping.json')
123- // let fieldRulesValue = schema.field_rules[k].conditions[i].value
124- // let fieldRulesArray = fieldRulesValue.split('.')
125- // let updatedValue = []
126- // for (let j = 0; j < fieldRulesArray.length; j++) {
127- // let splitedFieldRulesValue = fieldRulesArray[j]
128- // let oldUid = helper.readFile(path.join(entryUidMapperPath))
129- // if (oldUid.hasOwnProperty(splitedFieldRulesValue)) {
130- // updatedValue.push(oldUid[splitedFieldRulesValue])
131- // } else {
132- // updatedValue.push(fieldRulesArray[j])
133- // }
134- // }
135- // schema.field_rules[k].conditions[i].value = updatedValue.join('.')
136- // }
137- // }
138- // }
139- // let ctObj = client.stack({ api_key: config.target_stack, management_token: config.management_token }).contentType(schema.uid)
140- // Object.assign(ctObj, _.cloneDeep(schema))
141- // ctObj.update()
142- // .then(() => {
143- // return resolve()
144- // }).catch(function (error) {
145- // return reject(error)
146- // })
147- // }
148- // }
149- // }
150- // })
151- // })
152- // }
153-
154101let allImport = async ( config , types ) => {
155102 return new Promise ( async ( resolve , reject ) => {
156103 try {
@@ -175,7 +122,6 @@ let allImport = async (config, types) => {
175122 }
176123 return resolve ( )
177124 } catch ( error ) {
178- console . log ( "errrorororo" , error ) ;
179125 addlogs ( config , chalk . red ( 'Failed to migrate stack: ' + config . target_stack + '. Please check error logs for more info' ) , 'error' )
180126 addlogs ( config , error , 'error' )
181127 addlogs ( config , 'The log for this is stored at ' + path . join ( config . oldPath , 'logs' , 'import' ) , 'error' )
@@ -184,24 +130,6 @@ let allImport = async (config, types) => {
184130 } )
185131}
186132
187- // let masterLocalDetails = async (credentialConfig) => {
188- // let client = stack.Client(credentialConfig)
189- // return new Promise((resolve, reject) => {
190- // var result = client.stack({ api_key: credentialConfig.target_stack, management_token: credentialConfig.management_token }).locale().query()
191- // result.find()
192- // .then(response => {
193- // var masterLocalObj = response.items.filter(obj => {
194- // if (obj.fallback_locale === null) {
195- // return obj
196- // }
197- // });
198- // return resolve(masterLocalObj)
199- // }).catch(error => {
200- // return reject(error)
201- // })
202- // })
203- // }
204-
205133function createBackup ( backupDirPath , config ) {
206134 return new Promise ( ( resolve , reject ) => {
207135 if ( config . hasOwnProperty ( 'useBackedupDir' ) && fs . existsSync ( config . useBackedupDir ) ) {
0 commit comments