@contentstack/cli-cm-export 1.20.2 → 2.0.0-beta

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.
Files changed (72) hide show
  1. package/README.md +1 -1
  2. package/lib/commands/cm/stacks/export.js +15 -6
  3. package/lib/config/index.js +0 -2
  4. package/lib/export/module-exporter.js +37 -38
  5. package/lib/export/modules/assets.js +71 -14
  6. package/lib/export/modules/base-class.d.ts +17 -0
  7. package/lib/export/modules/base-class.js +45 -0
  8. package/lib/export/modules/content-types.js +30 -8
  9. package/lib/export/modules/custom-roles.js +61 -21
  10. package/lib/export/modules/entries.d.ts +2 -0
  11. package/lib/export/modules/entries.js +137 -37
  12. package/lib/export/modules/environments.js +45 -20
  13. package/lib/export/modules/extensions.js +42 -17
  14. package/lib/export/modules/global-fields.d.ts +1 -1
  15. package/lib/export/modules/global-fields.js +24 -6
  16. package/lib/export/modules/index.d.ts +1 -0
  17. package/lib/export/modules/index.js +1 -0
  18. package/lib/export/modules/labels.js +43 -16
  19. package/lib/export/modules/locales.js +31 -12
  20. package/lib/export/modules/marketplace-apps.d.ts +5 -2
  21. package/lib/export/modules/marketplace-apps.js +95 -25
  22. package/lib/export/modules/personalize.d.ts +12 -2
  23. package/lib/export/modules/personalize.js +181 -46
  24. package/lib/export/modules/stack.js +83 -28
  25. package/lib/export/modules/taxonomies.d.ts +4 -9
  26. package/lib/export/modules/taxonomies.js +123 -75
  27. package/lib/export/modules/webhooks.js +40 -17
  28. package/lib/export/modules/workflows.js +57 -20
  29. package/lib/types/default-config.d.ts +0 -2
  30. package/lib/types/index.d.ts +1 -1
  31. package/lib/utils/common-helper.d.ts +1 -2
  32. package/lib/utils/common-helper.js +1 -12
  33. package/lib/utils/constants.d.ts +147 -0
  34. package/lib/utils/constants.js +160 -0
  35. package/lib/utils/export-config-handler.js +2 -0
  36. package/lib/utils/index.d.ts +1 -0
  37. package/lib/utils/index.js +6 -1
  38. package/lib/utils/marketplace-app-helper.d.ts +1 -0
  39. package/lib/utils/marketplace-app-helper.js +21 -12
  40. package/lib/utils/progress-strategy-registry.d.ts +7 -0
  41. package/lib/utils/progress-strategy-registry.js +92 -0
  42. package/messages/index.json +4 -2
  43. package/oclif.manifest.json +1 -1
  44. package/package.json +2 -2
  45. package/lib/export/modules-js/assets.d.ts +0 -43
  46. package/lib/export/modules-js/assets.js +0 -396
  47. package/lib/export/modules-js/content-types.d.ts +0 -21
  48. package/lib/export/modules-js/content-types.js +0 -76
  49. package/lib/export/modules-js/custom-roles.d.ts +0 -21
  50. package/lib/export/modules-js/custom-roles.js +0 -76
  51. package/lib/export/modules-js/entries.d.ts +0 -18
  52. package/lib/export/modules-js/entries.js +0 -143
  53. package/lib/export/modules-js/environments.d.ts +0 -16
  54. package/lib/export/modules-js/environments.js +0 -62
  55. package/lib/export/modules-js/extensions.d.ts +0 -18
  56. package/lib/export/modules-js/extensions.js +0 -57
  57. package/lib/export/modules-js/global-fields.d.ts +0 -22
  58. package/lib/export/modules-js/global-fields.js +0 -108
  59. package/lib/export/modules-js/index.d.ts +0 -2
  60. package/lib/export/modules-js/index.js +0 -31
  61. package/lib/export/modules-js/labels.d.ts +0 -14
  62. package/lib/export/modules-js/labels.js +0 -56
  63. package/lib/export/modules-js/locales.d.ts +0 -23
  64. package/lib/export/modules-js/locales.js +0 -68
  65. package/lib/export/modules-js/marketplace-apps.d.ts +0 -21
  66. package/lib/export/modules-js/marketplace-apps.js +0 -132
  67. package/lib/export/modules-js/stack.d.ts +0 -18
  68. package/lib/export/modules-js/stack.js +0 -91
  69. package/lib/export/modules-js/webhooks.d.ts +0 -18
  70. package/lib/export/modules-js/webhooks.js +0 -60
  71. package/lib/export/modules-js/workflows.d.ts +0 -16
  72. package/lib/export/modules-js/workflows.js +0 -89
@@ -13,23 +13,46 @@ class ExportWorkFlows extends base_class_1.default {
13
13
  this.workflows = {};
14
14
  this.workflowConfig = exportConfig.modules.workflows;
15
15
  this.qs = { include_count: true };
16
- this.exportConfig.context.module = 'workflows';
16
+ this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.WORKFLOWS;
17
+ this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.WORKFLOWS];
17
18
  }
18
19
  async start() {
19
- this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.data, this.exportConfig.branchName || '', this.workflowConfig.dirName);
20
- cli_utilities_1.log.debug(`Workflows folder path: ${this.webhooksFolderPath}`, this.exportConfig.context);
21
- await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
22
- cli_utilities_1.log.debug('Created workflows directory', this.exportConfig.context);
23
- await this.getWorkflows();
24
- cli_utilities_1.log.debug(`Retrieved ${Object.keys(this.workflows).length} workflows`, this.exportConfig.context);
25
- if (this.workflows === undefined || (0, isEmpty_1.default)(this.workflows)) {
26
- cli_utilities_1.log.info(cli_utilities_1.messageHandler.parse('WORKFLOW_NOT_FOUND'), this.exportConfig.context);
20
+ try {
21
+ cli_utilities_1.log.debug('Starting workflows export process...', this.exportConfig.context);
22
+ // Setup with loading spinner
23
+ const [totalCount] = await this.withLoadingSpinner('WORKFLOWS: Analyzing workflows...', async () => {
24
+ var _a;
25
+ this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.data, this.exportConfig.branchName || '', this.workflowConfig.dirName);
26
+ await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
27
+ // Get count for progress tracking
28
+ const countResponse = await this.stack.workflow().fetchAll(Object.assign(Object.assign({}, this.qs), { limit: 1 }));
29
+ const workflowCount = countResponse.count !== undefined ? countResponse.count : ((_a = countResponse.items) === null || _a === void 0 ? void 0 : _a.length) || 0;
30
+ return [workflowCount];
31
+ });
32
+ if (totalCount === 0) {
33
+ cli_utilities_1.log.info(cli_utilities_1.messageHandler.parse('WORKFLOW_NOT_FOUND'), this.exportConfig.context);
34
+ return;
35
+ }
36
+ // Create nested progress manager for complex workflow processing
37
+ const progress = this.createSimpleProgress(this.currentModuleName, totalCount);
38
+ // Fetch workflows
39
+ progress.updateStatus('Fetching workflow definitions...');
40
+ await this.getWorkflows();
41
+ cli_utilities_1.log.debug(`Retrieved ${Object.keys(this.workflows || {}).length} workflows`, this.exportConfig.context);
42
+ if (this.workflows === undefined || (0, isEmpty_1.default)(this.workflows)) {
43
+ cli_utilities_1.log.info(cli_utilities_1.messageHandler.parse('WORKFLOW_NOT_FOUND'), this.exportConfig.context);
44
+ }
45
+ else {
46
+ const workflowsFilePath = (0, node_path_1.resolve)(this.webhooksFolderPath, this.workflowConfig.fileName);
47
+ cli_utilities_1.log.debug(`Writing workflows to: ${workflowsFilePath}`, this.exportConfig.context);
48
+ utils_1.fsUtil.writeFile(workflowsFilePath, this.workflows);
49
+ cli_utilities_1.log.success(cli_utilities_1.messageHandler.parse('WORKFLOW_EXPORT_COMPLETE', Object.keys(this.workflows || {}).length), this.exportConfig.context);
50
+ }
51
+ this.completeProgress(true);
27
52
  }
28
- else {
29
- const workflowsFilePath = (0, node_path_1.resolve)(this.webhooksFolderPath, this.workflowConfig.fileName);
30
- cli_utilities_1.log.debug(`Writing workflows to: ${workflowsFilePath}`, this.exportConfig.context);
31
- utils_1.fsUtil.writeFile(workflowsFilePath, this.workflows);
32
- cli_utilities_1.log.success(cli_utilities_1.messageHandler.parse('WORKFLOW_EXPORT_COMPLETE', Object.keys(this.workflows).length), this.exportConfig.context);
53
+ catch (error) {
54
+ (0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.exportConfig.context));
55
+ this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Workflows export failed');
33
56
  }
34
57
  }
35
58
  async getWorkflows(skip = 0) {
@@ -67,15 +90,23 @@ class ExportWorkFlows extends base_class_1.default {
67
90
  });
68
91
  }
69
92
  async sanitizeAttribs(workflows) {
70
- var _a;
93
+ var _a, _b, _c;
71
94
  cli_utilities_1.log.debug(`Sanitizing ${workflows.length} workflows`, this.exportConfig.context);
72
95
  for (let index = 0; index < (workflows === null || workflows === void 0 ? void 0 : workflows.length); index++) {
73
96
  const workflowUid = workflows[index].uid;
74
97
  const workflowName = ((_a = workflows[index]) === null || _a === void 0 ? void 0 : _a.name) || '';
75
98
  cli_utilities_1.log.debug(`Processing workflow: ${workflowName} (${workflowUid})`, this.exportConfig.context);
76
- await this.getWorkflowRoles(workflows[index]);
77
- this.workflows[workflowUid] = (0, omit_1.default)(workflows[index], this.workflowConfig.invalidKeys);
78
- cli_utilities_1.log.success(cli_utilities_1.messageHandler.parse('WORKFLOW_EXPORT_SUCCESS', workflowName), this.exportConfig.context);
99
+ try {
100
+ await this.getWorkflowRoles(workflows[index]);
101
+ this.workflows[workflowUid] = (0, omit_1.default)(workflows[index], this.workflowConfig.invalidKeys);
102
+ cli_utilities_1.log.success(cli_utilities_1.messageHandler.parse('WORKFLOW_EXPORT_SUCCESS', workflowName), this.exportConfig.context);
103
+ // Track progress for each workflow
104
+ (_b = this.progressManager) === null || _b === void 0 ? void 0 : _b.tick(true, `workflow: ${workflowName}`);
105
+ }
106
+ catch (error) {
107
+ cli_utilities_1.log.error(`Failed to process workflow: ${workflowName}`, this.exportConfig.context);
108
+ (_c = this.progressManager) === null || _c === void 0 ? void 0 : _c.tick(false, `workflow: ${workflowName}`, (error === null || error === void 0 ? void 0 : error.message) || 'Processing failed', 'Fetch');
109
+ }
79
110
  }
80
111
  cli_utilities_1.log.debug(`Sanitization complete. Total workflows processed: ${Object.keys(this.workflows).length}`, this.exportConfig.context);
81
112
  }
@@ -87,8 +118,13 @@ class ExportWorkFlows extends base_class_1.default {
87
118
  for (let i = 0; i < ((_c = (_b = (_a = stage === null || stage === void 0 ? void 0 : stage.SYS_ACL) === null || _a === void 0 ? void 0 : _a.roles) === null || _b === void 0 ? void 0 : _b.uids) === null || _c === void 0 ? void 0 : _c.length); i++) {
88
119
  const roleUid = stage.SYS_ACL.roles.uids[i];
89
120
  cli_utilities_1.log.debug(`Fetching role data for role UID: ${roleUid}`, this.exportConfig.context);
90
- const roleData = await this.getRoles(roleUid);
91
- stage.SYS_ACL.roles.uids[i] = roleData;
121
+ try {
122
+ const roleData = await this.getRoles(roleUid);
123
+ stage.SYS_ACL.roles.uids[i] = roleData;
124
+ }
125
+ catch (error) {
126
+ cli_utilities_1.log.error(`Failed to fetch role ${roleUid}`, this.exportConfig.context);
127
+ }
92
128
  }
93
129
  }
94
130
  }
@@ -104,6 +140,7 @@ class ExportWorkFlows extends base_class_1.default {
104
140
  .catch((err) => {
105
141
  cli_utilities_1.log.debug(`Failed to fetch role data for UID: ${roleUid}`, this.exportConfig.context);
106
142
  (0, cli_utilities_1.handleAndLogError)(err, Object.assign({}, this.exportConfig.context));
143
+ throw err;
107
144
  });
108
145
  }
109
146
  }
@@ -3,7 +3,6 @@ interface AnyProperty {
3
3
  [propName: string]: any;
4
4
  }
5
5
  export default interface DefaultConfig {
6
- contentVersion: number;
7
6
  versioning: boolean;
8
7
  host: string;
9
8
  cdn?: string;
@@ -200,6 +199,5 @@ export default interface DefaultConfig {
200
199
  writeConcurrency: number;
201
200
  developerHubBaseUrl: string;
202
201
  marketplaceAppEncryptionKey: string;
203
- onlyTSModules: string[];
204
202
  }
205
203
  export {};
@@ -100,7 +100,7 @@ export interface Context {
100
100
  command: string;
101
101
  module: string;
102
102
  userId: string | undefined;
103
- email: string | undefined;
103
+ email?: string | undefined;
104
104
  sessionId: string | undefined;
105
105
  clientId?: string | undefined;
106
106
  apiKey: string;
@@ -3,10 +3,9 @@
3
3
  * Copyright (c) 2024 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
- import { ExternalConfig, ExportConfig } from '../types';
6
+ import { ExternalConfig } from '../types';
7
7
  export declare const validateConfig: (config: ExternalConfig) => void;
8
8
  export declare const formatError: (error: any) => any;
9
9
  export declare const executeTask: (tasks: unknown[], handler: (task: unknown) => Promise<unknown>, options: {
10
10
  concurrency: number;
11
11
  }) => Promise<unknown[]>;
12
- export declare const writeExportMetaFile: (exportConfig: ExportConfig, metaFilePath?: string) => void;
@@ -5,12 +5,10 @@
5
5
  * MIT Licensed
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.writeExportMetaFile = exports.executeTask = exports.formatError = exports.validateConfig = void 0;
8
+ exports.executeTask = exports.formatError = exports.validateConfig = void 0;
9
9
  const tslib_1 = require("tslib");
10
- const path = tslib_1.__importStar(require("path"));
11
10
  const promise_limit_1 = tslib_1.__importDefault(require("promise-limit"));
12
11
  const cli_utilities_1 = require("@contentstack/cli-utilities");
13
- const file_helper_1 = require("./file-helper");
14
12
  const validateConfig = function (config) {
15
13
  if (!config.host || !config.cdn) {
16
14
  throw new Error('Host/CDN end point is missing from config');
@@ -78,12 +76,3 @@ const executeTask = function (tasks = [], handler, options) {
78
76
  }));
79
77
  };
80
78
  exports.executeTask = executeTask;
81
- // Note: we can add more useful details in meta file
82
- const writeExportMetaFile = (exportConfig, metaFilePath) => {
83
- const exportMeta = {
84
- contentVersion: exportConfig.contentVersion,
85
- logsPath: (0, cli_utilities_1.getLogPath)(),
86
- };
87
- file_helper_1.fsUtil.writeFile(path.join((0, cli_utilities_1.sanitizePath)(metaFilePath || exportConfig.exportDir), 'export-info.json'), exportMeta);
88
- };
89
- exports.writeExportMetaFile = writeExportMetaFile;
@@ -0,0 +1,147 @@
1
+ export declare const PROCESS_NAMES: {
2
+ readonly ASSET_FOLDERS: "Folders";
3
+ readonly ASSET_METADATA: "Metadata";
4
+ readonly ASSET_DOWNLOADS: "Downloads";
5
+ readonly FETCH_ROLES: "Fetch Roles";
6
+ readonly FETCH_LOCALES: "Fetch Locales";
7
+ readonly PROCESS_MAPPINGS: "Process Mappings";
8
+ readonly ENTRIES: "Entries";
9
+ readonly ENTRY_VERSIONS: "Entry Versions";
10
+ readonly VARIANT_ENTRIES: "Variant Entries";
11
+ readonly FETCH_APPS: "Fetch Apps";
12
+ readonly FETCH_CONFIG_MANIFEST: "Fetch config & manifest";
13
+ readonly STACK_SETTINGS: "Settings";
14
+ readonly STACK_LOCALE: "Locale";
15
+ readonly STACK_DETAILS: "Details";
16
+ readonly FETCH_TAXONOMIES: "Fetch Taxonomies";
17
+ readonly EXPORT_TAXONOMIES_TERMS: "Taxonomies & Terms";
18
+ readonly PERSONALIZE_PROJECTS: "Projects";
19
+ readonly PERSONALIZE_EVENTS: "Events";
20
+ readonly PERSONALIZE_ATTRIBUTES: "Attributes";
21
+ readonly PERSONALIZE_AUDIENCES: "Audiences";
22
+ readonly PERSONALIZE_EXPERIENCES: "Experiences";
23
+ };
24
+ export declare const MODULE_CONTEXTS: {
25
+ readonly ASSETS: "assets";
26
+ readonly CONTENT_TYPES: "content-types";
27
+ readonly CUSTOM_ROLES: "custom-roles";
28
+ readonly ENTRIES: "entries";
29
+ readonly ENVIRONMENTS: "environments";
30
+ readonly EXTENSIONS: "extensions";
31
+ readonly GLOBAL_FIELDS: "global-fields";
32
+ readonly LABELS: "labels";
33
+ readonly LOCALES: "locales";
34
+ readonly MARKETPLACE_APPS: "marketplace-apps";
35
+ readonly PERSONALIZE: "personalize";
36
+ readonly STACK: "stack";
37
+ readonly TAXONOMIES: "taxonomies";
38
+ readonly WEBHOOKS: "webhooks";
39
+ readonly WORKFLOWS: "workflows";
40
+ };
41
+ export declare const MODULE_NAMES: {
42
+ readonly assets: "Assets";
43
+ readonly "content-types": "Content Types";
44
+ readonly "custom-roles": "Custom Roles";
45
+ readonly entries: "Entries";
46
+ readonly environments: "Environments";
47
+ readonly extensions: "Extensions";
48
+ readonly "global-fields": "Global Fields";
49
+ readonly labels: "Labels";
50
+ readonly locales: "Locales";
51
+ readonly "marketplace-apps": "Marketplace Apps";
52
+ readonly personalize: "Personalize";
53
+ readonly stack: "Stack";
54
+ readonly taxonomies: "Taxonomies";
55
+ readonly webhooks: "Webhooks";
56
+ readonly workflows: "Workflows";
57
+ };
58
+ export declare const PROCESS_STATUS: {
59
+ Folders: {
60
+ FETCHING: string;
61
+ FAILED: string;
62
+ };
63
+ Metadata: {
64
+ FETCHING: string;
65
+ FAILED: string;
66
+ FETCHING_VERSION: string;
67
+ };
68
+ Downloads: {
69
+ DOWNLOADING: string;
70
+ FAILED: string;
71
+ };
72
+ "Fetch Roles": {
73
+ FETCHING: string;
74
+ FAILED: string;
75
+ };
76
+ "Fetch Locales": {
77
+ FETCHING: string;
78
+ FAILED: string;
79
+ };
80
+ "Process Mappings": {
81
+ PROCESSING: string;
82
+ FAILED: string;
83
+ };
84
+ Entries: {
85
+ PROCESSING: string;
86
+ FAILED: string;
87
+ };
88
+ "Entry Versions": {
89
+ PROCESSING: string;
90
+ FAILED: string;
91
+ };
92
+ "Variant Entries": {
93
+ PROCESSING: string;
94
+ FAILED: string;
95
+ };
96
+ "Fetch Apps": {
97
+ FETCHING: string;
98
+ FAILED: string;
99
+ };
100
+ "Fetch config & manifest": {
101
+ PROCESSING: string;
102
+ FAILED: string;
103
+ };
104
+ Settings: {
105
+ EXPORTING: string;
106
+ FAILED: string;
107
+ };
108
+ Locale: {
109
+ FETCHING: string;
110
+ FAILED: string;
111
+ };
112
+ Details: {
113
+ EXPORTING: string;
114
+ FAILED: string;
115
+ };
116
+ "Fetch Taxonomies": {
117
+ FETCHING: string;
118
+ FAILED: string;
119
+ };
120
+ "Taxonomies & Terms": {
121
+ EXPORTING: string;
122
+ FAILED: string;
123
+ };
124
+ Projects: {
125
+ EXPORTING: string;
126
+ FAILED: string;
127
+ };
128
+ Events: {
129
+ EXPORTING: string;
130
+ FAILED: string;
131
+ };
132
+ Attributes: {
133
+ EXPORTING: string;
134
+ FAILED: string;
135
+ };
136
+ Audiences: {
137
+ EXPORTING: string;
138
+ FAILED: string;
139
+ };
140
+ Experiences: {
141
+ EXPORTING: string;
142
+ FAILED: string;
143
+ };
144
+ };
145
+ export type ExportProcessName = (typeof PROCESS_NAMES)[keyof typeof PROCESS_NAMES];
146
+ export type ExportModuleContext = (typeof MODULE_CONTEXTS)[keyof typeof MODULE_CONTEXTS];
147
+ export type ExportProcessStatus = (typeof PROCESS_STATUS)[keyof typeof PROCESS_STATUS];
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROCESS_STATUS = exports.MODULE_NAMES = exports.MODULE_CONTEXTS = exports.PROCESS_NAMES = void 0;
4
+ exports.PROCESS_NAMES = {
5
+ // Assets module
6
+ ASSET_FOLDERS: 'Folders',
7
+ ASSET_METADATA: 'Metadata',
8
+ ASSET_DOWNLOADS: 'Downloads',
9
+ // Custom Roles module
10
+ FETCH_ROLES: 'Fetch Roles',
11
+ FETCH_LOCALES: 'Fetch Locales',
12
+ PROCESS_MAPPINGS: 'Process Mappings',
13
+ // Entries module
14
+ ENTRIES: 'Entries',
15
+ ENTRY_VERSIONS: 'Entry Versions',
16
+ VARIANT_ENTRIES: 'Variant Entries',
17
+ // Marketplace Apps module
18
+ FETCH_APPS: 'Fetch Apps',
19
+ FETCH_CONFIG_MANIFEST: 'Fetch config & manifest',
20
+ // Stack module
21
+ STACK_SETTINGS: 'Settings',
22
+ STACK_LOCALE: 'Locale',
23
+ STACK_DETAILS: 'Details',
24
+ // Taxonomies module
25
+ FETCH_TAXONOMIES: 'Fetch Taxonomies',
26
+ EXPORT_TAXONOMIES_TERMS: 'Taxonomies & Terms',
27
+ // Personalize module
28
+ PERSONALIZE_PROJECTS: 'Projects',
29
+ PERSONALIZE_EVENTS: 'Events',
30
+ PERSONALIZE_ATTRIBUTES: 'Attributes',
31
+ PERSONALIZE_AUDIENCES: 'Audiences',
32
+ PERSONALIZE_EXPERIENCES: 'Experiences',
33
+ };
34
+ exports.MODULE_CONTEXTS = {
35
+ ASSETS: 'assets',
36
+ CONTENT_TYPES: 'content-types',
37
+ CUSTOM_ROLES: 'custom-roles',
38
+ ENTRIES: 'entries',
39
+ ENVIRONMENTS: 'environments',
40
+ EXTENSIONS: 'extensions',
41
+ GLOBAL_FIELDS: 'global-fields',
42
+ LABELS: 'labels',
43
+ LOCALES: 'locales',
44
+ MARKETPLACE_APPS: 'marketplace-apps',
45
+ PERSONALIZE: 'personalize',
46
+ STACK: 'stack',
47
+ TAXONOMIES: 'taxonomies',
48
+ WEBHOOKS: 'webhooks',
49
+ WORKFLOWS: 'workflows',
50
+ };
51
+ // Display names for modules to avoid scattering user-facing strings
52
+ exports.MODULE_NAMES = {
53
+ [exports.MODULE_CONTEXTS.ASSETS]: 'Assets',
54
+ [exports.MODULE_CONTEXTS.CONTENT_TYPES]: 'Content Types',
55
+ [exports.MODULE_CONTEXTS.CUSTOM_ROLES]: 'Custom Roles',
56
+ [exports.MODULE_CONTEXTS.ENTRIES]: 'Entries',
57
+ [exports.MODULE_CONTEXTS.ENVIRONMENTS]: 'Environments',
58
+ [exports.MODULE_CONTEXTS.EXTENSIONS]: 'Extensions',
59
+ [exports.MODULE_CONTEXTS.GLOBAL_FIELDS]: 'Global Fields',
60
+ [exports.MODULE_CONTEXTS.LABELS]: 'Labels',
61
+ [exports.MODULE_CONTEXTS.LOCALES]: 'Locales',
62
+ [exports.MODULE_CONTEXTS.MARKETPLACE_APPS]: 'Marketplace Apps',
63
+ [exports.MODULE_CONTEXTS.PERSONALIZE]: 'Personalize',
64
+ [exports.MODULE_CONTEXTS.STACK]: 'Stack',
65
+ [exports.MODULE_CONTEXTS.TAXONOMIES]: 'Taxonomies',
66
+ [exports.MODULE_CONTEXTS.WEBHOOKS]: 'Webhooks',
67
+ [exports.MODULE_CONTEXTS.WORKFLOWS]: 'Workflows',
68
+ };
69
+ exports.PROCESS_STATUS = {
70
+ [exports.PROCESS_NAMES.ASSET_FOLDERS]: {
71
+ FETCHING: 'Fetching folder structure...',
72
+ FAILED: 'Failed to fetch folder structure.',
73
+ },
74
+ [exports.PROCESS_NAMES.ASSET_METADATA]: {
75
+ FETCHING: 'Fetching asset information...',
76
+ FAILED: 'Failed to fetch asset',
77
+ FETCHING_VERSION: 'Processing versioned assets...',
78
+ },
79
+ [exports.PROCESS_NAMES.ASSET_DOWNLOADS]: {
80
+ DOWNLOADING: 'Downloading asset file...',
81
+ FAILED: 'Failed to download asset:',
82
+ },
83
+ // Custom Roles
84
+ [exports.PROCESS_NAMES.FETCH_ROLES]: {
85
+ FETCHING: 'Fetching custom roles...',
86
+ FAILED: 'Failed to fetch custom roles.',
87
+ },
88
+ [exports.PROCESS_NAMES.FETCH_LOCALES]: {
89
+ FETCHING: 'Fetching locales...',
90
+ FAILED: 'Failed to fetch locales.',
91
+ },
92
+ [exports.PROCESS_NAMES.PROCESS_MAPPINGS]: {
93
+ PROCESSING: 'Processing role-locale mappings...',
94
+ FAILED: 'Failed to process role-locale mappings.',
95
+ },
96
+ [exports.PROCESS_NAMES.ENTRIES]: {
97
+ PROCESSING: 'Processing entry collections...',
98
+ FAILED: 'Failed to export entries.',
99
+ },
100
+ [exports.PROCESS_NAMES.ENTRY_VERSIONS]: {
101
+ PROCESSING: 'Processing entry versions...',
102
+ FAILED: 'Failed to export entry versions.',
103
+ },
104
+ [exports.PROCESS_NAMES.VARIANT_ENTRIES]: {
105
+ PROCESSING: 'Processing variant entries...',
106
+ FAILED: 'Failed to export variant entries.',
107
+ },
108
+ // Marketplace Apps
109
+ [exports.PROCESS_NAMES.FETCH_APPS]: {
110
+ FETCHING: 'Fetching marketplace apps...',
111
+ FAILED: 'Failed to fetch marketplace apps.',
112
+ },
113
+ [exports.PROCESS_NAMES.FETCH_CONFIG_MANIFEST]: {
114
+ PROCESSING: 'Processing app manifests and configurations...',
115
+ FAILED: 'Failed to process app manifests/configurations.',
116
+ },
117
+ // Stack
118
+ [exports.PROCESS_NAMES.STACK_SETTINGS]: {
119
+ EXPORTING: 'Exporting stack settings...',
120
+ FAILED: 'Failed to export stack settings.',
121
+ },
122
+ [exports.PROCESS_NAMES.STACK_LOCALE]: {
123
+ FETCHING: 'Fetching master locale...',
124
+ FAILED: 'Failed to fetch master locale.',
125
+ },
126
+ [exports.PROCESS_NAMES.STACK_DETAILS]: {
127
+ EXPORTING: 'Exporting stack data...',
128
+ FAILED: 'Failed to export stack data.',
129
+ },
130
+ // Taxonomies
131
+ [exports.PROCESS_NAMES.FETCH_TAXONOMIES]: {
132
+ FETCHING: 'Fetching taxonomy metadata...',
133
+ FAILED: 'Failed to fetch taxonomies.',
134
+ },
135
+ [exports.PROCESS_NAMES.EXPORT_TAXONOMIES_TERMS]: {
136
+ EXPORTING: 'Exporting taxonomy details...',
137
+ FAILED: 'Failed to export taxonomy details.',
138
+ },
139
+ // Personalize
140
+ [exports.PROCESS_NAMES.PERSONALIZE_PROJECTS]: {
141
+ EXPORTING: 'Exporting personalization projects...',
142
+ FAILED: 'Failed to export personalization projects.',
143
+ },
144
+ [exports.PROCESS_NAMES.PERSONALIZE_EVENTS]: {
145
+ EXPORTING: 'Exporting events...',
146
+ FAILED: 'Failed to export events.',
147
+ },
148
+ [exports.PROCESS_NAMES.PERSONALIZE_ATTRIBUTES]: {
149
+ EXPORTING: 'Exporting attributes...',
150
+ FAILED: 'Failed to export attributes.',
151
+ },
152
+ [exports.PROCESS_NAMES.PERSONALIZE_AUDIENCES]: {
153
+ EXPORTING: 'Exporting audiences...',
154
+ FAILED: 'Failed to export audiences.',
155
+ },
156
+ [exports.PROCESS_NAMES.PERSONALIZE_EXPERIENCES]: {
157
+ EXPORTING: 'Exporting experiences...',
158
+ FAILED: 'Failed to export experiences.',
159
+ },
160
+ };
@@ -119,6 +119,8 @@ const setupConfig = async (exportCmdFlags) => {
119
119
  throw new Error(`Invalid query format: ${error.message}`);
120
120
  }
121
121
  }
122
+ // Set progress supported module to check and display console logs
123
+ cli_utilities_1.configHandler.set('log.progressSupportedModule', 'export');
122
124
  // Add authentication details to config for context tracking
123
125
  config.authenticationMethod = authenticationMethod;
124
126
  cli_utilities_1.log.debug('Export configuration setup completed', Object.assign({}, config));
@@ -8,3 +8,4 @@ export { log, unlinkFileLogger } from './logger';
8
8
  export { default as login } from './basic-login';
9
9
  export * from './common-helper';
10
10
  export * from './marketplace-app-helper';
11
+ export { MODULE_CONTEXTS, MODULE_NAMES, PROCESS_NAMES, PROCESS_STATUS } from './constants';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.login = exports.unlinkFileLogger = exports.log = exports.setupExportDir = exports.setupBranches = exports.fsUtil = exports.fileHelper = exports.setupExportConfig = exports.interactive = void 0;
3
+ exports.PROCESS_STATUS = exports.PROCESS_NAMES = exports.MODULE_NAMES = exports.MODULE_CONTEXTS = exports.login = exports.unlinkFileLogger = exports.log = exports.setupExportDir = exports.setupBranches = exports.fsUtil = exports.fileHelper = exports.setupExportConfig = exports.interactive = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  exports.interactive = tslib_1.__importStar(require("./interactive"));
6
6
  var export_config_handler_1 = require("./export-config-handler");
@@ -19,3 +19,8 @@ var basic_login_1 = require("./basic-login");
19
19
  Object.defineProperty(exports, "login", { enumerable: true, get: function () { return tslib_1.__importDefault(basic_login_1).default; } });
20
20
  tslib_1.__exportStar(require("./common-helper"), exports);
21
21
  tslib_1.__exportStar(require("./marketplace-app-helper"), exports);
22
+ var constants_1 = require("./constants");
23
+ Object.defineProperty(exports, "MODULE_CONTEXTS", { enumerable: true, get: function () { return constants_1.MODULE_CONTEXTS; } });
24
+ Object.defineProperty(exports, "MODULE_NAMES", { enumerable: true, get: function () { return constants_1.MODULE_NAMES; } });
25
+ Object.defineProperty(exports, "PROCESS_NAMES", { enumerable: true, get: function () { return constants_1.PROCESS_NAMES; } });
26
+ Object.defineProperty(exports, "PROCESS_STATUS", { enumerable: true, get: function () { return constants_1.PROCESS_STATUS; } });
@@ -3,3 +3,4 @@ import { ExportConfig } from '../types';
3
3
  export declare const getDeveloperHubUrl: (exportConfig: ExportConfig) => Promise<string>;
4
4
  export declare function getOrgUid(config: ExportConfig): Promise<string>;
5
5
  export declare function createNodeCryptoInstance(config: ExportConfig): Promise<NodeCrypto>;
6
+ export declare function askEncryptionKey(config: ExportConfig): Promise<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNodeCryptoInstance = exports.getOrgUid = exports.getDeveloperHubUrl = void 0;
3
+ exports.askEncryptionKey = exports.createNodeCryptoInstance = exports.getOrgUid = exports.getDeveloperHubUrl = void 0;
4
4
  const cli_utilities_1 = require("@contentstack/cli-utilities");
5
5
  const getDeveloperHubUrl = async (exportConfig) => {
6
6
  return (0, cli_utilities_1.createDeveloperHubUrl)(exportConfig.host);
@@ -22,19 +22,28 @@ async function createNodeCryptoInstance(config) {
22
22
  if (config.forceStopMarketplaceAppsPrompt) {
23
23
  cryptoArgs['encryptionKey'] = config.marketplaceAppEncryptionKey;
24
24
  }
25
+ else if (config.marketplaceAppEncryptionKey) {
26
+ cryptoArgs['encryptionKey'] = config.marketplaceAppEncryptionKey;
27
+ }
25
28
  else {
26
- cryptoArgs['encryptionKey'] = await cli_utilities_1.cliux.inquire({
27
- type: 'input',
28
- name: 'name',
29
- default: config.marketplaceAppEncryptionKey,
30
- validate: (url) => {
31
- if (!url)
32
- return "Encryption key can't be empty.";
33
- return true;
34
- },
35
- message: 'Enter Marketplace app configurations encryption key',
36
- });
29
+ cli_utilities_1.cliux.print('');
30
+ cryptoArgs['encryptionKey'] = await askEncryptionKey(config);
31
+ cli_utilities_1.cliux.print('');
37
32
  }
38
33
  return new cli_utilities_1.NodeCrypto(cryptoArgs);
39
34
  }
40
35
  exports.createNodeCryptoInstance = createNodeCryptoInstance;
36
+ async function askEncryptionKey(config) {
37
+ return await cli_utilities_1.cliux.inquire({
38
+ type: 'input',
39
+ name: 'name',
40
+ default: config.marketplaceAppEncryptionKey,
41
+ validate: (url) => {
42
+ if (!url)
43
+ return "Encryption key can't be empty.";
44
+ return true;
45
+ },
46
+ message: 'Enter Marketplace app configurations encryption key',
47
+ });
48
+ }
49
+ exports.askEncryptionKey = askEncryptionKey;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Progress Strategy Registrations for Export Modules
3
+ * This file registers progress calculation strategies for all export modules
4
+ * to ensure correct item counts in the final summary.
5
+ */
6
+ import { ProgressStrategyRegistry } from '@contentstack/cli-utilities';
7
+ export default ProgressStrategyRegistry;