@contentstack/cli-cm-export 1.12.1 → 1.14.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/export.js +2 -0
- package/lib/config/index.js +4 -4
- package/lib/export/modules/marketplace-apps.js +8 -6
- package/lib/export/modules/{personalization.d.ts → personalize.d.ts} +1 -1
- package/lib/export/modules/{personalization.js → personalize.js} +10 -5
- 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 +6 -6
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
|
|
|
48
48
|
$ csdx COMMAND
|
|
49
49
|
running command...
|
|
50
50
|
$ csdx (--version)
|
|
51
|
-
@contentstack/cli-cm-export/1.
|
|
51
|
+
@contentstack/cli-cm-export/1.14.0 linux-x64 node-v18.20.4
|
|
52
52
|
$ csdx --help [COMMAND]
|
|
53
53
|
USAGE
|
|
54
54
|
$ csdx COMMAND
|
|
@@ -17,6 +17,8 @@ class ExportCommand extends cli_command_1.Command {
|
|
|
17
17
|
exportConfig.host = this.cmaHost;
|
|
18
18
|
exportConfig.region = this.region;
|
|
19
19
|
exportConfig.developerHubBaseUrl = this.developerHubUrl;
|
|
20
|
+
if (this.personalizeUrl)
|
|
21
|
+
exportConfig.modules.personalize.baseURL[exportConfig.region.name] = this.personalizeUrl;
|
|
20
22
|
exportDir = exportConfig.cliLogsPath || exportConfig.data || exportConfig.exportDir;
|
|
21
23
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportConfig);
|
|
22
24
|
const moduleExporter = new export_1.ModuleExporter(managementAPIClient, exportConfig);
|
package/lib/config/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const config = {
|
|
|
33
33
|
'content-types',
|
|
34
34
|
'custom-roles',
|
|
35
35
|
'workflows',
|
|
36
|
-
'
|
|
36
|
+
'personalize',
|
|
37
37
|
'entries',
|
|
38
38
|
'labels',
|
|
39
39
|
'marketplace-apps',
|
|
@@ -144,11 +144,11 @@ const config = {
|
|
|
144
144
|
dependencies: ['locales', 'content-types'],
|
|
145
145
|
exportVersions: false,
|
|
146
146
|
},
|
|
147
|
-
|
|
147
|
+
personalize: {
|
|
148
148
|
baseURL: {
|
|
149
|
-
NA: 'https://
|
|
149
|
+
NA: 'https://personalize-api.contentstack.com',
|
|
150
150
|
},
|
|
151
|
-
dirName: '
|
|
151
|
+
dirName: 'personalize',
|
|
152
152
|
exportOrder: ['attributes', 'audiences', 'events', 'experiences'],
|
|
153
153
|
projects: {
|
|
154
154
|
dirName: 'projects',
|
|
@@ -101,9 +101,11 @@ class ExportMarketplaceApps {
|
|
|
101
101
|
* identifier (uid), and other installation data.
|
|
102
102
|
*/
|
|
103
103
|
async getAppConfigurations(index, appInstallation) {
|
|
104
|
-
var _a;
|
|
104
|
+
var _a, _b;
|
|
105
105
|
const appName = (_a = appInstallation === null || appInstallation === void 0 ? void 0 : appInstallation.manifest) === null || _a === void 0 ? void 0 : _a.name;
|
|
106
|
-
(0
|
|
106
|
+
const appUid = (_b = appInstallation === null || appInstallation === void 0 ? void 0 : appInstallation.manifest) === null || _b === void 0 ? void 0 : _b.uid;
|
|
107
|
+
const app = appName || appUid;
|
|
108
|
+
(0, utils_1.log)(this.exportConfig, `Exporting ${app} app and it's config.`, 'info');
|
|
107
109
|
await this.appSdk
|
|
108
110
|
.marketplace(this.exportConfig.org_uid)
|
|
109
111
|
.installation(appInstallation.uid)
|
|
@@ -119,19 +121,19 @@ class ExportMarketplaceApps {
|
|
|
119
121
|
}
|
|
120
122
|
if (!(0, isEmpty_1.default)(data === null || data === void 0 ? void 0 : data.server_configuration)) {
|
|
121
123
|
this.installedApps[index]['server_configuration'] = this.nodeCrypto.encrypt(data.server_configuration);
|
|
122
|
-
(0, utils_1.log)(this.exportConfig, `Exported ${
|
|
124
|
+
(0, utils_1.log)(this.exportConfig, `Exported ${app} app and it's config.`, 'success');
|
|
123
125
|
}
|
|
124
126
|
else {
|
|
125
|
-
(0, utils_1.log)(this.exportConfig, `Exported ${
|
|
127
|
+
(0, utils_1.log)(this.exportConfig, `Exported ${app} app`, 'success');
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
else if (error) {
|
|
129
|
-
(0, utils_1.log)(this.exportConfig, `Error on exporting ${
|
|
131
|
+
(0, utils_1.log)(this.exportConfig, `Error on exporting ${app} app and it's config.`, 'error');
|
|
130
132
|
(0, utils_1.log)(this.exportConfig, error, 'error');
|
|
131
133
|
}
|
|
132
134
|
})
|
|
133
135
|
.catch((error) => {
|
|
134
|
-
(0, utils_1.log)(this.exportConfig, `Failed to export ${
|
|
136
|
+
(0, utils_1.log)(this.exportConfig, `Failed to export ${app} app config ${(0, utils_1.formatError)(error)}`, 'error');
|
|
135
137
|
(0, utils_1.log)(this.exportConfig, error, 'error');
|
|
136
138
|
});
|
|
137
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyProperty } from '@contentstack/cli-variants';
|
|
2
2
|
import { ModuleClassParams, ExportConfig } from '../../types';
|
|
3
|
-
export default class
|
|
3
|
+
export default class ExportPersonalize {
|
|
4
4
|
exportConfig: ExportConfig;
|
|
5
5
|
personalizeConfig: {
|
|
6
6
|
dirName: string;
|
|
@@ -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 ExportPersonalize {
|
|
6
6
|
constructor({ exportConfig }) {
|
|
7
7
|
this.exportConfig = exportConfig;
|
|
8
|
-
this.personalizeConfig = exportConfig.modules.
|
|
8
|
+
this.personalizeConfig = exportConfig.modules.personalize;
|
|
9
9
|
}
|
|
10
10
|
async start() {
|
|
11
11
|
try {
|
|
@@ -27,7 +27,7 @@ class ExportPersonalization {
|
|
|
27
27
|
audiences: new cli_variants_1.ExportAudiences(this.exportConfig),
|
|
28
28
|
experiences: new cli_variants_1.ExportExperiences(this.exportConfig),
|
|
29
29
|
};
|
|
30
|
-
const order = this.exportConfig.modules.
|
|
30
|
+
const order = this.exportConfig.modules.personalize
|
|
31
31
|
.exportOrder;
|
|
32
32
|
for (const module of order) {
|
|
33
33
|
if (moduleMapper[module]) {
|
|
@@ -40,9 +40,14 @@ class ExportPersonalization {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
catch (error) {
|
|
43
|
+
if (error === 'Forbidden') {
|
|
44
|
+
(0, utils_1.log)(this.exportConfig, "Personalize is not enabled in the given organization!", 'info');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
(0, utils_1.log)(this.exportConfig, error, 'error');
|
|
48
|
+
}
|
|
43
49
|
this.exportConfig.personalizationEnabled = false;
|
|
44
|
-
(0, utils_1.log)(this.exportConfig, error, 'error');
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
exports.default =
|
|
53
|
+
exports.default = ExportPersonalize;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface Region {
|
|
|
26
26
|
cda: string;
|
|
27
27
|
uiHost: 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';
|
|
30
30
|
export type ModuleClassParams = {
|
|
31
31
|
stackAPIClient: ReturnType<ContentstackClient['stack']>;
|
|
32
32
|
exportConfig: ExportConfig;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "~1.3.
|
|
9
|
-
"@contentstack/cli-variants": "~
|
|
10
|
-
"@contentstack/cli-utilities": "~1.
|
|
8
|
+
"@contentstack/cli-command": "~1.3.2",
|
|
9
|
+
"@contentstack/cli-variants": "~1.1.0",
|
|
10
|
+
"@contentstack/cli-utilities": "~1.8.0",
|
|
11
11
|
"@oclif/core": "^3.26.5",
|
|
12
12
|
"async": "^3.2.4",
|
|
13
13
|
"big-json": "^3.2.0",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"winston": "^3.7.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@contentstack/cli-auth": "~1.3.
|
|
29
|
-
"@contentstack/cli-config": "~1.7.
|
|
28
|
+
"@contentstack/cli-auth": "~1.3.22",
|
|
29
|
+
"@contentstack/cli-config": "~1.7.3",
|
|
30
30
|
"@contentstack/cli-dev-dependencies": "~1.2.4",
|
|
31
31
|
"@oclif/plugin-help": "^5.1.19",
|
|
32
32
|
"@oclif/test": "^2.5.6",
|