@squonk/data-manager-client 0.7.3 → 0.7.8-rc.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/accounting/accounting.cjs +5 -5
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.ts +8 -3
- package/accounting/accounting.js +1 -1
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +35 -25
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +36 -17
- package/admin/admin.js +32 -22
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +12 -12
- package/application/application.cjs.map +1 -1
- package/application/application.d.ts +11 -6
- package/application/application.js +9 -9
- package/application/application.js.map +1 -1
- package/{chunk-JR7F532L.js → chunk-6EEIAH4R.js} +1 -1
- package/{chunk-JR7F532L.js.map → chunk-6EEIAH4R.js.map} +1 -1
- package/{chunk-3DXYUDZH.cjs → chunk-NGBTCJWS.cjs} +1 -1
- package/chunk-NGBTCJWS.cjs.map +1 -0
- package/{custom-instance-32850190.d.ts → custom-instance-42e56f26.d.ts} +10 -3
- package/dataset/dataset.cjs +62 -52
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.ts +52 -29
- package/dataset/dataset.js +54 -44
- package/dataset/dataset.js.map +1 -1
- package/file/file.cjs +22 -17
- package/file/file.cjs.map +1 -1
- package/file/file.d.ts +20 -8
- package/file/file.js +18 -13
- package/file/file.js.map +1 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +26 -21
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.ts +23 -11
- package/instance/instance.js +23 -18
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +11 -11
- package/job/job.cjs.map +1 -1
- package/job/job.d.ts +11 -6
- package/job/job.js +8 -8
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +34 -28
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.ts +27 -16
- package/metadata/metadata.js +30 -24
- package/metadata/metadata.js.map +1 -1
- package/package.json +14 -14
- package/project/project.cjs +56 -41
- package/project/project.cjs.map +1 -1
- package/project/project.d.ts +49 -27
- package/project/project.js +52 -37
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +11 -1
- package/src/admin/admin.ts +94 -37
- package/src/application/application.ts +19 -9
- package/src/data-manager-api.schemas.ts +6 -3
- package/src/dataset/dataset.ts +130 -65
- package/src/file/file.ts +47 -16
- package/src/instance/instance.ts +57 -24
- package/src/job/job.ts +14 -8
- package/src/metadata/metadata.ts +66 -38
- package/src/project/project.ts +121 -55
- package/src/task/task.ts +28 -16
- package/src/type/type.ts +6 -1
- package/src/user/user.ts +26 -2
- package/task/task.cjs +16 -16
- package/task/task.cjs.map +1 -1
- package/task/task.d.ts +15 -8
- package/task/task.js +13 -13
- package/task/task.js.map +1 -1
- package/type/type.cjs +3 -3
- package/type/type.cjs.map +1 -1
- package/type/type.d.ts +6 -3
- package/type/type.js +1 -1
- package/type/type.js.map +1 -1
- package/user/user.cjs +13 -8
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +12 -2
- package/user/user.js +7 -2
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs.map +0 -1
package/src/instance/instance.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -82,11 +82,22 @@ export const createInstance = (
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
return customInstance<InstancePostResponse>(
|
|
85
|
-
{
|
|
85
|
+
{
|
|
86
|
+
url: `/instance`,
|
|
87
|
+
method: "post",
|
|
88
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
89
|
+
data: formData,
|
|
90
|
+
},
|
|
86
91
|
options
|
|
87
92
|
);
|
|
88
93
|
};
|
|
89
94
|
|
|
95
|
+
export type CreateInstanceMutationResult = NonNullable<
|
|
96
|
+
AsyncReturnType<typeof createInstance>
|
|
97
|
+
>;
|
|
98
|
+
export type CreateInstanceMutationBody = InstancePostBodyBody;
|
|
99
|
+
export type CreateInstanceMutationError = ErrorType<void | DmError>;
|
|
100
|
+
|
|
90
101
|
export const useCreateInstance = <
|
|
91
102
|
TError = ErrorType<void | DmError>,
|
|
92
103
|
TContext = unknown
|
|
@@ -137,6 +148,11 @@ export const getGetInstancesQueryKey = (params?: GetInstancesParams) => [
|
|
|
137
148
|
...(params ? [params] : []),
|
|
138
149
|
];
|
|
139
150
|
|
|
151
|
+
export type GetInstancesQueryResult = NonNullable<
|
|
152
|
+
AsyncReturnType<typeof getInstances>
|
|
153
|
+
>;
|
|
154
|
+
export type GetInstancesQueryError = ErrorType<void | DmError>;
|
|
155
|
+
|
|
140
156
|
export const useGetInstances = <
|
|
141
157
|
TData = AsyncReturnType<typeof getInstances>,
|
|
142
158
|
TError = ErrorType<void | DmError>
|
|
@@ -176,24 +192,29 @@ export const useGetInstances = <
|
|
|
176
192
|
* @summary Get detailed information about a specific instance
|
|
177
193
|
*/
|
|
178
194
|
export const getInstance = (
|
|
179
|
-
|
|
195
|
+
instanceId: string,
|
|
180
196
|
options?: SecondParameter<typeof customInstance>
|
|
181
197
|
) => {
|
|
182
198
|
return customInstance<InstanceGetResponse>(
|
|
183
|
-
{ url: `/instance/${
|
|
199
|
+
{ url: `/instance/${instanceId}`, method: "get" },
|
|
184
200
|
options
|
|
185
201
|
);
|
|
186
202
|
};
|
|
187
203
|
|
|
188
|
-
export const getGetInstanceQueryKey = (
|
|
189
|
-
`/instance/${
|
|
204
|
+
export const getGetInstanceQueryKey = (instanceId: string) => [
|
|
205
|
+
`/instance/${instanceId}`,
|
|
190
206
|
];
|
|
191
207
|
|
|
208
|
+
export type GetInstanceQueryResult = NonNullable<
|
|
209
|
+
AsyncReturnType<typeof getInstance>
|
|
210
|
+
>;
|
|
211
|
+
export type GetInstanceQueryError = ErrorType<void | DmError>;
|
|
212
|
+
|
|
192
213
|
export const useGetInstance = <
|
|
193
214
|
TData = AsyncReturnType<typeof getInstance>,
|
|
194
215
|
TError = ErrorType<void | DmError>
|
|
195
216
|
>(
|
|
196
|
-
|
|
217
|
+
instanceId: string,
|
|
197
218
|
options?: {
|
|
198
219
|
query?: UseQueryOptions<AsyncReturnType<typeof getInstance>, TError, TData>;
|
|
199
220
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -201,15 +222,15 @@ export const useGetInstance = <
|
|
|
201
222
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
202
223
|
const { query: queryOptions, request: requestOptions } = options || {};
|
|
203
224
|
|
|
204
|
-
const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(
|
|
225
|
+
const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(instanceId);
|
|
205
226
|
|
|
206
227
|
const queryFn: QueryFunction<AsyncReturnType<typeof getInstance>> = () =>
|
|
207
|
-
getInstance(
|
|
228
|
+
getInstance(instanceId, requestOptions);
|
|
208
229
|
|
|
209
230
|
const query = useQuery<AsyncReturnType<typeof getInstance>, TError, TData>(
|
|
210
231
|
queryKey,
|
|
211
232
|
queryFn,
|
|
212
|
-
{ enabled: !!
|
|
233
|
+
{ enabled: !!instanceId, ...queryOptions }
|
|
213
234
|
);
|
|
214
235
|
|
|
215
236
|
return {
|
|
@@ -226,15 +247,21 @@ You must be the `owner` or an `editor` of the instance to delete it
|
|
|
226
247
|
* @summary Delete an application instance
|
|
227
248
|
*/
|
|
228
249
|
export const terminateInstance = (
|
|
229
|
-
|
|
250
|
+
instanceId: string,
|
|
230
251
|
options?: SecondParameter<typeof customInstance>
|
|
231
252
|
) => {
|
|
232
253
|
return customInstance<InstanceDeleteResponse>(
|
|
233
|
-
{ url: `/instance/${
|
|
254
|
+
{ url: `/instance/${instanceId}`, method: "delete" },
|
|
234
255
|
options
|
|
235
256
|
);
|
|
236
257
|
};
|
|
237
258
|
|
|
259
|
+
export type TerminateInstanceMutationResult = NonNullable<
|
|
260
|
+
AsyncReturnType<typeof terminateInstance>
|
|
261
|
+
>;
|
|
262
|
+
|
|
263
|
+
export type TerminateInstanceMutationError = ErrorType<void | DmError>;
|
|
264
|
+
|
|
238
265
|
export const useTerminateInstance = <
|
|
239
266
|
TError = ErrorType<void | DmError>,
|
|
240
267
|
TContext = unknown
|
|
@@ -242,7 +269,7 @@ export const useTerminateInstance = <
|
|
|
242
269
|
mutation?: UseMutationOptions<
|
|
243
270
|
AsyncReturnType<typeof terminateInstance>,
|
|
244
271
|
TError,
|
|
245
|
-
{
|
|
272
|
+
{ instanceId: string },
|
|
246
273
|
TContext
|
|
247
274
|
>;
|
|
248
275
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -251,17 +278,17 @@ export const useTerminateInstance = <
|
|
|
251
278
|
|
|
252
279
|
const mutationFn: MutationFunction<
|
|
253
280
|
AsyncReturnType<typeof terminateInstance>,
|
|
254
|
-
{
|
|
281
|
+
{ instanceId: string }
|
|
255
282
|
> = (props) => {
|
|
256
|
-
const {
|
|
283
|
+
const { instanceId } = props || {};
|
|
257
284
|
|
|
258
|
-
return terminateInstance(
|
|
285
|
+
return terminateInstance(instanceId, requestOptions);
|
|
259
286
|
};
|
|
260
287
|
|
|
261
288
|
return useMutation<
|
|
262
289
|
AsyncReturnType<typeof terminateInstance>,
|
|
263
290
|
TError,
|
|
264
|
-
{
|
|
291
|
+
{ instanceId: string },
|
|
265
292
|
TContext
|
|
266
293
|
>(mutationFn, mutationOptions);
|
|
267
294
|
};
|
|
@@ -273,16 +300,22 @@ You must be the `owner` or an `editor` of the instance to patch it
|
|
|
273
300
|
* @summary Update an application instance
|
|
274
301
|
*/
|
|
275
302
|
export const patchInstance = (
|
|
276
|
-
|
|
303
|
+
instanceId: string,
|
|
277
304
|
params?: PatchInstanceParams,
|
|
278
305
|
options?: SecondParameter<typeof customInstance>
|
|
279
306
|
) => {
|
|
280
307
|
return customInstance<void>(
|
|
281
|
-
{ url: `/instance/${
|
|
308
|
+
{ url: `/instance/${instanceId}`, method: "patch", params },
|
|
282
309
|
options
|
|
283
310
|
);
|
|
284
311
|
};
|
|
285
312
|
|
|
313
|
+
export type PatchInstanceMutationResult = NonNullable<
|
|
314
|
+
AsyncReturnType<typeof patchInstance>
|
|
315
|
+
>;
|
|
316
|
+
|
|
317
|
+
export type PatchInstanceMutationError = ErrorType<DmError>;
|
|
318
|
+
|
|
286
319
|
export const usePatchInstance = <
|
|
287
320
|
TError = ErrorType<DmError>,
|
|
288
321
|
TContext = unknown
|
|
@@ -290,7 +323,7 @@ export const usePatchInstance = <
|
|
|
290
323
|
mutation?: UseMutationOptions<
|
|
291
324
|
AsyncReturnType<typeof patchInstance>,
|
|
292
325
|
TError,
|
|
293
|
-
{
|
|
326
|
+
{ instanceId: string; params?: PatchInstanceParams },
|
|
294
327
|
TContext
|
|
295
328
|
>;
|
|
296
329
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -299,17 +332,17 @@ export const usePatchInstance = <
|
|
|
299
332
|
|
|
300
333
|
const mutationFn: MutationFunction<
|
|
301
334
|
AsyncReturnType<typeof patchInstance>,
|
|
302
|
-
{
|
|
335
|
+
{ instanceId: string; params?: PatchInstanceParams }
|
|
303
336
|
> = (props) => {
|
|
304
|
-
const {
|
|
337
|
+
const { instanceId, params } = props || {};
|
|
305
338
|
|
|
306
|
-
return patchInstance(
|
|
339
|
+
return patchInstance(instanceId, params, requestOptions);
|
|
307
340
|
};
|
|
308
341
|
|
|
309
342
|
return useMutation<
|
|
310
343
|
AsyncReturnType<typeof patchInstance>,
|
|
311
344
|
TError,
|
|
312
|
-
{
|
|
345
|
+
{ instanceId: string; params?: PatchInstanceParams },
|
|
313
346
|
TContext
|
|
314
347
|
>(mutationFn, mutationOptions);
|
|
315
348
|
};
|
package/src/job/job.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -53,6 +53,9 @@ export const getJobs = (options?: SecondParameter<typeof customInstance>) => {
|
|
|
53
53
|
|
|
54
54
|
export const getGetJobsQueryKey = () => [`/job`];
|
|
55
55
|
|
|
56
|
+
export type GetJobsQueryResult = NonNullable<AsyncReturnType<typeof getJobs>>;
|
|
57
|
+
export type GetJobsQueryError = ErrorType<DmError>;
|
|
58
|
+
|
|
56
59
|
export const useGetJobs = <
|
|
57
60
|
TData = AsyncReturnType<typeof getJobs>,
|
|
58
61
|
TError = ErrorType<DmError>
|
|
@@ -87,22 +90,25 @@ To run a job you need to use the `/instance` endpoint. The Job is controlled thr
|
|
|
87
90
|
* @summary Get details of a specific Job
|
|
88
91
|
*/
|
|
89
92
|
export const getJob = (
|
|
90
|
-
|
|
93
|
+
jobId: number,
|
|
91
94
|
options?: SecondParameter<typeof customInstance>
|
|
92
95
|
) => {
|
|
93
96
|
return customInstance<JobGetResponse>(
|
|
94
|
-
{ url: `/job/${
|
|
97
|
+
{ url: `/job/${jobId}`, method: "get" },
|
|
95
98
|
options
|
|
96
99
|
);
|
|
97
100
|
};
|
|
98
101
|
|
|
99
|
-
export const getGetJobQueryKey = (
|
|
102
|
+
export const getGetJobQueryKey = (jobId: number) => [`/job/${jobId}`];
|
|
103
|
+
|
|
104
|
+
export type GetJobQueryResult = NonNullable<AsyncReturnType<typeof getJob>>;
|
|
105
|
+
export type GetJobQueryError = ErrorType<void | DmError>;
|
|
100
106
|
|
|
101
107
|
export const useGetJob = <
|
|
102
108
|
TData = AsyncReturnType<typeof getJob>,
|
|
103
109
|
TError = ErrorType<void | DmError>
|
|
104
110
|
>(
|
|
105
|
-
|
|
111
|
+
jobId: number,
|
|
106
112
|
options?: {
|
|
107
113
|
query?: UseQueryOptions<AsyncReturnType<typeof getJob>, TError, TData>;
|
|
108
114
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -110,15 +116,15 @@ export const useGetJob = <
|
|
|
110
116
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
111
117
|
const { query: queryOptions, request: requestOptions } = options || {};
|
|
112
118
|
|
|
113
|
-
const queryKey = queryOptions?.queryKey ?? getGetJobQueryKey(
|
|
119
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobQueryKey(jobId);
|
|
114
120
|
|
|
115
121
|
const queryFn: QueryFunction<AsyncReturnType<typeof getJob>> = () =>
|
|
116
|
-
getJob(
|
|
122
|
+
getJob(jobId, requestOptions);
|
|
117
123
|
|
|
118
124
|
const query = useQuery<AsyncReturnType<typeof getJob>, TError, TData>(
|
|
119
125
|
queryKey,
|
|
120
126
|
queryFn,
|
|
121
|
-
{ enabled: !!
|
|
127
|
+
{ enabled: !!jobId, ...queryOptions }
|
|
122
128
|
);
|
|
123
129
|
|
|
124
130
|
return {
|
package/src/metadata/metadata.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -49,8 +49,8 @@ The annotations are provided in a list in JSON format. For details of the annota
|
|
|
49
49
|
* @summary Update Metadata for the Dataset version
|
|
50
50
|
*/
|
|
51
51
|
export const addMetadataVersion = (
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
datasetId: string,
|
|
53
|
+
datasetVersion: number,
|
|
54
54
|
datasetVersionMetaPostBodyBody: DatasetVersionMetaPostBodyBody,
|
|
55
55
|
options?: SecondParameter<typeof customInstance>
|
|
56
56
|
) => {
|
|
@@ -67,14 +67,21 @@ export const addMetadataVersion = (
|
|
|
67
67
|
|
|
68
68
|
return customInstance<DatasetMetaGetResponse>(
|
|
69
69
|
{
|
|
70
|
-
url: `/dataset/${
|
|
70
|
+
url: `/dataset/${datasetId}/meta/${datasetVersion}`,
|
|
71
71
|
method: "post",
|
|
72
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
72
73
|
data: formData,
|
|
73
74
|
},
|
|
74
75
|
options
|
|
75
76
|
);
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
export type AddMetadataVersionMutationResult = NonNullable<
|
|
80
|
+
AsyncReturnType<typeof addMetadataVersion>
|
|
81
|
+
>;
|
|
82
|
+
export type AddMetadataVersionMutationBody = DatasetVersionMetaPostBodyBody;
|
|
83
|
+
export type AddMetadataVersionMutationError = ErrorType<DmError | void>;
|
|
84
|
+
|
|
78
85
|
export const useAddMetadataVersion = <
|
|
79
86
|
TError = ErrorType<DmError | void>,
|
|
80
87
|
TContext = unknown
|
|
@@ -83,8 +90,8 @@ export const useAddMetadataVersion = <
|
|
|
83
90
|
AsyncReturnType<typeof addMetadataVersion>,
|
|
84
91
|
TError,
|
|
85
92
|
{
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
datasetId: string;
|
|
94
|
+
datasetVersion: number;
|
|
88
95
|
data: DatasetVersionMetaPostBodyBody;
|
|
89
96
|
},
|
|
90
97
|
TContext
|
|
@@ -96,22 +103,22 @@ export const useAddMetadataVersion = <
|
|
|
96
103
|
const mutationFn: MutationFunction<
|
|
97
104
|
AsyncReturnType<typeof addMetadataVersion>,
|
|
98
105
|
{
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
datasetId: string;
|
|
107
|
+
datasetVersion: number;
|
|
101
108
|
data: DatasetVersionMetaPostBodyBody;
|
|
102
109
|
}
|
|
103
110
|
> = (props) => {
|
|
104
|
-
const {
|
|
111
|
+
const { datasetId, datasetVersion, data } = props || {};
|
|
105
112
|
|
|
106
|
-
return addMetadataVersion(
|
|
113
|
+
return addMetadataVersion(datasetId, datasetVersion, data, requestOptions);
|
|
107
114
|
};
|
|
108
115
|
|
|
109
116
|
return useMutation<
|
|
110
117
|
AsyncReturnType<typeof addMetadataVersion>,
|
|
111
118
|
TError,
|
|
112
119
|
{
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
datasetId: string;
|
|
121
|
+
datasetVersion: number;
|
|
115
122
|
data: DatasetVersionMetaPostBodyBody;
|
|
116
123
|
},
|
|
117
124
|
TContext
|
|
@@ -123,27 +130,32 @@ export const useAddMetadataVersion = <
|
|
|
123
130
|
* @summary Gets the metadata for a specific Dataset version
|
|
124
131
|
*/
|
|
125
132
|
export const getMetadataVersion = (
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
datasetId: string,
|
|
134
|
+
datasetVersion: number,
|
|
128
135
|
options?: SecondParameter<typeof customInstance>
|
|
129
136
|
) => {
|
|
130
137
|
return customInstance<DatasetMetaGetResponse>(
|
|
131
|
-
{ url: `/dataset/${
|
|
138
|
+
{ url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: "get" },
|
|
132
139
|
options
|
|
133
140
|
);
|
|
134
141
|
};
|
|
135
142
|
|
|
136
143
|
export const getGetMetadataVersionQueryKey = (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
) => [`/dataset/${
|
|
144
|
+
datasetId: string,
|
|
145
|
+
datasetVersion: number
|
|
146
|
+
) => [`/dataset/${datasetId}/meta/${datasetVersion}`];
|
|
147
|
+
|
|
148
|
+
export type GetMetadataVersionQueryResult = NonNullable<
|
|
149
|
+
AsyncReturnType<typeof getMetadataVersion>
|
|
150
|
+
>;
|
|
151
|
+
export type GetMetadataVersionQueryError = ErrorType<void | DmError>;
|
|
140
152
|
|
|
141
153
|
export const useGetMetadataVersion = <
|
|
142
154
|
TData = AsyncReturnType<typeof getMetadataVersion>,
|
|
143
155
|
TError = ErrorType<void | DmError>
|
|
144
156
|
>(
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
datasetId: string,
|
|
158
|
+
datasetVersion: number,
|
|
147
159
|
options?: {
|
|
148
160
|
query?: UseQueryOptions<
|
|
149
161
|
AsyncReturnType<typeof getMetadataVersion>,
|
|
@@ -157,18 +169,18 @@ export const useGetMetadataVersion = <
|
|
|
157
169
|
|
|
158
170
|
const queryKey =
|
|
159
171
|
queryOptions?.queryKey ??
|
|
160
|
-
getGetMetadataVersionQueryKey(
|
|
172
|
+
getGetMetadataVersionQueryKey(datasetId, datasetVersion);
|
|
161
173
|
|
|
162
174
|
const queryFn: QueryFunction<
|
|
163
175
|
AsyncReturnType<typeof getMetadataVersion>
|
|
164
|
-
> = () => getMetadataVersion(
|
|
176
|
+
> = () => getMetadataVersion(datasetId, datasetVersion, requestOptions);
|
|
165
177
|
|
|
166
178
|
const query = useQuery<
|
|
167
179
|
AsyncReturnType<typeof getMetadataVersion>,
|
|
168
180
|
TError,
|
|
169
181
|
TData
|
|
170
182
|
>(queryKey, queryFn, {
|
|
171
|
-
enabled: !!(
|
|
183
|
+
enabled: !!(datasetId && datasetVersion),
|
|
172
184
|
...queryOptions,
|
|
173
185
|
});
|
|
174
186
|
|
|
@@ -186,7 +198,7 @@ The labels are provided in a list in JSON format. For details of the label forma
|
|
|
186
198
|
* @summary Update Metadata for the Dataset
|
|
187
199
|
*/
|
|
188
200
|
export const addMetadata = (
|
|
189
|
-
|
|
201
|
+
datasetId: string,
|
|
190
202
|
datasetMetaPostBodyBody: DatasetMetaPostBodyBody,
|
|
191
203
|
options?: SecondParameter<typeof customInstance>
|
|
192
204
|
) => {
|
|
@@ -199,11 +211,22 @@ export const addMetadata = (
|
|
|
199
211
|
}
|
|
200
212
|
|
|
201
213
|
return customInstance<DatasetMetaGetResponse>(
|
|
202
|
-
{
|
|
214
|
+
{
|
|
215
|
+
url: `/dataset/${datasetId}/meta`,
|
|
216
|
+
method: "post",
|
|
217
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
218
|
+
data: formData,
|
|
219
|
+
},
|
|
203
220
|
options
|
|
204
221
|
);
|
|
205
222
|
};
|
|
206
223
|
|
|
224
|
+
export type AddMetadataMutationResult = NonNullable<
|
|
225
|
+
AsyncReturnType<typeof addMetadata>
|
|
226
|
+
>;
|
|
227
|
+
export type AddMetadataMutationBody = DatasetMetaPostBodyBody;
|
|
228
|
+
export type AddMetadataMutationError = ErrorType<DmError | void>;
|
|
229
|
+
|
|
207
230
|
export const useAddMetadata = <
|
|
208
231
|
TError = ErrorType<DmError | void>,
|
|
209
232
|
TContext = unknown
|
|
@@ -211,7 +234,7 @@ export const useAddMetadata = <
|
|
|
211
234
|
mutation?: UseMutationOptions<
|
|
212
235
|
AsyncReturnType<typeof addMetadata>,
|
|
213
236
|
TError,
|
|
214
|
-
{
|
|
237
|
+
{ datasetId: string; data: DatasetMetaPostBodyBody },
|
|
215
238
|
TContext
|
|
216
239
|
>;
|
|
217
240
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -220,17 +243,17 @@ export const useAddMetadata = <
|
|
|
220
243
|
|
|
221
244
|
const mutationFn: MutationFunction<
|
|
222
245
|
AsyncReturnType<typeof addMetadata>,
|
|
223
|
-
{
|
|
246
|
+
{ datasetId: string; data: DatasetMetaPostBodyBody }
|
|
224
247
|
> = (props) => {
|
|
225
|
-
const {
|
|
248
|
+
const { datasetId, data } = props || {};
|
|
226
249
|
|
|
227
|
-
return addMetadata(
|
|
250
|
+
return addMetadata(datasetId, data, requestOptions);
|
|
228
251
|
};
|
|
229
252
|
|
|
230
253
|
return useMutation<
|
|
231
254
|
AsyncReturnType<typeof addMetadata>,
|
|
232
255
|
TError,
|
|
233
|
-
{
|
|
256
|
+
{ datasetId: string; data: DatasetMetaPostBodyBody },
|
|
234
257
|
TContext
|
|
235
258
|
>(mutationFn, mutationOptions);
|
|
236
259
|
};
|
|
@@ -240,24 +263,29 @@ export const useAddMetadata = <
|
|
|
240
263
|
* @summary Gets the metadata for a specific Dataset
|
|
241
264
|
*/
|
|
242
265
|
export const getMetadata = (
|
|
243
|
-
|
|
266
|
+
datasetId: string,
|
|
244
267
|
options?: SecondParameter<typeof customInstance>
|
|
245
268
|
) => {
|
|
246
269
|
return customInstance<DatasetMetaGetResponse>(
|
|
247
|
-
{ url: `/dataset/${
|
|
270
|
+
{ url: `/dataset/${datasetId}/meta`, method: "get" },
|
|
248
271
|
options
|
|
249
272
|
);
|
|
250
273
|
};
|
|
251
274
|
|
|
252
|
-
export const getGetMetadataQueryKey = (
|
|
253
|
-
`/dataset/${
|
|
275
|
+
export const getGetMetadataQueryKey = (datasetId: string) => [
|
|
276
|
+
`/dataset/${datasetId}/meta`,
|
|
254
277
|
];
|
|
255
278
|
|
|
279
|
+
export type GetMetadataQueryResult = NonNullable<
|
|
280
|
+
AsyncReturnType<typeof getMetadata>
|
|
281
|
+
>;
|
|
282
|
+
export type GetMetadataQueryError = ErrorType<void | DmError>;
|
|
283
|
+
|
|
256
284
|
export const useGetMetadata = <
|
|
257
285
|
TData = AsyncReturnType<typeof getMetadata>,
|
|
258
286
|
TError = ErrorType<void | DmError>
|
|
259
287
|
>(
|
|
260
|
-
|
|
288
|
+
datasetId: string,
|
|
261
289
|
options?: {
|
|
262
290
|
query?: UseQueryOptions<AsyncReturnType<typeof getMetadata>, TError, TData>;
|
|
263
291
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -265,15 +293,15 @@ export const useGetMetadata = <
|
|
|
265
293
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
266
294
|
const { query: queryOptions, request: requestOptions } = options || {};
|
|
267
295
|
|
|
268
|
-
const queryKey = queryOptions?.queryKey ?? getGetMetadataQueryKey(
|
|
296
|
+
const queryKey = queryOptions?.queryKey ?? getGetMetadataQueryKey(datasetId);
|
|
269
297
|
|
|
270
298
|
const queryFn: QueryFunction<AsyncReturnType<typeof getMetadata>> = () =>
|
|
271
|
-
getMetadata(
|
|
299
|
+
getMetadata(datasetId, requestOptions);
|
|
272
300
|
|
|
273
301
|
const query = useQuery<AsyncReturnType<typeof getMetadata>, TError, TData>(
|
|
274
302
|
queryKey,
|
|
275
303
|
queryFn,
|
|
276
|
-
{ enabled: !!
|
|
304
|
+
{ enabled: !!datasetId, ...queryOptions }
|
|
277
305
|
);
|
|
278
306
|
|
|
279
307
|
return {
|