@depup/uploadthing 7.7.4-depup.0
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/LICENSE +21 -0
- package/README.md +33 -0
- package/changes.json +18 -0
- package/client/index.cjs +331 -0
- package/client/index.d.cts +36 -0
- package/client/index.d.cts.map +1 -0
- package/client/index.d.ts +36 -0
- package/client/index.d.ts.map +1 -0
- package/client/index.js +286 -0
- package/client/index.js.map +1 -0
- package/client-future/index.cjs +426 -0
- package/client-future/index.d.cts +373 -0
- package/client-future/index.d.cts.map +1 -0
- package/client-future/index.d.ts +373 -0
- package/client-future/index.d.ts.map +1 -0
- package/client-future/index.js +383 -0
- package/client-future/index.js.map +1 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/deprecations-DPGpmqha.cjs +13 -0
- package/dist/deprecations-pLmw6Ytd.js +8 -0
- package/dist/deprecations-pLmw6Ytd.js.map +1 -0
- package/dist/package-BQ_k22T9.cjs +11 -0
- package/dist/package-DpScpvTA.js +6 -0
- package/dist/package-DpScpvTA.js.map +1 -0
- package/dist/shared-schemas-BmG5ARoX.js +82 -0
- package/dist/shared-schemas-BmG5ARoX.js.map +1 -0
- package/dist/shared-schemas-CG9VaBtT.cjs +129 -0
- package/dist/to-web-request-BQtxSXgE.cjs +98 -0
- package/dist/to-web-request-DhP0wXG-.js +87 -0
- package/dist/to-web-request-DhP0wXG-.js.map +1 -0
- package/dist/types-Bs3w2d_3.d.ts +627 -0
- package/dist/types-Bs3w2d_3.d.ts.map +1 -0
- package/dist/types-DiVC1t2V.d.cts +625 -0
- package/dist/types-DiVC1t2V.d.cts.map +1 -0
- package/dist/upload-builder-BUa7tovh.d.cts +32 -0
- package/dist/upload-builder-BUa7tovh.d.cts.map +1 -0
- package/dist/upload-builder-BcFawEj0.d.ts +32 -0
- package/dist/upload-builder-BcFawEj0.d.ts.map +1 -0
- package/dist/upload-builder-BlFOAnsv.js +699 -0
- package/dist/upload-builder-BlFOAnsv.js.map +1 -0
- package/dist/upload-builder-D6Ken9H0.cjs +794 -0
- package/dist/ut-reporter-BHoyNnzW.cjs +120 -0
- package/dist/ut-reporter-Dlppchbx.js +103 -0
- package/dist/ut-reporter-Dlppchbx.js.map +1 -0
- package/effect-platform/index.cjs +22 -0
- package/effect-platform/index.d.cts +54 -0
- package/effect-platform/index.d.cts.map +1 -0
- package/effect-platform/index.d.ts +54 -0
- package/effect-platform/index.d.ts.map +1 -0
- package/effect-platform/index.js +19 -0
- package/effect-platform/index.js.map +1 -0
- package/express/index.cjs +30 -0
- package/express/index.d.cts +28 -0
- package/express/index.d.cts.map +1 -0
- package/express/index.d.ts +28 -0
- package/express/index.d.ts.map +1 -0
- package/express/index.js +27 -0
- package/express/index.js.map +1 -0
- package/fastify/index.cjs +27 -0
- package/fastify/index.d.cts +28 -0
- package/fastify/index.d.cts.map +1 -0
- package/fastify/index.d.ts +28 -0
- package/fastify/index.d.ts.map +1 -0
- package/fastify/index.js +24 -0
- package/fastify/index.js.map +1 -0
- package/h3/index.cjs +20 -0
- package/h3/index.d.cts +28 -0
- package/h3/index.d.cts.map +1 -0
- package/h3/index.d.ts +28 -0
- package/h3/index.d.ts.map +1 -0
- package/h3/index.js +17 -0
- package/h3/index.js.map +1 -0
- package/next/index.cjs +22 -0
- package/next/index.d.cts +30 -0
- package/next/index.d.cts.map +1 -0
- package/next/index.d.ts +30 -0
- package/next/index.d.ts.map +1 -0
- package/next/index.js +19 -0
- package/next/index.js.map +1 -0
- package/next-legacy/index.cjs +28 -0
- package/next-legacy/index.d.cts +28 -0
- package/next-legacy/index.d.cts.map +1 -0
- package/next-legacy/index.d.ts +28 -0
- package/next-legacy/index.d.ts.map +1 -0
- package/next-legacy/index.js +25 -0
- package/next-legacy/index.js.map +1 -0
- package/package.json +210 -0
- package/remix/index.cjs +22 -0
- package/remix/index.d.cts +30 -0
- package/remix/index.d.cts.map +1 -0
- package/remix/index.d.ts +30 -0
- package/remix/index.d.ts.map +1 -0
- package/remix/index.js +19 -0
- package/remix/index.js.map +1 -0
- package/server/index.cjs +414 -0
- package/server/index.d.cts +211 -0
- package/server/index.d.cts.map +1 -0
- package/server/index.d.ts +213 -0
- package/server/index.d.ts.map +1 -0
- package/server/index.js +405 -0
- package/server/index.js.map +1 -0
- package/tw/index.cjs +70 -0
- package/tw/index.d.cts +29 -0
- package/tw/index.d.cts.map +1 -0
- package/tw/index.d.ts +29 -0
- package/tw/index.d.ts.map +1 -0
- package/tw/index.js +74 -0
- package/tw/index.js.map +1 -0
- package/tw/v4.css +11 -0
- package/types/index.cjs +3 -0
- package/types/index.d.cts +2 -0
- package/types/index.d.ts +2 -0
- package/types/index.js +3 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { AnyFileRoute, EndpointArg, FileRouter, GenerateUploaderOptions, NewPresignedUrl, RouteRegistry } from "../dist/types-DiVC1t2V.cjs";
|
|
2
|
+
import * as effect_Types0 from "effect/Types";
|
|
3
|
+
import { LazyArg } from "effect/Function";
|
|
4
|
+
import * as Micro from "effect/Micro";
|
|
5
|
+
import { FetchContext, FetchError, MaybePromise, UploadAbortedError, UploadAbortedError as UploadAbortedError$1, UploadPausedError, generateClientDropzoneAccept, generateMimeTypes, generatePermittedFileTypes } from "@uploadthing/shared";
|
|
6
|
+
|
|
7
|
+
//#region src/_internal/random-hex.d.ts
|
|
8
|
+
type TraceHeaders = {
|
|
9
|
+
b3: string;
|
|
10
|
+
traceparent: string;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/_internal/client-future.d.ts
|
|
14
|
+
declare const XHRError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => Micro.YieldableError & {
|
|
15
|
+
readonly _tag: "XHRError";
|
|
16
|
+
} & Readonly<A>;
|
|
17
|
+
/**
|
|
18
|
+
* Error indicating the XHR request failed
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
declare class XHRError extends XHRError_base<{
|
|
22
|
+
message: string;
|
|
23
|
+
xhr: unknown;
|
|
24
|
+
}> {}
|
|
25
|
+
/**
|
|
26
|
+
* Error indicating the network request failed
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
type NetworkError = XHRError | FetchError;
|
|
30
|
+
declare const UTStorageError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => Micro.YieldableError & {
|
|
31
|
+
readonly _tag: "UTStorageError";
|
|
32
|
+
} & Readonly<A>;
|
|
33
|
+
/**
|
|
34
|
+
* Error indicating the upload was rejected during upload to the storage provider
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
declare class UTStorageError extends UTStorageError_base<{
|
|
38
|
+
message: string;
|
|
39
|
+
response: unknown;
|
|
40
|
+
}> {}
|
|
41
|
+
declare const UTServerError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => Micro.YieldableError & {
|
|
42
|
+
readonly _tag: "UTServerError";
|
|
43
|
+
} & Readonly<A>;
|
|
44
|
+
/**
|
|
45
|
+
* Error indicating the request to your UploadThing server failed
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
declare class UTServerError<TErrorShape> extends UTServerError_base<{
|
|
49
|
+
message: string;
|
|
50
|
+
cause: unknown;
|
|
51
|
+
/**
|
|
52
|
+
* Matches the shape returned by your error formatter
|
|
53
|
+
*/
|
|
54
|
+
data: TErrorShape;
|
|
55
|
+
}> {}
|
|
56
|
+
/**
|
|
57
|
+
* Error indicating the upload failed
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
type UploadThingClientError<TErrorShape> = UploadAbortedError$1 | NetworkError | UTStorageError | UTServerError<TErrorShape>;
|
|
61
|
+
/**
|
|
62
|
+
* A file that has not started uploading yet.
|
|
63
|
+
* Can either be pending for the presigned request to resolve,
|
|
64
|
+
* or pending for the browser to schedule the network request.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
interface PendingFile extends File {
|
|
68
|
+
status: "pending";
|
|
69
|
+
/**
|
|
70
|
+
* How many bytes of the file has been uploaded
|
|
71
|
+
* @example 0
|
|
72
|
+
*/
|
|
73
|
+
sent: number;
|
|
74
|
+
/**
|
|
75
|
+
* The key of the file. Null before the presigned request resolves.
|
|
76
|
+
*/
|
|
77
|
+
key: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* The customId of the file. Null before the presigned request resolves, then present if your file route sets it
|
|
80
|
+
*/
|
|
81
|
+
customId: string | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A file that is currently uploading.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
interface UploadingFile extends File {
|
|
88
|
+
status: "uploading";
|
|
89
|
+
/**
|
|
90
|
+
* How many bytes of the file has been uploaded
|
|
91
|
+
* @example 2500
|
|
92
|
+
*/
|
|
93
|
+
sent: number;
|
|
94
|
+
/**
|
|
95
|
+
* The key of the file.
|
|
96
|
+
*/
|
|
97
|
+
key: string;
|
|
98
|
+
/**
|
|
99
|
+
* The customId of the file, if your file route sets it
|
|
100
|
+
*/
|
|
101
|
+
customId: string | null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A file that failed to upload.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
interface FailedFile<TRoute extends AnyFileRoute> extends File {
|
|
108
|
+
status: "failed";
|
|
109
|
+
/**
|
|
110
|
+
* How many bytes of the file were uploaded before the upload failed.
|
|
111
|
+
* @example 2500
|
|
112
|
+
*/
|
|
113
|
+
sent: number;
|
|
114
|
+
/**
|
|
115
|
+
* The key of the file.
|
|
116
|
+
*/
|
|
117
|
+
key: string;
|
|
118
|
+
/**
|
|
119
|
+
* The customId of the file, if your file route sets it
|
|
120
|
+
*/
|
|
121
|
+
customId: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* The error that occurred during the upload.
|
|
124
|
+
*/
|
|
125
|
+
reason: UploadThingClientError<TRoute["$types"]["errorShape"]>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A file that has been uploaded successfully.
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
interface UploadedFile<TRoute extends AnyFileRoute> extends File {
|
|
132
|
+
status: "uploaded";
|
|
133
|
+
/**
|
|
134
|
+
* How many bytes of the file has been uploaded.
|
|
135
|
+
* @example 10000
|
|
136
|
+
*/
|
|
137
|
+
sent: number;
|
|
138
|
+
/**
|
|
139
|
+
* The key of the file.
|
|
140
|
+
*/
|
|
141
|
+
key: string;
|
|
142
|
+
/**
|
|
143
|
+
* The customId of the file, if your file route sets it
|
|
144
|
+
*/
|
|
145
|
+
customId: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* The url of the file.
|
|
148
|
+
* @example "https://APP_ID.ufs.sh/f/KEY"
|
|
149
|
+
*/
|
|
150
|
+
url: string;
|
|
151
|
+
/**
|
|
152
|
+
* The data returned by the serverside `onUploadComplete` callback.
|
|
153
|
+
* @example { uploadedBy: "user_123" }
|
|
154
|
+
*/
|
|
155
|
+
data: TRoute["$types"]["output"];
|
|
156
|
+
/**
|
|
157
|
+
* The hash ( <> checksum ) of the file.
|
|
158
|
+
*/
|
|
159
|
+
hash: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A web file with additional state properties
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
type AnyFile<TFileRoute extends AnyFileRoute> = PendingFile | UploadingFile | FailedFile<TFileRoute> | UploadedFile<TFileRoute>;
|
|
166
|
+
/**
|
|
167
|
+
* Predicate function to check if a file is pending
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
declare function isPendingFile<TRoute extends AnyFileRoute = AnyFileRoute>(file: AnyFile<TRoute>): file is PendingFile;
|
|
171
|
+
/**
|
|
172
|
+
* Predicate function to check if a file is uploading
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
|
+
declare function isUploadingFile<TRoute extends AnyFileRoute = AnyFileRoute>(file: AnyFile<TRoute>): file is UploadingFile;
|
|
176
|
+
/**
|
|
177
|
+
* Predicate function to check if a file is failed
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
declare function isFailedFile<TRoute extends AnyFileRoute = AnyFileRoute>(file: AnyFile<TRoute>): file is FailedFile<TRoute>;
|
|
181
|
+
/**
|
|
182
|
+
* Predicate function to check if a file is uploaded
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
declare function isUploadedFile<TRoute extends AnyFileRoute = AnyFileRoute>(file: AnyFile<TRoute>): file is UploadedFile<TRoute>;
|
|
186
|
+
/**
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
declare function makePendingFile(file: File): PendingFile;
|
|
190
|
+
/**
|
|
191
|
+
* Modifies a pending or uploading file to a failed file in place
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
declare function transitionToFailed<TRoute extends AnyFileRoute>(file: PendingFile | UploadingFile, reason: UploadThingClientError<TRoute["$types"]["errorShape"]>): FailedFile<TRoute>;
|
|
195
|
+
/**
|
|
196
|
+
* Event emitted when the presigned URLs have been retrieved from your server
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
interface PresignedReceivedEvent<TRoute extends AnyFileRoute> {
|
|
200
|
+
type: "presigned-received";
|
|
201
|
+
/**
|
|
202
|
+
* All files that are being uploaded as part of this action.
|
|
203
|
+
*/
|
|
204
|
+
files: AnyFile<TRoute>[];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Event emitted when a file starts uploading
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
interface UploadStartedEvent<TRoute extends AnyFileRoute> {
|
|
211
|
+
type: "upload-started";
|
|
212
|
+
/**
|
|
213
|
+
* The file that started uploading.
|
|
214
|
+
*/
|
|
215
|
+
file: UploadingFile;
|
|
216
|
+
/**
|
|
217
|
+
* All files that are being uploaded as part of this action.
|
|
218
|
+
*/
|
|
219
|
+
files: AnyFile<TRoute>[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Event emitted when a file is uploading and received a progress update
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
interface UploadProgressEvent<TRoute extends AnyFileRoute> {
|
|
226
|
+
type: "upload-progress";
|
|
227
|
+
/**
|
|
228
|
+
* The file that is currently uploading and received a progress update.
|
|
229
|
+
*/
|
|
230
|
+
file: UploadingFile;
|
|
231
|
+
/**
|
|
232
|
+
* All files that are being uploaded as part of this action.
|
|
233
|
+
*/
|
|
234
|
+
files: AnyFile<TRoute>[];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Event emitted when a file has finished uploading
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
interface UploadCompletedEvent<TRoute extends AnyFileRoute> {
|
|
241
|
+
type: "upload-completed";
|
|
242
|
+
/**
|
|
243
|
+
* The file that finished uploading.
|
|
244
|
+
*/
|
|
245
|
+
file: UploadedFile<TRoute>;
|
|
246
|
+
/**
|
|
247
|
+
* All files that are being uploaded as part of this action.
|
|
248
|
+
*/
|
|
249
|
+
files: AnyFile<TRoute>[];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Event emitted when a file failed to upload
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
interface UploadFailedEvent<TRoute extends AnyFileRoute> {
|
|
256
|
+
type: "upload-failed";
|
|
257
|
+
/**
|
|
258
|
+
* The file that failed to upload.
|
|
259
|
+
*/
|
|
260
|
+
file: FailedFile<TRoute>;
|
|
261
|
+
/**
|
|
262
|
+
* All files that are being uploaded as part of this action.
|
|
263
|
+
*/
|
|
264
|
+
files: AnyFile<TRoute>[];
|
|
265
|
+
}
|
|
266
|
+
interface UploadAbortedEvent<TRoute extends AnyFileRoute> {
|
|
267
|
+
type: "upload-aborted";
|
|
268
|
+
files: AnyFile<TRoute>[];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Event emitted throughout the upload process
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
type UploadEvent<TRoute extends AnyFileRoute> = PresignedReceivedEvent<TRoute> | UploadStartedEvent<TRoute> | UploadProgressEvent<TRoute> | UploadCompletedEvent<TRoute> | UploadFailedEvent<TRoute> | UploadAbortedEvent<TRoute>;
|
|
275
|
+
interface UploadFileOptions<TRoute extends AnyFileRoute> {
|
|
276
|
+
file: PendingFile;
|
|
277
|
+
files: AnyFile<TRoute>[];
|
|
278
|
+
input: TRoute["$types"]["input"];
|
|
279
|
+
onEvent: (event: UploadEvent<TRoute>) => void;
|
|
280
|
+
traceHeaders: TraceHeaders;
|
|
281
|
+
XHRImpl: new () => XMLHttpRequest;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Upload a file to the storage provider
|
|
285
|
+
* Throughout the upload, the file's status and progress will be updated
|
|
286
|
+
* @remarks This function never rejects
|
|
287
|
+
* @internal
|
|
288
|
+
*/
|
|
289
|
+
declare function uploadFile<TRoute extends AnyFileRoute>(url: string, {
|
|
290
|
+
file,
|
|
291
|
+
files,
|
|
292
|
+
XHRImpl,
|
|
293
|
+
...options
|
|
294
|
+
}: UploadFileOptions<TRoute>): Micro.Micro<UploadedFile<TRoute> | FailedFile<TRoute>, never, FetchContext>;
|
|
295
|
+
interface RequestPresignedUrlsOptions<TRouter extends FileRouter, TEndpoint extends keyof TRouter> {
|
|
296
|
+
/**
|
|
297
|
+
* The URL to your UploadThing server endpoint
|
|
298
|
+
* @example URL { https://www.example.com/api/uploadthing }
|
|
299
|
+
*/
|
|
300
|
+
url: URL;
|
|
301
|
+
/**
|
|
302
|
+
* The slug to your UploadThing FileRoute
|
|
303
|
+
* @example "imageUploader"
|
|
304
|
+
*/
|
|
305
|
+
endpoint: TEndpoint;
|
|
306
|
+
/**
|
|
307
|
+
* The files to request presigned URLs for
|
|
308
|
+
*/
|
|
309
|
+
files: File[];
|
|
310
|
+
/**
|
|
311
|
+
* The route input for the endpoint
|
|
312
|
+
*/
|
|
313
|
+
input?: TRouter[TEndpoint]["$types"]["input"];
|
|
314
|
+
/**
|
|
315
|
+
* Custom headers to send with the request
|
|
316
|
+
* @example { Authorization: "Bearer 123" }
|
|
317
|
+
*/
|
|
318
|
+
headers?: HeadersInit | LazyArg<MaybePromise<HeadersInit>> | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Custom trace headers to send with the request
|
|
321
|
+
*/
|
|
322
|
+
traceHeaders: TraceHeaders;
|
|
323
|
+
/**
|
|
324
|
+
* The uploadthing package that is making this request, used to identify the client in the server logs
|
|
325
|
+
* @example "@uploadthing/react"
|
|
326
|
+
*/
|
|
327
|
+
package?: string | undefined;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Request presigned URLs from your server for a set of files
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
declare function requestPresignedUrls<TRouter extends FileRouter, TEndpoint extends keyof TRouter>(options: RequestPresignedUrlsOptions<TRouter, TEndpoint>): Micro.Micro<ReadonlyArray<NewPresignedUrl>, UTServerError<TRouter[TEndpoint]["$types"]["errorShape"]>, FetchContext>;
|
|
334
|
+
interface UploadFilesOptions<TRoute extends AnyFileRoute> {
|
|
335
|
+
url: URL;
|
|
336
|
+
files: File[];
|
|
337
|
+
input?: TRoute["$types"]["input"];
|
|
338
|
+
onEvent: (event: UploadEvent<TRoute>) => void;
|
|
339
|
+
headers?: HeadersInit | LazyArg<MaybePromise<HeadersInit>> | undefined;
|
|
340
|
+
package?: string | undefined;
|
|
341
|
+
signal?: AbortSignal | undefined;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Upload a set of files to the storage provider
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
declare function uploadFiles<TRouter extends FileRouter, TEndpoint extends keyof TRouter>(endpoint: TEndpoint, options: UploadFilesOptions<TRouter[TEndpoint]>): Micro.Micro<(FailedFile<TRouter[TEndpoint]> | UploadedFile<TRouter[TEndpoint]>)[], UTServerError<TRouter[TEndpoint]["$types"]["errorShape"]>, FetchContext>;
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/client-future.d.ts
|
|
350
|
+
declare const version: string;
|
|
351
|
+
/**
|
|
352
|
+
* Generate a typed uploader for a given FileRouter
|
|
353
|
+
* @public
|
|
354
|
+
* @remarks This API is not covered by semver
|
|
355
|
+
*/
|
|
356
|
+
declare const future_genUploader: <TRouter extends FileRouter>(initOpts?: GenerateUploaderOptions) => {
|
|
357
|
+
uploadFiles: <TEndpoint extends keyof TRouter>(slug: EndpointArg<TRouter, TEndpoint>, opts: Omit<UploadFilesOptions<TRouter[TEndpoint]>, keyof GenerateUploaderOptions>) => Promise<(FailedFile<TRouter[TEndpoint]> | UploadedFile<TRouter[TEndpoint]>)[]>;
|
|
358
|
+
createUpload: <TEndpoint extends keyof TRouter>(slug: EndpointArg<TRouter, TEndpoint>, options: Omit<UploadFilesOptions<TRouter[TEndpoint]>, keyof GenerateUploaderOptions>) => Promise<{
|
|
359
|
+
pauseUpload: (file?: File) => void;
|
|
360
|
+
abortUpload: (file?: File) => void;
|
|
361
|
+
resumeUpload: (file?: File) => void;
|
|
362
|
+
done: <T extends AnyFile<TRouter[TEndpoint]> | void = void>(file?: T) => Promise<T extends AnyFile<TRouter[TEndpoint]> ? UploadedFile<TRouter[TEndpoint]> | FailedFile<TRouter[TEndpoint]> : (UploadedFile<TRouter[TEndpoint]> | FailedFile<TRouter[TEndpoint]>)[]>;
|
|
363
|
+
}>;
|
|
364
|
+
/**
|
|
365
|
+
* Identity object that can be used instead of raw strings
|
|
366
|
+
* that allows "Go to definition" in your IDE to bring you
|
|
367
|
+
* to the backend definition of a route.
|
|
368
|
+
*/
|
|
369
|
+
routeRegistry: RouteRegistry<TRouter>;
|
|
370
|
+
};
|
|
371
|
+
//#endregion
|
|
372
|
+
export { AnyFile, FailedFile, NetworkError, PendingFile, PresignedReceivedEvent, RequestPresignedUrlsOptions, UTServerError, UTStorageError, UploadAbortedError, UploadAbortedEvent, UploadCompletedEvent, UploadEvent, UploadFailedEvent, UploadFileOptions, UploadFilesOptions, UploadPausedError, UploadProgressEvent, UploadStartedEvent, UploadThingClientError, UploadedFile, UploadingFile, XHRError, future_genUploader, generateClientDropzoneAccept, generateMimeTypes, generatePermittedFileTypes, isFailedFile, isPendingFile, isUploadedFile, isUploadingFile, makePendingFile, requestPresignedUrls, transitionToFailed, uploadFile, uploadFiles, version };
|
|
373
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/_internal/random-hex.ts","../src/_internal/client-future.ts","../src/client-future.ts"],"sourcesContent":[],"mappings":";;;;;;;KAYY,YAAA;;;;;;cCOqC;;ADPjD,CAAA,WAAY,EAAA,CAAA;;;;ACOqC;cASpC,QAAA,SAAiB;;;;;;;;KASlB,YAAA,GAAe,WAAW;cAAW;;;AATjD;AASA;;;AAAsC,cAMzB,cAAA,SAAuB,mBANE,CAAA;EAAU,OAAA,EAAA,MAAA;EAAC,QAAA,EAAA,OAAA;;cAS5C;;;;;;;cAMQ,mCAAmC;;;;AAThD;AAGK;QAcG;;;;;;KAOI,sCACR,uBACA,eACA,iBACA,cAAc;;;;;;AAnBlB;AAA0B,UA2BT,WAAA,SAAoB,IA3BX,CAAA;EAAA,MAQlB,EAAA,SAAA;EAAW;AAR6B;AAehD;;EAAkC,IAC9B,EAAA,MAAA;EAAkB;;;EAGO,GAAzB,EAAA,MAAA,GAAA,IAAA;EAAa;AAQjB;AAqBA;EAqBiB,QAAA,EAAA,MAAU,GAAA,IAAA;;;;;;AAA0C,UArBpD,aAAA,SAAsB,IAqB8B,CAAA;EAyBpD,MAAA,EAAA,WAAY;EAAA;;;;EAA0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