fets 0.4.14 → 0.4.15

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 (69) hide show
  1. package/cjs/Response.js +80 -0
  2. package/cjs/client/auth/oauth.js +34 -0
  3. package/cjs/client/createClient.js +133 -0
  4. package/cjs/client/index.js +6 -0
  5. package/cjs/client/plugins/useClientCookieStore.js +31 -0
  6. package/cjs/client/types.js +0 -0
  7. package/cjs/createRouter.js +299 -0
  8. package/cjs/index.js +16 -0
  9. package/cjs/plugins/ajv.js +213 -0
  10. package/cjs/plugins/openapi.js +171 -0
  11. package/cjs/plugins/utils.js +31 -0
  12. package/cjs/swagger-ui-html.js +3 -0
  13. package/cjs/typed-fetch.js +0 -0
  14. package/cjs/types.js +0 -0
  15. package/cjs/utils.js +73 -0
  16. package/cjs/zod/types.js +7 -0
  17. package/cjs/zod/zod.js +92 -0
  18. package/esm/Response.js +74 -0
  19. package/esm/client/auth/oauth.js +31 -0
  20. package/esm/client/createClient.js +128 -0
  21. package/esm/client/index.js +3 -0
  22. package/esm/client/plugins/useClientCookieStore.js +27 -0
  23. package/esm/client/types.js +0 -0
  24. package/esm/createRouter.js +293 -0
  25. package/esm/index.js +7 -0
  26. package/esm/plugins/ajv.js +208 -0
  27. package/esm/plugins/openapi.js +166 -0
  28. package/esm/plugins/utils.js +27 -0
  29. package/esm/swagger-ui-html.js +1 -0
  30. package/esm/typed-fetch.js +0 -0
  31. package/esm/types.js +0 -0
  32. package/esm/utils.js +69 -0
  33. package/esm/zod/types.js +3 -0
  34. package/esm/zod/zod.js +88 -0
  35. package/package.json +1 -1
  36. package/typings/Response.d.cts +28 -0
  37. package/typings/Response.d.ts +28 -0
  38. package/typings/client/auth/oauth.d.cts +150 -0
  39. package/typings/client/auth/oauth.d.ts +150 -0
  40. package/typings/client/createClient.d.cts +34 -0
  41. package/typings/client/createClient.d.ts +34 -0
  42. package/typings/client/index.d.cts +3 -0
  43. package/typings/client/index.d.ts +3 -0
  44. package/typings/client/plugins/useClientCookieStore.d.cts +3 -0
  45. package/typings/client/plugins/useClientCookieStore.d.ts +3 -0
  46. package/typings/client/types.d.cts +426 -0
  47. package/typings/client/types.d.ts +426 -0
  48. package/typings/createRouter.d.cts +6 -0
  49. package/typings/createRouter.d.ts +6 -0
  50. package/typings/index.d.cts +7 -0
  51. package/typings/index.d.ts +7 -0
  52. package/typings/plugins/ajv.d.cts +4 -0
  53. package/typings/plugins/ajv.d.ts +4 -0
  54. package/typings/plugins/openapi.d.cts +33 -0
  55. package/typings/plugins/openapi.d.ts +33 -0
  56. package/typings/plugins/utils.d.cts +1 -0
  57. package/typings/plugins/utils.d.ts +1 -0
  58. package/typings/swagger-ui-html.d.cts +2 -0
  59. package/typings/swagger-ui-html.d.ts +2 -0
  60. package/typings/typed-fetch.d.cts +232 -0
  61. package/typings/typed-fetch.d.ts +232 -0
  62. package/typings/types.d.cts +261 -0
  63. package/typings/types.d.ts +261 -0
  64. package/typings/utils.d.cts +31 -0
  65. package/typings/utils.d.ts +31 -0
  66. package/typings/zod/types.d.cts +39 -0
  67. package/typings/zod/types.d.ts +39 -0
  68. package/typings/zod/zod.d.cts +2 -0
  69. package/typings/zod/zod.d.ts +2 -0
@@ -0,0 +1,39 @@
1
+ import { HTTPMethod, TypedRequest, TypedResponse, TypedResponseWithJSONStatusMap } from '../typed-fetch';
2
+ import { AddRouteWithTypesOpts, StatusCodeMap } from '../types';
3
+ export type ZodType = {
4
+ _output: any;
5
+ safeParse(input: any): any;
6
+ };
7
+ export type InferZodType<T extends ZodType> = T['_output'];
8
+ export type RouteZodSchemas = {
9
+ request?: {
10
+ json?: ZodType;
11
+ formData?: ZodType;
12
+ headers?: ZodType;
13
+ params?: ZodType;
14
+ query?: ZodType;
15
+ };
16
+ responses?: StatusCodeMap<ZodType>;
17
+ };
18
+ export type TypedRequestFromRouteZodSchemas<TRouteZodSchemas extends RouteZodSchemas, TMethod extends HTTPMethod> = TRouteZodSchemas extends {
19
+ request: Required<RouteZodSchemas>['request'];
20
+ } ? TypedRequest<TRouteZodSchemas['request'] extends {
21
+ json: ZodType;
22
+ } ? InferZodType<TRouteZodSchemas['request']['json']> : any, TRouteZodSchemas['request'] extends {
23
+ formData: ZodType;
24
+ } ? InferZodType<TRouteZodSchemas['request']['formData']> : Record<string, FormDataEntryValue>, TRouteZodSchemas['request'] extends {
25
+ headers: ZodType;
26
+ } ? InferZodType<TRouteZodSchemas['request']['headers']> : Record<string, string>, TMethod, TRouteZodSchemas['request'] extends {
27
+ query: ZodType;
28
+ } ? InferZodType<TRouteZodSchemas['request']['query']> : Record<string, string | string[]>, TRouteZodSchemas['request'] extends {
29
+ params: ZodType;
30
+ } ? InferZodType<TRouteZodSchemas['request']['params']> : Record<string, any>> : TypedRequest<any, Record<string, FormDataEntryValue>, Record<string, string>, TMethod>;
31
+ export type TypedResponseFromRouteZodSchemas<TRouteZodSchemas extends RouteZodSchemas> = TRouteZodSchemas extends {
32
+ responses: StatusCodeMap<ZodType>;
33
+ } ? TypedResponseWithJSONStatusMap<{
34
+ [TStatusCode in keyof TRouteZodSchemas['responses']]: TRouteZodSchemas['responses'][TStatusCode] extends ZodType ? InferZodType<TRouteZodSchemas['responses'][TStatusCode]> : never;
35
+ }> : TypedResponse;
36
+ export type AddRouteWithZodSchemasOpts<TServerContext, TRouteZodSchemas extends RouteZodSchemas, TMethod extends HTTPMethod, TPath extends string, TTypedRequest extends TypedRequestFromRouteZodSchemas<TRouteZodSchemas, TMethod>, TTypedResponse extends TypedResponseFromRouteZodSchemas<TRouteZodSchemas>> = {
37
+ schemas: TRouteZodSchemas;
38
+ } & AddRouteWithTypesOpts<TServerContext, TMethod, TPath, TTypedRequest, TTypedResponse>;
39
+ export declare function isZodSchema(value: any): value is ZodType;
@@ -0,0 +1,2 @@
1
+ import { RouterPlugin } from '../types.cjs';
2
+ export declare function useZod(): RouterPlugin<any>;
@@ -0,0 +1,2 @@
1
+ import { RouterPlugin } from '../types.js';
2
+ export declare function useZod(): RouterPlugin<any>;