@visulima/storage 1.0.9 → 1.0.11
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/CHANGELOG.md +17 -0
- package/dist/adapter/nuxt/module.d.ts +9 -8
- package/dist/ai/ai-sdk/index.d.ts +52 -59
- package/dist/ai/claude/index.d.ts +105 -119
- package/dist/ai/openai/index.d.ts +87 -99
- package/dist/ai/tanstack/index.d.ts +54 -61
- package/dist/handler/http/fetch/index.d.ts +202 -201
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +60 -59
- package/dist/handler/http/hono/index.js +1 -1
- package/dist/handler/http/nextjs/index.d.ts +55 -54
- package/dist/handler/http/nextjs/index.js +1 -1
- package/dist/handler/http/node/index.d.ts +234 -246
- package/dist/handler/http/node/index.js +1 -1
- package/dist/handler/http/solid-start/index.d.ts +55 -54
- package/dist/handler/http/solid-start/index.js +1 -1
- package/dist/index.d.ts +71 -70
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AbstractBaseStorage-CiPEMcuo.js → AbstractBaseStorage-CLsYmMZg.js} +1 -1
- package/dist/packem_shared/AwsLightStorage-DGSPFUqr.js +1 -0
- package/dist/packem_shared/AzureStorage-DvKk_hhz.js +1 -0
- package/dist/packem_shared/BoxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BoxStorage-DbGqBLux.js → BoxStorage-CmM95wi2.js} +1 -1
- package/dist/packem_shared/BunS3MetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunS3Storage-DNvimm9e.js → BunS3Storage-B_roVJ29.js} +1 -1
- package/dist/packem_shared/BunnyMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunnyStorage-C7d0opLL.js → BunnyStorage-eZ1QDVaY.js} +1 -1
- package/dist/packem_shared/CloudinaryMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{CloudinaryStorage-Dc3XA2lP.js → CloudinaryStorage-CpH2f0Fv.js} +1 -1
- package/dist/packem_shared/DiskStorage-DzjjqCzo.js +1 -0
- package/dist/packem_shared/{DiskStorageWithChecksum-vFCubS6K.js → DiskStorageWithChecksum-MZkDEyts.js} +1 -1
- package/dist/packem_shared/DropboxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{DropboxStorage-CY9Ggu3m.js → DropboxStorage-BB9NoWK2.js} +1 -1
- package/dist/packem_shared/{Files-CpIcMjP0.js → Files-DyMJ9FPN.js} +1 -1
- package/dist/packem_shared/FirebaseMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{FirebaseStorage-D6O9CJXN.js → FirebaseStorage-BgbxzYNC.js} +1 -1
- package/dist/packem_shared/FtpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{FtpStorage-DbEjbq8z.js → FtpStorage-CNqXDz7P.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-DT8K6zdm.js → GCSMetaStorage-gEhWlpfS.js} +1 -1
- package/dist/packem_shared/{GCStorage-6BHkFlEs.js → GCStorage-CRd5vjok.js} +1 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{GoogleDriveStorage-Bklsz7Bh.js → GoogleDriveStorage-Du7uBhSm.js} +1 -1
- package/dist/packem_shared/{LocalMetaStorage-BhicZnNl.js → LocalMetaStorage-CcGfFG39.js} +1 -1
- package/dist/packem_shared/{MemoryStorage-9gbWd09l.js → MemoryStorage-ChKyI6OY.js} +1 -1
- package/dist/packem_shared/{Multipart-D0ok6BBy.js → Multipart-C35TR2qL.js} +1 -1
- package/dist/packem_shared/{Multipart-CQjYqU--.js → Multipart-V64Bg5dt.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-CZsr_0DF.js +1 -0
- package/dist/packem_shared/OneDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{OneDriveStorage-CP6MvGAa.js → OneDriveStorage-B8qFgMq1.js} +1 -1
- package/dist/packem_shared/PocketBaseMetaStorage-Cm3v8g1-.js +1 -0
- package/dist/packem_shared/{PocketBaseStorage-2qhbI2PW.js → PocketBaseStorage-D2vMN-oY.js} +1 -1
- package/dist/packem_shared/{Rest-CI_BiZPv.js → Rest-B7g1sgkq.js} +1 -1
- package/dist/packem_shared/{Rest-DvfN4-kf.js → Rest-BrEMYgxZ.js} +1 -1
- package/dist/packem_shared/{S3Storage-YGeNk3Tt.js → S3Storage-CTe_BMDl.js} +1 -1
- package/dist/packem_shared/SftpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SftpStorage-2Hz396Xr.js → SftpStorage-BKeAzuej.js} +1 -1
- package/dist/packem_shared/SharePointMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SharePointStorage-CrX2Pk6C.js → SharePointStorage-Dtnt5-wk.js} +1 -1
- package/dist/packem_shared/SupabaseMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{SupabaseStorage-Dc_DBX29.js → SupabaseStorage-CmGQjqXf.js} +1 -1
- package/dist/packem_shared/{Tus-BlBZykIL.js → Tus-CJBgnJrn.js} +1 -1
- package/dist/packem_shared/{Tus-BBVt2ky3.js → Tus-D9c7KDnl.js} +1 -1
- package/dist/packem_shared/UploadThingMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{UploadThingStorage-BChykYSe.js → UploadThingStorage-DZ4zNvDH.js} +1 -1
- package/dist/packem_shared/VercelBlobMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{VercelBlobStorage-CsRyPfw3.js → VercelBlobStorage-DDNEofR3.js} +1 -1
- package/dist/packem_shared/{approval.d-CMAYH9GF.d.ts → approval.d-C-d-t94D.d.ts} +6 -6
- package/dist/packem_shared/{base-handler-core-D-9Ku1h-.js → base-handler-core-BJP9jHCE.js} +1 -1
- package/dist/packem_shared/{base-handler-fetch-CfkNakv8.js → base-handler-fetch-yrYrukwL.js} +1 -1
- package/dist/packem_shared/base-handler-node-C8P9rkaH.js +1 -0
- package/dist/packem_shared/{createRetryWrapper-CxgiV_hH.js → createRetryWrapper-DgmeHPNF.js} +1 -1
- package/dist/packem_shared/disk-storage-DqnnFQAQ.js +1 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-Dgwyza8a.d.ts +146 -0
- package/dist/packem_shared/{executors.d-BZP2rWo3.d.ts → executors.d-B9dIy3NT.d.ts} +3 -2
- package/dist/packem_shared/files.d-CmSZi3M0.d.ts +655 -0
- package/dist/packem_shared/gcs-meta-storage-C9F78Sqq.js +1 -0
- package/dist/packem_shared/local-meta-storage-BELb1YwO.js +11 -0
- package/dist/packem_shared/{local-meta-storage.d-D9PBfkn6.d.ts → local-meta-storage.d-cRTXr1kb.d.ts} +7 -7
- package/dist/packem_shared/media-transformer.d-C8tn4J2Z.d.ts +331 -0
- package/dist/packem_shared/{memory-storage.d-4EU1cMt1.d.ts → memory-storage.d-BNZvDG1b.d.ts} +32 -40
- package/dist/packem_shared/path-C-OWflAo-_mqb5p5d.js +1 -0
- package/dist/packem_shared/{rest-base-e0reNDE_.js → rest-base-BQ_dhWyV.js} +1 -1
- package/dist/packem_shared/s3-base-storage-CX94H-Za.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-BQgP5B-t.d.ts → s3-base-storage.d-ks99NSs-.d.ts} +64 -70
- package/dist/packem_shared/storage-DR7qdwBN.js +1 -0
- package/dist/packem_shared/storage.d-DwdJrArF.d.ts +1186 -0
- package/dist/packem_shared/tus-base.d-BKBoJVy0.d.ts +103 -0
- package/dist/packem_shared/types.d-B1_xZIhu.d.ts +104 -0
- package/dist/packem_shared/{types.d-CrUWY4On.d.ts → types.d-BEUv414z.d.ts} +134 -134
- package/dist/packem_shared/{types.d-CggTCgXr.d.ts → types.d-D7Zlz5RE.d.ts} +3 -3
- package/dist/storage/aws/clients/index.d.ts +388 -388
- package/dist/storage/aws/index.d.ts +110 -113
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +64 -67
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +134 -139
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +89 -92
- package/dist/storage/box/index.js +1 -1
- package/dist/storage/bun-s3/index.d.ts +71 -76
- package/dist/storage/bun-s3/index.js +1 -1
- package/dist/storage/bunny/index.d.ts +52 -55
- package/dist/storage/bunny/index.js +1 -1
- package/dist/storage/cloudinary/index.d.ts +54 -59
- package/dist/storage/cloudinary/index.js +1 -1
- package/dist/storage/dropbox/index.d.ts +59 -62
- package/dist/storage/dropbox/index.js +1 -1
- package/dist/storage/firebase/index.d.ts +74 -79
- package/dist/storage/firebase/index.js +1 -1
- package/dist/storage/ftp/index.d.ts +38 -43
- package/dist/storage/ftp/index.js +1 -1
- package/dist/storage/gcs/index.d.ts +90 -95
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +69 -72
- package/dist/storage/google-drive/index.js +1 -1
- package/dist/storage/local/index.d.ts +4 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/memory/index.d.ts +3 -2
- package/dist/storage/memory/index.js +1 -1
- package/dist/storage/netlify-blob/index.d.ts +86 -93
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +44 -53
- package/dist/storage/onedrive/index.js +1 -1
- package/dist/storage/pocketbase/index.d.ts +67 -72
- package/dist/storage/pocketbase/index.js +1 -1
- package/dist/storage/sftp/index.d.ts +40 -45
- package/dist/storage/sftp/index.js +1 -1
- package/dist/storage/sharepoint/index.d.ts +96 -95
- package/dist/storage/sharepoint/index.js +1 -1
- package/dist/storage/supabase/index.d.ts +50 -55
- package/dist/storage/supabase/index.js +1 -1
- package/dist/storage/uploadthing/index.d.ts +34 -37
- package/dist/storage/uploadthing/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +110 -115
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +97 -96
- package/dist/transformer/image-transformer.d.ts +423 -422
- package/dist/transformer/index.d.ts +35 -34
- package/dist/transformer/video-transformer.d.ts +112 -111
- package/package.json +2 -2
- package/dist/packem_shared/AwsLightStorage-BK-WPL0h.js +0 -1
- package/dist/packem_shared/AzureStorage-1UvDIQZd.js +0 -1
- package/dist/packem_shared/BoxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunS3MetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunnyMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/CloudinaryMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/DiskStorage-CI07TVNu.js +0 -1
- package/dist/packem_shared/DropboxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/FirebaseMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/FtpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/NetlifyBlobStorage-CkpCCoN1.js +0 -1
- package/dist/packem_shared/OneDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/PocketBaseMetaStorage-DOTLwVE7.js +0 -1
- package/dist/packem_shared/SftpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SharePointMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SupabaseMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/UploadThingMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/VercelBlobMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/base-handler-node-BF1v1qDa.js +0 -1
- package/dist/packem_shared/disk-storage-CsQcYW3s.js +0 -1
- package/dist/packem_shared/disk-storage-with-checksum.d-B-VGEsfl.d.ts +0 -156
- package/dist/packem_shared/files.d-CH0iLBNC.d.ts +0 -655
- package/dist/packem_shared/gcs-meta-storage-B7BnctnV.js +0 -1
- package/dist/packem_shared/local-meta-storage-iuJnu90B.js +0 -11
- package/dist/packem_shared/media-transformer.d-Quf4ai47.d.ts +0 -331
- package/dist/packem_shared/path-0oTTdkvl-DvWvbDbh.js +0 -1
- package/dist/packem_shared/s3-base-storage-BoTyhuzO.js +0 -1
- package/dist/packem_shared/storage-0j5nCAUp.js +0 -1
- package/dist/packem_shared/storage.d-CEM1upWM.d.ts +0 -1176
- package/dist/packem_shared/tus-base.d-DLzKE54M.d.ts +0 -106
- package/dist/packem_shared/types.d-Bon9GVVe.d.ts +0 -104
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"../../../packem_shared/Multipart-
|
|
1
|
+
import c from"../../../packem_shared/Multipart-V64Bg5dt.js";import i from"../../../packem_shared/Rest-B7g1sgkq.js";import{Tus as d}from"../../../packem_shared/Tus-D9c7KDnl.js";const u=t=>async o=>{try{const e=o.req.raw;return await t.fetch(e)}catch(e){const a=e,s=a.statusCode||(a.status?Number.parseInt(a.status,10):void 0)||500;return Response.json({error:a.message||"Request failed"},{status:s})}},m=(t,o)=>{const{path:e,type:a,...s}=o;let n;switch(a){case"multipart":{n=new c(s);break}case"rest":{n=new i(s);break}case"tus":{n=new d(s);break}default:throw new Error(`Unknown handler type: ${String(a??"unknown")}`)}const r=u(n);switch(a){case"multipart":{t.post(e,r),t.get(`${e}/:id?/:metadata?`,r),t.delete(`${e}/:id`,r),t.on("OPTIONS",e,r);break}case"rest":{t.post(e,r),t.put(`${e}/:id`,r),t.patch(`${e}/:id`,r),t.get(`${e}/:id?`,r),t.on("HEAD",`${e}/:id`,r),t.delete(`${e}/:id?`,r),t.on("OPTIONS",e,r);break}case"tus":{t.all(e,r),t.all(`${e}/:id`,r);break}default:throw new Error(`Unknown handler type: ${String(a)}`)}};export{m as createStorageHandler};
|
|
@@ -1,69 +1,70 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server.js';
|
|
2
|
-
import { U as UploadFile } from "../../../packem_shared/storage.d-
|
|
2
|
+
import { U as UploadFile } from "../../../packem_shared/storage.d-DwdJrArF.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { U as UploadOptions } from "../../../packem_shared/types.d-
|
|
4
|
+
import { U as UploadOptions } from "../../../packem_shared/types.d-D7Zlz5RE.js";
|
|
5
|
+
import 'node:timers';
|
|
5
6
|
import 'node:crypto';
|
|
6
7
|
import 'node:http';
|
|
7
8
|
import 'lru-cache';
|
|
8
9
|
import 'node:events';
|
|
9
10
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
11
|
+
import "../../../packem_shared/media-transformer.d-C8tn4J2Z.js";
|
|
12
|
+
import "../../../packem_shared/types.d-BEUv414z.js";
|
|
12
13
|
/**
|
|
13
|
-
* Configuration for Next.js handler.
|
|
14
|
-
*/
|
|
14
|
+
* Configuration for Next.js handler.
|
|
15
|
+
*/
|
|
15
16
|
interface NextjsHandlerConfig<TFile extends UploadFile> extends UploadOptions<TFile> {
|
|
16
17
|
/** Handler type to use */
|
|
17
18
|
type: "multipart" | "rest" | "tus";
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Next.js route handler that automatically exports the correct HTTP methods for each handler type.
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* // app/api/upload/multipart/route.ts
|
|
24
|
-
* import { DiskStorage } from "@visulima/storage";
|
|
25
|
-
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
26
|
-
*
|
|
27
|
-
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
28
|
-
* const handler = createHandler({ storage, type: "multipart" });
|
|
29
|
-
*
|
|
30
|
-
* export const POST = handler;
|
|
31
|
-
* export const DELETE = handler;
|
|
32
|
-
* export const GET = handler;
|
|
33
|
-
* export const OPTIONS = handler;
|
|
34
|
-
* ```
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* // app/api/upload/rest/route.ts
|
|
38
|
-
* import { DiskStorage } from "@visulima/storage";
|
|
39
|
-
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
40
|
-
*
|
|
41
|
-
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
42
|
-
* const handler = createHandler({ storage, type: "rest" });
|
|
43
|
-
*
|
|
44
|
-
* export const POST = handler;
|
|
45
|
-
* export const PUT = handler;
|
|
46
|
-
* export const PATCH = handler;
|
|
47
|
-
* export const GET = handler;
|
|
48
|
-
* export const HEAD = handler;
|
|
49
|
-
* export const DELETE = handler;
|
|
50
|
-
* export const OPTIONS = handler;
|
|
51
|
-
* ```
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* // app/api/upload/tus/route.ts
|
|
55
|
-
* import { DiskStorage } from "@visulima/storage";
|
|
56
|
-
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
57
|
-
*
|
|
58
|
-
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
59
|
-
* const handler = createHandler({ storage, type: "tus" });
|
|
60
|
-
*
|
|
61
|
-
* export const POST = handler;
|
|
62
|
-
* export const PATCH = handler;
|
|
63
|
-
* export const HEAD = handler;
|
|
64
|
-
* export const DELETE = handler;
|
|
65
|
-
* export const OPTIONS = handler;
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
21
|
+
* Next.js route handler that automatically exports the correct HTTP methods for each handler type.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* // app/api/upload/multipart/route.ts
|
|
25
|
+
* import { DiskStorage } from "@visulima/storage";
|
|
26
|
+
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
27
|
+
*
|
|
28
|
+
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
29
|
+
* const handler = createHandler({ storage, type: "multipart" });
|
|
30
|
+
*
|
|
31
|
+
* export const POST = handler;
|
|
32
|
+
* export const DELETE = handler;
|
|
33
|
+
* export const GET = handler;
|
|
34
|
+
* export const OPTIONS = handler;
|
|
35
|
+
* ```
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* // app/api/upload/rest/route.ts
|
|
39
|
+
* import { DiskStorage } from "@visulima/storage";
|
|
40
|
+
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
41
|
+
*
|
|
42
|
+
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
43
|
+
* const handler = createHandler({ storage, type: "rest" });
|
|
44
|
+
*
|
|
45
|
+
* export const POST = handler;
|
|
46
|
+
* export const PUT = handler;
|
|
47
|
+
* export const PATCH = handler;
|
|
48
|
+
* export const GET = handler;
|
|
49
|
+
* export const HEAD = handler;
|
|
50
|
+
* export const DELETE = handler;
|
|
51
|
+
* export const OPTIONS = handler;
|
|
52
|
+
* ```
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* // app/api/upload/tus/route.ts
|
|
56
|
+
* import { DiskStorage } from "@visulima/storage";
|
|
57
|
+
* import { createHandler } from "@visulima/storage/handler/http/nextjs";
|
|
58
|
+
*
|
|
59
|
+
* const storage = new DiskStorage({ directory: "./uploads" });
|
|
60
|
+
* const handler = createHandler({ storage, type: "tus" });
|
|
61
|
+
*
|
|
62
|
+
* export const POST = handler;
|
|
63
|
+
* export const PATCH = handler;
|
|
64
|
+
* export const HEAD = handler;
|
|
65
|
+
* export const DELETE = handler;
|
|
66
|
+
* export const OPTIONS = handler;
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
68
69
|
declare const createHandler: <TFile extends UploadFile>(config: NextjsHandlerConfig<TFile>) => ((request: NextRequest) => Promise<NextResponse>);
|
|
69
70
|
export { NextjsHandlerConfig, createHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NextResponse as o}from"next/server.js";import u from"../../../packem_shared/Multipart-
|
|
1
|
+
import{NextResponse as o}from"next/server.js";import u from"../../../packem_shared/Multipart-V64Bg5dt.js";import c from"../../../packem_shared/Rest-B7g1sgkq.js";import{Tus as m}from"../../../packem_shared/Tus-D9c7KDnl.js";const d=t=>{let r;switch(t.type){case"multipart":{r=new u(t);break}case"rest":{r=new c(t);break}case"tus":{r=new m(t);break}default:throw new Error(`Unknown handler type: ${String(t.type??"unknown")}`)}return async s=>{try{return await r.fetch(s)}catch(n){const e=n,a=e.statusCode||(e.status?Number.parseInt(e.status,10):void 0)||500;return o.json({error:e.message||"Request failed"},{status:a})}}};export{d as createHandler};
|