@eggjs/controller-decorator 4.0.0-beta.35 → 4.0.0-beta.36

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.
Files changed (59) hide show
  1. package/dist/builder/ControllerMetaBuilderFactory.d.ts +10 -6
  2. package/dist/builder/ControllerMetaBuilderFactory.js +37 -41
  3. package/dist/builder/index.d.ts +1 -1
  4. package/dist/builder/index.js +3 -2
  5. package/dist/decorator/Acl.d.ts +4 -1
  6. package/dist/decorator/Acl.js +23 -21
  7. package/dist/decorator/Context.d.ts +4 -1
  8. package/dist/decorator/Context.js +15 -10
  9. package/dist/decorator/Middleware.d.ts +6 -2
  10. package/dist/decorator/Middleware.js +49 -61
  11. package/dist/decorator/http/HTTPController.d.ts +6 -2
  12. package/dist/decorator/http/HTTPController.js +22 -28
  13. package/dist/decorator/http/HTTPMethod.d.ts +6 -2
  14. package/dist/decorator/http/HTTPMethod.js +20 -16
  15. package/dist/decorator/http/HTTPParam.d.ts +152 -166
  16. package/dist/decorator/http/HTTPParam.js +208 -226
  17. package/dist/decorator/http/Host.d.ts +6 -2
  18. package/dist/decorator/http/Host.js +26 -24
  19. package/dist/decorator/http/index.d.ts +5 -4
  20. package/dist/decorator/http/index.js +7 -5
  21. package/dist/decorator/index.d.ts +8 -4
  22. package/dist/decorator/index.js +10 -5
  23. package/dist/impl/http/HTTPControllerMetaBuilder.d.ts +13 -8
  24. package/dist/impl/http/HTTPControllerMetaBuilder.js +58 -55
  25. package/dist/impl/http/HTTPControllerMethodMetaBuilder.d.ts +15 -10
  26. package/dist/impl/http/HTTPControllerMethodMetaBuilder.js +80 -96
  27. package/dist/impl/http/index.d.ts +2 -2
  28. package/dist/impl/http/index.js +4 -3
  29. package/dist/impl/index.d.ts +3 -1
  30. package/dist/impl/index.js +5 -2
  31. package/dist/index.d.ts +27 -6
  32. package/dist/index.js +29 -7
  33. package/dist/model/HTTPControllerMeta.d.ts +24 -21
  34. package/dist/model/HTTPControllerMeta.js +53 -57
  35. package/dist/model/HTTPCookies.d.ts +2 -1
  36. package/dist/model/HTTPCookies.js +3 -2
  37. package/dist/model/HTTPMethodMeta.d.ts +59 -56
  38. package/dist/model/HTTPMethodMeta.js +102 -124
  39. package/dist/model/index.d.ts +3 -3
  40. package/dist/model/index.js +5 -4
  41. package/dist/util/ControllerInfoUtil.d.ts +19 -16
  42. package/dist/util/ControllerInfoUtil.js +48 -46
  43. package/dist/util/ControllerMetadataUtil.d.ts +8 -4
  44. package/dist/util/ControllerMetadataUtil.js +21 -20
  45. package/dist/util/HTTPInfoUtil.d.ts +19 -15
  46. package/dist/util/HTTPInfoUtil.js +53 -64
  47. package/dist/util/HTTPPriorityUtil.d.ts +22 -19
  48. package/dist/util/HTTPPriorityUtil.js +39 -43
  49. package/dist/util/MethodInfoUtil.d.ts +22 -19
  50. package/dist/util/MethodInfoUtil.js +62 -72
  51. package/dist/util/index.d.ts +8 -6
  52. package/dist/util/index.js +10 -7
  53. package/dist/util/validator/ControllerValidator.d.ts +7 -3
  54. package/dist/util/validator/ControllerValidator.js +15 -14
  55. package/dist/util/validator/MethodValidator.d.ts +7 -3
  56. package/dist/util/validator/MethodValidator.js +29 -29
  57. package/dist/util/validator/index.d.ts +2 -2
  58. package/dist/util/validator/index.js +4 -3
  59. package/package.json +31 -35
@@ -1,173 +1,159 @@
1
- import type { HTTPParamParams, HTTPQueriesParams, HTTPQueryParams } from '@eggjs/tegg-types';
2
- import { InjectContext } from '../Context.ts';
1
+ import { InjectContext } from "../Context.js";
2
+ import { HTTPParamParams, HTTPQueriesParams, HTTPQueryParams } from "@eggjs/tegg-types";
3
+
4
+ //#region src/decorator/http/HTTPParam.d.ts
5
+
3
6
  /**
4
- * Inject the request body.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPBody } from 'egg';
9
- *
10
- * @HTTPController()
11
- * export class FooController {
12
- * @HTTPMethod({
13
- * path: '/foo',
14
- * method: HTTPMethodEnum.GET,
15
- * })
16
- * // POST /foo -H 'Content-Type: application/json' -d '{"foo": "bar"}'
17
- * // body = { "foo": "bar" }
18
- * async bar(@HTTPBody() body: any): Promise<void> {
19
- * console.log(body);
20
- * }
21
- * }
22
- * ```
23
- */
24
- export declare function HTTPBody(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
7
+ * Inject the request body.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPBody } from 'egg';
12
+ *
13
+ * @HTTPController()
14
+ * export class FooController {
15
+ * @HTTPMethod({
16
+ * path: '/foo',
17
+ * method: HTTPMethodEnum.GET,
18
+ * })
19
+ * // POST /foo -H 'Content-Type: application/json' -d '{"foo": "bar"}'
20
+ * // body = { "foo": "bar" }
21
+ * async bar(@HTTPBody() body: any): Promise<void> {
22
+ * console.log(body);
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ declare function HTTPBody(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
25
28
  /**
26
- * Inject the request headers.
27
- *
28
- * @example
29
- * ```typescript
30
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPHeaders, type IncomingHttpHeaders } from 'egg';
31
- *
32
- * @HTTPController()
33
- * export class FooController {
34
- * @HTTPMethod({
35
- * path: '/foo',
36
- * method: HTTPMethodEnum.GET,
37
- * })
38
- * // GET /foo -H 'X-Custom: custom'
39
- * // headers['x-custom'] = 'custom'
40
- * async bar(@HTTPHeaders() headers: IncomingHttpHeaders): Promise<void> {
41
- * console.log(headers);
42
- * }
43
- * }
44
- * ```
45
- */
46
- export declare function HTTPHeaders(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
29
+ * Inject the request headers.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPHeaders, type IncomingHttpHeaders } from 'egg';
34
+ *
35
+ * @HTTPController()
36
+ * export class FooController {
37
+ * @HTTPMethod({
38
+ * path: '/foo',
39
+ * method: HTTPMethodEnum.GET,
40
+ * })
41
+ * // GET /foo -H 'X-Custom: custom'
42
+ * // headers['x-custom'] = 'custom'
43
+ * async bar(@HTTPHeaders() headers: IncomingHttpHeaders): Promise<void> {
44
+ * console.log(headers);
45
+ * }
46
+ * }
47
+ * ```
48
+ */
49
+ declare function HTTPHeaders(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
47
50
  /**
48
- * Inject the request query string, the value is string type.
49
- *
50
- * @example
51
- * ```typescript
52
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQuery } from 'egg';
53
- *
54
- * @HTTPController()
55
- * export class FooController {
56
- * @HTTPMethod({
57
- * path: '/foo',
58
- * method: HTTPMethodEnum.GET,
59
- * })
60
- * // GET /foo?user=asd
61
- * // user = 'asd'
62
- * async bar(@HTTPQuery() user?: string): Promise<void> {
63
- * console.log(user);
64
- * }
65
- * }
66
- * ```
67
- */
68
- export declare function HTTPQuery(param?: HTTPQueryParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
51
+ * Inject the request query string, the value is string type.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQuery } from 'egg';
56
+ *
57
+ * @HTTPController()
58
+ * export class FooController {
59
+ * @HTTPMethod({
60
+ * path: '/foo',
61
+ * method: HTTPMethodEnum.GET,
62
+ * })
63
+ * // GET /foo?user=asd
64
+ * // user = 'asd'
65
+ * async bar(@HTTPQuery() user?: string): Promise<void> {
66
+ * console.log(user);
67
+ * }
68
+ * }
69
+ * ```
70
+ */
71
+ declare function HTTPQuery(param?: HTTPQueryParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
69
72
  /**
70
- * Inject the request query strings, all value are Array type.
71
- *
72
- * @example
73
- * ```typescript
74
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQueries } from 'egg';
75
- *
76
- * @HTTPController()
77
- * export class FooController {
78
- * @HTTPMethod({
79
- * path: '/foo',
80
- * method: HTTPMethodEnum.GET,
81
- * })
82
- * // GET /foo?user=asd&user=fgh
83
- * // user = ['asd', 'fgh']
84
- * async bar(@HTTPQueries({ name: 'user' }) users?: string[]): Promise<void> {
85
- * console.log(users);
86
- * }
87
- * }
88
- * ```
89
- */
90
- export declare function HTTPQueries(param?: HTTPQueriesParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
73
+ * Inject the request query strings, all value are Array type.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQueries } from 'egg';
78
+ *
79
+ * @HTTPController()
80
+ * export class FooController {
81
+ * @HTTPMethod({
82
+ * path: '/foo',
83
+ * method: HTTPMethodEnum.GET,
84
+ * })
85
+ * // GET /foo?user=asd&user=fgh
86
+ * // user = ['asd', 'fgh']
87
+ * async bar(@HTTPQueries({ name: 'user' }) users?: string[]): Promise<void> {
88
+ * console.log(users);
89
+ * }
90
+ * }
91
+ * ```
92
+ */
93
+ declare function HTTPQueries(param?: HTTPQueriesParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
91
94
  /**
92
- * Inject the request path parameter, the value is string type.
93
- *
94
- * @example
95
- * ```typescript
96
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPParam } from 'egg';
97
- *
98
- * @HTTPController()
99
- * export class FooController {
100
- * @HTTPMethod({
101
- * path: '/foo/:id',
102
- * method: HTTPMethodEnum.GET,
103
- * })
104
- * // GET /foo/123
105
- * // id = '123'
106
- * async bar(@HTTPParam() id: string): Promise<void> {
107
- * console.log(id);
108
- * }
109
- * }
110
- * ```
111
- */
112
- export declare function HTTPParam(param?: HTTPParamParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
95
+ * Inject the request path parameter, the value is string type.
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPParam } from 'egg';
100
+ *
101
+ * @HTTPController()
102
+ * export class FooController {
103
+ * @HTTPMethod({
104
+ * path: '/foo/:id',
105
+ * method: HTTPMethodEnum.GET,
106
+ * })
107
+ * // GET /foo/123
108
+ * // id = '123'
109
+ * async bar(@HTTPParam() id: string): Promise<void> {
110
+ * console.log(id);
111
+ * }
112
+ * }
113
+ * ```
114
+ */
115
+ declare function HTTPParam(param?: HTTPParamParams): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
113
116
  /**
114
- * Inject the request object.
115
- *
116
- * @example
117
- * ```typescript
118
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPRequest } from 'egg';
119
- *
120
- * @HTTPController()
121
- * export class FooController {
122
- * @HTTPMethod({
123
- * path: '/foo',
124
- * method: HTTPMethodEnum.GET,
125
- * })
126
- * async bar(@HTTPRequest() request: Request): Promise<void> {
127
- * console.log(request);
128
- * }
129
- * }
130
- * ```
131
- */
132
- export declare function HTTPRequest(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
117
+ * Inject the request object.
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPRequest } from 'egg';
122
+ *
123
+ * @HTTPController()
124
+ * export class FooController {
125
+ * @HTTPMethod({
126
+ * path: '/foo',
127
+ * method: HTTPMethodEnum.GET,
128
+ * })
129
+ * async bar(@HTTPRequest() request: Request): Promise<void> {
130
+ * console.log(request);
131
+ * }
132
+ * }
133
+ * ```
134
+ */
135
+ declare function HTTPRequest(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
133
136
  /**
134
- * Inject the request cookies.
135
- *
136
- * @example
137
- * ```typescript
138
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPCookies, type Cookies } from 'egg';
139
- *
140
- * @HTTPController()
141
- * export class FooController {
142
- * @HTTPMethod({
143
- * path: '/foo',
144
- * method: HTTPMethodEnum.GET,
145
- * })
146
- * // GET /foo -H 'Cookie: foo=bar; bar=baz'
147
- * // cookies = cookies
148
- * async bar(@HTTPCookies() cookies: Cookies): Promise<void> {
149
- * console.log(cookies);
150
- * }
151
- * }
152
- * ```
153
- */
154
- export declare function HTTPCookies(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
155
- export {
156
- /**
157
- * @example
158
- *
159
- * ```typescript
160
- * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPContext, type Context } from 'egg';
161
- *
162
- * @HTTPController()
163
- * export class FooController {
164
- * @HTTPMethod({
165
- * path: '/foo',
166
- * method: HTTPMethodEnum.GET,
167
- * })
168
- * async bar(@HTTPContext() ctx: Context): Promise<void> {
169
- * console.log(ctx);
170
- * }
171
- * ```
172
- */
173
- InjectContext as HTTPContext, };
137
+ * Inject the request cookies.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * import { HTTPController, HTTPMethod, HTTPMethodEnum, HTTPCookies, type Cookies } from 'egg';
142
+ *
143
+ * @HTTPController()
144
+ * export class FooController {
145
+ * @HTTPMethod({
146
+ * path: '/foo',
147
+ * method: HTTPMethodEnum.GET,
148
+ * })
149
+ * // GET /foo -H 'Cookie: foo=bar; bar=baz'
150
+ * // cookies = cookies
151
+ * async bar(@HTTPCookies() cookies: Cookies): Promise<void> {
152
+ * console.log(cookies);
153
+ * }
154
+ * }
155
+ * ```
156
+ */
157
+ declare function HTTPCookies(): (target: any, propertyKey: PropertyKey, parameterIndex: number) => void;
158
+ //#endregion
159
+ export { HTTPBody, HTTPCookies, HTTPHeaders, HTTPParam, HTTPQueries, HTTPQuery, HTTPRequest };