@strapi/strapi 4.4.0-beta.4 → 4.4.0-rc.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/lib/Strapi.js CHANGED
@@ -21,9 +21,10 @@ const createEntityService = require('./services/entity-service');
21
21
  const createCronService = require('./services/cron');
22
22
  const entityValidator = require('./services/entity-validator');
23
23
  const createTelemetry = require('./services/metrics');
24
+ const requestContext = require('./services/request-context');
24
25
  const createAuth = require('./services/auth');
25
- const createContentAPI = require('./services/content-api');
26
26
  const createCustomFields = require('./services/custom-fields');
27
+ const createContentAPI = require('./services/content-api');
27
28
  const createUpdateNotifier = require('./utils/update-notifier');
28
29
  const createStartupLogger = require('./utils/startup-logger');
29
30
  const { LIFECYCLES } = require('./utils/lifecycles');
@@ -114,6 +115,7 @@ class Strapi {
114
115
  this.log = createLogger(this.config.get('logger', {}));
115
116
  this.cron = createCronService();
116
117
  this.telemetry = createTelemetry(this);
118
+ this.requestContext = requestContext;
117
119
 
118
120
  this.customFields = createCustomFields(this);
119
121
 
@@ -131,11 +131,12 @@ const loadDir = async (dir) => {
131
131
 
132
132
  const root = {};
133
133
  for (const fd of fds) {
134
- if (!fd.isFile()) {
134
+ if (!fd.isFile() || extname(fd.name) === '.map') {
135
135
  continue;
136
136
  }
137
137
 
138
138
  const key = basename(fd.name, extname(fd.name));
139
+
139
140
  root[normalizeName(key)] = await loadFile(join(dir, fd.name));
140
141
  }
141
142
 
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const { AsyncLocalStorage } = require('async_hooks');
4
+
5
+ const storage = new AsyncLocalStorage();
6
+
7
+ const requestCtx = {
8
+ async run(store, cb) {
9
+ return storage.run(store, cb);
10
+ },
11
+
12
+ get() {
13
+ return storage.getStore();
14
+ },
15
+ };
16
+
17
+ module.exports = requestCtx;
@@ -9,6 +9,7 @@ const { createContentAPI } = require('./content-api');
9
9
  const registerAllRoutes = require('./register-routes');
10
10
  const registerApplicationMiddlewares = require('./register-middlewares');
11
11
  const createKoaApp = require('./koa');
12
+ const requestCtx = require('../request-context');
12
13
 
13
14
  const healthCheck = async (ctx) => {
14
15
  ctx.set('strapi', 'You are so French!');
@@ -33,6 +34,8 @@ const createServer = (strapi) => {
33
34
  keys: strapi.config.get('server.app.keys'),
34
35
  });
35
36
 
37
+ app.use((ctx, next) => requestCtx.run(ctx, () => next()));
38
+
36
39
  const router = new Router();
37
40
 
38
41
  const routeManager = createRouteManager(strapi);
@@ -29,6 +29,9 @@ export type NonUniqueAttribute = { unique: false };
29
29
  export type ConfigurableAttribute = { configurable: true };
30
30
  export type NonConfigurableAttribute = { configurable: false };
31
31
 
32
+ // custom field
33
+ export type CustomField<T extends string, P extends object = undefined> = { customField: T, options?: P };
34
+
32
35
  // min/max
33
36
  export type SetMinMax<T extends MinMaxOption<U>, U = number> = T;
34
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.4.0-beta.4",
3
+ "version": "4.4.0-rc.1",
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",
@@ -80,18 +80,18 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.4.1",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.4.0-beta.4",
84
- "@strapi/database": "4.4.0-beta.4",
85
- "@strapi/generate-new": "4.4.0-beta.4",
86
- "@strapi/generators": "4.4.0-beta.4",
87
- "@strapi/logger": "4.4.0-beta.4",
88
- "@strapi/permissions": "4.4.0-beta.4",
89
- "@strapi/plugin-content-manager": "4.4.0-beta.4",
90
- "@strapi/plugin-content-type-builder": "4.4.0-beta.4",
91
- "@strapi/plugin-email": "4.4.0-beta.4",
92
- "@strapi/plugin-upload": "4.4.0-beta.4",
93
- "@strapi/typescript-utils": "4.4.0-beta.4",
94
- "@strapi/utils": "4.4.0-beta.4",
83
+ "@strapi/admin": "4.4.0-rc.1",
84
+ "@strapi/database": "4.4.0-rc.1",
85
+ "@strapi/generate-new": "4.4.0-rc.1",
86
+ "@strapi/generators": "4.4.0-rc.1",
87
+ "@strapi/logger": "4.4.0-rc.1",
88
+ "@strapi/permissions": "4.4.0-rc.1",
89
+ "@strapi/plugin-content-manager": "4.4.0-rc.1",
90
+ "@strapi/plugin-content-type-builder": "4.4.0-rc.1",
91
+ "@strapi/plugin-email": "4.4.0-rc.1",
92
+ "@strapi/plugin-upload": "4.4.0-rc.1",
93
+ "@strapi/typescript-utils": "4.4.0-rc.1",
94
+ "@strapi/utils": "4.4.0-rc.1",
95
95
  "bcryptjs": "2.4.3",
96
96
  "boxen": "5.1.2",
97
97
  "chalk": "4.1.2",
@@ -140,5 +140,5 @@
140
140
  "node": ">=14.19.1 <=18.x.x",
141
141
  "npm": ">=6.0.0"
142
142
  },
143
- "gitHead": "8ad31453be3eda4e01eae027995e7e584892e688"
143
+ "gitHead": "00c788873a5b25b63ccdeaad6b0781d26c26d90d"
144
144
  }