@strapi/strapi 5.12.1 → 5.12.3
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/dist/cli.js +89 -45
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +90 -42
- package/dist/cli.mjs.map +1 -1
- package/dist/package.json.js +6 -0
- package/dist/package.json.js.map +1 -0
- package/dist/package.json.mjs +4 -0
- package/dist/package.json.mjs.map +1 -0
- package/dist/src/cli/commands/admin/create-user.js +124 -0
- package/dist/src/cli/commands/admin/create-user.js.map +1 -0
- package/dist/src/cli/commands/admin/create-user.mjs +121 -0
- package/dist/src/cli/commands/admin/create-user.mjs.map +1 -0
- package/dist/src/cli/commands/admin/reset-user-password.js +61 -0
- package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -0
- package/dist/src/cli/commands/admin/reset-user-password.mjs +58 -0
- package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -0
- package/dist/src/cli/commands/build.js +29 -0
- package/dist/src/cli/commands/build.js.map +1 -0
- package/dist/src/cli/commands/build.mjs +27 -0
- package/dist/src/cli/commands/build.mjs.map +1 -0
- package/dist/src/cli/commands/components/list.js +32 -0
- package/dist/src/cli/commands/components/list.js.map +1 -0
- package/dist/src/cli/commands/components/list.mjs +29 -0
- package/dist/src/cli/commands/components/list.mjs.map +1 -0
- package/dist/src/cli/commands/configuration/dump.js +53 -0
- package/dist/src/cli/commands/configuration/dump.js.map +1 -0
- package/dist/src/cli/commands/configuration/dump.mjs +50 -0
- package/dist/src/cli/commands/configuration/dump.mjs.map +1 -0
- package/dist/src/cli/commands/configuration/restore.js +173 -0
- package/dist/src/cli/commands/configuration/restore.js.map +1 -0
- package/dist/src/cli/commands/configuration/restore.mjs +170 -0
- package/dist/src/cli/commands/configuration/restore.mjs.map +1 -0
- package/dist/src/cli/commands/console.js +31 -0
- package/dist/src/cli/commands/console.js.map +1 -0
- package/dist/src/cli/commands/console.mjs +28 -0
- package/dist/src/cli/commands/console.mjs.map +1 -0
- package/dist/src/cli/commands/content-types/list.js +32 -0
- package/dist/src/cli/commands/content-types/list.js.map +1 -0
- package/dist/src/cli/commands/content-types/list.mjs +29 -0
- package/dist/src/cli/commands/content-types/list.mjs.map +1 -0
- package/dist/src/cli/commands/controllers/list.js +32 -0
- package/dist/src/cli/commands/controllers/list.js.map +1 -0
- package/dist/src/cli/commands/controllers/list.mjs +29 -0
- package/dist/src/cli/commands/controllers/list.mjs.map +1 -0
- package/dist/src/cli/commands/develop.js +32 -0
- package/dist/src/cli/commands/develop.js.map +1 -0
- package/dist/src/cli/commands/develop.mjs +30 -0
- package/dist/src/cli/commands/develop.mjs.map +1 -0
- package/dist/src/cli/commands/export/action.js +126 -0
- package/dist/src/cli/commands/export/action.js.map +1 -0
- package/dist/src/cli/commands/export/action.mjs +124 -0
- package/dist/src/cli/commands/export/action.mjs.map +1 -0
- package/dist/src/cli/commands/export/command.js +15 -0
- package/dist/src/cli/commands/export/command.js.map +1 -0
- package/dist/src/cli/commands/export/command.mjs +13 -0
- package/dist/src/cli/commands/export/command.mjs.map +1 -0
- package/dist/src/cli/commands/generate.js +18 -0
- package/dist/src/cli/commands/generate.js.map +1 -0
- package/dist/src/cli/commands/generate.mjs +16 -0
- package/dist/src/cli/commands/generate.mjs.map +1 -0
- package/dist/src/cli/commands/hooks/list.js +32 -0
- package/dist/src/cli/commands/hooks/list.js.map +1 -0
- package/dist/src/cli/commands/hooks/list.mjs +29 -0
- package/dist/src/cli/commands/hooks/list.mjs.map +1 -0
- package/dist/src/cli/commands/import/action.js +124 -0
- package/dist/src/cli/commands/import/action.js.map +1 -0
- package/dist/src/cli/commands/import/action.mjs +122 -0
- package/dist/src/cli/commands/import/action.mjs.map +1 -0
- package/dist/src/cli/commands/import/command.js +59 -0
- package/dist/src/cli/commands/import/command.js.map +1 -0
- package/dist/src/cli/commands/import/command.mjs +57 -0
- package/dist/src/cli/commands/import/command.mjs.map +1 -0
- package/dist/src/cli/commands/index.js +64 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/index.mjs +62 -0
- package/dist/src/cli/commands/index.mjs.map +1 -0
- package/dist/src/cli/commands/middlewares/list.js +32 -0
- package/dist/src/cli/commands/middlewares/list.js.map +1 -0
- package/dist/src/cli/commands/middlewares/list.mjs +29 -0
- package/dist/src/cli/commands/middlewares/list.mjs.map +1 -0
- package/dist/src/cli/commands/policies/list.js +32 -0
- package/dist/src/cli/commands/policies/list.js.map +1 -0
- package/dist/src/cli/commands/policies/list.mjs +29 -0
- package/dist/src/cli/commands/policies/list.mjs.map +1 -0
- package/dist/src/cli/commands/report.js +39 -0
- package/dist/src/cli/commands/report.js.map +1 -0
- package/dist/src/cli/commands/report.mjs +37 -0
- package/dist/src/cli/commands/report.mjs.map +1 -0
- package/dist/src/cli/commands/routes/list.js +40 -0
- package/dist/src/cli/commands/routes/list.js.map +1 -0
- package/dist/src/cli/commands/routes/list.mjs +37 -0
- package/dist/src/cli/commands/routes/list.mjs.map +1 -0
- package/dist/src/cli/commands/services/list.js +32 -0
- package/dist/src/cli/commands/services/list.js.map +1 -0
- package/dist/src/cli/commands/services/list.mjs +29 -0
- package/dist/src/cli/commands/services/list.mjs.map +1 -0
- package/dist/src/cli/commands/start.js +28 -0
- package/dist/src/cli/commands/start.js.map +1 -0
- package/dist/src/cli/commands/start.mjs +26 -0
- package/dist/src/cli/commands/start.mjs.map +1 -0
- package/dist/src/cli/commands/telemetry/disable.js +72 -0
- package/dist/src/cli/commands/telemetry/disable.js.map +1 -0
- package/dist/src/cli/commands/telemetry/disable.mjs +69 -0
- package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -0
- package/dist/src/cli/commands/telemetry/enable.js +88 -0
- package/dist/src/cli/commands/telemetry/enable.js.map +1 -0
- package/dist/src/cli/commands/telemetry/enable.mjs +85 -0
- package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -0
- package/dist/src/cli/commands/templates/generate.js +15 -0
- package/dist/src/cli/commands/templates/generate.js.map +1 -0
- package/dist/src/cli/commands/templates/generate.mjs +13 -0
- package/dist/src/cli/commands/templates/generate.mjs.map +1 -0
- package/dist/src/cli/commands/transfer/action.js +141 -0
- package/dist/src/cli/commands/transfer/action.js.map +1 -0
- package/dist/src/cli/commands/transfer/action.mjs +139 -0
- package/dist/src/cli/commands/transfer/action.mjs.map +1 -0
- package/dist/src/cli/commands/transfer/command.js +61 -0
- package/dist/src/cli/commands/transfer/command.js.map +1 -0
- package/dist/src/cli/commands/transfer/command.mjs +59 -0
- package/dist/src/cli/commands/transfer/command.mjs.map +1 -0
- package/dist/src/cli/commands/ts/generate-types.js +40 -0
- package/dist/src/cli/commands/ts/generate-types.js.map +1 -0
- package/dist/src/cli/commands/ts/generate-types.mjs +37 -0
- package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -0
- package/dist/src/cli/commands/version.js +17 -0
- package/dist/src/cli/commands/version.js.map +1 -0
- package/dist/src/cli/commands/version.mjs +15 -0
- package/dist/src/cli/commands/version.mjs.map +1 -0
- package/dist/src/cli/utils/commander.js +125 -0
- package/dist/src/cli/utils/commander.js.map +1 -0
- package/dist/src/cli/utils/commander.mjs +116 -0
- package/dist/src/cli/utils/commander.mjs.map +1 -0
- package/dist/src/cli/utils/data-transfer.js +378 -0
- package/dist/src/cli/utils/data-transfer.js.map +1 -0
- package/dist/src/cli/utils/data-transfer.mjs +359 -0
- package/dist/src/cli/utils/data-transfer.mjs.map +1 -0
- package/dist/src/cli/utils/helpers.js +114 -0
- package/dist/src/cli/utils/helpers.js.map +1 -0
- package/dist/src/cli/utils/helpers.mjs +107 -0
- package/dist/src/cli/utils/helpers.mjs.map +1 -0
- package/dist/src/cli/utils/logger.js +125 -0
- package/dist/src/cli/utils/logger.js.map +1 -0
- package/dist/src/cli/utils/logger.mjs +104 -0
- package/dist/src/cli/utils/logger.mjs.map +1 -0
- package/dist/src/cli/utils/telemetry.js +27 -0
- package/dist/src/cli/utils/telemetry.js.map +1 -0
- package/dist/src/cli/utils/telemetry.mjs +25 -0
- package/dist/src/cli/utils/telemetry.mjs.map +1 -0
- package/dist/src/cli/utils/tsconfig.js +25 -0
- package/dist/src/cli/utils/tsconfig.js.map +1 -0
- package/dist/src/cli/utils/tsconfig.mjs +23 -0
- package/dist/src/cli/utils/tsconfig.mjs.map +1 -0
- package/dist/src/node/build.js +90 -0
- package/dist/src/node/build.js.map +1 -0
- package/dist/src/node/build.mjs +69 -0
- package/dist/src/node/build.mjs.map +1 -0
- package/dist/src/node/core/admin-customisations.js +27 -0
- package/dist/src/node/core/admin-customisations.js.map +1 -0
- package/dist/src/node/core/admin-customisations.mjs +25 -0
- package/dist/src/node/core/admin-customisations.mjs.map +1 -0
- package/dist/{chunks/aliases-BkD9BImE.js → src/node/core/aliases.js} +3 -42
- package/dist/src/node/core/aliases.js.map +1 -0
- package/dist/{chunks/aliases-CZgVGGH9.mjs → src/node/core/aliases.mjs} +4 -41
- package/dist/src/node/core/aliases.mjs.map +1 -0
- package/dist/src/node/core/config.js +18 -0
- package/dist/src/node/core/config.js.map +1 -0
- package/dist/src/node/core/config.mjs +16 -0
- package/dist/src/node/core/config.mjs.map +1 -0
- package/dist/src/node/core/dependencies.js +186 -0
- package/dist/src/node/core/dependencies.js.map +1 -0
- package/dist/src/node/core/dependencies.mjs +183 -0
- package/dist/src/node/core/dependencies.mjs.map +1 -0
- package/dist/src/node/core/env.js +32 -0
- package/dist/src/node/core/env.js.map +1 -0
- package/dist/src/node/core/env.mjs +29 -0
- package/dist/src/node/core/env.mjs.map +1 -0
- package/dist/src/node/core/errors.js +51 -0
- package/dist/src/node/core/errors.js.map +1 -0
- package/dist/src/node/core/errors.mjs +48 -0
- package/dist/src/node/core/errors.mjs.map +1 -0
- package/dist/src/node/core/files.js +68 -0
- package/dist/src/node/core/files.js.map +1 -0
- package/dist/src/node/core/files.mjs +63 -0
- package/dist/src/node/core/files.mjs.map +1 -0
- package/dist/src/node/core/managers.js +27 -0
- package/dist/src/node/core/managers.js.map +1 -0
- package/dist/src/node/core/managers.mjs +25 -0
- package/dist/src/node/core/managers.mjs.map +1 -0
- package/dist/src/node/core/monorepo.js +30 -0
- package/dist/src/node/core/monorepo.js.map +1 -0
- package/dist/src/node/core/monorepo.mjs +28 -0
- package/dist/src/node/core/monorepo.mjs.map +1 -0
- package/dist/src/node/core/plugins.js +140 -0
- package/dist/src/node/core/plugins.js.map +1 -0
- package/dist/src/node/core/plugins.mjs +137 -0
- package/dist/src/node/core/plugins.mjs.map +1 -0
- package/dist/src/node/core/timer.js +33 -0
- package/dist/src/node/core/timer.js.map +1 -0
- package/dist/src/node/core/timer.mjs +30 -0
- package/dist/src/node/core/timer.mjs.map +1 -0
- package/dist/src/node/create-build-context.js +111 -0
- package/dist/src/node/create-build-context.js.map +1 -0
- package/dist/src/node/create-build-context.mjs +109 -0
- package/dist/src/node/create-build-context.mjs.map +1 -0
- package/dist/src/node/develop.js +312 -0
- package/dist/src/node/develop.js.map +1 -0
- package/dist/src/node/develop.mjs +291 -0
- package/dist/src/node/develop.mjs.map +1 -0
- package/dist/src/node/staticFiles.js +81 -0
- package/dist/src/node/staticFiles.js.map +1 -0
- package/dist/src/node/staticFiles.mjs +78 -0
- package/dist/src/node/staticFiles.mjs.map +1 -0
- package/dist/src/node/vite/build.js +14 -0
- package/dist/src/node/vite/build.js.map +1 -0
- package/dist/src/node/vite/build.mjs +12 -0
- package/dist/src/node/vite/build.mjs.map +1 -0
- package/dist/{chunks/config-D3Y5s3ui.js → src/node/vite/config.js} +12 -50
- package/dist/src/node/vite/config.js.map +1 -0
- package/dist/{chunks/config-BFUn1raM.mjs → src/node/vite/config.mjs} +6 -44
- package/dist/src/node/vite/config.mjs.map +1 -0
- package/dist/src/node/vite/plugins.js +46 -0
- package/dist/src/node/vite/plugins.js.map +1 -0
- package/dist/src/node/vite/plugins.mjs +44 -0
- package/dist/src/node/vite/plugins.mjs.map +1 -0
- package/dist/{chunks/watch-gkyBsmAJ.js → src/node/vite/watch.js} +2 -45
- package/dist/src/node/vite/watch.js.map +1 -0
- package/dist/{chunks/watch-DUnlAAiK.mjs → src/node/vite/watch.mjs} +2 -45
- package/dist/src/node/vite/watch.mjs.map +1 -0
- package/dist/src/node/webpack/build.js +37 -0
- package/dist/src/node/webpack/build.js.map +1 -0
- package/dist/src/node/webpack/build.mjs +35 -0
- package/dist/src/node/webpack/build.mjs.map +1 -0
- package/dist/{chunks/config-Bcu3_xSp.js → src/node/webpack/config.js} +10 -8
- package/dist/src/node/webpack/config.js.map +1 -0
- package/dist/{chunks/config-DKpJU9io.mjs → src/node/webpack/config.mjs} +5 -3
- package/dist/src/node/webpack/config.mjs.map +1 -0
- package/dist/{chunks/watch-CNfkm7Fm.js → src/node/webpack/watch.js} +2 -51
- package/dist/src/node/webpack/watch.js.map +1 -0
- package/dist/{chunks/watch-BEC39t49.mjs → src/node/webpack/watch.mjs} +2 -51
- package/dist/src/node/webpack/watch.mjs.map +1 -0
- package/package.json +22 -22
- package/dist/chunks/aliases-BkD9BImE.js.map +0 -1
- package/dist/chunks/aliases-CZgVGGH9.mjs.map +0 -1
- package/dist/chunks/build-B6f5SABm.js +0 -87
- package/dist/chunks/build-B6f5SABm.js.map +0 -1
- package/dist/chunks/build-BQc6C2UF.mjs +0 -85
- package/dist/chunks/build-BQc6C2UF.mjs.map +0 -1
- package/dist/chunks/build-C4qN5x5L.js +0 -59
- package/dist/chunks/build-C4qN5x5L.js.map +0 -1
- package/dist/chunks/build-D6MP0Rwu.mjs +0 -57
- package/dist/chunks/build-D6MP0Rwu.mjs.map +0 -1
- package/dist/chunks/config-BFUn1raM.mjs.map +0 -1
- package/dist/chunks/config-Bcu3_xSp.js.map +0 -1
- package/dist/chunks/config-D3Y5s3ui.js.map +0 -1
- package/dist/chunks/config-DKpJU9io.mjs.map +0 -1
- package/dist/chunks/index-DGhshfMs.mjs +0 -3160
- package/dist/chunks/index-DGhshfMs.mjs.map +0 -1
- package/dist/chunks/index-DW2NjgW9.js +0 -3185
- package/dist/chunks/index-DW2NjgW9.js.map +0 -1
- package/dist/chunks/watch-BEC39t49.mjs.map +0 -1
- package/dist/chunks/watch-CNfkm7Fm.js.map +0 -1
- package/dist/chunks/watch-DUnlAAiK.mjs.map +0 -1
- package/dist/chunks/watch-gkyBsmAJ.js.map +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var inquirer = require('inquirer');
|
|
4
|
+
var commander = require('commander');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var fp = require('lodash/fp');
|
|
7
|
+
var helpers = require('./helpers.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* argParser: Parse a comma-delimited string as an array
|
|
11
|
+
*/ const parseList = (value)=>{
|
|
12
|
+
try {
|
|
13
|
+
return value.split(',').map((item)=>item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters
|
|
14
|
+
} catch (e) {
|
|
15
|
+
helpers.exitWith(1, `Unrecognized input: ${value}`);
|
|
16
|
+
}
|
|
17
|
+
return [];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns an argParser that returns a list
|
|
21
|
+
*/ const getParseListWithChoices = (choices, errorMessage = 'Invalid options:')=>{
|
|
22
|
+
return (value)=>{
|
|
23
|
+
const list = parseList(value);
|
|
24
|
+
const invalid = list.filter((item)=>{
|
|
25
|
+
return !choices.includes(item);
|
|
26
|
+
});
|
|
27
|
+
if (invalid.length > 0) {
|
|
28
|
+
helpers.exitWith(1, `${errorMessage}: ${invalid.join(',')}`);
|
|
29
|
+
}
|
|
30
|
+
return list;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* argParser: Parse a string as an integer
|
|
35
|
+
*/ const parseInteger = (value)=>{
|
|
36
|
+
// parseInt takes a string and a radix
|
|
37
|
+
const parsedValue = parseInt(value, 10);
|
|
38
|
+
if (fp.isNaN(parsedValue)) {
|
|
39
|
+
throw new commander.InvalidOptionArgumentError(`Not an integer: ${value}`);
|
|
40
|
+
}
|
|
41
|
+
return parsedValue;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* argParser: Parse a string as a URL object
|
|
45
|
+
*/ const parseURL = (value)=>{
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(value);
|
|
48
|
+
if (!url.host) {
|
|
49
|
+
throw new commander.InvalidOptionArgumentError(`Could not parse url ${value}`);
|
|
50
|
+
}
|
|
51
|
+
return url;
|
|
52
|
+
} catch (e) {
|
|
53
|
+
throw new commander.InvalidOptionArgumentError(`Could not parse url ${value}`);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* hook: if encrypt==true and key not provided, prompt for it
|
|
58
|
+
*/ const promptEncryptionKey = async (thisCommand)=>{
|
|
59
|
+
const opts = thisCommand.opts();
|
|
60
|
+
if (!opts.encrypt && opts.key) {
|
|
61
|
+
return helpers.exitWith(1, 'Key may not be present unless encryption is used');
|
|
62
|
+
}
|
|
63
|
+
// if encrypt==true but we have no key, prompt for it
|
|
64
|
+
if (opts.encrypt && !(opts.key && opts.key.length > 0)) {
|
|
65
|
+
try {
|
|
66
|
+
const answers = await inquirer.prompt([
|
|
67
|
+
{
|
|
68
|
+
type: 'password',
|
|
69
|
+
message: 'Please enter an encryption key',
|
|
70
|
+
name: 'key',
|
|
71
|
+
validate (key) {
|
|
72
|
+
if (key.length > 0) return true;
|
|
73
|
+
return 'Key must be present when using the encrypt option';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
opts.key = answers.key;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return helpers.exitWith(1, 'Failed to get encryption key');
|
|
80
|
+
}
|
|
81
|
+
if (!opts.key) {
|
|
82
|
+
return helpers.exitWith(1, 'Failed to get encryption key');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used
|
|
88
|
+
*/ const getCommanderConfirmMessage = (message, { failMessage } = {})=>{
|
|
89
|
+
return async (command)=>{
|
|
90
|
+
const confirmed = await confirmMessage(message, {
|
|
91
|
+
force: command.opts().force
|
|
92
|
+
});
|
|
93
|
+
if (!confirmed) {
|
|
94
|
+
helpers.exitWith(1, failMessage);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
const confirmMessage = async (message, { force } = {})=>{
|
|
99
|
+
// if we have a force option, respond yes
|
|
100
|
+
if (force === true) {
|
|
101
|
+
// attempt to mimic the inquirer prompt exactly
|
|
102
|
+
console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
const answers = await inquirer.prompt([
|
|
106
|
+
{
|
|
107
|
+
type: 'confirm',
|
|
108
|
+
message,
|
|
109
|
+
name: `confirm`,
|
|
110
|
+
default: false
|
|
111
|
+
}
|
|
112
|
+
]);
|
|
113
|
+
return answers.confirm;
|
|
114
|
+
};
|
|
115
|
+
const forceOption = new commander.Option('--force', `Automatically answer "yes" to all prompts, including potentially destructive requests, and run non-interactively.`);
|
|
116
|
+
|
|
117
|
+
exports.confirmMessage = confirmMessage;
|
|
118
|
+
exports.forceOption = forceOption;
|
|
119
|
+
exports.getCommanderConfirmMessage = getCommanderConfirmMessage;
|
|
120
|
+
exports.getParseListWithChoices = getParseListWithChoices;
|
|
121
|
+
exports.parseInteger = parseInteger;
|
|
122
|
+
exports.parseList = parseList;
|
|
123
|
+
exports.parseURL = parseURL;
|
|
124
|
+
exports.promptEncryptionKey = promptEncryptionKey;
|
|
125
|
+
//# sourceMappingURL=commander.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commander.js","sources":["../../../../src/cli/utils/commander.ts"],"sourcesContent":["/**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport inquirer from 'inquirer';\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","answers","inquirer","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;IACjB,IAAI;QACF,OAAOA,KAAAA,CAAMC,KAAK,CAAC,GAAKC,CAAAA,CAAAA,GAAG,CAAC,CAACC,IAASA,GAAAA,IAAAA,CAAKC,IAAI,EAAA,CAAA,CAAA;AACjD,KAAA,CAAE,OAAOC,CAAG,EAAA;AACVC,QAAAA,gBAAAA,CAAS,CAAG,EAAA,CAAC,oBAAoB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OH,EAAAA,OAAAA,CAAQZ,IAAI,EAAA,CAAGe;AAAM,SAAA,CAAA;AAC9E,QAAA,IAAI,CAACF,SAAW,EAAA;AACdlC,YAAAA,gBAAAA,CAAS,CAAGgC,EAAAA,WAAAA,CAAAA;AACd;AACF,KAAA;AACF;AAEMG,MAAAA,cAAAA,GAAiB,OAAOP,OAAiB,EAAA,EAAEQ,KAAK,EAAuB,GAAG,EAAE,GAAA;;AAEhF,IAAA,IAAIA,UAAU,IAAM,EAAA;;QAElBC,OAAQC,CAAAA,GAAG,CAAC,CAAC,EAAEC,MAAMC,KAAK,CAAC,KAAK,CAAC,EAAED,MAAME,IAAI,CAACb,SAAS,CAAC,EAAEW,MAAMG,IAAI,CAAC,OAAO,CAAC,CAAA;QAC7E,OAAO,IAAA;AACT;AAEA,IAAA,MAAMlB,OAAU,GAAA,MAAMC,QAASC,CAAAA,MAAM,CAAC;AACpC,QAAA;YACEC,IAAM,EAAA,SAAA;AACNC,YAAAA,OAAAA;YACAC,IAAM,EAAA,CAAC,OAAO,CAAC;YACfc,OAAS,EAAA;AACX;AACD,KAAA,CAAA;AAED,IAAA,OAAOnB,QAAQoB,OAAO;AACxB;AAEA,MAAMC,cAAc,IAAIC,gBAAAA,CACtB,SACA,EAAA,CAAC,iHAAiH,CAAC;;;;;;;;;;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import { Option, InvalidOptionArgumentError } from 'commander';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { isNaN } from 'lodash/fp';
|
|
5
|
+
import { exitWith } from './helpers.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* argParser: Parse a comma-delimited string as an array
|
|
9
|
+
*/ const parseList = (value)=>{
|
|
10
|
+
try {
|
|
11
|
+
return value.split(',').map((item)=>item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters
|
|
12
|
+
} catch (e) {
|
|
13
|
+
exitWith(1, `Unrecognized input: ${value}`);
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Returns an argParser that returns a list
|
|
19
|
+
*/ const getParseListWithChoices = (choices, errorMessage = 'Invalid options:')=>{
|
|
20
|
+
return (value)=>{
|
|
21
|
+
const list = parseList(value);
|
|
22
|
+
const invalid = list.filter((item)=>{
|
|
23
|
+
return !choices.includes(item);
|
|
24
|
+
});
|
|
25
|
+
if (invalid.length > 0) {
|
|
26
|
+
exitWith(1, `${errorMessage}: ${invalid.join(',')}`);
|
|
27
|
+
}
|
|
28
|
+
return list;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* argParser: Parse a string as an integer
|
|
33
|
+
*/ const parseInteger = (value)=>{
|
|
34
|
+
// parseInt takes a string and a radix
|
|
35
|
+
const parsedValue = parseInt(value, 10);
|
|
36
|
+
if (isNaN(parsedValue)) {
|
|
37
|
+
throw new InvalidOptionArgumentError(`Not an integer: ${value}`);
|
|
38
|
+
}
|
|
39
|
+
return parsedValue;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* argParser: Parse a string as a URL object
|
|
43
|
+
*/ const parseURL = (value)=>{
|
|
44
|
+
try {
|
|
45
|
+
const url = new URL(value);
|
|
46
|
+
if (!url.host) {
|
|
47
|
+
throw new InvalidOptionArgumentError(`Could not parse url ${value}`);
|
|
48
|
+
}
|
|
49
|
+
return url;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
throw new InvalidOptionArgumentError(`Could not parse url ${value}`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* hook: if encrypt==true and key not provided, prompt for it
|
|
56
|
+
*/ const promptEncryptionKey = async (thisCommand)=>{
|
|
57
|
+
const opts = thisCommand.opts();
|
|
58
|
+
if (!opts.encrypt && opts.key) {
|
|
59
|
+
return exitWith(1, 'Key may not be present unless encryption is used');
|
|
60
|
+
}
|
|
61
|
+
// if encrypt==true but we have no key, prompt for it
|
|
62
|
+
if (opts.encrypt && !(opts.key && opts.key.length > 0)) {
|
|
63
|
+
try {
|
|
64
|
+
const answers = await inquirer.prompt([
|
|
65
|
+
{
|
|
66
|
+
type: 'password',
|
|
67
|
+
message: 'Please enter an encryption key',
|
|
68
|
+
name: 'key',
|
|
69
|
+
validate (key) {
|
|
70
|
+
if (key.length > 0) return true;
|
|
71
|
+
return 'Key must be present when using the encrypt option';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]);
|
|
75
|
+
opts.key = answers.key;
|
|
76
|
+
} catch (e) {
|
|
77
|
+
return exitWith(1, 'Failed to get encryption key');
|
|
78
|
+
}
|
|
79
|
+
if (!opts.key) {
|
|
80
|
+
return exitWith(1, 'Failed to get encryption key');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used
|
|
86
|
+
*/ const getCommanderConfirmMessage = (message, { failMessage } = {})=>{
|
|
87
|
+
return async (command)=>{
|
|
88
|
+
const confirmed = await confirmMessage(message, {
|
|
89
|
+
force: command.opts().force
|
|
90
|
+
});
|
|
91
|
+
if (!confirmed) {
|
|
92
|
+
exitWith(1, failMessage);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const confirmMessage = async (message, { force } = {})=>{
|
|
97
|
+
// if we have a force option, respond yes
|
|
98
|
+
if (force === true) {
|
|
99
|
+
// attempt to mimic the inquirer prompt exactly
|
|
100
|
+
console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
const answers = await inquirer.prompt([
|
|
104
|
+
{
|
|
105
|
+
type: 'confirm',
|
|
106
|
+
message,
|
|
107
|
+
name: `confirm`,
|
|
108
|
+
default: false
|
|
109
|
+
}
|
|
110
|
+
]);
|
|
111
|
+
return answers.confirm;
|
|
112
|
+
};
|
|
113
|
+
const forceOption = new Option('--force', `Automatically answer "yes" to all prompts, including potentially destructive requests, and run non-interactively.`);
|
|
114
|
+
|
|
115
|
+
export { confirmMessage, forceOption, getCommanderConfirmMessage, getParseListWithChoices, parseInteger, parseList, parseURL, promptEncryptionKey };
|
|
116
|
+
//# sourceMappingURL=commander.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commander.mjs","sources":["../../../../src/cli/utils/commander.ts"],"sourcesContent":["/**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport inquirer from 'inquirer';\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","answers","inquirer","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;IACjB,IAAI;QACF,OAAOA,KAAAA,CAAMC,KAAK,CAAC,GAAKC,CAAAA,CAAAA,GAAG,CAAC,CAACC,IAASA,GAAAA,IAAAA,CAAKC,IAAI,EAAA,CAAA,CAAA;AACjD,KAAA,CAAE,OAAOC,CAAG,EAAA;AACVC,QAAAA,QAAAA,CAAS,CAAG,EAAA,CAAC,oBAAoB,EAAEN,MAAM,CAAC,CAAA;AAC5C;AAEA,IAAA,OAAO,EAAE;AACX;AAEA;;AAEC,IACKO,MAAAA,uBAAAA,GAA0B,CAACC,OAAAA,EAAmBC,eAAe,kBAAkB,GAAA;AACnF,IAAA,OAAO,CAACT,KAAAA,GAAAA;AACN,QAAA,MAAMU,OAAOX,SAAUC,CAAAA,KAAAA,CAAAA;AACvB,QAAA,MAAMW,OAAUD,GAAAA,IAAAA,CAAKE,MAAM,CAAC,CAACT,IAAAA,GAAAA;YAC3B,OAAO,CAACK,OAAQK,CAAAA,QAAQ,CAACV,IAAAA,CAAAA;AAC3B,SAAA,CAAA;QAEA,IAAIQ,OAAAA,CAAQG,MAAM,GAAG,CAAG,EAAA;YACtBR,QAAS,CAAA,CAAA,EAAG,CAAC,EAAEG,YAAa,CAAA,EAAE,EAAEE,OAAQI,CAAAA,IAAI,CAAC,GAAA,CAAA,CAAK,CAAC,CAAA;AACrD;QAEA,OAAOL,IAAAA;AACT,KAAA;AACF;AAEA;;IAGA,MAAMM,eAAe,CAAChB,KAAAA,GAAAA;;IAEpB,MAAMiB,WAAAA,GAAcC,SAASlB,KAAO,EAAA,EAAA,CAAA;AACpC,IAAA,IAAImB,MAAMF,WAAc,CAAA,EAAA;AACtB,QAAA,MAAM,IAAIG,0BAA2B,CAAA,CAAC,gBA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|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chalk = require('chalk');
|
|
4
|
+
var CLITable = require('cli-table3');
|
|
5
|
+
var commander = require('commander');
|
|
6
|
+
var logger = require('@strapi/logger');
|
|
7
|
+
var core = require('@strapi/core');
|
|
8
|
+
var ora = require('ora');
|
|
9
|
+
var fp = require('lodash/fp');
|
|
10
|
+
var dataTransfer = require('@strapi/data-transfer');
|
|
11
|
+
var helpers = require('./helpers.js');
|
|
12
|
+
var commander$1 = require('./commander.js');
|
|
13
|
+
|
|
14
|
+
const { errors: { TransferEngineInitializationError } } = dataTransfer.engine;
|
|
15
|
+
const exitMessageText = (process1, error = false)=>{
|
|
16
|
+
const processCapitalized = process1[0].toUpperCase() + process1.slice(1);
|
|
17
|
+
if (!error) {
|
|
18
|
+
return chalk.bold(chalk.green(`${processCapitalized} process has been completed successfully!`));
|
|
19
|
+
}
|
|
20
|
+
return chalk.bold(chalk.red(`${processCapitalized} process failed.`));
|
|
21
|
+
};
|
|
22
|
+
const pad = (n)=>{
|
|
23
|
+
return (n < 10 ? '0' : '') + String(n);
|
|
24
|
+
};
|
|
25
|
+
const yyyymmddHHMMSS = ()=>{
|
|
26
|
+
const date = new Date();
|
|
27
|
+
return date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()) + pad(date.getHours()) + pad(date.getMinutes()) + pad(date.getSeconds());
|
|
28
|
+
};
|
|
29
|
+
const getDefaultExportName = ()=>{
|
|
30
|
+
return `export_${yyyymmddHHMMSS()}`;
|
|
31
|
+
};
|
|
32
|
+
const buildTransferTable = (resultData)=>{
|
|
33
|
+
if (!resultData) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Build pretty table
|
|
37
|
+
const table = new CLITable({
|
|
38
|
+
head: [
|
|
39
|
+
'Type',
|
|
40
|
+
'Count',
|
|
41
|
+
'Size'
|
|
42
|
+
].map((text)=>chalk.bold.blue(text))
|
|
43
|
+
});
|
|
44
|
+
let totalBytes = 0;
|
|
45
|
+
let totalItems = 0;
|
|
46
|
+
Object.keys(resultData).forEach((stage)=>{
|
|
47
|
+
const item = resultData[stage];
|
|
48
|
+
if (!item) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
table.push([
|
|
52
|
+
{
|
|
53
|
+
hAlign: 'left',
|
|
54
|
+
content: chalk.bold(stage)
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
hAlign: 'right',
|
|
58
|
+
content: item.count
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
hAlign: 'right',
|
|
62
|
+
content: `${helpers.readableBytes(item.bytes, 1, 11)} `
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
65
|
+
totalBytes += item.bytes;
|
|
66
|
+
totalItems += item.count;
|
|
67
|
+
if (item.aggregates) {
|
|
68
|
+
Object.keys(item.aggregates).sort().forEach((subkey)=>{
|
|
69
|
+
if (!item.aggregates) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const subitem = item.aggregates[subkey];
|
|
73
|
+
table.push([
|
|
74
|
+
{
|
|
75
|
+
hAlign: 'left',
|
|
76
|
+
content: `-- ${chalk.bold.grey(subkey)}`
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
hAlign: 'right',
|
|
80
|
+
content: chalk.grey(subitem.count)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
hAlign: 'right',
|
|
84
|
+
content: chalk.grey(`(${helpers.readableBytes(subitem.bytes, 1, 11)})`)
|
|
85
|
+
}
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
table.push([
|
|
91
|
+
{
|
|
92
|
+
hAlign: 'left',
|
|
93
|
+
content: chalk.bold.green('Total')
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
hAlign: 'right',
|
|
97
|
+
content: chalk.bold.green(totalItems)
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
hAlign: 'right',
|
|
101
|
+
content: `${chalk.bold.green(helpers.readableBytes(totalBytes, 1, 11))} `
|
|
102
|
+
}
|
|
103
|
+
]);
|
|
104
|
+
return table;
|
|
105
|
+
};
|
|
106
|
+
const DEFAULT_IGNORED_CONTENT_TYPES = [
|
|
107
|
+
'admin::permission',
|
|
108
|
+
'admin::user',
|
|
109
|
+
'admin::role',
|
|
110
|
+
'admin::api-token',
|
|
111
|
+
'admin::api-token-permission',
|
|
112
|
+
'admin::transfer-token',
|
|
113
|
+
'admin::transfer-token-permission',
|
|
114
|
+
'admin::audit-log',
|
|
115
|
+
'plugin::content-releases.release',
|
|
116
|
+
'plugin::content-releases.release-action'
|
|
117
|
+
];
|
|
118
|
+
const abortTransfer = async ({ engine, strapi: strapi1 })=>{
|
|
119
|
+
try {
|
|
120
|
+
await engine.abortTransfer();
|
|
121
|
+
await strapi1.destroy();
|
|
122
|
+
} catch (e) {
|
|
123
|
+
// ignore because there's not much else we can do
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
};
|
|
128
|
+
const setSignalHandler = async (handler, signals = [
|
|
129
|
+
'SIGINT',
|
|
130
|
+
'SIGTERM',
|
|
131
|
+
'SIGQUIT'
|
|
132
|
+
])=>{
|
|
133
|
+
signals.forEach((signal)=>{
|
|
134
|
+
// We specifically remove ALL listeners because we have to clear the one added in Strapi bootstrap that has a process.exit
|
|
135
|
+
// TODO: Ideally Strapi bootstrap would not add that listener, and then this could be more flexible and add/remove only what it needs to
|
|
136
|
+
process.removeAllListeners(signal);
|
|
137
|
+
process.on(signal, handler);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const createStrapiInstance = async (opts = {})=>{
|
|
141
|
+
try {
|
|
142
|
+
const appContext = await core.compileStrapi();
|
|
143
|
+
const app = core.createStrapi({
|
|
144
|
+
...opts,
|
|
145
|
+
...appContext
|
|
146
|
+
});
|
|
147
|
+
app.log.level = opts.logLevel || 'error';
|
|
148
|
+
return await app.load();
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (error instanceof Error && 'code' in error && error.code === 'ECONNREFUSED') {
|
|
151
|
+
throw new Error('Process failed. Check the database connection with your Strapi project.');
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const transferDataTypes = Object.keys(dataTransfer.engine.TransferGroupPresets);
|
|
157
|
+
const throttleOption = new commander.Option('--throttle <delay after each entity>', `Add a delay in milliseconds between each transferred entity`).argParser(commander$1.parseInteger).hideHelp(); // This option is not publicly documented
|
|
158
|
+
const excludeOption = new commander.Option('--exclude <comma-separated data types>', `Exclude data using comma-separated types. Available types: ${transferDataTypes.join(',')}`).argParser(commander$1.getParseListWithChoices(transferDataTypes, 'Invalid options for "exclude"'));
|
|
159
|
+
const onlyOption = new commander.Option('--only <command-separated data types>', `Include only these types of data (plus schemas). Available types: ${transferDataTypes.join(',')}`).argParser(commander$1.getParseListWithChoices(transferDataTypes, 'Invalid options for "only"'));
|
|
160
|
+
const validateExcludeOnly = (command)=>{
|
|
161
|
+
const { exclude, only } = command.opts();
|
|
162
|
+
if (!only || !exclude) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const choicesInBoth = only.filter((n)=>{
|
|
166
|
+
return exclude.indexOf(n) !== -1;
|
|
167
|
+
});
|
|
168
|
+
if (choicesInBoth.length > 0) {
|
|
169
|
+
helpers.exitWith(1, `Data types may not be used in both "exclude" and "only" in the same command. Found in both: ${choicesInBoth.join(',')}`);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const errorColors = {
|
|
173
|
+
fatal: chalk.red,
|
|
174
|
+
error: chalk.red,
|
|
175
|
+
silly: chalk.yellow
|
|
176
|
+
};
|
|
177
|
+
const formatDiagnostic = (operation, info)=>{
|
|
178
|
+
// Create log file for all incoming diagnostics
|
|
179
|
+
let logger$1;
|
|
180
|
+
const getLogger = ()=>{
|
|
181
|
+
if (!logger$1) {
|
|
182
|
+
logger$1 = logger.createLogger(logger.configs.createOutputFileConfiguration(`${operation}_${Date.now()}.log`, {
|
|
183
|
+
level: 'info',
|
|
184
|
+
format: logger.formats?.detailedLogs
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
return logger$1;
|
|
188
|
+
};
|
|
189
|
+
// We don't want to write a log file until there is something to be logged
|
|
190
|
+
return ({ details, kind })=>{
|
|
191
|
+
try {
|
|
192
|
+
if (kind === 'error') {
|
|
193
|
+
const { message, severity = 'fatal' } = details;
|
|
194
|
+
const colorizeError = errorColors[severity];
|
|
195
|
+
const errorMessage = colorizeError(`[${severity.toUpperCase()}] ${message}`);
|
|
196
|
+
getLogger().error(errorMessage);
|
|
197
|
+
}
|
|
198
|
+
if (kind === 'info' && info) {
|
|
199
|
+
const { message, params, origin } = details;
|
|
200
|
+
const msg = `[${origin ?? 'transfer'}] ${message}\n${params ? JSON.stringify(params, null, 2) : ''}`;
|
|
201
|
+
getLogger().info(msg);
|
|
202
|
+
}
|
|
203
|
+
if (kind === 'warning') {
|
|
204
|
+
const { origin, message } = details;
|
|
205
|
+
getLogger().warn(`(${origin ?? 'transfer'}) ${message}`);
|
|
206
|
+
}
|
|
207
|
+
} catch (err) {
|
|
208
|
+
getLogger().error(err);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
const loadersFactory = (defaultLoaders = {})=>{
|
|
213
|
+
const loaders = defaultLoaders;
|
|
214
|
+
const updateLoader = (stage, data)=>{
|
|
215
|
+
if (!(stage in loaders)) {
|
|
216
|
+
createLoader(stage);
|
|
217
|
+
}
|
|
218
|
+
const stageData = data[stage];
|
|
219
|
+
const elapsedTime = stageData?.startTime ? (stageData?.endTime || Date.now()) - stageData.startTime : 0;
|
|
220
|
+
const size = `size: ${helpers.readableBytes(stageData?.bytes ?? 0)}`;
|
|
221
|
+
const elapsed = `elapsed: ${elapsedTime} ms`;
|
|
222
|
+
const speed = elapsedTime > 0 ? `(${helpers.readableBytes((stageData?.bytes ?? 0) * 1000 / elapsedTime)}/s)` : '';
|
|
223
|
+
loaders[stage].text = `${stage}: ${stageData?.count ?? 0} transfered (${size}) (${elapsed}) ${!stageData?.endTime ? speed : ''}`;
|
|
224
|
+
return loaders[stage];
|
|
225
|
+
};
|
|
226
|
+
const createLoader = (stage)=>{
|
|
227
|
+
Object.assign(loaders, {
|
|
228
|
+
[stage]: ora()
|
|
229
|
+
});
|
|
230
|
+
return loaders[stage];
|
|
231
|
+
};
|
|
232
|
+
const getLoader = (stage)=>{
|
|
233
|
+
return loaders[stage];
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
updateLoader,
|
|
237
|
+
createLoader,
|
|
238
|
+
getLoader
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Get the telemetry data to be sent for a didDEITSProcess* event from an initialized transfer engine object
|
|
243
|
+
*/ const getTransferTelemetryPayload = (engine)=>{
|
|
244
|
+
return {
|
|
245
|
+
eventProperties: {
|
|
246
|
+
source: engine?.sourceProvider?.name,
|
|
247
|
+
destination: engine?.destinationProvider?.name
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Get a transfer engine schema diff handler that confirms with the user before bypassing a schema check
|
|
253
|
+
*/ const getDiffHandler = (engine, { force, action })=>{
|
|
254
|
+
return async (context, next)=>{
|
|
255
|
+
// if we abort here, we need to actually exit the process because of conflict with inquirer prompt
|
|
256
|
+
setSignalHandler(async ()=>{
|
|
257
|
+
await abortTransfer({
|
|
258
|
+
engine,
|
|
259
|
+
strapi: strapi
|
|
260
|
+
});
|
|
261
|
+
helpers.exitWith(1, exitMessageText(action, true));
|
|
262
|
+
});
|
|
263
|
+
let workflowsStatus;
|
|
264
|
+
const source = 'Schema Integrity';
|
|
265
|
+
Object.entries(context.diffs).forEach(([uid, diffs])=>{
|
|
266
|
+
for (const diff of diffs){
|
|
267
|
+
const path = [
|
|
268
|
+
uid
|
|
269
|
+
].concat(diff.path).join('.');
|
|
270
|
+
const endPath = diff.path[diff.path.length - 1];
|
|
271
|
+
// Catch known features
|
|
272
|
+
if (uid === 'plugin::review-workflows.workflow' || uid === 'plugin::review-workflows.workflow-stage' || endPath?.startsWith('strapi_stage') || endPath?.startsWith('strapi_assignee')) {
|
|
273
|
+
workflowsStatus = diff.kind;
|
|
274
|
+
} else if (diff.kind === 'added') {
|
|
275
|
+
engine.reportWarning(chalk.red(`${chalk.bold(path)} does not exist on source`), source);
|
|
276
|
+
} else if (diff.kind === 'deleted') {
|
|
277
|
+
engine.reportWarning(chalk.red(`${chalk.bold(path)} does not exist on destination`), source);
|
|
278
|
+
} else if (diff.kind === 'modified') {
|
|
279
|
+
engine.reportWarning(chalk.red(`${chalk.bold(path)} has a different data type`), source);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
// output the known feature warnings
|
|
284
|
+
if (workflowsStatus === 'added') {
|
|
285
|
+
engine.reportWarning(chalk.red(`Review workflows feature does not exist on source`), source);
|
|
286
|
+
} else if (workflowsStatus === 'deleted') {
|
|
287
|
+
engine.reportWarning(chalk.red(`Review workflows feature does not exist on destination`), source);
|
|
288
|
+
} else if (workflowsStatus === 'modified') {
|
|
289
|
+
engine.panic(new TransferEngineInitializationError('Unresolved differences in schema [review workflows]'));
|
|
290
|
+
}
|
|
291
|
+
const confirmed = await commander$1.confirmMessage('There are differences in schema between the source and destination, and the data listed above will be lost. Are you sure you want to continue?', {
|
|
292
|
+
force
|
|
293
|
+
});
|
|
294
|
+
// reset handler back to normal
|
|
295
|
+
setSignalHandler(()=>abortTransfer({
|
|
296
|
+
engine,
|
|
297
|
+
strapi: strapi
|
|
298
|
+
}));
|
|
299
|
+
if (confirmed) {
|
|
300
|
+
context.ignoredDiffs = fp.merge(context.diffs, context.ignoredDiffs);
|
|
301
|
+
}
|
|
302
|
+
return next(context);
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
const getAssetsBackupHandler = (engine, { force, action })=>{
|
|
306
|
+
return async (context, next)=>{
|
|
307
|
+
// if we abort here, we need to actually exit the process because of conflict with inquirer prompt
|
|
308
|
+
setSignalHandler(async ()=>{
|
|
309
|
+
await abortTransfer({
|
|
310
|
+
engine,
|
|
311
|
+
strapi: strapi
|
|
312
|
+
});
|
|
313
|
+
helpers.exitWith(1, exitMessageText(action, true));
|
|
314
|
+
});
|
|
315
|
+
console.warn('The backup for the assets could not be created inside the public directory. Ensure Strapi has write permissions on the public directory.');
|
|
316
|
+
const confirmed = await commander$1.confirmMessage('Do you want to continue without backing up your public/uploads files?', {
|
|
317
|
+
force
|
|
318
|
+
});
|
|
319
|
+
if (confirmed) {
|
|
320
|
+
context.ignore = true;
|
|
321
|
+
}
|
|
322
|
+
// reset handler back to normal
|
|
323
|
+
setSignalHandler(()=>abortTransfer({
|
|
324
|
+
engine,
|
|
325
|
+
strapi: strapi
|
|
326
|
+
}));
|
|
327
|
+
return next(context);
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
const shouldSkipStage = (opts, dataKind)=>{
|
|
331
|
+
if (opts.exclude?.includes(dataKind)) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (opts.only) {
|
|
335
|
+
return !opts.only.includes(dataKind);
|
|
336
|
+
}
|
|
337
|
+
return false;
|
|
338
|
+
};
|
|
339
|
+
// Based on exclude/only from options, create the restore object to match
|
|
340
|
+
const parseRestoreFromOptions = (opts)=>{
|
|
341
|
+
const entitiesOptions = {
|
|
342
|
+
exclude: DEFAULT_IGNORED_CONTENT_TYPES,
|
|
343
|
+
include: undefined
|
|
344
|
+
};
|
|
345
|
+
// if content is not included, send an empty array for include
|
|
346
|
+
if (opts.only && !opts.only.includes('content') || opts.exclude?.includes('content')) {
|
|
347
|
+
entitiesOptions.include = [];
|
|
348
|
+
}
|
|
349
|
+
const restoreConfig = {
|
|
350
|
+
entities: entitiesOptions,
|
|
351
|
+
assets: !shouldSkipStage(opts, 'files'),
|
|
352
|
+
configuration: {
|
|
353
|
+
webhook: !shouldSkipStage(opts, 'config'),
|
|
354
|
+
coreStore: !shouldSkipStage(opts, 'config')
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
return restoreConfig;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
exports.DEFAULT_IGNORED_CONTENT_TYPES = DEFAULT_IGNORED_CONTENT_TYPES;
|
|
361
|
+
exports.abortTransfer = abortTransfer;
|
|
362
|
+
exports.buildTransferTable = buildTransferTable;
|
|
363
|
+
exports.createStrapiInstance = createStrapiInstance;
|
|
364
|
+
exports.excludeOption = excludeOption;
|
|
365
|
+
exports.exitMessageText = exitMessageText;
|
|
366
|
+
exports.formatDiagnostic = formatDiagnostic;
|
|
367
|
+
exports.getAssetsBackupHandler = getAssetsBackupHandler;
|
|
368
|
+
exports.getDefaultExportName = getDefaultExportName;
|
|
369
|
+
exports.getDiffHandler = getDiffHandler;
|
|
370
|
+
exports.getTransferTelemetryPayload = getTransferTelemetryPayload;
|
|
371
|
+
exports.loadersFactory = loadersFactory;
|
|
372
|
+
exports.onlyOption = onlyOption;
|
|
373
|
+
exports.parseRestoreFromOptions = parseRestoreFromOptions;
|
|
374
|
+
exports.setSignalHandler = setSignalHandler;
|
|
375
|
+
exports.shouldSkipStage = shouldSkipStage;
|
|
376
|
+
exports.throttleOption = throttleOption;
|
|
377
|
+
exports.validateExcludeOnly = validateExcludeOnly;
|
|
378
|
+
//# sourceMappingURL=data-transfer.js.map
|