@contentstack/cli-cm-import 1.5.10 → 1.6.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 +372 -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 +69 -0
- package/lib/import/modules/base-class.js +165 -0
- package/lib/import/modules/index.d.ts +2 -0
- package/lib/import/modules/index.js +19 -0
- package/lib/import/modules/locales.d.ts +31 -0
- package/lib/import/modules/locales.js +152 -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 +141 -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 +17 -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 +130 -0
- package/lib/types/default-config.js +2 -0
- package/lib/types/import-config.d.ts +51 -0
- package/lib/types/import-config.js +2 -0
- package/lib/types/index.d.ts +30 -0
- package/lib/types/index.js +2 -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 +49 -0
- package/lib/utils/content-type-helper.js +143 -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 +10 -0
- package/lib/utils/extension-helper.js +72 -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 +29 -0
- package/lib/utils/interactive.d.ts +2 -0
- package/lib/utils/interactive.js +23 -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 +4 -0
- package/lib/utils/marketplace-app-helper.js +31 -0
- package/messages/index.json +1 -7
- package/oclif.manifest.json +2 -2
- package/package.json +47 -21
- 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 -1480
- 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.6.0 linux-x64 node-v18.16.1
|
|
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, '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,372 @@
|
|
|
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
|
+
},
|
|
66
|
+
webhooks: {
|
|
67
|
+
dirName: 'webhooks',
|
|
68
|
+
fileName: 'webhooks.json',
|
|
69
|
+
},
|
|
70
|
+
releases: {
|
|
71
|
+
dirName: 'releases',
|
|
72
|
+
fileName: 'releases.json',
|
|
73
|
+
invalidKeys: ['stackHeaders', 'urlPath', 'created_at', 'updated_at', 'created_by', 'updated_by'],
|
|
74
|
+
},
|
|
75
|
+
workflows: {
|
|
76
|
+
dirName: 'workflows',
|
|
77
|
+
fileName: 'workflows.json',
|
|
78
|
+
invalidKeys: ['stackHeaders', 'urlPath', 'created_at', 'updated_at', 'created_by', 'updated_by'],
|
|
79
|
+
},
|
|
80
|
+
assets: {
|
|
81
|
+
dirName: 'assets',
|
|
82
|
+
assetBatchLimit: 1,
|
|
83
|
+
publishAssets: true,
|
|
84
|
+
fileName: 'assets.json',
|
|
85
|
+
importSameStructure: true,
|
|
86
|
+
uploadAssetsConcurrency: 10,
|
|
87
|
+
displayExecutionTime: false,
|
|
88
|
+
importFoldersConcurrency: 10,
|
|
89
|
+
includeVersionedAssets: false,
|
|
90
|
+
host: 'https://api.contentstack.io',
|
|
91
|
+
folderValidKeys: ['name', 'parent_uid'],
|
|
92
|
+
validKeys: ['title', 'parent_uid', 'description', 'tags'],
|
|
93
|
+
},
|
|
94
|
+
'assets-old': {
|
|
95
|
+
dirName: 'assets',
|
|
96
|
+
fileName: 'assets.json',
|
|
97
|
+
// This is the total no. of asset objects fetched in each 'get assets' call
|
|
98
|
+
limit: 100,
|
|
99
|
+
host: 'https://api.contentstack.io',
|
|
100
|
+
validKeys: ['uid', 'filename', 'url', 'status'],
|
|
101
|
+
assetBatchLimit: 1,
|
|
102
|
+
uploadAssetsConcurrency: 1,
|
|
103
|
+
importFoldersConcurrency: 1,
|
|
104
|
+
},
|
|
105
|
+
content_types: {
|
|
106
|
+
dirName: 'content_types',
|
|
107
|
+
fileName: 'content_types.json',
|
|
108
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
109
|
+
limit: 100,
|
|
110
|
+
},
|
|
111
|
+
entries: {
|
|
112
|
+
dirName: 'entries',
|
|
113
|
+
fileName: 'entries.json',
|
|
114
|
+
invalidKeys: ['created_at', 'updated_at', 'created_by', 'updated_by', '_metadata', 'published'],
|
|
115
|
+
limit: 50,
|
|
116
|
+
assetBatchLimit: 5,
|
|
117
|
+
},
|
|
118
|
+
globalfields: {
|
|
119
|
+
dirName: 'global_fields',
|
|
120
|
+
fileName: 'globalfields.json',
|
|
121
|
+
validKeys: ['title', 'uid', 'schema', 'options', 'singleton', 'description'],
|
|
122
|
+
limit: 100,
|
|
123
|
+
},
|
|
124
|
+
stack: {
|
|
125
|
+
dirName: 'stack',
|
|
126
|
+
fileName: 'stack.json',
|
|
127
|
+
},
|
|
128
|
+
marketplace_apps: {
|
|
129
|
+
dirName: 'marketplace_apps',
|
|
130
|
+
fileName: 'marketplace_apps.json',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
languagesCode: [
|
|
134
|
+
'af-za',
|
|
135
|
+
'sq-al',
|
|
136
|
+
'ar',
|
|
137
|
+
'ar-dz',
|
|
138
|
+
'ar-bh',
|
|
139
|
+
'ar-eg',
|
|
140
|
+
'ar-iq',
|
|
141
|
+
'ar-jo',
|
|
142
|
+
'ar-kw',
|
|
143
|
+
'ar-lb',
|
|
144
|
+
'ar-ly',
|
|
145
|
+
'ar-ma',
|
|
146
|
+
'ar-om',
|
|
147
|
+
'ar-qa',
|
|
148
|
+
'ar-sa',
|
|
149
|
+
'ar-sy',
|
|
150
|
+
'ar-tn',
|
|
151
|
+
'ar-ae',
|
|
152
|
+
'ar-ye',
|
|
153
|
+
'hy-am',
|
|
154
|
+
'az',
|
|
155
|
+
'cy-az-az',
|
|
156
|
+
'lt-az-az',
|
|
157
|
+
'eu-es',
|
|
158
|
+
'be-by',
|
|
159
|
+
'bs',
|
|
160
|
+
'bg-bg',
|
|
161
|
+
'ca-es',
|
|
162
|
+
'zh',
|
|
163
|
+
'zh-au',
|
|
164
|
+
'zh-cn',
|
|
165
|
+
'zh-hk',
|
|
166
|
+
'zh-mo',
|
|
167
|
+
'zh-my',
|
|
168
|
+
'zh-sg',
|
|
169
|
+
'zh-tw',
|
|
170
|
+
'zh-chs',
|
|
171
|
+
'zh-cht',
|
|
172
|
+
'hr-hr',
|
|
173
|
+
'cs',
|
|
174
|
+
'cs-cz',
|
|
175
|
+
'da-dk',
|
|
176
|
+
'div-mv',
|
|
177
|
+
'nl',
|
|
178
|
+
'nl-be',
|
|
179
|
+
'nl-nl',
|
|
180
|
+
'en',
|
|
181
|
+
'en-au',
|
|
182
|
+
'en-at',
|
|
183
|
+
'en-be',
|
|
184
|
+
'en-bz',
|
|
185
|
+
'en-ca',
|
|
186
|
+
'en-cb',
|
|
187
|
+
'en-cn',
|
|
188
|
+
'en-cz',
|
|
189
|
+
'en-dk',
|
|
190
|
+
'en-do',
|
|
191
|
+
'en-ee',
|
|
192
|
+
'en-fi',
|
|
193
|
+
'en-fr',
|
|
194
|
+
'en-de',
|
|
195
|
+
'en-gr',
|
|
196
|
+
'en-hk',
|
|
197
|
+
'en-hu',
|
|
198
|
+
'en-in',
|
|
199
|
+
'en-id',
|
|
200
|
+
'en-ie',
|
|
201
|
+
'en-it',
|
|
202
|
+
'en-jm',
|
|
203
|
+
'en-jp',
|
|
204
|
+
'en-kr',
|
|
205
|
+
'en-lv',
|
|
206
|
+
'en-lt',
|
|
207
|
+
'en-lu',
|
|
208
|
+
'en-my',
|
|
209
|
+
'en-mx',
|
|
210
|
+
'en-nz',
|
|
211
|
+
'en-no',
|
|
212
|
+
'en-ph',
|
|
213
|
+
'en-pl',
|
|
214
|
+
'en-pt',
|
|
215
|
+
'en-pr',
|
|
216
|
+
'en-ru',
|
|
217
|
+
'en-sg',
|
|
218
|
+
'en-sk',
|
|
219
|
+
'en-si',
|
|
220
|
+
'en-za',
|
|
221
|
+
'en-es',
|
|
222
|
+
'en-se',
|
|
223
|
+
'en-ch',
|
|
224
|
+
'en-th',
|
|
225
|
+
'en-nl',
|
|
226
|
+
'en-tt',
|
|
227
|
+
'en-gb',
|
|
228
|
+
'en-us',
|
|
229
|
+
'en-zw',
|
|
230
|
+
'et-ee',
|
|
231
|
+
'fo-fo',
|
|
232
|
+
'fa-ir',
|
|
233
|
+
'fi',
|
|
234
|
+
'fi-fi',
|
|
235
|
+
'fr',
|
|
236
|
+
'fr-be',
|
|
237
|
+
'fr-ca',
|
|
238
|
+
'fr-fr',
|
|
239
|
+
'fr-lu',
|
|
240
|
+
'fr-mc',
|
|
241
|
+
'fr-ch',
|
|
242
|
+
'fr-us',
|
|
243
|
+
'gd',
|
|
244
|
+
'gl-es',
|
|
245
|
+
'ka-ge',
|
|
246
|
+
'de',
|
|
247
|
+
'de-at',
|
|
248
|
+
'de-de',
|
|
249
|
+
'de-li',
|
|
250
|
+
'de-lu',
|
|
251
|
+
'de-ch',
|
|
252
|
+
'el-gr',
|
|
253
|
+
'gu-in',
|
|
254
|
+
'he-il',
|
|
255
|
+
'hi-in',
|
|
256
|
+
'hu-hu',
|
|
257
|
+
'is-is',
|
|
258
|
+
'id-id',
|
|
259
|
+
'it',
|
|
260
|
+
'it-it',
|
|
261
|
+
'it-ch',
|
|
262
|
+
'ja',
|
|
263
|
+
'ja-jp',
|
|
264
|
+
'kn-in',
|
|
265
|
+
'kk-kz',
|
|
266
|
+
'km-kh',
|
|
267
|
+
'kok-in',
|
|
268
|
+
'ko',
|
|
269
|
+
'ko-kr',
|
|
270
|
+
'ky-kz',
|
|
271
|
+
'lv-lv',
|
|
272
|
+
'lt-lt',
|
|
273
|
+
'mk-mk',
|
|
274
|
+
'ms',
|
|
275
|
+
'ms-bn',
|
|
276
|
+
'ms-my',
|
|
277
|
+
'ms-sg',
|
|
278
|
+
'mt',
|
|
279
|
+
'mr-in',
|
|
280
|
+
'mn-mn',
|
|
281
|
+
'no',
|
|
282
|
+
'no-no',
|
|
283
|
+
'nb-no',
|
|
284
|
+
'nn-no',
|
|
285
|
+
'pl-pl',
|
|
286
|
+
'pt',
|
|
287
|
+
'pt-br',
|
|
288
|
+
'pt-pt',
|
|
289
|
+
'pa-in',
|
|
290
|
+
'ro-ro',
|
|
291
|
+
'ru',
|
|
292
|
+
'ru-kz',
|
|
293
|
+
'ru-ru',
|
|
294
|
+
'ru-ua',
|
|
295
|
+
'sa-in',
|
|
296
|
+
'cy-sr-sp',
|
|
297
|
+
'lt-sr-sp',
|
|
298
|
+
'sr-me',
|
|
299
|
+
'sk-sk',
|
|
300
|
+
'sl-si',
|
|
301
|
+
'es',
|
|
302
|
+
'es-ar',
|
|
303
|
+
'es-bo',
|
|
304
|
+
'es-cl',
|
|
305
|
+
'es-co',
|
|
306
|
+
'es-cr',
|
|
307
|
+
'es-do',
|
|
308
|
+
'es-ec',
|
|
309
|
+
'es-sv',
|
|
310
|
+
'es-gt',
|
|
311
|
+
'es-hn',
|
|
312
|
+
'es-419',
|
|
313
|
+
'es-mx',
|
|
314
|
+
'es-ni',
|
|
315
|
+
'es-pa',
|
|
316
|
+
'es-py',
|
|
317
|
+
'es-pe',
|
|
318
|
+
'es-pr',
|
|
319
|
+
'es-es',
|
|
320
|
+
'es-us',
|
|
321
|
+
'es-uy',
|
|
322
|
+
'es-ve',
|
|
323
|
+
'sw-ke',
|
|
324
|
+
'sv',
|
|
325
|
+
'sv-fi',
|
|
326
|
+
'sv-se',
|
|
327
|
+
'syr-sy',
|
|
328
|
+
'tl',
|
|
329
|
+
'ta-in',
|
|
330
|
+
'tt-ru',
|
|
331
|
+
'te-in',
|
|
332
|
+
'th-th',
|
|
333
|
+
'tr-tr',
|
|
334
|
+
'uk-ua',
|
|
335
|
+
'ur-pk',
|
|
336
|
+
'uz',
|
|
337
|
+
'cy-uz-uz',
|
|
338
|
+
'lt-uz-uz',
|
|
339
|
+
'vi-vn',
|
|
340
|
+
'xh',
|
|
341
|
+
'zu',
|
|
342
|
+
],
|
|
343
|
+
apis: {
|
|
344
|
+
userSession: '/user-session/',
|
|
345
|
+
locales: '/locales/',
|
|
346
|
+
environments: '/environments/',
|
|
347
|
+
assets: '/assets/',
|
|
348
|
+
content_types: '/content_types/',
|
|
349
|
+
entries: '/entries/',
|
|
350
|
+
extensions: '/extensions/',
|
|
351
|
+
webhooks: '/webhooks/',
|
|
352
|
+
globalfields: '/global_fields/',
|
|
353
|
+
folders: '/folders/',
|
|
354
|
+
stacks: '/stacks/',
|
|
355
|
+
labels: '/labels/',
|
|
356
|
+
},
|
|
357
|
+
updatedModules: ['assets', 'locales'],
|
|
358
|
+
rateLimit: 5,
|
|
359
|
+
preserveStackVersion: false,
|
|
360
|
+
entriesPublish: true,
|
|
361
|
+
concurrency: 1,
|
|
362
|
+
importConcurrency: 5,
|
|
363
|
+
fetchConcurrency: 5,
|
|
364
|
+
writeConcurrency: 5,
|
|
365
|
+
developerHubBaseUrl: '',
|
|
366
|
+
marketplaceAppEncryptionKey: 'nF2ejRQcTv',
|
|
367
|
+
getEncryptionKeyMaxRetry: 3,
|
|
368
|
+
useNewModuleStructure: false,
|
|
369
|
+
// useBackedupDir: '',
|
|
370
|
+
// backupConcurrency: 10,
|
|
371
|
+
};
|
|
372
|
+
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;
|