@squonk/account-server-client 0.1.27-rc.1 → 0.1.29-rc.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 (50) hide show
  1. package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
  2. package/chunk-6EEIAH4R.js.map +1 -0
  3. package/chunk-NGBTCJWS.cjs +46 -0
  4. package/chunk-NGBTCJWS.cjs.map +1 -0
  5. package/{account-server-api.schemas-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -1
  6. package/index.cjs +5 -21
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +2 -20
  9. package/index.js +5 -21
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +35 -30
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +33 -32
  14. package/organisation/organisation.js +42 -37
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +1 -1
  17. package/product/product.cjs +65 -53
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +55 -54
  20. package/product/product.js +76 -64
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +21 -23
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +18 -17
  25. package/service/service.js +23 -25
  26. package/service/service.js.map +1 -1
  27. package/src/organisation/organisation.ts +93 -69
  28. package/src/product/product.ts +165 -146
  29. package/src/service/service.ts +59 -57
  30. package/src/state/state.ts +34 -28
  31. package/src/unit/unit.ts +145 -130
  32. package/src/user/user.ts +148 -120
  33. package/state/state.cjs +12 -12
  34. package/state/state.cjs.map +1 -1
  35. package/state/state.d.ts +11 -10
  36. package/state/state.js +13 -13
  37. package/state/state.js.map +1 -1
  38. package/unit/unit.cjs +55 -50
  39. package/unit/unit.cjs.map +1 -1
  40. package/unit/unit.d.ts +54 -53
  41. package/unit/unit.js +66 -61
  42. package/unit/unit.js.map +1 -1
  43. package/user/user.cjs +50 -50
  44. package/user/user.cjs.map +1 -1
  45. package/user/user.d.ts +53 -52
  46. package/user/user.js +61 -61
  47. package/user/user.js.map +1 -1
  48. package/chunk-GWBPVOL2.js.map +0 -1
  49. package/chunk-N3RLW53G.cjs +0 -25
  50. package/chunk-N3RLW53G.cjs.map +0 -1
package/src/user/user.ts CHANGED
@@ -8,7 +8,6 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
- import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from "axios";
12
11
  import {
13
12
  useQuery,
14
13
  useMutation,
@@ -24,6 +23,7 @@ import type {
24
23
  AsError,
25
24
  UsersGetResponse,
26
25
  } from "../account-server-api.schemas";
26
+ import { customInstance, ErrorType } from ".././custom-instance";
27
27
 
28
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
  type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
@@ -32,48 +32,58 @@ type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
32
32
  ? R
33
33
  : any;
34
34
 
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ type SecondParameter<T extends (...args: any) => any> = T extends (
37
+ config: any,
38
+ args: infer P
39
+ ) => any
40
+ ? P
41
+ : never;
42
+
35
43
  /**
36
44
  * Returns a summary of your account
37
45
 
38
46
  * @summary Get information about your account
39
47
  */
40
- export const appApiUserGetAccount = (
41
- options?: AxiosRequestConfig
42
- ): Promise<AxiosResponse<UserAccountGetResponse>> => {
43
- return axios.get(`/user/account`, options);
48
+ export const getUserAccount = (
49
+ options?: SecondParameter<typeof customInstance>
50
+ ) => {
51
+ return customInstance<UserAccountGetResponse>(
52
+ { url: `/user/account`, method: "get" },
53
+ options
54
+ );
44
55
  };
45
56
 
46
- export const getAppApiUserGetAccountQueryKey = () => [`/user/account`];
57
+ export const getGetUserAccountQueryKey = () => [`/user/account`];
47
58
 
48
- export type AppApiUserGetAccountQueryResult = NonNullable<
49
- AsyncReturnType<typeof appApiUserGetAccount>
59
+ export type GetUserAccountQueryResult = NonNullable<
60
+ AsyncReturnType<typeof getUserAccount>
50
61
  >;
51
- export type AppApiUserGetAccountQueryError = AxiosError<void | AsError>;
62
+ export type GetUserAccountQueryError = ErrorType<void | AsError>;
52
63
 
53
- export const useAppApiUserGetAccount = <
54
- TData = AsyncReturnType<typeof appApiUserGetAccount>,
55
- TError = AxiosError<void | AsError>
64
+ export const useGetUserAccount = <
65
+ TData = AsyncReturnType<typeof getUserAccount>,
66
+ TError = ErrorType<void | AsError>
56
67
  >(options?: {
57
68
  query?: UseQueryOptions<
58
- AsyncReturnType<typeof appApiUserGetAccount>,
69
+ AsyncReturnType<typeof getUserAccount>,
59
70
  TError,
60
71
  TData
61
72
  >;
62
- axios?: AxiosRequestConfig;
73
+ request?: SecondParameter<typeof customInstance>;
63
74
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
64
- const { query: queryOptions, axios: axiosOptions } = options || {};
75
+ const { query: queryOptions, request: requestOptions } = options || {};
65
76
 
66
- const queryKey = queryOptions?.queryKey ?? getAppApiUserGetAccountQueryKey();
77
+ const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
67
78
 
68
- const queryFn: QueryFunction<
69
- AsyncReturnType<typeof appApiUserGetAccount>
70
- > = () => appApiUserGetAccount(axiosOptions);
79
+ const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>
80
+ getUserAccount(requestOptions);
71
81
 
72
- const query = useQuery<
73
- AsyncReturnType<typeof appApiUserGetAccount>,
74
- TError,
75
- TData
76
- >(queryKey, queryFn, queryOptions);
82
+ const query = useQuery<AsyncReturnType<typeof getUserAccount>, TError, TData>(
83
+ queryKey,
84
+ queryFn,
85
+ queryOptions
86
+ );
77
87
 
78
88
  return {
79
89
  queryKey,
@@ -86,47 +96,50 @@ export const useAppApiUserGetAccount = <
86
96
 
87
97
  * @summary Gets users in an organisation
88
98
  */
89
- export const appApiUserOrgGetUsers = (
99
+ export const getOrganisationUsers = (
90
100
  orgId: string,
91
- options?: AxiosRequestConfig
92
- ): Promise<AxiosResponse<UsersGetResponse>> => {
93
- return axios.get(`/organisation/${orgId}/user`, options);
101
+ options?: SecondParameter<typeof customInstance>
102
+ ) => {
103
+ return customInstance<UsersGetResponse>(
104
+ { url: `/organisation/${orgId}/user`, method: "get" },
105
+ options
106
+ );
94
107
  };
95
108
 
96
- export const getAppApiUserOrgGetUsersQueryKey = (orgId: string) => [
109
+ export const getGetOrganisationUsersQueryKey = (orgId: string) => [
97
110
  `/organisation/${orgId}/user`,
98
111
  ];
99
112
 
100
- export type AppApiUserOrgGetUsersQueryResult = NonNullable<
101
- AsyncReturnType<typeof appApiUserOrgGetUsers>
113
+ export type GetOrganisationUsersQueryResult = NonNullable<
114
+ AsyncReturnType<typeof getOrganisationUsers>
102
115
  >;
103
- export type AppApiUserOrgGetUsersQueryError = AxiosError<AsError | void>;
116
+ export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
104
117
 
105
- export const useAppApiUserOrgGetUsers = <
106
- TData = AsyncReturnType<typeof appApiUserOrgGetUsers>,
107
- TError = AxiosError<AsError | void>
118
+ export const useGetOrganisationUsers = <
119
+ TData = AsyncReturnType<typeof getOrganisationUsers>,
120
+ TError = ErrorType<AsError | void>
108
121
  >(
109
122
  orgId: string,
110
123
  options?: {
111
124
  query?: UseQueryOptions<
112
- AsyncReturnType<typeof appApiUserOrgGetUsers>,
125
+ AsyncReturnType<typeof getOrganisationUsers>,
113
126
  TError,
114
127
  TData
115
128
  >;
116
- axios?: AxiosRequestConfig;
129
+ request?: SecondParameter<typeof customInstance>;
117
130
  }
118
131
  ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
119
- const { query: queryOptions, axios: axiosOptions } = options || {};
132
+ const { query: queryOptions, request: requestOptions } = options || {};
120
133
 
121
134
  const queryKey =
122
- queryOptions?.queryKey ?? getAppApiUserOrgGetUsersQueryKey(orgId);
135
+ queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
123
136
 
124
137
  const queryFn: QueryFunction<
125
- AsyncReturnType<typeof appApiUserOrgGetUsers>
126
- > = () => appApiUserOrgGetUsers(orgId, axiosOptions);
138
+ AsyncReturnType<typeof getOrganisationUsers>
139
+ > = () => getOrganisationUsers(orgId, requestOptions);
127
140
 
128
141
  const query = useQuery<
129
- AsyncReturnType<typeof appApiUserOrgGetUsers>,
142
+ AsyncReturnType<typeof getOrganisationUsers>,
130
143
  TError,
131
144
  TData
132
145
  >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
@@ -142,45 +155,48 @@ export const useAppApiUserOrgGetUsers = <
142
155
 
143
156
  * @summary Adds a user to an organisation
144
157
  */
145
- export const appApiUserOrgUserPut = (
158
+ export const addOrganisationUser = (
146
159
  orgId: string,
147
160
  userId: string,
148
- options?: AxiosRequestConfig
149
- ): Promise<AxiosResponse<void>> => {
150
- return axios.put(`/organisation/${orgId}/user/${userId}`, undefined, options);
161
+ options?: SecondParameter<typeof customInstance>
162
+ ) => {
163
+ return customInstance<void>(
164
+ { url: `/organisation/${orgId}/user/${userId}`, method: "put" },
165
+ options
166
+ );
151
167
  };
152
168
 
153
- export type AppApiUserOrgUserPutMutationResult = NonNullable<
154
- AsyncReturnType<typeof appApiUserOrgUserPut>
169
+ export type AddOrganisationUserMutationResult = NonNullable<
170
+ AsyncReturnType<typeof addOrganisationUser>
155
171
  >;
156
172
 
157
- export type AppApiUserOrgUserPutMutationError = AxiosError<AsError>;
173
+ export type AddOrganisationUserMutationError = ErrorType<AsError>;
158
174
 
159
- export const useAppApiUserOrgUserPut = <
160
- TError = AxiosError<AsError>,
175
+ export const useAddOrganisationUser = <
176
+ TError = ErrorType<AsError>,
161
177
  TContext = unknown
162
178
  >(options?: {
163
179
  mutation?: UseMutationOptions<
164
- AsyncReturnType<typeof appApiUserOrgUserPut>,
180
+ AsyncReturnType<typeof addOrganisationUser>,
165
181
  TError,
166
182
  { orgId: string; userId: string },
167
183
  TContext
168
184
  >;
169
- axios?: AxiosRequestConfig;
185
+ request?: SecondParameter<typeof customInstance>;
170
186
  }) => {
171
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
187
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
172
188
 
173
189
  const mutationFn: MutationFunction<
174
- AsyncReturnType<typeof appApiUserOrgUserPut>,
190
+ AsyncReturnType<typeof addOrganisationUser>,
175
191
  { orgId: string; userId: string }
176
192
  > = (props) => {
177
193
  const { orgId, userId } = props || {};
178
194
 
179
- return appApiUserOrgUserPut(orgId, userId, axiosOptions);
195
+ return addOrganisationUser(orgId, userId, requestOptions);
180
196
  };
181
197
 
182
198
  return useMutation<
183
- AsyncReturnType<typeof appApiUserOrgUserPut>,
199
+ AsyncReturnType<typeof addOrganisationUser>,
184
200
  TError,
185
201
  { orgId: string; userId: string },
186
202
  TContext
@@ -191,45 +207,48 @@ export const useAppApiUserOrgUserPut = <
191
207
 
192
208
  * @summary Deletes a user from an organisation
193
209
  */
194
- export const appApiUserOrgUserDelete = (
210
+ export const deleteOrganisationUser = (
195
211
  orgId: string,
196
212
  userId: string,
197
- options?: AxiosRequestConfig
198
- ): Promise<AxiosResponse<void>> => {
199
- return axios.delete(`/organisation/${orgId}/user/${userId}`, options);
213
+ options?: SecondParameter<typeof customInstance>
214
+ ) => {
215
+ return customInstance<void>(
216
+ { url: `/organisation/${orgId}/user/${userId}`, method: "delete" },
217
+ options
218
+ );
200
219
  };
201
220
 
202
- export type AppApiUserOrgUserDeleteMutationResult = NonNullable<
203
- AsyncReturnType<typeof appApiUserOrgUserDelete>
221
+ export type DeleteOrganisationUserMutationResult = NonNullable<
222
+ AsyncReturnType<typeof deleteOrganisationUser>
204
223
  >;
205
224
 
206
- export type AppApiUserOrgUserDeleteMutationError = AxiosError<AsError>;
225
+ export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
207
226
 
208
- export const useAppApiUserOrgUserDelete = <
209
- TError = AxiosError<AsError>,
227
+ export const useDeleteOrganisationUser = <
228
+ TError = ErrorType<AsError>,
210
229
  TContext = unknown
211
230
  >(options?: {
212
231
  mutation?: UseMutationOptions<
213
- AsyncReturnType<typeof appApiUserOrgUserDelete>,
232
+ AsyncReturnType<typeof deleteOrganisationUser>,
214
233
  TError,
215
234
  { orgId: string; userId: string },
216
235
  TContext
217
236
  >;
218
- axios?: AxiosRequestConfig;
237
+ request?: SecondParameter<typeof customInstance>;
219
238
  }) => {
220
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
239
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
221
240
 
222
241
  const mutationFn: MutationFunction<
223
- AsyncReturnType<typeof appApiUserOrgUserDelete>,
242
+ AsyncReturnType<typeof deleteOrganisationUser>,
224
243
  { orgId: string; userId: string }
225
244
  > = (props) => {
226
245
  const { orgId, userId } = props || {};
227
246
 
228
- return appApiUserOrgUserDelete(orgId, userId, axiosOptions);
247
+ return deleteOrganisationUser(orgId, userId, requestOptions);
229
248
  };
230
249
 
231
250
  return useMutation<
232
- AsyncReturnType<typeof appApiUserOrgUserDelete>,
251
+ AsyncReturnType<typeof deleteOrganisationUser>,
233
252
  TError,
234
253
  { orgId: string; userId: string },
235
254
  TContext
@@ -240,47 +259,50 @@ export const useAppApiUserOrgUserDelete = <
240
259
 
241
260
  * @summary Gets users in an Organisational Unit
242
261
  */
243
- export const appApiUserGetUnitUsers = (
262
+ export const getOrganisationUnitUsers = (
244
263
  unitId: string,
245
- options?: AxiosRequestConfig
246
- ): Promise<AxiosResponse<UsersGetResponse>> => {
247
- return axios.get(`/unit/${unitId}/user`, options);
264
+ options?: SecondParameter<typeof customInstance>
265
+ ) => {
266
+ return customInstance<UsersGetResponse>(
267
+ { url: `/unit/${unitId}/user`, method: "get" },
268
+ options
269
+ );
248
270
  };
249
271
 
250
- export const getAppApiUserGetUnitUsersQueryKey = (unitId: string) => [
272
+ export const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [
251
273
  `/unit/${unitId}/user`,
252
274
  ];
253
275
 
254
- export type AppApiUserGetUnitUsersQueryResult = NonNullable<
255
- AsyncReturnType<typeof appApiUserGetUnitUsers>
276
+ export type GetOrganisationUnitUsersQueryResult = NonNullable<
277
+ AsyncReturnType<typeof getOrganisationUnitUsers>
256
278
  >;
257
- export type AppApiUserGetUnitUsersQueryError = AxiosError<AsError | void>;
279
+ export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
258
280
 
259
- export const useAppApiUserGetUnitUsers = <
260
- TData = AsyncReturnType<typeof appApiUserGetUnitUsers>,
261
- TError = AxiosError<AsError | void>
281
+ export const useGetOrganisationUnitUsers = <
282
+ TData = AsyncReturnType<typeof getOrganisationUnitUsers>,
283
+ TError = ErrorType<AsError | void>
262
284
  >(
263
285
  unitId: string,
264
286
  options?: {
265
287
  query?: UseQueryOptions<
266
- AsyncReturnType<typeof appApiUserGetUnitUsers>,
288
+ AsyncReturnType<typeof getOrganisationUnitUsers>,
267
289
  TError,
268
290
  TData
269
291
  >;
270
- axios?: AxiosRequestConfig;
292
+ request?: SecondParameter<typeof customInstance>;
271
293
  }
272
294
  ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
273
- const { query: queryOptions, axios: axiosOptions } = options || {};
295
+ const { query: queryOptions, request: requestOptions } = options || {};
274
296
 
275
297
  const queryKey =
276
- queryOptions?.queryKey ?? getAppApiUserGetUnitUsersQueryKey(unitId);
298
+ queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
277
299
 
278
300
  const queryFn: QueryFunction<
279
- AsyncReturnType<typeof appApiUserGetUnitUsers>
280
- > = () => appApiUserGetUnitUsers(unitId, axiosOptions);
301
+ AsyncReturnType<typeof getOrganisationUnitUsers>
302
+ > = () => getOrganisationUnitUsers(unitId, requestOptions);
281
303
 
282
304
  const query = useQuery<
283
- AsyncReturnType<typeof appApiUserGetUnitUsers>,
305
+ AsyncReturnType<typeof getOrganisationUnitUsers>,
284
306
  TError,
285
307
  TData
286
308
  >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
@@ -300,45 +322,48 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
300
322
 
301
323
  * @summary Adds a user to an Organisational Unit
302
324
  */
303
- export const appApiUserUnitUserPut = (
325
+ export const addOrganisationUnitUser = (
304
326
  unitId: string,
305
327
  userId: string,
306
- options?: AxiosRequestConfig
307
- ): Promise<AxiosResponse<void>> => {
308
- return axios.put(`/unit/${unitId}/user/${userId}`, undefined, options);
328
+ options?: SecondParameter<typeof customInstance>
329
+ ) => {
330
+ return customInstance<void>(
331
+ { url: `/unit/${unitId}/user/${userId}`, method: "put" },
332
+ options
333
+ );
309
334
  };
310
335
 
311
- export type AppApiUserUnitUserPutMutationResult = NonNullable<
312
- AsyncReturnType<typeof appApiUserUnitUserPut>
336
+ export type AddOrganisationUnitUserMutationResult = NonNullable<
337
+ AsyncReturnType<typeof addOrganisationUnitUser>
313
338
  >;
314
339
 
315
- export type AppApiUserUnitUserPutMutationError = AxiosError<AsError>;
340
+ export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
316
341
 
317
- export const useAppApiUserUnitUserPut = <
318
- TError = AxiosError<AsError>,
342
+ export const useAddOrganisationUnitUser = <
343
+ TError = ErrorType<AsError>,
319
344
  TContext = unknown
320
345
  >(options?: {
321
346
  mutation?: UseMutationOptions<
322
- AsyncReturnType<typeof appApiUserUnitUserPut>,
347
+ AsyncReturnType<typeof addOrganisationUnitUser>,
323
348
  TError,
324
349
  { unitId: string; userId: string },
325
350
  TContext
326
351
  >;
327
- axios?: AxiosRequestConfig;
352
+ request?: SecondParameter<typeof customInstance>;
328
353
  }) => {
329
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
354
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
330
355
 
331
356
  const mutationFn: MutationFunction<
332
- AsyncReturnType<typeof appApiUserUnitUserPut>,
357
+ AsyncReturnType<typeof addOrganisationUnitUser>,
333
358
  { unitId: string; userId: string }
334
359
  > = (props) => {
335
360
  const { unitId, userId } = props || {};
336
361
 
337
- return appApiUserUnitUserPut(unitId, userId, axiosOptions);
362
+ return addOrganisationUnitUser(unitId, userId, requestOptions);
338
363
  };
339
364
 
340
365
  return useMutation<
341
- AsyncReturnType<typeof appApiUserUnitUserPut>,
366
+ AsyncReturnType<typeof addOrganisationUnitUser>,
342
367
  TError,
343
368
  { unitId: string; userId: string },
344
369
  TContext
@@ -353,45 +378,48 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
353
378
 
354
379
  * @summary Deletes a user from an Organisational Unit
355
380
  */
356
- export const appApiUserUnitUserDelete = (
381
+ export const deleteOrganisationUnitUser = (
357
382
  unitId: string,
358
383
  userId: string,
359
- options?: AxiosRequestConfig
360
- ): Promise<AxiosResponse<void>> => {
361
- return axios.delete(`/unit/${unitId}/user/${userId}`, options);
384
+ options?: SecondParameter<typeof customInstance>
385
+ ) => {
386
+ return customInstance<void>(
387
+ { url: `/unit/${unitId}/user/${userId}`, method: "delete" },
388
+ options
389
+ );
362
390
  };
363
391
 
364
- export type AppApiUserUnitUserDeleteMutationResult = NonNullable<
365
- AsyncReturnType<typeof appApiUserUnitUserDelete>
392
+ export type DeleteOrganisationUnitUserMutationResult = NonNullable<
393
+ AsyncReturnType<typeof deleteOrganisationUnitUser>
366
394
  >;
367
395
 
368
- export type AppApiUserUnitUserDeleteMutationError = AxiosError<AsError>;
396
+ export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
369
397
 
370
- export const useAppApiUserUnitUserDelete = <
371
- TError = AxiosError<AsError>,
398
+ export const useDeleteOrganisationUnitUser = <
399
+ TError = ErrorType<AsError>,
372
400
  TContext = unknown
373
401
  >(options?: {
374
402
  mutation?: UseMutationOptions<
375
- AsyncReturnType<typeof appApiUserUnitUserDelete>,
403
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
376
404
  TError,
377
405
  { unitId: string; userId: string },
378
406
  TContext
379
407
  >;
380
- axios?: AxiosRequestConfig;
408
+ request?: SecondParameter<typeof customInstance>;
381
409
  }) => {
382
- const { mutation: mutationOptions, axios: axiosOptions } = options || {};
410
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
383
411
 
384
412
  const mutationFn: MutationFunction<
385
- AsyncReturnType<typeof appApiUserUnitUserDelete>,
413
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
386
414
  { unitId: string; userId: string }
387
415
  > = (props) => {
388
416
  const { unitId, userId } = props || {};
389
417
 
390
- return appApiUserUnitUserDelete(unitId, userId, axiosOptions);
418
+ return deleteOrganisationUnitUser(unitId, userId, requestOptions);
391
419
  };
392
420
 
393
421
  return useMutation<
394
- AsyncReturnType<typeof appApiUserUnitUserDelete>,
422
+ AsyncReturnType<typeof deleteOrganisationUnitUser>,
395
423
  TError,
396
424
  { unitId: string; userId: string },
397
425
  TContext
package/state/state.cjs CHANGED
@@ -1,22 +1,22 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
3
+
4
+ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
4
5
 
5
6
  // src/state/state.ts
6
- var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
7
7
 
8
8
 
9
9
  var _reactquery = require('react-query');
10
- var appApiStateGetVersion = (options) => {
11
- return _axios2.default.get(`/version`, options);
10
+ var getVersion = (options) => {
11
+ return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/version`, method: "get" }, options);
12
12
  };
13
- var getAppApiStateGetVersionQueryKey = () => [`/version`];
14
- var useAppApiStateGetVersion = (options) => {
15
- const { query: queryOptions, axios: axiosOptions } = options || {};
16
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiStateGetVersionQueryKey()));
17
- const queryFn = () => appApiStateGetVersion(axiosOptions);
13
+ var getGetVersionQueryKey = () => [`/version`];
14
+ var useGetVersion = (options) => {
15
+ const { query: queryOptions, request: requestOptions } = options || {};
16
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetVersionQueryKey()));
17
+ const queryFn = () => getVersion(requestOptions);
18
18
  const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
19
- return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
19
+ return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
20
20
  queryKey
21
21
  }, query);
22
22
  };
@@ -24,5 +24,5 @@ var useAppApiStateGetVersion = (options) => {
24
24
 
25
25
 
26
26
 
27
- exports.appApiStateGetVersion = appApiStateGetVersion; exports.getAppApiStateGetVersionQueryKey = getAppApiStateGetVersionQueryKey; exports.useAppApiStateGetVersion = useAppApiStateGetVersion;
27
+ exports.getGetVersionQueryKey = getGetVersionQueryKey; exports.getVersion = getVersion; exports.useGetVersion = useGetVersion;
28
28
  //# sourceMappingURL=state.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAsBO,IAAM,wBAAwB,CACnC,YACoD;AACpD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,mCAAmC,MAAM,CAAC,UAAU;AAO1D,IAAM,2BAA2B,CAGtC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,iCAAiC;AAE5E,QAAM,UAEF,MAAM,sBAAsB,YAAY;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const appApiStateGetVersion = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<StateGetVersionResponse>> => {\n return axios.get(`/version`, options);\n};\n\nexport const getAppApiStateGetVersionQueryKey = () => [`/version`];\n\nexport type AppApiStateGetVersionQueryResult = NonNullable<\n AsyncReturnType<typeof appApiStateGetVersion>\n>;\nexport type AppApiStateGetVersionQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiStateGetVersion = <\n TData = AsyncReturnType<typeof appApiStateGetVersion>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiStateGetVersion>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiStateGetVersionQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiStateGetVersion>\n > = () => appApiStateGetVersion(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiStateGetVersion>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AA+BO,IAAM,aAAa,CACxB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,cAAc;AAE3B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\" },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n AsyncReturnType<typeof getVersion>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = AsyncReturnType<typeof getVersion>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>\n getVersion(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
package/state/state.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
2
1
  import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
3
- import { M as StateGetVersionResponse, N as AsError } from '../account-server-api.schemas-e6c5f956.js';
2
+ import { V as customInstance, M as StateGetVersionResponse, W as ErrorType, N as AsError } from '../custom-instance-13412a15.js';
3
+ import 'axios';
4
4
 
5
5
  /**
6
6
  * Generated by orval v6.7.1 🍺
@@ -14,18 +14,19 @@ A service that provides access to the Account Server, which gives *registered* u
14
14
  */
15
15
 
16
16
  declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
17
+ declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
17
18
  /**
18
19
  * @summary Gets the Account Server version
19
20
  */
20
- declare const appApiStateGetVersion: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<StateGetVersionResponse>>;
21
- declare const getAppApiStateGetVersionQueryKey: () => string[];
22
- declare type AppApiStateGetVersionQueryResult = NonNullable<AsyncReturnType<typeof appApiStateGetVersion>>;
23
- declare type AppApiStateGetVersionQueryError = AxiosError<AsError | void>;
24
- declare const useAppApiStateGetVersion: <TData = AxiosResponse<StateGetVersionResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
25
- query?: UseQueryOptions<AxiosResponse<StateGetVersionResponse, any>, TError, TData, QueryKey> | undefined;
26
- axios?: AxiosRequestConfig<any> | undefined;
21
+ declare const getVersion: (options?: SecondParameter<typeof customInstance>) => Promise<StateGetVersionResponse>;
22
+ declare const getGetVersionQueryKey: () => string[];
23
+ declare type GetVersionQueryResult = NonNullable<AsyncReturnType<typeof getVersion>>;
24
+ declare type GetVersionQueryError = ErrorType<AsError | void>;
25
+ declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorType<void | AsError>>(options?: {
26
+ query?: UseQueryOptions<StateGetVersionResponse, TError, TData, QueryKey> | undefined;
27
+ request?: SecondParameter<typeof customInstance>;
27
28
  } | undefined) => UseQueryResult<TData, TError> & {
28
29
  queryKey: QueryKey;
29
30
  };
30
31
 
31
- export { AppApiStateGetVersionQueryError, AppApiStateGetVersionQueryResult, appApiStateGetVersion, getAppApiStateGetVersionQueryKey, useAppApiStateGetVersion };
32
+ export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
package/state/state.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import {
2
- __spreadValues
3
- } from "../chunk-GWBPVOL2.js";
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-6EEIAH4R.js";
4
5
 
5
6
  // src/state/state.ts
6
- import axios from "axios";
7
7
  import {
8
8
  useQuery
9
9
  } from "react-query";
10
- var appApiStateGetVersion = (options) => {
11
- return axios.get(`/version`, options);
10
+ var getVersion = (options) => {
11
+ return customInstance({ url: `/version`, method: "get" }, options);
12
12
  };
13
- var getAppApiStateGetVersionQueryKey = () => [`/version`];
14
- var useAppApiStateGetVersion = (options) => {
15
- const { query: queryOptions, axios: axiosOptions } = options || {};
16
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiStateGetVersionQueryKey();
17
- const queryFn = () => appApiStateGetVersion(axiosOptions);
13
+ var getGetVersionQueryKey = () => [`/version`];
14
+ var useGetVersion = (options) => {
15
+ const { query: queryOptions, request: requestOptions } = options || {};
16
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetVersionQueryKey();
17
+ const queryFn = () => getVersion(requestOptions);
18
18
  const query = useQuery(queryKey, queryFn, queryOptions);
19
19
  return __spreadValues({
20
20
  queryKey
21
21
  }, query);
22
22
  };
23
23
  export {
24
- appApiStateGetVersion,
25
- getAppApiStateGetVersionQueryKey,
26
- useAppApiStateGetVersion
24
+ getGetVersionQueryKey,
25
+ getVersion,
26
+ useGetVersion
27
27
  };
28
28
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const appApiStateGetVersion = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<StateGetVersionResponse>> => {\n return axios.get(`/version`, options);\n};\n\nexport const getAppApiStateGetVersionQueryKey = () => [`/version`];\n\nexport type AppApiStateGetVersionQueryResult = NonNullable<\n AsyncReturnType<typeof appApiStateGetVersion>\n>;\nexport type AppApiStateGetVersionQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiStateGetVersion = <\n TData = AsyncReturnType<typeof appApiStateGetVersion>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiStateGetVersion>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiStateGetVersionQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiStateGetVersion>\n > = () => appApiStateGetVersion(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiStateGetVersion>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAsBO,IAAM,wBAAwB,CACnC,YACoD;AACpD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,mCAAmC,MAAM,CAAC,UAAU;AAO1D,IAAM,2BAA2B,CAGtC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,iCAAiC;AAE5E,QAAM,UAEF,MAAM,sBAAsB,YAAY;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
1
+ {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\" },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n AsyncReturnType<typeof getVersion>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = AsyncReturnType<typeof getVersion>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>\n getVersion(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AA+BO,IAAM,aAAa,CACxB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAA6D,MACjE,WAAW,cAAc;AAE3B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}