@contentstack/cli-cm-export 1.5.9 → 1.6.1

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.
Files changed (97) hide show
  1. package/README.md +2 -2
  2. package/lib/commands/cm/stacks/export.d.ts +10 -0
  3. package/lib/commands/cm/stacks/export.js +108 -0
  4. package/lib/config/index.d.ts +3 -0
  5. package/lib/config/index.js +393 -0
  6. package/lib/export/index.d.ts +1 -0
  7. package/lib/export/index.js +8 -0
  8. package/lib/export/module-exporter.d.ts +15 -0
  9. package/lib/export/module-exporter.js +93 -0
  10. package/lib/export/modules/assets.d.ts +54 -0
  11. package/lib/export/modules/assets.js +303 -0
  12. package/lib/export/modules/base-class.d.ts +48 -0
  13. package/lib/export/modules/base-class.js +117 -0
  14. package/lib/export/modules/index.d.ts +3 -0
  15. package/lib/export/modules/index.js +38 -0
  16. package/lib/export/modules/locales.d.ts +16 -0
  17. package/lib/export/modules/locales.js +68 -0
  18. package/lib/export/modules-js/assets.d.ts +43 -0
  19. package/lib/export/modules-js/assets.js +391 -0
  20. package/lib/export/modules-js/content-types.d.ts +21 -0
  21. package/lib/export/modules-js/content-types.js +75 -0
  22. package/lib/export/modules-js/custom-roles.d.ts +21 -0
  23. package/lib/export/modules-js/custom-roles.js +76 -0
  24. package/lib/export/modules-js/entries.d.ts +18 -0
  25. package/lib/export/modules-js/entries.js +141 -0
  26. package/lib/export/modules-js/environments.d.ts +16 -0
  27. package/lib/export/modules-js/environments.js +62 -0
  28. package/lib/export/modules-js/extensions.d.ts +18 -0
  29. package/lib/export/modules-js/extensions.js +57 -0
  30. package/lib/export/modules-js/global-fields.d.ts +22 -0
  31. package/lib/export/modules-js/global-fields.js +107 -0
  32. package/lib/export/modules-js/index.d.ts +1 -0
  33. package/lib/export/modules-js/index.js +33 -0
  34. package/lib/export/modules-js/labels.d.ts +14 -0
  35. package/lib/export/modules-js/labels.js +56 -0
  36. package/lib/export/modules-js/locales.d.ts +23 -0
  37. package/lib/export/modules-js/locales.js +67 -0
  38. package/lib/export/modules-js/marketplace-apps.d.ts +21 -0
  39. package/lib/export/modules-js/marketplace-apps.js +144 -0
  40. package/lib/export/modules-js/stack.d.ts +18 -0
  41. package/lib/export/modules-js/stack.js +91 -0
  42. package/lib/export/modules-js/webhooks.d.ts +18 -0
  43. package/lib/export/modules-js/webhooks.js +60 -0
  44. package/lib/export/modules-js/workflows.d.ts +16 -0
  45. package/lib/export/modules-js/workflows.js +89 -0
  46. package/lib/types/default-config.d.ts +158 -0
  47. package/lib/types/default-config.js +2 -0
  48. package/lib/types/export-config.d.ts +34 -0
  49. package/lib/types/export-config.js +2 -0
  50. package/lib/types/index.d.ts +45 -0
  51. package/lib/types/index.js +2 -0
  52. package/lib/utils/basic-login.d.ts +8 -0
  53. package/lib/utils/basic-login.js +45 -0
  54. package/lib/utils/common-helper.d.ts +11 -0
  55. package/lib/utils/common-helper.js +78 -0
  56. package/lib/utils/export-config-handler.d.ts +3 -0
  57. package/lib/utils/export-config-handler.js +72 -0
  58. package/lib/utils/file-helper.d.ts +14 -0
  59. package/lib/utils/file-helper.js +120 -0
  60. package/lib/utils/index.d.ts +10 -0
  61. package/lib/utils/index.js +21 -0
  62. package/lib/utils/interactive.d.ts +6 -0
  63. package/lib/utils/interactive.js +71 -0
  64. package/lib/utils/logger.d.ts +8 -0
  65. package/lib/utils/logger.js +154 -0
  66. package/lib/utils/marketplace-app-helper.d.ts +1 -0
  67. package/lib/utils/marketplace-app-helper.js +23 -0
  68. package/lib/utils/setup-branches.d.ts +3 -0
  69. package/lib/utils/setup-branches.js +49 -0
  70. package/lib/utils/setup-export-dir.d.ts +2 -0
  71. package/lib/utils/setup-export-dir.js +12 -0
  72. package/messages/index.json +1 -7
  73. package/oclif.manifest.json +1 -1
  74. package/package.json +37 -23
  75. package/src/app.js +0 -156
  76. package/src/commands/cm/stacks/export.js +0 -202
  77. package/src/config/default.js +0 -360
  78. package/src/lib/export/assets.js +0 -454
  79. package/src/lib/export/content-types.js +0 -90
  80. package/src/lib/export/custom-roles.js +0 -92
  81. package/src/lib/export/entries.js +0 -200
  82. package/src/lib/export/environments.js +0 -74
  83. package/src/lib/export/extensions.js +0 -69
  84. package/src/lib/export/global-fields.js +0 -122
  85. package/src/lib/export/labels.js +0 -67
  86. package/src/lib/export/locales.js +0 -72
  87. package/src/lib/export/marketplace-apps.js +0 -187
  88. package/src/lib/export/stack.js +0 -98
  89. package/src/lib/export/webhooks.js +0 -76
  90. package/src/lib/export/workflows.js +0 -106
  91. package/src/lib/util/export-flags.js +0 -193
  92. package/src/lib/util/helper.js +0 -113
  93. package/src/lib/util/index.js +0 -80
  94. package/src/lib/util/log.js +0 -161
  95. package/src/lib/util/login.js +0 -79
  96. package/src/lib/util/marketplace-app-helper.js +0 -24
  97. package/src/lib/util/setup-branches.js +0 -56
@@ -0,0 +1,144 @@
1
+ /*!
2
+ * Contentstack Export
3
+ * Copyright (c) 2019 Contentstack LLC
4
+ * MIT Licensed
5
+ */
6
+ const _ = require('lodash');
7
+ const path = require('path');
8
+ const chalk = require('chalk');
9
+ const mkdirp = require('mkdirp');
10
+ const eachOf = require('async/eachOf');
11
+ const { cliux, HttpClient, NodeCrypto, managementSDKClient, HttpClientDecorator, OauthDecorator, isAuthenticated, } = require('@contentstack/cli-utilities');
12
+ const { default: config } = require('../../config');
13
+ const { formatError, log, fileHelper } = require('../../utils');
14
+ const { getDeveloperHubUrl } = require('../../utils');
15
+ module.exports = class ExportMarketplaceApps {
16
+ constructor(credentialConfig) {
17
+ this.marketplaceAppPath = null;
18
+ this.developerHubBaseUrl = null;
19
+ this.marketplaceAppConfig = config.modules.marketplace_apps;
20
+ this.config = _.merge(config, credentialConfig);
21
+ }
22
+ async start() {
23
+ if (!isAuthenticated()) {
24
+ cliux.print('WARNING!!! To export Marketplace apps, you must be logged in. Please check csdx auth:login --help to log in', { color: 'yellow' });
25
+ return Promise.resolve();
26
+ }
27
+ this.developerHubBaseUrl = this.config.developerHubBaseUrl || (await getDeveloperHubUrl());
28
+ await this.getOrgUid();
29
+ const httpClient = new HttpClient();
30
+ if (!this.config.auth_token) {
31
+ this.httpClient = new OauthDecorator(httpClient);
32
+ const headers = await this.httpClient.preHeadersCheck(this.config);
33
+ this.httpClient = this.httpClient.headers(headers);
34
+ }
35
+ else {
36
+ this.httpClient = new HttpClientDecorator(httpClient);
37
+ this.httpClient.headers(this.config);
38
+ }
39
+ log(this.config, 'Starting marketplace app export', 'success');
40
+ this.marketplaceAppPath = path.resolve(this.config.data, this.config.branchName || '', this.marketplaceAppConfig.dirName);
41
+ mkdirp.sync(this.marketplaceAppPath);
42
+ return this.exportInstalledExtensions();
43
+ }
44
+ async getOrgUid() {
45
+ const tempAPIClient = await managementSDKClient({ host: this.config.host });
46
+ const tempStackData = await tempAPIClient
47
+ .stack({ api_key: this.config.source_stack })
48
+ .fetch()
49
+ .catch((error) => {
50
+ log(this.config, formatError(error), 'error');
51
+ console.log(error);
52
+ });
53
+ if (tempStackData && tempStackData.org_uid) {
54
+ this.config.org_uid = tempStackData.org_uid;
55
+ }
56
+ }
57
+ async createNodeCryptoInstance() {
58
+ const cryptoArgs = {};
59
+ if (this.config.forceStopMarketplaceAppsPrompt) {
60
+ cryptoArgs['encryptionKey'] = this.config.marketplaceAppEncryptionKey;
61
+ }
62
+ else {
63
+ cryptoArgs['encryptionKey'] = await cliux.inquire({
64
+ type: 'input',
65
+ name: 'name',
66
+ default: this.config.marketplaceAppEncryptionKey,
67
+ validate: (url) => {
68
+ if (!url)
69
+ return "Encryption key can't be empty.";
70
+ return true;
71
+ },
72
+ message: 'Enter marketplace app configurations encryption key',
73
+ });
74
+ }
75
+ this.nodeCrypto = new NodeCrypto(cryptoArgs);
76
+ }
77
+ async exportInstalledExtensions() {
78
+ const client = await managementSDKClient({ host: this.developerHubBaseUrl.split('://').pop() });
79
+ const installedApps = (await this.getAllStackSpecificApps()) || [];
80
+ if (!_.isEmpty(installedApps)) {
81
+ for (const [index, app] of _.entries(installedApps)) {
82
+ await this.getAppConfigurations(client, installedApps, [+index, app]);
83
+ }
84
+ await fileHelper.writeFileSync(path.join(this.marketplaceAppPath, this.marketplaceAppConfig.fileName), installedApps);
85
+ log(this.config, chalk.green('All the marketplace apps have been exported successfully'), 'success');
86
+ }
87
+ else {
88
+ log(this.config, 'No marketplace apps found', 'success');
89
+ }
90
+ }
91
+ getAllStackSpecificApps(listOfApps = [], skip = 0) {
92
+ return this.httpClient
93
+ .get(`${this.developerHubBaseUrl}/installations?target_uids=${this.config.source_stack}&skip=${skip}`)
94
+ .then(async ({ data }) => {
95
+ const { data: apps, count } = data;
96
+ if (!this.nodeCrypto && _.find(apps, (app) => !_.isEmpty(app.configuration))) {
97
+ await this.createNodeCryptoInstance();
98
+ }
99
+ listOfApps.push(..._.map(apps, (app) => {
100
+ if (_.has(app, 'configuration')) {
101
+ app['configuration'] = this.nodeCrypto.encrypt(app.configuration || configuration);
102
+ }
103
+ return app;
104
+ }));
105
+ if (count - (skip + 50) > 0) {
106
+ return await this.getAllStackSpecificApps(listOfApps, skip + 50);
107
+ }
108
+ return listOfApps;
109
+ })
110
+ .catch((error) => {
111
+ log(this.config, `Failed to export marketplace-apps. ${formatError(error)}`, 'error');
112
+ });
113
+ }
114
+ async getAppConfigurations(sdkClient, installedApps, [index, appInstallation]) {
115
+ const appName = appInstallation.manifest.name;
116
+ log(this.config, `Exporting ${appName} app and it's config.`, 'success');
117
+ await sdkClient
118
+ .organization(this.config.org_uid)
119
+ .app(appInstallation.manifest.uid)
120
+ .installation(appInstallation.uid)
121
+ .installationData()
122
+ .then(async (result) => {
123
+ const { data, error } = result;
124
+ if (_.has(data, 'server_configuration')) {
125
+ if (!this.nodeCrypto && _.has(data, 'server_configuration')) {
126
+ await this.createNodeCryptoInstance();
127
+ }
128
+ if (!_.isEmpty(data.server_configuration)) {
129
+ installedApps[index]['server_configuration'] = this.nodeCrypto.encrypt(data.server_configuration);
130
+ log(this.config, `Exported ${appName} app and it's config.`, 'success');
131
+ }
132
+ else {
133
+ log(this.config, `Exported ${appName} app`, 'success');
134
+ }
135
+ }
136
+ else if (error) {
137
+ log(this.config, `Error on exporting ${appName} app and it's config.`, 'error');
138
+ }
139
+ })
140
+ .catch(err => {
141
+ log(this.config, `Failed to export ${appName} app config ${formatError(err)}`, 'error');
142
+ });
143
+ }
144
+ };
@@ -0,0 +1,18 @@
1
+ export = ExportStack;
2
+ declare class ExportStack {
3
+ constructor(exportConfig: any, stackAPIClient: any);
4
+ stackConfig: {
5
+ dirName: string;
6
+ fileName: string;
7
+ dependencies?: import("../../types").Modules[];
8
+ };
9
+ config: any;
10
+ stackAPIClient: any;
11
+ requestOption: {
12
+ uri: any;
13
+ headers: any;
14
+ json: boolean;
15
+ };
16
+ start(): Promise<any>;
17
+ getLocales(apiDetails: any): Promise<any>;
18
+ }
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Contentstack Export
3
+ * Copyright (c) 2019 Contentstack LLC
4
+ * MIT Licensed
5
+ */
6
+ const path = require('path');
7
+ const mkdirp = require('mkdirp');
8
+ const merge = require('lodash/merge');
9
+ const { default: config } = require('../../config');
10
+ const { managementSDKClient, isAuthenticated } = require('@contentstack/cli-utilities');
11
+ const { log, fileHelper, formatError } = require('../../utils');
12
+ class ExportStack {
13
+ constructor(exportConfig, stackAPIClient) {
14
+ this.stackConfig = config.modules.stack;
15
+ this.config = merge(config, exportConfig);
16
+ this.stackAPIClient = stackAPIClient;
17
+ this.requestOption = {
18
+ uri: this.config.host + this.config.apis.stacks,
19
+ headers: this.config.headers,
20
+ json: true,
21
+ };
22
+ }
23
+ async start() {
24
+ const self = this;
25
+ if (isAuthenticated()) {
26
+ const tempAPIClient = await managementSDKClient({ host: config.host });
27
+ const tempStackData = await tempAPIClient
28
+ .stack({ api_key: self.config.source_stack })
29
+ .fetch()
30
+ .catch((error) => {
31
+ });
32
+ if (tempStackData && tempStackData.org_uid) {
33
+ self.config.org_uid = tempStackData.org_uid;
34
+ self.config.sourceStackName = tempStackData.name;
35
+ }
36
+ }
37
+ if (!self.config.preserveStackVersion && !self.config.hasOwnProperty('master_locale')) {
38
+ const apiDetails = {
39
+ limit: 100,
40
+ skip: 0,
41
+ include_count: true,
42
+ };
43
+ return self.getLocales(apiDetails);
44
+ }
45
+ else if (self.config.preserveStackVersion) {
46
+ log(self.config, 'Exporting stack details', 'success');
47
+ let stackFolderPath = path.resolve(self.config.data, stackConfig.dirName);
48
+ let stackContentsFile = path.resolve(stackFolderPath, stackConfig.fileName);
49
+ mkdirp.sync(stackFolderPath);
50
+ return new Promise((resolve, reject) => {
51
+ return self.stackAPIClient
52
+ .fetch()
53
+ .then((response) => {
54
+ fileHelper.writeFile(stackContentsFile, response);
55
+ log(self.config, 'Exported stack details successfully!', 'success');
56
+ return resolve(response);
57
+ })
58
+ .catch(reject);
59
+ });
60
+ }
61
+ }
62
+ getLocales(apiDetails) {
63
+ const self = this;
64
+ return new Promise((resolve, reject) => {
65
+ const result = self.stackAPIClient.locale().query(apiDetails);
66
+ result
67
+ .find()
68
+ .then((response) => {
69
+ const masterLocalObj = response.items.find((obj) => {
70
+ if (obj.fallback_locale === null) {
71
+ return obj;
72
+ }
73
+ });
74
+ apiDetails.skip += apiDetails.limit;
75
+ if (masterLocalObj) {
76
+ return resolve(masterLocalObj);
77
+ }
78
+ else if (apiDetails.skip <= response.count) {
79
+ return resolve(self.getLocales(apiDetails));
80
+ }
81
+ else {
82
+ return reject('Master locale not found');
83
+ }
84
+ })
85
+ .catch((error) => {
86
+ return reject(error);
87
+ });
88
+ });
89
+ }
90
+ }
91
+ module.exports = ExportStack;
@@ -0,0 +1,18 @@
1
+ export = ExportWebhooks;
2
+ declare class ExportWebhooks {
3
+ constructor(exportConfig: any, stackAPIClient: any);
4
+ config: any;
5
+ master: {};
6
+ webhooks: {};
7
+ requestOptions: {
8
+ include_count: boolean;
9
+ asc: string;
10
+ };
11
+ webhooksConfig: {
12
+ dirName: string;
13
+ fileName: string;
14
+ dependencies?: import("../../types").Modules[];
15
+ };
16
+ stackAPIClient: any;
17
+ start(): Promise<any>;
18
+ }
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * Contentstack Export
3
+ * Copyright (c) 2019 Contentstack LLC
4
+ * MIT Licensed
5
+ */
6
+ const path = require('path');
7
+ const chalk = require('chalk');
8
+ const mkdirp = require('mkdirp');
9
+ const { merge } = require('lodash');
10
+ const { default: config } = require('../../config');
11
+ const { formatError, log, fileHelper } = require('../../utils');
12
+ // Create folder for environments
13
+ module.exports = class ExportWebhooks {
14
+ constructor(exportConfig, stackAPIClient) {
15
+ this.master = {};
16
+ this.webhooks = {};
17
+ this.requestOptions = {
18
+ include_count: true,
19
+ asc: 'updated_at',
20
+ };
21
+ this.webhooksConfig = config.modules.webhooks;
22
+ this.config = merge(config, exportConfig);
23
+ this.stackAPIClient = stackAPIClient;
24
+ }
25
+ start() {
26
+ log(this.config, 'Starting webhooks export', 'success');
27
+ const self = this;
28
+ const webhooksFolderPath = path.resolve(this.config.data, this.config.branchName || '', self.webhooksConfig.dirName);
29
+ mkdirp.sync(webhooksFolderPath);
30
+ return new Promise((resolve, reject) => {
31
+ self.stackAPIClient
32
+ .webhook()
33
+ .fetchAll(self.requestOptions)
34
+ .then((webhooks) => {
35
+ if (webhooks.items.length !== 0) {
36
+ for (let i = 0, total = webhooks.count; i < total; i++) {
37
+ const webUid = webhooks.items[i].uid;
38
+ self.master[webUid] = '';
39
+ self.webhooks[webUid] = webhooks.items[i];
40
+ delete self.webhooks[webUid].uid;
41
+ delete self.webhooks[webUid].SYS_ACL;
42
+ }
43
+ fileHelper.writeFileSync(path.join(webhooksFolderPath, self.webhooksConfig.fileName), self.webhooks);
44
+ log(self.config, chalk.green('All the webhooks have been exported successfully'), 'success');
45
+ return resolve();
46
+ }
47
+ log(self.config, 'No webhooks found', 'success');
48
+ resolve();
49
+ })
50
+ .catch(function (error) {
51
+ if (error.statusCode === 401) {
52
+ log(self.config, 'You are not allowed to export webhooks, Unless you provide email and password in config', 'error');
53
+ return resolve();
54
+ }
55
+ log(self.config, `Failed to export webhooks. ${formatError(error)}`, 'error');
56
+ reject('Failed to export webhooks');
57
+ });
58
+ });
59
+ }
60
+ };
@@ -0,0 +1,16 @@
1
+ export = ExportWorkFlows;
2
+ declare class ExportWorkFlows {
3
+ constructor(exportConfig: any, stackAPIClient: any);
4
+ config: any;
5
+ workflows: {};
6
+ workFlowConfig: {
7
+ dirName: string;
8
+ fileName: string;
9
+ invalidKeys: string[];
10
+ dependencies?: import("../../types").Modules[];
11
+ };
12
+ stackAPIClient: any;
13
+ start(): Promise<any>;
14
+ getWorkflowRoles(self: any, workflow: any): Promise<void>;
15
+ getWorkflowsData(self: any, workflows: any): Promise<void>;
16
+ }
@@ -0,0 +1,89 @@
1
+ /*!
2
+ * Contentstack Export
3
+ * Copyright (c) 2019 Contentstack LLC
4
+ * MIT Licensed
5
+ */
6
+ const path = require('path');
7
+ const chalk = require('chalk');
8
+ const mkdirp = require('mkdirp');
9
+ const { merge } = require('lodash');
10
+ const { formatError, log, fileHelper } = require('../../utils');
11
+ const { default: config } = require('../../config');
12
+ module.exports = class ExportWorkFlows {
13
+ constructor(exportConfig, stackAPIClient) {
14
+ this.workflows = {};
15
+ this.workFlowConfig = config.modules.workflows;
16
+ this.config = merge(config, exportConfig);
17
+ this.stackAPIClient = stackAPIClient;
18
+ }
19
+ start() {
20
+ log(this.config, 'Starting workflow export', 'success');
21
+ const self = this;
22
+ const workflowsFolderPath = path.resolve(this.config.data, this.config.branchName || '', this.workFlowConfig.dirName);
23
+ mkdirp.sync(workflowsFolderPath);
24
+ return new Promise(function (resolve, reject) {
25
+ return self.stackAPIClient
26
+ .workflow()
27
+ .fetchAll()
28
+ .then(async (response) => {
29
+ try {
30
+ if (response.items.length) {
31
+ await self.getWorkflowsData(self, response.items);
32
+ log(self.config, chalk.green('All the workflow have been exported successfully'), 'success');
33
+ }
34
+ if (!response.items.length) {
35
+ log(self.config, 'No workflow were found in the Stack', 'success');
36
+ }
37
+ fileHelper.writeFileSync(path.join(workflowsFolderPath, self.workFlowConfig.fileName), self.workflows);
38
+ resolve();
39
+ }
40
+ catch (error) {
41
+ log(self.config, formatError(error), 'error');
42
+ reject(error);
43
+ }
44
+ })
45
+ .catch(function (error) {
46
+ if (error.statusCode === 401) {
47
+ log(self.config, 'You are not allowed to export workflow, Unless you provide email and password in config', 'error');
48
+ return resolve();
49
+ }
50
+ log(self.config, formatError(error), 'error');
51
+ resolve();
52
+ });
53
+ });
54
+ }
55
+ async getWorkflowRoles(self, workflow) {
56
+ try {
57
+ for (const stage of workflow.workflow_stages) {
58
+ if (stage.SYS_ACL.roles.uids.length) {
59
+ for (let i = 0; i < stage.SYS_ACL.roles.uids.length; i++) {
60
+ const roleUid = stage.SYS_ACL.roles.uids[i];
61
+ const roleData = await self.stackAPIClient
62
+ .role(roleUid)
63
+ .fetch({ include_rules: true, include_permissions: true });
64
+ stage.SYS_ACL.roles.uids[i] = roleData;
65
+ }
66
+ }
67
+ }
68
+ }
69
+ catch (error) {
70
+ log(self.config, `Error fetching roles in export workflows task. ${formatError(error)}`, 'error');
71
+ throw new Error({ message: 'Error fetching roles in export workflows task.' });
72
+ }
73
+ }
74
+ async getWorkflowsData(self, workflows) {
75
+ try {
76
+ for (const workflow of workflows) {
77
+ log(self.config, workflow.name + ' workflow was exported successfully', 'success');
78
+ await self.getWorkflowRoles(self, workflow);
79
+ self.workflows[workflow.uid] = workflow;
80
+ const deleteItems = config.modules.workflows.invalidKeys;
81
+ deleteItems.forEach((e) => delete workflow[e]);
82
+ }
83
+ }
84
+ catch (error) {
85
+ log(self.config, `Error fetching workflow data in export workflows task. ${formatError(error)}`, 'error');
86
+ throw error;
87
+ }
88
+ }
89
+ };
@@ -0,0 +1,158 @@
1
+ import { Modules } from '.';
2
+ export default interface DefaultConfig {
3
+ versioning: boolean;
4
+ host: string;
5
+ cdn?: string;
6
+ developerHubUrls: any;
7
+ modules: {
8
+ types: Modules[];
9
+ locales: {
10
+ dirName: string;
11
+ fileName: string;
12
+ requiredKeys: string[];
13
+ dependencies?: Modules[];
14
+ };
15
+ customRoles: {
16
+ dirName: string;
17
+ fileName: string;
18
+ customRolesLocalesFileName: string;
19
+ dependencies?: Modules[];
20
+ };
21
+ 'custom-roles': {
22
+ dirName: string;
23
+ fileName: string;
24
+ customRolesLocalesFileName: string;
25
+ dependencies?: Modules[];
26
+ };
27
+ environments: {
28
+ dirName: string;
29
+ fileName: string;
30
+ dependencies?: Modules[];
31
+ };
32
+ labels: {
33
+ dirName: string;
34
+ fileName: string;
35
+ invalidKeys: string[];
36
+ dependencies?: Modules[];
37
+ };
38
+ webhooks: {
39
+ dirName: string;
40
+ fileName: string;
41
+ dependencies?: Modules[];
42
+ };
43
+ releases: {
44
+ dirName: string;
45
+ fileName: string;
46
+ releasesList: string;
47
+ invalidKeys: string[];
48
+ dependencies?: Modules[];
49
+ };
50
+ workflows: {
51
+ dirName: string;
52
+ fileName: string;
53
+ invalidKeys: string[];
54
+ dependencies?: Modules[];
55
+ };
56
+ globalfields: {
57
+ dirName: string;
58
+ fileName: string;
59
+ validKeys: string[];
60
+ dependencies?: Modules[];
61
+ };
62
+ 'global-fields': {
63
+ dirName: string;
64
+ fileName: string;
65
+ validKeys: string[];
66
+ dependencies?: Modules[];
67
+ };
68
+ assets: {
69
+ dirName: string;
70
+ fileName: string;
71
+ batchLimit: number;
72
+ host: string;
73
+ invalidKeys: string[];
74
+ chunkFileSize: number;
75
+ downloadLimit: number;
76
+ fetchConcurrency: number;
77
+ assetsMetaKeys: string[];
78
+ securedAssets: boolean;
79
+ displayExecutionTime: boolean;
80
+ enableDownloadStatus: boolean;
81
+ includeVersionedAssets: boolean;
82
+ dependencies?: Modules[];
83
+ };
84
+ content_types: {
85
+ dirName: string;
86
+ fileName: string;
87
+ validKeys: string[];
88
+ limit: number;
89
+ dependencies?: Modules[];
90
+ };
91
+ 'content-types': {
92
+ dirName: string;
93
+ fileName: string;
94
+ validKeys: string[];
95
+ limit: number;
96
+ dependencies?: Modules[];
97
+ };
98
+ entries: {
99
+ dirName: string;
100
+ fileName: string;
101
+ invalidKeys: string[];
102
+ batchLimit: number;
103
+ downloadLimit: number;
104
+ limit: number;
105
+ dependencies?: Modules[];
106
+ };
107
+ extensions: {
108
+ dirName: string;
109
+ fileName: string;
110
+ dependencies?: Modules[];
111
+ };
112
+ stack: {
113
+ dirName: string;
114
+ fileName: string;
115
+ dependencies?: Modules[];
116
+ };
117
+ dependency: {
118
+ entries: string[];
119
+ };
120
+ marketplace_apps: {
121
+ dirName: string;
122
+ fileName: string;
123
+ dependencies?: Modules[];
124
+ };
125
+ 'marketplace-apps': {
126
+ dirName: string;
127
+ fileName: string;
128
+ dependencies?: Modules[];
129
+ };
130
+ masterLocale: {
131
+ dirName: string;
132
+ fileName: string;
133
+ requiredKeys: string[];
134
+ };
135
+ };
136
+ languagesCode: string[];
137
+ updatedModules: string[];
138
+ apis: {
139
+ userSession: string;
140
+ globalfields: string;
141
+ locales: string;
142
+ labels: string;
143
+ environments: string;
144
+ assets: string;
145
+ content_types: string;
146
+ entries: string;
147
+ users: string;
148
+ extension: string;
149
+ webhooks: string;
150
+ stacks: string;
151
+ };
152
+ preserveStackVersion: boolean;
153
+ fetchConcurrency: number;
154
+ writeConcurrency: number;
155
+ developerHubBaseUrl: string;
156
+ marketplaceAppEncryptionKey: string;
157
+ useNewModuleStructure: boolean;
158
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ import { Modules } from '.';
2
+ import DefaultConfig from './default-config';
3
+ export default interface ExportConfig extends DefaultConfig {
4
+ exportDir: string;
5
+ data: string;
6
+ management_token?: string;
7
+ apiKey: string;
8
+ forceStopMarketplaceAppsPrompt: boolean;
9
+ auth_token?: string;
10
+ branchName?: string;
11
+ securedAssets?: boolean;
12
+ contentTypes?: string[];
13
+ branches?: branch[];
14
+ branchEnabled?: boolean;
15
+ branchDir?: string;
16
+ singleModuleExport?: boolean;
17
+ moduleName?: Modules;
18
+ master_locale: masterLocale;
19
+ headers?: {
20
+ api_key: string;
21
+ access_token?: string;
22
+ authtoken?: string;
23
+ 'X-User-Agent': string;
24
+ };
25
+ access_token?: string;
26
+ }
27
+ type branch = {
28
+ uid: string;
29
+ source: string;
30
+ };
31
+ type masterLocale = {
32
+ code: string;
33
+ };
34
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,45 @@
1
+ import { ContentstackClient } from '@contentstack/cli-utilities';
2
+ import ExportConfig from './export-config';
3
+ export interface AuthOptions {
4
+ contentstackClient: any;
5
+ }
6
+ export interface ContentStackManagementClient {
7
+ contentstackClient: object;
8
+ }
9
+ export interface PrintOptions {
10
+ color?: string;
11
+ }
12
+ export interface InquirePayload {
13
+ type: string;
14
+ name: string;
15
+ message: string;
16
+ choices?: Array<any>;
17
+ transformer?: Function;
18
+ }
19
+ export interface User {
20
+ email: string;
21
+ authtoken: string;
22
+ }
23
+ export type Modules = 'stack' | 'assets' | 'locales' | 'environments' | 'extensions' | 'webhooks' | 'global-fields' | 'entries' | 'content-types' | 'custom-roles' | 'workflows' | 'labels' | 'marketplace-apps';
24
+ export type ModuleClassParams = {
25
+ stackAPIClient: ReturnType<ContentstackClient['stack']>;
26
+ exportConfig: ExportConfig;
27
+ moduleName: Modules;
28
+ };
29
+ export interface ExternalConfig extends ExportConfig {
30
+ master_locale: {
31
+ name: string;
32
+ code: string;
33
+ };
34
+ source_stack?: string;
35
+ data: string;
36
+ branchName: string;
37
+ moduleName: Modules;
38
+ fetchConcurrency: number;
39
+ writeConcurrency: number;
40
+ securedAssets: boolean;
41
+ email?: string;
42
+ password?: string;
43
+ }
44
+ export { default as DefaultConfig } from './default-config';
45
+ export { default as ExportConfig } from './export-config';