@strapi/strapi 4.1.1 → 4.2.0-alpha.O
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
|
@@ -205,7 +205,13 @@ class Strapi {
|
|
|
205
205
|
this.config.get('admin.autoOpen', true) !== false;
|
|
206
206
|
|
|
207
207
|
if (shouldOpenAdmin && !isInitialized) {
|
|
208
|
-
|
|
208
|
+
try {
|
|
209
|
+
await utils.openBrowser(this.config);
|
|
210
|
+
this.telemetry.send('didOpenTab');
|
|
211
|
+
} catch (e) {
|
|
212
|
+
this.telemetry.send('didNotOpenTab');
|
|
213
|
+
}
|
|
214
|
+
;
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
217
|
|
package/lib/commands/develop.js
CHANGED
|
@@ -120,7 +120,7 @@ function watchFileChanges({ dir, strapiInstance, watchIgnoreFiles, polling }) {
|
|
|
120
120
|
/(^|[/\\])\../, // dot files
|
|
121
121
|
/tmp/,
|
|
122
122
|
'**/src/admin/**',
|
|
123
|
-
'**/src/plugins/**/admin
|
|
123
|
+
'**/src/plugins/**/admin/**',
|
|
124
124
|
'**/documentation',
|
|
125
125
|
'**/documentation/**',
|
|
126
126
|
'**/node_modules',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { yup } = require('@strapi/utils');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
const { yup, toRegressedEnumValue, startsWithANumber } = require('@strapi/utils');
|
|
5
5
|
|
|
6
6
|
const LIFECYCLES = [
|
|
7
7
|
'beforeCreate',
|
|
@@ -24,7 +24,7 @@ const LIFECYCLES = [
|
|
|
24
24
|
'afterDeleteMany',
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
-
const lifecyclesShape = mapValues(keyBy(LIFECYCLES), () =>
|
|
27
|
+
const lifecyclesShape = _.mapValues(_.keyBy(LIFECYCLES), () =>
|
|
28
28
|
yup
|
|
29
29
|
.mixed()
|
|
30
30
|
.nullable()
|
|
@@ -47,6 +47,40 @@ const contentTypeSchemaValidator = yup.object().shape({
|
|
|
47
47
|
.required(),
|
|
48
48
|
})
|
|
49
49
|
.required(),
|
|
50
|
+
attributes: yup.object().test({
|
|
51
|
+
name: 'valuesCollide',
|
|
52
|
+
message: 'Some values collide when normalized',
|
|
53
|
+
test(attributes) {
|
|
54
|
+
for (const attrName in attributes) {
|
|
55
|
+
const attr = attributes[attrName];
|
|
56
|
+
if (attr.type === 'enumeration') {
|
|
57
|
+
// should not start by a number
|
|
58
|
+
if (attr.enum.some(startsWithANumber)) {
|
|
59
|
+
const message = `Enum values should not start with a number. Please modify your enumeration '${attrName}'.`;
|
|
60
|
+
|
|
61
|
+
return this.createError({ message });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// should not collide
|
|
65
|
+
const duplicates = _.uniq(
|
|
66
|
+
attr.enum
|
|
67
|
+
.map(toRegressedEnumValue)
|
|
68
|
+
.filter((value, index, values) => values.indexOf(value) !== index)
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
if (duplicates.length) {
|
|
72
|
+
const message = `Some enum values of the field '${attrName}' collide when normalized: ${duplicates.join(
|
|
73
|
+
', '
|
|
74
|
+
)}. Please modify your enumeration.`;
|
|
75
|
+
|
|
76
|
+
return this.createError({ message });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return true;
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
50
84
|
}),
|
|
51
85
|
actions: yup.object().onlyContainsFunctions(),
|
|
52
86
|
lifecycles: yup
|
|
@@ -251,8 +251,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
|
|
|
251
251
|
return null;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
await deleteComponents(uid, entityToDelete);
|
|
255
254
|
await db.query(uid).delete({ where: { id: entityToDelete.id } });
|
|
255
|
+
await deleteComponents(uid, entityToDelete);
|
|
256
256
|
|
|
257
257
|
await this.emitEvent(uid, ENTRY_DELETE, entityToDelete);
|
|
258
258
|
|
|
@@ -17,7 +17,7 @@ const pickSelectionParams = pick(['fields', 'populate']);
|
|
|
17
17
|
|
|
18
18
|
const transformParamsToQuery = (uid, params) => {
|
|
19
19
|
// NOTE: can be a CT, a Compo or nothing in the case of polymorphism (DZ & morph relations)
|
|
20
|
-
const
|
|
20
|
+
const schema = strapi.getModel(uid);
|
|
21
21
|
|
|
22
22
|
const query = {};
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ const transformParamsToQuery = (uid, params) => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (!isNil(filters)) {
|
|
35
|
-
query.where = convertFiltersQueryParams(filters,
|
|
35
|
+
query.where = convertFiltersQueryParams(filters, schema);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (!isNil(fields)) {
|
|
@@ -40,7 +40,7 @@ const transformParamsToQuery = (uid, params) => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (!isNil(populate)) {
|
|
43
|
-
query.populate = convertPopulateQueryParams(populate);
|
|
43
|
+
query.populate = convertPopulateQueryParams(populate, schema);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const isPagePagination = !isNil(page) || !isNil(pageSize);
|
|
@@ -84,7 +84,7 @@ const transformParamsToQuery = (uid, params) => {
|
|
|
84
84
|
query.limit = convertLimitQueryParams(limit);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
convertPublicationStateParams(
|
|
87
|
+
convertPublicationStateParams(schema, params, query);
|
|
88
88
|
|
|
89
89
|
return query;
|
|
90
90
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-alpha.O",
|
|
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.
|
|
84
|
-
"@strapi/database": "4.
|
|
85
|
-
"@strapi/generate-new": "4.
|
|
86
|
-
"@strapi/generators": "4.
|
|
87
|
-
"@strapi/logger": "4.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.
|
|
90
|
-
"@strapi/plugin-email": "4.
|
|
91
|
-
"@strapi/plugin-upload": "4.
|
|
92
|
-
"@strapi/utils": "4.
|
|
83
|
+
"@strapi/admin": "4.2.0-alpha.O",
|
|
84
|
+
"@strapi/database": "4.2.0-alpha.O",
|
|
85
|
+
"@strapi/generate-new": "4.2.0-alpha.O",
|
|
86
|
+
"@strapi/generators": "4.2.0-alpha.O",
|
|
87
|
+
"@strapi/logger": "4.2.0-alpha.O",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.2.0-alpha.O",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.2.0-alpha.O",
|
|
90
|
+
"@strapi/plugin-email": "4.2.0-alpha.O",
|
|
91
|
+
"@strapi/plugin-upload": "4.2.0-alpha.O",
|
|
92
|
+
"@strapi/utils": "4.2.0-alpha.O",
|
|
93
93
|
"bcryptjs": "2.4.3",
|
|
94
94
|
"boxen": "5.1.2",
|
|
95
95
|
"chalk": "4.1.2",
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"node": ">=12.22.0 <=16.x.x",
|
|
137
137
|
"npm": ">=6.0.0"
|
|
138
138
|
},
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "0e1f1ae08565a5f2427753582f37645a43c00cb2"
|
|
140
140
|
}
|