vovk 3.0.0-draft.260 → 3.0.0-draft.262

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.
@@ -16,7 +16,7 @@ const toKebabCase = (str) => str
16
16
  .replace(/^-/, ''); // Remove leading hyphen
17
17
  const assignSchema = ({ controller, propertyKey, path, options, httpMethod, vovkApp, }) => {
18
18
  if (typeof window !== 'undefined') {
19
- throw new Error('Decorators are intended for server-side use only. You have probably imported a controller on the client-side.');
19
+ throw new Error('HTTP decorators can be used on server-side only. You have probably imported a controller on the client-side.');
20
20
  }
21
21
  if (!isClass(controller)) {
22
22
  let decoratorName = httpMethod.toLowerCase();
@@ -19,8 +19,12 @@ function createDecorator(handler, initHandler) {
19
19
  controller[propertyKey] = method;
20
20
  method._controller = controller;
21
21
  method._sourceMethod = sourceMethod;
22
- method.fn = originalMethod.fn;
23
- method.models = originalMethod.models;
22
+ method.fn = function fn(req, params) {
23
+ const next = async () => {
24
+ return (await originalMethod.fn?.call(controller, req, params));
25
+ };
26
+ return handler ? handler.call(controller, req, next, ...args) : next();
27
+ };
24
28
  // TODO define internal method type
25
29
  originalMethod._controller = controller;
26
30
  const handlerSchema = controller._handlers?.[propertyKey] ?? null;
@@ -25,7 +25,7 @@ type CallerInput = {
25
25
  iteration?: KnownAny;
26
26
  } | undefined;
27
27
  init?: RequestInit;
28
- meta?: Record<string, KnownAny>;
28
+ meta: Record<string, KnownAny> | undefined;
29
29
  handlerName: string;
30
30
  moduleName: string;
31
31
  };
@@ -51,7 +51,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, on
51
51
  return {
52
52
  type: 'function',
53
53
  execute,
54
- name: `${moduleName}__${handlerName}`,
54
+ name: `${moduleName}_${handlerName}`,
55
55
  description: schema.openapi?.['x-tool-description'] ??
56
56
  ([schema.openapi?.summary ?? '', schema.openapi?.description ?? ''].filter(Boolean).join('\n') || handlerName),
57
57
  parameters: Object.keys(parametersProperties).length
@@ -25,13 +25,6 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
25
25
  isRPC?: boolean;
26
26
  } & {
27
27
  schema: import("../types").VovkHandlerSchema;
28
- models: {
29
- body: BODY;
30
- query: QUERY;
31
- params: PARAMS;
32
- output: OUTPUT;
33
- iteration: ITERATION;
34
- };
35
28
  } & {
36
29
  fn: {
37
30
  <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 ? {
@@ -48,12 +41,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
48
41
  params?: 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>["__types"]["params"] | undefined;
49
42
  } : {
50
43
  params: 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>["__types"]["params"];
51
- }) & {
52
- meta?: {
53
- [key: string]: any;
54
- __disableClientValidation?: boolean;
55
- };
56
- } : never) | undefined): (undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
44
+ }) : never) | undefined): (undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
57
45
  <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: {
58
46
  disableClientValidation?: boolean;
59
47
  } & (undefined extends BODY | undefined ? {
@@ -68,12 +56,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
68
56
  params?: 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>["__types"]["params"] | undefined;
69
57
  } : {
70
58
  params: 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>["__types"]["params"];
71
- }) & {
72
- meta?: {
73
- [key: string]: any;
74
- __disableClientValidation?: boolean;
75
- };
76
- }): RETURN_TYPE;
59
+ })): RETURN_TYPE;
77
60
  };
78
61
  models: {
79
62
  body: BODY | undefined;
@@ -1,9 +1,5 @@
1
1
  import { VovkHandlerSchema, VovkTypedMethod, VovkValidationType, type KnownAny, type VovkRequest } from '../types';
2
2
  type VovkRequestAny = VovkRequest<KnownAny, KnownAny, KnownAny>;
3
- type Meta = {
4
- __disableClientValidation?: boolean;
5
- [key: string]: KnownAny;
6
- };
7
3
  export declare function withValidationLibrary<T extends VovkTypedMethod<(req: KnownAny, params: KnownAny) => KnownAny>, BODY_MODEL, QUERY_MODEL, PARAMS_MODEL, OUTPUT_MODEL, ITERATION_MODEL, IS_FORM extends boolean = false>({ isForm, disableServerSideValidation, skipSchemaEmission, validateEachIteration, body, query, params, output, iteration, handle, toJSONSchema, validate, }: {
8
4
  isForm?: IS_FORM;
9
5
  disableServerSideValidation?: boolean | VovkValidationType[];
@@ -26,13 +22,6 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
26
22
  }) => KnownAny;
27
23
  }): T & {
28
24
  schema: VovkHandlerSchema;
29
- models: {
30
- body: BODY_MODEL;
31
- query: QUERY_MODEL;
32
- params: PARAMS_MODEL;
33
- output: OUTPUT_MODEL;
34
- iteration: ITERATION_MODEL;
35
- };
36
25
  } & {
37
26
  fn: {
38
27
  <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 ? {
@@ -49,9 +38,7 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
49
38
  params?: T["__types"]["params"];
50
39
  } : {
51
40
  params: T["__types"]["params"];
52
- }) & {
53
- meta?: Meta;
54
- } : never): (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
41
+ }) : never): (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
55
42
  <RETURN_TYPE = ReturnType<T>>(input: {
56
43
  disableClientValidation?: boolean;
57
44
  } & (undefined extends BODY_MODEL | undefined ? {
@@ -66,16 +53,14 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
66
53
  params?: T["__types"]["params"];
67
54
  } : {
68
55
  params: T["__types"]["params"];
69
- }) & {
70
- meta?: Meta;
71
- }): RETURN_TYPE;
56
+ })): RETURN_TYPE;
72
57
  };
73
58
  models: {
74
- body: typeof body;
75
- query: typeof query;
76
- params: typeof params;
77
- output: typeof output;
78
- iteration: typeof iteration;
59
+ body: BODY_MODEL | undefined;
60
+ query: QUERY_MODEL | undefined;
61
+ params: PARAMS_MODEL | undefined;
62
+ output: OUTPUT_MODEL | undefined;
63
+ iteration: ITERATION_MODEL | undefined;
79
64
  };
80
65
  };
81
66
  export {};
@@ -88,20 +88,16 @@ function withValidationLibrary({ isForm, disableServerSideValidation, skipSchema
88
88
  },
89
89
  },
90
90
  };
91
- fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation, ...(input?.meta ?? {}) });
91
+ fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation });
92
92
  return resultHandler(fakeReq, (input?.params ?? {}));
93
93
  }
94
- const models = {};
95
- if (body !== undefined)
96
- models.body = body;
97
- if (query !== undefined)
98
- models.query = query;
99
- if (params !== undefined)
100
- models.params = params;
101
- if (output !== undefined)
102
- models.output = output;
103
- if (iteration !== undefined)
104
- models.iteration = iteration;
94
+ const models = {
95
+ body,
96
+ query,
97
+ params,
98
+ output,
99
+ iteration,
100
+ };
105
101
  const resultHandlerEnhanced = Object.assign(resultHandler, { fn, models });
106
102
  if (toJSONSchema) {
107
103
  const getJsonSchema = (model, type) => Object.assign(toJSONSchema(model, { type }), type === 'body' && isForm ? { 'x-formData': isForm } : {});
@@ -16,7 +16,7 @@ const toKebabCase = (str) => str
16
16
  .replace(/^-/, ''); // Remove leading hyphen
17
17
  const assignSchema = ({ controller, propertyKey, path, options, httpMethod, vovkApp, }) => {
18
18
  if (typeof window !== 'undefined') {
19
- throw new Error('Decorators are intended for server-side use only. You have probably imported a controller on the client-side.');
19
+ throw new Error('HTTP decorators can be used on server-side only. You have probably imported a controller on the client-side.');
20
20
  }
21
21
  if (!isClass(controller)) {
22
22
  let decoratorName = httpMethod.toLowerCase();
@@ -19,8 +19,12 @@ function createDecorator(handler, initHandler) {
19
19
  controller[propertyKey] = method;
20
20
  method._controller = controller;
21
21
  method._sourceMethod = sourceMethod;
22
- method.fn = originalMethod.fn;
23
- method.models = originalMethod.models;
22
+ method.fn = function fn(req, params) {
23
+ const next = async () => {
24
+ return (await originalMethod.fn?.call(controller, req, params));
25
+ };
26
+ return handler ? handler.call(controller, req, next, ...args) : next();
27
+ };
24
28
  // TODO define internal method type
25
29
  originalMethod._controller = controller;
26
30
  const handlerSchema = controller._handlers?.[propertyKey] ?? null;
@@ -25,7 +25,7 @@ type CallerInput = {
25
25
  iteration?: KnownAny;
26
26
  } | undefined;
27
27
  init?: RequestInit;
28
- meta?: Record<string, KnownAny>;
28
+ meta: Record<string, KnownAny> | undefined;
29
29
  handlerName: string;
30
30
  moduleName: string;
31
31
  };
@@ -51,7 +51,7 @@ const createLLMTool = ({ moduleName, handlerName, caller, module, init, meta, on
51
51
  return {
52
52
  type: 'function',
53
53
  execute,
54
- name: `${moduleName}__${handlerName}`,
54
+ name: `${moduleName}_${handlerName}`,
55
55
  description: schema.openapi?.['x-tool-description'] ??
56
56
  ([schema.openapi?.summary ?? '', schema.openapi?.description ?? ''].filter(Boolean).join('\n') || handlerName),
57
57
  parameters: Object.keys(parametersProperties).length
@@ -25,13 +25,6 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
25
25
  isRPC?: boolean;
26
26
  } & {
27
27
  schema: import("../types").VovkHandlerSchema;
28
- models: {
29
- body: BODY;
30
- query: QUERY;
31
- params: PARAMS;
32
- output: OUTPUT;
33
- iteration: ITERATION;
34
- };
35
28
  } & {
36
29
  fn: {
37
30
  <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 ? {
@@ -48,12 +41,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
48
41
  params?: 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>["__types"]["params"] | undefined;
49
42
  } : {
50
43
  params: 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>["__types"]["params"];
51
- }) & {
52
- meta?: {
53
- [key: string]: any;
54
- __disableClientValidation?: boolean;
55
- };
56
- } : never) | undefined): (undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
44
+ }) : never) | undefined): (undefined extends BODY | undefined ? undefined extends QUERY | undefined ? undefined extends PARAMS | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
57
45
  <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: {
58
46
  disableClientValidation?: boolean;
59
47
  } & (undefined extends BODY | undefined ? {
@@ -68,12 +56,7 @@ export declare function withStandard<T extends (req: REQ, params: PARAMS extends
68
56
  params?: 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>["__types"]["params"] | undefined;
69
57
  } : {
70
58
  params: 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>["__types"]["params"];
71
- }) & {
72
- meta?: {
73
- [key: string]: any;
74
- __disableClientValidation?: boolean;
75
- };
76
- }): RETURN_TYPE;
59
+ })): RETURN_TYPE;
77
60
  };
78
61
  models: {
79
62
  body: BODY | undefined;
@@ -1,9 +1,5 @@
1
1
  import { VovkHandlerSchema, VovkTypedMethod, VovkValidationType, type KnownAny, type VovkRequest } from '../types';
2
2
  type VovkRequestAny = VovkRequest<KnownAny, KnownAny, KnownAny>;
3
- type Meta = {
4
- __disableClientValidation?: boolean;
5
- [key: string]: KnownAny;
6
- };
7
3
  export declare function withValidationLibrary<T extends VovkTypedMethod<(req: KnownAny, params: KnownAny) => KnownAny>, BODY_MODEL, QUERY_MODEL, PARAMS_MODEL, OUTPUT_MODEL, ITERATION_MODEL, IS_FORM extends boolean = false>({ isForm, disableServerSideValidation, skipSchemaEmission, validateEachIteration, body, query, params, output, iteration, handle, toJSONSchema, validate, }: {
8
4
  isForm?: IS_FORM;
9
5
  disableServerSideValidation?: boolean | VovkValidationType[];
@@ -26,13 +22,6 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
26
22
  }) => KnownAny;
27
23
  }): T & {
28
24
  schema: VovkHandlerSchema;
29
- models: {
30
- body: BODY_MODEL;
31
- query: QUERY_MODEL;
32
- params: PARAMS_MODEL;
33
- output: OUTPUT_MODEL;
34
- iteration: ITERATION_MODEL;
35
- };
36
25
  } & {
37
26
  fn: {
38
27
  <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 ? {
@@ -49,9 +38,7 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
49
38
  params?: T["__types"]["params"];
50
39
  } : {
51
40
  params: T["__types"]["params"];
52
- }) & {
53
- meta?: Meta;
54
- } : never): (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
41
+ }) : never): (undefined extends BODY_MODEL | undefined ? undefined extends QUERY_MODEL | undefined ? undefined extends PARAMS_MODEL | undefined ? true : false : false : false) extends true ? RETURN_TYPE : never;
55
42
  <RETURN_TYPE = ReturnType<T>>(input: {
56
43
  disableClientValidation?: boolean;
57
44
  } & (undefined extends BODY_MODEL | undefined ? {
@@ -66,16 +53,14 @@ export declare function withValidationLibrary<T extends VovkTypedMethod<(req: Kn
66
53
  params?: T["__types"]["params"];
67
54
  } : {
68
55
  params: T["__types"]["params"];
69
- }) & {
70
- meta?: Meta;
71
- }): RETURN_TYPE;
56
+ })): RETURN_TYPE;
72
57
  };
73
58
  models: {
74
- body: typeof body;
75
- query: typeof query;
76
- params: typeof params;
77
- output: typeof output;
78
- iteration: typeof iteration;
59
+ body: BODY_MODEL | undefined;
60
+ query: QUERY_MODEL | undefined;
61
+ params: PARAMS_MODEL | undefined;
62
+ output: OUTPUT_MODEL | undefined;
63
+ iteration: ITERATION_MODEL | undefined;
79
64
  };
80
65
  };
81
66
  export {};
@@ -88,20 +88,16 @@ function withValidationLibrary({ isForm, disableServerSideValidation, skipSchema
88
88
  },
89
89
  },
90
90
  };
91
- fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation, ...(input?.meta ?? {}) });
91
+ fakeReq.vovk.meta({ __disableClientValidation: input?.disableClientValidation });
92
92
  return resultHandler(fakeReq, (input?.params ?? {}));
93
93
  }
94
- const models = {};
95
- if (body !== undefined)
96
- models.body = body;
97
- if (query !== undefined)
98
- models.query = query;
99
- if (params !== undefined)
100
- models.params = params;
101
- if (output !== undefined)
102
- models.output = output;
103
- if (iteration !== undefined)
104
- models.iteration = iteration;
94
+ const models = {
95
+ body,
96
+ query,
97
+ params,
98
+ output,
99
+ iteration,
100
+ };
105
101
  const resultHandlerEnhanced = Object.assign(resultHandler, { fn, models });
106
102
  if (toJSONSchema) {
107
103
  const getJsonSchema = (model, type) => Object.assign(toJSONSchema(model, { type }), type === 'body' && isForm ? { 'x-formData': isForm } : {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.260",
3
+ "version": "3.0.0-draft.262",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",