@contentstack/cli-cm-import 1.5.11 → 1.7.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 +6 -14
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +6 -0
- package/bin/run.cmd +3 -0
- package/lib/commands/cm/stacks/import.d.ts +10 -0
- package/lib/commands/cm/stacks/import.js +111 -0
- package/lib/config/index.d.ts +3 -0
- package/lib/config/index.js +395 -0
- package/lib/import/index.d.ts +1 -0
- package/lib/import/index.js +8 -0
- package/lib/import/module-importer.d.ts +13 -0
- package/lib/import/module-importer.js +70 -0
- package/lib/import/modules/assets.d.ts +63 -0
- package/lib/import/modules/assets.js +265 -0
- package/lib/import/modules/base-class.d.ts +70 -0
- package/lib/import/modules/base-class.js +218 -0
- package/lib/import/modules/content-types.d.ts +56 -0
- package/lib/import/modules/content-types.js +186 -0
- package/lib/import/modules/custom-roles.d.ts +37 -0
- package/lib/import/modules/custom-roles.js +171 -0
- package/lib/import/modules/environments.d.ts +27 -0
- package/lib/import/modules/environments.js +106 -0
- package/lib/import/modules/extensions.d.ts +27 -0
- package/lib/import/modules/extensions.js +106 -0
- package/lib/import/modules/global-fields.d.ts +34 -0
- package/lib/import/modules/global-fields.js +99 -0
- package/lib/import/modules/index.d.ts +2 -0
- package/lib/import/modules/index.js +19 -0
- package/lib/import/modules/labels.d.ts +34 -0
- package/lib/import/modules/labels.js +171 -0
- package/lib/import/modules/locales.d.ts +31 -0
- package/lib/import/modules/locales.js +144 -0
- package/lib/import/modules/marketplace-apps.d.ts +51 -0
- package/lib/import/modules/marketplace-apps.js +297 -0
- package/lib/import/modules/webhooks.d.ts +27 -0
- package/lib/import/modules/webhooks.js +110 -0
- package/lib/import/modules-js/assets.d.ts +33 -0
- package/lib/import/modules-js/assets.js +415 -0
- package/lib/import/modules-js/content-types.d.ts +33 -0
- package/lib/import/modules-js/content-types.js +176 -0
- package/lib/import/modules-js/custom-roles.d.ts +15 -0
- package/lib/import/modules-js/custom-roles.js +143 -0
- package/lib/import/modules-js/entries.d.ts +54 -0
- package/lib/import/modules-js/entries.js +1260 -0
- package/lib/import/modules-js/environments.d.ts +13 -0
- package/lib/import/modules-js/environments.js +85 -0
- package/lib/import/modules-js/extensions.d.ts +18 -0
- package/lib/import/modules-js/extensions.js +86 -0
- package/lib/import/modules-js/global-fields.d.ts +13 -0
- package/lib/import/modules-js/global-fields.js +109 -0
- package/lib/import/modules-js/index.d.ts +1 -0
- package/lib/import/modules-js/index.js +33 -0
- package/lib/import/modules-js/labels.d.ts +20 -0
- package/lib/import/modules-js/labels.js +148 -0
- package/lib/import/modules-js/locales.d.ts +24 -0
- package/lib/import/modules-js/locales.js +196 -0
- package/lib/import/modules-js/marketplace-apps.d.ts +60 -0
- package/lib/import/modules-js/marketplace-apps.js +409 -0
- package/lib/import/modules-js/webhooks.d.ts +17 -0
- package/lib/import/modules-js/webhooks.js +85 -0
- package/lib/import/modules-js/workflows.d.ts +18 -0
- package/lib/import/modules-js/workflows.js +132 -0
- package/lib/types/default-config.d.ts +143 -0
- package/lib/types/default-config.js +2 -0
- package/lib/types/import-config.d.ts +52 -0
- package/lib/types/import-config.js +2 -0
- package/lib/types/index.d.ts +63 -0
- package/lib/types/index.js +4 -0
- package/lib/utils/asset-helper.d.ts +4 -0
- package/lib/utils/asset-helper.js +387 -0
- package/lib/utils/backup-handler.d.ts +2 -0
- package/lib/utils/backup-handler.js +31 -0
- package/lib/utils/common-helper.d.ts +20 -0
- package/lib/utils/common-helper.js +244 -0
- package/lib/utils/content-type-helper.d.ts +51 -0
- package/lib/utils/content-type-helper.js +145 -0
- package/lib/utils/entries-helper.d.ts +4 -0
- package/lib/utils/entries-helper.js +252 -0
- package/lib/utils/extension-helper.d.ts +5 -0
- package/lib/utils/extension-helper.js +84 -0
- package/lib/utils/file-helper.d.ts +14 -0
- package/lib/utils/file-helper.js +140 -0
- package/lib/utils/import-config-handler.d.ts +3 -0
- package/lib/utils/import-config-handler.js +73 -0
- package/lib/utils/index.d.ts +12 -0
- package/lib/utils/index.js +39 -0
- package/lib/utils/interactive.d.ts +7 -0
- package/lib/utils/interactive.js +88 -0
- package/lib/utils/logger.d.ts +8 -0
- package/lib/utils/logger.js +154 -0
- package/lib/utils/login-handler.d.ts +8 -0
- package/lib/utils/login-handler.js +53 -0
- package/lib/utils/marketplace-app-helper.d.ts +16 -0
- package/lib/utils/marketplace-app-helper.js +143 -0
- package/messages/index.json +1 -7
- package/oclif.manifest.json +2 -2
- package/package.json +46 -20
- package/src/app.js +0 -217
- package/src/commands/cm/stacks/import.js +0 -161
- package/src/config/default.js +0 -352
- package/src/lib/import/assets.js +0 -495
- package/src/lib/import/content-types.js +0 -201
- package/src/lib/import/custom-roles.js +0 -169
- package/src/lib/import/entries.js +0 -1495
- package/src/lib/import/environments.js +0 -106
- package/src/lib/import/extensions.js +0 -108
- package/src/lib/import/global-fields.js +0 -135
- package/src/lib/import/labels.js +0 -175
- package/src/lib/import/locales.js +0 -216
- package/src/lib/import/marketplace-apps.js +0 -542
- package/src/lib/import/webhooks.js +0 -113
- package/src/lib/import/workflows.js +0 -166
- package/src/lib/util/extensionsUidReplace.js +0 -67
- package/src/lib/util/fs.js +0 -124
- package/src/lib/util/import-flags.js +0 -187
- package/src/lib/util/index.js +0 -222
- package/src/lib/util/log.js +0 -144
- package/src/lib/util/login.js +0 -58
- package/src/lib/util/lookupReplaceAssets.js +0 -366
- package/src/lib/util/lookupReplaceEntries.js +0 -250
- package/src/lib/util/marketplace-app-helper.js +0 -31
- package/src/lib/util/removeReferenceFields.js +0 -59
- package/src/lib/util/schemaTemplate.js +0 -38
- package/src/lib/util/supress-mandatory-fields.js +0 -34
- package/src/lib/util/upload.js +0 -56
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.7.0 linux-x64 node-v18.17.0
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -63,7 +63,7 @@ USAGE
|
|
|
63
63
|
|
|
64
64
|
## `csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`
|
|
65
65
|
|
|
66
|
-
Import
|
|
66
|
+
Import content from a stack
|
|
67
67
|
|
|
68
68
|
```
|
|
69
69
|
USAGE
|
|
@@ -83,11 +83,7 @@ FLAGS
|
|
|
83
83
|
<options: disable|current>
|
|
84
84
|
|
|
85
85
|
DESCRIPTION
|
|
86
|
-
Import
|
|
87
|
-
...
|
|
88
|
-
Once you export content from the source stack, import it to your destination stack by using the cm:stacks:import
|
|
89
|
-
command.
|
|
90
|
-
|
|
86
|
+
Import content from a stack
|
|
91
87
|
|
|
92
88
|
ALIASES
|
|
93
89
|
$ csdx cm:import
|
|
@@ -112,7 +108,7 @@ EXAMPLES
|
|
|
112
108
|
|
|
113
109
|
## `csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`
|
|
114
110
|
|
|
115
|
-
Import
|
|
111
|
+
Import content from a stack
|
|
116
112
|
|
|
117
113
|
```
|
|
118
114
|
USAGE
|
|
@@ -132,11 +128,7 @@ FLAGS
|
|
|
132
128
|
<options: disable|current>
|
|
133
129
|
|
|
134
130
|
DESCRIPTION
|
|
135
|
-
Import
|
|
136
|
-
...
|
|
137
|
-
Once you export content from the source stack, import it to your destination stack by using the cm:stacks:import
|
|
138
|
-
command.
|
|
139
|
-
|
|
131
|
+
Import content from a stack
|
|
140
132
|
|
|
141
133
|
ALIASES
|
|
142
134
|
$ csdx cm:import
|
|
@@ -159,5 +151,5 @@ EXAMPLES
|
|
|
159
151
|
$ csdx cm:stacks:import --branch <branch name> --yes
|
|
160
152
|
```
|
|
161
153
|
|
|
162
|
-
_See code: [src/commands/cm/stacks/import.
|
|
154
|
+
_See code: [src/commands/cm/stacks/import.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-import/src/commands/cm/stacks/import.ts)_
|
|
163
155
|
<!-- commandsstop -->
|
package/bin/dev
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core');
|
|
4
|
+
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json');
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development';
|
|
10
|
+
|
|
11
|
+
require('ts-node').register({ project });
|
|
12
|
+
|
|
13
|
+
// In dev mode, always show stack traces
|
|
14
|
+
oclif.settings.debug = true;
|
|
15
|
+
|
|
16
|
+
// Start the CLI
|
|
17
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle);
|
package/bin/dev.cmd
ADDED
package/bin/run
ADDED
package/bin/run.cmd
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@contentstack/cli-command';
|
|
2
|
+
import { FlagInput } from '@contentstack/cli-utilities';
|
|
3
|
+
export default class ImportCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: FlagInput;
|
|
7
|
+
static aliases: string[];
|
|
8
|
+
static usage: string;
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
5
|
+
const cli_command_1 = require("@contentstack/cli-command");
|
|
6
|
+
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
7
|
+
const import_1 = require("../../../import");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
class ImportCommand extends cli_command_1.Command {
|
|
10
|
+
async run() {
|
|
11
|
+
// setup import config
|
|
12
|
+
// initialize the importer
|
|
13
|
+
// start import
|
|
14
|
+
let contentDir;
|
|
15
|
+
try {
|
|
16
|
+
const { flags } = await this.parse(ImportCommand);
|
|
17
|
+
let importConfig = await (0, utils_1.setupImportConfig)(flags);
|
|
18
|
+
// Note setting host to create cma client
|
|
19
|
+
importConfig.host = this.cmaHost;
|
|
20
|
+
contentDir = importConfig.contentDir;
|
|
21
|
+
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(importConfig);
|
|
22
|
+
const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
|
|
23
|
+
await moduleImporter.start();
|
|
24
|
+
(0, utils_1.log)(importConfig, `The content has been imported to the stack ${importConfig.apiKey} successfully!`, 'success');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
(0, utils_1.log)({ data: contentDir }, `Failed to import stack content - ${(0, utils_1.formatError)(error)}`, 'error');
|
|
28
|
+
(0, utils_1.log)({ data: contentDir }, `The log has been stored at ${{ data: contentDir } ? node_path_1.default.join(contentDir || __dirname, 'logs', 'import') : node_path_1.default.join(__dirname, 'logs')}`, 'info');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = ImportCommand;
|
|
33
|
+
ImportCommand.description = cli_utilities_1.messageHandler.parse('Import content from a stack');
|
|
34
|
+
ImportCommand.examples = [
|
|
35
|
+
`csdx cm:stacks:import --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>`,
|
|
36
|
+
`csdx cm:stacks:import --config <path/of/config/dir>`,
|
|
37
|
+
`csdx cm:stacks:import --module <single module name>`,
|
|
38
|
+
`csdx cm:stacks:import --module <single module name> --backup-dir <backup dir>`,
|
|
39
|
+
`csdx cm:stacks:import --alias <management_token_alias>`,
|
|
40
|
+
`csdx cm:stacks:import --alias <management_token_alias> --data-dir <path/of/export/destination/dir>`,
|
|
41
|
+
`csdx cm:stacks:import --alias <management_token_alias> --config <path/of/config/file>`,
|
|
42
|
+
`csdx cm:stacks:import --branch <branch name> --yes`,
|
|
43
|
+
];
|
|
44
|
+
ImportCommand.flags = {
|
|
45
|
+
config: cli_utilities_1.flags.string({
|
|
46
|
+
char: 'c',
|
|
47
|
+
description: '[optional] path of config file',
|
|
48
|
+
}),
|
|
49
|
+
'stack-uid': cli_utilities_1.flags.string({
|
|
50
|
+
char: 's',
|
|
51
|
+
description: 'API key of the target stack',
|
|
52
|
+
hidden: true,
|
|
53
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
|
|
54
|
+
}),
|
|
55
|
+
'stack-api-key': cli_utilities_1.flags.string({
|
|
56
|
+
char: 'k',
|
|
57
|
+
description: 'API key of the target stack',
|
|
58
|
+
}),
|
|
59
|
+
data: cli_utilities_1.flags.string({
|
|
60
|
+
description: 'path and location where data is stored',
|
|
61
|
+
hidden: true,
|
|
62
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['--data'], ['--data-dir']),
|
|
63
|
+
}),
|
|
64
|
+
'data-dir': cli_utilities_1.flags.string({
|
|
65
|
+
char: 'd',
|
|
66
|
+
description: 'path and location where data is stored',
|
|
67
|
+
}),
|
|
68
|
+
alias: cli_utilities_1.flags.string({
|
|
69
|
+
char: 'a',
|
|
70
|
+
description: 'alias of the management token',
|
|
71
|
+
}),
|
|
72
|
+
'management-token-alias': cli_utilities_1.flags.string({
|
|
73
|
+
description: 'alias of the management token',
|
|
74
|
+
hidden: true,
|
|
75
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['--management-token-alias'], ['-a', '--alias']),
|
|
76
|
+
}),
|
|
77
|
+
'auth-token': cli_utilities_1.flags.boolean({
|
|
78
|
+
char: 'A',
|
|
79
|
+
description: 'to use auth token',
|
|
80
|
+
hidden: true,
|
|
81
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['-A', '--auth-token']),
|
|
82
|
+
}),
|
|
83
|
+
module: cli_utilities_1.flags.string({
|
|
84
|
+
char: 'm',
|
|
85
|
+
description: '[optional] specific module name',
|
|
86
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['-m'], ['--module']),
|
|
87
|
+
}),
|
|
88
|
+
'backup-dir': cli_utilities_1.flags.string({
|
|
89
|
+
char: 'b',
|
|
90
|
+
description: '[optional] backup directory name when using specific module',
|
|
91
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['-b'], ['--backup-dir']),
|
|
92
|
+
}),
|
|
93
|
+
branch: cli_utilities_1.flags.string({
|
|
94
|
+
char: 'B',
|
|
95
|
+
description: '[optional] branch name',
|
|
96
|
+
parse: (0, cli_utilities_1.printFlagDeprecation)(['-B'], ['--branch']),
|
|
97
|
+
}),
|
|
98
|
+
'import-webhook-status': cli_utilities_1.flags.string({
|
|
99
|
+
description: '[optional] Webhook state',
|
|
100
|
+
options: ['disable', 'current'],
|
|
101
|
+
required: false,
|
|
102
|
+
default: 'disable',
|
|
103
|
+
}),
|
|
104
|
+
yes: cli_utilities_1.flags.boolean({
|
|
105
|
+
char: 'y',
|
|
106
|
+
required: false,
|
|
107
|
+
description: '[optional] Override marketplace prompts',
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
ImportCommand.aliases = ['cm:import'];
|
|
111
|
+
ImportCommand.usage = 'cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]';
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config = {
|
|
4
|
+
versioning: false,
|
|
5
|
+
// use below hosts for eu region
|
|
6
|
+
// host:'https://eu-api.contentstack.com/v3',
|
|
7
|
+
// use below hosts for azure-na region
|
|
8
|
+
// host:'https://azure-na-api.contentstack.com/v3',
|
|
9
|
+
// use below hosts for azure-eu region
|
|
10
|
+
// host:'https://azure-eu-api.contentstack.com/v3',
|
|
11
|
+
// pass locale, only to migrate entries from that locale
|
|
12
|
+
// not passing `locale` will migrate all the locales present
|
|
13
|
+
// locales: ['fr-fr'],
|
|
14
|
+
host: 'https://api.contentstack.io/v3',
|
|
15
|
+
extensionHost: 'https://app.contentstack.com',
|
|
16
|
+
developerHubUrls: {
|
|
17
|
+
'https://api.contentstack.io': 'https://developerhub-api.contentstack.com',
|
|
18
|
+
'https://eu-api.contentstack.com': 'https://eu-developerhub-api.contentstack.com',
|
|
19
|
+
'https://azure-na-api.contentstack.com': 'https://azure-na-developerhub-api.contentstack.com',
|
|
20
|
+
'https://azure-eu-api.contentstack.com': 'https://azure-eu-developerhub-api.contentstack.com',
|
|
21
|
+
'https://stag-api.csnonprod.com': 'https://stag-developerhub-api.csnonprod.com',
|
|
22
|
+
},
|
|
23
|
+
modules: {
|
|
24
|
+
apiConcurrency: 5,
|
|
25
|
+
types: [
|
|
26
|
+
'locales',
|
|
27
|
+
'environments',
|
|
28
|
+
'assets',
|
|
29
|
+
'extensions',
|
|
30
|
+
'marketplace-apps',
|
|
31
|
+
'global-fields',
|
|
32
|
+
'content-types',
|
|
33
|
+
'custom-roles',
|
|
34
|
+
'workflows',
|
|
35
|
+
'entries',
|
|
36
|
+
'labels',
|
|
37
|
+
'webhooks',
|
|
38
|
+
],
|
|
39
|
+
locales: {
|
|
40
|
+
dirName: 'locales',
|
|
41
|
+
fileName: 'locales.json',
|
|
42
|
+
requiredKeys: ['code', 'uid', 'name', 'fallback_locale'],
|
|
43
|
+
},
|
|
44
|
+
masterLocale: {
|
|
45
|
+
dirName: 'locales',
|
|
46
|
+
fileName: 'master-locale.json',
|
|
47
|
+
requiredKeys: ['code', 'uid', 'name'],
|
|
48
|
+
},
|
|
49
|
+
customRoles: {
|
|
50
|
+
dirName: 'custom-roles',
|
|
51
|
+
fileName: 'custom-roles.json',
|
|
52
|
+
customRolesLocalesFileName: 'custom-roles-locales.json',
|
|
53
|
+
},
|
|
54
|
+
environments: {
|
|
55
|
+
dirName: 'environments',
|
|
56
|
+
fileName: 'environments.json',
|
|
57
|
+
},
|
|
58
|
+
labels: {
|
|
59
|
+
dirName: 'labels',
|
|
60
|
+
fileName: 'labels.json',
|
|
61
|
+
},
|
|
62
|
+
extensions: {
|
|
63
|
+
dirName: 'extensions',
|
|
64
|
+
fileName: 'extensions.json',
|
|
65
|
+
validKeys: ['data_type', 'srcdoc', 'title', 'type', 'mutiple', 'config'],
|
|
66
|
+
},
|
|
67
|
+
webhooks: {
|
|
68
|
+
dirName: 'webhooks',
|
|
69
|
+
fileName: 'webhooks.json',
|
|
70
|
+
},
|
|
71
|
+
releases: {
|
|
72
|
+
dirName: 'releases',
|
|
73
|
+
fileName: 'releases.json',
|
|
74
|
+
invalidKeys: ['stackHeaders', 'urlPath', 'created_at', 'updated_at', 'created_by', 'updated_by'],
|
|
75
|
+
},
|
|
76
|
+
workflows: {
|
|
77
|
+
dirName: 'workflows',
|
|
78
|
+
fileName: 'workflows.json',
|
|
79
|
+
invalidKeys: ['stackHeaders', 'urlPath', 'created_at', 'updated_at', 'created_by', 'updated_by'],
|
|
80
|
+
},
|
|
81
|
+
assets: {
|
|
82
|
+
dirName: 'assets',
|
|
83
|
+
assetBatchLimit: 1,
|
|
84
|
+
publishAssets: true,
|
|
85
|
+
fileName: 'assets.json',
|
|
86
|
+
importSameStructure: true,
|
|
87
|
+
uploadAssetsConcurrency: 10,
|
|
88
|
+
displayExecutionTime: false,
|
|
89
|
+
importFoldersConcurrency: 10,
|
|
90
|
+
includeVersionedAssets: false,
|
|
91
|
+
host: 'https://api.contentstack.io',
|
|
92
|
+
folderValidKeys: ['name', 'parent_uid'],
|
|
93
|
+
validKeys: ['title', 'parent_uid', 'description', 'tags'],
|
|
94
|
+
},
|
|
95
|
+
'assets-old': {
|
|
96
|
+
dirName: 'assets',
|
|
97
|
+
fileName: 'assets.json',
|
|
98
|
+
// This is the total no. of asset objects fetched in each 'get assets' call
|
|
99
|
+
limit: 100,
|
|
100
|
+
host: 'https://api.contentstack.io',
|
|
101
|
+
validKeys: ['uid', 'filename', 'url', 'status'],
|
|
102
|
+
assetBatchLimit: 1,
|
|
103
|
+
uploadAssetsConcurrency: 1,
|
|
104
|
+
importFoldersConcurrency: 1,
|
|
105
|
+
},
|
|
106
|
+
content_types: {
|
|
107
|
+
dirName: 'content_types',
|
|
108
|
+
fileName: 'content_types.json',
|
|
109
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
110
|
+
limit: 100,
|
|
111
|
+
},
|
|
112
|
+
'content-types': {
|
|
113
|
+
dirName: 'content_types',
|
|
114
|
+
fileName: 'content_types.json',
|
|
115
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
116
|
+
limit: 100,
|
|
117
|
+
},
|
|
118
|
+
entries: {
|
|
119
|
+
dirName: 'entries',
|
|
120
|
+
fileName: 'entries.json',
|
|
121
|
+
invalidKeys: ['created_at', 'updated_at', 'created_by', 'updated_by', '_metadata', 'published'],
|
|
122
|
+
limit: 50,
|
|
123
|
+
assetBatchLimit: 5,
|
|
124
|
+
},
|
|
125
|
+
globalfields: {
|
|
126
|
+
dirName: 'global_fields',
|
|
127
|
+
fileName: 'globalfields.json',
|
|
128
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
129
|
+
limit: 100,
|
|
130
|
+
},
|
|
131
|
+
'global-fields': {
|
|
132
|
+
dirName: 'global_fields',
|
|
133
|
+
fileName: 'globalfields.json',
|
|
134
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
135
|
+
limit: 100,
|
|
136
|
+
},
|
|
137
|
+
stack: {
|
|
138
|
+
dirName: 'stack',
|
|
139
|
+
fileName: 'stack.json',
|
|
140
|
+
},
|
|
141
|
+
marketplace_apps: {
|
|
142
|
+
dirName: 'marketplace_apps',
|
|
143
|
+
fileName: 'marketplace_apps.json',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
languagesCode: [
|
|
147
|
+
'af-za',
|
|
148
|
+
'sq-al',
|
|
149
|
+
'ar',
|
|
150
|
+
'ar-dz',
|
|
151
|
+
'ar-bh',
|
|
152
|
+
'ar-eg',
|
|
153
|
+
'ar-iq',
|
|
154
|
+
'ar-jo',
|
|
155
|
+
'ar-kw',
|
|
156
|
+
'ar-lb',
|
|
157
|
+
'ar-ly',
|
|
158
|
+
'ar-ma',
|
|
159
|
+
'ar-om',
|
|
160
|
+
'ar-qa',
|
|
161
|
+
'ar-sa',
|
|
162
|
+
'ar-sy',
|
|
163
|
+
'ar-tn',
|
|
164
|
+
'ar-ae',
|
|
165
|
+
'ar-ye',
|
|
166
|
+
'hy-am',
|
|
167
|
+
'az',
|
|
168
|
+
'cy-az-az',
|
|
169
|
+
'lt-az-az',
|
|
170
|
+
'eu-es',
|
|
171
|
+
'be-by',
|
|
172
|
+
'bs',
|
|
173
|
+
'bg-bg',
|
|
174
|
+
'ca-es',
|
|
175
|
+
'zh',
|
|
176
|
+
'zh-au',
|
|
177
|
+
'zh-cn',
|
|
178
|
+
'zh-hk',
|
|
179
|
+
'zh-mo',
|
|
180
|
+
'zh-my',
|
|
181
|
+
'zh-sg',
|
|
182
|
+
'zh-tw',
|
|
183
|
+
'zh-chs',
|
|
184
|
+
'zh-cht',
|
|
185
|
+
'hr-hr',
|
|
186
|
+
'cs',
|
|
187
|
+
'cs-cz',
|
|
188
|
+
'da-dk',
|
|
189
|
+
'div-mv',
|
|
190
|
+
'nl',
|
|
191
|
+
'nl-be',
|
|
192
|
+
'nl-nl',
|
|
193
|
+
'en',
|
|
194
|
+
'en-au',
|
|
195
|
+
'en-at',
|
|
196
|
+
'en-be',
|
|
197
|
+
'en-bz',
|
|
198
|
+
'en-ca',
|
|
199
|
+
'en-cb',
|
|
200
|
+
'en-cn',
|
|
201
|
+
'en-cz',
|
|
202
|
+
'en-dk',
|
|
203
|
+
'en-do',
|
|
204
|
+
'en-ee',
|
|
205
|
+
'en-fi',
|
|
206
|
+
'en-fr',
|
|
207
|
+
'en-de',
|
|
208
|
+
'en-gr',
|
|
209
|
+
'en-hk',
|
|
210
|
+
'en-hu',
|
|
211
|
+
'en-in',
|
|
212
|
+
'en-id',
|
|
213
|
+
'en-ie',
|
|
214
|
+
'en-it',
|
|
215
|
+
'en-jm',
|
|
216
|
+
'en-jp',
|
|
217
|
+
'en-kr',
|
|
218
|
+
'en-lv',
|
|
219
|
+
'en-lt',
|
|
220
|
+
'en-lu',
|
|
221
|
+
'en-my',
|
|
222
|
+
'en-mx',
|
|
223
|
+
'en-nz',
|
|
224
|
+
'en-no',
|
|
225
|
+
'en-ph',
|
|
226
|
+
'en-pl',
|
|
227
|
+
'en-pt',
|
|
228
|
+
'en-pr',
|
|
229
|
+
'en-ru',
|
|
230
|
+
'en-sg',
|
|
231
|
+
'en-sk',
|
|
232
|
+
'en-si',
|
|
233
|
+
'en-za',
|
|
234
|
+
'en-es',
|
|
235
|
+
'en-se',
|
|
236
|
+
'en-ch',
|
|
237
|
+
'en-th',
|
|
238
|
+
'en-nl',
|
|
239
|
+
'en-tt',
|
|
240
|
+
'en-gb',
|
|
241
|
+
'en-us',
|
|
242
|
+
'en-zw',
|
|
243
|
+
'et-ee',
|
|
244
|
+
'fo-fo',
|
|
245
|
+
'fa-ir',
|
|
246
|
+
'fi',
|
|
247
|
+
'fi-fi',
|
|
248
|
+
'fr',
|
|
249
|
+
'fr-be',
|
|
250
|
+
'fr-ca',
|
|
251
|
+
'fr-fr',
|
|
252
|
+
'fr-lu',
|
|
253
|
+
'fr-mc',
|
|
254
|
+
'fr-ch',
|
|
255
|
+
'fr-us',
|
|
256
|
+
'gd',
|
|
257
|
+
'gl-es',
|
|
258
|
+
'ka-ge',
|
|
259
|
+
'de',
|
|
260
|
+
'de-at',
|
|
261
|
+
'de-de',
|
|
262
|
+
'de-li',
|
|
263
|
+
'de-lu',
|
|
264
|
+
'de-ch',
|
|
265
|
+
'el-gr',
|
|
266
|
+
'gu-in',
|
|
267
|
+
'he-il',
|
|
268
|
+
'hi-in',
|
|
269
|
+
'hu-hu',
|
|
270
|
+
'is-is',
|
|
271
|
+
'id-id',
|
|
272
|
+
'it',
|
|
273
|
+
'it-it',
|
|
274
|
+
'it-ch',
|
|
275
|
+
'ja',
|
|
276
|
+
'ja-jp',
|
|
277
|
+
'kn-in',
|
|
278
|
+
'kk-kz',
|
|
279
|
+
'km-kh',
|
|
280
|
+
'kok-in',
|
|
281
|
+
'ko',
|
|
282
|
+
'ko-kr',
|
|
283
|
+
'ky-kz',
|
|
284
|
+
'lv-lv',
|
|
285
|
+
'lt-lt',
|
|
286
|
+
'mk-mk',
|
|
287
|
+
'ms',
|
|
288
|
+
'ms-bn',
|
|
289
|
+
'ms-my',
|
|
290
|
+
'ms-sg',
|
|
291
|
+
'mt',
|
|
292
|
+
'mr-in',
|
|
293
|
+
'mn-mn',
|
|
294
|
+
'no',
|
|
295
|
+
'no-no',
|
|
296
|
+
'nb-no',
|
|
297
|
+
'nn-no',
|
|
298
|
+
'pl-pl',
|
|
299
|
+
'pt',
|
|
300
|
+
'pt-br',
|
|
301
|
+
'pt-pt',
|
|
302
|
+
'pa-in',
|
|
303
|
+
'ro-ro',
|
|
304
|
+
'ru',
|
|
305
|
+
'ru-kz',
|
|
306
|
+
'ru-ru',
|
|
307
|
+
'ru-ua',
|
|
308
|
+
'sa-in',
|
|
309
|
+
'cy-sr-sp',
|
|
310
|
+
'lt-sr-sp',
|
|
311
|
+
'sr-me',
|
|
312
|
+
'sk-sk',
|
|
313
|
+
'sl-si',
|
|
314
|
+
'es',
|
|
315
|
+
'es-ar',
|
|
316
|
+
'es-bo',
|
|
317
|
+
'es-cl',
|
|
318
|
+
'es-co',
|
|
319
|
+
'es-cr',
|
|
320
|
+
'es-do',
|
|
321
|
+
'es-ec',
|
|
322
|
+
'es-sv',
|
|
323
|
+
'es-gt',
|
|
324
|
+
'es-hn',
|
|
325
|
+
'es-419',
|
|
326
|
+
'es-mx',
|
|
327
|
+
'es-ni',
|
|
328
|
+
'es-pa',
|
|
329
|
+
'es-py',
|
|
330
|
+
'es-pe',
|
|
331
|
+
'es-pr',
|
|
332
|
+
'es-es',
|
|
333
|
+
'es-us',
|
|
334
|
+
'es-uy',
|
|
335
|
+
'es-ve',
|
|
336
|
+
'sw-ke',
|
|
337
|
+
'sv',
|
|
338
|
+
'sv-fi',
|
|
339
|
+
'sv-se',
|
|
340
|
+
'syr-sy',
|
|
341
|
+
'tl',
|
|
342
|
+
'ta-in',
|
|
343
|
+
'tt-ru',
|
|
344
|
+
'te-in',
|
|
345
|
+
'th-th',
|
|
346
|
+
'tr-tr',
|
|
347
|
+
'uk-ua',
|
|
348
|
+
'ur-pk',
|
|
349
|
+
'uz',
|
|
350
|
+
'cy-uz-uz',
|
|
351
|
+
'lt-uz-uz',
|
|
352
|
+
'vi-vn',
|
|
353
|
+
'xh',
|
|
354
|
+
'zu',
|
|
355
|
+
],
|
|
356
|
+
apis: {
|
|
357
|
+
userSession: '/user-session/',
|
|
358
|
+
locales: '/locales/',
|
|
359
|
+
environments: '/environments/',
|
|
360
|
+
assets: '/assets/',
|
|
361
|
+
content_types: '/content_types/',
|
|
362
|
+
entries: '/entries/',
|
|
363
|
+
extensions: '/extensions/',
|
|
364
|
+
webhooks: '/webhooks/',
|
|
365
|
+
globalfields: '/global_fields/',
|
|
366
|
+
folders: '/folders/',
|
|
367
|
+
stacks: '/stacks/',
|
|
368
|
+
labels: '/labels/',
|
|
369
|
+
},
|
|
370
|
+
updatedModules: [
|
|
371
|
+
'assets',
|
|
372
|
+
'extensions',
|
|
373
|
+
'locales',
|
|
374
|
+
'marketplace-apps',
|
|
375
|
+
'labels',
|
|
376
|
+
'global-fields',
|
|
377
|
+
'content-types',
|
|
378
|
+
'webhooks',
|
|
379
|
+
'custom-roles',
|
|
380
|
+
],
|
|
381
|
+
rateLimit: 5,
|
|
382
|
+
preserveStackVersion: false,
|
|
383
|
+
entriesPublish: true,
|
|
384
|
+
concurrency: 1,
|
|
385
|
+
importConcurrency: 5,
|
|
386
|
+
fetchConcurrency: 5,
|
|
387
|
+
writeConcurrency: 5,
|
|
388
|
+
developerHubBaseUrl: '',
|
|
389
|
+
marketplaceAppEncryptionKey: 'nF2ejRQcTv',
|
|
390
|
+
getEncryptionKeyMaxRetry: 3,
|
|
391
|
+
useNewModuleStructure: false,
|
|
392
|
+
// useBackedupDir: '',
|
|
393
|
+
// backupConcurrency: 10,
|
|
394
|
+
};
|
|
395
|
+
exports.default = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ModuleImporter } from './module-importer';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ModuleImporter = void 0;
|
|
7
|
+
var module_importer_1 = require("./module-importer");
|
|
8
|
+
Object.defineProperty(exports, "ModuleImporter", { enumerable: true, get: function () { return __importDefault(module_importer_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContentstackClient } from '@contentstack/cli-utilities';
|
|
2
|
+
import { ImportConfig, Modules } from '../types';
|
|
3
|
+
declare class ModuleImporter {
|
|
4
|
+
private managementAPIClient;
|
|
5
|
+
private importConfig;
|
|
6
|
+
private stackAPIClient;
|
|
7
|
+
constructor(managementAPIClient: ContentstackClient, importConfig: ImportConfig);
|
|
8
|
+
start(): Promise<any>;
|
|
9
|
+
import(): Promise<any>;
|
|
10
|
+
importByModuleByName(moduleName: Modules): Promise<any>;
|
|
11
|
+
importAllModules(): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
export default ModuleImporter;
|