@squonk/account-server-client 0.1.31 → 0.1.32-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 (59) hide show
  1. package/asset/asset.cjs +130 -0
  2. package/asset/asset.cjs.map +1 -0
  3. package/asset/asset.d.ts +126 -0
  4. package/asset/asset.js +130 -0
  5. package/asset/asset.js.map +1 -0
  6. package/asset/package.json +7 -0
  7. package/{custom-instance-13412a15.d.ts → custom-instance-6b9df5d3.d.ts} +124 -34
  8. package/index.cjs +20 -2
  9. package/index.cjs.map +1 -1
  10. package/index.d.ts +1 -1
  11. package/index.js +20 -2
  12. package/index.js.map +1 -1
  13. package/merchant/merchant.cjs +48 -0
  14. package/merchant/merchant.cjs.map +1 -0
  15. package/merchant/merchant.d.ts +39 -0
  16. package/merchant/merchant.js +48 -0
  17. package/merchant/merchant.js.map +1 -0
  18. package/merchant/package.json +7 -0
  19. package/organisation/organisation.cjs +12 -12
  20. package/organisation/organisation.cjs.map +1 -1
  21. package/organisation/organisation.d.ts +10 -9
  22. package/organisation/organisation.js +12 -12
  23. package/organisation/organisation.js.map +1 -1
  24. package/package.json +9 -9
  25. package/product/product.cjs +36 -26
  26. package/product/product.cjs.map +1 -1
  27. package/product/product.d.ts +17 -16
  28. package/product/product.js +36 -26
  29. package/product/product.js.map +1 -1
  30. package/src/account-server-api.schemas.ts +152 -46
  31. package/src/asset/asset.ts +430 -0
  32. package/src/merchant/merchant.ts +145 -0
  33. package/src/organisation/organisation.ts +37 -37
  34. package/src/product/product.ts +91 -74
  35. package/src/state/state.ts +19 -16
  36. package/src/unit/unit.ts +64 -56
  37. package/src/user/user.ts +63 -62
  38. package/state/state.cjs +6 -4
  39. package/state/state.cjs.map +1 -1
  40. package/state/state.d.ts +7 -6
  41. package/state/state.js +6 -4
  42. package/state/state.js.map +1 -1
  43. package/unit/unit.cjs +22 -18
  44. package/unit/unit.cjs.map +1 -1
  45. package/unit/unit.d.ts +14 -13
  46. package/unit/unit.js +22 -18
  47. package/unit/unit.js.map +1 -1
  48. package/user/user.cjs +22 -20
  49. package/user/user.cjs.map +1 -1
  50. package/user/user.d.ts +14 -13
  51. package/user/user.js +22 -20
  52. package/user/user.js.map +1 -1
  53. package/service/package.json +0 -7
  54. package/service/service.cjs +0 -44
  55. package/service/service.cjs.map +0 -1
  56. package/service/service.d.ts +0 -49
  57. package/service/service.js +0 -44
  58. package/service/service.js.map +0 -1
  59. package/src/service/service.ts +0 -136
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.7.1 🍺
2
+ * Generated by orval v6.8.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -21,12 +21,9 @@ import type {
21
21
  } from "../account-server-api.schemas";
22
22
  import { customInstance, ErrorType } from ".././custom-instance";
23
23
 
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
26
- ...args: any
27
- ) => Promise<infer R>
28
- ? R
29
- : any;
24
+ export type AwaitedInput<T> = PromiseLike<T> | T;
25
+
26
+ export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
30
27
 
31
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
29
  type SecondParameter<T extends (...args: any) => any> = T extends (
@@ -40,10 +37,11 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
40
37
  * @summary Gets the Account Server version
41
38
  */
42
39
  export const getVersion = (
43
- options?: SecondParameter<typeof customInstance>
40
+ options?: SecondParameter<typeof customInstance>,
41
+ signal?: AbortSignal
44
42
  ) => {
45
43
  return customInstance<StateGetVersionResponse>(
46
- { url: `/version`, method: "get" },
44
+ { url: `/version`, method: "get", signal },
47
45
  options
48
46
  );
49
47
  };
@@ -51,25 +49,30 @@ export const getVersion = (
51
49
  export const getGetVersionQueryKey = () => [`/version`];
52
50
 
53
51
  export type GetVersionQueryResult = NonNullable<
54
- AsyncReturnType<typeof getVersion>
52
+ Awaited<ReturnType<typeof getVersion>>
55
53
  >;
56
54
  export type GetVersionQueryError = ErrorType<AsError | void>;
57
55
 
58
56
  export const useGetVersion = <
59
- TData = AsyncReturnType<typeof getVersion>,
57
+ TData = Awaited<ReturnType<typeof getVersion>>,
60
58
  TError = ErrorType<AsError | void>
61
59
  >(options?: {
62
- query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;
60
+ query?: UseQueryOptions<
61
+ Awaited<ReturnType<typeof getVersion>>,
62
+ TError,
63
+ TData
64
+ >;
63
65
  request?: SecondParameter<typeof customInstance>;
64
66
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
65
- const { query: queryOptions, request: requestOptions } = options || {};
67
+ const { query: queryOptions, request: requestOptions } = options ?? {};
66
68
 
67
69
  const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
68
70
 
69
- const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>
70
- getVersion(requestOptions);
71
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({
72
+ signal,
73
+ }) => getVersion(requestOptions, signal);
71
74
 
72
- const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(
75
+ const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(
73
76
  queryKey,
74
77
  queryFn,
75
78
  queryOptions
package/src/unit/unit.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.7.1 🍺
2
+ * Generated by orval v6.8.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -29,12 +29,9 @@ import type {
29
29
  } from "../account-server-api.schemas";
30
30
  import { customInstance, ErrorType } from ".././custom-instance";
31
31
 
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
34
- ...args: any
35
- ) => Promise<infer R>
36
- ? R
37
- : any;
32
+ export type AwaitedInput<T> = PromiseLike<T> | T;
33
+
34
+ export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
38
35
 
39
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
37
  type SecondParameter<T extends (...args: any) => any> = T extends (
@@ -51,10 +48,11 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
51
48
  */
52
49
  export const getOrganisationUnits = (
53
50
  orgId: string,
54
- options?: SecondParameter<typeof customInstance>
51
+ options?: SecondParameter<typeof customInstance>,
52
+ signal?: AbortSignal
55
53
  ) => {
56
54
  return customInstance<OrganisationUnitsGetResponse>(
57
- { url: `/organisation/${orgId}/unit`, method: "get" },
55
+ { url: `/organisation/${orgId}/unit`, method: "get", signal },
58
56
  options
59
57
  );
60
58
  };
@@ -64,35 +62,35 @@ export const getGetOrganisationUnitsQueryKey = (orgId: string) => [
64
62
  ];
65
63
 
66
64
  export type GetOrganisationUnitsQueryResult = NonNullable<
67
- AsyncReturnType<typeof getOrganisationUnits>
65
+ Awaited<ReturnType<typeof getOrganisationUnits>>
68
66
  >;
69
67
  export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
70
68
 
71
69
  export const useGetOrganisationUnits = <
72
- TData = AsyncReturnType<typeof getOrganisationUnits>,
70
+ TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
73
71
  TError = ErrorType<void | AsError>
74
72
  >(
75
73
  orgId: string,
76
74
  options?: {
77
75
  query?: UseQueryOptions<
78
- AsyncReturnType<typeof getOrganisationUnits>,
76
+ Awaited<ReturnType<typeof getOrganisationUnits>>,
79
77
  TError,
80
78
  TData
81
79
  >;
82
80
  request?: SecondParameter<typeof customInstance>;
83
81
  }
84
82
  ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
85
- const { query: queryOptions, request: requestOptions } = options || {};
83
+ const { query: queryOptions, request: requestOptions } = options ?? {};
86
84
 
87
85
  const queryKey =
88
86
  queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
89
87
 
90
88
  const queryFn: QueryFunction<
91
- AsyncReturnType<typeof getOrganisationUnits>
92
- > = () => getOrganisationUnits(orgId, requestOptions);
89
+ Awaited<ReturnType<typeof getOrganisationUnits>>
90
+ > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
93
91
 
94
92
  const query = useQuery<
95
- AsyncReturnType<typeof getOrganisationUnits>,
93
+ Awaited<ReturnType<typeof getOrganisationUnits>>,
96
94
  TError,
97
95
  TData
98
96
  >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
@@ -125,7 +123,7 @@ export const createOrganisationUnit = (
125
123
  };
126
124
 
127
125
  export type CreateOrganisationUnitMutationResult = NonNullable<
128
- AsyncReturnType<typeof createOrganisationUnit>
126
+ Awaited<ReturnType<typeof createOrganisationUnit>>
129
127
  >;
130
128
  export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
131
129
  export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
@@ -135,26 +133,26 @@ export const useCreateOrganisationUnit = <
135
133
  TContext = unknown
136
134
  >(options?: {
137
135
  mutation?: UseMutationOptions<
138
- AsyncReturnType<typeof createOrganisationUnit>,
136
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
139
137
  TError,
140
138
  { orgId: string; data: OrganisationUnitPostBodyBody },
141
139
  TContext
142
140
  >;
143
141
  request?: SecondParameter<typeof customInstance>;
144
142
  }) => {
145
- const { mutation: mutationOptions, request: requestOptions } = options || {};
143
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
146
144
 
147
145
  const mutationFn: MutationFunction<
148
- AsyncReturnType<typeof createOrganisationUnit>,
146
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
149
147
  { orgId: string; data: OrganisationUnitPostBodyBody }
150
148
  > = (props) => {
151
- const { orgId, data } = props || {};
149
+ const { orgId, data } = props ?? {};
152
150
 
153
151
  return createOrganisationUnit(orgId, data, requestOptions);
154
152
  };
155
153
 
156
154
  return useMutation<
157
- AsyncReturnType<typeof createOrganisationUnit>,
155
+ Awaited<ReturnType<typeof createOrganisationUnit>>,
158
156
  TError,
159
157
  { orgId: string; data: OrganisationUnitPostBodyBody },
160
158
  TContext
@@ -168,10 +166,11 @@ export const useCreateOrganisationUnit = <
168
166
  export const getUnit = (
169
167
  orgId: string,
170
168
  unitId: string,
171
- options?: SecondParameter<typeof customInstance>
169
+ options?: SecondParameter<typeof customInstance>,
170
+ signal?: AbortSignal
172
171
  ) => {
173
172
  return customInstance<UnitGetResponse>(
174
- { url: `/organisation/${orgId}/unit/${unitId}`, method: "get" },
173
+ { url: `/organisation/${orgId}/unit/${unitId}`, method: "get", signal },
175
174
  options
176
175
  );
177
176
  };
@@ -180,28 +179,31 @@ export const getGetUnitQueryKey = (orgId: string, unitId: string) => [
180
179
  `/organisation/${orgId}/unit/${unitId}`,
181
180
  ];
182
181
 
183
- export type GetUnitQueryResult = NonNullable<AsyncReturnType<typeof getUnit>>;
182
+ export type GetUnitQueryResult = NonNullable<
183
+ Awaited<ReturnType<typeof getUnit>>
184
+ >;
184
185
  export type GetUnitQueryError = ErrorType<void | AsError>;
185
186
 
186
187
  export const useGetUnit = <
187
- TData = AsyncReturnType<typeof getUnit>,
188
+ TData = Awaited<ReturnType<typeof getUnit>>,
188
189
  TError = ErrorType<void | AsError>
189
190
  >(
190
191
  orgId: string,
191
192
  unitId: string,
192
193
  options?: {
193
- query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;
194
+ query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;
194
195
  request?: SecondParameter<typeof customInstance>;
195
196
  }
196
197
  ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
197
- const { query: queryOptions, request: requestOptions } = options || {};
198
+ const { query: queryOptions, request: requestOptions } = options ?? {};
198
199
 
199
200
  const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgId, unitId);
200
201
 
201
- const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>
202
- getUnit(orgId, unitId, requestOptions);
202
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({
203
+ signal,
204
+ }) => getUnit(orgId, unitId, requestOptions, signal);
203
205
 
204
- const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(
206
+ const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(
205
207
  queryKey,
206
208
  queryFn,
207
209
  { enabled: !!(orgId && unitId), ...queryOptions }
@@ -230,7 +232,7 @@ export const deleteOrganisationUnit = (
230
232
  };
231
233
 
232
234
  export type DeleteOrganisationUnitMutationResult = NonNullable<
233
- AsyncReturnType<typeof deleteOrganisationUnit>
235
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>
234
236
  >;
235
237
 
236
238
  export type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
@@ -240,26 +242,26 @@ export const useDeleteOrganisationUnit = <
240
242
  TContext = unknown
241
243
  >(options?: {
242
244
  mutation?: UseMutationOptions<
243
- AsyncReturnType<typeof deleteOrganisationUnit>,
245
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
244
246
  TError,
245
247
  { orgId: string; unitId: string },
246
248
  TContext
247
249
  >;
248
250
  request?: SecondParameter<typeof customInstance>;
249
251
  }) => {
250
- const { mutation: mutationOptions, request: requestOptions } = options || {};
252
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
251
253
 
252
254
  const mutationFn: MutationFunction<
253
- AsyncReturnType<typeof deleteOrganisationUnit>,
255
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
254
256
  { orgId: string; unitId: string }
255
257
  > = (props) => {
256
- const { orgId, unitId } = props || {};
258
+ const { orgId, unitId } = props ?? {};
257
259
 
258
260
  return deleteOrganisationUnit(orgId, unitId, requestOptions);
259
261
  };
260
262
 
261
263
  return useMutation<
262
- AsyncReturnType<typeof deleteOrganisationUnit>,
264
+ Awaited<ReturnType<typeof deleteOrganisationUnit>>,
263
265
  TError,
264
266
  { orgId: string; unitId: string },
265
267
  TContext
@@ -270,33 +272,39 @@ export const useDeleteOrganisationUnit = <
270
272
 
271
273
  * @summary Gets Units
272
274
  */
273
- export const getUnits = (options?: SecondParameter<typeof customInstance>) => {
275
+ export const getUnits = (
276
+ options?: SecondParameter<typeof customInstance>,
277
+ signal?: AbortSignal
278
+ ) => {
274
279
  return customInstance<UnitsGetResponse>(
275
- { url: `/unit`, method: "get" },
280
+ { url: `/unit`, method: "get", signal },
276
281
  options
277
282
  );
278
283
  };
279
284
 
280
285
  export const getGetUnitsQueryKey = () => [`/unit`];
281
286
 
282
- export type GetUnitsQueryResult = NonNullable<AsyncReturnType<typeof getUnits>>;
287
+ export type GetUnitsQueryResult = NonNullable<
288
+ Awaited<ReturnType<typeof getUnits>>
289
+ >;
283
290
  export type GetUnitsQueryError = ErrorType<void | AsError>;
284
291
 
285
292
  export const useGetUnits = <
286
- TData = AsyncReturnType<typeof getUnits>,
293
+ TData = Awaited<ReturnType<typeof getUnits>>,
287
294
  TError = ErrorType<void | AsError>
288
295
  >(options?: {
289
- query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;
296
+ query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;
290
297
  request?: SecondParameter<typeof customInstance>;
291
298
  }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
292
- const { query: queryOptions, request: requestOptions } = options || {};
299
+ const { query: queryOptions, request: requestOptions } = options ?? {};
293
300
 
294
301
  const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
295
302
 
296
- const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>
297
- getUnits(requestOptions);
303
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({
304
+ signal,
305
+ }) => getUnits(requestOptions, signal);
298
306
 
299
- const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(
307
+ const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(
300
308
  queryKey,
301
309
  queryFn,
302
310
  queryOptions
@@ -323,7 +331,7 @@ export const createDefaultUnit = (
323
331
  };
324
332
 
325
333
  export type CreateDefaultUnitMutationResult = NonNullable<
326
- AsyncReturnType<typeof createDefaultUnit>
334
+ Awaited<ReturnType<typeof createDefaultUnit>>
327
335
  >;
328
336
 
329
337
  export type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
@@ -334,24 +342,24 @@ export const useCreateDefaultUnit = <
334
342
  TContext = unknown
335
343
  >(options?: {
336
344
  mutation?: UseMutationOptions<
337
- AsyncReturnType<typeof createDefaultUnit>,
345
+ Awaited<ReturnType<typeof createDefaultUnit>>,
338
346
  TError,
339
347
  TVariables,
340
348
  TContext
341
349
  >;
342
350
  request?: SecondParameter<typeof customInstance>;
343
351
  }) => {
344
- const { mutation: mutationOptions, request: requestOptions } = options || {};
352
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
345
353
 
346
354
  const mutationFn: MutationFunction<
347
- AsyncReturnType<typeof createDefaultUnit>,
355
+ Awaited<ReturnType<typeof createDefaultUnit>>,
348
356
  TVariables
349
357
  > = () => {
350
358
  return createDefaultUnit(requestOptions);
351
359
  };
352
360
 
353
361
  return useMutation<
354
- AsyncReturnType<typeof createDefaultUnit>,
362
+ Awaited<ReturnType<typeof createDefaultUnit>>,
355
363
  TError,
356
364
  TVariables,
357
365
  TContext
@@ -369,7 +377,7 @@ export const deleteDefaultUnit = (
369
377
  };
370
378
 
371
379
  export type DeleteDefaultUnitMutationResult = NonNullable<
372
- AsyncReturnType<typeof deleteDefaultUnit>
380
+ Awaited<ReturnType<typeof deleteDefaultUnit>>
373
381
  >;
374
382
 
375
383
  export type DeleteDefaultUnitMutationError = ErrorType<AsError>;
@@ -380,24 +388,24 @@ export const useDeleteDefaultUnit = <
380
388
  TContext = unknown
381
389
  >(options?: {
382
390
  mutation?: UseMutationOptions<
383
- AsyncReturnType<typeof deleteDefaultUnit>,
391
+ Awaited<ReturnType<typeof deleteDefaultUnit>>,
384
392
  TError,
385
393
  TVariables,
386
394
  TContext
387
395
  >;
388
396
  request?: SecondParameter<typeof customInstance>;
389
397
  }) => {
390
- const { mutation: mutationOptions, request: requestOptions } = options || {};
398
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
391
399
 
392
400
  const mutationFn: MutationFunction<
393
- AsyncReturnType<typeof deleteDefaultUnit>,
401
+ Awaited<ReturnType<typeof deleteDefaultUnit>>,
394
402
  TVariables
395
403
  > = () => {
396
404
  return deleteDefaultUnit(requestOptions);
397
405
  };
398
406
 
399
407
  return useMutation<
400
- AsyncReturnType<typeof deleteDefaultUnit>,
408
+ Awaited<ReturnType<typeof deleteDefaultUnit>>,
401
409
  TError,
402
410
  TVariables,
403
411
  TContext