vovk 3.0.0-draft.310 → 3.0.0-draft.313
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/client/types.d.ts +1 -1
- package/cjs/types.d.ts +2 -2
- package/cjs/utils/getSchema.d.ts +1 -1
- package/cjs/utils/getSchema.js +0 -6
- package/mjs/client/types.d.ts +1 -1
- package/mjs/types.d.ts +2 -2
- package/mjs/utils/getSchema.d.ts +1 -1
- package/mjs/utils/getSchema.js +0 -6
- package/package.json +1 -1
package/cjs/client/types.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export type VovkValidateOnClient = (input: {
|
|
|
116
116
|
params?: unknown;
|
|
117
117
|
endpoint: string;
|
|
118
118
|
}, validation: Omit<Exclude<VovkHandlerSchema['validation'], undefined>, 'output' | 'iteration'>, fullSchema: VovkSchema) => void | Promise<void>;
|
|
119
|
-
type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : false : false;
|
|
119
|
+
type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : T extends Partial<T> ? Partial<T> extends T ? true : false : false : false;
|
|
120
120
|
type Prettify<T> = {
|
|
121
121
|
[K in keyof T]: T[K];
|
|
122
122
|
} & {};
|
package/cjs/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type VovkHandlerSchema<T = KnownAny> = {
|
|
|
16
16
|
iteration?: T;
|
|
17
17
|
};
|
|
18
18
|
openapi?: OperationObject;
|
|
19
|
-
misc?: Record<string, KnownAny
|
|
19
|
+
misc?: Record<string, KnownAny>;
|
|
20
20
|
};
|
|
21
21
|
export type VovkControllerSchema<T = KnownAny> = {
|
|
22
22
|
rpcModuleName: string;
|
|
@@ -77,7 +77,7 @@ export type DecoratorOptions = {
|
|
|
77
77
|
export type RouteHandler = ((req: VovkRequest, params: Record<string, string>) => Response | Promise<Response> | Iterable<unknown> | AsyncIterable<unknown>) & {
|
|
78
78
|
_options?: DecoratorOptions;
|
|
79
79
|
};
|
|
80
|
-
export interface VovkRequest<BODY =
|
|
80
|
+
export interface VovkRequest<BODY extends KnownAny = undefined, QUERY extends KnownAny = undefined, PARAMS extends KnownAny = undefined> extends Omit<NextRequest, 'json' | 'nextUrl'> {
|
|
81
81
|
json: () => Promise<BODY>;
|
|
82
82
|
nextUrl: Omit<NextRequest['nextUrl'], 'searchParams'> & {
|
|
83
83
|
searchParams: Omit<NextRequest['nextUrl']['searchParams'], 'get' | 'getAll' | 'entries' | 'forEach' | 'keys' | 'values'> & {
|
package/cjs/utils/getSchema.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function getControllerSchema(controller: VovkController, rpcModul
|
|
|
8
8
|
path: string;
|
|
9
9
|
httpMethod: string;
|
|
10
10
|
openapi?: import("openapi3-ts/oas31").OperationObject;
|
|
11
|
-
misc?: Record<string, import("../types").KnownAny
|
|
11
|
+
misc?: Record<string, import("../types").KnownAny>;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
}>;
|
package/cjs/utils/getSchema.js
CHANGED
|
@@ -9,12 +9,6 @@ async function getControllerSchema(controller, rpcModuleName, exposeValidation)
|
|
|
9
9
|
: Object.fromEntries(
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
11
|
Object.entries(controller._handlers ?? {}).map(([key, { validation: _v, ...value }]) => [key, value]));
|
|
12
|
-
// TODO: misc is the only async property for experimental purposes, this should be refactored and documented
|
|
13
|
-
await Promise.all(Object.values(handlers ?? {})
|
|
14
|
-
.filter(({ misc }) => misc instanceof Promise)
|
|
15
|
-
.map(async (schema) => {
|
|
16
|
-
schema.misc = await schema.misc;
|
|
17
|
-
}));
|
|
18
12
|
return {
|
|
19
13
|
rpcModuleName,
|
|
20
14
|
originalControllerName: controller.name,
|
package/mjs/client/types.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export type VovkValidateOnClient = (input: {
|
|
|
116
116
|
params?: unknown;
|
|
117
117
|
endpoint: string;
|
|
118
118
|
}, validation: Omit<Exclude<VovkHandlerSchema['validation'], undefined>, 'output' | 'iteration'>, fullSchema: VovkSchema) => void | Promise<void>;
|
|
119
|
-
type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : false : false;
|
|
119
|
+
type IsEmptyObject<T> = T extends object ? keyof T extends never ? true : T extends Partial<T> ? Partial<T> extends T ? true : false : false : false;
|
|
120
120
|
type Prettify<T> = {
|
|
121
121
|
[K in keyof T]: T[K];
|
|
122
122
|
} & {};
|
package/mjs/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type VovkHandlerSchema<T = KnownAny> = {
|
|
|
16
16
|
iteration?: T;
|
|
17
17
|
};
|
|
18
18
|
openapi?: OperationObject;
|
|
19
|
-
misc?: Record<string, KnownAny
|
|
19
|
+
misc?: Record<string, KnownAny>;
|
|
20
20
|
};
|
|
21
21
|
export type VovkControllerSchema<T = KnownAny> = {
|
|
22
22
|
rpcModuleName: string;
|
|
@@ -77,7 +77,7 @@ export type DecoratorOptions = {
|
|
|
77
77
|
export type RouteHandler = ((req: VovkRequest, params: Record<string, string>) => Response | Promise<Response> | Iterable<unknown> | AsyncIterable<unknown>) & {
|
|
78
78
|
_options?: DecoratorOptions;
|
|
79
79
|
};
|
|
80
|
-
export interface VovkRequest<BODY =
|
|
80
|
+
export interface VovkRequest<BODY extends KnownAny = undefined, QUERY extends KnownAny = undefined, PARAMS extends KnownAny = undefined> extends Omit<NextRequest, 'json' | 'nextUrl'> {
|
|
81
81
|
json: () => Promise<BODY>;
|
|
82
82
|
nextUrl: Omit<NextRequest['nextUrl'], 'searchParams'> & {
|
|
83
83
|
searchParams: Omit<NextRequest['nextUrl']['searchParams'], 'get' | 'getAll' | 'entries' | 'forEach' | 'keys' | 'values'> & {
|
package/mjs/utils/getSchema.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function getControllerSchema(controller: VovkController, rpcModul
|
|
|
8
8
|
path: string;
|
|
9
9
|
httpMethod: string;
|
|
10
10
|
openapi?: import("openapi3-ts/oas31").OperationObject;
|
|
11
|
-
misc?: Record<string, import("../types").KnownAny
|
|
11
|
+
misc?: Record<string, import("../types").KnownAny>;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
}>;
|
package/mjs/utils/getSchema.js
CHANGED
|
@@ -9,12 +9,6 @@ async function getControllerSchema(controller, rpcModuleName, exposeValidation)
|
|
|
9
9
|
: Object.fromEntries(
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
11
|
Object.entries(controller._handlers ?? {}).map(([key, { validation: _v, ...value }]) => [key, value]));
|
|
12
|
-
// TODO: misc is the only async property for experimental purposes, this should be refactored and documented
|
|
13
|
-
await Promise.all(Object.values(handlers ?? {})
|
|
14
|
-
.filter(({ misc }) => misc instanceof Promise)
|
|
15
|
-
.map(async (schema) => {
|
|
16
|
-
schema.misc = await schema.misc;
|
|
17
|
-
}));
|
|
18
12
|
return {
|
|
19
13
|
rpcModuleName,
|
|
20
14
|
originalControllerName: controller.name,
|