@contentstack/cli-cm-import 1.28.3 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -67
- package/lib/commands/cm/stacks/import.js +8 -6
- package/lib/config/index.js +7 -0
- package/lib/import/modules/assets.js +18 -18
- package/lib/import/modules/base-class.d.ts +1 -0
- package/lib/import/modules/base-class.js +3 -1
- package/lib/import/modules/composable-studio.d.ts +43 -0
- package/lib/import/modules/composable-studio.js +231 -0
- package/lib/import/modules/content-types.js +9 -9
- package/lib/import/modules/custom-roles.js +24 -24
- package/lib/import/modules/entries.js +35 -18
- package/lib/import/modules/environments.js +10 -10
- package/lib/import/modules/extensions.js +16 -16
- package/lib/import/modules/global-fields.js +13 -13
- package/lib/import/modules/labels.js +12 -12
- package/lib/import/modules/locales.js +22 -22
- package/lib/import/modules/marketplace-apps.js +53 -53
- package/lib/import/modules/personalize.js +11 -11
- package/lib/import/modules/taxonomies.d.ts +23 -4
- package/lib/import/modules/taxonomies.js +180 -70
- package/lib/import/modules-js/entries.js +1 -1
- package/lib/import/modules-js/marketplace-apps.js +2 -2
- package/lib/types/default-config.d.ts +6 -0
- package/lib/types/index.d.ts +27 -1
- package/lib/utils/content-type-helper.js +2 -2
- package/lib/utils/file-helper.js +1 -1
- package/lib/utils/import-config-handler.js +2 -2
- package/lib/utils/login-handler.js +1 -1
- package/lib/utils/marketplace-app-helper.js +1 -1
- package/lib/utils/taxonomies-helper.js +1 -1
- package/messages/index.json +10 -1
- package/oclif.manifest.json +2 -2
- package/package.json +5 -5
|
@@ -37,42 +37,42 @@ class ImportMarketplaceApps {
|
|
|
37
37
|
*/
|
|
38
38
|
async start() {
|
|
39
39
|
var _a;
|
|
40
|
-
cli_utilities_1.log.debug('Checking
|
|
40
|
+
cli_utilities_1.log.debug('Checking if Marketplace apps folder exists...', this.importConfig.context);
|
|
41
41
|
if (utils_1.fileHelper.fileExistsSync(this.marketPlaceFolderPath)) {
|
|
42
42
|
cli_utilities_1.log.debug(`Found marketplace apps folder: ${this.marketPlaceFolderPath}`, this.importConfig.context);
|
|
43
43
|
this.marketplaceApps = utils_1.fsUtil.readFile((0, node_path_1.join)(this.marketPlaceFolderPath, this.marketPlaceAppConfig.fileName), true);
|
|
44
44
|
cli_utilities_1.log.debug(`Found ${((_a = this.marketplaceApps) === null || _a === void 0 ? void 0 : _a.length) || 0} marketplace apps to import`, this.importConfig.context);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
cli_utilities_1.log.info(`No Marketplace apps
|
|
47
|
+
cli_utilities_1.log.info(`No Marketplace apps found: '${this.marketPlaceFolderPath}'`, this.importConfig.context);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
if ((0, isEmpty_1.default)(this.marketplaceApps)) {
|
|
51
|
-
cli_utilities_1.log.debug('No
|
|
51
|
+
cli_utilities_1.log.debug('No Marketplace Apps found to import.', this.importConfig.context);
|
|
52
52
|
return Promise.resolve();
|
|
53
53
|
}
|
|
54
54
|
else if (!(0, cli_utilities_1.isAuthenticated)()) {
|
|
55
55
|
cli_utilities_1.cliux.print('\nWARNING!!! To import Marketplace apps, you must be logged in. Please check csdx auth:login --help to log in\n', { color: 'yellow' });
|
|
56
|
-
cli_utilities_1.log.info('Skipping
|
|
56
|
+
cli_utilities_1.log.info('Skipping Marketplace Apps import: user not authenticated.', this.importConfig.context);
|
|
57
57
|
return Promise.resolve();
|
|
58
58
|
}
|
|
59
|
-
cli_utilities_1.log.debug('Creating
|
|
59
|
+
cli_utilities_1.log.debug('Creating Marketplace Apps mapper directory...', this.importConfig.context);
|
|
60
60
|
await utils_1.fsUtil.makeDirectory(this.mapperDirPath);
|
|
61
|
-
cli_utilities_1.log.debug('Created
|
|
62
|
-
cli_utilities_1.log.debug('Getting
|
|
61
|
+
cli_utilities_1.log.debug('Created Marketplace Apps mapper directory.', this.importConfig.context);
|
|
62
|
+
cli_utilities_1.log.debug('Getting Developer Hub base URL...', this.importConfig.context);
|
|
63
63
|
this.developerHubBaseUrl = this.importConfig.developerHubBaseUrl || (await (0, utils_1.getDeveloperHubUrl)(this.importConfig));
|
|
64
64
|
this.importConfig.developerHubBaseUrl = this.developerHubBaseUrl;
|
|
65
|
-
cli_utilities_1.log.debug(`Using
|
|
65
|
+
cli_utilities_1.log.debug(`Using Developer Hub base URL: ${this.developerHubBaseUrl}`, this.importConfig.context);
|
|
66
66
|
// NOTE init marketplace app sdk
|
|
67
|
-
cli_utilities_1.log.debug('Initializing
|
|
67
|
+
cli_utilities_1.log.debug('Initializing Marketplace SDK client...', this.importConfig.context);
|
|
68
68
|
const host = this.developerHubBaseUrl.split('://').pop();
|
|
69
69
|
this.appSdk = await (0, cli_utilities_1.marketplaceSDKClient)({ host });
|
|
70
|
-
cli_utilities_1.log.debug('Initialized
|
|
71
|
-
cli_utilities_1.log.debug('Getting organization UID', this.importConfig.context);
|
|
70
|
+
cli_utilities_1.log.debug('Initialized Marketplace SDK client.', this.importConfig.context);
|
|
71
|
+
cli_utilities_1.log.debug('Getting organization UID...', this.importConfig.context);
|
|
72
72
|
this.importConfig.org_uid = await (0, utils_1.getOrgUid)(this.importConfig);
|
|
73
73
|
cli_utilities_1.log.debug(`Using organization UID: ${this.importConfig.org_uid}`, this.importConfig.context);
|
|
74
74
|
// NOTE start the marketplace import process
|
|
75
|
-
cli_utilities_1.log.debug('Starting
|
|
75
|
+
cli_utilities_1.log.debug('Starting Marketplace Apps import process...', this.importConfig.context);
|
|
76
76
|
await this.importMarketplaceApps();
|
|
77
77
|
cli_utilities_1.log.success('Marketplace apps have been imported successfully!', this.importConfig.context);
|
|
78
78
|
}
|
|
@@ -82,32 +82,32 @@ class ImportMarketplaceApps {
|
|
|
82
82
|
*/
|
|
83
83
|
async importMarketplaceApps() {
|
|
84
84
|
var _a, _b, _c;
|
|
85
|
-
cli_utilities_1.log.debug('Setting up security configuration for
|
|
85
|
+
cli_utilities_1.log.debug('Setting up security configuration for Marketplace Apps...', this.importConfig.context);
|
|
86
86
|
// NOTE set default encryptionKey
|
|
87
87
|
const cryptoArgs = { encryptionKey: this.importConfig.marketplaceAppEncryptionKey };
|
|
88
88
|
if (this.importConfig.forceStopMarketplaceAppsPrompt) {
|
|
89
|
-
cli_utilities_1.log.debug('Using forced security configuration without validation', this.importConfig.context);
|
|
89
|
+
cli_utilities_1.log.debug('Using forced security configuration without validation.', this.importConfig.context);
|
|
90
90
|
this.nodeCrypto = new cli_utilities_1.NodeCrypto(cryptoArgs);
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
cli_utilities_1.log.debug('Validating security configuration', this.importConfig.context);
|
|
93
|
+
cli_utilities_1.log.debug('Validating security configuration...', this.importConfig.context);
|
|
94
94
|
await this.getAndValidateEncryptionKey(this.importConfig.marketplaceAppEncryptionKey);
|
|
95
95
|
}
|
|
96
96
|
// NOTE install all private apps which is not available for stack.
|
|
97
|
-
cli_utilities_1.log.debug('Handling private apps creation process', this.importConfig.context);
|
|
97
|
+
cli_utilities_1.log.debug('Handling private apps creation process...', this.importConfig.context);
|
|
98
98
|
await this.handleAllPrivateAppsCreationProcess();
|
|
99
99
|
// NOTE getting all apps to validate if it's already installed in the stack to manage conflict
|
|
100
|
-
cli_utilities_1.log.debug('Getting all stack-specific apps for validation', this.importConfig.context);
|
|
100
|
+
cli_utilities_1.log.debug('Getting all stack-specific apps for validation...', this.importConfig.context);
|
|
101
101
|
this.installedApps = await (0, utils_1.getAllStackSpecificApps)(this.importConfig);
|
|
102
102
|
cli_utilities_1.log.debug(`Found ${((_a = this.installedApps) === null || _a === void 0 ? void 0 : _a.length) || 0} already installed apps`, this.importConfig.context);
|
|
103
|
-
cli_utilities_1.log.info('Starting
|
|
103
|
+
cli_utilities_1.log.info('Starting Marketplace App installation...', this.importConfig.context);
|
|
104
104
|
for (let app of this.marketplaceApps) {
|
|
105
105
|
cli_utilities_1.log.debug(`Processing app: ${((_b = app.manifest) === null || _b === void 0 ? void 0 : _b.name) || ((_c = app.manifest) === null || _c === void 0 ? void 0 : _c.uid)}`, this.importConfig.context);
|
|
106
106
|
await this.installApps(app);
|
|
107
107
|
}
|
|
108
|
-
cli_utilities_1.log.debug('Generating UID mapper', this.importConfig.context);
|
|
108
|
+
cli_utilities_1.log.debug('Generating UID mapper...', this.importConfig.context);
|
|
109
109
|
const uidMapper = await this.generateUidMapper();
|
|
110
|
-
cli_utilities_1.log.debug('Writing UID mappings to file', this.importConfig.context);
|
|
110
|
+
cli_utilities_1.log.debug('Writing UID mappings to file...', this.importConfig.context);
|
|
111
111
|
utils_1.fsUtil.writeFile(this.marketPlaceUidMapperPath, {
|
|
112
112
|
app_uid: this.appUidMapping,
|
|
113
113
|
extension_uid: uidMapper || {},
|
|
@@ -125,21 +125,21 @@ class ImportMarketplaceApps {
|
|
|
125
125
|
*/
|
|
126
126
|
async generateUidMapper() {
|
|
127
127
|
var _a, _b, _c, _d, _e;
|
|
128
|
-
cli_utilities_1.log.debug('Generating UID mapper for extensions', this.importConfig.context);
|
|
128
|
+
cli_utilities_1.log.debug('Generating UID mapper for extensions...', this.importConfig.context);
|
|
129
129
|
const listOfNewMeta = [];
|
|
130
130
|
const listOfOldMeta = [];
|
|
131
131
|
const extensionUidMap = {};
|
|
132
132
|
// NOTE After installation getting all apps to create mapper.
|
|
133
|
-
cli_utilities_1.log.debug('Fetching updated list of installed apps', this.importConfig.context);
|
|
133
|
+
cli_utilities_1.log.debug('Fetching updated list of installed apps...', this.importConfig.context);
|
|
134
134
|
this.installedApps = (await (0, utils_1.getAllStackSpecificApps)(this.importConfig)) || [];
|
|
135
135
|
cli_utilities_1.log.debug(`Found ${((_a = this.installedApps) === null || _a === void 0 ? void 0 : _a.length) || 0} installed apps after installation`, this.importConfig.context);
|
|
136
|
-
cli_utilities_1.log.debug('Processing old metadata from
|
|
136
|
+
cli_utilities_1.log.debug('Processing old metadata from Marketplace Apps...', this.importConfig.context);
|
|
137
137
|
for (const app of this.marketplaceApps) {
|
|
138
138
|
const appMeta = (0, map_1.default)((_b = app === null || app === void 0 ? void 0 : app.ui_location) === null || _b === void 0 ? void 0 : _b.locations, 'meta').flat();
|
|
139
139
|
listOfOldMeta.push(...appMeta);
|
|
140
140
|
cli_utilities_1.log.debug(`Added ${appMeta.length} meta entries from app: ${(_c = app.manifest) === null || _c === void 0 ? void 0 : _c.name}`, this.importConfig.context);
|
|
141
141
|
}
|
|
142
|
-
cli_utilities_1.log.debug('Processing new metadata from installed apps', this.importConfig.context);
|
|
142
|
+
cli_utilities_1.log.debug('Processing new metadata from installed apps...', this.importConfig.context);
|
|
143
143
|
for (const app of this.installedApps) {
|
|
144
144
|
const appMeta = (0, map_1.default)((_d = app === null || app === void 0 ? void 0 : app.ui_location) === null || _d === void 0 ? void 0 : _d.locations, 'meta').flat();
|
|
145
145
|
listOfNewMeta.push(...appMeta);
|
|
@@ -174,18 +174,18 @@ class ImportMarketplaceApps {
|
|
|
174
174
|
cli_utilities_1.log.debug(`Validating security configuration (attempt ${retry})`, this.importConfig.context);
|
|
175
175
|
let appConfig = (0, find_1.default)(this.marketplaceApps, ({ configuration, server_configuration }) => !(0, isEmpty_1.default)(configuration) || !(0, isEmpty_1.default)(server_configuration));
|
|
176
176
|
if (!appConfig) {
|
|
177
|
-
cli_utilities_1.log.debug('No app configuration found requiring encryption', this.importConfig.context);
|
|
177
|
+
cli_utilities_1.log.debug('No app configuration found requiring encryption.', this.importConfig.context);
|
|
178
178
|
return defaultValue;
|
|
179
179
|
}
|
|
180
180
|
cli_utilities_1.log.debug('Found app configuration requiring security setup, asking for input', this.importConfig.context);
|
|
181
181
|
const encryptionKey = await (0, interactive_1.askEncryptionKey)(defaultValue);
|
|
182
182
|
try {
|
|
183
183
|
appConfig = !(0, isEmpty_1.default)(appConfig.configuration) ? appConfig.configuration : appConfig.server_configuration;
|
|
184
|
-
cli_utilities_1.log.debug('Creating NodeCrypto instance with security configuration', this.importConfig.context);
|
|
184
|
+
cli_utilities_1.log.debug('Creating NodeCrypto instance with security configuration...', this.importConfig.context);
|
|
185
185
|
this.nodeCrypto = new cli_utilities_1.NodeCrypto({ encryptionKey });
|
|
186
|
-
cli_utilities_1.log.debug('Testing security configuration with app data', this.importConfig.context);
|
|
186
|
+
cli_utilities_1.log.debug('Testing security configuration with app data...', this.importConfig.context);
|
|
187
187
|
this.nodeCrypto.decrypt(appConfig);
|
|
188
|
-
cli_utilities_1.log.debug('Security configuration validation successful', this.importConfig.context);
|
|
188
|
+
cli_utilities_1.log.debug('Security configuration validation successful.', this.importConfig.context);
|
|
189
189
|
}
|
|
190
190
|
catch (error) {
|
|
191
191
|
cli_utilities_1.log.debug(`Security configuration validation failed: ${error.message}`, this.importConfig.context);
|
|
@@ -197,7 +197,7 @@ class ImportMarketplaceApps {
|
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
199
|
cli_utilities_1.cliux.print(`Maximum retry limit exceeded. Closing the process, please try again.! attempt(${retry}/${this.importConfig.getEncryptionKeyMaxRetry})`, { color: 'red' });
|
|
200
|
-
cli_utilities_1.log.debug('Maximum retry limit exceeded for encryption validation', this.importConfig.context);
|
|
200
|
+
cli_utilities_1.log.debug('Maximum retry limit exceeded for encryption validation.', this.importConfig.context);
|
|
201
201
|
process.exit(1);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -210,25 +210,25 @@ class ImportMarketplaceApps {
|
|
|
210
210
|
* @returns a Promise that resolves to void.
|
|
211
211
|
*/
|
|
212
212
|
async handleAllPrivateAppsCreationProcess() {
|
|
213
|
-
cli_utilities_1.log.debug('Filtering private apps from
|
|
213
|
+
cli_utilities_1.log.debug('Filtering private apps from Marketplace Apps...', this.importConfig.context);
|
|
214
214
|
const privateApps = (0, filter_1.default)(this.marketplaceApps, { manifest: { visibility: 'private' } });
|
|
215
215
|
cli_utilities_1.log.debug(`Found ${privateApps.length} private apps to process`, this.importConfig.context);
|
|
216
216
|
if ((0, isEmpty_1.default)(privateApps)) {
|
|
217
217
|
cli_utilities_1.log.debug('No private apps found, skipping private app creation process', this.importConfig.context);
|
|
218
218
|
return Promise.resolve();
|
|
219
219
|
}
|
|
220
|
-
cli_utilities_1.log.debug('Getting confirmation to create private apps', this.importConfig.context);
|
|
220
|
+
cli_utilities_1.log.debug('Getting confirmation to create private apps...', this.importConfig.context);
|
|
221
221
|
let canCreatePrivateApp = await (0, utils_1.getConfirmationToCreateApps)(privateApps, this.importConfig);
|
|
222
222
|
this.importConfig.canCreatePrivateApp = canCreatePrivateApp;
|
|
223
223
|
if (canCreatePrivateApp) {
|
|
224
|
-
cli_utilities_1.log.info('Starting
|
|
224
|
+
cli_utilities_1.log.info('Starting Developer Hub private apps re-creation...', this.importConfig.context);
|
|
225
225
|
cli_utilities_1.log.debug(`Processing ${privateApps.length} private apps for creation`, this.importConfig.context);
|
|
226
226
|
for (let app of privateApps) {
|
|
227
227
|
cli_utilities_1.log.debug(`Checking if private app exists: ${app.manifest.name}`, this.importConfig.context);
|
|
228
228
|
if (await this.isPrivateAppExistInDeveloperHub(app)) {
|
|
229
229
|
// NOTE Found app already exist in the same org
|
|
230
230
|
this.appUidMapping[app.uid] = app.uid;
|
|
231
|
-
cli_utilities_1.cliux.print(`App '${app.manifest.name}' already
|
|
231
|
+
cli_utilities_1.cliux.print(`App '${app.manifest.name}' already exists. Skipping app recreation.`, { color: 'yellow' });
|
|
232
232
|
cli_utilities_1.log.debug(`App '${app.manifest.name}' already exists, skipping recreation`, this.importConfig.context);
|
|
233
233
|
continue;
|
|
234
234
|
}
|
|
@@ -254,7 +254,7 @@ class ImportMarketplaceApps {
|
|
|
254
254
|
cli_utilities_1.log.success(`Completed processing ${privateApps.length} private apps`, this.importConfig.context);
|
|
255
255
|
}
|
|
256
256
|
else {
|
|
257
|
-
cli_utilities_1.log.info('Skipping private apps creation on Developer Hub
|
|
257
|
+
cli_utilities_1.log.info('Skipping private apps creation on Developer Hub…', this.importConfig.context);
|
|
258
258
|
}
|
|
259
259
|
this.appOriginalName = undefined;
|
|
260
260
|
cli_utilities_1.log.debug('Private apps creation process completed', this.importConfig.context);
|
|
@@ -275,11 +275,11 @@ class ImportMarketplaceApps {
|
|
|
275
275
|
.fetch()
|
|
276
276
|
.catch(() => {
|
|
277
277
|
var _a;
|
|
278
|
-
cli_utilities_1.log.debug(`App ${(_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name} not found in
|
|
278
|
+
cli_utilities_1.log.debug(`App ${(_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name} not found in Developer Hub.`, this.importConfig.context);
|
|
279
279
|
return undefined;
|
|
280
280
|
}); // NOTE Keeping this to avoid Unhandled exception
|
|
281
281
|
const exists = !(0, isEmpty_1.default)(installation);
|
|
282
|
-
cli_utilities_1.log.debug(`Private app ${(_b = app.manifest) === null || _b === void 0 ? void 0 : _b.name} exists in
|
|
282
|
+
cli_utilities_1.log.debug(`Private app ${(_b = app.manifest) === null || _b === void 0 ? void 0 : _b.name} exists in Developer Hub: ${exists}`, this.importConfig.context);
|
|
283
283
|
return exists;
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
@@ -298,7 +298,7 @@ class ImportMarketplaceApps {
|
|
|
298
298
|
var _a, _b;
|
|
299
299
|
cli_utilities_1.log.debug(`Creating private app: ${app.name} (suffix: ${appSuffix}, updateUiLocation: ${updateUiLocation})`, this.importConfig.context);
|
|
300
300
|
if (updateUiLocation && !(0, isEmpty_1.default)((_a = app === null || app === void 0 ? void 0 : app.ui_location) === null || _a === void 0 ? void 0 : _a.locations)) {
|
|
301
|
-
cli_utilities_1.log.debug(`Updating UI locations for app: ${app.name}
|
|
301
|
+
cli_utilities_1.log.debug(`Updating UI locations for app: ${app.name}...`, this.importConfig.context);
|
|
302
302
|
app.ui_location.locations = this.updateManifestUILocations((_b = app === null || app === void 0 ? void 0 : app.ui_location) === null || _b === void 0 ? void 0 : _b.locations, appSuffix);
|
|
303
303
|
}
|
|
304
304
|
if (app.name.length > 20) {
|
|
@@ -394,7 +394,7 @@ class ImportMarketplaceApps {
|
|
|
394
394
|
*/
|
|
395
395
|
async appCreationCallback(app, response, appSuffix) {
|
|
396
396
|
const { statusText, message } = response || {};
|
|
397
|
-
cli_utilities_1.log.debug(`Processing app creation callback for: ${app.name} (suffix: ${appSuffix})
|
|
397
|
+
cli_utilities_1.log.debug(`Processing app creation callback for: ${app.name} (suffix: ${appSuffix})...`, this.importConfig.context);
|
|
398
398
|
if (message) {
|
|
399
399
|
cli_utilities_1.log.debug(`App creation response has message: ${message}`, this.importConfig.context);
|
|
400
400
|
if ((0, toLower_1.default)(statusText) === 'conflict') {
|
|
@@ -411,11 +411,11 @@ class ImportMarketplaceApps {
|
|
|
411
411
|
return Promise.resolve();
|
|
412
412
|
}
|
|
413
413
|
if (await cli_utilities_1.cliux.confirm(chalk_1.default.yellow('WARNING!!! The above error may have an impact if the failed app is referenced in entries/content type. Would you like to proceed? (y/n)'))) {
|
|
414
|
-
cli_utilities_1.log.debug('User chose to proceed despite error', this.importConfig.context);
|
|
414
|
+
cli_utilities_1.log.debug('User chose to proceed despite error.', this.importConfig.context);
|
|
415
415
|
Promise.resolve();
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
|
-
cli_utilities_1.log.debug('User chose to exit due to error', this.importConfig.context);
|
|
418
|
+
cli_utilities_1.log.debug('User chose to exit due to error.', this.importConfig.context);
|
|
419
419
|
process.exit();
|
|
420
420
|
}
|
|
421
421
|
}
|
|
@@ -449,7 +449,7 @@ class ImportMarketplaceApps {
|
|
|
449
449
|
cli_utilities_1.log.debug(`App not found in current stack, installing new app: ${(_d = app.manifest) === null || _d === void 0 ? void 0 : _d.name}`, this.importConfig.context);
|
|
450
450
|
// NOTE install new app
|
|
451
451
|
if (app.manifest.visibility === 'private' && !this.importConfig.canCreatePrivateApp) {
|
|
452
|
-
cli_utilities_1.log.info(`Skipping
|
|
452
|
+
cli_utilities_1.log.info(`Skipping installation of the private app: ${app.manifest.name}…`, this.importConfig.context);
|
|
453
453
|
return Promise.resolve();
|
|
454
454
|
}
|
|
455
455
|
cli_utilities_1.log.debug(`Installing app with manifest UID: ${this.appUidMapping[app.manifest.uid] || app.manifest.uid}`, this.importConfig.context);
|
|
@@ -460,7 +460,7 @@ class ImportMarketplaceApps {
|
|
|
460
460
|
const appName = this.appNameMapping[app.manifest.name] || app.manifest.name || app.manifest.uid;
|
|
461
461
|
cli_utilities_1.log.success(`${appName} app installed successfully.!`, this.importConfig.context);
|
|
462
462
|
cli_utilities_1.log.debug(`Installation UID: ${installation.installation_uid}`, this.importConfig.context);
|
|
463
|
-
cli_utilities_1.log.debug(`Making redirect URL call for
|
|
463
|
+
cli_utilities_1.log.debug(`Making redirect URL call for: ${appName}`, this.importConfig.context);
|
|
464
464
|
await (0, utils_1.makeRedirectUrlCall)(installation, appName, this.importConfig);
|
|
465
465
|
this.installationUidMapping[app.uid] = installation.installation_uid;
|
|
466
466
|
cli_utilities_1.log.debug(`Installation UID mapping: ${app.uid} → ${installation.installation_uid}`, this.importConfig.context);
|
|
@@ -468,14 +468,14 @@ class ImportMarketplaceApps {
|
|
|
468
468
|
}
|
|
469
469
|
else if (installation.message) {
|
|
470
470
|
cli_utilities_1.log.info((0, utils_1.formatError)(installation.message), this.importConfig.context);
|
|
471
|
-
cli_utilities_1.log.debug(`Installation failed for
|
|
471
|
+
cli_utilities_1.log.debug(`Installation failed for: ${(_e = app.manifest) === null || _e === void 0 ? void 0 : _e.name}`, this.importConfig.context);
|
|
472
472
|
await (0, utils_1.confirmToCloseProcess)(installation, this.importConfig);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
else if (!(0, isEmpty_1.default)(configuration) || !(0, isEmpty_1.default)(server_configuration)) {
|
|
476
476
|
const appName = app.manifest.name || app.manifest.uid;
|
|
477
|
-
cli_utilities_1.log.info(`${appName} is already installed
|
|
478
|
-
cli_utilities_1.log.debug(`Handling existing
|
|
477
|
+
cli_utilities_1.log.info(`${appName} is already installed.`, this.importConfig.context);
|
|
478
|
+
cli_utilities_1.log.debug(`Handling existing configuration for: ${appName}`, this.importConfig.context);
|
|
479
479
|
updateParam = await (0, utils_1.ifAppAlreadyExist)(app, currentStackApp, this.importConfig);
|
|
480
480
|
}
|
|
481
481
|
else {
|
|
@@ -491,7 +491,7 @@ class ImportMarketplaceApps {
|
|
|
491
491
|
await this.updateAppsConfig(updateParam);
|
|
492
492
|
}
|
|
493
493
|
else {
|
|
494
|
-
cli_utilities_1.log.debug(`No
|
|
494
|
+
cli_utilities_1.log.debug(`No update needed for configuration: ${(_h = app.manifest) === null || _h === void 0 ? void 0 : _h.name}`, this.importConfig.context);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
@@ -503,9 +503,9 @@ class ImportMarketplaceApps {
|
|
|
503
503
|
async updateAppsConfig(app) {
|
|
504
504
|
const { installation_uid, configuration, server_configuration } = app;
|
|
505
505
|
const appName = app.manifest.name || app.manifest.uid;
|
|
506
|
-
cli_utilities_1.log.debug(`Updating
|
|
506
|
+
cli_utilities_1.log.debug(`Updating configuration for: ${appName} (${installation_uid})`, this.importConfig.context);
|
|
507
507
|
if (!(0, isEmpty_1.default)(configuration)) {
|
|
508
|
-
cli_utilities_1.log.debug(`Updating
|
|
508
|
+
cli_utilities_1.log.debug(`Updating configuration for: ${appName}`, this.importConfig.context);
|
|
509
509
|
await this.appSdk
|
|
510
510
|
.marketplace(this.importConfig.org_uid)
|
|
511
511
|
.installation(installation_uid)
|
|
@@ -517,17 +517,17 @@ class ImportMarketplaceApps {
|
|
|
517
517
|
}
|
|
518
518
|
else {
|
|
519
519
|
cli_utilities_1.log.success(`${appName} app config updated successfully.!`, this.importConfig.context);
|
|
520
|
-
cli_utilities_1.log.debug(`Configuration update successful for: ${appName}`, this.importConfig.context);
|
|
520
|
+
cli_utilities_1.log.debug(`Configuration update was successful for: ${appName}`, this.importConfig.context);
|
|
521
521
|
}
|
|
522
522
|
})
|
|
523
523
|
.catch((error) => {
|
|
524
524
|
(0, log_1.trace)(error, 'error', true);
|
|
525
525
|
cli_utilities_1.log.error((0, utils_1.formatError)(error), this.importConfig.context);
|
|
526
|
-
cli_utilities_1.log.debug(`Configuration update failed for: ${appName}
|
|
526
|
+
cli_utilities_1.log.debug(`Configuration update failed for: ${appName}.`, this.importConfig.context);
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
if (!(0, isEmpty_1.default)(server_configuration)) {
|
|
530
|
-
cli_utilities_1.log.debug(`Updating server configuration for: ${appName}
|
|
530
|
+
cli_utilities_1.log.debug(`Updating server configuration for: ${appName}...`, this.importConfig.context);
|
|
531
531
|
await this.appSdk
|
|
532
532
|
.marketplace(this.importConfig.org_uid)
|
|
533
533
|
.installation(installation_uid)
|
|
@@ -539,13 +539,13 @@ class ImportMarketplaceApps {
|
|
|
539
539
|
}
|
|
540
540
|
else {
|
|
541
541
|
cli_utilities_1.log.success(`${appName} app server config updated successfully.!`, this.importConfig.context);
|
|
542
|
-
cli_utilities_1.log.debug(`Server configuration update successful for: ${appName}
|
|
542
|
+
cli_utilities_1.log.debug(`Server configuration update was successful for: ${appName}.`, this.importConfig.context);
|
|
543
543
|
}
|
|
544
544
|
})
|
|
545
545
|
.catch((error) => {
|
|
546
546
|
(0, log_1.trace)(error, 'error', true);
|
|
547
547
|
cli_utilities_1.log.error((0, utils_1.formatError)(error), this.importConfig.context);
|
|
548
|
-
cli_utilities_1.log.debug(`Server configuration update failed for: ${appName}
|
|
548
|
+
cli_utilities_1.log.debug(`Server configuration update failed for: ${appName}.`, this.importConfig.context);
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
}
|
|
@@ -22,15 +22,15 @@ class ImportPersonalize {
|
|
|
22
22
|
}
|
|
23
23
|
if (this.config.management_token) {
|
|
24
24
|
cli_utilities_1.log.debug('Management token detected, skipping personalize import', this.config.context);
|
|
25
|
-
cli_utilities_1.log.info('Skipping Personalize project import when using management token', this.config.context);
|
|
25
|
+
cli_utilities_1.log.info('Skipping Personalize project import when using management token...', this.config.context);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
cli_utilities_1.log.debug('Starting
|
|
28
|
+
cli_utilities_1.log.debug('Starting Personalize project import...', this.config.context);
|
|
29
29
|
cli_utilities_1.log.debug(`Base URL: ${this.personalizeConfig.baseURL[this.config.region.name]}`, this.config.context);
|
|
30
30
|
await new cli_variants_1.Import.Project(this.config).import();
|
|
31
|
-
cli_utilities_1.log.debug('Personalize project import completed', this.config.context);
|
|
31
|
+
cli_utilities_1.log.debug('Personalize project import completed.', this.config.context);
|
|
32
32
|
if (this.personalizeConfig.importData) {
|
|
33
|
-
cli_utilities_1.log.debug('Personalize data import is enabled', this.config.context);
|
|
33
|
+
cli_utilities_1.log.debug('Personalize data import is enabled.', this.config.context);
|
|
34
34
|
const moduleMapper = {
|
|
35
35
|
events: cli_variants_1.Import.Events,
|
|
36
36
|
audiences: cli_variants_1.Import.Audiences,
|
|
@@ -39,11 +39,11 @@ class ImportPersonalize {
|
|
|
39
39
|
};
|
|
40
40
|
const order = this.personalizeConfig
|
|
41
41
|
.importOrder;
|
|
42
|
-
cli_utilities_1.log.debug(`Processing ${order.length}
|
|
42
|
+
cli_utilities_1.log.debug(`Processing ${order.length} Personalize modules in order: ${order.join(', ')}`, this.config.context);
|
|
43
43
|
const moduleTypes = Object.keys(moduleMapper || {}).join(', ');
|
|
44
44
|
cli_utilities_1.log.debug(`Available module types: ${moduleTypes}`, this.config.context);
|
|
45
45
|
for (const module of order) {
|
|
46
|
-
cli_utilities_1.log.debug(`Starting import for
|
|
46
|
+
cli_utilities_1.log.debug(`Starting import for Personalize module: ${module}`, this.config.context);
|
|
47
47
|
const Module = moduleMapper[module];
|
|
48
48
|
if (!Module) {
|
|
49
49
|
cli_utilities_1.log.debug(`Module ${module} not found in moduleMapper`, this.config.context);
|
|
@@ -54,12 +54,12 @@ class ImportPersonalize {
|
|
|
54
54
|
cli_utilities_1.log.debug(`Importing ${module} module`, this.config.context);
|
|
55
55
|
await moduleInstance.import();
|
|
56
56
|
cli_utilities_1.log.success(`Successfully imported personalize module: ${module}`, this.config.context);
|
|
57
|
-
cli_utilities_1.log.debug(`Completed import for
|
|
57
|
+
cli_utilities_1.log.debug(`Completed import for Personalize module: ${module}`, this.config.context);
|
|
58
58
|
}
|
|
59
|
-
cli_utilities_1.log.debug('All
|
|
59
|
+
cli_utilities_1.log.debug('All Personalize modules imported successfully.', this.config.context);
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
cli_utilities_1.log.debug('Personalize data import is disabled', this.config.context);
|
|
62
|
+
cli_utilities_1.log.debug('Personalize data import is disabled.', this.config.context);
|
|
63
63
|
}
|
|
64
64
|
cli_utilities_1.log.success('Personalize import completed successfully', this.config.context);
|
|
65
65
|
}
|
|
@@ -67,8 +67,8 @@ class ImportPersonalize {
|
|
|
67
67
|
this.personalizeConfig.importData = false; // Stop personalize import if project creation fails
|
|
68
68
|
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.config.context));
|
|
69
69
|
if (!this.personalizeConfig.importData) {
|
|
70
|
-
cli_utilities_1.log.debug('Personalize import data flag set to false due to error', this.config.context);
|
|
71
|
-
cli_utilities_1.log.info('Skipping
|
|
70
|
+
cli_utilities_1.log.debug('Personalize import data flag set to false due to error.', this.config.context);
|
|
71
|
+
cli_utilities_1.log.info('Skipping Personalize migration…', this.config.context);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -10,6 +10,8 @@ export default class ImportTaxonomies extends BaseClass {
|
|
|
10
10
|
private termsMapperDirPath;
|
|
11
11
|
private termsSuccessPath;
|
|
12
12
|
private termsFailsPath;
|
|
13
|
+
private localesFilePath;
|
|
14
|
+
private isLocaleBasedStructure;
|
|
13
15
|
createdTaxonomies: Record<string, unknown>;
|
|
14
16
|
failedTaxonomies: Record<string, unknown>;
|
|
15
17
|
createdTerms: Record<string, Record<string, unknown>>;
|
|
@@ -26,17 +28,34 @@ export default class ImportTaxonomies extends BaseClass {
|
|
|
26
28
|
* @async
|
|
27
29
|
* @returns {Promise<any>} Promise<any>
|
|
28
30
|
*/
|
|
29
|
-
importTaxonomies(
|
|
31
|
+
importTaxonomies({ apiContent, localeCode }: {
|
|
32
|
+
apiContent: any[];
|
|
33
|
+
localeCode?: string;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
importTaxonomiesLegacy(): Promise<void>;
|
|
36
|
+
importTaxonomiesByLocale(): Promise<void>;
|
|
37
|
+
handleSuccess(apiData: any, locale?: string): void;
|
|
38
|
+
handleFailure(error: any, apiData: any, locale?: string): void;
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {ApiOptions} apiOptions
|
|
33
|
-
* @
|
|
40
|
+
*
|
|
41
|
+
* @param {ApiOptions} apiOptions
|
|
42
|
+
* @param {?string} [localeCode]
|
|
43
|
+
* @returns {ApiOptions}
|
|
34
44
|
*/
|
|
35
45
|
serializeTaxonomy(apiOptions: ApiOptions): ApiOptions;
|
|
46
|
+
loadTaxonomyFile(filePath: string, context: string): Record<string, unknown> | undefined;
|
|
47
|
+
findTaxonomyFilePath(taxonomyUID: string): string | undefined;
|
|
48
|
+
findTaxonomyInLocaleFolders(taxonomyUID: string): string | undefined;
|
|
49
|
+
loadAvailableLocales(): Record<string, string>;
|
|
36
50
|
/**
|
|
37
51
|
* create taxonomies success and fail in (mapper/taxonomies)
|
|
38
52
|
* create terms success and fail in (mapper/taxonomies/terms)
|
|
39
53
|
* @method createSuccessAndFailedFile
|
|
40
54
|
*/
|
|
41
55
|
createSuccessAndFailedFile(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Detect if locale-based folder structure exists and scan taxonomies by locale
|
|
58
|
+
* @returns {boolean} true if locale-based structure detected, false otherwise
|
|
59
|
+
*/
|
|
60
|
+
detectAndScanLocaleStructure(): boolean;
|
|
42
61
|
}
|