@geekmidas/client 10.0.0-alpha.2 → 10.0.0-alpha.21
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/README.md +39 -57
- package/dist/auth-fetcher.cjs +78 -3
- package/dist/auth-fetcher.cjs.map +1 -0
- package/dist/auth-fetcher.d.cts +155 -3
- package/dist/auth-fetcher.d.cts.map +1 -0
- package/dist/auth-fetcher.d.mts +155 -3
- package/dist/auth-fetcher.d.mts.map +1 -0
- package/dist/auth-fetcher.mjs +77 -3
- package/dist/auth-fetcher.mjs.map +1 -0
- package/dist/endpoint-hooks.cjs +11 -15
- package/dist/endpoint-hooks.cjs.map +1 -1
- package/dist/endpoint-hooks.d.cts +4 -7
- package/dist/endpoint-hooks.d.cts.map +1 -1
- package/dist/endpoint-hooks.d.mts +4 -7
- package/dist/endpoint-hooks.d.mts.map +1 -1
- package/dist/endpoint-hooks.mjs +5 -9
- package/dist/endpoint-hooks.mjs.map +1 -1
- package/dist/fetcher.cjs +111 -3
- package/dist/fetcher.cjs.map +1 -0
- package/dist/fetcher.d.cts +23 -3
- package/dist/fetcher.d.cts.map +1 -0
- package/dist/fetcher.d.mts +23 -3
- package/dist/fetcher.d.mts.map +1 -0
- package/dist/fetcher.mjs +86 -2
- package/dist/fetcher.mjs.map +1 -0
- package/dist/index.cjs +9 -6
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +6 -6
- package/dist/infer.cjs +0 -1
- package/dist/infer.d.cts +130 -2
- package/dist/infer.d.cts.map +1 -0
- package/dist/infer.d.mts +130 -2
- package/dist/infer.d.mts.map +1 -0
- package/dist/infer.mjs +1 -1
- package/dist/methods.cjs +21 -0
- package/dist/methods.cjs.map +1 -0
- package/dist/methods.d.cts +23 -0
- package/dist/methods.d.cts.map +1 -0
- package/dist/methods.d.mts +23 -0
- package/dist/methods.d.mts.map +1 -0
- package/dist/methods.mjs +19 -0
- package/dist/methods.mjs.map +1 -0
- package/dist/openapi-hooks.cjs +13 -16
- package/dist/openapi-hooks.cjs.map +1 -1
- package/dist/openapi-hooks.d.cts +8 -11
- package/dist/openapi-hooks.d.cts.map +1 -1
- package/dist/openapi-hooks.d.mts +8 -11
- package/dist/openapi-hooks.d.mts.map +1 -1
- package/dist/openapi-hooks.mjs +9 -12
- package/dist/openapi-hooks.mjs.map +1 -1
- package/dist/openapi-types.d.cts +5 -6
- package/dist/openapi-types.d.cts.map +1 -1
- package/dist/openapi-types.d.mts +5 -6
- package/dist/openapi-types.d.mts.map +1 -1
- package/dist/react-query.cjs +17 -16
- package/dist/react-query.cjs.map +1 -1
- package/dist/react-query.d.cts +12 -17
- package/dist/react-query.d.cts.map +1 -1
- package/dist/react-query.d.mts +12 -17
- package/dist/react-query.d.mts.map +1 -1
- package/dist/react-query.mjs +10 -9
- package/dist/react-query.mjs.map +1 -1
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +114 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +114 -2
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -1
- package/package.json +14 -14
- package/dist/auth-fetcher-CBYuL6rx.d.cts +0 -158
- package/dist/auth-fetcher-CBYuL6rx.d.cts.map +0 -1
- package/dist/auth-fetcher-DOj0iz21.mjs +0 -77
- package/dist/auth-fetcher-DOj0iz21.mjs.map +0 -1
- package/dist/auth-fetcher-DxS8zOLc.d.mts +0 -158
- package/dist/auth-fetcher-DxS8zOLc.d.mts.map +0 -1
- package/dist/auth-fetcher-HILABmws.cjs +0 -82
- package/dist/auth-fetcher-HILABmws.cjs.map +0 -1
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/fetcher-C1xtCKpT.d.mts +0 -25
- package/dist/fetcher-C1xtCKpT.d.mts.map +0 -1
- package/dist/fetcher-CakjC9C7.mjs +0 -88
- package/dist/fetcher-CakjC9C7.mjs.map +0 -1
- package/dist/fetcher-CwnSqc4D.cjs +0 -100
- package/dist/fetcher-CwnSqc4D.cjs.map +0 -1
- package/dist/fetcher-cDrfwN-Y.d.cts +0 -25
- package/dist/fetcher-cDrfwN-Y.d.cts.map +0 -1
- package/dist/infer-6KKCgmg1.cjs +0 -0
- package/dist/infer-DfRq5kIb.d.cts +0 -133
- package/dist/infer-DfRq5kIb.d.cts.map +0 -1
- package/dist/infer-bTirNeNW.d.mts +0 -133
- package/dist/infer-bTirNeNW.d.mts.map +0 -1
- package/dist/infer-uCUq1whM.mjs +0 -0
- package/dist/openapi.cjs +0 -526
- package/dist/openapi.cjs.map +0 -1
- package/dist/openapi.mjs +0 -501
- package/dist/openapi.mjs.map +0 -1
- package/dist/types-BH8WgGrm.mjs +0 -0
- package/dist/types-BMGM6sZc.d.mts +0 -110
- package/dist/types-BMGM6sZc.d.mts.map +0 -1
- package/dist/types-DMQMHePI.d.cts +0 -110
- package/dist/types-DMQMHePI.d.cts.map +0 -1
- package/dist/types-a8gm_IaQ.cjs +0 -0
package/dist/openapi-hooks.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const require_fetcher = require(
|
|
3
|
-
|
|
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
|
|
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
|
|
14
|
+
useQuery: (operationId, config, options) => {
|
|
16
15
|
const endpoint = buildEndpoint(operationId);
|
|
17
16
|
const queryKey = [operationId, ...config ? [config] : []];
|
|
18
|
-
return (0,
|
|
17
|
+
return (0, _tanstack_react_query.useQuery)({
|
|
19
18
|
queryKey,
|
|
20
19
|
queryFn: async () => {
|
|
21
|
-
|
|
22
|
-
return response;
|
|
20
|
+
return await fetcher(endpoint, config);
|
|
23
21
|
},
|
|
24
|
-
...options
|
|
22
|
+
...options
|
|
25
23
|
});
|
|
26
24
|
},
|
|
27
|
-
useMutation: (operationId, options
|
|
25
|
+
useMutation: (operationId, options) => {
|
|
28
26
|
const endpoint = buildEndpoint(operationId);
|
|
29
|
-
return (0,
|
|
27
|
+
return (0, _tanstack_react_query.useMutation)({
|
|
30
28
|
mutationFn: async (variables) => {
|
|
31
|
-
|
|
32
|
-
return response;
|
|
29
|
+
return await fetcher(endpoint, variables);
|
|
33
30
|
},
|
|
34
|
-
...options
|
|
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":["
|
|
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"}
|
package/dist/openapi-hooks.d.cts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { FetcherOptions } from "./types
|
|
2
|
-
import * as _tanstack_react_query8 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,
|
|
95
|
-
useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths,
|
|
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<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"],"
|
|
1
|
+
{"version":3,"file":"openapi-hooks.d.cts","names":[],"sources":["../src/openapi-hooks.ts"],"mappings":";;;KASK;KAGA,cAAc,YACjB,cAAc,WACb,gBAAgB,MAAM,QAAQ,cAAc,MAAM,MAAM;EACxD,mBAAmB;IAEjB;EAEC,aAAa;EACb,MAAM;EACN,QAAQ;EACR,MAAM,MAAM,MAAM;IACjB,cAAc,MAAM;MACnB;QAAc,YAAY;;QAExB;;2BAMD,MAAM,QAAQ,sBACf;KAGH,aAAa,YAChB,MAAM,cAAc,UAAU;EAC9B,mBAAmB;IAEjB,aACQ;KAIP,YAAY,eAAe,aAAa;KAGxC,mBAAmB,OAAO,eAAe,kBAC5C,KAAK,YAAY,SAAS,aAAa,OAAO;EAAa,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;;EAkBxC,WAAW,aAAa,mBAAmB,eAAa,aAC1C,MAAI,SACR,YAAY,gBAAgB,OAAO,QAAM,UACxC,KACT,gBAAgB,kBAAkB,OAAO,OAAO,oEAEhD,eAAA,kBAAA,OAAA,OAAA;EAeF,cACC,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"}
|
package/dist/openapi-hooks.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { FetcherOptions } from "./types
|
|
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,
|
|
95
|
-
useMutation: <OpId extends Exclude<OperationId<Paths>, OperationsByMethod<Paths,
|
|
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<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.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-hooks.d.mts","names":[],"sources":["../src/openapi-hooks.ts"],"
|
|
1
|
+
{"version":3,"file":"openapi-hooks.d.mts","names":[],"sources":["../src/openapi-hooks.ts"],"mappings":";;;KASK;KAGA,cAAc,YACjB,cAAc,WACb,gBAAgB,MAAM,QAAQ,cAAc,MAAM,MAAM;EACxD,mBAAmB;IAEjB;EAEC,aAAa;EACb,MAAM;EACN,QAAQ;EACR,MAAM,MAAM,MAAM;IACjB,cAAc,MAAM;MACnB;QAAc,YAAY;;QAExB;;2BAMD,MAAM,QAAQ,sBACf;KAGH,aAAa,YAChB,MAAM,cAAc,UAAU;EAC9B,mBAAmB;IAEjB,aACQ;KAIP,YAAY,eAAe,aAAa;KAGxC,mBAAmB,OAAO,eAAe,kBAC5C,KAAK,YAAY,SAAS,aAAa,OAAO;EAAa,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;;EAkBxC,WAAW,aAAa,mBAAmB,eAAa,aAC1C,MAAI,SACR,YAAY,gBAAgB,OAAO,QAAM,UACxC,KACT,gBAAgB,kBAAkB,OAAO,OAAO,oEAEhD,eAAA,kBAAA,OAAA,OAAA;EAeF,cACC,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"}
|
package/dist/openapi-hooks.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { createTypedFetcher } from "./fetcher
|
|
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
|
|
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
|
|
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
|
-
|
|
21
|
-
return response;
|
|
19
|
+
return await fetcher(endpoint, config);
|
|
22
20
|
},
|
|
23
|
-
...options
|
|
21
|
+
...options
|
|
24
22
|
});
|
|
25
23
|
},
|
|
26
|
-
useMutation: (operationId, options
|
|
24
|
+
useMutation: (operationId, options) => {
|
|
27
25
|
const endpoint = buildEndpoint(operationId);
|
|
28
26
|
return useMutation({
|
|
29
27
|
mutationFn: async (variables) => {
|
|
30
|
-
|
|
31
|
-
return response;
|
|
28
|
+
return await fetcher(endpoint, variables);
|
|
32
29
|
},
|
|
33
|
-
...options
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-hooks.mjs","names":[
|
|
1
|
+
{"version":3,"file":"openapi-hooks.mjs","names":[],"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,UAAU,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,OAAO,SAAgD;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,OAAO,YAIL;IACD,YAAY,OAAO,cAAc;KAEhC,OAAO,MADgB,QAAQ,UAAiB,SAAgB;IAEjE;IACA,GAAG;GACJ,CAAC;EACF;CACD;AACD"}
|
package/dist/openapi-types.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//#region src/openapi-types.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* A hand-written `paths` fixture in openapi-typescript's shape, for the
|
|
4
|
+
* client's own tests. Applications get theirs from `gkm build`, which writes
|
|
5
|
+
* a typed client per surface to `.gkm/openapi/<surface>.ts`.
|
|
5
6
|
*
|
|
6
7
|
* This is a placeholder file showing the expected structure.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
interface paths {
|
|
9
|
+
export interface paths {
|
|
10
10
|
'/job/{id}': {
|
|
11
11
|
parameters: {
|
|
12
12
|
query?: never;
|
|
@@ -422,7 +422,7 @@ interface paths {
|
|
|
422
422
|
};
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
interface components {
|
|
425
|
+
export interface components {
|
|
426
426
|
schemas: {
|
|
427
427
|
User: {
|
|
428
428
|
id: string;
|
|
@@ -439,5 +439,4 @@ interface components {
|
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
|
-
export { components, paths };
|
|
443
442
|
//# sourceMappingURL=openapi-types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-types.d.cts","names":["paths","Array","Record","components"],"sources":["../src/openapi-types.d.ts"],"sourcesContent":["/**\n * This file should be auto-generated by openapi-typescript.\n * Run: npx openapi-typescript <your-openapi-spec> -o ./openapi-types.d.ts\n *\n * This is a placeholder file showing the expected structure.\n */\n\nexport interface paths {\n\t'/job/{id}': {\n\t\tparameters: {\n\t\t\tquery?: never;\n\t\t\theader?: never;\n\t\t\tpath?: never;\n\t\t\tcookie?: never;\n\t\t};\n\t\tget: {\n\t\t\toperationId: 'getJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody?: never;\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\trole: string;\n\t\t\t\t\t\t\toverview: string;\n\t\t\t\t\t\t\tqualifications: string;\n\t\t\t\t\t\t\thourlyRate: {\n\t\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tdateNeeded: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tshiftHours: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tupdatedAt: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tbusinessId: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tcreatorId: string;\n\t\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\t\tstatus: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tput: {\n\t\t\toperationId: 'updateJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\trole?: string;\n\t\t\t\t\t\toverview?: string;\n\t\t\t\t\t\tqualifications?: string;\n\t\t\t\t\t\thourlyRate?: {\n\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdateNeeded?: {\n\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tshiftHours?: {\n\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\tstatus?: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\trole: string;\n\t\t\t\t\t\t\toverview: string;\n\t\t\t\t\t\t\tqualifications: string;\n\t\t\t\t\t\t\thourlyRate: {\n\t\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tdateNeeded: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tshiftHours: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tupdatedAt: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tbusinessId: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tcreatorId: string;\n\t\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\t\tstatus: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tpost?: never;\n\t\tdelete: {\n\t\t\toperationId: 'deleteJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody?: never;\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\toptions?: never;\n\t\thead?: never;\n\t\tpatch?: never;\n\t\ttrace?: never;\n\t};\n\t'/users': {\n\t\tget: {\n\t\t\toperationId: 'listUsers';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t\tsort?: 'asc' | 'desc';\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tusers: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tpost: {\n\t\t\toperationId: 'createUser';\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\temail: string;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t201: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/users/{id}': {\n\t\tparameters: {\n\t\t\tpath: {\n\t\t\t\tid: string;\n\t\t\t};\n\t\t};\n\t\tget: {\n\t\t\toperationId: 'getUser';\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tput: {\n\t\t\toperationId: 'updateUser';\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\tname?: string;\n\t\t\t\t\t\temail?: string;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tdelete: {\n\t\t\toperationId: 'deleteUser';\n\t\t\tresponses: {\n\t\t\t\t204: {\n\t\t\t\t\tcontent: never;\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/posts': {\n\t\tget: {\n\t\t\toperationId: 'listPosts';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t\tsort?: 'asc' | 'desc';\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tposts: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\ttitle: string;\n\t\t\t\t\t\t\t\tcontent: string;\n\t\t\t\t\t\t\t\tauthorId: string;\n\t\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tsort: 'asc' | 'desc';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/protected': {\n\t\tget: {\n\t\t\toperationId: 'getProtected';\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\t401: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/error': {\n\t\tget: {\n\t\t\toperationId: 'getError';\n\t\t\tresponses: {\n\t\t\t\t500: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/users/paginated': {\n\t\tget: {\n\t\t\toperationId: 'getUsersPaginated';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tusers: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t\thasMore: boolean;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/messages': {\n\t\tget: {\n\t\t\toperationId: 'getMessages';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tcursor?: string;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessages: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\ttext: string;\n\t\t\t\t\t\t\t\ttimestamp: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tnextCursor: string | null;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/echo': {\n\t\tget: {\n\t\t\toperationId: 'echo';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\t[key: string]: string | number | boolean;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tqueryParams: Record<string, string>;\n\t\t\t\t\t\t\tdata: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tvalue: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t\thasMore: boolean;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface components {\n\tschemas: {\n\t\tUser: {\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\temail: string;\n\t\t};\n\t\tPost: {\n\t\t\tid: string;\n\t\t\ttitle: string;\n\t\t\tcontent: string;\n\t\t\tauthorId: string;\n\t\t\tcreatedAt: string;\n\t\t};\n\t};\n}\n"],"mappings":";;AAOA;;;;;;AA8YoBE,UA9YHF,KAAAA,CA8YGE;EAAM,WACbD,EAAAA;IAAK,UAAA,EAAA;MAkBlB,KAAiBE,CAAAA,EAAAA,KAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA9OHF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkGAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BGA;;;;;;;;;;;;;;;;;;;;;;;;2BAwBGC;oBACPD;;;;;;;;;;;;;;;;;UAkBIE,UAAAA"}
|
|
1
|
+
{"version":3,"file":"openapi-types.d.cts","names":[],"sources":["../src/openapi-types.d.ts"],"mappings":";;;;;;;;iBAQiB;EAChB;IACC;MACC;MACA;MACA;MACA;;IAED;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;MACA;;QAEC;UACC;aACE;;UAEF;YACC;cACC;cACA;cACA;cACA;gBACC;gBACA;;cAED;gBACC;gBACA;;cAED;gBACC;gBACA;;;cAGD;;cAEA;;cAEA;;cAEA;;cAEA;;cAEA;;;;;;IAML;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;QACC;UACC;YACC;YACA;YACA;YACA;cACC;cACA;;YAED;cACC;cACA;;YAED;cACC;cACA;;;YAGD;;;;MAIH;;QAEC;UACC;aACE;;UAEF;YACC;cACC;cACA;cACA;cACA;gBACC;gBACA;;cAED;gBACC;gBACA;;cAED;gBACC;gBACA;;;cAGD;;cAEA;;cAEA;;cAEA;;cAEA;;cAEA;;;;;;IAML;IACA;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;MACA;;QAEC;UACC;aACE;;UAEF;YACC;cACC;;cAEA;;;;;;IAML;IACA;IACA;IACA;;EAED;IACC;MACC;MACA;QACC;UACC;UACA;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;;;;;;;IAON;MACC;MACA;QACC;UACC;YACC;YACA;;;;MAIH;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;;EAON;IACC;MACC;QACC;;;IAGF;MACC;MACA;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;IAML;MACC;MACA;QACC;UACC;YACC;YACA;;;;MAIH;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;IAML;MACC;MACA;QACC;UACC;;;;;EAKJ;IACC;MACC;MACA;QACC;UACC;UACA;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;gBACA;gBACA;;cAED;gBACC;gBACA;gBACA;;cAED;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;YACC;cACC;;;;QAIH;UACC;YACC;cACC;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;YACC;cACC;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;;cAED;gBACC;gBACA;gBACA;gBACA;;;;;;;;EAQP;IACC;MACC;MACA;QACC;UACC;UACA;;;MAGF;QACC;UACC;YACC;cACC,UAAU;gBACT;gBACA;gBACA;;cAED;;;;;;;EAON;IACC;MACC;MACA;QACC;WACE;;;MAGH;QACC;UACC;YACC;cACC,aAAa;cACb,MAAM;gBACL;gBACA;;cAED;gBACC;gBACA;gBACA;gBACA;;;;;;;;;iBAUS;EAChB;IACC;MACC;MACA;MACA;;IAED;MACC;MACA;MACA;MACA;MACA"}
|
package/dist/openapi-types.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//#region src/openapi-types.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* A hand-written `paths` fixture in openapi-typescript's shape, for the
|
|
4
|
+
* client's own tests. Applications get theirs from `gkm build`, which writes
|
|
5
|
+
* a typed client per surface to `.gkm/openapi/<surface>.ts`.
|
|
5
6
|
*
|
|
6
7
|
* This is a placeholder file showing the expected structure.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
interface paths {
|
|
9
|
+
export interface paths {
|
|
10
10
|
'/job/{id}': {
|
|
11
11
|
parameters: {
|
|
12
12
|
query?: never;
|
|
@@ -422,7 +422,7 @@ interface paths {
|
|
|
422
422
|
};
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
interface components {
|
|
425
|
+
export interface components {
|
|
426
426
|
schemas: {
|
|
427
427
|
User: {
|
|
428
428
|
id: string;
|
|
@@ -439,5 +439,4 @@ interface components {
|
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
|
-
export { components, paths };
|
|
443
442
|
//# sourceMappingURL=openapi-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-types.d.mts","names":["paths","Array","Record","components"],"sources":["../src/openapi-types.d.ts"],"sourcesContent":["/**\n * This file should be auto-generated by openapi-typescript.\n * Run: npx openapi-typescript <your-openapi-spec> -o ./openapi-types.d.ts\n *\n * This is a placeholder file showing the expected structure.\n */\n\nexport interface paths {\n\t'/job/{id}': {\n\t\tparameters: {\n\t\t\tquery?: never;\n\t\t\theader?: never;\n\t\t\tpath?: never;\n\t\t\tcookie?: never;\n\t\t};\n\t\tget: {\n\t\t\toperationId: 'getJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody?: never;\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\trole: string;\n\t\t\t\t\t\t\toverview: string;\n\t\t\t\t\t\t\tqualifications: string;\n\t\t\t\t\t\t\thourlyRate: {\n\t\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tdateNeeded: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tshiftHours: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tupdatedAt: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tbusinessId: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tcreatorId: string;\n\t\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\t\tstatus: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tput: {\n\t\t\toperationId: 'updateJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\trole?: string;\n\t\t\t\t\t\toverview?: string;\n\t\t\t\t\t\tqualifications?: string;\n\t\t\t\t\t\thourlyRate?: {\n\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdateNeeded?: {\n\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tshiftHours?: {\n\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\tstatus?: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\trole: string;\n\t\t\t\t\t\t\toverview: string;\n\t\t\t\t\t\t\tqualifications: string;\n\t\t\t\t\t\t\thourlyRate: {\n\t\t\t\t\t\t\t\tmax: number;\n\t\t\t\t\t\t\t\tmin: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tdateNeeded: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tshiftHours: {\n\t\t\t\t\t\t\t\tfrom: string;\n\t\t\t\t\t\t\t\tto: string;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t/** Format: date-time */\n\t\t\t\t\t\t\tupdatedAt: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tbusinessId: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tcreatorId: string;\n\t\t\t\t\t\t\t/** @enum {string} */\n\t\t\t\t\t\t\tstatus: 'Draft' | 'Active' | 'Closed' | 'Filled';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tpost?: never;\n\t\tdelete: {\n\t\t\toperationId: 'deleteJob';\n\t\t\tparameters: {\n\t\t\t\tquery?: never;\n\t\t\t\theader?: never;\n\t\t\t\tpath: {\n\t\t\t\t\tid: string;\n\t\t\t\t};\n\t\t\t\tcookie?: never;\n\t\t\t};\n\t\t\trequestBody?: never;\n\t\t\tresponses: {\n\t\t\t\t/** @description Successful response */\n\t\t\t\t200: {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t[name: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t\t/** Format: uuid */\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\toptions?: never;\n\t\thead?: never;\n\t\tpatch?: never;\n\t\ttrace?: never;\n\t};\n\t'/users': {\n\t\tget: {\n\t\t\toperationId: 'listUsers';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t\tsort?: 'asc' | 'desc';\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tusers: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tpost: {\n\t\t\toperationId: 'createUser';\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\tname: string;\n\t\t\t\t\t\temail: string;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t201: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/users/{id}': {\n\t\tparameters: {\n\t\t\tpath: {\n\t\t\t\tid: string;\n\t\t\t};\n\t\t};\n\t\tget: {\n\t\t\toperationId: 'getUser';\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tput: {\n\t\t\toperationId: 'updateUser';\n\t\t\trequestBody: {\n\t\t\t\tcontent: {\n\t\t\t\t\t'application/json': {\n\t\t\t\t\t\tname?: string;\n\t\t\t\t\t\temail?: string;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\tdelete: {\n\t\t\toperationId: 'deleteUser';\n\t\t\tresponses: {\n\t\t\t\t204: {\n\t\t\t\t\tcontent: never;\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/posts': {\n\t\tget: {\n\t\t\toperationId: 'listPosts';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t\tsort?: 'asc' | 'desc';\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tposts: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\ttitle: string;\n\t\t\t\t\t\t\t\tcontent: string;\n\t\t\t\t\t\t\t\tauthorId: string;\n\t\t\t\t\t\t\t\tcreatedAt: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tsort: 'asc' | 'desc';\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/protected': {\n\t\tget: {\n\t\t\toperationId: 'getProtected';\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\t401: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/error': {\n\t\tget: {\n\t\t\toperationId: 'getError';\n\t\t\tresponses: {\n\t\t\t\t500: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessage: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/users/paginated': {\n\t\tget: {\n\t\t\toperationId: 'getUsersPaginated';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tpage?: number;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tusers: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\temail: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t\thasMore: boolean;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/messages': {\n\t\tget: {\n\t\t\toperationId: 'getMessages';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\tcursor?: string;\n\t\t\t\t\tlimit?: number;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tmessages: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\ttext: string;\n\t\t\t\t\t\t\t\ttimestamp: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tnextCursor: string | null;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\t'/echo': {\n\t\tget: {\n\t\t\toperationId: 'echo';\n\t\t\tparameters: {\n\t\t\t\tquery: {\n\t\t\t\t\t[key: string]: string | number | boolean;\n\t\t\t\t};\n\t\t\t};\n\t\t\tresponses: {\n\t\t\t\t200: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\tqueryParams: Record<string, string>;\n\t\t\t\t\t\t\tdata: Array<{\n\t\t\t\t\t\t\t\tid: string;\n\t\t\t\t\t\t\t\tvalue: string;\n\t\t\t\t\t\t\t}>;\n\t\t\t\t\t\t\tpagination: {\n\t\t\t\t\t\t\t\tpage: number;\n\t\t\t\t\t\t\t\tlimit: number;\n\t\t\t\t\t\t\t\ttotal: number;\n\t\t\t\t\t\t\t\thasMore: boolean;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface components {\n\tschemas: {\n\t\tUser: {\n\t\t\tid: string;\n\t\t\tname: string;\n\t\t\temail: string;\n\t\t};\n\t\tPost: {\n\t\t\tid: string;\n\t\t\ttitle: string;\n\t\t\tcontent: string;\n\t\t\tauthorId: string;\n\t\t\tcreatedAt: string;\n\t\t};\n\t};\n}\n"],"mappings":";;AAOA;;;;;;AA8YoBE,UA9YHF,KAAAA,CA8YGE;EAAM,WACbD,EAAAA;IAAK,UAAA,EAAA;MAkBlB,KAAiBE,CAAAA,EAAAA,KAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA9OHF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkGAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BGA;;;;;;;;;;;;;;;;;;;;;;;;2BAwBGC;oBACPD;;;;;;;;;;;;;;;;;UAkBIE,UAAAA"}
|
|
1
|
+
{"version":3,"file":"openapi-types.d.mts","names":[],"sources":["../src/openapi-types.d.ts"],"mappings":";;;;;;;;iBAQiB;EAChB;IACC;MACC;MACA;MACA;MACA;;IAED;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;MACA;;QAEC;UACC;aACE;;UAEF;YACC;cACC;cACA;cACA;cACA;gBACC;gBACA;;cAED;gBACC;gBACA;;cAED;gBACC;gBACA;;;cAGD;;cAEA;;cAEA;;cAEA;;cAEA;;cAEA;;;;;;IAML;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;QACC;UACC;YACC;YACA;YACA;YACA;cACC;cACA;;YAED;cACC;cACA;;YAED;cACC;cACA;;;YAGD;;;;MAIH;;QAEC;UACC;aACE;;UAEF;YACC;cACC;cACA;cACA;cACA;gBACC;gBACA;;cAED;gBACC;gBACA;;cAED;gBACC;gBACA;;;cAGD;;cAEA;;cAEA;;cAEA;;cAEA;;cAEA;;;;;;IAML;IACA;MACC;MACA;QACC;QACA;QACA;UACC;;QAED;;MAED;MACA;;QAEC;UACC;aACE;;UAEF;YACC;cACC;;cAEA;;;;;;IAML;IACA;IACA;IACA;;EAED;IACC;MACC;MACA;QACC;UACC;UACA;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;;;;;;;IAON;MACC;MACA;QACC;UACC;YACC;YACA;;;;MAIH;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;;EAON;IACC;MACC;QACC;;;IAGF;MACC;MACA;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;IAML;MACC;MACA;QACC;UACC;YACC;YACA;;;;MAIH;QACC;UACC;YACC;cACC;cACA;cACA;;;;;;IAML;MACC;MACA;QACC;UACC;;;;;EAKJ;IACC;MACC;MACA;QACC;UACC;UACA;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;gBACA;gBACA;;cAED;gBACC;gBACA;gBACA;;cAED;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;YACC;cACC;;;;QAIH;UACC;YACC;cACC;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;YACC;cACC;;;;;;;EAON;IACC;MACC;MACA;QACC;UACC;UACA;;;MAGF;QACC;UACC;YACC;cACC,OAAO;gBACN;gBACA;gBACA;;cAED;gBACC;gBACA;gBACA;gBACA;;;;;;;;EAQP;IACC;MACC;MACA;QACC;UACC;UACA;;;MAGF;QACC;UACC;YACC;cACC,UAAU;gBACT;gBACA;gBACA;;cAED;;;;;;;EAON;IACC;MACC;MACA;QACC;WACE;;;MAGH;QACC;UACC;YACC;cACC,aAAa;cACb,MAAM;gBACL;gBACA;;cAED;gBACC;gBACA;gBACA;gBACA;;;;;;;;;iBAUS;EAChB;IACC;MACC;MACA;MACA;;IAED;MACC;MACA;MACA;MACA;MACA"}
|
package/dist/react-query.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
const require_fetcher = require(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_fetcher = require("./fetcher.cjs");
|
|
3
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
|
+
let react = require("react");
|
|
6
5
|
//#region src/react-query.ts
|
|
7
6
|
var TypedQueryClient = class {
|
|
8
7
|
fetcher;
|
|
@@ -23,14 +22,14 @@ var TypedQueryClient = class {
|
|
|
23
22
|
JSON.stringify(config),
|
|
24
23
|
JSON.stringify(options)
|
|
25
24
|
]);
|
|
26
|
-
return (0,
|
|
25
|
+
return (0, _tanstack_react_query.useQuery)(memoizedOptions);
|
|
27
26
|
}
|
|
28
27
|
useMutation(endpoint, options) {
|
|
29
28
|
const memoizedOptions = (0, react.useMemo)(() => ({
|
|
30
29
|
mutationFn: (config) => this.fetcher(endpoint, config),
|
|
31
30
|
...options
|
|
32
31
|
}), [endpoint, JSON.stringify(options)]);
|
|
33
|
-
return (0,
|
|
32
|
+
return (0, _tanstack_react_query.useMutation)(memoizedOptions);
|
|
34
33
|
}
|
|
35
34
|
useInfiniteQuery(endpoint, options, config) {
|
|
36
35
|
const queryKey = this.buildQueryKey(endpoint, config);
|
|
@@ -47,10 +46,7 @@ var TypedQueryClient = class {
|
|
|
47
46
|
...pageQuery
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
|
-
} else if (pageParam !== void 0 && !config) {
|
|
51
|
-
const pageQuery = typeof pageParam === "object" ? pageParam : { page: pageParam };
|
|
52
|
-
mergedConfig = { query: pageQuery };
|
|
53
|
-
}
|
|
49
|
+
} else if (pageParam !== void 0 && !config) mergedConfig = { query: typeof pageParam === "object" ? pageParam : { page: pageParam } };
|
|
54
50
|
return this.fetcher(endpoint, mergedConfig);
|
|
55
51
|
},
|
|
56
52
|
...options
|
|
@@ -60,7 +56,7 @@ var TypedQueryClient = class {
|
|
|
60
56
|
JSON.stringify(config),
|
|
61
57
|
JSON.stringify(options)
|
|
62
58
|
]);
|
|
63
|
-
return (0,
|
|
59
|
+
return (0, _tanstack_react_query.useInfiniteQuery)(memoizedOptions);
|
|
64
60
|
}
|
|
65
61
|
buildQueryKey(endpoint, config) {
|
|
66
62
|
const key = [endpoint];
|
|
@@ -87,8 +83,7 @@ var TypedQueryClient = class {
|
|
|
87
83
|
* @returns Promise that resolves when invalidation is complete
|
|
88
84
|
*/
|
|
89
85
|
invalidateAllQueries() {
|
|
90
|
-
|
|
91
|
-
return queryClient.invalidateQueries();
|
|
86
|
+
return this.getQueryClient().invalidateQueries();
|
|
92
87
|
}
|
|
93
88
|
/**
|
|
94
89
|
* Get the underlying QueryClient instance
|
|
@@ -122,8 +117,11 @@ function useTypedInfiniteQuery(client, endpoint, options, config) {
|
|
|
122
117
|
* Hook to invalidate queries using the current QueryClient from context
|
|
123
118
|
*/
|
|
124
119
|
function useTypedInvalidateQueries(client) {
|
|
125
|
-
const queryClient = (0,
|
|
120
|
+
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
126
121
|
return {
|
|
122
|
+
/**
|
|
123
|
+
* Invalidate queries for a specific endpoint
|
|
124
|
+
*/
|
|
127
125
|
invalidateQueries: (endpoint, config) => {
|
|
128
126
|
const queryKey = client.buildQueryKey(endpoint, config);
|
|
129
127
|
return queryClient.invalidateQueries({
|
|
@@ -131,12 +129,14 @@ function useTypedInvalidateQueries(client) {
|
|
|
131
129
|
exact: !!config
|
|
132
130
|
});
|
|
133
131
|
},
|
|
132
|
+
/**
|
|
133
|
+
* Invalidate all queries
|
|
134
|
+
*/
|
|
134
135
|
invalidateAllQueries: () => {
|
|
135
136
|
return queryClient.invalidateQueries();
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
|
-
|
|
140
140
|
//#endregion
|
|
141
141
|
exports.TypedQueryClient = TypedQueryClient;
|
|
142
142
|
exports.createTypedQueryClient = createTypedQueryClient;
|
|
@@ -144,4 +144,5 @@ exports.useTypedInfiniteQuery = useTypedInfiniteQuery;
|
|
|
144
144
|
exports.useTypedInvalidateQueries = useTypedInvalidateQueries;
|
|
145
145
|
exports.useTypedMutation = useTypedMutation;
|
|
146
146
|
exports.useTypedQuery = useTypedQuery;
|
|
147
|
+
|
|
147
148
|
//# sourceMappingURL=react-query.cjs.map
|