@squonk/account-server-client 2.0.4-rc.1 → 2.0.4-rc.3
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 +10 -14
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +9 -3
- package/admin/admin.js +9 -13
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +59 -28
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +71 -3
- package/asset/asset.js +58 -27
- package/asset/asset.js.map +1 -1
- package/{custom-instance-85497958.d.ts → custom-instance-8a11f2d1.d.ts} +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +19 -16
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +16 -4
- package/merchant/merchant.js +18 -15
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +64 -40
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +56 -6
- package/organisation/organisation.js +63 -39
- package/organisation/organisation.js.map +1 -1
- package/package.json +10 -9
- package/product/product.cjs +92 -55
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +79 -9
- package/product/product.js +91 -54
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +1 -1
- package/src/admin/admin.ts +34 -18
- package/src/asset/asset.ts +223 -88
- package/src/merchant/merchant.ts +60 -27
- package/src/organisation/organisation.ts +215 -97
- package/src/product/product.ts +310 -134
- package/src/state/state.ts +30 -15
- package/src/unit/unit.ts +263 -117
- package/src/user/user.ts +207 -88
- package/state/state.cjs +10 -11
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +9 -3
- package/state/state.js +9 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +74 -46
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +70 -6
- package/unit/unit.js +73 -45
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -31
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +63 -5
- package/user/user.js +55 -30
- package/user/user.js.map +1 -1
- package/chunk-7XN3IQYV.cjs +0 -13
- package/chunk-7XN3IQYV.cjs.map +0 -1
- package/chunk-YEX2SGER.js +0 -13
- package/chunk-YEX2SGER.js.map +0 -1
- package/src/queryMutator.ts +0 -12
package/src/asset/asset.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.15.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -29,7 +29,6 @@ import type {
|
|
|
29
29
|
} from "../account-server-api.schemas";
|
|
30
30
|
import { customInstance } from ".././custom-instance";
|
|
31
31
|
import type { ErrorType } from ".././custom-instance";
|
|
32
|
-
import { queryMutator } from ".././queryMutator";
|
|
33
32
|
|
|
34
33
|
// eslint-disable-next-line
|
|
35
34
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -55,17 +54,10 @@ export const getAsset = (
|
|
|
55
54
|
);
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
export const getGetAssetQueryKey = (params?: GetAssetParams) =>
|
|
59
|
-
`/asset`,
|
|
60
|
-
...(params ? [params] : []),
|
|
61
|
-
];
|
|
57
|
+
export const getGetAssetQueryKey = (params?: GetAssetParams) =>
|
|
58
|
+
["account-server-api", `/asset`, ...(params ? [params] : [])] as const;
|
|
62
59
|
|
|
63
|
-
export
|
|
64
|
-
Awaited<ReturnType<typeof getAsset>>
|
|
65
|
-
>;
|
|
66
|
-
export type GetAssetQueryError = ErrorType<AsError | void>;
|
|
67
|
-
|
|
68
|
-
export const useGetAsset = <
|
|
60
|
+
export const getGetAssetQueryOptions = <
|
|
69
61
|
TData = Awaited<ReturnType<typeof getAsset>>,
|
|
70
62
|
TError = ErrorType<AsError | void>
|
|
71
63
|
>(
|
|
@@ -78,7 +70,9 @@ export const useGetAsset = <
|
|
|
78
70
|
>;
|
|
79
71
|
request?: SecondParameter<typeof customInstance>;
|
|
80
72
|
}
|
|
81
|
-
):
|
|
73
|
+
): UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & {
|
|
74
|
+
queryKey: QueryKey;
|
|
75
|
+
} => {
|
|
82
76
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
83
77
|
|
|
84
78
|
const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);
|
|
@@ -87,13 +81,35 @@ export const useGetAsset = <
|
|
|
87
81
|
signal,
|
|
88
82
|
}) => getAsset(params, requestOptions, signal);
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
85
|
+
};
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
export type GetAssetQueryResult = NonNullable<
|
|
88
|
+
Awaited<ReturnType<typeof getAsset>>
|
|
89
|
+
>;
|
|
90
|
+
export type GetAssetQueryError = ErrorType<AsError | void>;
|
|
95
91
|
|
|
96
|
-
|
|
92
|
+
export const useGetAsset = <
|
|
93
|
+
TData = Awaited<ReturnType<typeof getAsset>>,
|
|
94
|
+
TError = ErrorType<AsError | void>
|
|
95
|
+
>(
|
|
96
|
+
params?: GetAssetParams,
|
|
97
|
+
options?: {
|
|
98
|
+
query?: UseQueryOptions<
|
|
99
|
+
Awaited<ReturnType<typeof getAsset>>,
|
|
100
|
+
TError,
|
|
101
|
+
TData
|
|
102
|
+
>;
|
|
103
|
+
request?: SecondParameter<typeof customInstance>;
|
|
104
|
+
}
|
|
105
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
106
|
+
const queryOptions = getGetAssetQueryOptions(params, options);
|
|
107
|
+
|
|
108
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
109
|
+
queryKey: QueryKey;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
query.queryKey = queryOptions.queryKey;
|
|
97
113
|
|
|
98
114
|
return query;
|
|
99
115
|
};
|
|
@@ -135,13 +151,7 @@ export const createAsset = (
|
|
|
135
151
|
);
|
|
136
152
|
};
|
|
137
153
|
|
|
138
|
-
export
|
|
139
|
-
Awaited<ReturnType<typeof createAsset>>
|
|
140
|
-
>;
|
|
141
|
-
export type CreateAssetMutationBody = AssetPostBodyBody;
|
|
142
|
-
export type CreateAssetMutationError = ErrorType<AsError | void>;
|
|
143
|
-
|
|
144
|
-
export const useCreateAsset = <
|
|
154
|
+
export const getCreateAssetMutationOptions = <
|
|
145
155
|
TError = ErrorType<AsError | void>,
|
|
146
156
|
TContext = unknown
|
|
147
157
|
>(options?: {
|
|
@@ -152,7 +162,12 @@ export const useCreateAsset = <
|
|
|
152
162
|
TContext
|
|
153
163
|
>;
|
|
154
164
|
request?: SecondParameter<typeof customInstance>;
|
|
155
|
-
})
|
|
165
|
+
}): UseMutationOptions<
|
|
166
|
+
Awaited<ReturnType<typeof createAsset>>,
|
|
167
|
+
TError,
|
|
168
|
+
{ data: AssetPostBodyBody },
|
|
169
|
+
TContext
|
|
170
|
+
> => {
|
|
156
171
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
157
172
|
|
|
158
173
|
const mutationFn: MutationFunction<
|
|
@@ -164,12 +179,30 @@ export const useCreateAsset = <
|
|
|
164
179
|
return createAsset(data, requestOptions);
|
|
165
180
|
};
|
|
166
181
|
|
|
167
|
-
return
|
|
182
|
+
return { mutationFn, ...mutationOptions };
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type CreateAssetMutationResult = NonNullable<
|
|
186
|
+
Awaited<ReturnType<typeof createAsset>>
|
|
187
|
+
>;
|
|
188
|
+
export type CreateAssetMutationBody = AssetPostBodyBody;
|
|
189
|
+
export type CreateAssetMutationError = ErrorType<AsError | void>;
|
|
190
|
+
|
|
191
|
+
export const useCreateAsset = <
|
|
192
|
+
TError = ErrorType<AsError | void>,
|
|
193
|
+
TContext = unknown
|
|
194
|
+
>(options?: {
|
|
195
|
+
mutation?: UseMutationOptions<
|
|
168
196
|
Awaited<ReturnType<typeof createAsset>>,
|
|
169
197
|
TError,
|
|
170
198
|
{ data: AssetPostBodyBody },
|
|
171
199
|
TContext
|
|
172
|
-
|
|
200
|
+
>;
|
|
201
|
+
request?: SecondParameter<typeof customInstance>;
|
|
202
|
+
}) => {
|
|
203
|
+
const mutationOptions = getCreateAssetMutationOptions(options);
|
|
204
|
+
|
|
205
|
+
return useMutation(mutationOptions);
|
|
173
206
|
};
|
|
174
207
|
/**
|
|
175
208
|
* Used to update or replace an existing asset's **Content** and/or its **Description**. It is important to realise that the value of Assets currently in use will not be affected by the change i.e. a **Merchant** that has obtained an Asset will continue to use the original value until the Merchant requests the asset again.
|
|
@@ -203,13 +236,7 @@ export const patchAsset = (
|
|
|
203
236
|
);
|
|
204
237
|
};
|
|
205
238
|
|
|
206
|
-
export
|
|
207
|
-
Awaited<ReturnType<typeof patchAsset>>
|
|
208
|
-
>;
|
|
209
|
-
export type PatchAssetMutationBody = AssetPatchBodyBody;
|
|
210
|
-
export type PatchAssetMutationError = ErrorType<AsError>;
|
|
211
|
-
|
|
212
|
-
export const usePatchAsset = <
|
|
239
|
+
export const getPatchAssetMutationOptions = <
|
|
213
240
|
TError = ErrorType<AsError>,
|
|
214
241
|
TContext = unknown
|
|
215
242
|
>(options?: {
|
|
@@ -220,7 +247,12 @@ export const usePatchAsset = <
|
|
|
220
247
|
TContext
|
|
221
248
|
>;
|
|
222
249
|
request?: SecondParameter<typeof customInstance>;
|
|
223
|
-
})
|
|
250
|
+
}): UseMutationOptions<
|
|
251
|
+
Awaited<ReturnType<typeof patchAsset>>,
|
|
252
|
+
TError,
|
|
253
|
+
{ assetId: string; data: AssetPatchBodyBody },
|
|
254
|
+
TContext
|
|
255
|
+
> => {
|
|
224
256
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
225
257
|
|
|
226
258
|
const mutationFn: MutationFunction<
|
|
@@ -232,12 +264,30 @@ export const usePatchAsset = <
|
|
|
232
264
|
return patchAsset(assetId, data, requestOptions);
|
|
233
265
|
};
|
|
234
266
|
|
|
235
|
-
return
|
|
267
|
+
return { mutationFn, ...mutationOptions };
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export type PatchAssetMutationResult = NonNullable<
|
|
271
|
+
Awaited<ReturnType<typeof patchAsset>>
|
|
272
|
+
>;
|
|
273
|
+
export type PatchAssetMutationBody = AssetPatchBodyBody;
|
|
274
|
+
export type PatchAssetMutationError = ErrorType<AsError>;
|
|
275
|
+
|
|
276
|
+
export const usePatchAsset = <
|
|
277
|
+
TError = ErrorType<AsError>,
|
|
278
|
+
TContext = unknown
|
|
279
|
+
>(options?: {
|
|
280
|
+
mutation?: UseMutationOptions<
|
|
236
281
|
Awaited<ReturnType<typeof patchAsset>>,
|
|
237
282
|
TError,
|
|
238
283
|
{ assetId: string; data: AssetPatchBodyBody },
|
|
239
284
|
TContext
|
|
240
|
-
|
|
285
|
+
>;
|
|
286
|
+
request?: SecondParameter<typeof customInstance>;
|
|
287
|
+
}) => {
|
|
288
|
+
const mutationOptions = getPatchAssetMutationOptions(options);
|
|
289
|
+
|
|
290
|
+
return useMutation(mutationOptions);
|
|
241
291
|
};
|
|
242
292
|
/**
|
|
243
293
|
* Deletes a known Asset. Assets that are attached to merchants cannot be deleted
|
|
@@ -254,13 +304,7 @@ export const deleteAsset = (
|
|
|
254
304
|
);
|
|
255
305
|
};
|
|
256
306
|
|
|
257
|
-
export
|
|
258
|
-
Awaited<ReturnType<typeof deleteAsset>>
|
|
259
|
-
>;
|
|
260
|
-
|
|
261
|
-
export type DeleteAssetMutationError = ErrorType<AsError>;
|
|
262
|
-
|
|
263
|
-
export const useDeleteAsset = <
|
|
307
|
+
export const getDeleteAssetMutationOptions = <
|
|
264
308
|
TError = ErrorType<AsError>,
|
|
265
309
|
TContext = unknown
|
|
266
310
|
>(options?: {
|
|
@@ -271,7 +315,12 @@ export const useDeleteAsset = <
|
|
|
271
315
|
TContext
|
|
272
316
|
>;
|
|
273
317
|
request?: SecondParameter<typeof customInstance>;
|
|
274
|
-
})
|
|
318
|
+
}): UseMutationOptions<
|
|
319
|
+
Awaited<ReturnType<typeof deleteAsset>>,
|
|
320
|
+
TError,
|
|
321
|
+
{ assetId: string },
|
|
322
|
+
TContext
|
|
323
|
+
> => {
|
|
275
324
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
276
325
|
|
|
277
326
|
const mutationFn: MutationFunction<
|
|
@@ -283,12 +332,30 @@ export const useDeleteAsset = <
|
|
|
283
332
|
return deleteAsset(assetId, requestOptions);
|
|
284
333
|
};
|
|
285
334
|
|
|
286
|
-
return
|
|
335
|
+
return { mutationFn, ...mutationOptions };
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export type DeleteAssetMutationResult = NonNullable<
|
|
339
|
+
Awaited<ReturnType<typeof deleteAsset>>
|
|
340
|
+
>;
|
|
341
|
+
|
|
342
|
+
export type DeleteAssetMutationError = ErrorType<AsError>;
|
|
343
|
+
|
|
344
|
+
export const useDeleteAsset = <
|
|
345
|
+
TError = ErrorType<AsError>,
|
|
346
|
+
TContext = unknown
|
|
347
|
+
>(options?: {
|
|
348
|
+
mutation?: UseMutationOptions<
|
|
287
349
|
Awaited<ReturnType<typeof deleteAsset>>,
|
|
288
350
|
TError,
|
|
289
351
|
{ assetId: string },
|
|
290
352
|
TContext
|
|
291
|
-
|
|
353
|
+
>;
|
|
354
|
+
request?: SecondParameter<typeof customInstance>;
|
|
355
|
+
}) => {
|
|
356
|
+
const mutationOptions = getDeleteAssetMutationOptions(options);
|
|
357
|
+
|
|
358
|
+
return useMutation(mutationOptions);
|
|
292
359
|
};
|
|
293
360
|
/**
|
|
294
361
|
* Disables a known Asset
|
|
@@ -305,13 +372,7 @@ export const disableAsset = (
|
|
|
305
372
|
);
|
|
306
373
|
};
|
|
307
374
|
|
|
308
|
-
export
|
|
309
|
-
Awaited<ReturnType<typeof disableAsset>>
|
|
310
|
-
>;
|
|
311
|
-
|
|
312
|
-
export type DisableAssetMutationError = ErrorType<AsError>;
|
|
313
|
-
|
|
314
|
-
export const useDisableAsset = <
|
|
375
|
+
export const getDisableAssetMutationOptions = <
|
|
315
376
|
TError = ErrorType<AsError>,
|
|
316
377
|
TContext = unknown
|
|
317
378
|
>(options?: {
|
|
@@ -322,7 +383,12 @@ export const useDisableAsset = <
|
|
|
322
383
|
TContext
|
|
323
384
|
>;
|
|
324
385
|
request?: SecondParameter<typeof customInstance>;
|
|
325
|
-
})
|
|
386
|
+
}): UseMutationOptions<
|
|
387
|
+
Awaited<ReturnType<typeof disableAsset>>,
|
|
388
|
+
TError,
|
|
389
|
+
{ assetId: string },
|
|
390
|
+
TContext
|
|
391
|
+
> => {
|
|
326
392
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
327
393
|
|
|
328
394
|
const mutationFn: MutationFunction<
|
|
@@ -334,12 +400,30 @@ export const useDisableAsset = <
|
|
|
334
400
|
return disableAsset(assetId, requestOptions);
|
|
335
401
|
};
|
|
336
402
|
|
|
337
|
-
return
|
|
403
|
+
return { mutationFn, ...mutationOptions };
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
export type DisableAssetMutationResult = NonNullable<
|
|
407
|
+
Awaited<ReturnType<typeof disableAsset>>
|
|
408
|
+
>;
|
|
409
|
+
|
|
410
|
+
export type DisableAssetMutationError = ErrorType<AsError>;
|
|
411
|
+
|
|
412
|
+
export const useDisableAsset = <
|
|
413
|
+
TError = ErrorType<AsError>,
|
|
414
|
+
TContext = unknown
|
|
415
|
+
>(options?: {
|
|
416
|
+
mutation?: UseMutationOptions<
|
|
338
417
|
Awaited<ReturnType<typeof disableAsset>>,
|
|
339
418
|
TError,
|
|
340
419
|
{ assetId: string },
|
|
341
420
|
TContext
|
|
342
|
-
|
|
421
|
+
>;
|
|
422
|
+
request?: SecondParameter<typeof customInstance>;
|
|
423
|
+
}) => {
|
|
424
|
+
const mutationOptions = getDisableAssetMutationOptions(options);
|
|
425
|
+
|
|
426
|
+
return useMutation(mutationOptions);
|
|
343
427
|
};
|
|
344
428
|
/**
|
|
345
429
|
* Enables a known Asset
|
|
@@ -356,13 +440,7 @@ export const enableAsset = (
|
|
|
356
440
|
);
|
|
357
441
|
};
|
|
358
442
|
|
|
359
|
-
export
|
|
360
|
-
Awaited<ReturnType<typeof enableAsset>>
|
|
361
|
-
>;
|
|
362
|
-
|
|
363
|
-
export type EnableAssetMutationError = ErrorType<AsError>;
|
|
364
|
-
|
|
365
|
-
export const useEnableAsset = <
|
|
443
|
+
export const getEnableAssetMutationOptions = <
|
|
366
444
|
TError = ErrorType<AsError>,
|
|
367
445
|
TContext = unknown
|
|
368
446
|
>(options?: {
|
|
@@ -373,7 +451,12 @@ export const useEnableAsset = <
|
|
|
373
451
|
TContext
|
|
374
452
|
>;
|
|
375
453
|
request?: SecondParameter<typeof customInstance>;
|
|
376
|
-
})
|
|
454
|
+
}): UseMutationOptions<
|
|
455
|
+
Awaited<ReturnType<typeof enableAsset>>,
|
|
456
|
+
TError,
|
|
457
|
+
{ assetId: string },
|
|
458
|
+
TContext
|
|
459
|
+
> => {
|
|
377
460
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
378
461
|
|
|
379
462
|
const mutationFn: MutationFunction<
|
|
@@ -385,12 +468,30 @@ export const useEnableAsset = <
|
|
|
385
468
|
return enableAsset(assetId, requestOptions);
|
|
386
469
|
};
|
|
387
470
|
|
|
388
|
-
return
|
|
471
|
+
return { mutationFn, ...mutationOptions };
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
export type EnableAssetMutationResult = NonNullable<
|
|
475
|
+
Awaited<ReturnType<typeof enableAsset>>
|
|
476
|
+
>;
|
|
477
|
+
|
|
478
|
+
export type EnableAssetMutationError = ErrorType<AsError>;
|
|
479
|
+
|
|
480
|
+
export const useEnableAsset = <
|
|
481
|
+
TError = ErrorType<AsError>,
|
|
482
|
+
TContext = unknown
|
|
483
|
+
>(options?: {
|
|
484
|
+
mutation?: UseMutationOptions<
|
|
389
485
|
Awaited<ReturnType<typeof enableAsset>>,
|
|
390
486
|
TError,
|
|
391
487
|
{ assetId: string },
|
|
392
488
|
TContext
|
|
393
|
-
|
|
489
|
+
>;
|
|
490
|
+
request?: SecondParameter<typeof customInstance>;
|
|
491
|
+
}) => {
|
|
492
|
+
const mutationOptions = getEnableAssetMutationOptions(options);
|
|
493
|
+
|
|
494
|
+
return useMutation(mutationOptions);
|
|
394
495
|
};
|
|
395
496
|
/**
|
|
396
497
|
* Attaches an Asset to a merchant
|
|
@@ -408,13 +509,7 @@ export const attachAsset = (
|
|
|
408
509
|
);
|
|
409
510
|
};
|
|
410
511
|
|
|
411
|
-
export
|
|
412
|
-
Awaited<ReturnType<typeof attachAsset>>
|
|
413
|
-
>;
|
|
414
|
-
|
|
415
|
-
export type AttachAssetMutationError = ErrorType<AsError>;
|
|
416
|
-
|
|
417
|
-
export const useAttachAsset = <
|
|
512
|
+
export const getAttachAssetMutationOptions = <
|
|
418
513
|
TError = ErrorType<AsError>,
|
|
419
514
|
TContext = unknown
|
|
420
515
|
>(options?: {
|
|
@@ -425,7 +520,12 @@ export const useAttachAsset = <
|
|
|
425
520
|
TContext
|
|
426
521
|
>;
|
|
427
522
|
request?: SecondParameter<typeof customInstance>;
|
|
428
|
-
})
|
|
523
|
+
}): UseMutationOptions<
|
|
524
|
+
Awaited<ReturnType<typeof attachAsset>>,
|
|
525
|
+
TError,
|
|
526
|
+
{ assetId: string; params?: AttachAssetParams },
|
|
527
|
+
TContext
|
|
528
|
+
> => {
|
|
429
529
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
430
530
|
|
|
431
531
|
const mutationFn: MutationFunction<
|
|
@@ -437,12 +537,30 @@ export const useAttachAsset = <
|
|
|
437
537
|
return attachAsset(assetId, params, requestOptions);
|
|
438
538
|
};
|
|
439
539
|
|
|
440
|
-
return
|
|
540
|
+
return { mutationFn, ...mutationOptions };
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
export type AttachAssetMutationResult = NonNullable<
|
|
544
|
+
Awaited<ReturnType<typeof attachAsset>>
|
|
545
|
+
>;
|
|
546
|
+
|
|
547
|
+
export type AttachAssetMutationError = ErrorType<AsError>;
|
|
548
|
+
|
|
549
|
+
export const useAttachAsset = <
|
|
550
|
+
TError = ErrorType<AsError>,
|
|
551
|
+
TContext = unknown
|
|
552
|
+
>(options?: {
|
|
553
|
+
mutation?: UseMutationOptions<
|
|
441
554
|
Awaited<ReturnType<typeof attachAsset>>,
|
|
442
555
|
TError,
|
|
443
556
|
{ assetId: string; params?: AttachAssetParams },
|
|
444
557
|
TContext
|
|
445
|
-
|
|
558
|
+
>;
|
|
559
|
+
request?: SecondParameter<typeof customInstance>;
|
|
560
|
+
}) => {
|
|
561
|
+
const mutationOptions = getAttachAssetMutationOptions(options);
|
|
562
|
+
|
|
563
|
+
return useMutation(mutationOptions);
|
|
446
564
|
};
|
|
447
565
|
/**
|
|
448
566
|
* Detaches an Asset from a merchant
|
|
@@ -460,13 +578,7 @@ export const detachAsset = (
|
|
|
460
578
|
);
|
|
461
579
|
};
|
|
462
580
|
|
|
463
|
-
export
|
|
464
|
-
Awaited<ReturnType<typeof detachAsset>>
|
|
465
|
-
>;
|
|
466
|
-
|
|
467
|
-
export type DetachAssetMutationError = ErrorType<AsError>;
|
|
468
|
-
|
|
469
|
-
export const useDetachAsset = <
|
|
581
|
+
export const getDetachAssetMutationOptions = <
|
|
470
582
|
TError = ErrorType<AsError>,
|
|
471
583
|
TContext = unknown
|
|
472
584
|
>(options?: {
|
|
@@ -477,7 +589,12 @@ export const useDetachAsset = <
|
|
|
477
589
|
TContext
|
|
478
590
|
>;
|
|
479
591
|
request?: SecondParameter<typeof customInstance>;
|
|
480
|
-
})
|
|
592
|
+
}): UseMutationOptions<
|
|
593
|
+
Awaited<ReturnType<typeof detachAsset>>,
|
|
594
|
+
TError,
|
|
595
|
+
{ assetId: string; params?: DetachAssetParams },
|
|
596
|
+
TContext
|
|
597
|
+
> => {
|
|
481
598
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
482
599
|
|
|
483
600
|
const mutationFn: MutationFunction<
|
|
@@ -489,10 +606,28 @@ export const useDetachAsset = <
|
|
|
489
606
|
return detachAsset(assetId, params, requestOptions);
|
|
490
607
|
};
|
|
491
608
|
|
|
492
|
-
return
|
|
609
|
+
return { mutationFn, ...mutationOptions };
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
export type DetachAssetMutationResult = NonNullable<
|
|
613
|
+
Awaited<ReturnType<typeof detachAsset>>
|
|
614
|
+
>;
|
|
615
|
+
|
|
616
|
+
export type DetachAssetMutationError = ErrorType<AsError>;
|
|
617
|
+
|
|
618
|
+
export const useDetachAsset = <
|
|
619
|
+
TError = ErrorType<AsError>,
|
|
620
|
+
TContext = unknown
|
|
621
|
+
>(options?: {
|
|
622
|
+
mutation?: UseMutationOptions<
|
|
493
623
|
Awaited<ReturnType<typeof detachAsset>>,
|
|
494
624
|
TError,
|
|
495
625
|
{ assetId: string; params?: DetachAssetParams },
|
|
496
626
|
TContext
|
|
497
|
-
|
|
627
|
+
>;
|
|
628
|
+
request?: SecondParameter<typeof customInstance>;
|
|
629
|
+
}) => {
|
|
630
|
+
const mutationOptions = getDetachAssetMutationOptions(options);
|
|
631
|
+
|
|
632
|
+
return useMutation(mutationOptions);
|
|
498
633
|
};
|
package/src/merchant/merchant.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.15.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -22,7 +22,6 @@ import type {
|
|
|
22
22
|
} from "../account-server-api.schemas";
|
|
23
23
|
import { customInstance } from ".././custom-instance";
|
|
24
24
|
import type { ErrorType } from ".././custom-instance";
|
|
25
|
-
import { queryMutator } from ".././queryMutator";
|
|
26
25
|
|
|
27
26
|
// eslint-disable-next-line
|
|
28
27
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -47,14 +46,9 @@ export const getMerchants = (
|
|
|
47
46
|
);
|
|
48
47
|
};
|
|
49
48
|
|
|
50
|
-
export const getGetMerchantsQueryKey = () => [`/merchant`];
|
|
49
|
+
export const getGetMerchantsQueryKey = () => ["account-server-api", `/merchant`] as const;
|
|
51
50
|
|
|
52
|
-
export
|
|
53
|
-
Awaited<ReturnType<typeof getMerchants>>
|
|
54
|
-
>;
|
|
55
|
-
export type GetMerchantsQueryError = ErrorType<AsError | void>;
|
|
56
|
-
|
|
57
|
-
export const useGetMerchants = <
|
|
51
|
+
export const getGetMerchantsQueryOptions = <
|
|
58
52
|
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
59
53
|
TError = ErrorType<AsError | void>
|
|
60
54
|
>(options?: {
|
|
@@ -64,7 +58,9 @@ export const useGetMerchants = <
|
|
|
64
58
|
TData
|
|
65
59
|
>;
|
|
66
60
|
request?: SecondParameter<typeof customInstance>;
|
|
67
|
-
}):
|
|
61
|
+
}): UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & {
|
|
62
|
+
queryKey: QueryKey;
|
|
63
|
+
} => {
|
|
68
64
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
69
65
|
|
|
70
66
|
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
@@ -73,15 +69,32 @@ export const useGetMerchants = <
|
|
|
73
69
|
signal,
|
|
74
70
|
}) => getMerchants(requestOptions, signal);
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type GetMerchantsQueryResult = NonNullable<
|
|
76
|
+
Awaited<ReturnType<typeof getMerchants>>
|
|
77
|
+
>;
|
|
78
|
+
export type GetMerchantsQueryError = ErrorType<AsError | void>;
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
export const useGetMerchants = <
|
|
81
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
82
|
+
TError = ErrorType<AsError | void>
|
|
83
|
+
>(options?: {
|
|
84
|
+
query?: UseQueryOptions<
|
|
79
85
|
Awaited<ReturnType<typeof getMerchants>>,
|
|
80
86
|
TError,
|
|
81
87
|
TData
|
|
82
|
-
|
|
88
|
+
>;
|
|
89
|
+
request?: SecondParameter<typeof customInstance>;
|
|
90
|
+
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
91
|
+
const queryOptions = getGetMerchantsQueryOptions(options);
|
|
92
|
+
|
|
93
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
94
|
+
queryKey: QueryKey;
|
|
95
|
+
};
|
|
83
96
|
|
|
84
|
-
query.queryKey =
|
|
97
|
+
query.queryKey = queryOptions.queryKey;
|
|
85
98
|
|
|
86
99
|
return query;
|
|
87
100
|
};
|
|
@@ -102,14 +115,10 @@ export const getService = (
|
|
|
102
115
|
);
|
|
103
116
|
};
|
|
104
117
|
|
|
105
|
-
export const getGetServiceQueryKey = (mId: number) =>
|
|
106
|
-
|
|
107
|
-
export type GetServiceQueryResult = NonNullable<
|
|
108
|
-
Awaited<ReturnType<typeof getService>>
|
|
109
|
-
>;
|
|
110
|
-
export type GetServiceQueryError = ErrorType<AsError | void>;
|
|
118
|
+
export const getGetServiceQueryKey = (mId: number) =>
|
|
119
|
+
["account-server-api", `/merchant/${mId}`] as const;
|
|
111
120
|
|
|
112
|
-
export const
|
|
121
|
+
export const getGetServiceQueryOptions = <
|
|
113
122
|
TData = Awaited<ReturnType<typeof getService>>,
|
|
114
123
|
TError = ErrorType<AsError | void>
|
|
115
124
|
>(
|
|
@@ -122,7 +131,9 @@ export const useGetService = <
|
|
|
122
131
|
>;
|
|
123
132
|
request?: SecondParameter<typeof customInstance>;
|
|
124
133
|
}
|
|
125
|
-
):
|
|
134
|
+
): UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & {
|
|
135
|
+
queryKey: QueryKey;
|
|
136
|
+
} => {
|
|
126
137
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
127
138
|
|
|
128
139
|
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
@@ -131,13 +142,35 @@ export const useGetService = <
|
|
|
131
142
|
signal,
|
|
132
143
|
}) => getService(mId, requestOptions, signal);
|
|
133
144
|
|
|
134
|
-
|
|
145
|
+
return { queryKey, queryFn, enabled: !!mId, ...queryOptions };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type GetServiceQueryResult = NonNullable<
|
|
149
|
+
Awaited<ReturnType<typeof getService>>
|
|
150
|
+
>;
|
|
151
|
+
export type GetServiceQueryError = ErrorType<AsError | void>;
|
|
152
|
+
|
|
153
|
+
export const useGetService = <
|
|
154
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
155
|
+
TError = ErrorType<AsError | void>
|
|
156
|
+
>(
|
|
157
|
+
mId: number,
|
|
158
|
+
options?: {
|
|
159
|
+
query?: UseQueryOptions<
|
|
160
|
+
Awaited<ReturnType<typeof getService>>,
|
|
161
|
+
TError,
|
|
162
|
+
TData
|
|
163
|
+
>;
|
|
164
|
+
request?: SecondParameter<typeof customInstance>;
|
|
165
|
+
}
|
|
166
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
167
|
+
const queryOptions = getGetServiceQueryOptions(mId, options);
|
|
135
168
|
|
|
136
|
-
const query = useQuery
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
170
|
+
queryKey: QueryKey;
|
|
171
|
+
};
|
|
139
172
|
|
|
140
|
-
query.queryKey =
|
|
173
|
+
query.queryKey = queryOptions.queryKey;
|
|
141
174
|
|
|
142
175
|
return query;
|
|
143
176
|
};
|