@strapi/strapi 4.1.11 → 4.1.12
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/core/loaders/apis.js
CHANGED
|
@@ -6,31 +6,35 @@ const _ = require('lodash');
|
|
|
6
6
|
const fse = require('fs-extra');
|
|
7
7
|
const { isKebabCase } = require('@strapi/utils');
|
|
8
8
|
|
|
9
|
-
// to handle names with numbers in it we first check if it is already in kebabCase
|
|
10
|
-
const normalizeName = name => (isKebabCase(name) ? name : _.kebabCase(name));
|
|
11
|
-
|
|
12
9
|
const DEFAULT_CONTENT_TYPE = {
|
|
13
10
|
schema: {},
|
|
14
11
|
actions: {},
|
|
15
12
|
lifecycles: {},
|
|
16
13
|
};
|
|
17
14
|
|
|
15
|
+
// to handle names with numbers in it we first check if it is already in kebabCase
|
|
16
|
+
const normalizeName = name => (isKebabCase(name) ? name : _.kebabCase(name));
|
|
17
|
+
|
|
18
|
+
const isDirectory = fd => fd.isDirectory();
|
|
19
|
+
const isDotFile = fd => fd.name.startsWith('.');
|
|
20
|
+
|
|
18
21
|
module.exports = async strapi => {
|
|
19
22
|
if (!existsSync(strapi.dirs.api)) {
|
|
20
23
|
throw new Error('Missing api folder. Please create one at `./src/api`');
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
const apisFDs = await fse.readdir(strapi.dirs.api, { withFileTypes: true })
|
|
26
|
+
const apisFDs = await (await fse.readdir(strapi.dirs.api, { withFileTypes: true }))
|
|
27
|
+
.filter(isDirectory)
|
|
28
|
+
.filter(_.negate(isDotFile));
|
|
29
|
+
|
|
24
30
|
const apis = {};
|
|
25
31
|
|
|
26
32
|
// only load folders
|
|
27
33
|
for (const apiFD of apisFDs) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const api = await loadAPI(join(strapi.dirs.api, apiFD.name));
|
|
34
|
+
const apiName = normalizeName(apiFD.name);
|
|
35
|
+
const api = await loadAPI(join(strapi.dirs.api, apiFD.name));
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
}
|
|
37
|
+
apis[apiName] = api;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
validateContentTypesUnicity(apis);
|
|
@@ -166,7 +166,9 @@ const stringValidator = composeValidators(
|
|
|
166
166
|
addUniqueValidator
|
|
167
167
|
);
|
|
168
168
|
|
|
169
|
-
const emailValidator = composeValidators(stringValidator, validator =>
|
|
169
|
+
const emailValidator = composeValidators(stringValidator, validator =>
|
|
170
|
+
validator.email().min(1, '${path} cannot be empty')
|
|
171
|
+
);
|
|
170
172
|
|
|
171
173
|
const uidValidator = composeValidators(stringValidator, validator =>
|
|
172
174
|
validator.matches(new RegExp('^[A-Za-z0-9-_.~]*$'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12",
|
|
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,16 +80,16 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.1.0",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.1.
|
|
84
|
-
"@strapi/database": "4.1.
|
|
85
|
-
"@strapi/generate-new": "4.1.
|
|
86
|
-
"@strapi/generators": "4.1.
|
|
87
|
-
"@strapi/logger": "4.1.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.1.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.1.
|
|
90
|
-
"@strapi/plugin-email": "4.1.
|
|
91
|
-
"@strapi/plugin-upload": "4.1.
|
|
92
|
-
"@strapi/utils": "4.1.
|
|
83
|
+
"@strapi/admin": "4.1.12",
|
|
84
|
+
"@strapi/database": "4.1.12",
|
|
85
|
+
"@strapi/generate-new": "4.1.12",
|
|
86
|
+
"@strapi/generators": "4.1.12",
|
|
87
|
+
"@strapi/logger": "4.1.12",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.1.12",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.1.12",
|
|
90
|
+
"@strapi/plugin-email": "4.1.12",
|
|
91
|
+
"@strapi/plugin-upload": "4.1.12",
|
|
92
|
+
"@strapi/utils": "4.1.12",
|
|
93
93
|
"bcryptjs": "2.4.3",
|
|
94
94
|
"boxen": "5.1.2",
|
|
95
95
|
"chalk": "4.1.2",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"node": ">=12.22.0 <=16.x.x",
|
|
138
138
|
"npm": ">=6.0.0"
|
|
139
139
|
},
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "ab698015cfc4f43fa0ce2ae94ec59e00a67e4cda"
|
|
141
141
|
}
|