@contentstack/cli-cm-import 1.17.0 → 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 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.17.0 linux-x64 node-v18.20.4
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);
@@ -33,7 +33,7 @@ const config = {
33
33
  'marketplace-apps',
34
34
  'global-fields',
35
35
  'content-types',
36
- 'personalization',
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
- personalization: {
154
+ personalize: {
155
155
  baseURL: {
156
- NA: 'https://personalization-api.contentstack.com',
156
+ NA: 'https://personalize-api.contentstack.com',
157
157
  },
158
158
  importData: true,
159
- dirName: 'personalization',
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 ImportPersonalization {
2
+ export default class ImportPersonalize {
3
3
  private config;
4
- personalizeConfig: ImportConfig['modules']['personalization'];
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 ImportPersonalization {
5
+ class ImportPersonalize {
6
6
  constructor({ importConfig }) {
7
7
  this.config = importConfig;
8
- this.personalizeConfig = importConfig.modules.personalization;
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 personalization import if project creation fails
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 personalization migration...', 'warn');
45
+ (0, utils_1.log)(this.config, 'Skipping personalize migration...', 'warn');
46
46
  }
47
47
  }
48
48
  }
49
49
  }
50
- exports.default = ImportPersonalization;
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
- personalization: ImportConfig['modules']['personalization'];
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.personalization = importConfig.modules.personalization;
12
- this.projectMapperFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', (0, cli_utilities_1.sanitizePath)(this.personalization.dirName), 'projects', 'projects.json');
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 && this.personalization.importData) {
22
- this.config.modules.personalization.project_id = project.uid;
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,
@@ -120,7 +120,7 @@ export default interface DefaultConfig {
120
120
  fileName: string;
121
121
  dependencies?: Modules[];
122
122
  };
123
- personalization: {
123
+ personalize: {
124
124
  baseURL: Record<string, string>;
125
125
  dirName: string;
126
126
  importData: boolean;
@@ -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' | 'personalization' | 'variant-entries';
29
+ export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps' | 'taxonomies' | 'personalize' | 'variant-entries';
30
30
  export type ModuleClassParams = {
31
31
  stackAPIClient: ReturnType<ContentstackClient['stack']>;
32
32
  importConfig: ImportConfig;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.17.0",
2
+ "version": "1.18.0",
3
3
  "commands": {
4
4
  "cm:stacks:import": {
5
5
  "id": "cm:stacks:import",
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.17.0",
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.1-alpha",
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",
@@ -46,7 +46,7 @@
46
46
  "nyc": "^15.1.0",
47
47
  "oclif": "^3.8.1",
48
48
  "rimraf": "^2.7.1",
49
- "sinon": "^11.1.1",
49
+ "sinon": "^19.0.0",
50
50
  "tmp": "^0.2.2",
51
51
  "ts-node": "^10.9.1",
52
52
  "typescript": "^4.9.3"