@squonk/account-server-client 2.0.4-rc.2 → 2.0.4-rc.4
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/admin/admin.cjs +10 -14
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +9 -3
- package/admin/admin.js +9 -13
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +59 -28
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +71 -3
- package/asset/asset.js +58 -27
- package/asset/asset.js.map +1 -1
- package/{custom-instance-85497958.d.ts → custom-instance-8a11f2d1.d.ts} +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +19 -16
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +16 -4
- package/merchant/merchant.js +18 -15
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +62 -34
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +56 -6
- package/organisation/organisation.js +61 -33
- package/organisation/organisation.js.map +1 -1
- package/package.json +10 -9
- package/product/product.cjs +92 -55
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +79 -9
- package/product/product.js +91 -54
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +1 -1
- package/src/admin/admin.ts +34 -18
- package/src/asset/asset.ts +223 -88
- package/src/merchant/merchant.ts +60 -27
- package/src/organisation/organisation.ts +213 -90
- package/src/product/product.ts +310 -134
- package/src/state/state.ts +30 -15
- package/src/unit/unit.ts +261 -110
- package/src/user/user.ts +207 -88
- package/state/state.cjs +10 -11
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +9 -3
- package/state/state.js +9 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +72 -40
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +70 -6
- package/unit/unit.js +71 -39
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -31
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +63 -5
- package/user/user.js +55 -30
- package/user/user.js.map +1 -1
- package/chunk-7XN3IQYV.cjs +0 -13
- package/chunk-7XN3IQYV.cjs.map +0 -1
- package/chunk-YEX2SGER.js +0 -13
- package/chunk-YEX2SGER.js.map +0 -1
- package/src/queryMutator.ts +0 -12
package/src/user/user.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.15.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -24,7 +24,6 @@ import type {
|
|
|
24
24
|
} from "../account-server-api.schemas";
|
|
25
25
|
import { customInstance } from ".././custom-instance";
|
|
26
26
|
import type { ErrorType } from ".././custom-instance";
|
|
27
|
-
import { queryMutator } from ".././queryMutator";
|
|
28
27
|
|
|
29
28
|
// eslint-disable-next-line
|
|
30
29
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -49,14 +48,9 @@ export const getUserAccount = (
|
|
|
49
48
|
);
|
|
50
49
|
};
|
|
51
50
|
|
|
52
|
-
export const getGetUserAccountQueryKey = () => [`/user/account`];
|
|
51
|
+
export const getGetUserAccountQueryKey = () => ["account-server-api", `/user/account`] as const;
|
|
53
52
|
|
|
54
|
-
export
|
|
55
|
-
Awaited<ReturnType<typeof getUserAccount>>
|
|
56
|
-
>;
|
|
57
|
-
export type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
58
|
-
|
|
59
|
-
export const useGetUserAccount = <
|
|
53
|
+
export const getGetUserAccountQueryOptions = <
|
|
60
54
|
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
61
55
|
TError = ErrorType<void | AsError>
|
|
62
56
|
>(options?: {
|
|
@@ -66,7 +60,11 @@ export const useGetUserAccount = <
|
|
|
66
60
|
TData
|
|
67
61
|
>;
|
|
68
62
|
request?: SecondParameter<typeof customInstance>;
|
|
69
|
-
}):
|
|
63
|
+
}): UseQueryOptions<
|
|
64
|
+
Awaited<ReturnType<typeof getUserAccount>>,
|
|
65
|
+
TError,
|
|
66
|
+
TData
|
|
67
|
+
> & { queryKey: QueryKey } => {
|
|
70
68
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
71
69
|
|
|
72
70
|
const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
|
|
@@ -75,15 +73,32 @@ export const useGetUserAccount = <
|
|
|
75
73
|
signal,
|
|
76
74
|
}) => getUserAccount(requestOptions, signal);
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type GetUserAccountQueryResult = NonNullable<
|
|
80
|
+
Awaited<ReturnType<typeof getUserAccount>>
|
|
81
|
+
>;
|
|
82
|
+
export type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
export const useGetUserAccount = <
|
|
85
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
86
|
+
TError = ErrorType<void | AsError>
|
|
87
|
+
>(options?: {
|
|
88
|
+
query?: UseQueryOptions<
|
|
81
89
|
Awaited<ReturnType<typeof getUserAccount>>,
|
|
82
90
|
TError,
|
|
83
91
|
TData
|
|
84
|
-
|
|
92
|
+
>;
|
|
93
|
+
request?: SecondParameter<typeof customInstance>;
|
|
94
|
+
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
95
|
+
const queryOptions = getGetUserAccountQueryOptions(options);
|
|
85
96
|
|
|
86
|
-
query
|
|
97
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
98
|
+
queryKey: QueryKey;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
query.queryKey = queryOptions.queryKey;
|
|
87
102
|
|
|
88
103
|
return query;
|
|
89
104
|
};
|
|
@@ -104,16 +119,10 @@ export const getOrganisationUsers = (
|
|
|
104
119
|
);
|
|
105
120
|
};
|
|
106
121
|
|
|
107
|
-
export const getGetOrganisationUsersQueryKey = (orgId: string) =>
|
|
108
|
-
`/organisation/${orgId}/user
|
|
109
|
-
];
|
|
122
|
+
export const getGetOrganisationUsersQueryKey = (orgId: string) =>
|
|
123
|
+
["account-server-api", `/organisation/${orgId}/user`] as const;
|
|
110
124
|
|
|
111
|
-
export
|
|
112
|
-
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
113
|
-
>;
|
|
114
|
-
export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
115
|
-
|
|
116
|
-
export const useGetOrganisationUsers = <
|
|
125
|
+
export const getGetOrganisationUsersQueryOptions = <
|
|
117
126
|
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
118
127
|
TError = ErrorType<AsError | void>
|
|
119
128
|
>(
|
|
@@ -126,7 +135,11 @@ export const useGetOrganisationUsers = <
|
|
|
126
135
|
>;
|
|
127
136
|
request?: SecondParameter<typeof customInstance>;
|
|
128
137
|
}
|
|
129
|
-
):
|
|
138
|
+
): UseQueryOptions<
|
|
139
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
140
|
+
TError,
|
|
141
|
+
TData
|
|
142
|
+
> & { queryKey: QueryKey } => {
|
|
130
143
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
131
144
|
|
|
132
145
|
const queryKey =
|
|
@@ -136,15 +149,35 @@ export const useGetOrganisationUsers = <
|
|
|
136
149
|
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
137
150
|
> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
|
|
138
151
|
|
|
139
|
-
|
|
152
|
+
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
153
|
+
};
|
|
140
154
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
>(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
155
|
+
export type GetOrganisationUsersQueryResult = NonNullable<
|
|
156
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
157
|
+
>;
|
|
158
|
+
export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
146
159
|
|
|
147
|
-
|
|
160
|
+
export const useGetOrganisationUsers = <
|
|
161
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
162
|
+
TError = ErrorType<AsError | void>
|
|
163
|
+
>(
|
|
164
|
+
orgId: string,
|
|
165
|
+
options?: {
|
|
166
|
+
query?: UseQueryOptions<
|
|
167
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
168
|
+
TError,
|
|
169
|
+
TData
|
|
170
|
+
>;
|
|
171
|
+
request?: SecondParameter<typeof customInstance>;
|
|
172
|
+
}
|
|
173
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
174
|
+
const queryOptions = getGetOrganisationUsersQueryOptions(orgId, options);
|
|
175
|
+
|
|
176
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
177
|
+
queryKey: QueryKey;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
query.queryKey = queryOptions.queryKey;
|
|
148
181
|
|
|
149
182
|
return query;
|
|
150
183
|
};
|
|
@@ -165,13 +198,7 @@ export const addOrganisationUser = (
|
|
|
165
198
|
);
|
|
166
199
|
};
|
|
167
200
|
|
|
168
|
-
export
|
|
169
|
-
Awaited<ReturnType<typeof addOrganisationUser>>
|
|
170
|
-
>;
|
|
171
|
-
|
|
172
|
-
export type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
173
|
-
|
|
174
|
-
export const useAddOrganisationUser = <
|
|
201
|
+
export const getAddOrganisationUserMutationOptions = <
|
|
175
202
|
TError = ErrorType<AsError>,
|
|
176
203
|
TContext = unknown
|
|
177
204
|
>(options?: {
|
|
@@ -182,7 +209,12 @@ export const useAddOrganisationUser = <
|
|
|
182
209
|
TContext
|
|
183
210
|
>;
|
|
184
211
|
request?: SecondParameter<typeof customInstance>;
|
|
185
|
-
})
|
|
212
|
+
}): UseMutationOptions<
|
|
213
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
214
|
+
TError,
|
|
215
|
+
{ orgId: string; userId: string },
|
|
216
|
+
TContext
|
|
217
|
+
> => {
|
|
186
218
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
187
219
|
|
|
188
220
|
const mutationFn: MutationFunction<
|
|
@@ -194,12 +226,30 @@ export const useAddOrganisationUser = <
|
|
|
194
226
|
return addOrganisationUser(orgId, userId, requestOptions);
|
|
195
227
|
};
|
|
196
228
|
|
|
197
|
-
return
|
|
229
|
+
return { mutationFn, ...mutationOptions };
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export type AddOrganisationUserMutationResult = NonNullable<
|
|
233
|
+
Awaited<ReturnType<typeof addOrganisationUser>>
|
|
234
|
+
>;
|
|
235
|
+
|
|
236
|
+
export type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
237
|
+
|
|
238
|
+
export const useAddOrganisationUser = <
|
|
239
|
+
TError = ErrorType<AsError>,
|
|
240
|
+
TContext = unknown
|
|
241
|
+
>(options?: {
|
|
242
|
+
mutation?: UseMutationOptions<
|
|
198
243
|
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
199
244
|
TError,
|
|
200
245
|
{ orgId: string; userId: string },
|
|
201
246
|
TContext
|
|
202
|
-
|
|
247
|
+
>;
|
|
248
|
+
request?: SecondParameter<typeof customInstance>;
|
|
249
|
+
}) => {
|
|
250
|
+
const mutationOptions = getAddOrganisationUserMutationOptions(options);
|
|
251
|
+
|
|
252
|
+
return useMutation(mutationOptions);
|
|
203
253
|
};
|
|
204
254
|
/**
|
|
205
255
|
* Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint
|
|
@@ -217,13 +267,7 @@ export const deleteOrganisationUser = (
|
|
|
217
267
|
);
|
|
218
268
|
};
|
|
219
269
|
|
|
220
|
-
export
|
|
221
|
-
Awaited<ReturnType<typeof deleteOrganisationUser>>
|
|
222
|
-
>;
|
|
223
|
-
|
|
224
|
-
export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
225
|
-
|
|
226
|
-
export const useDeleteOrganisationUser = <
|
|
270
|
+
export const getDeleteOrganisationUserMutationOptions = <
|
|
227
271
|
TError = ErrorType<AsError>,
|
|
228
272
|
TContext = unknown
|
|
229
273
|
>(options?: {
|
|
@@ -234,7 +278,12 @@ export const useDeleteOrganisationUser = <
|
|
|
234
278
|
TContext
|
|
235
279
|
>;
|
|
236
280
|
request?: SecondParameter<typeof customInstance>;
|
|
237
|
-
})
|
|
281
|
+
}): UseMutationOptions<
|
|
282
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
283
|
+
TError,
|
|
284
|
+
{ orgId: string; userId: string },
|
|
285
|
+
TContext
|
|
286
|
+
> => {
|
|
238
287
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
239
288
|
|
|
240
289
|
const mutationFn: MutationFunction<
|
|
@@ -246,12 +295,30 @@ export const useDeleteOrganisationUser = <
|
|
|
246
295
|
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
247
296
|
};
|
|
248
297
|
|
|
249
|
-
return
|
|
298
|
+
return { mutationFn, ...mutationOptions };
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export type DeleteOrganisationUserMutationResult = NonNullable<
|
|
302
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>
|
|
303
|
+
>;
|
|
304
|
+
|
|
305
|
+
export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
306
|
+
|
|
307
|
+
export const useDeleteOrganisationUser = <
|
|
308
|
+
TError = ErrorType<AsError>,
|
|
309
|
+
TContext = unknown
|
|
310
|
+
>(options?: {
|
|
311
|
+
mutation?: UseMutationOptions<
|
|
250
312
|
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
251
313
|
TError,
|
|
252
314
|
{ orgId: string; userId: string },
|
|
253
315
|
TContext
|
|
254
|
-
|
|
316
|
+
>;
|
|
317
|
+
request?: SecondParameter<typeof customInstance>;
|
|
318
|
+
}) => {
|
|
319
|
+
const mutationOptions = getDeleteOrganisationUserMutationOptions(options);
|
|
320
|
+
|
|
321
|
+
return useMutation(mutationOptions);
|
|
255
322
|
};
|
|
256
323
|
/**
|
|
257
324
|
* Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
@@ -269,16 +336,10 @@ export const getOrganisationUnitUsers = (
|
|
|
269
336
|
);
|
|
270
337
|
};
|
|
271
338
|
|
|
272
|
-
export const getGetOrganisationUnitUsersQueryKey = (unitId: string) =>
|
|
273
|
-
`/unit/${unitId}/user
|
|
274
|
-
];
|
|
339
|
+
export const getGetOrganisationUnitUsersQueryKey = (unitId: string) =>
|
|
340
|
+
["account-server-api", `/unit/${unitId}/user`] as const;
|
|
275
341
|
|
|
276
|
-
export
|
|
277
|
-
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
278
|
-
>;
|
|
279
|
-
export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
280
|
-
|
|
281
|
-
export const useGetOrganisationUnitUsers = <
|
|
342
|
+
export const getGetOrganisationUnitUsersQueryOptions = <
|
|
282
343
|
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
283
344
|
TError = ErrorType<AsError | void>
|
|
284
345
|
>(
|
|
@@ -291,7 +352,11 @@ export const useGetOrganisationUnitUsers = <
|
|
|
291
352
|
>;
|
|
292
353
|
request?: SecondParameter<typeof customInstance>;
|
|
293
354
|
}
|
|
294
|
-
):
|
|
355
|
+
): UseQueryOptions<
|
|
356
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
357
|
+
TError,
|
|
358
|
+
TData
|
|
359
|
+
> & { queryKey: QueryKey } => {
|
|
295
360
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
296
361
|
|
|
297
362
|
const queryKey =
|
|
@@ -301,15 +366,35 @@ export const useGetOrganisationUnitUsers = <
|
|
|
301
366
|
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
302
367
|
> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
303
368
|
|
|
304
|
-
|
|
369
|
+
return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
|
|
370
|
+
};
|
|
305
371
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
>(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
372
|
+
export type GetOrganisationUnitUsersQueryResult = NonNullable<
|
|
373
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
374
|
+
>;
|
|
375
|
+
export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
311
376
|
|
|
312
|
-
|
|
377
|
+
export const useGetOrganisationUnitUsers = <
|
|
378
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
379
|
+
TError = ErrorType<AsError | void>
|
|
380
|
+
>(
|
|
381
|
+
unitId: string,
|
|
382
|
+
options?: {
|
|
383
|
+
query?: UseQueryOptions<
|
|
384
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
385
|
+
TError,
|
|
386
|
+
TData
|
|
387
|
+
>;
|
|
388
|
+
request?: SecondParameter<typeof customInstance>;
|
|
389
|
+
}
|
|
390
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
391
|
+
const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, options);
|
|
392
|
+
|
|
393
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
394
|
+
queryKey: QueryKey;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
query.queryKey = queryOptions.queryKey;
|
|
313
398
|
|
|
314
399
|
return query;
|
|
315
400
|
};
|
|
@@ -334,13 +419,7 @@ export const addOrganisationUnitUser = (
|
|
|
334
419
|
);
|
|
335
420
|
};
|
|
336
421
|
|
|
337
|
-
export
|
|
338
|
-
Awaited<ReturnType<typeof addOrganisationUnitUser>>
|
|
339
|
-
>;
|
|
340
|
-
|
|
341
|
-
export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
342
|
-
|
|
343
|
-
export const useAddOrganisationUnitUser = <
|
|
422
|
+
export const getAddOrganisationUnitUserMutationOptions = <
|
|
344
423
|
TError = ErrorType<AsError>,
|
|
345
424
|
TContext = unknown
|
|
346
425
|
>(options?: {
|
|
@@ -351,7 +430,12 @@ export const useAddOrganisationUnitUser = <
|
|
|
351
430
|
TContext
|
|
352
431
|
>;
|
|
353
432
|
request?: SecondParameter<typeof customInstance>;
|
|
354
|
-
})
|
|
433
|
+
}): UseMutationOptions<
|
|
434
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
435
|
+
TError,
|
|
436
|
+
{ unitId: string; userId: string },
|
|
437
|
+
TContext
|
|
438
|
+
> => {
|
|
355
439
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
356
440
|
|
|
357
441
|
const mutationFn: MutationFunction<
|
|
@@ -363,12 +447,30 @@ export const useAddOrganisationUnitUser = <
|
|
|
363
447
|
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
364
448
|
};
|
|
365
449
|
|
|
366
|
-
return
|
|
450
|
+
return { mutationFn, ...mutationOptions };
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
export type AddOrganisationUnitUserMutationResult = NonNullable<
|
|
454
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>
|
|
455
|
+
>;
|
|
456
|
+
|
|
457
|
+
export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
458
|
+
|
|
459
|
+
export const useAddOrganisationUnitUser = <
|
|
460
|
+
TError = ErrorType<AsError>,
|
|
461
|
+
TContext = unknown
|
|
462
|
+
>(options?: {
|
|
463
|
+
mutation?: UseMutationOptions<
|
|
367
464
|
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
368
465
|
TError,
|
|
369
466
|
{ unitId: string; userId: string },
|
|
370
467
|
TContext
|
|
371
|
-
|
|
468
|
+
>;
|
|
469
|
+
request?: SecondParameter<typeof customInstance>;
|
|
470
|
+
}) => {
|
|
471
|
+
const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);
|
|
472
|
+
|
|
473
|
+
return useMutation(mutationOptions);
|
|
372
474
|
};
|
|
373
475
|
/**
|
|
374
476
|
* Removes a user from an Organisational Unit.
|
|
@@ -390,13 +492,7 @@ export const deleteOrganisationUnitUser = (
|
|
|
390
492
|
);
|
|
391
493
|
};
|
|
392
494
|
|
|
393
|
-
export
|
|
394
|
-
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
|
|
395
|
-
>;
|
|
396
|
-
|
|
397
|
-
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
398
|
-
|
|
399
|
-
export const useDeleteOrganisationUnitUser = <
|
|
495
|
+
export const getDeleteOrganisationUnitUserMutationOptions = <
|
|
400
496
|
TError = ErrorType<AsError>,
|
|
401
497
|
TContext = unknown
|
|
402
498
|
>(options?: {
|
|
@@ -407,7 +503,12 @@ export const useDeleteOrganisationUnitUser = <
|
|
|
407
503
|
TContext
|
|
408
504
|
>;
|
|
409
505
|
request?: SecondParameter<typeof customInstance>;
|
|
410
|
-
})
|
|
506
|
+
}): UseMutationOptions<
|
|
507
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
508
|
+
TError,
|
|
509
|
+
{ unitId: string; userId: string },
|
|
510
|
+
TContext
|
|
511
|
+
> => {
|
|
411
512
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
412
513
|
|
|
413
514
|
const mutationFn: MutationFunction<
|
|
@@ -419,10 +520,28 @@ export const useDeleteOrganisationUnitUser = <
|
|
|
419
520
|
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
420
521
|
};
|
|
421
522
|
|
|
422
|
-
return
|
|
523
|
+
return { mutationFn, ...mutationOptions };
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
export type DeleteOrganisationUnitUserMutationResult = NonNullable<
|
|
527
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
|
|
528
|
+
>;
|
|
529
|
+
|
|
530
|
+
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
531
|
+
|
|
532
|
+
export const useDeleteOrganisationUnitUser = <
|
|
533
|
+
TError = ErrorType<AsError>,
|
|
534
|
+
TContext = unknown
|
|
535
|
+
>(options?: {
|
|
536
|
+
mutation?: UseMutationOptions<
|
|
423
537
|
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
424
538
|
TError,
|
|
425
539
|
{ unitId: string; userId: string },
|
|
426
540
|
TContext
|
|
427
|
-
|
|
541
|
+
>;
|
|
542
|
+
request?: SecondParameter<typeof customInstance>;
|
|
543
|
+
}) => {
|
|
544
|
+
const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);
|
|
545
|
+
|
|
546
|
+
return useMutation(mutationOptions);
|
|
428
547
|
};
|
package/state/state.cjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
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 _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
3
|
var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
|
|
7
4
|
|
|
8
5
|
// src/state/state.ts
|
|
@@ -13,23 +10,25 @@ var getVersion = (options, signal) => {
|
|
|
13
10
|
options
|
|
14
11
|
);
|
|
15
12
|
};
|
|
16
|
-
var getGetVersionQueryKey = () => [`/version`];
|
|
17
|
-
var
|
|
13
|
+
var getGetVersionQueryKey = () => ["account-server-api", `/version`];
|
|
14
|
+
var getGetVersionQueryOptions = (options) => {
|
|
18
15
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
19
16
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetVersionQueryKey()));
|
|
20
17
|
const queryFn = ({
|
|
21
18
|
signal
|
|
22
19
|
}) => getVersion(requestOptions, signal);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
query
|
|
20
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
21
|
+
};
|
|
22
|
+
var useGetVersion = (options) => {
|
|
23
|
+
const queryOptions = getGetVersionQueryOptions(options);
|
|
24
|
+
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
25
|
+
query.queryKey = queryOptions.queryKey;
|
|
28
26
|
return query;
|
|
29
27
|
};
|
|
30
28
|
|
|
31
29
|
|
|
32
30
|
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
exports.getGetVersionQueryKey = getGetVersionQueryKey; exports.getGetVersionQueryOptions = getGetVersionQueryOptions; exports.getVersion = getVersion; exports.useGetVersion = useGetVersion;
|
|
35
34
|
//# sourceMappingURL=state.cjs.map
|
package/state/state.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,sBAAsB,UAAU;AAErE,IAAM,4BAA4B,CAGvC,YASG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,eAAe,0BAA0B,OAAO;AAEtD,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.15.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: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 = () => [\"account-server-api\", `/version`] as const;\n\nexport const getGetVersionQueryOptions = <\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}): UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\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 return { queryKey, queryFn, ...queryOptions };\n};\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 queryOptions = getGetVersionQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"]}
|
package/state/state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { aE as customInstance, aw as StateGetVersionResponse, aF as ErrorType, aA as AsError } from '../custom-instance-
|
|
2
|
+
import { aE as customInstance, aw as StateGetVersionResponse, aF as ErrorType, aA as AsError } from '../custom-instance-8a11f2d1.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
@@ -7,7 +7,13 @@ type SecondParameter<T extends (...args: any) => any> = T extends (config: any,
|
|
|
7
7
|
* @summary Gets the Account Server version
|
|
8
8
|
*/
|
|
9
9
|
declare const getVersion: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<StateGetVersionResponse>;
|
|
10
|
-
declare const getGetVersionQueryKey: () =>
|
|
10
|
+
declare const getGetVersionQueryKey: () => readonly ["account-server-api", "/version"];
|
|
11
|
+
declare const getGetVersionQueryOptions: <TData = StateGetVersionResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
12
|
+
query?: UseQueryOptions<StateGetVersionResponse, TError, TData, QueryKey> | undefined;
|
|
13
|
+
request?: SecondParameter<typeof customInstance>;
|
|
14
|
+
} | undefined) => UseQueryOptions<StateGetVersionResponse, TError, TData, QueryKey> & {
|
|
15
|
+
queryKey: QueryKey;
|
|
16
|
+
};
|
|
11
17
|
type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
|
|
12
18
|
type GetVersionQueryError = ErrorType<AsError | void>;
|
|
13
19
|
declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
@@ -17,4 +23,4 @@ declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorTyp
|
|
|
17
23
|
queryKey: QueryKey;
|
|
18
24
|
};
|
|
19
25
|
|
|
20
|
-
export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
|
|
26
|
+
export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getGetVersionQueryOptions, getVersion, useGetVersion };
|
package/state/state.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
queryMutator
|
|
3
|
-
} from "../chunk-YEX2SGER.js";
|
|
4
1
|
import {
|
|
5
2
|
customInstance
|
|
6
3
|
} from "../chunk-3RNIDX7T.js";
|
|
@@ -13,22 +10,24 @@ var getVersion = (options, signal) => {
|
|
|
13
10
|
options
|
|
14
11
|
);
|
|
15
12
|
};
|
|
16
|
-
var getGetVersionQueryKey = () => [`/version`];
|
|
17
|
-
var
|
|
13
|
+
var getGetVersionQueryKey = () => ["account-server-api", `/version`];
|
|
14
|
+
var getGetVersionQueryOptions = (options) => {
|
|
18
15
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
19
16
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetVersionQueryKey();
|
|
20
17
|
const queryFn = ({
|
|
21
18
|
signal
|
|
22
19
|
}) => getVersion(requestOptions, signal);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
query
|
|
20
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
21
|
+
};
|
|
22
|
+
var useGetVersion = (options) => {
|
|
23
|
+
const queryOptions = getGetVersionQueryOptions(options);
|
|
24
|
+
const query = useQuery(queryOptions);
|
|
25
|
+
query.queryKey = queryOptions.queryKey;
|
|
28
26
|
return query;
|
|
29
27
|
};
|
|
30
28
|
export {
|
|
31
29
|
getGetVersionQueryKey,
|
|
30
|
+
getGetVersionQueryOptions,
|
|
32
31
|
getVersion,
|
|
33
32
|
useGetVersion
|
|
34
33
|
};
|
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.15.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: 2.0\n */\nimport { useQuery } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 = () => [\"account-server-api\", `/version`] as const;\n\nexport const getGetVersionQueryOptions = <\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}): UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\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 return { queryKey, queryFn, ...queryOptions };\n};\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 queryOptions = getGetVersionQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,sBAAsB,UAAU;AAErE,IAAM,4BAA4B,CAGvC,YASG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,eAAe,0BAA0B,OAAO;AAEtD,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
|