@squonk/account-server-client 0.1.26 → 0.1.27-rc.1

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