@strapi/strapi 4.6.1 → 4.6.2
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/registries/hooks.d.ts +1 -4
- package/lib/core/registries/policies.d.ts +5 -1
- package/lib/global.d.ts +12 -7
- package/lib/index.d.ts +1 -1
- package/lib/middlewares/cors.js +8 -0
- package/lib/middlewares/public/index.js +2 -1
- package/lib/services/entity-service/index.d.ts +1 -1
- package/lib/types/core/attributes/component.d.ts +4 -7
- package/lib/types/core/attributes/utils.d.ts +4 -5
- package/lib/types/core/index.d.ts +2 -2
- package/lib/types/index.d.ts +2 -2
- package/package.json +18 -18
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
type Handler = (context: any) => any;
|
|
3
2
|
|
|
4
3
|
type AsyncHook = {
|
|
@@ -8,7 +7,6 @@ type AsyncHook = {
|
|
|
8
7
|
call(): Promise<void>;
|
|
9
8
|
};
|
|
10
9
|
|
|
11
|
-
|
|
12
10
|
type SyncHook = {
|
|
13
11
|
get handlers(): Handler[];
|
|
14
12
|
register(handler: Handler): this;
|
|
@@ -16,5 +14,4 @@ type SyncHook = {
|
|
|
16
14
|
call(): void;
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
export type Hook = AsyncHook|SyncHook
|
|
17
|
+
export type Hook = AsyncHook | SyncHook;
|
|
@@ -6,4 +6,8 @@ interface PolicyContext extends BaseContext {
|
|
|
6
6
|
is(name): boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type Policy<T=unknown> = (
|
|
9
|
+
export type Policy<T = unknown> = (
|
|
10
|
+
ctx: PolicyContext,
|
|
11
|
+
cfg: T,
|
|
12
|
+
{ strapi: Strapi }
|
|
13
|
+
) => boolean | undefined;
|
package/lib/global.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Strapi as StrapiInterface } from './types/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CollectionTypeSchema,
|
|
4
|
+
SingleTypeSchema,
|
|
5
|
+
ComponentSchema,
|
|
6
|
+
ContentTypeSchema,
|
|
7
|
+
} from './types/core/schemas';
|
|
3
8
|
import type { KeysBy } from './types/utils';
|
|
4
9
|
|
|
5
10
|
declare global {
|
|
@@ -7,7 +12,7 @@ declare global {
|
|
|
7
12
|
/**
|
|
8
13
|
* Map of UID / schemas used as a schemas database for other types.
|
|
9
14
|
* It must be extended by the user application or plugins.
|
|
10
|
-
*
|
|
15
|
+
*
|
|
11
16
|
* @example
|
|
12
17
|
* ```ts
|
|
13
18
|
* declare global {
|
|
@@ -39,12 +44,12 @@ declare global {
|
|
|
39
44
|
/**
|
|
40
45
|
* Literal union type of every component registered in Strapi.Schemas
|
|
41
46
|
*/
|
|
42
|
-
|
|
47
|
+
type ComponentUIDs = KeysBy<Schemas, ComponentSchema>;
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Global shorthand to access the `StrapiInterface` type
|
|
51
|
+
*/
|
|
52
|
+
type Strapi = StrapiInterface;
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
/**
|
package/lib/index.d.ts
CHANGED
package/lib/middlewares/cors.js
CHANGED
|
@@ -19,6 +19,14 @@ module.exports = (config) => {
|
|
|
19
19
|
const { origin, expose, maxAge, credentials, methods, headers, keepHeadersOnError } =
|
|
20
20
|
defaultsDeep(defaults, config);
|
|
21
21
|
|
|
22
|
+
if (config.enabled !== undefined) {
|
|
23
|
+
strapi.log.warn(
|
|
24
|
+
'The strapi::cors middleware no longer supports the `enabled` option. Using it' +
|
|
25
|
+
' to conditionally enable CORS might cause an insecure default. To disable strapi::cors, remove it from' +
|
|
26
|
+
' the exported array in config/middleware.js'
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
return cors({
|
|
23
31
|
async origin(ctx) {
|
|
24
32
|
let originList;
|
|
@@ -77,9 +77,10 @@ module.exports = (config, { strapi }) => {
|
|
|
77
77
|
}),
|
|
78
78
|
config: { auth: false },
|
|
79
79
|
},
|
|
80
|
+
// All other public GET-routes except /uploads/(.*) which is handled in upload middleware
|
|
80
81
|
{
|
|
81
82
|
method: 'GET',
|
|
82
|
-
path: '/(
|
|
83
|
+
path: '/((?!uploads/).+)',
|
|
83
84
|
handler: koaStatic(strapi.dirs.static.public, {
|
|
84
85
|
maxage: maxAge,
|
|
85
86
|
defer: true,
|
|
@@ -25,13 +25,10 @@ export type ComponentAttribute<
|
|
|
25
25
|
PrivateOption &
|
|
26
26
|
RequiredOption;
|
|
27
27
|
|
|
28
|
-
export type ComponentValue<
|
|
29
|
-
T
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
? V[]
|
|
33
|
-
: V
|
|
34
|
-
: never;
|
|
28
|
+
export type ComponentValue<
|
|
29
|
+
T extends Strapi.ComponentUIDs,
|
|
30
|
+
R extends boolean
|
|
31
|
+
> = GetAttributesValues<T> extends infer V ? (R extends true ? V[] : V) : never;
|
|
35
32
|
|
|
36
33
|
export type GetComponentAttributeValue<T extends Attribute> = T extends ComponentAttribute<
|
|
37
34
|
infer U,
|
|
@@ -83,11 +83,10 @@ export type GetAttributeValueByKey<
|
|
|
83
83
|
export type GetAttributesValues<T extends SchemaUID> = {
|
|
84
84
|
// Handle required attributes
|
|
85
85
|
[key in GetAttributesRequiredKeys<T>]-?: GetAttributeValueByKey<T, key>;
|
|
86
|
-
} &
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
86
|
+
} & {
|
|
87
|
+
// Handle optional attributes
|
|
88
|
+
[key in GetAttributesOptionalKeys<T>]?: GetAttributeValueByKey<T, key>;
|
|
89
|
+
};
|
|
91
90
|
|
|
92
91
|
export type GetAttributesRequiredKeys<T extends SchemaUID> = KeysBy<
|
|
93
92
|
GetAttributes<T>,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './attributes';
|
|
2
|
-
export * from
|
|
3
|
-
export * from './strapi'
|
|
2
|
+
export * from './schemas';
|
|
3
|
+
export * from './strapi';
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
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.6.
|
|
85
|
-
"@strapi/data-transfer": "4.6.
|
|
86
|
-
"@strapi/database": "4.6.
|
|
87
|
-
"@strapi/generate-new": "4.6.
|
|
88
|
-
"@strapi/generators": "4.6.
|
|
89
|
-
"@strapi/logger": "4.6.
|
|
90
|
-
"@strapi/permissions": "4.6.
|
|
91
|
-
"@strapi/plugin-content-manager": "4.6.
|
|
92
|
-
"@strapi/plugin-content-type-builder": "4.6.
|
|
93
|
-
"@strapi/plugin-email": "4.6.
|
|
94
|
-
"@strapi/plugin-upload": "4.6.
|
|
95
|
-
"@strapi/typescript-utils": "4.6.
|
|
96
|
-
"@strapi/utils": "4.6.
|
|
84
|
+
"@strapi/admin": "4.6.2",
|
|
85
|
+
"@strapi/data-transfer": "4.6.2",
|
|
86
|
+
"@strapi/database": "4.6.2",
|
|
87
|
+
"@strapi/generate-new": "4.6.2",
|
|
88
|
+
"@strapi/generators": "4.6.2",
|
|
89
|
+
"@strapi/logger": "4.6.2",
|
|
90
|
+
"@strapi/permissions": "4.6.2",
|
|
91
|
+
"@strapi/plugin-content-manager": "4.6.2",
|
|
92
|
+
"@strapi/plugin-content-type-builder": "4.6.2",
|
|
93
|
+
"@strapi/plugin-email": "4.6.2",
|
|
94
|
+
"@strapi/plugin-upload": "4.6.2",
|
|
95
|
+
"@strapi/typescript-utils": "4.6.2",
|
|
96
|
+
"@strapi/utils": "4.6.2",
|
|
97
97
|
"bcryptjs": "2.4.3",
|
|
98
98
|
"boxen": "5.1.2",
|
|
99
99
|
"chalk": "4.1.2",
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"koa-favicon": "2.1.0",
|
|
119
119
|
"koa-helmet": "6.1.0",
|
|
120
120
|
"koa-ip": "^2.1.2",
|
|
121
|
-
"koa-session": "6.
|
|
121
|
+
"koa-session": "6.4.0",
|
|
122
122
|
"koa-static": "5.0.0",
|
|
123
123
|
"lodash": "4.17.21",
|
|
124
124
|
"mime-types": "2.1.35",
|
|
125
|
-
"node-fetch": "2.6.
|
|
125
|
+
"node-fetch": "2.6.9",
|
|
126
126
|
"node-machine-id": "1.1.12",
|
|
127
127
|
"node-schedule": "2.1.0",
|
|
128
128
|
"open": "8.4.0",
|
|
@@ -135,12 +135,12 @@
|
|
|
135
135
|
"uuid": "^8.3.2"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
|
-
"supertest": "6.
|
|
138
|
+
"supertest": "6.3.3",
|
|
139
139
|
"typescript": "4.6.2"
|
|
140
140
|
},
|
|
141
141
|
"engines": {
|
|
142
142
|
"node": ">=14.19.1 <=18.x.x",
|
|
143
143
|
"npm": ">=6.0.0"
|
|
144
144
|
},
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "bae505f44c3a779905f6b8dbc0c497e24d9eabfb"
|
|
146
146
|
}
|