@strapi/strapi 4.10.0 → 4.10.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/coverage/clover.xml +1613 -0
- package/coverage/coverage-final.json +48 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/commands/__tests__/data-transfer/shared/index.html +116 -0
- package/coverage/lcov-report/commands/__tests__/data-transfer/shared/transfer.test.utils.js.html +133 -0
- package/coverage/lcov-report/commands/admin-create.js.html +424 -0
- package/coverage/lcov-report/commands/admin-reset.js.html +241 -0
- package/coverage/lcov-report/commands/generate-template.js.html +373 -0
- package/coverage/lcov-report/commands/index.html +146 -0
- package/coverage/lcov-report/commands/transfer/export.js.html +619 -0
- package/coverage/lcov-report/commands/transfer/import.js.html +562 -0
- package/coverage/lcov-report/commands/transfer/index.html +146 -0
- package/coverage/lcov-report/commands/transfer/transfer.js.html +532 -0
- package/coverage/lcov-report/commands/utils/helpers.js.html +430 -0
- package/coverage/lcov-report/commands/utils/index.html +116 -0
- package/coverage/lcov-report/core/registries/custom-fields.js.html +301 -0
- package/coverage/lcov-report/core/registries/index.html +116 -0
- package/coverage/lcov-report/core-api/controller/collection-type.js.html +418 -0
- package/coverage/lcov-report/core-api/controller/index.html +161 -0
- package/coverage/lcov-report/core-api/controller/index.js.html +220 -0
- package/coverage/lcov-report/core-api/controller/single-type.js.html +274 -0
- package/coverage/lcov-report/core-api/controller/transform.js.html +376 -0
- package/coverage/lcov-report/core-api/service/collection-type.js.html +325 -0
- package/coverage/lcov-report/core-api/service/index.html +161 -0
- package/coverage/lcov-report/core-api/service/index.js.html +220 -0
- package/coverage/lcov-report/core-api/service/pagination.js.html +460 -0
- package/coverage/lcov-report/core-api/service/single-type.js.html +301 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +386 -0
- package/coverage/lcov-report/load/filepath-to-prop-path.js.html +151 -0
- package/coverage/lcov-report/load/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/services/content-api/index.html +116 -0
- package/coverage/lcov-report/services/content-api/index.js.html +307 -0
- package/coverage/lcov-report/services/content-api/permissions/engine.js.html +100 -0
- package/coverage/lcov-report/services/content-api/permissions/index.html +131 -0
- package/coverage/lcov-report/services/content-api/permissions/index.js.html +529 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/action.js.html +142 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/condition.js.html +142 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/index.html +146 -0
- package/coverage/lcov-report/services/content-api/permissions/providers/index.js.html +112 -0
- package/coverage/lcov-report/services/core-store.js.html +520 -0
- package/coverage/lcov-report/services/entity-service/attributes/index.html +131 -0
- package/coverage/lcov-report/services/entity-service/attributes/index.js.html +178 -0
- package/coverage/lcov-report/services/entity-service/attributes/transforms.js.html +145 -0
- package/coverage/lcov-report/services/entity-service/components.js.html +1246 -0
- package/coverage/lcov-report/services/entity-service/index.html +146 -0
- package/coverage/lcov-report/services/entity-service/index.js.html +1120 -0
- package/coverage/lcov-report/services/entity-service/params.js.html +112 -0
- package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/index.html +116 -0
- package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/relations.testdata.js.html +544 -0
- package/coverage/lcov-report/services/entity-validator/index.html +131 -0
- package/coverage/lcov-report/services/entity-validator/index.js.html +1231 -0
- package/coverage/lcov-report/services/entity-validator/validators.js.html +733 -0
- package/coverage/lcov-report/services/event-hub.js.html +319 -0
- package/coverage/lcov-report/services/fs.js.html +259 -0
- package/coverage/lcov-report/services/index.html +161 -0
- package/coverage/lcov-report/services/metrics/admin-user-hash.js.html +148 -0
- package/coverage/lcov-report/services/metrics/index.html +206 -0
- package/coverage/lcov-report/services/metrics/index.js.html +265 -0
- package/coverage/lcov-report/services/metrics/is-truthy.js.html +112 -0
- package/coverage/lcov-report/services/metrics/middleware.js.html +184 -0
- package/coverage/lcov-report/services/metrics/rate-limiter.js.html +166 -0
- package/coverage/lcov-report/services/metrics/sender.js.html +394 -0
- package/coverage/lcov-report/services/metrics/stringify-deep.js.html +151 -0
- package/coverage/lcov-report/services/utils/index.html +116 -0
- package/coverage/lcov-report/services/utils/upload-files.js.html +322 -0
- package/coverage/lcov-report/services/worker-queue.js.html +262 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/utils/convert-custom-field-type.js.html +151 -0
- package/coverage/lcov-report/utils/index.html +146 -0
- package/coverage/lcov-report/utils/machine-id.js.html +127 -0
- package/coverage/lcov-report/utils/url-from-segments.js.html +121 -0
- package/lib/commands/__tests__/commands.test.js +20 -0
- package/lib/commands/__tests__/commands.test.utils.js +16 -0
- package/lib/commands/actions/admin/create-user/__tests__/admin.create-user.test.js +450 -0
- package/lib/commands/actions/admin/reset-user-password/__tests__/admin.reset-user-password.test.js +145 -0
- package/lib/commands/actions/build/action.js +18 -0
- package/lib/commands/actions/build/command.js +15 -0
- package/lib/commands/actions/export/__tests__/export.test.js +175 -0
- package/lib/commands/actions/import/__tests__/import.test.js +143 -0
- package/lib/commands/actions/templates/generate/__tests__/templates.generate.js +118 -0
- package/lib/commands/actions/transfer/__tests__/transfer.test.js +178 -0
- package/lib/core/registries/__tests__/custom-fields.test.js +152 -0
- package/lib/core-api/__tests__/controller.test.js +39 -0
- package/lib/core-api/controller/__tests__/transform.test.js +226 -0
- package/lib/core-api/service/__tests__/index.test.js +127 -0
- package/lib/core-api/service/__tests__/pagination.test.js +275 -0
- package/lib/load/__tests__/filepath-to-prop-path.test.js +30 -0
- package/lib/middlewares/__tests__/errors.test.js +21 -0
- package/lib/services/__tests__/content-api-permissions.test.js +291 -0
- package/lib/services/__tests__/core-store.test.js +148 -0
- package/lib/services/__tests__/event-hub.test.js +126 -0
- package/lib/services/__tests__/fs.test.js +78 -0
- package/lib/services/__tests__/worker-queue.test.js +47 -0
- package/lib/services/entity-service/__tests__/entity-service-events.test.js +117 -0
- package/lib/services/entity-service/__tests__/entity-service.test.js +587 -0
- package/lib/services/entity-validator/__tests__/biginteger-validators.test.js +220 -0
- package/lib/services/entity-validator/__tests__/date-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/datetime-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/email-validators.test.js +56 -0
- package/lib/services/entity-validator/__tests__/enumeration-validators.test.js +43 -0
- package/lib/services/entity-validator/__tests__/float-validators.test.js +278 -0
- package/lib/services/entity-validator/__tests__/index.test.js +609 -0
- package/lib/services/entity-validator/__tests__/integer-validators.test.js +278 -0
- package/lib/services/entity-validator/__tests__/relations/attribute-level.test.js +123 -0
- package/lib/services/entity-validator/__tests__/relations/component-level.test.js +275 -0
- package/lib/services/entity-validator/__tests__/relations/dynamic-zone-level.test.js +159 -0
- package/lib/services/entity-validator/__tests__/relations/media-level.test.js +74 -0
- package/lib/services/entity-validator/__tests__/relations/utils/relations.testdata.js +153 -0
- package/lib/services/entity-validator/__tests__/string-validators.test.js +374 -0
- package/lib/services/entity-validator/__tests__/time-validators.test.js +183 -0
- package/lib/services/entity-validator/__tests__/timestamp-validators.test.js +204 -0
- package/lib/services/entity-validator/__tests__/uid-validators.test.js +229 -0
- package/lib/services/metrics/__tests__/admin-user-hash.test.js +41 -0
- package/lib/services/metrics/__tests__/index.test.js +157 -0
- package/lib/services/metrics/__tests__/is-truthy.js +33 -0
- package/lib/services/metrics/__tests__/middleware.test.js +60 -0
- package/lib/services/metrics/__tests__/rate-limiter.test.js +50 -0
- package/lib/services/metrics/__tests__/stringify-deep.test.js +27 -0
- package/lib/utils/__tests__/convert-custom-field-type.test.js +69 -0
- package/lib/utils/__tests__/url-from-segments.test.js +40 -0
- package/package.json +15 -15
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const createMiddleware = require('../middleware');
|
|
4
|
+
|
|
5
|
+
describe('Metrics middleware', () => {
|
|
6
|
+
test('Ignores request with extension in them', async () => {
|
|
7
|
+
const sendEvent = jest.fn();
|
|
8
|
+
|
|
9
|
+
const middleware = createMiddleware({ sendEvent });
|
|
10
|
+
|
|
11
|
+
await middleware(
|
|
12
|
+
{
|
|
13
|
+
request: {
|
|
14
|
+
method: 'GET',
|
|
15
|
+
url: '/uploads/image.png',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
jest.fn()
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
expect(sendEvent).not.toHaveBeenCalled();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test.each(['OPTIONS', 'HEAD'])('Ignores %s method', async (method) => {
|
|
25
|
+
const sendEvent = jest.fn();
|
|
26
|
+
|
|
27
|
+
const middleware = createMiddleware({ sendEvent });
|
|
28
|
+
|
|
29
|
+
await middleware(
|
|
30
|
+
{
|
|
31
|
+
request: {
|
|
32
|
+
method,
|
|
33
|
+
url: '/some-api',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
jest.fn()
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
expect(sendEvent).not.toHaveBeenCalled();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('Stops sending after 1000 events', async () => {
|
|
43
|
+
const sendEvent = jest.fn();
|
|
44
|
+
const middleware = createMiddleware({ sendEvent });
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < 2000; i += 1) {
|
|
47
|
+
await middleware(
|
|
48
|
+
{
|
|
49
|
+
request: {
|
|
50
|
+
method: 'GET',
|
|
51
|
+
url: '/some-api',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
jest.fn()
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
expect(sendEvent).toHaveBeenCalledTimes(1000);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const wrapWithRateLimiter = require('../rate-limiter');
|
|
4
|
+
|
|
5
|
+
describe('Telemetry daily RateLimiter', () => {
|
|
6
|
+
test('Passes event and payload to sender', async () => {
|
|
7
|
+
const sender = jest.fn(() => Promise.resolve(true));
|
|
8
|
+
|
|
9
|
+
const send = wrapWithRateLimiter(sender, { limitedEvents: ['testEvent'] });
|
|
10
|
+
|
|
11
|
+
const payload = { key: 'value' };
|
|
12
|
+
await send('notRestricted', payload);
|
|
13
|
+
|
|
14
|
+
expect(sender).toHaveBeenCalledWith('notRestricted', payload);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Calls sender if event is not restricted', async () => {
|
|
18
|
+
const sender = jest.fn(() => Promise.resolve(true));
|
|
19
|
+
|
|
20
|
+
const send = wrapWithRateLimiter(sender, { limitedEvents: ['testEvent'] });
|
|
21
|
+
|
|
22
|
+
await send('notRestricted');
|
|
23
|
+
|
|
24
|
+
expect(sender).toHaveBeenCalledWith('notRestricted');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('Calls the sender as many times as request when events is not restricted', async () => {
|
|
28
|
+
const sender = jest.fn(() => Promise.resolve(true));
|
|
29
|
+
|
|
30
|
+
const send = wrapWithRateLimiter(sender, { limitedEvents: ['testEvent'] });
|
|
31
|
+
|
|
32
|
+
await send('notRestricted');
|
|
33
|
+
await send('notRestricted');
|
|
34
|
+
await send('notRestricted');
|
|
35
|
+
|
|
36
|
+
expect(sender).toHaveBeenCalledTimes(3);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Calls the sender only once when event is restricted', async () => {
|
|
40
|
+
const sender = jest.fn(() => Promise.resolve(true));
|
|
41
|
+
|
|
42
|
+
const send = wrapWithRateLimiter(sender, { limitedEvents: ['restrictedEvent'] });
|
|
43
|
+
|
|
44
|
+
await send('restrictedEvent');
|
|
45
|
+
await send('restrictedEvent');
|
|
46
|
+
await send('restrictedEvent');
|
|
47
|
+
|
|
48
|
+
expect(sender).toHaveBeenCalledTimes(1);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const stringifyDeep = require('../stringify-deep');
|
|
4
|
+
|
|
5
|
+
describe('stringifyDeep', () => {
|
|
6
|
+
test('Stringifies recursively', () => {
|
|
7
|
+
const input = {
|
|
8
|
+
property: 15,
|
|
9
|
+
subOjbect: {
|
|
10
|
+
property: 'test',
|
|
11
|
+
number: 81,
|
|
12
|
+
boolean: true,
|
|
13
|
+
},
|
|
14
|
+
arrayValue: ['valueA', 'valueB'],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
expect(stringifyDeep(input)).toStrictEqual({
|
|
18
|
+
property: '15',
|
|
19
|
+
subOjbect: {
|
|
20
|
+
property: 'test',
|
|
21
|
+
number: '81',
|
|
22
|
+
boolean: 'true',
|
|
23
|
+
},
|
|
24
|
+
arrayValue: ['valueA', 'valueB'],
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const convertCustomFieldType = require('../convert-custom-field-type');
|
|
4
|
+
|
|
5
|
+
describe('format attributes', () => {
|
|
6
|
+
it('replaces type customField with the underlying data type', () => {
|
|
7
|
+
global.strapi = {
|
|
8
|
+
container: {
|
|
9
|
+
// mock container.get('custom-fields')
|
|
10
|
+
get: jest.fn(() => ({
|
|
11
|
+
// mock container.get('custom-fields').get(uid)
|
|
12
|
+
get: jest.fn(() => ({
|
|
13
|
+
name: 'color',
|
|
14
|
+
plugin: 'mycustomfields',
|
|
15
|
+
type: 'text',
|
|
16
|
+
})),
|
|
17
|
+
})),
|
|
18
|
+
},
|
|
19
|
+
contentTypes: {
|
|
20
|
+
test: {
|
|
21
|
+
attributes: {
|
|
22
|
+
color: {
|
|
23
|
+
type: 'customField',
|
|
24
|
+
customField: 'plugin::mycustomfields.color',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
components: {
|
|
30
|
+
'default.test': {
|
|
31
|
+
attributes: {
|
|
32
|
+
color: {
|
|
33
|
+
type: 'customField',
|
|
34
|
+
customField: 'plugin::mycustomfields.color',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
convertCustomFieldType(global.strapi);
|
|
42
|
+
|
|
43
|
+
const expected = {
|
|
44
|
+
...global.strapi,
|
|
45
|
+
contentTypes: {
|
|
46
|
+
test: {
|
|
47
|
+
attributes: {
|
|
48
|
+
color: {
|
|
49
|
+
type: 'text',
|
|
50
|
+
customField: 'plugin::mycustomfields.color',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
components: {
|
|
56
|
+
'default.test': {
|
|
57
|
+
attributes: {
|
|
58
|
+
color: {
|
|
59
|
+
type: 'text',
|
|
60
|
+
customField: 'plugin::mycustomfields.color',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
expect(global.strapi).toEqual(expected);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getUrlFromSegments = require('../url-from-segments');
|
|
4
|
+
|
|
5
|
+
describe('getUrlFromSegments', () => {
|
|
6
|
+
test('Handles hostname', () => {
|
|
7
|
+
expect(getUrlFromSegments({ hostname: 'localhost' })).toEqual('http://localhost');
|
|
8
|
+
expect(getUrlFromSegments({ hostname: 'otherhost.com' })).toEqual('http://otherhost.com');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Handles port', () => {
|
|
12
|
+
expect(getUrlFromSegments({ hostname: 'localhost', port: '80' })).toEqual('http://localhost');
|
|
13
|
+
expect(getUrlFromSegments({ hostname: 'localhost', port: '8000' })).toEqual(
|
|
14
|
+
'http://localhost:8000'
|
|
15
|
+
);
|
|
16
|
+
expect(getUrlFromSegments({ hostname: 'otherhost.com', port: 5421 })).toEqual(
|
|
17
|
+
'http://otherhost.com:5421'
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Handles ssl and ports', () => {
|
|
22
|
+
expect(getUrlFromSegments({ hostname: 'localhost', ssl: true })).toEqual('https://localhost');
|
|
23
|
+
|
|
24
|
+
expect(getUrlFromSegments({ hostname: 'localhost', ssl: true, port: 532 })).toEqual(
|
|
25
|
+
'https://localhost:532'
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(getUrlFromSegments({ hostname: 'localhost', ssl: true, port: 443 })).toEqual(
|
|
29
|
+
'https://localhost'
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(getUrlFromSegments({ hostname: 'otherhost.com', ssl: true })).toEqual(
|
|
33
|
+
'https://otherhost.com'
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(getUrlFromSegments({ hostname: 'otherhost.com', ssl: true, port: 7263 })).toEqual(
|
|
37
|
+
'https://otherhost.com:7263'
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.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",
|
|
@@ -81,19 +81,19 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@koa/cors": "3.4.3",
|
|
83
83
|
"@koa/router": "10.1.1",
|
|
84
|
-
"@strapi/admin": "4.10.
|
|
85
|
-
"@strapi/data-transfer": "4.10.
|
|
86
|
-
"@strapi/database": "4.10.
|
|
87
|
-
"@strapi/generate-new": "4.10.
|
|
88
|
-
"@strapi/generators": "4.10.
|
|
89
|
-
"@strapi/logger": "4.10.
|
|
90
|
-
"@strapi/permissions": "4.10.
|
|
91
|
-
"@strapi/plugin-content-manager": "4.10.
|
|
92
|
-
"@strapi/plugin-content-type-builder": "4.10.
|
|
93
|
-
"@strapi/plugin-email": "4.10.
|
|
94
|
-
"@strapi/plugin-upload": "4.10.
|
|
95
|
-
"@strapi/typescript-utils": "4.10.
|
|
96
|
-
"@strapi/utils": "4.10.
|
|
84
|
+
"@strapi/admin": "4.10.1",
|
|
85
|
+
"@strapi/data-transfer": "4.10.1",
|
|
86
|
+
"@strapi/database": "4.10.1",
|
|
87
|
+
"@strapi/generate-new": "4.10.1",
|
|
88
|
+
"@strapi/generators": "4.10.1",
|
|
89
|
+
"@strapi/logger": "4.10.1",
|
|
90
|
+
"@strapi/permissions": "4.10.1",
|
|
91
|
+
"@strapi/plugin-content-manager": "4.10.1",
|
|
92
|
+
"@strapi/plugin-content-type-builder": "4.10.1",
|
|
93
|
+
"@strapi/plugin-email": "4.10.1",
|
|
94
|
+
"@strapi/plugin-upload": "4.10.1",
|
|
95
|
+
"@strapi/typescript-utils": "4.10.1",
|
|
96
|
+
"@strapi/utils": "4.10.1",
|
|
97
97
|
"bcryptjs": "2.4.3",
|
|
98
98
|
"boxen": "5.1.2",
|
|
99
99
|
"chalk": "4.1.2",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"node": ">=14.19.1 <=18.x.x",
|
|
144
144
|
"npm": ">=6.0.0"
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "23b531cef55c1583ea7d526b2baf2340a3129dad"
|
|
147
147
|
}
|