@openapi-qraft/react 2.0.0-next.17 → 2.0.0-next.19
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @openapi-qraft/react
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @openapi-qraft/tanstack-query-react-types@2.0.0-next.19
|
|
8
|
+
|
|
9
|
+
## 2.0.0-next.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 665a77d: Add `ensureQueryData` methods to `QueryOperationCallbacks`.
|
|
14
|
+
- @openapi-qraft/tanstack-query-react-types@2.0.0-next.18
|
|
15
|
+
|
|
3
16
|
## 2.0.0-next.17
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qraftAPIClient.cjs","sources":["../../src/qraftAPIClient.ts"],"sourcesContent":["import type {\n ServiceOperationMutation,\n ServiceOperationMutationFn,\n ServiceOperationQuery,\n ServiceOperationQueryFn,\n} from '@openapi-qraft/tanstack-query-react-types';\nimport type { QueryClient } from '@tanstack/query-core';\nimport type * as callbacks from './callbacks/index.js';\nimport type * as operationInvokeModule from './callbacks/operationInvokeFn.js';\nimport type {\n OperationSchema,\n RequestFnInfo,\n RequestFnResponse,\n} from './lib/requestFn.js';\nimport { createRecursiveProxy } from './lib/createRecursiveProxy.js';\n\nexport interface CreateAPIBasicClientOptions {\n requestFn<TData, TError>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo\n ): Promise<RequestFnResponse<TData, TError>>;\n baseUrl: string;\n}\n\nexport interface CreateAPIBasicQueryClientOptions {\n queryClient: QueryClient;\n}\n\nexport interface CreateAPIQueryClientOptions\n extends CreateAPIBasicClientOptions,\n CreateAPIBasicQueryClientOptions {}\n\n/**\n * @deprecated use `CreateAPIClientOptions` instead\n */\nexport type QraftClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIQueryClientOptions;\n\nexport type CreateAPIClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIBasicQueryClientOptions\n | CreateAPIQueryClientOptions;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicClientOptions\n): APIBasicClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Required<Callbacks>,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): Services;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicQueryClientOptions\n): APIBasicQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): APIQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks\n): APIUtilityClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options?: CreateAPIClientOptions\n): APIQueryClientServices<Services, TCallbacks> | Services {\n return createRecursiveProxy(\n function getCallback(getPath, key) {\n if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?\n\n const serviceOperation = getByPath(services, getPath);\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${getPath.join('.')}`);\n return serviceOperation.schema;\n },\n function applyCallback(applyPath, args) {\n const { path, callbackName } = extractCallbackDetails(applyPath);\n\n assertValidCallbackName(callbackName, callbacks);\n\n const serviceOperation = getByPath(services, path);\n\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${path.join('.')}`);\n\n if (\n callbackName !== 'operationInvokeFn' &&\n callbackName !== 'getQueryKey' &&\n callbackName !== 'getMutationKey' &&\n callbackName !== 'getInfiniteQueryKey'\n )\n if (!options || !('queryClient' in options && options.queryClient))\n throw new Error(\n `'qraft.<service>.<operation>.${String(callbackName)}()' requires 'queryClient' in 'createAPIClient(...)' options.`\n );\n\n // @ts-expect-error - Too complex union type\n return callbacks[callbackName](options, serviceOperation.schema, args);\n },\n []\n ) as never;\n}\n\nfunction assertValidCallbackName<\n TCallbacks extends Record<string, (...rest: any[]) => unknown>,\n>(\n callbackName: string | number | symbol,\n callbacks: TCallbacks\n): asserts callbackName is keyof TCallbacks {\n if (!(callbackName in callbacks)) {\n if ((callbackName as OperationInvokeFnName) === 'operationInvokeFn')\n throw new Error(\n `Callback 'operationInvokeFn' is required for executing 'qraft.<service>.<operation>()', but it is not provided in the 'callbacks' object.`\n );\n throw new Error(\n `Callback for 'qraft.<service>.<operation>.${String(callbackName)}()' is not provided in the 'callbacks' object.`\n );\n }\n}\n\n/**\n * Extracts Callback details from the applyPath\n * @param applyPath\n */\nfunction extractCallbackDetails(applyPath: string[]) {\n // <service>.<operation>()\n if (applyPath.length === 2) {\n return {\n path: applyPath,\n callbackName: 'operationInvokeFn' satisfies OperationInvokeFnName,\n };\n } else {\n // <service>.<operation>.<method>()\n return {\n path: applyPath.slice(0, -1),\n // The last arg is for instance `.useMutation` or `.useQuery()`\n callbackName: applyPath[applyPath.length - 1],\n };\n }\n}\n\nfunction isServiceOperation(\n input: unknown\n): input is { schema: OperationSchema } {\n return input !== null && typeof input === 'object' && 'schema' in input;\n}\n\nfunction getByPath(obj: Record<string, unknown>, path: string[]) {\n return path.reduce<unknown>((acc, key) => {\n if (acc && typeof acc === 'object' && key in acc)\n return acc[key as keyof typeof acc];\n }, obj);\n}\n\ntype Callbacks = Partial<typeof callbacks>;\n\ntype ServicesDeclaration<Services> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: OperationSchema;\n types: {\n parameters?: any;\n data?: any;\n error?: any;\n body?: any;\n };\n };\n };\n};\n\ntype ServiceSchemasDeclaration<Services extends ServicesDeclaration<Services>> =\n {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: Services[service][method]['schema'];\n };\n };\n };\n\ntype QueryOperationCallbacks = Extract<\n keyof Callbacks,\n | 'cancelQueries'\n | 'fetchInfiniteQuery'\n | 'fetchQuery'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'getInfiniteQueryState'\n | 'getQueriesData'\n | 'getQueryData'\n | 'getQueryKey'\n | 'getQueryState'\n | 'invalidateQueries'\n | 'isFetching'\n | 'prefetchInfiniteQuery'\n | 'prefetchQuery'\n | 'refetchQueries'\n | 'removeQueries'\n | 'resetQueries'\n | 'setInfiniteQueryData'\n | 'setQueriesData'\n | 'setQueryData'\n | 'useInfiniteQuery'\n | 'useIsFetching'\n | 'useQueries'\n | 'useQuery'\n | 'useSuspenseInfiniteQuery'\n | 'useSuspenseQueries'\n | 'useSuspenseQuery'\n>;\n\ntype MutationOperationCallbacks = Extract<\n keyof Callbacks,\n | 'getMutationKey'\n | 'isMutating'\n | 'useIsMutating'\n | 'useMutation'\n | 'useMutationState'\n>;\n\nexport type APIQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n QueryOperationCallbacks,\n MutationOperationCallbacks\n>;\n\nexport type APIBasicQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<\n QueryOperationCallbacks,\n | 'resetQueries'\n | 'removeQueries'\n | 'cancelQueries'\n | 'invalidateQueries'\n | 'refetchQueries'\n | 'getQueryKey'\n | 'getInfiniteQueryState'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'setInfiniteQueryData'\n | 'getQueriesData'\n | 'setQueriesData'\n | 'getQueryState'\n | 'getQueryData'\n | 'setQueryData'\n | 'useIsFetching'\n | 'isFetching'\n >,\n Extract<\n MutationOperationCallbacks,\n 'getMutationKey' | 'useMutationState' | 'useIsMutating' | 'isMutating'\n >\n>;\n\nexport type APIUtilityClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\nexport type APIBasicClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\ntype ServicesFilteredByCallbacks<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n TQueryOperationCallbacks extends QueryOperationCallbacks,\n TMutationOperationCallbacks extends MutationOperationCallbacks,\n> = {\n [serviceName in keyof TServices]: {\n [method in keyof TServices[serviceName]]: TServices[serviceName][method]['schema']['method'] extends\n | 'get'\n | 'head'\n | 'options'\n ? Pick<\n ServiceOperationQuery<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TQueryOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationQueryFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {})\n : Pick<\n ServiceOperationMutation<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TMutationOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationMutationFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {});\n };\n};\n\ntype OperationInvokeFnName = Extract<\n keyof typeof operationInvokeModule,\n 'operationInvokeFn'\n>;\n"],"names":["qraftAPIClient","services","callbacks","options","createRecursiveProxy","getCallback","getPath","key","length","serviceOperation","getByPath","isServiceOperation","Error","join","schema","applyCallback","applyPath","args","path","callbackName","extractCallbackDetails","assertValidCallbackName","queryClient","String","slice","input","obj","reduce","acc"],"mappings":";;;;AAwFO,SAASA,cAIdC,CAAAA,QAA6C,EAC7CC,SAAqB,EACrBC,OAAgC,EAAA;AAEhC,IAAA,OAAOC,yCACL,CAAA,SAASC,WAAYC,CAAAA,OAAO,EAAEC,GAAG,EAAA;AAC/B,QAAA,IAAID,QAAQE,MAAM,KAAK,KAAKD,GAAQ,KAAA,QAAA,EAAU;QAE9C,MAAME,gBAAAA,GAAmBC,UAAUT,QAAUK,EAAAA,OAAAA,CAAAA,CAAAA;AAC7C,QAAA,IAAI,CAACK,kBAAAA,CAAmBF,gBACtB,CAAA,EAAA,MAAM,IAAIG,KAAAA,CAAM,CAAC,6BAA6B,EAAEN,OAAAA,CAAQO,IAAI,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AAA,CAAA;QAE/I,MAAM,IAAIA,MACR,CAAC,0CAA0C,EAAEW,MAAOJ,CAAAA,YAAAA,CAAAA,CAAc,8CAA8C,CAAC,CAAA,CAAA;AAErH,KAAA;AACF,CAAA;AAEA;;;IAIA,SAASC,uBAAuBJ,SAAmB,EAAA;;IAEjD,IAAIA,SAAAA,CAAUR,MAAM,KAAK,CAAG,EAAA;QAC1B,OAAO;YACLU,IAAMF,EAAAA,SAAAA;YACNG,YAAc,EAAA,mBAAA;AAChB,SAAA,CAAA;KACK,MAAA;;QAEL,OAAO;AACLD,YAAAA,IAAAA,EAAMF,SAAUQ,CAAAA,KAAK,CAAC,CAAA,EAAG,CAAC,CAAA,CAAA;;AAE1BL,YAAAA,YAAAA,EAAcH,SAAS,CAACA,SAAUR,CAAAA,MAAM,GAAG,CAAE,CAAA;AAC/C,SAAA,CAAA;AACF,KAAA;AACF,CAAA;AAEA,SAASG,mBACPc,KAAc,EAAA;AAEd,IAAA,OAAOA,KAAU,KAAA,IAAA,IAAQ,OAAOA,KAAAA,KAAU,YAAY,QAAYA,IAAAA,KAAAA,CAAAA;AACpE,CAAA;AAEA,SAASf,SAAAA,CAAUgB,GAA4B,EAAER,IAAc,EAAA;AAC7D,IAAA,OAAOA,IAAKS,CAAAA,MAAM,CAAU,CAACC,GAAKrB,EAAAA,GAAAA,GAAAA;QAChC,IAAIqB,GAAAA,IAAO,OAAOA,GAAQ,KAAA,QAAA,IAAYrB,OAAOqB,GAC3C,EAAA,OAAOA,GAAG,CAACrB,GAAwB,CAAA,CAAA;KACpCmB,EAAAA,GAAAA,CAAAA,CAAAA;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"qraftAPIClient.cjs","sources":["../../src/qraftAPIClient.ts"],"sourcesContent":["import type {\n ServiceOperationMutation,\n ServiceOperationMutationFn,\n ServiceOperationQuery,\n ServiceOperationQueryFn,\n} from '@openapi-qraft/tanstack-query-react-types';\nimport type { QueryClient } from '@tanstack/query-core';\nimport type * as callbacks from './callbacks/index.js';\nimport type * as operationInvokeModule from './callbacks/operationInvokeFn.js';\nimport type {\n OperationSchema,\n RequestFnInfo,\n RequestFnResponse,\n} from './lib/requestFn.js';\nimport { createRecursiveProxy } from './lib/createRecursiveProxy.js';\n\nexport interface CreateAPIBasicClientOptions {\n requestFn<TData, TError>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo\n ): Promise<RequestFnResponse<TData, TError>>;\n baseUrl: string;\n}\n\nexport interface CreateAPIBasicQueryClientOptions {\n queryClient: QueryClient;\n}\n\nexport interface CreateAPIQueryClientOptions\n extends CreateAPIBasicClientOptions,\n CreateAPIBasicQueryClientOptions {}\n\n/**\n * @deprecated use `CreateAPIClientOptions` instead\n */\nexport type QraftClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIQueryClientOptions;\n\nexport type CreateAPIClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIBasicQueryClientOptions\n | CreateAPIQueryClientOptions;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicClientOptions\n): APIBasicClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Required<Callbacks>,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): Services;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicQueryClientOptions\n): APIBasicQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): APIQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks\n): APIUtilityClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options?: CreateAPIClientOptions\n): APIQueryClientServices<Services, TCallbacks> | Services {\n return createRecursiveProxy(\n function getCallback(getPath, key) {\n if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?\n\n const serviceOperation = getByPath(services, getPath);\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${getPath.join('.')}`);\n return serviceOperation.schema;\n },\n function applyCallback(applyPath, args) {\n const { path, callbackName } = extractCallbackDetails(applyPath);\n\n assertValidCallbackName(callbackName, callbacks);\n\n const serviceOperation = getByPath(services, path);\n\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${path.join('.')}`);\n\n if (\n callbackName !== 'operationInvokeFn' &&\n callbackName !== 'getQueryKey' &&\n callbackName !== 'getMutationKey' &&\n callbackName !== 'getInfiniteQueryKey'\n )\n if (!options || !('queryClient' in options && options.queryClient))\n throw new Error(\n `'qraft.<service>.<operation>.${String(callbackName)}()' requires 'queryClient' in 'createAPIClient(...)' options.`\n );\n\n // @ts-expect-error - Too complex union type\n return callbacks[callbackName](options, serviceOperation.schema, args);\n },\n []\n ) as never;\n}\n\nfunction assertValidCallbackName<\n TCallbacks extends Record<string, (...rest: any[]) => unknown>,\n>(\n callbackName: string | number | symbol,\n callbacks: TCallbacks\n): asserts callbackName is keyof TCallbacks {\n if (!(callbackName in callbacks)) {\n if ((callbackName as OperationInvokeFnName) === 'operationInvokeFn')\n throw new Error(\n `Callback 'operationInvokeFn' is required for executing 'qraft.<service>.<operation>()', but it is not provided in the 'callbacks' object.`\n );\n throw new Error(\n `Callback for 'qraft.<service>.<operation>.${String(callbackName)}()' is not provided in the 'callbacks' object.`\n );\n }\n}\n\n/**\n * Extracts Callback details from the applyPath\n * @param applyPath\n */\nfunction extractCallbackDetails(applyPath: string[]) {\n // <service>.<operation>()\n if (applyPath.length === 2) {\n return {\n path: applyPath,\n callbackName: 'operationInvokeFn' satisfies OperationInvokeFnName,\n };\n } else {\n // <service>.<operation>.<method>()\n return {\n path: applyPath.slice(0, -1),\n // The last arg is for instance `.useMutation` or `.useQuery()`\n callbackName: applyPath[applyPath.length - 1],\n };\n }\n}\n\nfunction isServiceOperation(\n input: unknown\n): input is { schema: OperationSchema } {\n return input !== null && typeof input === 'object' && 'schema' in input;\n}\n\nfunction getByPath(obj: Record<string, unknown>, path: string[]) {\n return path.reduce<unknown>((acc, key) => {\n if (acc && typeof acc === 'object' && key in acc)\n return acc[key as keyof typeof acc];\n }, obj);\n}\n\ntype Callbacks = Partial<typeof callbacks>;\n\ntype ServicesDeclaration<Services> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: OperationSchema;\n types: {\n parameters?: any;\n data?: any;\n error?: any;\n body?: any;\n };\n };\n };\n};\n\ntype ServiceSchemasDeclaration<Services extends ServicesDeclaration<Services>> =\n {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: Services[service][method]['schema'];\n };\n };\n };\n\ntype QueryOperationCallbacks = Extract<\n keyof Callbacks,\n | 'cancelQueries'\n | 'fetchInfiniteQuery'\n | 'fetchQuery'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'getInfiniteQueryState'\n | 'getQueriesData'\n | 'getQueryData'\n | 'getQueryKey'\n | 'getQueryState'\n | 'invalidateQueries'\n | 'isFetching'\n | 'prefetchInfiniteQuery'\n | 'prefetchQuery'\n | 'refetchQueries'\n | 'ensureQueryData'\n | 'ensureInfiniteQueryData'\n | 'removeQueries'\n | 'resetQueries'\n | 'setInfiniteQueryData'\n | 'setQueriesData'\n | 'setQueryData'\n | 'useInfiniteQuery'\n | 'useIsFetching'\n | 'useQueries'\n | 'useQuery'\n | 'useSuspenseInfiniteQuery'\n | 'useSuspenseQueries'\n | 'useSuspenseQuery'\n>;\n\ntype MutationOperationCallbacks = Extract<\n keyof Callbacks,\n | 'getMutationKey'\n | 'isMutating'\n | 'useIsMutating'\n | 'useMutation'\n | 'useMutationState'\n>;\n\nexport type APIQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n QueryOperationCallbacks,\n MutationOperationCallbacks\n>;\n\nexport type APIBasicQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<\n QueryOperationCallbacks,\n | 'resetQueries'\n | 'removeQueries'\n | 'cancelQueries'\n | 'invalidateQueries'\n | 'refetchQueries'\n | 'getQueryKey'\n | 'getInfiniteQueryState'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'setInfiniteQueryData'\n | 'getQueriesData'\n | 'setQueriesData'\n | 'getQueryState'\n | 'getQueryData'\n | 'setQueryData'\n | 'useIsFetching'\n | 'isFetching'\n >,\n Extract<\n MutationOperationCallbacks,\n 'getMutationKey' | 'useMutationState' | 'useIsMutating' | 'isMutating'\n >\n>;\n\nexport type APIUtilityClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\nexport type APIBasicClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\ntype ServicesFilteredByCallbacks<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n TQueryOperationCallbacks extends QueryOperationCallbacks,\n TMutationOperationCallbacks extends MutationOperationCallbacks,\n> = {\n [serviceName in keyof TServices]: {\n [method in keyof TServices[serviceName]]: TServices[serviceName][method]['schema']['method'] extends\n | 'get'\n | 'head'\n | 'options'\n ? Pick<\n ServiceOperationQuery<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TQueryOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationQueryFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {})\n : Pick<\n ServiceOperationMutation<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TMutationOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationMutationFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {});\n };\n};\n\ntype OperationInvokeFnName = Extract<\n keyof typeof operationInvokeModule,\n 'operationInvokeFn'\n>;\n"],"names":["qraftAPIClient","services","callbacks","options","createRecursiveProxy","getCallback","getPath","key","length","serviceOperation","getByPath","isServiceOperation","Error","join","schema","applyCallback","applyPath","args","path","callbackName","extractCallbackDetails","assertValidCallbackName","queryClient","String","slice","input","obj","reduce","acc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CAAU,CAACC,GAAKrB,EAAAA,GAAAA,GAAAA;QAChC,IAAIqB,GAAAA,IAAO,OAAOA,GAAQ,KAAA,QAAA,IAAYrB,OAAOqB,GAC3C,EAAA,OAAOA,GAAG,CAACrB,GAAwB,CAAA,CAAA;KACpCmB,EAAAA,GAAAA,CAAAA,CAAAA;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qraftAPIClient.js","sources":["../../src/qraftAPIClient.ts"],"sourcesContent":["import type {\n ServiceOperationMutation,\n ServiceOperationMutationFn,\n ServiceOperationQuery,\n ServiceOperationQueryFn,\n} from '@openapi-qraft/tanstack-query-react-types';\nimport type { QueryClient } from '@tanstack/query-core';\nimport type * as callbacks from './callbacks/index.js';\nimport type * as operationInvokeModule from './callbacks/operationInvokeFn.js';\nimport type {\n OperationSchema,\n RequestFnInfo,\n RequestFnResponse,\n} from './lib/requestFn.js';\nimport { createRecursiveProxy } from './lib/createRecursiveProxy.js';\n\nexport interface CreateAPIBasicClientOptions {\n requestFn<TData, TError>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo\n ): Promise<RequestFnResponse<TData, TError>>;\n baseUrl: string;\n}\n\nexport interface CreateAPIBasicQueryClientOptions {\n queryClient: QueryClient;\n}\n\nexport interface CreateAPIQueryClientOptions\n extends CreateAPIBasicClientOptions,\n CreateAPIBasicQueryClientOptions {}\n\n/**\n * @deprecated use `CreateAPIClientOptions` instead\n */\nexport type QraftClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIQueryClientOptions;\n\nexport type CreateAPIClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIBasicQueryClientOptions\n | CreateAPIQueryClientOptions;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicClientOptions\n): APIBasicClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Required<Callbacks>,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): Services;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicQueryClientOptions\n): APIBasicQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): APIQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks\n): APIUtilityClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options?: CreateAPIClientOptions\n): APIQueryClientServices<Services, TCallbacks> | Services {\n return createRecursiveProxy(\n function getCallback(getPath, key) {\n if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?\n\n const serviceOperation = getByPath(services, getPath);\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${getPath.join('.')}`);\n return serviceOperation.schema;\n },\n function applyCallback(applyPath, args) {\n const { path, callbackName } = extractCallbackDetails(applyPath);\n\n assertValidCallbackName(callbackName, callbacks);\n\n const serviceOperation = getByPath(services, path);\n\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${path.join('.')}`);\n\n if (\n callbackName !== 'operationInvokeFn' &&\n callbackName !== 'getQueryKey' &&\n callbackName !== 'getMutationKey' &&\n callbackName !== 'getInfiniteQueryKey'\n )\n if (!options || !('queryClient' in options && options.queryClient))\n throw new Error(\n `'qraft.<service>.<operation>.${String(callbackName)}()' requires 'queryClient' in 'createAPIClient(...)' options.`\n );\n\n // @ts-expect-error - Too complex union type\n return callbacks[callbackName](options, serviceOperation.schema, args);\n },\n []\n ) as never;\n}\n\nfunction assertValidCallbackName<\n TCallbacks extends Record<string, (...rest: any[]) => unknown>,\n>(\n callbackName: string | number | symbol,\n callbacks: TCallbacks\n): asserts callbackName is keyof TCallbacks {\n if (!(callbackName in callbacks)) {\n if ((callbackName as OperationInvokeFnName) === 'operationInvokeFn')\n throw new Error(\n `Callback 'operationInvokeFn' is required for executing 'qraft.<service>.<operation>()', but it is not provided in the 'callbacks' object.`\n );\n throw new Error(\n `Callback for 'qraft.<service>.<operation>.${String(callbackName)}()' is not provided in the 'callbacks' object.`\n );\n }\n}\n\n/**\n * Extracts Callback details from the applyPath\n * @param applyPath\n */\nfunction extractCallbackDetails(applyPath: string[]) {\n // <service>.<operation>()\n if (applyPath.length === 2) {\n return {\n path: applyPath,\n callbackName: 'operationInvokeFn' satisfies OperationInvokeFnName,\n };\n } else {\n // <service>.<operation>.<method>()\n return {\n path: applyPath.slice(0, -1),\n // The last arg is for instance `.useMutation` or `.useQuery()`\n callbackName: applyPath[applyPath.length - 1],\n };\n }\n}\n\nfunction isServiceOperation(\n input: unknown\n): input is { schema: OperationSchema } {\n return input !== null && typeof input === 'object' && 'schema' in input;\n}\n\nfunction getByPath(obj: Record<string, unknown>, path: string[]) {\n return path.reduce<unknown>((acc, key) => {\n if (acc && typeof acc === 'object' && key in acc)\n return acc[key as keyof typeof acc];\n }, obj);\n}\n\ntype Callbacks = Partial<typeof callbacks>;\n\ntype ServicesDeclaration<Services> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: OperationSchema;\n types: {\n parameters?: any;\n data?: any;\n error?: any;\n body?: any;\n };\n };\n };\n};\n\ntype ServiceSchemasDeclaration<Services extends ServicesDeclaration<Services>> =\n {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: Services[service][method]['schema'];\n };\n };\n };\n\ntype QueryOperationCallbacks = Extract<\n keyof Callbacks,\n | 'cancelQueries'\n | 'fetchInfiniteQuery'\n | 'fetchQuery'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'getInfiniteQueryState'\n | 'getQueriesData'\n | 'getQueryData'\n | 'getQueryKey'\n | 'getQueryState'\n | 'invalidateQueries'\n | 'isFetching'\n | 'prefetchInfiniteQuery'\n | 'prefetchQuery'\n | 'refetchQueries'\n | 'removeQueries'\n | 'resetQueries'\n | 'setInfiniteQueryData'\n | 'setQueriesData'\n | 'setQueryData'\n | 'useInfiniteQuery'\n | 'useIsFetching'\n | 'useQueries'\n | 'useQuery'\n | 'useSuspenseInfiniteQuery'\n | 'useSuspenseQueries'\n | 'useSuspenseQuery'\n>;\n\ntype MutationOperationCallbacks = Extract<\n keyof Callbacks,\n | 'getMutationKey'\n | 'isMutating'\n | 'useIsMutating'\n | 'useMutation'\n | 'useMutationState'\n>;\n\nexport type APIQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n QueryOperationCallbacks,\n MutationOperationCallbacks\n>;\n\nexport type APIBasicQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<\n QueryOperationCallbacks,\n | 'resetQueries'\n | 'removeQueries'\n | 'cancelQueries'\n | 'invalidateQueries'\n | 'refetchQueries'\n | 'getQueryKey'\n | 'getInfiniteQueryState'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'setInfiniteQueryData'\n | 'getQueriesData'\n | 'setQueriesData'\n | 'getQueryState'\n | 'getQueryData'\n | 'setQueryData'\n | 'useIsFetching'\n | 'isFetching'\n >,\n Extract<\n MutationOperationCallbacks,\n 'getMutationKey' | 'useMutationState' | 'useIsMutating' | 'isMutating'\n >\n>;\n\nexport type APIUtilityClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\nexport type APIBasicClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\ntype ServicesFilteredByCallbacks<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n TQueryOperationCallbacks extends QueryOperationCallbacks,\n TMutationOperationCallbacks extends MutationOperationCallbacks,\n> = {\n [serviceName in keyof TServices]: {\n [method in keyof TServices[serviceName]]: TServices[serviceName][method]['schema']['method'] extends\n | 'get'\n | 'head'\n | 'options'\n ? Pick<\n ServiceOperationQuery<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TQueryOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationQueryFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {})\n : Pick<\n ServiceOperationMutation<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TMutationOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationMutationFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {});\n };\n};\n\ntype OperationInvokeFnName = Extract<\n keyof typeof operationInvokeModule,\n 'operationInvokeFn'\n>;\n"],"names":["qraftAPIClient","services","callbacks","options","createRecursiveProxy","getCallback","getPath","key","length","serviceOperation","getByPath","isServiceOperation","Error","join","schema","applyCallback","applyPath","args","path","callbackName","extractCallbackDetails","assertValidCallbackName","queryClient","String","slice","input","obj","reduce","acc"],"mappings":";;AAwFO,SAASA,cAIdC,CAAAA,QAA6C,EAC7CC,SAAqB,EACrBC,OAAgC,EAAA;AAEhC,IAAA,OAAOC,oBACL,CAAA,SAASC,WAAYC,CAAAA,OAAO,EAAEC,GAAG,EAAA;AAC/B,QAAA,IAAID,QAAQE,MAAM,KAAK,KAAKD,GAAQ,KAAA,QAAA,EAAU;QAE9C,MAAME,gBAAAA,GAAmBC,UAAUT,QAAUK,EAAAA,OAAAA,CAAAA,CAAAA;AAC7C,QAAA,IAAI,CAACK,kBAAAA,CAAmBF,gBACtB,CAAA,EAAA,MAAM,IAAIG,KAAAA,CAAM,CAAC,6BAA6B,EAAEN,OAAAA,CAAQO,IAAI,CAAC,KAAK,CAAC,CAAA,CAAA;AACrE,QAAA,OAAOJ,iBAAiBK,MAAM,CAAA;AAChC,KAAA,EACA,SAASC,aAAAA,CAAcC,SAAS,EAAEC,IAAI,EAAA;AACpC,QAAA,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGC,sBAAuBJ,CAAAA,SAAAA,CAAAA,CAAAA;AAEtDK,QAAAA,uBAAAA,CAAwBF,YAAcjB,EAAAA,SAAAA,CAAAA,CAAAA;QAEtC,MAAMO,gBAAAA,GAAmBC,UAAUT,QAAUiB,EAAAA,IAAAA,CAAAA,CAAAA;A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AAUQ,CAAAA,KAAK,CAAC,CAAA,EAAG,CAAC,CAAA,CAAA;;AAE1BL,YAAAA,YAAAA,EAAcH,SAAS,CAACA,SAAUR,CAAAA,MAAM,GAAG,CAAE,CAAA;AAC/C,SAAA,CAAA;AACF,KAAA;AACF,CAAA;AAEA,SAASG,mBACPc,KAAc,EAAA;AAEd,IAAA,OAAOA,KAAU,KAAA,IAAA,IAAQ,OAAOA,KAAAA,KAAU,YAAY,QAAYA,IAAAA,KAAAA,CAAAA;AACpE,CAAA;AAEA,SAASf,SAAAA,CAAUgB,GAA4B,EAAER,IAAc,EAAA;AAC7D,IAAA,OAAOA,IAAKS,CAAAA,MAAM,CAAU,CAACC,GAAKrB,EAAAA,GAAAA,GAAAA;QAChC,IAAIqB,GAAAA,IAAO,OAAOA,GAAQ,KAAA,QAAA,IAAYrB,OAAOqB,GAC3C,EAAA,OAAOA,GAAG,CAACrB,GAAwB,CAAA,CAAA;KACpCmB,EAAAA,GAAAA,CAAAA,CAAAA;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"qraftAPIClient.js","sources":["../../src/qraftAPIClient.ts"],"sourcesContent":["import type {\n ServiceOperationMutation,\n ServiceOperationMutationFn,\n ServiceOperationQuery,\n ServiceOperationQueryFn,\n} from '@openapi-qraft/tanstack-query-react-types';\nimport type { QueryClient } from '@tanstack/query-core';\nimport type * as callbacks from './callbacks/index.js';\nimport type * as operationInvokeModule from './callbacks/operationInvokeFn.js';\nimport type {\n OperationSchema,\n RequestFnInfo,\n RequestFnResponse,\n} from './lib/requestFn.js';\nimport { createRecursiveProxy } from './lib/createRecursiveProxy.js';\n\nexport interface CreateAPIBasicClientOptions {\n requestFn<TData, TError>(\n schema: OperationSchema,\n requestInfo: RequestFnInfo\n ): Promise<RequestFnResponse<TData, TError>>;\n baseUrl: string;\n}\n\nexport interface CreateAPIBasicQueryClientOptions {\n queryClient: QueryClient;\n}\n\nexport interface CreateAPIQueryClientOptions\n extends CreateAPIBasicClientOptions,\n CreateAPIBasicQueryClientOptions {}\n\n/**\n * @deprecated use `CreateAPIClientOptions` instead\n */\nexport type QraftClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIQueryClientOptions;\n\nexport type CreateAPIClientOptions =\n | CreateAPIBasicClientOptions\n | CreateAPIBasicQueryClientOptions\n | CreateAPIQueryClientOptions;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicClientOptions\n): APIBasicClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Required<Callbacks>,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): Services;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIBasicQueryClientOptions\n): APIBasicQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options: CreateAPIQueryClientOptions\n): APIQueryClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks\n): APIUtilityClientServices<Services, TCallbacks>;\n\nexport function qraftAPIClient<\n Services extends ServicesDeclaration<Services>,\n TCallbacks extends Callbacks,\n>(\n services: ServiceSchemasDeclaration<Services>,\n callbacks: TCallbacks,\n options?: CreateAPIClientOptions\n): APIQueryClientServices<Services, TCallbacks> | Services {\n return createRecursiveProxy(\n function getCallback(getPath, key) {\n if (getPath.length !== 2 || key !== 'schema') return; // todo::maybe return callback?\n\n const serviceOperation = getByPath(services, getPath);\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${getPath.join('.')}`);\n return serviceOperation.schema;\n },\n function applyCallback(applyPath, args) {\n const { path, callbackName } = extractCallbackDetails(applyPath);\n\n assertValidCallbackName(callbackName, callbacks);\n\n const serviceOperation = getByPath(services, path);\n\n if (!isServiceOperation(serviceOperation))\n throw new Error(`Service operation not found: ${path.join('.')}`);\n\n if (\n callbackName !== 'operationInvokeFn' &&\n callbackName !== 'getQueryKey' &&\n callbackName !== 'getMutationKey' &&\n callbackName !== 'getInfiniteQueryKey'\n )\n if (!options || !('queryClient' in options && options.queryClient))\n throw new Error(\n `'qraft.<service>.<operation>.${String(callbackName)}()' requires 'queryClient' in 'createAPIClient(...)' options.`\n );\n\n // @ts-expect-error - Too complex union type\n return callbacks[callbackName](options, serviceOperation.schema, args);\n },\n []\n ) as never;\n}\n\nfunction assertValidCallbackName<\n TCallbacks extends Record<string, (...rest: any[]) => unknown>,\n>(\n callbackName: string | number | symbol,\n callbacks: TCallbacks\n): asserts callbackName is keyof TCallbacks {\n if (!(callbackName in callbacks)) {\n if ((callbackName as OperationInvokeFnName) === 'operationInvokeFn')\n throw new Error(\n `Callback 'operationInvokeFn' is required for executing 'qraft.<service>.<operation>()', but it is not provided in the 'callbacks' object.`\n );\n throw new Error(\n `Callback for 'qraft.<service>.<operation>.${String(callbackName)}()' is not provided in the 'callbacks' object.`\n );\n }\n}\n\n/**\n * Extracts Callback details from the applyPath\n * @param applyPath\n */\nfunction extractCallbackDetails(applyPath: string[]) {\n // <service>.<operation>()\n if (applyPath.length === 2) {\n return {\n path: applyPath,\n callbackName: 'operationInvokeFn' satisfies OperationInvokeFnName,\n };\n } else {\n // <service>.<operation>.<method>()\n return {\n path: applyPath.slice(0, -1),\n // The last arg is for instance `.useMutation` or `.useQuery()`\n callbackName: applyPath[applyPath.length - 1],\n };\n }\n}\n\nfunction isServiceOperation(\n input: unknown\n): input is { schema: OperationSchema } {\n return input !== null && typeof input === 'object' && 'schema' in input;\n}\n\nfunction getByPath(obj: Record<string, unknown>, path: string[]) {\n return path.reduce<unknown>((acc, key) => {\n if (acc && typeof acc === 'object' && key in acc)\n return acc[key as keyof typeof acc];\n }, obj);\n}\n\ntype Callbacks = Partial<typeof callbacks>;\n\ntype ServicesDeclaration<Services> = {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: OperationSchema;\n types: {\n parameters?: any;\n data?: any;\n error?: any;\n body?: any;\n };\n };\n };\n};\n\ntype ServiceSchemasDeclaration<Services extends ServicesDeclaration<Services>> =\n {\n [service in keyof Services]: {\n [method in keyof Services[service]]: {\n schema: Services[service][method]['schema'];\n };\n };\n };\n\ntype QueryOperationCallbacks = Extract<\n keyof Callbacks,\n | 'cancelQueries'\n | 'fetchInfiniteQuery'\n | 'fetchQuery'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'getInfiniteQueryState'\n | 'getQueriesData'\n | 'getQueryData'\n | 'getQueryKey'\n | 'getQueryState'\n | 'invalidateQueries'\n | 'isFetching'\n | 'prefetchInfiniteQuery'\n | 'prefetchQuery'\n | 'refetchQueries'\n | 'ensureQueryData'\n | 'ensureInfiniteQueryData'\n | 'removeQueries'\n | 'resetQueries'\n | 'setInfiniteQueryData'\n | 'setQueriesData'\n | 'setQueryData'\n | 'useInfiniteQuery'\n | 'useIsFetching'\n | 'useQueries'\n | 'useQuery'\n | 'useSuspenseInfiniteQuery'\n | 'useSuspenseQueries'\n | 'useSuspenseQuery'\n>;\n\ntype MutationOperationCallbacks = Extract<\n keyof Callbacks,\n | 'getMutationKey'\n | 'isMutating'\n | 'useIsMutating'\n | 'useMutation'\n | 'useMutationState'\n>;\n\nexport type APIQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n QueryOperationCallbacks,\n MutationOperationCallbacks\n>;\n\nexport type APIBasicQueryClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<\n QueryOperationCallbacks,\n | 'resetQueries'\n | 'removeQueries'\n | 'cancelQueries'\n | 'invalidateQueries'\n | 'refetchQueries'\n | 'getQueryKey'\n | 'getInfiniteQueryState'\n | 'getInfiniteQueryData'\n | 'getInfiniteQueryKey'\n | 'setInfiniteQueryData'\n | 'getQueriesData'\n | 'setQueriesData'\n | 'getQueryState'\n | 'getQueryData'\n | 'setQueryData'\n | 'useIsFetching'\n | 'isFetching'\n >,\n Extract<\n MutationOperationCallbacks,\n 'getMutationKey' | 'useMutationState' | 'useIsMutating' | 'isMutating'\n >\n>;\n\nexport type APIUtilityClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n Omit<TCallbacks, 'operationInvokeFn'>,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\nexport type APIBasicClientServices<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n> = ServicesFilteredByCallbacks<\n TServices,\n TCallbacks,\n Extract<QueryOperationCallbacks, 'getQueryKey' | 'getInfiniteQueryKey'>,\n Extract<MutationOperationCallbacks, 'getMutationKey'>\n>;\n\ntype ServicesFilteredByCallbacks<\n TServices extends ServicesDeclaration<TServices>,\n TCallbacks extends Callbacks,\n TQueryOperationCallbacks extends QueryOperationCallbacks,\n TMutationOperationCallbacks extends MutationOperationCallbacks,\n> = {\n [serviceName in keyof TServices]: {\n [method in keyof TServices[serviceName]]: TServices[serviceName][method]['schema']['method'] extends\n | 'get'\n | 'head'\n | 'options'\n ? Pick<\n ServiceOperationQuery<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TQueryOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationQueryFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {})\n : Pick<\n ServiceOperationMutation<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >,\n | Extract<keyof TCallbacks, TMutationOperationCallbacks>\n | 'types'\n | 'schema'\n > &\n (OperationInvokeFnName extends keyof TCallbacks\n ? ServiceOperationMutationFn<\n TServices[serviceName][method]['schema'],\n TServices[serviceName][method]['types']['body'],\n TServices[serviceName][method]['types']['data'],\n TServices[serviceName][method]['types']['parameters'],\n TServices[serviceName][method]['types']['error']\n >\n : {});\n };\n};\n\ntype OperationInvokeFnName = Extract<\n keyof typeof operationInvokeModule,\n 'operationInvokeFn'\n>;\n"],"names":["qraftAPIClient","services","callbacks","options","createRecursiveProxy","getCallback","getPath","key","length","serviceOperation","getByPath","isServiceOperation","Error","join","schema","applyCallback","applyPath","args","path","callbackName","extractCallbackDetails","assertValidCallbackName","queryClient","String","slice","input","obj","reduce","acc"],"mappings":";;AAwFO,SAASA,cAIdC,CAAAA,QAA6C,EAC7CC,SAAqB,EACrBC,OAAgC,EAAA;AAEhC,IAAA,OAAOC,oBACL,CAAA,SAASC,WAAYC,CAAAA,OAAO,EAAEC,GAAG,EAAA;AAC/B,QAAA,IAAID,QAAQE,MAAM,KAAK,KAAKD,GAAQ,KAAA,QAAA,EAAU;QAE9C,MAAME,gBAAAA,GAAmBC,UAAUT,QAAUK,EAAAA,OAAAA,CAAAA,CAAAA;AAC7C,QAAA,IAAI,CAACK,kBAAAA,CAAmBF,gBACtB,CAAA,EAAA,MAAM,IAAIG,KA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,EAAA,MAAM,IAAIP,KACR,CAAA,CAAC,yIAAyI,CAAC,CAAA,CAAA;QAE/I,MAAM,IAAIA,MACR,CAAC,0CAA0C,EAAEW,MAAOJ,CAAAA,YAAAA,CAAAA,CAAc,8CAA8C,CAAC,CAAA,CAAA;AAErH,KAAA;AACF,CAAA;AAEA;;;IAIA,SAASC,uBAAuBJ,SAAmB,EAAA;;IAEjD,IAAIA,SAAAA,CAAUR,MAAM,KAAK,CAAG,EAAA;QAC1B,OAAO;YACLU,IAAMF,EAAAA,SAAAA;YACNG,YAAc,EAAA,mBAAA;AAChB,SAAA,CAAA;KACK,MAAA;;QAEL,OAAO;AACLD,YAAAA,IAAAA,EAAMF,SAAUQ,CAAAA,KAAK,CAAC,CAAA,EAAG,CAAC,CAAA,CAAA;;AAE1BL,YAAAA,YAAAA,EAAcH,SAAS,CAACA,SAAUR,CAAAA,MAAM,GAAG,CAAE,CAAA;AAC/C,SAAA,CAAA;AACF,KAAA;AACF,CAAA;AAEA,SAASG,mBACPc,KAAc,EAAA;AAEd,IAAA,OAAOA,KAAU,KAAA,IAAA,IAAQ,OAAOA,KAAAA,KAAU,YAAY,QAAYA,IAAAA,KAAAA,CAAAA;AACpE,CAAA;AAEA,SAASf,SAAAA,CAAUgB,GAA4B,EAAER,IAAc,EAAA;AAC7D,IAAA,OAAOA,IAAKS,CAAAA,MAAM,CAAU,CAACC,GAAKrB,EAAAA,GAAAA,GAAAA;QAChC,IAAIqB,GAAAA,IAAO,OAAOA,GAAQ,KAAA,QAAA,IAAYrB,OAAOqB,GAC3C,EAAA,OAAOA,GAAG,CAACrB,GAAwB,CAAA,CAAA;KACpCmB,EAAAA,GAAAA,CAAAA,CAAAA;AACL;;;;"}
|
|
@@ -43,7 +43,7 @@ type ServiceSchemasDeclaration<Services extends ServicesDeclaration<Services>> =
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
type QueryOperationCallbacks = Extract<keyof Callbacks, 'cancelQueries' | 'fetchInfiniteQuery' | 'fetchQuery' | 'getInfiniteQueryData' | 'getInfiniteQueryKey' | 'getInfiniteQueryState' | 'getQueriesData' | 'getQueryData' | 'getQueryKey' | 'getQueryState' | 'invalidateQueries' | 'isFetching' | 'prefetchInfiniteQuery' | 'prefetchQuery' | 'refetchQueries' | 'removeQueries' | 'resetQueries' | 'setInfiniteQueryData' | 'setQueriesData' | 'setQueryData' | 'useInfiniteQuery' | 'useIsFetching' | 'useQueries' | 'useQuery' | 'useSuspenseInfiniteQuery' | 'useSuspenseQueries' | 'useSuspenseQuery'>;
|
|
46
|
+
type QueryOperationCallbacks = Extract<keyof Callbacks, 'cancelQueries' | 'fetchInfiniteQuery' | 'fetchQuery' | 'getInfiniteQueryData' | 'getInfiniteQueryKey' | 'getInfiniteQueryState' | 'getQueriesData' | 'getQueryData' | 'getQueryKey' | 'getQueryState' | 'invalidateQueries' | 'isFetching' | 'prefetchInfiniteQuery' | 'prefetchQuery' | 'refetchQueries' | 'ensureQueryData' | 'ensureInfiniteQueryData' | 'removeQueries' | 'resetQueries' | 'setInfiniteQueryData' | 'setQueriesData' | 'setQueryData' | 'useInfiniteQuery' | 'useIsFetching' | 'useQueries' | 'useQuery' | 'useSuspenseInfiniteQuery' | 'useSuspenseQueries' | 'useSuspenseQuery'>;
|
|
47
47
|
type MutationOperationCallbacks = Extract<keyof Callbacks, 'getMutationKey' | 'isMutating' | 'useIsMutating' | 'useMutation' | 'useMutationState'>;
|
|
48
48
|
export type APIQueryClientServices<TServices extends ServicesDeclaration<TServices>, TCallbacks extends Callbacks> = ServicesFilteredByCallbacks<TServices, TCallbacks, QueryOperationCallbacks, MutationOperationCallbacks>;
|
|
49
49
|
export type APIBasicQueryClientServices<TServices extends ServicesDeclaration<TServices>, TCallbacks extends Callbacks> = ServicesFilteredByCallbacks<TServices, Omit<TCallbacks, 'operationInvokeFn'>, Extract<QueryOperationCallbacks, 'resetQueries' | 'removeQueries' | 'cancelQueries' | 'invalidateQueries' | 'refetchQueries' | 'getQueryKey' | 'getInfiniteQueryState' | 'getInfiniteQueryData' | 'getInfiniteQueryKey' | 'setInfiniteQueryData' | 'getQueriesData' | 'setQueriesData' | 'getQueryState' | 'getQueryData' | 'setQueryData' | 'useIsFetching' | 'isFetching'>, Extract<MutationOperationCallbacks, 'getMutationKey' | 'useMutationState' | 'useIsMutating' | 'isMutating'>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qraftAPIClient.d.ts","sourceRoot":"","sources":["../../src/qraftAPIClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,KAAK,qBAAqB,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,aAAa,GACzB,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,2BACf,SAAQ,2BAA2B,EACjC,gCAAgC;CAAG;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,2BAA2B,CAAC;AAEhC,MAAM,MAAM,sBAAsB,GAC9B,2BAA2B,GAC3B,gCAAgC,GAChC,2BAA2B,CAAC;AAEhC,wBAAgB,cAAc,CAC5B,QAAQ,SAAS,mBAA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xC,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAC/C,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAC/C,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,EACrD,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CACjD,GACD,EAAE,CAAC;KACd;CACF,CAAC;AAEF,KAAK,qBAAqB,GAAG,OAAO,CAClC,MAAM,OAAO,qBAAqB,EAClC,mBAAmB,CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/react",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.19",
|
|
4
4
|
"description": "OpenAPI client for React, providing type-safe requests and dynamic TanStack Query React Hooks via a modular, Proxy-based architecture.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "NODE_ENV=production rollup --config rollup.config.mjs && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@openapi-qraft/tanstack-query-react-types": "2.0.0-next.
|
|
18
|
+
"@openapi-qraft/tanstack-query-react-types": "2.0.0-next.19"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@openapi-qraft/cli": "2.0.0-next.
|
|
21
|
+
"@openapi-qraft/cli": "2.0.0-next.19",
|
|
22
22
|
"@openapi-qraft/eslint-config": "1.0.0",
|
|
23
|
-
"@openapi-qraft/openapi-typescript-plugin": "^1.2.0-next.
|
|
23
|
+
"@openapi-qraft/openapi-typescript-plugin": "^1.2.0-next.19",
|
|
24
24
|
"@openapi-qraft/rollup-config": "1.1.0-next.0",
|
|
25
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.0.0-next.
|
|
25
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.0.0-next.19",
|
|
26
26
|
"@openapi-qraft/test-fixtures": "1.0.0",
|
|
27
27
|
"@tanstack/react-query": "^5.56.2",
|
|
28
28
|
"@testing-library/jest-dom": "^5.17.0",
|
package/src/qraftAPIClient.ts
CHANGED