vovk 3.0.0-draft.262 → 3.0.0-draft.263
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/cjs/utils/createDecorator.js +2 -6
- package/cjs/utils/withStandard.d.ts +1 -0
- package/cjs/utils/withValidationLibrary.d.ts +1 -0
- package/cjs/utils/withValidationLibrary.js +1 -1
- package/mjs/utils/createDecorator.js +2 -6
- package/mjs/utils/withStandard.d.ts +1 -0
- package/mjs/utils/withValidationLibrary.d.ts +1 -0
- package/mjs/utils/withValidationLibrary.js +1 -1
- package/package.json +1 -1
|
@@ -19,12 +19,8 @@ function createDecorator(handler, initHandler) {
|
|
|
19
19
|
controller[propertyKey] = method;
|
|
20
20
|
method._controller = controller;
|
|
21
21
|
method._sourceMethod = sourceMethod;
|
|
22
|
-
method.fn =
|
|
23
|
-
|
|
24
|
-
return (await originalMethod.fn?.call(controller, req, params));
|
|
25
|
-
};
|
|
26
|
-
return handler ? handler.call(controller, req, next, ...args) : next();
|
|
27
|
-
};
|
|
22
|
+
method.fn = originalMethod.fn;
|
|
23
|
+
sourceMethod.wrapper = method;
|
|
28
24
|
// TODO define internal method type
|
|
29
25
|
originalMethod._controller = controller;
|
|
30
26
|
const handlerSchema = controller._handlers?.[propertyKey] ?? null;
|
|
@@ -25,6 +25,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
|
|
|
25
25
|
isRPC?: boolean;
|
|
26
26
|
} & {
|
|
27
27
|
schema: import("../types").VovkHandlerSchema;
|
|
28
|
+
wrapper?: ((req: VovkRequest<any, any, any>, params: Parameters<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>[1]) => ReturnType<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>) | undefined;
|
|
28
29
|
} & {
|
|
29
30
|
fn: {
|
|
30
31
|
<RETURN_TYPE = ReturnType<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>>(input?: ((undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? {
|
|
@@ -22,6 +22,7 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
|
|
|
22
22
|
}) => KnownAny;
|
|
23
23
|
}): T & {
|
|
24
24
|
schema: VovkHandlerSchema;
|
|
25
|
+
wrapper?: (req: VovkRequestAny, params: Parameters<T>[1]) => ReturnType<T>;
|
|
25
26
|
} & {
|
|
26
27
|
fn: {
|
|
27
28
|
<RETURN_TYPE = ReturnType<T>>(input?: (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? {
|
|
@@ -89,7 +89,7 @@ function withValidationLibrary({ isForm, disableServerSideValidation, skipSchema
|
|
|
89
89
|
},
|
|
90
90
|
};
|
|
91
91
|
fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation });
|
|
92
|
-
return resultHandler(fakeReq, (input?.params ?? {}));
|
|
92
|
+
return (resultHandler.wrapper ?? resultHandler)(fakeReq, (input?.params ?? {}));
|
|
93
93
|
}
|
|
94
94
|
const models = {
|
|
95
95
|
body,
|
|
@@ -19,12 +19,8 @@ function createDecorator(handler, initHandler) {
|
|
|
19
19
|
controller[propertyKey] = method;
|
|
20
20
|
method._controller = controller;
|
|
21
21
|
method._sourceMethod = sourceMethod;
|
|
22
|
-
method.fn =
|
|
23
|
-
|
|
24
|
-
return (await originalMethod.fn?.call(controller, req, params));
|
|
25
|
-
};
|
|
26
|
-
return handler ? handler.call(controller, req, next, ...args) : next();
|
|
27
|
-
};
|
|
22
|
+
method.fn = originalMethod.fn;
|
|
23
|
+
sourceMethod.wrapper = method;
|
|
28
24
|
// TODO define internal method type
|
|
29
25
|
originalMethod._controller = controller;
|
|
30
26
|
const handlerSchema = controller._handlers?.[propertyKey] ?? null;
|
|
@@ -25,6 +25,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
|
|
|
25
25
|
isRPC?: boolean;
|
|
26
26
|
} & {
|
|
27
27
|
schema: import("../types").VovkHandlerSchema;
|
|
28
|
+
wrapper?: ((req: VovkRequest<any, any, any>, params: Parameters<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>[1]) => ReturnType<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>) | undefined;
|
|
28
29
|
} & {
|
|
29
30
|
fn: {
|
|
30
31
|
<RETURN_TYPE = ReturnType<VovkTypedMethod<T, BODY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<BODY> : any, QUERY extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<QUERY> : any, PARAMS extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<PARAMS> : any, OUTPUT extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<OUTPUT> : any, ITERATION extends StandardSchemaV1<unknown, unknown> ? StandardSchemaV1.InferOutput<ITERATION> : any, IS_FORM extends true ? true : any>>>(input?: ((undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? {
|
|
@@ -22,6 +22,7 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
|
|
|
22
22
|
}) => KnownAny;
|
|
23
23
|
}): T & {
|
|
24
24
|
schema: VovkHandlerSchema;
|
|
25
|
+
wrapper?: (req: VovkRequestAny, params: Parameters<T>[1]) => ReturnType<T>;
|
|
25
26
|
} & {
|
|
26
27
|
fn: {
|
|
27
28
|
<RETURN_TYPE = ReturnType<T>>(input?: (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? {
|
|
@@ -89,7 +89,7 @@ function withValidationLibrary({ isForm, disableServerSideValidation, skipSchema
|
|
|
89
89
|
},
|
|
90
90
|
};
|
|
91
91
|
fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation });
|
|
92
|
-
return resultHandler(fakeReq, (input?.params ?? {}));
|
|
92
|
+
return (resultHandler.wrapper ?? resultHandler)(fakeReq, (input?.params ?? {}));
|
|
93
93
|
}
|
|
94
94
|
const models = {
|
|
95
95
|
body,
|