vovk 3.0.0-draft.13 → 3.0.0-draft.18

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 (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +6 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.13",
3
+ "version": "3.0.0-draft.18",
4
4
  "description": "RESTful RPC for Next.js - Transforms Next.js into a powerful REST API platform with RPC capabilities.",
5
5
  "repository": {
6
6
  "type": "git",
package/types.d.ts CHANGED
@@ -63,7 +63,6 @@ export interface _VovkRequest<BODY = undefined, QUERY extends object | undefined
63
63
  forEach: (callbackfn: (value: QUERY[keyof QUERY], key: keyof QUERY, searchParams: NextRequest['nextUrl']['searchParams']) => void) => void;
64
64
  keys: () => IterableIterator<keyof QUERY>;
65
65
  values: () => IterableIterator<QUERY[keyof QUERY]>;
66
- readonly __queryType: QUERY;
67
66
  };
68
67
  };
69
68
  vovk: {
@@ -72,26 +71,16 @@ export interface _VovkRequest<BODY = undefined, QUERY extends object | undefined
72
71
  meta: <T = Record<_KnownAny, _KnownAny>>(meta?: T | null) => T;
73
72
  };
74
73
  }
75
- export type _ControllerStaticMethod<REQ extends _VovkRequest<undefined, _KnownAny> = _VovkRequest<undefined, Record<string, string | string[]>>, PARAMS extends {
74
+ export type _ControllerStaticMethod<REQ extends _VovkRequest<_KnownAny, _KnownAny> = _VovkRequest<undefined, Record<string, string | string[]>>, PARAMS extends {
76
75
  [key: string]: string;
77
76
  } = _KnownAny> = ((req: REQ, params: PARAMS) => unknown) & {
78
77
  _controller?: _VovkController;
79
78
  };
80
- export type _VovkControllerBody<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
81
- [key: string]: string;
82
- } = _KnownAny> = Awaited<ReturnType<Parameters<T>[0]['json']>>;
83
- export type _VovkControllerQuery<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
84
- [key: string]: string;
85
- } = _KnownAny> = Parameters<T>[0]['nextUrl']['searchParams']['__queryType'];
86
- export type _VovkControllerParams<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
87
- [key: string]: string;
88
- } = _KnownAny> = Parameters<T>[1];
89
- export type _VovkControllerReturnType<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
90
- [key: string]: string;
91
- } = _KnownAny> = Awaited<ReturnType<T>>;
92
- export type _VovkControllerYieldType<T extends _ControllerStaticMethod<REQ, PARAMS>, REQ extends _VovkRequest<undefined, _KnownAny> = Parameters<T>[0], PARAMS extends {
93
- [key: string]: string;
94
- } = _KnownAny> = T extends (...args: _KnownAny[]) => AsyncGenerator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Generator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Promise<StreamResponse<infer Y>> | StreamResponse<infer Y> ? Y : never;
79
+ export type _VovkControllerBody<T extends _ControllerStaticMethod<_KnownAny, _KnownAny>> = Awaited<ReturnType<Parameters<T>[0]['vovk']['body']>>;
80
+ export type _VovkControllerQuery<T extends _ControllerStaticMethod<_KnownAny, _KnownAny>> = ReturnType<Parameters<T>[0]['vovk']['query']>;
81
+ export type _VovkControllerParams<T extends _ControllerStaticMethod<_KnownAny, _KnownAny>> = Parameters<T>[1];
82
+ export type _VovkControllerReturnType<T extends _ControllerStaticMethod<_KnownAny, _KnownAny>> = Awaited<ReturnType<T>>;
83
+ export type _VovkControllerYieldType<T extends (req: _VovkRequest<_KnownAny, _KnownAny>) => _KnownAny> = T extends (...args: _KnownAny[]) => AsyncGenerator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Generator<infer Y, _KnownAny, _KnownAny> ? Y : T extends (...args: _KnownAny[]) => Promise<StreamResponse<infer Y>> | StreamResponse<infer Y> ? Y : never;
95
84
  export type _VovkClientBody<T extends (options: OPTIONS) => _KnownAny, OPTIONS extends {
96
85
  body: B;
97
86
  [key: string]: _KnownAny;