@squonk/account-server-client 0.1.31-rc.1 → 0.1.32-rc.2
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.
- package/asset/asset.cjs +133 -0
- package/asset/asset.cjs.map +1 -0
- package/asset/asset.d.ts +126 -0
- package/asset/asset.js +133 -0
- package/asset/asset.js.map +1 -0
- package/asset/package.json +7 -0
- package/{custom-instance-13412a15.d.ts → custom-instance-b985e1be.d.ts} +127 -40
- package/index.cjs +20 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +20 -2
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +48 -0
- package/merchant/merchant.cjs.map +1 -0
- package/merchant/merchant.d.ts +39 -0
- package/merchant/merchant.js +48 -0
- package/merchant/merchant.js.map +1 -0
- package/merchant/package.json +7 -0
- package/organisation/organisation.cjs +12 -12
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +10 -9
- package/organisation/organisation.js +12 -12
- package/organisation/organisation.js.map +1 -1
- package/package.json +9 -9
- package/product/product.cjs +36 -26
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +23 -16
- package/product/product.js +36 -26
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +155 -52
- package/src/asset/asset.ts +433 -0
- package/src/merchant/merchant.ts +145 -0
- package/src/organisation/organisation.ts +37 -37
- package/src/product/product.ts +97 -74
- package/src/state/state.ts +19 -16
- package/src/unit/unit.ts +64 -56
- package/src/user/user.ts +63 -62
- package/state/state.cjs +6 -4
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -6
- package/state/state.js +6 -4
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +22 -18
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +16 -15
- package/unit/unit.js +22 -18
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +22 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +14 -13
- package/user/user.js +22 -20
- package/user/user.js.map +1 -1
- package/service/package.json +0 -7
- package/service/service.cjs +0 -44
- package/service/service.cjs.map +0 -1
- package/service/service.d.ts +0 -49
- package/service/service.js +0 -44
- package/service/service.js.map +0 -1
- package/src/service/service.ts +0 -136
package/src/user/user.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.8.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -25,12 +25,9 @@ import type {
|
|
|
25
25
|
} from "../account-server-api.schemas";
|
|
26
26
|
import { customInstance, ErrorType } from ".././custom-instance";
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
) => Promise<infer R>
|
|
32
|
-
? R
|
|
33
|
-
: any;
|
|
28
|
+
export type AwaitedInput<T> = PromiseLike<T> | T;
|
|
29
|
+
|
|
30
|
+
export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
34
31
|
|
|
35
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
33
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -46,10 +43,11 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
46
43
|
* @summary Get information about your account
|
|
47
44
|
*/
|
|
48
45
|
export const getUserAccount = (
|
|
49
|
-
options?: SecondParameter<typeof customInstance
|
|
46
|
+
options?: SecondParameter<typeof customInstance>,
|
|
47
|
+
signal?: AbortSignal
|
|
50
48
|
) => {
|
|
51
49
|
return customInstance<UserAccountGetResponse>(
|
|
52
|
-
{ url: `/user/account`, method: "get" },
|
|
50
|
+
{ url: `/user/account`, method: "get", signal },
|
|
53
51
|
options
|
|
54
52
|
);
|
|
55
53
|
};
|
|
@@ -57,33 +55,34 @@ export const getUserAccount = (
|
|
|
57
55
|
export const getGetUserAccountQueryKey = () => [`/user/account`];
|
|
58
56
|
|
|
59
57
|
export type GetUserAccountQueryResult = NonNullable<
|
|
60
|
-
|
|
58
|
+
Awaited<ReturnType<typeof getUserAccount>>
|
|
61
59
|
>;
|
|
62
60
|
export type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
63
61
|
|
|
64
62
|
export const useGetUserAccount = <
|
|
65
|
-
TData =
|
|
63
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
66
64
|
TError = ErrorType<void | AsError>
|
|
67
65
|
>(options?: {
|
|
68
66
|
query?: UseQueryOptions<
|
|
69
|
-
|
|
67
|
+
Awaited<ReturnType<typeof getUserAccount>>,
|
|
70
68
|
TError,
|
|
71
69
|
TData
|
|
72
70
|
>;
|
|
73
71
|
request?: SecondParameter<typeof customInstance>;
|
|
74
72
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
75
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
73
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
76
74
|
|
|
77
75
|
const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
|
|
78
76
|
|
|
79
|
-
const queryFn: QueryFunction<
|
|
80
|
-
|
|
77
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({
|
|
78
|
+
signal,
|
|
79
|
+
}) => getUserAccount(requestOptions, signal);
|
|
81
80
|
|
|
82
|
-
const query = useQuery<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
81
|
+
const query = useQuery<
|
|
82
|
+
Awaited<ReturnType<typeof getUserAccount>>,
|
|
83
|
+
TError,
|
|
84
|
+
TData
|
|
85
|
+
>(queryKey, queryFn, queryOptions);
|
|
87
86
|
|
|
88
87
|
return {
|
|
89
88
|
queryKey,
|
|
@@ -98,10 +97,11 @@ export const useGetUserAccount = <
|
|
|
98
97
|
*/
|
|
99
98
|
export const getOrganisationUsers = (
|
|
100
99
|
orgId: string,
|
|
101
|
-
options?: SecondParameter<typeof customInstance
|
|
100
|
+
options?: SecondParameter<typeof customInstance>,
|
|
101
|
+
signal?: AbortSignal
|
|
102
102
|
) => {
|
|
103
103
|
return customInstance<UsersGetResponse>(
|
|
104
|
-
{ url: `/organisation/${orgId}/user`, method: "get" },
|
|
104
|
+
{ url: `/organisation/${orgId}/user`, method: "get", signal },
|
|
105
105
|
options
|
|
106
106
|
);
|
|
107
107
|
};
|
|
@@ -111,35 +111,35 @@ export const getGetOrganisationUsersQueryKey = (orgId: string) => [
|
|
|
111
111
|
];
|
|
112
112
|
|
|
113
113
|
export type GetOrganisationUsersQueryResult = NonNullable<
|
|
114
|
-
|
|
114
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
115
115
|
>;
|
|
116
116
|
export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
117
117
|
|
|
118
118
|
export const useGetOrganisationUsers = <
|
|
119
|
-
TData =
|
|
119
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
120
120
|
TError = ErrorType<AsError | void>
|
|
121
121
|
>(
|
|
122
122
|
orgId: string,
|
|
123
123
|
options?: {
|
|
124
124
|
query?: UseQueryOptions<
|
|
125
|
-
|
|
125
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
126
126
|
TError,
|
|
127
127
|
TData
|
|
128
128
|
>;
|
|
129
129
|
request?: SecondParameter<typeof customInstance>;
|
|
130
130
|
}
|
|
131
131
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
132
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
132
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
133
133
|
|
|
134
134
|
const queryKey =
|
|
135
135
|
queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
|
|
136
136
|
|
|
137
137
|
const queryFn: QueryFunction<
|
|
138
|
-
|
|
139
|
-
> = () => getOrganisationUsers(orgId, requestOptions);
|
|
138
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
139
|
+
> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
|
|
140
140
|
|
|
141
141
|
const query = useQuery<
|
|
142
|
-
|
|
142
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
143
143
|
TError,
|
|
144
144
|
TData
|
|
145
145
|
>(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
|
|
@@ -167,7 +167,7 @@ export const addOrganisationUser = (
|
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
export type AddOrganisationUserMutationResult = NonNullable<
|
|
170
|
-
|
|
170
|
+
Awaited<ReturnType<typeof addOrganisationUser>>
|
|
171
171
|
>;
|
|
172
172
|
|
|
173
173
|
export type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
@@ -177,26 +177,26 @@ export const useAddOrganisationUser = <
|
|
|
177
177
|
TContext = unknown
|
|
178
178
|
>(options?: {
|
|
179
179
|
mutation?: UseMutationOptions<
|
|
180
|
-
|
|
180
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
181
181
|
TError,
|
|
182
182
|
{ orgId: string; userId: string },
|
|
183
183
|
TContext
|
|
184
184
|
>;
|
|
185
185
|
request?: SecondParameter<typeof customInstance>;
|
|
186
186
|
}) => {
|
|
187
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
187
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
188
188
|
|
|
189
189
|
const mutationFn: MutationFunction<
|
|
190
|
-
|
|
190
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
191
191
|
{ orgId: string; userId: string }
|
|
192
192
|
> = (props) => {
|
|
193
|
-
const { orgId, userId } = props
|
|
193
|
+
const { orgId, userId } = props ?? {};
|
|
194
194
|
|
|
195
195
|
return addOrganisationUser(orgId, userId, requestOptions);
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
return useMutation<
|
|
199
|
-
|
|
199
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
200
200
|
TError,
|
|
201
201
|
{ orgId: string; userId: string },
|
|
202
202
|
TContext
|
|
@@ -219,7 +219,7 @@ export const deleteOrganisationUser = (
|
|
|
219
219
|
};
|
|
220
220
|
|
|
221
221
|
export type DeleteOrganisationUserMutationResult = NonNullable<
|
|
222
|
-
|
|
222
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>
|
|
223
223
|
>;
|
|
224
224
|
|
|
225
225
|
export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
@@ -229,26 +229,26 @@ export const useDeleteOrganisationUser = <
|
|
|
229
229
|
TContext = unknown
|
|
230
230
|
>(options?: {
|
|
231
231
|
mutation?: UseMutationOptions<
|
|
232
|
-
|
|
232
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
233
233
|
TError,
|
|
234
234
|
{ orgId: string; userId: string },
|
|
235
235
|
TContext
|
|
236
236
|
>;
|
|
237
237
|
request?: SecondParameter<typeof customInstance>;
|
|
238
238
|
}) => {
|
|
239
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
239
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
240
240
|
|
|
241
241
|
const mutationFn: MutationFunction<
|
|
242
|
-
|
|
242
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
243
243
|
{ orgId: string; userId: string }
|
|
244
244
|
> = (props) => {
|
|
245
|
-
const { orgId, userId } = props
|
|
245
|
+
const { orgId, userId } = props ?? {};
|
|
246
246
|
|
|
247
247
|
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
248
248
|
};
|
|
249
249
|
|
|
250
250
|
return useMutation<
|
|
251
|
-
|
|
251
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
252
252
|
TError,
|
|
253
253
|
{ orgId: string; userId: string },
|
|
254
254
|
TContext
|
|
@@ -261,10 +261,11 @@ export const useDeleteOrganisationUser = <
|
|
|
261
261
|
*/
|
|
262
262
|
export const getOrganisationUnitUsers = (
|
|
263
263
|
unitId: string,
|
|
264
|
-
options?: SecondParameter<typeof customInstance
|
|
264
|
+
options?: SecondParameter<typeof customInstance>,
|
|
265
|
+
signal?: AbortSignal
|
|
265
266
|
) => {
|
|
266
267
|
return customInstance<UsersGetResponse>(
|
|
267
|
-
{ url: `/unit/${unitId}/user`, method: "get" },
|
|
268
|
+
{ url: `/unit/${unitId}/user`, method: "get", signal },
|
|
268
269
|
options
|
|
269
270
|
);
|
|
270
271
|
};
|
|
@@ -274,35 +275,35 @@ export const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [
|
|
|
274
275
|
];
|
|
275
276
|
|
|
276
277
|
export type GetOrganisationUnitUsersQueryResult = NonNullable<
|
|
277
|
-
|
|
278
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
278
279
|
>;
|
|
279
280
|
export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
280
281
|
|
|
281
282
|
export const useGetOrganisationUnitUsers = <
|
|
282
|
-
TData =
|
|
283
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
283
284
|
TError = ErrorType<AsError | void>
|
|
284
285
|
>(
|
|
285
286
|
unitId: string,
|
|
286
287
|
options?: {
|
|
287
288
|
query?: UseQueryOptions<
|
|
288
|
-
|
|
289
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
289
290
|
TError,
|
|
290
291
|
TData
|
|
291
292
|
>;
|
|
292
293
|
request?: SecondParameter<typeof customInstance>;
|
|
293
294
|
}
|
|
294
295
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
295
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
296
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
296
297
|
|
|
297
298
|
const queryKey =
|
|
298
299
|
queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
299
300
|
|
|
300
301
|
const queryFn: QueryFunction<
|
|
301
|
-
|
|
302
|
-
> = () => getOrganisationUnitUsers(unitId, requestOptions);
|
|
302
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
303
|
+
> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
303
304
|
|
|
304
305
|
const query = useQuery<
|
|
305
|
-
|
|
306
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
306
307
|
TError,
|
|
307
308
|
TData
|
|
308
309
|
>(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });
|
|
@@ -334,7 +335,7 @@ export const addOrganisationUnitUser = (
|
|
|
334
335
|
};
|
|
335
336
|
|
|
336
337
|
export type AddOrganisationUnitUserMutationResult = NonNullable<
|
|
337
|
-
|
|
338
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>
|
|
338
339
|
>;
|
|
339
340
|
|
|
340
341
|
export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
@@ -344,26 +345,26 @@ export const useAddOrganisationUnitUser = <
|
|
|
344
345
|
TContext = unknown
|
|
345
346
|
>(options?: {
|
|
346
347
|
mutation?: UseMutationOptions<
|
|
347
|
-
|
|
348
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
348
349
|
TError,
|
|
349
350
|
{ unitId: string; userId: string },
|
|
350
351
|
TContext
|
|
351
352
|
>;
|
|
352
353
|
request?: SecondParameter<typeof customInstance>;
|
|
353
354
|
}) => {
|
|
354
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
355
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
355
356
|
|
|
356
357
|
const mutationFn: MutationFunction<
|
|
357
|
-
|
|
358
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
358
359
|
{ unitId: string; userId: string }
|
|
359
360
|
> = (props) => {
|
|
360
|
-
const { unitId, userId } = props
|
|
361
|
+
const { unitId, userId } = props ?? {};
|
|
361
362
|
|
|
362
363
|
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
363
364
|
};
|
|
364
365
|
|
|
365
366
|
return useMutation<
|
|
366
|
-
|
|
367
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
367
368
|
TError,
|
|
368
369
|
{ unitId: string; userId: string },
|
|
369
370
|
TContext
|
|
@@ -390,7 +391,7 @@ export const deleteOrganisationUnitUser = (
|
|
|
390
391
|
};
|
|
391
392
|
|
|
392
393
|
export type DeleteOrganisationUnitUserMutationResult = NonNullable<
|
|
393
|
-
|
|
394
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
|
|
394
395
|
>;
|
|
395
396
|
|
|
396
397
|
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
@@ -400,26 +401,26 @@ export const useDeleteOrganisationUnitUser = <
|
|
|
400
401
|
TContext = unknown
|
|
401
402
|
>(options?: {
|
|
402
403
|
mutation?: UseMutationOptions<
|
|
403
|
-
|
|
404
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
404
405
|
TError,
|
|
405
406
|
{ unitId: string; userId: string },
|
|
406
407
|
TContext
|
|
407
408
|
>;
|
|
408
409
|
request?: SecondParameter<typeof customInstance>;
|
|
409
410
|
}) => {
|
|
410
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
411
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
411
412
|
|
|
412
413
|
const mutationFn: MutationFunction<
|
|
413
|
-
|
|
414
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
414
415
|
{ unitId: string; userId: string }
|
|
415
416
|
> = (props) => {
|
|
416
|
-
const { unitId, userId } = props
|
|
417
|
+
const { unitId, userId } = props ?? {};
|
|
417
418
|
|
|
418
419
|
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
419
420
|
};
|
|
420
421
|
|
|
421
422
|
return useMutation<
|
|
422
|
-
|
|
423
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
423
424
|
TError,
|
|
424
425
|
{ unitId: string; userId: string },
|
|
425
426
|
TContext
|
package/state/state.cjs
CHANGED
|
@@ -7,14 +7,16 @@ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _reactquery = require('react-query');
|
|
10
|
-
var getVersion = (options) => {
|
|
11
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/version`, method: "get" }, options);
|
|
10
|
+
var getVersion = (options, signal) => {
|
|
11
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/version`, method: "get", signal }, options);
|
|
12
12
|
};
|
|
13
13
|
var getGetVersionQueryKey = () => [`/version`];
|
|
14
14
|
var useGetVersion = (options) => {
|
|
15
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
15
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
16
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetVersionQueryKey()));
|
|
17
|
-
const queryFn = (
|
|
17
|
+
const queryFn = ({
|
|
18
|
+
signal
|
|
19
|
+
}) => getVersion(requestOptions, signal);
|
|
18
20
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
19
21
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
20
22
|
queryKey
|
package/state/state.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AA4BO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\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\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\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<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<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,9 +1,9 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { a9 as customInstance, a2 as StateGetVersionResponse, aa as ErrorType, a5 as AsError } from '../custom-instance-b985e1be.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Generated by orval v6.
|
|
6
|
+
* Generated by orval v6.8.0 🍺
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Account Server API
|
|
9
9
|
* The Informatics Matters Account Server API.
|
|
@@ -13,14 +13,15 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
13
13
|
* OpenAPI spec version: 0.1
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
declare type
|
|
16
|
+
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
17
|
+
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
17
18
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
18
19
|
/**
|
|
19
20
|
* @summary Gets the Account Server version
|
|
20
21
|
*/
|
|
21
|
-
declare const getVersion: (options?: SecondParameter<typeof customInstance
|
|
22
|
+
declare const getVersion: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<StateGetVersionResponse>;
|
|
22
23
|
declare const getGetVersionQueryKey: () => string[];
|
|
23
|
-
declare type GetVersionQueryResult = NonNullable<
|
|
24
|
+
declare type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
|
|
24
25
|
declare type GetVersionQueryError = ErrorType<AsError | void>;
|
|
25
26
|
declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
26
27
|
query?: UseQueryOptions<StateGetVersionResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -29,4 +30,4 @@ declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorTyp
|
|
|
29
30
|
queryKey: QueryKey;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
|
|
33
|
+
export { Awaited, AwaitedInput, GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
|
package/state/state.js
CHANGED
|
@@ -7,14 +7,16 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
useQuery
|
|
9
9
|
} from "react-query";
|
|
10
|
-
var getVersion = (options) => {
|
|
11
|
-
return customInstance({ url: `/version`, method: "get" }, options);
|
|
10
|
+
var getVersion = (options, signal) => {
|
|
11
|
+
return customInstance({ url: `/version`, method: "get", signal }, options);
|
|
12
12
|
};
|
|
13
13
|
var getGetVersionQueryKey = () => [`/version`];
|
|
14
14
|
var useGetVersion = (options) => {
|
|
15
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
15
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
16
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetVersionQueryKey();
|
|
17
|
-
const queryFn = (
|
|
17
|
+
const queryFn = ({
|
|
18
|
+
signal
|
|
19
|
+
}) => getVersion(requestOptions, signal);
|
|
18
20
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
19
21
|
return __spreadValues({
|
|
20
22
|
queryKey
|
package/state/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.
|
|
1
|
+
{"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\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\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\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<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<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;AA4BO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
|
package/unit/unit.cjs
CHANGED
|
@@ -8,16 +8,16 @@ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _reactquery = require('react-query');
|
|
11
|
-
var getOrganisationUnits = (orgId, options) => {
|
|
12
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit`, method: "get" }, options);
|
|
11
|
+
var getOrganisationUnits = (orgId, options, signal) => {
|
|
12
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit`, method: "get", signal }, options);
|
|
13
13
|
};
|
|
14
14
|
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
15
15
|
`/organisation/${orgId}/unit`
|
|
16
16
|
];
|
|
17
17
|
var useGetOrganisationUnits = (orgId, options) => {
|
|
18
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
18
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
19
19
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
|
|
20
|
-
const queryFn = () => getOrganisationUnits(orgId, requestOptions);
|
|
20
|
+
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
21
21
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
|
|
22
22
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
23
23
|
queryKey
|
|
@@ -32,23 +32,25 @@ var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
|
32
32
|
}, options);
|
|
33
33
|
};
|
|
34
34
|
var useCreateOrganisationUnit = (options) => {
|
|
35
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
35
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
36
36
|
const mutationFn = (props) => {
|
|
37
|
-
const { orgId, data } = props
|
|
37
|
+
const { orgId, data } = _nullishCoalesce(props, () => ( {}));
|
|
38
38
|
return createOrganisationUnit(orgId, data, requestOptions);
|
|
39
39
|
};
|
|
40
40
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
41
41
|
};
|
|
42
|
-
var getUnit = (orgId, unitId, options) => {
|
|
43
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit/${unitId}`, method: "get" }, options);
|
|
42
|
+
var getUnit = (orgId, unitId, options, signal) => {
|
|
43
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit/${unitId}`, method: "get", signal }, options);
|
|
44
44
|
};
|
|
45
45
|
var getGetUnitQueryKey = (orgId, unitId) => [
|
|
46
46
|
`/organisation/${orgId}/unit/${unitId}`
|
|
47
47
|
];
|
|
48
48
|
var useGetUnit = (orgId, unitId, options) => {
|
|
49
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
49
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
50
50
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitQueryKey(orgId, unitId)));
|
|
51
|
-
const queryFn = (
|
|
51
|
+
const queryFn = ({
|
|
52
|
+
signal
|
|
53
|
+
}) => getUnit(orgId, unitId, requestOptions, signal);
|
|
52
54
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!(orgId && unitId) }, queryOptions));
|
|
53
55
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
54
56
|
queryKey
|
|
@@ -58,21 +60,23 @@ var deleteOrganisationUnit = (orgId, unitId, options) => {
|
|
|
58
60
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit/${unitId}`, method: "delete" }, options);
|
|
59
61
|
};
|
|
60
62
|
var useDeleteOrganisationUnit = (options) => {
|
|
61
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
63
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
62
64
|
const mutationFn = (props) => {
|
|
63
|
-
const { orgId, unitId } = props
|
|
65
|
+
const { orgId, unitId } = _nullishCoalesce(props, () => ( {}));
|
|
64
66
|
return deleteOrganisationUnit(orgId, unitId, requestOptions);
|
|
65
67
|
};
|
|
66
68
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
67
69
|
};
|
|
68
|
-
var getUnits = (options) => {
|
|
69
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "get" }, options);
|
|
70
|
+
var getUnits = (options, signal) => {
|
|
71
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "get", signal }, options);
|
|
70
72
|
};
|
|
71
73
|
var getGetUnitsQueryKey = () => [`/unit`];
|
|
72
74
|
var useGetUnits = (options) => {
|
|
73
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
75
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
74
76
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitsQueryKey()));
|
|
75
|
-
const queryFn = (
|
|
77
|
+
const queryFn = ({
|
|
78
|
+
signal
|
|
79
|
+
}) => getUnits(requestOptions, signal);
|
|
76
80
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
77
81
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
78
82
|
queryKey
|
|
@@ -82,7 +86,7 @@ var createDefaultUnit = (options) => {
|
|
|
82
86
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "put" }, options);
|
|
83
87
|
};
|
|
84
88
|
var useCreateDefaultUnit = (options) => {
|
|
85
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
89
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
86
90
|
const mutationFn = () => {
|
|
87
91
|
return createDefaultUnit(requestOptions);
|
|
88
92
|
};
|
|
@@ -92,7 +96,7 @@ var deleteDefaultUnit = (options) => {
|
|
|
92
96
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
|
|
93
97
|
};
|
|
94
98
|
var useDeleteDefaultUnit = (options) => {
|
|
95
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
99
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
96
100
|
const mutationFn = () => {
|
|
97
101
|
return deleteDefaultUnit(requestOptions);
|
|
98
102
|
};
|