@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,
@@ -67,7 +71,7 @@ export const getGetOrganisationsQueryOptions = <
67
71
  >(
68
72
  params?: GetOrganisationsParams,
69
73
  options?: {
70
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
74
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
71
75
  request?: SecondParameter<typeof customInstance>;
72
76
  },
73
77
  ) => {
@@ -82,12 +86,61 @@ export const getGetOrganisationsQueryOptions = <
82
86
  Awaited<ReturnType<typeof getOrganisations>>,
83
87
  TError,
84
88
  TData
85
- > & { queryKey: QueryKey };
89
+ > & { queryKey: DataTag<QueryKey, TData> };
86
90
  };
87
91
 
88
92
  export type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>;
89
93
  export type GetOrganisationsQueryError = ErrorType<void | AsError>;
90
94
 
95
+ export function useGetOrganisations<
96
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
97
+ TError = ErrorType<void | AsError>,
98
+ >(
99
+ params: undefined | GetOrganisationsParams,
100
+ options: {
101
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>> &
102
+ Pick<
103
+ DefinedInitialDataOptions<
104
+ Awaited<ReturnType<typeof getOrganisations>>,
105
+ TError,
106
+ Awaited<ReturnType<typeof getOrganisations>>
107
+ >,
108
+ "initialData"
109
+ >;
110
+ request?: SecondParameter<typeof customInstance>;
111
+ },
112
+ queryClient?: QueryClient,
113
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
114
+ export function useGetOrganisations<
115
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
116
+ TError = ErrorType<void | AsError>,
117
+ >(
118
+ params?: GetOrganisationsParams,
119
+ options?: {
120
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>> &
121
+ Pick<
122
+ UndefinedInitialDataOptions<
123
+ Awaited<ReturnType<typeof getOrganisations>>,
124
+ TError,
125
+ Awaited<ReturnType<typeof getOrganisations>>
126
+ >,
127
+ "initialData"
128
+ >;
129
+ request?: SecondParameter<typeof customInstance>;
130
+ },
131
+ queryClient?: QueryClient,
132
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
133
+ export function useGetOrganisations<
134
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
135
+ TError = ErrorType<void | AsError>,
136
+ >(
137
+ params?: GetOrganisationsParams,
138
+ options?: {
139
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
140
+ request?: SecondParameter<typeof customInstance>;
141
+ },
142
+ queryClient?: QueryClient,
143
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
91
144
  /**
92
145
  * @summary Gets Organisations
93
146
  */
@@ -98,13 +151,16 @@ export function useGetOrganisations<
98
151
  >(
99
152
  params?: GetOrganisationsParams,
100
153
  options?: {
101
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
154
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>;
102
155
  request?: SecondParameter<typeof customInstance>;
103
156
  },
104
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
157
+ queryClient?: QueryClient,
158
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
105
159
  const queryOptions = getGetOrganisationsQueryOptions(params, options);
106
160
 
107
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
161
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
162
+ queryKey: DataTag<QueryKey, TData>;
163
+ };
108
164
 
109
165
  query.queryKey = queryOptions.queryKey;
110
166
 
@@ -130,7 +186,9 @@ export const getGetOrganisationsSuspenseQueryOptions = <
130
186
  >(
131
187
  params?: GetOrganisationsParams,
132
188
  options?: {
133
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
189
+ query?: Partial<
190
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
191
+ >;
134
192
  request?: SecondParameter<typeof customInstance>;
135
193
  },
136
194
  ) => {
@@ -145,7 +203,7 @@ export const getGetOrganisationsSuspenseQueryOptions = <
145
203
  Awaited<ReturnType<typeof getOrganisations>>,
146
204
  TError,
147
205
  TData
148
- > & { queryKey: QueryKey };
206
+ > & { queryKey: DataTag<QueryKey, TData> };
149
207
  };
150
208
 
151
209
  export type GetOrganisationsSuspenseQueryResult = NonNullable<
@@ -153,6 +211,45 @@ export type GetOrganisationsSuspenseQueryResult = NonNullable<
153
211
  >;
154
212
  export type GetOrganisationsSuspenseQueryError = ErrorType<void | AsError>;
155
213
 
214
+ export function useGetOrganisationsSuspense<
215
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
216
+ TError = ErrorType<void | AsError>,
217
+ >(
218
+ params: undefined | GetOrganisationsParams,
219
+ options: {
220
+ query: Partial<
221
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
222
+ >;
223
+ request?: SecondParameter<typeof customInstance>;
224
+ },
225
+ queryClient?: QueryClient,
226
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
227
+ export function useGetOrganisationsSuspense<
228
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
229
+ TError = ErrorType<void | AsError>,
230
+ >(
231
+ params?: GetOrganisationsParams,
232
+ options?: {
233
+ query?: Partial<
234
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
235
+ >;
236
+ request?: SecondParameter<typeof customInstance>;
237
+ },
238
+ queryClient?: QueryClient,
239
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
240
+ export function useGetOrganisationsSuspense<
241
+ TData = Awaited<ReturnType<typeof getOrganisations>>,
242
+ TError = ErrorType<void | AsError>,
243
+ >(
244
+ params?: GetOrganisationsParams,
245
+ options?: {
246
+ query?: Partial<
247
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
248
+ >;
249
+ request?: SecondParameter<typeof customInstance>;
250
+ },
251
+ queryClient?: QueryClient,
252
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
156
253
  /**
157
254
  * @summary Gets Organisations
158
255
  */
@@ -163,15 +260,19 @@ export function useGetOrganisationsSuspense<
163
260
  >(
164
261
  params?: GetOrganisationsParams,
165
262
  options?: {
166
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>;
263
+ query?: Partial<
264
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>
265
+ >;
167
266
  request?: SecondParameter<typeof customInstance>;
168
267
  },
169
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
268
+ queryClient?: QueryClient,
269
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
170
270
  const queryOptions = getGetOrganisationsSuspenseQueryOptions(params, options);
171
271
 
172
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
173
- queryKey: QueryKey;
174
- };
272
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
273
+ TData,
274
+ TError
275
+ > & { queryKey: DataTag<QueryKey, TData> };
175
276
 
176
277
  query.queryKey = queryOptions.queryKey;
177
278
 
@@ -249,18 +350,18 @@ export type CreateOrganisationMutationError = ErrorType<AsError | void>;
249
350
  /**
250
351
  * @summary Create a new organisation
251
352
  */
252
- export const useCreateOrganisation = <
253
- TError = ErrorType<AsError | void>,
254
- TContext = unknown,
255
- >(options?: {
256
- mutation?: UseMutationOptions<
257
- Awaited<ReturnType<typeof createOrganisation>>,
258
- TError,
259
- { data: OrganisationPostBodyBody },
260
- TContext
261
- >;
262
- request?: SecondParameter<typeof customInstance>;
263
- }): UseMutationResult<
353
+ export const useCreateOrganisation = <TError = ErrorType<AsError | void>, TContext = unknown>(
354
+ options?: {
355
+ mutation?: UseMutationOptions<
356
+ Awaited<ReturnType<typeof createOrganisation>>,
357
+ TError,
358
+ { data: OrganisationPostBodyBody },
359
+ TContext
360
+ >;
361
+ request?: SecondParameter<typeof customInstance>;
362
+ },
363
+ queryClient?: QueryClient,
364
+ ): UseMutationResult<
264
365
  Awaited<ReturnType<typeof createOrganisation>>,
265
366
  TError,
266
367
  { data: OrganisationPostBodyBody },
@@ -268,7 +369,7 @@ export const useCreateOrganisation = <
268
369
  > => {
269
370
  const mutationOptions = getCreateOrganisationMutationOptions(options);
270
371
 
271
- return useMutation(mutationOptions);
372
+ return useMutation(mutationOptions, queryClient);
272
373
  };
273
374
  /**
274
375
  * Gets an Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation or are its *creator*.
@@ -298,7 +399,7 @@ export const getGetOrganisationQueryOptions = <
298
399
  >(
299
400
  orgId: string,
300
401
  options?: {
301
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
402
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
302
403
  request?: SecondParameter<typeof customInstance>;
303
404
  },
304
405
  ) => {
@@ -313,12 +414,61 @@ export const getGetOrganisationQueryOptions = <
313
414
  Awaited<ReturnType<typeof getOrganisation>>,
314
415
  TError,
315
416
  TData
316
- > & { queryKey: QueryKey };
417
+ > & { queryKey: DataTag<QueryKey, TData> };
317
418
  };
318
419
 
319
420
  export type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>;
320
421
  export type GetOrganisationQueryError = ErrorType<void | AsError>;
321
422
 
423
+ export function useGetOrganisation<
424
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
425
+ TError = ErrorType<void | AsError>,
426
+ >(
427
+ orgId: string,
428
+ options: {
429
+ query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>> &
430
+ Pick<
431
+ DefinedInitialDataOptions<
432
+ Awaited<ReturnType<typeof getOrganisation>>,
433
+ TError,
434
+ Awaited<ReturnType<typeof getOrganisation>>
435
+ >,
436
+ "initialData"
437
+ >;
438
+ request?: SecondParameter<typeof customInstance>;
439
+ },
440
+ queryClient?: QueryClient,
441
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
442
+ export function useGetOrganisation<
443
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
444
+ TError = ErrorType<void | AsError>,
445
+ >(
446
+ orgId: string,
447
+ options?: {
448
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>> &
449
+ Pick<
450
+ UndefinedInitialDataOptions<
451
+ Awaited<ReturnType<typeof getOrganisation>>,
452
+ TError,
453
+ Awaited<ReturnType<typeof getOrganisation>>
454
+ >,
455
+ "initialData"
456
+ >;
457
+ request?: SecondParameter<typeof customInstance>;
458
+ },
459
+ queryClient?: QueryClient,
460
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
461
+ export function useGetOrganisation<
462
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
463
+ TError = ErrorType<void | AsError>,
464
+ >(
465
+ orgId: string,
466
+ options?: {
467
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
468
+ request?: SecondParameter<typeof customInstance>;
469
+ },
470
+ queryClient?: QueryClient,
471
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
322
472
  /**
323
473
  * @summary Gets an Organisation
324
474
  */
@@ -329,13 +479,16 @@ export function useGetOrganisation<
329
479
  >(
330
480
  orgId: string,
331
481
  options?: {
332
- query?: UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
482
+ query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>;
333
483
  request?: SecondParameter<typeof customInstance>;
334
484
  },
335
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
485
+ queryClient?: QueryClient,
486
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
336
487
  const queryOptions = getGetOrganisationQueryOptions(orgId, options);
337
488
 
338
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
489
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
490
+ queryKey: DataTag<QueryKey, TData>;
491
+ };
339
492
 
340
493
  query.queryKey = queryOptions.queryKey;
341
494
 
@@ -361,7 +514,9 @@ export const getGetOrganisationSuspenseQueryOptions = <
361
514
  >(
362
515
  orgId: string,
363
516
  options?: {
364
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
517
+ query?: Partial<
518
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
519
+ >;
365
520
  request?: SecondParameter<typeof customInstance>;
366
521
  },
367
522
  ) => {
@@ -376,7 +531,7 @@ export const getGetOrganisationSuspenseQueryOptions = <
376
531
  Awaited<ReturnType<typeof getOrganisation>>,
377
532
  TError,
378
533
  TData
379
- > & { queryKey: QueryKey };
534
+ > & { queryKey: DataTag<QueryKey, TData> };
380
535
  };
381
536
 
382
537
  export type GetOrganisationSuspenseQueryResult = NonNullable<
@@ -384,6 +539,45 @@ export type GetOrganisationSuspenseQueryResult = NonNullable<
384
539
  >;
385
540
  export type GetOrganisationSuspenseQueryError = ErrorType<void | AsError>;
386
541
 
542
+ export function useGetOrganisationSuspense<
543
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
544
+ TError = ErrorType<void | AsError>,
545
+ >(
546
+ orgId: string,
547
+ options: {
548
+ query: Partial<
549
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
550
+ >;
551
+ request?: SecondParameter<typeof customInstance>;
552
+ },
553
+ queryClient?: QueryClient,
554
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
555
+ export function useGetOrganisationSuspense<
556
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
557
+ TError = ErrorType<void | AsError>,
558
+ >(
559
+ orgId: string,
560
+ options?: {
561
+ query?: Partial<
562
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
563
+ >;
564
+ request?: SecondParameter<typeof customInstance>;
565
+ },
566
+ queryClient?: QueryClient,
567
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
568
+ export function useGetOrganisationSuspense<
569
+ TData = Awaited<ReturnType<typeof getOrganisation>>,
570
+ TError = ErrorType<void | AsError>,
571
+ >(
572
+ orgId: string,
573
+ options?: {
574
+ query?: Partial<
575
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
576
+ >;
577
+ request?: SecondParameter<typeof customInstance>;
578
+ },
579
+ queryClient?: QueryClient,
580
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
387
581
  /**
388
582
  * @summary Gets an Organisation
389
583
  */
@@ -394,15 +588,19 @@ export function useGetOrganisationSuspense<
394
588
  >(
395
589
  orgId: string,
396
590
  options?: {
397
- query?: UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>;
591
+ query?: Partial<
592
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>
593
+ >;
398
594
  request?: SecondParameter<typeof customInstance>;
399
595
  },
400
- ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
596
+ queryClient?: QueryClient,
597
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
401
598
  const queryOptions = getGetOrganisationSuspenseQueryOptions(orgId, options);
402
599
 
403
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
404
- queryKey: QueryKey;
405
- };
600
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
601
+ TData,
602
+ TError
603
+ > & { queryKey: DataTag<QueryKey, TData> };
406
604
 
407
605
  query.queryKey = queryOptions.queryKey;
408
606
 
@@ -479,18 +677,18 @@ export type PatchOrganisationMutationError = ErrorType<void | AsError>;
479
677
  /**
480
678
  * @summary Adjust an existing Organisation
481
679
  */
482
- export const usePatchOrganisation = <
483
- TError = ErrorType<void | AsError>,
484
- TContext = unknown,
485
- >(options?: {
486
- mutation?: UseMutationOptions<
487
- Awaited<ReturnType<typeof patchOrganisation>>,
488
- TError,
489
- { orgId: string; data: OrganisationPatchBodyBody },
490
- TContext
491
- >;
492
- request?: SecondParameter<typeof customInstance>;
493
- }): UseMutationResult<
680
+ export const usePatchOrganisation = <TError = ErrorType<void | AsError>, TContext = unknown>(
681
+ options?: {
682
+ mutation?: UseMutationOptions<
683
+ Awaited<ReturnType<typeof patchOrganisation>>,
684
+ TError,
685
+ { orgId: string; data: OrganisationPatchBodyBody },
686
+ TContext
687
+ >;
688
+ request?: SecondParameter<typeof customInstance>;
689
+ },
690
+ queryClient?: QueryClient,
691
+ ): UseMutationResult<
494
692
  Awaited<ReturnType<typeof patchOrganisation>>,
495
693
  TError,
496
694
  { orgId: string; data: OrganisationPatchBodyBody },
@@ -498,7 +696,7 @@ export const usePatchOrganisation = <
498
696
  > => {
499
697
  const mutationOptions = getPatchOrganisationMutationOptions(options);
500
698
 
501
- return useMutation(mutationOptions);
699
+ return useMutation(mutationOptions, queryClient);
502
700
  };
503
701
  /**
504
702
  * Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.
@@ -559,18 +757,18 @@ export type DeleteOrganisationMutationError = ErrorType<AsError | void>;
559
757
  /**
560
758
  * @summary Deletes an Organisation
561
759
  */
562
- export const useDeleteOrganisation = <
563
- TError = ErrorType<AsError | void>,
564
- TContext = unknown,
565
- >(options?: {
566
- mutation?: UseMutationOptions<
567
- Awaited<ReturnType<typeof deleteOrganisation>>,
568
- TError,
569
- { orgId: string },
570
- TContext
571
- >;
572
- request?: SecondParameter<typeof customInstance>;
573
- }): UseMutationResult<
760
+ export const useDeleteOrganisation = <TError = ErrorType<AsError | void>, TContext = unknown>(
761
+ options?: {
762
+ mutation?: UseMutationOptions<
763
+ Awaited<ReturnType<typeof deleteOrganisation>>,
764
+ TError,
765
+ { orgId: string },
766
+ TContext
767
+ >;
768
+ request?: SecondParameter<typeof customInstance>;
769
+ },
770
+ queryClient?: QueryClient,
771
+ ): UseMutationResult<
574
772
  Awaited<ReturnType<typeof deleteOrganisation>>,
575
773
  TError,
576
774
  { orgId: string },
@@ -578,7 +776,7 @@ export const useDeleteOrganisation = <
578
776
  > => {
579
777
  const mutationOptions = getDeleteOrganisationMutationOptions(options);
580
778
 
581
- return useMutation(mutationOptions);
779
+ return useMutation(mutationOptions, queryClient);
582
780
  };
583
781
  /**
584
782
  * Gets the Default Organisation, a built-in Organisation used exclusively for **Personal Units**.
@@ -605,7 +803,9 @@ export const getGetDefaultOrganisationQueryOptions = <
605
803
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
606
804
  TError = ErrorType<void | AsError>,
607
805
  >(options?: {
608
- query?: UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>;
806
+ query?: Partial<
807
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
808
+ >;
609
809
  request?: SecondParameter<typeof customInstance>;
610
810
  }) => {
611
811
  const { query: queryOptions, request: requestOptions } = options ?? {};
@@ -619,7 +819,7 @@ export const getGetDefaultOrganisationQueryOptions = <
619
819
  Awaited<ReturnType<typeof getDefaultOrganisation>>,
620
820
  TError,
621
821
  TData
622
- > & { queryKey: QueryKey };
822
+ > & { queryKey: DataTag<QueryKey, TData> };
623
823
  };
624
824
 
625
825
  export type GetDefaultOrganisationQueryResult = NonNullable<
@@ -627,6 +827,58 @@ export type GetDefaultOrganisationQueryResult = NonNullable<
627
827
  >;
628
828
  export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
629
829
 
830
+ export function useGetDefaultOrganisation<
831
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
832
+ TError = ErrorType<void | AsError>,
833
+ >(
834
+ options: {
835
+ query: Partial<
836
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
837
+ > &
838
+ Pick<
839
+ DefinedInitialDataOptions<
840
+ Awaited<ReturnType<typeof getDefaultOrganisation>>,
841
+ TError,
842
+ Awaited<ReturnType<typeof getDefaultOrganisation>>
843
+ >,
844
+ "initialData"
845
+ >;
846
+ request?: SecondParameter<typeof customInstance>;
847
+ },
848
+ queryClient?: QueryClient,
849
+ ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
850
+ export function useGetDefaultOrganisation<
851
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
852
+ TError = ErrorType<void | AsError>,
853
+ >(
854
+ options?: {
855
+ query?: Partial<
856
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
857
+ > &
858
+ Pick<
859
+ UndefinedInitialDataOptions<
860
+ Awaited<ReturnType<typeof getDefaultOrganisation>>,
861
+ TError,
862
+ Awaited<ReturnType<typeof getDefaultOrganisation>>
863
+ >,
864
+ "initialData"
865
+ >;
866
+ request?: SecondParameter<typeof customInstance>;
867
+ },
868
+ queryClient?: QueryClient,
869
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
870
+ export function useGetDefaultOrganisation<
871
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
872
+ TError = ErrorType<void | AsError>,
873
+ >(
874
+ options?: {
875
+ query?: Partial<
876
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
877
+ >;
878
+ request?: SecondParameter<typeof customInstance>;
879
+ },
880
+ queryClient?: QueryClient,
881
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
630
882
  /**
631
883
  * @summary Gets the Default Organisation
632
884
  */
@@ -634,13 +886,20 @@ export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
634
886
  export function useGetDefaultOrganisation<
635
887
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
636
888
  TError = ErrorType<void | AsError>,
637
- >(options?: {
638
- query?: UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>;
639
- request?: SecondParameter<typeof customInstance>;
640
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
889
+ >(
890
+ options?: {
891
+ query?: Partial<
892
+ UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
893
+ >;
894
+ request?: SecondParameter<typeof customInstance>;
895
+ },
896
+ queryClient?: QueryClient,
897
+ ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
641
898
  const queryOptions = getGetDefaultOrganisationQueryOptions(options);
642
899
 
643
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
900
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
901
+ queryKey: DataTag<QueryKey, TData>;
902
+ };
644
903
 
645
904
  query.queryKey = queryOptions.queryKey;
646
905
 
@@ -663,10 +922,8 @@ export const getGetDefaultOrganisationSuspenseQueryOptions = <
663
922
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
664
923
  TError = ErrorType<void | AsError>,
665
924
  >(options?: {
666
- query?: UseSuspenseQueryOptions<
667
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
668
- TError,
669
- TData
925
+ query?: Partial<
926
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
670
927
  >;
671
928
  request?: SecondParameter<typeof customInstance>;
672
929
  }) => {
@@ -681,7 +938,7 @@ export const getGetDefaultOrganisationSuspenseQueryOptions = <
681
938
  Awaited<ReturnType<typeof getDefaultOrganisation>>,
682
939
  TError,
683
940
  TData
684
- > & { queryKey: QueryKey };
941
+ > & { queryKey: DataTag<QueryKey, TData> };
685
942
  };
686
943
 
687
944
  export type GetDefaultOrganisationSuspenseQueryResult = NonNullable<
@@ -689,6 +946,42 @@ export type GetDefaultOrganisationSuspenseQueryResult = NonNullable<
689
946
  >;
690
947
  export type GetDefaultOrganisationSuspenseQueryError = ErrorType<void | AsError>;
691
948
 
949
+ export function useGetDefaultOrganisationSuspense<
950
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
951
+ TError = ErrorType<void | AsError>,
952
+ >(
953
+ options: {
954
+ query: Partial<
955
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
956
+ >;
957
+ request?: SecondParameter<typeof customInstance>;
958
+ },
959
+ queryClient?: QueryClient,
960
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
961
+ export function useGetDefaultOrganisationSuspense<
962
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
963
+ TError = ErrorType<void | AsError>,
964
+ >(
965
+ options?: {
966
+ query?: Partial<
967
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
968
+ >;
969
+ request?: SecondParameter<typeof customInstance>;
970
+ },
971
+ queryClient?: QueryClient,
972
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
973
+ export function useGetDefaultOrganisationSuspense<
974
+ TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
975
+ TError = ErrorType<void | AsError>,
976
+ >(
977
+ options?: {
978
+ query?: Partial<
979
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
980
+ >;
981
+ request?: SecondParameter<typeof customInstance>;
982
+ },
983
+ queryClient?: QueryClient,
984
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> };
692
985
  /**
693
986
  * @summary Gets the Default Organisation
694
987
  */
@@ -696,19 +989,21 @@ export type GetDefaultOrganisationSuspenseQueryError = ErrorType<void | AsError>
696
989
  export function useGetDefaultOrganisationSuspense<
697
990
  TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
698
991
  TError = ErrorType<void | AsError>,
699
- >(options?: {
700
- query?: UseSuspenseQueryOptions<
701
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
702
- TError,
703
- TData
704
- >;
705
- request?: SecondParameter<typeof customInstance>;
706
- }): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } {
992
+ >(
993
+ options?: {
994
+ query?: Partial<
995
+ UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>
996
+ >;
997
+ request?: SecondParameter<typeof customInstance>;
998
+ },
999
+ queryClient?: QueryClient,
1000
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
707
1001
  const queryOptions = getGetDefaultOrganisationSuspenseQueryOptions(options);
708
1002
 
709
- const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & {
710
- queryKey: QueryKey;
711
- };
1003
+ const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
1004
+ TData,
1005
+ TError
1006
+ > & { queryKey: DataTag<QueryKey, TData> };
712
1007
 
713
1008
  query.queryKey = queryOptions.queryKey;
714
1009