@geekmidas/client 10.0.0-alpha.12 → 10.0.0-alpha.13

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 (98) hide show
  1. package/dist/auth-fetcher.cjs +76 -3
  2. package/dist/auth-fetcher.cjs.map +1 -0
  3. package/dist/auth-fetcher.d.cts +155 -3
  4. package/dist/auth-fetcher.d.cts.map +1 -0
  5. package/dist/auth-fetcher.d.mts +155 -3
  6. package/dist/auth-fetcher.d.mts.map +1 -0
  7. package/dist/auth-fetcher.mjs +75 -3
  8. package/dist/auth-fetcher.mjs.map +1 -0
  9. package/dist/endpoint-hooks.cjs +11 -15
  10. package/dist/endpoint-hooks.cjs.map +1 -1
  11. package/dist/endpoint-hooks.d.cts +4 -7
  12. package/dist/endpoint-hooks.d.cts.map +1 -1
  13. package/dist/endpoint-hooks.d.mts +4 -7
  14. package/dist/endpoint-hooks.d.mts.map +1 -1
  15. package/dist/endpoint-hooks.mjs +5 -9
  16. package/dist/endpoint-hooks.mjs.map +1 -1
  17. package/dist/fetcher.cjs +110 -3
  18. package/dist/fetcher.cjs.map +1 -0
  19. package/dist/fetcher.d.cts +22 -3
  20. package/dist/fetcher.d.cts.map +1 -0
  21. package/dist/fetcher.d.mts +22 -3
  22. package/dist/fetcher.d.mts.map +1 -0
  23. package/dist/fetcher.mjs +85 -2
  24. package/dist/fetcher.mjs.map +1 -0
  25. package/dist/index.cjs +6 -6
  26. package/dist/index.d.cts +4 -4
  27. package/dist/index.d.mts +4 -4
  28. package/dist/index.mjs +5 -6
  29. package/dist/infer.cjs +0 -1
  30. package/dist/infer.d.cts +130 -2
  31. package/dist/infer.d.cts.map +1 -0
  32. package/dist/infer.d.mts +130 -2
  33. package/dist/infer.d.mts.map +1 -0
  34. package/dist/infer.mjs +1 -1
  35. package/dist/openapi-hooks.cjs +13 -16
  36. package/dist/openapi-hooks.cjs.map +1 -1
  37. package/dist/openapi-hooks.d.cts +8 -11
  38. package/dist/openapi-hooks.d.cts.map +1 -1
  39. package/dist/openapi-hooks.d.mts +8 -11
  40. package/dist/openapi-hooks.d.mts.map +1 -1
  41. package/dist/openapi-hooks.mjs +9 -12
  42. package/dist/openapi-hooks.mjs.map +1 -1
  43. package/dist/openapi-types.d.cts +2 -4
  44. package/dist/openapi-types.d.cts.map +1 -1
  45. package/dist/openapi-types.d.mts +2 -4
  46. package/dist/openapi-types.d.mts.map +1 -1
  47. package/dist/openapi.cjs +25 -23
  48. package/dist/openapi.cjs.map +1 -1
  49. package/dist/openapi.d.cts +494 -0
  50. package/dist/openapi.d.cts.map +1 -0
  51. package/dist/openapi.d.mts +494 -0
  52. package/dist/openapi.d.mts.map +1 -0
  53. package/dist/openapi.mjs +1 -1
  54. package/dist/openapi.mjs.map +1 -1
  55. package/dist/react-query.cjs +17 -16
  56. package/dist/react-query.cjs.map +1 -1
  57. package/dist/react-query.d.cts +12 -17
  58. package/dist/react-query.d.cts.map +1 -1
  59. package/dist/react-query.d.mts +12 -17
  60. package/dist/react-query.d.mts.map +1 -1
  61. package/dist/react-query.mjs +10 -9
  62. package/dist/react-query.mjs.map +1 -1
  63. package/dist/types.cjs +0 -1
  64. package/dist/types.d.cts +109 -2
  65. package/dist/types.d.cts.map +1 -0
  66. package/dist/types.d.mts +109 -2
  67. package/dist/types.d.mts.map +1 -0
  68. package/dist/types.mjs +1 -1
  69. package/package.json +5 -5
  70. package/dist/auth-fetcher-CBYuL6rx.d.cts +0 -158
  71. package/dist/auth-fetcher-CBYuL6rx.d.cts.map +0 -1
  72. package/dist/auth-fetcher-DOj0iz21.mjs +0 -77
  73. package/dist/auth-fetcher-DOj0iz21.mjs.map +0 -1
  74. package/dist/auth-fetcher-DxS8zOLc.d.mts +0 -158
  75. package/dist/auth-fetcher-DxS8zOLc.d.mts.map +0 -1
  76. package/dist/auth-fetcher-HILABmws.cjs +0 -82
  77. package/dist/auth-fetcher-HILABmws.cjs.map +0 -1
  78. package/dist/chunk-CUT6urMc.cjs +0 -30
  79. package/dist/fetcher-C1xtCKpT.d.mts +0 -25
  80. package/dist/fetcher-C1xtCKpT.d.mts.map +0 -1
  81. package/dist/fetcher-CakjC9C7.mjs +0 -88
  82. package/dist/fetcher-CakjC9C7.mjs.map +0 -1
  83. package/dist/fetcher-CwnSqc4D.cjs +0 -100
  84. package/dist/fetcher-CwnSqc4D.cjs.map +0 -1
  85. package/dist/fetcher-cDrfwN-Y.d.cts +0 -25
  86. package/dist/fetcher-cDrfwN-Y.d.cts.map +0 -1
  87. package/dist/infer-6KKCgmg1.cjs +0 -0
  88. package/dist/infer-CPRqfabW.d.cts +0 -133
  89. package/dist/infer-CPRqfabW.d.cts.map +0 -1
  90. package/dist/infer-D9CgpOuc.d.mts +0 -133
  91. package/dist/infer-D9CgpOuc.d.mts.map +0 -1
  92. package/dist/infer-uCUq1whM.mjs +0 -0
  93. package/dist/types-BH8WgGrm.mjs +0 -0
  94. package/dist/types-BMGM6sZc.d.mts +0 -110
  95. package/dist/types-BMGM6sZc.d.mts.map +0 -1
  96. package/dist/types-DMQMHePI.d.cts +0 -110
  97. package/dist/types-DMQMHePI.d.cts.map +0 -1
  98. package/dist/types-a8gm_IaQ.cjs +0 -0
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { EndpointString, ErrorTransformer, ExtractEndpointConfig, ExtractEndpointResponse, ExtractMethod, ExtractPathParams, ExtractQueryParams, ExtractRequestBody, ExtractResponse, FetcherOptions, FilterEndpointByMethod, FilteredRequestConfig, IsConfigRequired, MutationEndpoint, OpenAPIRoutes, ParseEndpoint, QueryEndpoint, RequestConfig, TypedApiFunction, TypedEndpoint, ValidEndpoint, WrappedApiFunction, WrappedResult } from "./types-BMGM6sZc.mjs";
2
- import { ApiKeyProvider, AuthFetcherOptions, AuthStrategy, AuthenticatedEndpoints, AwsSigner, GetEndpointAuth, PublicEndpoints, SecuritySchemeObject, TokenProvider, UsedSecuritySchemes, createAuthAwareFetcher } from "./auth-fetcher-DxS8zOLc.mjs";
3
- import { FetchFn, TypedFetcher, createTypedFetcher } from "./fetcher-C1xtCKpT.mjs";
4
- import { InferOpenApi, InferOpenApiFromEndpoint } from "./infer-D9CgpOuc.mjs";
1
+ import { EndpointString, ErrorTransformer, ExtractEndpointConfig, ExtractEndpointResponse, ExtractMethod, ExtractPathParams, ExtractQueryParams, ExtractRequestBody, ExtractResponse, FetcherOptions, FilterEndpointByMethod, FilteredRequestConfig, IsConfigRequired, MutationEndpoint, OpenAPIRoutes, ParseEndpoint, QueryEndpoint, RequestConfig, TypedApiFunction, TypedEndpoint, ValidEndpoint, WrappedApiFunction, WrappedResult } from "./types.mjs";
2
+ import { ApiKeyProvider, AuthFetcherOptions, AuthStrategy, AuthenticatedEndpoints, AwsSigner, GetEndpointAuth, PublicEndpoints, SecuritySchemeObject, TokenProvider, UsedSecuritySchemes, createAuthAwareFetcher } from "./auth-fetcher.mjs";
3
+ import { FetchFn, TypedFetcher, createTypedFetcher } from "./fetcher.mjs";
4
+ import { InferOpenApi, InferOpenApiFromEndpoint } from "./infer.mjs";
5
5
  export { ApiKeyProvider, AuthFetcherOptions, AuthStrategy, AuthenticatedEndpoints, AwsSigner, EndpointString, ErrorTransformer, ExtractEndpointConfig, ExtractEndpointResponse, ExtractMethod, ExtractPathParams, ExtractQueryParams, ExtractRequestBody, ExtractResponse, FetchFn, FetcherOptions, FilterEndpointByMethod, FilteredRequestConfig, GetEndpointAuth, InferOpenApi, InferOpenApiFromEndpoint, IsConfigRequired, MutationEndpoint, OpenAPIRoutes, ParseEndpoint, PublicEndpoints, QueryEndpoint, RequestConfig, SecuritySchemeObject, TokenProvider, TypedApiFunction, TypedEndpoint, TypedFetcher, UsedSecuritySchemes, ValidEndpoint, WrappedApiFunction, WrappedResult, createAuthAwareFetcher, createTypedFetcher };
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { TypedFetcher, createTypedFetcher } from "./fetcher-CakjC9C7.mjs";
2
- import { createAuthAwareFetcher } from "./auth-fetcher-DOj0iz21.mjs";
3
- import "./infer-uCUq1whM.mjs";
4
- import "./types-BH8WgGrm.mjs";
5
-
6
- export { TypedFetcher, createAuthAwareFetcher, createTypedFetcher };
1
+ import { TypedFetcher, createTypedFetcher } from "./fetcher.mjs";
2
+ import { createAuthAwareFetcher } from "./auth-fetcher.mjs";
3
+ import "./infer.mjs";
4
+ import "./types.mjs";
5
+ export { TypedFetcher, createAuthAwareFetcher, createTypedFetcher };
package/dist/infer.cjs CHANGED
@@ -1 +0,0 @@
1
- require('./infer-6KKCgmg1.cjs');
package/dist/infer.d.cts CHANGED
@@ -1,2 +1,130 @@
1
- import { InferOpenApi, InferOpenApiFromEndpoint } from "./infer-CPRqfabW.cjs";
2
- export { InferOpenApi, InferOpenApiFromEndpoint };
1
+ import { Endpoint, EndpointSchemas } from "@geekmidas/constructs/endpoints";
2
+ import { HttpMethod } from "@geekmidas/constructs/types";
3
+ import { InferStandardSchema, InferStandardSchemaInput } from "@geekmidas/schema";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+ //#region src/infer.d.ts
6
+ /**
7
+ * Infers path parameters from a route string as an object
8
+ * @example '/users/{id}/posts/{postId}' -> { id: string, postId: string }
9
+ */
10
+ type InferPathParams<TRoute extends string> = TRoute extends `${string}{${infer Param}}${infer Rest}` ? { [K in Param]: string; } & InferPathParams<Rest> : {};
11
+ /**
12
+ * Converts an HTTP method to lowercase for TypedFetcher compatibility
13
+ */
14
+ type LowercaseMethod<T extends HttpMethod> = Lowercase<T>;
15
+ /**
16
+ * Infers route-level parameters (path params)
17
+ */
18
+ type InferRouteParameters<TRoute extends string> = InferPathParams<TRoute> extends Record<string, never> ? {} : {
19
+ parameters: {
20
+ path: InferPathParams<TRoute>;
21
+ };
22
+ };
23
+ /**
24
+ * Infers operation-level parameters (query params)
25
+ */
26
+ type InferOperationParameters<TInput extends EndpointSchemas> = TInput extends {
27
+ query: infer Q;
28
+ } ? {
29
+ parameters: {
30
+ query: InferStandardSchemaInput<Q>;
31
+ };
32
+ } : {};
33
+ /**
34
+ * Infers the operation object compatible with TypedFetcher
35
+ */
36
+ type InferOperation<TInput extends EndpointSchemas, TOutput extends StandardSchemaV1 | undefined> = InferOperationParameters<TInput> & {
37
+ requestBody?: TInput extends {
38
+ body: infer B;
39
+ } ? {
40
+ content: {
41
+ 'application/json': InferStandardSchemaInput<B>;
42
+ };
43
+ } : never;
44
+ responses: {
45
+ 200: {
46
+ content: TOutput extends StandardSchemaV1 ? {
47
+ 'application/json': InferStandardSchema<TOutput>;
48
+ } : never;
49
+ };
50
+ };
51
+ };
52
+ /**
53
+ * Infers the TypedFetcher-compatible paths structure from a single endpoint
54
+ *
55
+ * This generates a structure compatible with @geekmidas/client TypedFetcher,
56
+ * allowing you to create a typed client directly from endpoint definitions
57
+ * without needing OpenAPI JSON + codegen.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * import { api } from './constructs/api.js';
62
+ * import { createTypedFetcher, type InferOpenApiFromEndpoint } from '@geekmidas/client';
63
+ * import { z } from 'zod';
64
+ *
65
+ * const endpoint = e
66
+ * .get('/users/{id}')
67
+ * .params(z.object({ id: z.string() }))
68
+ * .output(z.object({ id: z.string(), name: z.string() }))
69
+ * .handle(async ({ params }) => ({ id: params.id, name: 'John' }));
70
+ *
71
+ * type Paths = InferOpenApiFromEndpoint<typeof endpoint>['paths'];
72
+ * const client = createTypedFetcher<Paths>({ baseURL: 'http://localhost:3000' });
73
+ * const user = await client('GET /users/{id}', { params: { id: '123' } });
74
+ * ```
75
+ */
76
+ export type InferOpenApiFromEndpoint<T> = T extends Endpoint<infer TRoute, infer TMethod, infer TInput, infer TOutput, any, any, any> ? {
77
+ paths: { [K in TRoute]: InferRouteParameters<TRoute> & { [M in LowercaseMethod<TMethod>]: InferOperation<TInput, TOutput>; }; };
78
+ } : never;
79
+ /**
80
+ * Infers TypedFetcher-compatible paths structure from multiple endpoints
81
+ *
82
+ * Merges multiple endpoint definitions into a single paths object that can be
83
+ * used with @geekmidas/client TypedFetcher for fully type-safe API calls.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * import { api } from './constructs/api.js';
88
+ * import { createTypedFetcher, type InferOpenApi } from '@geekmidas/client';
89
+ * import { z } from 'zod';
90
+ *
91
+ * // Define endpoints
92
+ * const getUserEndpoint = e
93
+ * .get('/users/{id}')
94
+ * .params(z.object({ id: z.string() }))
95
+ * .output(z.object({ id: z.string(), name: z.string() }))
96
+ * .handle(async ({ params }) => ({ id: params.id, name: 'John' }));
97
+ *
98
+ * const createUserEndpoint = e
99
+ * .post('/users')
100
+ * .body(z.object({ name: z.string() }))
101
+ * .output(z.object({ id: z.string(), name: z.string() }))
102
+ * .handle(async ({ body }) => ({ id: '123', name: body.name }));
103
+ *
104
+ * // Export for client
105
+ * export const endpoints = [getUserEndpoint, createUserEndpoint] as const;
106
+ * export type Paths = InferOpenApi<typeof endpoints>['paths'];
107
+ *
108
+ * // Client usage
109
+ * import type { Paths } from './endpoints';
110
+ * const client = createTypedFetcher<Paths>({ baseURL: 'http://localhost:3000' });
111
+ *
112
+ * const user = await client('GET /users/{id}', { params: { id: '123' } });
113
+ * const newUser = await client('POST /users', { body: { name: 'Jane' } });
114
+ * ```
115
+ */
116
+ export type InferOpenApi<TEndpoints extends readonly any[]> = TEndpoints extends readonly [infer First, ...infer Rest] ? InferOpenApiFromEndpoint<First> extends {
117
+ paths: infer P1;
118
+ } ? Rest extends [] ? {
119
+ paths: P1;
120
+ } : InferOpenApi<Rest> extends {
121
+ paths: infer P2;
122
+ } ? {
123
+ paths: P1 & P2;
124
+ } : {
125
+ paths: P1;
126
+ } : InferOpenApi<Rest> : {
127
+ paths: {};
128
+ };
129
+ //#endregion
130
+ //# sourceMappingURL=infer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infer.d.cts","names":[],"sources":["../src/infer.ts"],"mappings":";;;;;;;;;KAeK,gBAAgB,yBACpB,kCAAkC,eAAe,YAC3C,KAAK,oBAAmB,gBAAgB;;;;KAM1C,gBAAgB,UAAU,cAAc,UAAU;;;;KAKlD,qBAAqB,yBACzB,gBAAgB,gBAAgB;EAG7B;IACC,MAAM,gBAAgB;;;;;;KAOtB,yBAAyB,eAAe,mBAAmB;EAC/D,aAAa;;EAGX;IAMC,OAAO,yBAAyB;;;;;;KAQ/B,eACJ,eAAe,iBACf,gBAAgB,gCACb,yBAAyB;EAC5B,cAAc;IAAiB,YAAY;;IAExC;MAKC,oBAAoB,yBAAyB;;;EAIjD;IACC;MACC,SAAS,gBAAgB;QAEtB,oBAAoB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BlC,yBAAyB,KACpC,UAAU,eACH,cACA,eACA,cACA;EAMJ,UACE,KAAK,SAAS,qBAAqB,aAClC,KAAK,gBAAgB,WAAW,eAAe,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2ClD,aAAa,qCACxB,mCAAmC,gBAAgB,QAChD,yBAAyB;EAAiB,aAAa;IACtD;EACG,OAAO;IACT,aAAa;EAAgB,aAAa;;EACvC,OAAO,KAAK;;EACZ,OAAO;IACX,aAAa;EACZ"}
package/dist/infer.d.mts CHANGED
@@ -1,2 +1,130 @@
1
- import { InferOpenApi, InferOpenApiFromEndpoint } from "./infer-D9CgpOuc.mjs";
2
- export { InferOpenApi, InferOpenApiFromEndpoint };
1
+ import { Endpoint, EndpointSchemas } from "@geekmidas/constructs/endpoints";
2
+ import { HttpMethod } from "@geekmidas/constructs/types";
3
+ import { InferStandardSchema, InferStandardSchemaInput } from "@geekmidas/schema";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+ //#region src/infer.d.ts
6
+ /**
7
+ * Infers path parameters from a route string as an object
8
+ * @example '/users/{id}/posts/{postId}' -> { id: string, postId: string }
9
+ */
10
+ type InferPathParams<TRoute extends string> = TRoute extends `${string}{${infer Param}}${infer Rest}` ? { [K in Param]: string; } & InferPathParams<Rest> : {};
11
+ /**
12
+ * Converts an HTTP method to lowercase for TypedFetcher compatibility
13
+ */
14
+ type LowercaseMethod<T extends HttpMethod> = Lowercase<T>;
15
+ /**
16
+ * Infers route-level parameters (path params)
17
+ */
18
+ type InferRouteParameters<TRoute extends string> = InferPathParams<TRoute> extends Record<string, never> ? {} : {
19
+ parameters: {
20
+ path: InferPathParams<TRoute>;
21
+ };
22
+ };
23
+ /**
24
+ * Infers operation-level parameters (query params)
25
+ */
26
+ type InferOperationParameters<TInput extends EndpointSchemas> = TInput extends {
27
+ query: infer Q;
28
+ } ? {
29
+ parameters: {
30
+ query: InferStandardSchemaInput<Q>;
31
+ };
32
+ } : {};
33
+ /**
34
+ * Infers the operation object compatible with TypedFetcher
35
+ */
36
+ type InferOperation<TInput extends EndpointSchemas, TOutput extends StandardSchemaV1 | undefined> = InferOperationParameters<TInput> & {
37
+ requestBody?: TInput extends {
38
+ body: infer B;
39
+ } ? {
40
+ content: {
41
+ 'application/json': InferStandardSchemaInput<B>;
42
+ };
43
+ } : never;
44
+ responses: {
45
+ 200: {
46
+ content: TOutput extends StandardSchemaV1 ? {
47
+ 'application/json': InferStandardSchema<TOutput>;
48
+ } : never;
49
+ };
50
+ };
51
+ };
52
+ /**
53
+ * Infers the TypedFetcher-compatible paths structure from a single endpoint
54
+ *
55
+ * This generates a structure compatible with @geekmidas/client TypedFetcher,
56
+ * allowing you to create a typed client directly from endpoint definitions
57
+ * without needing OpenAPI JSON + codegen.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * import { api } from './constructs/api.js';
62
+ * import { createTypedFetcher, type InferOpenApiFromEndpoint } from '@geekmidas/client';
63
+ * import { z } from 'zod';
64
+ *
65
+ * const endpoint = e
66
+ * .get('/users/{id}')
67
+ * .params(z.object({ id: z.string() }))
68
+ * .output(z.object({ id: z.string(), name: z.string() }))
69
+ * .handle(async ({ params }) => ({ id: params.id, name: 'John' }));
70
+ *
71
+ * type Paths = InferOpenApiFromEndpoint<typeof endpoint>['paths'];
72
+ * const client = createTypedFetcher<Paths>({ baseURL: 'http://localhost:3000' });
73
+ * const user = await client('GET /users/{id}', { params: { id: '123' } });
74
+ * ```
75
+ */
76
+ export type InferOpenApiFromEndpoint<T> = T extends Endpoint<infer TRoute, infer TMethod, infer TInput, infer TOutput, any, any, any> ? {
77
+ paths: { [K in TRoute]: InferRouteParameters<TRoute> & { [M in LowercaseMethod<TMethod>]: InferOperation<TInput, TOutput>; }; };
78
+ } : never;
79
+ /**
80
+ * Infers TypedFetcher-compatible paths structure from multiple endpoints
81
+ *
82
+ * Merges multiple endpoint definitions into a single paths object that can be
83
+ * used with @geekmidas/client TypedFetcher for fully type-safe API calls.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * import { api } from './constructs/api.js';
88
+ * import { createTypedFetcher, type InferOpenApi } from '@geekmidas/client';
89
+ * import { z } from 'zod';
90
+ *
91
+ * // Define endpoints
92
+ * const getUserEndpoint = e
93
+ * .get('/users/{id}')
94
+ * .params(z.object({ id: z.string() }))
95
+ * .output(z.object({ id: z.string(), name: z.string() }))
96
+ * .handle(async ({ params }) => ({ id: params.id, name: 'John' }));
97
+ *
98
+ * const createUserEndpoint = e
99
+ * .post('/users')
100
+ * .body(z.object({ name: z.string() }))
101
+ * .output(z.object({ id: z.string(), name: z.string() }))
102
+ * .handle(async ({ body }) => ({ id: '123', name: body.name }));
103
+ *
104
+ * // Export for client
105
+ * export const endpoints = [getUserEndpoint, createUserEndpoint] as const;
106
+ * export type Paths = InferOpenApi<typeof endpoints>['paths'];
107
+ *
108
+ * // Client usage
109
+ * import type { Paths } from './endpoints';
110
+ * const client = createTypedFetcher<Paths>({ baseURL: 'http://localhost:3000' });
111
+ *
112
+ * const user = await client('GET /users/{id}', { params: { id: '123' } });
113
+ * const newUser = await client('POST /users', { body: { name: 'Jane' } });
114
+ * ```
115
+ */
116
+ export type InferOpenApi<TEndpoints extends readonly any[]> = TEndpoints extends readonly [infer First, ...infer Rest] ? InferOpenApiFromEndpoint<First> extends {
117
+ paths: infer P1;
118
+ } ? Rest extends [] ? {
119
+ paths: P1;
120
+ } : InferOpenApi<Rest> extends {
121
+ paths: infer P2;
122
+ } ? {
123
+ paths: P1 & P2;
124
+ } : {
125
+ paths: P1;
126
+ } : InferOpenApi<Rest> : {
127
+ paths: {};
128
+ };
129
+ //#endregion
130
+ //# sourceMappingURL=infer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infer.d.mts","names":[],"sources":["../src/infer.ts"],"mappings":";;;;;;;;;KAeK,gBAAgB,yBACpB,kCAAkC,eAAe,YAC3C,KAAK,oBAAmB,gBAAgB;;;;KAM1C,gBAAgB,UAAU,cAAc,UAAU;;;;KAKlD,qBAAqB,yBACzB,gBAAgB,gBAAgB;EAG7B;IACC,MAAM,gBAAgB;;;;;;KAOtB,yBAAyB,eAAe,mBAAmB;EAC/D,aAAa;;EAGX;IAMC,OAAO,yBAAyB;;;;;;KAQ/B,eACJ,eAAe,iBACf,gBAAgB,gCACb,yBAAyB;EAC5B,cAAc;IAAiB,YAAY;;IAExC;MAKC,oBAAoB,yBAAyB;;;EAIjD;IACC;MACC,SAAS,gBAAgB;QAEtB,oBAAoB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+BlC,yBAAyB,KACpC,UAAU,eACH,cACA,eACA,cACA;EAMJ,UACE,KAAK,SAAS,qBAAqB,aAClC,KAAK,gBAAgB,WAAW,eAAe,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2ClD,aAAa,qCACxB,mCAAmC,gBAAgB,QAChD,yBAAyB;EAAiB,aAAa;IACtD;EACG,OAAO;IACT,aAAa;EAAgB,aAAa;;EACvC,OAAO,KAAK;;EACZ,OAAO;IACX,aAAa;EACZ"}
package/dist/infer.mjs CHANGED
@@ -1 +1 @@
1
- import "./infer-uCUq1whM.mjs";
1
+ export {};
@@ -1,10 +1,9 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_fetcher = require('./fetcher-CwnSqc4D.cjs');
3
- const __tanstack_react_query = require_chunk.__toESM(require("@tanstack/react-query"));
4
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_fetcher = require("./fetcher.cjs");
3
+ let _tanstack_react_query = require("@tanstack/react-query");
5
4
  //#region src/openapi-hooks.ts
6
5
  function createOpenAPIHooks(options = {}) {
7
- const { operations,...fetcherOptions } = options;
6
+ const { operations, ...fetcherOptions } = options;
8
7
  const fetcher = require_fetcher.createTypedFetcher(fetcherOptions);
9
8
  function buildEndpoint(operationId) {
10
9
  const op = operations?.[operationId];
@@ -12,31 +11,29 @@ function createOpenAPIHooks(options = {}) {
12
11
  return operationId;
13
12
  }
14
13
  return {
15
- useQuery: (operationId, config, options$1) => {
14
+ useQuery: (operationId, config, options) => {
16
15
  const endpoint = buildEndpoint(operationId);
17
16
  const queryKey = [operationId, ...config ? [config] : []];
18
- return (0, __tanstack_react_query.useQuery)({
17
+ return (0, _tanstack_react_query.useQuery)({
19
18
  queryKey,
20
19
  queryFn: async () => {
21
- const response = await fetcher(endpoint, config);
22
- return response;
20
+ return await fetcher(endpoint, config);
23
21
  },
24
- ...options$1
22
+ ...options
25
23
  });
26
24
  },
27
- useMutation: (operationId, options$1) => {
25
+ useMutation: (operationId, options) => {
28
26
  const endpoint = buildEndpoint(operationId);
29
- return (0, __tanstack_react_query.useMutation)({
27
+ return (0, _tanstack_react_query.useMutation)({
30
28
  mutationFn: async (variables) => {
31
- const response = await fetcher(endpoint, variables);
32
- return response;
29
+ return await fetcher(endpoint, variables);
33
30
  },
34
- ...options$1
31
+ ...options
35
32
  });
36
33
  }
37
34
  };
38
35
  }
39
-
40
36
  //#endregion
41
37
  exports.createOpenAPIHooks = createOpenAPIHooks;
38
+
42
39
  //# sourceMappingURL=openapi-hooks.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi-hooks.cjs","names":["options: FetcherOptions & { operations?: OperationRegistry }","operationId: OpId","config?: RemoveNever<OperationParams<Paths, OpId>>","options?: Omit<\n\t\t\t\tUseQueryOptions<OperationResponse<Paths, OpId>, Error>,\n\t\t\t\t'queryKey' | 'queryFn'\n\t\t\t>","options","options?: Omit<\n\t\t\t\tUseMutationOptions<\n\t\t\t\t\tOperationResponse<Paths, OpId>,\n\t\t\t\t\tError,\n\t\t\t\t\tRemoveNever<OperationParams<Paths, OpId>>\n\t\t\t\t>,\n\t\t\t\t'mutationFn'\n\t\t\t>"],"sources":["../src/openapi-hooks.ts"],"sourcesContent":["import type {\n\tUseMutationOptions,\n\tUseQueryOptions,\n} from '@tanstack/react-query';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { createTypedFetcher } from './fetcher';\nimport type { FetcherOptions } from './types';\n\n// Simplified type helpers for OpenAPI paths\ntype HttpMethods = 'get' | 'post' | 'put' | 'patch' | 'delete';\n\n// Extract all operations from paths\ntype AllOperations<Paths> = {\n\t[Path in keyof Paths]: {\n\t\t[Method in keyof Paths[Path] & HttpMethods]: Paths[Path][Method] extends {\n\t\t\toperationId: infer OpId;\n\t\t}\n\t\t\t? OpId extends string\n\t\t\t\t? {\n\t\t\t\t\t\toperationId: OpId;\n\t\t\t\t\t\tpath: Path;\n\t\t\t\t\t\tmethod: Method;\n\t\t\t\t\t\tspec: Paths[Path][Method] & {\n\t\t\t\t\t\t\t_pathParams?: Paths[Path] extends {\n\t\t\t\t\t\t\t\tparameters: { path: infer P };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t? P\n\t\t\t\t\t\t\t\t: never;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t: never\n\t\t\t: never;\n\t}[keyof Paths[Path] & HttpMethods];\n}[keyof Paths];\n\n// Create operation map\ntype OperationMap<Paths> = {\n\t[Op in AllOperations<Paths> as Op extends {\n\t\toperationId: infer Id extends string;\n\t}\n\t\t? Id\n\t\t: never]: Op;\n};\n\n// Get operation IDs\ntype OperationId<Paths> = keyof OperationMap<Paths>;\n\n// Get operations by method\ntype OperationsByMethod<Paths, Method extends HttpMethods> = {\n\t[K in OperationId<Paths>]: OperationMap<Paths>[K] extends { method: Method }\n\t\t? K\n\t\t: never;\n}[OperationId<Paths>];\n\n// Extract parameter types\ntype OperationParams<\n\tPaths,\n\tOpId extends OperationId<Paths>,\n> = OperationMap<Paths>[OpId] extends {\n\tpath: infer Path extends keyof Paths;\n\tspec: infer Spec;\n}\n\t? {\n\t\t\tparams?: Paths[Path] extends { parameters: { path: infer P } }\n\t\t\t\t? P\n\t\t\t\t: Spec extends { parameters: { path: infer P } }\n\t\t\t\t\t? P\n\t\t\t\t\t: never;\n\t\t\tquery?: Spec extends { parameters?: { query?: infer Q } } ? Q : never;\n\t\t\tbody?: Spec extends {\n\t\t\t\trequestBody: { content: { 'application/json': infer Body } };\n\t\t\t}\n\t\t\t\t? Body\n\t\t\t\t: Spec extends {\n\t\t\t\t\t\t\trequestBody: {\n\t\t\t\t\t\t\t\trequired: true;\n\t\t\t\t\t\t\t\tcontent: { 'application/json': infer Body };\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t? Body\n\t\t\t\t\t: never;\n\t\t}\n\t: never;\n\n// Extract response type\ntype OperationResponse<\n\tPaths,\n\tOpId extends OperationId<Paths>,\n> = OperationMap<Paths>[OpId] extends { spec: infer Spec }\n\t? Spec extends {\n\t\t\tresponses: { 200: { content: { 'application/json': infer R } } };\n\t\t}\n\t\t? R\n\t\t: Spec extends {\n\t\t\t\t\tresponses: { 201: { content: { 'application/json': infer R } } };\n\t\t\t\t}\n\t\t\t? R\n\t\t\t: Spec extends { responses: { 204: any } }\n\t\t\t\t? undefined\n\t\t\t\t: unknown\n\t: never;\n\n// Remove never properties\ntype RemoveNever<T> = Pick<\n\tT,\n\t{\n\t\t[K in keyof T]: T[K] extends never ? never : K;\n\t}[keyof T]\n>;\n\n// Runtime operation registry (would be generated)\ninterface OperationRegistry {\n\t[operationId: string]: {\n\t\tpath: string;\n\t\tmethod: string;\n\t};\n}\n\nexport function createOpenAPIHooks<Paths>(\n\toptions: FetcherOptions & { operations?: OperationRegistry } = {},\n) {\n\tconst { operations, ...fetcherOptions } = options;\n\tconst fetcher = createTypedFetcher<Paths>(fetcherOptions);\n\n\tfunction buildEndpoint<OpId extends OperationId<Paths>>(\n\t\toperationId: OpId,\n\t): string {\n\t\t// Runtime lookup from registry\n\t\tconst op = operations?.[operationId as string];\n\t\tif (op) {\n\t\t\treturn `${op.method.toUpperCase()} ${op.path}`;\n\t\t}\n\t\t// Fallback for compile-time only usage\n\t\treturn operationId as string;\n\t}\n\n\treturn {\n\t\tuseQuery: <OpId extends OperationsByMethod<Paths, 'get'>>(\n\t\t\toperationId: OpId,\n\t\t\tconfig?: RemoveNever<OperationParams<Paths, OpId>>,\n\t\t\toptions?: Omit<\n\t\t\t\tUseQueryOptions<OperationResponse<Paths, OpId>, Error>,\n\t\t\t\t'queryKey' | 'queryFn'\n\t\t\t>,\n\t\t) => {\n\t\t\tconst endpoint = buildEndpoint(operationId);\n\t\t\tconst queryKey = [operationId, ...(config ? [config] : [])];\n\n\t\t\treturn useQuery<OperationResponse<Paths, OpId>, Error>({\n\t\t\t\tqueryKey,\n\t\t\t\tqueryFn: async () => {\n\t\t\t\t\tconst response = await fetcher(endpoint as any, config as any);\n\t\t\t\t\treturn response as OperationResponse<Paths, OpId>;\n\t\t\t\t},\n\t\t\t\t...options,\n\t\t\t});\n\t\t},\n\n\t\tuseMutation: <\n\t\t\tOpId extends Exclude<\n\t\t\t\tOperationId<Paths>,\n\t\t\t\tOperationsByMethod<Paths, 'get'>\n\t\t\t>,\n\t\t>(\n\t\t\toperationId: OpId,\n\t\t\toptions?: Omit<\n\t\t\t\tUseMutationOptions<\n\t\t\t\t\tOperationResponse<Paths, OpId>,\n\t\t\t\t\tError,\n\t\t\t\t\tRemoveNever<OperationParams<Paths, OpId>>\n\t\t\t\t>,\n\t\t\t\t'mutationFn'\n\t\t\t>,\n\t\t) => {\n\t\t\tconst endpoint = buildEndpoint(operationId);\n\n\t\t\treturn useMutation<\n\t\t\t\tOperationResponse<Paths, OpId>,\n\t\t\t\tError,\n\t\t\t\tRemoveNever<OperationParams<Paths, OpId>>\n\t\t\t>({\n\t\t\t\tmutationFn: async (variables) => {\n\t\t\t\t\tconst response = await fetcher(endpoint as any, variables as any);\n\t\t\t\t\treturn response as OperationResponse<Paths, OpId>;\n\t\t\t\t},\n\t\t\t\t...options,\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;;AAsHA,SAAgB,mBACfA,UAA+D,CAAE,GAChE;CACD,MAAM,EAAE,WAAY,GAAG,gBAAgB,GAAG;CAC1C,MAAM,UAAU,mCAA0B,eAAe;CAEzD,SAAS,cACRC,aACS;EAET,MAAM,KAAK,aAAa;AACxB,MAAI,GACH,SAAQ,EAAE,GAAG,OAAO,aAAa,CAAC,GAAG,GAAG,KAAK;AAG9C,SAAO;CACP;AAED,QAAO;EACN,UAAU,CACTA,aACAC,QACAC,cAII;GACJ,MAAM,WAAW,cAAc,YAAY;GAC3C,MAAM,WAAW,CAAC,aAAa,GAAI,SAAS,CAAC,MAAO,IAAG,CAAE,CAAE;AAE3D,UAAO,qCAAgD;IACtD;IACA,SAAS,YAAY;KACpB,MAAM,WAAW,MAAM,QAAQ,UAAiB,OAAc;AAC9D,YAAO;IACP;IACD,GAAGC;GACH,EAAC;EACF;EAED,aAAa,CAMZH,aACAI,cAQI;GACJ,MAAM,WAAW,cAAc,YAAY;AAE3C,UAAO,wCAIL;IACD,YAAY,OAAO,cAAc;KAChC,MAAM,WAAW,MAAM,QAAQ,UAAiB,UAAiB;AACjE,YAAO;IACP;IACD,GAAGD;GACH,EAAC;EACF;CACD;AACD"}
1
+ {"version":3,"file":"openapi-hooks.cjs","names":["createTypedFetcher","useQuery","useMutation"],"sources":["../src/openapi-hooks.ts"],"sourcesContent":["import type {\n\tUseMutationOptions,\n\tUseQueryOptions,\n} from '@tanstack/react-query';\nimport { useMutation, useQuery } from '@tanstack/react-query';\nimport { createTypedFetcher } from './fetcher';\nimport type { FetcherOptions } from './types';\n\n// Simplified type helpers for OpenAPI paths\ntype HttpMethods = 'get' | 'post' | 'put' | 'patch' | 'delete';\n\n// Extract all operations from paths\ntype AllOperations<Paths> = {\n\t[Path in keyof Paths]: {\n\t\t[Method in keyof Paths[Path] & HttpMethods]: Paths[Path][Method] extends {\n\t\t\toperationId: infer OpId;\n\t\t}\n\t\t\t? OpId extends string\n\t\t\t\t? {\n\t\t\t\t\t\toperationId: OpId;\n\t\t\t\t\t\tpath: Path;\n\t\t\t\t\t\tmethod: Method;\n\t\t\t\t\t\tspec: Paths[Path][Method] & {\n\t\t\t\t\t\t\t_pathParams?: Paths[Path] extends {\n\t\t\t\t\t\t\t\tparameters: { path: infer P };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t? P\n\t\t\t\t\t\t\t\t: never;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t: never\n\t\t\t: never;\n\t}[keyof Paths[Path] & HttpMethods];\n}[keyof Paths];\n\n// Create operation map\ntype OperationMap<Paths> = {\n\t[Op in AllOperations<Paths> as Op extends {\n\t\toperationId: infer Id extends string;\n\t}\n\t\t? Id\n\t\t: never]: Op;\n};\n\n// Get operation IDs\ntype OperationId<Paths> = keyof OperationMap<Paths>;\n\n// Get operations by method\ntype OperationsByMethod<Paths, Method extends HttpMethods> = {\n\t[K in OperationId<Paths>]: OperationMap<Paths>[K] extends { method: Method }\n\t\t? K\n\t\t: never;\n}[OperationId<Paths>];\n\n// Extract parameter types\ntype OperationParams<\n\tPaths,\n\tOpId extends OperationId<Paths>,\n> = OperationMap<Paths>[OpId] extends {\n\tpath: infer Path extends keyof Paths;\n\tspec: infer Spec;\n}\n\t? {\n\t\t\tparams?: Paths[Path] extends { parameters: { path: infer P } }\n\t\t\t\t? P\n\t\t\t\t: Spec extends { parameters: { path: infer P } }\n\t\t\t\t\t? P\n\t\t\t\t\t: never;\n\t\t\tquery?: Spec extends { parameters?: { query?: infer Q } } ? Q : never;\n\t\t\tbody?: Spec extends {\n\t\t\t\trequestBody: { content: { 'application/json': infer Body } };\n\t\t\t}\n\t\t\t\t? Body\n\t\t\t\t: Spec extends {\n\t\t\t\t\t\t\trequestBody: {\n\t\t\t\t\t\t\t\trequired: true;\n\t\t\t\t\t\t\t\tcontent: { 'application/json': infer Body };\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t? Body\n\t\t\t\t\t: never;\n\t\t}\n\t: never;\n\n// Extract response type\ntype OperationResponse<\n\tPaths,\n\tOpId extends OperationId<Paths>,\n> = OperationMap<Paths>[OpId] extends { spec: infer Spec }\n\t? Spec extends {\n\t\t\tresponses: { 200: { content: { 'application/json': infer R } } };\n\t\t}\n\t\t? R\n\t\t: Spec extends {\n\t\t\t\t\tresponses: { 201: { content: { 'application/json': infer R } } };\n\t\t\t\t}\n\t\t\t? R\n\t\t\t: Spec extends { responses: { 204: any } }\n\t\t\t\t? undefined\n\t\t\t\t: unknown\n\t: never;\n\n// Remove never properties\ntype RemoveNever<T> = Pick<\n\tT,\n\t{\n\t\t[K in keyof T]: T[K] extends never ? never : K;\n\t}[keyof T]\n>;\n\n// Runtime operation registry (would be generated)\ninterface OperationRegistry {\n\t[operationId: string]: {\n\t\tpath: string;\n\t\tmethod: string;\n\t};\n}\n\nexport function createOpenAPIHooks<Paths>(\n\toptions: FetcherOptions & { operations?: OperationRegistry } = {},\n) {\n\tconst { operations, ...fetcherOptions } = options;\n\tconst fetcher = createTypedFetcher<Paths>(fetcherOptions);\n\n\tfunction buildEndpoint<OpId extends OperationId<Paths>>(\n\t\toperationId: OpId,\n\t): string {\n\t\t// Runtime lookup from registry\n\t\tconst op = operations?.[operationId as string];\n\t\tif (op) {\n\t\t\treturn `${op.method.toUpperCase()} ${op.path}`;\n\t\t}\n\t\t// Fallback for compile-time only usage\n\t\treturn operationId as string;\n\t}\n\n\treturn {\n\t\tuseQuery: <OpId extends OperationsByMethod<Paths, 'get'>>(\n\t\t\toperationId: OpId,\n\t\t\tconfig?: RemoveNever<OperationParams<Paths, OpId>>,\n\t\t\toptions?: Omit<\n\t\t\t\tUseQueryOptions<OperationResponse<Paths, OpId>, Error>,\n\t\t\t\t'queryKey' | 'queryFn'\n\t\t\t>,\n\t\t) => {\n\t\t\tconst endpoint = buildEndpoint(operationId);\n\t\t\tconst queryKey = [operationId, ...(config ? [config] : [])];\n\n\t\t\treturn useQuery<OperationResponse<Paths, OpId>, Error>({\n\t\t\t\tqueryKey,\n\t\t\t\tqueryFn: async () => {\n\t\t\t\t\tconst response = await fetcher(endpoint as any, config as any);\n\t\t\t\t\treturn response as OperationResponse<Paths, OpId>;\n\t\t\t\t},\n\t\t\t\t...options,\n\t\t\t});\n\t\t},\n\n\t\tuseMutation: <\n\t\t\tOpId extends Exclude<\n\t\t\t\tOperationId<Paths>,\n\t\t\t\tOperationsByMethod<Paths, 'get'>\n\t\t\t>,\n\t\t>(\n\t\t\toperationId: OpId,\n\t\t\toptions?: Omit<\n\t\t\t\tUseMutationOptions<\n\t\t\t\t\tOperationResponse<Paths, OpId>,\n\t\t\t\t\tError,\n\t\t\t\t\tRemoveNever<OperationParams<Paths, OpId>>\n\t\t\t\t>,\n\t\t\t\t'mutationFn'\n\t\t\t>,\n\t\t) => {\n\t\t\tconst endpoint = buildEndpoint(operationId);\n\n\t\t\treturn useMutation<\n\t\t\t\tOperationResponse<Paths, OpId>,\n\t\t\t\tError,\n\t\t\t\tRemoveNever<OperationParams<Paths, OpId>>\n\t\t\t>({\n\t\t\t\tmutationFn: async (variables) => {\n\t\t\t\t\tconst response = await fetcher(endpoint as any, variables as any);\n\t\t\t\t\treturn response as OperationResponse<Paths, OpId>;\n\t\t\t\t},\n\t\t\t\t...options,\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;AAsHA,SAAgB,mBACf,UAA+D,CAAC,GAC/D;CACD,MAAM,EAAE,YAAY,GAAG,mBAAmB;CAC1C,MAAM,UAAUA,gBAAAA,mBAA0B,cAAc;CAExD,SAAS,cACR,aACS;EAET,MAAM,KAAK,aAAa;EACxB,IAAI,IACH,OAAO,GAAG,GAAG,OAAO,YAAY,EAAE,GAAG,GAAG;EAGzC,OAAO;CACR;CAEA,OAAO;EACN,WACC,aACA,QACA,YAII;GACJ,MAAM,WAAW,cAAc,WAAW;GAC1C,MAAM,WAAW,CAAC,aAAa,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;GAE1D,QAAA,GAAOC,sBAAAA,SAAAA,CAAgD;IACtD;IACA,SAAS,YAAY;KAEpB,OAAO,MADgB,QAAQ,UAAiB,MAAa;IAE9D;IACA,GAAG;GACJ,CAAC;EACF;EAEA,cAMC,aACA,YAQI;GACJ,MAAM,WAAW,cAAc,WAAW;GAE1C,QAAA,GAAOC,sBAAAA,YAAAA,CAIL;IACD,YAAY,OAAO,cAAc;KAEhC,OAAO,MADgB,QAAQ,UAAiB,SAAgB;IAEjE;IACA,GAAG;GACJ,CAAC;EACF;CACD;AACD"}
@@ -1,7 +1,5 @@
1
- import { FetcherOptions } from "./types-DMQMHePI.cjs";
2
- import * as _tanstack_react_query0 from "@tanstack/react-query";
1
+ import { FetcherOptions } from "./types.cjs";
3
2
  import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
4
-
5
3
  //#region src/openapi-hooks.d.ts
6
4
  type HttpMethods = 'get' | 'post' | 'put' | 'patch' | 'delete';
7
5
  type AllOperations<Paths> = { [Path in keyof Paths]: { [Method in keyof Paths[Path] & HttpMethods]: Paths[Path][Method] extends {
@@ -17,14 +15,14 @@ type AllOperations<Paths> = { [Path in keyof Paths]: { [Method in keyof Paths[Pa
17
15
  };
18
16
  } ? P : never;
19
17
  };
20
- } : never : never }[keyof Paths[Path] & HttpMethods] }[keyof Paths];
18
+ } : never : never; }[keyof Paths[Path] & HttpMethods]; }[keyof Paths];
21
19
  type OperationMap<Paths> = { [Op in AllOperations<Paths> as Op extends {
22
20
  operationId: infer Id extends string;
23
- } ? Id : never]: Op };
21
+ } ? Id : never]: Op; };
24
22
  type OperationId<Paths> = keyof OperationMap<Paths>;
25
23
  type OperationsByMethod<Paths, Method extends HttpMethods> = { [K in OperationId<Paths>]: OperationMap<Paths>[K] extends {
26
24
  method: Method;
27
- } ? K : never }[OperationId<Paths>];
25
+ } ? K : never; }[OperationId<Paths>];
28
26
  type OperationParams<Paths, OpId extends OperationId<Paths>> = OperationMap<Paths>[OpId] extends {
29
27
  path: infer Path extends keyof Paths;
30
28
  spec: infer Spec;
@@ -81,19 +79,18 @@ type OperationResponse<Paths, OpId extends OperationId<Paths>> = OperationMap<Pa
81
79
  204: any;
82
80
  };
83
81
  } ? undefined : unknown : never;
84
- type RemoveNever<T> = Pick<T, { [K in keyof T]: T[K] extends never ? never : K }[keyof T]>;
82
+ type RemoveNever<T> = Pick<T, { [K in keyof T]: T[K] extends never ? never : K; }[keyof T]>;
85
83
  interface OperationRegistry {
86
84
  [operationId: string]: {
87
85
  path: string;
88
86
  method: string;
89
87
  };
90
88
  }
91
- declare function createOpenAPIHooks<Paths>(options?: FetcherOptions & {
89
+ export declare function createOpenAPIHooks<Paths>(options?: FetcherOptions & {
92
90
  operations?: OperationRegistry;
93
91
  }): {
94
- useQuery: <OpId extends OperationsByMethod<Paths, "get">>(operationId: OpId, config?: RemoveNever<OperationParams<Paths, OpId>>, options?: Omit<UseQueryOptions<OperationResponse<Paths, OpId>, Error>, "queryKey" | "queryFn">) => _tanstack_react_query0.UseQueryResult<_tanstack_react_query0.NoInfer<OperationResponse<Paths, OpId>>, Error>;
95
- useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths, "get">>>(operationId: OpId, options?: Omit<UseMutationOptions<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>>, "mutationFn">) => _tanstack_react_query0.UseMutationResult<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>, unknown>;
92
+ useQuery: <OpId extends OperationsByMethod<Paths, "get">>(operationId: OpId, config?: RemoveNever<OperationParams<Paths, OpId>>, options?: Omit<UseQueryOptions<OperationResponse<Paths, OpId>, Error>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseQueryResult<import("@tanstack/react-query").NoInfer<OperationResponse<Paths, OpId>>, Error>;
93
+ useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths, "get">>>(operationId: OpId, options?: Omit<UseMutationOptions<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>>, "mutationFn">) => import("@tanstack/react-query").UseMutationResult<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>, unknown>;
96
94
  };
97
95
  //#endregion
98
- export { createOpenAPIHooks };
99
96
  //# sourceMappingURL=openapi-hooks.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi-hooks.d.cts","names":[],"sources":["../src/openapi-hooks.ts"],"sourcesContent":[],"mappings":";;;;;KASK,WAAA;KAGA,wCACW,qBAJA,MAKG,KALH,CAKS,IALT,CAAA,GAKiB,WALjB,GAK+B,KAL/B,CAKqC,IALrC,CAAA,CAK2C,MAL3C,CAAA,SAAA;EAGX,WAAa,EAAA,KAAA,KAAA;AAAA,CAAA,GAKb,IALa,SAAA,MAAA,GAAA;EACF,WAAA,EAMG,IANH;EACG,IAAA,EAMP,IANO;EAAM,MAAA,EAOX,MAPW;EAAQ,IAAA,EAQrB,KARqB,CAQf,IARe,CAAA,CAQT,MARS,CAAA,GAAA;IAAc,WAAA,CAAA,EAS1B,KAT0B,CASpB,IAToB,CAAA,SAAA;MAAM,UAAA,EAAA;QAAM,IAAA,EAAA,KAAA,EAAA;MAGtD,CAAA;IAEc,CAAA,GAOT,CAPS,GAAA,KAAA;EACP,CAAA;AACE,CAAA,GAAA,KAAA,GAAA,KAAA,EAAM,CAAA,MAWX,KAVG,CAUG,IAVH,CAAA,GAUW,WAVX,CAAA,EAAK,CAAA,MAWT,KAXU,CAAA;KAcb,YAdmB,CAAA,KAAA,CAAA,GAAA,SAehB,aAda,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ACZ,YAAY,QACZ,mBAAmB,gBACnB,aAEY,MAAI,UACP,KACT,mBACC,kBAAkB,OAAO,OACzB,OACA,YAAY,gBAAgB,OAAO,2DAGpC,kBAAA,kBAAA,OAAA,OAAA,OAAA,YAAA,gBAAA,OAAA"}
@@ -1,7 +1,5 @@
1
- import { FetcherOptions } from "./types-BMGM6sZc.mjs";
2
- import * as _tanstack_react_query0 from "@tanstack/react-query";
1
+ import { FetcherOptions } from "./types.mjs";
3
2
  import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
4
-
5
3
  //#region src/openapi-hooks.d.ts
6
4
  type HttpMethods = 'get' | 'post' | 'put' | 'patch' | 'delete';
7
5
  type AllOperations<Paths> = { [Path in keyof Paths]: { [Method in keyof Paths[Path] & HttpMethods]: Paths[Path][Method] extends {
@@ -17,14 +15,14 @@ type AllOperations<Paths> = { [Path in keyof Paths]: { [Method in keyof Paths[Pa
17
15
  };
18
16
  } ? P : never;
19
17
  };
20
- } : never : never }[keyof Paths[Path] & HttpMethods] }[keyof Paths];
18
+ } : never : never; }[keyof Paths[Path] & HttpMethods]; }[keyof Paths];
21
19
  type OperationMap<Paths> = { [Op in AllOperations<Paths> as Op extends {
22
20
  operationId: infer Id extends string;
23
- } ? Id : never]: Op };
21
+ } ? Id : never]: Op; };
24
22
  type OperationId<Paths> = keyof OperationMap<Paths>;
25
23
  type OperationsByMethod<Paths, Method extends HttpMethods> = { [K in OperationId<Paths>]: OperationMap<Paths>[K] extends {
26
24
  method: Method;
27
- } ? K : never }[OperationId<Paths>];
25
+ } ? K : never; }[OperationId<Paths>];
28
26
  type OperationParams<Paths, OpId extends OperationId<Paths>> = OperationMap<Paths>[OpId] extends {
29
27
  path: infer Path extends keyof Paths;
30
28
  spec: infer Spec;
@@ -81,19 +79,18 @@ type OperationResponse<Paths, OpId extends OperationId<Paths>> = OperationMap<Pa
81
79
  204: any;
82
80
  };
83
81
  } ? undefined : unknown : never;
84
- type RemoveNever<T> = Pick<T, { [K in keyof T]: T[K] extends never ? never : K }[keyof T]>;
82
+ type RemoveNever<T> = Pick<T, { [K in keyof T]: T[K] extends never ? never : K; }[keyof T]>;
85
83
  interface OperationRegistry {
86
84
  [operationId: string]: {
87
85
  path: string;
88
86
  method: string;
89
87
  };
90
88
  }
91
- declare function createOpenAPIHooks<Paths>(options?: FetcherOptions & {
89
+ export declare function createOpenAPIHooks<Paths>(options?: FetcherOptions & {
92
90
  operations?: OperationRegistry;
93
91
  }): {
94
- useQuery: <OpId extends OperationsByMethod<Paths, "get">>(operationId: OpId, config?: RemoveNever<OperationParams<Paths, OpId>>, options?: Omit<UseQueryOptions<OperationResponse<Paths, OpId>, Error>, "queryKey" | "queryFn">) => _tanstack_react_query0.UseQueryResult<_tanstack_react_query0.NoInfer<OperationResponse<Paths, OpId>>, Error>;
95
- useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths, "get">>>(operationId: OpId, options?: Omit<UseMutationOptions<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>>, "mutationFn">) => _tanstack_react_query0.UseMutationResult<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>, unknown>;
92
+ useQuery: <OpId extends OperationsByMethod<Paths, "get">>(operationId: OpId, config?: RemoveNever<OperationParams<Paths, OpId>>, options?: Omit<UseQueryOptions<OperationResponse<Paths, OpId>, Error>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseQueryResult<import("@tanstack/react-query").NoInfer<OperationResponse<Paths, OpId>>, Error>;
93
+ useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths, "get">>>(operationId: OpId, options?: Omit<UseMutationOptions<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>>, "mutationFn">) => import("@tanstack/react-query").UseMutationResult<OperationResponse<Paths, OpId>, Error, RemoveNever<OperationParams<Paths, OpId>>, unknown>;
96
94
  };
97
95
  //#endregion
98
- export { createOpenAPIHooks };
99
96
  //# sour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QAAQ;IACjE,aAEF,YAAY;KAGT,gBACJ,OACA,aAAa,YAAY,UACtB,aAAa,OAAO;EACvB,YAAY,mBAAmB;EAC/B,YAAY;;EAGV,SAAS,MAAM;IAAgB;MAAc,YAAY;;MACtD,IACA;IAAe;MAAc,YAAY;;MACxC;EAEJ,QAAQ;IAAe;MAAe,cAAc;;MAAQ;EAC5D,OAAO;IACN;MAAe;QAAW,0BAA0B;;;MAElD,OACA;IACC;MACC;MACA;QAAW,0BAA0B;;;MAGtC;;KAMF,kBACJ,OACA,aAAa,YAAY,UACtB,aAAa,OAAO;EAAgB,YAAY;IACjD;EACA;IAAa;MAAO;QAAW,0BAA0B;;;;IAExD,IACA;EACC;IAAa;MAAO;QAAW,0BAA0B;;;;IAEzD,IACA;EAAe;IAAa;;;KAM5B,YAAY,KAAK,KACrB,MAEE,WAAW,IAAI,EAAE,2BAA2B,WACtC;UAIC;GACR;IACA;IACA;;;wBAIc,mBAAmB,OAClC,UAAS;EAAmB,aAAa;;EAkB7B,WAAA,aAAa,mBAAmB,eAAa,aAC1C,MAAI,SACR,YAAY,gBAAgB,OAAO,QAAM,UACxC,KACT,gBAAgB,kBAAkB,OAAO,OAAO,oEAEhD,+CAAA,QAAA,kBAAA,OAAA,QAAA;EAgBD,cAAA,aAAa,QACZ,YAAY,QACZ,mBAAmB,gBACnB,aAEY,MAAI,UACP,KACT,mBACC,kBAAkB,OAAO,OACzB,OACA,YAAY,gBAAgB,OAAO,2DAGpC,kBAAA,kBAAA,OAAA,OAAA,OAAA,YAAA,gBAAA,OAAA"}
@@ -1,9 +1,8 @@
1
- import { createTypedFetcher } from "./fetcher-CakjC9C7.mjs";
1
+ import { createTypedFetcher } from "./fetcher.mjs";
2
2
  import { useMutation, useQuery } from "@tanstack/react-query";
3
-
4
3
  //#region src/openapi-hooks.ts
5
4
  function createOpenAPIHooks(options = {}) {
6
- const { operations,...fetcherOptions } = options;
5
+ const { operations, ...fetcherOptions } = options;
7
6
  const fetcher = createTypedFetcher(fetcherOptions);
8
7
  function buildEndpoint(operationId) {
9
8
  const op = operations?.[operationId];
@@ -11,31 +10,29 @@ function createOpenAPIHooks(options = {}) {
11
10
  return operationId;
12
11
  }
13
12
  return {
14
- useQuery: (operationId, config, options$1) => {
13
+ useQuery: (operationId, config, options) => {
15
14
  const endpoint = buildEndpoint(operationId);
16
15
  const queryKey = [operationId, ...config ? [config] : []];
17
16
  return useQuery({
18
17
  queryKey,
19
18
  queryFn: async () => {
20
- const response = await fetcher(endpoint, config);
21
- return response;
19
+ return await fetcher(endpoint, config);
22
20
  },
23
- ...options$1
21
+ ...options
24
22
  });
25
23
  },
26
- useMutation: (operationId, options$1) => {
24
+ useMutation: (operationId, options) => {
27
25
  const endpoint = buildEndpoint(operationId);
28
26
  return useMutation({
29
27
  mutationFn: async (variables) => {
30
- const response = await fetcher(endpoint, variables);
31
- return response;
28
+ return await fetcher(endpoint, variables);
32
29
  },
33
- ...options$1
30
+ ...options
34
31
  });
35
32
  }
36
33
  };
37
34
  }
38
-
39
35
  //#endregion
40
36
  export { createOpenAPIHooks };
37
+
41
38
  //# sourceMappingURL=openapi-hooks.mjs.map