@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,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
var inquirer = require('inquirer');
|
|
5
|
+
var commander = require('commander');
|
|
6
|
+
var core = require('@strapi/core');
|
|
7
|
+
var helpers = require('../../utils/helpers.js');
|
|
8
|
+
|
|
9
|
+
const promptQuestions = [
|
|
10
|
+
{
|
|
11
|
+
type: 'input',
|
|
12
|
+
name: 'email',
|
|
13
|
+
message: 'User email?'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'password',
|
|
17
|
+
name: 'password',
|
|
18
|
+
message: 'New password?'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'confirm',
|
|
22
|
+
name: 'confirm',
|
|
23
|
+
message: "Do you really want to reset this user's password?"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
async function changePassword({ email, password }) {
|
|
27
|
+
const appContext = await core.compileStrapi();
|
|
28
|
+
const app = await core.createStrapi(appContext).load();
|
|
29
|
+
await app.admin.services.user.resetPasswordByEmail(email, password);
|
|
30
|
+
console.log(`Successfully reset user's password`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reset user's password
|
|
35
|
+
*/ const action = async (cmdOptions = {})=>{
|
|
36
|
+
const { email, password } = cmdOptions;
|
|
37
|
+
if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {
|
|
38
|
+
const inquiry = await inquirer.prompt(promptQuestions);
|
|
39
|
+
if (!inquiry.confirm) {
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
return changePassword(inquiry);
|
|
43
|
+
}
|
|
44
|
+
if (_.isEmpty(email) || _.isEmpty(password)) {
|
|
45
|
+
console.error('Missing required options `email` or `password`');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
return changePassword({
|
|
49
|
+
email,
|
|
50
|
+
password
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* `$ strapi admin:reset-user-password`
|
|
55
|
+
*/ const command = ()=>{
|
|
56
|
+
return commander.createCommand('admin:reset-user-password').alias('admin:reset-password').description("Reset an admin user's password").option('-e, --email <email>', 'The user email').option('-p, --password <password>', 'New password for the user').action(helpers.runAction('admin:reset-user-password', action));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.action = action;
|
|
60
|
+
exports.command = command;
|
|
61
|
+
//# sourceMappingURL=reset-user-password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-user-password.js","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAmBA,MAAMA,eAAqE,GAAA;AACzE,IAAA;QAAEC,IAAM,EAAA,OAAA;QAASC,IAAM,EAAA,OAAA;QAASC,OAAS,EAAA;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAM,EAAA,UAAA;QAAYC,IAAM,EAAA,UAAA;QAAYC,OAAS,EAAA;AAAgB,KAAA;AAC/D,IAAA;QACEF,IAAM,EAAA,SAAA;QACNC,IAAM,EAAA,SAAA;QACNC,OAAS,EAAA;AACX;AACD,CAAA;AAED,eAAeC,cAAe,CAAA,EAAEC,KAAK,EAAEC,QAAQ,EAAc,EAAA;AAC3D,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,MAAMF,GAAAA,CAAIG,KAAK,CAAEC,QAAQ,CAACC,IAAI,CAACC,oBAAoB,CAACV,KAAOC,EAAAA,QAAAA,CAAAA;AA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6BhB,EAAAA,MAAAA,CAAAA,CAAAA;AACnD;;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import { createCommand } from 'commander';
|
|
4
|
+
import { compileStrapi, createStrapi } from '@strapi/core';
|
|
5
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
6
|
+
|
|
7
|
+
const promptQuestions = [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'email',
|
|
11
|
+
message: 'User email?'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'password',
|
|
15
|
+
name: 'password',
|
|
16
|
+
message: 'New password?'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'confirm',
|
|
20
|
+
name: 'confirm',
|
|
21
|
+
message: "Do you really want to reset this user's password?"
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
async function changePassword({ email, password }) {
|
|
25
|
+
const appContext = await compileStrapi();
|
|
26
|
+
const app = await createStrapi(appContext).load();
|
|
27
|
+
await app.admin.services.user.resetPasswordByEmail(email, password);
|
|
28
|
+
console.log(`Successfully reset user's password`);
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reset user's password
|
|
33
|
+
*/ const action = async (cmdOptions = {})=>{
|
|
34
|
+
const { email, password } = cmdOptions;
|
|
35
|
+
if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {
|
|
36
|
+
const inquiry = await inquirer.prompt(promptQuestions);
|
|
37
|
+
if (!inquiry.confirm) {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
return changePassword(inquiry);
|
|
41
|
+
}
|
|
42
|
+
if (_.isEmpty(email) || _.isEmpty(password)) {
|
|
43
|
+
console.error('Missing required options `email` or `password`');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
return changePassword({
|
|
47
|
+
email,
|
|
48
|
+
password
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* `$ strapi admin:reset-user-password`
|
|
53
|
+
*/ const command = ()=>{
|
|
54
|
+
return createCommand('admin:reset-user-password').alias('admin:reset-password').description("Reset an admin user's password").option('-e, --email <email>', 'The user email').option('-p, --password <password>', 'New password for the user').action(runAction('admin:reset-user-password', action));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { action, command };
|
|
58
|
+
//# sourceMappingURL=reset-user-password.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-user-password.mjs","sources":["../../../../../src/cli/commands/admin/reset-user-password.ts"],"sourcesContent":["import _ from 'lodash';\nimport inquirer from 'inquirer';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n email?: string;\n password?: string;\n}\n\ninterface Answers {\n email: string;\n password: string;\n confirm: boolean;\n}\n\nconst promptQuestions: ReadonlyArray<inquirer.DistinctQuestion<Answers>> = [\n { type: 'input', name: 'email', message: 'User email?' },\n { type: 'password', name: 'password', message: 'New password?' },\n {\n type: 'confirm',\n name: 'confirm',\n message: \"Do you really want to reset this user's password?\",\n },\n];\n\nasync function changePassword({ email, password }: CmdOptions) {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n await app.admin!.services.user.resetPasswordByEmail(email, password);\n\n console.log(`Successfully reset user's password`);\n process.exit(0);\n}\n\n/**\n * Reset user's password\n */\nconst action = async (cmdOptions: CmdOptions = {}) => {\n const { email, password } = cmdOptions;\n\n if (_.isEmpty(email) && _.isEmpty(password) && process.stdin.isTTY) {\n const inquiry = await inquirer.prompt(promptQuestions);\n\n if (!inquiry.confirm) {\n process.exit(0);\n }\n\n return changePassword(inquiry);\n }\n\n if (_.isEmpty(email) || _.isEmpty(password)) {\n console.error('Missing required options `email` or `password`');\n process.exit(1);\n }\n\n return changePassword({ email, password });\n};\n\n/**\n * `$ strapi admin:reset-user-password`\n */\nconst command: StrapiCommand = () => {\n return createCommand('admin:reset-user-password')\n .alias('admin:reset-password')\n .description(\"Reset an admin user's password\")\n .option('-e, --email <email>', 'The user email')\n .option('-p, --password <password>', 'New password for the user')\n .action(runAction('admin:reset-user-password', action));\n};\n\nexport { action, command };\n"],"names":["promptQuestions","type","name","message","changePassword","email","password","appContext","compileStrapi","app","createStrapi","load","admin","services","user","resetPasswordByEmail","console","log","process","exit","action","cmdOptions","_","isEmpty","stdin","isTTY","inquiry","inquirer","prompt","confirm","error","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;AAmBA,MAAMA,eAAqE,GAAA;AACzE,IAAA;QAAEC,IAAM,EAAA,OAAA;QAASC,IAAM,EAAA,OAAA;QAASC,OAAS,EAAA;AAAc,KAAA;AACvD,IAAA;QAAEF,IAAM,EAAA,UAAA;QAAYC,IAAM,EAAA,UAAA;QAAYC,OAAS,EAAA;AAAgB,KAAA;AAC/D,IAAA;QACEF,IAAM,EAAA,SAAA;QACNC,IAAM,EAAA,SAAA;QACNC,OAAS,EAAA;AACX;AACD,CAAA;AAED,eAAeC,cAAe,CAAA,EAAEC,KAAK,EAAEC,QAAQ,EAAc,EAAA;AAC3D,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,MAAMF,GAAAA,CAAIG,KAAK,CAAEC,QAAQ,CAACC,IAAI,CAACC,oBAAoB,CAACV,KAAOC,EAAAA,QAAAA,CAAAA;AAE3DU,IAAAA,OAAAA,CAAQC,GAAG,CAAC,CAAC,kCAAkC,CAAC,CAAA;AAChDC,IAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,IACKC,MAAAA,MAAAA,GAAS,OA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+
var errors = require('../../node/core/errors.js');
|
|
6
|
+
|
|
7
|
+
const action = async (options)=>{
|
|
8
|
+
try {
|
|
9
|
+
if (options.bundler === 'webpack') {
|
|
10
|
+
options.logger.warn('[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.');
|
|
11
|
+
}
|
|
12
|
+
await build.build(options);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
errors.handleUnexpectedError(err);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* `$ strapi build`
|
|
19
|
+
*/ const command = ({ ctx })=>{
|
|
20
|
+
return commander.createCommand('build').option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite').option('-d, --debug', 'Enable debugging mode with verbose logs', false).option('--minify', 'Minify the output', true).option('--silent', "Don't log anything", false).option('--sourcemap', 'Produce sourcemaps', false).option('--stats', 'Print build statistics to the console', false).description('Build the strapi admin app').action(async (options)=>{
|
|
21
|
+
return action({
|
|
22
|
+
...options,
|
|
23
|
+
...ctx
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.command = command;
|
|
29
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAW,EAAA;YACjCD,OAAQE,CAAAA,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ;AAEA,QAAA,MAAMC,WAAUJ,CAAAA,OAAAA,CAAAA;AAClB,KAAA,CAAE,OAAOK,GAAK,EAAA;QACZC,4BAAsBD,CAAAA,GAAAA,CAAAA;AACxB;AACF,CAAA;AAEA;;AAEC,IACKE,MAAAA,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,wBAAc,OAClBC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAClEA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KACjEA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IACxCA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KACzCA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAC5CA,CAAAA,CAAAA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAC3DC,CAAAA,CAAAA,WAAW,CAAC,4BACZZ,CAAAA,CAAAA,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAO,CAAA;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,KAAA,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
import { build } from '../../node/build.mjs';
|
|
3
|
+
import { handleUnexpectedError } from '../../node/core/errors.mjs';
|
|
4
|
+
|
|
5
|
+
const action = async (options)=>{
|
|
6
|
+
try {
|
|
7
|
+
if (options.bundler === 'webpack') {
|
|
8
|
+
options.logger.warn('[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.');
|
|
9
|
+
}
|
|
10
|
+
await build(options);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
handleUnexpectedError(err);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `$ strapi build`
|
|
17
|
+
*/ const command = ({ ctx })=>{
|
|
18
|
+
return createCommand('build').option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite').option('-d, --debug', 'Enable debugging mode with verbose logs', false).option('--minify', 'Minify the output', true).option('--silent', "Don't log anything", false).option('--sourcemap', 'Produce sourcemaps', false).option('--stats', 'Print build statistics to the console', false).description('Build the strapi admin app').action(async (options)=>{
|
|
19
|
+
return action({
|
|
20
|
+
...options,
|
|
21
|
+
...ctx
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { command };
|
|
27
|
+
//# sourceMappingURL=build.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.mjs","sources":["../../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["action","options","bundler","logger","warn","nodeBuild","err","handleUnexpectedError","command","ctx","createCommand","option","description"],"mappings":";;;;AAQA,MAAMA,SAAS,OAAOC,OAAAA,GAAAA;IACpB,IAAI;QACF,IAAIA,OAAAA,CAAQC,OAAO,KAAK,SAAW,EAAA;YACjCD,OAAQE,CAAAA,MAAM,CAACC,IAAI,CACjB,yFAAA,CAAA;AAEJ;AAEA,QAAA,MAAMC,KAAUJ,CAAAA,OAAAA,CAAAA;AAClB,KAAA,CAAE,OAAOK,GAAK,EAAA;QACZC,qBAAsBD,CAAAA,GAAAA,CAAAA;AACxB;AACF,CAAA;AAEA;;AAEC,IACKE,MAAAA,OAAAA,GAAyB,CAAC,EAAEC,GAAG,EAAE,GAAA;AACrC,IAAA,OAAOC,cAAc,OAClBC,CAAAA,CAAAA,MAAM,CAAC,qBAAA,EAAuB,oCAAoC,MAClEA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,2CAA2C,KACjEA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,qBAAqB,IACxCA,CAAAA,CAAAA,MAAM,CAAC,UAAA,EAAY,sBAAsB,KACzCA,CAAAA,CAAAA,MAAM,CAAC,aAAA,EAAe,sBAAsB,KAC5CA,CAAAA,CAAAA,MAAM,CAAC,SAAA,EAAW,yCAAyC,KAC3DC,CAAAA,CAAAA,WAAW,CAAC,4BACZZ,CAAAA,CAAAA,MAAM,CAAC,OAAOC,OAAAA,GAAAA;AACb,QAAA,OAAOD,MAAO,CAAA;AAAE,YAAA,GAAGC,OAAO;AAAE,YAAA,GAAGQ;AAAI,SAAA,CAAA;AACrC,KAAA,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commander = require('commander');
|
|
4
|
+
var CLITable = require('cli-table3');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var core = require('@strapi/core');
|
|
7
|
+
var helpers = require('../../utils/helpers.js');
|
|
8
|
+
|
|
9
|
+
const action = async ()=>{
|
|
10
|
+
const appContext = await core.compileStrapi();
|
|
11
|
+
const app = await core.createStrapi(appContext).register();
|
|
12
|
+
const list = Object.keys(app.components);
|
|
13
|
+
const infoTable = new CLITable({
|
|
14
|
+
head: [
|
|
15
|
+
chalk.blue('Name')
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
list.forEach((name)=>infoTable.push([
|
|
19
|
+
name
|
|
20
|
+
]));
|
|
21
|
+
console.log(infoTable.toString());
|
|
22
|
+
await app.destroy();
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `$ strapi components:list`
|
|
26
|
+
*/ const command = ()=>{
|
|
27
|
+
return commander.createCommand('components:list').description('List all the application components').action(helpers.runAction('components:list', action));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.action = action;
|
|
31
|
+
exports.command = command;
|
|
32
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOC,GAAAA,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAASN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,kBAAU,iBAAmBzB,EAAAA,MAAAA,CAAAA,CAAAA;AACzC;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
import CLITable from 'cli-table3';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { compileStrapi, createStrapi } from '@strapi/core';
|
|
5
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
6
|
+
|
|
7
|
+
const action = async ()=>{
|
|
8
|
+
const appContext = await compileStrapi();
|
|
9
|
+
const app = await createStrapi(appContext).register();
|
|
10
|
+
const list = Object.keys(app.components);
|
|
11
|
+
const infoTable = new CLITable({
|
|
12
|
+
head: [
|
|
13
|
+
chalk.blue('Name')
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
list.forEach((name)=>infoTable.push([
|
|
17
|
+
name
|
|
18
|
+
]));
|
|
19
|
+
console.log(infoTable.toString());
|
|
20
|
+
await app.destroy();
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* `$ strapi components:list`
|
|
24
|
+
*/ const command = ()=>{
|
|
25
|
+
return createCommand('components:list').description('List all the application components').action(runAction('components:list', action));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { action, command };
|
|
29
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/components/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n const list = Object.keys(app.components);\n\n const infoTable = new CLITable({\n head: [chalk.blue('Name')],\n });\n\n list.forEach((name) => infoTable.push([name]));\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi components:list`\n */\nconst command: StrapiCommand = () => {\n return createCommand('components:list')\n .description('List all the application components')\n .action(runAction('components:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","register","list","Object","keys","components","infoTable","CLITable","head","chalk","blue","forEach","name","push","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,QAAQ,EAAA;AAEnD,IAAA,MAAMC,IAAOC,GAAAA,MAAAA,CAAOC,IAAI,CAACL,IAAIM,UAAU,CAAA;IAEvC,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ;AAC5B,KAAA,CAAA;AAEAR,IAAAA,IAAAA,CAAKS,OAAO,CAAC,CAACC,IAASN,GAAAA,SAAAA,CAAUO,IAAI,CAAC;AAACD,YAAAA;AAAK,SAAA,CAAA,CAAA;IAE5CE,OAAQC,CAAAA,GAAG,CAACT,SAAAA,CAAUU,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMjB,IAAIkB,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,mBAClBC,WAAW,CAAC,uCACZxB,MAAM,CAACyB,UAAU,iBAAmBzB,EAAAA,MAAAA,CAAAA,CAAAA;AACzC;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var commander = require('commander');
|
|
5
|
+
var core = require('@strapi/core');
|
|
6
|
+
var helpers = require('../../utils/helpers.js');
|
|
7
|
+
|
|
8
|
+
const CHUNK_SIZE = 100;
|
|
9
|
+
/**
|
|
10
|
+
* Will dump configurations to a file or stdout
|
|
11
|
+
* @param {string} file filepath to use as output
|
|
12
|
+
*/ const action = async ({ file: filePath, pretty })=>{
|
|
13
|
+
const output = filePath ? fs.createWriteStream(filePath) : process.stdout;
|
|
14
|
+
const appContext = await core.compileStrapi();
|
|
15
|
+
const app = await core.createStrapi(appContext).load();
|
|
16
|
+
const count = await app.query('strapi::core-store').count();
|
|
17
|
+
const exportData = [];
|
|
18
|
+
const pageCount = Math.ceil(count / CHUNK_SIZE);
|
|
19
|
+
for(let page = 0; page < pageCount; page += 1){
|
|
20
|
+
const results = await app.query('strapi::core-store').findMany({
|
|
21
|
+
limit: CHUNK_SIZE,
|
|
22
|
+
offset: page * CHUNK_SIZE,
|
|
23
|
+
orderBy: 'key'
|
|
24
|
+
});
|
|
25
|
+
results.filter((result)=>result.key.startsWith('plugin_')).forEach((result)=>{
|
|
26
|
+
exportData.push({
|
|
27
|
+
key: result.key,
|
|
28
|
+
value: result.value,
|
|
29
|
+
type: result.type,
|
|
30
|
+
environment: result.environment,
|
|
31
|
+
tag: result.tag
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);
|
|
36
|
+
output.write(str);
|
|
37
|
+
output.write('\n');
|
|
38
|
+
output.end();
|
|
39
|
+
// log success only when writting to file
|
|
40
|
+
if (filePath) {
|
|
41
|
+
console.log(`Successfully exported ${exportData.length} configuration entries`);
|
|
42
|
+
}
|
|
43
|
+
process.exit(0);
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* `$ strapi configuration:dump`
|
|
47
|
+
*/ const command = ()=>{
|
|
48
|
+
return commander.createCommand('configuration:dump').alias('config:dump').description('Dump configurations of your application').option('-f, --file <file>', 'Output file, default output is stdout').option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false).action(helpers.runAction('configuration:dump', action));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.action = action;
|
|
52
|
+
exports.command = command;
|
|
53
|
+
//# sourceMappingURL=dump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump.js","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;AAyBA,MAAMA,UAAa,GAAA,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAWG,GAAAA,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAYC,GAAAA,IAAAA,CAAKC,IAAI,CAACL,KAAQf,GAAAA,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAO,GAAA,CAAA,EAAGA,IAAOH,GAAAA,SAAAA,EAAWG,QAAQ,CAAG,CAAA;AAC9C,QAAA,MAAMC,UAAU,MAAMV,GAAAA,CACnBI,KAAK,CAAC,oBAAA,CAAA,CACNO,QAAQ,CAAC;YAAEC,KAAOxB,EAAAA,UAAAA;AAAYyB,YAAAA,MAAAA,EAAQJ,IAAOrB,GAAAA,UAAAA;YAAY0B,OAAS,EAAA;AAAM,SAAA,CAAA;AAE3EJ,QAAAA,OAAAA,CACGK,MAAM,CAAC,CAACC,MAAAA,GAAWA,MAAOC,CAAAA,GAAG,CAACC,UAAU,CAAC,SAAA,CAAA,CAAA,CACzCC,OAAO,CAAC,CAACH,MAAAA,GAAAA;AACRX,YAAAA,UAAAA,CAAWe,IAAI,CAAC;AACdH,gBAAAA,GAAAA,EAAKD,OAAOC,GAAG;AACfI,gBAAAA,KAAAA,EAAOL,OAAOK,KAAK;AACnBC,gBAAAA,IAAAA,EAAMN,OAAOM,IAAI;AACjBC,gBAAAA,WAAAA,EAAaP,OAAOO,WAAW;AAC/BC,gBAAAA,GAAAA,EAAKR,OAAOQ;AACd,aAAA,CAAA;AACF,SAAA,CAAA;AACJ;AAEA,IAAA,MAAMC,MAAMC,IAAKC,CAAAA,SAAS,CAACtB,UAAY,EAAA,IAAA,EAAMb,SAAS,CAAIoC,GAAAA,SAAAA,CAAAA;AAE1DnC,IAAAA,MAAAA,CAAOoC,KAAK,CAACJ,GAAAA,CAAAA;AACbhC,IAAAA,MAAAA,CAAOoC,KAAK,CAAC,IAAA,CAAA;AACbpC,IAAAA,MAAAA,CAAOqC,GAAG,EAAA;;AAGV,IAAA,IAAIvC,QAAU,EAAA;QACZwC,OAAQC,CAAAA,GAAG,CAAC,CAAC,sBAAsB,EAAE3B,UAAW4B,CAAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;AAChF;AACArC,IAAAA,OAAAA,CAAQsC,IAAI,CAAC,CAAA,CAAA;AACf;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,sBAClBC,KAAK,CAAC,eACNC,WAAW,CAAC,2CACZC,MAAM,CAAC,qBAAqB,uCAC5BA,CAAAA,CAAAA,MAAM,CAAC,cAAgB,EAAA,yDAAA,EAA2D,OAClFlD,MAAM,CAACmD,kBAAU,oBAAsBnD,EAAAA,MAAAA,CAAAA,CAAAA;AAC5C;;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { createCommand } from 'commander';
|
|
3
|
+
import { compileStrapi, createStrapi } from '@strapi/core';
|
|
4
|
+
import { runAction } from '../../utils/helpers.mjs';
|
|
5
|
+
|
|
6
|
+
const CHUNK_SIZE = 100;
|
|
7
|
+
/**
|
|
8
|
+
* Will dump configurations to a file or stdout
|
|
9
|
+
* @param {string} file filepath to use as output
|
|
10
|
+
*/ const action = async ({ file: filePath, pretty })=>{
|
|
11
|
+
const output = filePath ? fs.createWriteStream(filePath) : process.stdout;
|
|
12
|
+
const appContext = await compileStrapi();
|
|
13
|
+
const app = await createStrapi(appContext).load();
|
|
14
|
+
const count = await app.query('strapi::core-store').count();
|
|
15
|
+
const exportData = [];
|
|
16
|
+
const pageCount = Math.ceil(count / CHUNK_SIZE);
|
|
17
|
+
for(let page = 0; page < pageCount; page += 1){
|
|
18
|
+
const results = await app.query('strapi::core-store').findMany({
|
|
19
|
+
limit: CHUNK_SIZE,
|
|
20
|
+
offset: page * CHUNK_SIZE,
|
|
21
|
+
orderBy: 'key'
|
|
22
|
+
});
|
|
23
|
+
results.filter((result)=>result.key.startsWith('plugin_')).forEach((result)=>{
|
|
24
|
+
exportData.push({
|
|
25
|
+
key: result.key,
|
|
26
|
+
value: result.value,
|
|
27
|
+
type: result.type,
|
|
28
|
+
environment: result.environment,
|
|
29
|
+
tag: result.tag
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);
|
|
34
|
+
output.write(str);
|
|
35
|
+
output.write('\n');
|
|
36
|
+
output.end();
|
|
37
|
+
// log success only when writting to file
|
|
38
|
+
if (filePath) {
|
|
39
|
+
console.log(`Successfully exported ${exportData.length} configuration entries`);
|
|
40
|
+
}
|
|
41
|
+
process.exit(0);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* `$ strapi configuration:dump`
|
|
45
|
+
*/ const command = ()=>{
|
|
46
|
+
return createCommand('configuration:dump').alias('config:dump').description('Dump configurations of your application').option('-f, --file <file>', 'Output file, default output is stdout').option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false).action(runAction('configuration:dump', action));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { action, command };
|
|
50
|
+
//# sourceMappingURL=dump.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump.mjs","sources":["../../../../../src/cli/commands/configuration/dump.ts"],"sourcesContent":["import fs from 'fs';\nimport { createCommand } from 'commander';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n file?: string;\n pretty?: boolean;\n}\n\ninterface ExportItem {\n key: string;\n value: string;\n type: string;\n environment: string;\n tag: string;\n}\n\ninterface Output {\n write(str: string): void;\n end(): void;\n}\n\nconst CHUNK_SIZE = 100;\n\n/**\n * Will dump configurations to a file or stdout\n * @param {string} file filepath to use as output\n */\nconst action = async ({ file: filePath, pretty }: CmdOptions) => {\n const output: Output = filePath ? fs.createWriteStream(filePath) : process.stdout;\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const count = await app.query('strapi::core-store').count();\n\n const exportData: ExportItem[] = [];\n\n const pageCount = Math.ceil(count / CHUNK_SIZE);\n\n for (let page = 0; page < pageCount; page += 1) {\n const results = await app\n .query('strapi::core-store')\n .findMany({ limit: CHUNK_SIZE, offset: page * CHUNK_SIZE, orderBy: 'key' });\n\n results\n .filter((result) => result.key.startsWith('plugin_'))\n .forEach((result) => {\n exportData.push({\n key: result.key,\n value: result.value,\n type: result.type,\n environment: result.environment,\n tag: result.tag,\n });\n });\n }\n\n const str = JSON.stringify(exportData, null, pretty ? 2 : undefined);\n\n output.write(str);\n output.write('\\n');\n output.end();\n\n // log success only when writting to file\n if (filePath) {\n console.log(`Successfully exported ${exportData.length} configuration entries`);\n }\n process.exit(0);\n};\n\n/**\n * `$ strapi configuration:dump`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:dump')\n .alias('config:dump')\n .description('Dump configurations of your application')\n .option('-f, --file <file>', 'Output file, default output is stdout')\n .option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)\n .action(runAction('configuration:dump', action));\n};\n\nexport { action, command };\n"],"names":["CHUNK_SIZE","action","file","filePath","pretty","output","fs","createWriteStream","process","stdout","appContext","compileStrapi","app","createStrapi","load","count","query","exportData","pageCount","Math","ceil","page","results","findMany","limit","offset","orderBy","filter","result","key","startsWith","forEach","push","value","type","environment","tag","str","JSON","stringify","undefined","write","end","console","log","length","exit","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;AAyBA,MAAMA,UAAa,GAAA,GAAA;AAEnB;;;IAIA,MAAMC,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,MAAM,EAAc,GAAA;AAC1D,IAAA,MAAMC,SAAiBF,QAAWG,GAAAA,EAAAA,CAAGC,iBAAiB,CAACJ,QAAAA,CAAAA,GAAYK,QAAQC,MAAM;AAEjF,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,QAAQ,MAAMH,GAAAA,CAAII,KAAK,CAAC,sBAAsBD,KAAK,EAAA;AAEzD,IAAA,MAAME,aAA2B,EAAE;AAEnC,IAAA,MAAMC,SAAYC,GAAAA,IAAAA,CAAKC,IAAI,CAACL,KAAQf,GAAAA,UAAAA,CAAAA;AAEpC,IAAA,IAAK,IAAIqB,IAAO,GAAA,CAAA,EAAGA,IAAOH,GAAAA,SAAAA,EAAWG,QAAQ,CAAG,CAAA;AAC9C,QAAA,MAAMC,UAAU,MAAMV,GAAAA,CACnBI,KAAK,CAAC,oBAAA,CAAA,CACNO,QAAQ,CAAC;YAAEC,KAAOxB,EAAAA,UAAAA;AAAYyB,YAAAA,MAAAA,EAAQJ,IAAOrB,GAAAA,UAAAA;YAAY0B,OAAS,EAAA;AAAM,SAAA,CAAA;AAE3EJ,QAAAA,OAAAA,CACGK,MAAM,CAAC,CAACC,MAAAA,GAAWA,MAAOC,CAAAA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
|
5
|
+
var _ = require('lodash');
|
|
6
|
+
var core = require('@strapi/core');
|
|
7
|
+
var helpers = require('../../utils/helpers.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Will restore configurations. It reads from a file or stdin
|
|
11
|
+
*/ const action = async ({ file: filePath, strategy = 'replace' })=>{
|
|
12
|
+
const input = filePath ? fs.readFileSync(filePath) : await readStdin();
|
|
13
|
+
const appContext = await core.compileStrapi();
|
|
14
|
+
const app = await core.createStrapi(appContext).load();
|
|
15
|
+
let dataToImport;
|
|
16
|
+
try {
|
|
17
|
+
dataToImport = JSON.parse(_.toString(input));
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error instanceof Error) {
|
|
20
|
+
throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
if (!Array.isArray(dataToImport)) {
|
|
25
|
+
throw new Error(`Invalid input data. Expected a valid JSON array.`);
|
|
26
|
+
}
|
|
27
|
+
if (!app.db) {
|
|
28
|
+
throw new Error('Cannot import configuration without a database connection.');
|
|
29
|
+
}
|
|
30
|
+
const importer = createImporter(app.db, strategy);
|
|
31
|
+
for (const config of dataToImport){
|
|
32
|
+
await importer.import(config);
|
|
33
|
+
}
|
|
34
|
+
console.log(`Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
};
|
|
37
|
+
const readStdin = ()=>{
|
|
38
|
+
const { stdin } = process;
|
|
39
|
+
let result = '';
|
|
40
|
+
if (stdin.isTTY) return Promise.resolve(result);
|
|
41
|
+
return new Promise((resolve, reject)=>{
|
|
42
|
+
stdin.setEncoding('utf8');
|
|
43
|
+
stdin.on('readable', ()=>{
|
|
44
|
+
let chunk;
|
|
45
|
+
// eslint-disable-next-line no-cond-assign
|
|
46
|
+
while(chunk = stdin.read()){
|
|
47
|
+
result += chunk;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
stdin.on('end', ()=>{
|
|
51
|
+
resolve(result);
|
|
52
|
+
});
|
|
53
|
+
stdin.on('error', reject);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const createImporter = (db, strategy)=>{
|
|
57
|
+
switch(strategy){
|
|
58
|
+
case 'replace':
|
|
59
|
+
return createReplaceImporter(db);
|
|
60
|
+
case 'merge':
|
|
61
|
+
return createMergeImporter(db);
|
|
62
|
+
case 'keep':
|
|
63
|
+
return createKeepImporter(db);
|
|
64
|
+
default:
|
|
65
|
+
throw new Error(`No importer available for strategy "${strategy}"`);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Replace importer. Will replace the keys that already exist and create the new ones
|
|
70
|
+
*/ const createReplaceImporter = (db)=>{
|
|
71
|
+
const stats = {
|
|
72
|
+
created: 0,
|
|
73
|
+
replaced: 0
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
printStatistics () {
|
|
77
|
+
return `${stats.created} created, ${stats.replaced} replaced`;
|
|
78
|
+
},
|
|
79
|
+
async import (conf) {
|
|
80
|
+
const matching = await db.query('strapi::core-store').count({
|
|
81
|
+
where: {
|
|
82
|
+
key: conf.key
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (matching > 0) {
|
|
86
|
+
stats.replaced += 1;
|
|
87
|
+
await db.query('strapi::core-store').update({
|
|
88
|
+
where: {
|
|
89
|
+
key: conf.key
|
|
90
|
+
},
|
|
91
|
+
data: conf
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
stats.created += 1;
|
|
95
|
+
await db.query('strapi::core-store').create({
|
|
96
|
+
data: conf
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Merge importer. Will merge the keys that already exist with their new value and create the new ones
|
|
104
|
+
*/ const createMergeImporter = (db)=>{
|
|
105
|
+
const stats = {
|
|
106
|
+
created: 0,
|
|
107
|
+
merged: 0
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
printStatistics () {
|
|
111
|
+
return `${stats.created} created, ${stats.merged} merged`;
|
|
112
|
+
},
|
|
113
|
+
async import (conf) {
|
|
114
|
+
const existingConf = await db.query('strapi::core-store').findOne({
|
|
115
|
+
where: {
|
|
116
|
+
key: conf.key
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
if (existingConf) {
|
|
120
|
+
stats.merged += 1;
|
|
121
|
+
await db.query('strapi::core-store').update({
|
|
122
|
+
where: {
|
|
123
|
+
key: conf.key
|
|
124
|
+
},
|
|
125
|
+
data: _.merge(existingConf, conf)
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
stats.created += 1;
|
|
129
|
+
await db.query('strapi::core-store').create({
|
|
130
|
+
data: conf
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Merge importer. Will keep the keys that already exist without changing them and create the new ones
|
|
138
|
+
*/ const createKeepImporter = (db)=>{
|
|
139
|
+
const stats = {
|
|
140
|
+
created: 0,
|
|
141
|
+
untouched: 0
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
printStatistics () {
|
|
145
|
+
return `${stats.created} created, ${stats.untouched} untouched`;
|
|
146
|
+
},
|
|
147
|
+
async import (conf) {
|
|
148
|
+
const matching = await db.query('strapi::core-store').count({
|
|
149
|
+
where: {
|
|
150
|
+
key: conf.key
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if (matching > 0) {
|
|
154
|
+
stats.untouched += 1;
|
|
155
|
+
// if configuration already exists do not overwrite it
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
stats.created += 1;
|
|
159
|
+
await db.query('strapi::core-store').create({
|
|
160
|
+
data: conf
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* `$ strapi configuration:restore`
|
|
167
|
+
*/ const command = ()=>{
|
|
168
|
+
return commander.createCommand('configuration:restore').alias('config:restore').description('Restore configurations of your application').option('-f, --file <file>', 'Input file, default input is stdin').option('-s, --strategy <strategy>', 'Strategy name, one of: "replace", "merge", "keep"').action(helpers.runAction('configuration:restore', action));
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
exports.action = action;
|
|
172
|
+
exports.command = command;
|
|
173
|
+
//# sourceMappingURL=restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.js","sources":["../../../../../src/cli/commands/configuration/restore.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport { createStrapi, compileStrapi } from '@strapi/core';\nimport type { Database } from '@strapi/database';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ntype Strategy = 'replace' | 'merge' | 'keep';\n\ninterface CmdOptions {\n file?: string;\n strategy?: Strategy;\n}\n\n/**\n * Will restore configurations. It reads from a file or stdin\n */\nconst action = async ({ file: filePath, strategy = 'replace' }: CmdOptions) => {\n const input = filePath ? fs.readFileSync(filePath) : await readStdin();\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n let dataToImport;\n try {\n dataToImport = JSON.parse(_.toString(input));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid input data: ${error.message}. Expected a valid JSON array.`);\n }\n\n throw error;\n }\n\n if (!Array.isArray(dataToImport)) {\n throw new Error(`Invalid input data. Expected a valid JSON array.`);\n }\n\n if (!app.db) {\n throw new Error('Cannot import configuration without a database connection.');\n }\n\n const importer = createImporter(app.db, strategy);\n\n for (const config of dataToImport) {\n await importer.import(config);\n }\n\n console.log(\n `Successfully imported configuration with ${strategy} strategy. Statistics: ${importer.printStatistics()}.`\n );\n\n process.exit(0);\n};\n\nconst readStdin = () => {\n const { stdin } = process;\n let result = '';\n\n if (stdin.isTTY) return Promise.resolve(result);\n\n return new Promise((resolve, reject) => {\n stdin.setEncoding('utf8');\n stdin.on('readable', () => {\n let chunk;\n // eslint-disable-next-line no-cond-assign\n while ((chunk = stdin.read())) {\n result += chunk;\n }\n });\n\n stdin.on('end', () => {\n resolve(result);\n });\n\n stdin.on('error', reject);\n });\n};\n\nconst createImporter = (db: Database, strategy?: Strategy) => {\n switch (strategy) {\n case 'replace':\n return createReplaceImporter(db);\n case 'merge':\n return createMergeImporter(db);\n case 'keep':\n return createKeepImporter(db);\n default:\n throw new Error(`No importer available for strategy \"${strategy}\"`);\n }\n};\n\n/**\n * Replace importer. Will replace the keys that already exist and create the new ones\n */\nconst createReplaceImporter = (db: Database) => {\n const stats = {\n created: 0,\n replaced: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.replaced} replaced`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.replaced += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: conf,\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will merge the keys that already exist with their new value and create the new ones\n */\nconst createMergeImporter = (db: Database) => {\n const stats = {\n created: 0,\n merged: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.merged} merged`;\n },\n\n async import(conf: Record<string, unknown>) {\n const existingConf = await db\n .query('strapi::core-store')\n .findOne({ where: { key: conf.key } });\n\n if (existingConf) {\n stats.merged += 1;\n await db.query('strapi::core-store').update({\n where: { key: conf.key },\n data: _.merge(existingConf, conf),\n });\n } else {\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n }\n },\n };\n};\n\n/**\n * Merge importer. Will keep the keys that already exist without changing them and create the new ones\n */\nconst createKeepImporter = (db: Database) => {\n const stats = {\n created: 0,\n untouched: 0,\n };\n\n return {\n printStatistics() {\n return `${stats.created} created, ${stats.untouched} untouched`;\n },\n\n async import(conf: Record<string, unknown>) {\n const matching = await db.query('strapi::core-store').count({ where: { key: conf.key } });\n if (matching > 0) {\n stats.untouched += 1;\n // if configuration already exists do not overwrite it\n return;\n }\n\n stats.created += 1;\n await db.query('strapi::core-store').create({ data: conf });\n },\n };\n};\n\n/**\n * `$ strapi configuration:restore`\n */\nconst command: StrapiCommand = () => {\n return createCommand('configuration:restore')\n .alias('config:restore')\n .description('Restore configurations of your application')\n .option('-f, --file <file>', 'Input file, default input is stdin')\n .option('-s, --strategy <strategy>', 'Strategy name, one of: \"replace\", \"merge\", \"keep\"')\n .action(runAction('configuration:restore', action));\n};\n\nexport { action, command };\n"],"names":["action","file","filePath","strategy","input","fs","readFileSync","readStdin","appContext","compileStrapi","app","createStrapi","load","dataToImport","JSON","parse","_","toString","error","Error","message","Array","isArray","db","importer","createImporter","config","import","console","log","printStatistics","process","exit","stdin","result","isTTY","Promise","resolve","reject","setEncoding","on","chunk","read","createReplaceImporter","createMergeImporter","createKeepImporter","stats","created","replaced","conf","matching","query","count","where","key","update","data","create","merged","existingConf","findOne","merge","untouched","command","createCommand","alias","description","option","runAction"],"mappings":";;;;;;;;AAgBA;;IAGA,MAAMA,SAAS,OAAO,EAAEC,MAAMC,QAAQ,EAAEC,QAAW,GAAA,SAAS,EAAc,GAAA;AACxE,IAAA,MAAMC,QAAQF,QAAWG,GAAAA,EAAAA,CAAGC,YAAY,CAACJ,YAAY,MAAMK,SAAAA,EAAAA;AAE3D,IAAA,MAAMC,aAAa,MAAMC,kBAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,iBAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;IAE/C,IAAIC,YAAAA;IACJ,IAAI;AACFA,QAAAA,YAAAA,GAAeC,IAAKC,CAAAA,KAAK,CAACC,CAAAA,CAAEC,QAAQ,CAACb,KAAAA,CAAAA,CAAAA;A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