@squonk/account-server-client 2.1.0-rc.7 → 2.1.0-rc.9
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 +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 +31 -14
- package/asset/asset.d.ts +31 -14
- 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 +39 -10
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +50 -16
- package/event-stream/event-stream.d.ts +50 -16
- package/event-stream/event-stream.js +36 -7
- package/event-stream/event-stream.js.map +1 -1
- 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 +10 -10
- 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 +1 -1
- package/src/admin/admin.ts +50 -14
- package/src/asset/asset.ts +57 -35
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +99 -28
- package/src/merchant/merchant.ts +93 -18
- package/src/organisation/organisation.ts +184 -35
- package/src/product/product.ts +313 -47
- package/src/state/state.ts +50 -14
- package/src/unit/unit.ts +190 -45
- package/src/user/user.ts +140 -34
- 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-6780910b.d.ts +0 -700
package/asset/asset.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
1
|
+
import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
import { GetAssetParams, customInstance, AssetGetResponse, ErrorType, AsError, AssetPostBodyBody, AssetPostResponse, AssetPatchBodyBody, AttachAssetParams, DetachAssetParams } from '../index.cjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
type SecondParameter<T extends (...args: any) => any> = T
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
7
7
|
/**
|
|
8
8
|
* Gets Assets you have access to.
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ type SecondParameter<T extends (...args: any) => any> = T extends (config: any,
|
|
|
12
12
|
declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
|
|
13
13
|
declare const getGetAssetQueryKey: (params?: GetAssetParams) => readonly ["account-server-api", "/asset", ...GetAssetParams[]];
|
|
14
14
|
declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
15
|
-
query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey
|
|
15
|
+
query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
16
16
|
request?: SecondParameter<typeof customInstance>;
|
|
17
17
|
} | undefined) => UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
|
|
18
18
|
queryKey: QueryKey;
|
|
@@ -23,11 +23,28 @@ type GetAssetQueryError = ErrorType<AsError | void>;
|
|
|
23
23
|
* @summary Gets Assets
|
|
24
24
|
*/
|
|
25
25
|
declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
26
|
-
query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey
|
|
26
|
+
query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
27
27
|
request?: SecondParameter<typeof customInstance>;
|
|
28
28
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
29
29
|
queryKey: QueryKey;
|
|
30
30
|
};
|
|
31
|
+
declare const getGetAssetSuspenseQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
32
|
+
query?: Partial<UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
33
|
+
request?: SecondParameter<typeof customInstance>;
|
|
34
|
+
} | undefined) => UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
type GetAssetSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
|
|
38
|
+
type GetAssetSuspenseQueryError = ErrorType<AsError | void>;
|
|
39
|
+
/**
|
|
40
|
+
* @summary Gets Assets
|
|
41
|
+
*/
|
|
42
|
+
declare const useGetAssetSuspense: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
43
|
+
query?: Partial<UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
44
|
+
request?: SecondParameter<typeof customInstance>;
|
|
45
|
+
} | undefined) => UseSuspenseQueryResult<TData, TError> & {
|
|
46
|
+
queryKey: QueryKey;
|
|
47
|
+
};
|
|
31
48
|
/**
|
|
32
49
|
* Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
|
|
33
50
|
|
|
@@ -59,7 +76,7 @@ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = un
|
|
|
59
76
|
data: AssetPostBodyBody;
|
|
60
77
|
}, TContext> | undefined;
|
|
61
78
|
request?: SecondParameter<typeof customInstance>;
|
|
62
|
-
} | undefined) =>
|
|
79
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<AssetPostResponse, TError, {
|
|
63
80
|
data: AssetPostBodyBody;
|
|
64
81
|
}, TContext>;
|
|
65
82
|
/**
|
|
@@ -92,7 +109,7 @@ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(o
|
|
|
92
109
|
data: AssetPatchBodyBody;
|
|
93
110
|
}, TContext> | undefined;
|
|
94
111
|
request?: SecondParameter<typeof customInstance>;
|
|
95
|
-
} | undefined) =>
|
|
112
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
96
113
|
assetId: string;
|
|
97
114
|
data: AssetPatchBodyBody;
|
|
98
115
|
}, TContext>;
|
|
@@ -120,7 +137,7 @@ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
120
137
|
assetId: string;
|
|
121
138
|
}, TContext> | undefined;
|
|
122
139
|
request?: SecondParameter<typeof customInstance>;
|
|
123
|
-
} | undefined) =>
|
|
140
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
124
141
|
assetId: string;
|
|
125
142
|
}, TContext>;
|
|
126
143
|
/**
|
|
@@ -147,7 +164,7 @@ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>
|
|
|
147
164
|
assetId: string;
|
|
148
165
|
}, TContext> | undefined;
|
|
149
166
|
request?: SecondParameter<typeof customInstance>;
|
|
150
|
-
} | undefined) =>
|
|
167
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
151
168
|
assetId: string;
|
|
152
169
|
}, TContext>;
|
|
153
170
|
/**
|
|
@@ -174,7 +191,7 @@ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
174
191
|
assetId: string;
|
|
175
192
|
}, TContext> | undefined;
|
|
176
193
|
request?: SecondParameter<typeof customInstance>;
|
|
177
|
-
} | undefined) =>
|
|
194
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
178
195
|
assetId: string;
|
|
179
196
|
}, TContext>;
|
|
180
197
|
/**
|
|
@@ -204,7 +221,7 @@ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
204
221
|
params?: AttachAssetParams | undefined;
|
|
205
222
|
}, TContext> | undefined;
|
|
206
223
|
request?: SecondParameter<typeof customInstance>;
|
|
207
|
-
} | undefined) =>
|
|
224
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
208
225
|
assetId: string;
|
|
209
226
|
params?: AttachAssetParams | undefined;
|
|
210
227
|
}, TContext>;
|
|
@@ -235,9 +252,9 @@ declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
235
252
|
params?: DetachAssetParams | undefined;
|
|
236
253
|
}, TContext> | undefined;
|
|
237
254
|
request?: SecondParameter<typeof customInstance>;
|
|
238
|
-
} | undefined) =>
|
|
255
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
239
256
|
assetId: string;
|
|
240
257
|
params?: DetachAssetParams | undefined;
|
|
241
258
|
}, TContext>;
|
|
242
259
|
|
|
243
|
-
export { AttachAssetMutationError, AttachAssetMutationResult, CreateAssetMutationBody, CreateAssetMutationError, CreateAssetMutationResult, DeleteAssetMutationError, DeleteAssetMutationResult, DetachAssetMutationError, DetachAssetMutationResult, DisableAssetMutationError, DisableAssetMutationResult, EnableAssetMutationError, EnableAssetMutationResult, GetAssetQueryError, GetAssetQueryResult, PatchAssetMutationBody, PatchAssetMutationError, PatchAssetMutationResult, attachAsset, createAsset, deleteAsset, detachAsset, disableAsset, enableAsset, getAsset, getAttachAssetMutationOptions, getCreateAssetMutationOptions, getDeleteAssetMutationOptions, getDetachAssetMutationOptions, getDisableAssetMutationOptions, getEnableAssetMutationOptions, getGetAssetQueryKey, getGetAssetQueryOptions, getPatchAssetMutationOptions, patchAsset, useAttachAsset, useCreateAsset, useDeleteAsset, useDetachAsset, useDisableAsset, useEnableAsset, useGetAsset, usePatchAsset };
|
|
260
|
+
export { type AttachAssetMutationError, type AttachAssetMutationResult, type CreateAssetMutationBody, type CreateAssetMutationError, type CreateAssetMutationResult, type DeleteAssetMutationError, type DeleteAssetMutationResult, type DetachAssetMutationError, type DetachAssetMutationResult, type DisableAssetMutationError, type DisableAssetMutationResult, type EnableAssetMutationError, type EnableAssetMutationResult, type GetAssetQueryError, type GetAssetQueryResult, type GetAssetSuspenseQueryError, type GetAssetSuspenseQueryResult, type PatchAssetMutationBody, type PatchAssetMutationError, type PatchAssetMutationResult, attachAsset, createAsset, deleteAsset, detachAsset, disableAsset, enableAsset, getAsset, getAttachAssetMutationOptions, getCreateAssetMutationOptions, getDeleteAssetMutationOptions, getDetachAssetMutationOptions, getDisableAssetMutationOptions, getEnableAssetMutationOptions, getGetAssetQueryKey, getGetAssetQueryOptions, getGetAssetSuspenseQueryOptions, getPatchAssetMutationOptions, patchAsset, useAttachAsset, useCreateAsset, useDeleteAsset, useDetachAsset, useDisableAsset, useEnableAsset, useGetAsset, useGetAssetSuspense, usePatchAsset };
|
package/asset/asset.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
1
|
+
import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
import { GetAssetParams, customInstance, AssetGetResponse, ErrorType, AsError, AssetPostBodyBody, AssetPostResponse, AssetPatchBodyBody, AttachAssetParams, DetachAssetParams } from '../index.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
type SecondParameter<T extends (...args: any) => any> = T
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
7
7
|
/**
|
|
8
8
|
* Gets Assets you have access to.
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ type SecondParameter<T extends (...args: any) => any> = T extends (config: any,
|
|
|
12
12
|
declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
|
|
13
13
|
declare const getGetAssetQueryKey: (params?: GetAssetParams) => readonly ["account-server-api", "/asset", ...GetAssetParams[]];
|
|
14
14
|
declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
15
|
-
query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey
|
|
15
|
+
query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
16
16
|
request?: SecondParameter<typeof customInstance>;
|
|
17
17
|
} | undefined) => UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
|
|
18
18
|
queryKey: QueryKey;
|
|
@@ -23,11 +23,28 @@ type GetAssetQueryError = ErrorType<AsError | void>;
|
|
|
23
23
|
* @summary Gets Assets
|
|
24
24
|
*/
|
|
25
25
|
declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
26
|
-
query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey
|
|
26
|
+
query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
27
27
|
request?: SecondParameter<typeof customInstance>;
|
|
28
28
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
29
29
|
queryKey: QueryKey;
|
|
30
30
|
};
|
|
31
|
+
declare const getGetAssetSuspenseQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
32
|
+
query?: Partial<UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
33
|
+
request?: SecondParameter<typeof customInstance>;
|
|
34
|
+
} | undefined) => UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
type GetAssetSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
|
|
38
|
+
type GetAssetSuspenseQueryError = ErrorType<AsError | void>;
|
|
39
|
+
/**
|
|
40
|
+
* @summary Gets Assets
|
|
41
|
+
*/
|
|
42
|
+
declare const useGetAssetSuspense: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
|
|
43
|
+
query?: Partial<UseSuspenseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
|
|
44
|
+
request?: SecondParameter<typeof customInstance>;
|
|
45
|
+
} | undefined) => UseSuspenseQueryResult<TData, TError> & {
|
|
46
|
+
queryKey: QueryKey;
|
|
47
|
+
};
|
|
31
48
|
/**
|
|
32
49
|
* Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
|
|
33
50
|
|
|
@@ -59,7 +76,7 @@ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = un
|
|
|
59
76
|
data: AssetPostBodyBody;
|
|
60
77
|
}, TContext> | undefined;
|
|
61
78
|
request?: SecondParameter<typeof customInstance>;
|
|
62
|
-
} | undefined) =>
|
|
79
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<AssetPostResponse, TError, {
|
|
63
80
|
data: AssetPostBodyBody;
|
|
64
81
|
}, TContext>;
|
|
65
82
|
/**
|
|
@@ -92,7 +109,7 @@ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(o
|
|
|
92
109
|
data: AssetPatchBodyBody;
|
|
93
110
|
}, TContext> | undefined;
|
|
94
111
|
request?: SecondParameter<typeof customInstance>;
|
|
95
|
-
} | undefined) =>
|
|
112
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
96
113
|
assetId: string;
|
|
97
114
|
data: AssetPatchBodyBody;
|
|
98
115
|
}, TContext>;
|
|
@@ -120,7 +137,7 @@ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
120
137
|
assetId: string;
|
|
121
138
|
}, TContext> | undefined;
|
|
122
139
|
request?: SecondParameter<typeof customInstance>;
|
|
123
|
-
} | undefined) =>
|
|
140
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
124
141
|
assetId: string;
|
|
125
142
|
}, TContext>;
|
|
126
143
|
/**
|
|
@@ -147,7 +164,7 @@ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>
|
|
|
147
164
|
assetId: string;
|
|
148
165
|
}, TContext> | undefined;
|
|
149
166
|
request?: SecondParameter<typeof customInstance>;
|
|
150
|
-
} | undefined) =>
|
|
167
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
151
168
|
assetId: string;
|
|
152
169
|
}, TContext>;
|
|
153
170
|
/**
|
|
@@ -174,7 +191,7 @@ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
174
191
|
assetId: string;
|
|
175
192
|
}, TContext> | undefined;
|
|
176
193
|
request?: SecondParameter<typeof customInstance>;
|
|
177
|
-
} | undefined) =>
|
|
194
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
178
195
|
assetId: string;
|
|
179
196
|
}, TContext>;
|
|
180
197
|
/**
|
|
@@ -204,7 +221,7 @@ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
204
221
|
params?: AttachAssetParams | undefined;
|
|
205
222
|
}, TContext> | undefined;
|
|
206
223
|
request?: SecondParameter<typeof customInstance>;
|
|
207
|
-
} | undefined) =>
|
|
224
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
208
225
|
assetId: string;
|
|
209
226
|
params?: AttachAssetParams | undefined;
|
|
210
227
|
}, TContext>;
|
|
@@ -235,9 +252,9 @@ declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
|
|
|
235
252
|
params?: DetachAssetParams | undefined;
|
|
236
253
|
}, TContext> | undefined;
|
|
237
254
|
request?: SecondParameter<typeof customInstance>;
|
|
238
|
-
} | undefined) =>
|
|
255
|
+
} | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
|
|
239
256
|
assetId: string;
|
|
240
257
|
params?: DetachAssetParams | undefined;
|
|
241
258
|
}, TContext>;
|
|
242
259
|
|
|
243
|
-
export { AttachAssetMutationError, AttachAssetMutationResult, CreateAssetMutationBody, CreateAssetMutationError, CreateAssetMutationResult, DeleteAssetMutationError, DeleteAssetMutationResult, DetachAssetMutationError, DetachAssetMutationResult, DisableAssetMutationError, DisableAssetMutationResult, EnableAssetMutationError, EnableAssetMutationResult, GetAssetQueryError, GetAssetQueryResult, PatchAssetMutationBody, PatchAssetMutationError, PatchAssetMutationResult, attachAsset, createAsset, deleteAsset, detachAsset, disableAsset, enableAsset, getAsset, getAttachAssetMutationOptions, getCreateAssetMutationOptions, getDeleteAssetMutationOptions, getDetachAssetMutationOptions, getDisableAssetMutationOptions, getEnableAssetMutationOptions, getGetAssetQueryKey, getGetAssetQueryOptions, getPatchAssetMutationOptions, patchAsset, useAttachAsset, useCreateAsset, useDeleteAsset, useDetachAsset, useDisableAsset, useEnableAsset, useGetAsset, usePatchAsset };
|
|
260
|
+
export { type AttachAssetMutationError, type AttachAssetMutationResult, type CreateAssetMutationBody, type CreateAssetMutationError, type CreateAssetMutationResult, type DeleteAssetMutationError, type DeleteAssetMutationResult, type DetachAssetMutationError, type DetachAssetMutationResult, type DisableAssetMutationError, type DisableAssetMutationResult, type EnableAssetMutationError, type EnableAssetMutationResult, type GetAssetQueryError, type GetAssetQueryResult, type GetAssetSuspenseQueryError, type GetAssetSuspenseQueryResult, type PatchAssetMutationBody, type PatchAssetMutationError, type PatchAssetMutationResult, attachAsset, createAsset, deleteAsset, detachAsset, disableAsset, enableAsset, getAsset, getAttachAssetMutationOptions, getCreateAssetMutationOptions, getDeleteAssetMutationOptions, getDetachAssetMutationOptions, getDisableAssetMutationOptions, getEnableAssetMutationOptions, getGetAssetQueryKey, getGetAssetQueryOptions, getGetAssetSuspenseQueryOptions, getPatchAssetMutationOptions, patchAsset, useAttachAsset, useCreateAsset, useDeleteAsset, useDetachAsset, useDisableAsset, useEnableAsset, useGetAsset, useGetAssetSuspense, usePatchAsset };
|
package/asset/asset.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-EBOQPVLG.js";
|
|
4
4
|
|
|
5
5
|
// src/asset/asset.ts
|
|
6
6
|
import {
|
|
7
7
|
useMutation,
|
|
8
|
-
useQuery
|
|
8
|
+
useQuery,
|
|
9
|
+
useSuspenseQuery
|
|
9
10
|
} from "@tanstack/react-query";
|
|
10
11
|
var getAsset = (params, options, signal) => {
|
|
11
12
|
return customInstance(
|
|
12
13
|
{
|
|
13
14
|
url: `/asset`,
|
|
14
|
-
method: "
|
|
15
|
+
method: "GET",
|
|
15
16
|
params,
|
|
16
17
|
signal
|
|
17
18
|
},
|
|
@@ -33,6 +34,18 @@ var useGetAsset = (params, options) => {
|
|
|
33
34
|
query.queryKey = queryOptions.queryKey;
|
|
34
35
|
return query;
|
|
35
36
|
};
|
|
37
|
+
var getGetAssetSuspenseQueryOptions = (params, options) => {
|
|
38
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
39
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAssetQueryKey(params);
|
|
40
|
+
const queryFn = ({ signal }) => getAsset(params, requestOptions, signal);
|
|
41
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
42
|
+
};
|
|
43
|
+
var useGetAssetSuspense = (params, options) => {
|
|
44
|
+
const queryOptions = getGetAssetSuspenseQueryOptions(params, options);
|
|
45
|
+
const query = useSuspenseQuery(queryOptions);
|
|
46
|
+
query.queryKey = queryOptions.queryKey;
|
|
47
|
+
return query;
|
|
48
|
+
};
|
|
36
49
|
var createAsset = (assetPostBodyBody, options) => {
|
|
37
50
|
const formData = new FormData();
|
|
38
51
|
formData.append("name", assetPostBodyBody.name);
|
|
@@ -53,7 +66,7 @@ var createAsset = (assetPostBodyBody, options) => {
|
|
|
53
66
|
return customInstance(
|
|
54
67
|
{
|
|
55
68
|
url: `/asset`,
|
|
56
|
-
method: "
|
|
69
|
+
method: "POST",
|
|
57
70
|
headers: { "Content-Type": "multipart/form-data" },
|
|
58
71
|
data: formData
|
|
59
72
|
},
|
|
@@ -86,7 +99,7 @@ var patchAsset = (assetId, assetPatchBodyBody, options) => {
|
|
|
86
99
|
return customInstance(
|
|
87
100
|
{
|
|
88
101
|
url: `/asset/${assetId}`,
|
|
89
|
-
method: "
|
|
102
|
+
method: "PATCH",
|
|
90
103
|
headers: { "Content-Type": "multipart/form-data" },
|
|
91
104
|
data: formData
|
|
92
105
|
},
|
|
@@ -109,7 +122,7 @@ var deleteAsset = (assetId, options) => {
|
|
|
109
122
|
return customInstance(
|
|
110
123
|
{
|
|
111
124
|
url: `/asset/${assetId}`,
|
|
112
|
-
method: "
|
|
125
|
+
method: "DELETE"
|
|
113
126
|
},
|
|
114
127
|
options
|
|
115
128
|
);
|
|
@@ -130,7 +143,7 @@ var disableAsset = (assetId, options) => {
|
|
|
130
143
|
return customInstance(
|
|
131
144
|
{
|
|
132
145
|
url: `/asset/${assetId}/disable`,
|
|
133
|
-
method: "
|
|
146
|
+
method: "PATCH"
|
|
134
147
|
},
|
|
135
148
|
options
|
|
136
149
|
);
|
|
@@ -151,7 +164,7 @@ var enableAsset = (assetId, options) => {
|
|
|
151
164
|
return customInstance(
|
|
152
165
|
{
|
|
153
166
|
url: `/asset/${assetId}/enable`,
|
|
154
|
-
method: "
|
|
167
|
+
method: "PATCH"
|
|
155
168
|
},
|
|
156
169
|
options
|
|
157
170
|
);
|
|
@@ -172,7 +185,7 @@ var attachAsset = (assetId, params, options) => {
|
|
|
172
185
|
return customInstance(
|
|
173
186
|
{
|
|
174
187
|
url: `/asset/${assetId}/attach`,
|
|
175
|
-
method: "
|
|
188
|
+
method: "PATCH",
|
|
176
189
|
params
|
|
177
190
|
},
|
|
178
191
|
options
|
|
@@ -194,7 +207,7 @@ var detachAsset = (assetId, params, options) => {
|
|
|
194
207
|
return customInstance(
|
|
195
208
|
{
|
|
196
209
|
url: `/asset/${assetId}/detach`,
|
|
197
|
-
method: "
|
|
210
|
+
method: "PATCH",
|
|
198
211
|
params
|
|
199
212
|
},
|
|
200
213
|
options
|
|
@@ -228,6 +241,7 @@ export {
|
|
|
228
241
|
getEnableAssetMutationOptions,
|
|
229
242
|
getGetAssetQueryKey,
|
|
230
243
|
getGetAssetQueryOptions,
|
|
244
|
+
getGetAssetSuspenseQueryOptions,
|
|
231
245
|
getPatchAssetMutationOptions,
|
|
232
246
|
patchAsset,
|
|
233
247
|
useAttachAsset,
|
|
@@ -237,6 +251,7 @@ export {
|
|
|
237
251
|
useDisableAsset,
|
|
238
252
|
useEnableAsset,
|
|
239
253
|
useGetAsset,
|
|
254
|
+
useGetAssetSuspense,
|
|
240
255
|
usePatchAsset
|
|
241
256
|
};
|
|
242
257
|
//# sourceMappingURL=asset.js.map
|
package/asset/asset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.20.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n AssetGetResponse,\n AssetPatchBodyBody,\n AssetPostBodyBody,\n AssetPostResponse,\n AttachAssetParams,\n DetachAssetParams,\n GetAssetParams\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n\n/**\n * Gets Assets you have access to.\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<AssetGetResponse>(\n {url: `/asset`, method: 'get',\n params, signal\n },\n options);\n }\n \n\nexport const getGetAssetQueryKey = (params?: GetAssetParams,) => {\n \n return [\"account-server-api\", `/asset`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetAssetQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>\nexport type GetAssetQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets Assets\n */\nexport const useGetAsset = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(\n params?: GetAssetParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetAssetQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**\n\nAssets are text and file resources that can be requested by **Merchants**. The Data Manager **Merchant** uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nAssets must be *enabled* before they can be used.\n\nThey must also be *attached* to a **Merchant** before the **Merchant** can ue them. Assets are only available to merchants if they are enabled and attached.\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nformData.append('name', assetPostBodyBody.name)\nif(assetPostBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPostBodyBody.content_file)\n }\nif(assetPostBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPostBodyBody.content_string)\n }\nformData.append('scope', assetPostBodyBody.scope)\nif(assetPostBodyBody.scope_id !== undefined) {\n formData.append('scope_id', assetPostBodyBody.scope_id)\n }\nformData.append('secret', assetPostBodyBody.secret.toString())\nif(assetPostBodyBody.description !== undefined) {\n formData.append('description', assetPostBodyBody.description)\n }\n\n return customInstance<AssetPostResponse>(\n {url: `/asset`, method: 'post',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getCreateAssetMutationOptions = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: AssetPostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return createAsset(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>\n export type CreateAssetMutationBody = AssetPostBodyBody\n export type CreateAssetMutationError = ErrorType<AsError | void>\n\n /**\n * @summary Create an Asset\n */\nexport const useCreateAsset = <TError = ErrorType<AsError | void>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getCreateAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Used to update or replace Asset *Content* or *Description*.\n\nThe content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nif(assetPatchBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPatchBodyBody.content_file)\n }\nif(assetPatchBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPatchBodyBody.content_string)\n }\nif(assetPatchBodyBody.description !== undefined) {\n formData.append('description', assetPatchBodyBody.description)\n }\n\n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'patch',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getPatchAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchAsset>>, {assetId: string;data: AssetPatchBodyBody}> = (props) => {\n const {assetId,data} = props ?? {};\n\n return patchAsset(assetId,data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>\n export type PatchAssetMutationBody = AssetPatchBodyBody\n export type PatchAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Adjust an existing Asset\n */\nexport const usePatchAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getPatchAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return deleteAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>\n \n export type DeleteAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes an Asset\n */\nexport const useDeleteAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/disable`, method: 'patch'\n },\n options);\n }\n \n\n\nexport const getDisableAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof disableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return disableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>\n \n export type DisableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Disables an Asset\n */\nexport const useDisableAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDisableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/enable`, method: 'patch'\n },\n options);\n }\n \n\n\nexport const getEnableAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof enableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return enableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>\n \n export type EnableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Enables an Asset\n */\nexport const useEnableAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getEnableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/attach`, method: 'patch',\n params\n },\n options);\n }\n \n\n\nexport const getAttachAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachAsset>>, {assetId: string;params?: AttachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return attachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>\n \n export type AttachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Attaches an Asset to a Merchant\n */\nexport const useAttachAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAttachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Detaches an Asset from a **Merchant**\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/detach`, method: 'patch',\n params\n },\n options);\n }\n \n\n\nexport const getDetachAssetMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof detachAsset>>, {assetId: string;params?: DetachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return detachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>\n \n export type DetachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Detaches an Asset from a Merchant\n */\nexport const useDetachAsset = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDetachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAqCA,IAAM,WAAW,CACpB,QACH,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAU,QAAQ;AAAA,MACtB;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,sBAAsB,CAAC,WAA6B;AAE7D,SAAO,CAAC,sBAAsB,UAAU,GAAI,SAAS,CAAC,MAAM,IAAG,CAAC,CAAE;AAClE;AAGG,IAAM,0BAA0B,CAAmF,QAAyB,YAC9I;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,oBAAoB,MAAM;AAIpE,QAAM,UAA+D,CAAC,EAAE,OAAO,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAM7H,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,cAAc,CAC1B,QAAyB,YAEsC;AAE9D,QAAM,eAAe,wBAAwB,QAAO,OAAO;AAE3D,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAeO,IAAM,cAAc,CACvB,mBACH,YAAsD;AAEjD,QAAM,WAAW,IAAI,SAAS;AACpC,WAAS,OAAO,QAAQ,kBAAkB,IAAI;AAC9C,MAAG,kBAAkB,iBAAiB,QAAW;AAChD,aAAS,OAAO,gBAAgB,kBAAkB,YAAY;AAAA,EAC9D;AACD,MAAG,kBAAkB,mBAAmB,QAAW;AAClD,aAAS,OAAO,kBAAkB,kBAAkB,cAAc;AAAA,EAClE;AACD,WAAS,OAAO,SAAS,kBAAkB,KAAK;AAChD,MAAG,kBAAkB,aAAa,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ACA,QACH,YAAsD;AAGjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,UAAU,OAAO;AAAA,MAAW,QAAQ;AAAA,MACxC;AAAA,IACJ;AAAA,IACE;AAAA,EAAO;AACT;AAIG,IAAM,gCAAgC,CAErB,YACyG;AAChI,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKpE,QAAM,aAAsH,CAAC,UAAU;AACnI,UAAM,EAAC,SAAQ,OAAM,IAAI,SAAS,CAAC;AAEnC,WAAQ,YAAY,SAAQ,QAAO,cAAc;AAAA,EACnD;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,iBAAiB,CAEN,YACnB;AAEC,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.24.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport {\n useMutation,\n useQuery,\n useSuspenseQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n AssetGetResponse,\n AssetPatchBodyBody,\n AssetPostBodyBody,\n AssetPostResponse,\n AttachAssetParams,\n DetachAssetParams,\n GetAssetParams\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\ntype SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n\n/**\n * Gets Assets you have access to.\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<AssetGetResponse>(\n {url: `/asset`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetAssetQueryKey = (params?: GetAssetParams,) => {\n return [\"account-server-api\", `/asset`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetAssetQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>\nexport type GetAssetQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets Assets\n */\nexport const useGetAsset = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(\n params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetAssetQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetAssetSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetAssetSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>\nexport type GetAssetSuspenseQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets Assets\n */\nexport const useGetAssetSuspense = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(\n params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetAssetSuspenseQueryOptions(params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**\n\nAssets are text and file resources that can be requested by **Merchants**. The Data Manager **Merchant** uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nAssets must be *enabled* before they can be used.\n\nThey must also be *attached* to a **Merchant** before the **Merchant** can ue them. Assets are only available to merchants if they are enabled and attached.\n\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nformData.append('name', assetPostBodyBody.name)\nif(assetPostBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPostBodyBody.content_file)\n }\nif(assetPostBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPostBodyBody.content_string)\n }\nformData.append('scope', assetPostBodyBody.scope)\nif(assetPostBodyBody.scope_id !== undefined) {\n formData.append('scope_id', assetPostBodyBody.scope_id)\n }\nformData.append('secret', assetPostBodyBody.secret.toString())\nif(assetPostBodyBody.description !== undefined) {\n formData.append('description', assetPostBodyBody.description)\n }\n\n return customInstance<AssetPostResponse>(\n {url: `/asset`, method: 'POST',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getCreateAssetMutationOptions = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: AssetPostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return createAsset(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>\n export type CreateAssetMutationBody = AssetPostBodyBody\n export type CreateAssetMutationError = ErrorType<AsError | void>\n\n /**\n * @summary Create an Asset\n */\nexport const useCreateAsset = <TError = ErrorType<AsError | void>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getCreateAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Used to update or replace Asset *Content* or *Description*.\n\nThe content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.\n\n * @summary Adjust an existing Asset\n */\nexport const patchAsset = (\n assetId: string,\n assetPatchBodyBody: AssetPatchBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nif(assetPatchBodyBody.content_file !== undefined) {\n formData.append('content_file', assetPatchBodyBody.content_file)\n }\nif(assetPatchBodyBody.content_string !== undefined) {\n formData.append('content_string', assetPatchBodyBody.content_string)\n }\nif(assetPatchBodyBody.description !== undefined) {\n formData.append('description', assetPatchBodyBody.description)\n }\n\n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'PATCH',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getPatchAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchAsset>>, {assetId: string;data: AssetPatchBodyBody}> = (props) => {\n const {assetId,data} = props ?? {};\n\n return patchAsset(assetId,data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>\n export type PatchAssetMutationBody = AssetPatchBodyBody\n export type PatchAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Adjust an existing Asset\n */\nexport const usePatchAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getPatchAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted\n\n * @summary Deletes an Asset\n */\nexport const deleteAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}`, method: 'DELETE'\n },\n options);\n }\n \n\n\nexport const getDeleteAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return deleteAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>\n \n export type DeleteAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes an Asset\n */\nexport const useDeleteAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Disables a known Asset\n\n * @summary Disables an Asset\n */\nexport const disableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/disable`, method: 'PATCH'\n },\n options);\n }\n \n\n\nexport const getDisableAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof disableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return disableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>\n \n export type DisableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Disables an Asset\n */\nexport const useDisableAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDisableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Enables a known Asset\n\n * @summary Enables an Asset\n */\nexport const enableAsset = (\n assetId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/enable`, method: 'PATCH'\n },\n options);\n }\n \n\n\nexport const getEnableAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof enableAsset>>, {assetId: string}> = (props) => {\n const {assetId} = props ?? {};\n\n return enableAsset(assetId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>\n \n export type EnableAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Enables an Asset\n */\nexport const useEnableAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getEnableAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.\n\n * @summary Attaches an Asset to a Merchant\n */\nexport const attachAsset = (\n assetId: string,\n params?: AttachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/attach`, method: 'PATCH',\n params\n },\n options);\n }\n \n\n\nexport const getAttachAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachAsset>>, {assetId: string;params?: AttachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return attachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>\n \n export type AttachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Attaches an Asset to a Merchant\n */\nexport const useAttachAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAttachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Detaches an Asset from a **Merchant**\n\n * @summary Detaches an Asset from a Merchant\n */\nexport const detachAsset = (\n assetId: string,\n params?: DetachAssetParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/asset/${assetId}/detach`, method: 'PATCH',\n params\n },\n options);\n }\n \n\n\nexport const getDetachAssetMutationOptions = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof detachAsset>>, {assetId: string;params?: DetachAssetParams}> = (props) => {\n const {assetId,params} = props ?? {};\n\n return detachAsset(assetId,params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>\n \n export type DetachAssetMutationError = ErrorType<AsError>\n\n /**\n * @summary Detaches an Asset from a Merchant\n */\nexport const useDetachAsset = <TError = ErrorType<AsError>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDetachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiCA,IAAM,WAAW,CACpB,QACH,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAU,QAAQ;AAAA,MACtB;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT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AAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;AAMG,IAAM,cAAc,CACvB,SACA,QACH,YAAsD;AAGjD,SAAO;AAAA,IACP;AAAA,MAAC,KAAK,UAAU,OAAO;AAAA,MAAW,QAAQ;AAAA,MACxC;AAAA,IACJ;AAAA,IACE;AAAA,EAAO;AACT;AAIG,IAAM,gCAAgC,CACrB,YACyG;AAChI,QAAM,EAAC,UAAU,iBAAiB,SAAS,eAAc,IAAI,WAAW,CAAC;AAKpE,QAAM,aAAsH,CAAC,UAAU;AACnI,UAAM,EAAC,SAAQ,OAAM,IAAI,SAAS,CAAC;AAEnC,WAAQ,YAAY,SAAQ,QAAO,cAAc;AAAA,EACnD;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,iBAAiB,CACN,YACnB;AAEC,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
|
@@ -13,7 +13,7 @@ var customInstance = (config, options) => {
|
|
|
13
13
|
({ data }) => data
|
|
14
14
|
);
|
|
15
15
|
promise.cancel = () => {
|
|
16
|
-
source.cancel("Query was cancelled
|
|
16
|
+
source.cancel("Query was cancelled");
|
|
17
17
|
};
|
|
18
18
|
return promise;
|
|
19
19
|
};
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
setBaseUrl,
|
|
25
25
|
customInstance
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-EBOQPVLG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n //
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel('Query was cancelled');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU,KAAK;AAC3E;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAGA,UAAQ,SAAS,MAAM;AACrB,WAAO,OAAO,qBAAqB;AAAA,EACrC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -13,7 +13,7 @@ var customInstance = (config, options) => {
|
|
|
13
13
|
({ data }) => data
|
|
14
14
|
);
|
|
15
15
|
promise.cancel = () => {
|
|
16
|
-
source.cancel("Query was cancelled
|
|
16
|
+
source.cancel("Query was cancelled");
|
|
17
17
|
};
|
|
18
18
|
return promise;
|
|
19
19
|
};
|
|
@@ -24,4 +24,4 @@ var customInstance = (config, options) => {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-TKLTUR4R.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU,KAAK;AAC3E;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAGA,UAAQ,SAAS,MAAM;AACrB,WAAO,OAAO,qBAAqB;AAAA,EACrC;AAEA,SAAO;AACT","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel('Query was cancelled');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkTKLTUR4Rcjs = require('../chunk-TKLTUR4R.cjs');
|
|
4
4
|
|
|
5
5
|
// src/event-stream/event-stream.ts
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
var _reactquery = require('@tanstack/react-query');
|
|
10
11
|
var getEventStream = (options, signal) => {
|
|
11
|
-
return
|
|
12
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
12
13
|
{
|
|
13
14
|
url: `/event-stream`,
|
|
14
|
-
method: "
|
|
15
|
+
method: "GET",
|
|
15
16
|
signal
|
|
16
17
|
},
|
|
17
18
|
options
|
|
@@ -32,11 +33,23 @@ var useGetEventStream = (options) => {
|
|
|
32
33
|
query.queryKey = queryOptions.queryKey;
|
|
33
34
|
return query;
|
|
34
35
|
};
|
|
36
|
+
var getGetEventStreamSuspenseQueryOptions = (options) => {
|
|
37
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
38
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamQueryKey()));
|
|
39
|
+
const queryFn = ({ signal }) => getEventStream(requestOptions, signal);
|
|
40
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
41
|
+
};
|
|
42
|
+
var useGetEventStreamSuspense = (options) => {
|
|
43
|
+
const queryOptions = getGetEventStreamSuspenseQueryOptions(options);
|
|
44
|
+
const query = _reactquery.useSuspenseQuery.call(void 0, queryOptions);
|
|
45
|
+
query.queryKey = queryOptions.queryKey;
|
|
46
|
+
return query;
|
|
47
|
+
};
|
|
35
48
|
var createEventStream = (options) => {
|
|
36
|
-
return
|
|
49
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
37
50
|
{
|
|
38
51
|
url: `/event-stream`,
|
|
39
|
-
method: "
|
|
52
|
+
method: "POST"
|
|
40
53
|
},
|
|
41
54
|
options
|
|
42
55
|
);
|
|
@@ -53,10 +66,10 @@ var useCreateEventStream = (options) => {
|
|
|
53
66
|
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
54
67
|
};
|
|
55
68
|
var getEventStreamEvents = (eventStreamId, options, signal) => {
|
|
56
|
-
return
|
|
69
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
57
70
|
{
|
|
58
71
|
url: `/event-stream/${eventStreamId}`,
|
|
59
|
-
method: "
|
|
72
|
+
method: "GET",
|
|
60
73
|
signal
|
|
61
74
|
},
|
|
62
75
|
options
|
|
@@ -77,11 +90,23 @@ var useGetEventStreamEvents = (eventStreamId, options) => {
|
|
|
77
90
|
query.queryKey = queryOptions.queryKey;
|
|
78
91
|
return query;
|
|
79
92
|
};
|
|
93
|
+
var getGetEventStreamEventsSuspenseQueryOptions = (eventStreamId, options) => {
|
|
94
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
95
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetEventStreamEventsQueryKey(eventStreamId)));
|
|
96
|
+
const queryFn = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
|
|
97
|
+
return { queryKey, queryFn, enabled: !!eventStreamId, ...queryOptions };
|
|
98
|
+
};
|
|
99
|
+
var useGetEventStreamEventsSuspense = (eventStreamId, options) => {
|
|
100
|
+
const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId, options);
|
|
101
|
+
const query = _reactquery.useSuspenseQuery.call(void 0, queryOptions);
|
|
102
|
+
query.queryKey = queryOptions.queryKey;
|
|
103
|
+
return query;
|
|
104
|
+
};
|
|
80
105
|
var deleteEventStream = (eventStreamId, options) => {
|
|
81
|
-
return
|
|
106
|
+
return _chunkTKLTUR4Rcjs.customInstance.call(void 0,
|
|
82
107
|
{
|
|
83
108
|
url: `/event-stream/${eventStreamId}`,
|
|
84
|
-
method: "
|
|
109
|
+
method: "DELETE"
|
|
85
110
|
},
|
|
86
111
|
options
|
|
87
112
|
);
|
|
@@ -113,5 +138,9 @@ var useDeleteEventStream = (options) => {
|
|
|
113
138
|
|
|
114
139
|
|
|
115
140
|
|
|
116
|
-
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
exports.createEventStream = createEventStream; exports.deleteEventStream = deleteEventStream; exports.getCreateEventStreamMutationOptions = getCreateEventStreamMutationOptions; exports.getDeleteEventStreamMutationOptions = getDeleteEventStreamMutationOptions; exports.getEventStream = getEventStream; exports.getEventStreamEvents = getEventStreamEvents; exports.getGetEventStreamEventsQueryKey = getGetEventStreamEventsQueryKey; exports.getGetEventStreamEventsQueryOptions = getGetEventStreamEventsQueryOptions; exports.getGetEventStreamEventsSuspenseQueryOptions = getGetEventStreamEventsSuspenseQueryOptions; exports.getGetEventStreamQueryKey = getGetEventStreamQueryKey; exports.getGetEventStreamQueryOptions = getGetEventStreamQueryOptions; exports.getGetEventStreamSuspenseQueryOptions = getGetEventStreamSuspenseQueryOptions; exports.useCreateEventStream = useCreateEventStream; exports.useDeleteEventStream = useDeleteEventStream; exports.useGetEventStream = useGetEventStream; exports.useGetEventStreamEvents = useGetEventStreamEvents; exports.useGetEventStreamEventsSuspense = useGetEventStreamEventsSuspense; exports.useGetEventStreamSuspense = useGetEventStreamSuspense;
|
|
117
146
|
//# sourceMappingURL=event-stream.cjs.map
|