@squonk/data-manager-client 1.0.6-rc.2 → 1.0.6
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 +21 -17
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.ts +1 -1
- package/accounting/accounting.js +22 -18
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +30 -6
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +19 -19
- package/admin/admin.js +31 -7
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +16 -15
- package/application/application.cjs.map +1 -1
- package/application/application.d.ts +1 -1
- package/application/application.js +17 -16
- package/application/application.js.map +1 -1
- package/{custom-instance-c4af1ee9.d.ts → custom-instance-9e5c9e19.d.ts} +299 -299
- package/dataset/dataset.cjs +47 -58
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.ts +16 -16
- package/dataset/dataset.js +48 -59
- package/dataset/dataset.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +23 -11
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.ts +7 -7
- package/exchange-rate/exchange-rate.js +24 -12
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file/file.cjs +29 -27
- package/file/file.cjs.map +1 -1
- package/file/file.d.ts +10 -10
- package/file/file.js +30 -28
- 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 +34 -30
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.ts +10 -10
- package/instance/instance.js +35 -31
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +24 -26
- package/job/job.cjs.map +1 -1
- package/job/job.d.ts +1 -1
- package/job/job.js +25 -27
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +13 -19
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.ts +7 -7
- package/metadata/metadata.js +14 -20
- package/metadata/metadata.js.map +1 -1
- package/package.json +1 -1
- package/project/project.cjs +38 -31
- package/project/project.cjs.map +1 -1
- package/project/project.d.ts +19 -19
- package/project/project.js +39 -32
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +96 -132
- package/src/admin/admin.ts +307 -442
- package/src/application/application.ts +66 -94
- package/src/data-manager-api.schemas.ts +425 -470
- package/src/dataset/dataset.ts +367 -554
- package/src/exchange-rate/exchange-rate.ts +221 -339
- package/src/file/file.ts +177 -253
- package/src/instance/instance.ts +217 -314
- package/src/job/job.ts +88 -116
- package/src/metadata/metadata.ts +154 -245
- package/src/project/project.ts +347 -511
- package/src/task/task.ts +105 -141
- package/src/type/type.ts +38 -43
- package/src/user/user.ts +136 -197
- package/task/task.cjs +25 -27
- package/task/task.cjs.map +1 -1
- package/task/task.d.ts +1 -1
- package/task/task.js +26 -28
- package/task/task.js.map +1 -1
- package/type/type.cjs +8 -4
- package/type/type.cjs.map +1 -1
- package/type/type.d.ts +1 -1
- package/type/type.js +9 -5
- package/type/type.js.map +1 -1
- package/user/user.cjs +28 -33
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +4 -4
- package/user/user.js +29 -34
- package/user/user.js.map +1 -1
package/src/dataset/dataset.ts
CHANGED
|
@@ -8,15 +8,18 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery,
|
|
13
|
+
useMutation
|
|
14
|
+
} from 'react-query'
|
|
12
15
|
import type {
|
|
13
16
|
UseQueryOptions,
|
|
14
17
|
UseMutationOptions,
|
|
15
18
|
QueryFunction,
|
|
16
19
|
MutationFunction,
|
|
17
20
|
UseQueryResult,
|
|
18
|
-
QueryKey
|
|
19
|
-
} from
|
|
21
|
+
QueryKey
|
|
22
|
+
} from 'react-query'
|
|
20
23
|
import type {
|
|
21
24
|
DatasetPutPostResponse,
|
|
22
25
|
DmError,
|
|
@@ -29,15 +32,16 @@ import type {
|
|
|
29
32
|
DatasetVersionDeleteResponse,
|
|
30
33
|
DeleteDatasetParams,
|
|
31
34
|
DatasetDigestGetResponse,
|
|
32
|
-
DatasetSchemaGetResponse
|
|
33
|
-
} from
|
|
34
|
-
import { customInstance } from
|
|
35
|
-
import type { ErrorType } from
|
|
35
|
+
DatasetSchemaGetResponse
|
|
36
|
+
} from '../data-manager-api.schemas'
|
|
37
|
+
import { customInstance } from '.././custom-instance'
|
|
38
|
+
import type { ErrorType } from '.././custom-instance'
|
|
39
|
+
|
|
36
40
|
|
|
37
41
|
// eslint-disable-next-line
|
|
38
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
42
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
39
43
|
config: any,
|
|
40
|
-
args: infer P
|
|
44
|
+
args: infer P,
|
|
41
45
|
) => any
|
|
42
46
|
? P
|
|
43
47
|
: never;
|
|
@@ -52,81 +56,57 @@ Behaves like the corresponding **POST** method except the file is expected to ex
|
|
|
52
56
|
* @summary Create a Dataset from a file in a Project
|
|
53
57
|
*/
|
|
54
58
|
export const createDatasetFromFile = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (datasetPutBodyBody.unit_id !== undefined) {
|
|
79
|
-
formData.append("unit_id", datasetPutBodyBody.unit_id);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return customInstance<DatasetPutPostResponse>(
|
|
83
|
-
{
|
|
84
|
-
url: `/dataset`,
|
|
85
|
-
method: "put",
|
|
86
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
87
|
-
data: formData,
|
|
59
|
+
datasetPutBodyBody: DatasetPutBodyBody,
|
|
60
|
+
options?: SecondParameter<typeof customInstance>,) => {const formData = new FormData();
|
|
61
|
+
formData.append('dataset_type', datasetPutBodyBody.dataset_type)
|
|
62
|
+
if(datasetPutBodyBody.format_extra_variables !== undefined) {
|
|
63
|
+
formData.append('format_extra_variables', datasetPutBodyBody.format_extra_variables)
|
|
64
|
+
}
|
|
65
|
+
if(datasetPutBodyBody.skip_molecule_load !== undefined) {
|
|
66
|
+
formData.append('skip_molecule_load', datasetPutBodyBody.skip_molecule_load.toString())
|
|
67
|
+
}
|
|
68
|
+
formData.append('project_id', datasetPutBodyBody.project_id)
|
|
69
|
+
formData.append('path', datasetPutBodyBody.path)
|
|
70
|
+
formData.append('file_name', datasetPutBodyBody.file_name)
|
|
71
|
+
if(datasetPutBodyBody.dataset_id !== undefined) {
|
|
72
|
+
formData.append('dataset_id', datasetPutBodyBody.dataset_id)
|
|
73
|
+
}
|
|
74
|
+
if(datasetPutBodyBody.unit_id !== undefined) {
|
|
75
|
+
formData.append('unit_id', datasetPutBodyBody.unit_id)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return customInstance<DatasetPutPostResponse>(
|
|
79
|
+
{url: `/dataset`, method: 'put',
|
|
80
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
81
|
+
data: formData
|
|
88
82
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
export type
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
> = (props) => {
|
|
117
|
-
const { data } = props ?? {};
|
|
118
|
-
|
|
119
|
-
return createDatasetFromFile(data, requestOptions);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return useMutation<
|
|
123
|
-
Awaited<ReturnType<typeof createDatasetFromFile>>,
|
|
124
|
-
TError,
|
|
125
|
-
{ data: DatasetPutBodyBody },
|
|
126
|
-
TContext
|
|
127
|
-
>(mutationFn, mutationOptions);
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
83
|
+
options);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export type CreateDatasetFromFileMutationResult = NonNullable<Awaited<ReturnType<typeof createDatasetFromFile>>>
|
|
89
|
+
export type CreateDatasetFromFileMutationBody = DatasetPutBodyBody
|
|
90
|
+
export type CreateDatasetFromFileMutationError = ErrorType<void | DmError>
|
|
91
|
+
|
|
92
|
+
export const useCreateDatasetFromFile = <TError = ErrorType<void | DmError>,
|
|
93
|
+
|
|
94
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDatasetFromFile>>, TError,{data: DatasetPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
95
|
+
) => {
|
|
96
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDatasetFromFile>>, {data: DatasetPutBodyBody}> = (props) => {
|
|
102
|
+
const {data} = props ?? {};
|
|
103
|
+
|
|
104
|
+
return createDatasetFromFile(data,requestOptions)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return useMutation<Awaited<ReturnType<typeof createDatasetFromFile>>, TError, {data: DatasetPutBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
130
110
|
* Uploads a dataset.
|
|
131
111
|
|
|
132
112
|
Dataset file-naming is strictly limited to a fixed set of extensions based on the Dataset **Type**. You can obtain the supported types (and their extensions) via the **\/type** endpoint. Filenames that do not comply with the supported filename extensions will be rejected.
|
|
@@ -140,80 +120,56 @@ Datasets undergo some processing in an asynchronous `task` after control returns
|
|
|
140
120
|
* @summary Upload an external file as a Dataset
|
|
141
121
|
*/
|
|
142
122
|
export const uploadDataset = (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
formData.append("dataset_id", datasetPostBodyBody.dataset_id);
|
|
166
|
-
}
|
|
167
|
-
formData.append("unit_id", datasetPostBodyBody.unit_id);
|
|
168
|
-
|
|
169
|
-
return customInstance<DatasetPutPostResponse>(
|
|
170
|
-
{
|
|
171
|
-
url: `/dataset`,
|
|
172
|
-
method: "post",
|
|
173
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
174
|
-
data: formData,
|
|
123
|
+
datasetPostBodyBody: DatasetPostBodyBody,
|
|
124
|
+
options?: SecondParameter<typeof customInstance>,) => {const formData = new FormData();
|
|
125
|
+
formData.append('dataset_file', datasetPostBodyBody.dataset_file)
|
|
126
|
+
formData.append('dataset_type', datasetPostBodyBody.dataset_type)
|
|
127
|
+
if(datasetPostBodyBody.format_extra_variables !== undefined) {
|
|
128
|
+
formData.append('format_extra_variables', datasetPostBodyBody.format_extra_variables)
|
|
129
|
+
}
|
|
130
|
+
if(datasetPostBodyBody.skip_molecule_load !== undefined) {
|
|
131
|
+
formData.append('skip_molecule_load', datasetPostBodyBody.skip_molecule_load.toString())
|
|
132
|
+
}
|
|
133
|
+
if(datasetPostBodyBody.as_filename !== undefined) {
|
|
134
|
+
formData.append('as_filename', datasetPostBodyBody.as_filename)
|
|
135
|
+
}
|
|
136
|
+
if(datasetPostBodyBody.dataset_id !== undefined) {
|
|
137
|
+
formData.append('dataset_id', datasetPostBodyBody.dataset_id)
|
|
138
|
+
}
|
|
139
|
+
formData.append('unit_id', datasetPostBodyBody.unit_id)
|
|
140
|
+
|
|
141
|
+
return customInstance<DatasetPutPostResponse>(
|
|
142
|
+
{url: `/dataset`, method: 'post',
|
|
143
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
144
|
+
data: formData
|
|
175
145
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
export type
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
> = (props) => {
|
|
204
|
-
const { data } = props ?? {};
|
|
205
|
-
|
|
206
|
-
return uploadDataset(data, requestOptions);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return useMutation<
|
|
210
|
-
Awaited<ReturnType<typeof uploadDataset>>,
|
|
211
|
-
TError,
|
|
212
|
-
{ data: DatasetPostBodyBody },
|
|
213
|
-
TContext
|
|
214
|
-
>(mutationFn, mutationOptions);
|
|
215
|
-
};
|
|
216
|
-
/**
|
|
146
|
+
options);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
export type UploadDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof uploadDataset>>>
|
|
152
|
+
export type UploadDatasetMutationBody = DatasetPostBodyBody
|
|
153
|
+
export type UploadDatasetMutationError = ErrorType<void | DmError>
|
|
154
|
+
|
|
155
|
+
export const useUploadDataset = <TError = ErrorType<void | DmError>,
|
|
156
|
+
|
|
157
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadDataset>>, TError,{data: DatasetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
158
|
+
) => {
|
|
159
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof uploadDataset>>, {data: DatasetPostBodyBody}> = (props) => {
|
|
165
|
+
const {data} = props ?? {};
|
|
166
|
+
|
|
167
|
+
return uploadDataset(data,requestOptions)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return useMutation<Awaited<ReturnType<typeof uploadDataset>>, TError, {data: DatasetPostBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
217
173
|
* Returns datasets that you have access to, whether attached to a project or not.
|
|
218
174
|
|
|
219
175
|
You will not see Datasets while their upload is still in progress.
|
|
@@ -225,60 +181,42 @@ Note that if `editors` are combined with `owner username`, then the datasets wil
|
|
|
225
181
|
* @summary Get Datasets that are available to you
|
|
226
182
|
*/
|
|
227
183
|
export const getDatasets = (
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
signal?: AbortSignal
|
|
184
|
+
params?: GetDatasetsParams,
|
|
185
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
231
186
|
) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
export type GetDatasetsQueryResult = NonNullable<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
export
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
TData
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
params?: GetDatasetsParams,
|
|
253
|
-
options?: {
|
|
254
|
-
query?: UseQueryOptions<
|
|
255
|
-
Awaited<ReturnType<typeof getDatasets>>,
|
|
256
|
-
TError,
|
|
257
|
-
TData
|
|
258
|
-
>;
|
|
259
|
-
request?: SecondParameter<typeof customInstance>;
|
|
260
|
-
}
|
|
261
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
262
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
187
|
+
return customInstance<DatasetsGetResponse>(
|
|
188
|
+
{url: `/dataset`, method: 'get',
|
|
189
|
+
params, signal
|
|
190
|
+
},
|
|
191
|
+
options);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
export const getGetDatasetsQueryKey = (params?: GetDatasetsParams,) => [`/dataset`, ...(params ? [params]: [])];
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
export type GetDatasetsQueryResult = NonNullable<Awaited<ReturnType<typeof getDatasets>>>
|
|
199
|
+
export type GetDatasetsQueryError = ErrorType<void | DmError>
|
|
200
|
+
|
|
201
|
+
export const useGetDatasets = <TData = Awaited<ReturnType<typeof getDatasets>>, TError = ErrorType<void | DmError>>(
|
|
202
|
+
params?: GetDatasetsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasets>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
203
|
+
|
|
204
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
205
|
+
|
|
206
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
263
207
|
|
|
264
208
|
const queryKey = queryOptions?.queryKey ?? getGetDatasetsQueryKey(params);
|
|
265
209
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}) => getDatasets(params, requestOptions, signal);
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDatasets>>> = ({ signal }) => getDatasets(params, requestOptions, signal);
|
|
269
213
|
|
|
270
|
-
const query = useQuery<
|
|
271
|
-
Awaited<ReturnType<typeof getDatasets>>,
|
|
272
|
-
TError,
|
|
273
|
-
TData
|
|
274
|
-
>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
|
|
275
|
-
queryKey: QueryKey;
|
|
276
|
-
};
|
|
214
|
+
const query = useQuery<Awaited<ReturnType<typeof getDatasets>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
277
215
|
|
|
278
216
|
query.queryKey = queryKey;
|
|
279
217
|
|
|
280
218
|
return query;
|
|
281
|
-
}
|
|
219
|
+
}
|
|
282
220
|
|
|
283
221
|
/**
|
|
284
222
|
* Returns a list of Dataset versions.
|
|
@@ -288,64 +226,45 @@ You will not see Datasets while their upload is still in progress.
|
|
|
288
226
|
* @summary Gets all the versions of a specific Dataset
|
|
289
227
|
*/
|
|
290
228
|
export const getVersions = (
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
signal?: AbortSignal
|
|
229
|
+
datasetId: string,
|
|
230
|
+
params?: GetVersionsParams,
|
|
231
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
295
232
|
) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
) => [`/dataset/${datasetId}/versions`, ...(params ? [params]
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
>
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
327
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
328
|
-
|
|
329
|
-
const queryKey =
|
|
330
|
-
queryOptions?.queryKey ?? getGetVersionsQueryKey(datasetId, params);
|
|
331
|
-
|
|
332
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersions>>> = ({
|
|
333
|
-
signal,
|
|
334
|
-
}) => getVersions(datasetId, params, requestOptions, signal);
|
|
335
|
-
|
|
336
|
-
const query = useQuery<
|
|
337
|
-
Awaited<ReturnType<typeof getVersions>>,
|
|
338
|
-
TError,
|
|
339
|
-
TData
|
|
340
|
-
>(queryKey, queryFn, {
|
|
341
|
-
enabled: !!datasetId,
|
|
342
|
-
...queryOptions,
|
|
343
|
-
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
233
|
+
return customInstance<DatasetVersionsGetResponse>(
|
|
234
|
+
{url: `/dataset/${datasetId}/versions`, method: 'get',
|
|
235
|
+
params, signal
|
|
236
|
+
},
|
|
237
|
+
options);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
export const getGetVersionsQueryKey = (datasetId: string,
|
|
242
|
+
params?: GetVersionsParams,) => [`/dataset/${datasetId}/versions`, ...(params ? [params]: [])];
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
export type GetVersionsQueryResult = NonNullable<Awaited<ReturnType<typeof getVersions>>>
|
|
246
|
+
export type GetVersionsQueryError = ErrorType<void | DmError>
|
|
247
|
+
|
|
248
|
+
export const useGetVersions = <TData = Awaited<ReturnType<typeof getVersions>>, TError = ErrorType<void | DmError>>(
|
|
249
|
+
datasetId: string,
|
|
250
|
+
params?: GetVersionsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersions>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
251
|
+
|
|
252
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
253
|
+
|
|
254
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
255
|
+
|
|
256
|
+
const queryKey = queryOptions?.queryKey ?? getGetVersionsQueryKey(datasetId,params);
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersions>>> = ({ signal }) => getVersions(datasetId,params, requestOptions, signal);
|
|
261
|
+
|
|
262
|
+
const query = useQuery<Awaited<ReturnType<typeof getVersions>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
344
263
|
|
|
345
264
|
query.queryKey = queryKey;
|
|
346
265
|
|
|
347
266
|
return query;
|
|
348
|
-
}
|
|
267
|
+
}
|
|
349
268
|
|
|
350
269
|
/**
|
|
351
270
|
* Given the Dataset `id` and `version` the Dataset will be removed. The API does not prevent you removing a Dataset that's been used in a **Project**. When removed using this endpoint the Dataset is automatically detached from any and all Projects that it was attached to and any corresponding Project Files relating to the Dataset are also removed.
|
|
@@ -357,58 +276,41 @@ You cannot delete a Dataset until its upload is complete.
|
|
|
357
276
|
* @summary Delete a Dataset
|
|
358
277
|
*/
|
|
359
278
|
export const deleteDataset = (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
url: `/dataset/${datasetId}/${datasetVersion}`,
|
|
368
|
-
method: "delete",
|
|
369
|
-
params,
|
|
279
|
+
datasetId: string,
|
|
280
|
+
datasetVersion: number,
|
|
281
|
+
params?: DeleteDatasetParams,
|
|
282
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
283
|
+
return customInstance<DatasetVersionDeleteResponse>(
|
|
284
|
+
{url: `/dataset/${datasetId}/${datasetVersion}`, method: 'delete',
|
|
285
|
+
params
|
|
370
286
|
},
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
> = (props) => {
|
|
399
|
-
const { datasetId, datasetVersion, params } = props ?? {};
|
|
400
|
-
|
|
401
|
-
return deleteDataset(datasetId, datasetVersion, params, requestOptions);
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
return useMutation<
|
|
405
|
-
Awaited<ReturnType<typeof deleteDataset>>,
|
|
406
|
-
TError,
|
|
407
|
-
{ datasetId: string; datasetVersion: number; params?: DeleteDatasetParams },
|
|
408
|
-
TContext
|
|
409
|
-
>(mutationFn, mutationOptions);
|
|
410
|
-
};
|
|
411
|
-
/**
|
|
287
|
+
options);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
export type DeleteDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDataset>>>
|
|
293
|
+
|
|
294
|
+
export type DeleteDatasetMutationError = ErrorType<void | DmError>
|
|
295
|
+
|
|
296
|
+
export const useDeleteDataset = <TError = ErrorType<void | DmError>,
|
|
297
|
+
|
|
298
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDataset>>, TError,{datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
299
|
+
) => {
|
|
300
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDataset>>, {datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}> = (props) => {
|
|
306
|
+
const {datasetId,datasetVersion,params} = props ?? {};
|
|
307
|
+
|
|
308
|
+
return deleteDataset(datasetId,datasetVersion,params,requestOptions)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return useMutation<Awaited<ReturnType<typeof deleteDataset>>, TError, {datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}, TContext>(mutationFn, mutationOptions)
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
412
314
|
* Given a `dataset_id` the dataset will be returned if available.
|
|
413
315
|
|
|
414
316
|
You cannot get a Dataset until its upload is complete.
|
|
@@ -416,65 +318,44 @@ You cannot get a Dataset until its upload is complete.
|
|
|
416
318
|
* @summary Download a Dataset
|
|
417
319
|
*/
|
|
418
320
|
export const downloadDataset = (
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
signal?: AbortSignal
|
|
321
|
+
datasetId: string,
|
|
322
|
+
datasetVersion: number,
|
|
323
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
423
324
|
) => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
export type DownloadDatasetQueryResult = NonNullable<
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
export
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
TError
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
455
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
456
|
-
|
|
457
|
-
const queryKey =
|
|
458
|
-
queryOptions?.queryKey ??
|
|
459
|
-
getDownloadDatasetQueryKey(datasetId, datasetVersion);
|
|
460
|
-
|
|
461
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadDataset>>> = ({
|
|
462
|
-
signal,
|
|
463
|
-
}) => downloadDataset(datasetId, datasetVersion, requestOptions, signal);
|
|
464
|
-
|
|
465
|
-
const query = useQuery<
|
|
466
|
-
Awaited<ReturnType<typeof downloadDataset>>,
|
|
467
|
-
TError,
|
|
468
|
-
TData
|
|
469
|
-
>(queryKey, queryFn, {
|
|
470
|
-
enabled: !!(datasetId && datasetVersion),
|
|
471
|
-
...queryOptions,
|
|
472
|
-
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
325
|
+
return customInstance<void>(
|
|
326
|
+
{url: `/dataset/${datasetId}/${datasetVersion}`, method: 'get', signal
|
|
327
|
+
},
|
|
328
|
+
options);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
export const getDownloadDatasetQueryKey = (datasetId: string,
|
|
333
|
+
datasetVersion: number,) => [`/dataset/${datasetId}/${datasetVersion}`];
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
export type DownloadDatasetQueryResult = NonNullable<Awaited<ReturnType<typeof downloadDataset>>>
|
|
337
|
+
export type DownloadDatasetQueryError = ErrorType<DmError>
|
|
338
|
+
|
|
339
|
+
export const useDownloadDataset = <TData = Awaited<ReturnType<typeof downloadDataset>>, TError = ErrorType<DmError>>(
|
|
340
|
+
datasetId: string,
|
|
341
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadDataset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
342
|
+
|
|
343
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
344
|
+
|
|
345
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
346
|
+
|
|
347
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadDatasetQueryKey(datasetId,datasetVersion);
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadDataset>>> = ({ signal }) => downloadDataset(datasetId,datasetVersion, requestOptions, signal);
|
|
352
|
+
|
|
353
|
+
const query = useQuery<Awaited<ReturnType<typeof downloadDataset>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetId && datasetVersion), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
473
354
|
|
|
474
355
|
query.queryKey = queryKey;
|
|
475
356
|
|
|
476
357
|
return query;
|
|
477
|
-
}
|
|
358
|
+
}
|
|
478
359
|
|
|
479
360
|
/**
|
|
480
361
|
* The user is removed from the Dataset's `editor` list. The user is removed from all versions of a dataset. You can remove yourself but an `owner` (creator) will always have access to the dataset.
|
|
@@ -486,53 +367,39 @@ You cannot modify Dataset editors until its upload is complete.
|
|
|
486
367
|
* @summary Remove a user's edit permission for a Dataset
|
|
487
368
|
*/
|
|
488
369
|
export const removeEditorFromDataset = (
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
370
|
+
datasetId: string,
|
|
371
|
+
userId: string,
|
|
372
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
373
|
+
return customInstance<void>(
|
|
374
|
+
{url: `/dataset/${datasetId}/editor/${userId}`, method: 'delete'
|
|
375
|
+
},
|
|
376
|
+
options);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
export type RemoveEditorFromDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof removeEditorFromDataset>>>
|
|
382
|
+
|
|
383
|
+
export type RemoveEditorFromDatasetMutationError = ErrorType<DmError>
|
|
384
|
+
|
|
385
|
+
export const useRemoveEditorFromDataset = <TError = ErrorType<DmError>,
|
|
386
|
+
|
|
387
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
492
388
|
) => {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
TContext = unknown
|
|
508
|
-
>(options?: {
|
|
509
|
-
mutation?: UseMutationOptions<
|
|
510
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
511
|
-
TError,
|
|
512
|
-
{ datasetId: string; userId: string },
|
|
513
|
-
TContext
|
|
514
|
-
>;
|
|
515
|
-
request?: SecondParameter<typeof customInstance>;
|
|
516
|
-
}) => {
|
|
517
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
518
|
-
|
|
519
|
-
const mutationFn: MutationFunction<
|
|
520
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
521
|
-
{ datasetId: string; userId: string }
|
|
522
|
-
> = (props) => {
|
|
523
|
-
const { datasetId, userId } = props ?? {};
|
|
524
|
-
|
|
525
|
-
return removeEditorFromDataset(datasetId, userId, requestOptions);
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
return useMutation<
|
|
529
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
530
|
-
TError,
|
|
531
|
-
{ datasetId: string; userId: string },
|
|
532
|
-
TContext
|
|
533
|
-
>(mutationFn, mutationOptions);
|
|
534
|
-
};
|
|
535
|
-
/**
|
|
389
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof removeEditorFromDataset>>, {datasetId: string;userId: string}> = (props) => {
|
|
395
|
+
const {datasetId,userId} = props ?? {};
|
|
396
|
+
|
|
397
|
+
return removeEditorFromDataset(datasetId,userId,requestOptions)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return useMutation<Awaited<ReturnType<typeof removeEditorFromDataset>>, TError, {datasetId: string;userId: string}, TContext>(mutationFn, mutationOptions)
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
536
403
|
* The user is added to the dataset's editor list. The dataset `owner` is automatically an editor and so does not need to be added as an `editor`.
|
|
537
404
|
|
|
538
405
|
You must be an `editor` or `owner` of the dataset.
|
|
@@ -542,113 +409,79 @@ You cannot modify Dataset editors until its upload is complete.
|
|
|
542
409
|
* @summary Give a user edit permission for a Dataset
|
|
543
410
|
*/
|
|
544
411
|
export const addEditorToDataset = (
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
412
|
+
datasetId: string,
|
|
413
|
+
userId: string,
|
|
414
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
415
|
+
return customInstance<void>(
|
|
416
|
+
{url: `/dataset/${datasetId}/editor/${userId}`, method: 'put'
|
|
417
|
+
},
|
|
418
|
+
options);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
export type AddEditorToDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof addEditorToDataset>>>
|
|
424
|
+
|
|
425
|
+
export type AddEditorToDatasetMutationError = ErrorType<DmError>
|
|
426
|
+
|
|
427
|
+
export const useAddEditorToDataset = <TError = ErrorType<DmError>,
|
|
428
|
+
|
|
429
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addEditorToDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
548
430
|
) => {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
TContext = unknown
|
|
564
|
-
>(options?: {
|
|
565
|
-
mutation?: UseMutationOptions<
|
|
566
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
567
|
-
TError,
|
|
568
|
-
{ datasetId: string; userId: string },
|
|
569
|
-
TContext
|
|
570
|
-
>;
|
|
571
|
-
request?: SecondParameter<typeof customInstance>;
|
|
572
|
-
}) => {
|
|
573
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
574
|
-
|
|
575
|
-
const mutationFn: MutationFunction<
|
|
576
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
577
|
-
{ datasetId: string; userId: string }
|
|
578
|
-
> = (props) => {
|
|
579
|
-
const { datasetId, userId } = props ?? {};
|
|
580
|
-
|
|
581
|
-
return addEditorToDataset(datasetId, userId, requestOptions);
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
return useMutation<
|
|
585
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
586
|
-
TError,
|
|
587
|
-
{ datasetId: string; userId: string },
|
|
588
|
-
TContext
|
|
589
|
-
>(mutationFn, mutationOptions);
|
|
590
|
-
};
|
|
591
|
-
/**
|
|
431
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addEditorToDataset>>, {datasetId: string;userId: string}> = (props) => {
|
|
437
|
+
const {datasetId,userId} = props ?? {};
|
|
438
|
+
|
|
439
|
+
return addEditorToDataset(datasetId,userId,requestOptions)
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return useMutation<Awaited<ReturnType<typeof addEditorToDataset>>, TError, {datasetId: string;userId: string}, TContext>(mutationFn, mutationOptions)
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
592
445
|
* Returns a dataset ID and version of a dataset that matches the provided SHA256 digest, a 64-character hex string.
|
|
593
446
|
|
|
594
447
|
* @summary Gets the first Dataset that matches the provided digest
|
|
595
448
|
*/
|
|
596
449
|
export const getDatasetDigest = (
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
signal?: AbortSignal
|
|
450
|
+
datasetDigest: string,
|
|
451
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
600
452
|
) => {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
export type GetDatasetDigestQueryResult = NonNullable<
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
export
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
TData
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
630
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
631
|
-
|
|
632
|
-
const queryKey =
|
|
633
|
-
queryOptions?.queryKey ?? getGetDatasetDigestQueryKey(datasetDigest);
|
|
634
|
-
|
|
635
|
-
const queryFn: QueryFunction<
|
|
636
|
-
Awaited<ReturnType<typeof getDatasetDigest>>
|
|
637
|
-
> = ({ signal }) => getDatasetDigest(datasetDigest, requestOptions, signal);
|
|
638
|
-
|
|
639
|
-
const query = useQuery<
|
|
640
|
-
Awaited<ReturnType<typeof getDatasetDigest>>,
|
|
641
|
-
TError,
|
|
642
|
-
TData
|
|
643
|
-
>(queryKey, queryFn, {
|
|
644
|
-
enabled: !!datasetDigest,
|
|
645
|
-
...queryOptions,
|
|
646
|
-
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
453
|
+
return customInstance<DatasetDigestGetResponse>(
|
|
454
|
+
{url: `/dataset/digest/${datasetDigest}`, method: 'get', signal
|
|
455
|
+
},
|
|
456
|
+
options);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
export const getGetDatasetDigestQueryKey = (datasetDigest: string,) => [`/dataset/digest/${datasetDigest}`];
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
export type GetDatasetDigestQueryResult = NonNullable<Awaited<ReturnType<typeof getDatasetDigest>>>
|
|
464
|
+
export type GetDatasetDigestQueryError = ErrorType<void | DmError>
|
|
465
|
+
|
|
466
|
+
export const useGetDatasetDigest = <TData = Awaited<ReturnType<typeof getDatasetDigest>>, TError = ErrorType<void | DmError>>(
|
|
467
|
+
datasetDigest: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasetDigest>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
468
|
+
|
|
469
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
470
|
+
|
|
471
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
472
|
+
|
|
473
|
+
const queryKey = queryOptions?.queryKey ?? getGetDatasetDigestQueryKey(datasetDigest);
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDatasetDigest>>> = ({ signal }) => getDatasetDigest(datasetDigest, requestOptions, signal);
|
|
478
|
+
|
|
479
|
+
const query = useQuery<Awaited<ReturnType<typeof getDatasetDigest>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetDigest), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
647
480
|
|
|
648
481
|
query.queryKey = queryKey;
|
|
649
482
|
|
|
650
483
|
return query;
|
|
651
|
-
}
|
|
484
|
+
}
|
|
652
485
|
|
|
653
486
|
/**
|
|
654
487
|
* Returns the property schema for a Dataset versions in JSON format (if available).
|
|
@@ -656,62 +489,42 @@ export const useGetDatasetDigest = <
|
|
|
656
489
|
* @summary Gets the property schema for a specific Dataset
|
|
657
490
|
*/
|
|
658
491
|
export const getSchema = (
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
signal?: AbortSignal
|
|
492
|
+
datasetId: string,
|
|
493
|
+
datasetVersion: number,
|
|
494
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
663
495
|
) => {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
url: `/dataset/${datasetId}/schema/${datasetVersion}`,
|
|
667
|
-
method: "get",
|
|
668
|
-
signal,
|
|
496
|
+
return customInstance<DatasetSchemaGetResponse>(
|
|
497
|
+
{url: `/dataset/${datasetId}/schema/${datasetVersion}`, method: 'get', signal
|
|
669
498
|
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
export const getGetSchemaQueryKey = (
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
export type
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
TData
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
request?: SecondParameter<typeof customInstance>;
|
|
697
|
-
}
|
|
698
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
699
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
700
|
-
|
|
701
|
-
const queryKey =
|
|
702
|
-
queryOptions?.queryKey ?? getGetSchemaQueryKey(datasetId, datasetVersion);
|
|
703
|
-
|
|
704
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSchema>>> = ({
|
|
705
|
-
signal,
|
|
706
|
-
}) => getSchema(datasetId, datasetVersion, requestOptions, signal);
|
|
707
|
-
|
|
708
|
-
const query = useQuery<Awaited<ReturnType<typeof getSchema>>, TError, TData>(
|
|
709
|
-
queryKey,
|
|
710
|
-
queryFn,
|
|
711
|
-
{ enabled: !!(datasetId && datasetVersion), ...queryOptions }
|
|
712
|
-
) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
499
|
+
options);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
export const getGetSchemaQueryKey = (datasetId: string,
|
|
504
|
+
datasetVersion: number,) => [`/dataset/${datasetId}/schema/${datasetVersion}`];
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
export type GetSchemaQueryResult = NonNullable<Awaited<ReturnType<typeof getSchema>>>
|
|
508
|
+
export type GetSchemaQueryError = ErrorType<void | DmError>
|
|
509
|
+
|
|
510
|
+
export const useGetSchema = <TData = Awaited<ReturnType<typeof getSchema>>, TError = ErrorType<void | DmError>>(
|
|
511
|
+
datasetId: string,
|
|
512
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getSchema>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
513
|
+
|
|
514
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
515
|
+
|
|
516
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
517
|
+
|
|
518
|
+
const queryKey = queryOptions?.queryKey ?? getGetSchemaQueryKey(datasetId,datasetVersion);
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSchema>>> = ({ signal }) => getSchema(datasetId,datasetVersion, requestOptions, signal);
|
|
523
|
+
|
|
524
|
+
const query = useQuery<Awaited<ReturnType<typeof getSchema>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetId && datasetVersion), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
713
525
|
|
|
714
526
|
query.queryKey = queryKey;
|
|
715
527
|
|
|
716
528
|
return query;
|
|
717
|
-
}
|
|
529
|
+
}
|
|
530
|
+
|