@strapi/strapi 4.3.4 → 4.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -9
- package/bin/strapi.js +29 -26
- package/lib/Strapi.js +9 -9
- package/lib/commands/admin-create.js +2 -5
- package/lib/commands/admin-reset.js +1 -1
- package/lib/commands/build.js +1 -1
- package/lib/commands/builders/admin.js +1 -1
- package/lib/commands/builders/typescript.js +2 -2
- package/lib/commands/configurationDump.js +3 -3
- package/lib/commands/configurationRestore.js +5 -4
- package/lib/commands/console.js +1 -1
- package/lib/commands/content-types/list.js +2 -2
- package/lib/commands/controllers/list.js +2 -2
- package/lib/commands/develop.js +16 -10
- package/lib/commands/hooks/list.js +2 -2
- package/lib/commands/install.js +4 -4
- package/lib/commands/middlewares/list.js +2 -2
- package/lib/commands/new.js +1 -1
- package/lib/commands/opt-in-telemetry.js +12 -13
- package/lib/commands/opt-out-telemetry.js +3 -3
- package/lib/commands/policies/list.js +2 -2
- package/lib/commands/routes/list.js +3 -3
- package/lib/commands/services/list.js +2 -2
- package/lib/commands/start.js +1 -0
- package/lib/commands/ts/generate-types.js +1 -1
- package/lib/commands/uninstall.js +4 -4
- package/lib/commands/watchAdmin.js +1 -1
- package/lib/compile.js +1 -1
- package/lib/container.js +1 -1
- package/lib/core/app-configuration/config-loader.js +2 -2
- package/lib/core/app-configuration/load-config-file.js +3 -3
- package/lib/core/bootstrap.js +1 -1
- package/lib/core/domain/component/validator.js +3 -9
- package/lib/core/domain/content-type/index.js +2 -2
- package/lib/core/domain/content-type/validator.js +9 -23
- package/lib/core/domain/module/index.js +1 -1
- package/lib/core/domain/module/validation.js +3 -4
- package/lib/core/loaders/admin.js +1 -1
- package/lib/core/loaders/apis.js +22 -30
- package/lib/core/loaders/components.js +2 -2
- package/lib/core/loaders/middlewares.js +1 -1
- package/lib/core/loaders/plugins/get-enabled-plugins.js +7 -7
- package/lib/core/loaders/plugins/index.js +7 -8
- package/lib/core/loaders/sanitizers.js +1 -1
- package/lib/core/loaders/src-index.js +2 -2
- package/lib/core/registries/apis.js +1 -1
- package/lib/core/registries/config.js +1 -1
- package/lib/core/registries/content-types.js +1 -1
- package/lib/core/registries/modules.js +1 -1
- package/lib/core/registries/plugins.js +1 -1
- package/lib/core/registries/services.js +1 -1
- package/lib/core/utils.js +3 -6
- package/lib/core-api/controller/transform.js +4 -4
- package/lib/core-api/service/collection-type.js +1 -1
- package/lib/core-api/service/index.d.ts +6 -3
- package/lib/core-api/service/pagination.js +5 -5
- package/lib/factories.js +5 -5
- package/lib/load/filepath-to-prop-path.js +2 -2
- package/lib/load/load-files.js +1 -1
- package/lib/load/package-path.js +1 -1
- package/lib/middlewares/body.js +10 -3
- package/lib/middlewares/compression.js +1 -1
- package/lib/middlewares/cors.js +3 -10
- package/lib/middlewares/ip.js +1 -1
- package/lib/middlewares/logger.js +4 -1
- package/lib/middlewares/powered-by.js +1 -1
- package/lib/middlewares/query.js +8 -2
- package/lib/middlewares/response-time.js +1 -1
- package/lib/middlewares/responses.js +1 -1
- package/lib/middlewares/security.js +22 -16
- package/lib/middlewares/session.js +2 -2
- package/lib/migrations/draft-publish.js +1 -5
- package/lib/services/auth/index.js +1 -3
- package/lib/services/core-store.js +4 -4
- package/lib/services/entity-service/components.js +34 -20
- package/lib/services/entity-service/index.js +73 -52
- package/lib/services/entity-validator/index.js +134 -127
- package/lib/services/entity-validator/validators.js +18 -15
- package/lib/services/errors.js +6 -10
- package/lib/services/event-hub.js +1 -0
- package/lib/services/fs.js +1 -1
- package/lib/services/metrics/index.js +6 -9
- package/lib/services/metrics/is-truthy.js +1 -1
- package/lib/services/metrics/sender.js +6 -6
- package/lib/services/metrics/stringify-deep.js +1 -1
- package/lib/services/server/admin-api.js +1 -1
- package/lib/services/server/compose-endpoint.js +7 -7
- package/lib/services/server/content-api.js +1 -1
- package/lib/services/server/http-server.js +9 -9
- package/lib/services/server/index.js +4 -4
- package/lib/services/server/koa.js +9 -12
- package/lib/services/server/middleware.js +1 -1
- package/lib/services/server/policy.js +1 -1
- package/lib/services/server/register-middlewares.js +6 -8
- package/lib/services/server/register-routes.js +11 -11
- package/lib/services/server/routing.js +11 -26
- package/lib/services/utils/upload-files.js +3 -3
- package/lib/services/webhook-runner.js +8 -7
- package/lib/services/webhook-store.js +3 -2
- package/lib/services/worker-queue.js +1 -0
- package/lib/types/core/strapi/index.d.ts +4 -3
- package/lib/types/factories.d.ts +3 -3
- package/lib/utils/addSlash.js +3 -3
- package/lib/utils/ee.js +1 -1
- package/lib/utils/import-default.js +1 -1
- package/lib/utils/open-browser.js +1 -1
- package/lib/utils/run-checks.js +4 -4
- package/lib/utils/signals.js +2 -2
- package/lib/utils/startup-logger.js +2 -2
- package/lib/utils/success.js +1 -1
- package/lib/utils/update-notifier/index.js +4 -4
- package/package.json +15 -15
package/lib/utils/addSlash.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = path => {
|
|
3
|
+
module.exports = (path) => {
|
|
4
4
|
if (typeof path !== 'string') throw new Error('admin.url must be a string');
|
|
5
5
|
if (path === '' || path === '/') return '/';
|
|
6
6
|
|
|
7
|
-
if (path[0] != '/') path =
|
|
8
|
-
if (path[path.length - 1] != '/') path
|
|
7
|
+
if (path[0] != '/') path = `/${path}`;
|
|
8
|
+
if (path[path.length - 1] != '/') path += '/';
|
|
9
9
|
return path;
|
|
10
10
|
};
|
package/lib/utils/ee.js
CHANGED
|
@@ -114,7 +114,7 @@ Object.defineProperty(module.exports, 'features', {
|
|
|
114
114
|
enumerable: false,
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
const mustHaveKey = key => {
|
|
117
|
+
const mustHaveKey = (key) => {
|
|
118
118
|
if (!_.has(internals, key)) {
|
|
119
119
|
const err = new Error('Tampering with license');
|
|
120
120
|
// err.stack = null;
|
package/lib/utils/run-checks.js
CHANGED
|
@@ -5,18 +5,18 @@ const fs = require('fs-extra');
|
|
|
5
5
|
|
|
6
6
|
const requiredPaths = ['api', 'extensions', 'plugins', 'config', 'public'];
|
|
7
7
|
const checkFoldersExist = ({ appPath }) => {
|
|
8
|
-
|
|
9
|
-
for (
|
|
8
|
+
const missingPaths = [];
|
|
9
|
+
for (const reqPath of requiredPaths) {
|
|
10
10
|
if (!fs.pathExistsSync(path.resolve(appPath, reqPath))) {
|
|
11
11
|
missingPaths.push(reqPath);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (missingPaths.length > 0) {
|
|
16
|
-
throw new Error(`Missing required folders:\n${missingPaths.map(p => `- ./${p}`).join('\n')}`);
|
|
16
|
+
throw new Error(`Missing required folders:\n${missingPaths.map((p) => `- ./${p}`).join('\n')}`);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
module.exports = config => {
|
|
20
|
+
module.exports = (config) => {
|
|
21
21
|
checkFoldersExist(config);
|
|
22
22
|
};
|
package/lib/utils/signals.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const destroyOnSignal = strapi => {
|
|
3
|
+
const destroyOnSignal = (strapi) => {
|
|
4
4
|
let signalReceived = false;
|
|
5
5
|
|
|
6
6
|
// For unknown reasons, we receive signals 2 times.
|
|
@@ -14,7 +14,7 @@ const destroyOnSignal = strapi => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
['SIGTERM', 'SIGINT'].forEach(signal => {
|
|
17
|
+
['SIGTERM', 'SIGINT'].forEach((signal) => {
|
|
18
18
|
process.on(signal, terminateStrapi);
|
|
19
19
|
});
|
|
20
20
|
};
|
|
@@ -6,7 +6,7 @@ const _ = require('lodash/fp');
|
|
|
6
6
|
const { getAbsoluteAdminUrl, getAbsoluteServerUrl } = require('@strapi/utils');
|
|
7
7
|
const ee = require('./ee');
|
|
8
8
|
|
|
9
|
-
module.exports = app => {
|
|
9
|
+
module.exports = (app) => {
|
|
10
10
|
return {
|
|
11
11
|
logStats() {
|
|
12
12
|
const columns = Math.min(process.stderr.columns, 80) - 2;
|
|
@@ -23,7 +23,7 @@ module.exports = app => {
|
|
|
23
23
|
|
|
24
24
|
infoTable.push(
|
|
25
25
|
[chalk.blue('Time'), `${new Date()}`],
|
|
26
|
-
[chalk.blue('Launched in'), Date.now() - app.config.launchedAt
|
|
26
|
+
[chalk.blue('Launched in'), `${Date.now() - app.config.launchedAt} ms`],
|
|
27
27
|
[chalk.blue('Environment'), app.config.environment],
|
|
28
28
|
[chalk.blue('Process PID'), process.pid],
|
|
29
29
|
[chalk.blue('Version'), `${app.config.info.strapi} (node ${process.version})`],
|
package/lib/utils/success.js
CHANGED
|
@@ -8,7 +8,7 @@ const boxen = require('boxen');
|
|
|
8
8
|
const chalk = require('chalk');
|
|
9
9
|
const { env } = require('@strapi/utils');
|
|
10
10
|
|
|
11
|
-
const pkg = require('../../../package');
|
|
11
|
+
const pkg = require('../../../package.json');
|
|
12
12
|
|
|
13
13
|
const CHECK_INTERVAL = 1000 * 60 * 60 * 24 * 1; // 1 day
|
|
14
14
|
const NOTIF_INTERVAL = 1000 * 60 * 60 * 24 * 7; // 1 week
|
|
@@ -31,7 +31,7 @@ Check out the new releases at: ${releaseLink}
|
|
|
31
31
|
`.trim();
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const createUpdateNotifier = strapi => {
|
|
34
|
+
const createUpdateNotifier = (strapi) => {
|
|
35
35
|
let config = null;
|
|
36
36
|
|
|
37
37
|
try {
|
|
@@ -45,7 +45,7 @@ const createUpdateNotifier = strapi => {
|
|
|
45
45
|
// we silence the error
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const checkUpdate = async checkInterval => {
|
|
48
|
+
const checkUpdate = async (checkInterval) => {
|
|
49
49
|
const now = Date.now();
|
|
50
50
|
const lastUpdateCheck = config.get('lastUpdateCheck') || 0;
|
|
51
51
|
if (lastUpdateCheck + checkInterval > now) {
|
|
@@ -63,7 +63,7 @@ const createUpdateNotifier = strapi => {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const display = notifInterval => {
|
|
66
|
+
const display = (notifInterval) => {
|
|
67
67
|
const now = Date.now();
|
|
68
68
|
const latestVersion = config.get('latest');
|
|
69
69
|
const lastNotification = config.get('lastNotification') || 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.7",
|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -78,19 +78,19 @@
|
|
|
78
78
|
"test:unit": "jest --verbose"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@koa/cors": "3.1
|
|
81
|
+
"@koa/cors": "3.4.1",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.3.
|
|
84
|
-
"@strapi/database": "4.3.
|
|
85
|
-
"@strapi/generate-new": "4.3.
|
|
86
|
-
"@strapi/generators": "4.3.
|
|
87
|
-
"@strapi/logger": "4.3.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.3.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.3.
|
|
90
|
-
"@strapi/plugin-email": "4.3.
|
|
91
|
-
"@strapi/plugin-upload": "4.3.
|
|
92
|
-
"@strapi/typescript-utils": "4.3.
|
|
93
|
-
"@strapi/utils": "4.3.
|
|
83
|
+
"@strapi/admin": "4.3.7",
|
|
84
|
+
"@strapi/database": "4.3.7",
|
|
85
|
+
"@strapi/generate-new": "4.3.7",
|
|
86
|
+
"@strapi/generators": "4.3.7",
|
|
87
|
+
"@strapi/logger": "4.3.7",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.3.7",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.3.7",
|
|
90
|
+
"@strapi/plugin-email": "4.3.7",
|
|
91
|
+
"@strapi/plugin-upload": "4.3.7",
|
|
92
|
+
"@strapi/typescript-utils": "4.3.7",
|
|
93
|
+
"@strapi/utils": "4.3.7",
|
|
94
94
|
"bcryptjs": "2.4.3",
|
|
95
95
|
"boxen": "5.1.2",
|
|
96
96
|
"chalk": "4.1.2",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"koa-compress": "5.1.0",
|
|
115
115
|
"koa-favicon": "2.1.0",
|
|
116
116
|
"koa-helmet": "6.1.0",
|
|
117
|
-
"koa-ip": "2.1.
|
|
117
|
+
"koa-ip": "^2.1.2",
|
|
118
118
|
"koa-session": "6.2.0",
|
|
119
119
|
"koa-static": "5.0.0",
|
|
120
120
|
"lodash": "4.17.21",
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"node": ">=14.19.1 <=16.x.x",
|
|
140
140
|
"npm": ">=6.0.0"
|
|
141
141
|
},
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "73f523b98322cea8992c72977b94a73a624d2e79"
|
|
143
143
|
}
|