@contentstack/cli-cm-import 1.30.0 → 1.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/commands/cm/stacks/import.d.ts +0 -1
- package/lib/commands/cm/stacks/import.js +4 -17
- package/lib/import/modules/composable-studio.d.ts +1 -1
- package/lib/import/modules/composable-studio.js +12 -16
- package/lib/import/modules/content-types.d.ts +1 -1
- package/lib/import/modules/content-types.js +1 -1
- package/lib/import/modules/entries.js +1 -1
- package/lib/import/modules/global-fields.d.ts +1 -1
- package/lib/import/modules/global-fields.js +1 -1
- package/lib/import/modules/locales.d.ts +1 -1
- package/lib/import/modules/locales.js +1 -1
- package/lib/import/modules-js/assets.js +1 -1
- package/lib/import/modules-js/entries.js +1 -1
- package/lib/import/modules-js/environments.js +1 -1
- package/lib/import/modules-js/extensions.js +1 -1
- package/lib/import/modules-js/global-fields.js +1 -1
- package/lib/import/modules-js/labels.js +1 -1
- package/lib/import/modules-js/locales.js +1 -1
- package/lib/import/modules-js/marketplace-apps.js +1 -1
- package/lib/import/modules-js/webhooks.js +1 -1
- package/lib/import/modules-js/workflows.js +1 -1
- package/lib/types/index.d.ts +0 -19
- package/lib/utils/common-helper.d.ts +1 -1
- package/lib/utils/common-helper.js +1 -1
- package/lib/utils/content-type-helper.d.ts +1 -1
- package/lib/utils/content-type-helper.js +1 -1
- package/lib/utils/extension-helper.js +1 -1
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/login-handler.d.ts +1 -1
- package/lib/utils/login-handler.js +1 -1
- package/messages/index.json +5 -5
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import/1.30.
|
|
50
|
+
@contentstack/cli-cm-import/1.30.2 linux-x64 node-v22.21.1
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -6,6 +6,7 @@ const import_1 = require("../../../import");
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
class ImportCommand extends cli_command_1.Command {
|
|
8
8
|
async run() {
|
|
9
|
+
var _a, _b;
|
|
9
10
|
// setup import config
|
|
10
11
|
// initialize the importer
|
|
11
12
|
// start import
|
|
@@ -15,9 +16,9 @@ class ImportCommand extends cli_command_1.Command {
|
|
|
15
16
|
const { flags } = await this.parse(ImportCommand);
|
|
16
17
|
importConfig = await (0, utils_1.setupImportConfig)(flags);
|
|
17
18
|
// Prepare the context object
|
|
18
|
-
|
|
19
|
-
importConfig.context =
|
|
20
|
-
//
|
|
19
|
+
(0, cli_utilities_1.createLogContext)(((_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.command) || 'cm:stacks:export', importConfig.apiKey, importConfig.authenticationMethod);
|
|
20
|
+
importConfig.context = { module: '' };
|
|
21
|
+
//log.info(`Using Cli Version: ${this.context?.cliVersion}`, importConfig.context);
|
|
21
22
|
// Note setting host to create cma client
|
|
22
23
|
importConfig.host = this.cmaHost;
|
|
23
24
|
importConfig.region = this.region;
|
|
@@ -51,20 +52,6 @@ class ImportCommand extends cli_command_1.Command {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
// Create export context object
|
|
55
|
-
createImportContext(apiKey, authenticationMethod) {
|
|
56
|
-
var _a, _b, _c;
|
|
57
|
-
return {
|
|
58
|
-
command: ((_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.command) || 'cm:stacks:import',
|
|
59
|
-
module: '',
|
|
60
|
-
userId: cli_utilities_1.configHandler.get('userUid') || '',
|
|
61
|
-
email: cli_utilities_1.configHandler.get('email') || '',
|
|
62
|
-
sessionId: (_c = this.context) === null || _c === void 0 ? void 0 : _c.sessionId,
|
|
63
|
-
apiKey: apiKey || '',
|
|
64
|
-
orgId: cli_utilities_1.configHandler.get('oauthOrgUid') || '',
|
|
65
|
-
authenticationMethod: authenticationMethod || 'Basic Auth',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
55
|
}
|
|
69
56
|
exports.default = ImportCommand;
|
|
70
57
|
ImportCommand.description = cli_utilities_1.messageHandler.parse('Import content from a stack');
|
|
@@ -15,25 +15,24 @@ class ImportComposableStudio {
|
|
|
15
15
|
this.composableStudioFilePath = (0, node_path_1.join)(this.composableStudioPath, this.composableStudioConfig.fileName);
|
|
16
16
|
this.envUidMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'environments', 'uid-mapping.json');
|
|
17
17
|
this.envUidMapper = {};
|
|
18
|
-
// Initialize HttpClient with
|
|
18
|
+
// Initialize HttpClient with Studio API base URL
|
|
19
19
|
this.apiClient = new cli_utilities_1.HttpClient();
|
|
20
20
|
this.apiClient.baseUrl(`${this.composableStudioConfig.apiBaseUrl}/${this.composableStudioConfig.apiVersion}`);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Entry point for
|
|
23
|
+
* Entry point for Studio import
|
|
24
24
|
*/
|
|
25
25
|
async start() {
|
|
26
26
|
if (this.importConfig.management_token) {
|
|
27
|
-
cli_utilities_1.log.warn('Skipping
|
|
27
|
+
cli_utilities_1.log.warn('Skipping Studio project import when using management token', this.importConfig.context);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
cli_utilities_1.log.debug('Starting
|
|
31
|
-
cli_utilities_1.cliux.print(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_IMPORT_START'), { color: 'blue' });
|
|
30
|
+
cli_utilities_1.log.debug('Starting Studio project import process...', this.importConfig.context);
|
|
32
31
|
try {
|
|
33
32
|
// Initialize authentication
|
|
34
33
|
const authInitialized = await this.addAuthHeaders();
|
|
35
34
|
if (!authInitialized) {
|
|
36
|
-
cli_utilities_1.log.warn('Skipping
|
|
35
|
+
cli_utilities_1.log.warn('Skipping Studio project import when using OAuth authentication', this.importConfig.context);
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
38
|
// Load environment UID mapper
|
|
@@ -41,8 +40,7 @@ class ImportComposableStudio {
|
|
|
41
40
|
// Read exported project data
|
|
42
41
|
const exportedProject = await this.readExportedProject();
|
|
43
42
|
if (!exportedProject) {
|
|
44
|
-
cli_utilities_1.log.
|
|
45
|
-
cli_utilities_1.cliux.print(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_NOT_FOUND'), { color: 'yellow' });
|
|
43
|
+
cli_utilities_1.log.warn(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_NOT_FOUND'), this.importConfig.context);
|
|
46
44
|
return;
|
|
47
45
|
}
|
|
48
46
|
cli_utilities_1.log.debug(`Exported project found: ${exportedProject.name}`, this.importConfig.context);
|
|
@@ -50,12 +48,10 @@ class ImportComposableStudio {
|
|
|
50
48
|
const existingProject = await this.getExistingProject();
|
|
51
49
|
if (existingProject) {
|
|
52
50
|
cli_utilities_1.log.warn(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_SKIP_EXISTING'), this.importConfig.context);
|
|
53
|
-
cli_utilities_1.cliux.print(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_SKIP_EXISTING'), { color: 'yellow' });
|
|
54
51
|
return;
|
|
55
52
|
}
|
|
56
53
|
// Import the project with name conflict handling
|
|
57
54
|
await this.importProject(exportedProject);
|
|
58
|
-
cli_utilities_1.cliux.print(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_IMPORT_COMPLETE', exportedProject.name), { color: 'green' });
|
|
59
55
|
cli_utilities_1.log.success(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_IMPORT_COMPLETE', exportedProject.name), this.importConfig.context);
|
|
60
56
|
}
|
|
61
57
|
catch (error) {
|
|
@@ -66,7 +62,7 @@ class ImportComposableStudio {
|
|
|
66
62
|
* Initialize authentication headers for API calls
|
|
67
63
|
*/
|
|
68
64
|
async addAuthHeaders() {
|
|
69
|
-
cli_utilities_1.log.debug('Initializing
|
|
65
|
+
cli_utilities_1.log.debug('Initializing Studio API authentication...', this.importConfig.context);
|
|
70
66
|
// Get authentication details - following personalization-api-adapter pattern
|
|
71
67
|
await cli_utilities_1.authenticationHandler.getAuthDetails();
|
|
72
68
|
const token = cli_utilities_1.authenticationHandler.accessToken;
|
|
@@ -87,7 +83,7 @@ class ImportComposableStudio {
|
|
|
87
83
|
'Content-Type': 'application/json',
|
|
88
84
|
Accept: 'application/json',
|
|
89
85
|
});
|
|
90
|
-
cli_utilities_1.log.debug('
|
|
86
|
+
cli_utilities_1.log.debug('Studio API authentication initialized', this.importConfig.context);
|
|
91
87
|
return true;
|
|
92
88
|
}
|
|
93
89
|
/**
|
|
@@ -109,12 +105,12 @@ class ImportComposableStudio {
|
|
|
109
105
|
async readExportedProject() {
|
|
110
106
|
cli_utilities_1.log.debug(`Reading exported project from: ${this.composableStudioFilePath}`, this.importConfig.context);
|
|
111
107
|
if (!utils_1.fileHelper.fileExistsSync(this.composableStudioFilePath)) {
|
|
112
|
-
cli_utilities_1.log.debug('
|
|
108
|
+
cli_utilities_1.log.debug('Studio project file does not exist', this.importConfig.context);
|
|
113
109
|
return null;
|
|
114
110
|
}
|
|
115
111
|
const projectData = utils_1.fileHelper.readFileSync(this.composableStudioFilePath);
|
|
116
112
|
if (!projectData || (0, isEmpty_1.default)(projectData)) {
|
|
117
|
-
cli_utilities_1.log.debug('
|
|
113
|
+
cli_utilities_1.log.debug('Studio project file is empty', this.importConfig.context);
|
|
118
114
|
return null;
|
|
119
115
|
}
|
|
120
116
|
return projectData;
|
|
@@ -215,8 +211,8 @@ class ImportComposableStudio {
|
|
|
215
211
|
*/
|
|
216
212
|
async promptForNewProjectName(currentName) {
|
|
217
213
|
const suggestedName = `Copy of ${currentName}`;
|
|
218
|
-
cli_utilities_1.
|
|
219
|
-
cli_utilities_1.
|
|
214
|
+
cli_utilities_1.log.warn(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_NAME_CONFLICT', currentName), this.importConfig.context);
|
|
215
|
+
cli_utilities_1.log.info(cli_utilities_1.messageHandler.parse('COMPOSABLE_STUDIO_SUGGEST_NAME', suggestedName), this.importConfig.context);
|
|
220
216
|
const response = await cli_utilities_1.cliux.inquire({
|
|
221
217
|
type: 'input',
|
|
222
218
|
name: 'projectName',
|
package/lib/types/index.d.ts
CHANGED
|
@@ -98,15 +98,7 @@ export interface ComposableStudioProject {
|
|
|
98
98
|
updatedAt?: string;
|
|
99
99
|
}
|
|
100
100
|
export interface Context {
|
|
101
|
-
command: string;
|
|
102
101
|
module: string;
|
|
103
|
-
userId: string | undefined;
|
|
104
|
-
email: string | undefined;
|
|
105
|
-
sessionId: string | undefined;
|
|
106
|
-
clientId?: string | undefined;
|
|
107
|
-
apiKey: string;
|
|
108
|
-
orgId: string;
|
|
109
|
-
authenticationMethod?: string;
|
|
110
102
|
}
|
|
111
103
|
export { default as DefaultConfig } from './default-config';
|
|
112
104
|
export { default as ImportConfig } from './import-config';
|
|
@@ -117,14 +109,3 @@ export type ExtensionType = {
|
|
|
117
109
|
scope: Record<string, unknown>;
|
|
118
110
|
title: string;
|
|
119
111
|
};
|
|
120
|
-
export interface Context {
|
|
121
|
-
command: string;
|
|
122
|
-
module: string;
|
|
123
|
-
userId: string | undefined;
|
|
124
|
-
email: string | undefined;
|
|
125
|
-
sessionId: string | undefined;
|
|
126
|
-
clientId?: string | undefined;
|
|
127
|
-
apiKey: string;
|
|
128
|
-
orgId: string;
|
|
129
|
-
authenticationMethod?: string;
|
|
130
|
-
}
|
|
@@ -42,7 +42,7 @@ export declare const schemaTemplate: {
|
|
|
42
42
|
};
|
|
43
43
|
/*!
|
|
44
44
|
* Contentstack Import
|
|
45
|
-
* Copyright (c)
|
|
45
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
46
46
|
* MIT Licensed
|
|
47
47
|
*/
|
|
48
48
|
export declare const suppressSchemaReference: (schema: any, flag: any) => void;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.lookupExtension = void 0;
|
|
7
7
|
/*!
|
|
8
8
|
* Contentstack Import
|
|
9
|
-
* Copyright (c)
|
|
9
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
10
10
|
* MIT Licensed
|
|
11
11
|
*/
|
|
12
12
|
const node_path_1 = require("node:path");
|
package/lib/utils/logger.d.ts
CHANGED
package/lib/utils/logger.js
CHANGED
package/messages/index.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"COMPOSABLE_STUDIO_IMPORT_START": "Starting
|
|
3
|
-
"COMPOSABLE_STUDIO_NOT_FOUND": "No
|
|
4
|
-
"COMPOSABLE_STUDIO_SKIP_EXISTING": "Skipping
|
|
5
|
-
"COMPOSABLE_STUDIO_IMPORT_COMPLETE": "Successfully imported
|
|
6
|
-
"COMPOSABLE_STUDIO_IMPORT_FAILED": "Failed to import
|
|
2
|
+
"COMPOSABLE_STUDIO_IMPORT_START": "Starting Studio project import...",
|
|
3
|
+
"COMPOSABLE_STUDIO_NOT_FOUND": "No Studio project found in exported data",
|
|
4
|
+
"COMPOSABLE_STUDIO_SKIP_EXISTING": "Skipping Studio import - target stack already has a connected project",
|
|
5
|
+
"COMPOSABLE_STUDIO_IMPORT_COMPLETE": "Successfully imported Studio project '%s'",
|
|
6
|
+
"COMPOSABLE_STUDIO_IMPORT_FAILED": "Failed to import Studio project: %s",
|
|
7
7
|
"COMPOSABLE_STUDIO_NAME_CONFLICT": "Project name '%s' already exists. Please provide a new name:",
|
|
8
8
|
"COMPOSABLE_STUDIO_SUGGEST_NAME": "Suggested name: %s",
|
|
9
9
|
"COMPOSABLE_STUDIO_ENV_MAPPING_FAILED": "Warning: Could not map environment '%s', using empty environment"
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import",
|
|
3
3
|
"description": "Contentstack CLI plugin to import content into stack",
|
|
4
|
-
"version": "1.30.
|
|
4
|
+
"version": "1.30.2",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-audit": "~1.16.
|
|
9
|
-
"@contentstack/cli-command": "~1.7.
|
|
10
|
-
"@contentstack/cli-utilities": "~1.
|
|
8
|
+
"@contentstack/cli-audit": "~1.16.2",
|
|
9
|
+
"@contentstack/cli-command": "~1.7.1",
|
|
10
|
+
"@contentstack/cli-utilities": "~1.16.0",
|
|
11
11
|
"@contentstack/management": "~1.22.0",
|
|
12
|
-
"@contentstack/cli-variants": "~1.3.
|
|
12
|
+
"@contentstack/cli-variants": "~1.3.6",
|
|
13
13
|
"@oclif/core": "^4.3.0",
|
|
14
14
|
"big-json": "^3.2.0",
|
|
15
15
|
"bluebird": "^3.7.2",
|