@openapi-qraft/react 1.11.0-beta.1 → 1.11.0-beta.2
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 +6 -0
- package/dist/types/QraftContext.d.ts +20 -0
- package/dist/types/QraftContext.d.ts.map +1 -0
- package/dist/types/ServiceOperation.d.ts +44 -0
- package/dist/types/ServiceOperation.d.ts.map +1 -0
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts +81 -0
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts.map +1 -0
- package/dist/types/callbacks/cancelQueries.d.ts +5 -0
- package/dist/types/callbacks/cancelQueries.d.ts.map +1 -0
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/fetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/fetchQuery.d.ts +7 -0
- package/dist/types/callbacks/fetchQuery.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryData.d.ts +6 -0
- package/dist/types/callbacks/getInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts +5 -0
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts.map +1 -0
- package/dist/types/callbacks/getInfiniteQueryState.d.ts +5 -0
- package/dist/types/callbacks/getInfiniteQueryState.d.ts.map +1 -0
- package/dist/types/callbacks/getMutationKey.d.ts +5 -0
- package/dist/types/callbacks/getMutationKey.d.ts.map +1 -0
- package/dist/types/callbacks/getQueriesData.d.ts +5 -0
- package/dist/types/callbacks/getQueriesData.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryData.d.ts +5 -0
- package/dist/types/callbacks/getQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryKey.d.ts +5 -0
- package/dist/types/callbacks/getQueryKey.d.ts.map +1 -0
- package/dist/types/callbacks/getQueryState.d.ts +5 -0
- package/dist/types/callbacks/getQueryState.d.ts.map +1 -0
- package/dist/types/callbacks/index.d.ts +36 -0
- package/dist/types/callbacks/index.d.ts.map +1 -0
- package/dist/types/callbacks/invalidateQueries.d.ts +5 -0
- package/dist/types/callbacks/invalidateQueries.d.ts.map +1 -0
- package/dist/types/callbacks/isFetching.d.ts +5 -0
- package/dist/types/callbacks/isFetching.d.ts.map +1 -0
- package/dist/types/callbacks/isMutating.d.ts +5 -0
- package/dist/types/callbacks/isMutating.d.ts.map +1 -0
- package/dist/types/callbacks/mutationFn.d.ts +4 -0
- package/dist/types/callbacks/mutationFn.d.ts.map +1 -0
- package/dist/types/callbacks/operationInvokeFn.d.ts +9 -0
- package/dist/types/callbacks/operationInvokeFn.d.ts.map +1 -0
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/prefetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/prefetchQuery.d.ts +7 -0
- package/dist/types/callbacks/prefetchQuery.d.ts.map +1 -0
- package/dist/types/callbacks/queryFn.d.ts +7 -0
- package/dist/types/callbacks/queryFn.d.ts.map +1 -0
- package/dist/types/callbacks/refetchQueries.d.ts +5 -0
- package/dist/types/callbacks/refetchQueries.d.ts.map +1 -0
- package/dist/types/callbacks/removeQueries.d.ts +5 -0
- package/dist/types/callbacks/removeQueries.d.ts.map +1 -0
- package/dist/types/callbacks/resetQueries.d.ts +5 -0
- package/dist/types/callbacks/resetQueries.d.ts.map +1 -0
- package/dist/types/callbacks/setInfiniteQueryData.d.ts +6 -0
- package/dist/types/callbacks/setInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/setQueriesData.d.ts +5 -0
- package/dist/types/callbacks/setQueriesData.d.ts.map +1 -0
- package/dist/types/callbacks/setQueryData.d.ts +5 -0
- package/dist/types/callbacks/setQueryData.d.ts.map +1 -0
- package/dist/types/callbacks/useInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/useInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useIsFetching.d.ts +5 -0
- package/dist/types/callbacks/useIsFetching.d.ts.map +1 -0
- package/dist/types/callbacks/useIsMutating.d.ts +7 -0
- package/dist/types/callbacks/useIsMutating.d.ts.map +1 -0
- package/dist/types/callbacks/useMutation.d.ts +7 -0
- package/dist/types/callbacks/useMutation.d.ts.map +1 -0
- package/dist/types/callbacks/useMutationState.d.ts +7 -0
- package/dist/types/callbacks/useMutationState.d.ts.map +1 -0
- package/dist/types/callbacks/useQueries.d.ts +6 -0
- package/dist/types/callbacks/useQueries.d.ts.map +1 -0
- package/dist/types/callbacks/useQuery.d.ts +7 -0
- package/dist/types/callbacks/useQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts +7 -0
- package/dist/types/callbacks/useSuspenseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseQueries.d.ts +6 -0
- package/dist/types/callbacks/useSuspenseQueries.d.ts.map +1 -0
- package/dist/types/callbacks/useSuspenseQuery.d.ts +7 -0
- package/dist/types/callbacks/useSuspenseQuery.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/PartialParameters.type.d.ts +13 -0
- package/dist/types/lib/PartialParameters.type.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientFetchMethod.d.ts +20 -0
- package/dist/types/lib/callQueryClientFetchMethod.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithMutationFilters.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithMutationFilters.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithQueryFilters.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithQueryFilters.d.ts.map +1 -0
- package/dist/types/lib/callQueryClientMethodWithQueryKey.d.ts +11 -0
- package/dist/types/lib/callQueryClientMethodWithQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeBaseQueryKey.d.ts +6 -0
- package/dist/types/lib/composeBaseQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeInfiniteQueryKey.d.ts +4 -0
- package/dist/types/lib/composeInfiniteQueryKey.d.ts.map +1 -0
- package/dist/types/lib/composeMutationFilters.d.ts +11 -0
- package/dist/types/lib/composeMutationFilters.d.ts.map +1 -0
- package/dist/types/lib/composeMutationKey.d.ts +10 -0
- package/dist/types/lib/composeMutationKey.d.ts.map +1 -0
- package/dist/types/lib/composeQueryFilters.d.ts +14 -0
- package/dist/types/lib/composeQueryFilters.d.ts.map +1 -0
- package/dist/types/lib/composeQueryKey.d.ts +4 -0
- package/dist/types/lib/composeQueryKey.d.ts.map +1 -0
- package/dist/types/lib/createRecursiveProxy.d.ts +15 -0
- package/dist/types/lib/createRecursiveProxy.d.ts.map +1 -0
- package/dist/types/lib/jwt-decode/index.d.ts +29 -0
- package/dist/types/lib/jwt-decode/index.d.ts.map +1 -0
- package/dist/types/lib/jwt-decode/index.test.d.ts +2 -0
- package/dist/types/lib/jwt-decode/index.test.d.ts.map +1 -0
- package/dist/types/lib/requestFn.d.ts +100 -0
- package/dist/types/lib/requestFn.d.ts.map +1 -0
- package/dist/types/lib/shelfMerge.d.ts +7 -0
- package/dist/types/lib/shelfMerge.d.ts.map +1 -0
- package/dist/types/lib/useComposeUseQueryOptions.d.ts +16 -0
- package/dist/types/lib/useComposeUseQueryOptions.d.ts.map +1 -0
- package/dist/types/lib/useQueryClient.d.ts +9 -0
- package/dist/types/lib/useQueryClient.d.ts.map +1 -0
- package/dist/types/qraftAPIClient.d.ts +24 -0
- package/dist/types/qraftAPIClient.d.ts.map +1 -0
- package/dist/types/service-operation/OperationInfiniteData.d.ts +4 -0
- package/dist/types/service-operation/OperationInfiniteData.d.ts.map +1 -0
- package/dist/types/service-operation/QueryFilters.d.ts +123 -0
- package/dist/types/service-operation/QueryFilters.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperation.d.ts +53 -0
- package/dist/types/service-operation/ServiceOperation.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationCancelQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts +58 -0
- package/dist/types/service-operation/ServiceOperationFetchInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts +49 -0
- package/dist/types/service-operation/ServiceOperationFetchQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationGetInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts +18 -0
- package/dist/types/service-operation/ServiceOperationGetQueriesData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationGetQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts +11 -0
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts +26 -0
- package/dist/types/service-operation/ServiceOperationInvalidateQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationIsFetchingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationIsMutatingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationKey.d.ts +16 -0
- package/dist/types/service-operation/ServiceOperationKey.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts +47 -0
- package/dist/types/service-operation/ServiceOperationMutationFn.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts +79 -0
- package/dist/types/service-operation/ServiceOperationQueryFn.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts +30 -0
- package/dist/types/service-operation/ServiceOperationRefetchQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationRemoveQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationResetQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationSetInfiniteQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationSetQueriesData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts +19 -0
- package/dist/types/service-operation/ServiceOperationSetQueryData.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts +14 -0
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationUseIsFetchingQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts +9 -0
- package/dist/types/service-operation/ServiceOperationUseIsMutating.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts +17 -0
- package/dist/types/service-operation/ServiceOperationUseMutation.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts +46 -0
- package/dist/types/service-operation/ServiceOperationUseMutationState.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts +20 -0
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts +12 -0
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts +12 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts +18 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts.map +1 -0
- package/dist/types/service-operation/index.d.ts +2 -0
- package/dist/types/service-operation/index.d.ts.map +1 -0
- package/package.json +7 -7
- package/dist/cjs/index.d.cts +0 -1035
- package/dist/esm/index.d.ts +0 -1035
package/dist/esm/index.d.ts
DELETED
|
@@ -1,1035 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { Context, ReactNode } from 'react';
|
|
3
|
-
import { QueryClient, UseMutationOptions, UseMutationResult, UndefinedInitialDataInfiniteOptions, UseInfiniteQueryResult, DefinedInitialDataInfiniteOptions, DefinedUseInfiniteQueryResult, UseQueryResult, UseQueryOptions, UndefinedInitialDataOptions, DefinedInitialDataOptions, DefinedUseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryResult, UseSuspenseQueryOptions, QueriesResults, SuspenseQueriesResults } from '@tanstack/react-query';
|
|
4
|
-
import { InfiniteData, DefaultError, FetchStatus, Query, CancelOptions, QueryClient as QueryClient$1, QueryFunction, FetchQueryOptions, InitialPageParam, GetNextPageParamFunction, NoInfer, QueryState, InvalidateOptions, MutationState, Mutation, MutationStatus, ResetOptions, RefetchOptions, Updater, SetDataOptions, InfiniteQueryPageParamsOptions, QueriesPlaceholderDataFunction } from '@tanstack/query-core';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This function is used to make a request to a specified endpoint.
|
|
8
|
-
*
|
|
9
|
-
* @template T The expected return type of the request.
|
|
10
|
-
*
|
|
11
|
-
* @param schema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.
|
|
12
|
-
* @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.
|
|
13
|
-
* @param [options] Optional. Additional options for the request. It includes custom urlSerializer, bodySerializer, and fetch function.
|
|
14
|
-
*
|
|
15
|
-
* @returns {Promise<T>} Returns a promise that resolves with the response of the request.
|
|
16
|
-
*
|
|
17
|
-
* @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.
|
|
18
|
-
*/
|
|
19
|
-
declare function requestFn<T>(schema: OperationSchema, requestInfo: RequestFnInfo, options?: RequestFnOptions): Promise<T>;
|
|
20
|
-
/**
|
|
21
|
-
* This function is used to make a request to a specified endpoint.
|
|
22
|
-
* It's needed to create a custom `requestFn` with a custom `urlSerializer`
|
|
23
|
-
* and `bodySerializer`, with the tree-shaking of the default `requestFn`
|
|
24
|
-
* and its serializers.
|
|
25
|
-
*
|
|
26
|
-
* @template T The expected return type of the request.
|
|
27
|
-
*
|
|
28
|
-
* @param requestSchema The schema of the operation to be performed. It includes the OpenAPI path, HTTP method and media type.
|
|
29
|
-
* @param requestInfo The information required to make the request. It includes parameters, headers, body, etc.
|
|
30
|
-
* @param options The options for the request. It includes urlSerializer, bodySerializer, and fetch function. The 'urlSerializer' and 'bodySerializer' are required.
|
|
31
|
-
*
|
|
32
|
-
* @returns {Promise<T>} Returns a promise that resolves with the response of the request.
|
|
33
|
-
*
|
|
34
|
-
* @throws {error: object|string, response: Response} Throws an error if the request fails. The error includes the error message and the response from the server.
|
|
35
|
-
*/
|
|
36
|
-
declare function baseRequestFn<T>(requestSchema: OperationSchema, requestInfo: RequestFnInfo, options: WithRequired<RequestFnOptions, 'urlSerializer' | 'bodySerializer'>): Promise<T>;
|
|
37
|
-
declare function urlSerializer(schema: OperationSchema, info: RequestFnPayload): string;
|
|
38
|
-
declare function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]): Headers;
|
|
39
|
-
declare function bodySerializer(schema: OperationSchema, info: RequestFnPayload): string | Blob | FormData | undefined;
|
|
40
|
-
type HeadersOptions = HeadersInit | Record<string, string | number | boolean | null | undefined>;
|
|
41
|
-
interface OperationSchema {
|
|
42
|
-
/**
|
|
43
|
-
* Operation path
|
|
44
|
-
* @example /user/{id}
|
|
45
|
-
*/
|
|
46
|
-
readonly url: string;
|
|
47
|
-
/**
|
|
48
|
-
* Operation method
|
|
49
|
-
*/
|
|
50
|
-
readonly method: 'get' | 'put' | 'post' | 'patch' | 'delete' | 'options' | 'head' | 'trace';
|
|
51
|
-
/**
|
|
52
|
-
* Media type of the request body
|
|
53
|
-
* @example application/json
|
|
54
|
-
*/
|
|
55
|
-
readonly mediaType?: string;
|
|
56
|
-
readonly security?: string[];
|
|
57
|
-
}
|
|
58
|
-
interface RequestFnPayload {
|
|
59
|
-
/**
|
|
60
|
-
* Base URL to use for the request
|
|
61
|
-
* @example 'https://api.example.com'
|
|
62
|
-
*/
|
|
63
|
-
baseUrl: string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* OpenAPI parameters
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* { path: {id: 1}, query: {search: 'hello'} }
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
readonly parameters?: {
|
|
72
|
-
readonly path?: Record<string, any>;
|
|
73
|
-
readonly header?: Record<string, any>;
|
|
74
|
-
readonly query?: Record<string, any>;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Request body
|
|
78
|
-
* @example { name: 'John' }
|
|
79
|
-
*/
|
|
80
|
-
readonly body?: BodyInit | Record<string, unknown> | null;
|
|
81
|
-
/**
|
|
82
|
-
* Tanstack Query Meta
|
|
83
|
-
*/
|
|
84
|
-
meta?: Record<string, unknown>;
|
|
85
|
-
/** An AbortSignal to set request's signal. */
|
|
86
|
-
signal?: AbortSignal | null;
|
|
87
|
-
}
|
|
88
|
-
interface RequestFnInfo extends RequestFnPayload, Omit<RequestInit, 'headers' | 'method' | 'body' | 'signal'> {
|
|
89
|
-
/**
|
|
90
|
-
* Request headers
|
|
91
|
-
* @example { 'X-Auth': '123' }
|
|
92
|
-
*/
|
|
93
|
-
readonly headers?: HeadersOptions;
|
|
94
|
-
}
|
|
95
|
-
interface RequestFnOptions {
|
|
96
|
-
urlSerializer?: typeof urlSerializer;
|
|
97
|
-
bodySerializer?: typeof bodySerializer;
|
|
98
|
-
fetch?: typeof fetch;
|
|
99
|
-
}
|
|
100
|
-
type RequestFn$1<T> = typeof requestFn<T>;
|
|
101
|
-
type WithRequired<T, K extends keyof T> = T & {
|
|
102
|
-
[_ in K]: {};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
interface QraftContextValueBase {
|
|
106
|
-
/**
|
|
107
|
-
* Base URL to use for the request
|
|
108
|
-
* @example 'https://api.example.com'
|
|
109
|
-
*/
|
|
110
|
-
baseUrl?: string;
|
|
111
|
-
/**
|
|
112
|
-
* The `requestFn` will be invoked with every request.
|
|
113
|
-
*/
|
|
114
|
-
requestFn<T>(requestSchema: OperationSchema, requestInfo: RequestFnPayload): Promise<T>;
|
|
115
|
-
/** The QueryClient to use in Hooks */
|
|
116
|
-
queryClient?: QueryClient;
|
|
117
|
-
}
|
|
118
|
-
type QraftContextValue = QraftContextValueBase | undefined;
|
|
119
|
-
declare const QraftContext: react.Context<QraftContextValue>;
|
|
120
|
-
|
|
121
|
-
interface QraftClientOptions {
|
|
122
|
-
context?: Context<QraftContextValue>;
|
|
123
|
-
}
|
|
124
|
-
declare const qraftAPIClient: <Services extends ServicesBaseDeclaration<Services>, Callbacks extends ServicesCallbacks>(services: ServicesDeclaration<Services>, callbacks: Callbacks, options?: QraftClientOptions) => Services;
|
|
125
|
-
type ServicesBaseDeclaration<Services> = {
|
|
126
|
-
[service in keyof Services]: {
|
|
127
|
-
[method in keyof Services[service]]: {
|
|
128
|
-
schema: OperationSchema;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
type ServicesDeclaration<Services extends ServicesBaseDeclaration<Services>> = {
|
|
133
|
-
[service in keyof Services]: {
|
|
134
|
-
[method in keyof Services[service]]: {
|
|
135
|
-
schema: Services[service][method]['schema'];
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
type ServicesCallbacks = Record<string, (...rest: any[]) => unknown>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Shallow partial 'parameters'.
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* {query?: {page: number, nested: {still: 'not_partial'}}}
|
|
146
|
-
* // =>
|
|
147
|
-
* {query?: {page?: number, nested?: {still: 'not_partial'}}}
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
type PartialParameters<T> = T extends object ? {
|
|
151
|
-
[K in keyof T]?: T[K] extends object ? Partial<T[K]> : T[K];
|
|
152
|
-
} : T;
|
|
153
|
-
|
|
154
|
-
type OperationInfiniteData<TData, TParams> = InfiniteData<TData, PartialParameters<TParams>>;
|
|
155
|
-
|
|
156
|
-
type ServiceOperationBaseQueryKey<S extends {
|
|
157
|
-
url: string;
|
|
158
|
-
method: string;
|
|
159
|
-
}, Infinite extends boolean, T> = [S & {
|
|
160
|
-
infinite: Infinite;
|
|
161
|
-
}, T];
|
|
162
|
-
type ServiceOperationQueryKey<S extends {
|
|
163
|
-
url: string;
|
|
164
|
-
method: string;
|
|
165
|
-
}, T> = ServiceOperationBaseQueryKey<S, false, T>;
|
|
166
|
-
type ServiceOperationInfiniteQueryKey<S extends {
|
|
167
|
-
url: string;
|
|
168
|
-
method: string;
|
|
169
|
-
}, T> = ServiceOperationBaseQueryKey<S, true, T>;
|
|
170
|
-
type ServiceOperationMutationKey<S extends Record<'url' | 'method', string>, T> = NonNullable<T> extends never ? [S] : [S, T];
|
|
171
|
-
|
|
172
|
-
type QueryTypeFilter = 'all' | 'active' | 'inactive';
|
|
173
|
-
interface QueryFiltersBase<TSchema extends {
|
|
174
|
-
url: string;
|
|
175
|
-
method: string;
|
|
176
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> {
|
|
177
|
-
/**
|
|
178
|
-
* Include queries matching this predicate function
|
|
179
|
-
*/
|
|
180
|
-
predicate?: TInfinite extends true ? QueryFilterInfinitePredicate<TSchema, TData, TParams, TError> : TInfinite extends false ? QueryFilterRegularPredicate<TSchema, TData, TParams, TError> : (query: string) => boolean;
|
|
181
|
-
/**
|
|
182
|
-
* Filter to active queries, inactive queries or all queries
|
|
183
|
-
*/
|
|
184
|
-
type?: QueryTypeFilter;
|
|
185
|
-
/**
|
|
186
|
-
* Include or exclude stale queries
|
|
187
|
-
*/
|
|
188
|
-
stale?: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Include queries matching their fetchStatus
|
|
191
|
-
*/
|
|
192
|
-
fetchStatus?: FetchStatus;
|
|
193
|
-
}
|
|
194
|
-
interface QueryFiltersByQueryKeyBase<TSchema extends {
|
|
195
|
-
url: string;
|
|
196
|
-
method: string;
|
|
197
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
198
|
-
infinite?: never;
|
|
199
|
-
parameters?: never;
|
|
200
|
-
}
|
|
201
|
-
interface QueryFiltersByExactQueryKey<TSchema extends {
|
|
202
|
-
url: string;
|
|
203
|
-
method: string;
|
|
204
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersByQueryKeyBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
205
|
-
/**
|
|
206
|
-
* Include queries matching this query key
|
|
207
|
-
*/
|
|
208
|
-
queryKey: ServiceOperationBaseQueryKey<TSchema, TInfinite, TParams>;
|
|
209
|
-
/**
|
|
210
|
-
* Match query key exactly
|
|
211
|
-
*/
|
|
212
|
-
exact: true;
|
|
213
|
-
}
|
|
214
|
-
interface QueryFiltersWeakExactQueryKey<TSchema extends {
|
|
215
|
-
url: string;
|
|
216
|
-
method: string;
|
|
217
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersByQueryKeyBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
218
|
-
/**
|
|
219
|
-
* Include queries matching this query key
|
|
220
|
-
*/
|
|
221
|
-
queryKey?: ServiceOperationBaseQueryKey<TSchema, TInfinite, PartialParameters<TParams>>;
|
|
222
|
-
/**
|
|
223
|
-
* Match query key exactly
|
|
224
|
-
*/
|
|
225
|
-
exact?: false;
|
|
226
|
-
}
|
|
227
|
-
type QueryFiltersByQueryKey<TSchema extends {
|
|
228
|
-
url: string;
|
|
229
|
-
method: string;
|
|
230
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> = QueryFiltersByExactQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersWeakExactQueryKey<TSchema, TData, TInfinite, TParams, TError>;
|
|
231
|
-
interface QueryFiltersByParametersBase<TSchema extends {
|
|
232
|
-
url: string;
|
|
233
|
-
method: string;
|
|
234
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
235
|
-
/**
|
|
236
|
-
* Is the query infinite
|
|
237
|
-
*/
|
|
238
|
-
infinite?: TInfinite;
|
|
239
|
-
queryKey?: never;
|
|
240
|
-
}
|
|
241
|
-
interface QueryFiltersByExactParameters<TSchema extends {
|
|
242
|
-
url: string;
|
|
243
|
-
method: string;
|
|
244
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersByParametersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
245
|
-
/**
|
|
246
|
-
* Match query key exactly
|
|
247
|
-
*/
|
|
248
|
-
exact: true;
|
|
249
|
-
/**
|
|
250
|
-
* Include queries matching parameters
|
|
251
|
-
*/
|
|
252
|
-
parameters: TParams;
|
|
253
|
-
}
|
|
254
|
-
interface QueryFiltersByWeakParameters<TSchema extends {
|
|
255
|
-
url: string;
|
|
256
|
-
method: string;
|
|
257
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> extends QueryFiltersByParametersBase<TSchema, TData, TInfinite, TParams, TError> {
|
|
258
|
-
/**
|
|
259
|
-
* Match query key exactly
|
|
260
|
-
*/
|
|
261
|
-
exact?: false;
|
|
262
|
-
/**
|
|
263
|
-
* Include queries matching parameters
|
|
264
|
-
*/
|
|
265
|
-
parameters?: PartialParameters<TParams>;
|
|
266
|
-
}
|
|
267
|
-
type QueryFiltersByParameters<TSchema extends {
|
|
268
|
-
url: string;
|
|
269
|
-
method: string;
|
|
270
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> = QueryFiltersByExactParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByWeakParameters<TSchema, TData, TInfinite, TParams, TError>;
|
|
271
|
-
interface QueryFilterInfinitePredicate<TSchema extends {
|
|
272
|
-
url: string;
|
|
273
|
-
method: string;
|
|
274
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
275
|
-
/**
|
|
276
|
-
* Include queries matching this predicate function
|
|
277
|
-
*/
|
|
278
|
-
(query: Query<OperationInfiniteData<TData, TParams>, TError, OperationInfiniteData<TData, TParams>, ServiceOperationInfiniteQueryKey<TSchema, TParams>>): boolean;
|
|
279
|
-
}
|
|
280
|
-
interface QueryFilterRegularPredicate<TSchema extends {
|
|
281
|
-
url: string;
|
|
282
|
-
method: string;
|
|
283
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
284
|
-
/**
|
|
285
|
-
* Include queries matching this predicate function
|
|
286
|
-
*/
|
|
287
|
-
(query: Query<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>): boolean;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
interface ServiceOperationCancelQueries<TSchema extends {
|
|
291
|
-
url: string;
|
|
292
|
-
method: string;
|
|
293
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
294
|
-
cancelQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, options: CancelOptions, queryClient: QueryClient$1): Promise<void>;
|
|
295
|
-
cancelQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): Promise<void>;
|
|
296
|
-
cancelQueries(queryClient: QueryClient$1): Promise<void>;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* @internal
|
|
300
|
-
*/
|
|
301
|
-
interface ServiceOperationCancelQueriesCallback<TSchema extends {
|
|
302
|
-
url: string;
|
|
303
|
-
method: string;
|
|
304
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationCancelQueries<TSchema, TData, TParams, TError> {
|
|
305
|
-
cancelQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, options?: CancelOptions | QueryClient$1, queryClient?: QueryClient$1): Promise<void>;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
interface ServiceOperationFetchInfiniteQuery<TSchema extends {
|
|
309
|
-
url: string;
|
|
310
|
-
method: string;
|
|
311
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
312
|
-
fetchInfiniteQuery<TPageParam extends TParams>(options: (FetchInfiniteQueryOptionsByQueryKey<TSchema, TData, TParams, TPageParam, TError> & FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>) | (FetchInfiniteQueryOptionsByParameters<TSchema, TData, TParams, TPageParam, TError> & FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>), queryClient: QueryClient$1): Promise<OperationInfiniteData<TData, TParams>>;
|
|
313
|
-
prefetchInfiniteQuery<TPageParam extends TParams>(options: (FetchInfiniteQueryOptionsByQueryKey<TSchema, TData, TParams, TPageParam, TError> & FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>) | (FetchInfiniteQueryOptionsByParameters<TSchema, TData, TParams, TPageParam, TError> & FetchInfiniteQueryOptionsQueryFn<TSchema, TData, TParams>), queryClient: QueryClient$1): Promise<void>;
|
|
314
|
-
}
|
|
315
|
-
type FetchInfiniteQueryPages<TData = unknown, TPageParam = unknown> = {
|
|
316
|
-
pages?: never;
|
|
317
|
-
} | {
|
|
318
|
-
pages: number;
|
|
319
|
-
getNextPageParam: GetNextPageParamFunction<PartialParameters<TPageParam>, TData>;
|
|
320
|
-
};
|
|
321
|
-
type FetchInfiniteQueryOptionsBase<TSchema extends {
|
|
322
|
-
url: string;
|
|
323
|
-
method: string;
|
|
324
|
-
}, TData, TParams = {}, TPageParam = unknown, TError = DefaultError> = Omit<FetchQueryOptions<TData, TError, OperationInfiniteData<TData, TParams>, ServiceOperationQueryKey<TSchema, TParams>, TPageParam>, 'queryKey'> & InitialPageParam<PartialParameters<TPageParam>> & FetchInfiniteQueryPages<TData, TPageParam>;
|
|
325
|
-
type FetchInfiniteQueryOptionsByQueryKey<TSchema extends {
|
|
326
|
-
url: string;
|
|
327
|
-
method: string;
|
|
328
|
-
}, TData, TParams = {}, TPageParam = {}, TError = DefaultError> = FetchInfiniteQueryOptionsBase<TSchema, TData, TParams, TPageParam, TError> & {
|
|
329
|
-
/**
|
|
330
|
-
* Fetch Queries by query key
|
|
331
|
-
*/
|
|
332
|
-
queryKey?: ServiceOperationInfiniteQueryKey<TSchema, TParams>;
|
|
333
|
-
parameters?: never;
|
|
334
|
-
};
|
|
335
|
-
type FetchInfiniteQueryOptionsByParameters<TSchema extends {
|
|
336
|
-
url: string;
|
|
337
|
-
method: string;
|
|
338
|
-
}, TData, TParams = {}, TPageParam = {}, TError = DefaultError> = FetchInfiniteQueryOptionsBase<TSchema, TData, TParams, TPageParam, TError> & {
|
|
339
|
-
/**
|
|
340
|
-
* Fetch Queries by parameters
|
|
341
|
-
*/
|
|
342
|
-
parameters?: TParams;
|
|
343
|
-
queryKey?: never;
|
|
344
|
-
};
|
|
345
|
-
type FetchInfiniteQueryOptionsQueryFn<TSchema extends {
|
|
346
|
-
url: string;
|
|
347
|
-
method: string;
|
|
348
|
-
}, TData, TParams = {}> = {
|
|
349
|
-
queryFn?: QueryFunction<TData, ServiceOperationInfiniteQueryKey<TSchema, TParams>>;
|
|
350
|
-
} | {
|
|
351
|
-
requestFn: RequestFn$1<TData>;
|
|
352
|
-
/**
|
|
353
|
-
* Base URL to use for the request (used in the `queryFn`)
|
|
354
|
-
* @example 'https://api.example.com'
|
|
355
|
-
*/
|
|
356
|
-
baseUrl: string | undefined;
|
|
357
|
-
queryFn?: never;
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
interface ServiceOperationFetchQuery<TSchema extends {
|
|
361
|
-
url: string;
|
|
362
|
-
method: string;
|
|
363
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
364
|
-
fetchQuery(options: (FetchQueryOptionsByQueryKey<TSchema, TData, TParams, TError> & FetchQueryOptionsQueryFn<TSchema, TData, TParams>) | (FetchQueryOptionsByParameters<TSchema, TData, TParams, TError> & FetchQueryOptionsQueryFn<TSchema, TData, TParams>), queryClient: QueryClient$1): Promise<TData>;
|
|
365
|
-
prefetchQuery(options: (FetchQueryOptionsByQueryKey<TSchema, TData, TParams, TError> & FetchQueryOptionsQueryFn<TSchema, TData, TParams>) | (FetchQueryOptionsByParameters<TSchema, TData, TParams, TError> & FetchQueryOptionsQueryFn<TSchema, TData, TParams>), queryClient: QueryClient$1): Promise<void>;
|
|
366
|
-
}
|
|
367
|
-
type FetchQueryOptionsBase<TSchema extends {
|
|
368
|
-
url: string;
|
|
369
|
-
method: string;
|
|
370
|
-
}, TData, TParams = {}, TError = DefaultError> = Omit<FetchQueryOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey' | 'queryFn'>;
|
|
371
|
-
interface FetchQueryOptionsByQueryKey<TSchema extends {
|
|
372
|
-
url: string;
|
|
373
|
-
method: string;
|
|
374
|
-
}, TData, TParams = {}, TError = DefaultError> extends FetchQueryOptionsBase<TSchema, TData, TParams, TError> {
|
|
375
|
-
/**
|
|
376
|
-
* Fetch Queries by query key
|
|
377
|
-
*/
|
|
378
|
-
queryKey?: ServiceOperationQueryKey<TSchema, TParams>;
|
|
379
|
-
}
|
|
380
|
-
interface FetchQueryOptionsByParameters<TSchema extends {
|
|
381
|
-
url: string;
|
|
382
|
-
method: string;
|
|
383
|
-
}, TData, TParams = {}, TError = DefaultError> extends FetchQueryOptionsBase<TSchema, TData, TParams, TError> {
|
|
384
|
-
/**
|
|
385
|
-
* Fetch Queries by parameters
|
|
386
|
-
*/
|
|
387
|
-
parameters?: TParams;
|
|
388
|
-
queryKey?: never;
|
|
389
|
-
}
|
|
390
|
-
type FetchQueryOptionsQueryFn<TSchema extends {
|
|
391
|
-
url: string;
|
|
392
|
-
method: string;
|
|
393
|
-
}, TData, TParams = {}> = {
|
|
394
|
-
queryFn?: QueryFunction<TData, ServiceOperationQueryKey<TSchema, TParams>>;
|
|
395
|
-
} | {
|
|
396
|
-
requestFn: RequestFn$1<TData>;
|
|
397
|
-
/**
|
|
398
|
-
* Base URL to use for the request (used in the `queryFn`)
|
|
399
|
-
* @example 'https://api.example.com'
|
|
400
|
-
*/
|
|
401
|
-
baseUrl: string | undefined;
|
|
402
|
-
queryFn?: never;
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
interface ServiceOperationGetInfiniteQueryData<TSchema extends {
|
|
406
|
-
url: string;
|
|
407
|
-
method: string;
|
|
408
|
-
}, TData, TParams = {}> {
|
|
409
|
-
getInfiniteQueryData(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, queryClient: QueryClient$1): OperationInfiniteData<TData, TParams> | undefined;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface ServiceOperationGetQueriesData<TSchema extends {
|
|
413
|
-
url: string;
|
|
414
|
-
method: string;
|
|
415
|
-
}, TData, TParams = {}, // todo::try to replace `TParams = {}` with `TParams = undefined`
|
|
416
|
-
TError = DefaultError> {
|
|
417
|
-
getQueriesData<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): TInfinite extends true ? Array<[
|
|
418
|
-
queryKey: ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
419
|
-
data: NoInfer<OperationInfiniteData<TData, TParams>> | undefined
|
|
420
|
-
]> : Array<[
|
|
421
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>,
|
|
422
|
-
data: TData | undefined
|
|
423
|
-
]>;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
interface ServiceOperationGetQueryData<TSchema extends {
|
|
427
|
-
url: string;
|
|
428
|
-
method: string;
|
|
429
|
-
}, TData, TParams = {}> {
|
|
430
|
-
getQueryData(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, queryClient: QueryClient$1): TData | undefined;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
interface ServiceOperationGetQueryState<TSchema extends {
|
|
434
|
-
url: string;
|
|
435
|
-
method: string;
|
|
436
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
437
|
-
getQueryState(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, queryClient: QueryClient$1): QueryState<TData, TError> | undefined;
|
|
438
|
-
getInfiniteQueryState(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, queryClient: QueryClient$1): QueryState<OperationInfiniteData<TData, TParams>, TError> | undefined;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
type InvalidateQueryFilters<TSchema extends {
|
|
442
|
-
url: string;
|
|
443
|
-
method: string;
|
|
444
|
-
}, TData, TInfinite extends boolean, TParams = {}, TError = DefaultError> = (QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>) & {
|
|
445
|
-
refetchType?: QueryTypeFilter | 'none';
|
|
446
|
-
};
|
|
447
|
-
interface ServiceOperationInvalidateQueries<TSchema extends {
|
|
448
|
-
url: string;
|
|
449
|
-
method: string;
|
|
450
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
451
|
-
invalidateQueries<TInfinite extends boolean>(filters: InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError>, options: InvalidateOptions, queryClient: QueryClient$1): Promise<void>;
|
|
452
|
-
invalidateQueries<TInfinite extends boolean>(filters: InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): Promise<void>;
|
|
453
|
-
invalidateQueries(queryClient: QueryClient$1): Promise<void>;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* @internal
|
|
457
|
-
*/
|
|
458
|
-
interface ServiceOperationInvalidateQueriesCallback<TSchema extends {
|
|
459
|
-
url: string;
|
|
460
|
-
method: string;
|
|
461
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError> {
|
|
462
|
-
invalidateQueries<TInfinite extends boolean>(filters: InvalidateQueryFilters<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, options?: InvalidateOptions | QueryClient$1, queryClient?: QueryClient$1): Promise<void>;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
interface ServiceOperationIsFetchingQueries<TSchema extends {
|
|
466
|
-
url: string;
|
|
467
|
-
method: string;
|
|
468
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
469
|
-
isFetching<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): number;
|
|
470
|
-
isFetching(queryClient: QueryClient$1): number;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* @internal
|
|
474
|
-
*/
|
|
475
|
-
interface ServiceOperationIsFetchingQueriesCallback<TSchema extends {
|
|
476
|
-
url: string;
|
|
477
|
-
method: string;
|
|
478
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {
|
|
479
|
-
refetchQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, queryClient?: QueryClient$1): number;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
interface ServiceOperationUseMutation<TSchema extends {
|
|
483
|
-
url: string;
|
|
484
|
-
method: string;
|
|
485
|
-
}, TBody, TData, TParams, TError = DefaultError> {
|
|
486
|
-
getMutationKey<TMutationKeyParams extends TParams | undefined = undefined>(parameters?: TMutationKeyParams): ServiceOperationMutationKey<TSchema, TMutationKeyParams>;
|
|
487
|
-
useMutation<TVariables extends MutationVariables<TBody, TParams>, TContext = unknown>(parameters?: undefined, options?: Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'mutationKey'> & {
|
|
488
|
-
mutationKey?: ServiceOperationMutationKey<TSchema, TParams>;
|
|
489
|
-
}, queryClient?: QueryClient$1): UseMutationResult<TData, TError | Error, TVariables, TContext>;
|
|
490
|
-
useMutation<TVariables extends TBody, TContext = unknown>(parameters: TParams, options?: Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'mutationKey'>, queryClient?: QueryClient$1): UseMutationResult<TData, TError | Error, TVariables, TContext>;
|
|
491
|
-
}
|
|
492
|
-
type MutationVariables<TBody, TParams> = {
|
|
493
|
-
body: TBody;
|
|
494
|
-
} & (NonNullable<TParams> extends never ? {} : TParams);
|
|
495
|
-
|
|
496
|
-
interface UseMutationStateFiltersBase<TBody, TData, TParams, TError = DefaultError, TContext = unknown> {
|
|
497
|
-
/**
|
|
498
|
-
* Match mutation key exactly
|
|
499
|
-
*/
|
|
500
|
-
exact?: boolean;
|
|
501
|
-
/**
|
|
502
|
-
* Include mutations matching this predicate function
|
|
503
|
-
*/
|
|
504
|
-
predicate?: (mutation: Mutation<TData, TError, MutationVariables<TBody, TParams>, TContext>) => boolean;
|
|
505
|
-
/**
|
|
506
|
-
* Filter by mutation status
|
|
507
|
-
*/
|
|
508
|
-
status?: MutationStatus;
|
|
509
|
-
}
|
|
510
|
-
interface MutationFiltersByParameters<TBody, TData, TParams, TError = DefaultError, TContext = unknown> extends UseMutationStateFiltersBase<TBody, TData, TParams, TError, TContext> {
|
|
511
|
-
/**
|
|
512
|
-
* Include mutations matching these parameters
|
|
513
|
-
*/
|
|
514
|
-
parameters?: PartialParameters<TParams>;
|
|
515
|
-
mutationKey?: never;
|
|
516
|
-
}
|
|
517
|
-
interface MutationFiltersByMutationKey<TSchema extends {
|
|
518
|
-
url: string;
|
|
519
|
-
method: string;
|
|
520
|
-
}, TBody, TData, TParams, TError = DefaultError, TContext = unknown> extends UseMutationStateFiltersBase<TBody, TData, TParams, TError, TContext> {
|
|
521
|
-
/**
|
|
522
|
-
* Include mutations matching this mutation key
|
|
523
|
-
*/
|
|
524
|
-
mutationKey?: ServiceOperationMutationKey<TSchema, PartialParameters<TParams>>;
|
|
525
|
-
parameters?: never;
|
|
526
|
-
}
|
|
527
|
-
interface ServiceOperationUseMutationState<TSchema extends {
|
|
528
|
-
url: string;
|
|
529
|
-
method: string;
|
|
530
|
-
}, TBody, TData, TParams, TError = DefaultError> {
|
|
531
|
-
useMutationState<TContext = unknown, TResult = MutationState<TData, TError, MutationVariables<TBody, TParams>, TContext>>(options?: {
|
|
532
|
-
filters?: MutationFiltersByParameters<TBody, TData, TParams, TError, TContext> | MutationFiltersByMutationKey<TSchema, TBody, TData, TParams, TError, TContext>;
|
|
533
|
-
select?: (mutation: Mutation<TData, TError, MutationVariables<TBody, TParams>, TContext>) => TResult;
|
|
534
|
-
}, queryClient?: QueryClient$1): Array<TResult>;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
interface ServiceOperationIsMutatingQueries<TSchema extends {
|
|
538
|
-
url: string;
|
|
539
|
-
method: string;
|
|
540
|
-
}, TBody, TData, TParams = {}, TError = DefaultError> {
|
|
541
|
-
isMutating<TContext>(filters: MutationFiltersByParameters<TBody, TData, TParams, TError, TContext> | MutationFiltersByMutationKey<TSchema, TBody, TData, TParams, TError, TContext>, queryClient: QueryClient$1): number;
|
|
542
|
-
isMutating(queryClient: QueryClient$1): number;
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* @internal
|
|
546
|
-
*/
|
|
547
|
-
interface ServiceOperationIsMutatingQueriesCallback<TSchema extends {
|
|
548
|
-
url: string;
|
|
549
|
-
method: string;
|
|
550
|
-
}, TBody, TData, TParams = {}, TError = DefaultError> extends ServiceOperationIsMutatingQueries<TSchema, TBody, TData, TParams, TError> {
|
|
551
|
-
isMutating<TContext>(filters: MutationFiltersByParameters<TBody, TData, TParams, TError, TContext> | MutationFiltersByMutationKey<TSchema, TBody, TData, TParams, TError, TContext> | QueryClient$1, queryClient?: QueryClient$1): number;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
interface QueryFnBaseUrlOptions$1 {
|
|
555
|
-
/**
|
|
556
|
-
* Base URL to use for the request
|
|
557
|
-
* @example 'https://api.example.com'
|
|
558
|
-
*/
|
|
559
|
-
baseUrl: string;
|
|
560
|
-
}
|
|
561
|
-
interface ServiceOperationMutationFnOptionsBase<TBody, TParams> {
|
|
562
|
-
parameters: TParams;
|
|
563
|
-
body: TBody;
|
|
564
|
-
}
|
|
565
|
-
interface ServiceOperationMutationFnOptions<TBody, TParams> extends ServiceOperationMutationFnOptionsBase<TBody, TParams> {
|
|
566
|
-
baseUrl?: never;
|
|
567
|
-
}
|
|
568
|
-
interface ServiceOperationMutationFnOptionsWithBaseUrl<TBody, TParams> extends ServiceOperationMutationFnOptionsBase<TBody, TParams>, QueryFnBaseUrlOptions$1 {
|
|
569
|
-
}
|
|
570
|
-
interface ServiceOperationMutationFn<TSchema extends {
|
|
571
|
-
url: string;
|
|
572
|
-
method: string;
|
|
573
|
-
}, TBody, TData, TParams> {
|
|
574
|
-
/**
|
|
575
|
-
* @deprecated Use `<service>.<operation>(...)` instead.
|
|
576
|
-
*/
|
|
577
|
-
mutationFn(client: (schema: TSchema, options: {
|
|
578
|
-
parameters: TParams;
|
|
579
|
-
body: TBody;
|
|
580
|
-
}) => TData, options: {
|
|
581
|
-
parameters: TParams;
|
|
582
|
-
body: TBody;
|
|
583
|
-
}): TData;
|
|
584
|
-
/**
|
|
585
|
-
* @deprecated Use `<service>.<operation>(...)` instead.
|
|
586
|
-
*/
|
|
587
|
-
mutationFn(client: (schema: TSchema, options: {
|
|
588
|
-
parameters: TParams;
|
|
589
|
-
body: TBody;
|
|
590
|
-
}) => Promise<TData>, options: {
|
|
591
|
-
parameters: TParams;
|
|
592
|
-
body: TBody;
|
|
593
|
-
}): Promise<TData>;
|
|
594
|
-
<TOptions extends ServiceOperationMutationFnOptions<TBody, TParams>>(options: TOptions, client: (schema: TSchema, options: TOptions) => TData): TData;
|
|
595
|
-
<TOptions extends ServiceOperationMutationFnOptionsWithBaseUrl<TBody, TParams>>(options: TOptions, client: (schema: TSchema, options: TOptions) => TData): TData;
|
|
596
|
-
<TOptions extends ServiceOperationMutationFnOptions<TBody, TParams>>(options: TOptions, client: (schema: TSchema, options: TOptions) => Promise<TData>): Promise<TData>;
|
|
597
|
-
<TOptions extends ServiceOperationMutationFnOptionsWithBaseUrl<TBody, TParams>>(options: TOptions, client: (schema: TSchema, options: TOptions) => Promise<TData>): Promise<TData>;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
interface QueryFnOptionsBase<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal> {
|
|
601
|
-
signal?: TSignal;
|
|
602
|
-
meta?: TMeta;
|
|
603
|
-
}
|
|
604
|
-
interface QueryFnOptionsByParameters<TParams, TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal> extends QueryFnOptionsBase<TMeta, TSignal> {
|
|
605
|
-
parameters: TParams;
|
|
606
|
-
queryKey?: never;
|
|
607
|
-
baseUrl?: never;
|
|
608
|
-
}
|
|
609
|
-
interface QueryFnOptionsByParametersWithBaseUrl<TParams, TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal> extends QueryFnOptionsBase<TMeta, TSignal>, QueryFnBaseUrlOptions {
|
|
610
|
-
parameters: TParams;
|
|
611
|
-
queryKey?: never;
|
|
612
|
-
}
|
|
613
|
-
interface QueryFnOptionsByQueryKey<TSchema extends {
|
|
614
|
-
url: string;
|
|
615
|
-
method: string;
|
|
616
|
-
}, TParams, TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal> extends QueryFnOptionsBase<TMeta, TSignal> {
|
|
617
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
618
|
-
parameters?: never;
|
|
619
|
-
baseUrl?: never;
|
|
620
|
-
}
|
|
621
|
-
interface QueryFnOptionsByQueryKeyWithBaseUrl<TSchema extends {
|
|
622
|
-
url: string;
|
|
623
|
-
method: string;
|
|
624
|
-
}, TParams, TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal> extends QueryFnOptionsBase<TMeta, TSignal>, QueryFnBaseUrlOptions {
|
|
625
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
626
|
-
parameters?: never;
|
|
627
|
-
}
|
|
628
|
-
interface QueryFnBaseUrlOptions {
|
|
629
|
-
/**
|
|
630
|
-
* Base URL to use for the request
|
|
631
|
-
* @example 'https://api.example.com'
|
|
632
|
-
*/
|
|
633
|
-
baseUrl: string;
|
|
634
|
-
}
|
|
635
|
-
interface ServiceOperationQueryFn<TSchema extends {
|
|
636
|
-
url: string;
|
|
637
|
-
method: string;
|
|
638
|
-
}, TData, TParams> {
|
|
639
|
-
/**
|
|
640
|
-
* @deprecated Use `<service>.<operation>(...)` instead.
|
|
641
|
-
*/
|
|
642
|
-
queryFn<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParameters<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
643
|
-
parameters: TParams;
|
|
644
|
-
signal?: TSignal;
|
|
645
|
-
meta?: TMeta;
|
|
646
|
-
}) => TData): TData;
|
|
647
|
-
/**
|
|
648
|
-
* @deprecated Use `<service>.<operation>(...)` instead.
|
|
649
|
-
*/
|
|
650
|
-
queryFn<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParameters<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
651
|
-
parameters: TParams;
|
|
652
|
-
signal?: TSignal;
|
|
653
|
-
meta?: TMeta;
|
|
654
|
-
}) => Promise<TData>): Promise<TData>;
|
|
655
|
-
<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParameters<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
656
|
-
parameters: TParams;
|
|
657
|
-
signal?: TSignal;
|
|
658
|
-
meta?: TMeta;
|
|
659
|
-
}) => TData): TData;
|
|
660
|
-
<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParametersWithBaseUrl<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKeyWithBaseUrl<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
661
|
-
parameters: TParams;
|
|
662
|
-
signal?: TSignal;
|
|
663
|
-
meta?: TMeta;
|
|
664
|
-
} & QueryFnBaseUrlOptions) => TData): TData;
|
|
665
|
-
<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParameters<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKey<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
666
|
-
parameters: TParams;
|
|
667
|
-
signal?: TSignal;
|
|
668
|
-
meta?: TMeta;
|
|
669
|
-
}) => Promise<TData>): Promise<TData>;
|
|
670
|
-
<TMeta extends Record<string, any>, TSignal extends AbortSignal = AbortSignal>(options: QueryFnOptionsByParametersWithBaseUrl<TParams, TMeta, TSignal> | QueryFnOptionsByQueryKeyWithBaseUrl<TSchema, TParams, TMeta, TSignal>, client: (schema: TSchema, options: {
|
|
671
|
-
parameters: TParams;
|
|
672
|
-
signal?: TSignal;
|
|
673
|
-
meta?: TMeta;
|
|
674
|
-
} & QueryFnBaseUrlOptions) => Promise<TData>): Promise<TData>;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
interface ServiceOperationResetQueries<TSchema extends {
|
|
678
|
-
url: string;
|
|
679
|
-
method: string;
|
|
680
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
681
|
-
resetQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, options: ResetOptions, queryClient: QueryClient$1): Promise<void>;
|
|
682
|
-
resetQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): Promise<void>;
|
|
683
|
-
resetQueries(queryClient: QueryClient$1): Promise<void>;
|
|
684
|
-
}
|
|
685
|
-
/**
|
|
686
|
-
* @internal
|
|
687
|
-
*/
|
|
688
|
-
interface ServiceOperationResetQueriesCallback<TSchema extends {
|
|
689
|
-
url: string;
|
|
690
|
-
method: string;
|
|
691
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationResetQueries<TSchema, TData, TParams, TError> {
|
|
692
|
-
resetQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, options?: ResetOptions | QueryClient$1, queryClient?: QueryClient$1): Promise<void>;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
interface ServiceOperationRefetchQueries<TSchema extends {
|
|
696
|
-
url: string;
|
|
697
|
-
method: string;
|
|
698
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
699
|
-
refetchQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, options: RefetchOptions, queryClient: QueryClient$1): Promise<void>;
|
|
700
|
-
refetchQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): Promise<void>;
|
|
701
|
-
refetchQueries(queryClient: QueryClient$1): Promise<void>;
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* @internal
|
|
705
|
-
*/
|
|
706
|
-
interface ServiceOperationRefetchQueriesCallback<TSchema extends {
|
|
707
|
-
url: string;
|
|
708
|
-
method: string;
|
|
709
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationRefetchQueries<TSchema, TData, TParams, TError> {
|
|
710
|
-
refetchQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, options?: RefetchOptions | QueryClient$1, queryClient?: QueryClient$1): Promise<void>;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
interface ServiceOperationRemoveQueries<TSchema extends {
|
|
714
|
-
url: string;
|
|
715
|
-
method: string;
|
|
716
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
717
|
-
removeQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient: QueryClient$1): void;
|
|
718
|
-
removeQueries(queryClient: QueryClient$1): void;
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* @internal
|
|
722
|
-
*/
|
|
723
|
-
interface ServiceOperationRemoveQueriesCallback<TSchema extends {
|
|
724
|
-
url: string;
|
|
725
|
-
method: string;
|
|
726
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationRemoveQueries<TSchema, TData, TParams, TError> {
|
|
727
|
-
removeQueries<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError> | QueryClient$1, queryClient?: QueryClient$1): void;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
interface ServiceOperationSetInfiniteQueryData<TSchema extends {
|
|
731
|
-
url: string;
|
|
732
|
-
method: string;
|
|
733
|
-
}, TData, TParams = {}> {
|
|
734
|
-
setInfiniteQueryData(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, updater: Updater<NoInfer<OperationInfiniteData<TData, TParams>> | undefined, NoInfer<OperationInfiniteData<TData, TParams>> | undefined>, queryClient: QueryClient$1, options?: SetDataOptions): OperationInfiniteData<TData, TParams> | undefined;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
interface ServiceOperationSetQueriesData<TSchema extends {
|
|
738
|
-
url: string;
|
|
739
|
-
method: string;
|
|
740
|
-
}, TData, TParams = {}, // todo::try to replace `TParams = {}` with `TParams = undefined`
|
|
741
|
-
TError = DefaultError> {
|
|
742
|
-
setQueriesData<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, options: SetDataOptions, queryClient: QueryClient$1): Array<TData | undefined>;
|
|
743
|
-
setQueriesData<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, queryClient: QueryClient$1): Array<TData | undefined>;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* @internal
|
|
747
|
-
*/
|
|
748
|
-
interface ServiceOperationSetQueriesDataCallback<TSchema extends {
|
|
749
|
-
url: string;
|
|
750
|
-
method: string;
|
|
751
|
-
}, TData, TParams = {}, TError = DefaultError> extends ServiceOperationSetQueriesData<TSchema, TData, TParams, TError> {
|
|
752
|
-
setQueriesData<TInfinite extends boolean>(filters: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, options: SetDataOptions | QueryClient$1, queryClient?: QueryClient$1): Array<TData | undefined>;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
interface ServiceOperationSetQueryData<TSchema extends {
|
|
756
|
-
url: string;
|
|
757
|
-
method: string;
|
|
758
|
-
}, TData, TParams = {}> {
|
|
759
|
-
setQueryData(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, options: SetDataOptions, queryClient: QueryClient$1): TData | undefined;
|
|
760
|
-
setQueryData(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, queryClient: QueryClient$1): TData | undefined;
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* @internal
|
|
764
|
-
*/
|
|
765
|
-
interface ServiceOperationSetQueryDataCallback<TSchema extends {
|
|
766
|
-
url: string;
|
|
767
|
-
method: string;
|
|
768
|
-
}, TData, TParams = {}> extends ServiceOperationSetQueryData<TSchema, TData, TParams> {
|
|
769
|
-
setQueryData(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, updater: Updater<NoInfer<TData> | undefined, NoInfer<TData> | undefined>, options: SetDataOptions | QueryClient$1, queryClient?: QueryClient$1): TData | undefined;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
interface ServiceOperationUseInfiniteQuery<TSchema extends {
|
|
773
|
-
url: string;
|
|
774
|
-
method: string;
|
|
775
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
776
|
-
getInfiniteQueryKey<TQueryKeyParams extends TParams>(parameters: TQueryKeyParams): ServiceOperationInfiniteQueryKey<TSchema, TQueryKeyParams>;
|
|
777
|
-
useInfiniteQuery<TPageParam extends TParams>(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, options: Omit<UndefinedInitialDataInfiniteOptions<TData, TError, OperationInfiniteData<TData, TParams>, ServiceOperationInfiniteQueryKey<TSchema, TParams>, PartialParameters<TPageParam>>, 'queryKey' | 'getPreviousPageParam' | 'getNextPageParam' | 'initialPageParam'> & InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>, queryClient?: QueryClient$1): UseInfiniteQueryResult<OperationInfiniteData<TData, TParams>, TError | Error>;
|
|
778
|
-
useInfiniteQuery<TPageParam extends TParams>(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, options: Omit<DefinedInitialDataInfiniteOptions<TData, TError, OperationInfiniteData<TData, TParams>, ServiceOperationInfiniteQueryKey<TSchema, TParams>, PartialParameters<TPageParam>>, 'queryKey' | 'getPreviousPageParam' | 'getNextPageParam' | 'initialPageParam'> & InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>, queryClient?: QueryClient$1): DefinedUseInfiniteQueryResult<OperationInfiniteData<TData, TParams>, TError | Error>;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
interface ServiceOperationUseIsFetchingQueries<TSchema extends {
|
|
782
|
-
url: string;
|
|
783
|
-
method: string;
|
|
784
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
785
|
-
useIsFetching<TInfinite extends boolean>(filters?: QueryFiltersByParameters<TSchema, TData, TInfinite, TParams, TError> | QueryFiltersByQueryKey<TSchema, TData, TInfinite, TParams, TError>, queryClient?: QueryClient$1): number;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
interface ServiceOperationUseIsMutating<TSchema extends {
|
|
789
|
-
url: string;
|
|
790
|
-
method: string;
|
|
791
|
-
}, TBody, TData, TParams, TError = DefaultError> {
|
|
792
|
-
useIsMutating<TContext = unknown>(filters?: MutationFiltersByParameters<TBody, TData, TParams, TError, TContext> | MutationFiltersByMutationKey<TSchema, TBody, TData, TParams, TError, TContext>, queryClient?: QueryClient$1): number;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
interface ServiceOperationUseQueries<TSchema extends {
|
|
796
|
-
url: string;
|
|
797
|
-
method: string;
|
|
798
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
799
|
-
useQueries<TCombinedResult = Array<UseQueryResult<TData, TError>>>(options: {
|
|
800
|
-
queries: ReadonlyArray<Omit<UseQueryOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'placeholderData' | 'suspense' | 'queryKey'> & {
|
|
801
|
-
placeholderData?: TData | QueriesPlaceholderDataFunction<TData>;
|
|
802
|
-
} & ({
|
|
803
|
-
parameters: TParams;
|
|
804
|
-
queryKey?: never;
|
|
805
|
-
} | {
|
|
806
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
807
|
-
})>;
|
|
808
|
-
combine?: (results: Array<UseQueryResult<TData, TError>>) => TCombinedResult;
|
|
809
|
-
}, queryClient?: QueryClient$1): TCombinedResult;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
interface ServiceOperationUseQuery<TSchema extends {
|
|
813
|
-
url: string;
|
|
814
|
-
method: string;
|
|
815
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
816
|
-
getQueryKey<QueryKeyParams extends TParams | undefined = undefined>(parameters?: QueryKeyParams): ServiceOperationQueryKey<TSchema, QueryKeyParams>;
|
|
817
|
-
useQuery(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, options?: Omit<UndefinedInitialDataOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey'>, queryClient?: QueryClient$1): UseQueryResult<TData, TError | Error>;
|
|
818
|
-
useQuery(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, options: Omit<DefinedInitialDataOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey'>, queryClient?: QueryClient$1): DefinedUseQueryResult<TData, TError | Error>;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
interface ServiceOperationUseSuspenseInfiniteQuery<TSchema extends {
|
|
822
|
-
url: string;
|
|
823
|
-
method: string;
|
|
824
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
825
|
-
useSuspenseInfiniteQuery<TPageParam extends TParams>(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>, options: Omit<UseSuspenseInfiniteQueryOptions<TData, TError, OperationInfiniteData<TData, TParams>, TData, ServiceOperationInfiniteQueryKey<TSchema, TParams>, PartialParameters<TPageParam>>, 'queryKey' | 'getPreviousPageParam' | 'getNextPageParam' | 'initialPageParam'> & InfiniteQueryPageParamsOptions<TData, PartialParameters<TPageParam>>, queryClient?: QueryClient$1): UseSuspenseInfiniteQueryResult<OperationInfiniteData<TData, TParams>, TError | Error>;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
interface ServiceOperationUseSuspenseQueries<TSchema extends {
|
|
829
|
-
url: string;
|
|
830
|
-
method: string;
|
|
831
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
832
|
-
useSuspenseQueries<TCombinedResult = Array<UseSuspenseQueryResult<TData, TError>>>(options: {
|
|
833
|
-
queries: ReadonlyArray<Omit<UseSuspenseQueryOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey'> & ({
|
|
834
|
-
parameters: TParams;
|
|
835
|
-
queryKey?: never;
|
|
836
|
-
} | {
|
|
837
|
-
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
838
|
-
})>;
|
|
839
|
-
combine?: (results: Array<UseSuspenseQueryResult<TData, TError>>) => TCombinedResult;
|
|
840
|
-
}, queryClient?: QueryClient$1): TCombinedResult;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
interface ServiceOperationUseSuspenseQueryQuery<TSchema extends {
|
|
844
|
-
url: string;
|
|
845
|
-
method: string;
|
|
846
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
847
|
-
useSuspenseQuery(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, options?: Omit<UseSuspenseQueryOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey'>, queryClient?: QueryClient$1): UseSuspenseQueryResult<TData, TError | Error>;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
interface ServiceOperationQuery<TSchema extends {
|
|
851
|
-
url: string;
|
|
852
|
-
method: string;
|
|
853
|
-
}, TData, TParams, TError = DefaultError> extends ServiceOperationUseQuery<TSchema, TData, TParams, TError>, ServiceOperationUseQueries<TSchema, TData, TParams, TError>, ServiceOperationUseSuspenseQueries<TSchema, TData, TParams, TError>, ServiceOperationUseInfiniteQuery<TSchema, TData, TParams, TError>, ServiceOperationUseSuspenseQueryQuery<TSchema, TData, TParams, TError>, ServiceOperationUseSuspenseInfiniteQuery<TSchema, TData, TParams, TError>, ServiceOperationUseIsFetchingQueries<TSchema, TData, TParams, TError>, ServiceOperationQueryFn<TSchema, TData, TParams>, ServiceOperationFetchQuery<TSchema, TData, TParams, TError>, ServiceOperationFetchInfiniteQuery<TSchema, TData, TParams, TError>, ServiceOperationGetQueryData<TSchema, TData, TParams>, ServiceOperationGetQueryState<TSchema, TData, TParams, TError>, ServiceOperationGetQueriesData<TSchema, TData, TParams, TError>, ServiceOperationGetInfiniteQueryData<TSchema, TData, TParams>, ServiceOperationSetQueryData<TSchema, TData, TParams>, ServiceOperationSetQueriesData<TSchema, TData, TParams, TError>, ServiceOperationSetInfiniteQueryData<TSchema, TData, TParams>, ServiceOperationInvalidateQueries<TSchema, TData, TParams, TError>, ServiceOperationCancelQueries<TSchema, TData, TParams, TError>, ServiceOperationRemoveQueries<TSchema, TData, TParams, TError>, ServiceOperationResetQueries<TSchema, TData, TParams, TError>, ServiceOperationRefetchQueries<TSchema, TData, TParams, TError>, ServiceOperationIsFetchingQueries<TSchema, TData, TParams, TError> {
|
|
854
|
-
schema: TSchema;
|
|
855
|
-
types: {
|
|
856
|
-
parameters: TParams;
|
|
857
|
-
data: TData;
|
|
858
|
-
error: TError;
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
interface ServiceOperationMutation<TSchema extends {
|
|
862
|
-
url: string;
|
|
863
|
-
method: string;
|
|
864
|
-
}, TBody, TData, TParams, TError = DefaultError> extends ServiceOperationUseMutation<TSchema, TBody, TData, TParams, TError>, ServiceOperationUseIsMutating<TSchema, TBody, TData, TParams, TError>, ServiceOperationUseMutationState<TSchema, TBody, TData, TParams, TError>, ServiceOperationIsMutatingQueries<TSchema, TBody, TData, TParams, TError>, ServiceOperationMutationFn<TSchema, TBody, TData, TParams> {
|
|
865
|
-
schema: TSchema;
|
|
866
|
-
types: {
|
|
867
|
-
parameters: TParams;
|
|
868
|
-
data: TData;
|
|
869
|
-
error: TError;
|
|
870
|
-
body: TBody;
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
declare function getInfiniteQueryData<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['getInfiniteQueryData']>): InfiniteData<TData> | undefined;
|
|
875
|
-
|
|
876
|
-
declare const getInfiniteQueryKey: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['getInfiniteQueryKey']>) => ServiceOperationInfiniteQueryKey<OperationSchema, unknown>;
|
|
877
|
-
|
|
878
|
-
declare const getMutationKey: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, unknown, unknown, unknown>['getMutationKey']>) => [OperationSchema, unknown];
|
|
879
|
-
|
|
880
|
-
declare function getQueryData<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['getQueryData']>): TData | undefined;
|
|
881
|
-
|
|
882
|
-
declare function getQueriesData<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['getQueriesData']>): TData | undefined;
|
|
883
|
-
|
|
884
|
-
declare const getQueryKey: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['getQueryKey']>) => ServiceOperationQueryKey<OperationSchema, unknown>;
|
|
885
|
-
|
|
886
|
-
declare const mutationFn: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: unknown) => Promise<unknown>;
|
|
887
|
-
|
|
888
|
-
declare const queryFn: <TSchema extends {
|
|
889
|
-
url: string;
|
|
890
|
-
method: 'get' | 'head' | 'options';
|
|
891
|
-
}, TData, TParams>(qraftOptions: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQuery<TSchema, TData, TParams>['queryFn']>) => Promise<TData>;
|
|
892
|
-
|
|
893
|
-
declare function setInfiniteQueryData<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['setInfiniteQueryData']>): InfiniteData<TData> | undefined;
|
|
894
|
-
|
|
895
|
-
declare function setQueryData<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationSetQueryDataCallback<OperationSchema, unknown, TData>['setQueryData']>): TData | undefined;
|
|
896
|
-
|
|
897
|
-
declare function setQueriesData<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationSetQueriesDataCallback<OperationSchema, unknown, TData>['setQueriesData']>): TData | undefined;
|
|
898
|
-
|
|
899
|
-
declare const useInfiniteQuery: <TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useInfiniteQuery']>) => UseInfiniteQueryResult<TData, TError>;
|
|
900
|
-
|
|
901
|
-
declare const useMutation: <TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, object | undefined, TVariables, TData>['useMutation']>) => UseMutationResult<TData, TError, TVariables, TContext>;
|
|
902
|
-
|
|
903
|
-
declare const useQuery: <TData = unknown, TError = DefaultError>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useQuery']>) => UseQueryResult<TData, TError>;
|
|
904
|
-
|
|
905
|
-
declare const useSuspenseQuery: <TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useSuspenseQuery']>) => UseQueryResult<TData, TError>;
|
|
906
|
-
|
|
907
|
-
declare const useSuspenseInfiniteQuery: <TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useSuspenseInfiniteQuery']>) => UseSuspenseInfiniteQueryResult<TData, TError>;
|
|
908
|
-
|
|
909
|
-
declare const useMutationState: <TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, object | undefined, TVariables, TData>['useMutationState']>) => UseMutationResult<TData, TError, TVariables, TContext>;
|
|
910
|
-
|
|
911
|
-
declare const useIsMutating: <TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, object | undefined, TVariables, TData>['useIsMutating']>) => UseMutationResult<TData, TError, TVariables, TContext>;
|
|
912
|
-
|
|
913
|
-
declare const useQueries: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useQueries']>) => QueriesResults<never>;
|
|
914
|
-
|
|
915
|
-
declare const useSuspenseQueries: (qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>['useSuspenseQueries']>) => SuspenseQueriesResults<never>;
|
|
916
|
-
|
|
917
|
-
declare function invalidateQueries<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationInvalidateQueriesCallback<OperationSchema, unknown, TData>['invalidateQueries']>): Promise<void>;
|
|
918
|
-
|
|
919
|
-
declare function cancelQueries<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationCancelQueriesCallback<OperationSchema, unknown, TData>['cancelQueries']>): Promise<void>;
|
|
920
|
-
|
|
921
|
-
declare function resetQueries<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationResetQueriesCallback<OperationSchema, unknown, TData>['resetQueries']>): Promise<void>;
|
|
922
|
-
|
|
923
|
-
declare function removeQueries<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationRemoveQueriesCallback<OperationSchema, unknown, TData>['removeQueries']>): Promise<void>;
|
|
924
|
-
|
|
925
|
-
declare function refetchQueries<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationRefetchQueriesCallback<OperationSchema, unknown, TData>['refetchQueries']>): Promise<void>;
|
|
926
|
-
|
|
927
|
-
declare function isFetching<TData>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationIsFetchingQueriesCallback<OperationSchema, unknown, TData>['isFetching']>): Promise<void>;
|
|
928
|
-
|
|
929
|
-
declare function isMutating<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationIsMutatingQueriesCallback<OperationSchema, unknown, TData>['isMutating']>): Promise<void>;
|
|
930
|
-
|
|
931
|
-
declare const useIsFetching: <TVariables = unknown>(qraftOptions: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, object | undefined, TVariables, unknown>['useIsFetching']>) => number;
|
|
932
|
-
|
|
933
|
-
declare const fetchQuery: <TSchema extends {
|
|
934
|
-
url: string;
|
|
935
|
-
method: 'get' | 'head' | 'options';
|
|
936
|
-
}, TData, TParams>(_: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQuery<TSchema, TData, TParams>['fetchQuery']>) => Promise<TData>;
|
|
937
|
-
|
|
938
|
-
declare const prefetchQuery: <TSchema extends {
|
|
939
|
-
url: string;
|
|
940
|
-
method: 'get' | 'head' | 'options';
|
|
941
|
-
}, TData, TParams>(_: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQuery<TSchema, TData, TParams>['prefetchQuery']>) => Promise<TData>;
|
|
942
|
-
|
|
943
|
-
declare const fetchInfiniteQuery: <TSchema extends {
|
|
944
|
-
url: string;
|
|
945
|
-
method: 'get' | 'head' | 'options';
|
|
946
|
-
}, TData, TParams>(_: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQuery<TSchema, TData, TParams>['fetchInfiniteQuery']>) => Promise<TData>;
|
|
947
|
-
|
|
948
|
-
declare const prefetchInfiniteQuery: <TSchema extends {
|
|
949
|
-
url: string;
|
|
950
|
-
method: 'get' | 'head' | 'options';
|
|
951
|
-
}, TData, TParams>(_: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQuery<TSchema, TData, TParams>['prefetchInfiniteQuery']>) => Promise<TData>;
|
|
952
|
-
|
|
953
|
-
declare function getQueryState<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['getQueryState']>): TData | undefined;
|
|
954
|
-
|
|
955
|
-
declare function getInfiniteQueryState<TData>(_: QraftClientOptions | undefined, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, TData>['getInfiniteQueryState']>): TData | undefined;
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* Called when <service>.<operation>(...) is invoked.
|
|
959
|
-
*/
|
|
960
|
-
declare const operationInvokeFn: <TSchema extends OperationSchema, TBody, TData, TParams>(qraftOptions: QraftClientOptions | undefined, schema: TSchema, args: Parameters<ServiceOperationQueryFn<TSchema, TData, TParams>> | Parameters<ServiceOperationMutationFn<TSchema, TBody, TData, TParams>>) => Promise<TData>;
|
|
961
|
-
|
|
962
|
-
interface QraftSecureRequestFnBaseProps {
|
|
963
|
-
requestFn<T>(schema: OperationSchema, requestInfo: RequestFnInfo, options?: RequestFnOptions): Promise<T>;
|
|
964
|
-
securitySchemes: SecuritySchemeHandlers<string>;
|
|
965
|
-
}
|
|
966
|
-
type RequestFn = QraftSecureRequestFnBaseProps['requestFn'];
|
|
967
|
-
interface QraftSecureRequestFnProps extends QraftSecureRequestFnBaseProps {
|
|
968
|
-
children(secureRequestFn: QraftSecureRequestFnBaseProps['requestFn']): ReactNode;
|
|
969
|
-
queryClient?: QueryClient;
|
|
970
|
-
}
|
|
971
|
-
declare function QraftSecureRequestFn({ children, requestFn, securitySchemes, queryClient: inQueryClient, }: QraftSecureRequestFnProps): react.FunctionComponentElement<{
|
|
972
|
-
children?: ReactNode;
|
|
973
|
-
}>;
|
|
974
|
-
declare const useSecuritySchemeAuth: ({ securitySchemes, requestFn, queryClient, }: QraftSecureRequestFnBaseProps & {
|
|
975
|
-
queryClient: QueryClient;
|
|
976
|
-
}) => RequestFn;
|
|
977
|
-
/**
|
|
978
|
-
* Create a secure `requestFn` that manages security schemes.
|
|
979
|
-
* It will automatically fetch and refresh tokens when needed
|
|
980
|
-
* using QueryClient and the provided security schemes.
|
|
981
|
-
*
|
|
982
|
-
* @param securitySchemes OpenAPI security schemes.
|
|
983
|
-
* @param requestFn Qraft `requestFn`
|
|
984
|
-
* @param queryClient QueryClient instance.
|
|
985
|
-
*/
|
|
986
|
-
declare function createSecureRequestFn(securitySchemes: SecuritySchemeHandlers<string>, requestFn: RequestFn, queryClient: QueryClient): RequestFn;
|
|
987
|
-
type SecurityScheme = SecuritySchemeBearer | SecuritySchemeBasic | SecuritySchemeAPIKey | SecuritySchemeCookie;
|
|
988
|
-
type SecuritySchemeBearer = string /** JWT Bearer token. **/ | {
|
|
989
|
-
/** Refresh interval in milliseconds. */
|
|
990
|
-
refreshInterval: number;
|
|
991
|
-
/** Token to be used for authentication. */
|
|
992
|
-
token: string;
|
|
993
|
-
};
|
|
994
|
-
interface SecuritySchemeBasic {
|
|
995
|
-
/** Credentials to be used for authentication. */
|
|
996
|
-
credentials: string;
|
|
997
|
-
/** Refresh interval in milliseconds. */
|
|
998
|
-
refreshInterval: number;
|
|
999
|
-
}
|
|
1000
|
-
type SecuritySchemeAPIKey = {
|
|
1001
|
-
/** Where the secret should be placed. */
|
|
1002
|
-
in: 'header' | 'query';
|
|
1003
|
-
/** Name of the secret key. */
|
|
1004
|
-
name: string;
|
|
1005
|
-
/** Secret to be used for authentication. */
|
|
1006
|
-
value: string;
|
|
1007
|
-
/** Refresh interval in milliseconds. */
|
|
1008
|
-
refreshInterval?: number;
|
|
1009
|
-
};
|
|
1010
|
-
type SecuritySchemeCookie = {
|
|
1011
|
-
/** Where the secret should be placed. */
|
|
1012
|
-
in: 'cookie';
|
|
1013
|
-
/** Refresh interval in milliseconds. */
|
|
1014
|
-
refreshInterval?: number;
|
|
1015
|
-
};
|
|
1016
|
-
/**
|
|
1017
|
-
* Type definition for a handler function that manages security schemes.
|
|
1018
|
-
* This function is invoked when a token needs to be fetched or refreshed.
|
|
1019
|
-
*
|
|
1020
|
-
* @param props - The properties for the handler function.
|
|
1021
|
-
* @param props.isRefreshing - A boolean indicating the state of the token.
|
|
1022
|
-
* It's `false` on the initial "fetch token" request, and `true` if the token is stale or updating using `refreshInterval`.
|
|
1023
|
-
* @param props.signal - An AbortSignal that can be used to abort the request.
|
|
1024
|
-
*
|
|
1025
|
-
* @returns A SecurityScheme, which contains the necessary data for authentication.
|
|
1026
|
-
*/
|
|
1027
|
-
type SecuritySchemeHandler = (props: {
|
|
1028
|
-
isRefreshing: boolean;
|
|
1029
|
-
signal: AbortSignal;
|
|
1030
|
-
}) => SecurityScheme | Promise<SecurityScheme>;
|
|
1031
|
-
type SecuritySchemeHandlers<SecuritySchemeName extends string> = {
|
|
1032
|
-
[key in SecuritySchemeName]: SecuritySchemeHandler;
|
|
1033
|
-
};
|
|
1034
|
-
|
|
1035
|
-
export { type HeadersOptions, type OperationSchema, type QraftClientOptions, QraftContext, type QraftContextValue, type QraftSecureRequestFnProps, type RequestFn$1 as RequestFn, type RequestFnOptions, type RequestFnPayload, type SecuritySchemeAPIKey, type SecuritySchemeBasic, type SecuritySchemeBearer, type SecuritySchemeCookie, type SecuritySchemeHandlers, type ServiceOperationMutation, type ServiceOperationQuery, QraftSecureRequestFn as Unstable_QraftSecureRequestFn, baseRequestFn, bodySerializer, cancelQueries, createSecureRequestFn, fetchInfiniteQuery, fetchQuery, getInfiniteQueryData, getInfiniteQueryKey, getInfiniteQueryState, getMutationKey, getQueriesData, getQueryData, getQueryKey, getQueryState, invalidateQueries, isFetching, isMutating, mergeHeaders, mutationFn, operationInvokeFn, prefetchInfiniteQuery, prefetchQuery, qraftAPIClient, queryFn, refetchQueries, removeQueries, requestFn, resetQueries, setInfiniteQueryData, setQueriesData, setQueryData, urlSerializer, useInfiniteQuery, useIsFetching, useIsMutating, useMutation, useMutationState, useQueries, useQuery, useSecuritySchemeAuth, useSuspenseInfiniteQuery, useSuspenseQueries, useSuspenseQuery };
|