@squonk/account-server-client 4.4.0-4-4.2197467763 → 4.4.0-4-4.2200269934

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 (185) hide show
  1. package/dist/api/actions/actions.cjs +4 -4
  2. package/dist/api/actions/actions.cjs.map +1 -1
  3. package/dist/api/actions/actions.d.cts +35 -17
  4. package/dist/api/actions/actions.d.cts.map +1 -1
  5. package/dist/api/actions/actions.d.ts +35 -17
  6. package/dist/api/actions/actions.d.ts.map +1 -1
  7. package/dist/api/actions/actions.fetch.cjs +4 -4
  8. package/dist/api/actions/actions.fetch.cjs.map +1 -1
  9. package/dist/api/actions/actions.fetch.d.cts +35 -17
  10. package/dist/api/actions/actions.fetch.d.cts.map +1 -1
  11. package/dist/api/actions/actions.fetch.d.ts +35 -17
  12. package/dist/api/actions/actions.fetch.d.ts.map +1 -1
  13. package/dist/api/actions/actions.fetch.js +4 -4
  14. package/dist/api/actions/actions.fetch.js.map +1 -1
  15. package/dist/api/actions/actions.js +4 -4
  16. package/dist/api/actions/actions.js.map +1 -1
  17. package/dist/api/asset/asset.cjs +22 -22
  18. package/dist/api/asset/asset.cjs.map +1 -1
  19. package/dist/api/asset/asset.d.cts +76 -40
  20. package/dist/api/asset/asset.d.cts.map +1 -1
  21. package/dist/api/asset/asset.d.ts +76 -40
  22. package/dist/api/asset/asset.d.ts.map +1 -1
  23. package/dist/api/asset/asset.fetch.cjs +22 -22
  24. package/dist/api/asset/asset.fetch.cjs.map +1 -1
  25. package/dist/api/asset/asset.fetch.d.cts +76 -40
  26. package/dist/api/asset/asset.fetch.d.cts.map +1 -1
  27. package/dist/api/asset/asset.fetch.d.ts +76 -40
  28. package/dist/api/asset/asset.fetch.d.ts.map +1 -1
  29. package/dist/api/asset/asset.fetch.js +22 -22
  30. package/dist/api/asset/asset.fetch.js.map +1 -1
  31. package/dist/api/asset/asset.js +22 -22
  32. package/dist/api/asset/asset.js.map +1 -1
  33. package/dist/api/charges/charges.cjs +16 -16
  34. package/dist/api/charges/charges.cjs.map +1 -1
  35. package/dist/api/charges/charges.d.cts +137 -65
  36. package/dist/api/charges/charges.d.cts.map +1 -1
  37. package/dist/api/charges/charges.d.ts +137 -65
  38. package/dist/api/charges/charges.d.ts.map +1 -1
  39. package/dist/api/charges/charges.fetch.cjs +16 -16
  40. package/dist/api/charges/charges.fetch.cjs.map +1 -1
  41. package/dist/api/charges/charges.fetch.d.cts +137 -65
  42. package/dist/api/charges/charges.fetch.d.cts.map +1 -1
  43. package/dist/api/charges/charges.fetch.d.ts +137 -65
  44. package/dist/api/charges/charges.fetch.d.ts.map +1 -1
  45. package/dist/api/charges/charges.fetch.js +16 -16
  46. package/dist/api/charges/charges.fetch.js.map +1 -1
  47. package/dist/api/charges/charges.js +16 -16
  48. package/dist/api/charges/charges.js.map +1 -1
  49. package/dist/api/event-stream/event-stream.cjs +12 -12
  50. package/dist/api/event-stream/event-stream.cjs.map +1 -1
  51. package/dist/api/event-stream/event-stream.d.cts +71 -35
  52. package/dist/api/event-stream/event-stream.d.cts.map +1 -1
  53. package/dist/api/event-stream/event-stream.d.ts +71 -35
  54. package/dist/api/event-stream/event-stream.d.ts.map +1 -1
  55. package/dist/api/event-stream/event-stream.fetch.cjs +12 -12
  56. package/dist/api/event-stream/event-stream.fetch.cjs.map +1 -1
  57. package/dist/api/event-stream/event-stream.fetch.d.cts +71 -35
  58. package/dist/api/event-stream/event-stream.fetch.d.cts.map +1 -1
  59. package/dist/api/event-stream/event-stream.fetch.d.ts +71 -35
  60. package/dist/api/event-stream/event-stream.fetch.d.ts.map +1 -1
  61. package/dist/api/event-stream/event-stream.fetch.js +12 -12
  62. package/dist/api/event-stream/event-stream.fetch.js.map +1 -1
  63. package/dist/api/event-stream/event-stream.js +12 -12
  64. package/dist/api/event-stream/event-stream.js.map +1 -1
  65. package/dist/api/merchant/merchant.cjs +8 -8
  66. package/dist/api/merchant/merchant.cjs.map +1 -1
  67. package/dist/api/merchant/merchant.d.cts +69 -33
  68. package/dist/api/merchant/merchant.d.cts.map +1 -1
  69. package/dist/api/merchant/merchant.d.ts +69 -33
  70. package/dist/api/merchant/merchant.d.ts.map +1 -1
  71. package/dist/api/merchant/merchant.fetch.cjs +8 -8
  72. package/dist/api/merchant/merchant.fetch.cjs.map +1 -1
  73. package/dist/api/merchant/merchant.fetch.d.cts +69 -33
  74. package/dist/api/merchant/merchant.fetch.d.cts.map +1 -1
  75. package/dist/api/merchant/merchant.fetch.d.ts +69 -33
  76. package/dist/api/merchant/merchant.fetch.d.ts.map +1 -1
  77. package/dist/api/merchant/merchant.fetch.js +8 -8
  78. package/dist/api/merchant/merchant.fetch.js.map +1 -1
  79. package/dist/api/merchant/merchant.js +8 -8
  80. package/dist/api/merchant/merchant.js.map +1 -1
  81. package/dist/api/organisation/organisation.cjs +18 -18
  82. package/dist/api/organisation/organisation.cjs.map +1 -1
  83. package/dist/api/organisation/organisation.d.cts +106 -52
  84. package/dist/api/organisation/organisation.d.cts.map +1 -1
  85. package/dist/api/organisation/organisation.d.ts +106 -52
  86. package/dist/api/organisation/organisation.d.ts.map +1 -1
  87. package/dist/api/organisation/organisation.fetch.cjs +18 -18
  88. package/dist/api/organisation/organisation.fetch.cjs.map +1 -1
  89. package/dist/api/organisation/organisation.fetch.d.cts +106 -52
  90. package/dist/api/organisation/organisation.fetch.d.cts.map +1 -1
  91. package/dist/api/organisation/organisation.fetch.d.ts +106 -52
  92. package/dist/api/organisation/organisation.fetch.d.ts.map +1 -1
  93. package/dist/api/organisation/organisation.fetch.js +18 -18
  94. package/dist/api/organisation/organisation.fetch.js.map +1 -1
  95. package/dist/api/organisation/organisation.js +18 -18
  96. package/dist/api/organisation/organisation.js.map +1 -1
  97. package/dist/api/product/product.cjs +30 -30
  98. package/dist/api/product/product.cjs.map +1 -1
  99. package/dist/api/product/product.d.cts +208 -100
  100. package/dist/api/product/product.d.cts.map +1 -1
  101. package/dist/api/product/product.d.ts +208 -100
  102. package/dist/api/product/product.d.ts.map +1 -1
  103. package/dist/api/product/product.fetch.cjs +30 -30
  104. package/dist/api/product/product.fetch.cjs.map +1 -1
  105. package/dist/api/product/product.fetch.d.cts +208 -100
  106. package/dist/api/product/product.fetch.d.cts.map +1 -1
  107. package/dist/api/product/product.fetch.d.ts +208 -100
  108. package/dist/api/product/product.fetch.d.ts.map +1 -1
  109. package/dist/api/product/product.fetch.js +30 -30
  110. package/dist/api/product/product.fetch.js.map +1 -1
  111. package/dist/api/product/product.js +30 -30
  112. package/dist/api/product/product.js.map +1 -1
  113. package/dist/api/state/state.cjs +4 -4
  114. package/dist/api/state/state.cjs.map +1 -1
  115. package/dist/api/state/state.d.cts +35 -17
  116. package/dist/api/state/state.d.cts.map +1 -1
  117. package/dist/api/state/state.d.ts +35 -17
  118. package/dist/api/state/state.d.ts.map +1 -1
  119. package/dist/api/state/state.fetch.cjs +4 -4
  120. package/dist/api/state/state.fetch.cjs.map +1 -1
  121. package/dist/api/state/state.fetch.d.cts +35 -17
  122. package/dist/api/state/state.fetch.d.cts.map +1 -1
  123. package/dist/api/state/state.fetch.d.ts +35 -17
  124. package/dist/api/state/state.fetch.d.ts.map +1 -1
  125. package/dist/api/state/state.fetch.js +4 -4
  126. package/dist/api/state/state.fetch.js.map +1 -1
  127. package/dist/api/state/state.js +4 -4
  128. package/dist/api/state/state.js.map +1 -1
  129. package/dist/api/unit/unit.cjs +30 -30
  130. package/dist/api/unit/unit.cjs.map +1 -1
  131. package/dist/api/unit/unit.d.cts +144 -72
  132. package/dist/api/unit/unit.d.cts.map +1 -1
  133. package/dist/api/unit/unit.d.ts +144 -72
  134. package/dist/api/unit/unit.d.ts.map +1 -1
  135. package/dist/api/unit/unit.fetch.cjs +30 -30
  136. package/dist/api/unit/unit.fetch.cjs.map +1 -1
  137. package/dist/api/unit/unit.fetch.d.cts +144 -72
  138. package/dist/api/unit/unit.fetch.d.cts.map +1 -1
  139. package/dist/api/unit/unit.fetch.d.ts +144 -72
  140. package/dist/api/unit/unit.fetch.d.ts.map +1 -1
  141. package/dist/api/unit/unit.fetch.js +30 -30
  142. package/dist/api/unit/unit.fetch.js.map +1 -1
  143. package/dist/api/unit/unit.js +30 -30
  144. package/dist/api/unit/unit.js.map +1 -1
  145. package/dist/api/user/user.cjs +20 -20
  146. package/dist/api/user/user.cjs.map +1 -1
  147. package/dist/api/user/user.d.cts +107 -53
  148. package/dist/api/user/user.d.cts.map +1 -1
  149. package/dist/api/user/user.d.ts +107 -53
  150. package/dist/api/user/user.d.ts.map +1 -1
  151. package/dist/api/user/user.fetch.cjs +20 -20
  152. package/dist/api/user/user.fetch.cjs.map +1 -1
  153. package/dist/api/user/user.fetch.d.cts +107 -53
  154. package/dist/api/user/user.fetch.d.cts.map +1 -1
  155. package/dist/api/user/user.fetch.d.ts +107 -53
  156. package/dist/api/user/user.fetch.d.ts.map +1 -1
  157. package/dist/api/user/user.fetch.js +20 -20
  158. package/dist/api/user/user.fetch.js.map +1 -1
  159. package/dist/api/user/user.js +20 -20
  160. package/dist/api/user/user.js.map +1 -1
  161. package/package.json +7 -5
  162. package/src/api/actions/actions.fetch.ts +103 -12
  163. package/src/api/actions/actions.ts +103 -12
  164. package/src/api/asset/asset.fetch.ts +303 -94
  165. package/src/api/asset/asset.ts +303 -94
  166. package/src/api/charges/charges.fetch.ts +456 -54
  167. package/src/api/charges/charges.ts +456 -54
  168. package/src/api/event-stream/event-stream.fetch.ts +262 -58
  169. package/src/api/event-stream/event-stream.ts +262 -58
  170. package/src/api/merchant/merchant.fetch.ts +212 -28
  171. package/src/api/merchant/merchant.ts +212 -28
  172. package/src/api/organisation/organisation.fetch.ts +381 -86
  173. package/src/api/organisation/organisation.ts +381 -86
  174. package/src/api/product/product.fetch.ts +724 -130
  175. package/src/api/product/product.ts +724 -130
  176. package/src/api/state/state.fetch.ts +105 -16
  177. package/src/api/state/state.ts +105 -16
  178. package/src/api/unit/unit.fetch.ts +521 -146
  179. package/src/api/unit/unit.ts +521 -146
  180. package/src/api/user/user.fetch.ts +401 -101
  181. package/src/api/user/user.ts +401 -101
  182. package/tests/README.md +98 -0
  183. package/tests/component.test.tsx +191 -0
  184. package/tests/tsconfig.json +7 -0
  185. package/tests/type-tests.tsx +196 -0
@@ -10,11 +10,15 @@ A service that provides access to the Account Server, which gives *registered* u
10
10
  */
11
11
  import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
12
12
  import type {
13
+ DataTag,
14
+ DefinedInitialDataOptions,
15
+ DefinedUseQueryResult,
13
16
  InvalidateOptions,
14
17
  MutationFunction,
15
18
  QueryClient,
16
19
  QueryFunction,
17
20
  QueryKey,
21
+ UndefinedInitialDataOptions,
18
22
  UseMutationOptions,
19
23
  UseMutationResult,
20
24
  UseQueryOptions,
@@ -99,7 +103,7 @@ export const getGetOrganisationsQueryOptions = <
99
103
  >(
100
104
  params?: GetOrganisationsParams,
101
105
  options?: {
102
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
106
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
103
107
  request?: SecondParameter<typeof customFetch>;
104
108
  },
105
109
  ) => {
@@ -114,12 +118,61 @@ export const getGetOrganisationsQueryOptions = <
114
118
  Awaited<ReturnType<typeof getOrganisations>>,
115
119
  TError,
116
120
  TData
117
- > & { queryKey: QueryKey };
121
+ > & { queryKey: DataTag<QueryKey, TData> };
118
122
  };
119
123
 
120
124
  export type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>;
121
125
  export type GetOrganisationsQueryError = ErrorType<void | AsError>;
122
126
 
127
+ export function useGetOrganisations<
128
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
129
+ TError = ErrorType<void | AsError>,
130
+ >(
131
+ params: undefined | GetOrganisationsParams,
132
+ options: {
133
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>> &
134
+ Pick<
135
+ DefinedInitialDataOptions<
136
+ Awaited<ReturnType<typeof getOrganisations>>,
137
+ TError,
138
+ Awaited<ReturnType<typeof getOrganisations>>
139
+ >,
140
+ "initialData"
141
+ >;
142
+ request?: SecondParameter<typeof customFetch>;
143
+ },
144
+ queryClient?: QueryClient,
145
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
146
+ export function useGetOrganisations<
147
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
148
+ TError = ErrorType<void | AsError>,
149
+ >(
150
+ params?: GetOrganisationsParams,
151
+ options?: {
152
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>> &
153
+ Pick<
154
+ UndefinedInitialDataOptions<
155
+ Awaited<ReturnType<typeof getOrganisations>>,
156
+ TError,
157
+ Awaited<ReturnType<typeof getOrganisations>>
158
+ >,
159
+ "initialData"
160
+ >;
161
+ request?: SecondParameter<typeof customFetch>;
162
+ },
163
+ queryClient?: QueryClient,
164
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
165
+ export function useGetOrganisations<
166
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
167
+ TError = ErrorType<void | AsError>,
168
+ >(
169
+ params?: GetOrganisationsParams,
170
+ options?: {
171
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
172
+ request?: SecondParameter<typeof customFetch>;
173
+ },
174
+ queryClient?: QueryClient,
175
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
123
176
  /**
124
177
  * @summary Gets Organisations
125
178
  */
@@ -130,13 +183,16 @@ export function useGetOrganisations<
130
183
  >(
131
184
  params?: GetOrganisationsParams,
132
185
  options?: {
133
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
186
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
134
187
  request?: SecondParameter<typeof customFetch>;
135
188
  },
136
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
189
+ queryClient?: QueryClient,
190
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
137
191
  const queryOptions = getGetOrganisationsQueryOptions(params, options);
138
192
 
139
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
193
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
194
+ queryKey: DataTag<QueryKey, TData>;
195
+ };
140
196
 
141
197
  query.queryKey = queryOptions.queryKey;
142
198
 
@@ -162,7 +218,9 @@ export const getGetOrganisationsSuspenseQueryOptions = <
162
218
  >(
163
219
  params?: GetOrganisationsParams,
164
220
  options?: {
165
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
221
+ query?: Partial<
222
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
223
+ >;
166
224
  request?: SecondParameter<typeof customFetch>;
167
225
  },
168
226
  ) => {
@@ -177,7 +235,7 @@ export const getGetOrganisationsSuspenseQueryOptions = <
177
235
  Awaited<ReturnType<typeof getOrganisations>>,
178
236
  TError,
179
237
  TData
180
- > & { queryKey: QueryKey };
238
+ > & { queryKey: DataTag<QueryKey, TData> };
181
239
  };
182
240
 
183
241
  export type GetOrganisationsSuspenseQueryResult = NonNullable<
@@ -185,6 +243,45 @@ export type GetOrganisationsSuspenseQueryResult = NonNullable<
185
243
  >;
186
244
  export type GetOrganisationsSuspenseQueryError = ErrorType<void | AsError>;
187
245
 
246
+ export function useGetOrganisationsSuspense<
247
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
248
+ TError = ErrorType<void | AsError>,
249
+ >(
250
+ params: undefined | GetOrganisationsParams,
251
+ options: {
252
+ query: Partial<
253
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
254
+ >;
255
+ request?: SecondParameter<typeof customFetch>;
256
+ },
257
+ queryClient?: QueryClient,
258
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
259
+ export function useGetOrganisationsSuspense<
260
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
261
+ TError = ErrorType<void | AsError>,
262
+ >(
263
+ params?: GetOrganisationsParams,
264
+ options?: {
265
+ query?: Partial<
266
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
267
+ >;
268
+ request?: SecondParameter<typeof customFetch>;
269
+ },
270
+ queryClient?: QueryClient,
271
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
272
+ export function useGetOrganisationsSuspense<
273
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
274
+ TError = ErrorType<void | AsError>,
275
+ >(
276
+ params?: GetOrganisationsParams,
277
+ options?: {
278
+ query?: Partial<
279
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
280
+ >;
281
+ request?: SecondParameter<typeof customFetch>;
282
+ },
283
+ queryClient?: QueryClient,
284
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
188
285
  /**
189
286
  * @summary Gets Organisations
190
287
  */
@@ -195,15 +292,19 @@ export function useGetOrganisationsSuspense<
195
292
  >(
196
293
  params?: GetOrganisationsParams,
197
294
  options?: {
198
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
295
+ query?: Partial<
296
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
297
+ >;
199
298
  request?: SecondParameter<typeof customFetch>;
200
299
  },
201
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
300
+ queryClient?: QueryClient,
301
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
202
302
  const queryOptions = getGetOrganisationsSuspenseQueryOptions(params, options);
203
303
 
204
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
205
- queryKey: QueryKey;
206
- };
304
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
305
+ TData,
306
+ TError
307
+ > & { queryKey: DataTag<QueryKey, TData> };
207
308
 
208
309
  query.queryKey = queryOptions.queryKey;
209
310
 
@@ -301,18 +402,18 @@ export type CreateOrganisationMutationError = ErrorType<AsError | void>;
301
402
  /**
302
403
  * @summary Create a new organisation
303
404
  */
304
- export const useCreateOrganisation = <
305
- TError = ErrorType<AsError | void>,
306
- TContext = unknown,
307
- >(options?: {
308
- mutation?: UseMutationOptions<
309
- Awaited<ReturnType<typeof createOrganisation>>,
310
- TError,
311
- { data: OrganisationPostBodyBody },
312
- TContext
313
- >;
314
- request?: SecondParameter<typeof customFetch>;
315
- }): UseMutationResult<
405
+ export const useCreateOrganisation = <TError = ErrorType<AsError | void>, TContext = unknown>(
406
+ options?: {
407
+ mutation?: UseMutationOptions<
408
+ Awaited<ReturnType<typeof createOrganisation>>,
409
+ TError,
410
+ { data: OrganisationPostBodyBody },
411
+ TContext
412
+ >;
413
+ request?: SecondParameter<typeof customFetch>;
414
+ },
415
+ queryClient?: QueryClient,
416
+ ): UseMutationResult<
316
417
  Awaited<ReturnType<typeof createOrganisation>>,
317
418
  TError,
318
419
  { data: OrganisationPostBodyBody },
@@ -320,7 +421,7 @@ export const useCreateOrganisation = <
320
421
  > => {
321
422
  const mutationOptions = getCreateOrganisationMutationOptions(options);
322
423
 
323
- return useMutation(mutationOptions);
424
+ return useMutation(mutationOptions, queryClient);
324
425
  };
325
426
  /**
326
427
  * Gets an Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation or are its *creator*.
@@ -370,7 +471,7 @@ export const getGetOrganisationQueryOptions = <
370
471
  >(
371
472
  orgId: string,
372
473
  options?: {
373
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
474
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
374
475
  request?: SecondParameter<typeof customFetch>;
375
476
  },
376
477
  ) => {
@@ -385,12 +486,61 @@ export const getGetOrganisationQueryOptions = <
385
486
  Awaited<ReturnType<typeof getOrganisation>>,
386
487
  TError,
387
488
  TData
388
- > & { queryKey: QueryKey };
489
+ > & { queryKey: DataTag<QueryKey, TData> };
389
490
  };
390
491
 
391
492
  export type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>;
392
493
  export type GetOrganisationQueryError = ErrorType<void | AsError>;
393
494
 
495
+ export function useGetOrganisation<
496
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
497
+ TError = ErrorType<void | AsError>,
498
+ >(
499
+ orgId: string,
500
+ options: {
501
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>> &
502
+ Pick<
503
+ DefinedInitialDataOptions<
504
+ Awaited<ReturnType<typeof getOrganisation>>,
505
+ TError,
506
+ Awaited<ReturnType<typeof getOrganisation>>
507
+ >,
508
+ "initialData"
509
+ >;
510
+ request?: SecondParameter<typeof customFetch>;
511
+ },
512
+ queryClient?: QueryClient,
513
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
514
+ export function useGetOrganisation<
515
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
516
+ TError = ErrorType<void | AsError>,
517
+ >(
518
+ orgId: string,
519
+ options?: {
520
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>> &
521
+ Pick<
522
+ UndefinedInitialDataOptions<
523
+ Awaited<ReturnType<typeof getOrganisation>>,
524
+ TError,
525
+ Awaited<ReturnType<typeof getOrganisation>>
526
+ >,
527
+ "initialData"
528
+ >;
529
+ request?: SecondParameter<typeof customFetch>;
530
+ },
531
+ queryClient?: QueryClient,
532
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
533
+ export function useGetOrganisation<
534
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
535
+ TError = ErrorType<void | AsError>,
536
+ >(
537
+ orgId: string,
538
+ options?: {
539
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
540
+ request?: SecondParameter<typeof customFetch>;
541
+ },
542
+ queryClient?: QueryClient,
543
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
394
544
  /**
395
545
  * @summary Gets an Organisation
396
546
  */
@@ -401,13 +551,16 @@ export function useGetOrganisation<
401
551
  >(
402
552
  orgId: string,
403
553
  options?: {
404
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
554
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
405
555
  request?: SecondParameter<typeof customFetch>;
406
556
  },
407
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
557
+ queryClient?: QueryClient,
558
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
408
559
  const queryOptions = getGetOrganisationQueryOptions(orgId, options);
409
560
 
410
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
561
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
562
+ queryKey: DataTag<QueryKey, TData>;
563
+ };
411
564
 
412
565
  query.queryKey = queryOptions.queryKey;
413
566
 
@@ -433,7 +586,9 @@ export const getGetOrganisationSuspenseQueryOptions = <
433
586
  >(
434
587
  orgId: string,
435
588
  options?: {
436
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
589
+ query?: Partial<
590
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
591
+ >;
437
592
  request?: SecondParameter<typeof customFetch>;
438
593
  },
439
594
  ) => {
@@ -448,7 +603,7 @@ export const getGetOrganisationSuspenseQueryOptions = <
448
603
  Awaited<ReturnType<typeof getOrganisation>>,
449
604
  TError,
450
605
  TData
451
- > & { queryKey: QueryKey };
606
+ > & { queryKey: DataTag<QueryKey, TData> };
452
607
  };
453
608
 
454
609
  export type GetOrganisationSuspenseQueryResult = NonNullable<
@@ -456,6 +611,45 @@ export type GetOrganisationSuspenseQueryResult = NonNullable<
456
611
  >;
457
612
  export type GetOrganisationSuspenseQueryError = ErrorType<void | AsError>;
458
613
 
614
+ export function useGetOrganisationSuspense<
615
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
616
+ TError = ErrorType<void | AsError>,
617
+ >(
618
+ orgId: string,
619
+ options: {
620
+ query: Partial<
621
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
622
+ >;
623
+ request?: SecondParameter<typeof customFetch>;
624
+ },
625
+ queryClient?: QueryClient,
626
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
627
+ export function useGetOrganisationSuspense<
628
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
629
+ TError = ErrorType<void | AsError>,
630
+ >(
631
+ orgId: string,
632
+ options?: {
633
+ query?: Partial<
634
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
635
+ >;
636
+ request?: SecondParameter<typeof customFetch>;
637
+ },
638
+ queryClient?: QueryClient,
639
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
640
+ export function useGetOrganisationSuspense<
641
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
642
+ TError = ErrorType<void | AsError>,
643
+ >(
644
+ orgId: string,
645
+ options?: {
646
+ query?: Partial<
647
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
648
+ >;
649
+ request?: SecondParameter<typeof customFetch>;
650
+ },
651
+ queryClient?: QueryClient,
652
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
459
653
  /**
460
654
  * @summary Gets an Organisation
461
655
  */
@@ -466,15 +660,19 @@ export function useGetOrganisationSuspense<
466
660
  >(
467
661
  orgId: string,
468
662
  options?: {
469
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
663
+ query?: Partial<
664
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
665
+ >;
470
666
  request?: SecondParameter<typeof customFetch>;
471
667
  },
472
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
668
+ queryClient?: QueryClient,
669
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
473
670
  const queryOptions = getGetOrganisationSuspenseQueryOptions(orgId, options);
474
671
 
475
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
476
- queryKey: QueryKey;
477
- };
672
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
673
+ TData,
674
+ TError
675
+ > & { queryKey: DataTag<QueryKey, TData> };
478
676
 
479
677
  query.queryKey = queryOptions.queryKey;
480
678
 
@@ -571,18 +769,18 @@ export type PatchOrganisationMutationError = ErrorType<void | AsError>;
571
769
  /**
572
770
  * @summary Adjust an existing Organisation
573
771
  */
574
- export const usePatchOrganisation = <
575
- TError = ErrorType<void | AsError>,
576
- TContext = unknown,
577
- >(options?: {
578
- mutation?: UseMutationOptions<
579
- Awaited<ReturnType<typeof patchOrganisation>>,
580
- TError,
581
- { orgId: string; data: OrganisationPatchBodyBody },
582
- TContext
583
- >;
584
- request?: SecondParameter<typeof customFetch>;
585
- }): UseMutationResult<
772
+ export const usePatchOrganisation = <TError = ErrorType<void | AsError>, TContext = unknown>(
773
+ options?: {
774
+ mutation?: UseMutationOptions<
775
+ Awaited<ReturnType<typeof patchOrganisation>>,
776
+ TError,
777
+ { orgId: string; data: OrganisationPatchBodyBody },
778
+ TContext
779
+ >;
780
+ request?: SecondParameter<typeof customFetch>;
781
+ },
782
+ queryClient?: QueryClient,
783
+ ): UseMutationResult<
586
784
  Awaited<ReturnType<typeof patchOrganisation>>,
587
785
  TError,
588
786
  { orgId: string; data: OrganisationPatchBodyBody },
@@ -590,7 +788,7 @@ export const usePatchOrganisation = <
590
788
  > => {
591
789
  const mutationOptions = getPatchOrganisationMutationOptions(options);
592
790
 
593
- return useMutation(mutationOptions);
791
+ return useMutation(mutationOptions, queryClient);
594
792
  };
595
793
  /**
596
794
  * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.
@@ -679,18 +877,18 @@ export type DeleteOrganisationMutationError = ErrorType<AsError | void>;
679
877
  /**
680
878
  * @summary Deletes an Organisation
681
879
  */
682
- export const useDeleteOrganisation = <
683
- TError = ErrorType<AsError | void>,
684
- TContext = unknown,
685
- >(options?: {
686
- mutation?: UseMutationOptions<
687
- Awaited<ReturnType<typeof deleteOrganisation>>,
688
- TError,
689
- { orgId: string },
690
- TContext
691
- >;
692
- request?: SecondParameter<typeof customFetch>;
693
- }): UseMutationResult<
880
+ export const useDeleteOrganisation = <TError = ErrorType<AsError | void>, TContext = unknown>(
881
+ options?: {
882
+ mutation?: UseMutationOptions<
883
+ Awaited<ReturnType<typeof deleteOrganisation>>,
884
+ TError,
885
+ { orgId: string },
886
+ TContext
887
+ >;
888
+ request?: SecondParameter<typeof customFetch>;
889
+ },
890
+ queryClient?: QueryClient,
891
+ ): UseMutationResult<
694
892
  Awaited<ReturnType<typeof deleteOrganisation>>,
695
893
  TError,
696
894
  { orgId: string },
@@ -698,7 +896,7 @@ export const useDeleteOrganisation = <
698
896
  > => {
699
897
  const mutationOptions = getDeleteOrganisationMutationOptions(options);
700
898
 
701
- return useMutation(mutationOptions);
899
+ return useMutation(mutationOptions, queryClient);
702
900
  };
703
901
  /**
704
902
  * Gets the Default Organisation, a built-in Organisation used exclusively for **Personal Units**.
@@ -752,7 +950,9 @@ export const getGetDefaultOrganisationQueryOptions = <
752
950
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
753
951
  TError = ErrorType<void | AsError>,
754
952
  >(options?: {
755
- query?: UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>;
953
+ query?: Partial<
954
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
955
+ >;
756
956
  request?: SecondParameter<typeof customFetch>;
757
957
  }) => {
758
958
  const { query: queryOptions, request: requestOptions } = options ?? {};
@@ -766,7 +966,7 @@ export const getGetDefaultOrganisationQueryOptions = <
766
966
  Awaited<ReturnType<typeof getDefaultOrganisation>>,
767
967
  TError,
768
968
  TData
769
- > & { queryKey: QueryKey };
969
+ > & { queryKey: DataTag<QueryKey, TData> };
770
970
  };
771
971
 
772
972
  export type GetDefaultOrganisationQueryResult = NonNullable<
@@ -774,6 +974,58 @@ export type GetDefaultOrganisationQueryResult = NonNullable<
774
974
  >;
775
975
  export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
776
976
 
977
+ export function useGetDefaultOrganisation<
978
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
979
+ TError = ErrorType<void | AsError>,
980
+ >(
981
+ options: {
982
+ query: Partial<
983
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
984
+ > &
985
+ Pick<
986
+ DefinedInitialDataOptions<
987
+ Awaited<ReturnType<typeof getDefaultOrganisation>>,
988
+ TError,
989
+ Awaited<ReturnType<typeof getDefaultOrganisation>>
990
+ >,
991
+ "initialData"
992
+ >;
993
+ request?: SecondParameter<typeof customFetch>;
994
+ },
995
+ queryClient?: QueryClient,
996
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
997
+ export function useGetDefaultOrganisation<
998
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
999
+ TError = ErrorType<void | AsError>,
1000
+ >(
1001
+ options?: {
1002
+ query?: Partial<
1003
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1004
+ > &
1005
+ Pick<
1006
+ UndefinedInitialDataOptions<
1007
+ Awaited<ReturnType<typeof getDefaultOrganisation>>,
1008
+ TError,
1009
+ Awaited<ReturnType<typeof getDefaultOrganisation>>
1010
+ >,
1011
+ "initialData"
1012
+ >;
1013
+ request?: SecondParameter<typeof customFetch>;
1014
+ },
1015
+ queryClient?: QueryClient,
1016
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
1017
+ export function useGetDefaultOrganisation<
1018
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
1019
+ TError = ErrorType<void | AsError>,
1020
+ >(
1021
+ options?: {
1022
+ query?: Partial<
1023
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1024
+ >;
1025
+ request?: SecondParameter<typeof customFetch>;
1026
+ },
1027
+ queryClient?: QueryClient,
1028
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
777
1029
  /**
778
1030
  * @summary Gets the Default Organisation
779
1031
  */
@@ -781,13 +1033,20 @@ export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
781
1033
  export function useGetDefaultOrganisation<
782
1034
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
783
1035
  TError = ErrorType<void | AsError>,
784
- >(options?: {
785
- query?: UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>;
786
- request?: SecondParameter<typeof customFetch>;
787
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
1036
+ >(
1037
+ options?: {
1038
+ query?: Partial<
1039
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1040
+ >;
1041
+ request?: SecondParameter<typeof customFetch>;
1042
+ },
1043
+ queryClient?: QueryClient,
1044
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
788
1045
  const queryOptions = getGetDefaultOrganisationQueryOptions(options);
789
1046
 
790
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
1047
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
1048
+ queryKey: DataTag<QueryKey, TData>;
1049
+ };
791
1050
 
792
1051
  query.queryKey = queryOptions.queryKey;
793
1052
 
@@ -810,10 +1069,8 @@ export const getGetDefaultOrganisationSuspenseQueryOptions = <
810
1069
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
811
1070
  TError = ErrorType<void | AsError>,
812
1071
  >(options?: {
813
- query?: UseSuspenseQueryOptions<
814
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
815
- TError,
816
- TData
1072
+ query?: Partial<
1073
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
817
1074
  >;
818
1075
  request?: SecondParameter<typeof customFetch>;
819
1076
  }) => {
@@ -828,7 +1085,7 @@ export const getGetDefaultOrganisationSuspenseQueryOptions = <
828
1085
  Awaited<ReturnType<typeof getDefaultOrganisation>>,
829
1086
  TError,
830
1087
  TData
831
- > & { queryKey: QueryKey };
1088
+ > & { queryKey: DataTag<QueryKey, TData> };
832
1089
  };
833
1090
 
834
1091
  export type GetDefaultOrganisationSuspenseQueryResult = NonNullable<
@@ -836,6 +1093,42 @@ export type GetDefaultOrganisationSuspenseQueryResult = NonNullable<
836
1093
  >;
837
1094
  export type GetDefaultOrganisationSuspenseQueryError = ErrorType<void | AsError>;
838
1095
 
1096
+ export function useGetDefaultOrganisationSuspense<
1097
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
1098
+ TError = ErrorType<void | AsError>,
1099
+ >(
1100
+ options: {
1101
+ query: Partial<
1102
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1103
+ >;
1104
+ request?: SecondParameter<typeof customFetch>;
1105
+ },
1106
+ queryClient?: QueryClient,
1107
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
1108
+ export function useGetDefaultOrganisationSuspense<
1109
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
1110
+ TError = ErrorType<void | AsError>,
1111
+ >(
1112
+ options?: {
1113
+ query?: Partial<
1114
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1115
+ >;
1116
+ request?: SecondParameter<typeof customFetch>;
1117
+ },
1118
+ queryClient?: QueryClient,
1119
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
1120
+ export function useGetDefaultOrganisationSuspense<
1121
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
1122
+ TError = ErrorType<void | AsError>,
1123
+ >(
1124
+ options?: {
1125
+ query?: Partial<
1126
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1127
+ >;
1128
+ request?: SecondParameter<typeof customFetch>;
1129
+ },
1130
+ queryClient?: QueryClient,
1131
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
839
1132
  /**
840
1133
  * @summary Gets the Default Organisation
841
1134
  */
@@ -843,19 +1136,21 @@ export type GetDefaultOrganisationSuspenseQueryError = ErrorType<void | AsError>
843
1136
  export function useGetDefaultOrganisationSuspense<
844
1137
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
845
1138
  TError = ErrorType<void | AsError>,
846
- >(options?: {
847
- query?: UseSuspenseQueryOptions<
848
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
849
- TError,
850
- TData
851
- >;
852
- request?: SecondParameter<typeof customFetch>;
853
- }): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
1139
+ >(
1140
+ options?: {
1141
+ query?: Partial<
1142
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
1143
+ >;
1144
+ request?: SecondParameter<typeof customFetch>;
1145
+ },
1146
+ queryClient?: QueryClient,
1147
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
854
1148
  const queryOptions = getGetDefaultOrganisationSuspenseQueryOptions(options);
855
1149
 
856
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
857
- queryKey: QueryKey;
858
- };
1150
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
1151
+ TData,
1152
+ TError
1153
+ > & { queryKey: DataTag<QueryKey, TData> };
859
1154
 
860
1155
  query.queryKey = queryOptions.queryKey;
861
1156