vovk 3.0.0-draft.54 → 3.0.0-draft.56
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-tsc.log +1 -1
- package/dist/createDecorator.d.ts +1 -1
- package/dist/createVovkApp.js +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils/getSchema.js +1 -4
- package/package.json +1 -1
- package/src/createDecorator.ts +1 -1
- package/src/createVovkApp.ts +3 -1
- package/src/types.ts +1 -1
- package/src/utils/getSchema.ts +1 -4
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-tsc.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { VovkHandlerSchema, KnownAny, VovkController, VovkRequest } from './types';
|
|
2
2
|
type Next = () => Promise<unknown>;
|
|
3
|
-
export declare function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(handler: null | ((this: VovkController, req: REQUEST, next: Next, ...args: ARGS) => unknown), initHandler?: (this: VovkController, ...args: ARGS) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'> | ((handlerSchema: VovkHandlerSchema | null) => Omit<VovkHandlerSchema
|
|
3
|
+
export declare function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(handler: null | ((this: VovkController, req: REQUEST, next: Next, ...args: ARGS) => unknown), initHandler?: (this: VovkController, ...args: ARGS) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'> | ((handlerSchema: VovkHandlerSchema | null) => Omit<Partial<VovkHandlerSchema>, 'path' | 'httpMethod'>) | null | undefined): (...args: ARGS) => (target: KnownAny, propertyKey: string) => void;
|
|
4
4
|
export {};
|
package/dist/createVovkApp.js
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/utils/getSchema.js
CHANGED
|
@@ -20,10 +20,7 @@ function getSchema(options) {
|
|
|
20
20
|
handlers: {
|
|
21
21
|
...(exposeValidation
|
|
22
22
|
? controller._handlers
|
|
23
|
-
: Object.fromEntries(Object.entries(controller._handlers ?? {}).map(([key, value]) => [
|
|
24
|
-
key,
|
|
25
|
-
{ ...value, validation: undefined },
|
|
26
|
-
]))),
|
|
23
|
+
: Object.fromEntries(Object.entries(controller._handlers ?? {}).map(([key, value]) => [key, { ...value, validation: {} }]))),
|
|
27
24
|
},
|
|
28
25
|
};
|
|
29
26
|
}
|
package/package.json
CHANGED
package/src/createDecorator.ts
CHANGED
|
@@ -9,7 +9,7 @@ export function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(
|
|
|
9
9
|
...args: ARGS
|
|
10
10
|
) =>
|
|
11
11
|
| Omit<VovkHandlerSchema, 'path' | 'httpMethod'>
|
|
12
|
-
| ((handlerSchema: VovkHandlerSchema | null) => Omit<VovkHandlerSchema
|
|
12
|
+
| ((handlerSchema: VovkHandlerSchema | null) => Omit<Partial<VovkHandlerSchema>, 'path' | 'httpMethod'>)
|
|
13
13
|
| null
|
|
14
14
|
| undefined
|
|
15
15
|
) {
|
package/src/createVovkApp.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type DecoratorOptions,
|
|
8
8
|
type VovkRequest,
|
|
9
9
|
type StaticClass,
|
|
10
|
+
VovkHandlerSchema,
|
|
10
11
|
} from './types';
|
|
11
12
|
import getSchema from './utils/getSchema';
|
|
12
13
|
|
|
@@ -47,7 +48,8 @@ export function createVovkApp() {
|
|
|
47
48
|
controller._handlers = {
|
|
48
49
|
...controller._handlers,
|
|
49
50
|
[propertyKey]: {
|
|
50
|
-
|
|
51
|
+
validation: {},
|
|
52
|
+
...((controller._handlers ?? {})[propertyKey] as Partial<VovkHandlerSchema>),
|
|
51
53
|
path,
|
|
52
54
|
httpMethod,
|
|
53
55
|
},
|
package/src/types.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type StaticClass = Function; // eslint-disable-line @typescript-eslint/no
|
|
|
9
9
|
export type VovkHandlerSchema = {
|
|
10
10
|
path: string;
|
|
11
11
|
httpMethod: HttpMethod;
|
|
12
|
-
validation
|
|
12
|
+
validation: { query?: KnownAny; body?: KnownAny };
|
|
13
13
|
custom?: Record<string, KnownAny>;
|
|
14
14
|
};
|
|
15
15
|
|
package/src/utils/getSchema.ts
CHANGED
|
@@ -27,10 +27,7 @@ export default function getSchema(options: {
|
|
|
27
27
|
...(exposeValidation
|
|
28
28
|
? controller._handlers
|
|
29
29
|
: Object.fromEntries(
|
|
30
|
-
Object.entries(controller._handlers ?? {}).map(([key, value]) => [
|
|
31
|
-
key,
|
|
32
|
-
{ ...value, validation: undefined },
|
|
33
|
-
])
|
|
30
|
+
Object.entries(controller._handlers ?? {}).map(([key, value]) => [key, { ...value, validation: {} }])
|
|
34
31
|
)),
|
|
35
32
|
},
|
|
36
33
|
};
|