@squonk/account-server-client 1.0.2-rc.3 → 1.0.3-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/asset/asset.cjs +34 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +16 -16
- package/asset/asset.js +35 -19
- package/asset/asset.js.map +1 -1
- package/{custom-instance-b8075093.d.ts → custom-instance-93fb01eb.d.ts} +22 -20
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +15 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +1 -1
- package/merchant/merchant.js +16 -14
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +18 -6
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +7 -7
- package/organisation/organisation.js +19 -7
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +47 -38
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +10 -10
- package/product/product.js +48 -39
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +73 -87
- package/src/asset/asset.ts +248 -345
- package/src/merchant/merchant.ts +62 -84
- package/src/organisation/organisation.ts +131 -184
- package/src/product/product.ts +279 -422
- package/src/state/state.ts +36 -42
- package/src/unit/unit.ts +218 -301
- package/src/user/user.ts +224 -327
- package/state/state.cjs +9 -9
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +1 -1
- package/state/state.js +10 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +40 -25
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +10 -10
- package/unit/unit.js +41 -26
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +38 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +10 -10
- package/user/user.js +39 -21
- package/user/user.js.map +1 -1
package/src/state/state.ts
CHANGED
|
@@ -8,24 +8,27 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery
|
|
13
|
+
} from 'react-query'
|
|
12
14
|
import type {
|
|
13
15
|
UseQueryOptions,
|
|
14
16
|
QueryFunction,
|
|
15
17
|
UseQueryResult,
|
|
16
|
-
QueryKey
|
|
17
|
-
} from
|
|
18
|
+
QueryKey
|
|
19
|
+
} from 'react-query'
|
|
18
20
|
import type {
|
|
19
21
|
StateGetVersionResponse,
|
|
20
|
-
AsError
|
|
21
|
-
} from
|
|
22
|
-
import { customInstance } from
|
|
23
|
-
import type { ErrorType } from
|
|
22
|
+
AsError
|
|
23
|
+
} from '../account-server-api.schemas'
|
|
24
|
+
import { customInstance } from '.././custom-instance'
|
|
25
|
+
import type { ErrorType } from '.././custom-instance'
|
|
26
|
+
|
|
24
27
|
|
|
25
28
|
// eslint-disable-next-line
|
|
26
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
29
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
27
30
|
config: any,
|
|
28
|
-
args: infer P
|
|
31
|
+
args: infer P,
|
|
29
32
|
) => any
|
|
30
33
|
? P
|
|
31
34
|
: never;
|
|
@@ -34,48 +37,39 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
34
37
|
* @summary Gets the Account Server version
|
|
35
38
|
*/
|
|
36
39
|
export const getVersion = (
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
|
|
41
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
39
42
|
) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
43
|
+
return customInstance<StateGetVersionResponse>(
|
|
44
|
+
{url: `/version`, method: 'get', signal
|
|
45
|
+
},
|
|
46
|
+
options);
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
|
|
46
50
|
export const getGetVersionQueryKey = () => [`/version`];
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
TError
|
|
56
|
-
|
|
57
|
-
query
|
|
58
|
-
Awaited<ReturnType<typeof getVersion>>,
|
|
59
|
-
TError,
|
|
60
|
-
TData
|
|
61
|
-
>;
|
|
62
|
-
request?: SecondParameter<typeof customInstance>;
|
|
63
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
64
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
52
|
+
|
|
53
|
+
export type GetVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>
|
|
54
|
+
export type GetVersionQueryError = ErrorType<AsError | void>
|
|
55
|
+
|
|
56
|
+
export const useGetVersion = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>(
|
|
57
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
58
|
+
|
|
59
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
60
|
+
|
|
61
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
65
62
|
|
|
66
63
|
const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}) => getVersion(requestOptions, signal);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) => getVersion(requestOptions, signal);
|
|
71
68
|
|
|
72
|
-
const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(
|
|
73
|
-
queryKey,
|
|
74
|
-
queryFn,
|
|
75
|
-
queryOptions
|
|
76
|
-
) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
69
|
+
const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
77
70
|
|
|
78
71
|
query.queryKey = queryKey;
|
|
79
72
|
|
|
80
73
|
return query;
|
|
81
|
-
}
|
|
74
|
+
}
|
|
75
|
+
|