@strapi/strapi 4.0.0-next.7 → 4.0.1
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 +14 -14
- package/bin/strapi.js +46 -60
- package/lib/Strapi.js +193 -98
- package/lib/commands/build.js +19 -8
- package/lib/commands/console.js +1 -1
- package/lib/commands/content-types/list.js +22 -0
- package/lib/commands/controllers/list.js +22 -0
- package/lib/commands/develop.js +22 -27
- package/lib/commands/generate-template.js +4 -5
- package/lib/commands/hooks/list.js +22 -0
- package/lib/commands/middlewares/list.js +22 -0
- package/lib/commands/new.js +3 -1
- package/lib/commands/policies/list.js +22 -0
- package/lib/commands/routes/list.js +28 -0
- package/lib/commands/services/list.js +22 -0
- package/lib/commands/watchAdmin.js +18 -9
- package/lib/core/app-configuration/index.js +3 -36
- package/lib/core/bootstrap.js +25 -0
- package/lib/core/domain/content-type/index.js +26 -29
- package/lib/core/domain/content-type/validator.js +22 -3
- package/lib/core/domain/module/index.js +42 -11
- package/lib/core/domain/module/validation.js +16 -19
- package/lib/core/loaders/admin.js +16 -0
- package/lib/core/loaders/apis.js +159 -0
- package/lib/core/loaders/{load-components.js → components.js} +5 -6
- package/lib/core/loaders/index.js +11 -0
- package/lib/core/loaders/middlewares.js +36 -0
- package/lib/core/{load-plugins → loaders/plugins}/get-enabled-plugins.js +55 -19
- package/lib/core/loaders/plugins/get-user-plugins-config.js +37 -0
- package/lib/core/{load-plugins → loaders/plugins}/index.js +35 -19
- package/lib/core/loaders/policies.js +28 -0
- package/lib/core/loaders/src-index.js +39 -0
- package/lib/core/registries/apis.js +29 -0
- package/lib/core/registries/content-types.js +66 -10
- package/lib/core/registries/controllers.d.ts +7 -0
- package/lib/core/registries/controllers.js +92 -7
- package/lib/core/registries/hooks.d.ts +20 -0
- package/lib/core/registries/hooks.js +87 -0
- package/lib/core/registries/middlewares.d.ts +5 -0
- package/lib/core/registries/middlewares.js +65 -5
- package/lib/core/registries/modules.js +3 -3
- package/lib/core/registries/plugins.js +2 -2
- package/lib/core/registries/policies.d.ts +9 -0
- package/lib/core/registries/policies.js +65 -5
- package/lib/core/registries/services.d.ts +7 -0
- package/lib/core/registries/services.js +88 -17
- package/lib/core/utils.js +35 -0
- package/lib/core-api/controller/collection-type.js +45 -26
- package/lib/core-api/controller/index.d.ts +25 -0
- package/lib/core-api/controller/index.js +33 -11
- package/lib/core-api/controller/single-type.js +29 -15
- package/lib/core-api/controller/transform.js +62 -6
- package/lib/core-api/routes/index.js +71 -0
- package/lib/core-api/service/collection-type.js +43 -21
- package/lib/core-api/service/index.d.ts +21 -0
- package/lib/core-api/service/index.js +8 -67
- package/lib/core-api/service/pagination.js +125 -0
- package/lib/core-api/service/single-type.js +17 -19
- package/lib/factories.d.ts +48 -0
- package/lib/factories.js +84 -0
- package/lib/index.d.ts +10 -31
- package/lib/index.js +5 -1
- package/lib/middlewares/body.js +33 -0
- package/lib/middlewares/compression.js +8 -0
- package/lib/middlewares/cors.js +58 -0
- package/lib/middlewares/errors.js +40 -0
- package/lib/middlewares/favicon.js +19 -0
- package/lib/middlewares/index.d.ts +5 -0
- package/lib/middlewares/index.js +30 -116
- package/lib/middlewares/ip.js +8 -0
- package/lib/middlewares/logger.js +27 -0
- package/lib/middlewares/powered-by.js +20 -0
- package/lib/middlewares/public/index.js +72 -77
- package/lib/middlewares/query.js +46 -0
- package/lib/middlewares/response-time.js +15 -0
- package/lib/middlewares/responses.js +19 -0
- package/lib/middlewares/security.js +51 -0
- package/lib/middlewares/session/index.js +6 -6
- package/lib/migrations/draft-publish.js +57 -0
- package/lib/services/auth/index.js +87 -0
- package/lib/services/core-store.js +64 -51
- package/lib/services/cron.js +54 -0
- package/lib/services/entity-service/attributes/index.js +31 -0
- package/lib/services/entity-service/attributes/transforms.js +20 -0
- package/lib/services/entity-service/components.js +39 -15
- package/lib/services/entity-service/index.d.ts +91 -0
- package/lib/services/entity-service/index.js +120 -59
- package/lib/services/entity-service/params.js +52 -94
- package/lib/services/entity-validator/index.js +76 -43
- package/lib/services/entity-validator/validators.js +131 -43
- package/lib/services/errors.js +77 -0
- package/lib/{core → services}/fs.js +1 -1
- package/lib/services/metrics/index.js +38 -36
- package/lib/services/server/admin-api.js +14 -0
- package/lib/services/server/api.js +36 -0
- package/lib/services/server/compose-endpoint.js +141 -0
- package/lib/services/server/content-api.js +16 -0
- package/lib/{server.js → services/server/http-server.js} +0 -0
- package/lib/services/server/index.js +127 -0
- package/lib/services/server/koa.js +64 -0
- package/lib/services/server/middleware.js +122 -0
- package/lib/services/server/policy.js +32 -0
- package/lib/services/server/register-middlewares.js +110 -0
- package/lib/services/server/register-routes.js +106 -0
- package/lib/services/server/routing.js +120 -0
- package/lib/services/webhook-runner.js +1 -1
- package/lib/utils/ee.js +3 -3
- package/lib/utils/get-dirs.js +17 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/is-initialized.js +1 -1
- package/lib/utils/signals.js +24 -0
- package/lib/utils/startup-logger.js +2 -2
- package/lib/utils/update-notifier/index.js +3 -2
- package/package.json +94 -97
- package/lib/commands/generate.js +0 -76
- package/lib/core/loaders/bootstrap.js +0 -176
- package/lib/core/loaders/load-apis.js +0 -20
- package/lib/core/loaders/load-functions.js +0 -21
- package/lib/core/loaders/load-middlewares.js +0 -136
- package/lib/core/loaders/load-modules.js +0 -21
- package/lib/core/loaders/load-policies.js +0 -36
- package/lib/core/loaders/walk.js +0 -27
- package/lib/core-api/index.js +0 -39
- package/lib/load/check-reserved-filename.js +0 -10
- package/lib/load/load-config-files.js +0 -22
- package/lib/load/require-file-parse.js +0 -15
- package/lib/middlewares/boom/defaults.json +0 -5
- package/lib/middlewares/boom/index.js +0 -147
- package/lib/middlewares/cors/index.js +0 -66
- package/lib/middlewares/cron/defaults.json +0 -5
- package/lib/middlewares/cron/index.js +0 -43
- package/lib/middlewares/favicon/defaults.json +0 -7
- package/lib/middlewares/favicon/index.js +0 -32
- package/lib/middlewares/gzip/defaults.json +0 -6
- package/lib/middlewares/gzip/index.js +0 -19
- package/lib/middlewares/helmet/defaults.json +0 -18
- package/lib/middlewares/helmet/index.js +0 -9
- package/lib/middlewares/ip/defaults.json +0 -7
- package/lib/middlewares/ip/index.js +0 -25
- package/lib/middlewares/language/defaults.json +0 -9
- package/lib/middlewares/language/index.js +0 -40
- package/lib/middlewares/logger/defaults.json +0 -5
- package/lib/middlewares/logger/index.js +0 -37
- package/lib/middlewares/parser/defaults.json +0 -11
- package/lib/middlewares/parser/index.js +0 -71
- package/lib/middlewares/poweredBy/defaults.json +0 -5
- package/lib/middlewares/poweredBy/index.js +0 -16
- package/lib/middlewares/public/defaults.json +0 -8
- package/lib/middlewares/responseTime/defaults.json +0 -5
- package/lib/middlewares/responseTime/index.js +0 -25
- package/lib/middlewares/responses/defaults.json +0 -5
- package/lib/middlewares/responses/index.js +0 -18
- package/lib/middlewares/router/defaults.json +0 -7
- package/lib/middlewares/router/index.js +0 -56
- package/lib/middlewares/router/utils/composeEndpoint.js +0 -25
- package/lib/middlewares/router/utils/routerChecker.js +0 -96
- package/lib/utils/get-prefixed-dependencies.js +0 -7
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
<br />
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="https://www.npmjs.org/package/strapi">
|
|
13
|
-
<img src="https://img.shields.io/npm/v/strapi/latest.svg" alt="NPM Version" />
|
|
12
|
+
<a href="https://www.npmjs.org/package/@strapi/strapi">
|
|
13
|
+
<img src="https://img.shields.io/npm/v/@strapi/strapi/latest.svg" alt="NPM Version" />
|
|
14
14
|
</a>
|
|
15
|
-
<a href="https://
|
|
16
|
-
<img src="https://
|
|
15
|
+
<a href="https://github.com/strapi/strapi/actions/workflows/tests.yml">
|
|
16
|
+
<img src="https://github.com/strapi/strapi/actions/workflows/tests.yml/badge.svg?branch=master" alt="Tests" />
|
|
17
17
|
</a>
|
|
18
18
|
<a href="https://discord.strapi.io">
|
|
19
19
|
<img src="https://img.shields.io/discord/811989166782021633?label=Discord" alt="Strapi on Discord" />
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
<p align="center">
|
|
26
26
|
<a href="https://strapi.io">
|
|
27
|
-
<img src="https://raw.githubusercontent.com/strapi/strapi/
|
|
27
|
+
<img src="https://raw.githubusercontent.com/strapi/strapi/0bcebf77b37182fe021cb59cc19be8f5db4a18ac/public/assets/administration_panel.png" alt="Administration panel" />
|
|
28
28
|
</a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ Strapi is a free and open-source headless CMS delivering your content anywhere y
|
|
|
39
39
|
|
|
40
40
|
## Getting Started
|
|
41
41
|
|
|
42
|
-
<a href="https://strapi.io/
|
|
42
|
+
<a href="https://docs.strapi.io/developer-docs/latest/getting-started/quick-start.html" target="_blank">Read the Getting Started tutorial</a> or follow the steps below:
|
|
43
43
|
|
|
44
44
|
### ⏳ Installation
|
|
45
45
|
|
|
@@ -65,7 +65,7 @@ Enjoy 🎉
|
|
|
65
65
|
|
|
66
66
|
### 🖐 Requirements
|
|
67
67
|
|
|
68
|
-
Complete installation requirements can be found in the documentation under <a href="https://strapi.io/
|
|
68
|
+
Complete installation requirements can be found in the documentation under <a href="https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html">Installation Requirements</a>.
|
|
69
69
|
|
|
70
70
|
**Supported operating systems**:
|
|
71
71
|
|
|
@@ -79,13 +79,13 @@ Complete installation requirements can be found in the documentation under <a hr
|
|
|
79
79
|
|
|
80
80
|
**Node:**
|
|
81
81
|
|
|
82
|
-
- NodeJS >=
|
|
82
|
+
- NodeJS >= 12 <= 16
|
|
83
83
|
- NPM >= 6.x
|
|
84
84
|
|
|
85
85
|
**Database:**
|
|
86
86
|
|
|
87
|
-
- MySQL >= 5.
|
|
88
|
-
- MariaDB >= 10.
|
|
87
|
+
- MySQL >= 5.7.8
|
|
88
|
+
- MariaDB >= 10.2.7
|
|
89
89
|
- PostgreSQL >= 10
|
|
90
90
|
- SQLite >= 3
|
|
91
91
|
|
|
@@ -109,7 +109,7 @@ Please read our [Contributing Guide](./CONTRIBUTING.md) before submitting a Pull
|
|
|
109
109
|
|
|
110
110
|
## Community support
|
|
111
111
|
|
|
112
|
-
For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io
|
|
112
|
+
For general help using Strapi, please refer to [the official Strapi documentation](https://docs.strapi.io). For additional help, you can use one of these channels to ask a question:
|
|
113
113
|
|
|
114
114
|
- [Discord](https://discord.strapi.io) (For live discussion with the Community and Strapi team)
|
|
115
115
|
- [GitHub](https://github.com/strapi/strapi) (Bug reports, Contributions)
|
|
@@ -122,7 +122,7 @@ For general help using Strapi, please refer to [the official Strapi documentatio
|
|
|
122
122
|
|
|
123
123
|
## Migration
|
|
124
124
|
|
|
125
|
-
Follow our [migration guides](https://strapi.io/
|
|
125
|
+
Follow our [migration guides](https://docs.strapi.io/developer-docs/latest/update-migration-guides/migration-guides.html) on the documentation to keep your projects up-to-date.
|
|
126
126
|
|
|
127
127
|
## Roadmap
|
|
128
128
|
|
|
@@ -132,8 +132,8 @@ Check out our [roadmap](https://portal.productboard.com/strapi) to get informed
|
|
|
132
132
|
|
|
133
133
|
See our dedicated [repository](https://github.com/strapi/documentation) for the Strapi documentation, or view our documentation live:
|
|
134
134
|
|
|
135
|
-
- [Developer docs](https://strapi.io/
|
|
136
|
-
- [User
|
|
135
|
+
- [Developer docs](https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html)
|
|
136
|
+
- [User guide](https://docs.strapi.io/user-docs/latest/getting-started/introduction.html)
|
|
137
137
|
|
|
138
138
|
## Try live demo
|
|
139
139
|
|
package/bin/strapi.js
CHANGED
|
@@ -58,10 +58,7 @@ const getLocalScript = name => (...args) => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
// Initial program setup
|
|
61
|
-
program
|
|
62
|
-
.storeOptionsAsProperties(false)
|
|
63
|
-
.passCommandToAction(false)
|
|
64
|
-
.allowUnknownOption(true);
|
|
61
|
+
program.storeOptionsAsProperties(false).allowUnknownOption(true);
|
|
65
62
|
|
|
66
63
|
program.helpOption('-h, --help', 'Display help for command');
|
|
67
64
|
program.addHelpCommand('help [command]', 'Display help for command');
|
|
@@ -118,68 +115,22 @@ program
|
|
|
118
115
|
.description('Start your Strapi application in development mode')
|
|
119
116
|
.action(getLocalScript('develop'));
|
|
120
117
|
|
|
121
|
-
//
|
|
122
|
-
program
|
|
123
|
-
.command('generate:api <id> [attributes...]')
|
|
124
|
-
.option('-a, --api <api>', 'API name to generate the files in')
|
|
125
|
-
.option('-p, --plugin <api>', 'Name of the local plugin')
|
|
126
|
-
.option('-e, --extend <api>', 'Name of the plugin to extend')
|
|
127
|
-
.option('--draft-and-publish', 'Enable draft/publish', false)
|
|
128
|
-
.description('Generate a basic API')
|
|
129
|
-
.action((id, attributes, cliArguments) => {
|
|
130
|
-
cliArguments.attributes = attributes;
|
|
131
|
-
getLocalScript('generate')(id, cliArguments);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// `$ strapi generate:controller`
|
|
135
|
-
program
|
|
136
|
-
.command('generate:controller <id>')
|
|
137
|
-
.option('-a, --api <api>', 'API name to generate the files in')
|
|
138
|
-
.option('-p, --plugin <api>', 'Name of the local plugin')
|
|
139
|
-
.option('-e, --extend <api>', 'Name of the plugin to extend')
|
|
140
|
-
.description('Generate a controller for an API')
|
|
141
|
-
.action(getLocalScript('generate'));
|
|
142
|
-
|
|
143
|
-
// `$ strapi generate:model`
|
|
144
|
-
program
|
|
145
|
-
.command('generate:model <id> [attributes...]')
|
|
146
|
-
.option('-a, --api <api>', 'API name to generate a sub API')
|
|
147
|
-
.option('-p, --plugin <api>', 'plugin name')
|
|
148
|
-
.option('--draft-and-publish', 'Enable draft/publish', false)
|
|
149
|
-
.description('Generate a model for an API')
|
|
150
|
-
.action((id, attributes, cliArguments) => {
|
|
151
|
-
cliArguments.attributes = attributes;
|
|
152
|
-
getLocalScript('generate')(id, cliArguments);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// `$ strapi generate:policy`
|
|
156
|
-
program
|
|
157
|
-
.command('generate:policy <id>')
|
|
158
|
-
.option('-a, --api <api>', 'API name')
|
|
159
|
-
.option('-p, --plugin <api>', 'plugin name')
|
|
160
|
-
.description('Generate a policy for an API')
|
|
161
|
-
.action(getLocalScript('generate'));
|
|
162
|
-
|
|
163
|
-
// `$ strapi generate:service`
|
|
118
|
+
// $ strapi generate
|
|
164
119
|
program
|
|
165
|
-
.command('generate
|
|
166
|
-
.
|
|
167
|
-
.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
program
|
|
173
|
-
.command('generate:plugin <id>')
|
|
174
|
-
.option('-n, --name <name>', 'Plugin name')
|
|
175
|
-
.description('Generate a basic plugin')
|
|
176
|
-
.action(getLocalScript('generate'));
|
|
120
|
+
.command('generate')
|
|
121
|
+
.description('Launch interactive API generator')
|
|
122
|
+
.action(() => {
|
|
123
|
+
checkCwdIsStrapiApp('generate');
|
|
124
|
+
process.argv.splice(2, 1);
|
|
125
|
+
require('@strapi/generators').runCLI();
|
|
126
|
+
});
|
|
177
127
|
|
|
178
128
|
// `$ strapi generate:template <directory>`
|
|
179
129
|
program
|
|
180
|
-
.command('generate
|
|
130
|
+
.command('templates:generate <directory>')
|
|
181
131
|
.description('Generate template from Strapi project')
|
|
182
132
|
.action(getLocalScript('generate-template'));
|
|
133
|
+
|
|
183
134
|
program
|
|
184
135
|
.command('build')
|
|
185
136
|
.option('--clean', 'Remove the build and .cache folders', false)
|
|
@@ -232,4 +183,39 @@ program
|
|
|
232
183
|
.option('-p, --password <password>', 'New password for the user')
|
|
233
184
|
.action(getLocalScript('admin-reset'));
|
|
234
185
|
|
|
186
|
+
program
|
|
187
|
+
.command('routes:list')
|
|
188
|
+
.description('List all the application routes')
|
|
189
|
+
.action(getLocalScript('routes/list'));
|
|
190
|
+
|
|
191
|
+
program
|
|
192
|
+
.command('middlewares:list')
|
|
193
|
+
.description('List all the application middlewares')
|
|
194
|
+
.action(getLocalScript('middlewares/list'));
|
|
195
|
+
|
|
196
|
+
program
|
|
197
|
+
.command('policies:list')
|
|
198
|
+
.description('List all the application policies')
|
|
199
|
+
.action(getLocalScript('policies/list'));
|
|
200
|
+
|
|
201
|
+
program
|
|
202
|
+
.command('content-types:list')
|
|
203
|
+
.description('List all the application content-types')
|
|
204
|
+
.action(getLocalScript('content-types/list'));
|
|
205
|
+
|
|
206
|
+
program
|
|
207
|
+
.command('hooks:list')
|
|
208
|
+
.description('List all the application hooks')
|
|
209
|
+
.action(getLocalScript('hooks/list'));
|
|
210
|
+
|
|
211
|
+
program
|
|
212
|
+
.command('services:list')
|
|
213
|
+
.description('List all the application services')
|
|
214
|
+
.action(getLocalScript('services/list'));
|
|
215
|
+
|
|
216
|
+
program
|
|
217
|
+
.command('controllers:list')
|
|
218
|
+
.description('List all the application controllers')
|
|
219
|
+
.action(getLocalScript('controllers/list'));
|
|
220
|
+
|
|
235
221
|
program.parseAsync(process.argv);
|