@squonk/account-server-client 4.2.1 → 4.3.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/asset/asset.cjs +99 -126
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +99 -99
- package/asset/asset.d.ts +99 -99
- package/asset/asset.js +107 -134
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs +73 -85
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.d.cts +47 -47
- package/charges/charges.d.ts +47 -47
- package/charges/charges.js +78 -90
- package/charges/charges.js.map +1 -1
- package/chunk-3WKSNKHE.js +25 -0
- package/chunk-3WKSNKHE.js.map +1 -0
- package/chunk-NY2VJJG7.cjs +25 -0
- package/chunk-NY2VJJG7.cjs.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/event-stream/event-stream.cjs +53 -61
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +45 -45
- package/event-stream/event-stream.d.ts +45 -45
- package/event-stream/event-stream.js +58 -66
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +49 -57
- package/index.cjs.map +1 -1
- package/index.d.cts +796 -773
- package/index.d.ts +796 -773
- package/index.js +48 -56
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +38 -45
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +25 -25
- package/merchant/merchant.d.ts +25 -25
- package/merchant/merchant.js +42 -49
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +77 -87
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +72 -70
- package/organisation/organisation.d.ts +72 -70
- package/organisation/organisation.js +83 -93
- package/organisation/organisation.js.map +1 -1
- package/package.json +13 -16
- package/product/product.cjs +143 -153
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +100 -100
- package/product/product.d.ts +100 -100
- package/product/product.js +153 -163
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +863 -856
- package/src/asset/asset.ts +899 -634
- package/src/charges/charges.ts +822 -498
- package/src/custom-instance.ts +3 -3
- package/src/event-stream/event-stream.ts +531 -345
- package/src/index.ts +2 -2
- package/src/merchant/merchant.ts +355 -234
- package/src/options-mutator.ts +27 -0
- package/src/organisation/organisation.ts +812 -504
- package/src/product/product.ts +1373 -841
- package/src/state/state.ts +174 -127
- package/src/unit/unit.ts +1273 -603
- package/src/user/user.ts +895 -564
- package/state/state.cjs +22 -24
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +14 -14
- package/state/state.d.ts +14 -14
- package/state/state.js +24 -26
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +171 -106
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +200 -90
- package/unit/unit.d.ts +200 -90
- package/unit/unit.js +179 -114
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +94 -110
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +77 -77
- package/user/user.d.ts +77 -77
- package/user/user.js +101 -117
- package/user/user.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
package/src/state/state.ts
CHANGED
|
@@ -1,179 +1,226 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.10.0 🍺
|
|
4
3
|
* Do not edit manually.
|
|
5
4
|
* Account Server API
|
|
6
5
|
* The Informatics Matters Account Server API.
|
|
7
6
|
|
|
8
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
8
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.3
|
|
11
10
|
*/
|
|
12
|
-
import {
|
|
13
|
-
useQuery,
|
|
14
|
-
useSuspenseQuery
|
|
15
|
-
} from '@tanstack/react-query'
|
|
11
|
+
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
16
12
|
import type {
|
|
17
13
|
DataTag,
|
|
18
14
|
DefinedInitialDataOptions,
|
|
19
15
|
DefinedUseQueryResult,
|
|
16
|
+
QueryClient,
|
|
20
17
|
QueryFunction,
|
|
21
18
|
QueryKey,
|
|
22
19
|
UndefinedInitialDataOptions,
|
|
23
20
|
UseQueryOptions,
|
|
24
21
|
UseQueryResult,
|
|
25
22
|
UseSuspenseQueryOptions,
|
|
26
|
-
UseSuspenseQueryResult
|
|
27
|
-
} from
|
|
28
|
-
import type {
|
|
29
|
-
AsError,
|
|
30
|
-
StateGetVersionResponse
|
|
31
|
-
} from '../account-server-api.schemas'
|
|
32
|
-
import { customInstance } from '.././custom-instance';
|
|
33
|
-
import type { ErrorType } from '.././custom-instance';
|
|
23
|
+
UseSuspenseQueryResult,
|
|
24
|
+
} from "@tanstack/react-query";
|
|
34
25
|
|
|
26
|
+
import type { AsError, StateGetVersionResponse } from "../account-server-api.schemas";
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
import { customInstance } from ".././custom-instance";
|
|
29
|
+
import type { ErrorType } from ".././custom-instance";
|
|
30
|
+
import { queryMutator } from ".././options-mutator";
|
|
37
31
|
|
|
32
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
38
33
|
|
|
39
34
|
/**
|
|
40
35
|
* @summary Gets the Account Server version
|
|
41
36
|
*/
|
|
42
37
|
export const getVersion = (
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
options?: SecondParameter<typeof customInstance>,
|
|
39
|
+
signal?: AbortSignal,
|
|
45
40
|
) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
options);
|
|
52
|
-
}
|
|
53
|
-
|
|
41
|
+
return customInstance<StateGetVersionResponse>(
|
|
42
|
+
{ url: `/version`, method: "GET", signal },
|
|
43
|
+
options,
|
|
44
|
+
);
|
|
45
|
+
};
|
|
54
46
|
|
|
55
47
|
export const getGetVersionQueryKey = () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
48
|
+
return [`/version`] as const;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const useGetVersionQueryOptions = <
|
|
52
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
53
|
+
TError = ErrorType<AsError | void>,
|
|
54
|
+
>(options?: {
|
|
55
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
56
|
+
request?: SecondParameter<typeof customInstance>;
|
|
57
|
+
}) => {
|
|
58
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
59
|
+
|
|
60
|
+
const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
|
|
61
|
+
|
|
62
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) =>
|
|
63
|
+
getVersion(requestOptions, signal);
|
|
64
|
+
|
|
65
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
66
|
+
|
|
67
|
+
return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData> & {
|
|
68
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
|
|
73
|
+
export type GetVersionQueryError = ErrorType<AsError | void>;
|
|
74
|
+
|
|
75
|
+
export function useGetVersion<
|
|
76
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
77
|
+
TError = ErrorType<AsError | void>,
|
|
78
|
+
>(
|
|
79
|
+
options: {
|
|
80
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>> &
|
|
81
|
+
Pick<
|
|
84
82
|
DefinedInitialDataOptions<
|
|
85
83
|
Awaited<ReturnType<typeof getVersion>>,
|
|
86
84
|
TError,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
Awaited<ReturnType<typeof getVersion>>
|
|
86
|
+
>,
|
|
87
|
+
"initialData"
|
|
88
|
+
>;
|
|
89
|
+
request?: SecondParameter<typeof customInstance>;
|
|
90
|
+
},
|
|
91
|
+
queryClient?: QueryClient,
|
|
92
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
93
|
+
export function useGetVersion<
|
|
94
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
95
|
+
TError = ErrorType<AsError | void>,
|
|
96
|
+
>(
|
|
97
|
+
options?: {
|
|
98
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>> &
|
|
99
|
+
Pick<
|
|
94
100
|
UndefinedInitialDataOptions<
|
|
95
101
|
Awaited<ReturnType<typeof getVersion>>,
|
|
96
102
|
TError,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
Awaited<ReturnType<typeof getVersion>>
|
|
104
|
+
>,
|
|
105
|
+
"initialData"
|
|
106
|
+
>;
|
|
107
|
+
request?: SecondParameter<typeof customInstance>;
|
|
108
|
+
},
|
|
109
|
+
queryClient?: QueryClient,
|
|
110
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
111
|
+
export function useGetVersion<
|
|
112
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
113
|
+
TError = ErrorType<AsError | void>,
|
|
114
|
+
>(
|
|
115
|
+
options?: {
|
|
116
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
117
|
+
request?: SecondParameter<typeof customInstance>;
|
|
118
|
+
},
|
|
119
|
+
queryClient?: QueryClient,
|
|
120
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
106
121
|
/**
|
|
107
122
|
* @summary Gets the Account Server version
|
|
108
123
|
*/
|
|
109
124
|
|
|
110
|
-
export function useGetVersion<
|
|
111
|
-
|
|
125
|
+
export function useGetVersion<
|
|
126
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
127
|
+
TError = ErrorType<AsError | void>,
|
|
128
|
+
>(
|
|
129
|
+
options?: {
|
|
130
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
131
|
+
request?: SecondParameter<typeof customInstance>;
|
|
132
|
+
},
|
|
133
|
+
queryClient?: QueryClient,
|
|
134
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
135
|
+
const queryOptions = useGetVersionQueryOptions(options);
|
|
112
136
|
|
|
113
|
-
|
|
137
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
138
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
139
|
+
};
|
|
114
140
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
118
|
-
|
|
119
|
-
query.queryKey = queryOptions.queryKey ;
|
|
141
|
+
query.queryKey = queryOptions.queryKey;
|
|
120
142
|
|
|
121
143
|
return query;
|
|
122
144
|
}
|
|
123
145
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
export const useGetVersionSuspenseQueryOptions = <
|
|
147
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
148
|
+
TError = ErrorType<AsError | void>,
|
|
149
|
+
>(options?: {
|
|
150
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
151
|
+
request?: SecondParameter<typeof customInstance>;
|
|
152
|
+
}) => {
|
|
153
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
154
|
+
|
|
155
|
+
const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
|
|
156
|
+
|
|
157
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) =>
|
|
158
|
+
getVersion(requestOptions, signal);
|
|
159
|
+
|
|
160
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
161
|
+
|
|
162
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
163
|
+
Awaited<ReturnType<typeof getVersion>>,
|
|
164
|
+
TError,
|
|
165
|
+
TData
|
|
166
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type GetVersionSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>;
|
|
170
|
+
export type GetVersionSuspenseQueryError = ErrorType<AsError | void>;
|
|
171
|
+
|
|
172
|
+
export function useGetVersionSuspense<
|
|
173
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
174
|
+
TError = ErrorType<AsError | void>,
|
|
175
|
+
>(
|
|
176
|
+
options: {
|
|
177
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
178
|
+
request?: SecondParameter<typeof customInstance>;
|
|
179
|
+
},
|
|
180
|
+
queryClient?: QueryClient,
|
|
181
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
182
|
+
export function useGetVersionSuspense<
|
|
183
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
184
|
+
TError = ErrorType<AsError | void>,
|
|
185
|
+
>(
|
|
186
|
+
options?: {
|
|
187
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
188
|
+
request?: SecondParameter<typeof customInstance>;
|
|
189
|
+
},
|
|
190
|
+
queryClient?: QueryClient,
|
|
191
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
192
|
+
export function useGetVersionSuspense<
|
|
193
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
194
|
+
TError = ErrorType<AsError | void>,
|
|
195
|
+
>(
|
|
196
|
+
options?: {
|
|
197
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
198
|
+
request?: SecondParameter<typeof customInstance>;
|
|
199
|
+
},
|
|
200
|
+
queryClient?: QueryClient,
|
|
201
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
160
202
|
/**
|
|
161
203
|
* @summary Gets the Account Server version
|
|
162
204
|
*/
|
|
163
205
|
|
|
164
|
-
export function useGetVersionSuspense<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
206
|
+
export function useGetVersionSuspense<
|
|
207
|
+
TData = Awaited<ReturnType<typeof getVersion>>,
|
|
208
|
+
TError = ErrorType<AsError | void>,
|
|
209
|
+
>(
|
|
210
|
+
options?: {
|
|
211
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>;
|
|
212
|
+
request?: SecondParameter<typeof customInstance>;
|
|
213
|
+
},
|
|
214
|
+
queryClient?: QueryClient,
|
|
215
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
216
|
+
const queryOptions = useGetVersionSuspenseQueryOptions(options);
|
|
217
|
+
|
|
218
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
219
|
+
TData,
|
|
220
|
+
TError
|
|
221
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
222
|
+
|
|
223
|
+
query.queryKey = queryOptions.queryKey;
|
|
174
224
|
|
|
175
225
|
return query;
|
|
176
226
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|