@strapi/strapi 4.0.0-next.11 → 4.0.0-next.15

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.
Files changed (51) hide show
  1. package/bin/strapi.js +1 -4
  2. package/lib/Strapi.js +82 -28
  3. package/lib/commands/console.js +1 -1
  4. package/lib/commands/develop.js +4 -3
  5. package/lib/core/domain/content-type/index.js +3 -7
  6. package/lib/core/domain/module/index.js +2 -2
  7. package/lib/core/loaders/apis.js +4 -6
  8. package/lib/core/loaders/components.js +3 -5
  9. package/lib/core/loaders/index.js +1 -0
  10. package/lib/core/loaders/middlewares.js +1 -1
  11. package/lib/core/loaders/plugins/get-enabled-plugins.js +2 -2
  12. package/lib/core/loaders/plugins/index.js +7 -7
  13. package/lib/core/loaders/policies.js +1 -1
  14. package/lib/core/loaders/src-index.js +38 -0
  15. package/lib/core/registries/hooks.js +37 -0
  16. package/lib/core/registries/services.js +7 -7
  17. package/lib/core-api/controller/collection-type.js +5 -5
  18. package/lib/core-api/controller/single-type.js +3 -3
  19. package/lib/core-api/controller/transform.js +28 -3
  20. package/lib/core-api/service/collection-type.js +18 -19
  21. package/lib/core-api/service/single-type.js +10 -14
  22. package/lib/index.d.ts +9 -31
  23. package/lib/middlewares/cors/index.js +1 -1
  24. package/lib/middlewares/{boom → error}/defaults.json +1 -1
  25. package/lib/middlewares/{boom → error}/index.js +1 -1
  26. package/lib/middlewares/favicon/index.js +1 -2
  27. package/lib/middlewares/index.js +1 -1
  28. package/lib/middlewares/public/index.js +2 -2
  29. package/lib/middlewares/responses/index.js +2 -1
  30. package/lib/middlewares/router/index.js +5 -3
  31. package/lib/migrations/draft-publish.js +57 -0
  32. package/lib/services/auth/index.js +2 -2
  33. package/lib/services/core-store.js +64 -49
  34. package/lib/services/cron.js +54 -0
  35. package/lib/services/entity-service/components.js +37 -12
  36. package/lib/services/entity-service/index.d.ts +91 -0
  37. package/lib/services/entity-service/index.js +52 -50
  38. package/lib/services/entity-service/params.js +74 -57
  39. package/lib/services/fs.js +1 -1
  40. package/lib/services/metrics/index.js +1 -1
  41. package/lib/services/server/policy.js +15 -4
  42. package/lib/services/webhook-runner.js +1 -1
  43. package/lib/utils/ee.js +3 -3
  44. package/lib/utils/get-dirs.js +15 -0
  45. package/lib/utils/index.js +2 -0
  46. package/lib/utils/update-notifier/index.js +2 -1
  47. package/package.json +88 -98
  48. package/lib/middlewares/cron/defaults.json +0 -5
  49. package/lib/middlewares/cron/index.js +0 -43
  50. package/lib/middlewares/language/defaults.json +0 -9
  51. package/lib/middlewares/language/index.js +0 -40
@@ -2,8 +2,10 @@
2
2
 
3
3
  const openBrowser = require('./open-browser');
4
4
  const isInitialized = require('./is-initialized');
5
+ const getDirs = require('./get-dirs');
5
6
 
6
7
  module.exports = {
7
8
  isInitialized,
8
9
  openBrowser,
10
+ getDirs,
9
11
  };
@@ -38,7 +38,7 @@ const createUpdateNotifier = strapi => {
38
38
  config = new Configstore(
39
39
  pkg.name,
40
40
  {},
41
- { configPath: path.join(strapi.dir, '.strapi-updater.json') }
41
+ { configPath: path.join(strapi.dirs.root, '.strapi-updater.json') }
42
42
  );
43
43
  } catch {
44
44
  // we don't have write access to the file system
@@ -67,6 +67,7 @@ const createUpdateNotifier = strapi => {
67
67
  const now = Date.now();
68
68
  const latestVersion = config.get('latest');
69
69
  const lastNotification = config.get('lastNotification') || 0;
70
+
70
71
  if (
71
72
  !process.stdout.isTTY ||
72
73
  lastNotification + notifInterval > now ||
package/package.json CHANGED
@@ -1,102 +1,7 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.0.0-next.11",
3
+ "version": "4.0.0-next.15",
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
- "homepage": "https://strapi.io",
6
- "directories": {
7
- "lib": "./lib",
8
- "bin": "./bin"
9
- },
10
- "main": "./lib",
11
- "types": "./lib/index.d.ts",
12
- "bin": {
13
- "strapi": "./bin/strapi.js"
14
- },
15
- "dependencies": {
16
- "@koa/cors": "^3.0.0",
17
- "@koa/router": "10.1.1",
18
- "@strapi/admin": "4.0.0-next.11",
19
- "@strapi/database": "4.0.0-next.11",
20
- "@strapi/generate-new": "4.0.0-next.11",
21
- "@strapi/generators": "4.0.0-next.11",
22
- "@strapi/logger": "4.0.0-next.11",
23
- "@strapi/plugin-content-manager": "4.0.0-next.11",
24
- "@strapi/plugin-content-type-builder": "4.0.0-next.11",
25
- "@strapi/plugin-email": "4.0.0-next.11",
26
- "@strapi/plugin-upload": "4.0.0-next.11",
27
- "@strapi/utils": "4.0.0-next.11",
28
- "async": "^2.1.2",
29
- "boom": "^7.3.0",
30
- "boxen": "4.2.0",
31
- "chalk": "^4.1.1",
32
- "chokidar": "3.5.1",
33
- "ci-info": "3.1.1",
34
- "cli-table3": "^0.6.0",
35
- "commander": "6.1.0",
36
- "configstore": "5.0.1",
37
- "cross-spawn": "^7.0.3",
38
- "debug": "^4.1.1",
39
- "delegates": "^1.0.0",
40
- "dotenv": "10.0.0",
41
- "execa": "^1.0.0",
42
- "fs-extra": "^9.1.0",
43
- "glob": "^7.1.2",
44
- "inquirer": "^6.2.1",
45
- "is-docker": "2.2.1",
46
- "koa": "^2.13.1",
47
- "koa-body": "^4.2.0",
48
- "koa-compose": "^4.1.0",
49
- "koa-compress": "^5.0.1",
50
- "koa-convert": "^2.0.0",
51
- "koa-favicon": "^2.0.0",
52
- "koa-helmet": "6.1.0",
53
- "koa-i18n": "^2.1.0",
54
- "koa-ip": "^2.0.0",
55
- "koa-locale": "~1.3.0",
56
- "koa-mount": "4.0.0",
57
- "koa-session": "^6.2.0",
58
- "koa-static": "^5.0.0",
59
- "lodash": "4.17.21",
60
- "node-fetch": "2.6.1",
61
- "node-machine-id": "1.1.12",
62
- "node-schedule": "1.3.2",
63
- "open": "8.2.1",
64
- "ora": "^5.4.0",
65
- "package-json": "6.5.0",
66
- "plop": "2.7.4",
67
- "pluralize": "8.0.0",
68
- "qs": "^6.10.1",
69
- "resolve-cwd": "^3.0.0",
70
- "rimraf": "^3.0.2",
71
- "semver": "7.3.5"
72
- },
73
- "scripts": {
74
- "postinstall": "node lib/utils/success.js"
75
- },
76
- "author": {
77
- "email": "hi@strapi.io",
78
- "name": "Strapi team",
79
- "url": "https://strapi.io"
80
- },
81
- "maintainers": [
82
- {
83
- "name": "Strapi team",
84
- "email": "hi@strapi.io",
85
- "url": "https://strapi.io"
86
- }
87
- ],
88
- "repository": {
89
- "type": "git",
90
- "url": "git://github.com/strapi/strapi.git"
91
- },
92
- "bugs": {
93
- "url": "https://github.com/strapi/strapi/issues"
94
- },
95
- "engines": {
96
- "node": ">=12.x.x <=16.x.x",
97
- "npm": ">=6.0.0"
98
- },
99
- "license": "SEE LICENSE IN LICENSE",
100
5
  "keywords": [
101
6
  "strapi",
102
7
  "cms",
@@ -133,11 +38,96 @@
133
38
  "backend",
134
39
  "open source",
135
40
  "self hosted",
136
- "javascript",
137
41
  "lerna",
138
42
  "lernajs",
139
43
  "react",
140
44
  "reactjs"
141
45
  ],
142
- "gitHead": "3d8950e29d465a0917db9bbd0e034e5227506716"
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-next.15",
84
+ "@strapi/database": "4.0.0-next.15",
85
+ "@strapi/generate-new": "4.0.0-next.15",
86
+ "@strapi/generators": "4.0.0-next.15",
87
+ "@strapi/logger": "4.0.0-next.15",
88
+ "@strapi/plugin-content-manager": "4.0.0-next.15",
89
+ "@strapi/plugin-content-type-builder": "4.0.0-next.15",
90
+ "@strapi/plugin-email": "4.0.0-next.15",
91
+ "@strapi/plugin-upload": "4.0.0-next.15",
92
+ "@strapi/utils": "4.0.0-next.15",
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": "3d2740ae0d80d9ed61d1429a92756bbe39fa97be"
143
133
  }
@@ -1,5 +0,0 @@
1
- {
2
- "cron": {
3
- "enabled": true
4
- }
5
- }
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Module dependencies
5
- */
6
-
7
- // Public node modules.
8
- const _ = require('lodash');
9
- const cron = require('node-schedule');
10
-
11
- /**
12
- * CRON hook
13
- */
14
-
15
- module.exports = strapi => {
16
- return {
17
- /**
18
- * Initialize the hook
19
- */
20
-
21
- initialize() {
22
- if (strapi.config.get('server.cron.enabled', false) === true) {
23
- _.forEach(_.keys(strapi.config.get('functions.cron', {})), taskExpression => {
24
- const taskValue = strapi.config.functions.cron[taskExpression];
25
-
26
- if (_.isFunction(taskValue)) {
27
- return cron.scheduleJob(taskExpression, taskValue);
28
- }
29
-
30
- const options = _.get(taskValue, 'options', {});
31
-
32
- cron.scheduleJob(
33
- {
34
- rule: taskExpression,
35
- ...options,
36
- },
37
- taskValue.task
38
- );
39
- });
40
- }
41
- },
42
- };
43
- };
@@ -1,9 +0,0 @@
1
- {
2
- "language": {
3
- "enabled": false,
4
- "defaultLocale": "en_us",
5
- "locales": ["en_us"],
6
- "modes": ["query", "subdomain", "cookie", "header", "url", "tld"],
7
- "cookieName": "locale"
8
- }
9
- }
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Module dependencies
5
- */
6
-
7
- // Node.js core.
8
- const { resolve } = require('path');
9
- const locale = require('koa-locale');
10
- const i18n = require('koa-i18n');
11
- /**
12
- * Language hook
13
- */
14
-
15
- module.exports = strapi => {
16
- return {
17
- /**
18
- * Initialize the hook
19
- */
20
-
21
- initialize() {
22
- locale(strapi.server.app);
23
-
24
- const { defaultLocale, modes, cookieName } = strapi.config.middleware.settings.language;
25
-
26
- const directory = resolve(strapi.config.appPath, strapi.config.paths.config, 'locales');
27
-
28
- strapi.server.use(
29
- i18n(strapi.server.app, {
30
- directory,
31
- locales: strapi.config.get('middleware.settings.language.locales', []),
32
- defaultLocale,
33
- modes,
34
- cookieName,
35
- extension: '.json',
36
- })
37
- );
38
- },
39
- };
40
- };