@squonk/account-server-client 2.0.9 → 2.1.0-beta.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/README.md +1 -1
- package/admin/admin.cjs +19 -4
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +23 -6
- package/admin/admin.d.ts +23 -6
- package/admin/admin.js +19 -4
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +33 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +37 -18
- package/asset/asset.d.ts +37 -18
- package/asset/asset.js +25 -10
- package/asset/asset.js.map +1 -1
- package/{chunk-UKA7G3OB.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-UKA7G3OB.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-J22A7LHX.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/event-stream/event-stream.cjs +146 -0
- package/event-stream/event-stream.cjs.map +1 -0
- package/event-stream/event-stream.d.cts +142 -0
- package/event-stream/event-stream.d.ts +142 -0
- package/event-stream/event-stream.js +146 -0
- package/event-stream/event-stream.js.map +1 -0
- package/event-stream/package.json +7 -0
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +700 -2
- package/index.d.ts +700 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +35 -6
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +42 -8
- package/merchant/merchant.d.ts +42 -8
- package/merchant/merchant.js +34 -5
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +73 -16
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +84 -16
- package/organisation/organisation.d.ts +84 -16
- package/organisation/organisation.js +66 -9
- package/organisation/organisation.js.map +1 -1
- package/package.json +11 -11
- package/product/product.cjs +121 -22
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +141 -22
- package/product/product.d.ts +141 -22
- package/product/product.js +111 -12
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +9 -2
- package/src/admin/admin.ts +51 -15
- package/src/asset/asset.ts +64 -40
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +353 -0
- package/src/merchant/merchant.ts +94 -19
- package/src/organisation/organisation.ts +185 -36
- package/src/product/product.ts +314 -48
- package/src/state/state.ts +51 -15
- package/src/unit/unit.ts +191 -46
- package/src/user/user.ts +141 -35
- package/state/state.cjs +19 -4
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +23 -6
- package/state/state.d.ts +23 -6
- package/state/state.js +19 -4
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +77 -20
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +91 -23
- package/unit/unit.d.ts +91 -23
- package/unit/unit.js +68 -11
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +59 -16
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +66 -15
- package/user/user.d.ts +66 -15
- package/user/user.js +53 -10
- package/user/user.js.map +1 -1
- package/chunk-J22A7LHX.cjs.map +0 -1
- package/custom-instance-56b86e9f.d.ts +0 -694
package/src/custom-instance.ts
CHANGED
|
@@ -39,10 +39,9 @@ export const customInstance = <TReturn>(
|
|
|
39
39
|
({ data }) => data,
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
source.cancel('Query was cancelled by React Query');
|
|
42
|
+
// @ts-expect-error need to add a cancel method to the promise
|
|
43
|
+
promise.cancel = () => {
|
|
44
|
+
source.cancel('Query was cancelled');
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
return promise;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Account Server API
|
|
5
|
+
* The Informatics Matters Account Server API.
|
|
6
|
+
|
|
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**.
|
|
8
|
+
|
|
9
|
+
* OpenAPI spec version: 2.1
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
useMutation,
|
|
13
|
+
useQuery,
|
|
14
|
+
useSuspenseQuery
|
|
15
|
+
} from '@tanstack/react-query'
|
|
16
|
+
import type {
|
|
17
|
+
MutationFunction,
|
|
18
|
+
QueryFunction,
|
|
19
|
+
QueryKey,
|
|
20
|
+
UseMutationOptions,
|
|
21
|
+
UseQueryOptions,
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
25
|
+
} from '@tanstack/react-query'
|
|
26
|
+
import type {
|
|
27
|
+
AsError,
|
|
28
|
+
EventStreamGetPostResponse
|
|
29
|
+
} from '../account-server-api.schemas'
|
|
30
|
+
import { customInstance } from '.././custom-instance';
|
|
31
|
+
import type { ErrorType } from '.././custom-instance';
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Gets your EventStream ID and read token, if you have created one.
|
|
39
|
+
|
|
40
|
+
* @summary Gets the details of your EventStream
|
|
41
|
+
*/
|
|
42
|
+
export const getEventStream = (
|
|
43
|
+
|
|
44
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
45
|
+
) => {
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return customInstance<EventStreamGetPostResponse>(
|
|
49
|
+
{url: `/event-stream`, method: 'GET', signal
|
|
50
|
+
},
|
|
51
|
+
options);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export const getGetEventStreamQueryKey = () => {
|
|
56
|
+
return ["account-server-api", `/event-stream`] as const;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export const getGetEventStreamQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
61
|
+
) => {
|
|
62
|
+
|
|
63
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
64
|
+
|
|
65
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type GetEventStreamQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
|
|
79
|
+
export type GetEventStreamQueryError = ErrorType<void | AsError>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @summary Gets the details of your EventStream
|
|
83
|
+
*/
|
|
84
|
+
export const useGetEventStream = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
85
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
86
|
+
|
|
87
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
88
|
+
|
|
89
|
+
const queryOptions = getGetEventStreamQueryOptions(options)
|
|
90
|
+
|
|
91
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
92
|
+
|
|
93
|
+
query.queryKey = queryOptions.queryKey ;
|
|
94
|
+
|
|
95
|
+
return query;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
export const getGetEventStreamSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
101
|
+
) => {
|
|
102
|
+
|
|
103
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
104
|
+
|
|
105
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
|
|
119
|
+
export type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @summary Gets the details of your EventStream
|
|
123
|
+
*/
|
|
124
|
+
export const useGetEventStreamSuspense = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
125
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
126
|
+
|
|
127
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
128
|
+
|
|
129
|
+
const queryOptions = getGetEventStreamSuspenseQueryOptions(options)
|
|
130
|
+
|
|
131
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
132
|
+
|
|
133
|
+
query.queryKey = queryOptions.queryKey ;
|
|
134
|
+
|
|
135
|
+
return query;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.
|
|
142
|
+
|
|
143
|
+
A user is only permitted one event stream.
|
|
144
|
+
|
|
145
|
+
* @summary Create a new Server-Sent Events EventStream
|
|
146
|
+
*/
|
|
147
|
+
export const createEventStream = (
|
|
148
|
+
|
|
149
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
return customInstance<EventStreamGetPostResponse>(
|
|
153
|
+
{url: `/event-stream`, method: 'POST'
|
|
154
|
+
},
|
|
155
|
+
options);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export const getCreateEventStreamMutationOptions = <TError = ErrorType<AsError | void>,
|
|
161
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
162
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext> => {
|
|
163
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, void> = () => {
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
return createEventStream(requestOptions)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
return { mutationFn, ...mutationOptions }}
|
|
178
|
+
|
|
179
|
+
export type CreateEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof createEventStream>>>
|
|
180
|
+
|
|
181
|
+
export type CreateEventStreamMutationError = ErrorType<AsError | void>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @summary Create a new Server-Sent Events EventStream
|
|
185
|
+
*/
|
|
186
|
+
export const useCreateEventStream = <TError = ErrorType<AsError | void>,
|
|
187
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
188
|
+
) => {
|
|
189
|
+
|
|
190
|
+
const mutationOptions = getCreateEventStreamMutationOptions(options);
|
|
191
|
+
|
|
192
|
+
return useMutation(mutationOptions);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.
|
|
196
|
+
|
|
197
|
+
This is an un-authenticated endpoint. In order to read from the stream the caller must provide either the User access token that belongs to the event stream or the **read token** that was allocated when the stream was created. The **read token** must be provided in the request header property `X-IM-AS-EventStreamReadToken`.
|
|
198
|
+
|
|
199
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
200
|
+
*/
|
|
201
|
+
export const getEventStreamEvents = (
|
|
202
|
+
eventStreamId: number,
|
|
203
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
204
|
+
) => {
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
return customInstance<string>(
|
|
208
|
+
{url: `/event-stream/${eventStreamId}`, method: 'GET', signal
|
|
209
|
+
},
|
|
210
|
+
options);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
export const getGetEventStreamEventsQueryKey = (eventStreamId: number,) => {
|
|
215
|
+
return ["account-server-api", `/event-stream/${eventStreamId}`] as const;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
export const getGetEventStreamEventsQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
220
|
+
) => {
|
|
221
|
+
|
|
222
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
223
|
+
|
|
224
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export type GetEventStreamEventsQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>
|
|
238
|
+
export type GetEventStreamEventsQueryError = ErrorType<void | AsError>
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
242
|
+
*/
|
|
243
|
+
export const useGetEventStreamEvents = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
|
|
244
|
+
eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
245
|
+
|
|
246
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
247
|
+
|
|
248
|
+
const queryOptions = getGetEventStreamEventsQueryOptions(eventStreamId,options)
|
|
249
|
+
|
|
250
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
251
|
+
|
|
252
|
+
query.queryKey = queryOptions.queryKey ;
|
|
253
|
+
|
|
254
|
+
return query;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
export const getGetEventStreamEventsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
260
|
+
) => {
|
|
261
|
+
|
|
262
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
263
|
+
|
|
264
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export type GetEventStreamEventsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>
|
|
278
|
+
export type GetEventStreamEventsSuspenseQueryError = ErrorType<void | AsError>
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
282
|
+
*/
|
|
283
|
+
export const useGetEventStreamEventsSuspense = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
|
|
284
|
+
eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
285
|
+
|
|
286
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
287
|
+
|
|
288
|
+
const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId,options)
|
|
289
|
+
|
|
290
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
291
|
+
|
|
292
|
+
query.queryKey = queryOptions.queryKey ;
|
|
293
|
+
|
|
294
|
+
return query;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Deletes an Event Stream.
|
|
301
|
+
|
|
302
|
+
You must be the user who created the event stream.
|
|
303
|
+
|
|
304
|
+
* @summary Deletes an existing EventStream (that you created)
|
|
305
|
+
*/
|
|
306
|
+
export const deleteEventStream = (
|
|
307
|
+
eventStreamId: number,
|
|
308
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
return customInstance<void>(
|
|
312
|
+
{url: `/event-stream/${eventStreamId}`, method: 'DELETE'
|
|
313
|
+
},
|
|
314
|
+
options);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
export const getDeleteEventStreamMutationOptions = <TError = ErrorType<AsError>,
|
|
320
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
321
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext> => {
|
|
322
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteEventStream>>, {eventStreamId: number}> = (props) => {
|
|
328
|
+
const {eventStreamId} = props ?? {};
|
|
329
|
+
|
|
330
|
+
return deleteEventStream(eventStreamId,requestOptions)
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
return { mutationFn, ...mutationOptions }}
|
|
337
|
+
|
|
338
|
+
export type DeleteEventStreamMutationResult = NonNullable<Awaited<ReturnType<typeof deleteEventStream>>>
|
|
339
|
+
|
|
340
|
+
export type DeleteEventStreamMutationError = ErrorType<AsError>
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @summary Deletes an existing EventStream (that you created)
|
|
344
|
+
*/
|
|
345
|
+
export const useDeleteEventStream = <TError = ErrorType<AsError>,
|
|
346
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
347
|
+
) => {
|
|
348
|
+
|
|
349
|
+
const mutationOptions = getDeleteEventStreamMutationOptions(options);
|
|
350
|
+
|
|
351
|
+
return useMutation(mutationOptions);
|
|
352
|
+
}
|
|
353
|
+
|
package/src/merchant/merchant.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
6
6
|
|
|
7
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**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 2.
|
|
9
|
+
* OpenAPI spec version: 2.1
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
|
-
useQuery
|
|
12
|
+
useQuery,
|
|
13
|
+
useSuspenseQuery
|
|
13
14
|
} from '@tanstack/react-query'
|
|
14
15
|
import type {
|
|
15
16
|
QueryFunction,
|
|
16
17
|
QueryKey,
|
|
17
18
|
UseQueryOptions,
|
|
18
|
-
UseQueryResult
|
|
19
|
+
UseQueryResult,
|
|
20
|
+
UseSuspenseQueryOptions,
|
|
21
|
+
UseSuspenseQueryResult
|
|
19
22
|
} from '@tanstack/react-query'
|
|
20
23
|
import type {
|
|
21
24
|
AsError,
|
|
@@ -26,13 +29,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
26
29
|
import type { ErrorType } from '.././custom-instance';
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
31
|
-
config: any,
|
|
32
|
-
args: infer P,
|
|
33
|
-
) => any
|
|
34
|
-
? P
|
|
35
|
-
: never;
|
|
32
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
36
33
|
|
|
37
34
|
|
|
38
35
|
/**
|
|
@@ -49,19 +46,18 @@ export const getMerchants = (
|
|
|
49
46
|
|
|
50
47
|
|
|
51
48
|
return customInstance<MerchantsGetResponse>(
|
|
52
|
-
{url: `/merchant`, method: '
|
|
49
|
+
{url: `/merchant`, method: 'GET', signal
|
|
53
50
|
},
|
|
54
51
|
options);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
export const getGetMerchantsQueryKey = () => {
|
|
59
|
-
|
|
60
56
|
return ["account-server-api", `/merchant`] as const;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
|
|
64
|
-
export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData
|
|
60
|
+
export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
65
61
|
) => {
|
|
66
62
|
|
|
67
63
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -86,7 +82,7 @@ export type GetMerchantsQueryError = ErrorType<AsError | void>
|
|
|
86
82
|
* @summary Gets all Merchants
|
|
87
83
|
*/
|
|
88
84
|
export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
89
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData
|
|
85
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
90
86
|
|
|
91
87
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
92
88
|
|
|
@@ -101,6 +97,46 @@ export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>
|
|
|
101
97
|
|
|
102
98
|
|
|
103
99
|
|
|
100
|
+
export const getGetMerchantsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
101
|
+
) => {
|
|
102
|
+
|
|
103
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
104
|
+
|
|
105
|
+
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & { queryKey: QueryKey }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type GetMerchantsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
|
|
119
|
+
export type GetMerchantsSuspenseQueryError = ErrorType<AsError | void>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @summary Gets all Merchants
|
|
123
|
+
*/
|
|
124
|
+
export const useGetMerchantsSuspense = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
125
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
126
|
+
|
|
127
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
128
|
+
|
|
129
|
+
const queryOptions = getGetMerchantsSuspenseQueryOptions(options)
|
|
130
|
+
|
|
131
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
132
|
+
|
|
133
|
+
query.queryKey = queryOptions.queryKey ;
|
|
134
|
+
|
|
135
|
+
return query;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
104
140
|
/**
|
|
105
141
|
* Gets a known Merchant
|
|
106
142
|
|
|
@@ -113,19 +149,18 @@ export const getService = (
|
|
|
113
149
|
|
|
114
150
|
|
|
115
151
|
return customInstance<MerchantDetail>(
|
|
116
|
-
{url: `/merchant/${mId}`, method: '
|
|
152
|
+
{url: `/merchant/${mId}`, method: 'GET', signal
|
|
117
153
|
},
|
|
118
154
|
options);
|
|
119
155
|
}
|
|
120
156
|
|
|
121
157
|
|
|
122
158
|
export const getGetServiceQueryKey = (mId: number,) => {
|
|
123
|
-
|
|
124
159
|
return ["account-server-api", `/merchant/${mId}`] as const;
|
|
125
160
|
}
|
|
126
161
|
|
|
127
162
|
|
|
128
|
-
export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData
|
|
163
|
+
export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
129
164
|
) => {
|
|
130
165
|
|
|
131
166
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -150,7 +185,7 @@ export type GetServiceQueryError = ErrorType<AsError | void>
|
|
|
150
185
|
* @summary Gets a specific Merchant
|
|
151
186
|
*/
|
|
152
187
|
export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
153
|
-
mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData
|
|
188
|
+
mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
154
189
|
|
|
155
190
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
156
191
|
|
|
@@ -165,3 +200,43 @@ export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TE
|
|
|
165
200
|
|
|
166
201
|
|
|
167
202
|
|
|
203
|
+
export const getGetServiceSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
204
|
+
) => {
|
|
205
|
+
|
|
206
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
207
|
+
|
|
208
|
+
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
return { queryKey, queryFn, enabled: !!(mId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & { queryKey: QueryKey }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
|
|
222
|
+
export type GetServiceSuspenseQueryError = ErrorType<AsError | void>
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @summary Gets a specific Merchant
|
|
226
|
+
*/
|
|
227
|
+
export const useGetServiceSuspense = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
228
|
+
mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
229
|
+
|
|
230
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
231
|
+
|
|
232
|
+
const queryOptions = getGetServiceSuspenseQueryOptions(mId,options)
|
|
233
|
+
|
|
234
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
235
|
+
|
|
236
|
+
query.queryKey = queryOptions.queryKey ;
|
|
237
|
+
|
|
238
|
+
return query;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|