@strapi/strapi 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +144 -0
- package/bin/strapi.js +186 -0
- package/lib/Strapi.js +470 -0
- package/lib/commands/admin-reset.js +51 -0
- package/lib/commands/build.js +56 -0
- package/lib/commands/configurationDump.js +50 -0
- package/lib/commands/configurationRestore.js +169 -0
- package/lib/commands/console.js +26 -0
- package/lib/commands/develop.js +157 -0
- package/lib/commands/generate-template.js +97 -0
- package/lib/commands/install.js +48 -0
- package/lib/commands/new.js +11 -0
- package/lib/commands/start.js +8 -0
- package/lib/commands/uninstall.js +68 -0
- package/lib/commands/watchAdmin.js +45 -0
- package/lib/container.js +45 -0
- package/lib/core/app-configuration/config-loader.js +20 -0
- package/lib/core/app-configuration/index.js +75 -0
- package/lib/core/app-configuration/load-config-file.js +43 -0
- package/lib/core/app-configuration/load-functions.js +28 -0
- package/lib/core/bootstrap.js +60 -0
- package/lib/core/domain/component/index.js +24 -0
- package/lib/core/domain/component/validator.js +29 -0
- package/lib/core/domain/content-type/index.js +140 -0
- package/lib/core/domain/content-type/validator.js +64 -0
- package/lib/core/domain/module/index.js +106 -0
- package/lib/core/domain/module/validation.js +36 -0
- package/lib/core/loaders/admin.js +16 -0
- package/lib/core/loaders/apis.js +157 -0
- package/lib/core/loaders/components.js +41 -0
- package/lib/core/loaders/index.js +11 -0
- package/lib/core/loaders/middlewares.js +86 -0
- package/lib/core/loaders/plugins/get-enabled-plugins.js +100 -0
- package/lib/core/loaders/plugins/index.js +109 -0
- package/lib/core/loaders/policies.js +28 -0
- package/lib/core/loaders/src-index.js +38 -0
- package/lib/core/registries/apis.js +43 -0
- package/lib/core/registries/config.js +21 -0
- package/lib/core/registries/content-types.js +53 -0
- package/lib/core/registries/controllers.js +43 -0
- package/lib/core/registries/hooks.js +37 -0
- package/lib/core/registries/middlewares.js +30 -0
- package/lib/core/registries/modules.js +44 -0
- package/lib/core/registries/plugins.js +28 -0
- package/lib/core/registries/policies.js +38 -0
- package/lib/core/registries/services.js +58 -0
- package/lib/core/utils.js +35 -0
- package/lib/core-api/controller/collection-type.js +84 -0
- package/lib/core-api/controller/index.js +26 -0
- package/lib/core-api/controller/single-type.js +44 -0
- package/lib/core-api/controller/transform.js +97 -0
- package/lib/core-api/index.js +39 -0
- package/lib/core-api/service/collection-type.js +84 -0
- package/lib/core-api/service/index.js +55 -0
- package/lib/core-api/service/pagination.js +125 -0
- package/lib/core-api/service/single-type.js +58 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +3 -0
- package/lib/load/filepath-to-prop-path.js +22 -0
- package/lib/load/glob.js +15 -0
- package/lib/load/index.js +9 -0
- package/lib/load/load-files.js +56 -0
- package/lib/load/package-path.js +9 -0
- package/lib/middlewares/cors/index.js +66 -0
- package/lib/middlewares/error/defaults.json +5 -0
- package/lib/middlewares/error/index.js +147 -0
- package/lib/middlewares/favicon/defaults.json +7 -0
- package/lib/middlewares/favicon/index.js +31 -0
- package/lib/middlewares/gzip/defaults.json +6 -0
- package/lib/middlewares/gzip/index.js +19 -0
- package/lib/middlewares/helmet/defaults.json +18 -0
- package/lib/middlewares/helmet/index.js +9 -0
- package/lib/middlewares/index.js +120 -0
- package/lib/middlewares/ip/defaults.json +7 -0
- package/lib/middlewares/ip/index.js +25 -0
- package/lib/middlewares/logger/defaults.json +5 -0
- package/lib/middlewares/logger/index.js +37 -0
- package/lib/middlewares/parser/defaults.json +11 -0
- package/lib/middlewares/parser/index.js +75 -0
- package/lib/middlewares/poweredBy/defaults.json +5 -0
- package/lib/middlewares/poweredBy/index.js +16 -0
- package/lib/middlewares/public/assets/images/group_people_1.png +0 -0
- package/lib/middlewares/public/assets/images/group_people_2.png +0 -0
- package/lib/middlewares/public/assets/images/group_people_3.png +0 -0
- package/lib/middlewares/public/assets/images/logo_login.png +0 -0
- package/lib/middlewares/public/defaults.json +8 -0
- package/lib/middlewares/public/index.html +66 -0
- package/lib/middlewares/public/index.js +130 -0
- package/lib/middlewares/public/serve-static.js +23 -0
- package/lib/middlewares/responseTime/defaults.json +5 -0
- package/lib/middlewares/responseTime/index.js +25 -0
- package/lib/middlewares/responses/defaults.json +5 -0
- package/lib/middlewares/responses/index.js +19 -0
- package/lib/middlewares/router/defaults.json +7 -0
- package/lib/middlewares/router/index.js +97 -0
- package/lib/middlewares/session/defaults.json +18 -0
- package/lib/middlewares/session/index.js +140 -0
- package/lib/migrations/draft-publish.js +57 -0
- package/lib/services/auth/index.js +92 -0
- package/lib/services/core-store.js +145 -0
- package/lib/services/cron.js +54 -0
- package/lib/services/entity-service/components.js +365 -0
- package/lib/services/entity-service/index.d.ts +91 -0
- package/lib/services/entity-service/index.js +244 -0
- package/lib/services/entity-service/params.js +145 -0
- package/lib/services/entity-validator/index.js +187 -0
- package/lib/services/entity-validator/validators.js +123 -0
- package/lib/services/event-hub.js +15 -0
- package/lib/services/fs.js +58 -0
- package/lib/services/metrics/index.js +104 -0
- package/lib/services/metrics/is-truthy.js +9 -0
- package/lib/services/metrics/middleware.js +33 -0
- package/lib/services/metrics/rate-limiter.js +27 -0
- package/lib/services/metrics/sender.js +76 -0
- package/lib/services/metrics/stringify-deep.js +22 -0
- package/lib/services/server/admin-api.js +14 -0
- package/lib/services/server/api.js +32 -0
- package/lib/services/server/compose-endpoint.js +112 -0
- package/lib/services/server/content-api.js +16 -0
- package/lib/services/server/http-server.js +64 -0
- package/lib/services/server/index.js +108 -0
- package/lib/services/server/middleware.js +28 -0
- package/lib/services/server/policy.js +34 -0
- package/lib/services/server/routing.js +107 -0
- package/lib/services/utils/upload-files.js +79 -0
- package/lib/services/webhook-runner.js +155 -0
- package/lib/services/webhook-store.js +91 -0
- package/lib/services/worker-queue.js +58 -0
- package/lib/utils/addSlash.js +10 -0
- package/lib/utils/ee.js +123 -0
- package/lib/utils/get-dirs.js +15 -0
- package/lib/utils/get-prefixed-dependencies.js +7 -0
- package/lib/utils/index.js +11 -0
- package/lib/utils/is-initialized.js +23 -0
- package/lib/utils/open-browser.js +12 -0
- package/lib/utils/resources/key.pub +9 -0
- package/lib/utils/run-checks.js +22 -0
- package/lib/utils/startup-logger.js +90 -0
- package/lib/utils/success.js +31 -0
- package/lib/utils/update-notifier/index.js +97 -0
- package/lib/utils/url-from-segments.js +12 -0
- package/package.json +133 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const packageJson = require('package-json');
|
|
5
|
+
const Configstore = require('configstore');
|
|
6
|
+
const semver = require('semver');
|
|
7
|
+
const boxen = require('boxen');
|
|
8
|
+
const chalk = require('chalk');
|
|
9
|
+
const { env } = require('@strapi/utils');
|
|
10
|
+
|
|
11
|
+
const pkg = require('../../../package');
|
|
12
|
+
|
|
13
|
+
const CHECK_INTERVAL = 1000 * 60 * 60 * 24 * 1; // 1 day
|
|
14
|
+
const NOTIF_INTERVAL = 1000 * 60 * 60 * 24 * 7; // 1 week
|
|
15
|
+
const boxenOptions = {
|
|
16
|
+
padding: 1,
|
|
17
|
+
margin: 1,
|
|
18
|
+
align: 'center',
|
|
19
|
+
borderColor: 'yellow',
|
|
20
|
+
borderStyle: 'round',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const geUpdatetMessage = (newVersion, currentVersion) => {
|
|
24
|
+
const currentVersionLog = chalk.dim(currentVersion);
|
|
25
|
+
const newVersionLog = chalk.green(newVersion);
|
|
26
|
+
const releaseLink = chalk.bold('https://github.com/strapi/strapi/releases');
|
|
27
|
+
|
|
28
|
+
return `
|
|
29
|
+
A new version of Strapi is available ${currentVersionLog} → ${newVersionLog}
|
|
30
|
+
Check out the new releases at: ${releaseLink}
|
|
31
|
+
`.trim();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const createUpdateNotifier = strapi => {
|
|
35
|
+
let config = null;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
config = new Configstore(
|
|
39
|
+
pkg.name,
|
|
40
|
+
{},
|
|
41
|
+
{ configPath: path.join(strapi.dirs.root, '.strapi-updater.json') }
|
|
42
|
+
);
|
|
43
|
+
} catch {
|
|
44
|
+
// we don't have write access to the file system
|
|
45
|
+
// we silence the error
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const checkUpdate = async checkInterval => {
|
|
49
|
+
const now = Date.now();
|
|
50
|
+
const lastUpdateCheck = config.get('lastUpdateCheck') || 0;
|
|
51
|
+
if (lastUpdateCheck + checkInterval > now) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const res = await packageJson(pkg.name);
|
|
57
|
+
if (res.version) {
|
|
58
|
+
config.set('latest', res.version);
|
|
59
|
+
config.set('lastUpdateCheck', now);
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
// silence error if offline
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const display = notifInterval => {
|
|
67
|
+
const now = Date.now();
|
|
68
|
+
const latestVersion = config.get('latest');
|
|
69
|
+
const lastNotification = config.get('lastNotification') || 0;
|
|
70
|
+
|
|
71
|
+
if (
|
|
72
|
+
!process.stdout.isTTY ||
|
|
73
|
+
lastNotification + notifInterval > now ||
|
|
74
|
+
!semver.valid(latestVersion) ||
|
|
75
|
+
!semver.valid(pkg.version) ||
|
|
76
|
+
semver.lte(latestVersion, pkg.version)
|
|
77
|
+
) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const message = boxen(geUpdatetMessage(latestVersion, pkg.version), boxenOptions);
|
|
82
|
+
config.set('lastNotification', now);
|
|
83
|
+
console.log(message);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
notify({ checkInterval = CHECK_INTERVAL, notifInterval = NOTIF_INTERVAL } = {}) {
|
|
88
|
+
if (env.bool('STRAPI_DISABLE_UPDATE_NOTIFICATION', false) || !config) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
display(notifInterval);
|
|
92
|
+
checkUpdate(checkInterval); // doesn't need to await
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
module.exports = createUpdateNotifier;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a url base on hostname, port and ssl options
|
|
5
|
+
*/
|
|
6
|
+
module.exports = ({ hostname, port, ssl = false }) => {
|
|
7
|
+
const protocol = ssl ? 'https' : 'http';
|
|
8
|
+
const defaultPort = ssl ? 443 : 80;
|
|
9
|
+
const portString = port === undefined || parseInt(port, 10) === defaultPort ? '' : `:${port}`;
|
|
10
|
+
|
|
11
|
+
return `${protocol}://${hostname}${portString}`;
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@strapi/strapi",
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
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
|
+
"keywords": [
|
|
6
|
+
"strapi",
|
|
7
|
+
"cms",
|
|
8
|
+
"cmf",
|
|
9
|
+
"content management system",
|
|
10
|
+
"content management framework",
|
|
11
|
+
"admin panel",
|
|
12
|
+
"dashboard",
|
|
13
|
+
"api",
|
|
14
|
+
"auth",
|
|
15
|
+
"framework",
|
|
16
|
+
"http",
|
|
17
|
+
"json",
|
|
18
|
+
"koa",
|
|
19
|
+
"koajs",
|
|
20
|
+
"helmet",
|
|
21
|
+
"mvc",
|
|
22
|
+
"oauth",
|
|
23
|
+
"oauth2",
|
|
24
|
+
"orm",
|
|
25
|
+
"rest",
|
|
26
|
+
"restful",
|
|
27
|
+
"security",
|
|
28
|
+
"jam",
|
|
29
|
+
"jamstack",
|
|
30
|
+
"javascript",
|
|
31
|
+
"headless",
|
|
32
|
+
"MySQL",
|
|
33
|
+
"MariaDB",
|
|
34
|
+
"PostgreSQL",
|
|
35
|
+
"SQLite",
|
|
36
|
+
"graphqL",
|
|
37
|
+
"infrastructure",
|
|
38
|
+
"backend",
|
|
39
|
+
"open source",
|
|
40
|
+
"self hosted",
|
|
41
|
+
"lerna",
|
|
42
|
+
"lernajs",
|
|
43
|
+
"react",
|
|
44
|
+
"reactjs"
|
|
45
|
+
],
|
|
46
|
+
"homepage": "https://strapi.io",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/strapi/strapi/issues"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git://github.com/strapi/strapi.git"
|
|
53
|
+
},
|
|
54
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
55
|
+
"author": {
|
|
56
|
+
"name": "Strapi team",
|
|
57
|
+
"email": "hi@strapi.io",
|
|
58
|
+
"url": "https://strapi.io"
|
|
59
|
+
},
|
|
60
|
+
"maintainers": [
|
|
61
|
+
{
|
|
62
|
+
"name": "Strapi team",
|
|
63
|
+
"email": "hi@strapi.io",
|
|
64
|
+
"url": "https://strapi.io"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"main": "./lib",
|
|
68
|
+
"types": "./lib/index.d.ts",
|
|
69
|
+
"bin": {
|
|
70
|
+
"strapi": "./bin/strapi.js"
|
|
71
|
+
},
|
|
72
|
+
"directories": {
|
|
73
|
+
"lib": "./lib",
|
|
74
|
+
"bin": "./bin"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"postinstall": "node lib/utils/success.js"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@hapi/boom": "9.1.4",
|
|
81
|
+
"@koa/cors": "3.1.0",
|
|
82
|
+
"@koa/router": "10.1.1",
|
|
83
|
+
"@strapi/admin": "4.0.0-beta.0",
|
|
84
|
+
"@strapi/database": "4.0.0-beta.0",
|
|
85
|
+
"@strapi/generate-new": "4.0.0-beta.0",
|
|
86
|
+
"@strapi/generators": "4.0.0-beta.0",
|
|
87
|
+
"@strapi/logger": "4.0.0-beta.0",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.0.0-beta.0",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.0.0-beta.0",
|
|
90
|
+
"@strapi/plugin-email": "4.0.0-beta.0",
|
|
91
|
+
"@strapi/plugin-upload": "4.0.0-beta.0",
|
|
92
|
+
"@strapi/utils": "4.0.0-beta.0",
|
|
93
|
+
"boxen": "5.1.2",
|
|
94
|
+
"chalk": "4.1.2",
|
|
95
|
+
"chokidar": "3.5.2",
|
|
96
|
+
"ci-info": "3.2.0",
|
|
97
|
+
"cli-table3": "0.6.0",
|
|
98
|
+
"commander": "8.2.0",
|
|
99
|
+
"configstore": "5.0.1",
|
|
100
|
+
"debug": "4.3.2",
|
|
101
|
+
"delegates": "1.0.0",
|
|
102
|
+
"dotenv": "10.0.0",
|
|
103
|
+
"execa": "5.1.1",
|
|
104
|
+
"fs-extra": "10.0.0",
|
|
105
|
+
"glob": "7.2.0",
|
|
106
|
+
"inquirer": "8.1.5",
|
|
107
|
+
"is-docker": "2.2.1",
|
|
108
|
+
"koa": "2.13.3",
|
|
109
|
+
"koa-body": "4.2.0",
|
|
110
|
+
"koa-compose": "4.1.0",
|
|
111
|
+
"koa-compress": "5.1.0",
|
|
112
|
+
"koa-favicon": "2.1.0",
|
|
113
|
+
"koa-helmet": "6.1.0",
|
|
114
|
+
"koa-ip": "2.1.0",
|
|
115
|
+
"koa-session": "6.2.0",
|
|
116
|
+
"koa-static": "5.0.0",
|
|
117
|
+
"lodash": "4.17.21",
|
|
118
|
+
"node-fetch": "2.6.5",
|
|
119
|
+
"node-machine-id": "1.1.12",
|
|
120
|
+
"node-schedule": "2.0.0",
|
|
121
|
+
"open": "8.2.1",
|
|
122
|
+
"ora": "5.4.1",
|
|
123
|
+
"package-json": "7.0.0",
|
|
124
|
+
"qs": "6.10.1",
|
|
125
|
+
"resolve-cwd": "3.0.0",
|
|
126
|
+
"semver": "7.3.5"
|
|
127
|
+
},
|
|
128
|
+
"engines": {
|
|
129
|
+
"node": ">=12.x.x <=16.x.x",
|
|
130
|
+
"npm": ">=6.0.0"
|
|
131
|
+
},
|
|
132
|
+
"gitHead": "9807c78cb7ab6373b7abb46da5ecc4980a9ea56c"
|
|
133
|
+
}
|