@squonk/data-manager-client 1.0.6-rc.4 → 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/metadata/metadata.ts
CHANGED
|
@@ -8,28 +8,32 @@ 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
|
DatasetMetaGetResponse,
|
|
22
25
|
DmError,
|
|
23
26
|
DatasetVersionMetaPostBodyBody,
|
|
24
|
-
DatasetMetaPostBodyBody
|
|
25
|
-
} from
|
|
26
|
-
import { customInstance } from
|
|
27
|
-
import type { ErrorType } from
|
|
27
|
+
DatasetMetaPostBodyBody
|
|
28
|
+
} from '../data-manager-api.schemas'
|
|
29
|
+
import { customInstance } from '.././custom-instance'
|
|
30
|
+
import type { ErrorType } from '.././custom-instance'
|
|
31
|
+
|
|
28
32
|
|
|
29
33
|
// eslint-disable-next-line
|
|
30
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
31
35
|
config: any,
|
|
32
|
-
args: infer P
|
|
36
|
+
args: infer P,
|
|
33
37
|
) => any
|
|
34
38
|
? P
|
|
35
39
|
: never;
|
|
@@ -44,151 +48,92 @@ The annotations are provided in a list in JSON format. For details of the annota
|
|
|
44
48
|
* @summary Update Metadata for the Dataset version
|
|
45
49
|
*/
|
|
46
50
|
export const addMetadataVersion = (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return customInstance<DatasetMetaGetResponse>(
|
|
64
|
-
{
|
|
65
|
-
url: `/dataset/${datasetId}/meta/${datasetVersion}`,
|
|
66
|
-
method: "post",
|
|
67
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
68
|
-
data: formData,
|
|
69
|
-
},
|
|
70
|
-
options
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export type AddMetadataVersionMutationResult = NonNullable<
|
|
75
|
-
Awaited<ReturnType<typeof addMetadataVersion>>
|
|
76
|
-
>;
|
|
77
|
-
export type AddMetadataVersionMutationBody = DatasetVersionMetaPostBodyBody;
|
|
78
|
-
export type AddMetadataVersionMutationError = ErrorType<DmError | void>;
|
|
79
|
-
|
|
80
|
-
export const useAddMetadataVersion = <
|
|
81
|
-
TError = ErrorType<DmError | void>,
|
|
82
|
-
TContext = unknown
|
|
83
|
-
>(options?: {
|
|
84
|
-
mutation?: UseMutationOptions<
|
|
85
|
-
Awaited<ReturnType<typeof addMetadataVersion>>,
|
|
86
|
-
TError,
|
|
87
|
-
{
|
|
88
|
-
datasetId: string;
|
|
89
|
-
datasetVersion: number;
|
|
90
|
-
data: DatasetVersionMetaPostBodyBody;
|
|
51
|
+
datasetId: string,
|
|
52
|
+
datasetVersion: number,
|
|
53
|
+
datasetVersionMetaPostBodyBody: DatasetVersionMetaPostBodyBody,
|
|
54
|
+
options?: SecondParameter<typeof customInstance>,) => {const formData = new FormData();
|
|
55
|
+
if(datasetVersionMetaPostBodyBody.meta_properties !== undefined) {
|
|
56
|
+
formData.append('meta_properties', datasetVersionMetaPostBodyBody.meta_properties)
|
|
57
|
+
}
|
|
58
|
+
if(datasetVersionMetaPostBodyBody.annotations !== undefined) {
|
|
59
|
+
formData.append('annotations', datasetVersionMetaPostBodyBody.annotations)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return customInstance<DatasetMetaGetResponse>(
|
|
63
|
+
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: 'post',
|
|
64
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
65
|
+
data: formData
|
|
91
66
|
},
|
|
92
|
-
|
|
93
|
-
>;
|
|
94
|
-
request?: SecondParameter<typeof customInstance>;
|
|
95
|
-
}) => {
|
|
96
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
97
|
-
|
|
98
|
-
const mutationFn: MutationFunction<
|
|
99
|
-
Awaited<ReturnType<typeof addMetadataVersion>>,
|
|
100
|
-
{
|
|
101
|
-
datasetId: string;
|
|
102
|
-
datasetVersion: number;
|
|
103
|
-
data: DatasetVersionMetaPostBodyBody;
|
|
67
|
+
options);
|
|
104
68
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export type AddMetadataVersionMutationResult = NonNullable<Awaited<ReturnType<typeof addMetadataVersion>>>
|
|
73
|
+
export type AddMetadataVersionMutationBody = DatasetVersionMetaPostBodyBody
|
|
74
|
+
export type AddMetadataVersionMutationError = ErrorType<DmError | void>
|
|
75
|
+
|
|
76
|
+
export const useAddMetadataVersion = <TError = ErrorType<DmError | void>,
|
|
77
|
+
|
|
78
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadataVersion>>, TError,{datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
79
|
+
) => {
|
|
80
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addMetadataVersion>>, {datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}> = (props) => {
|
|
86
|
+
const {datasetId,datasetVersion,data} = props ?? {};
|
|
87
|
+
|
|
88
|
+
return addMetadataVersion(datasetId,datasetVersion,data,requestOptions)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return useMutation<Awaited<ReturnType<typeof addMetadataVersion>>, TError, {datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
123
94
|
* Returns the metadata for a Dataset version in JSON format.
|
|
124
95
|
|
|
125
96
|
* @summary Gets the Metadata for a specific Dataset version
|
|
126
97
|
*/
|
|
127
98
|
export const getMetadataVersion = (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
signal?: AbortSignal
|
|
99
|
+
datasetId: string,
|
|
100
|
+
datasetVersion: number,
|
|
101
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
132
102
|
) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
url: `/dataset/${datasetId}/meta/${datasetVersion}`,
|
|
136
|
-
method: "get",
|
|
137
|
-
signal,
|
|
103
|
+
return customInstance<DatasetMetaGetResponse>(
|
|
104
|
+
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: 'get', signal
|
|
138
105
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export const getGetMetadataVersionQueryKey = (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export type
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
TData
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
request?: SecondParameter<typeof customInstance>;
|
|
166
|
-
}
|
|
167
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
168
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
169
|
-
|
|
170
|
-
const queryKey =
|
|
171
|
-
queryOptions?.queryKey ??
|
|
172
|
-
getGetMetadataVersionQueryKey(datasetId, datasetVersion);
|
|
173
|
-
|
|
174
|
-
const queryFn: QueryFunction<
|
|
175
|
-
Awaited<ReturnType<typeof getMetadataVersion>>
|
|
176
|
-
> = ({ signal }) =>
|
|
177
|
-
getMetadataVersion(datasetId, datasetVersion, requestOptions, signal);
|
|
178
|
-
|
|
179
|
-
const query = useQuery<
|
|
180
|
-
Awaited<ReturnType<typeof getMetadataVersion>>,
|
|
181
|
-
TError,
|
|
182
|
-
TData
|
|
183
|
-
>(queryKey, queryFn, {
|
|
184
|
-
enabled: !!(datasetId && datasetVersion),
|
|
185
|
-
...queryOptions,
|
|
186
|
-
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
106
|
+
options);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
export const getGetMetadataVersionQueryKey = (datasetId: string,
|
|
111
|
+
datasetVersion: number,) => [`/dataset/${datasetId}/meta/${datasetVersion}`];
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
export type GetMetadataVersionQueryResult = NonNullable<Awaited<ReturnType<typeof getMetadataVersion>>>
|
|
115
|
+
export type GetMetadataVersionQueryError = ErrorType<void | DmError>
|
|
116
|
+
|
|
117
|
+
export const useGetMetadataVersion = <TData = Awaited<ReturnType<typeof getMetadataVersion>>, TError = ErrorType<void | DmError>>(
|
|
118
|
+
datasetId: string,
|
|
119
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
120
|
+
|
|
121
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
122
|
+
|
|
123
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
124
|
+
|
|
125
|
+
const queryKey = queryOptions?.queryKey ?? getGetMetadataVersionQueryKey(datasetId,datasetVersion);
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMetadataVersion>>> = ({ signal }) => getMetadataVersion(datasetId,datasetVersion, requestOptions, signal);
|
|
130
|
+
|
|
131
|
+
const query = useQuery<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetId && datasetVersion), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
187
132
|
|
|
188
133
|
query.queryKey = queryKey;
|
|
189
134
|
|
|
190
135
|
return query;
|
|
191
|
-
}
|
|
136
|
+
}
|
|
192
137
|
|
|
193
138
|
/**
|
|
194
139
|
* Update default parameters or add new labels to the metadata for the dataset.
|
|
@@ -198,122 +143,86 @@ The labels are provided in a list in JSON format. For details of the label forma
|
|
|
198
143
|
* @summary Update Metadata for the Dataset
|
|
199
144
|
*/
|
|
200
145
|
export const addMetadata = (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
url: `/dataset/${datasetId}/meta`,
|
|
216
|
-
method: "post",
|
|
217
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
218
|
-
data: formData,
|
|
146
|
+
datasetId: string,
|
|
147
|
+
datasetMetaPostBodyBody: DatasetMetaPostBodyBody,
|
|
148
|
+
options?: SecondParameter<typeof customInstance>,) => {const formData = new FormData();
|
|
149
|
+
if(datasetMetaPostBodyBody.meta_properties !== undefined) {
|
|
150
|
+
formData.append('meta_properties', datasetMetaPostBodyBody.meta_properties)
|
|
151
|
+
}
|
|
152
|
+
if(datasetMetaPostBodyBody.labels !== undefined) {
|
|
153
|
+
formData.append('labels', datasetMetaPostBodyBody.labels)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return customInstance<DatasetMetaGetResponse>(
|
|
157
|
+
{url: `/dataset/${datasetId}/meta`, method: 'post',
|
|
158
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
159
|
+
data: formData
|
|
219
160
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
export type
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
> = (props) => {
|
|
248
|
-
const { datasetId, data } = props ?? {};
|
|
249
|
-
|
|
250
|
-
return addMetadata(datasetId, data, requestOptions);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
return useMutation<
|
|
254
|
-
Awaited<ReturnType<typeof addMetadata>>,
|
|
255
|
-
TError,
|
|
256
|
-
{ datasetId: string; data: DatasetMetaPostBodyBody },
|
|
257
|
-
TContext
|
|
258
|
-
>(mutationFn, mutationOptions);
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
161
|
+
options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export type AddMetadataMutationResult = NonNullable<Awaited<ReturnType<typeof addMetadata>>>
|
|
167
|
+
export type AddMetadataMutationBody = DatasetMetaPostBodyBody
|
|
168
|
+
export type AddMetadataMutationError = ErrorType<DmError | void>
|
|
169
|
+
|
|
170
|
+
export const useAddMetadata = <TError = ErrorType<DmError | void>,
|
|
171
|
+
|
|
172
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadata>>, TError,{datasetId: string;data: DatasetMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
173
|
+
) => {
|
|
174
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addMetadata>>, {datasetId: string;data: DatasetMetaPostBodyBody}> = (props) => {
|
|
180
|
+
const {datasetId,data} = props ?? {};
|
|
181
|
+
|
|
182
|
+
return addMetadata(datasetId,data,requestOptions)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return useMutation<Awaited<ReturnType<typeof addMetadata>>, TError, {datasetId: string;data: DatasetMetaPostBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
261
188
|
* Returns the metadata for a Dataset in JSON format.
|
|
262
189
|
|
|
263
190
|
* @summary Gets the Metadata for a specific Dataset
|
|
264
191
|
*/
|
|
265
192
|
export const getMetadata = (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
signal?: AbortSignal
|
|
193
|
+
datasetId: string,
|
|
194
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
269
195
|
) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
export type GetMetadataQueryResult = NonNullable<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
export
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
TData
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
datasetId: string,
|
|
290
|
-
options?: {
|
|
291
|
-
query?: UseQueryOptions<
|
|
292
|
-
Awaited<ReturnType<typeof getMetadata>>,
|
|
293
|
-
TError,
|
|
294
|
-
TData
|
|
295
|
-
>;
|
|
296
|
-
request?: SecondParameter<typeof customInstance>;
|
|
297
|
-
}
|
|
298
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
299
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
196
|
+
return customInstance<DatasetMetaGetResponse>(
|
|
197
|
+
{url: `/dataset/${datasetId}/meta`, method: 'get', signal
|
|
198
|
+
},
|
|
199
|
+
options);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
export const getGetMetadataQueryKey = (datasetId: string,) => [`/dataset/${datasetId}/meta`];
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
export type GetMetadataQueryResult = NonNullable<Awaited<ReturnType<typeof getMetadata>>>
|
|
207
|
+
export type GetMetadataQueryError = ErrorType<void | DmError>
|
|
208
|
+
|
|
209
|
+
export const useGetMetadata = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(
|
|
210
|
+
datasetId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
211
|
+
|
|
212
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
213
|
+
|
|
214
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
300
215
|
|
|
301
216
|
const queryKey = queryOptions?.queryKey ?? getGetMetadataQueryKey(datasetId);
|
|
302
217
|
|
|
303
|
-
|
|
304
|
-
signal,
|
|
305
|
-
}) => getMetadata(datasetId, requestOptions, signal);
|
|
218
|
+
|
|
306
219
|
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
TData
|
|
311
|
-
>(queryKey, queryFn, {
|
|
312
|
-
enabled: !!datasetId,
|
|
313
|
-
...queryOptions,
|
|
314
|
-
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
220
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMetadata>>> = ({ signal }) => getMetadata(datasetId, requestOptions, signal);
|
|
221
|
+
|
|
222
|
+
const query = useQuery<Awaited<ReturnType<typeof getMetadata>>, TError, TData>(queryKey, queryFn, {enabled: !!(datasetId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
315
223
|
|
|
316
224
|
query.queryKey = queryKey;
|
|
317
225
|
|
|
318
226
|
return query;
|
|
319
|
-
}
|
|
227
|
+
}
|
|
228
|
+
|