@squonk/data-manager-client 0.7.10 → 0.7.11-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accounting/accounting.cjs +10 -8
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.ts +9 -8
- package/accounting/accounting.js +10 -8
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +17 -17
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +13 -12
- package/admin/admin.js +17 -17
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +12 -8
- package/application/application.cjs.map +1 -1
- package/application/application.d.ts +9 -8
- package/application/application.js +12 -8
- package/application/application.js.map +1 -1
- package/{custom-instance-6e6b0801.d.ts → custom-instance-da4fff1f.d.ts} +144 -116
- package/dataset/dataset.cjs +42 -30
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.ts +19 -18
- package/dataset/dataset.js +42 -30
- package/dataset/dataset.js.map +1 -1
- package/file/file.cjs +18 -14
- package/file/file.cjs.map +1 -1
- package/file/file.d.ts +11 -10
- package/file/file.js +18 -14
- package/file/file.js.map +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +35 -15
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.ts +33 -10
- package/instance/instance.js +34 -14
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +12 -8
- package/job/job.cjs.map +1 -1
- package/job/job.d.ts +9 -8
- package/job/job.js +12 -8
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +18 -12
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.ts +10 -9
- package/metadata/metadata.js +18 -12
- package/metadata/metadata.js.map +1 -1
- package/package.json +9 -9
- package/project/project.cjs +52 -25
- package/project/project.cjs.map +1 -1
- package/project/project.d.ts +35 -15
- package/project/project.js +51 -24
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +29 -25
- package/src/admin/admin.ts +55 -57
- package/src/application/application.ts +30 -29
- package/src/data-manager-api.schemas.ts +178 -180
- package/src/dataset/dataset.ts +113 -90
- package/src/file/file.ts +54 -47
- package/src/instance/instance.ts +118 -51
- package/src/job/job.ts +30 -25
- package/src/metadata/metadata.ts +50 -41
- package/src/project/project.ts +163 -78
- package/src/task/task.ts +40 -31
- package/src/type/type.ts +23 -20
- package/src/user/user.ts +55 -48
- package/task/task.cjs +14 -10
- package/task/task.cjs.map +1 -1
- package/task/task.d.ts +9 -8
- package/task/task.js +14 -10
- package/task/task.js.map +1 -1
- package/type/type.cjs +6 -4
- package/type/type.cjs.map +1 -1
- package/type/type.d.ts +7 -6
- package/type/type.js +6 -4
- package/type/type.js.map +1 -1
- package/user/user.cjs +20 -14
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +11 -10
- package/user/user.js +20 -14
- package/user/user.js.map +1 -1
package/src/project/project.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.8.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -28,15 +28,13 @@ import type {
|
|
|
28
28
|
ProjectDeleteResponse,
|
|
29
29
|
GetProjectFileParams,
|
|
30
30
|
ProjectFilePutBodyBody,
|
|
31
|
+
GetProjectFileWithTokenParams,
|
|
31
32
|
} from "../data-manager-api.schemas";
|
|
32
33
|
import { customInstance, ErrorType } from ".././custom-instance";
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
) => Promise<infer R>
|
|
38
|
-
? R
|
|
39
|
-
: any;
|
|
35
|
+
export type AwaitedInput<T> = PromiseLike<T> | T;
|
|
36
|
+
|
|
37
|
+
export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
40
38
|
|
|
41
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
40
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -52,10 +50,11 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
52
50
|
* @summary Get all projects available to you
|
|
53
51
|
*/
|
|
54
52
|
export const getProjects = (
|
|
55
|
-
options?: SecondParameter<typeof customInstance
|
|
53
|
+
options?: SecondParameter<typeof customInstance>,
|
|
54
|
+
signal?: AbortSignal
|
|
56
55
|
) => {
|
|
57
56
|
return customInstance<ProjectsGetResponse>(
|
|
58
|
-
{ url: `/project`, method: "get" },
|
|
57
|
+
{ url: `/project`, method: "get", signal },
|
|
59
58
|
options
|
|
60
59
|
);
|
|
61
60
|
};
|
|
@@ -63,29 +62,34 @@ export const getProjects = (
|
|
|
63
62
|
export const getGetProjectsQueryKey = () => [`/project`];
|
|
64
63
|
|
|
65
64
|
export type GetProjectsQueryResult = NonNullable<
|
|
66
|
-
|
|
65
|
+
Awaited<ReturnType<typeof getProjects>>
|
|
67
66
|
>;
|
|
68
67
|
export type GetProjectsQueryError = ErrorType<void | DmError>;
|
|
69
68
|
|
|
70
69
|
export const useGetProjects = <
|
|
71
|
-
TData =
|
|
70
|
+
TData = Awaited<ReturnType<typeof getProjects>>,
|
|
72
71
|
TError = ErrorType<void | DmError>
|
|
73
72
|
>(options?: {
|
|
74
|
-
query?: UseQueryOptions<
|
|
73
|
+
query?: UseQueryOptions<
|
|
74
|
+
Awaited<ReturnType<typeof getProjects>>,
|
|
75
|
+
TError,
|
|
76
|
+
TData
|
|
77
|
+
>;
|
|
75
78
|
request?: SecondParameter<typeof customInstance>;
|
|
76
79
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
77
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
80
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
78
81
|
|
|
79
82
|
const queryKey = queryOptions?.queryKey ?? getGetProjectsQueryKey();
|
|
80
83
|
|
|
81
|
-
const queryFn: QueryFunction<
|
|
82
|
-
|
|
84
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjects>>> = ({
|
|
85
|
+
signal,
|
|
86
|
+
}) => getProjects(requestOptions, signal);
|
|
83
87
|
|
|
84
|
-
const query = useQuery<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
88
|
+
const query = useQuery<
|
|
89
|
+
Awaited<ReturnType<typeof getProjects>>,
|
|
90
|
+
TError,
|
|
91
|
+
TData
|
|
92
|
+
>(queryKey, queryFn, queryOptions);
|
|
89
93
|
|
|
90
94
|
return {
|
|
91
95
|
queryKey,
|
|
@@ -129,7 +133,7 @@ export const createProject = (
|
|
|
129
133
|
};
|
|
130
134
|
|
|
131
135
|
export type CreateProjectMutationResult = NonNullable<
|
|
132
|
-
|
|
136
|
+
Awaited<ReturnType<typeof createProject>>
|
|
133
137
|
>;
|
|
134
138
|
export type CreateProjectMutationBody = ProjectPostBodyBody;
|
|
135
139
|
export type CreateProjectMutationError = ErrorType<DmError | void>;
|
|
@@ -139,26 +143,26 @@ export const useCreateProject = <
|
|
|
139
143
|
TContext = unknown
|
|
140
144
|
>(options?: {
|
|
141
145
|
mutation?: UseMutationOptions<
|
|
142
|
-
|
|
146
|
+
Awaited<ReturnType<typeof createProject>>,
|
|
143
147
|
TError,
|
|
144
148
|
{ data: ProjectPostBodyBody },
|
|
145
149
|
TContext
|
|
146
150
|
>;
|
|
147
151
|
request?: SecondParameter<typeof customInstance>;
|
|
148
152
|
}) => {
|
|
149
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
153
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
150
154
|
|
|
151
155
|
const mutationFn: MutationFunction<
|
|
152
|
-
|
|
156
|
+
Awaited<ReturnType<typeof createProject>>,
|
|
153
157
|
{ data: ProjectPostBodyBody }
|
|
154
158
|
> = (props) => {
|
|
155
|
-
const { data } = props
|
|
159
|
+
const { data } = props ?? {};
|
|
156
160
|
|
|
157
161
|
return createProject(data, requestOptions);
|
|
158
162
|
};
|
|
159
163
|
|
|
160
164
|
return useMutation<
|
|
161
|
-
|
|
165
|
+
Awaited<ReturnType<typeof createProject>>,
|
|
162
166
|
TError,
|
|
163
167
|
{ data: ProjectPostBodyBody },
|
|
164
168
|
TContext
|
|
@@ -171,10 +175,11 @@ export const useCreateProject = <
|
|
|
171
175
|
*/
|
|
172
176
|
export const getProject = (
|
|
173
177
|
projectId: string,
|
|
174
|
-
options?: SecondParameter<typeof customInstance
|
|
178
|
+
options?: SecondParameter<typeof customInstance>,
|
|
179
|
+
signal?: AbortSignal
|
|
175
180
|
) => {
|
|
176
181
|
return customInstance<ProjectGetResponse>(
|
|
177
|
-
{ url: `/project/${projectId}`, method: "get" },
|
|
182
|
+
{ url: `/project/${projectId}`, method: "get", signal },
|
|
178
183
|
options
|
|
179
184
|
);
|
|
180
185
|
};
|
|
@@ -184,28 +189,33 @@ export const getGetProjectQueryKey = (projectId: string) => [
|
|
|
184
189
|
];
|
|
185
190
|
|
|
186
191
|
export type GetProjectQueryResult = NonNullable<
|
|
187
|
-
|
|
192
|
+
Awaited<ReturnType<typeof getProject>>
|
|
188
193
|
>;
|
|
189
194
|
export type GetProjectQueryError = ErrorType<void | DmError>;
|
|
190
195
|
|
|
191
196
|
export const useGetProject = <
|
|
192
|
-
TData =
|
|
197
|
+
TData = Awaited<ReturnType<typeof getProject>>,
|
|
193
198
|
TError = ErrorType<void | DmError>
|
|
194
199
|
>(
|
|
195
200
|
projectId: string,
|
|
196
201
|
options?: {
|
|
197
|
-
query?: UseQueryOptions<
|
|
202
|
+
query?: UseQueryOptions<
|
|
203
|
+
Awaited<ReturnType<typeof getProject>>,
|
|
204
|
+
TError,
|
|
205
|
+
TData
|
|
206
|
+
>;
|
|
198
207
|
request?: SecondParameter<typeof customInstance>;
|
|
199
208
|
}
|
|
200
209
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
201
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
210
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
202
211
|
|
|
203
212
|
const queryKey = queryOptions?.queryKey ?? getGetProjectQueryKey(projectId);
|
|
204
213
|
|
|
205
|
-
const queryFn: QueryFunction<
|
|
206
|
-
|
|
214
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProject>>> = ({
|
|
215
|
+
signal,
|
|
216
|
+
}) => getProject(projectId, requestOptions, signal);
|
|
207
217
|
|
|
208
|
-
const query = useQuery<
|
|
218
|
+
const query = useQuery<Awaited<ReturnType<typeof getProject>>, TError, TData>(
|
|
209
219
|
queryKey,
|
|
210
220
|
queryFn,
|
|
211
221
|
{ enabled: !!projectId, ...queryOptions }
|
|
@@ -247,7 +257,7 @@ export const patchProject = (
|
|
|
247
257
|
};
|
|
248
258
|
|
|
249
259
|
export type PatchProjectMutationResult = NonNullable<
|
|
250
|
-
|
|
260
|
+
Awaited<ReturnType<typeof patchProject>>
|
|
251
261
|
>;
|
|
252
262
|
export type PatchProjectMutationBody = ProjectPatchBodyBody;
|
|
253
263
|
export type PatchProjectMutationError = ErrorType<DmError>;
|
|
@@ -257,26 +267,26 @@ export const usePatchProject = <
|
|
|
257
267
|
TContext = unknown
|
|
258
268
|
>(options?: {
|
|
259
269
|
mutation?: UseMutationOptions<
|
|
260
|
-
|
|
270
|
+
Awaited<ReturnType<typeof patchProject>>,
|
|
261
271
|
TError,
|
|
262
272
|
{ projectId: string; data: ProjectPatchBodyBody },
|
|
263
273
|
TContext
|
|
264
274
|
>;
|
|
265
275
|
request?: SecondParameter<typeof customInstance>;
|
|
266
276
|
}) => {
|
|
267
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
277
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
268
278
|
|
|
269
279
|
const mutationFn: MutationFunction<
|
|
270
|
-
|
|
280
|
+
Awaited<ReturnType<typeof patchProject>>,
|
|
271
281
|
{ projectId: string; data: ProjectPatchBodyBody }
|
|
272
282
|
> = (props) => {
|
|
273
|
-
const { projectId, data } = props
|
|
283
|
+
const { projectId, data } = props ?? {};
|
|
274
284
|
|
|
275
285
|
return patchProject(projectId, data, requestOptions);
|
|
276
286
|
};
|
|
277
287
|
|
|
278
288
|
return useMutation<
|
|
279
|
-
|
|
289
|
+
Awaited<ReturnType<typeof patchProject>>,
|
|
280
290
|
TError,
|
|
281
291
|
{ projectId: string; data: ProjectPatchBodyBody },
|
|
282
292
|
TContext
|
|
@@ -302,7 +312,7 @@ export const deleteProject = (
|
|
|
302
312
|
};
|
|
303
313
|
|
|
304
314
|
export type DeleteProjectMutationResult = NonNullable<
|
|
305
|
-
|
|
315
|
+
Awaited<ReturnType<typeof deleteProject>>
|
|
306
316
|
>;
|
|
307
317
|
|
|
308
318
|
export type DeleteProjectMutationError = ErrorType<void | DmError>;
|
|
@@ -312,26 +322,26 @@ export const useDeleteProject = <
|
|
|
312
322
|
TContext = unknown
|
|
313
323
|
>(options?: {
|
|
314
324
|
mutation?: UseMutationOptions<
|
|
315
|
-
|
|
325
|
+
Awaited<ReturnType<typeof deleteProject>>,
|
|
316
326
|
TError,
|
|
317
327
|
{ projectId: string },
|
|
318
328
|
TContext
|
|
319
329
|
>;
|
|
320
330
|
request?: SecondParameter<typeof customInstance>;
|
|
321
331
|
}) => {
|
|
322
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
332
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
323
333
|
|
|
324
334
|
const mutationFn: MutationFunction<
|
|
325
|
-
|
|
335
|
+
Awaited<ReturnType<typeof deleteProject>>,
|
|
326
336
|
{ projectId: string }
|
|
327
337
|
> = (props) => {
|
|
328
|
-
const { projectId } = props
|
|
338
|
+
const { projectId } = props ?? {};
|
|
329
339
|
|
|
330
340
|
return deleteProject(projectId, requestOptions);
|
|
331
341
|
};
|
|
332
342
|
|
|
333
343
|
return useMutation<
|
|
334
|
-
|
|
344
|
+
Awaited<ReturnType<typeof deleteProject>>,
|
|
335
345
|
TError,
|
|
336
346
|
{ projectId: string },
|
|
337
347
|
TContext
|
|
@@ -358,7 +368,7 @@ export const addEditorToProject = (
|
|
|
358
368
|
};
|
|
359
369
|
|
|
360
370
|
export type AddEditorToProjectMutationResult = NonNullable<
|
|
361
|
-
|
|
371
|
+
Awaited<ReturnType<typeof addEditorToProject>>
|
|
362
372
|
>;
|
|
363
373
|
|
|
364
374
|
export type AddEditorToProjectMutationError = ErrorType<DmError>;
|
|
@@ -368,26 +378,26 @@ export const useAddEditorToProject = <
|
|
|
368
378
|
TContext = unknown
|
|
369
379
|
>(options?: {
|
|
370
380
|
mutation?: UseMutationOptions<
|
|
371
|
-
|
|
381
|
+
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
372
382
|
TError,
|
|
373
383
|
{ projectId: string; userId: string },
|
|
374
384
|
TContext
|
|
375
385
|
>;
|
|
376
386
|
request?: SecondParameter<typeof customInstance>;
|
|
377
387
|
}) => {
|
|
378
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
388
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
379
389
|
|
|
380
390
|
const mutationFn: MutationFunction<
|
|
381
|
-
|
|
391
|
+
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
382
392
|
{ projectId: string; userId: string }
|
|
383
393
|
> = (props) => {
|
|
384
|
-
const { projectId, userId } = props
|
|
394
|
+
const { projectId, userId } = props ?? {};
|
|
385
395
|
|
|
386
396
|
return addEditorToProject(projectId, userId, requestOptions);
|
|
387
397
|
};
|
|
388
398
|
|
|
389
399
|
return useMutation<
|
|
390
|
-
|
|
400
|
+
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
391
401
|
TError,
|
|
392
402
|
{ projectId: string; userId: string },
|
|
393
403
|
TContext
|
|
@@ -414,7 +424,7 @@ export const removeEditorFromProject = (
|
|
|
414
424
|
};
|
|
415
425
|
|
|
416
426
|
export type RemoveEditorFromProjectMutationResult = NonNullable<
|
|
417
|
-
|
|
427
|
+
Awaited<ReturnType<typeof removeEditorFromProject>>
|
|
418
428
|
>;
|
|
419
429
|
|
|
420
430
|
export type RemoveEditorFromProjectMutationError = ErrorType<DmError>;
|
|
@@ -424,26 +434,26 @@ export const useRemoveEditorFromProject = <
|
|
|
424
434
|
TContext = unknown
|
|
425
435
|
>(options?: {
|
|
426
436
|
mutation?: UseMutationOptions<
|
|
427
|
-
|
|
437
|
+
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
428
438
|
TError,
|
|
429
439
|
{ projectId: string; userId: string },
|
|
430
440
|
TContext
|
|
431
441
|
>;
|
|
432
442
|
request?: SecondParameter<typeof customInstance>;
|
|
433
443
|
}) => {
|
|
434
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
444
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
435
445
|
|
|
436
446
|
const mutationFn: MutationFunction<
|
|
437
|
-
|
|
447
|
+
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
438
448
|
{ projectId: string; userId: string }
|
|
439
449
|
> = (props) => {
|
|
440
|
-
const { projectId, userId } = props
|
|
450
|
+
const { projectId, userId } = props ?? {};
|
|
441
451
|
|
|
442
452
|
return removeEditorFromProject(projectId, userId, requestOptions);
|
|
443
453
|
};
|
|
444
454
|
|
|
445
455
|
return useMutation<
|
|
446
|
-
|
|
456
|
+
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
447
457
|
TError,
|
|
448
458
|
{ projectId: string; userId: string },
|
|
449
459
|
TContext
|
|
@@ -461,10 +471,11 @@ You must be an `editor` or the `owner` of the project if the project is private
|
|
|
461
471
|
export const getProjectFile = (
|
|
462
472
|
projectId: string,
|
|
463
473
|
params?: GetProjectFileParams,
|
|
464
|
-
options?: SecondParameter<typeof customInstance
|
|
474
|
+
options?: SecondParameter<typeof customInstance>,
|
|
475
|
+
signal?: AbortSignal
|
|
465
476
|
) => {
|
|
466
477
|
return customInstance<void>(
|
|
467
|
-
{ url: `/project/${projectId}/file`, method: "get", params },
|
|
478
|
+
{ url: `/project/${projectId}/file`, method: "get", signal, params },
|
|
468
479
|
options
|
|
469
480
|
);
|
|
470
481
|
};
|
|
@@ -475,38 +486,39 @@ export const getGetProjectFileQueryKey = (
|
|
|
475
486
|
) => [`/project/${projectId}/file`, ...(params ? [params] : [])];
|
|
476
487
|
|
|
477
488
|
export type GetProjectFileQueryResult = NonNullable<
|
|
478
|
-
|
|
489
|
+
Awaited<ReturnType<typeof getProjectFile>>
|
|
479
490
|
>;
|
|
480
491
|
export type GetProjectFileQueryError = ErrorType<DmError>;
|
|
481
492
|
|
|
482
493
|
export const useGetProjectFile = <
|
|
483
|
-
TData =
|
|
494
|
+
TData = Awaited<ReturnType<typeof getProjectFile>>,
|
|
484
495
|
TError = ErrorType<DmError>
|
|
485
496
|
>(
|
|
486
497
|
projectId: string,
|
|
487
498
|
params?: GetProjectFileParams,
|
|
488
499
|
options?: {
|
|
489
500
|
query?: UseQueryOptions<
|
|
490
|
-
|
|
501
|
+
Awaited<ReturnType<typeof getProjectFile>>,
|
|
491
502
|
TError,
|
|
492
503
|
TData
|
|
493
504
|
>;
|
|
494
505
|
request?: SecondParameter<typeof customInstance>;
|
|
495
506
|
}
|
|
496
507
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
497
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
508
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
498
509
|
|
|
499
510
|
const queryKey =
|
|
500
511
|
queryOptions?.queryKey ?? getGetProjectFileQueryKey(projectId, params);
|
|
501
512
|
|
|
502
|
-
const queryFn: QueryFunction<
|
|
503
|
-
|
|
513
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjectFile>>> = ({
|
|
514
|
+
signal,
|
|
515
|
+
}) => getProjectFile(projectId, params, requestOptions, signal);
|
|
504
516
|
|
|
505
|
-
const query = useQuery<
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
);
|
|
517
|
+
const query = useQuery<
|
|
518
|
+
Awaited<ReturnType<typeof getProjectFile>>,
|
|
519
|
+
TError,
|
|
520
|
+
TData
|
|
521
|
+
>(queryKey, queryFn, { enabled: !!projectId, ...queryOptions });
|
|
510
522
|
|
|
511
523
|
return {
|
|
512
524
|
queryKey,
|
|
@@ -547,7 +559,7 @@ export const addFileToProject = (
|
|
|
547
559
|
};
|
|
548
560
|
|
|
549
561
|
export type AddFileToProjectMutationResult = NonNullable<
|
|
550
|
-
|
|
562
|
+
Awaited<ReturnType<typeof addFileToProject>>
|
|
551
563
|
>;
|
|
552
564
|
export type AddFileToProjectMutationBody = ProjectFilePutBodyBody;
|
|
553
565
|
export type AddFileToProjectMutationError = ErrorType<DmError>;
|
|
@@ -557,28 +569,101 @@ export const useAddFileToProject = <
|
|
|
557
569
|
TContext = unknown
|
|
558
570
|
>(options?: {
|
|
559
571
|
mutation?: UseMutationOptions<
|
|
560
|
-
|
|
572
|
+
Awaited<ReturnType<typeof addFileToProject>>,
|
|
561
573
|
TError,
|
|
562
574
|
{ projectId: string; data: ProjectFilePutBodyBody },
|
|
563
575
|
TContext
|
|
564
576
|
>;
|
|
565
577
|
request?: SecondParameter<typeof customInstance>;
|
|
566
578
|
}) => {
|
|
567
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
579
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
568
580
|
|
|
569
581
|
const mutationFn: MutationFunction<
|
|
570
|
-
|
|
582
|
+
Awaited<ReturnType<typeof addFileToProject>>,
|
|
571
583
|
{ projectId: string; data: ProjectFilePutBodyBody }
|
|
572
584
|
> = (props) => {
|
|
573
|
-
const { projectId, data } = props
|
|
585
|
+
const { projectId, data } = props ?? {};
|
|
574
586
|
|
|
575
587
|
return addFileToProject(projectId, data, requestOptions);
|
|
576
588
|
};
|
|
577
589
|
|
|
578
590
|
return useMutation<
|
|
579
|
-
|
|
591
|
+
Awaited<ReturnType<typeof addFileToProject>>,
|
|
580
592
|
TError,
|
|
581
593
|
{ projectId: string; data: ProjectFilePutBodyBody },
|
|
582
594
|
TContext
|
|
583
595
|
>(mutationFn, mutationOptions);
|
|
584
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
* Gets a file from the project, with an optional path. This method should be used to get arbitrary files from the Project's file system (typically **unmanaged** files).
|
|
599
|
+
|
|
600
|
+
For **managed** files you should consider using the `/file/{file_id}` endpoint.
|
|
601
|
+
|
|
602
|
+
As there is no security You must provide a valid token. The token must be a token valid for the project, usually generted when an Instance has been launched in the Project. If the token is not valid ou will receive a `403` error
|
|
603
|
+
|
|
604
|
+
* @summary Download a project file using a token
|
|
605
|
+
*/
|
|
606
|
+
export const getProjectFileWithToken = (
|
|
607
|
+
projectId: string,
|
|
608
|
+
params?: GetProjectFileWithTokenParams,
|
|
609
|
+
options?: SecondParameter<typeof customInstance>,
|
|
610
|
+
signal?: AbortSignal
|
|
611
|
+
) => {
|
|
612
|
+
return customInstance<void>(
|
|
613
|
+
{
|
|
614
|
+
url: `/project/${projectId}/file-with-token`,
|
|
615
|
+
method: "get",
|
|
616
|
+
signal,
|
|
617
|
+
params,
|
|
618
|
+
},
|
|
619
|
+
options
|
|
620
|
+
);
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
export const getGetProjectFileWithTokenQueryKey = (
|
|
624
|
+
projectId: string,
|
|
625
|
+
params?: GetProjectFileWithTokenParams
|
|
626
|
+
) => [`/project/${projectId}/file-with-token`, ...(params ? [params] : [])];
|
|
627
|
+
|
|
628
|
+
export type GetProjectFileWithTokenQueryResult = NonNullable<
|
|
629
|
+
Awaited<ReturnType<typeof getProjectFileWithToken>>
|
|
630
|
+
>;
|
|
631
|
+
export type GetProjectFileWithTokenQueryError = ErrorType<DmError>;
|
|
632
|
+
|
|
633
|
+
export const useGetProjectFileWithToken = <
|
|
634
|
+
TData = Awaited<ReturnType<typeof getProjectFileWithToken>>,
|
|
635
|
+
TError = ErrorType<DmError>
|
|
636
|
+
>(
|
|
637
|
+
projectId: string,
|
|
638
|
+
params?: GetProjectFileWithTokenParams,
|
|
639
|
+
options?: {
|
|
640
|
+
query?: UseQueryOptions<
|
|
641
|
+
Awaited<ReturnType<typeof getProjectFileWithToken>>,
|
|
642
|
+
TError,
|
|
643
|
+
TData
|
|
644
|
+
>;
|
|
645
|
+
request?: SecondParameter<typeof customInstance>;
|
|
646
|
+
}
|
|
647
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
648
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
649
|
+
|
|
650
|
+
const queryKey =
|
|
651
|
+
queryOptions?.queryKey ??
|
|
652
|
+
getGetProjectFileWithTokenQueryKey(projectId, params);
|
|
653
|
+
|
|
654
|
+
const queryFn: QueryFunction<
|
|
655
|
+
Awaited<ReturnType<typeof getProjectFileWithToken>>
|
|
656
|
+
> = ({ signal }) =>
|
|
657
|
+
getProjectFileWithToken(projectId, params, requestOptions, signal);
|
|
658
|
+
|
|
659
|
+
const query = useQuery<
|
|
660
|
+
Awaited<ReturnType<typeof getProjectFileWithToken>>,
|
|
661
|
+
TError,
|
|
662
|
+
TData
|
|
663
|
+
>(queryKey, queryFn, { enabled: !!projectId, ...queryOptions });
|
|
664
|
+
|
|
665
|
+
return {
|
|
666
|
+
queryKey,
|
|
667
|
+
...query,
|
|
668
|
+
};
|
|
669
|
+
};
|