@squonk/account-server-client 2.1.0-rc.1 → 2.1.0-rc.10

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 (78) hide show
  1. package/README.md +1 -1
  2. package/admin/admin.cjs +30 -8
  3. package/admin/admin.cjs.map +1 -1
  4. package/admin/admin.d.cts +50 -0
  5. package/admin/admin.d.ts +26 -6
  6. package/admin/admin.js +30 -8
  7. package/admin/admin.js.map +1 -1
  8. package/asset/asset.cjs +62 -22
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +260 -0
  11. package/asset/asset.d.ts +79 -36
  12. package/asset/asset.js +54 -14
  13. package/asset/asset.js.map +1 -1
  14. package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
  15. package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
  16. package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
  17. package/chunk-TKLTUR4R.cjs.map +1 -0
  18. package/event-stream/event-stream.cjs +64 -19
  19. package/event-stream/event-stream.cjs.map +1 -1
  20. package/event-stream/event-stream.d.cts +142 -0
  21. package/event-stream/event-stream.d.ts +66 -20
  22. package/event-stream/event-stream.js +61 -16
  23. package/event-stream/event-stream.js.map +1 -1
  24. package/index.cjs +10 -10
  25. package/index.cjs.map +1 -1
  26. package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
  27. package/index.d.ts +700 -2
  28. package/index.js +9 -9
  29. package/index.js.map +1 -1
  30. package/merchant/merchant.cjs +53 -14
  31. package/merchant/merchant.cjs.map +1 -1
  32. package/merchant/merchant.d.cts +91 -0
  33. package/merchant/merchant.d.ts +48 -8
  34. package/merchant/merchant.js +52 -13
  35. package/merchant/merchant.js.map +1 -1
  36. package/organisation/organisation.cjs +110 -28
  37. package/organisation/organisation.cjs.map +1 -1
  38. package/organisation/organisation.d.cts +271 -0
  39. package/organisation/organisation.d.ts +114 -25
  40. package/organisation/organisation.js +103 -21
  41. package/organisation/organisation.js.map +1 -1
  42. package/package.json +12 -12
  43. package/product/product.cjs +182 -47
  44. package/product/product.cjs.map +1 -1
  45. package/product/product.d.cts +399 -0
  46. package/product/product.d.ts +180 -31
  47. package/product/product.js +172 -37
  48. package/product/product.js.map +1 -1
  49. package/src/account-server-api.schemas.ts +272 -280
  50. package/src/admin/admin.ts +114 -84
  51. package/src/asset/asset.ts +480 -565
  52. package/src/custom-instance.ts +3 -4
  53. package/src/event-stream/event-stream.ts +300 -275
  54. package/src/merchant/merchant.ts +206 -142
  55. package/src/organisation/organisation.ts +549 -490
  56. package/src/product/product.ts +829 -688
  57. package/src/state/state.ts +112 -75
  58. package/src/unit/unit.ts +645 -599
  59. package/src/user/user.ts +489 -469
  60. package/state/state.cjs +29 -8
  61. package/state/state.cjs.map +1 -1
  62. package/state/state.d.cts +46 -0
  63. package/state/state.d.ts +26 -6
  64. package/state/state.js +29 -8
  65. package/state/state.js.map +1 -1
  66. package/unit/unit.cjs +120 -32
  67. package/unit/unit.cjs.map +1 -1
  68. package/unit/unit.d.cts +322 -0
  69. package/unit/unit.d.ts +133 -38
  70. package/unit/unit.js +112 -24
  71. package/unit/unit.js.map +1 -1
  72. package/user/user.cjs +96 -22
  73. package/user/user.cjs.map +1 -1
  74. package/user/user.d.cts +271 -0
  75. package/user/user.d.ts +96 -24
  76. package/user/user.js +90 -16
  77. package/user/user.js.map +1 -1
  78. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -0,0 +1,260 @@
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
+ import 'axios';
5
+
6
+ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
7
+ /**
8
+ * Gets Assets you have access to.
9
+
10
+ * @summary Gets Assets
11
+ */
12
+ declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
13
+ declare const getGetAssetQueryKey: (params?: GetAssetParams) => readonly ["account-server-api", "/asset", ...GetAssetParams[]];
14
+ declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
15
+ query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
16
+ request?: SecondParameter<typeof customInstance>;
17
+ } | undefined) => UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
18
+ queryKey: QueryKey;
19
+ };
20
+ type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
21
+ type GetAssetQueryError = ErrorType<AsError | void>;
22
+ /**
23
+ * @summary Gets Assets
24
+ */
25
+ declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
26
+ query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
27
+ request?: SecondParameter<typeof customInstance>;
28
+ } | undefined) => UseQueryResult<TData, TError> & {
29
+ queryKey: QueryKey;
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
+ };
48
+ /**
49
+ * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
50
+
51
+ Assets 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**.
52
+
53
+ Assets must be *enabled* before they can be used.
54
+
55
+ They 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.
56
+
57
+ * @summary Create an Asset
58
+ */
59
+ declare const createAsset: (assetPostBodyBody: AssetPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<AssetPostResponse>;
60
+ declare const getCreateAssetMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
61
+ mutation?: UseMutationOptions<AssetPostResponse, TError, {
62
+ data: AssetPostBodyBody;
63
+ }, TContext> | undefined;
64
+ request?: SecondParameter<typeof customInstance>;
65
+ } | undefined) => UseMutationOptions<AssetPostResponse, TError, {
66
+ data: AssetPostBodyBody;
67
+ }, TContext>;
68
+ type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>;
69
+ type CreateAssetMutationBody = AssetPostBodyBody;
70
+ type CreateAssetMutationError = ErrorType<AsError | void>;
71
+ /**
72
+ * @summary Create an Asset
73
+ */
74
+ declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
75
+ mutation?: UseMutationOptions<AssetPostResponse, TError, {
76
+ data: AssetPostBodyBody;
77
+ }, TContext> | undefined;
78
+ request?: SecondParameter<typeof customInstance>;
79
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<AssetPostResponse, TError, {
80
+ data: AssetPostBodyBody;
81
+ }, TContext>;
82
+ /**
83
+ * Used to update or replace Asset *Content* or *Description*.
84
+
85
+ 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.
86
+
87
+ * @summary Adjust an existing Asset
88
+ */
89
+ declare const patchAsset: (assetId: string, assetPatchBodyBody: AssetPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
90
+ declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
91
+ mutation?: UseMutationOptions<void, TError, {
92
+ assetId: string;
93
+ data: AssetPatchBodyBody;
94
+ }, TContext> | undefined;
95
+ request?: SecondParameter<typeof customInstance>;
96
+ } | undefined) => UseMutationOptions<void, TError, {
97
+ assetId: string;
98
+ data: AssetPatchBodyBody;
99
+ }, TContext>;
100
+ type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>;
101
+ type PatchAssetMutationBody = AssetPatchBodyBody;
102
+ type PatchAssetMutationError = ErrorType<AsError>;
103
+ /**
104
+ * @summary Adjust an existing Asset
105
+ */
106
+ declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
107
+ mutation?: UseMutationOptions<void, TError, {
108
+ assetId: string;
109
+ data: AssetPatchBodyBody;
110
+ }, TContext> | undefined;
111
+ request?: SecondParameter<typeof customInstance>;
112
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
113
+ assetId: string;
114
+ data: AssetPatchBodyBody;
115
+ }, TContext>;
116
+ /**
117
+ * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
118
+
119
+ * @summary Deletes an Asset
120
+ */
121
+ declare const deleteAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
122
+ declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
123
+ mutation?: UseMutationOptions<void, TError, {
124
+ assetId: string;
125
+ }, TContext> | undefined;
126
+ request?: SecondParameter<typeof customInstance>;
127
+ } | undefined) => UseMutationOptions<void, TError, {
128
+ assetId: string;
129
+ }, TContext>;
130
+ type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>;
131
+ type DeleteAssetMutationError = ErrorType<AsError>;
132
+ /**
133
+ * @summary Deletes an Asset
134
+ */
135
+ declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
136
+ mutation?: UseMutationOptions<void, TError, {
137
+ assetId: string;
138
+ }, TContext> | undefined;
139
+ request?: SecondParameter<typeof customInstance>;
140
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
141
+ assetId: string;
142
+ }, TContext>;
143
+ /**
144
+ * Disables a known Asset
145
+
146
+ * @summary Disables an Asset
147
+ */
148
+ declare const disableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
149
+ declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
150
+ mutation?: UseMutationOptions<void, TError, {
151
+ assetId: string;
152
+ }, TContext> | undefined;
153
+ request?: SecondParameter<typeof customInstance>;
154
+ } | undefined) => UseMutationOptions<void, TError, {
155
+ assetId: string;
156
+ }, TContext>;
157
+ type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>;
158
+ type DisableAssetMutationError = ErrorType<AsError>;
159
+ /**
160
+ * @summary Disables an Asset
161
+ */
162
+ declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
163
+ mutation?: UseMutationOptions<void, TError, {
164
+ assetId: string;
165
+ }, TContext> | undefined;
166
+ request?: SecondParameter<typeof customInstance>;
167
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
168
+ assetId: string;
169
+ }, TContext>;
170
+ /**
171
+ * Enables a known Asset
172
+
173
+ * @summary Enables an Asset
174
+ */
175
+ declare const enableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
176
+ declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
177
+ mutation?: UseMutationOptions<void, TError, {
178
+ assetId: string;
179
+ }, TContext> | undefined;
180
+ request?: SecondParameter<typeof customInstance>;
181
+ } | undefined) => UseMutationOptions<void, TError, {
182
+ assetId: string;
183
+ }, TContext>;
184
+ type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>;
185
+ type EnableAssetMutationError = ErrorType<AsError>;
186
+ /**
187
+ * @summary Enables an Asset
188
+ */
189
+ declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
190
+ mutation?: UseMutationOptions<void, TError, {
191
+ assetId: string;
192
+ }, TContext> | undefined;
193
+ request?: SecondParameter<typeof customInstance>;
194
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
195
+ assetId: string;
196
+ }, TContext>;
197
+ /**
198
+ * Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
199
+
200
+ * @summary Attaches an Asset to a Merchant
201
+ */
202
+ declare const attachAsset: (assetId: string, params?: AttachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
203
+ declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
204
+ mutation?: UseMutationOptions<void, TError, {
205
+ assetId: string;
206
+ params?: AttachAssetParams | undefined;
207
+ }, TContext> | undefined;
208
+ request?: SecondParameter<typeof customInstance>;
209
+ } | undefined) => UseMutationOptions<void, TError, {
210
+ assetId: string;
211
+ params?: AttachAssetParams | undefined;
212
+ }, TContext>;
213
+ type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>;
214
+ type AttachAssetMutationError = ErrorType<AsError>;
215
+ /**
216
+ * @summary Attaches an Asset to a Merchant
217
+ */
218
+ declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
219
+ mutation?: UseMutationOptions<void, TError, {
220
+ assetId: string;
221
+ params?: AttachAssetParams | undefined;
222
+ }, TContext> | undefined;
223
+ request?: SecondParameter<typeof customInstance>;
224
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
225
+ assetId: string;
226
+ params?: AttachAssetParams | undefined;
227
+ }, TContext>;
228
+ /**
229
+ * Detaches an Asset from a **Merchant**
230
+
231
+ * @summary Detaches an Asset from a Merchant
232
+ */
233
+ declare const detachAsset: (assetId: string, params?: DetachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
234
+ declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
235
+ mutation?: UseMutationOptions<void, TError, {
236
+ assetId: string;
237
+ params?: DetachAssetParams | undefined;
238
+ }, TContext> | undefined;
239
+ request?: SecondParameter<typeof customInstance>;
240
+ } | undefined) => UseMutationOptions<void, TError, {
241
+ assetId: string;
242
+ params?: DetachAssetParams | undefined;
243
+ }, TContext>;
244
+ type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>;
245
+ type DetachAssetMutationError = ErrorType<AsError>;
246
+ /**
247
+ * @summary Detaches an Asset from a Merchant
248
+ */
249
+ declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
250
+ mutation?: UseMutationOptions<void, TError, {
251
+ assetId: string;
252
+ params?: DetachAssetParams | undefined;
253
+ }, TContext> | undefined;
254
+ request?: SecondParameter<typeof customInstance>;
255
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
256
+ assetId: string;
257
+ params?: DetachAssetParams | undefined;
258
+ }, TContext>;
259
+
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,37 +1,59 @@
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, aF as customInstance, aA as AssetGetResponse, aG as ErrorType, aB as AsError, s as AssetPostBodyBody, az as AssetPostResponse, t as AssetPatchBodyBody, A as AttachAssetParams, D as DetachAssetParams } from '../custom-instance-35e5d4fd.js';
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 extends (config: any, args: infer P) => any ? P : never;
6
+ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
7
7
  /**
8
8
  * Gets Assets you have access to.
9
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
10
  * @summary Gets Assets
15
11
  */
16
12
  declare const getAsset: (params?: GetAssetParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<AssetGetResponse>;
17
13
  declare const getGetAssetQueryKey: (params?: GetAssetParams) => readonly ["account-server-api", "/asset", ...GetAssetParams[]];
18
14
  declare const getGetAssetQueryOptions: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
19
- query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
15
+ query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
20
16
  request?: SecondParameter<typeof customInstance>;
21
17
  } | undefined) => UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> & {
22
18
  queryKey: QueryKey;
23
19
  };
24
20
  type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>;
25
21
  type GetAssetQueryError = ErrorType<AsError | void>;
22
+ /**
23
+ * @summary Gets Assets
24
+ */
26
25
  declare const useGetAsset: <TData = AssetGetResponse, TError = ErrorType<void | AsError>>(params?: GetAssetParams, options?: {
27
- query?: UseQueryOptions<AssetGetResponse, TError, TData, QueryKey> | undefined;
26
+ query?: Partial<UseQueryOptions<AssetGetResponse, TError, TData, QueryKey>> | undefined;
28
27
  request?: SecondParameter<typeof customInstance>;
29
28
  } | undefined) => UseQueryResult<TData, TError> & {
30
29
  queryKey: QueryKey;
31
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
+ };
32
48
  /**
33
49
  * Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
34
50
 
51
+ Assets 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**.
52
+
53
+ Assets must be *enabled* before they can be used.
54
+
55
+ They 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.
56
+
35
57
  * @summary Create an Asset
36
58
  */
37
59
  declare const createAsset: (assetPostBodyBody: AssetPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<AssetPostResponse>;
@@ -46,21 +68,24 @@ declare const getCreateAssetMutationOptions: <TError = ErrorType<void | AsError>
46
68
  type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>;
47
69
  type CreateAssetMutationBody = AssetPostBodyBody;
48
70
  type CreateAssetMutationError = ErrorType<AsError | void>;
71
+ /**
72
+ * @summary Create an Asset
73
+ */
49
74
  declare const useCreateAsset: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
50
75
  mutation?: UseMutationOptions<AssetPostResponse, TError, {
51
76
  data: AssetPostBodyBody;
52
77
  }, TContext> | undefined;
53
78
  request?: SecondParameter<typeof customInstance>;
54
- } | undefined) => _tanstack_react_query.UseMutationResult<AssetPostResponse, TError, {
79
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<AssetPostResponse, TError, {
55
80
  data: AssetPostBodyBody;
56
81
  }, TContext>;
57
82
  /**
58
- * Used to update or replace Asset *Content* or *Description*.
83
+ * Used to update or replace Asset *Content* or *Description*.
59
84
 
60
85
  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
86
 
62
- * @summary Adjust an existing Asset
63
- */
87
+ * @summary Adjust an existing Asset
88
+ */
64
89
  declare const patchAsset: (assetId: string, assetPatchBodyBody: AssetPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
65
90
  declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
66
91
  mutation?: UseMutationOptions<void, TError, {
@@ -75,21 +100,24 @@ declare const getPatchAssetMutationOptions: <TError = ErrorType<AsError>, TConte
75
100
  type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>;
76
101
  type PatchAssetMutationBody = AssetPatchBodyBody;
77
102
  type PatchAssetMutationError = ErrorType<AsError>;
103
+ /**
104
+ * @summary Adjust an existing Asset
105
+ */
78
106
  declare const usePatchAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
79
107
  mutation?: UseMutationOptions<void, TError, {
80
108
  assetId: string;
81
109
  data: AssetPatchBodyBody;
82
110
  }, TContext> | undefined;
83
111
  request?: SecondParameter<typeof customInstance>;
84
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
112
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
85
113
  assetId: string;
86
114
  data: AssetPatchBodyBody;
87
115
  }, TContext>;
88
116
  /**
89
- * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
117
+ * Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
90
118
 
91
- * @summary Deletes an Asset
92
- */
119
+ * @summary Deletes an Asset
120
+ */
93
121
  declare const deleteAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
94
122
  declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
95
123
  mutation?: UseMutationOptions<void, TError, {
@@ -101,19 +129,22 @@ declare const getDeleteAssetMutationOptions: <TError = ErrorType<AsError>, TCont
101
129
  }, TContext>;
102
130
  type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>;
103
131
  type DeleteAssetMutationError = ErrorType<AsError>;
132
+ /**
133
+ * @summary Deletes an Asset
134
+ */
104
135
  declare const useDeleteAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
105
136
  mutation?: UseMutationOptions<void, TError, {
106
137
  assetId: string;
107
138
  }, TContext> | undefined;
108
139
  request?: SecondParameter<typeof customInstance>;
109
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
140
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
110
141
  assetId: string;
111
142
  }, TContext>;
112
143
  /**
113
- * Disables a known Asset
144
+ * Disables a known Asset
114
145
 
115
- * @summary Disables an Asset
116
- */
146
+ * @summary Disables an Asset
147
+ */
117
148
  declare const disableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
118
149
  declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
119
150
  mutation?: UseMutationOptions<void, TError, {
@@ -125,19 +156,22 @@ declare const getDisableAssetMutationOptions: <TError = ErrorType<AsError>, TCon
125
156
  }, TContext>;
126
157
  type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>;
127
158
  type DisableAssetMutationError = ErrorType<AsError>;
159
+ /**
160
+ * @summary Disables an Asset
161
+ */
128
162
  declare const useDisableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
129
163
  mutation?: UseMutationOptions<void, TError, {
130
164
  assetId: string;
131
165
  }, TContext> | undefined;
132
166
  request?: SecondParameter<typeof customInstance>;
133
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
167
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
134
168
  assetId: string;
135
169
  }, TContext>;
136
170
  /**
137
- * Enables a known Asset
171
+ * Enables a known Asset
138
172
 
139
- * @summary Enables an Asset
140
- */
173
+ * @summary Enables an Asset
174
+ */
141
175
  declare const enableAsset: (assetId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
142
176
  declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
143
177
  mutation?: UseMutationOptions<void, TError, {
@@ -149,19 +183,22 @@ declare const getEnableAssetMutationOptions: <TError = ErrorType<AsError>, TCont
149
183
  }, TContext>;
150
184
  type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>;
151
185
  type EnableAssetMutationError = ErrorType<AsError>;
186
+ /**
187
+ * @summary Enables an Asset
188
+ */
152
189
  declare const useEnableAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
153
190
  mutation?: UseMutationOptions<void, TError, {
154
191
  assetId: string;
155
192
  }, TContext> | undefined;
156
193
  request?: SecondParameter<typeof customInstance>;
157
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
194
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
158
195
  assetId: string;
159
196
  }, TContext>;
160
197
  /**
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.
198
+ * 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
199
 
163
- * @summary Attaches an Asset to a Merchant
164
- */
200
+ * @summary Attaches an Asset to a Merchant
201
+ */
165
202
  declare const attachAsset: (assetId: string, params?: AttachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
166
203
  declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
167
204
  mutation?: UseMutationOptions<void, TError, {
@@ -175,21 +212,24 @@ declare const getAttachAssetMutationOptions: <TError = ErrorType<AsError>, TCont
175
212
  }, TContext>;
176
213
  type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>;
177
214
  type AttachAssetMutationError = ErrorType<AsError>;
215
+ /**
216
+ * @summary Attaches an Asset to a Merchant
217
+ */
178
218
  declare const useAttachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
179
219
  mutation?: UseMutationOptions<void, TError, {
180
220
  assetId: string;
181
221
  params?: AttachAssetParams | undefined;
182
222
  }, TContext> | undefined;
183
223
  request?: SecondParameter<typeof customInstance>;
184
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
224
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
185
225
  assetId: string;
186
226
  params?: AttachAssetParams | undefined;
187
227
  }, TContext>;
188
228
  /**
189
- * Detaches an Asset from a **Merchant**
229
+ * Detaches an Asset from a **Merchant**
190
230
 
191
- * @summary Detaches an Asset from a Merchant
192
- */
231
+ * @summary Detaches an Asset from a Merchant
232
+ */
193
233
  declare const detachAsset: (assetId: string, params?: DetachAssetParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
194
234
  declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
195
235
  mutation?: UseMutationOptions<void, TError, {
@@ -203,15 +243,18 @@ declare const getDetachAssetMutationOptions: <TError = ErrorType<AsError>, TCont
203
243
  }, TContext>;
204
244
  type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>;
205
245
  type DetachAssetMutationError = ErrorType<AsError>;
246
+ /**
247
+ * @summary Detaches an Asset from a Merchant
248
+ */
206
249
  declare const useDetachAsset: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
207
250
  mutation?: UseMutationOptions<void, TError, {
208
251
  assetId: string;
209
252
  params?: DetachAssetParams | undefined;
210
253
  }, TContext> | undefined;
211
254
  request?: SecondParameter<typeof customInstance>;
212
- } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
255
+ } | undefined) => _tanstack_react_query_build_legacy_types.UseMutationResult<void, TError, {
213
256
  assetId: string;
214
257
  params?: DetachAssetParams | undefined;
215
258
  }, TContext>;
216
259
 
217
- 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,22 +1,31 @@
1
1
  import {
2
2
  customInstance
3
- } from "../chunk-3RNIDX7T.js";
3
+ } from "../chunk-EBOQPVLG.js";
4
4
 
5
5
  // src/asset/asset.ts
6
- import { useQuery, useMutation } from "@tanstack/react-query";
6
+ import {
7
+ useMutation,
8
+ useQuery,
9
+ useSuspenseQuery
10
+ } from "@tanstack/react-query";
7
11
  var getAsset = (params, options, signal) => {
8
12
  return customInstance(
9
- { url: `/asset`, method: "get", params, signal },
13
+ {
14
+ url: `/asset`,
15
+ method: "GET",
16
+ params,
17
+ signal
18
+ },
10
19
  options
11
20
  );
12
21
  };
13
- var getGetAssetQueryKey = (params) => ["account-server-api", `/asset`, ...params ? [params] : []];
22
+ var getGetAssetQueryKey = (params) => {
23
+ return ["account-server-api", `/asset`, ...params ? [params] : []];
24
+ };
14
25
  var getGetAssetQueryOptions = (params, options) => {
15
26
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
27
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetAssetQueryKey(params);
17
- const queryFn = ({
18
- signal
19
- }) => getAsset(params, requestOptions, signal);
28
+ const queryFn = ({ signal }) => getAsset(params, requestOptions, signal);
20
29
  return { queryKey, queryFn, ...queryOptions };
21
30
  };
22
31
  var useGetAsset = (params, options) => {
@@ -25,6 +34,18 @@ var useGetAsset = (params, options) => {
25
34
  query.queryKey = queryOptions.queryKey;
26
35
  return query;
27
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
+ };
28
49
  var createAsset = (assetPostBodyBody, options) => {
29
50
  const formData = new FormData();
30
51
  formData.append("name", assetPostBodyBody.name);
@@ -45,7 +66,7 @@ var createAsset = (assetPostBodyBody, options) => {
45
66
  return customInstance(
46
67
  {
47
68
  url: `/asset`,
48
- method: "post",
69
+ method: "POST",
49
70
  headers: { "Content-Type": "multipart/form-data" },
50
71
  data: formData
51
72
  },
@@ -78,7 +99,7 @@ var patchAsset = (assetId, assetPatchBodyBody, options) => {
78
99
  return customInstance(
79
100
  {
80
101
  url: `/asset/${assetId}`,
81
- method: "patch",
102
+ method: "PATCH",
82
103
  headers: { "Content-Type": "multipart/form-data" },
83
104
  data: formData
84
105
  },
@@ -99,7 +120,10 @@ var usePatchAsset = (options) => {
99
120
  };
100
121
  var deleteAsset = (assetId, options) => {
101
122
  return customInstance(
102
- { url: `/asset/${assetId}`, method: "delete" },
123
+ {
124
+ url: `/asset/${assetId}`,
125
+ method: "DELETE"
126
+ },
103
127
  options
104
128
  );
105
129
  };
@@ -117,7 +141,10 @@ var useDeleteAsset = (options) => {
117
141
  };
118
142
  var disableAsset = (assetId, options) => {
119
143
  return customInstance(
120
- { url: `/asset/${assetId}/disable`, method: "patch" },
144
+ {
145
+ url: `/asset/${assetId}/disable`,
146
+ method: "PATCH"
147
+ },
121
148
  options
122
149
  );
123
150
  };
@@ -135,7 +162,10 @@ var useDisableAsset = (options) => {
135
162
  };
136
163
  var enableAsset = (assetId, options) => {
137
164
  return customInstance(
138
- { url: `/asset/${assetId}/enable`, method: "patch" },
165
+ {
166
+ url: `/asset/${assetId}/enable`,
167
+ method: "PATCH"
168
+ },
139
169
  options
140
170
  );
141
171
  };
@@ -153,7 +183,11 @@ var useEnableAsset = (options) => {
153
183
  };
154
184
  var attachAsset = (assetId, params, options) => {
155
185
  return customInstance(
156
- { url: `/asset/${assetId}/attach`, method: "patch", params },
186
+ {
187
+ url: `/asset/${assetId}/attach`,
188
+ method: "PATCH",
189
+ params
190
+ },
157
191
  options
158
192
  );
159
193
  };
@@ -171,7 +205,11 @@ var useAttachAsset = (options) => {
171
205
  };
172
206
  var detachAsset = (assetId, params, options) => {
173
207
  return customInstance(
174
- { url: `/asset/${assetId}/detach`, method: "patch", params },
208
+ {
209
+ url: `/asset/${assetId}/detach`,
210
+ method: "PATCH",
211
+ params
212
+ },
175
213
  options
176
214
  );
177
215
  };
@@ -203,6 +241,7 @@ export {
203
241
  getEnableAssetMutationOptions,
204
242
  getGetAssetQueryKey,
205
243
  getGetAssetQueryOptions,
244
+ getGetAssetSuspenseQueryOptions,
206
245
  getPatchAssetMutationOptions,
207
246
  patchAsset,
208
247
  useAttachAsset,
@@ -212,6 +251,7 @@ export {
212
251
  useDisableAsset,
213
252
  useEnableAsset,
214
253
  useGetAsset,
254
+ useGetAssetSuspense,
215
255
  usePatchAsset
216
256
  };
217
257
  //# sourceMappingURL=asset.js.map