@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.
- package/{chunk-GWBPVOL2.js → chunk-6EEIAH4R.js} +23 -2
- package/chunk-6EEIAH4R.js.map +1 -0
- package/chunk-NGBTCJWS.cjs +46 -0
- package/chunk-NGBTCJWS.cjs.map +1 -0
- package/{account-server-api.schemas-e6c5f956.d.ts → custom-instance-13412a15.d.ts} +19 -1
- package/index.cjs +5 -21
- package/index.cjs.map +1 -1
- package/index.d.ts +2 -20
- package/index.js +5 -21
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +35 -30
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +33 -32
- package/organisation/organisation.js +42 -37
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +65 -53
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +55 -54
- package/product/product.js +76 -64
- package/product/product.js.map +1 -1
- package/service/service.cjs +21 -23
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +18 -17
- package/service/service.js +23 -25
- package/service/service.js.map +1 -1
- package/src/organisation/organisation.ts +93 -69
- package/src/product/product.ts +165 -146
- package/src/service/service.ts +59 -57
- package/src/state/state.ts +34 -28
- package/src/unit/unit.ts +145 -130
- package/src/user/user.ts +148 -120
- package/state/state.cjs +12 -12
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +11 -10
- package/state/state.js +13 -13
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +55 -50
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +54 -53
- package/unit/unit.js +66 -61
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +50 -50
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +53 -52
- package/user/user.js +61 -61
- package/user/user.js.map +1 -1
- package/chunk-GWBPVOL2.js.map +0 -1
- package/chunk-N3RLW53G.cjs +0 -25
- 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
|
|
41
|
-
options?:
|
|
42
|
-
)
|
|
43
|
-
return
|
|
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
|
|
57
|
+
export const getGetUserAccountQueryKey = () => [`/user/account`];
|
|
47
58
|
|
|
48
|
-
export type
|
|
49
|
-
AsyncReturnType<typeof
|
|
59
|
+
export type GetUserAccountQueryResult = NonNullable<
|
|
60
|
+
AsyncReturnType<typeof getUserAccount>
|
|
50
61
|
>;
|
|
51
|
-
export type
|
|
62
|
+
export type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
52
63
|
|
|
53
|
-
export const
|
|
54
|
-
TData = AsyncReturnType<typeof
|
|
55
|
-
TError =
|
|
64
|
+
export const useGetUserAccount = <
|
|
65
|
+
TData = AsyncReturnType<typeof getUserAccount>,
|
|
66
|
+
TError = ErrorType<void | AsError>
|
|
56
67
|
>(options?: {
|
|
57
68
|
query?: UseQueryOptions<
|
|
58
|
-
AsyncReturnType<typeof
|
|
69
|
+
AsyncReturnType<typeof getUserAccount>,
|
|
59
70
|
TError,
|
|
60
71
|
TData
|
|
61
72
|
>;
|
|
62
|
-
|
|
73
|
+
request?: SecondParameter<typeof customInstance>;
|
|
63
74
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
64
|
-
const { query: queryOptions,
|
|
75
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
65
76
|
|
|
66
|
-
const queryKey = queryOptions?.queryKey ??
|
|
77
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
|
|
67
78
|
|
|
68
|
-
const queryFn: QueryFunction<
|
|
69
|
-
|
|
70
|
-
> = () => appApiUserGetAccount(axiosOptions);
|
|
79
|
+
const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>
|
|
80
|
+
getUserAccount(requestOptions);
|
|
71
81
|
|
|
72
|
-
const query = useQuery<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
|
99
|
+
export const getOrganisationUsers = (
|
|
90
100
|
orgId: string,
|
|
91
|
-
options?:
|
|
92
|
-
)
|
|
93
|
-
return
|
|
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
|
|
109
|
+
export const getGetOrganisationUsersQueryKey = (orgId: string) => [
|
|
97
110
|
`/organisation/${orgId}/user`,
|
|
98
111
|
];
|
|
99
112
|
|
|
100
|
-
export type
|
|
101
|
-
AsyncReturnType<typeof
|
|
113
|
+
export type GetOrganisationUsersQueryResult = NonNullable<
|
|
114
|
+
AsyncReturnType<typeof getOrganisationUsers>
|
|
102
115
|
>;
|
|
103
|
-
export type
|
|
116
|
+
export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
104
117
|
|
|
105
|
-
export const
|
|
106
|
-
TData = AsyncReturnType<typeof
|
|
107
|
-
TError =
|
|
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
|
|
125
|
+
AsyncReturnType<typeof getOrganisationUsers>,
|
|
113
126
|
TError,
|
|
114
127
|
TData
|
|
115
128
|
>;
|
|
116
|
-
|
|
129
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
130
|
}
|
|
118
131
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
119
|
-
const { query: queryOptions,
|
|
132
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
120
133
|
|
|
121
134
|
const queryKey =
|
|
122
|
-
queryOptions?.queryKey ??
|
|
135
|
+
queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
|
|
123
136
|
|
|
124
137
|
const queryFn: QueryFunction<
|
|
125
|
-
AsyncReturnType<typeof
|
|
126
|
-
> = () =>
|
|
138
|
+
AsyncReturnType<typeof getOrganisationUsers>
|
|
139
|
+
> = () => getOrganisationUsers(orgId, requestOptions);
|
|
127
140
|
|
|
128
141
|
const query = useQuery<
|
|
129
|
-
AsyncReturnType<typeof
|
|
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
|
|
158
|
+
export const addOrganisationUser = (
|
|
146
159
|
orgId: string,
|
|
147
160
|
userId: string,
|
|
148
|
-
options?:
|
|
149
|
-
)
|
|
150
|
-
return
|
|
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
|
|
154
|
-
AsyncReturnType<typeof
|
|
169
|
+
export type AddOrganisationUserMutationResult = NonNullable<
|
|
170
|
+
AsyncReturnType<typeof addOrganisationUser>
|
|
155
171
|
>;
|
|
156
172
|
|
|
157
|
-
export type
|
|
173
|
+
export type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
158
174
|
|
|
159
|
-
export const
|
|
160
|
-
TError =
|
|
175
|
+
export const useAddOrganisationUser = <
|
|
176
|
+
TError = ErrorType<AsError>,
|
|
161
177
|
TContext = unknown
|
|
162
178
|
>(options?: {
|
|
163
179
|
mutation?: UseMutationOptions<
|
|
164
|
-
AsyncReturnType<typeof
|
|
180
|
+
AsyncReturnType<typeof addOrganisationUser>,
|
|
165
181
|
TError,
|
|
166
182
|
{ orgId: string; userId: string },
|
|
167
183
|
TContext
|
|
168
184
|
>;
|
|
169
|
-
|
|
185
|
+
request?: SecondParameter<typeof customInstance>;
|
|
170
186
|
}) => {
|
|
171
|
-
const { mutation: mutationOptions,
|
|
187
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
172
188
|
|
|
173
189
|
const mutationFn: MutationFunction<
|
|
174
|
-
AsyncReturnType<typeof
|
|
190
|
+
AsyncReturnType<typeof addOrganisationUser>,
|
|
175
191
|
{ orgId: string; userId: string }
|
|
176
192
|
> = (props) => {
|
|
177
193
|
const { orgId, userId } = props || {};
|
|
178
194
|
|
|
179
|
-
return
|
|
195
|
+
return addOrganisationUser(orgId, userId, requestOptions);
|
|
180
196
|
};
|
|
181
197
|
|
|
182
198
|
return useMutation<
|
|
183
|
-
AsyncReturnType<typeof
|
|
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
|
|
210
|
+
export const deleteOrganisationUser = (
|
|
195
211
|
orgId: string,
|
|
196
212
|
userId: string,
|
|
197
|
-
options?:
|
|
198
|
-
)
|
|
199
|
-
return
|
|
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
|
|
203
|
-
AsyncReturnType<typeof
|
|
221
|
+
export type DeleteOrganisationUserMutationResult = NonNullable<
|
|
222
|
+
AsyncReturnType<typeof deleteOrganisationUser>
|
|
204
223
|
>;
|
|
205
224
|
|
|
206
|
-
export type
|
|
225
|
+
export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
207
226
|
|
|
208
|
-
export const
|
|
209
|
-
TError =
|
|
227
|
+
export const useDeleteOrganisationUser = <
|
|
228
|
+
TError = ErrorType<AsError>,
|
|
210
229
|
TContext = unknown
|
|
211
230
|
>(options?: {
|
|
212
231
|
mutation?: UseMutationOptions<
|
|
213
|
-
AsyncReturnType<typeof
|
|
232
|
+
AsyncReturnType<typeof deleteOrganisationUser>,
|
|
214
233
|
TError,
|
|
215
234
|
{ orgId: string; userId: string },
|
|
216
235
|
TContext
|
|
217
236
|
>;
|
|
218
|
-
|
|
237
|
+
request?: SecondParameter<typeof customInstance>;
|
|
219
238
|
}) => {
|
|
220
|
-
const { mutation: mutationOptions,
|
|
239
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
221
240
|
|
|
222
241
|
const mutationFn: MutationFunction<
|
|
223
|
-
AsyncReturnType<typeof
|
|
242
|
+
AsyncReturnType<typeof deleteOrganisationUser>,
|
|
224
243
|
{ orgId: string; userId: string }
|
|
225
244
|
> = (props) => {
|
|
226
245
|
const { orgId, userId } = props || {};
|
|
227
246
|
|
|
228
|
-
return
|
|
247
|
+
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
229
248
|
};
|
|
230
249
|
|
|
231
250
|
return useMutation<
|
|
232
|
-
AsyncReturnType<typeof
|
|
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
|
|
262
|
+
export const getOrganisationUnitUsers = (
|
|
244
263
|
unitId: string,
|
|
245
|
-
options?:
|
|
246
|
-
)
|
|
247
|
-
return
|
|
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
|
|
272
|
+
export const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [
|
|
251
273
|
`/unit/${unitId}/user`,
|
|
252
274
|
];
|
|
253
275
|
|
|
254
|
-
export type
|
|
255
|
-
AsyncReturnType<typeof
|
|
276
|
+
export type GetOrganisationUnitUsersQueryResult = NonNullable<
|
|
277
|
+
AsyncReturnType<typeof getOrganisationUnitUsers>
|
|
256
278
|
>;
|
|
257
|
-
export type
|
|
279
|
+
export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
258
280
|
|
|
259
|
-
export const
|
|
260
|
-
TData = AsyncReturnType<typeof
|
|
261
|
-
TError =
|
|
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
|
|
288
|
+
AsyncReturnType<typeof getOrganisationUnitUsers>,
|
|
267
289
|
TError,
|
|
268
290
|
TData
|
|
269
291
|
>;
|
|
270
|
-
|
|
292
|
+
request?: SecondParameter<typeof customInstance>;
|
|
271
293
|
}
|
|
272
294
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
273
|
-
const { query: queryOptions,
|
|
295
|
+
const { query: queryOptions, request: requestOptions } = options || {};
|
|
274
296
|
|
|
275
297
|
const queryKey =
|
|
276
|
-
queryOptions?.queryKey ??
|
|
298
|
+
queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
277
299
|
|
|
278
300
|
const queryFn: QueryFunction<
|
|
279
|
-
AsyncReturnType<typeof
|
|
280
|
-
> = () =>
|
|
301
|
+
AsyncReturnType<typeof getOrganisationUnitUsers>
|
|
302
|
+
> = () => getOrganisationUnitUsers(unitId, requestOptions);
|
|
281
303
|
|
|
282
304
|
const query = useQuery<
|
|
283
|
-
AsyncReturnType<typeof
|
|
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
|
|
325
|
+
export const addOrganisationUnitUser = (
|
|
304
326
|
unitId: string,
|
|
305
327
|
userId: string,
|
|
306
|
-
options?:
|
|
307
|
-
)
|
|
308
|
-
return
|
|
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
|
|
312
|
-
AsyncReturnType<typeof
|
|
336
|
+
export type AddOrganisationUnitUserMutationResult = NonNullable<
|
|
337
|
+
AsyncReturnType<typeof addOrganisationUnitUser>
|
|
313
338
|
>;
|
|
314
339
|
|
|
315
|
-
export type
|
|
340
|
+
export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
316
341
|
|
|
317
|
-
export const
|
|
318
|
-
TError =
|
|
342
|
+
export const useAddOrganisationUnitUser = <
|
|
343
|
+
TError = ErrorType<AsError>,
|
|
319
344
|
TContext = unknown
|
|
320
345
|
>(options?: {
|
|
321
346
|
mutation?: UseMutationOptions<
|
|
322
|
-
AsyncReturnType<typeof
|
|
347
|
+
AsyncReturnType<typeof addOrganisationUnitUser>,
|
|
323
348
|
TError,
|
|
324
349
|
{ unitId: string; userId: string },
|
|
325
350
|
TContext
|
|
326
351
|
>;
|
|
327
|
-
|
|
352
|
+
request?: SecondParameter<typeof customInstance>;
|
|
328
353
|
}) => {
|
|
329
|
-
const { mutation: mutationOptions,
|
|
354
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
330
355
|
|
|
331
356
|
const mutationFn: MutationFunction<
|
|
332
|
-
AsyncReturnType<typeof
|
|
357
|
+
AsyncReturnType<typeof addOrganisationUnitUser>,
|
|
333
358
|
{ unitId: string; userId: string }
|
|
334
359
|
> = (props) => {
|
|
335
360
|
const { unitId, userId } = props || {};
|
|
336
361
|
|
|
337
|
-
return
|
|
362
|
+
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
338
363
|
};
|
|
339
364
|
|
|
340
365
|
return useMutation<
|
|
341
|
-
AsyncReturnType<typeof
|
|
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
|
|
381
|
+
export const deleteOrganisationUnitUser = (
|
|
357
382
|
unitId: string,
|
|
358
383
|
userId: string,
|
|
359
|
-
options?:
|
|
360
|
-
)
|
|
361
|
-
return
|
|
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
|
|
365
|
-
AsyncReturnType<typeof
|
|
392
|
+
export type DeleteOrganisationUnitUserMutationResult = NonNullable<
|
|
393
|
+
AsyncReturnType<typeof deleteOrganisationUnitUser>
|
|
366
394
|
>;
|
|
367
395
|
|
|
368
|
-
export type
|
|
396
|
+
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
369
397
|
|
|
370
|
-
export const
|
|
371
|
-
TError =
|
|
398
|
+
export const useDeleteOrganisationUnitUser = <
|
|
399
|
+
TError = ErrorType<AsError>,
|
|
372
400
|
TContext = unknown
|
|
373
401
|
>(options?: {
|
|
374
402
|
mutation?: UseMutationOptions<
|
|
375
|
-
AsyncReturnType<typeof
|
|
403
|
+
AsyncReturnType<typeof deleteOrganisationUnitUser>,
|
|
376
404
|
TError,
|
|
377
405
|
{ unitId: string; userId: string },
|
|
378
406
|
TContext
|
|
379
407
|
>;
|
|
380
|
-
|
|
408
|
+
request?: SecondParameter<typeof customInstance>;
|
|
381
409
|
}) => {
|
|
382
|
-
const { mutation: mutationOptions,
|
|
410
|
+
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
383
411
|
|
|
384
412
|
const mutationFn: MutationFunction<
|
|
385
|
-
AsyncReturnType<typeof
|
|
413
|
+
AsyncReturnType<typeof deleteOrganisationUnitUser>,
|
|
386
414
|
{ unitId: string; userId: string }
|
|
387
415
|
> = (props) => {
|
|
388
416
|
const { unitId, userId } = props || {};
|
|
389
417
|
|
|
390
|
-
return
|
|
418
|
+
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
391
419
|
};
|
|
392
420
|
|
|
393
421
|
return useMutation<
|
|
394
|
-
AsyncReturnType<typeof
|
|
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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
11
|
-
return
|
|
10
|
+
var getVersion = (options) => {
|
|
11
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/version`, method: "get" }, options);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
const { query: queryOptions,
|
|
16
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => (
|
|
17
|
-
const queryFn = () =>
|
|
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
|
|
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.
|
|
27
|
+
exports.getGetVersionQueryKey = getGetVersionQueryKey; exports.getVersion = getVersion; exports.useGetVersion = useGetVersion;
|
|
28
28
|
//# 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;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 '../
|
|
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
|
|
21
|
-
declare const
|
|
22
|
-
declare type
|
|
23
|
-
declare type
|
|
24
|
-
declare const
|
|
25
|
-
query?: UseQueryOptions<
|
|
26
|
-
|
|
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 {
|
|
32
|
+
export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
|
package/state/state.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
|
|
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
|
|
11
|
-
return
|
|
10
|
+
var getVersion = (options) => {
|
|
11
|
+
return customInstance({ url: `/version`, method: "get" }, options);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
const { query: queryOptions,
|
|
16
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
17
|
-
const queryFn = () =>
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
getGetVersionQueryKey,
|
|
25
|
+
getVersion,
|
|
26
|
+
useGetVersion
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=state.js.map
|
package/state/state.js.map
CHANGED
|
@@ -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
|
|
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":[]}
|