@contentstack/cli-cm-import 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commands/cm/stacks/import.js +2 -0
- package/lib/config/index.js +4 -4
- package/lib/import/modules/{personalization.d.ts → personalize.d.ts} +2 -2
- package/lib/import/modules/{personalization.js → personalize.js} +5 -5
- package/lib/import/modules/variant-entries.d.ts +1 -1
- package/lib/import/modules/variant-entries.js +4 -4
- package/lib/types/default-config.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
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.
|
|
50
|
+
@contentstack/cli-cm-import/1.18.0 linux-x64 node-v18.20.4
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -19,6 +19,8 @@ class ImportCommand extends cli_command_1.Command {
|
|
|
19
19
|
importConfig.host = this.cmaHost;
|
|
20
20
|
importConfig.region = this.region;
|
|
21
21
|
importConfig.developerHubBaseUrl = this.developerHubUrl;
|
|
22
|
+
if (this.personalizeUrl)
|
|
23
|
+
importConfig.modules.personalize.baseURL[importConfig.region.name] = this.personalizeUrl;
|
|
22
24
|
backupDir = importConfig.cliLogsPath || importConfig.backupDir;
|
|
23
25
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(importConfig);
|
|
24
26
|
const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
|
package/lib/config/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const config = {
|
|
|
33
33
|
'marketplace-apps',
|
|
34
34
|
'global-fields',
|
|
35
35
|
'content-types',
|
|
36
|
-
'
|
|
36
|
+
'personalize',
|
|
37
37
|
'custom-roles',
|
|
38
38
|
'workflows',
|
|
39
39
|
'entries',
|
|
@@ -151,12 +151,12 @@ const config = {
|
|
|
151
151
|
dirName: 'taxonomies',
|
|
152
152
|
fileName: 'taxonomies.json',
|
|
153
153
|
},
|
|
154
|
-
|
|
154
|
+
personalize: {
|
|
155
155
|
baseURL: {
|
|
156
|
-
NA: 'https://
|
|
156
|
+
NA: 'https://personalize-api.contentstack.com',
|
|
157
157
|
},
|
|
158
158
|
importData: true,
|
|
159
|
-
dirName: '
|
|
159
|
+
dirName: 'personalize',
|
|
160
160
|
importOrder: ['attributes', 'audiences', 'events', 'experiences'],
|
|
161
161
|
project_id: '',
|
|
162
162
|
projects: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImportConfig, ModuleClassParams } from '../../types';
|
|
2
|
-
export default class
|
|
2
|
+
export default class ImportPersonalize {
|
|
3
3
|
private config;
|
|
4
|
-
personalizeConfig: ImportConfig['modules']['
|
|
4
|
+
personalizeConfig: ImportConfig['modules']['personalize'];
|
|
5
5
|
constructor({ importConfig }: ModuleClassParams);
|
|
6
6
|
/**
|
|
7
7
|
* The `start` function in TypeScript asynchronously imports data based on a specified order using a
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_variants_1 = require("@contentstack/cli-variants");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
-
class
|
|
5
|
+
class ImportPersonalize {
|
|
6
6
|
constructor({ importConfig }) {
|
|
7
7
|
this.config = importConfig;
|
|
8
|
-
this.personalizeConfig = importConfig.modules.
|
|
8
|
+
this.personalizeConfig = importConfig.modules.personalize;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The `start` function in TypeScript asynchronously imports data based on a specified order using a
|
|
@@ -39,12 +39,12 @@ class ImportPersonalization {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
|
-
this.personalizeConfig.importData = false; // Stop
|
|
42
|
+
this.personalizeConfig.importData = false; // Stop personalize import if project creation fails
|
|
43
43
|
(0, utils_1.log)(this.config, error, 'error');
|
|
44
44
|
if (!this.personalizeConfig.importData) {
|
|
45
|
-
(0, utils_1.log)(this.config, 'Skipping
|
|
45
|
+
(0, utils_1.log)(this.config, 'Skipping personalize migration...', 'warn');
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
exports.default =
|
|
50
|
+
exports.default = ImportPersonalize;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImportConfig, ModuleClassParams } from '../../types';
|
|
2
2
|
export default class ImportVarientEntries {
|
|
3
3
|
private config;
|
|
4
|
-
|
|
4
|
+
personalize: ImportConfig['modules']['personalize'];
|
|
5
5
|
private projectMapperFilePath;
|
|
6
6
|
constructor({ importConfig }: ModuleClassParams);
|
|
7
7
|
/**
|
|
@@ -8,8 +8,8 @@ const utils_1 = require("../../utils");
|
|
|
8
8
|
class ImportVarientEntries {
|
|
9
9
|
constructor({ importConfig }) {
|
|
10
10
|
this.config = importConfig;
|
|
11
|
-
this.
|
|
12
|
-
this.projectMapperFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', (0, cli_utilities_1.sanitizePath)(this.
|
|
11
|
+
this.personalize = importConfig.modules.personalize;
|
|
12
|
+
this.projectMapperFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', (0, cli_utilities_1.sanitizePath)(this.personalize.dirName), 'projects', 'projects.json');
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The `start` function in TypeScript is an asynchronous method that conditionally imports data using
|
|
@@ -18,8 +18,8 @@ class ImportVarientEntries {
|
|
|
18
18
|
async start() {
|
|
19
19
|
try {
|
|
20
20
|
const project = utils_1.fsUtil.readFile(this.projectMapperFilePath);
|
|
21
|
-
if (project && project.uid
|
|
22
|
-
this.config.modules.
|
|
21
|
+
if (project && project.uid) {
|
|
22
|
+
this.config.modules.personalize.project_id = project.uid;
|
|
23
23
|
const helpers = {
|
|
24
24
|
lookUpTerms: utils_1.lookUpTerms,
|
|
25
25
|
lookupAssets: utils_1.lookupAssets,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface User {
|
|
|
26
26
|
email: string;
|
|
27
27
|
authtoken: string;
|
|
28
28
|
}
|
|
29
|
-
export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | '
|
|
29
|
+
export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize' | 'variant-entries';
|
|
30
30
|
export type ModuleClassParams = {
|
|
31
31
|
stackAPIClient: ReturnType<ContentstackClient['stack']>;
|
|
32
32
|
importConfig: ImportConfig;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import",
|
|
3
3
|
"description": "Contentstack CLI plugin to import content into stack",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@contentstack/cli-command": "~1.3.0",
|
|
10
10
|
"@contentstack/cli-utilities": "~1.7.2",
|
|
11
11
|
"@contentstack/management": "~1.17.0",
|
|
12
|
-
"@contentstack/cli-variants": "0.0
|
|
12
|
+
"@contentstack/cli-variants": "~1.0.0",
|
|
13
13
|
"@oclif/core": "^3.26.5",
|
|
14
14
|
"big-json": "^3.2.0",
|
|
15
15
|
"bluebird": "^3.7.2",
|