@contentstack/cli-cm-export 1.8.2 → 1.9.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 +3 -17
- package/lib/export/module-exporter.js +2 -1
- package/lib/export/modules/custom-roles.js +1 -2
- package/lib/export/modules/entries.js +5 -1
- package/lib/export/modules/environments.js +1 -2
- package/lib/export/modules/extensions.js +1 -2
- package/lib/export/modules/labels.js +1 -2
- package/lib/export/modules/marketplace-apps.js +1 -2
- package/lib/export/modules/stack.js +2 -5
- package/lib/export/modules/webhooks.js +1 -2
- package/lib/export/modules/workflows.js +4 -3
- package/lib/export/modules-js/marketplace-apps.d.ts +1 -0
- package/lib/export/modules-js/marketplace-apps.js +10 -3
- package/lib/types/default-config.d.ts +1 -2
- package/lib/utils/common-helper.d.ts +2 -1
- package/lib/utils/common-helper.js +12 -1
- package/lib/utils/logger.js +3 -3
- package/lib/utils/marketplace-app-helper.js +10 -3
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
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.9.0 linux-x64 node-v18.18.0
|
|
52
52
|
$ csdx --help [COMMAND]
|
|
53
53
|
USAGE
|
|
54
54
|
$ csdx COMMAND
|
|
@@ -18,7 +18,9 @@ class ExportCommand extends cli_command_1.Command {
|
|
|
18
18
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportConfig);
|
|
19
19
|
const moduleExporter = new export_1.ModuleExporter(managementAPIClient, exportConfig);
|
|
20
20
|
await moduleExporter.start();
|
|
21
|
+
(0, utils_1.writeExportMetaFile)(exportConfig);
|
|
21
22
|
(0, utils_1.log)(exportConfig, `The content of the stack ${exportConfig.apiKey} has been exported successfully!`, 'success');
|
|
23
|
+
(0, utils_1.log)(exportConfig, `The log has been stored at '${path_1.default.join(exportDir, 'logs', 'export')}'`, 'success');
|
|
22
24
|
}
|
|
23
25
|
catch (error) {
|
|
24
26
|
(0, utils_1.log)({ data: exportDir }, `Failed to export stack content - ${(0, utils_1.formatError)(error)}`, 'error');
|
package/lib/config/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config = {
|
|
4
|
+
contentVersion: 2,
|
|
4
5
|
versioning: false,
|
|
5
6
|
host: 'https://api.contentstack.io/v3',
|
|
6
7
|
developerHubUrls: {
|
|
@@ -96,8 +97,8 @@ const config = {
|
|
|
96
97
|
invalidKeys: ['created_at', 'updated_at', 'created_by', 'updated_by', '_metadata', 'published'],
|
|
97
98
|
// no of asset version files (of a single asset) that'll be downloaded parallel
|
|
98
99
|
chunkFileSize: 1,
|
|
99
|
-
downloadLimit:
|
|
100
|
-
fetchConcurrency:
|
|
100
|
+
downloadLimit: 5,
|
|
101
|
+
fetchConcurrency: 5,
|
|
101
102
|
assetsMetaKeys: [],
|
|
102
103
|
securedAssets: false,
|
|
103
104
|
displayExecutionTime: false,
|
|
@@ -369,20 +370,6 @@ const config = {
|
|
|
369
370
|
'xh',
|
|
370
371
|
'zu',
|
|
371
372
|
],
|
|
372
|
-
updatedModules: [
|
|
373
|
-
'assets',
|
|
374
|
-
'locales',
|
|
375
|
-
'extensions',
|
|
376
|
-
'marketplace-apps',
|
|
377
|
-
'labels',
|
|
378
|
-
'webhooks',
|
|
379
|
-
'custom-roles',
|
|
380
|
-
'global-fields',
|
|
381
|
-
'content-types',
|
|
382
|
-
'entries',
|
|
383
|
-
'workflows',
|
|
384
|
-
'stack',
|
|
385
|
-
],
|
|
386
373
|
apis: {
|
|
387
374
|
userSession: '/user-session/',
|
|
388
375
|
globalfields: '/global_fields/',
|
|
@@ -402,6 +389,5 @@ const config = {
|
|
|
402
389
|
writeConcurrency: 5,
|
|
403
390
|
developerHubBaseUrl: '',
|
|
404
391
|
marketplaceAppEncryptionKey: 'nF2ejRQcTv',
|
|
405
|
-
useNewModuleStructure: false,
|
|
406
392
|
};
|
|
407
393
|
exports.default = config;
|
|
@@ -41,6 +41,7 @@ class ModuleExporter {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
async export() {
|
|
44
|
+
(0, utils_1.log)(this.exportConfig, `Started to export content, version is ${this.exportConfig.contentVersion}`, 'info');
|
|
44
45
|
// checks for single module or all modules
|
|
45
46
|
if (this.exportConfig.singleModuleExport) {
|
|
46
47
|
return this.exportSingleModule(this.exportConfig.moduleName);
|
|
@@ -52,7 +53,7 @@ class ModuleExporter {
|
|
|
52
53
|
// export the modules by name
|
|
53
54
|
// calls the module runner which inturn calls the module itself
|
|
54
55
|
let exportedModuleResponse;
|
|
55
|
-
if (this.exportConfig.
|
|
56
|
+
if (this.exportConfig.contentVersion === 2) {
|
|
56
57
|
exportedModuleResponse = await (0, modules_1.default)({
|
|
57
58
|
stackAPIClient: this.stackAPIClient,
|
|
58
59
|
exportConfig: this.exportConfig,
|
|
@@ -6,14 +6,13 @@ const find_1 = tslib_1.__importDefault(require("lodash/find"));
|
|
|
6
6
|
const forEach_1 = tslib_1.__importDefault(require("lodash/forEach"));
|
|
7
7
|
const values_1 = tslib_1.__importDefault(require("lodash/values"));
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
10
9
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
11
10
|
const utils_1 = require("../../utils");
|
|
12
11
|
class ExportCustomRoles extends base_class_1.default {
|
|
13
12
|
constructor({ exportConfig, stackAPIClient }) {
|
|
14
13
|
super({ exportConfig, stackAPIClient });
|
|
15
14
|
this.customRoles = {};
|
|
16
|
-
this.customRolesConfig =
|
|
15
|
+
this.customRolesConfig = exportConfig.modules.customRoles;
|
|
17
16
|
this.existingRoles = { Admin: 1, Developer: 1, 'Content Manager': 1 };
|
|
18
17
|
this.localesMap = {};
|
|
19
18
|
this.sourceLocalesMap = {};
|
|
@@ -27,7 +27,11 @@ class EntriesExport extends base_class_1.default {
|
|
|
27
27
|
}
|
|
28
28
|
const entryRequestOptions = this.createRequestObjects(locales, contentTypes);
|
|
29
29
|
for (let entryRequestOption of entryRequestOptions) {
|
|
30
|
-
|
|
30
|
+
// log(
|
|
31
|
+
// this.exportConfig,
|
|
32
|
+
// `Starting export of entries of content type - ${entryRequestOption.contentType} locale - ${entryRequestOption.locale}`,
|
|
33
|
+
// 'info',
|
|
34
|
+
// );
|
|
31
35
|
await this.getEntries(entryRequestOption);
|
|
32
36
|
(_a = this.entriesFileHelper) === null || _a === void 0 ? void 0 : _a.completeFile(true);
|
|
33
37
|
(0, utils_1.log)(this.exportConfig, `Exported entries of type '${entryRequestOption.contentType}' locale '${entryRequestOption.locale}'`, 'success');
|
|
@@ -4,14 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportEnvironments extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
12
|
this.environments = {};
|
|
14
|
-
this.environmentConfig =
|
|
13
|
+
this.environmentConfig = exportConfig.modules.environments;
|
|
15
14
|
this.qs = { include_count: true };
|
|
16
15
|
}
|
|
17
16
|
async start() {
|
|
@@ -4,14 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
5
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportExtensions extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
12
|
this.extensions = {};
|
|
14
|
-
this.extensionConfig =
|
|
13
|
+
this.extensionConfig = exportConfig.modules.extensions;
|
|
15
14
|
this.qs = { include_count: true };
|
|
16
15
|
}
|
|
17
16
|
async start() {
|
|
@@ -4,14 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
5
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportLabels extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
12
|
this.labels = {};
|
|
14
|
-
this.labelConfig =
|
|
13
|
+
this.labelConfig = exportConfig.modules.labels;
|
|
15
14
|
this.qs = { include_count: true };
|
|
16
15
|
}
|
|
17
16
|
async start() {
|
|
@@ -8,14 +8,13 @@ const entries_1 = tslib_1.__importDefault(require("lodash/entries"));
|
|
|
8
8
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
11
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
12
11
|
const utils_1 = require("../../utils");
|
|
13
12
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
14
13
|
class ExportMarketplaceApps extends base_class_1.default {
|
|
15
14
|
constructor({ exportConfig, stackAPIClient }) {
|
|
16
15
|
super({ exportConfig, stackAPIClient });
|
|
17
16
|
this.httpClient = new cli_utilities_1.HttpClient();
|
|
18
|
-
this.marketplaceAppConfig =
|
|
17
|
+
this.marketplaceAppConfig = exportConfig.modules.marketplace_apps;
|
|
19
18
|
this.listOfApps = [];
|
|
20
19
|
this.installedApps = [];
|
|
21
20
|
}
|
|
@@ -4,13 +4,12 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const find_1 = tslib_1.__importDefault(require("lodash/find"));
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportStack extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
|
-
this.stackConfig =
|
|
12
|
+
this.stackConfig = exportConfig.modules.stack;
|
|
14
13
|
this.qs = { include_count: true };
|
|
15
14
|
this.stackFolderPath = (0, node_path_1.resolve)(this.exportConfig.data, this.stackConfig.dirName);
|
|
16
15
|
}
|
|
@@ -35,9 +34,7 @@ class ExportStack extends base_class_1.default {
|
|
|
35
34
|
return await tempAPIClient
|
|
36
35
|
.stack({ api_key: this.exportConfig.source_stack })
|
|
37
36
|
.fetch()
|
|
38
|
-
.catch((error) => {
|
|
39
|
-
(0, utils_1.log)(this.exportConfig, `Failed to export stack. ${(0, utils_1.formatError)(error)}`, 'error');
|
|
40
|
-
});
|
|
37
|
+
.catch((error) => { });
|
|
41
38
|
}
|
|
42
39
|
async getLocales(skip = 0) {
|
|
43
40
|
if (skip) {
|
|
@@ -4,14 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
5
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportWebhooks extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
12
|
this.webhooks = {};
|
|
14
|
-
this.webhookConfig =
|
|
13
|
+
this.webhookConfig = exportConfig.modules.webhooks;
|
|
15
14
|
this.qs = { include_count: true, asc: 'updated_at' };
|
|
16
15
|
}
|
|
17
16
|
async start() {
|
|
@@ -4,14 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
5
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const config_1 = tslib_1.__importDefault(require("../../config"));
|
|
8
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
class ExportWorkFlows extends base_class_1.default {
|
|
11
10
|
constructor({ exportConfig, stackAPIClient }) {
|
|
12
11
|
super({ exportConfig, stackAPIClient });
|
|
13
12
|
this.workflows = {};
|
|
14
|
-
this.workflowConfig =
|
|
13
|
+
this.workflowConfig = exportConfig.modules.workflows;
|
|
15
14
|
this.qs = { include_count: true };
|
|
16
15
|
}
|
|
17
16
|
async start() {
|
|
@@ -36,10 +35,12 @@ class ExportWorkFlows extends base_class_1.default {
|
|
|
36
35
|
.fetchAll(this.qs)
|
|
37
36
|
.then(async (data) => {
|
|
38
37
|
const { items, count } = data;
|
|
38
|
+
//NOTE - Handle the case where old workflow api is enabled in that case getting responses as objects.
|
|
39
|
+
const workflowCount = count !== undefined ? count : items.length;
|
|
39
40
|
if (items === null || items === void 0 ? void 0 : items.length) {
|
|
40
41
|
await this.sanitizeAttribs(items);
|
|
41
42
|
skip += this.workflowConfig.limit || 100;
|
|
42
|
-
if (skip >=
|
|
43
|
+
if (skip >= workflowCount) {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
return await this.getWorkflows(skip);
|
|
@@ -13,6 +13,7 @@ declare class ExportMarketplaceApps {
|
|
|
13
13
|
dependencies?: import("../../types").Modules[];
|
|
14
14
|
};
|
|
15
15
|
start(): Promise<void>;
|
|
16
|
+
appSdkAxiosInstance: any;
|
|
16
17
|
getOrgUid(): Promise<void>;
|
|
17
18
|
exportInstalledExtensions(): Promise<void>;
|
|
18
19
|
getAllStackSpecificApps(listOfApps?: any[], skip?: number): any;
|
|
@@ -25,6 +25,9 @@ module.exports = class ExportMarketplaceApps {
|
|
|
25
25
|
return Promise.resolve();
|
|
26
26
|
}
|
|
27
27
|
this.developerHubBaseUrl = this.config.developerHubBaseUrl || (await getDeveloperHubUrl(this.config));
|
|
28
|
+
this.appSdkAxiosInstance = await managementSDKClient({
|
|
29
|
+
host: this.developerHubBaseUrl.split('://').pop()
|
|
30
|
+
});
|
|
28
31
|
await this.getOrgUid();
|
|
29
32
|
const httpClient = new HttpClient();
|
|
30
33
|
if (!this.config.auth_token) {
|
|
@@ -70,8 +73,12 @@ module.exports = class ExportMarketplaceApps {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
getAllStackSpecificApps(listOfApps = [], skip = 0) {
|
|
73
|
-
return this.
|
|
74
|
-
.get(
|
|
76
|
+
return this.appSdkAxiosInstance.axiosInstance
|
|
77
|
+
.get(`/installations?target_uids=${this.config.source_stack}&skip=${skip}`, {
|
|
78
|
+
headers: {
|
|
79
|
+
organization_uid: this.config.org_uid
|
|
80
|
+
},
|
|
81
|
+
})
|
|
75
82
|
.then(async ({ data }) => {
|
|
76
83
|
const { data: apps, count } = data;
|
|
77
84
|
if (!this.nodeCrypto && _.find(apps, (app) => !_.isEmpty(app.configuration))) {
|
|
@@ -118,7 +125,7 @@ module.exports = class ExportMarketplaceApps {
|
|
|
118
125
|
log(this.config, `Error on exporting ${appName} app and it's config.`, 'error');
|
|
119
126
|
}
|
|
120
127
|
})
|
|
121
|
-
.catch(err => {
|
|
128
|
+
.catch((err) => {
|
|
122
129
|
log(this.config, `Failed to export ${appName} app config ${formatError(err)}`, 'error');
|
|
123
130
|
});
|
|
124
131
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Modules } from '.';
|
|
2
2
|
export default interface DefaultConfig {
|
|
3
|
+
contentVersion: number;
|
|
3
4
|
versioning: boolean;
|
|
4
5
|
host: string;
|
|
5
6
|
cdn?: string;
|
|
@@ -135,7 +136,6 @@ export default interface DefaultConfig {
|
|
|
135
136
|
};
|
|
136
137
|
};
|
|
137
138
|
languagesCode: string[];
|
|
138
|
-
updatedModules: string[];
|
|
139
139
|
apis: {
|
|
140
140
|
userSession: string;
|
|
141
141
|
globalfields: string;
|
|
@@ -155,5 +155,4 @@ export default interface DefaultConfig {
|
|
|
155
155
|
writeConcurrency: number;
|
|
156
156
|
developerHubBaseUrl: string;
|
|
157
157
|
marketplaceAppEncryptionKey: string;
|
|
158
|
-
useNewModuleStructure: boolean;
|
|
159
158
|
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2019 Contentstack LLC
|
|
4
4
|
* MIT Licensed
|
|
5
5
|
*/
|
|
6
|
-
import { ExternalConfig } from '../types';
|
|
6
|
+
import { ExternalConfig, ExportConfig } 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) => void;
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* MIT Licensed
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.executeTask = exports.formatError = exports.validateConfig = void 0;
|
|
8
|
+
exports.writeExportMetaFile = exports.executeTask = exports.formatError = exports.validateConfig = void 0;
|
|
9
9
|
const tslib_1 = require("tslib");
|
|
10
10
|
const promise_limit_1 = tslib_1.__importDefault(require("promise-limit"));
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
11
12
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
13
|
+
const file_helper_1 = require("./file-helper");
|
|
12
14
|
const validateConfig = function (config) {
|
|
13
15
|
if (!config.host || !config.cdn) {
|
|
14
16
|
throw new Error('Host/CDN end point is missing from config');
|
|
@@ -76,3 +78,12 @@ const executeTask = function (tasks = [], handler, options) {
|
|
|
76
78
|
}));
|
|
77
79
|
};
|
|
78
80
|
exports.executeTask = executeTask;
|
|
81
|
+
// Note: we can add more useful details in meta file
|
|
82
|
+
const writeExportMetaFile = (exportConfig) => {
|
|
83
|
+
const exportMeta = {
|
|
84
|
+
contentVersion: exportConfig.contentVersion,
|
|
85
|
+
logsPath: path.join(exportConfig.exportDir, 'logs', 'export'),
|
|
86
|
+
};
|
|
87
|
+
file_helper_1.fsUtil.writeFile(path.join(exportConfig.exportDir, exportConfig.branchName || '', 'export-info.json'), exportMeta);
|
|
88
|
+
};
|
|
89
|
+
exports.writeExportMetaFile = writeExportMetaFile;
|
package/lib/utils/logger.js
CHANGED
|
@@ -122,14 +122,14 @@ function init(_logPath) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
const log = async (config, message, type) => {
|
|
125
|
-
|
|
125
|
+
const logsPath = config.data || __dirname;
|
|
126
126
|
// ignoring the type argument, as we are not using it to create a logfile anymore
|
|
127
127
|
if (type !== 'error') {
|
|
128
128
|
// removed type argument from init method
|
|
129
|
-
init(
|
|
129
|
+
init(logsPath).log(message);
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
|
-
init(
|
|
132
|
+
init(logsPath).error(message);
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
exports.log = log;
|
|
@@ -19,7 +19,7 @@ async function getOrgUid(config) {
|
|
|
19
19
|
.stack({ api_key: config.source_stack })
|
|
20
20
|
.fetch()
|
|
21
21
|
.catch((error) => {
|
|
22
|
-
(0, utils_1.log)(
|
|
22
|
+
(0, utils_1.log)(config, (0, utils_1.formatError)(error), 'error');
|
|
23
23
|
});
|
|
24
24
|
return tempStackData === null || tempStackData === void 0 ? void 0 : tempStackData.org_uid;
|
|
25
25
|
}
|
|
@@ -47,8 +47,15 @@ async function createNodeCryptoInstance(config) {
|
|
|
47
47
|
exports.createNodeCryptoInstance = createNodeCryptoInstance;
|
|
48
48
|
const getStackSpecificApps = async (params) => {
|
|
49
49
|
const { developerHubBaseUrl, httpClient, config, skip } = params;
|
|
50
|
-
|
|
51
|
-
.
|
|
50
|
+
const appSdkAxiosInstance = await (0, cli_utilities_1.managementSDKClient)({
|
|
51
|
+
host: developerHubBaseUrl.split('://').pop()
|
|
52
|
+
});
|
|
53
|
+
return appSdkAxiosInstance.axiosInstance
|
|
54
|
+
.get(`${developerHubBaseUrl}/installations?target_uids=${config.source_stack}&skip=${skip}`, {
|
|
55
|
+
headers: {
|
|
56
|
+
organization_uid: config.org_uid,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
52
59
|
.then((data) => data.data)
|
|
53
60
|
.catch((error) => (0, utils_1.log)(config, `Failed to export marketplace-apps ${(0, utils_1.formatError)(error)}`, 'error'));
|
|
54
61
|
};
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.9.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@contentstack/cli-dev-dependencies": "~1.2.3",
|
|
30
30
|
"@oclif/plugin-help": "^5.1.19",
|
|
31
31
|
"@oclif/test": "^1.2.6",
|
|
32
|
+
"@types/big-json": "^3.2.0",
|
|
32
33
|
"@types/mkdirp": "^1.0.2",
|
|
33
34
|
"@types/progress-stream": "^2.0.2",
|
|
34
|
-
"@types/mkdirp": "^1.0.2",
|
|
35
35
|
"assert": "^2.0.0",
|
|
36
36
|
"chai": "^4.2.0",
|
|
37
37
|
"dotenv": "^16.0.1",
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"repository": "https://github.com/contentstack/cli"
|
|
101
|
-
}
|
|
101
|
+
}
|