@contentstack/cli-cm-import 1.29.0 → 1.30.1

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.
@@ -37,42 +37,42 @@ class ImportMarketplaceApps {
37
37
  */
38
38
  async start() {
39
39
  var _a;
40
- cli_utilities_1.log.debug('Checking for marketplace apps folder existence', this.importConfig.context);
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 are found - '${this.marketPlaceFolderPath}'`, this.importConfig.context);
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 marketplace apps found to import', this.importConfig.context);
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 marketplace apps import - user not authenticated', this.importConfig.context);
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 marketplace apps mapper directory', this.importConfig.context);
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 marketplace apps mapper directory', this.importConfig.context);
62
- cli_utilities_1.log.debug('Getting developer hub base URL', this.importConfig.context);
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 developer hub base URL: ${this.developerHubBaseUrl}`, this.importConfig.context);
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 marketplace SDK client', this.importConfig.context);
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 marketplace SDK client', this.importConfig.context);
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 marketplace apps import process', this.importConfig.context);
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 marketplace apps', this.importConfig.context);
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 marketplace app installation', this.importConfig.context);
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 marketplace apps', this.importConfig.context);
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 marketplace apps', this.importConfig.context);
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 developer hub private apps re-creation', this.importConfig.context);
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 exist. skipping app recreation.!`, { color: 'yellow' });
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...', this.importConfig.context);
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 developer hub`, this.importConfig.context);
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 developer hub: ${exists}`, this.importConfig.context);
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}`, this.importConfig.context);
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})`, this.importConfig.context);
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 the installation of the private app ${app.manifest.name}...`, this.importConfig.context);
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 app: ${appName}`, this.importConfig.context);
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 app: ${(_e = app.manifest) === null || _e === void 0 ? void 0 : _e.name}`, this.importConfig.context);
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`, this.importConfig.context);
478
- cli_utilities_1.log.debug(`Handling existing app configuration for: ${appName}`, this.importConfig.context);
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 configuration update needed for: ${(_h = app.manifest) === null || _h === void 0 ? void 0 : _h.name}`, this.importConfig.context);
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 app configuration for: ${appName} (${installation_uid})`, this.importConfig.context);
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 app configuration for: ${appName}`, this.importConfig.context);
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}`, this.importConfig.context);
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}`, this.importConfig.context);
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}`, this.importConfig.context);
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}`, this.importConfig.context);
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 personalize project import', this.config.context);
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} personalize modules in order: ${order.join(', ')}`, this.config.context);
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 personalize module: ${module}`, this.config.context);
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 personalize module: ${module}`, this.config.context);
57
+ cli_utilities_1.log.debug(`Completed import for Personalize module: ${module}`, this.config.context);
58
58
  }
59
- cli_utilities_1.log.debug('All personalize modules imported successfully', this.config.context);
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 personalize migration...', this.config.context);
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
  }
@@ -31,30 +31,30 @@ class ImportTaxonomies extends base_class_1.default {
31
31
  * @returns {Promise<void>} Promise<void>
32
32
  */
33
33
  async start() {
34
- cli_utilities_1.log.debug('Checking for taxonomies folder existence', this.importConfig.context);
34
+ cli_utilities_1.log.debug('Checking for taxonomy folder existence', this.importConfig.context);
35
35
  //Step1 check folder exists or not
36
36
  if (utils_1.fileHelper.fileExistsSync(this.taxonomiesFolderPath)) {
37
- cli_utilities_1.log.debug(`Found taxonomies folder: ${this.taxonomiesFolderPath}`, this.importConfig.context);
37
+ cli_utilities_1.log.debug(`Found taxonomy folder at: ${this.taxonomiesFolderPath}`, this.importConfig.context);
38
38
  this.taxonomies = utils_1.fsUtil.readFile((0, node_path_1.join)(this.taxonomiesFolderPath, 'taxonomies.json'), true);
39
39
  const taxonomyCount = Object.keys(this.taxonomies || {}).length;
40
- cli_utilities_1.log.debug(`Loaded ${taxonomyCount} taxonomy items from file`, this.importConfig.context);
40
+ cli_utilities_1.log.debug(`Loaded ${taxonomyCount} taxonomy items from file.`, this.importConfig.context);
41
41
  }
42
42
  else {
43
- cli_utilities_1.log.info(`No Taxonomies Found! - '${this.taxonomiesFolderPath}'`, this.importConfig.context);
43
+ cli_utilities_1.log.info(`No taxonomies found at: '${this.taxonomiesFolderPath}'`, this.importConfig.context);
44
44
  return;
45
45
  }
46
46
  //Step 2 create taxonomies & terms mapper directory
47
- cli_utilities_1.log.debug('Creating mapper directories', this.importConfig.context);
47
+ cli_utilities_1.log.debug('Creating mapper directories...', this.importConfig.context);
48
48
  await utils_1.fsUtil.makeDirectory(this.taxonomiesMapperDirPath);
49
49
  await utils_1.fsUtil.makeDirectory(this.termsMapperDirPath);
50
- cli_utilities_1.log.debug('Created taxonomies and terms mapper directories', this.importConfig.context);
50
+ cli_utilities_1.log.debug('Created taxonomies and terms mapper directories.', this.importConfig.context);
51
51
  // Step 3: Check if locale-based structure exists and scan taxonomies by locale
52
52
  cli_utilities_1.log.debug('Checking for locale-based folder structure', this.importConfig.context);
53
53
  this.isLocaleBasedStructure = this.detectAndScanLocaleStructure();
54
54
  // Step 4 import taxonomies
55
55
  if (this.isLocaleBasedStructure) {
56
56
  cli_utilities_1.log.debug('Detected locale-based folder structure for taxonomies', this.importConfig.context);
57
- cli_utilities_1.log.debug('Starting taxonomies import', this.importConfig.context);
57
+ cli_utilities_1.log.debug('Starting taxonomies import...', this.importConfig.context);
58
58
  await this.importTaxonomiesByLocale();
59
59
  }
60
60
  else {
@@ -63,7 +63,7 @@ class ImportTaxonomies extends base_class_1.default {
63
63
  cli_utilities_1.log.debug('Using legacy folder structure for taxonomies', this.importConfig.context);
64
64
  }
65
65
  //Step 5 create taxonomy & related terms success & failure file
66
- cli_utilities_1.log.debug('Creating success and failure files', this.importConfig.context);
66
+ cli_utilities_1.log.debug('Creating success and failure files...', this.importConfig.context);
67
67
  this.createSuccessAndFailedFile();
68
68
  cli_utilities_1.log.success('Taxonomies imported successfully!', this.importConfig.context);
69
69
  }
@@ -122,7 +122,7 @@ class ImportTaxonomies extends base_class_1.default {
122
122
  var _a, _b, _c;
123
123
  const taxonomyUID = (_a = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy) === null || _a === void 0 ? void 0 : _a.uid;
124
124
  if ((error === null || error === void 0 ? void 0 : error.status) === 409 && (error === null || error === void 0 ? void 0 : error.statusText) === 'Conflict') {
125
- cli_utilities_1.log.info(`Taxonomy '${taxonomyUID}' already exists${locale ? ` for locale: ${locale}` : ''}!`, this.importConfig.context);
125
+ cli_utilities_1.log.info(`Taxonomy '${taxonomyUID}' already exists ${locale ? ` for locale: ${locale}` : ''}!`, this.importConfig.context);
126
126
  this.createdTaxonomies[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy;
127
127
  this.createdTerms[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.terms;
128
128
  return;
@@ -243,7 +243,7 @@ class ImportTaxonomies extends base_class_1.default {
243
243
  */
244
244
  createSuccessAndFailedFile() {
245
245
  var _a, _b, _c, _d;
246
- cli_utilities_1.log.debug('Creating success and failed files for taxonomies and terms', this.importConfig.context);
246
+ cli_utilities_1.log.debug('Creating success and failed files for taxonomies and terms...', this.importConfig.context);
247
247
  const createdTaxCount = (_a = Object.keys(this.createdTaxonomies)) === null || _a === void 0 ? void 0 : _a.length;
248
248
  const failedTaxCount = (_b = Object.keys(this.failedTaxonomies)) === null || _b === void 0 ? void 0 : _b.length;
249
249
  const createdTermsCount = (_c = Object.keys(this.createdTerms)) === null || _c === void 0 ? void 0 : _c.length;
@@ -934,7 +934,7 @@ module.exports = class ImportEntries {
934
934
  addlogs(this.config, `Entries published successfully in '${ctUid}' content type`, 'info');
935
935
  })
936
936
  .catch((error) => {
937
- console.log(error);
937
+ console.log('Error', error);
938
938
  addlogs(this.config, `failed to publish entry in content type '${ctUid}' ${formatError(error)}`, 'error');
939
939
  });
940
940
  }
@@ -65,7 +65,7 @@ module.exports = class ImportMarketplaceApps {
65
65
  .stack({ api_key: this.config.target_stack })
66
66
  .fetch()
67
67
  .catch((error) => {
68
- console.log(error);
68
+ console.log('Error', error);
69
69
  });
70
70
  if (tempStackData === null || tempStackData === void 0 ? void 0 : tempStackData.org_uid) {
71
71
  this.config.org_uid = tempStackData.org_uid;
@@ -376,7 +376,7 @@ module.exports = class ImportMarketplaceApps {
376
376
  return updateParam;
377
377
  }
378
378
  async confirmToCloseProcess(installation) {
379
- cliux.print(`\nWARNING!!! ${formatError(installation.message)}\n`, { color: 'yellow' });
379
+ cliux.print(`\nWARNING: ${formatError(installation.message)}\n`, { color: 'yellow' });
380
380
  if (!this.config.forceStopMarketplaceAppsPrompt) {
381
381
  if (!(await cliux.confirm(chalk.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)')))) {
382
382
  process.exit();
@@ -156,6 +156,12 @@ export default interface DefaultConfig {
156
156
  locale: string;
157
157
  } & AnyProperty;
158
158
  } & AnyProperty;
159
+ 'composable-studio': {
160
+ dirName: string;
161
+ fileName: string;
162
+ apiBaseUrl: string;
163
+ apiVersion: string;
164
+ };
159
165
  };
160
166
  languagesCode: string[];
161
167
  apis: {
@@ -26,7 +26,7 @@ export interface User {
26
26
  email: string;
27
27
  authtoken: string;
28
28
  }
29
- export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize' | 'variant-entries';
29
+ export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize' | 'variant-entries' | 'composable-studio';
30
30
  export type ModuleClassParams = {
31
31
  stackAPIClient: ReturnType<ContentstackClient['stack']>;
32
32
  importConfig: ImportConfig;
@@ -71,6 +71,32 @@ export interface TaxonomiesConfig {
71
71
  fileName: string;
72
72
  dependencies?: Modules[];
73
73
  }
74
+ export interface ComposableStudioConfig {
75
+ dirName: string;
76
+ fileName: string;
77
+ apiBaseUrl: string;
78
+ apiVersion: string;
79
+ }
80
+ export interface ComposableStudioProject {
81
+ name: string;
82
+ description: string;
83
+ canvasUrl: string;
84
+ connectedStackApiKey: string;
85
+ contentTypeUid: string;
86
+ organizationUid: string;
87
+ settings: {
88
+ configuration: {
89
+ environment: string;
90
+ locale: string;
91
+ };
92
+ };
93
+ uid?: string;
94
+ createdBy?: string;
95
+ updatedBy?: string;
96
+ deletedAt?: boolean;
97
+ createdAt?: string;
98
+ updatedAt?: string;
99
+ }
74
100
  export interface Context {
75
101
  command: string;
76
102
  module: string;
@@ -128,7 +128,7 @@ const removeReferenceFields = async function (schema, flag = { supressed: false
128
128
  catch (error) {
129
129
  // Else warn and modify the schema object.
130
130
  isContentTypeError = true;
131
- cli_utilities_1.log.warn(`Content-type ${schema[i].reference_to[j]} does not exist. Removing the field from schema`);
131
+ cli_utilities_1.log.warn(`Content type ${schema[i].reference_to[j]} does not exist. Removing the field from schema...`);
132
132
  }
133
133
  }
134
134
  if (isContentTypeError) {
@@ -200,7 +200,7 @@ const updateFieldRules = function (contentType) {
200
200
  const field = contentType.schema[i];
201
201
  fieldDataTypeMap[field.uid] = field.data_type;
202
202
  }
203
- cli_utilities_1.log.debug(`Created field data type mapping for ${Object.keys(fieldDataTypeMap).length} fields`);
203
+ cli_utilities_1.log.debug(`Created field data type mapping for ${Object.keys(fieldDataTypeMap).length} fields.`);
204
204
  const fieldRules = [...contentType.field_rules];
205
205
  let len = fieldRules.length;
206
206
  let removedRules = 0;
@@ -58,7 +58,7 @@ const readLargeFile = function (filePath, opts) {
58
58
  resolve(data);
59
59
  });
60
60
  parseStream.on('error', function (error) {
61
- console.log('error', error);
61
+ console.log('Error', error);
62
62
  reject(error);
63
63
  });
64
64
  readStream.pipe(parseStream);
@@ -26,7 +26,7 @@ const setupConfig = async (importCmdFlags) => {
26
26
  config.contentDir = (0, cli_utilities_1.sanitizePath)(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)()));
27
27
  const pattern = /[*$%#<>{}!&?]/g;
28
28
  if (pattern.test(config.contentDir)) {
29
- cli_utilities_1.cliux.print(`\nPlease add a directory path without any of the special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
29
+ cli_utilities_1.cliux.print(`\nPlease enter a directory path without any special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
30
30
  color: 'yellow',
31
31
  });
32
32
  config.contentDir = (0, cli_utilities_1.sanitizePath)(await (0, interactive_1.askContentDir)());
@@ -115,7 +115,7 @@ const setupConfig = async (importCmdFlags) => {
115
115
  }
116
116
  // Add authentication details to config for context tracking
117
117
  config.authenticationMethod = authenticationMethod;
118
- cli_utilities_1.log.debug('Import configuration setup completed', Object.assign({}, config));
118
+ cli_utilities_1.log.debug('Import configuration setup completed.', Object.assign({}, config));
119
119
  return config;
120
120
  };
121
121
  exports.default = setupConfig;
@@ -44,7 +44,7 @@ const login = async (config) => {
44
44
  let errorstack_key = (_a = error === null || error === void 0 ? void 0 : error.errors) === null || _a === void 0 ? void 0 : _a.api_key;
45
45
  if (errorstack_key) {
46
46
  const keyError = errorstack_key[0];
47
- cli_utilities_1.log.error(`Invalid stack API token: ${keyError} Please enter valid stack API token.`);
47
+ cli_utilities_1.log.error(`Invalid stack API token: ${keyError}. Please enter a valid stack API token.`);
48
48
  throw error;
49
49
  }
50
50
  cli_utilities_1.log.error(`Stack fetch error: ${error === null || error === void 0 ? void 0 : error.errorMessage}`);
@@ -81,7 +81,7 @@ const getConfirmationToCreateApps = async (privateApps, config) => {
81
81
  return Promise.resolve(true);
82
82
  }
83
83
  else {
84
- cli_utilities_1.log.debug('User declined to create private apps (second prompt)');
84
+ cli_utilities_1.log.debug('User declined to create private apps (second prompt).');
85
85
  return Promise.resolve(false);
86
86
  }
87
87
  }
@@ -14,7 +14,7 @@ const cli_utilities_1 = require("@contentstack/cli-utilities");
14
14
  * @param {ImportConfig} importConfig
15
15
  */
16
16
  const lookUpTaxonomy = function (importConfig, schema, taxonomies) {
17
- cli_utilities_1.log.debug(`Starting taxonomy lookup for schema with ${Object.keys(schema).length} fields`);
17
+ cli_utilities_1.log.debug(`Starting taxonomy lookup for schema with ${Object.keys(schema).length} fields.`);
18
18
  for (let i in schema) {
19
19
  if (schema[i].data_type === 'taxonomy') {
20
20
  cli_utilities_1.log.debug(`Processing taxonomy field: ${schema[i].uid}`);