Skip to content

Commit

Permalink
entry post fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeeqd959 committed Jul 19, 2022
1 parent 2fe30ab commit 58a39a8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/contentstack-import/src/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ module.exports = {
'environments',
'assets',
'extensions',
'webhooks',
'global-fields',
'content-types',
'workflows',
'entries',
'labels',
'webhooks',
],
locales: {
dirName: 'locales',
Expand Down
1 change: 1 addition & 0 deletions packages/contentstack-import/src/lib/import/entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ importEntries.prototype = {
.contentType(ctUid)
.entry(entry.uid);
Object.assign(entryResponse, entry);
delete entryResponse.title;
delete entryResponse.publish_details;
return entryResponse
.update({ locale: lang })
Expand Down
41 changes: 21 additions & 20 deletions packages/contentstack-import/src/lib/import/webhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,34 @@ importWebhooks.prototype = {
webUids,
function (webUid) {
let web = self.webhooks[webUid];
if (config.disableWebhooks) {
web.disabled = true;
}
if (!self.webUidMapper.hasOwnProperty(webUid)) {
let requestOption = {
json: {
webhook: web,
},
};

return (
client
.stack({ api_key: config.target_stack, management_token: config.management_token })
.webhook()
.create(requestOption.json)
.then(function (response) {
self.success.push(response);
self.webUidMapper[webUid] = response.uid;
helper.writeFile(webUidMapperPath, self.webUidMapper);
})
.catch(function (err) {
let error = JSON.parse(err.message);
self.fails.push(web);
addlogs(
config,
chalk.red("Webhooks: '" + web.name + "' failed to be import\n" + JSON.stringify(error)),
'error',
);
})
);
return client
.stack({ api_key: config.target_stack, management_token: config.management_token })
.webhook()
.create(requestOption.json)
.then(function (response) {
self.success.push(response);
self.webUidMapper[webUid] = response.uid;
helper.writeFile(webUidMapperPath, self.webUidMapper);
})
.catch(function (err) {
let error = JSON.parse(err.message);
self.fails.push(web);
addlogs(
config,
chalk.red("Webhooks: '" + web.name + "' failed to be import\n" + JSON.stringify(error)),
'error',
);
});
} else {
// the webhooks has already been created
addlogs(
Expand Down

0 comments on commit 58a39a8

Please sign in to comment.