@openapi-qraft/react 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/README.md +17 -17
  3. package/dist/ServiceOperation.d.ts +146 -40
  4. package/dist/ServiceOperation.d.ts.map +1 -1
  5. package/dist/callbacks/getInfiniteQueryState.d.ts +5 -0
  6. package/dist/callbacks/getInfiniteQueryState.d.ts.map +1 -0
  7. package/dist/callbacks/getInfiniteQueryState.js +5 -0
  8. package/dist/callbacks/getInfiniteQueryState.js.map +1 -0
  9. package/dist/callbacks/getQueriesData.d.ts +5 -0
  10. package/dist/callbacks/getQueriesData.d.ts.map +1 -0
  11. package/dist/callbacks/getQueriesData.js +5 -0
  12. package/dist/callbacks/getQueriesData.js.map +1 -0
  13. package/dist/callbacks/getQueryState.d.ts +5 -0
  14. package/dist/callbacks/getQueryState.d.ts.map +1 -0
  15. package/dist/callbacks/getQueryState.js +5 -0
  16. package/dist/callbacks/getQueryState.js.map +1 -0
  17. package/dist/callbacks/isMutating.d.ts +5 -0
  18. package/dist/callbacks/isMutating.d.ts.map +1 -0
  19. package/dist/callbacks/isMutating.js +5 -0
  20. package/dist/callbacks/isMutating.js.map +1 -0
  21. package/dist/callbacks/removeQueries.d.ts +5 -0
  22. package/dist/callbacks/removeQueries.d.ts.map +1 -0
  23. package/dist/callbacks/removeQueries.js +5 -0
  24. package/dist/callbacks/removeQueries.js.map +1 -0
  25. package/dist/callbacks/setQueriesData.d.ts +5 -0
  26. package/dist/callbacks/setQueriesData.d.ts.map +1 -0
  27. package/dist/callbacks/setQueriesData.js +5 -0
  28. package/dist/callbacks/setQueriesData.js.map +1 -0
  29. package/dist/callbacks/useIsFetching.js.map +1 -1
  30. package/dist/callbacks/useIsMutating.d.ts +7 -0
  31. package/dist/callbacks/useIsMutating.d.ts.map +1 -0
  32. package/dist/callbacks/useIsMutating.js +9 -0
  33. package/dist/callbacks/useIsMutating.js.map +1 -0
  34. package/dist/callbacks/useMutationState.d.ts.map +1 -1
  35. package/dist/callbacks/useMutationState.js +2 -15
  36. package/dist/callbacks/useMutationState.js.map +1 -1
  37. package/dist/lib/callQueryClientMethodWithMutationFilters.d.ts +11 -0
  38. package/dist/lib/callQueryClientMethodWithMutationFilters.d.ts.map +1 -0
  39. package/dist/lib/callQueryClientMethodWithMutationFilters.js +18 -0
  40. package/dist/lib/callQueryClientMethodWithMutationFilters.js.map +1 -0
  41. package/dist/lib/callQueryClientMethodWithQueryFilters.js +1 -1
  42. package/dist/lib/callQueryClientMethodWithQueryFilters.js.map +1 -1
  43. package/dist/lib/callQueryClientMethodWithQueryKey.js +1 -1
  44. package/dist/lib/callQueryClientMethodWithQueryKey.js.map +1 -1
  45. package/dist/lib/composeBaseQueryKey.d.ts +6 -0
  46. package/dist/lib/composeBaseQueryKey.d.ts.map +1 -0
  47. package/dist/lib/composeBaseQueryKey.js +7 -0
  48. package/dist/lib/composeBaseQueryKey.js.map +1 -0
  49. package/dist/lib/composeInfiniteQueryKey.d.ts.map +1 -1
  50. package/dist/lib/composeInfiniteQueryKey.js +2 -1
  51. package/dist/lib/composeInfiniteQueryKey.js.map +1 -1
  52. package/dist/lib/composeMutationFilters.d.ts +11 -0
  53. package/dist/lib/composeMutationFilters.d.ts.map +1 -0
  54. package/dist/lib/composeMutationFilters.js +32 -0
  55. package/dist/lib/composeMutationFilters.js.map +1 -0
  56. package/dist/lib/composeMutationKey.js +1 -1
  57. package/dist/lib/composeMutationKey.js.map +1 -1
  58. package/dist/lib/composeQueryFilters.d.ts +5 -2
  59. package/dist/lib/composeQueryFilters.d.ts.map +1 -1
  60. package/dist/lib/composeQueryFilters.js +17 -11
  61. package/dist/lib/composeQueryFilters.js.map +1 -1
  62. package/dist/lib/composeQueryKey.d.ts.map +1 -1
  63. package/dist/lib/composeQueryKey.js +2 -1
  64. package/dist/lib/composeQueryKey.js.map +1 -1
  65. package/package.json +4 -3
  66. package/src/ServiceOperation.ts +344 -84
  67. package/src/callbacks/getInfiniteQueryState.ts +23 -0
  68. package/src/callbacks/getQueriesData.ts +18 -0
  69. package/src/callbacks/getQueryState.ts +19 -0
  70. package/src/callbacks/isMutating.ts +22 -0
  71. package/src/callbacks/removeQueries.ts +22 -0
  72. package/src/callbacks/setQueriesData.ts +22 -0
  73. package/src/callbacks/useIsFetching.ts +1 -1
  74. package/src/callbacks/useIsMutating.ts +42 -0
  75. package/src/callbacks/useMutationState.ts +2 -27
  76. package/src/lib/callQueryClientMethodWithMutationFilters.ts +37 -0
  77. package/src/lib/callQueryClientMethodWithQueryFilters.ts +1 -1
  78. package/src/lib/callQueryClientMethodWithQueryKey.ts +1 -1
  79. package/src/lib/composeBaseQueryKey.ts +34 -0
  80. package/src/lib/composeInfiniteQueryKey.ts +2 -1
  81. package/src/lib/composeMutationFilters.ts +44 -0
  82. package/src/lib/composeMutationKey.ts +1 -1
  83. package/src/lib/composeQueryFilters.ts +24 -16
  84. package/src/lib/composeQueryKey.ts +2 -1
@@ -0,0 +1,23 @@
1
+ import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import type { ServiceOperationQuery } from '../ServiceOperation.js';
5
+
6
+ export function getInfiniteQueryState<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationQuery<
11
+ OperationSchema,
12
+ unknown,
13
+ TData
14
+ >['getInfiniteQueryState']
15
+ >
16
+ ): TData | undefined {
17
+ return callQueryClientMethodWithQueryKey(
18
+ 'getQueryState',
19
+ schema,
20
+ true,
21
+ args as never
22
+ ) as never;
23
+ }
@@ -0,0 +1,18 @@
1
+ import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import { ServiceOperationQuery } from '../ServiceOperation.js';
5
+
6
+ export function getQueriesData<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationQuery<OperationSchema, unknown, TData>['getQueriesData']
11
+ >
12
+ ): TData | undefined {
13
+ return callQueryClientMethodWithQueryFilters(
14
+ 'getQueriesData',
15
+ schema,
16
+ args as never
17
+ ) as never;
18
+ }
@@ -0,0 +1,19 @@
1
+ import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import type { ServiceOperationQuery } from '../ServiceOperation.js';
5
+
6
+ export function getQueryState<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationQuery<OperationSchema, unknown, TData>['getQueryState']
11
+ >
12
+ ): TData | undefined {
13
+ return callQueryClientMethodWithQueryKey(
14
+ 'getQueryState',
15
+ schema,
16
+ false,
17
+ args as never
18
+ ) as never;
19
+ }
@@ -0,0 +1,22 @@
1
+ import { callQueryClientMethodWithMutationFilters } from '../lib/callQueryClientMethodWithMutationFilters.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import { ServiceOperationIsMutatingQueriesCallback } from '../ServiceOperation.js';
5
+
6
+ export function isMutating<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationIsMutatingQueriesCallback<
11
+ OperationSchema,
12
+ unknown,
13
+ TData
14
+ >['isMutating']
15
+ >
16
+ ): Promise<void> {
17
+ return callQueryClientMethodWithMutationFilters(
18
+ 'isMutating',
19
+ schema,
20
+ args as never
21
+ ) as never;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import { ServiceOperationRemoveQueriesCallback } from '../ServiceOperation.js';
5
+
6
+ export function removeQueries<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationRemoveQueriesCallback<
11
+ OperationSchema,
12
+ unknown,
13
+ TData
14
+ >['removeQueries']
15
+ >
16
+ ): Promise<void> {
17
+ return callQueryClientMethodWithQueryFilters(
18
+ 'removeQueries',
19
+ schema,
20
+ args as never
21
+ ) as never;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js';
2
+ import type { OperationSchema } from '../lib/requestFn.js';
3
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
4
+ import type { ServiceOperationSetQueriesDataCallback } from '../ServiceOperation.js';
5
+
6
+ export function setQueriesData<TData>(
7
+ _: QraftClientOptions | undefined,
8
+ schema: OperationSchema,
9
+ args: Parameters<
10
+ ServiceOperationSetQueriesDataCallback<
11
+ OperationSchema,
12
+ unknown,
13
+ TData
14
+ >['setQueriesData']
15
+ >
16
+ ): TData | undefined {
17
+ return callQueryClientMethodWithQueryFilters(
18
+ 'setQueriesData',
19
+ schema,
20
+ args as never
21
+ ) as never;
22
+ }
@@ -23,7 +23,7 @@ export const useIsFetching: <TVariables = unknown>(
23
23
  const [filters, queryClientByArg] = args;
24
24
 
25
25
  return useIsFetchingTanstack(
26
- composeQueryFilters(schema, filters) as never,
26
+ composeQueryFilters(schema, filters as never) as never,
27
27
  useQueryClient(qraftOptions, queryClientByArg)
28
28
  ) as never;
29
29
  };
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+
3
+ import type { DefaultError } from '@tanstack/query-core';
4
+ import {
5
+ UseMutationResult,
6
+ useIsMutating as useIsMutatingStateTanstack,
7
+ } from '@tanstack/react-query';
8
+
9
+ import { composeMutationFilters } from '../lib/composeMutationFilters.js';
10
+ import type { OperationSchema } from '../lib/requestFn.js';
11
+ import { useQueryClient } from '../lib/useQueryClient.js';
12
+ import type { QraftClientOptions } from '../qraftAPIClient.js';
13
+ import { ServiceOperationMutation } from '../ServiceOperation.js';
14
+
15
+ export const useIsMutating: <
16
+ TData = unknown,
17
+ TError = DefaultError,
18
+ TVariables = unknown,
19
+ TContext = unknown,
20
+ >(
21
+ _: QraftClientOptions | undefined,
22
+ schema: OperationSchema,
23
+ args: Parameters<
24
+ ServiceOperationMutation<
25
+ OperationSchema,
26
+ object | undefined,
27
+ TVariables,
28
+ TData
29
+ >['useIsMutating']
30
+ >
31
+ ) => UseMutationResult<TData, TError, TVariables, TContext> = (
32
+ qraftOptions,
33
+ schema,
34
+ args
35
+ ) => {
36
+ const [filters, queryClientByArg] = args;
37
+
38
+ return useIsMutatingStateTanstack(
39
+ composeMutationFilters(schema, filters) as never,
40
+ useQueryClient(qraftOptions, queryClientByArg)
41
+ ) as never;
42
+ };
@@ -1,14 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { useContext } from 'react';
4
-
5
3
  import type { DefaultError } from '@tanstack/query-core';
6
4
  import {
7
5
  UseMutationResult,
8
6
  useMutationState as useMutationStateTanstack,
9
7
  } from '@tanstack/react-query';
10
8
 
11
- import { composeMutationKey } from '../lib/composeMutationKey.js';
9
+ import { composeMutationFilters } from '../lib/composeMutationFilters.js';
12
10
  import type { OperationSchema } from '../lib/requestFn.js';
13
11
  import { useQueryClient } from '../lib/useQueryClient.js';
14
12
  import type { QraftClientOptions } from '../qraftAPIClient.js';
@@ -37,33 +35,10 @@ export const useMutationState: <
37
35
  ) => {
38
36
  const [options, queryClientByArg] = args;
39
37
 
40
- if (
41
- options?.filters &&
42
- 'parameters' in options.filters &&
43
- 'mutationKey' in options.filters
44
- ) {
45
- throw new Error(
46
- `'useMutationState': 'parameters' and 'mutationKey' cannot be used together`
47
- );
48
- }
49
-
50
- const filters = options?.filters;
51
-
52
38
  return useMutationStateTanstack(
53
39
  {
54
40
  ...options,
55
- filters:
56
- filters && 'mutationKey' in filters
57
- ? filters
58
- : {
59
- ...filters,
60
- mutationKey: composeMutationKey(
61
- schema,
62
- filters && 'parameters' in filters
63
- ? filters.parameters
64
- : undefined
65
- ),
66
- },
41
+ filters: composeMutationFilters(schema, options?.filters),
67
42
  } as never,
68
43
  useQueryClient(qraftOptions, queryClientByArg)
69
44
  ) as never;
@@ -0,0 +1,37 @@
1
+ import type { QueryClient } from '@tanstack/query-core';
2
+
3
+ import { composeMutationFilters } from './composeMutationFilters.js';
4
+ import type { OperationSchema } from './requestFn.js';
5
+
6
+ /**
7
+ * Calls a query client method with mutation filters and options,
8
+ * and automatically composes the `MutationKey` based on the schema and parameters.
9
+ */
10
+ export function callQueryClientMethodWithMutationFilters<
11
+ QFMethod extends QueryFilterMethods,
12
+ >(
13
+ queryFilterMethod: QFMethod,
14
+ schema: OperationSchema,
15
+ args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
16
+ ): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
17
+ const filters = args.length > 1 ? args[0] : undefined;
18
+ const queryClient = args[args.length - 1] as QueryClient | undefined;
19
+
20
+ if (!queryClient) throw new Error('queryClient is required');
21
+ if (!queryClient[queryFilterMethod])
22
+ throw new Error(
23
+ `queryClient is invalid, ${queryFilterMethod} method does not exist`
24
+ );
25
+
26
+ // @ts-expect-error
27
+ return queryClient[queryFilterMethod](
28
+ composeMutationFilters(schema, filters as never),
29
+ // @ts-expect-error
30
+ ...args.slice(1, -1)
31
+ );
32
+ }
33
+
34
+ type QueryFiltersMethod<QFMethod extends keyof typeof QueryClient.prototype> =
35
+ QFMethod;
36
+
37
+ type QueryFilterMethods = QueryFiltersMethod<'isMutating'>;
@@ -14,7 +14,7 @@ export function callQueryClientMethodWithQueryFilters<
14
14
  schema: OperationSchema,
15
15
  args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
16
16
  ): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
17
- const filters = args[0];
17
+ const filters = args.length > 1 ? args[0] : undefined;
18
18
  const queryClient = args[args.length - 1] as QueryClient | undefined;
19
19
 
20
20
  if (!queryClient) throw new Error('queryClient is required');
@@ -16,7 +16,7 @@ export function callQueryClientMethodWithQueryKey<
16
16
  infinite: boolean,
17
17
  args: [...Parameters<(typeof QueryClient.prototype)[QFMethod]>, QueryClient]
18
18
  ): ReturnType<(typeof QueryClient.prototype)[QFMethod]> {
19
- const parameters = args[0];
19
+ const parameters = args.length > 1 ? args[0] : undefined;
20
20
  const queryClient = args[args.length - 1] as QueryClient | undefined;
21
21
 
22
22
  if (!queryClient) throw new Error('queryClient is required');
@@ -0,0 +1,34 @@
1
+ import {
2
+ ServiceOperationInfiniteQueryKey,
3
+ ServiceOperationQueryKey,
4
+ } from '../ServiceOperation.js';
5
+ import type { OperationSchema } from './requestFn.js';
6
+
7
+ export function composeBaseQueryKey<TSchema extends OperationSchema, TParams>(
8
+ schema: TSchema,
9
+ parameters: TParams | undefined,
10
+ infinite: undefined
11
+ ): [TSchema, TParams];
12
+ export function composeBaseQueryKey<TSchema extends OperationSchema, TParams>(
13
+ schema: TSchema,
14
+ parameters: TParams | undefined,
15
+ infinite: true
16
+ ): ServiceOperationInfiniteQueryKey<TSchema, TParams>;
17
+ export function composeBaseQueryKey<TSchema extends OperationSchema, TParams>(
18
+ schema: TSchema,
19
+ parameters: TParams | undefined,
20
+ infinite: false
21
+ ): ServiceOperationQueryKey<TSchema, TParams>;
22
+ export function composeBaseQueryKey<TSchema extends OperationSchema, TParams>(
23
+ schema: TSchema,
24
+ parameters: TParams | undefined,
25
+ infinite: boolean | undefined
26
+ ):
27
+ | ServiceOperationQueryKey<TSchema, TParams>
28
+ | ServiceOperationInfiniteQueryKey<TSchema, TParams>
29
+ | [TSchema, TParams] {
30
+ return [
31
+ typeof infinite === 'boolean' ? { ...schema, infinite } : schema,
32
+ parameters ?? ({} as TParams),
33
+ ];
34
+ }
@@ -1,4 +1,5 @@
1
1
  import type { ServiceOperationInfiniteQueryKey } from '../ServiceOperation.js';
2
+ import { composeBaseQueryKey } from './composeBaseQueryKey.js';
2
3
  import type { OperationSchema } from './requestFn.js';
3
4
 
4
5
  export function composeInfiniteQueryKey<
@@ -8,5 +9,5 @@ export function composeInfiniteQueryKey<
8
9
  schema: TSchema,
9
10
  parameters: TParams | undefined
10
11
  ): ServiceOperationInfiniteQueryKey<TSchema, TParams> {
11
- return [{ ...schema, infinite: true }, parameters ?? ({} as TParams)];
12
+ return composeBaseQueryKey(schema, parameters, true);
12
13
  }
@@ -0,0 +1,44 @@
1
+ import { composeMutationKey } from './composeMutationKey.js';
2
+ import type { OperationSchema } from './requestFn.js';
3
+
4
+ /**
5
+ * Replaces the `parameters` field in the filters with a `mutationKey` field based on the schema.
6
+ * If no filters are provided, a `mutationKey` will be composed schema's base query key.
7
+ * @param schema
8
+ * @param filters
9
+ */
10
+ export function composeMutationFilters<Filters extends object>(
11
+ schema: OperationSchema,
12
+ filters: Filters | undefined
13
+ ) {
14
+ if (!filters) {
15
+ return {
16
+ mutationKey: composeMutationKey(schema, undefined),
17
+ };
18
+ }
19
+
20
+ if (filters && 'mutationKey' in filters && 'parameters' in filters) {
21
+ throw new Error(
22
+ `'composeMutationFilters': 'mutationKey' and 'parameters' cannot be used together`
23
+ );
24
+ }
25
+
26
+ if ('mutationKey' in filters) {
27
+ return filters;
28
+ }
29
+
30
+ if ('parameters' in filters) {
31
+ const { parameters, ...filtersWithoutParameters } = filters;
32
+
33
+ Object.assign(filtersWithoutParameters, {
34
+ mutationKey: composeMutationKey(schema, parameters),
35
+ });
36
+
37
+ return filtersWithoutParameters;
38
+ }
39
+
40
+ return {
41
+ ...filters,
42
+ mutationKey: composeMutationKey(schema, undefined),
43
+ };
44
+ }
@@ -21,7 +21,7 @@ export function composeMutationKey<
21
21
  TParams = unknown,
22
22
  >(schema: TSchema, parameters: TParams | undefined) {
23
23
  return parameters === undefined
24
- ? [{ url: schema.url, method: schema.method }]
24
+ ? [{ url: schema.url, method: schema.method }, {}]
25
25
  : [
26
26
  {
27
27
  url: schema.url,
@@ -1,3 +1,5 @@
1
+ import { composeBaseQueryKey } from './composeBaseQueryKey.js';
2
+ import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js';
1
3
  import { composeQueryKey } from './composeQueryKey.js';
2
4
  import type { OperationSchema } from './requestFn.js';
3
5
 
@@ -7,38 +9,44 @@ import type { OperationSchema } from './requestFn.js';
7
9
  * @param schema
8
10
  * @param filters
9
11
  */
10
- export function composeQueryFilters<Filters extends object>(
11
- schema: OperationSchema,
12
- filters: Filters | undefined
13
- ) {
12
+ export function composeQueryFilters<
13
+ Filters extends {
14
+ infinite: boolean;
15
+ parameters?: object;
16
+ } & Record<string, unknown>,
17
+ >(schema: OperationSchema, filters: Filters | undefined) {
14
18
  if (!filters) {
15
19
  return {
16
- queryKey: composeQueryKey(schema, undefined),
20
+ queryKey: composeBaseQueryKey(schema, undefined, undefined),
17
21
  };
18
22
  }
19
23
 
20
- if (filters && 'queryKey' in filters && 'parameters' in filters) {
24
+ if ('queryKey' in filters && 'parameters' in filters) {
21
25
  throw new Error(
22
26
  `'composeQueryFilters': 'queryKey' and 'parameters' cannot be used together`
23
27
  );
24
28
  }
25
29
 
26
- if ('queryKey' in filters) {
27
- return filters;
28
- }
30
+ const { infinite, parameters, ...filtersRest } = filters;
29
31
 
30
- if ('parameters' in filters) {
31
- const { parameters, ...filtersWithoutParameters } = filters;
32
+ if ('queryKey' in filtersRest) {
33
+ return filtersRest;
34
+ }
32
35
 
33
- Object.assign(filtersWithoutParameters, {
34
- queryKey: composeQueryKey(schema, parameters),
36
+ if (parameters) {
37
+ Object.assign(filtersRest, {
38
+ queryKey: infinite
39
+ ? composeInfiniteQueryKey(schema, parameters)
40
+ : composeQueryKey(schema, parameters),
35
41
  });
36
42
 
37
- return filtersWithoutParameters;
43
+ return filtersRest;
38
44
  }
39
45
 
40
46
  return {
41
- ...filters,
42
- queryKey: composeQueryKey(schema, undefined),
47
+ ...filtersRest,
48
+ queryKey: infinite
49
+ ? composeInfiniteQueryKey(schema, undefined)
50
+ : composeQueryKey(schema, undefined),
43
51
  };
44
52
  }
@@ -1,9 +1,10 @@
1
1
  import type { ServiceOperationQueryKey } from '../ServiceOperation.js';
2
+ import { composeBaseQueryKey } from './composeBaseQueryKey.js';
2
3
  import type { OperationSchema } from './requestFn.js';
3
4
 
4
5
  export function composeQueryKey<TSchema extends OperationSchema, TParams>(
5
6
  schema: TSchema,
6
7
  parameters: TParams | undefined
7
8
  ): ServiceOperationQueryKey<TSchema, TParams> {
8
- return [schema, parameters ?? ({} as TParams)];
9
+ return composeBaseQueryKey(schema, parameters, false);
9
10
  }