@squonk/data-manager-client 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/accounting/accounting.cjs +51 -8
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +61 -10
- package/accounting/accounting.d.ts +61 -10
- package/accounting/accounting.js +49 -6
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +67 -24
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +75 -24
- package/admin/admin.d.ts +75 -24
- package/admin/admin.js +56 -13
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +35 -6
- package/application/application.cjs.map +1 -1
- package/application/application.d.cts +42 -8
- package/application/application.d.ts +42 -8
- package/application/application.js +34 -5
- package/application/application.js.map +1 -1
- package/{chunk-UKA7G3OB.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-UKA7G3OB.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-J22A7LHX.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/configuration/configuration.cjs +19 -4
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +23 -6
- package/configuration/configuration.d.ts +23 -6
- package/configuration/configuration.js +19 -4
- package/configuration/configuration.js.map +1 -1
- package/dataset/dataset.cjs +93 -22
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.cts +105 -20
- package/dataset/dataset.d.ts +105 -20
- package/dataset/dataset.js +83 -12
- package/dataset/dataset.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +71 -14
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.cts +83 -15
- package/exchange-rate/exchange-rate.d.ts +83 -15
- package/exchange-rate/exchange-rate.js +65 -8
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file-and-path/file-and-path.cjs +45 -16
- package/file-and-path/file-and-path.cjs.map +1 -1
- package/file-and-path/file-and-path.d.cts +48 -14
- package/file-and-path/file-and-path.d.ts +48 -14
- package/file-and-path/file-and-path.js +39 -10
- package/file-and-path/file-and-path.js.map +1 -1
- package/index.cjs +9 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +2033 -2
- package/index.d.ts +2033 -2
- package/index.js +8 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +45 -16
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.cts +48 -14
- package/instance/instance.d.ts +48 -14
- package/instance/instance.js +38 -9
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +51 -8
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +61 -10
- package/job/job.d.ts +61 -10
- package/job/job.js +49 -6
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +39 -10
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.cts +45 -11
- package/metadata/metadata.d.ts +45 -11
- package/metadata/metadata.js +36 -7
- package/metadata/metadata.js.map +1 -1
- package/package.json +11 -11
- package/project/project.cjs +83 -26
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +89 -21
- package/project/project.d.ts +89 -21
- package/project/project.js +71 -14
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +136 -22
- package/src/admin/admin.ts +148 -50
- package/src/application/application.ts +93 -18
- package/src/configuration/configuration.ts +50 -14
- package/src/custom-instance.ts +3 -4
- package/src/data-manager-api.schemas.ts +59 -33
- package/src/dataset/dataset.ts +233 -45
- package/src/exchange-rate/exchange-rate.ts +185 -32
- package/src/file-and-path/file-and-path.ts +98 -33
- package/src/instance/instance.ts +98 -33
- package/src/job/job.ts +138 -22
- package/src/metadata/metadata.ts +97 -24
- package/src/project/project.ts +191 -50
- package/src/task/task.ts +96 -21
- package/src/type/type.ts +50 -14
- package/src/user/user.ts +137 -25
- package/task/task.cjs +37 -8
- package/task/task.cjs.map +1 -1
- package/task/task.d.cts +44 -10
- package/task/task.d.ts +44 -10
- package/task/task.js +35 -6
- package/task/task.js.map +1 -1
- package/type/type.cjs +19 -4
- package/type/type.cjs.map +1 -1
- package/type/type.d.cts +23 -6
- package/type/type.d.ts +23 -6
- package/type/type.js +19 -4
- package/type/type.js.map +1 -1
- package/user/user.cjs +53 -10
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +63 -12
- package/user/user.d.ts +63 -12
- package/user/user.js +49 -6
- package/user/user.js.map +1 -1
- package/chunk-J22A7LHX.cjs.map +0 -1
- package/custom-instance-37ed2460.d.ts +0 -2014
package/src/job/job.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -9,13 +9,16 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
9
9
|
* OpenAPI spec version: 1.2
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
|
-
useQuery
|
|
12
|
+
useQuery,
|
|
13
|
+
useSuspenseQuery
|
|
13
14
|
} from '@tanstack/react-query'
|
|
14
15
|
import type {
|
|
15
16
|
QueryFunction,
|
|
16
17
|
QueryKey,
|
|
17
18
|
UseQueryOptions,
|
|
18
|
-
UseQueryResult
|
|
19
|
+
UseQueryResult,
|
|
20
|
+
UseSuspenseQueryOptions,
|
|
21
|
+
UseSuspenseQueryResult
|
|
19
22
|
} from '@tanstack/react-query'
|
|
20
23
|
import type {
|
|
21
24
|
DmError,
|
|
@@ -29,13 +32,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
29
32
|
import type { ErrorType } from '.././custom-instance';
|
|
30
33
|
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
|
-
config: any,
|
|
35
|
-
args: infer P,
|
|
36
|
-
) => any
|
|
37
|
-
? P
|
|
38
|
-
: never;
|
|
35
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
39
36
|
|
|
40
37
|
|
|
41
38
|
/**
|
|
@@ -52,7 +49,7 @@ export const getJobs = (
|
|
|
52
49
|
|
|
53
50
|
|
|
54
51
|
return customInstance<JobsGetResponse>(
|
|
55
|
-
{url: `/job`, method: '
|
|
52
|
+
{url: `/job`, method: 'GET',
|
|
56
53
|
params, signal
|
|
57
54
|
},
|
|
58
55
|
options);
|
|
@@ -60,12 +57,11 @@ export const getJobs = (
|
|
|
60
57
|
|
|
61
58
|
|
|
62
59
|
export const getGetJobsQueryKey = (params?: GetJobsParams,) => {
|
|
63
|
-
|
|
64
60
|
return ["data-manager-api", `/job`, ...(params ? [params]: [])] as const;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
|
|
68
|
-
export const getGetJobsQueryOptions = <TData = Awaited<ReturnType<typeof getJobs>>, TError = ErrorType<DmError>>(params?: GetJobsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData
|
|
64
|
+
export const getGetJobsQueryOptions = <TData = Awaited<ReturnType<typeof getJobs>>, TError = ErrorType<DmError>>(params?: GetJobsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
69
65
|
) => {
|
|
70
66
|
|
|
71
67
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -90,7 +86,7 @@ export type GetJobsQueryError = ErrorType<DmError>
|
|
|
90
86
|
* @summary Get all Jobs available to you
|
|
91
87
|
*/
|
|
92
88
|
export const useGetJobs = <TData = Awaited<ReturnType<typeof getJobs>>, TError = ErrorType<DmError>>(
|
|
93
|
-
params?: GetJobsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData
|
|
89
|
+
params?: GetJobsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
94
90
|
|
|
95
91
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
96
92
|
|
|
@@ -105,6 +101,46 @@ export const useGetJobs = <TData = Awaited<ReturnType<typeof getJobs>>, TError =
|
|
|
105
101
|
|
|
106
102
|
|
|
107
103
|
|
|
104
|
+
export const getGetJobsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getJobs>>, TError = ErrorType<DmError>>(params?: GetJobsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
105
|
+
) => {
|
|
106
|
+
|
|
107
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
108
|
+
|
|
109
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobsQueryKey(params);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getJobs>>> = ({ signal }) => getJobs(params, requestOptions, signal);
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData> & { queryKey: QueryKey }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type GetJobsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getJobs>>>
|
|
123
|
+
export type GetJobsSuspenseQueryError = ErrorType<DmError>
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @summary Get all Jobs available to you
|
|
127
|
+
*/
|
|
128
|
+
export const useGetJobsSuspense = <TData = Awaited<ReturnType<typeof getJobs>>, TError = ErrorType<DmError>>(
|
|
129
|
+
params?: GetJobsParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
130
|
+
|
|
131
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
132
|
+
|
|
133
|
+
const queryOptions = getGetJobsSuspenseQueryOptions(params,options)
|
|
134
|
+
|
|
135
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
136
|
+
|
|
137
|
+
query.queryKey = queryOptions.queryKey ;
|
|
138
|
+
|
|
139
|
+
return query;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
108
144
|
/**
|
|
109
145
|
* Gets a Job based on its **collection**, **job** and **version**.
|
|
110
146
|
|
|
@@ -119,7 +155,7 @@ export const getJobByVersion = (
|
|
|
119
155
|
|
|
120
156
|
|
|
121
157
|
return customInstance<JobGetResponse>(
|
|
122
|
-
{url: `/job/get-by-version`, method: '
|
|
158
|
+
{url: `/job/get-by-version`, method: 'GET',
|
|
123
159
|
params, signal
|
|
124
160
|
},
|
|
125
161
|
options);
|
|
@@ -127,12 +163,11 @@ export const getJobByVersion = (
|
|
|
127
163
|
|
|
128
164
|
|
|
129
165
|
export const getGetJobByVersionQueryKey = (params: GetJobByVersionParams,) => {
|
|
130
|
-
|
|
131
166
|
return ["data-manager-api", `/job/get-by-version`, ...(params ? [params]: [])] as const;
|
|
132
167
|
}
|
|
133
168
|
|
|
134
169
|
|
|
135
|
-
export const getGetJobByVersionQueryOptions = <TData = Awaited<ReturnType<typeof getJobByVersion>>, TError = ErrorType<DmError>>(params: GetJobByVersionParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData
|
|
170
|
+
export const getGetJobByVersionQueryOptions = <TData = Awaited<ReturnType<typeof getJobByVersion>>, TError = ErrorType<DmError>>(params: GetJobByVersionParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
136
171
|
) => {
|
|
137
172
|
|
|
138
173
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -157,7 +192,7 @@ export type GetJobByVersionQueryError = ErrorType<DmError>
|
|
|
157
192
|
* @summary Get a Job by its version
|
|
158
193
|
*/
|
|
159
194
|
export const useGetJobByVersion = <TData = Awaited<ReturnType<typeof getJobByVersion>>, TError = ErrorType<DmError>>(
|
|
160
|
-
params: GetJobByVersionParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData
|
|
195
|
+
params: GetJobByVersionParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
161
196
|
|
|
162
197
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
163
198
|
|
|
@@ -172,6 +207,46 @@ export const useGetJobByVersion = <TData = Awaited<ReturnType<typeof getJobByVer
|
|
|
172
207
|
|
|
173
208
|
|
|
174
209
|
|
|
210
|
+
export const getGetJobByVersionSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getJobByVersion>>, TError = ErrorType<DmError>>(params: GetJobByVersionParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
211
|
+
) => {
|
|
212
|
+
|
|
213
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
214
|
+
|
|
215
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobByVersionQueryKey(params);
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getJobByVersion>>> = ({ signal }) => getJobByVersion(params, requestOptions, signal);
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData> & { queryKey: QueryKey }
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type GetJobByVersionSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getJobByVersion>>>
|
|
229
|
+
export type GetJobByVersionSuspenseQueryError = ErrorType<DmError>
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @summary Get a Job by its version
|
|
233
|
+
*/
|
|
234
|
+
export const useGetJobByVersionSuspense = <TData = Awaited<ReturnType<typeof getJobByVersion>>, TError = ErrorType<DmError>>(
|
|
235
|
+
params: GetJobByVersionParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobByVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
236
|
+
|
|
237
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
238
|
+
|
|
239
|
+
const queryOptions = getGetJobByVersionSuspenseQueryOptions(params,options)
|
|
240
|
+
|
|
241
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
242
|
+
|
|
243
|
+
query.queryKey = queryOptions.queryKey ;
|
|
244
|
+
|
|
245
|
+
return query;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
175
250
|
/**
|
|
176
251
|
* Get details of a specific Job available to you that can be instantiated.
|
|
177
252
|
|
|
@@ -187,7 +262,7 @@ export const getJob = (
|
|
|
187
262
|
|
|
188
263
|
|
|
189
264
|
return customInstance<JobGetResponse>(
|
|
190
|
-
{url: `/job/${jobId}`, method: '
|
|
265
|
+
{url: `/job/${jobId}`, method: 'GET',
|
|
191
266
|
params, signal
|
|
192
267
|
},
|
|
193
268
|
options);
|
|
@@ -196,13 +271,12 @@ export const getJob = (
|
|
|
196
271
|
|
|
197
272
|
export const getGetJobQueryKey = (jobId: number,
|
|
198
273
|
params?: GetJobParams,) => {
|
|
199
|
-
|
|
200
274
|
return ["data-manager-api", `/job/${jobId}`, ...(params ? [params]: [])] as const;
|
|
201
275
|
}
|
|
202
276
|
|
|
203
277
|
|
|
204
278
|
export const getGetJobQueryOptions = <TData = Awaited<ReturnType<typeof getJob>>, TError = ErrorType<void | DmError>>(jobId: number,
|
|
205
|
-
params?: GetJobParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData
|
|
279
|
+
params?: GetJobParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
206
280
|
) => {
|
|
207
281
|
|
|
208
282
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -228,7 +302,7 @@ export type GetJobQueryError = ErrorType<void | DmError>
|
|
|
228
302
|
*/
|
|
229
303
|
export const useGetJob = <TData = Awaited<ReturnType<typeof getJob>>, TError = ErrorType<void | DmError>>(
|
|
230
304
|
jobId: number,
|
|
231
|
-
params?: GetJobParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData
|
|
305
|
+
params?: GetJobParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
232
306
|
|
|
233
307
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
234
308
|
|
|
@@ -243,3 +317,45 @@ export const useGetJob = <TData = Awaited<ReturnType<typeof getJob>>, TError = E
|
|
|
243
317
|
|
|
244
318
|
|
|
245
319
|
|
|
320
|
+
export const getGetJobSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getJob>>, TError = ErrorType<void | DmError>>(jobId: number,
|
|
321
|
+
params?: GetJobParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
322
|
+
) => {
|
|
323
|
+
|
|
324
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
325
|
+
|
|
326
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobQueryKey(jobId,params);
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getJob>>> = ({ signal }) => getJob(jobId,params, requestOptions, signal);
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
return { queryKey, queryFn, enabled: !!(jobId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData> & { queryKey: QueryKey }
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export type GetJobSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getJob>>>
|
|
340
|
+
export type GetJobSuspenseQueryError = ErrorType<void | DmError>
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @summary Get details of a specific Job
|
|
344
|
+
*/
|
|
345
|
+
export const useGetJobSuspense = <TData = Awaited<ReturnType<typeof getJob>>, TError = ErrorType<void | DmError>>(
|
|
346
|
+
jobId: number,
|
|
347
|
+
params?: GetJobParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
348
|
+
|
|
349
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
350
|
+
|
|
351
|
+
const queryOptions = getGetJobSuspenseQueryOptions(jobId,params,options)
|
|
352
|
+
|
|
353
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
354
|
+
|
|
355
|
+
query.queryKey = queryOptions.queryKey ;
|
|
356
|
+
|
|
357
|
+
return query;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
package/src/metadata/metadata.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -10,7 +10,8 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
12
|
useMutation,
|
|
13
|
-
useQuery
|
|
13
|
+
useQuery,
|
|
14
|
+
useSuspenseQuery
|
|
14
15
|
} from '@tanstack/react-query'
|
|
15
16
|
import type {
|
|
16
17
|
MutationFunction,
|
|
@@ -18,7 +19,9 @@ import type {
|
|
|
18
19
|
QueryKey,
|
|
19
20
|
UseMutationOptions,
|
|
20
21
|
UseQueryOptions,
|
|
21
|
-
UseQueryResult
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
22
25
|
} from '@tanstack/react-query'
|
|
23
26
|
import type {
|
|
24
27
|
DatasetMetaGetResponse,
|
|
@@ -30,13 +33,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
30
33
|
import type { ErrorType } from '.././custom-instance';
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
35
|
-
config: any,
|
|
36
|
-
args: infer P,
|
|
37
|
-
) => any
|
|
38
|
-
? P
|
|
39
|
-
: never;
|
|
36
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
40
37
|
|
|
41
38
|
|
|
42
39
|
/**
|
|
@@ -63,7 +60,7 @@ if(datasetVersionMetaPostBodyBody.annotations !== undefined) {
|
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
return customInstance<DatasetMetaGetResponse>(
|
|
66
|
-
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: '
|
|
63
|
+
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: 'POST',
|
|
67
64
|
headers: {'Content-Type': 'multipart/form-data', },
|
|
68
65
|
data: formData
|
|
69
66
|
},
|
|
@@ -73,7 +70,6 @@ if(datasetVersionMetaPostBodyBody.annotations !== undefined) {
|
|
|
73
70
|
|
|
74
71
|
|
|
75
72
|
export const getAddMetadataVersionMutationOptions = <TError = ErrorType<DmError | void>,
|
|
76
|
-
|
|
77
73
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadataVersion>>, TError,{datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
78
74
|
): UseMutationOptions<Awaited<ReturnType<typeof addMetadataVersion>>, TError,{datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}, TContext> => {
|
|
79
75
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -100,7 +96,6 @@ export const getAddMetadataVersionMutationOptions = <TError = ErrorType<DmError
|
|
|
100
96
|
* @summary Update Metadata for the Dataset version
|
|
101
97
|
*/
|
|
102
98
|
export const useAddMetadataVersion = <TError = ErrorType<DmError | void>,
|
|
103
|
-
|
|
104
99
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadataVersion>>, TError,{datasetId: string;datasetVersion: number;data: DatasetVersionMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
105
100
|
) => {
|
|
106
101
|
|
|
@@ -121,7 +116,7 @@ export const getMetadataVersion = (
|
|
|
121
116
|
|
|
122
117
|
|
|
123
118
|
return customInstance<DatasetMetaGetResponse>(
|
|
124
|
-
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: '
|
|
119
|
+
{url: `/dataset/${datasetId}/meta/${datasetVersion}`, method: 'GET', signal
|
|
125
120
|
},
|
|
126
121
|
options);
|
|
127
122
|
}
|
|
@@ -129,13 +124,12 @@ export const getMetadataVersion = (
|
|
|
129
124
|
|
|
130
125
|
export const getGetMetadataVersionQueryKey = (datasetId: string,
|
|
131
126
|
datasetVersion: number,) => {
|
|
132
|
-
|
|
133
127
|
return ["data-manager-api", `/dataset/${datasetId}/meta/${datasetVersion}`] as const;
|
|
134
128
|
}
|
|
135
129
|
|
|
136
130
|
|
|
137
131
|
export const getGetMetadataVersionQueryOptions = <TData = Awaited<ReturnType<typeof getMetadataVersion>>, TError = ErrorType<void | DmError>>(datasetId: string,
|
|
138
|
-
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData
|
|
132
|
+
datasetVersion: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
139
133
|
) => {
|
|
140
134
|
|
|
141
135
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -161,7 +155,7 @@ export type GetMetadataVersionQueryError = ErrorType<void | DmError>
|
|
|
161
155
|
*/
|
|
162
156
|
export const useGetMetadataVersion = <TData = Awaited<ReturnType<typeof getMetadataVersion>>, TError = ErrorType<void | DmError>>(
|
|
163
157
|
datasetId: string,
|
|
164
|
-
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData
|
|
158
|
+
datasetVersion: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
165
159
|
|
|
166
160
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
167
161
|
|
|
@@ -176,6 +170,48 @@ export const useGetMetadataVersion = <TData = Awaited<ReturnType<typeof getMetad
|
|
|
176
170
|
|
|
177
171
|
|
|
178
172
|
|
|
173
|
+
export const getGetMetadataVersionSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getMetadataVersion>>, TError = ErrorType<void | DmError>>(datasetId: string,
|
|
174
|
+
datasetVersion: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
175
|
+
) => {
|
|
176
|
+
|
|
177
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
178
|
+
|
|
179
|
+
const queryKey = queryOptions?.queryKey ?? getGetMetadataVersionQueryKey(datasetId,datasetVersion);
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMetadataVersion>>> = ({ signal }) => getMetadataVersion(datasetId,datasetVersion, requestOptions, signal);
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
return { queryKey, queryFn, enabled: !!(datasetId && datasetVersion), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData> & { queryKey: QueryKey }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type GetMetadataVersionSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMetadataVersion>>>
|
|
193
|
+
export type GetMetadataVersionSuspenseQueryError = ErrorType<void | DmError>
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @summary Gets the Metadata for a specific Dataset Version
|
|
197
|
+
*/
|
|
198
|
+
export const useGetMetadataVersionSuspense = <TData = Awaited<ReturnType<typeof getMetadataVersion>>, TError = ErrorType<void | DmError>>(
|
|
199
|
+
datasetId: string,
|
|
200
|
+
datasetVersion: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadataVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
201
|
+
|
|
202
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
203
|
+
|
|
204
|
+
const queryOptions = getGetMetadataVersionSuspenseQueryOptions(datasetId,datasetVersion,options)
|
|
205
|
+
|
|
206
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
207
|
+
|
|
208
|
+
query.queryKey = queryOptions.queryKey ;
|
|
209
|
+
|
|
210
|
+
return query;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
179
215
|
/**
|
|
180
216
|
* Update default parameters or add new labels to the Metadata for the Dataset.
|
|
181
217
|
|
|
@@ -199,7 +235,7 @@ if(datasetMetaPostBodyBody.labels !== undefined) {
|
|
|
199
235
|
}
|
|
200
236
|
|
|
201
237
|
return customInstance<DatasetMetaGetResponse>(
|
|
202
|
-
{url: `/dataset/${datasetId}/meta`, method: '
|
|
238
|
+
{url: `/dataset/${datasetId}/meta`, method: 'POST',
|
|
203
239
|
headers: {'Content-Type': 'multipart/form-data', },
|
|
204
240
|
data: formData
|
|
205
241
|
},
|
|
@@ -209,7 +245,6 @@ if(datasetMetaPostBodyBody.labels !== undefined) {
|
|
|
209
245
|
|
|
210
246
|
|
|
211
247
|
export const getAddMetadataMutationOptions = <TError = ErrorType<DmError | void>,
|
|
212
|
-
|
|
213
248
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadata>>, TError,{datasetId: string;data: DatasetMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
214
249
|
): UseMutationOptions<Awaited<ReturnType<typeof addMetadata>>, TError,{datasetId: string;data: DatasetMetaPostBodyBody}, TContext> => {
|
|
215
250
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -236,7 +271,6 @@ export const getAddMetadataMutationOptions = <TError = ErrorType<DmError | void>
|
|
|
236
271
|
* @summary Update Metadata for the Dataset
|
|
237
272
|
*/
|
|
238
273
|
export const useAddMetadata = <TError = ErrorType<DmError | void>,
|
|
239
|
-
|
|
240
274
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addMetadata>>, TError,{datasetId: string;data: DatasetMetaPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
241
275
|
) => {
|
|
242
276
|
|
|
@@ -256,19 +290,18 @@ export const getMetadata = (
|
|
|
256
290
|
|
|
257
291
|
|
|
258
292
|
return customInstance<DatasetMetaGetResponse>(
|
|
259
|
-
{url: `/dataset/${datasetId}/meta`, method: '
|
|
293
|
+
{url: `/dataset/${datasetId}/meta`, method: 'GET', signal
|
|
260
294
|
},
|
|
261
295
|
options);
|
|
262
296
|
}
|
|
263
297
|
|
|
264
298
|
|
|
265
299
|
export const getGetMetadataQueryKey = (datasetId: string,) => {
|
|
266
|
-
|
|
267
300
|
return ["data-manager-api", `/dataset/${datasetId}/meta`] as const;
|
|
268
301
|
}
|
|
269
302
|
|
|
270
303
|
|
|
271
|
-
export const getGetMetadataQueryOptions = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(datasetId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData
|
|
304
|
+
export const getGetMetadataQueryOptions = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(datasetId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
272
305
|
) => {
|
|
273
306
|
|
|
274
307
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -293,7 +326,7 @@ export type GetMetadataQueryError = ErrorType<void | DmError>
|
|
|
293
326
|
* @summary Gets the Metadata for a specific Dataset
|
|
294
327
|
*/
|
|
295
328
|
export const useGetMetadata = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(
|
|
296
|
-
datasetId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData
|
|
329
|
+
datasetId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
297
330
|
|
|
298
331
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
299
332
|
|
|
@@ -308,3 +341,43 @@ export const useGetMetadata = <TData = Awaited<ReturnType<typeof getMetadata>>,
|
|
|
308
341
|
|
|
309
342
|
|
|
310
343
|
|
|
344
|
+
export const getGetMetadataSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(datasetId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
345
|
+
) => {
|
|
346
|
+
|
|
347
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
348
|
+
|
|
349
|
+
const queryKey = queryOptions?.queryKey ?? getGetMetadataQueryKey(datasetId);
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMetadata>>> = ({ signal }) => getMetadata(datasetId, requestOptions, signal);
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
return { queryKey, queryFn, enabled: !!(datasetId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData> & { queryKey: QueryKey }
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type GetMetadataSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMetadata>>>
|
|
363
|
+
export type GetMetadataSuspenseQueryError = ErrorType<void | DmError>
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @summary Gets the Metadata for a specific Dataset
|
|
367
|
+
*/
|
|
368
|
+
export const useGetMetadataSuspense = <TData = Awaited<ReturnType<typeof getMetadata>>, TError = ErrorType<void | DmError>>(
|
|
369
|
+
datasetId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMetadata>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
370
|
+
|
|
371
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
372
|
+
|
|
373
|
+
const queryOptions = getGetMetadataSuspenseQueryOptions(datasetId,options)
|
|
374
|
+
|
|
375
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
376
|
+
|
|
377
|
+
query.queryKey = queryOptions.queryKey ;
|
|
378
|
+
|
|
379
|
+
return query;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|