@contentstack/cli-cm-import 2.0.0-beta.12 → 2.0.0-beta.14

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
5
5
  const map_1 = tslib_1.__importDefault(require("lodash/map"));
6
6
  const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
7
7
  const find_1 = tslib_1.__importDefault(require("lodash/find"));
@@ -12,7 +12,7 @@ const node_path_1 = require("node:path");
12
12
  const filter_1 = tslib_1.__importDefault(require("lodash/filter"));
13
13
  const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
14
14
  const toLower_1 = tslib_1.__importDefault(require("lodash/toLower"));
15
- const cli_utilities_1 = require("@contentstack/cli-utilities");
15
+ const cli_utilities_2 = require("@contentstack/cli-utilities");
16
16
  const constants_1 = require("../../constants");
17
17
  const interactive_1 = require("../../utils/interactive");
18
18
  const utils_1 = require("../../utils");
@@ -39,20 +39,20 @@ class ImportMarketplaceApps extends base_class_1.default {
39
39
  */
40
40
  async start() {
41
41
  try {
42
- cli_utilities_1.log.debug('Starting marketplace apps import process...', this.importConfig.context);
42
+ cli_utilities_2.log.debug('Starting marketplace apps import process...', this.importConfig.context);
43
43
  const [marketplaceAppsCount] = await this.analyzeMarketplaceApps();
44
44
  if (marketplaceAppsCount === 0) {
45
- cli_utilities_1.log.info('No marketplace apps found to import', this.importConfig.context);
45
+ cli_utilities_2.log.info('No marketplace apps found to import', this.importConfig.context);
46
46
  return;
47
47
  }
48
- if (!(0, cli_utilities_1.isAuthenticated)()) {
49
- 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' });
50
- cli_utilities_1.log.info('Skipping marketplace apps import - user not authenticated', this.importConfig.context);
48
+ if (!(0, cli_utilities_2.isAuthenticated)()) {
49
+ cli_utilities_2.cliux.print('\nWARNING!!! To import Marketplace apps, you must be logged in. Please check csdx auth:login --help to log in\n', { color: 'yellow' });
50
+ cli_utilities_2.log.info('Skipping marketplace apps import - user not authenticated', this.importConfig.context);
51
51
  return;
52
52
  }
53
53
  // Handle encryption key prompt BEFORE starting progress
54
54
  if (!this.importConfig.forceStopMarketplaceAppsPrompt) {
55
- cli_utilities_1.log.debug('Validating security configuration before progress start', this.importConfig.context);
55
+ cli_utilities_2.log.debug('Validating security configuration before progress start', this.importConfig.context);
56
56
  await this.getAndValidateEncryptionKey(this.importConfig.marketplaceAppEncryptionKey);
57
57
  }
58
58
  const progress = this.createNestedProgress(this.currentModuleName);
@@ -64,7 +64,7 @@ class ImportMarketplaceApps extends base_class_1.default {
64
64
  progress.addProcess(utils_1.PROCESS_NAMES.INSTALL_APPS, marketplaceAppsCount);
65
65
  this.prepareMarketplaceAppMapper();
66
66
  // Step 1: Setup Environment SDK and authentication
67
- cli_utilities_1.log.info('Setting up marketplace SDK and authentication', this.importConfig.context);
67
+ cli_utilities_2.log.info('Setting up marketplace SDK and authentication', this.importConfig.context);
68
68
  progress
69
69
  .startProcess(utils_1.PROCESS_NAMES.SETUP_ENVIRONMENT)
70
70
  .updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.SETUP_ENVIRONMENT].SETTING_UP, utils_1.PROCESS_NAMES.SETUP_ENVIRONMENT);
@@ -72,7 +72,7 @@ class ImportMarketplaceApps extends base_class_1.default {
72
72
  progress.completeProcess(utils_1.PROCESS_NAMES.SETUP_ENVIRONMENT, true);
73
73
  // Step 2: Handle private apps creation (if any)
74
74
  if (privateAppsCount > 0) {
75
- cli_utilities_1.log.info('Starting private apps creation process', this.importConfig.context);
75
+ cli_utilities_2.log.info('Starting private apps creation process', this.importConfig.context);
76
76
  progress
77
77
  .startProcess(utils_1.PROCESS_NAMES.CREATE_APPS)
78
78
  .updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.CREATE_APPS].CREATING, utils_1.PROCESS_NAMES.CREATE_APPS);
@@ -80,7 +80,7 @@ class ImportMarketplaceApps extends base_class_1.default {
80
80
  progress.completeProcess(utils_1.PROCESS_NAMES.CREATE_APPS, true);
81
81
  }
82
82
  // Step 3: Install marketplace apps - FIXED THIS PART
83
- cli_utilities_1.log.info('Starting marketplace apps installation process', this.importConfig.context);
83
+ cli_utilities_2.log.info('Starting marketplace apps installation process', this.importConfig.context);
84
84
  progress
85
85
  .startProcess(utils_1.PROCESS_NAMES.INSTALL_APPS)
86
86
  .updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.INSTALL_APPS].INSTALLING, utils_1.PROCESS_NAMES.INSTALL_APPS);
@@ -90,7 +90,7 @@ class ImportMarketplaceApps extends base_class_1.default {
90
90
  }
91
91
  catch (error) {
92
92
  this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Marketplace apps import failed');
93
- (0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context));
93
+ (0, cli_utilities_2.handleAndLogError)(error, Object.assign({}, this.importConfig.context));
94
94
  }
95
95
  }
96
96
  /**
@@ -99,25 +99,25 @@ class ImportMarketplaceApps extends base_class_1.default {
99
99
  */
100
100
  async importMarketplaceApps() {
101
101
  var _a, _b, _c;
102
- cli_utilities_1.log.debug('Setting up security configuration for marketplace apps', this.importConfig.context);
102
+ cli_utilities_2.log.debug('Setting up security configuration for marketplace apps', this.importConfig.context);
103
103
  // NOTE set default encryptionKey
104
104
  const cryptoArgs = { encryptionKey: this.importConfig.marketplaceAppEncryptionKey };
105
105
  if (this.importConfig.forceStopMarketplaceAppsPrompt) {
106
- cli_utilities_1.log.debug('Using forced security configuration without validation', this.importConfig.context);
107
- this.nodeCrypto = new cli_utilities_1.NodeCrypto(cryptoArgs);
106
+ cli_utilities_2.log.debug('Using forced security configuration without validation', this.importConfig.context);
107
+ this.nodeCrypto = new cli_utilities_2.NodeCrypto(cryptoArgs);
108
108
  }
109
109
  // NOTE getting all apps to validate if it's already installed in the stack to manage conflict
110
- cli_utilities_1.log.debug('Getting all stack-specific apps for validation', this.importConfig.context);
110
+ cli_utilities_2.log.debug('Getting all stack-specific apps for validation', this.importConfig.context);
111
111
  this.installedApps = await (0, utils_1.getAllStackSpecificApps)(this.importConfig);
112
- cli_utilities_1.log.debug(`Found ${((_a = this.installedApps) === null || _a === void 0 ? void 0 : _a.length) || 0} already installed apps`, this.importConfig.context);
113
- cli_utilities_1.log.info('Starting marketplace app installation', this.importConfig.context);
112
+ cli_utilities_2.log.debug(`Found ${((_a = this.installedApps) === null || _a === void 0 ? void 0 : _a.length) || 0} already installed apps`, this.importConfig.context);
113
+ cli_utilities_2.log.info('Starting marketplace app installation', this.importConfig.context);
114
114
  for (let app of this.marketplaceApps) {
115
- 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);
115
+ cli_utilities_2.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);
116
116
  await this.installApps(app);
117
117
  }
118
- cli_utilities_1.log.debug('Generating UID mapper', this.importConfig.context);
118
+ cli_utilities_2.log.debug('Generating UID mapper', this.importConfig.context);
119
119
  const uidMapper = await this.generateUidMapper();
120
- cli_utilities_1.log.debug('Writing UID mappings to file', this.importConfig.context);
120
+ cli_utilities_2.log.debug('Writing UID mappings to file', this.importConfig.context);
121
121
  utils_1.fsUtil.writeFile(this.marketPlaceUidMapperPath, {
122
122
  app_uid: this.appUidMapping,
123
123
  extension_uid: uidMapper || {},
@@ -125,7 +125,7 @@ class ImportMarketplaceApps extends base_class_1.default {
125
125
  });
126
126
  const appUidCount = Object.keys(this.appUidMapping || {}).length;
127
127
  const extensionUidCount = Object.keys(uidMapper || {}).length;
128
- cli_utilities_1.log.debug(`Written UID data: ${appUidCount} app UIDs, ${extensionUidCount} extension UIDs`, this.importConfig.context);
128
+ cli_utilities_2.log.debug(`Written UID data: ${appUidCount} app UIDs, ${extensionUidCount} extension UIDs`, this.importConfig.context);
129
129
  }
130
130
  /**
131
131
  * The function `generateUidMapper` generates a mapping of extension UIDs from old metadata to new
@@ -135,36 +135,36 @@ class ImportMarketplaceApps extends base_class_1.default {
135
135
  */
136
136
  async generateUidMapper() {
137
137
  var _a, _b, _c, _d, _e;
138
- cli_utilities_1.log.debug('Generating UID mapper for extensions', this.importConfig.context);
138
+ cli_utilities_2.log.debug('Generating UID mapper for extensions', this.importConfig.context);
139
139
  const listOfNewMeta = [];
140
140
  const listOfOldMeta = [];
141
141
  const extensionUidMap = {};
142
142
  // NOTE After installation getting all apps to create mapper.
143
- cli_utilities_1.log.debug('Fetching updated list of installed apps', this.importConfig.context);
143
+ cli_utilities_2.log.debug('Fetching updated list of installed apps', this.importConfig.context);
144
144
  this.installedApps = (await (0, utils_1.getAllStackSpecificApps)(this.importConfig)) || [];
145
- 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);
146
- cli_utilities_1.log.debug('Processing old metadata from marketplace apps', this.importConfig.context);
145
+ cli_utilities_2.log.debug(`Found ${((_a = this.installedApps) === null || _a === void 0 ? void 0 : _a.length) || 0} installed apps after installation`, this.importConfig.context);
146
+ cli_utilities_2.log.debug('Processing old metadata from marketplace apps', this.importConfig.context);
147
147
  for (const app of this.marketplaceApps) {
148
148
  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();
149
149
  listOfOldMeta.push(...appMeta);
150
- 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);
150
+ cli_utilities_2.log.debug(`Added ${appMeta.length} meta entries from app: ${(_c = app.manifest) === null || _c === void 0 ? void 0 : _c.name}`, this.importConfig.context);
151
151
  }
152
- cli_utilities_1.log.debug('Processing new metadata from installed apps', this.importConfig.context);
152
+ cli_utilities_2.log.debug('Processing new metadata from installed apps', this.importConfig.context);
153
153
  for (const app of this.installedApps) {
154
154
  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();
155
155
  listOfNewMeta.push(...appMeta);
156
- cli_utilities_1.log.debug(`Added ${appMeta.length} meta entries from installed app: ${(_e = app.manifest) === null || _e === void 0 ? void 0 : _e.name}`, this.importConfig.context);
156
+ cli_utilities_2.log.debug(`Added ${appMeta.length} meta entries from installed app: ${(_e = app.manifest) === null || _e === void 0 ? void 0 : _e.name}`, this.importConfig.context);
157
157
  }
158
- cli_utilities_1.log.debug(`Creating extension UID mappings from ${listOfOldMeta.length} old meta entries`, this.importConfig.context);
158
+ cli_utilities_2.log.debug(`Creating extension UID mappings from ${listOfOldMeta.length} old meta entries`, this.importConfig.context);
159
159
  for (const { extension_uid, uid } of (0, filter_1.default)(listOfOldMeta, 'name')) {
160
160
  const meta = (0, find_1.default)(listOfNewMeta, { uid });
161
161
  if (meta) {
162
162
  extensionUidMap[extension_uid] = meta.extension_uid;
163
- cli_utilities_1.log.debug(`Extension UID mapping: ${extension_uid} → ${meta.extension_uid}`, this.importConfig.context);
163
+ cli_utilities_2.log.debug(`Extension UID mapping: ${extension_uid} → ${meta.extension_uid}`, this.importConfig.context);
164
164
  }
165
165
  }
166
166
  const extensionMapCount = Object.keys(extensionUidMap || {}).length;
167
- cli_utilities_1.log.debug(`Generated ${extensionMapCount} extension UID items`, this.importConfig.context);
167
+ cli_utilities_2.log.debug(`Generated ${extensionMapCount} extension UID items`, this.importConfig.context);
168
168
  return extensionUidMap;
169
169
  }
170
170
  /**
@@ -181,34 +181,34 @@ class ImportMarketplaceApps extends base_class_1.default {
181
181
  * encryption key.
182
182
  */
183
183
  async getAndValidateEncryptionKey(defaultValue, retry = 1) {
184
- cli_utilities_1.log.debug(`Validating security configuration (attempt ${retry})`, this.importConfig.context);
184
+ cli_utilities_2.log.debug(`Validating security configuration (attempt ${retry})`, this.importConfig.context);
185
185
  let appConfig = (0, find_1.default)(this.marketplaceApps, ({ configuration, server_configuration }) => !(0, isEmpty_1.default)(configuration) || !(0, isEmpty_1.default)(server_configuration));
186
186
  if (!appConfig) {
187
- cli_utilities_1.log.debug('No app configuration found requiring encryption', this.importConfig.context);
187
+ cli_utilities_2.log.debug('No app configuration found requiring encryption', this.importConfig.context);
188
188
  return defaultValue;
189
189
  }
190
- cli_utilities_1.log.debug('Found app configuration requiring security setup, asking for input', this.importConfig.context);
191
- cli_utilities_1.cliux.print('\n');
190
+ cli_utilities_2.log.debug('Found app configuration requiring security setup, asking for input', this.importConfig.context);
191
+ cli_utilities_2.cliux.print('\n');
192
192
  const encryptionKey = await (0, interactive_1.askEncryptionKey)(defaultValue);
193
193
  try {
194
194
  appConfig = !(0, isEmpty_1.default)(appConfig.configuration) ? appConfig.configuration : appConfig.server_configuration;
195
- cli_utilities_1.log.debug('Creating NodeCrypto instance with security configuration', this.importConfig.context);
196
- this.nodeCrypto = new cli_utilities_1.NodeCrypto({ encryptionKey });
197
- cli_utilities_1.log.debug('Testing security configuration with app data', this.importConfig.context);
195
+ cli_utilities_2.log.debug('Creating NodeCrypto instance with security configuration', this.importConfig.context);
196
+ this.nodeCrypto = new cli_utilities_2.NodeCrypto({ encryptionKey });
197
+ cli_utilities_2.log.debug('Testing security configuration with app data', this.importConfig.context);
198
198
  this.nodeCrypto.decrypt(appConfig);
199
- cli_utilities_1.log.debug('Security configuration validation successful', this.importConfig.context);
199
+ cli_utilities_2.log.debug('Security configuration validation successful', this.importConfig.context);
200
200
  }
201
201
  catch (error) {
202
- cli_utilities_1.log.debug(`Security configuration validation failed: ${error.message}`, this.importConfig.context);
202
+ cli_utilities_2.log.debug(`Security configuration validation failed: ${error.message}`, this.importConfig.context);
203
203
  if (retry < this.importConfig.getEncryptionKeyMaxRetry && error.code === 'ERR_OSSL_EVP_BAD_DECRYPT') {
204
- cli_utilities_1.cliux.print(`Provided encryption key is not valid or your data might be corrupted.! attempt(${retry}/${this.importConfig.getEncryptionKeyMaxRetry})`, { color: 'red' });
204
+ cli_utilities_2.cliux.print(`Provided encryption key is not valid or your data might be corrupted.! attempt(${retry}/${this.importConfig.getEncryptionKeyMaxRetry})`, { color: 'red' });
205
205
  // NOTE max retry limit is 3
206
- cli_utilities_1.log.debug(`Retrying security configuration validation (${retry + 1}/${this.importConfig.getEncryptionKeyMaxRetry})`, this.importConfig.context);
206
+ cli_utilities_2.log.debug(`Retrying security configuration validation (${retry + 1}/${this.importConfig.getEncryptionKeyMaxRetry})`, this.importConfig.context);
207
207
  return this.getAndValidateEncryptionKey(encryptionKey, retry + 1);
208
208
  }
209
209
  else {
210
- cli_utilities_1.cliux.print(`Maximum retry limit exceeded. Closing the process, please try again.! attempt(${retry}/${this.importConfig.getEncryptionKeyMaxRetry})`, { color: 'red' });
211
- cli_utilities_1.log.debug('Maximum retry limit exceeded for encryption validation', this.importConfig.context);
210
+ cli_utilities_2.cliux.print(`Maximum retry limit exceeded. Closing the process, please try again.! attempt(${retry}/${this.importConfig.getEncryptionKeyMaxRetry})`, { color: 'red' });
211
+ cli_utilities_2.log.debug('Maximum retry limit exceeded for encryption validation', this.importConfig.context);
212
212
  process.exit(1);
213
213
  }
214
214
  }
@@ -222,28 +222,28 @@ class ImportMarketplaceApps extends base_class_1.default {
222
222
  */
223
223
  async handleAllPrivateAppsCreationProcess() {
224
224
  var _a, _b;
225
- cli_utilities_1.log.debug('Filtering private apps from marketplace apps', this.importConfig.context);
225
+ cli_utilities_2.log.debug('Filtering private apps from marketplace apps', this.importConfig.context);
226
226
  const privateApps = (0, filter_1.default)(this.marketplaceApps, { manifest: { visibility: 'private' } });
227
- cli_utilities_1.log.debug(`Found ${privateApps.length} private apps to process`, this.importConfig.context);
227
+ cli_utilities_2.log.debug(`Found ${privateApps.length} private apps to process`, this.importConfig.context);
228
228
  if ((0, isEmpty_1.default)(privateApps)) {
229
- cli_utilities_1.log.debug('No private apps found, skipping private app creation process', this.importConfig.context);
229
+ cli_utilities_2.log.debug('No private apps found, skipping private app creation process', this.importConfig.context);
230
230
  return Promise.resolve();
231
231
  }
232
- cli_utilities_1.log.debug('Getting confirmation to create private apps', this.importConfig.context);
233
- cli_utilities_1.cliux.print('\n');
232
+ cli_utilities_2.log.debug('Getting confirmation to create private apps', this.importConfig.context);
233
+ cli_utilities_2.cliux.print('\n');
234
234
  let canCreatePrivateApp = await (0, utils_1.getConfirmationToCreateApps)(privateApps, this.importConfig);
235
235
  this.importConfig.canCreatePrivateApp = canCreatePrivateApp;
236
236
  if (canCreatePrivateApp) {
237
- cli_utilities_1.log.info('Starting developer hub private apps re-creation', this.importConfig.context);
238
- cli_utilities_1.log.debug(`Processing ${privateApps.length} private apps for creation`, this.importConfig.context);
237
+ cli_utilities_2.log.info('Starting developer hub private apps re-creation', this.importConfig.context);
238
+ cli_utilities_2.log.debug(`Processing ${privateApps.length} private apps for creation`, this.importConfig.context);
239
239
  for (let app of privateApps) {
240
- cli_utilities_1.log.debug(`Checking if private app exists: ${app.manifest.name}`, this.importConfig.context);
240
+ cli_utilities_2.log.debug(`Checking if private app exists: ${app.manifest.name}`, this.importConfig.context);
241
241
  if (await this.isPrivateAppExistInDeveloperHub(app)) {
242
242
  // NOTE Found app already exist in the same org
243
243
  this.appUidMapping[app.uid] = app.uid;
244
244
  (_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(true, `${app.manifest.name} (already exists)`, null, utils_1.PROCESS_NAMES.CREATE_APPS);
245
- cli_utilities_1.cliux.print(`App '${app.manifest.name}' already exist. skipping app recreation.!`, { color: 'yellow' });
246
- cli_utilities_1.log.debug(`App '${app.manifest.name}' already exists, skipping recreation`, this.importConfig.context);
245
+ cli_utilities_2.cliux.print(`App '${app.manifest.name}' already exist. skipping app recreation.!`, { color: 'yellow' });
246
+ cli_utilities_2.log.debug(`App '${app.manifest.name}' already exists, skipping recreation`, this.importConfig.context);
247
247
  continue;
248
248
  }
249
249
  // NOTE keys can be passed to install new app in the developer hub
@@ -259,23 +259,23 @@ class ImportMarketplaceApps extends base_class_1.default {
259
259
  'ui_location',
260
260
  'framework_version',
261
261
  ];
262
- cli_utilities_1.log.debug(`Extracting valid configuration from app manifest: ${app.manifest.name}`, this.importConfig.context);
262
+ cli_utilities_2.log.debug(`Extracting valid configuration from app manifest: ${app.manifest.name}`, this.importConfig.context);
263
263
  const manifest = (0, pick_1.default)(app.manifest, validKeys);
264
264
  this.appOriginalName = manifest.name;
265
- cli_utilities_1.log.debug(`Creating private app: ${manifest.name}`, this.importConfig.context);
265
+ cli_utilities_2.log.debug(`Creating private app: ${manifest.name}`, this.importConfig.context);
266
266
  await this.createPrivateApp(manifest);
267
267
  }
268
- cli_utilities_1.log.success(`Completed processing ${privateApps.length} private apps`, this.importConfig.context);
268
+ cli_utilities_2.log.success(`Completed processing ${privateApps.length} private apps`, this.importConfig.context);
269
269
  }
270
270
  else {
271
- cli_utilities_1.log.info('Skipping private apps creation on Developer Hub...', this.importConfig.context);
271
+ cli_utilities_2.log.info('Skipping private apps creation on Developer Hub...', this.importConfig.context);
272
272
  // Mark all private apps as skipped in progress
273
273
  for (let app of privateApps) {
274
274
  (_b = this.progressManager) === null || _b === void 0 ? void 0 : _b.tick(true, `${app.manifest.name} (creation skipped)`, null, utils_1.PROCESS_NAMES.CREATE_APPS);
275
275
  }
276
276
  }
277
277
  this.appOriginalName = undefined;
278
- cli_utilities_1.log.debug('Private apps creation process completed', this.importConfig.context);
278
+ cli_utilities_2.log.debug('Private apps creation process completed', this.importConfig.context);
279
279
  }
280
280
  /**
281
281
  * The function checks if a private app exists in the developer hub.
@@ -286,18 +286,18 @@ class ImportMarketplaceApps extends base_class_1.default {
286
286
  */
287
287
  async isPrivateAppExistInDeveloperHub(app) {
288
288
  var _a, _b;
289
- cli_utilities_1.log.debug(`Checking if private app exists in developer hub: ${(_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name} (${app.uid})`, this.importConfig.context);
289
+ cli_utilities_2.log.debug(`Checking if private app exists in developer hub: ${(_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name} (${app.uid})`, this.importConfig.context);
290
290
  const installation = await this.appSdk
291
291
  .marketplace(this.importConfig.org_uid)
292
292
  .installation(app.uid)
293
293
  .fetch()
294
294
  .catch(() => {
295
295
  var _a;
296
- 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);
296
+ cli_utilities_2.log.debug(`App ${(_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name} not found in developer hub`, this.importConfig.context);
297
297
  return undefined;
298
298
  }); // NOTE Keeping this to avoid Unhandled exception
299
299
  const exists = !(0, isEmpty_1.default)(installation);
300
- 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);
300
+ cli_utilities_2.log.debug(`Private app ${(_b = app.manifest) === null || _b === void 0 ? void 0 : _b.name} exists in developer hub: ${exists}`, this.importConfig.context);
301
301
  return exists;
302
302
  }
303
303
  /**
@@ -314,26 +314,26 @@ class ImportMarketplaceApps extends base_class_1.default {
314
314
  */
315
315
  async createPrivateApp(app, appSuffix = 1, updateUiLocation = false) {
316
316
  var _a, _b;
317
- cli_utilities_1.log.debug(`Creating private app: ${app.name} (suffix: ${appSuffix}, updateUiLocation: ${updateUiLocation})`, this.importConfig.context);
317
+ cli_utilities_2.log.debug(`Creating private app: ${app.name} (suffix: ${appSuffix}, updateUiLocation: ${updateUiLocation})`, this.importConfig.context);
318
318
  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)) {
319
- cli_utilities_1.log.debug(`Updating UI locations for app: ${app.name}`, this.importConfig.context);
319
+ cli_utilities_2.log.debug(`Updating UI locations for app: ${app.name}`, this.importConfig.context);
320
320
  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);
321
321
  }
322
322
  if (app.name.length > 20) {
323
323
  const originalName = app.name;
324
324
  app.name = app.name.slice(0, 20);
325
- cli_utilities_1.log.debug(`Truncated app name from '${originalName}' to '${app.name}'`, this.importConfig.context);
325
+ cli_utilities_2.log.debug(`Truncated app name from '${originalName}' to '${app.name}'`, this.importConfig.context);
326
326
  }
327
- cli_utilities_1.log.debug(`Making API call to create private app: ${app.name}`, this.importConfig.context);
327
+ cli_utilities_2.log.debug(`Making API call to create private app: ${app.name}`, this.importConfig.context);
328
328
  const response = await this.appSdk
329
329
  .marketplace(this.importConfig.org_uid)
330
330
  .app()
331
331
  .create((0, omit_1.default)(app, ['uid']))
332
332
  .catch((error) => {
333
- cli_utilities_1.log.debug(`Error creating private app ${app.name}: ${error.message}`, this.importConfig.context);
333
+ cli_utilities_2.log.debug(`Error creating private app ${app.name}: ${error.message}`, this.importConfig.context);
334
334
  return error;
335
335
  });
336
- cli_utilities_1.log.debug(`Processing app creation response for: ${app.name}`, this.importConfig.context);
336
+ cli_utilities_2.log.debug(`Processing app creation response for: ${app.name}`, this.importConfig.context);
337
337
  return this.appCreationCallback(app, response, appSuffix);
338
338
  }
339
339
  /**
@@ -346,18 +346,18 @@ class ImportMarketplaceApps extends base_class_1.default {
346
346
  * @returns a Promise that resolves to an object.
347
347
  */
348
348
  async installApp(config, appManifestUid) {
349
- cli_utilities_1.log.debug(`Installing app with manifest UID: ${appManifestUid}`, this.importConfig.context);
350
- cli_utilities_1.log.debug(`Target stack: ${config.apiKey}`, this.importConfig.context);
349
+ cli_utilities_2.log.debug(`Installing app with manifest UID: ${appManifestUid}`, this.importConfig.context);
350
+ cli_utilities_2.log.debug(`Target stack: ${config.apiKey}`, this.importConfig.context);
351
351
  return await this.appSdk
352
352
  .marketplace(this.importConfig.org_uid)
353
353
  .app(appManifestUid)
354
354
  .install({ targetUid: config.apiKey, targetType: 'stack' })
355
355
  .then((response) => {
356
- cli_utilities_1.log.debug(`App installation successful: ${appManifestUid}`, this.importConfig.context);
356
+ cli_utilities_2.log.debug(`App installation successful: ${appManifestUid}`, this.importConfig.context);
357
357
  return response;
358
358
  })
359
359
  .catch((error) => {
360
- cli_utilities_1.log.debug(`App installation failed: ${appManifestUid} - ${error.message}`, this.importConfig.context);
360
+ cli_utilities_2.log.debug(`App installation failed: ${appManifestUid} - ${error.message}`, this.importConfig.context);
361
361
  return error;
362
362
  });
363
363
  }
@@ -371,24 +371,24 @@ class ImportMarketplaceApps extends base_class_1.default {
371
371
  * @returns The function `updateManifestUILocations` returns an updated array of `locations`.
372
372
  */
373
373
  updateManifestUILocations(locations, appSuffix = 1) {
374
- cli_utilities_1.log.debug(`Updating manifest UI locations with suffix: ${appSuffix}`, this.importConfig.context);
375
- cli_utilities_1.log.debug(`Processing ${locations.length} locations`, this.importConfig.context);
374
+ cli_utilities_2.log.debug(`Updating manifest UI locations with suffix: ${appSuffix}`, this.importConfig.context);
375
+ cli_utilities_2.log.debug(`Processing ${locations.length} locations`, this.importConfig.context);
376
376
  return (0, map_1.default)(locations, (location, index) => {
377
377
  if (location.meta) {
378
- cli_utilities_1.log.debug(`Processing location ${index} with ${location.meta.length} meta entries`, this.importConfig.context);
378
+ cli_utilities_2.log.debug(`Processing location ${index} with ${location.meta.length} meta entries`, this.importConfig.context);
379
379
  location.meta = (0, map_1.default)(location.meta, (meta) => {
380
380
  if (meta.name && this.appOriginalName == meta.name) {
381
381
  const name = (0, interactive_1.getLocationName)((0, first_1.default)((0, split_1.default)(meta.name, '◈')), appSuffix, this.existingNames);
382
382
  if (!this.appNameMapping[this.appOriginalName]) {
383
383
  this.appNameMapping[this.appOriginalName] = name;
384
- cli_utilities_1.log.debug(`Created app name mapping: ${this.appOriginalName} → ${name}`, this.importConfig.context);
384
+ cli_utilities_2.log.debug(`Created app name mapping: ${this.appOriginalName} → ${name}`, this.importConfig.context);
385
385
  }
386
386
  meta.name = name;
387
- cli_utilities_1.log.debug(`Updated meta name to: ${name}`, this.importConfig.context);
387
+ cli_utilities_2.log.debug(`Updated meta name to: ${name}`, this.importConfig.context);
388
388
  }
389
389
  else if (meta.name) {
390
390
  const newName = (0, interactive_1.getLocationName)((0, first_1.default)((0, split_1.default)(meta.name, '◈')), appSuffix + (+index + 1), this.existingNames);
391
- cli_utilities_1.log.debug(`Updated meta name from '${meta.name}' to '${newName}'`, this.importConfig.context);
391
+ cli_utilities_2.log.debug(`Updated meta name from '${meta.name}' to '${newName}'`, this.importConfig.context);
392
392
  meta.name = newName;
393
393
  }
394
394
  return meta;
@@ -413,28 +413,28 @@ class ImportMarketplaceApps extends base_class_1.default {
413
413
  async appCreationCallback(app, response, appSuffix) {
414
414
  var _a, _b, _c;
415
415
  const { statusText, message } = response || {};
416
- cli_utilities_1.log.debug(`Processing app creation callback for: ${app.name} (suffix: ${appSuffix})`, this.importConfig.context);
416
+ cli_utilities_2.log.debug(`Processing app creation callback for: ${app.name} (suffix: ${appSuffix})`, this.importConfig.context);
417
417
  if (message) {
418
- cli_utilities_1.log.debug(`App creation response has message: ${message}`, this.importConfig.context);
418
+ cli_utilities_2.log.debug(`App creation response has message: ${message}`, this.importConfig.context);
419
419
  if ((0, toLower_1.default)(statusText) === 'conflict') {
420
- cli_utilities_1.log.debug(`Name conflict detected for app: ${app.name}`, this.importConfig.context);
420
+ cli_utilities_2.log.debug(`Name conflict detected for app: ${app.name}`, this.importConfig.context);
421
421
  const updatedApp = await (0, utils_1.handleNameConflict)(app, appSuffix, this.importConfig);
422
- cli_utilities_1.log.debug(`Retrying app creation with updated name: ${updatedApp.name}`, this.importConfig.context);
422
+ cli_utilities_2.log.debug(`Retrying app creation with updated name: ${updatedApp.name}`, this.importConfig.context);
423
423
  return this.createPrivateApp(updatedApp, appSuffix + 1, true);
424
424
  }
425
425
  else {
426
426
  (_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(false, `${app.name}`, message, utils_1.PROCESS_NAMES.CREATE_APPS);
427
- cli_utilities_1.log.error((0, utils_1.formatError)(message), this.importConfig.context);
427
+ cli_utilities_2.log.error((0, utils_1.formatError)(message), this.importConfig.context);
428
428
  if (this.importConfig.forceStopMarketplaceAppsPrompt) {
429
- cli_utilities_1.log.debug('Force stop marketplace apps prompt is enabled, resolving', this.importConfig.context);
429
+ cli_utilities_2.log.debug('Force stop marketplace apps prompt is enabled, resolving', this.importConfig.context);
430
430
  return Promise.resolve();
431
431
  }
432
- 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)'))) {
433
- cli_utilities_1.log.debug('User chose to proceed despite error', this.importConfig.context);
432
+ if (await cli_utilities_2.cliux.confirm((0, cli_utilities_1.getChalk)().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)'))) {
433
+ cli_utilities_2.log.debug('User chose to proceed despite error', this.importConfig.context);
434
434
  Promise.resolve();
435
435
  }
436
436
  else {
437
- cli_utilities_1.log.debug('User chose to exit due to error', this.importConfig.context);
437
+ cli_utilities_2.log.debug('User chose to exit due to error', this.importConfig.context);
438
438
  process.exit();
439
439
  }
440
440
  }
@@ -442,15 +442,15 @@ class ImportMarketplaceApps extends base_class_1.default {
442
442
  else if (response.uid) {
443
443
  // NOTE new app installation
444
444
  (_b = this.progressManager) === null || _b === void 0 ? void 0 : _b.tick(true, `${response.name}`, null, utils_1.PROCESS_NAMES.CREATE_APPS);
445
- cli_utilities_1.log.success(`${response.name} app created successfully.!`, this.importConfig.context);
446
- cli_utilities_1.log.debug(`App UID mapping: ${app.uid} → ${response.uid}`, this.importConfig.context);
445
+ cli_utilities_2.log.success(`${response.name} app created successfully.!`, this.importConfig.context);
446
+ cli_utilities_2.log.debug(`App UID mapping: ${app.uid} → ${response.uid}`, this.importConfig.context);
447
447
  this.appUidMapping[app.uid] = response.uid;
448
448
  this.appNameMapping[this.appOriginalName] = response.name;
449
- cli_utilities_1.log.debug(`App name mapping: ${this.appOriginalName} → ${response.name}`, this.importConfig.context);
449
+ cli_utilities_2.log.debug(`App name mapping: ${this.appOriginalName} → ${response.name}`, this.importConfig.context);
450
450
  }
451
451
  else {
452
452
  (_c = this.progressManager) === null || _c === void 0 ? void 0 : _c.tick(false, `${app.name}`, 'Unexpected response format', utils_1.PROCESS_NAMES.CREATE_APPS);
453
- cli_utilities_1.log.debug(`Unexpected response format for app: ${app.name}`, this.importConfig.context);
453
+ cli_utilities_2.log.debug(`Unexpected response format for app: ${app.name}`, this.importConfig.context);
454
454
  }
455
455
  }
456
456
  /**
@@ -463,62 +463,62 @@ class ImportMarketplaceApps extends base_class_1.default {
463
463
  async installApps(app) {
464
464
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
465
465
  try {
466
- cli_utilities_1.log.debug(`Installing app: ${((_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name) || ((_b = app.manifest) === null || _b === void 0 ? void 0 : _b.uid)}`, this.importConfig.context);
466
+ cli_utilities_2.log.debug(`Installing app: ${((_a = app.manifest) === null || _a === void 0 ? void 0 : _a.name) || ((_b = app.manifest) === null || _b === void 0 ? void 0 : _b.uid)}`, this.importConfig.context);
467
467
  let updateParam;
468
468
  const { configuration, server_configuration } = app;
469
469
  const currentStackApp = (0, find_1.default)(this.installedApps, { manifest: { uid: (_c = app === null || app === void 0 ? void 0 : app.manifest) === null || _c === void 0 ? void 0 : _c.uid } });
470
470
  if (!currentStackApp) {
471
- 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);
471
+ cli_utilities_2.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);
472
472
  if (app.manifest.visibility === 'private' && !this.importConfig.canCreatePrivateApp) {
473
473
  (_e = this.progressManager) === null || _e === void 0 ? void 0 : _e.tick(true, `${app.manifest.name} (skipped - private app not allowed)`, null, utils_1.PROCESS_NAMES.INSTALL_APPS);
474
- cli_utilities_1.log.info(`Skipping the installation of the private app ${app.manifest.name}...`, this.importConfig.context);
474
+ cli_utilities_2.log.info(`Skipping the installation of the private app ${app.manifest.name}...`, this.importConfig.context);
475
475
  return Promise.resolve();
476
476
  }
477
- cli_utilities_1.log.debug(`Installing app with manifest UID: ${this.appUidMapping[app.manifest.uid] || app.manifest.uid}`, this.importConfig.context);
477
+ cli_utilities_2.log.debug(`Installing app with manifest UID: ${this.appUidMapping[app.manifest.uid] || app.manifest.uid}`, this.importConfig.context);
478
478
  const installation = await this.installApp(this.importConfig,
479
479
  // NOTE if it's private app it should get uid from mapper else will use manifest uid
480
480
  this.appUidMapping[app.manifest.uid] || app.manifest.uid);
481
481
  if (installation.installation_uid) {
482
482
  const appName = this.appNameMapping[app.manifest.name] || app.manifest.name || app.manifest.uid;
483
483
  (_f = this.progressManager) === null || _f === void 0 ? void 0 : _f.tick(true, `${appName}`, null, utils_1.PROCESS_NAMES.INSTALL_APPS);
484
- cli_utilities_1.log.success(`${appName} app installed successfully.!`, this.importConfig.context);
485
- cli_utilities_1.log.debug(`Installation UID: ${installation.installation_uid}`, this.importConfig.context);
486
- cli_utilities_1.log.debug(`Making redirect URL call for app: ${appName}`, this.importConfig.context);
484
+ cli_utilities_2.log.success(`${appName} app installed successfully.!`, this.importConfig.context);
485
+ cli_utilities_2.log.debug(`Installation UID: ${installation.installation_uid}`, this.importConfig.context);
486
+ cli_utilities_2.log.debug(`Making redirect URL call for app: ${appName}`, this.importConfig.context);
487
487
  await (0, utils_1.makeRedirectUrlCall)(installation, appName, this.importConfig);
488
488
  this.installationUidMapping[app.uid] = installation.installation_uid;
489
- cli_utilities_1.log.debug(`Installation UID mapping: ${app.uid} → ${installation.installation_uid}`, this.importConfig.context);
489
+ cli_utilities_2.log.debug(`Installation UID mapping: ${app.uid} → ${installation.installation_uid}`, this.importConfig.context);
490
490
  updateParam = Object.assign(Object.assign({ manifest: app.manifest }, installation), { configuration, server_configuration });
491
491
  }
492
492
  else if (installation.message) {
493
493
  (_g = this.progressManager) === null || _g === void 0 ? void 0 : _g.tick(false, `${(_h = app.manifest) === null || _h === void 0 ? void 0 : _h.name}`, installation.message, utils_1.PROCESS_NAMES.INSTALL_APPS);
494
- cli_utilities_1.log.info((0, utils_1.formatError)(installation.message), this.importConfig.context);
495
- cli_utilities_1.log.debug(`Installation failed for app: ${(_j = app.manifest) === null || _j === void 0 ? void 0 : _j.name}`, this.importConfig.context);
496
- cli_utilities_1.cliux.print('\n');
494
+ cli_utilities_2.log.info((0, utils_1.formatError)(installation.message), this.importConfig.context);
495
+ cli_utilities_2.log.debug(`Installation failed for app: ${(_j = app.manifest) === null || _j === void 0 ? void 0 : _j.name}`, this.importConfig.context);
496
+ cli_utilities_2.cliux.print('\n');
497
497
  await (0, utils_1.confirmToCloseProcess)(installation, this.importConfig);
498
498
  }
499
499
  }
500
500
  else if (!(0, isEmpty_1.default)(configuration) || !(0, isEmpty_1.default)(server_configuration)) {
501
501
  const appName = app.manifest.name || app.manifest.uid;
502
502
  (_k = this.progressManager) === null || _k === void 0 ? void 0 : _k.tick(true, `${appName} (already installed, updating config)`, null, utils_1.PROCESS_NAMES.INSTALL_APPS);
503
- cli_utilities_1.log.info(`${appName} is already installed`, this.importConfig.context);
504
- cli_utilities_1.log.debug(`Handling existing app configuration for: ${appName}`, this.importConfig.context);
503
+ cli_utilities_2.log.info(`${appName} is already installed`, this.importConfig.context);
504
+ cli_utilities_2.log.debug(`Handling existing app configuration for: ${appName}`, this.importConfig.context);
505
505
  updateParam = await (0, utils_1.ifAppAlreadyExist)(app, currentStackApp, this.importConfig);
506
506
  }
507
507
  else {
508
508
  (_l = this.progressManager) === null || _l === void 0 ? void 0 : _l.tick(true, `${(_m = app.manifest) === null || _m === void 0 ? void 0 : _m.name} (already installed)`, null, utils_1.PROCESS_NAMES.INSTALL_APPS);
509
- cli_utilities_1.log.debug(`App ${(_o = app.manifest) === null || _o === void 0 ? void 0 : _o.name} is already installed with no configuration to update`, this.importConfig.context);
509
+ cli_utilities_2.log.debug(`App ${(_o = app.manifest) === null || _o === void 0 ? void 0 : _o.name} is already installed with no configuration to update`, this.importConfig.context);
510
510
  }
511
511
  if (!this.appUidMapping[app.manifest.uid]) {
512
512
  this.appUidMapping[app.manifest.uid] = currentStackApp ? currentStackApp.manifest.uid : app.manifest.uid;
513
- cli_utilities_1.log.debug(`App UID mapping: ${app.manifest.uid} → ${this.appUidMapping[app.manifest.uid]}`, this.importConfig.context);
513
+ cli_utilities_2.log.debug(`App UID mapping: ${app.manifest.uid} → ${this.appUidMapping[app.manifest.uid]}`, this.importConfig.context);
514
514
  }
515
515
  // NOTE update configurations
516
516
  if (updateParam && (!(0, isEmpty_1.default)(updateParam.configuration) || !(0, isEmpty_1.default)(updateParam.server_configuration))) {
517
- cli_utilities_1.log.debug(`Updating app configuration for: ${(_p = app.manifest) === null || _p === void 0 ? void 0 : _p.name}`, this.importConfig.context);
517
+ cli_utilities_2.log.debug(`Updating app configuration for: ${(_p = app.manifest) === null || _p === void 0 ? void 0 : _p.name}`, this.importConfig.context);
518
518
  await this.updateAppsConfig(updateParam);
519
519
  }
520
520
  else {
521
- cli_utilities_1.log.debug(`No configuration update needed for: ${(_q = app.manifest) === null || _q === void 0 ? void 0 : _q.name}`, this.importConfig.context);
521
+ cli_utilities_2.log.debug(`No configuration update needed for: ${(_q = app.manifest) === null || _q === void 0 ? void 0 : _q.name}`, this.importConfig.context);
522
522
  }
523
523
  }
524
524
  catch (error) {
@@ -535,90 +535,90 @@ class ImportMarketplaceApps extends base_class_1.default {
535
535
  async updateAppsConfig(app) {
536
536
  const { installation_uid, configuration, server_configuration } = app;
537
537
  const appName = app.manifest.name || app.manifest.uid;
538
- cli_utilities_1.log.debug(`Updating app configuration for: ${appName} (${installation_uid})`, this.importConfig.context);
538
+ cli_utilities_2.log.debug(`Updating app configuration for: ${appName} (${installation_uid})`, this.importConfig.context);
539
539
  if (!(0, isEmpty_1.default)(configuration)) {
540
- cli_utilities_1.log.debug(`Updating app configuration for: ${appName}`, this.importConfig.context);
540
+ cli_utilities_2.log.debug(`Updating app configuration for: ${appName}`, this.importConfig.context);
541
541
  await this.appSdk
542
542
  .marketplace(this.importConfig.org_uid)
543
543
  .installation(installation_uid)
544
544
  .setConfiguration(this.nodeCrypto.decrypt(configuration))
545
545
  .then(({ data }) => {
546
546
  if (data === null || data === void 0 ? void 0 : data.message) {
547
- cli_utilities_1.log.debug(data, this.importConfig.context);
548
- cli_utilities_1.log.info((0, utils_1.formatError)(data.message), this.importConfig.context);
547
+ cli_utilities_2.log.debug(data, this.importConfig.context);
548
+ cli_utilities_2.log.info((0, utils_1.formatError)(data.message), this.importConfig.context);
549
549
  }
550
550
  else {
551
- cli_utilities_1.log.success(`${appName} app config updated successfully.!`, this.importConfig.context);
552
- cli_utilities_1.log.debug(`Configuration update successful for: ${appName}`, this.importConfig.context);
551
+ cli_utilities_2.log.success(`${appName} app config updated successfully.!`, this.importConfig.context);
552
+ cli_utilities_2.log.debug(`Configuration update successful for: ${appName}`, this.importConfig.context);
553
553
  }
554
554
  })
555
555
  .catch((error) => {
556
- cli_utilities_1.log.debug(error, this.importConfig.context);
557
- cli_utilities_1.log.error((0, utils_1.formatError)(error), this.importConfig.context);
558
- cli_utilities_1.log.debug(`Configuration update failed for: ${appName}`, this.importConfig.context);
556
+ cli_utilities_2.log.debug(error, this.importConfig.context);
557
+ cli_utilities_2.log.error((0, utils_1.formatError)(error), this.importConfig.context);
558
+ cli_utilities_2.log.debug(`Configuration update failed for: ${appName}`, this.importConfig.context);
559
559
  });
560
560
  }
561
561
  if (!(0, isEmpty_1.default)(server_configuration)) {
562
- cli_utilities_1.log.debug(`Updating server configuration for: ${appName}`, this.importConfig.context);
562
+ cli_utilities_2.log.debug(`Updating server configuration for: ${appName}`, this.importConfig.context);
563
563
  await this.appSdk
564
564
  .marketplace(this.importConfig.org_uid)
565
565
  .installation(installation_uid)
566
566
  .setServerConfig(this.nodeCrypto.decrypt(server_configuration))
567
567
  .then(({ data }) => {
568
568
  if (data === null || data === void 0 ? void 0 : data.message) {
569
- cli_utilities_1.log.debug(data, this.importConfig.context);
570
- cli_utilities_1.log.error((0, utils_1.formatError)(data.message), this.importConfig.context);
569
+ cli_utilities_2.log.debug(data, this.importConfig.context);
570
+ cli_utilities_2.log.error((0, utils_1.formatError)(data.message), this.importConfig.context);
571
571
  }
572
572
  else {
573
- cli_utilities_1.log.success(`${appName} app server config updated successfully.!`, this.importConfig.context);
574
- cli_utilities_1.log.debug(`Server configuration update successful for: ${appName}`, this.importConfig.context);
573
+ cli_utilities_2.log.success(`${appName} app server config updated successfully.!`, this.importConfig.context);
574
+ cli_utilities_2.log.debug(`Server configuration update successful for: ${appName}`, this.importConfig.context);
575
575
  }
576
576
  })
577
577
  .catch((error) => {
578
- cli_utilities_1.log.debug(error, this.importConfig.context);
579
- cli_utilities_1.log.error((0, utils_1.formatError)(error), this.importConfig.context);
580
- cli_utilities_1.log.debug(`Server configuration update failed for: ${appName}`, this.importConfig.context);
578
+ cli_utilities_2.log.debug(error, this.importConfig.context);
579
+ cli_utilities_2.log.error((0, utils_1.formatError)(error), this.importConfig.context);
580
+ cli_utilities_2.log.debug(`Server configuration update failed for: ${appName}`, this.importConfig.context);
581
581
  });
582
582
  }
583
583
  }
584
584
  async analyzeMarketplaceApps() {
585
585
  return this.withLoadingSpinner('MARKETPLACE APPS: Analyzing import data...', async () => {
586
586
  var _a;
587
- cli_utilities_1.log.debug('Checking for marketplace apps folder existence', this.importConfig.context);
587
+ cli_utilities_2.log.debug('Checking for marketplace apps folder existence', this.importConfig.context);
588
588
  if (!utils_1.fileHelper.fileExistsSync(this.marketPlaceFolderPath)) {
589
- cli_utilities_1.log.info(`No Marketplace apps are found - '${this.marketPlaceFolderPath}'`, this.importConfig.context);
589
+ cli_utilities_2.log.info(`No Marketplace apps are found - '${this.marketPlaceFolderPath}'`, this.importConfig.context);
590
590
  return [0];
591
591
  }
592
- cli_utilities_1.log.debug(`Found marketplace apps folder: ${this.marketPlaceFolderPath}`, this.importConfig.context);
592
+ cli_utilities_2.log.debug(`Found marketplace apps folder: ${this.marketPlaceFolderPath}`, this.importConfig.context);
593
593
  this.marketplaceApps = utils_1.fsUtil.readFile((0, node_path_1.join)(this.marketPlaceFolderPath, this.marketPlaceAppConfig.fileName), true);
594
594
  if ((0, isEmpty_1.default)(this.marketplaceApps)) {
595
- cli_utilities_1.log.debug('No marketplace apps found to import', this.importConfig.context);
595
+ cli_utilities_2.log.debug('No marketplace apps found to import', this.importConfig.context);
596
596
  return [0];
597
597
  }
598
598
  const count = ((_a = this.marketplaceApps) === null || _a === void 0 ? void 0 : _a.length) || 0;
599
- cli_utilities_1.log.debug(`Found ${count} marketplace apps to import`, this.importConfig.context);
599
+ cli_utilities_2.log.debug(`Found ${count} marketplace apps to import`, this.importConfig.context);
600
600
  return [count];
601
601
  });
602
602
  }
603
603
  prepareMarketplaceAppMapper() {
604
- cli_utilities_1.log.debug('Creating marketplace apps mapper directory', this.importConfig.context);
604
+ cli_utilities_2.log.debug('Creating marketplace apps mapper directory', this.importConfig.context);
605
605
  utils_1.fsUtil.makeDirectory(this.mapperDirPath);
606
- cli_utilities_1.log.debug(`Created marketplace apps mapper directory, ${this.mapperDirPath}`, this.importConfig.context);
606
+ cli_utilities_2.log.debug(`Created marketplace apps mapper directory, ${this.mapperDirPath}`, this.importConfig.context);
607
607
  }
608
608
  async setupMarketplaceEnvironment() {
609
609
  try {
610
- cli_utilities_1.log.debug('Getting developer hub base URL', this.importConfig.context);
610
+ cli_utilities_2.log.debug('Getting developer hub base URL', this.importConfig.context);
611
611
  this.developerHubBaseUrl = this.importConfig.developerHubBaseUrl || (await (0, utils_1.getDeveloperHubUrl)(this.importConfig));
612
612
  this.importConfig.developerHubBaseUrl = this.developerHubBaseUrl;
613
- cli_utilities_1.log.debug(`Using developer hub base URL: ${this.developerHubBaseUrl}`, this.importConfig.context);
613
+ cli_utilities_2.log.debug(`Using developer hub base URL: ${this.developerHubBaseUrl}`, this.importConfig.context);
614
614
  // NOTE init marketplace app sdk
615
- cli_utilities_1.log.debug('Initializing marketplace SDK client', this.importConfig.context);
615
+ cli_utilities_2.log.debug('Initializing marketplace SDK client', this.importConfig.context);
616
616
  const host = this.developerHubBaseUrl.split('://').pop();
617
- this.appSdk = await (0, cli_utilities_1.marketplaceSDKClient)({ host });
618
- cli_utilities_1.log.debug('Initialized marketplace SDK client', this.importConfig.context);
619
- cli_utilities_1.log.debug('Getting organization UID', this.importConfig.context);
617
+ this.appSdk = await (0, cli_utilities_2.marketplaceSDKClient)({ host });
618
+ cli_utilities_2.log.debug('Initialized marketplace SDK client', this.importConfig.context);
619
+ cli_utilities_2.log.debug('Getting organization UID', this.importConfig.context);
620
620
  this.importConfig.org_uid = await (0, utils_1.getOrgUid)(this.importConfig);
621
- cli_utilities_1.log.debug(`Using organization UID: ${this.importConfig.org_uid}`, this.importConfig.context);
621
+ cli_utilities_2.log.debug(`Using organization UID: ${this.importConfig.org_uid}`, this.importConfig.context);
622
622
  }
623
623
  catch (error) {
624
624
  throw error;