Skip to content

Commit

Permalink
Merge pull request #1453 from contentstack/fix/DX-722
Browse files Browse the repository at this point in the history
fix: fixed missing plugin id in ct schema
  • Loading branch information
aman19K authored Jul 4, 2024
2 parents 01e37ff + 443e785 commit 22c7609
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/contentstack-import/src/utils/extension-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const lookupExtension = function (
const fs = new FsUtility({ basePath: config.backupDir });
const extensionPath = join(config.backupDir, 'mapper/extensions', 'uid-mapping.json');
const globalfieldsPath = join(config.backupDir, 'mapper/globalfields', 'uid-mapping.json');
const marketPlaceAppsPath = join(config.backupDir, 'mapper/marketplace_apps', 'uid-mapping.json');

for (let i in schema) {
if (schema[i].data_type === 'group') {
Expand Down Expand Up @@ -72,9 +73,12 @@ export const lookupExtension = function (
} else if (schema[i].data_type === 'json' && schema[i].hasOwnProperty('plugins') && schema[i].plugins.length > 0) {
const newPluginUidsArray: any[] = [];
const data = fs.readFile(extensionPath) as Record<string, unknown>;
const marketPlaceAppsData = fs.readFile(marketPlaceAppsPath) as { extension_uid: Record<string, unknown> };
schema[i].plugins.forEach((extension_key_value: string) => {
if (data && data.hasOwnProperty(extension_key_value)) {
newPluginUidsArray.push(data[extension_key_value]);
} else if (marketPlaceAppsData && marketPlaceAppsData.extension_uid && marketPlaceAppsData.extension_uid.hasOwnProperty(extension_key_value)) {
newPluginUidsArray.push(marketPlaceAppsData.extension_uid[extension_key_value]);
}
});
schema[i].plugins = newPluginUidsArray;
Expand Down

0 comments on commit 22c7609

Please sign in to comment.