@squonk/data-manager-client 1.2.8 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/accounting/accounting.cjs +51 -8
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +61 -10
- package/accounting/accounting.d.ts +61 -10
- package/accounting/accounting.js +49 -6
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +67 -24
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +75 -24
- package/admin/admin.d.ts +75 -24
- package/admin/admin.js +56 -13
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +35 -6
- package/application/application.cjs.map +1 -1
- package/application/application.d.cts +42 -8
- package/application/application.d.ts +42 -8
- package/application/application.js +34 -5
- package/application/application.js.map +1 -1
- package/{chunk-UKA7G3OB.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-UKA7G3OB.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-J22A7LHX.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/configuration/configuration.cjs +19 -4
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +23 -6
- package/configuration/configuration.d.ts +23 -6
- package/configuration/configuration.js +19 -4
- package/configuration/configuration.js.map +1 -1
- package/dataset/dataset.cjs +93 -22
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.cts +105 -20
- package/dataset/dataset.d.ts +105 -20
- package/dataset/dataset.js +83 -12
- package/dataset/dataset.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +71 -14
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.cts +83 -15
- package/exchange-rate/exchange-rate.d.ts +83 -15
- package/exchange-rate/exchange-rate.js +65 -8
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file-and-path/file-and-path.cjs +45 -16
- package/file-and-path/file-and-path.cjs.map +1 -1
- package/file-and-path/file-and-path.d.cts +53 -19
- package/file-and-path/file-and-path.d.ts +53 -19
- package/file-and-path/file-and-path.js +39 -10
- package/file-and-path/file-and-path.js.map +1 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +2102 -2
- package/index.d.ts +2102 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +45 -16
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.cts +48 -14
- package/instance/instance.d.ts +48 -14
- package/instance/instance.js +38 -9
- package/instance/instance.js.map +1 -1
- package/inventory/inventory.cjs +56 -0
- package/inventory/inventory.cjs.map +1 -0
- package/inventory/inventory.d.cts +50 -0
- package/inventory/inventory.d.ts +50 -0
- package/inventory/inventory.js +56 -0
- package/inventory/inventory.js.map +1 -0
- package/inventory/package.json +7 -0
- package/job/job.cjs +51 -8
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +61 -10
- package/job/job.d.ts +61 -10
- package/job/job.js +49 -6
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +39 -10
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.cts +45 -11
- package/metadata/metadata.d.ts +45 -11
- package/metadata/metadata.js +36 -7
- package/metadata/metadata.js.map +1 -1
- package/package.json +11 -11
- package/project/project.cjs +131 -26
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +166 -30
- package/project/project.d.ts +166 -30
- package/project/project.js +119 -14
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +137 -23
- package/src/admin/admin.ts +149 -51
- package/src/application/application.ts +94 -19
- package/src/configuration/configuration.ts +51 -15
- package/src/custom-instance.ts +3 -4
- package/src/data-manager-api.schemas.ts +115 -13
- package/src/dataset/dataset.ts +234 -46
- package/src/exchange-rate/exchange-rate.ts +186 -33
- package/src/file-and-path/file-and-path.ts +104 -39
- package/src/instance/instance.ts +99 -34
- package/src/inventory/inventory.ts +140 -0
- package/src/job/job.ts +139 -23
- package/src/metadata/metadata.ts +98 -25
- package/src/project/project.ts +313 -60
- package/src/task/task.ts +97 -22
- package/src/type/type.ts +51 -15
- package/src/user/user.ts +138 -26
- package/task/task.cjs +37 -8
- package/task/task.cjs.map +1 -1
- package/task/task.d.cts +44 -10
- package/task/task.d.ts +44 -10
- package/task/task.js +35 -6
- package/task/task.js.map +1 -1
- package/type/type.cjs +19 -4
- package/type/type.cjs.map +1 -1
- package/type/type.d.cts +23 -6
- package/type/type.d.ts +23 -6
- package/type/type.js +19 -4
- package/type/type.js.map +1 -1
- package/user/user.cjs +53 -10
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +63 -12
- package/user/user.d.ts +63 -12
- package/user/user.js +49 -6
- package/user/user.js.map +1 -1
- package/chunk-J22A7LHX.cjs.map +0 -1
- package/custom-instance-37ed2460.d.ts +0 -2014
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
6
6
|
|
|
7
7
|
A service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version:
|
|
9
|
+
* OpenAPI spec version: 2.0
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
12
|
useMutation,
|
|
13
|
-
useQuery
|
|
13
|
+
useQuery,
|
|
14
|
+
useSuspenseQuery
|
|
14
15
|
} from '@tanstack/react-query'
|
|
15
16
|
import type {
|
|
16
17
|
MutationFunction,
|
|
@@ -18,7 +19,9 @@ import type {
|
|
|
18
19
|
QueryKey,
|
|
19
20
|
UseMutationOptions,
|
|
20
21
|
UseQueryOptions,
|
|
21
|
-
UseQueryResult
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
22
25
|
} from '@tanstack/react-query'
|
|
23
26
|
import type {
|
|
24
27
|
CreatePathParams,
|
|
@@ -34,19 +37,13 @@ import { customInstance } from '.././custom-instance';
|
|
|
34
37
|
import type { ErrorType } from '.././custom-instance';
|
|
35
38
|
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
39
|
-
config: any,
|
|
40
|
-
args: infer P,
|
|
41
|
-
) => any
|
|
42
|
-
? P
|
|
43
|
-
: never;
|
|
40
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
44
41
|
|
|
45
42
|
|
|
46
43
|
/**
|
|
47
44
|
* Creates a new Path within a Project. Every directory in the Path will be created. The path will belong to the User and Project.
|
|
48
45
|
|
|
49
|
-
Only Project
|
|
46
|
+
Only Project editors can create Paths.
|
|
50
47
|
|
|
51
48
|
* @summary Create a new Project Path
|
|
52
49
|
*/
|
|
@@ -56,7 +53,7 @@ export const createPath = (
|
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
return customInstance<void>(
|
|
59
|
-
{url: `/path`, method: '
|
|
56
|
+
{url: `/path`, method: 'PUT',
|
|
60
57
|
params
|
|
61
58
|
},
|
|
62
59
|
options);
|
|
@@ -65,7 +62,6 @@ export const createPath = (
|
|
|
65
62
|
|
|
66
63
|
|
|
67
64
|
export const getCreatePathMutationOptions = <TError = ErrorType<DmError>,
|
|
68
|
-
|
|
69
65
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createPath>>, TError,{params: CreatePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
70
66
|
): UseMutationOptions<Awaited<ReturnType<typeof createPath>>, TError,{params: CreatePathParams}, TContext> => {
|
|
71
67
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -92,7 +88,6 @@ export const getCreatePathMutationOptions = <TError = ErrorType<DmError>,
|
|
|
92
88
|
* @summary Create a new Project Path
|
|
93
89
|
*/
|
|
94
90
|
export const useCreatePath = <TError = ErrorType<DmError>,
|
|
95
|
-
|
|
96
91
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createPath>>, TError,{params: CreatePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
97
92
|
) => {
|
|
98
93
|
|
|
@@ -103,7 +98,7 @@ export const useCreatePath = <TError = ErrorType<DmError>,
|
|
|
103
98
|
/**
|
|
104
99
|
* Deletes a Path within the Project. Be aware that the deletion of a Path will result in te contents of the Path also being deleted. If There are files in Path or sub-directories, they will all be deleted.
|
|
105
100
|
|
|
106
|
-
Only Project
|
|
101
|
+
Only Project editors can delete Paths.
|
|
107
102
|
|
|
108
103
|
* @summary Delete a Project Path
|
|
109
104
|
*/
|
|
@@ -113,7 +108,7 @@ export const deletePath = (
|
|
|
113
108
|
|
|
114
109
|
|
|
115
110
|
return customInstance<void>(
|
|
116
|
-
{url: `/path`, method: '
|
|
111
|
+
{url: `/path`, method: 'DELETE',
|
|
117
112
|
params
|
|
118
113
|
},
|
|
119
114
|
options);
|
|
@@ -122,7 +117,6 @@ export const deletePath = (
|
|
|
122
117
|
|
|
123
118
|
|
|
124
119
|
export const getDeletePathMutationOptions = <TError = ErrorType<DmError>,
|
|
125
|
-
|
|
126
120
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePath>>, TError,{params: DeletePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
127
121
|
): UseMutationOptions<Awaited<ReturnType<typeof deletePath>>, TError,{params: DeletePathParams}, TContext> => {
|
|
128
122
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -149,7 +143,6 @@ export const getDeletePathMutationOptions = <TError = ErrorType<DmError>,
|
|
|
149
143
|
* @summary Delete a Project Path
|
|
150
144
|
*/
|
|
151
145
|
export const useDeletePath = <TError = ErrorType<DmError>,
|
|
152
|
-
|
|
153
146
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePath>>, TError,{params: DeletePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
154
147
|
) => {
|
|
155
148
|
|
|
@@ -169,7 +162,7 @@ export const getFiles = (
|
|
|
169
162
|
|
|
170
163
|
|
|
171
164
|
return customInstance<FilesGetResponse>(
|
|
172
|
-
{url: `/file`, method: '
|
|
165
|
+
{url: `/file`, method: 'GET',
|
|
173
166
|
params, signal
|
|
174
167
|
},
|
|
175
168
|
options);
|
|
@@ -177,12 +170,11 @@ export const getFiles = (
|
|
|
177
170
|
|
|
178
171
|
|
|
179
172
|
export const getGetFilesQueryKey = (params: GetFilesParams,) => {
|
|
180
|
-
|
|
181
173
|
return ["data-manager-api", `/file`, ...(params ? [params]: [])] as const;
|
|
182
174
|
}
|
|
183
175
|
|
|
184
176
|
|
|
185
|
-
export const getGetFilesQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData
|
|
177
|
+
export const getGetFilesQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
186
178
|
) => {
|
|
187
179
|
|
|
188
180
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -207,7 +199,7 @@ export type GetFilesQueryError = ErrorType<void | DmError>
|
|
|
207
199
|
* @summary Gets the Files on a Project Path
|
|
208
200
|
*/
|
|
209
201
|
export const useGetFiles = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(
|
|
210
|
-
params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData
|
|
202
|
+
params: GetFilesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
211
203
|
|
|
212
204
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
213
205
|
|
|
@@ -222,6 +214,46 @@ export const useGetFiles = <TData = Awaited<ReturnType<typeof getFiles>>, TError
|
|
|
222
214
|
|
|
223
215
|
|
|
224
216
|
|
|
217
|
+
export const getGetFilesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
218
|
+
) => {
|
|
219
|
+
|
|
220
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
221
|
+
|
|
222
|
+
const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) => getFiles(params, requestOptions, signal);
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & { queryKey: QueryKey }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export type GetFilesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>
|
|
236
|
+
export type GetFilesSuspenseQueryError = ErrorType<void | DmError>
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @summary Gets the Files on a Project Path
|
|
240
|
+
*/
|
|
241
|
+
export const useGetFilesSuspense = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(
|
|
242
|
+
params: GetFilesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
243
|
+
|
|
244
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
245
|
+
|
|
246
|
+
const queryOptions = getGetFilesSuspenseQueryOptions(params,options)
|
|
247
|
+
|
|
248
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
249
|
+
|
|
250
|
+
query.queryKey = queryOptions.queryKey ;
|
|
251
|
+
|
|
252
|
+
return query;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
225
257
|
/**
|
|
226
258
|
* Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.
|
|
227
259
|
|
|
@@ -229,7 +261,7 @@ Only Datasets attached to projects are available through the Project API. A Data
|
|
|
229
261
|
|
|
230
262
|
An `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.
|
|
231
263
|
|
|
232
|
-
You must be an `editor`
|
|
264
|
+
You must be an `editor` of the Project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.
|
|
233
265
|
|
|
234
266
|
You cannot add a Dataset to a Project until its upload is complete.
|
|
235
267
|
|
|
@@ -255,7 +287,7 @@ if(filePostBodyBody.immutable !== undefined) {
|
|
|
255
287
|
}
|
|
256
288
|
|
|
257
289
|
return customInstance<FilePostResponse>(
|
|
258
|
-
{url: `/file`, method: '
|
|
290
|
+
{url: `/file`, method: 'POST',
|
|
259
291
|
headers: {'Content-Type': 'multipart/form-data', },
|
|
260
292
|
data: formData
|
|
261
293
|
},
|
|
@@ -265,7 +297,6 @@ if(filePostBodyBody.immutable !== undefined) {
|
|
|
265
297
|
|
|
266
298
|
|
|
267
299
|
export const getAttachFileMutationOptions = <TError = ErrorType<void | DmError>,
|
|
268
|
-
|
|
269
300
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
270
301
|
): UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext> => {
|
|
271
302
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -292,7 +323,6 @@ export const getAttachFileMutationOptions = <TError = ErrorType<void | DmError>,
|
|
|
292
323
|
* @summary Attach a Dataset, as a File, to a Project
|
|
293
324
|
*/
|
|
294
325
|
export const useAttachFile = <TError = ErrorType<void | DmError>,
|
|
295
|
-
|
|
296
326
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
297
327
|
) => {
|
|
298
328
|
|
|
@@ -303,7 +333,7 @@ export const useAttachFile = <TError = ErrorType<void | DmError>,
|
|
|
303
333
|
/**
|
|
304
334
|
* Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.
|
|
305
335
|
|
|
306
|
-
You must be an `editor`
|
|
336
|
+
You must be an `editor` of the Project to delete a file from a Project.
|
|
307
337
|
|
|
308
338
|
* @summary Delete an unmanaged Project File
|
|
309
339
|
*/
|
|
@@ -313,7 +343,7 @@ export const deleteUnmanagedFile = (
|
|
|
313
343
|
|
|
314
344
|
|
|
315
345
|
return customInstance<void>(
|
|
316
|
-
{url: `/file`, method: '
|
|
346
|
+
{url: `/file`, method: 'DELETE',
|
|
317
347
|
params
|
|
318
348
|
},
|
|
319
349
|
options);
|
|
@@ -322,7 +352,6 @@ export const deleteUnmanagedFile = (
|
|
|
322
352
|
|
|
323
353
|
|
|
324
354
|
export const getDeleteUnmanagedFileMutationOptions = <TError = ErrorType<DmError>,
|
|
325
|
-
|
|
326
355
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
327
356
|
): UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext> => {
|
|
328
357
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -349,7 +378,6 @@ export const getDeleteUnmanagedFileMutationOptions = <TError = ErrorType<DmError
|
|
|
349
378
|
* @summary Delete an unmanaged Project File
|
|
350
379
|
*/
|
|
351
380
|
export const useDeleteUnmanagedFile = <TError = ErrorType<DmError>,
|
|
352
|
-
|
|
353
381
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
354
382
|
) => {
|
|
355
383
|
|
|
@@ -360,7 +388,7 @@ export const useDeleteUnmanagedFile = <TError = ErrorType<DmError>,
|
|
|
360
388
|
/**
|
|
361
389
|
* Given a `file_id` the file will be removed from the Project it's attached to.
|
|
362
390
|
|
|
363
|
-
You must be an `editor`
|
|
391
|
+
You must be an `editor` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.
|
|
364
392
|
|
|
365
393
|
You cannot delete a Project File until the attach is complete.
|
|
366
394
|
|
|
@@ -372,7 +400,7 @@ export const deleteFile = (
|
|
|
372
400
|
|
|
373
401
|
|
|
374
402
|
return customInstance<void>(
|
|
375
|
-
{url: `/file/${fileId}`, method: '
|
|
403
|
+
{url: `/file/${fileId}`, method: 'DELETE'
|
|
376
404
|
},
|
|
377
405
|
options);
|
|
378
406
|
}
|
|
@@ -380,7 +408,6 @@ export const deleteFile = (
|
|
|
380
408
|
|
|
381
409
|
|
|
382
410
|
export const getDeleteFileMutationOptions = <TError = ErrorType<DmError>,
|
|
383
|
-
|
|
384
411
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
385
412
|
): UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext> => {
|
|
386
413
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -407,7 +434,6 @@ export const getDeleteFileMutationOptions = <TError = ErrorType<DmError>,
|
|
|
407
434
|
* @summary Delete/detach a File (from a Project)
|
|
408
435
|
*/
|
|
409
436
|
export const useDeleteFile = <TError = ErrorType<DmError>,
|
|
410
|
-
|
|
411
437
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
412
438
|
) => {
|
|
413
439
|
|
|
@@ -429,19 +455,18 @@ export const downloadFile = (
|
|
|
429
455
|
|
|
430
456
|
|
|
431
457
|
return customInstance<void>(
|
|
432
|
-
{url: `/file/${fileId}`, method: '
|
|
458
|
+
{url: `/file/${fileId}`, method: 'GET', signal
|
|
433
459
|
},
|
|
434
460
|
options);
|
|
435
461
|
}
|
|
436
462
|
|
|
437
463
|
|
|
438
464
|
export const getDownloadFileQueryKey = (fileId: string,) => {
|
|
439
|
-
|
|
440
465
|
return ["data-manager-api", `/file/${fileId}`] as const;
|
|
441
466
|
}
|
|
442
467
|
|
|
443
468
|
|
|
444
|
-
export const getDownloadFileQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData
|
|
469
|
+
export const getDownloadFileQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
445
470
|
) => {
|
|
446
471
|
|
|
447
472
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -466,7 +491,7 @@ export type DownloadFileQueryError = ErrorType<DmError>
|
|
|
466
491
|
* @summary Download a File (from a project)
|
|
467
492
|
*/
|
|
468
493
|
export const useDownloadFile = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(
|
|
469
|
-
fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData
|
|
494
|
+
fileId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
470
495
|
|
|
471
496
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
472
497
|
|
|
@@ -481,3 +506,43 @@ export const useDownloadFile = <TData = Awaited<ReturnType<typeof downloadFile>>
|
|
|
481
506
|
|
|
482
507
|
|
|
483
508
|
|
|
509
|
+
export const getDownloadFileSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
510
|
+
) => {
|
|
511
|
+
|
|
512
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
513
|
+
|
|
514
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) => downloadFile(fileId, requestOptions, signal);
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
return { queryKey, queryFn, enabled: !!(fileId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & { queryKey: QueryKey }
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export type DownloadFileSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>
|
|
528
|
+
export type DownloadFileSuspenseQueryError = ErrorType<DmError>
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @summary Download a File (from a project)
|
|
532
|
+
*/
|
|
533
|
+
export const useDownloadFileSuspense = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(
|
|
534
|
+
fileId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
535
|
+
|
|
536
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
537
|
+
|
|
538
|
+
const queryOptions = getDownloadFileSuspenseQueryOptions(fileId,options)
|
|
539
|
+
|
|
540
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
541
|
+
|
|
542
|
+
query.queryKey = queryOptions.queryKey ;
|
|
543
|
+
|
|
544
|
+
return query;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|