@squonk/account-server-client 4.2.1 → 4.3.1

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/asset/asset.cjs +99 -126
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.cts +99 -99
  4. package/asset/asset.d.ts +99 -99
  5. package/asset/asset.js +107 -134
  6. package/asset/asset.js.map +1 -1
  7. package/charges/charges.cjs +73 -85
  8. package/charges/charges.cjs.map +1 -1
  9. package/charges/charges.d.cts +47 -47
  10. package/charges/charges.d.ts +47 -47
  11. package/charges/charges.js +78 -90
  12. package/charges/charges.js.map +1 -1
  13. package/chunk-3WKSNKHE.js +25 -0
  14. package/chunk-3WKSNKHE.js.map +1 -0
  15. package/chunk-NY2VJJG7.cjs +25 -0
  16. package/chunk-NY2VJJG7.cjs.map +1 -0
  17. package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
  18. package/chunk-RB2KVIEK.cjs.map +1 -0
  19. package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
  20. package/chunk-XYDLYMQ2.js.map +1 -0
  21. package/event-stream/event-stream.cjs +53 -61
  22. package/event-stream/event-stream.cjs.map +1 -1
  23. package/event-stream/event-stream.d.cts +45 -45
  24. package/event-stream/event-stream.d.ts +45 -45
  25. package/event-stream/event-stream.js +58 -66
  26. package/event-stream/event-stream.js.map +1 -1
  27. package/index.cjs +49 -57
  28. package/index.cjs.map +1 -1
  29. package/index.d.cts +796 -773
  30. package/index.d.ts +796 -773
  31. package/index.js +48 -56
  32. package/index.js.map +1 -1
  33. package/merchant/merchant.cjs +38 -45
  34. package/merchant/merchant.cjs.map +1 -1
  35. package/merchant/merchant.d.cts +25 -25
  36. package/merchant/merchant.d.ts +25 -25
  37. package/merchant/merchant.js +42 -49
  38. package/merchant/merchant.js.map +1 -1
  39. package/organisation/organisation.cjs +77 -87
  40. package/organisation/organisation.cjs.map +1 -1
  41. package/organisation/organisation.d.cts +72 -70
  42. package/organisation/organisation.d.ts +72 -70
  43. package/organisation/organisation.js +83 -93
  44. package/organisation/organisation.js.map +1 -1
  45. package/package.json +13 -16
  46. package/product/product.cjs +143 -153
  47. package/product/product.cjs.map +1 -1
  48. package/product/product.d.cts +100 -100
  49. package/product/product.d.ts +100 -100
  50. package/product/product.js +153 -163
  51. package/product/product.js.map +1 -1
  52. package/src/account-server-api.schemas.ts +863 -856
  53. package/src/asset/asset.ts +899 -634
  54. package/src/charges/charges.ts +822 -498
  55. package/src/custom-instance.ts +3 -3
  56. package/src/event-stream/event-stream.ts +531 -345
  57. package/src/index.ts +2 -2
  58. package/src/merchant/merchant.ts +355 -234
  59. package/src/options-mutator.ts +27 -0
  60. package/src/organisation/organisation.ts +812 -504
  61. package/src/product/product.ts +1373 -841
  62. package/src/state/state.ts +174 -127
  63. package/src/unit/unit.ts +1273 -603
  64. package/src/user/user.ts +895 -564
  65. package/state/state.cjs +22 -24
  66. package/state/state.cjs.map +1 -1
  67. package/state/state.d.cts +14 -14
  68. package/state/state.d.ts +14 -14
  69. package/state/state.js +24 -26
  70. package/state/state.js.map +1 -1
  71. package/unit/unit.cjs +171 -106
  72. package/unit/unit.cjs.map +1 -1
  73. package/unit/unit.d.cts +200 -90
  74. package/unit/unit.d.ts +200 -90
  75. package/unit/unit.js +179 -114
  76. package/unit/unit.js.map +1 -1
  77. package/user/user.cjs +94 -110
  78. package/user/user.cjs.map +1 -1
  79. package/user/user.d.cts +77 -77
  80. package/user/user.d.ts +77 -77
  81. package/user/user.js +101 -117
  82. package/user/user.js.map +1 -1
  83. package/chunk-EBOQPVLG.js.map +0 -1
  84. package/chunk-TKLTUR4R.cjs.map +0 -1
@@ -1,41 +1,35 @@
1
- // @ts-nocheck
2
1
  /**
3
- * Generated by orval v7.4.1 🍺
2
+ * Generated by orval v7.10.0 🍺
4
3
  * Do not edit manually.
5
4
  * Account Server API
6
5
  * The Informatics Matters Account Server API.
7
6
 
8
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
9
8
 
10
- * OpenAPI spec version: 4.2
9
+ * OpenAPI spec version: 4.3
11
10
  */
12
- import {
13
- useQuery,
14
- useSuspenseQuery
15
- } from '@tanstack/react-query'
11
+ import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
16
12
  import type {
17
13
  DataTag,
18
14
  DefinedInitialDataOptions,
19
15
  DefinedUseQueryResult,
16
+ QueryClient,
20
17
  QueryFunction,
21
18
  QueryKey,
22
19
  UndefinedInitialDataOptions,
23
20
  UseQueryOptions,
24
21
  UseQueryResult,
25
22
  UseSuspenseQueryOptions,
26
- UseSuspenseQueryResult
27
- } from '@tanstack/react-query'
28
- import type {
29
- AsError,
30
- MerchantDetail,
31
- MerchantsGetResponse
32
- } from '../account-server-api.schemas'
33
- import { customInstance } from '.././custom-instance';
34
- import type { ErrorType } from '.././custom-instance';
23
+ UseSuspenseQueryResult,
24
+ } from "@tanstack/react-query";
35
25
 
26
+ import type { AsError, MerchantDetail, MerchantsGetResponse } from "../account-server-api.schemas";
36
27
 
37
- type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
28
+ import { customInstance } from ".././custom-instance";
29
+ import type { ErrorType } from ".././custom-instance";
30
+ import { queryMutator } from ".././options-mutator";
38
31
 
32
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
39
33
 
40
34
  /**
41
35
  * Gets Merchants known to the Account Server
@@ -45,283 +39,410 @@ Merchants are software services (SaaS assets) whose facilities are known to and
45
39
  * @summary Gets all Merchants
46
40
  */
47
41
  export const getMerchants = (
48
-
49
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
42
+ options?: SecondParameter<typeof customInstance>,
43
+ signal?: AbortSignal,
50
44
  ) => {
51
-
52
-
53
- return customInstance<MerchantsGetResponse>(
54
- {url: `/merchant`, method: 'GET', signal
55
- },
56
- options);
57
- }
58
-
45
+ return customInstance<MerchantsGetResponse>({ url: `/merchant`, method: "GET", signal }, options);
46
+ };
59
47
 
60
48
  export const getGetMerchantsQueryKey = () => {
61
- return ["account-server-api", `/merchant`] as const;
62
- }
63
-
64
-
65
- export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
66
- ) => {
67
-
68
- const {query: queryOptions, request: requestOptions} = options ?? {};
69
-
70
- const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
71
-
72
-
73
-
74
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
75
-
76
-
77
-
78
-
79
-
80
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
81
- }
82
-
83
- export type GetMerchantsQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
84
- export type GetMerchantsQueryError = ErrorType<AsError | void>
85
-
86
-
87
- export function useGetMerchants<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
88
- options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> & Pick<
49
+ return [`/merchant`] as const;
50
+ };
51
+
52
+ export const useGetMerchantsQueryOptions = <
53
+ TData = Awaited<ReturnType<typeof getMerchants>>,
54
+ TError = ErrorType<AsError | void>,
55
+ >(options?: {
56
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
57
+ request?: SecondParameter<typeof customInstance>;
58
+ }) => {
59
+ const { query: queryOptions, request: requestOptions } = options ?? {};
60
+
61
+ const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
62
+
63
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) =>
64
+ getMerchants(requestOptions, signal);
65
+
66
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
67
+
68
+ return customOptions as UseQueryOptions<
69
+ Awaited<ReturnType<typeof getMerchants>>,
70
+ TError,
71
+ TData
72
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
73
+ };
74
+
75
+ export type GetMerchantsQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>;
76
+ export type GetMerchantsQueryError = ErrorType<AsError | void>;
77
+
78
+ export function useGetMerchants<
79
+ TData = Awaited<ReturnType<typeof getMerchants>>,
80
+ TError = ErrorType<AsError | void>,
81
+ >(
82
+ options: {
83
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> &
84
+ Pick<
89
85
  DefinedInitialDataOptions<
90
86
  Awaited<ReturnType<typeof getMerchants>>,
91
87
  TError,
92
- TData
93
- > , 'initialData'
94
- >, request?: SecondParameter<typeof customInstance>}
95
-
96
- ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
97
- export function useGetMerchants<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
98
- options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> & Pick<
88
+ Awaited<ReturnType<typeof getMerchants>>
89
+ >,
90
+ "initialData"
91
+ >;
92
+ request?: SecondParameter<typeof customInstance>;
93
+ },
94
+ queryClient?: QueryClient,
95
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
96
+ export function useGetMerchants<
97
+ TData = Awaited<ReturnType<typeof getMerchants>>,
98
+ TError = ErrorType<AsError | void>,
99
+ >(
100
+ options?: {
101
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> &
102
+ Pick<
99
103
  UndefinedInitialDataOptions<
100
104
  Awaited<ReturnType<typeof getMerchants>>,
101
105
  TError,
102
- TData
103
- > , 'initialData'
104
- >, request?: SecondParameter<typeof customInstance>}
105
-
106
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
107
- export function useGetMerchants<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
108
- options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
109
-
110
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
106
+ Awaited<ReturnType<typeof getMerchants>>
107
+ >,
108
+ "initialData"
109
+ >;
110
+ request?: SecondParameter<typeof customInstance>;
111
+ },
112
+ queryClient?: QueryClient,
113
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
114
+ export function useGetMerchants<
115
+ TData = Awaited<ReturnType<typeof getMerchants>>,
116
+ TError = ErrorType<AsError | void>,
117
+ >(
118
+ options?: {
119
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
120
+ request?: SecondParameter<typeof customInstance>;
121
+ },
122
+ queryClient?: QueryClient,
123
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
111
124
  /**
112
125
  * @summary Gets all Merchants
113
126
  */
114
127
 
115
- export function useGetMerchants<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
116
- options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
117
-
118
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
128
+ export function useGetMerchants<
129
+ TData = Awaited<ReturnType<typeof getMerchants>>,
130
+ TError = ErrorType<AsError | void>,
131
+ >(
132
+ options?: {
133
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
134
+ request?: SecondParameter<typeof customInstance>;
135
+ },
136
+ queryClient?: QueryClient,
137
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
138
+ const queryOptions = useGetMerchantsQueryOptions(options);
119
139
 
120
- const queryOptions = getGetMerchantsQueryOptions(options)
140
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
141
+ queryKey: DataTag<QueryKey, TData, TError>;
142
+ };
121
143
 
122
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
123
-
124
- query.queryKey = queryOptions.queryKey ;
144
+ query.queryKey = queryOptions.queryKey;
125
145
 
126
146
  return query;
127
147
  }
128
148
 
129
-
130
-
131
- export const getGetMerchantsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
132
- ) => {
133
-
134
- const {query: queryOptions, request: requestOptions} = options ?? {};
135
-
136
- const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
137
-
138
-
139
-
140
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
141
-
142
-
143
-
144
-
145
-
146
- return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
147
- }
148
-
149
- export type GetMerchantsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
150
- export type GetMerchantsSuspenseQueryError = ErrorType<AsError | void>
151
-
152
-
153
- export function useGetMerchantsSuspense<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
154
- options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
155
-
156
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
157
- export function useGetMerchantsSuspense<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
158
- options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
159
-
160
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
161
- export function useGetMerchantsSuspense<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
162
- options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
163
-
164
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
149
+ export const useGetMerchantsSuspenseQueryOptions = <
150
+ TData = Awaited<ReturnType<typeof getMerchants>>,
151
+ TError = ErrorType<AsError | void>,
152
+ >(options?: {
153
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
154
+ request?: SecondParameter<typeof customInstance>;
155
+ }) => {
156
+ const { query: queryOptions, request: requestOptions } = options ?? {};
157
+
158
+ const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
159
+
160
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) =>
161
+ getMerchants(requestOptions, signal);
162
+
163
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
164
+
165
+ return customOptions as UseSuspenseQueryOptions<
166
+ Awaited<ReturnType<typeof getMerchants>>,
167
+ TError,
168
+ TData
169
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
170
+ };
171
+
172
+ export type GetMerchantsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>;
173
+ export type GetMerchantsSuspenseQueryError = ErrorType<AsError | void>;
174
+
175
+ export function useGetMerchantsSuspense<
176
+ TData = Awaited<ReturnType<typeof getMerchants>>,
177
+ TError = ErrorType<AsError | void>,
178
+ >(
179
+ options: {
180
+ query: Partial<
181
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
182
+ >;
183
+ request?: SecondParameter<typeof customInstance>;
184
+ },
185
+ queryClient?: QueryClient,
186
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
187
+ export function useGetMerchantsSuspense<
188
+ TData = Awaited<ReturnType<typeof getMerchants>>,
189
+ TError = ErrorType<AsError | void>,
190
+ >(
191
+ options?: {
192
+ query?: Partial<
193
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
194
+ >;
195
+ request?: SecondParameter<typeof customInstance>;
196
+ },
197
+ queryClient?: QueryClient,
198
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
199
+ export function useGetMerchantsSuspense<
200
+ TData = Awaited<ReturnType<typeof getMerchants>>,
201
+ TError = ErrorType<AsError | void>,
202
+ >(
203
+ options?: {
204
+ query?: Partial<
205
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
206
+ >;
207
+ request?: SecondParameter<typeof customInstance>;
208
+ },
209
+ queryClient?: QueryClient,
210
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
165
211
  /**
166
212
  * @summary Gets all Merchants
167
213
  */
168
214
 
169
- export function useGetMerchantsSuspense<TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
170
- options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
171
-
172
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
173
-
174
- const queryOptions = getGetMerchantsSuspenseQueryOptions(options)
175
-
176
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
177
-
178
- query.queryKey = queryOptions.queryKey ;
215
+ export function useGetMerchantsSuspense<
216
+ TData = Awaited<ReturnType<typeof getMerchants>>,
217
+ TError = ErrorType<AsError | void>,
218
+ >(
219
+ options?: {
220
+ query?: Partial<
221
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
222
+ >;
223
+ request?: SecondParameter<typeof customInstance>;
224
+ },
225
+ queryClient?: QueryClient,
226
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
227
+ const queryOptions = useGetMerchantsSuspenseQueryOptions(options);
228
+
229
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
230
+ TData,
231
+ TError
232
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
233
+
234
+ query.queryKey = queryOptions.queryKey;
179
235
 
180
236
  return query;
181
237
  }
182
238
 
183
-
184
-
185
239
  /**
186
240
  * Gets a known Merchant
187
241
 
188
242
  * @summary Gets a specific Merchant
189
243
  */
190
244
  export const getService = (
191
- mId: number,
192
- options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
245
+ mId: number,
246
+ options?: SecondParameter<typeof customInstance>,
247
+ signal?: AbortSignal,
193
248
  ) => {
194
-
195
-
196
- return customInstance<MerchantDetail>(
197
- {url: `/merchant/${mId}`, method: 'GET', signal
198
- },
199
- options);
200
- }
201
-
202
-
203
- export const getGetServiceQueryKey = (mId: number,) => {
204
- return ["account-server-api", `/merchant/${mId}`] as const;
205
- }
206
-
207
-
208
- export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
249
+ return customInstance<MerchantDetail>(
250
+ { url: `/merchant/${mId}`, method: "GET", signal },
251
+ options,
252
+ );
253
+ };
254
+
255
+ export const getGetServiceQueryKey = (mId: number) => {
256
+ return [`/merchant/${mId}`] as const;
257
+ };
258
+
259
+ export const useGetServiceQueryOptions = <
260
+ TData = Awaited<ReturnType<typeof getService>>,
261
+ TError = ErrorType<AsError | void>,
262
+ >(
263
+ mId: number,
264
+ options?: {
265
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
266
+ request?: SecondParameter<typeof customInstance>;
267
+ },
209
268
  ) => {
269
+ const { query: queryOptions, request: requestOptions } = options ?? {};
210
270
 
211
- const {query: queryOptions, request: requestOptions} = options ?? {};
212
-
213
- const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
214
-
215
-
271
+ const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
216
272
 
217
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
273
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) =>
274
+ getService(mId, requestOptions, signal);
218
275
 
219
-
276
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
220
277
 
221
-
222
-
223
- return { queryKey, queryFn, enabled: !!(mId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
224
- }
225
-
226
- export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
227
- export type GetServiceQueryError = ErrorType<AsError | void>
278
+ return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & {
279
+ queryKey: DataTag<QueryKey, TData, TError>;
280
+ };
281
+ };
228
282
 
283
+ export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>;
284
+ export type GetServiceQueryError = ErrorType<AsError | void>;
229
285
 
230
- export function useGetService<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
231
- mId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> & Pick<
286
+ export function useGetService<
287
+ TData = Awaited<ReturnType<typeof getService>>,
288
+ TError = ErrorType<AsError | void>,
289
+ >(
290
+ mId: number,
291
+ options: {
292
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> &
293
+ Pick<
232
294
  DefinedInitialDataOptions<
233
295
  Awaited<ReturnType<typeof getService>>,
234
296
  TError,
235
- TData
236
- > , 'initialData'
237
- >, request?: SecondParameter<typeof customInstance>}
238
-
239
- ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
240
- export function useGetService<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
241
- mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> & Pick<
297
+ Awaited<ReturnType<typeof getService>>
298
+ >,
299
+ "initialData"
300
+ >;
301
+ request?: SecondParameter<typeof customInstance>;
302
+ },
303
+ queryClient?: QueryClient,
304
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
305
+ export function useGetService<
306
+ TData = Awaited<ReturnType<typeof getService>>,
307
+ TError = ErrorType<AsError | void>,
308
+ >(
309
+ mId: number,
310
+ options?: {
311
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> &
312
+ Pick<
242
313
  UndefinedInitialDataOptions<
243
314
  Awaited<ReturnType<typeof getService>>,
244
315
  TError,
245
- TData
246
- > , 'initialData'
247
- >, request?: SecondParameter<typeof customInstance>}
248
-
249
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
250
- export function useGetService<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
251
- mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
252
-
253
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
316
+ Awaited<ReturnType<typeof getService>>
317
+ >,
318
+ "initialData"
319
+ >;
320
+ request?: SecondParameter<typeof customInstance>;
321
+ },
322
+ queryClient?: QueryClient,
323
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
324
+ export function useGetService<
325
+ TData = Awaited<ReturnType<typeof getService>>,
326
+ TError = ErrorType<AsError | void>,
327
+ >(
328
+ mId: number,
329
+ options?: {
330
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
331
+ request?: SecondParameter<typeof customInstance>;
332
+ },
333
+ queryClient?: QueryClient,
334
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
254
335
  /**
255
336
  * @summary Gets a specific Merchant
256
337
  */
257
338
 
258
- export function useGetService<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
259
- mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
260
-
261
- ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
262
-
263
- const queryOptions = getGetServiceQueryOptions(mId,options)
264
-
265
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
266
-
267
- query.queryKey = queryOptions.queryKey ;
339
+ export function useGetService<
340
+ TData = Awaited<ReturnType<typeof getService>>,
341
+ TError = ErrorType<AsError | void>,
342
+ >(
343
+ mId: number,
344
+ options?: {
345
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
346
+ request?: SecondParameter<typeof customInstance>;
347
+ },
348
+ queryClient?: QueryClient,
349
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
350
+ const queryOptions = useGetServiceQueryOptions(mId, options);
351
+
352
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
353
+ queryKey: DataTag<QueryKey, TData, TError>;
354
+ };
355
+
356
+ query.queryKey = queryOptions.queryKey;
268
357
 
269
358
  return query;
270
359
  }
271
360
 
272
-
273
-
274
- export const getGetServiceSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
361
+ export const useGetServiceSuspenseQueryOptions = <
362
+ TData = Awaited<ReturnType<typeof getService>>,
363
+ TError = ErrorType<AsError | void>,
364
+ >(
365
+ mId: number,
366
+ options?: {
367
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
368
+ request?: SecondParameter<typeof customInstance>;
369
+ },
275
370
  ) => {
276
-
277
- const {query: queryOptions, request: requestOptions} = options ?? {};
278
-
279
- const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
280
-
281
-
282
-
283
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
284
-
285
-
286
-
287
-
288
-
289
- return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
290
- }
291
-
292
- export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
293
- export type GetServiceSuspenseQueryError = ErrorType<AsError | void>
294
-
295
-
296
- export function useGetServiceSuspense<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
297
- mId: number, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
298
-
299
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
300
- export function useGetServiceSuspense<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
301
- mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
302
-
303
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
304
- export function useGetServiceSuspense<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
305
- mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
306
-
307
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
371
+ const { query: queryOptions, request: requestOptions } = options ?? {};
372
+
373
+ const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
374
+
375
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) =>
376
+ getService(mId, requestOptions, signal);
377
+
378
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
379
+
380
+ return customOptions as UseSuspenseQueryOptions<
381
+ Awaited<ReturnType<typeof getService>>,
382
+ TError,
383
+ TData
384
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
385
+ };
386
+
387
+ export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>;
388
+ export type GetServiceSuspenseQueryError = ErrorType<AsError | void>;
389
+
390
+ export function useGetServiceSuspense<
391
+ TData = Awaited<ReturnType<typeof getService>>,
392
+ TError = ErrorType<AsError | void>,
393
+ >(
394
+ mId: number,
395
+ options: {
396
+ query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
397
+ request?: SecondParameter<typeof customInstance>;
398
+ },
399
+ queryClient?: QueryClient,
400
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
401
+ export function useGetServiceSuspense<
402
+ TData = Awaited<ReturnType<typeof getService>>,
403
+ TError = ErrorType<AsError | void>,
404
+ >(
405
+ mId: number,
406
+ options?: {
407
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
408
+ request?: SecondParameter<typeof customInstance>;
409
+ },
410
+ queryClient?: QueryClient,
411
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
412
+ export function useGetServiceSuspense<
413
+ TData = Awaited<ReturnType<typeof getService>>,
414
+ TError = ErrorType<AsError | void>,
415
+ >(
416
+ mId: number,
417
+ options?: {
418
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
419
+ request?: SecondParameter<typeof customInstance>;
420
+ },
421
+ queryClient?: QueryClient,
422
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
308
423
  /**
309
424
  * @summary Gets a specific Merchant
310
425
  */
311
426
 
312
- export function useGetServiceSuspense<TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
313
- mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
314
-
315
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
316
-
317
- const queryOptions = getGetServiceSuspenseQueryOptions(mId,options)
318
-
319
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
320
-
321
- query.queryKey = queryOptions.queryKey ;
427
+ export function useGetServiceSuspense<
428
+ TData = Awaited<ReturnType<typeof getService>>,
429
+ TError = ErrorType<AsError | void>,
430
+ >(
431
+ mId: number,
432
+ options?: {
433
+ query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
434
+ request?: SecondParameter<typeof customInstance>;
435
+ },
436
+ queryClient?: QueryClient,
437
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
438
+ const queryOptions = useGetServiceSuspenseQueryOptions(mId, options);
439
+
440
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
441
+ TData,
442
+ TError
443
+ > & { queryKey: DataTag<QueryKey, TData, TError> };
444
+
445
+ query.queryKey = queryOptions.queryKey;
322
446
 
323
447
  return query;
324
448
  }
325
-
326
-
327
-