@squonk/account-server-client 2.0.6 → 2.0.7

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.
Files changed (70) hide show
  1. package/admin/admin.cjs +14 -7
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.cts +33 -0
  4. package/admin/admin.d.ts +4 -1
  5. package/admin/admin.js +14 -7
  6. package/admin/admin.js.map +1 -1
  7. package/asset/asset.cjs +44 -19
  8. package/asset/asset.cjs.map +1 -1
  9. package/asset/asset.d.cts +241 -0
  10. package/asset/asset.d.ts +43 -19
  11. package/asset/asset.js +37 -12
  12. package/asset/asset.js.map +1 -1
  13. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  14. package/chunk-J22A7LHX.cjs.map +1 -0
  15. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  16. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  17. package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
  18. package/index.cjs +10 -10
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +2 -0
  21. package/index.d.ts +1 -1
  22. package/index.js +9 -9
  23. package/index.js.map +1 -1
  24. package/merchant/merchant.cjs +23 -13
  25. package/merchant/merchant.cjs.map +1 -1
  26. package/merchant/merchant.d.cts +57 -0
  27. package/merchant/merchant.d.ts +7 -1
  28. package/merchant/merchant.js +22 -12
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +50 -25
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.cts +203 -0
  33. package/organisation/organisation.d.ts +31 -10
  34. package/organisation/organisation.js +44 -19
  35. package/organisation/organisation.js.map +1 -1
  36. package/package.json +12 -12
  37. package/product/product.cjs +80 -44
  38. package/product/product.cjs.map +1 -1
  39. package/product/product.d.cts +280 -0
  40. package/product/product.d.ts +40 -10
  41. package/product/product.js +71 -35
  42. package/product/product.js.map +1 -1
  43. package/src/account-server-api.schemas.ts +268 -276
  44. package/src/admin/admin.ts +72 -78
  45. package/src/asset/asset.ts +447 -556
  46. package/src/merchant/merchant.ts +125 -136
  47. package/src/organisation/organisation.ts +394 -484
  48. package/src/product/product.ts +557 -682
  49. package/src/state/state.ts +70 -69
  50. package/src/unit/unit.ts +494 -593
  51. package/src/user/user.ts +377 -463
  52. package/state/state.cjs +13 -7
  53. package/state/state.cjs.map +1 -1
  54. package/state/state.d.cts +29 -0
  55. package/state/state.d.ts +4 -1
  56. package/state/state.js +13 -7
  57. package/state/state.js.map +1 -1
  58. package/unit/unit.cjs +59 -28
  59. package/unit/unit.cjs.map +1 -1
  60. package/unit/unit.d.cts +254 -0
  61. package/unit/unit.d.ts +43 -16
  62. package/unit/unit.js +52 -21
  63. package/unit/unit.js.map +1 -1
  64. package/user/user.cjs +52 -21
  65. package/user/user.cjs.map +1 -1
  66. package/user/user.d.cts +220 -0
  67. package/user/user.d.ts +31 -10
  68. package/user/user.js +46 -15
  69. package/user/user.js.map +1 -1
  70. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -0,0 +1,241 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
3
+ import { g as GetAssetParams, aE as customInstance, az as AssetGetResponse, aF as ErrorType, aA as AsError, s as AssetPostBodyBody, ay as AssetPostResponse, t as AssetPatchBodyBody, A as AttachAssetParams, D as DetachAssetParams } from '../custom-instance-13ade7a9.js';
4
+ import 'axios';
5
+
6
+ type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
+ /**
8
+ * Gets Assets you have access to.
9
+
10
+ Assets are text and file resources that can be attached to (have a *scope* that applies to) **User** accounts, **Products**, **Units**, **Organisations** or can be **Global**. Assets can be requested by **Merchants**. The Data Manager uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.
11
+
12
+ Users must *attach* an Asset to a **Merchant** before the **Merchant** can ue it
13
+
14
+ * @summary Gets Assets
15
+ */
16
+ declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
17
+ declare const getGetAssetQueryKey: (params?: GetAssetParams) => readonly ["account-server-api", "/asset", ...GetAssetParams[]];
18
+ declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
19
+ query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
20
+ request?: SecondParameter<typeof customInstance>;
21
+ } | undefined) => UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
22
+ queryKey: QueryKey;
23
+ };
24
+ type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
25
+ type GetAssetQueryError = ErrorType<AsError | void>;
26
+ /**
27
+ * @summary Gets Assets
28
+ */
29
+ declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
30
+ query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
31
+ request?: SecondParameter<typeof customInstance>;
32
+ } | undefined) => UseQueryResult<TData, TError> & {
33
+ queryKey: QueryKey;
34
+ };
35
+ /**
36
+ * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
37
+
38
+ * @summary Create an Asset
39
+ */
40
+ declare const createAsset: (assetPostBodyBody: AssetPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<AssetPostResponse>;
41
+ declare const getCreateAssetMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
42
+ mutation?: UseMutationOptions<AssetPostResponse, TError, {
43
+ data: AssetPostBodyBody;
44
+ }, TContext> | undefined;
45
+ request?: SecondParameter<typeof customInstance>;
46
+ } | undefined) => UseMutationOptions<AssetPostResponse, TError, {
47
+ data: AssetPostBodyBody;
48
+ }, TContext>;
49
+ type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>;
50
+ type CreateAssetMutationBody = AssetPostBodyBody;
51
+ type CreateAssetMutationError = ErrorType<AsError | void>;
52
+ /**
53
+ * @summary Create an Asset
54
+ */
55
+ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
56
+ mutation?: UseMutationOptions<AssetPostResponse, TError, {
57
+ data: AssetPostBodyBody;
58
+ }, TContext> | undefined;
59
+ request?: SecondParameter<typeof customInstance>;
60
+ } | undefined) => _tanstack_react_query.UseMutationResult<AssetPostResponse, TError, {
61
+ data: AssetPostBodyBody;
62
+ }, TContext>;
63
+ /**
64
+ * Used to update or replace Asset *Content* or *Description*.
65
+
66
+ The 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.
67
+
68
+ * @summary Adjust an existing Asset
69
+ */
70
+ declare const patchAsset: (assetId: string, assetPatchBodyBody: AssetPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
71
+ declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
72
+ mutation?: UseMutationOptions<void, TError, {
73
+ assetId: string;
74
+ data: AssetPatchBodyBody;
75
+ }, TContext> | undefined;
76
+ request?: SecondParameter<typeof customInstance>;
77
+ } | undefined) => UseMutationOptions<void, TError, {
78
+ assetId: string;
79
+ data: AssetPatchBodyBody;
80
+ }, TContext>;
81
+ type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>;
82
+ type PatchAssetMutationBody = AssetPatchBodyBody;
83
+ type PatchAssetMutationError = ErrorType<AsError>;
84
+ /**
85
+ * @summary Adjust an existing Asset
86
+ */
87
+ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
88
+ mutation?: UseMutationOptions<void, TError, {
89
+ assetId: string;
90
+ data: AssetPatchBodyBody;
91
+ }, TContext> | undefined;
92
+ request?: SecondParameter<typeof customInstance>;
93
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
94
+ assetId: string;
95
+ data: AssetPatchBodyBody;
96
+ }, TContext>;
97
+ /**
98
+ * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
99
+
100
+ * @summary Deletes an Asset
101
+ */
102
+ declare const deleteAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
103
+ declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
104
+ mutation?: UseMutationOptions<void, TError, {
105
+ assetId: string;
106
+ }, TContext> | undefined;
107
+ request?: SecondParameter<typeof customInstance>;
108
+ } | undefined) => UseMutationOptions<void, TError, {
109
+ assetId: string;
110
+ }, TContext>;
111
+ type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>;
112
+ type DeleteAssetMutationError = ErrorType<AsError>;
113
+ /**
114
+ * @summary Deletes an Asset
115
+ */
116
+ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
117
+ mutation?: UseMutationOptions<void, TError, {
118
+ assetId: string;
119
+ }, TContext> | undefined;
120
+ request?: SecondParameter<typeof customInstance>;
121
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
122
+ assetId: string;
123
+ }, TContext>;
124
+ /**
125
+ * Disables a known Asset
126
+
127
+ * @summary Disables an Asset
128
+ */
129
+ declare const disableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
130
+ declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
131
+ mutation?: UseMutationOptions<void, TError, {
132
+ assetId: string;
133
+ }, TContext> | undefined;
134
+ request?: SecondParameter<typeof customInstance>;
135
+ } | undefined) => UseMutationOptions<void, TError, {
136
+ assetId: string;
137
+ }, TContext>;
138
+ type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>;
139
+ type DisableAssetMutationError = ErrorType<AsError>;
140
+ /**
141
+ * @summary Disables an Asset
142
+ */
143
+ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
144
+ mutation?: UseMutationOptions<void, TError, {
145
+ assetId: string;
146
+ }, TContext> | undefined;
147
+ request?: SecondParameter<typeof customInstance>;
148
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
149
+ assetId: string;
150
+ }, TContext>;
151
+ /**
152
+ * Enables a known Asset
153
+
154
+ * @summary Enables an Asset
155
+ */
156
+ declare const enableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
157
+ declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
158
+ mutation?: UseMutationOptions<void, TError, {
159
+ assetId: string;
160
+ }, TContext> | undefined;
161
+ request?: SecondParameter<typeof customInstance>;
162
+ } | undefined) => UseMutationOptions<void, TError, {
163
+ assetId: string;
164
+ }, TContext>;
165
+ type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>;
166
+ type EnableAssetMutationError = ErrorType<AsError>;
167
+ /**
168
+ * @summary Enables an Asset
169
+ */
170
+ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
171
+ mutation?: UseMutationOptions<void, TError, {
172
+ assetId: string;
173
+ }, TContext> | undefined;
174
+ request?: SecondParameter<typeof customInstance>;
175
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
176
+ assetId: string;
177
+ }, TContext>;
178
+ /**
179
+ * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
180
+
181
+ * @summary Attaches an Asset to a Merchant
182
+ */
183
+ declare const attachAsset: (assetId: string, params?: AttachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
184
+ declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
185
+ mutation?: UseMutationOptions<void, TError, {
186
+ assetId: string;
187
+ params?: AttachAssetParams | undefined;
188
+ }, TContext> | undefined;
189
+ request?: SecondParameter<typeof customInstance>;
190
+ } | undefined) => UseMutationOptions<void, TError, {
191
+ assetId: string;
192
+ params?: AttachAssetParams | undefined;
193
+ }, TContext>;
194
+ type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>;
195
+ type AttachAssetMutationError = ErrorType<AsError>;
196
+ /**
197
+ * @summary Attaches an Asset to a Merchant
198
+ */
199
+ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
200
+ mutation?: UseMutationOptions<void, TError, {
201
+ assetId: string;
202
+ params?: AttachAssetParams | undefined;
203
+ }, TContext> | undefined;
204
+ request?: SecondParameter<typeof customInstance>;
205
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
206
+ assetId: string;
207
+ params?: AttachAssetParams | undefined;
208
+ }, TContext>;
209
+ /**
210
+ * Detaches an Asset from a **Merchant**
211
+
212
+ * @summary Detaches an Asset from a Merchant
213
+ */
214
+ declare const detachAsset: (assetId: string, params?: DetachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
215
+ declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
216
+ mutation?: UseMutationOptions<void, TError, {
217
+ assetId: string;
218
+ params?: DetachAssetParams | undefined;
219
+ }, TContext> | undefined;
220
+ request?: SecondParameter<typeof customInstance>;
221
+ } | undefined) => UseMutationOptions<void, TError, {
222
+ assetId: string;
223
+ params?: DetachAssetParams | undefined;
224
+ }, TContext>;
225
+ type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>;
226
+ type DetachAssetMutationError = ErrorType<AsError>;
227
+ /**
228
+ * @summary Detaches an Asset from a Merchant
229
+ */
230
+ declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
231
+ mutation?: UseMutationOptions<void, TError, {
232
+ assetId: string;
233
+ params?: DetachAssetParams | undefined;
234
+ }, TContext> | undefined;
235
+ request?: SecondParameter<typeof customInstance>;
236
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
237
+ assetId: string;
238
+ params?: DetachAssetParams | undefined;
239
+ }, TContext>;
240
+
241
+ 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 };
package/asset/asset.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
3
- import { g as GetAssetParams, aE as customInstance, az as AssetGetResponse, aF as ErrorType, aA as AsError, s as AssetPostBodyBody, ay as AssetPostResponse, t as AssetPatchBodyBody, A as AttachAssetParams, D as DetachAssetParams } from '../custom-instance-f32f6506.js';
3
+ import { g as GetAssetParams, aE as customInstance, az as AssetGetResponse, aF as ErrorType, aA as AsError, s as AssetPostBodyBody, ay as AssetPostResponse, t as AssetPatchBodyBody, A as AttachAssetParams, D as DetachAssetParams } from '../custom-instance-13ade7a9.js';
4
4
  import 'axios';
5
5
 
6
6
  type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
@@ -23,6 +23,9 @@ declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = Error
23
23
  };
24
24
  type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
25
25
  type GetAssetQueryError = ErrorType<AsError | void>;
26
+ /**
27
+ * @summary Gets Assets
28
+ */
26
29
  declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
27
30
  query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
28
31
  request?: SecondParameter<typeof customInstance>;
@@ -46,6 +49,9 @@ declare const getCreateAssetMutationOptions: <TError = ErrorType<void | AsError>
46
49
  type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>;
47
50
  type CreateAssetMutationBody = AssetPostBodyBody;
48
51
  type CreateAssetMutationError = ErrorType<AsError | void>;
52
+ /**
53
+ * @summary Create an Asset
54
+ */
49
55
  declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
50
56
  mutation?: UseMutationOptions<AssetPostResponse, TError, {
51
57
  data: AssetPostBodyBody;
@@ -55,12 +61,12 @@ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = un
55
61
  data: AssetPostBodyBody;
56
62
  }, TContext>;
57
63
  /**
58
- * Used to update or replace Asset *Content* or *Description*.
64
+ * Used to update or replace Asset *Content* or *Description*.
59
65
 
60
66
  The 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.
61
67
 
62
- * @summary Adjust an existing Asset
63
- */
68
+ * @summary Adjust an existing Asset
69
+ */
64
70
  declare const patchAsset: (assetId: string, assetPatchBodyBody: AssetPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
65
71
  declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
66
72
  mutation?: UseMutationOptions<void, TError, {
@@ -75,6 +81,9 @@ declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TConte
75
81
  type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>;
76
82
  type PatchAssetMutationBody = AssetPatchBodyBody;
77
83
  type PatchAssetMutationError = ErrorType<AsError>;
84
+ /**
85
+ * @summary Adjust an existing Asset
86
+ */
78
87
  declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
79
88
  mutation?: UseMutationOptions<void, TError, {
80
89
  assetId: string;
@@ -86,10 +95,10 @@ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(o
86
95
  data: AssetPatchBodyBody;
87
96
  }, TContext>;
88
97
  /**
89
- * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
98
+ * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
90
99
 
91
- * @summary Deletes an Asset
92
- */
100
+ * @summary Deletes an Asset
101
+ */
93
102
  declare const deleteAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
94
103
  declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
95
104
  mutation?: UseMutationOptions<void, TError, {
@@ -101,6 +110,9 @@ declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TCont
101
110
  }, TContext>;
102
111
  type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>;
103
112
  type DeleteAssetMutationError = ErrorType<AsError>;
113
+ /**
114
+ * @summary Deletes an Asset
115
+ */
104
116
  declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
105
117
  mutation?: UseMutationOptions<void, TError, {
106
118
  assetId: string;
@@ -110,10 +122,10 @@ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(
110
122
  assetId: string;
111
123
  }, TContext>;
112
124
  /**
113
- * Disables a known Asset
125
+ * Disables a known Asset
114
126
 
115
- * @summary Disables an Asset
116
- */
127
+ * @summary Disables an Asset
128
+ */
117
129
  declare const disableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
118
130
  declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
119
131
  mutation?: UseMutationOptions<void, TError, {
@@ -125,6 +137,9 @@ declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TCon
125
137
  }, TContext>;
126
138
  type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>;
127
139
  type DisableAssetMutationError = ErrorType<AsError>;
140
+ /**
141
+ * @summary Disables an Asset
142
+ */
128
143
  declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
129
144
  mutation?: UseMutationOptions<void, TError, {
130
145
  assetId: string;
@@ -134,10 +149,10 @@ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>
134
149
  assetId: string;
135
150
  }, TContext>;
136
151
  /**
137
- * Enables a known Asset
152
+ * Enables a known Asset
138
153
 
139
- * @summary Enables an Asset
140
- */
154
+ * @summary Enables an Asset
155
+ */
141
156
  declare const enableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
142
157
  declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
143
158
  mutation?: UseMutationOptions<void, TError, {
@@ -149,6 +164,9 @@ declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TCont
149
164
  }, TContext>;
150
165
  type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>;
151
166
  type EnableAssetMutationError = ErrorType<AsError>;
167
+ /**
168
+ * @summary Enables an Asset
169
+ */
152
170
  declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
153
171
  mutation?: UseMutationOptions<void, TError, {
154
172
  assetId: string;
@@ -158,10 +176,10 @@ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(
158
176
  assetId: string;
159
177
  }, TContext>;
160
178
  /**
161
- * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
179
+ * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
162
180
 
163
- * @summary Attaches an Asset to a Merchant
164
- */
181
+ * @summary Attaches an Asset to a Merchant
182
+ */
165
183
  declare const attachAsset: (assetId: string, params?: AttachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
166
184
  declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
167
185
  mutation?: UseMutationOptions<void, TError, {
@@ -175,6 +193,9 @@ declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TCont
175
193
  }, TContext>;
176
194
  type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>;
177
195
  type AttachAssetMutationError = ErrorType<AsError>;
196
+ /**
197
+ * @summary Attaches an Asset to a Merchant
198
+ */
178
199
  declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
179
200
  mutation?: UseMutationOptions<void, TError, {
180
201
  assetId: string;
@@ -186,10 +207,10 @@ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(
186
207
  params?: AttachAssetParams | undefined;
187
208
  }, TContext>;
188
209
  /**
189
- * Detaches an Asset from a **Merchant**
210
+ * Detaches an Asset from a **Merchant**
190
211
 
191
- * @summary Detaches an Asset from a Merchant
192
- */
212
+ * @summary Detaches an Asset from a Merchant
213
+ */
193
214
  declare const detachAsset: (assetId: string, params?: DetachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
194
215
  declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
195
216
  mutation?: UseMutationOptions<void, TError, {
@@ -203,6 +224,9 @@ declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TCont
203
224
  }, TContext>;
204
225
  type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>;
205
226
  type DetachAssetMutationError = ErrorType<AsError>;
227
+ /**
228
+ * @summary Detaches an Asset from a Merchant
229
+ */
206
230
  declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
207
231
  mutation?: UseMutationOptions<void, TError, {
208
232
  assetId: string;
package/asset/asset.js CHANGED
@@ -1,22 +1,30 @@
1
1
  import {
2
2
  customInstance
3
- } from "../chunk-3RNIDX7T.js";
3
+ } from "../chunk-UKA7G3OB.js";
4
4
 
5
5
  // src/asset/asset.ts
6
- import { useQuery, useMutation } from "@tanstack/react-query";
6
+ import {
7
+ useMutation,
8
+ useQuery
9
+ } from "@tanstack/react-query";
7
10
  var getAsset = (params, options, signal) => {
8
11
  return customInstance(
9
- { url: `/asset`, method: "get", params, signal },
12
+ {
13
+ url: `/asset`,
14
+ method: "get",
15
+ params,
16
+ signal
17
+ },
10
18
  options
11
19
  );
12
20
  };
13
- var getGetAssetQueryKey = (params) => ["account-server-api", `/asset`, ...params ? [params] : []];
21
+ var getGetAssetQueryKey = (params) => {
22
+ return ["account-server-api", `/asset`, ...params ? [params] : []];
23
+ };
14
24
  var getGetAssetQueryOptions = (params, options) => {
15
25
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
26
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAssetQueryKey(params);
17
- const queryFn = ({
18
- signal
19
- }) => getAsset(params, requestOptions, signal);
27
+ const queryFn = ({ signal }) => getAsset(params, requestOptions, signal);
20
28
  return { queryKey, queryFn, ...queryOptions };
21
29
  };
22
30
  var useGetAsset = (params, options) => {
@@ -99,7 +107,10 @@ var usePatchAsset = (options) => {
99
107
  };
100
108
  var deleteAsset = (assetId, options) => {
101
109
  return customInstance(
102
- { url: `/asset/${assetId}`, method: "delete" },
110
+ {
111
+ url: `/asset/${assetId}`,
112
+ method: "delete"
113
+ },
103
114
  options
104
115
  );
105
116
  };
@@ -117,7 +128,10 @@ var useDeleteAsset = (options) => {
117
128
  };
118
129
  var disableAsset = (assetId, options) => {
119
130
  return customInstance(
120
- { url: `/asset/${assetId}/disable`, method: "patch" },
131
+ {
132
+ url: `/asset/${assetId}/disable`,
133
+ method: "patch"
134
+ },
121
135
  options
122
136
  );
123
137
  };
@@ -135,7 +149,10 @@ var useDisableAsset = (options) => {
135
149
  };
136
150
  var enableAsset = (assetId, options) => {
137
151
  return customInstance(
138
- { url: `/asset/${assetId}/enable`, method: "patch" },
152
+ {
153
+ url: `/asset/${assetId}/enable`,
154
+ method: "patch"
155
+ },
139
156
  options
140
157
  );
141
158
  };
@@ -153,7 +170,11 @@ var useEnableAsset = (options) => {
153
170
  };
154
171
  var attachAsset = (assetId, params, options) => {
155
172
  return customInstance(
156
- { url: `/asset/${assetId}/attach`, method: "patch", params },
173
+ {
174
+ url: `/asset/${assetId}/attach`,
175
+ method: "patch",
176
+ params
177
+ },
157
178
  options
158
179
  );
159
180
  };
@@ -171,7 +192,11 @@ var useAttachAsset = (options) => {
171
192
  };
172
193
  var detachAsset = (assetId, params, options) => {
173
194
  return customInstance(
174
- { url: `/asset/${assetId}/detach`, method: "patch", params },
195
+ {
196
+ url: `/asset/${assetId}/detach`,
197
+ method: "patch",
198
+ params
199
+ },
175
200
  options
176
201
  );
177
202
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/asset/asset.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.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.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n AssetGetResponse,\n AsError,\n GetAssetParams,\n AssetPostResponse,\n AssetPostBodyBody,\n AssetPatchBodyBody,\n AttachAssetParams,\n DetachAssetParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Assets you have access to.\n\nAssets are text and file resources that can be attached to (have a *scope* that applies to) **User** accounts, **Products**, **Units**, **Organisations** or can be **Global**. Assets can be requested by **Merchants**. The Data Manager uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nUsers must *attach* an Asset to a **Merchant** before the **Merchant** can ue it\n\n * @summary Gets Assets\n */\nexport const getAsset = (\n params?: GetAssetParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<AssetGetResponse>(\n { url: `/asset`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetAssetQueryKey = (params?: GetAssetParams) =>\n [\"account-server-api\", `/asset`, ...(params ? [params] : [])] as const;\n\nexport const getGetAssetQueryOptions = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({\n signal,\n }) => getAsset(params, requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetAssetQueryResult = NonNullable<\n Awaited<ReturnType<typeof getAsset>>\n>;\nexport type GetAssetQueryError = ErrorType<AsError | void>;\n\nexport const useGetAsset = <\n TData = Awaited<ReturnType<typeof getAsset>>,\n TError = ErrorType<AsError | void>\n>(\n params?: GetAssetParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getAsset>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetAssetQueryOptions(params, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\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\n * @summary Create an Asset\n */\nexport const createAsset = (\n assetPostBodyBody: AssetPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"name\", assetPostBodyBody.name);\n if (assetPostBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPostBodyBody.content_file);\n }\n if (assetPostBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPostBodyBody.content_string);\n }\n formData.append(\"scope\", assetPostBodyBody.scope);\n if (assetPostBodyBody.scope_id !== undefined) {\n formData.append(\"scope_id\", assetPostBodyBody.scope_id);\n }\n formData.append(\"secret\", assetPostBodyBody.secret.toString());\n if (assetPostBodyBody.description !== undefined) {\n formData.append(\"description\", assetPostBodyBody.description);\n }\n\n return customInstance<AssetPostResponse>(\n {\n url: `/asset`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getCreateAssetMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createAsset>>,\n { data: AssetPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createAsset(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof createAsset>>\n>;\nexport type CreateAssetMutationBody = AssetPostBodyBody;\nexport type CreateAssetMutationError = ErrorType<AsError | void>;\n\nexport const useCreateAsset = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createAsset>>,\n TError,\n { data: AssetPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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();\n if (assetPatchBodyBody.content_file !== undefined) {\n formData.append(\"content_file\", assetPatchBodyBody.content_file);\n }\n if (assetPatchBodyBody.content_string !== undefined) {\n formData.append(\"content_string\", assetPatchBodyBody.content_string);\n }\n if (assetPatchBodyBody.description !== undefined) {\n formData.append(\"description\", assetPatchBodyBody.description);\n }\n\n return customInstance<void>(\n {\n url: `/asset/${assetId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getPatchAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchAsset>>,\n { assetId: string; data: AssetPatchBodyBody }\n > = (props) => {\n const { assetId, data } = props ?? {};\n\n return patchAsset(assetId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchAsset>>\n>;\nexport type PatchAssetMutationBody = AssetPatchBodyBody;\nexport type PatchAssetMutationError = ErrorType<AsError>;\n\nexport const usePatchAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchAsset>>,\n TError,\n { assetId: string; data: AssetPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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 return customInstance<void>(\n { url: `/asset/${assetId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return deleteAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteAsset>>\n>;\n\nexport type DeleteAssetMutationError = ErrorType<AsError>;\n\nexport const useDeleteAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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 return customInstance<void>(\n { url: `/asset/${assetId}/disable`, method: \"patch\" },\n options\n );\n};\n\nexport const getDisableAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof disableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return disableAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DisableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof disableAsset>>\n>;\n\nexport type DisableAssetMutationError = ErrorType<AsError>;\n\nexport const useDisableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof disableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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 return customInstance<void>(\n { url: `/asset/${assetId}/enable`, method: \"patch\" },\n options\n );\n};\n\nexport const getEnableAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof enableAsset>>,\n { assetId: string }\n > = (props) => {\n const { assetId } = props ?? {};\n\n return enableAsset(assetId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type EnableAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof enableAsset>>\n>;\n\nexport type EnableAssetMutationError = ErrorType<AsError>;\n\nexport const useEnableAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof enableAsset>>,\n TError,\n { assetId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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 return customInstance<void>(\n { url: `/asset/${assetId}/attach`, method: \"patch\", params },\n options\n );\n};\n\nexport const getAttachAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachAsset>>,\n { assetId: string; params?: AttachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return attachAsset(assetId, params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AttachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachAsset>>\n>;\n\nexport type AttachAssetMutationError = ErrorType<AsError>;\n\nexport const useAttachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachAsset>>,\n TError,\n { assetId: string; params?: AttachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\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 return customInstance<void>(\n { url: `/asset/${assetId}/detach`, method: \"patch\", params },\n options\n );\n};\n\nexport const getDetachAssetMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof detachAsset>>,\n { assetId: string; params?: DetachAssetParams }\n > = (props) => {\n const { assetId, params } = props ?? {};\n\n return detachAsset(assetId, params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DetachAssetMutationResult = NonNullable<\n Awaited<ReturnType<typeof detachAsset>>\n>;\n\nexport type DetachAssetMutationError = ErrorType<AsError>;\n\nexport const useDetachAsset = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof detachAsset>>,\n TError,\n { assetId: string; params?: DetachAssetParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDetachAssetMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAuC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,CAAC,WAClC,CAAC,sBAAsB,UAAU,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAEvD,IAAM,0BAA0B,CAIrC,QACA,YAUG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB,MAAM;AAErE,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAE7C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,cAAc,CAIzB,QACA,YAQ2D;AAC3D,QAAM,eAAe,wBAAwB,QAAQ,OAAO;AAE5D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,mBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9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AAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;AAMO,IAAM,cAAc,CACzB,SACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,UAAU,kBAAkB,QAAQ,SAAS,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,IAAM,gCAAgC,CAG3C,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,OAAO,IAAI,SAAS,CAAC;AAEtC,WAAO,YAAY,SAAS,QAAQ,cAAc;AAAA,EACpD;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,kBAAkB,8BAA8B,OAAO;AAE7D,SAAO,YAAY,eAAe;AACpC;","names":[]}
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.0\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\nAssets are text and file resources that can be attached to (have a *scope* that applies to) **User** accounts, **Products**, **Units**, **Organisations** or can be **Global**. Assets can be requested by **Merchants**. The Data Manager uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.\n\nUsers must *attach* an Asset to a **Merchant** before the **Merchant** can ue it\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\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;AAyCA,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;AASO,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,kBAAk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,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,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":[]}
@@ -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-UZTHSGDT.cjs.map
27
+ //# sourceMappingURL=chunk-J22A7LHX.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;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;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 // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
@@ -24,4 +24,4 @@ export {
24
24
  setBaseUrl,
25
25
  customInstance
26
26
  };
27
- //# sourceMappingURL=chunk-3RNIDX7T.js.map
27
+ //# sourceMappingURL=chunk-UKA7G3OB.js.map