@squonk/account-server-client 2.0.6 → 2.0.8
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/admin/admin.cjs +14 -7
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +33 -0
- package/admin/admin.d.ts +4 -1
- package/admin/admin.js +14 -7
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +44 -19
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +241 -0
- package/asset/asset.d.ts +43 -19
- package/asset/asset.js +37 -12
- package/asset/asset.js.map +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
- package/chunk-J22A7LHX.cjs.map +1 -0
- package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
- package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
- package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +23 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +57 -0
- package/merchant/merchant.d.ts +7 -1
- package/merchant/merchant.js +22 -12
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +50 -25
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +203 -0
- package/organisation/organisation.d.ts +31 -10
- package/organisation/organisation.js +44 -19
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +80 -44
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +280 -0
- package/product/product.d.ts +40 -10
- package/product/product.js +71 -35
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +268 -276
- package/src/admin/admin.ts +72 -78
- package/src/asset/asset.ts +447 -556
- package/src/merchant/merchant.ts +125 -136
- package/src/organisation/organisation.ts +394 -484
- package/src/product/product.ts +557 -682
- package/src/state/state.ts +70 -69
- package/src/unit/unit.ts +494 -593
- package/src/user/user.ts +377 -463
- package/state/state.cjs +13 -7
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +29 -0
- package/state/state.d.ts +4 -1
- package/state/state.js +13 -7
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +59 -28
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +254 -0
- package/unit/unit.d.ts +43 -16
- package/unit/unit.js +52 -21
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +52 -21
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +220 -0
- package/user/user.d.ts +31 -10
- package/user/user.js +46 -15
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/merchant/merchant.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.20.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,29 +8,33 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 2.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery
|
|
13
|
+
} from '@tanstack/react-query'
|
|
12
14
|
import type {
|
|
13
|
-
UseQueryOptions,
|
|
14
15
|
QueryFunction,
|
|
15
|
-
UseQueryResult,
|
|
16
16
|
QueryKey,
|
|
17
|
-
|
|
17
|
+
UseQueryOptions,
|
|
18
|
+
UseQueryResult
|
|
19
|
+
} from '@tanstack/react-query'
|
|
18
20
|
import type {
|
|
19
|
-
MerchantsGetResponse,
|
|
20
21
|
AsError,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import
|
|
22
|
+
MerchantDetail,
|
|
23
|
+
MerchantsGetResponse
|
|
24
|
+
} from '../account-server-api.schemas'
|
|
25
|
+
import { customInstance } from '.././custom-instance';
|
|
26
|
+
import type { ErrorType } from '.././custom-instance';
|
|
27
|
+
|
|
25
28
|
|
|
26
29
|
// eslint-disable-next-line
|
|
27
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
30
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
28
31
|
config: any,
|
|
29
|
-
args: infer P
|
|
32
|
+
args: infer P,
|
|
30
33
|
) => any
|
|
31
34
|
? P
|
|
32
35
|
: never;
|
|
33
36
|
|
|
37
|
+
|
|
34
38
|
/**
|
|
35
39
|
* Gets Merchants known to the Account Server
|
|
36
40
|
|
|
@@ -39,67 +43,63 @@ Merchants are software services (SaaS assets) whose facilities are known to and
|
|
|
39
43
|
* @summary Gets all Merchants
|
|
40
44
|
*/
|
|
41
45
|
export const getMerchants = (
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
|
|
47
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
48
|
+
) => {
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return customInstance<MerchantsGetResponse>(
|
|
52
|
+
{url: `/merchant`, method: 'get', signal
|
|
53
|
+
},
|
|
54
|
+
options);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export const getGetMerchantsQueryKey = () => {
|
|
59
|
+
|
|
60
|
+
return ["account-server-api", `/merchant`] as const;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
44
65
|
) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export type GetMerchantsQueryResult = NonNullable<
|
|
78
|
-
Awaited<ReturnType<typeof getMerchants>>
|
|
79
|
-
>;
|
|
80
|
-
export type GetMerchantsQueryError = ErrorType<AsError | void>;
|
|
81
|
-
|
|
82
|
-
export const useGetMerchants = <
|
|
83
|
-
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
84
|
-
TError = ErrorType<AsError | void>
|
|
85
|
-
>(options?: {
|
|
86
|
-
query?: UseQueryOptions<
|
|
87
|
-
Awaited<ReturnType<typeof getMerchants>>,
|
|
88
|
-
TError,
|
|
89
|
-
TData
|
|
90
|
-
>;
|
|
91
|
-
request?: SecondParameter<typeof customInstance>;
|
|
92
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
93
|
-
const queryOptions = getGetMerchantsQueryOptions(options);
|
|
94
|
-
|
|
95
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
96
|
-
queryKey: QueryKey;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
query.queryKey = queryOptions.queryKey;
|
|
66
|
+
|
|
67
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
68
|
+
|
|
69
|
+
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & { queryKey: QueryKey }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type GetMerchantsQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
|
|
83
|
+
export type GetMerchantsQueryError = ErrorType<AsError | void>
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @summary Gets all Merchants
|
|
87
|
+
*/
|
|
88
|
+
export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
89
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
90
|
+
|
|
91
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
92
|
+
|
|
93
|
+
const queryOptions = getGetMerchantsQueryOptions(options)
|
|
94
|
+
|
|
95
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
96
|
+
|
|
97
|
+
query.queryKey = queryOptions.queryKey ;
|
|
100
98
|
|
|
101
99
|
return query;
|
|
102
|
-
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Gets a known Merchant
|
|
@@ -107,72 +107,61 @@ export const useGetMerchants = <
|
|
|
107
107
|
* @summary Gets a specific Merchant
|
|
108
108
|
*/
|
|
109
109
|
export const getService = (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
mId: number,
|
|
111
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
112
|
+
) => {
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return customInstance<MerchantDetail>(
|
|
116
|
+
{url: `/merchant/${mId}`, method: 'get', signal
|
|
117
|
+
},
|
|
118
|
+
options);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
export const getGetServiceQueryKey = (mId: number,) => {
|
|
123
|
+
|
|
124
|
+
return ["account-server-api", `/merchant/${mId}`] as const;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
113
129
|
) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
mId:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return { queryKey, queryFn, enabled: !!mId, ...queryOptions };
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export type GetServiceQueryResult = NonNullable<
|
|
151
|
-
Awaited<ReturnType<typeof getService>>
|
|
152
|
-
>;
|
|
153
|
-
export type GetServiceQueryError = ErrorType<AsError | void>;
|
|
154
|
-
|
|
155
|
-
export const useGetService = <
|
|
156
|
-
TData = Awaited<ReturnType<typeof getService>>,
|
|
157
|
-
TError = ErrorType<AsError | void>
|
|
158
|
-
>(
|
|
159
|
-
mId: number,
|
|
160
|
-
options?: {
|
|
161
|
-
query?: UseQueryOptions<
|
|
162
|
-
Awaited<ReturnType<typeof getService>>,
|
|
163
|
-
TError,
|
|
164
|
-
TData
|
|
165
|
-
>;
|
|
166
|
-
request?: SecondParameter<typeof customInstance>;
|
|
167
|
-
}
|
|
168
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
169
|
-
const queryOptions = getGetServiceQueryOptions(mId, options);
|
|
170
|
-
|
|
171
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
172
|
-
queryKey: QueryKey;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
query.queryKey = queryOptions.queryKey;
|
|
130
|
+
|
|
131
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
132
|
+
|
|
133
|
+
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
return { queryKey, queryFn, enabled: !!(mId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & { queryKey: QueryKey }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
|
|
147
|
+
export type GetServiceQueryError = ErrorType<AsError | void>
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @summary Gets a specific Merchant
|
|
151
|
+
*/
|
|
152
|
+
export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
153
|
+
mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
154
|
+
|
|
155
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
156
|
+
|
|
157
|
+
const queryOptions = getGetServiceQueryOptions(mId,options)
|
|
158
|
+
|
|
159
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
160
|
+
|
|
161
|
+
query.queryKey = queryOptions.queryKey ;
|
|
176
162
|
|
|
177
163
|
return query;
|
|
178
|
-
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|