@openapi-qraft/react 1.11.0-beta.5 → 1.12.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 +24 -0
- package/dist/cjs/callbacks/useMutation.cjs +2 -1
- package/dist/cjs/callbacks/useMutation.cjs.map +1 -1
- package/dist/cjs/callbacks/useQueries.cjs +1 -2
- package/dist/cjs/callbacks/useQueries.cjs.map +1 -1
- package/dist/cjs/callbacks/useSuspenseQueries.cjs +1 -2
- package/dist/cjs/callbacks/useSuspenseQueries.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -76
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/lib/useComposeUseQueryOptions.cjs +1 -1
- package/dist/cjs/lib/useComposeUseQueryOptions.cjs.map +1 -1
- package/dist/esm/callbacks/useMutation.js +2 -1
- package/dist/esm/callbacks/useMutation.js.map +1 -1
- package/dist/esm/callbacks/useQueries.js +1 -2
- package/dist/esm/callbacks/useQueries.js.map +1 -1
- package/dist/esm/callbacks/useSuspenseQueries.js +1 -2
- package/dist/esm/callbacks/useSuspenseQueries.js.map +1 -1
- package/dist/esm/index.js +0 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/useComposeUseQueryOptions.js +1 -1
- package/dist/esm/lib/useComposeUseQueryOptions.js.map +1 -1
- package/dist/types/callbacks/useMutation.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/useComposeUseQueryOptions.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperation.d.ts +2 -2
- package/dist/types/service-operation/ServiceOperation.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts +3 -3
- package/dist/types/service-operation/ServiceOperationUseInfiniteQuery.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts +18 -12
- package/dist/types/service-operation/ServiceOperationUseQueries.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts +3 -3
- package/dist/types/service-operation/ServiceOperationUseQuery.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts +2 -2
- package/dist/types/service-operation/ServiceOperationUseSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts +17 -10
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueries.d.ts.map +1 -1
- package/dist/types/service-operation/ServiceOperationUseSuspenseQuery.d.ts +10 -0
- package/dist/types/service-operation/ServiceOperationUseSuspenseQuery.d.ts.map +1 -0
- package/package.json +32 -10
- package/src/callbacks/useMutation.ts +6 -2
- package/src/callbacks/useQueries.ts +3 -3
- package/src/callbacks/useSuspenseQueries.ts +3 -3
- package/src/index.ts +9 -20
- package/src/lib/useComposeUseQueryOptions.ts +3 -2
- package/src/service-operation/ServiceOperation.ts +2 -2
- package/src/service-operation/ServiceOperationUseInfiniteQuery.ts +13 -7
- package/src/service-operation/ServiceOperationUseQueries.ts +42 -20
- package/src/service-operation/ServiceOperationUseQuery.ts +5 -5
- package/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts +8 -5
- package/src/service-operation/ServiceOperationUseSuspenseQueries.ts +38 -19
- package/src/service-operation/{ServiceOperationUseSuspenseQueryQuery.ts → ServiceOperationUseSuspenseQuery.ts} +4 -4
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts +0 -10
- package/dist/types/service-operation/ServiceOperationUseSuspenseQueryQuery.d.ts.map +0 -1
|
@@ -16,7 +16,7 @@ import type { ServiceOperationInfiniteQueryKey } from './ServiceOperationKey.js'
|
|
|
16
16
|
|
|
17
17
|
export interface ServiceOperationUseInfiniteQuery<
|
|
18
18
|
TSchema extends { url: string; method: string },
|
|
19
|
-
|
|
19
|
+
TQueryFnData,
|
|
20
20
|
TParams = {},
|
|
21
21
|
TError = DefaultError,
|
|
22
22
|
> {
|
|
@@ -24,11 +24,11 @@ export interface ServiceOperationUseInfiniteQuery<
|
|
|
24
24
|
parameters: TQueryKeyParams
|
|
25
25
|
): ServiceOperationInfiniteQueryKey<TSchema, TQueryKeyParams>;
|
|
26
26
|
|
|
27
|
-
useInfiniteQuery<TPageParam extends TParams>(
|
|
27
|
+
useInfiniteQuery<TPageParam extends TParams, TData = TQueryFnData>(
|
|
28
28
|
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
29
29
|
options: Omit<
|
|
30
30
|
UndefinedInitialDataInfiniteOptions<
|
|
31
|
-
|
|
31
|
+
TQueryFnData,
|
|
32
32
|
TError,
|
|
33
33
|
OperationInfiniteData<TData, TParams>,
|
|
34
34
|
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
@@ -39,18 +39,21 @@ export interface ServiceOperationUseInfiniteQuery<
|
|
|
39
39
|
| 'getNextPageParam'
|
|
40
40
|
| 'initialPageParam'
|
|
41
41
|
> &
|
|
42
|
-
InfiniteQueryPageParamsOptions<
|
|
42
|
+
InfiniteQueryPageParamsOptions<
|
|
43
|
+
TQueryFnData,
|
|
44
|
+
PartialParameters<TPageParam>
|
|
45
|
+
>,
|
|
43
46
|
queryClient?: QueryClient
|
|
44
47
|
): UseInfiniteQueryResult<
|
|
45
48
|
OperationInfiniteData<TData, TParams>,
|
|
46
49
|
TError | Error
|
|
47
50
|
>;
|
|
48
51
|
|
|
49
|
-
useInfiniteQuery<TPageParam extends TParams>(
|
|
52
|
+
useInfiniteQuery<TPageParam extends TParams, TData = TQueryFnData>(
|
|
50
53
|
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
51
54
|
options: Omit<
|
|
52
55
|
DefinedInitialDataInfiniteOptions<
|
|
53
|
-
|
|
56
|
+
TQueryFnData,
|
|
54
57
|
TError,
|
|
55
58
|
OperationInfiniteData<TData, TParams>,
|
|
56
59
|
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
@@ -61,7 +64,10 @@ export interface ServiceOperationUseInfiniteQuery<
|
|
|
61
64
|
| 'getNextPageParam'
|
|
62
65
|
| 'initialPageParam'
|
|
63
66
|
> &
|
|
64
|
-
InfiniteQueryPageParamsOptions<
|
|
67
|
+
InfiniteQueryPageParamsOptions<
|
|
68
|
+
TQueryFnData,
|
|
69
|
+
PartialParameters<TPageParam>
|
|
70
|
+
>,
|
|
65
71
|
queryClient?: QueryClient
|
|
66
72
|
): DefinedUseInfiniteQueryResult<
|
|
67
73
|
OperationInfiniteData<TData, TParams>,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
DefaultError,
|
|
3
3
|
QueriesPlaceholderDataFunction,
|
|
4
4
|
QueryClient,
|
|
@@ -7,32 +7,54 @@ import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
|
7
7
|
|
|
8
8
|
import type { ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
9
9
|
|
|
10
|
+
type UseQueryOptionsForUseQueries<
|
|
11
|
+
TSchema extends { url: string; method: string },
|
|
12
|
+
TParams,
|
|
13
|
+
TQueryFnData,
|
|
14
|
+
TError,
|
|
15
|
+
TData = TQueryFnData,
|
|
16
|
+
> = Omit<
|
|
17
|
+
UseQueryOptions<
|
|
18
|
+
TQueryFnData,
|
|
19
|
+
TError,
|
|
20
|
+
TData,
|
|
21
|
+
ServiceOperationQueryKey<TSchema, TParams>
|
|
22
|
+
>,
|
|
23
|
+
'placeholderData' | 'suspense' | 'queryKey'
|
|
24
|
+
> &
|
|
25
|
+
(
|
|
26
|
+
| {
|
|
27
|
+
parameters: TParams;
|
|
28
|
+
placeholderData?:
|
|
29
|
+
| TQueryFnData
|
|
30
|
+
| QueriesPlaceholderDataFunction<TQueryFnData>;
|
|
31
|
+
queryKey?: never;
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
35
|
+
placeholderData?:
|
|
36
|
+
| TQueryFnData
|
|
37
|
+
| QueriesPlaceholderDataFunction<TQueryFnData>;
|
|
38
|
+
parameters?: never;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
10
42
|
export interface ServiceOperationUseQueries<
|
|
11
43
|
TSchema extends { url: string; method: string },
|
|
12
|
-
|
|
44
|
+
TQueryFnData,
|
|
13
45
|
TParams = {},
|
|
14
46
|
TError = DefaultError,
|
|
15
47
|
> {
|
|
16
|
-
useQueries<
|
|
48
|
+
useQueries<
|
|
49
|
+
T extends Array<
|
|
50
|
+
UseQueryOptionsForUseQueries<TSchema, TParams, TQueryFnData, TError>
|
|
51
|
+
>,
|
|
52
|
+
TCombinedResult = Array<UseQueryResult<TQueryFnData, TError>>,
|
|
53
|
+
>(
|
|
17
54
|
options: {
|
|
18
|
-
queries:
|
|
19
|
-
Omit<
|
|
20
|
-
UseQueryOptions<
|
|
21
|
-
TData,
|
|
22
|
-
TError,
|
|
23
|
-
TData,
|
|
24
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
25
|
-
>,
|
|
26
|
-
'placeholderData' | 'suspense' | 'queryKey'
|
|
27
|
-
> & {
|
|
28
|
-
placeholderData?: TData | QueriesPlaceholderDataFunction<TData>;
|
|
29
|
-
} & (
|
|
30
|
-
| { parameters: TParams; queryKey?: never }
|
|
31
|
-
| { queryKey: ServiceOperationQueryKey<TSchema, TParams> }
|
|
32
|
-
)
|
|
33
|
-
>;
|
|
55
|
+
queries: T;
|
|
34
56
|
combine?: (
|
|
35
|
-
results: Array<UseQueryResult<
|
|
57
|
+
results: Array<UseQueryResult<TQueryFnData, TError>>
|
|
36
58
|
) => TCombinedResult;
|
|
37
59
|
},
|
|
38
60
|
queryClient?: QueryClient
|
|
@@ -10,7 +10,7 @@ import type { ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
|
10
10
|
|
|
11
11
|
export interface ServiceOperationUseQuery<
|
|
12
12
|
TSchema extends { url: string; method: string },
|
|
13
|
-
|
|
13
|
+
TQueryFnData,
|
|
14
14
|
TParams = {},
|
|
15
15
|
TError = DefaultError,
|
|
16
16
|
> {
|
|
@@ -18,11 +18,11 @@ export interface ServiceOperationUseQuery<
|
|
|
18
18
|
parameters?: QueryKeyParams
|
|
19
19
|
): ServiceOperationQueryKey<TSchema, QueryKeyParams>;
|
|
20
20
|
|
|
21
|
-
useQuery(
|
|
21
|
+
useQuery<TData = TQueryFnData>(
|
|
22
22
|
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
23
23
|
options?: Omit<
|
|
24
24
|
UndefinedInitialDataOptions<
|
|
25
|
-
|
|
25
|
+
TQueryFnData,
|
|
26
26
|
TError,
|
|
27
27
|
TData,
|
|
28
28
|
ServiceOperationQueryKey<TSchema, TParams>
|
|
@@ -32,11 +32,11 @@ export interface ServiceOperationUseQuery<
|
|
|
32
32
|
queryClient?: QueryClient
|
|
33
33
|
): UseQueryResult<TData, TError | Error>;
|
|
34
34
|
|
|
35
|
-
useQuery(
|
|
35
|
+
useQuery<TData = TQueryFnData>(
|
|
36
36
|
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
37
37
|
options: Omit<
|
|
38
38
|
DefinedInitialDataOptions<
|
|
39
|
-
|
|
39
|
+
TQueryFnData,
|
|
40
40
|
TError,
|
|
41
41
|
TData,
|
|
42
42
|
ServiceOperationQueryKey<TSchema, TParams>
|
|
@@ -14,18 +14,18 @@ import type { ServiceOperationInfiniteQueryKey } from './ServiceOperationKey.js'
|
|
|
14
14
|
|
|
15
15
|
export interface ServiceOperationUseSuspenseInfiniteQuery<
|
|
16
16
|
TSchema extends { url: string; method: string },
|
|
17
|
-
|
|
17
|
+
TQueryFnData,
|
|
18
18
|
TParams = {},
|
|
19
19
|
TError = DefaultError,
|
|
20
20
|
> {
|
|
21
|
-
useSuspenseInfiniteQuery<TPageParam extends TParams>(
|
|
21
|
+
useSuspenseInfiniteQuery<TPageParam extends TParams, TData = TQueryFnData>(
|
|
22
22
|
parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
23
23
|
options: Omit<
|
|
24
24
|
UseSuspenseInfiniteQueryOptions<
|
|
25
|
-
|
|
25
|
+
TQueryFnData,
|
|
26
26
|
TError,
|
|
27
27
|
OperationInfiniteData<TData, TParams>,
|
|
28
|
-
|
|
28
|
+
TQueryFnData,
|
|
29
29
|
ServiceOperationInfiniteQueryKey<TSchema, TParams>,
|
|
30
30
|
PartialParameters<TPageParam>
|
|
31
31
|
>,
|
|
@@ -34,7 +34,10 @@ export interface ServiceOperationUseSuspenseInfiniteQuery<
|
|
|
34
34
|
| 'getNextPageParam'
|
|
35
35
|
| 'initialPageParam'
|
|
36
36
|
> &
|
|
37
|
-
InfiniteQueryPageParamsOptions<
|
|
37
|
+
InfiniteQueryPageParamsOptions<
|
|
38
|
+
TQueryFnData,
|
|
39
|
+
PartialParameters<TPageParam>
|
|
40
|
+
>,
|
|
38
41
|
queryClient?: QueryClient
|
|
39
42
|
): UseSuspenseInfiniteQueryResult<
|
|
40
43
|
OperationInfiniteData<TData, TParams>,
|
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
import type { DefaultError, QueryClient } from '@tanstack/query-core';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
3
|
+
UseQueryOptions,
|
|
4
4
|
UseSuspenseQueryResult,
|
|
5
5
|
} from '@tanstack/react-query';
|
|
6
6
|
|
|
7
7
|
import type { ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
8
8
|
|
|
9
|
+
type UseQueryOptionsForUseSuspenseQuery<
|
|
10
|
+
TSchema extends { url: string; method: string },
|
|
11
|
+
TParams,
|
|
12
|
+
TQueryFnData,
|
|
13
|
+
TError,
|
|
14
|
+
TData = TQueryFnData,
|
|
15
|
+
> = Omit<
|
|
16
|
+
UseQueryOptions<
|
|
17
|
+
TQueryFnData,
|
|
18
|
+
TError,
|
|
19
|
+
TData,
|
|
20
|
+
ServiceOperationQueryKey<TSchema, TParams>
|
|
21
|
+
>,
|
|
22
|
+
'enabled' | 'throwOnError' | 'placeholderData' | 'queryKey'
|
|
23
|
+
> &
|
|
24
|
+
(
|
|
25
|
+
| {
|
|
26
|
+
parameters: TParams;
|
|
27
|
+
queryKey?: never;
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
queryKey: ServiceOperationQueryKey<TSchema, TParams>;
|
|
31
|
+
parameters?: never;
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
9
35
|
export interface ServiceOperationUseSuspenseQueries<
|
|
10
36
|
TSchema extends { url: string; method: string },
|
|
11
|
-
|
|
37
|
+
TQueryFnData,
|
|
12
38
|
TParams = {},
|
|
13
39
|
TError = DefaultError,
|
|
14
40
|
> {
|
|
15
41
|
useSuspenseQueries<
|
|
16
|
-
|
|
42
|
+
T extends Array<
|
|
43
|
+
UseQueryOptionsForUseSuspenseQuery<TSchema, TParams, TQueryFnData, TError>
|
|
44
|
+
>,
|
|
45
|
+
TCombinedResult = Array<UseSuspenseQueryResult<TQueryFnData, TError>>,
|
|
17
46
|
>(
|
|
18
47
|
options: {
|
|
19
|
-
queries:
|
|
20
|
-
Omit<
|
|
21
|
-
UseSuspenseQueryOptions<
|
|
22
|
-
TData,
|
|
23
|
-
TError,
|
|
24
|
-
TData,
|
|
25
|
-
ServiceOperationQueryKey<TSchema, TParams>
|
|
26
|
-
>,
|
|
27
|
-
'queryKey'
|
|
28
|
-
> &
|
|
29
|
-
(
|
|
30
|
-
| { parameters: TParams; queryKey?: never }
|
|
31
|
-
| { queryKey: ServiceOperationQueryKey<TSchema, TParams> }
|
|
32
|
-
)
|
|
33
|
-
>;
|
|
48
|
+
queries: T;
|
|
34
49
|
combine?: (
|
|
35
|
-
results: Array<
|
|
50
|
+
results: Array<
|
|
51
|
+
WithOptional<UseSuspenseQueryResult<TQueryFnData, TError>, 'data'>
|
|
52
|
+
>
|
|
36
53
|
) => TCombinedResult;
|
|
37
54
|
},
|
|
38
55
|
queryClient?: QueryClient
|
|
39
56
|
): TCombinedResult;
|
|
40
57
|
}
|
|
58
|
+
|
|
59
|
+
type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
@@ -6,17 +6,17 @@ import type {
|
|
|
6
6
|
|
|
7
7
|
import type { ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface ServiceOperationUseSuspenseQuery<
|
|
10
10
|
TSchema extends { url: string; method: string },
|
|
11
|
-
|
|
11
|
+
TQueryFnData,
|
|
12
12
|
TParams = {},
|
|
13
13
|
TError = DefaultError,
|
|
14
14
|
> {
|
|
15
|
-
useSuspenseQuery(
|
|
15
|
+
useSuspenseQuery<TData = TQueryFnData>(
|
|
16
16
|
parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>,
|
|
17
17
|
options?: Omit<
|
|
18
18
|
UseSuspenseQueryOptions<
|
|
19
|
-
|
|
19
|
+
TQueryFnData,
|
|
20
20
|
TError,
|
|
21
21
|
TData,
|
|
22
22
|
ServiceOperationQueryKey<TSchema, TParams>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DefaultError, QueryClient } from '@tanstack/query-core';
|
|
2
|
-
import type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import type { ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
4
|
-
export interface ServiceOperationUseSuspenseQueryQuery<TSchema extends {
|
|
5
|
-
url: string;
|
|
6
|
-
method: string;
|
|
7
|
-
}, TData, TParams = {}, TError = DefaultError> {
|
|
8
|
-
useSuspenseQuery(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>, options?: Omit<UseSuspenseQueryOptions<TData, TError, TData, ServiceOperationQueryKey<TSchema, TParams>>, 'queryKey'>, queryClient?: QueryClient): UseSuspenseQueryResult<TData, TError | Error>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=ServiceOperationUseSuspenseQueryQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceOperationUseSuspenseQueryQuery.d.ts","sourceRoot":"","sources":["../../../src/service-operation/ServiceOperationUseSuspenseQueryQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,MAAM,WAAW,qCAAqC,CACpD,OAAO,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC/C,KAAK,EACL,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,YAAY;IAErB,gBAAgB,CACd,UAAU,EAAE,OAAO,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAChE,OAAO,CAAC,EAAE,IAAI,CACZ,uBAAuB,CACrB,KAAK,EACL,MAAM,EACN,KAAK,EACL,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAC3C,EACD,UAAU,CACX,EACD,WAAW,CAAC,EAAE,WAAW,GACxB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;CAClD"}
|