snap-on-openapi 1.0.24 → 1.0.26
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/dist/services/RoutingFactory/RoutingFactory.d.ts +3 -3
- package/dist/services/RoutingFactory/types/StandardRoute.d.ts +4 -4
- package/dist/services/ValidationUtils/ValidationUtils.d.ts +2 -2
- package/dist/services/ValidationUtils/transformers/stringDateTimeTransformer.js +0 -1
- package/dist/types/AnyRoute.d.ts +2 -2
- package/dist/types/Route.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZodTypeAny, ZodObject, ZodRawShape } from 'zod';
|
|
2
2
|
import { Method } from '../../enums/Methods.js';
|
|
3
3
|
import { Route } from '../../types/Route.js';
|
|
4
4
|
import { AnyConfig } from '../../types/config/AnyConfig.js';
|
|
@@ -7,6 +7,6 @@ import { StandardRoute } from './types/StandardRoute.js';
|
|
|
7
7
|
export declare class RoutingFactory<TRouteTypes extends string, TErrorCodes extends string, TConfig extends AnyConfig<TRouteTypes, TErrorCodes>> {
|
|
8
8
|
protected map: TConfig;
|
|
9
9
|
constructor(map: TConfig);
|
|
10
|
-
createCustomRoute<TType extends TRouteTypes, TMethod extends Method, TResponseValidator extends
|
|
11
|
-
createRoute<TType extends TRouteTypes, TMethod extends Method, TResponseValidator extends
|
|
10
|
+
createCustomRoute<TType extends TRouteTypes, TMethod extends Method, TResponseValidator extends ZodTypeAny | undefined = undefined, TQueryValidator extends ZodObject<ZodRawShape> | undefined = undefined, TPathValidator extends ZodObject<ZodRawShape> | undefined = undefined, TBodyValidator extends ZodTypeAny | undefined = undefined, TResponseHeadersValidator extends ZodObject<ZodRawShape> | undefined = undefined>(params: Route<TType, Awaited<ReturnType<TConfig['routes'][TType]['contextFactory']>>, TResponseValidator, TPathValidator, TQueryValidator, TBodyValidator, TResponseHeadersValidator, TMethod> & (RouteExtraProps<TConfig['routes'][TType]['extraProps']>)): Route<TType, Awaited<ReturnType<TConfig['routes'][TType]['contextFactory']>>, TResponseValidator, TPathValidator, TQueryValidator, TBodyValidator, TResponseHeadersValidator>;
|
|
11
|
+
createRoute<TType extends TRouteTypes, TMethod extends Method, TResponseValidator extends ZodTypeAny | undefined = undefined, TQueryValidator extends ZodObject<ZodRawShape> | undefined = undefined, TPathValidator extends ZodObject<ZodRawShape> | undefined = undefined, TBodyValidator extends ZodTypeAny | undefined = undefined, TResponseHeadersValidator extends ZodObject<ZodRawShape> | undefined = undefined>(params: StandardRoute<TType, Awaited<ReturnType<TConfig['routes'][TType]['contextFactory']>>, TResponseValidator, TPathValidator, TQueryValidator, TBodyValidator, TMethod> & (RouteExtraProps<TConfig['routes'][TType]['extraProps']>)): Route<TType, Awaited<ReturnType<TConfig['routes'][TType]['contextFactory']>>, TResponseValidator, TPathValidator, TQueryValidator, TBodyValidator, TResponseHeadersValidator>;
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z,
|
|
1
|
+
import { z, ZodTypeAny, ZodObject, ZodRawShape } from 'zod';
|
|
2
2
|
import { Method } from '../../../enums/Methods.js';
|
|
3
3
|
import { RoutePath } from '../../../types/RoutePath.js';
|
|
4
|
-
type BodyHandlerResponse<T extends
|
|
5
|
-
export interface StandardRoute<TType extends string, TContext extends object, TResponseValidator extends
|
|
4
|
+
type BodyHandlerResponse<T extends ZodTypeAny | undefined = undefined> = Promise<T extends undefined ? void : z.infer<Exclude<T, undefined>>>;
|
|
5
|
+
export interface StandardRoute<TType extends string, TContext extends object, TResponseValidator extends ZodTypeAny | undefined, TPathValidator extends ZodObject<ZodRawShape> | undefined, TQueryValidator extends ZodObject<ZodRawShape> | undefined, TBodyValidator extends ZodTypeAny | undefined, TMethod extends Method = Method> {
|
|
6
6
|
tags?: string[];
|
|
7
7
|
operationId?: string;
|
|
8
8
|
type: TType;
|
|
@@ -17,7 +17,7 @@ export interface StandardRoute<TType extends string, TContext extends object, TR
|
|
|
17
17
|
};
|
|
18
18
|
handler: (context: {
|
|
19
19
|
params: {
|
|
20
|
-
body: TBodyValidator extends
|
|
20
|
+
body: TBodyValidator extends ZodTypeAny ? z.infer<TBodyValidator> : object;
|
|
21
21
|
query: TQueryValidator extends ZodObject<ZodRawShape> ? z.infer<TQueryValidator> : object;
|
|
22
22
|
path: TPathValidator extends ZodObject<ZodRawShape> ? z.infer<TPathValidator> : object;
|
|
23
23
|
};
|
|
@@ -40,18 +40,18 @@ export declare class ValidationUtils {
|
|
|
40
40
|
count: number;
|
|
41
41
|
}>;
|
|
42
42
|
}, "strip", import("zod").ZodTypeAny, {
|
|
43
|
-
items: T["_output"][];
|
|
44
43
|
info: {
|
|
45
44
|
page: number;
|
|
46
45
|
pageSize: number;
|
|
47
46
|
count: number;
|
|
48
47
|
};
|
|
48
|
+
items: T["_output"][];
|
|
49
49
|
}, {
|
|
50
|
-
items: T["_input"][];
|
|
51
50
|
info: {
|
|
52
51
|
page: number;
|
|
53
52
|
pageSize: number;
|
|
54
53
|
count: number;
|
|
55
54
|
};
|
|
55
|
+
items: T["_input"][];
|
|
56
56
|
}>;
|
|
57
57
|
}
|
|
@@ -7,7 +7,6 @@ export const stringDateTimeTransformer = z.union([
|
|
|
7
7
|
const output = new Date(Date.parse(input));
|
|
8
8
|
const outputStr = output.toISOString().replace('T', ' ');
|
|
9
9
|
const inputStr = input.replace('T', ' ');
|
|
10
|
-
console.log(inputStr, outputStr);
|
|
11
10
|
return inputStr === outputStr;
|
|
12
11
|
}
|
|
13
12
|
catch (e) {
|
package/dist/types/AnyRoute.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ZodObject, ZodRawShape,
|
|
1
|
+
import { ZodObject, ZodRawShape, ZodTypeAny } from 'zod';
|
|
2
2
|
import { Route } from './Route.js';
|
|
3
|
-
export type AnyRoute<TRouteType extends string> = Route<TRouteType, any,
|
|
3
|
+
export type AnyRoute<TRouteType extends string> = Route<TRouteType, any, ZodTypeAny | undefined, ZodObject<ZodRawShape> | undefined, ZodObject<ZodRawShape> | undefined, ZodTypeAny | undefined, ZodObject<ZodRawShape> | undefined>;
|
package/dist/types/Route.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z,
|
|
1
|
+
import { z, ZodTypeAny, ZodObject, ZodRawShape } from 'zod';
|
|
2
2
|
import { Method } from '../enums/Methods.js';
|
|
3
3
|
import { RoutePath } from './RoutePath.js';
|
|
4
4
|
import { RouteResponse } from './RouteResponse.js';
|
|
5
|
-
export interface Route<TType extends string, TContext extends object, TResponseValidator extends
|
|
5
|
+
export interface Route<TType extends string, TContext extends object, TResponseValidator extends ZodTypeAny | undefined, TPathValidator extends ZodObject<ZodRawShape> | undefined, TQueryValidator extends ZodObject<ZodRawShape> | undefined, TBodyValidator extends ZodTypeAny | undefined, TResponseHeadersValidator extends ZodObject<ZodRawShape> | undefined, TMethod extends Method = Method> {
|
|
6
6
|
tags?: string[];
|
|
7
7
|
operationId?: string;
|
|
8
8
|
type: TType;
|
|
@@ -18,7 +18,7 @@ export interface Route<TType extends string, TContext extends object, TResponseV
|
|
|
18
18
|
};
|
|
19
19
|
handler: (context: {
|
|
20
20
|
params: {
|
|
21
|
-
body: TBodyValidator extends
|
|
21
|
+
body: TBodyValidator extends ZodTypeAny ? z.infer<TBodyValidator> : object;
|
|
22
22
|
query: TQueryValidator extends ZodObject<ZodRawShape> ? z.infer<TQueryValidator> : object;
|
|
23
23
|
path: TPathValidator extends ZodObject<ZodRawShape> ? z.infer<TPathValidator> : object;
|
|
24
24
|
};
|
package/package.json
CHANGED