@squonk/data-manager-client 1.2.3 → 1.2.4-rc.2
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 +31 -13
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +77 -0
- package/accounting/accounting.d.ts +10 -1
- package/accounting/accounting.js +29 -11
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +67 -27
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +324 -0
- package/admin/admin.d.ts +55 -22
- package/admin/admin.js +57 -17
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +23 -13
- package/application/application.cjs.map +1 -1
- package/application/application.d.cts +57 -0
- package/application/application.d.ts +7 -1
- package/application/application.js +22 -12
- package/application/application.js.map +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
- package/chunk-J22A7LHX.cjs.map +1 -0
- package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
- package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
- package/configuration/configuration.cjs +13 -7
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +29 -0
- package/configuration/configuration.d.ts +4 -1
- package/configuration/configuration.js +13 -7
- package/configuration/configuration.js.map +1 -1
- package/{custom-instance-50c9dd5d.d.ts → custom-instance-3d66fe97.d.ts} +826 -826
- package/dataset/dataset.cjs +71 -72
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.cts +315 -0
- package/dataset/dataset.d.ts +46 -16
- package/dataset/dataset.js +62 -63
- package/dataset/dataset.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +43 -32
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.cts +180 -0
- package/exchange-rate/exchange-rate.d.ts +25 -7
- package/exchange-rate/exchange-rate.js +38 -27
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file/file.cjs +38 -22
- package/file/file.cjs.map +1 -1
- package/file/file.d.cts +154 -0
- package/file/file.d.ts +25 -10
- package/file/file.js +34 -18
- package/file/file.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/instance/instance.cjs +47 -37
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.cts +215 -0
- package/instance/instance.d.ts +33 -12
- package/instance/instance.js +41 -31
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +36 -19
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +85 -0
- package/job/job.d.ts +10 -1
- package/job/job.js +34 -17
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +23 -26
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.cts +132 -0
- package/metadata/metadata.d.ts +19 -7
- package/metadata/metadata.js +20 -23
- package/metadata/metadata.js.map +1 -1
- package/package.json +12 -12
- package/project/project.cjs +70 -48
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +377 -0
- package/project/project.d.ts +61 -25
- package/project/project.js +59 -37
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +179 -194
- package/src/admin/admin.ts +590 -735
- package/src/application/application.ts +125 -141
- package/src/configuration/configuration.ts +72 -60
- package/src/data-manager-api.schemas.ts +941 -942
- package/src/dataset/dataset.ts +591 -770
- package/src/exchange-rate/exchange-rate.ts +362 -478
- package/src/file/file.ts +292 -357
- package/src/instance/instance.ts +427 -533
- package/src/job/job.ts +187 -198
- package/src/metadata/metadata.ts +247 -339
- package/src/project/project.ts +669 -860
- package/src/task/task.ts +181 -202
- package/src/type/type.ts +72 -68
- package/src/user/user.ts +248 -286
- package/task/task.cjs +31 -15
- package/task/task.cjs.map +1 -1
- package/task/task.d.cts +103 -0
- package/task/task.d.ts +10 -1
- package/task/task.js +29 -13
- package/task/task.js.map +1 -1
- package/type/type.cjs +13 -7
- package/type/type.cjs.map +1 -1
- package/type/type.d.cts +31 -0
- package/type/type.d.ts +4 -1
- package/type/type.js +13 -7
- package/type/type.js.map +1 -1
- package/user/user.cjs +39 -28
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +104 -0
- package/user/user.d.ts +16 -4
- package/user/user.js +36 -25
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/file/file.cjs
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJ22A7LHXcjs = require('../chunk-J22A7LHX.cjs');
|
|
4
4
|
|
|
5
5
|
// src/file/file.ts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
6
9
|
var _reactquery = require('@tanstack/react-query');
|
|
7
10
|
var getFiles = (params, options, signal) => {
|
|
8
|
-
return
|
|
9
|
-
{
|
|
11
|
+
return _chunkJ22A7LHXcjs.customInstance.call(void 0,
|
|
12
|
+
{
|
|
13
|
+
url: `/file`,
|
|
14
|
+
method: "get",
|
|
15
|
+
params,
|
|
16
|
+
signal
|
|
17
|
+
},
|
|
10
18
|
options
|
|
11
19
|
);
|
|
12
20
|
};
|
|
13
|
-
var getGetFilesQueryKey = (params) =>
|
|
21
|
+
var getGetFilesQueryKey = (params) => {
|
|
22
|
+
return ["data-manager-api", `/file`, ...params ? [params] : []];
|
|
23
|
+
};
|
|
14
24
|
var getGetFilesQueryOptions = (params, options) => {
|
|
15
25
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
26
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetFilesQueryKey(params)));
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getFiles(params, requestOptions, signal);
|
|
27
|
+
const queryFn = ({ signal }) => getFiles(params, requestOptions, signal);
|
|
20
28
|
return { queryKey, queryFn, ...queryOptions };
|
|
21
29
|
};
|
|
22
30
|
var useGetFiles = (params, options) => {
|
|
@@ -28,10 +36,7 @@ var useGetFiles = (params, options) => {
|
|
|
28
36
|
var attachFile = (filePostBodyBody, options) => {
|
|
29
37
|
const formData = new FormData();
|
|
30
38
|
formData.append("dataset_id", filePostBodyBody.dataset_id);
|
|
31
|
-
formData.append(
|
|
32
|
-
"dataset_version",
|
|
33
|
-
filePostBodyBody.dataset_version.toString()
|
|
34
|
-
);
|
|
39
|
+
formData.append("dataset_version", filePostBodyBody.dataset_version.toString());
|
|
35
40
|
formData.append("project_id", filePostBodyBody.project_id);
|
|
36
41
|
formData.append("as_type", filePostBodyBody.as_type);
|
|
37
42
|
if (filePostBodyBody.path !== void 0) {
|
|
@@ -43,7 +48,7 @@ var attachFile = (filePostBodyBody, options) => {
|
|
|
43
48
|
if (filePostBodyBody.immutable !== void 0) {
|
|
44
49
|
formData.append("immutable", filePostBodyBody.immutable.toString());
|
|
45
50
|
}
|
|
46
|
-
return
|
|
51
|
+
return _chunkJ22A7LHXcjs.customInstance.call(void 0,
|
|
47
52
|
{
|
|
48
53
|
url: `/file`,
|
|
49
54
|
method: "post",
|
|
@@ -66,8 +71,12 @@ var useAttachFile = (options) => {
|
|
|
66
71
|
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
67
72
|
};
|
|
68
73
|
var deleteUnmanagedFile = (params, options) => {
|
|
69
|
-
return
|
|
70
|
-
{
|
|
74
|
+
return _chunkJ22A7LHXcjs.customInstance.call(void 0,
|
|
75
|
+
{
|
|
76
|
+
url: `/file`,
|
|
77
|
+
method: "delete",
|
|
78
|
+
params
|
|
79
|
+
},
|
|
71
80
|
options
|
|
72
81
|
);
|
|
73
82
|
};
|
|
@@ -84,8 +93,11 @@ var useDeleteUnmanagedFile = (options) => {
|
|
|
84
93
|
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
85
94
|
};
|
|
86
95
|
var deleteFile = (fileId, options) => {
|
|
87
|
-
return
|
|
88
|
-
{
|
|
96
|
+
return _chunkJ22A7LHXcjs.customInstance.call(void 0,
|
|
97
|
+
{
|
|
98
|
+
url: `/file/${fileId}`,
|
|
99
|
+
method: "delete"
|
|
100
|
+
},
|
|
89
101
|
options
|
|
90
102
|
);
|
|
91
103
|
};
|
|
@@ -102,18 +114,22 @@ var useDeleteFile = (options) => {
|
|
|
102
114
|
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
103
115
|
};
|
|
104
116
|
var downloadFile = (fileId, options, signal) => {
|
|
105
|
-
return
|
|
106
|
-
{
|
|
117
|
+
return _chunkJ22A7LHXcjs.customInstance.call(void 0,
|
|
118
|
+
{
|
|
119
|
+
url: `/file/${fileId}`,
|
|
120
|
+
method: "get",
|
|
121
|
+
signal
|
|
122
|
+
},
|
|
107
123
|
options
|
|
108
124
|
);
|
|
109
125
|
};
|
|
110
|
-
var getDownloadFileQueryKey = (fileId) =>
|
|
126
|
+
var getDownloadFileQueryKey = (fileId) => {
|
|
127
|
+
return ["data-manager-api", `/file/${fileId}`];
|
|
128
|
+
};
|
|
111
129
|
var getDownloadFileQueryOptions = (fileId, options) => {
|
|
112
130
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
113
131
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getDownloadFileQueryKey(fileId)));
|
|
114
|
-
const queryFn = ({
|
|
115
|
-
signal
|
|
116
|
-
}) => downloadFile(fileId, requestOptions, signal);
|
|
132
|
+
const queryFn = ({ signal }) => downloadFile(fileId, requestOptions, signal);
|
|
117
133
|
return { queryKey, queryFn, enabled: !!fileId, ...queryOptions };
|
|
118
134
|
};
|
|
119
135
|
var useDownloadFile = (fileId, options) => {
|
package/file/file.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"s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AAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,IAAI,SAAS,CAAC;AAE7B,WAAO,WAAW,QAAQ,cAAc;AAAA,EAC1C;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,gBAAgB,CAG3B,YAQI;AACJ,QAAM,kBAAkB,6BAA6B,OAAO;AAE5D,SAAO,YAAY,eAAe;AACpC;AAQO,IAAM,eAAe,CAC1B,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,UAAU,QAAQ,OAAO,OAAO;AAAA,IAChD;AAAA,EACF;AACF;AAEO,IAAM,0BAA0B,CAAC,WACtC,CAAC,oBAAoB,SAAS,QAAQ;AAEjC,IAAM,8BAA8B,CAIzC,QACA,YAUG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,wBAAwB,MAAM;AAEzE,QAAM,UAAmE,CAAC;AAAA,IACxE;AAAA,EACF,MAAM,aAAa,QAAQ,gBAAgB,MAAM;AAEjD,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,QAAQ,GAAG,aAAa;AACjE;AAOO,IAAM,kBAAkB,CAI7B,QACA,YAQ2D;AAC3D,QAAM,eAAe,4BAA4B,QAAQ,OAAO;AAEhE,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 1.2\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n FilesGetResponse,\n DmError,\n GetFilesParams,\n FilePostResponse,\n FilePostBodyBody,\n DeleteUnmanagedFileParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).\n\n * @summary Gets the Files on a Project Path\n */\nexport const getFiles = (\n params: GetFilesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<FilesGetResponse>(\n { url: `/file`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetFilesQueryKey = (params: GetFilesParams) =>\n [\"data-manager-api\", `/file`, ...(params ? [params] : [])] as const;\n\nexport const getGetFilesQueryOptions = <\n TData = Awaited<ReturnType<typeof getFiles>>,\n TError = ErrorType<void | DmError>\n>(\n params: GetFilesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getFiles>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({\n signal,\n }) => getFiles(params, requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetFilesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getFiles>>\n>;\nexport type GetFilesQueryError = ErrorType<void | DmError>;\n\nexport const useGetFiles = <\n TData = Awaited<ReturnType<typeof getFiles>>,\n TError = ErrorType<void | DmError>\n>(\n params: GetFilesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getFiles>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetFilesQueryOptions(params, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.\n\nOnly Datasets attached to projects are available through the Project API. A Dataset that you upload is only available to others (who are not already `editors` of the data) when the Dataset is attached to a project.\n\nAn `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.\n\nYou must be an `editor` or the `owner` of the project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.\n\nYou cannot add a Dataset to a Project until its upload is complete.\n\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const attachFile = (\n filePostBodyBody: FilePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"dataset_id\", filePostBodyBody.dataset_id);\n formData.append(\n \"dataset_version\",\n filePostBodyBody.dataset_version.toString()\n );\n formData.append(\"project_id\", filePostBodyBody.project_id);\n formData.append(\"as_type\", filePostBodyBody.as_type);\n if (filePostBodyBody.path !== undefined) {\n formData.append(\"path\", filePostBodyBody.path);\n }\n if (filePostBodyBody.compress !== undefined) {\n formData.append(\"compress\", filePostBodyBody.compress.toString());\n }\n if (filePostBodyBody.immutable !== undefined) {\n formData.append(\"immutable\", filePostBodyBody.immutable.toString());\n }\n\n return customInstance<FilePostResponse>(\n {\n url: `/file`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getAttachFileMutationOptions = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachFile>>,\n { data: FilePostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return attachFile(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AttachFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachFile>>\n>;\nexport type AttachFileMutationBody = FilePostBodyBody;\nexport type AttachFileMutationError = ErrorType<void | DmError>;\n\nexport const useAttachFile = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAttachFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a project.\n\n * @summary Delete an unmanaged Project File\n */\nexport const deleteUnmanagedFile = (\n params: DeleteUnmanagedFileParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/file`, method: \"delete\", params },\n options\n );\n};\n\nexport const getDeleteUnmanagedFileMutationOptions = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n { params: DeleteUnmanagedFileParams }\n > = (props) => {\n const { params } = props ?? {};\n\n return deleteUnmanagedFile(params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteUnmanagedFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>\n>;\n\nexport type DeleteUnmanagedFileMutationError = ErrorType<DmError>;\n\nexport const useDeleteUnmanagedFile = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Given a `file_id` the file will be removed from the Project it's attached to.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.\n\nYou cannot delete a Project File until the attach is complete.\n\n * @summary Delete/detach a File (from a Project)\n */\nexport const deleteFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/file/${fileId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteFileMutationOptions = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteFile>>,\n { fileId: string }\n > = (props) => {\n const { fileId } = props ?? {};\n\n return deleteFile(fileId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteFile>>\n>;\n\nexport type DeleteFileMutationError = ErrorType<DmError>;\n\nexport const useDeleteFile = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Given a `file_id` the file will be returned if available.\n\nYou cannot get a Project File until the attach is complete.\n\n * @summary Download a File (from a project)\n */\nexport const downloadFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<void>(\n { url: `/file/${fileId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getDownloadFileQueryKey = (fileId: string) =>\n [\"data-manager-api\", `/file/${fileId}`] as const;\n\nexport const getDownloadFileQueryOptions = <\n TData = Awaited<ReturnType<typeof downloadFile>>,\n TError = ErrorType<DmError>\n>(\n fileId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof downloadFile>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({\n signal,\n }) => downloadFile(fileId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!fileId, ...queryOptions };\n};\n\nexport type DownloadFileQueryResult = NonNullable<\n Awaited<ReturnType<typeof downloadFile>>\n>;\nexport type DownloadFileQueryError = ErrorType<DmError>;\n\nexport const useDownloadFile = <\n TData = Awaited<ReturnType<typeof downloadFile>>,\n TError = ErrorType<DmError>\n>(\n fileId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof downloadFile>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getDownloadFileQueryOptions(fileId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/file/file.ts"],"names":[],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAmCA,IAAM,WAAW,CACpB,QACH,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAS,QAAQ;AAAA,MACrB;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,sBAAsB,CAAC,WAA4B;AAE5D,SAAO,CAAC,oBAAoB,SAAS,GAAI,SAAS,CAAC,MAAM,IAAG,CAAC,CAAE;AAC/D;AAGG,IAAM,0BAA0B,CAAmF,QAAwB,YAC7I;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,oBAAoB,MAAM;AAIpE,QAAM,UAA+D,CAAC,EAAE,OAAO,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAM7H,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,cAAc,CAC1B,QAAwB,YAEuC;AAE9D,QAAM,eAAe,wBAAwB,QAAO,OAAO;AAE3D,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAiBO,IAAM,aAAa,CACtB,kBACH,YAAsD;AAEjD,QAAM,WAAW,IAAI,SAAS;AACpC,WAAS,OAAO,cAAc,iB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AU,SAAS,SAAS,CAAC,CAAE,QAAS,GAAG,aAAY;AACpE;AAQO,IAAM,kBAAkB,CAC9B,QAAgB,YAE+C;AAE9D,QAAM,eAAe,4BAA4B,QAAO,OAAO;AAE/D,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.20.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 1.2\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query'\nimport type {\n DeleteUnmanagedFileParams,\n DmError,\n FilePostBodyBody,\n FilePostResponse,\n FilesGetResponse,\n GetFilesParams\n} from '../data-manager-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n\n/**\n * Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).\n\n * @summary Gets the Files on a Project Path\n */\nexport const getFiles = (\n params: GetFilesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<FilesGetResponse>(\n {url: `/file`, method: 'get',\n params, signal\n },\n options);\n }\n \n\nexport const getGetFilesQueryKey = (params: GetFilesParams,) => {\n \n return [\"data-manager-api\", `/file`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetFilesQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) => getFiles(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>\nexport type GetFilesQueryError = ErrorType<void | DmError>\n\n/**\n * @summary Gets the Files on a Project Path\n */\nexport const useGetFiles = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(\n params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetFilesQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.\n\nOnly Datasets attached to projects are available through the Project API. A Dataset that you upload is only available to others (who are not already `editors` of the data) when the Dataset is attached to a project.\n\nAn `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.\n\nYou must be an `editor` or the `owner` of the project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.\n\nYou cannot add a Dataset to a Project until its upload is complete.\n\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const attachFile = (\n filePostBodyBody: FilePostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nformData.append('dataset_id', filePostBodyBody.dataset_id)\nformData.append('dataset_version', filePostBodyBody.dataset_version.toString())\nformData.append('project_id', filePostBodyBody.project_id)\nformData.append('as_type', filePostBodyBody.as_type)\nif(filePostBodyBody.path !== undefined) {\n formData.append('path', filePostBodyBody.path)\n }\nif(filePostBodyBody.compress !== undefined) {\n formData.append('compress', filePostBodyBody.compress.toString())\n }\nif(filePostBodyBody.immutable !== undefined) {\n formData.append('immutable', filePostBodyBody.immutable.toString())\n }\n\n return customInstance<FilePostResponse>(\n {url: `/file`, method: 'post',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getAttachFileMutationOptions = <TError = ErrorType<void | DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachFile>>, {data: FilePostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return attachFile(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>\n export type AttachFileMutationBody = FilePostBodyBody\n export type AttachFileMutationError = ErrorType<void | DmError>\n\n /**\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const useAttachFile = <TError = ErrorType<void | DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAttachFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a project.\n\n * @summary Delete an unmanaged Project File\n */\nexport const deleteUnmanagedFile = (\n params: DeleteUnmanagedFileParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/file`, method: 'delete',\n params\n },\n options);\n }\n \n\n\nexport const getDeleteUnmanagedFileMutationOptions = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteUnmanagedFile>>, {params: DeleteUnmanagedFileParams}> = (props) => {\n const {params} = props ?? {};\n\n return deleteUnmanagedFile(params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>\n \n export type DeleteUnmanagedFileMutationError = ErrorType<DmError>\n\n /**\n * @summary Delete an unmanaged Project File\n */\nexport const useDeleteUnmanagedFile = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Given a `file_id` the file will be removed from the Project it's attached to.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.\n\nYou cannot delete a Project File until the attach is complete.\n\n * @summary Delete/detach a File (from a Project)\n */\nexport const deleteFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/file/${fileId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteFileMutationOptions = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteFile>>, {fileId: string}> = (props) => {\n const {fileId} = props ?? {};\n\n return deleteFile(fileId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>\n \n export type DeleteFileMutationError = ErrorType<DmError>\n\n /**\n * @summary Delete/detach a File (from a Project)\n */\nexport const useDeleteFile = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Given a `file_id` the file will be returned if available.\n\nYou cannot get a Project File until the attach is complete.\n\n * @summary Download a File (from a project)\n */\nexport const downloadFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<void>(\n {url: `/file/${fileId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getDownloadFileQueryKey = (fileId: string,) => {\n \n return [\"data-manager-api\", `/file/${fileId}`] as const;\n }\n\n \nexport const getDownloadFileQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) => downloadFile(fileId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(fileId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>\nexport type DownloadFileQueryError = ErrorType<DmError>\n\n/**\n * @summary Download a File (from a project)\n */\nexport const useDownloadFile = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(\n fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getDownloadFileQueryOptions(fileId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n"]}
|
package/file/file.d.cts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
import { n as GetFilesParams, bX as customInstance, by as FilesGetResponse, bY as ErrorType, bT as DmError, ad as FilePostBodyBody, bz as FilePostResponse, D as DeleteUnmanagedFileParams } from '../custom-instance-3d66fe97.js';
|
|
4
|
+
import 'axios';
|
|
5
|
+
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
|
+
/**
|
|
8
|
+
* Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).
|
|
9
|
+
|
|
10
|
+
* @summary Gets the Files on a Project Path
|
|
11
|
+
*/
|
|
12
|
+
declare const getFiles: (params: GetFilesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<FilesGetResponse>;
|
|
13
|
+
declare const getGetFilesQueryKey: (params: GetFilesParams) => readonly ["data-manager-api", "/file", ...GetFilesParams[]];
|
|
14
|
+
declare const getGetFilesQueryOptions: <TData = FilesGetResponse, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: {
|
|
15
|
+
query?: UseQueryOptions<FilesGetResponse, TError, TData, QueryKey> | undefined;
|
|
16
|
+
request?: SecondParameter<typeof customInstance>;
|
|
17
|
+
} | undefined) => UseQueryOptions<FilesGetResponse, TError, TData, QueryKey> & {
|
|
18
|
+
queryKey: QueryKey;
|
|
19
|
+
};
|
|
20
|
+
type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>;
|
|
21
|
+
type GetFilesQueryError = ErrorType<void | DmError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Gets the Files on a Project Path
|
|
24
|
+
*/
|
|
25
|
+
declare const useGetFiles: <TData = FilesGetResponse, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: {
|
|
26
|
+
query?: UseQueryOptions<FilesGetResponse, TError, TData, QueryKey> | undefined;
|
|
27
|
+
request?: SecondParameter<typeof customInstance>;
|
|
28
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
29
|
+
queryKey: QueryKey;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.
|
|
33
|
+
|
|
34
|
+
Only Datasets attached to projects are available through the Project API. A Dataset that you upload is only available to others (who are not already `editors` of the data) when the Dataset is attached to a project.
|
|
35
|
+
|
|
36
|
+
An `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.
|
|
37
|
+
|
|
38
|
+
You must be an `editor` or the `owner` of the project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.
|
|
39
|
+
|
|
40
|
+
You cannot add a Dataset to a Project until its upload is complete.
|
|
41
|
+
|
|
42
|
+
* @summary Attach a Dataset, as a File, to a Project
|
|
43
|
+
*/
|
|
44
|
+
declare const attachFile: (filePostBodyBody: FilePostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<FilePostResponse>;
|
|
45
|
+
declare const getAttachFileMutationOptions: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
|
|
46
|
+
mutation?: UseMutationOptions<FilePostResponse, TError, {
|
|
47
|
+
data: FilePostBodyBody;
|
|
48
|
+
}, TContext> | undefined;
|
|
49
|
+
request?: SecondParameter<typeof customInstance>;
|
|
50
|
+
} | undefined) => UseMutationOptions<FilePostResponse, TError, {
|
|
51
|
+
data: FilePostBodyBody;
|
|
52
|
+
}, TContext>;
|
|
53
|
+
type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>;
|
|
54
|
+
type AttachFileMutationBody = FilePostBodyBody;
|
|
55
|
+
type AttachFileMutationError = ErrorType<void | DmError>;
|
|
56
|
+
/**
|
|
57
|
+
* @summary Attach a Dataset, as a File, to a Project
|
|
58
|
+
*/
|
|
59
|
+
declare const useAttachFile: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
|
|
60
|
+
mutation?: UseMutationOptions<FilePostResponse, TError, {
|
|
61
|
+
data: FilePostBodyBody;
|
|
62
|
+
}, TContext> | undefined;
|
|
63
|
+
request?: SecondParameter<typeof customInstance>;
|
|
64
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<FilePostResponse, TError, {
|
|
65
|
+
data: FilePostBodyBody;
|
|
66
|
+
}, TContext>;
|
|
67
|
+
/**
|
|
68
|
+
* Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.
|
|
69
|
+
|
|
70
|
+
You must be an `editor` or the `owner` of the project to delete a file from a project.
|
|
71
|
+
|
|
72
|
+
* @summary Delete an unmanaged Project File
|
|
73
|
+
*/
|
|
74
|
+
declare const deleteUnmanagedFile: (params: DeleteUnmanagedFileParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
75
|
+
declare const getDeleteUnmanagedFileMutationOptions: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
76
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
77
|
+
params: DeleteUnmanagedFileParams;
|
|
78
|
+
}, TContext> | undefined;
|
|
79
|
+
request?: SecondParameter<typeof customInstance>;
|
|
80
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
81
|
+
params: DeleteUnmanagedFileParams;
|
|
82
|
+
}, TContext>;
|
|
83
|
+
type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>;
|
|
84
|
+
type DeleteUnmanagedFileMutationError = ErrorType<DmError>;
|
|
85
|
+
/**
|
|
86
|
+
* @summary Delete an unmanaged Project File
|
|
87
|
+
*/
|
|
88
|
+
declare const useDeleteUnmanagedFile: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
89
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
90
|
+
params: DeleteUnmanagedFileParams;
|
|
91
|
+
}, TContext> | undefined;
|
|
92
|
+
request?: SecondParameter<typeof customInstance>;
|
|
93
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
|
|
94
|
+
params: DeleteUnmanagedFileParams;
|
|
95
|
+
}, TContext>;
|
|
96
|
+
/**
|
|
97
|
+
* Given a `file_id` the file will be removed from the Project it's attached to.
|
|
98
|
+
|
|
99
|
+
You must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.
|
|
100
|
+
|
|
101
|
+
You cannot delete a Project File until the attach is complete.
|
|
102
|
+
|
|
103
|
+
* @summary Delete/detach a File (from a Project)
|
|
104
|
+
*/
|
|
105
|
+
declare const deleteFile: (fileId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
106
|
+
declare const getDeleteFileMutationOptions: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
107
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
108
|
+
fileId: string;
|
|
109
|
+
}, TContext> | undefined;
|
|
110
|
+
request?: SecondParameter<typeof customInstance>;
|
|
111
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
112
|
+
fileId: string;
|
|
113
|
+
}, TContext>;
|
|
114
|
+
type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>;
|
|
115
|
+
type DeleteFileMutationError = ErrorType<DmError>;
|
|
116
|
+
/**
|
|
117
|
+
* @summary Delete/detach a File (from a Project)
|
|
118
|
+
*/
|
|
119
|
+
declare const useDeleteFile: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
120
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
121
|
+
fileId: string;
|
|
122
|
+
}, TContext> | undefined;
|
|
123
|
+
request?: SecondParameter<typeof customInstance>;
|
|
124
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
|
|
125
|
+
fileId: string;
|
|
126
|
+
}, TContext>;
|
|
127
|
+
/**
|
|
128
|
+
* Given a `file_id` the file will be returned if available.
|
|
129
|
+
|
|
130
|
+
You cannot get a Project File until the attach is complete.
|
|
131
|
+
|
|
132
|
+
* @summary Download a File (from a project)
|
|
133
|
+
*/
|
|
134
|
+
declare const downloadFile: (fileId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<void>;
|
|
135
|
+
declare const getDownloadFileQueryKey: (fileId: string) => readonly ["data-manager-api", `/file/${string}`];
|
|
136
|
+
declare const getDownloadFileQueryOptions: <TData = void, TError = ErrorType<DmError>>(fileId: string, options?: {
|
|
137
|
+
query?: UseQueryOptions<void, TError, TData, QueryKey> | undefined;
|
|
138
|
+
request?: SecondParameter<typeof customInstance>;
|
|
139
|
+
} | undefined) => UseQueryOptions<void, TError, TData, QueryKey> & {
|
|
140
|
+
queryKey: QueryKey;
|
|
141
|
+
};
|
|
142
|
+
type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>;
|
|
143
|
+
type DownloadFileQueryError = ErrorType<DmError>;
|
|
144
|
+
/**
|
|
145
|
+
* @summary Download a File (from a project)
|
|
146
|
+
*/
|
|
147
|
+
declare const useDownloadFile: <TData = void, TError = ErrorType<DmError>>(fileId: string, options?: {
|
|
148
|
+
query?: UseQueryOptions<void, TError, TData, QueryKey> | undefined;
|
|
149
|
+
request?: SecondParameter<typeof customInstance>;
|
|
150
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
151
|
+
queryKey: QueryKey;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export { AttachFileMutationBody, AttachFileMutationError, AttachFileMutationResult, DeleteFileMutationError, DeleteFileMutationResult, DeleteUnmanagedFileMutationError, DeleteUnmanagedFileMutationResult, DownloadFileQueryError, DownloadFileQueryResult, GetFilesQueryError, GetFilesQueryResult, attachFile, deleteFile, deleteUnmanagedFile, downloadFile, getAttachFileMutationOptions, getDeleteFileMutationOptions, getDeleteUnmanagedFileMutationOptions, getDownloadFileQueryKey, getDownloadFileQueryOptions, getFiles, getGetFilesQueryKey, getGetFilesQueryOptions, useAttachFile, useDeleteFile, useDeleteUnmanagedFile, useDownloadFile, useGetFiles };
|
package/file/file.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
-
import { n as GetFilesParams, bX as customInstance, by as FilesGetResponse, bY as ErrorType, bT as DmError, ad as FilePostBodyBody, bz as FilePostResponse, D as DeleteUnmanagedFileParams } from '../custom-instance-
|
|
3
|
+
import { n as GetFilesParams, bX as customInstance, by as FilesGetResponse, bY as ErrorType, bT as DmError, ad as FilePostBodyBody, bz as FilePostResponse, D as DeleteUnmanagedFileParams } from '../custom-instance-3d66fe97.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
6
|
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
@@ -19,6 +19,9 @@ declare const getGetFilesQueryOptions: <TData = FilesGetResponse, TError = Error
|
|
|
19
19
|
};
|
|
20
20
|
type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>;
|
|
21
21
|
type GetFilesQueryError = ErrorType<void | DmError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Gets the Files on a Project Path
|
|
24
|
+
*/
|
|
22
25
|
declare const useGetFiles: <TData = FilesGetResponse, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: {
|
|
23
26
|
query?: UseQueryOptions<FilesGetResponse, TError, TData, QueryKey> | undefined;
|
|
24
27
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -50,6 +53,9 @@ declare const getAttachFileMutationOptions: <TError = ErrorType<void | DmError>,
|
|
|
50
53
|
type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>;
|
|
51
54
|
type AttachFileMutationBody = FilePostBodyBody;
|
|
52
55
|
type AttachFileMutationError = ErrorType<void | DmError>;
|
|
56
|
+
/**
|
|
57
|
+
* @summary Attach a Dataset, as a File, to a Project
|
|
58
|
+
*/
|
|
53
59
|
declare const useAttachFile: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
|
|
54
60
|
mutation?: UseMutationOptions<FilePostResponse, TError, {
|
|
55
61
|
data: FilePostBodyBody;
|
|
@@ -59,12 +65,12 @@ declare const useAttachFile: <TError = ErrorType<void | DmError>, TContext = unk
|
|
|
59
65
|
data: FilePostBodyBody;
|
|
60
66
|
}, TContext>;
|
|
61
67
|
/**
|
|
62
|
-
|
|
68
|
+
* Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.
|
|
63
69
|
|
|
64
70
|
You must be an `editor` or the `owner` of the project to delete a file from a project.
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
* @summary Delete an unmanaged Project File
|
|
73
|
+
*/
|
|
68
74
|
declare const deleteUnmanagedFile: (params: DeleteUnmanagedFileParams, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
69
75
|
declare const getDeleteUnmanagedFileMutationOptions: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
70
76
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -76,6 +82,9 @@ declare const getDeleteUnmanagedFileMutationOptions: <TError = ErrorType<DmError
|
|
|
76
82
|
}, TContext>;
|
|
77
83
|
type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>;
|
|
78
84
|
type DeleteUnmanagedFileMutationError = ErrorType<DmError>;
|
|
85
|
+
/**
|
|
86
|
+
* @summary Delete an unmanaged Project File
|
|
87
|
+
*/
|
|
79
88
|
declare const useDeleteUnmanagedFile: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
80
89
|
mutation?: UseMutationOptions<void, TError, {
|
|
81
90
|
params: DeleteUnmanagedFileParams;
|
|
@@ -85,14 +94,14 @@ declare const useDeleteUnmanagedFile: <TError = ErrorType<DmError>, TContext = u
|
|
|
85
94
|
params: DeleteUnmanagedFileParams;
|
|
86
95
|
}, TContext>;
|
|
87
96
|
/**
|
|
88
|
-
|
|
97
|
+
* Given a `file_id` the file will be removed from the Project it's attached to.
|
|
89
98
|
|
|
90
99
|
You must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.
|
|
91
100
|
|
|
92
101
|
You cannot delete a Project File until the attach is complete.
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
* @summary Delete/detach a File (from a Project)
|
|
104
|
+
*/
|
|
96
105
|
declare const deleteFile: (fileId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
97
106
|
declare const getDeleteFileMutationOptions: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
98
107
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -104,6 +113,9 @@ declare const getDeleteFileMutationOptions: <TError = ErrorType<DmError>, TConte
|
|
|
104
113
|
}, TContext>;
|
|
105
114
|
type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>;
|
|
106
115
|
type DeleteFileMutationError = ErrorType<DmError>;
|
|
116
|
+
/**
|
|
117
|
+
* @summary Delete/detach a File (from a Project)
|
|
118
|
+
*/
|
|
107
119
|
declare const useDeleteFile: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
108
120
|
mutation?: UseMutationOptions<void, TError, {
|
|
109
121
|
fileId: string;
|
|
@@ -113,12 +125,12 @@ declare const useDeleteFile: <TError = ErrorType<DmError>, TContext = unknown>(o
|
|
|
113
125
|
fileId: string;
|
|
114
126
|
}, TContext>;
|
|
115
127
|
/**
|
|
116
|
-
|
|
128
|
+
* Given a `file_id` the file will be returned if available.
|
|
117
129
|
|
|
118
130
|
You cannot get a Project File until the attach is complete.
|
|
119
131
|
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
* @summary Download a File (from a project)
|
|
133
|
+
*/
|
|
122
134
|
declare const downloadFile: (fileId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<void>;
|
|
123
135
|
declare const getDownloadFileQueryKey: (fileId: string) => readonly ["data-manager-api", `/file/${string}`];
|
|
124
136
|
declare const getDownloadFileQueryOptions: <TData = void, TError = ErrorType<DmError>>(fileId: string, options?: {
|
|
@@ -129,6 +141,9 @@ declare const getDownloadFileQueryOptions: <TData = void, TError = ErrorType<DmE
|
|
|
129
141
|
};
|
|
130
142
|
type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>;
|
|
131
143
|
type DownloadFileQueryError = ErrorType<DmError>;
|
|
144
|
+
/**
|
|
145
|
+
* @summary Download a File (from a project)
|
|
146
|
+
*/
|
|
132
147
|
declare const useDownloadFile: <TData = void, TError = ErrorType<DmError>>(fileId: string, options?: {
|
|
133
148
|
query?: UseQueryOptions<void, TError, TData, QueryKey> | undefined;
|
|
134
149
|
request?: SecondParameter<typeof customInstance>;
|
package/file/file.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-UKA7G3OB.js";
|
|
4
4
|
|
|
5
5
|
// src/file/file.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useMutation,
|
|
8
|
+
useQuery
|
|
9
|
+
} from "@tanstack/react-query";
|
|
7
10
|
var getFiles = (params, options, signal) => {
|
|
8
11
|
return customInstance(
|
|
9
|
-
{
|
|
12
|
+
{
|
|
13
|
+
url: `/file`,
|
|
14
|
+
method: "get",
|
|
15
|
+
params,
|
|
16
|
+
signal
|
|
17
|
+
},
|
|
10
18
|
options
|
|
11
19
|
);
|
|
12
20
|
};
|
|
13
|
-
var getGetFilesQueryKey = (params) =>
|
|
21
|
+
var getGetFilesQueryKey = (params) => {
|
|
22
|
+
return ["data-manager-api", `/file`, ...params ? [params] : []];
|
|
23
|
+
};
|
|
14
24
|
var getGetFilesQueryOptions = (params, options) => {
|
|
15
25
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
26
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetFilesQueryKey(params);
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getFiles(params, requestOptions, signal);
|
|
27
|
+
const queryFn = ({ signal }) => getFiles(params, requestOptions, signal);
|
|
20
28
|
return { queryKey, queryFn, ...queryOptions };
|
|
21
29
|
};
|
|
22
30
|
var useGetFiles = (params, options) => {
|
|
@@ -28,10 +36,7 @@ var useGetFiles = (params, options) => {
|
|
|
28
36
|
var attachFile = (filePostBodyBody, options) => {
|
|
29
37
|
const formData = new FormData();
|
|
30
38
|
formData.append("dataset_id", filePostBodyBody.dataset_id);
|
|
31
|
-
formData.append(
|
|
32
|
-
"dataset_version",
|
|
33
|
-
filePostBodyBody.dataset_version.toString()
|
|
34
|
-
);
|
|
39
|
+
formData.append("dataset_version", filePostBodyBody.dataset_version.toString());
|
|
35
40
|
formData.append("project_id", filePostBodyBody.project_id);
|
|
36
41
|
formData.append("as_type", filePostBodyBody.as_type);
|
|
37
42
|
if (filePostBodyBody.path !== void 0) {
|
|
@@ -67,7 +72,11 @@ var useAttachFile = (options) => {
|
|
|
67
72
|
};
|
|
68
73
|
var deleteUnmanagedFile = (params, options) => {
|
|
69
74
|
return customInstance(
|
|
70
|
-
{
|
|
75
|
+
{
|
|
76
|
+
url: `/file`,
|
|
77
|
+
method: "delete",
|
|
78
|
+
params
|
|
79
|
+
},
|
|
71
80
|
options
|
|
72
81
|
);
|
|
73
82
|
};
|
|
@@ -85,7 +94,10 @@ var useDeleteUnmanagedFile = (options) => {
|
|
|
85
94
|
};
|
|
86
95
|
var deleteFile = (fileId, options) => {
|
|
87
96
|
return customInstance(
|
|
88
|
-
{
|
|
97
|
+
{
|
|
98
|
+
url: `/file/${fileId}`,
|
|
99
|
+
method: "delete"
|
|
100
|
+
},
|
|
89
101
|
options
|
|
90
102
|
);
|
|
91
103
|
};
|
|
@@ -103,17 +115,21 @@ var useDeleteFile = (options) => {
|
|
|
103
115
|
};
|
|
104
116
|
var downloadFile = (fileId, options, signal) => {
|
|
105
117
|
return customInstance(
|
|
106
|
-
{
|
|
118
|
+
{
|
|
119
|
+
url: `/file/${fileId}`,
|
|
120
|
+
method: "get",
|
|
121
|
+
signal
|
|
122
|
+
},
|
|
107
123
|
options
|
|
108
124
|
);
|
|
109
125
|
};
|
|
110
|
-
var getDownloadFileQueryKey = (fileId) =>
|
|
126
|
+
var getDownloadFileQueryKey = (fileId) => {
|
|
127
|
+
return ["data-manager-api", `/file/${fileId}`];
|
|
128
|
+
};
|
|
111
129
|
var getDownloadFileQueryOptions = (fileId, options) => {
|
|
112
130
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
113
131
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getDownloadFileQueryKey(fileId);
|
|
114
|
-
const queryFn = ({
|
|
115
|
-
signal
|
|
116
|
-
}) => downloadFile(fileId, requestOptions, signal);
|
|
132
|
+
const queryFn = ({ signal }) => downloadFile(fileId, requestOptions, signal);
|
|
117
133
|
return { queryKey, queryFn, enabled: !!fileId, ...queryOptions };
|
|
118
134
|
};
|
|
119
135
|
var useDownloadFile = (fileId, options) => {
|
package/file/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/file/file.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 1.2\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n FilesGetResponse,\n DmError,\n GetFilesParams,\n FilePostResponse,\n FilePostBodyBody,\n DeleteUnmanagedFileParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).\n\n * @summary Gets the Files on a Project Path\n */\nexport const getFiles = (\n params: GetFilesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<FilesGetResponse>(\n { url: `/file`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetFilesQueryKey = (params: GetFilesParams) =>\n [\"data-manager-api\", `/file`, ...(params ? [params] : [])] as const;\n\nexport const getGetFilesQueryOptions = <\n TData = Awaited<ReturnType<typeof getFiles>>,\n TError = ErrorType<void | DmError>\n>(\n params: GetFilesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getFiles>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({\n signal,\n }) => getFiles(params, requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetFilesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getFiles>>\n>;\nexport type GetFilesQueryError = ErrorType<void | DmError>;\n\nexport const useGetFiles = <\n TData = Awaited<ReturnType<typeof getFiles>>,\n TError = ErrorType<void | DmError>\n>(\n params: GetFilesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getFiles>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetFilesQueryOptions(params, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.\n\nOnly Datasets attached to projects are available through the Project API. A Dataset that you upload is only available to others (who are not already `editors` of the data) when the Dataset is attached to a project.\n\nAn `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.\n\nYou must be an `editor` or the `owner` of the project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.\n\nYou cannot add a Dataset to a Project until its upload is complete.\n\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const attachFile = (\n filePostBodyBody: FilePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"dataset_id\", filePostBodyBody.dataset_id);\n formData.append(\n \"dataset_version\",\n filePostBodyBody.dataset_version.toString()\n );\n formData.append(\"project_id\", filePostBodyBody.project_id);\n formData.append(\"as_type\", filePostBodyBody.as_type);\n if (filePostBodyBody.path !== undefined) {\n formData.append(\"path\", filePostBodyBody.path);\n }\n if (filePostBodyBody.compress !== undefined) {\n formData.append(\"compress\", filePostBodyBody.compress.toString());\n }\n if (filePostBodyBody.immutable !== undefined) {\n formData.append(\"immutable\", filePostBodyBody.immutable.toString());\n }\n\n return customInstance<FilePostResponse>(\n {\n url: `/file`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport const getAttachFileMutationOptions = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof attachFile>>,\n { data: FilePostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return attachFile(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AttachFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof attachFile>>\n>;\nexport type AttachFileMutationBody = FilePostBodyBody;\nexport type AttachFileMutationError = ErrorType<void | DmError>;\n\nexport const useAttachFile = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof attachFile>>,\n TError,\n { data: FilePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAttachFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a project.\n\n * @summary Delete an unmanaged Project File\n */\nexport const deleteUnmanagedFile = (\n params: DeleteUnmanagedFileParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/file`, method: \"delete\", params },\n options\n );\n};\n\nexport const getDeleteUnmanagedFileMutationOptions = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n { params: DeleteUnmanagedFileParams }\n > = (props) => {\n const { params } = props ?? {};\n\n return deleteUnmanagedFile(params, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteUnmanagedFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>\n>;\n\nexport type DeleteUnmanagedFileMutationError = ErrorType<DmError>;\n\nexport const useDeleteUnmanagedFile = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteUnmanagedFile>>,\n TError,\n { params: DeleteUnmanagedFileParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Given a `file_id` the file will be removed from the Project it's attached to.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.\n\nYou cannot delete a Project File until the attach is complete.\n\n * @summary Delete/detach a File (from a Project)\n */\nexport const deleteFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/file/${fileId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteFileMutationOptions = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteFile>>,\n { fileId: string }\n > = (props) => {\n const { fileId } = props ?? {};\n\n return deleteFile(fileId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteFileMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteFile>>\n>;\n\nexport type DeleteFileMutationError = ErrorType<DmError>;\n\nexport const useDeleteFile = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteFile>>,\n TError,\n { fileId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Given a `file_id` the file will be returned if available.\n\nYou cannot get a Project File until the attach is complete.\n\n * @summary Download a File (from a project)\n */\nexport const downloadFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<void>(\n { url: `/file/${fileId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getDownloadFileQueryKey = (fileId: string) =>\n [\"data-manager-api\", `/file/${fileId}`] as const;\n\nexport const getDownloadFileQueryOptions = <\n TData = Awaited<ReturnType<typeof downloadFile>>,\n TError = ErrorType<DmError>\n>(\n fileId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof downloadFile>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({\n signal,\n }) => downloadFile(fileId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!fileId, ...queryOptions };\n};\n\nexport type DownloadFileQueryResult = NonNullable<\n Awaited<ReturnType<typeof downloadFile>>\n>;\nexport type DownloadFileQueryError = ErrorType<DmError>;\n\nexport const useDownloadFile = <\n TData = Awaited<ReturnType<typeof downloadFile>>,\n TError = ErrorType<DmError>\n>(\n fileId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof downloadFile>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getDownloadFileQueryOptions(fileId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAiC/B,IAAM,WAAW,CACtB,QACA,SACA,WACG;AACH,SAAO;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,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,gBAAgB,CAG3B,YAQI;AACJ,QAAM,kBAAkB,6BAA6B,OAAO;AAE5D,SAAO,YAAY,eAAe;AACpC;AAQO,IAAM,eAAe,CAC1B,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,UAAU,QAAQ,OAAO,OAAO;AAAA,IAChD;AAAA,EACF;AACF;AAEO,IAAM,0BAA0B,CAAC,WACtC,CAAC,oBAAoB,SAAS,QAAQ;AAEjC,IAAM,8BAA8B,CAIzC,QACA,YAUG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,wBAAwB,MAAM;AAEzE,QAAM,UAAmE,CAAC;AAAA,IACxE;AAAA,EACF,MAAM,aAAa,QAAQ,gBAAgB,MAAM;AAEjD,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,QAAQ,GAAG,aAAa;AACjE;AAOO,IAAM,kBAAkB,CAI7B,QACA,YAQ2D;AAC3D,QAAM,eAAe,4BAA4B,QAAQ,OAAO;AAEhE,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/file/file.ts"],"sourcesContent":["/**\n * Generated by orval v6.20.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 1.2\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query'\nimport type {\n DeleteUnmanagedFileParams,\n DmError,\n FilePostBodyBody,\n FilePostResponse,\n FilesGetResponse,\n GetFilesParams\n} from '../data-manager-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n\n/**\n * Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).\n\n * @summary Gets the Files on a Project Path\n */\nexport const getFiles = (\n params: GetFilesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<FilesGetResponse>(\n {url: `/file`, method: 'get',\n params, signal\n },\n options);\n }\n \n\nexport const getGetFilesQueryKey = (params: GetFilesParams,) => {\n \n return [\"data-manager-api\", `/file`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetFilesQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) => getFiles(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>\nexport type GetFilesQueryError = ErrorType<void | DmError>\n\n/**\n * @summary Gets the Files on a Project Path\n */\nexport const useGetFiles = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(\n params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetFilesQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.\n\nOnly Datasets attached to projects are available through the Project API. A Dataset that you upload is only available to others (who are not already `editors` of the data) when the Dataset is attached to a project.\n\nAn `editor` of a **dataset** is not automatically and `editor` of the **project** it's attached to.\n\nYou must be an `editor` or the `owner` of the project to attach a Dataset to a project. Being an `editor` of the Dataset you are attaching does not give you the ability to detach it from the Project.\n\nYou cannot add a Dataset to a Project until its upload is complete.\n\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const attachFile = (\n filePostBodyBody: FilePostBodyBody,\n options?: SecondParameter<typeof customInstance>,) => {\n \n const formData = new FormData();\nformData.append('dataset_id', filePostBodyBody.dataset_id)\nformData.append('dataset_version', filePostBodyBody.dataset_version.toString())\nformData.append('project_id', filePostBodyBody.project_id)\nformData.append('as_type', filePostBodyBody.as_type)\nif(filePostBodyBody.path !== undefined) {\n formData.append('path', filePostBodyBody.path)\n }\nif(filePostBodyBody.compress !== undefined) {\n formData.append('compress', filePostBodyBody.compress.toString())\n }\nif(filePostBodyBody.immutable !== undefined) {\n formData.append('immutable', filePostBodyBody.immutable.toString())\n }\n\n return customInstance<FilePostResponse>(\n {url: `/file`, method: 'post',\n headers: {'Content-Type': 'multipart/form-data', },\n data: formData\n },\n options);\n }\n \n\n\nexport const getAttachFileMutationOptions = <TError = ErrorType<void | DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachFile>>, {data: FilePostBodyBody}> = (props) => {\n const {data} = props ?? {};\n\n return attachFile(data,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>\n export type AttachFileMutationBody = FilePostBodyBody\n export type AttachFileMutationError = ErrorType<void | DmError>\n\n /**\n * @summary Attach a Dataset, as a File, to a Project\n */\nexport const useAttachFile = <TError = ErrorType<void | DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAttachFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a project.\n\n * @summary Delete an unmanaged Project File\n */\nexport const deleteUnmanagedFile = (\n params: DeleteUnmanagedFileParams,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/file`, method: 'delete',\n params\n },\n options);\n }\n \n\n\nexport const getDeleteUnmanagedFileMutationOptions = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteUnmanagedFile>>, {params: DeleteUnmanagedFileParams}> = (props) => {\n const {params} = props ?? {};\n\n return deleteUnmanagedFile(params,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>\n \n export type DeleteUnmanagedFileMutationError = ErrorType<DmError>\n\n /**\n * @summary Delete an unmanaged Project File\n */\nexport const useDeleteUnmanagedFile = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Given a `file_id` the file will be removed from the Project it's attached to.\n\nYou must be an `editor` or the `owner` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.\n\nYou cannot delete a Project File until the attach is complete.\n\n * @summary Delete/detach a File (from a Project)\n */\nexport const deleteFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/file/${fileId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteFileMutationOptions = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteFile>>, {fileId: string}> = (props) => {\n const {fileId} = props ?? {};\n\n return deleteFile(fileId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>\n \n export type DeleteFileMutationError = ErrorType<DmError>\n\n /**\n * @summary Delete/detach a File (from a Project)\n */\nexport const useDeleteFile = <TError = ErrorType<DmError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteFileMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Given a `file_id` the file will be returned if available.\n\nYou cannot get a Project File until the attach is complete.\n\n * @summary Download a File (from a project)\n */\nexport const downloadFile = (\n fileId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<void>(\n {url: `/file/${fileId}`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getDownloadFileQueryKey = (fileId: string,) => {\n \n return [\"data-manager-api\", `/file/${fileId}`] as const;\n }\n\n \nexport const getDownloadFileQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) => downloadFile(fileId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(fileId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>\nexport type DownloadFileQueryError = ErrorType<DmError>\n\n/**\n * @summary Download a File (from a project)\n */\nexport const useDownloadFile = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(\n fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getDownloadFileQueryOptions(fileId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n"],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAmCA,IAAM,WAAW,CACpB,QACH,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAS,QAAQ;AAAA,MACrB;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,sBAAsB,CAAC,WAA4B;AAE5D,SAAO,CAAC,oBAAoB,SAAS,GAAI,SAAS,CAAC,MAAM,IAAG,CAAC,CAAE;AAC/D;AAGG,IAAM,0BAA0B,CAAmF,QAAwB,YAC7I;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,oBAAoB,MAAM;AAIpE,QAAM,UAA+D,CAAC,EAAE,OAAO,MAAM,SAAS,QAAQ,gBAAgB,MAAM;AAM7H,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAQO,IAAM,cAAc,CAC1B,QAAwB,YAEuC;AAE9D,QAAM,eAAe,wBAAwB,QAAO,OAAO;AAE3D,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAiBO,IAAM,aAAa,CACtB,kBACH,YAAsD;AAEjD,QAAM,WAAW,IAAI,SAAS;AACpC,WAAS,OAAO,cAAc,iBAAiB,UAAU;AACzD,WAAS,OAAO,mBAAmB,iBAAiB,gBAAgB,SAAS,CAAC;AAC9E,WAAS,OAAO,cAAc,iBAAiB,UAAU;AACzD,WAAS,OAAO,WAAW,iBAAiB,OAAO;AACnD,MAAG,iBAAiB,SAAS,QAAW;AACvC,aAAS,OAAO,QAAQ,iB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