@visulima/storage 1.0.0-alpha.26 → 1.0.0-alpha.27
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 +25 -0
- package/LICENSE.md +0 -1104
- package/README.md +79 -466
- package/dist/adapter/nuxt/module.d.ts +4 -4
- package/dist/adapter/nuxt/node_modules/.bin/nuxi +22 -0
- package/dist/adapter/nuxt/node_modules/.bin/nuxt +22 -0
- package/dist/ai/ai-sdk/index.d.ts +113 -0
- package/dist/ai/ai-sdk/index.js +1 -0
- package/dist/ai/claude/index.d.ts +177 -0
- package/dist/ai/claude/index.js +1 -0
- package/dist/ai/openai/index.d.ts +205 -0
- package/dist/ai/openai/index.js +1 -0
- package/dist/ai/tanstack/index.d.ts +115 -0
- package/dist/ai/tanstack/index.js +1 -0
- package/dist/handler/http/fetch/index.d.ts +13 -7
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +5 -1412
- package/dist/handler/http/hono/index.js +1 -1
- package/dist/handler/http/nextjs/index.d.ts +4 -4
- package/dist/handler/http/nextjs/index.js +1 -1
- package/dist/handler/http/node/index.d.ts +7 -7
- package/dist/handler/http/node/index.js +1 -1
- package/dist/handler/http/solid-start/index.d.ts +4 -4
- package/dist/handler/http/solid-start/index.js +1 -1
- package/dist/index.d.ts +6 -324
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AwsLightFile-BTLiRxXj.js → AwsLightFile-BSqjc_rD.js} +1 -1
- package/dist/packem_shared/{AwsLightStorage-CA9cdfJ6.js → AwsLightStorage-SH7j-myh.js} +1 -1
- package/dist/packem_shared/{AzureFile-BKHru1zB.js → AzureFile-Dgj2Tef4.js} +1 -1
- package/dist/packem_shared/{AzureSMetaStorage-BqA4jUDJ.js → AzureSMetaStorage-DV2tNjKh.js} +1 -1
- package/dist/packem_shared/AzureStorage-BVYMFEBP.js +1 -0
- package/dist/packem_shared/BaseTransformer-Fpcuz4kj.js +1 -0
- package/dist/packem_shared/BoxFile-Be0S4N1L.js +1 -0
- package/dist/packem_shared/BoxMetaStorage-BUe5Qmqe.js +1 -0
- package/dist/packem_shared/BoxStorage-CgC81_So.js +1 -0
- package/dist/packem_shared/BunnyFile-Dotl-lO9.js +1 -0
- package/dist/packem_shared/BunnyMetaStorage-D0mT6veJ.js +1 -0
- package/dist/packem_shared/BunnyStorage-Bl4usdVT.js +1 -0
- package/dist/packem_shared/DiskStorage-B5uIDVXr.js +1 -0
- package/dist/packem_shared/DiskStorageWithChecksum-CbXWpSOr.js +1 -0
- package/dist/packem_shared/DropboxFile-BGVG2kXM.js +1 -0
- package/dist/packem_shared/DropboxMetaStorage-CICuUZ1n.js +1 -0
- package/dist/packem_shared/DropboxStorage-CPjhDN5B.js +1 -0
- package/dist/packem_shared/ERRORS-CyOuSMLY.js +1 -0
- package/dist/packem_shared/File-BhfUgJjs.js +1 -0
- package/dist/packem_shared/Files-B7hlJcB4.js +1 -0
- package/dist/packem_shared/{GCSFile-CHjX_fJk.js → GCSFile-CDQ6IWAz.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-DV0MBO3W.js → GCSMetaStorage-CqP9ifYB.js} +1 -1
- package/dist/packem_shared/GCStorage-XSBKVx90.js +1 -0
- package/dist/packem_shared/GoogleDriveFile-D0aGfGbL.js +1 -0
- package/dist/packem_shared/GoogleDriveMetaStorage-rghGy3Fa.js +1 -0
- package/dist/packem_shared/GoogleDriveStorage-DuB6glUk.js +1 -0
- package/dist/packem_shared/LocalMetaStorage-B5uh1snG.js +1 -0
- package/dist/packem_shared/MediaTransformer-D-1c9Q_k.js +1 -0
- package/dist/packem_shared/Multipart-7FSSy2n1.js +1 -0
- package/dist/packem_shared/Multipart-DACQFsrn.js +1 -0
- package/dist/packem_shared/{NetlifyBlobFile-CpzkMKng.js → NetlifyBlobFile-PMZLJ8AC.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-BcRFPky8.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-C4qkJv1R.js +1 -0
- package/dist/packem_shared/OneDriveFile-XbVVKIJh.js +1 -0
- package/dist/packem_shared/OneDriveMetaStorage-B_BkGLzW.js +1 -0
- package/dist/packem_shared/OneDriveStorage-Cu0cGcrh.js +1 -0
- package/dist/packem_shared/Rest-5NwM1xYj.js +1 -0
- package/dist/packem_shared/{Rest-CYEBbtCD.js → Rest-y8Vz2Rt0.js} +1 -1
- package/dist/packem_shared/{S3File-Du6wP0Sz.js → S3File-BfmCOET4.js} +1 -1
- package/dist/packem_shared/S3Storage-D8dopWoO.js +1 -0
- package/dist/packem_shared/SupabaseFile-DZ1iv9gM.js +1 -0
- package/dist/packem_shared/SupabaseMetaStorage-BR1UGqnj.js +1 -0
- package/dist/packem_shared/SupabaseStorage-CCtMTiN5.js +1 -0
- package/dist/packem_shared/{Tus-CUBCkuPE.js → Tus-BCVAbJIi.js} +1 -1
- package/dist/packem_shared/Tus-CJMcygk7.js +1 -0
- package/dist/packem_shared/UploadThingFile-BpG9mE8K.js +1 -0
- package/dist/packem_shared/UploadThingMetaStorage-DyGNyaAq.js +1 -0
- package/dist/packem_shared/UploadThingStorage-B_fNzNFO.js +1 -0
- package/dist/packem_shared/{VercelBlobFile-CL9MjKcY.js → VercelBlobFile-Cni_1qwD.js} +1 -1
- package/dist/packem_shared/{VercelBlobMetaStorage-BsOTx-Su.js → VercelBlobMetaStorage-Do9ZoKrl.js} +1 -1
- package/dist/packem_shared/VercelBlobStorage-D5zy4PPQ.js +1 -0
- package/dist/packem_shared/agentsListFiles-R-CnGKc4.js +1 -0
- package/dist/packem_shared/akamai-BYS9pP8S.js +1 -0
- package/dist/packem_shared/approval-BBeX3o4E.js +1 -0
- package/dist/packem_shared/approval.d-CMAYH9GF.d.ts +75 -0
- package/dist/packem_shared/backblaze-CvdtCvJL.js +1 -0
- package/dist/packem_shared/base-handler-core-BfwZ1RS1.js +1 -0
- package/dist/packem_shared/base-handler-fetch-CLxqXTQf.js +1 -0
- package/dist/packem_shared/base-handler-node-DBZjcqsp.js +1 -0
- package/dist/packem_shared/claudeListFiles-DAezbKEi.js +1 -0
- package/dist/packem_shared/cloudflare-Bm_Pg6yx.js +1 -0
- package/dist/packem_shared/createResponsesFileTools-BCep-qdO.js +1 -0
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-6URTv-Mp.js +1 -0
- package/dist/packem_shared/detect-file-type-5JhzC9RU.js +1 -0
- package/dist/packem_shared/digitalOcean-Lj1NfDzc.js +1 -0
- package/dist/packem_shared/disk-storage-CbSSPnOf.js +5 -0
- package/dist/packem_shared/{disk-storage-with-checksum.d-hEoe2ugb.d.ts → disk-storage-with-checksum.d-BQMXA4Wl.d.ts} +6 -4
- package/dist/packem_shared/executors-DG6hGtvm.js +1 -0
- package/dist/packem_shared/executors.d-UtkeCbk1.d.ts +65 -0
- package/dist/packem_shared/{gcs-meta-storage-BfJB-ejI.js → gcs-meta-storage-XB-UPJn6.js} +1 -1
- package/dist/packem_shared/hetzner-DDxE7Gy7.js +1 -0
- package/dist/packem_shared/index.d-DotjipuX.d.ts +89 -0
- package/dist/packem_shared/isRetryableError-B6ZS_-5I.js +1 -0
- package/dist/packem_shared/listFiles-B6VF05d-.js +1 -0
- package/dist/packem_shared/listFiles-BtP6VnUp.js +1 -0
- package/dist/packem_shared/{local-meta-storage-Bkwqi_gi.js → local-meta-storage-CT1audnK.js} +1 -1
- package/dist/packem_shared/{local-meta-storage.d-Dop9RP9k.d.ts → local-meta-storage.d-B5R1nswK.d.ts} +2 -1
- package/dist/packem_shared/{media-transformer.d-CY9CsEOe.d.ts → media-transformer.d-DK7NJncf.d.ts} +2 -2
- package/dist/packem_shared/minio-T_Z3iEy7.js +1 -0
- package/dist/packem_shared/multipart-base-BxckfvQf.js +1 -0
- package/dist/packem_shared/oauth-refresh-Dg2ybc6_.js +1 -0
- package/dist/packem_shared/part-match-B5fLLmFw.js +1 -0
- package/dist/packem_shared/rest-base-CCv78k7h.js +1 -0
- package/dist/packem_shared/s3-base-storage-f_EyFAAt.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-CczjSe98.d.ts → s3-base-storage.d-BROGYJ4F.d.ts} +1 -1
- package/dist/packem_shared/storage-CoyB2O-Y.js +1 -0
- package/dist/packem_shared/{storage.d-BOMUJD96.d.ts → storage.d-Cr6f2lac.d.ts} +179 -78
- package/dist/packem_shared/storj-CVA9mM-7.js +1 -0
- package/dist/packem_shared/tigris-wmhjfsH2.js +1 -0
- package/dist/packem_shared/{tus-base.d-DNZRXR9X.d.ts → tus-base.d-4-ZfDQwl.d.ts} +3 -3
- package/dist/packem_shared/{types.d-D4caL2Fp.d.ts → types.d-BgCmSE94.d.ts} +2 -2
- package/dist/packem_shared/{types.d-BCN94sB_.d.ts → types.d-C8eSxqX9.d.ts} +13 -1
- package/dist/packem_shared/wasabi-JQzxdrFy.js +1 -0
- package/dist/storage/aws/clients/index.d.ts +90 -15
- package/dist/storage/aws/clients/index.js +1 -1
- package/dist/storage/aws/index.d.ts +16 -15
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +5 -3
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +4 -10277
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +186 -0
- package/dist/storage/box/index.js +1 -0
- package/dist/storage/bunny/index.d.ts +116 -0
- package/dist/storage/bunny/index.js +1 -0
- package/dist/storage/dropbox/index.d.ts +129 -0
- package/dist/storage/dropbox/index.js +1 -0
- package/dist/storage/gcs/index.d.ts +6 -3941
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +145 -0
- package/dist/storage/google-drive/index.js +1 -0
- package/dist/storage/local/index.d.ts +3 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/netlify-blob/index.d.ts +4 -2
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +192 -0
- package/dist/storage/onedrive/index.js +1 -0
- package/dist/storage/supabase/index.d.ts +111 -0
- package/dist/storage/supabase/index.js +1 -0
- package/dist/storage/uploadthing/index.d.ts +91 -0
- package/dist/storage/uploadthing/index.js +1 -0
- package/dist/storage/vercel-blob/index.d.ts +17 -2
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +2 -2
- package/dist/transformer/audio-transformer.js +1 -1
- package/dist/transformer/image-transformer.d.ts +6 -2
- package/dist/transformer/image-transformer.js +1 -1
- package/dist/transformer/index.d.ts +3 -3
- package/dist/transformer/index.js +1 -1
- package/dist/transformer/video-transformer.d.ts +2 -2
- package/dist/transformer/video-transformer.js +1 -1
- package/package.json +99 -3
- package/dist/packem_shared/AzureStorage-BKUjCymW.js +0 -1
- package/dist/packem_shared/BaseTransformer-D68eLyz1.js +0 -1
- package/dist/packem_shared/DiskStorage-DNjpDMX9.js +0 -1
- package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +0 -1
- package/dist/packem_shared/ERRORS-B9jkvKwx.js +0 -1
- package/dist/packem_shared/File-alcSNpLq.js +0 -1
- package/dist/packem_shared/GCStorage-B8dl6TGK.js +0 -1
- package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +0 -1
- package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +0 -1
- package/dist/packem_shared/Multipart-Bd9YFFn0.js +0 -1
- package/dist/packem_shared/Multipart-D5bcEvga.js +0 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +0 -1
- package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +0 -1
- package/dist/packem_shared/Rest-DoonVU7B.js +0 -1
- package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +0 -20357
- package/dist/packem_shared/S3Storage-Fx6-OSc-.js +0 -1
- package/dist/packem_shared/Tus-Bd_2Ki2G.js +0 -1
- package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +0 -1
- package/dist/packem_shared/backblaze-DEflv87m.js +0 -1
- package/dist/packem_shared/base-handler-core-DaggCVsq.js +0 -1
- package/dist/packem_shared/base-handler-fetch-DnarP64X.js +0 -1
- package/dist/packem_shared/base-handler-node-BTes6sql.js +0 -1
- package/dist/packem_shared/cloudflare-DLAeQvgD.js +0 -1
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +0 -1
- package/dist/packem_shared/digitalOcean-nhZUds87.js +0 -1
- package/dist/packem_shared/disk-storage-BvdK4bqF.js +0 -5
- package/dist/packem_shared/isRetryableError-DQNSZiBc.js +0 -1
- package/dist/packem_shared/minio-BWwgGXeE.js +0 -1
- package/dist/packem_shared/multipart-base-C6OjBwMS.js +0 -1
- package/dist/packem_shared/part-match-DqD5U7An.js +0 -1
- package/dist/packem_shared/rest-base-B2Dv7esY.js +0 -1
- package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +0 -1
- package/dist/packem_shared/storage-m_Cxgiih.js +0 -1
- package/dist/packem_shared/tigris-DZoyrMNd.js +0 -1
- package/dist/packem_shared/validator-DK41xp8N.js +0 -1
- package/dist/packem_shared/wasabi-Dmce4x9s.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var d=Object.defineProperty;var c=(t,n)=>d(t,"name",{value:n,configurable:!0});import u from"../../../packem_shared/Multipart-
|
|
1
|
+
var d=Object.defineProperty;var c=(t,n)=>d(t,"name",{value:n,configurable:!0});import u from"../../../packem_shared/Multipart-DACQFsrn.js";import l from"../../../packem_shared/Rest-5NwM1xYj.js";import{Tus as p}from"../../../packem_shared/Tus-CJMcygk7.js";var m=Object.defineProperty,i=c((t,n)=>m(t,"name",{value:n,configurable:!0}),"a");const w=i(t=>async n=>{try{const e=n.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})}},"createHandlerFunction"),k=i((t,n)=>{const{path:e,type:a,...s}=n;let o;switch(a){case"multipart":{o=new u(s);break}case"rest":{o=new l(s);break}case"tus":{o=new p(s);break}default:throw new Error(`Unknown handler type: ${String(a??"unknown")}`)}const r=w(o);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)}`)}},"createStorageHandler");export{k as createStorageHandler};
|
|
@@ -1,14 +1,14 @@
|
|
|
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-Cr6f2lac.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-BgCmSE94.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
10
|
+
import "../../../packem_shared/media-transformer.d-DK7NJncf.js";
|
|
11
|
+
import "../../../packem_shared/types.d-C8eSxqX9.js";
|
|
12
12
|
/**
|
|
13
13
|
* Configuration for Next.js handler.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var a=(e,r)=>c(e,"name",{value:r,configurable:!0});import{NextResponse as i}from"next/server.js";import m from"../../../packem_shared/Multipart-
|
|
1
|
+
var c=Object.defineProperty;var a=(e,r)=>c(e,"name",{value:r,configurable:!0});import{NextResponse as i}from"next/server.js";import m from"../../../packem_shared/Multipart-DACQFsrn.js";import p from"../../../packem_shared/Rest-5NwM1xYj.js";import{Tus as d}from"../../../packem_shared/Tus-CJMcygk7.js";var l=Object.defineProperty,n=a((e,r)=>l(e,"name",{value:r,configurable:!0}),"r");const k=n(e=>{let r;switch(e.type){case"multipart":{r=new m(e);break}case"rest":{r=new p(e);break}case"tus":{r=new d(e);break}default:throw new Error(`Unknown handler type: ${String(e.type??"unknown")}`)}return n(async s=>{try{return await r.fetch(s)}catch(o){const t=o,u=t.statusCode||(t.status?Number.parseInt(t.status,10):void 0)||500;return i.json({error:t.message||"Request failed"},{status:u})}},"nextjsHandler")},"createHandler");export{k as createHandler};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { U as UploadFile,
|
|
2
|
+
import { U as UploadFile, K as UploadResponse } from "../../../packem_shared/storage.d-Cr6f2lac.js";
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
|
-
import { H as Handlers, A as AsyncHandler, U as UploadOptions, R as ResponseFile, a as ResponseList, M as MethodHandler } from "../../../packem_shared/types.d-
|
|
5
|
-
export { type B as BaseHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-
|
|
6
|
-
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-
|
|
7
|
-
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-
|
|
4
|
+
import { H as Handlers, A as AsyncHandler, U as UploadOptions, R as ResponseFile, a as ResponseList, M as MethodHandler } from "../../../packem_shared/types.d-BgCmSE94.js";
|
|
5
|
+
export { type B as BaseHandler, type b as RequestEvent, type c as UploadErrorEvent, type d as UploadEvent } from "../../../packem_shared/types.d-BgCmSE94.js";
|
|
6
|
+
import { B as BaseHandlerCore } from "../../../packem_shared/tus-base.d-4-ZfDQwl.js";
|
|
7
|
+
export { T as TUS_RESUMABLE, a as TUS_VERSION } from "../../../packem_shared/tus-base.d-4-ZfDQwl.js";
|
|
8
8
|
import 'node:crypto';
|
|
9
9
|
import 'lru-cache';
|
|
10
10
|
import 'node:events';
|
|
11
11
|
import '@visulima/pagination';
|
|
12
|
-
import "../../../packem_shared/media-transformer.d-
|
|
13
|
-
import "../../../packem_shared/types.d-
|
|
12
|
+
import "../../../packem_shared/media-transformer.d-DK7NJncf.js";
|
|
13
|
+
import "../../../packem_shared/types.d-C8eSxqX9.js";
|
|
14
14
|
/**
|
|
15
15
|
* Base handler for Node.js platform (IncomingMessage/ServerResponse).
|
|
16
16
|
* Extends BaseHandlerCore with Node.js-specific request/response handling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"../../../packem_shared/Multipart-
|
|
1
|
+
import o from"../../../packem_shared/Multipart-7FSSy2n1.js";import m from"../../../packem_shared/Rest-y8Vz2Rt0.js";import{Tus as f}from"../../../packem_shared/Tus-BCVAbJIi.js";import{TUS_RESUMABLE as S,TUS_VERSION as a}from"../../../packem_shared/TUS_RESUMABLE-B7KtPVeC.js";export{o as Multipart,m as Rest,S as TUS_RESUMABLE,a as TUS_VERSION,f as Tus};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { U as UploadFile } from "../../../packem_shared/storage.d-
|
|
2
|
+
import { U as UploadFile } from "../../../packem_shared/storage.d-Cr6f2lac.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-BgCmSE94.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '@visulima/pagination';
|
|
10
|
-
import "../../../packem_shared/media-transformer.d-
|
|
11
|
-
import "../../../packem_shared/types.d-
|
|
10
|
+
import "../../../packem_shared/media-transformer.d-DK7NJncf.js";
|
|
11
|
+
import "../../../packem_shared/types.d-C8eSxqX9.js";
|
|
12
12
|
/**
|
|
13
13
|
* Configuration for SolidStart handler.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=Object.defineProperty;var a=(t,e)=>i(t,"name",{value:e,configurable:!0});import c from"../../../packem_shared/Multipart-
|
|
1
|
+
var i=Object.defineProperty;var a=(t,e)=>i(t,"name",{value:e,configurable:!0});import c from"../../../packem_shared/Multipart-DACQFsrn.js";import d from"../../../packem_shared/Rest-5NwM1xYj.js";import{Tus as l}from"../../../packem_shared/Tus-CJMcygk7.js";var p=Object.defineProperty,n=a((t,e)=>p(t,"name",{value:e,configurable:!0}),"s");const b=n(t=>{let e;switch(t.type){case"multipart":{e=new c(t);break}case"rest":{e=new d(t);break}case"tus":{e=new l(t);break}default:throw new Error(`Unknown handler type: ${String(t.type??"unknown")}`)}return n(async s=>{try{return await e.fetch(s.request)}catch(o){const r=o,u=r.statusCode||(r.status?Number.parseInt(r.status,10):void 0)||500;return Response.json({error:r.message||"Request failed"},{headers:{"Content-Type":"application/json"},status:u})}},"solidStartHandler")},"createSolidStartHandler");export{b as createSolidStartHandler};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { D as
|
|
4
|
-
|
|
1
|
+
export { type D as DownloadResult, type a as FileBody, type b as FileObject, F as Files, type c as FilesOptions, type L as ListOptions, type S as SignedReadUrlOptions, type d as SignedUploadUrlOptions, type U as UploadOptions } from "./packem_shared/index.d-DotjipuX.js";
|
|
2
|
+
import { k as Metrics } from "./packem_shared/storage.d-Cr6f2lac.js";
|
|
3
|
+
export { B as AbstractBaseStorage, type l as BaseStorageOptions, type m as BatchOperationResponse, type n as BatchOperationResult, type D as DiskStorageOptions, type h as DiskStorageWithChecksumOptions, E as ERRORS, o as ErrorMap, type p as ExpirationOptions, F as File, type e as FileInit, type f as FilePart, type g as FileQuery, type q as Header, type r as Headers, type H as HttpError, type s as HttpErrorBody, type I as IncomingMessageWithBody, type L as LocalMetaStorageOptions, M as MetaStorage, type t as MetaStorageOptions, u as Metadata, type O as OnComplete, type v as OnCreate, type w as OnDelete, type x as OnError, type y as OnUpdate, type P as PurgeList, type z as RangeChecksum, type A as RangeHasher, type G as ResponseBody, type i as ResponseBodyType, type J as ResponseTuple, type R as RetryConfig, b as UploadError, type c as UploadEventType, type U as UploadFile, type K as UploadResponse, type V as Validation, type N as ValidationError, type Q as ValidatorConfig, d as createRetryWrapper, S as defaultCloudStorageFileNameValidation, T as defaultFilesystemFileNameValidation, W as extractHttpStatus, X as isRetryableError, Y as isUploadError, Z as mapStatusToErrorCode, _ as retry, $ as throwErrorCode, a0 as wrapStorageError } from "./packem_shared/storage.d-Cr6f2lac.js";
|
|
4
|
+
import { Meter } from '@opentelemetry/api';
|
|
5
|
+
export { D as DiskStorage, a as DiskStorageWithChecksum } from "./packem_shared/disk-storage-with-checksum.d-BQMXA4Wl.js";
|
|
6
|
+
export { L as LocalMetaStorage } from "./packem_shared/local-meta-storage.d-B5R1nswK.js";
|
|
5
7
|
export { type AnyWebReadableByteStreamWithFileType, type AnyWebReadableStream, type Detector, type FileTypeOptions, type FileTypeParser, type FileTypeResult, type StreamOptions, type TokenizerPositionError, fileTypeFromBlob, fileTypeFromBuffer, fileTypeFromTokenizer, supportedExtensions, supportedMimeTypes } from 'file-type';
|
|
6
8
|
import 'node:stream';
|
|
7
9
|
import 'node:crypto';
|
|
@@ -26,326 +28,6 @@ declare class NoOpMetrics implements Metrics {
|
|
|
26
28
|
timing(_name: string, _duration: number, _attributes?: Record<string, string | number>): void;
|
|
27
29
|
gauge(_name: string, _value: number, _attributes?: Record<string, string | number>): void;
|
|
28
30
|
}
|
|
29
|
-
/**
|
|
30
|
-
* @since 1.0.0
|
|
31
|
-
*/
|
|
32
|
-
interface Context {
|
|
33
|
-
/**
|
|
34
|
-
* Get a value from the context.
|
|
35
|
-
*
|
|
36
|
-
* @param key key which identifies a context value
|
|
37
|
-
*/
|
|
38
|
-
getValue(key: symbol): unknown;
|
|
39
|
-
/**
|
|
40
|
-
* Create a new context which inherits from this context and has
|
|
41
|
-
* the given key set to the given value.
|
|
42
|
-
*
|
|
43
|
-
* @param key context key for which to set the value
|
|
44
|
-
* @param value value to set for the given key
|
|
45
|
-
*/
|
|
46
|
-
setValue(key: symbol, value: unknown): Context;
|
|
47
|
-
/**
|
|
48
|
-
* Return a new context which inherits from this context but does
|
|
49
|
-
* not contain a value for the given key.
|
|
50
|
-
*
|
|
51
|
-
* @param key context key for which to clear a value
|
|
52
|
-
*/
|
|
53
|
-
deleteValue(key: symbol): Context;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Attributes is a map from string to attribute values.
|
|
57
|
-
*
|
|
58
|
-
* Note: only the own enumerable keys are counted as valid attribute keys.
|
|
59
|
-
*
|
|
60
|
-
* @since 1.3.0
|
|
61
|
-
*/
|
|
62
|
-
interface Attributes {
|
|
63
|
-
[attributeKey: string]: AttributeValue | undefined;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Attribute values may be any non-nullish primitive value except an object.
|
|
67
|
-
*
|
|
68
|
-
* null or undefined attribute values are invalid and will result in undefined behavior.
|
|
69
|
-
*
|
|
70
|
-
* @since 1.3.0
|
|
71
|
-
*/
|
|
72
|
-
type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
|
|
73
|
-
/**
|
|
74
|
-
* Advisory options influencing aggregation configuration parameters.
|
|
75
|
-
*
|
|
76
|
-
* @since 1.7.0
|
|
77
|
-
* @experimental
|
|
78
|
-
*/
|
|
79
|
-
interface MetricAdvice {
|
|
80
|
-
/**
|
|
81
|
-
* Hint the explicit bucket boundaries for SDK if the metric is been
|
|
82
|
-
* aggregated with a HistogramAggregator.
|
|
83
|
-
*/
|
|
84
|
-
explicitBucketBoundaries?: number[];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Options needed for metric creation
|
|
88
|
-
*
|
|
89
|
-
* @since 1.3.0
|
|
90
|
-
*/
|
|
91
|
-
interface MetricOptions {
|
|
92
|
-
/**
|
|
93
|
-
* The description of the Metric.
|
|
94
|
-
* @default ''
|
|
95
|
-
*/
|
|
96
|
-
description?: string;
|
|
97
|
-
/**
|
|
98
|
-
* The unit of the Metric values.
|
|
99
|
-
* @default ''
|
|
100
|
-
*/
|
|
101
|
-
unit?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Indicates the type of the recorded value.
|
|
104
|
-
* @default {@link ValueType.DOUBLE}
|
|
105
|
-
*/
|
|
106
|
-
valueType?: ValueType;
|
|
107
|
-
/**
|
|
108
|
-
* The advice influencing aggregation configuration parameters.
|
|
109
|
-
* @experimental
|
|
110
|
-
* @since 1.7.0
|
|
111
|
-
*/
|
|
112
|
-
advice?: MetricAdvice;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* The Type of value. It describes how the data is reported.
|
|
116
|
-
*
|
|
117
|
-
* @since 1.3.0
|
|
118
|
-
*/
|
|
119
|
-
declare enum ValueType {
|
|
120
|
-
INT = 0,
|
|
121
|
-
DOUBLE = 1,
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Counter is the most common synchronous instrument. This instrument supports
|
|
125
|
-
* an `Add(increment)` function for reporting a sum, and is restricted to
|
|
126
|
-
* non-negative increments. The default aggregation is Sum, as for any additive
|
|
127
|
-
* instrument.
|
|
128
|
-
*
|
|
129
|
-
* Example uses for Counter:
|
|
130
|
-
* <ol>
|
|
131
|
-
* <li> count the number of bytes received. </li>
|
|
132
|
-
* <li> count the number of requests completed. </li>
|
|
133
|
-
* <li> count the number of accounts created. </li>
|
|
134
|
-
* <li> count the number of checkpoints run. </li>
|
|
135
|
-
* <li> count the number of 5xx errors. </li>
|
|
136
|
-
* <ol>
|
|
137
|
-
*
|
|
138
|
-
* @since 1.3.0
|
|
139
|
-
*/
|
|
140
|
-
interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
141
|
-
/**
|
|
142
|
-
* Increment value of counter by the input. Inputs must not be negative.
|
|
143
|
-
*/
|
|
144
|
-
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* @since 1.3.0
|
|
148
|
-
*/
|
|
149
|
-
interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
150
|
-
/**
|
|
151
|
-
* Increment value of counter by the input. Inputs may be negative.
|
|
152
|
-
*/
|
|
153
|
-
add(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* @since 1.9.0
|
|
157
|
-
*/
|
|
158
|
-
interface Gauge<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
159
|
-
/**
|
|
160
|
-
* Records a measurement.
|
|
161
|
-
*/
|
|
162
|
-
record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @since 1.3.0
|
|
166
|
-
*/
|
|
167
|
-
interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
168
|
-
/**
|
|
169
|
-
* Records a measurement. Value of the measurement must not be negative.
|
|
170
|
-
*/
|
|
171
|
-
record(value: number, attributes?: AttributesTypes, context?: Context): void;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* @deprecated please use {@link Attributes}
|
|
175
|
-
* @since 1.3.0
|
|
176
|
-
*/
|
|
177
|
-
type MetricAttributes = Attributes;
|
|
178
|
-
/**
|
|
179
|
-
* Interface that is being used in callback function for Observable Metric.
|
|
180
|
-
*
|
|
181
|
-
* @since 1.3.0
|
|
182
|
-
*/
|
|
183
|
-
interface ObservableResult<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
184
|
-
/**
|
|
185
|
-
* Observe a measurement of the value associated with the given attributes.
|
|
186
|
-
*
|
|
187
|
-
* @param value The value to be observed.
|
|
188
|
-
* @param attributes The attributes associated with the value. If more than
|
|
189
|
-
* one value is associated with the same attributes values, SDK may pick the
|
|
190
|
-
* last one or simply drop the entire observable result.
|
|
191
|
-
*/
|
|
192
|
-
observe(this: ObservableResult<AttributesTypes>, value: number, attributes?: AttributesTypes): void;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Interface that is being used in batch observable callback function.
|
|
196
|
-
*/
|
|
197
|
-
interface BatchObservableResult<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
198
|
-
/**
|
|
199
|
-
* Observe a measurement of the value associated with the given attributes.
|
|
200
|
-
*
|
|
201
|
-
* @param metric The observable metric to be observed.
|
|
202
|
-
* @param value The value to be observed.
|
|
203
|
-
* @param attributes The attributes associated with the value. If more than
|
|
204
|
-
* one value is associated with the same attributes values, SDK may pick the
|
|
205
|
-
* last one or simply drop the entire observable result.
|
|
206
|
-
*/
|
|
207
|
-
observe(this: BatchObservableResult<AttributesTypes>, metric: Observable<AttributesTypes>, value: number, attributes?: AttributesTypes): void;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* The observable callback for Observable instruments.
|
|
211
|
-
*
|
|
212
|
-
* @since 1.3.0
|
|
213
|
-
*/
|
|
214
|
-
type ObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: ObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* The observable callback for a batch of Observable instruments.
|
|
217
|
-
*
|
|
218
|
-
* @since 1.3.0
|
|
219
|
-
*/
|
|
220
|
-
type BatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes> = (observableResult: BatchObservableResult<AttributesTypes>) => void | Promise<void>;
|
|
221
|
-
/**
|
|
222
|
-
* @since 1.3.0
|
|
223
|
-
*/
|
|
224
|
-
interface Observable<AttributesTypes extends MetricAttributes = MetricAttributes> {
|
|
225
|
-
/**
|
|
226
|
-
* Sets up a function that will be called whenever a metric collection is initiated.
|
|
227
|
-
*
|
|
228
|
-
* If the function is already in the list of callbacks for this Observable, the function is not added a second time.
|
|
229
|
-
*/
|
|
230
|
-
addCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
231
|
-
/**
|
|
232
|
-
* Removes a callback previously registered with {@link Observable.addCallback}.
|
|
233
|
-
*/
|
|
234
|
-
removeCallback(callback: ObservableCallback<AttributesTypes>): void;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* @since 1.3.0
|
|
238
|
-
*/
|
|
239
|
-
type ObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
240
|
-
/**
|
|
241
|
-
* @since 1.3.0
|
|
242
|
-
*/
|
|
243
|
-
type ObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
244
|
-
/**
|
|
245
|
-
* @since 1.3.0
|
|
246
|
-
*/
|
|
247
|
-
type ObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes> = Observable<AttributesTypes>;
|
|
248
|
-
/**
|
|
249
|
-
* An interface to allow the recording metrics.
|
|
250
|
-
*
|
|
251
|
-
* {@link Metric}s are used for recording pre-defined aggregation (`Counter`),
|
|
252
|
-
* or raw values (`Histogram`) in which the aggregation and attributes
|
|
253
|
-
* for the exported metric are deferred.
|
|
254
|
-
*
|
|
255
|
-
* @since 1.3.0
|
|
256
|
-
*/
|
|
257
|
-
interface Meter {
|
|
258
|
-
/**
|
|
259
|
-
* Creates and returns a new `Gauge`.
|
|
260
|
-
* @param name the name of the metric.
|
|
261
|
-
* @param [options] the metric options.
|
|
262
|
-
*/
|
|
263
|
-
createGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): Gauge<AttributesTypes>;
|
|
264
|
-
/**
|
|
265
|
-
* Creates and returns a new `Histogram`.
|
|
266
|
-
* @param name the name of the metric.
|
|
267
|
-
* @param [options] the metric options.
|
|
268
|
-
*/
|
|
269
|
-
createHistogram<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): Histogram<AttributesTypes>;
|
|
270
|
-
/**
|
|
271
|
-
* Creates a new `Counter` metric. Generally, this kind of metric when the
|
|
272
|
-
* value is a quantity, the sum is of primary interest, and the event count
|
|
273
|
-
* and value distribution are not of primary interest.
|
|
274
|
-
* @param name the name of the metric.
|
|
275
|
-
* @param [options] the metric options.
|
|
276
|
-
*/
|
|
277
|
-
createCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): Counter<AttributesTypes>;
|
|
278
|
-
/**
|
|
279
|
-
* Creates a new `UpDownCounter` metric. UpDownCounter is a synchronous
|
|
280
|
-
* instrument and very similar to Counter except that Add(increment)
|
|
281
|
-
* supports negative increments. It is generally useful for capturing changes
|
|
282
|
-
* in an amount of resources used, or any quantity that rises and falls
|
|
283
|
-
* during a request.
|
|
284
|
-
* Example uses for UpDownCounter:
|
|
285
|
-
* <ol>
|
|
286
|
-
* <li> count the number of active requests. </li>
|
|
287
|
-
* <li> count memory in use by instrumenting new and delete. </li>
|
|
288
|
-
* <li> count queue size by instrumenting enqueue and dequeue. </li>
|
|
289
|
-
* <li> count semaphore up and down operations. </li>
|
|
290
|
-
* </ol>
|
|
291
|
-
*
|
|
292
|
-
* @param name the name of the metric.
|
|
293
|
-
* @param [options] the metric options.
|
|
294
|
-
*/
|
|
295
|
-
createUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): UpDownCounter<AttributesTypes>;
|
|
296
|
-
/**
|
|
297
|
-
* Creates a new `ObservableGauge` metric.
|
|
298
|
-
*
|
|
299
|
-
* The callback SHOULD be safe to be invoked concurrently.
|
|
300
|
-
*
|
|
301
|
-
* @param name the name of the metric.
|
|
302
|
-
* @param [options] the metric options.
|
|
303
|
-
*/
|
|
304
|
-
createObservableGauge<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableGauge<AttributesTypes>;
|
|
305
|
-
/**
|
|
306
|
-
* Creates a new `ObservableCounter` metric.
|
|
307
|
-
*
|
|
308
|
-
* The callback SHOULD be safe to be invoked concurrently.
|
|
309
|
-
*
|
|
310
|
-
* @param name the name of the metric.
|
|
311
|
-
* @param [options] the metric options.
|
|
312
|
-
*/
|
|
313
|
-
createObservableCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableCounter<AttributesTypes>;
|
|
314
|
-
/**
|
|
315
|
-
* Creates a new `ObservableUpDownCounter` metric.
|
|
316
|
-
*
|
|
317
|
-
* The callback SHOULD be safe to be invoked concurrently.
|
|
318
|
-
*
|
|
319
|
-
* @param name the name of the metric.
|
|
320
|
-
* @param [options] the metric options.
|
|
321
|
-
*/
|
|
322
|
-
createObservableUpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes>(name: string, options?: MetricOptions): ObservableUpDownCounter<AttributesTypes>;
|
|
323
|
-
/**
|
|
324
|
-
* Sets up a function that will be called whenever a metric collection is
|
|
325
|
-
* initiated.
|
|
326
|
-
*
|
|
327
|
-
* If the function is already in the list of callbacks for this Observable,
|
|
328
|
-
* the function is not added a second time.
|
|
329
|
-
*
|
|
330
|
-
* Only the associated observables can be observed in the callback.
|
|
331
|
-
* Measurements of observables that are not associated observed in the
|
|
332
|
-
* callback are dropped.
|
|
333
|
-
*
|
|
334
|
-
* @param callback the batch observable callback
|
|
335
|
-
* @param observables the observables associated with this batch observable callback
|
|
336
|
-
*/
|
|
337
|
-
addBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(callback: BatchObservableCallback<AttributesTypes>, observables: Observable<AttributesTypes>[]): void;
|
|
338
|
-
/**
|
|
339
|
-
* Removes a callback previously registered with {@link Meter.addBatchObservableCallback}.
|
|
340
|
-
*
|
|
341
|
-
* The callback to be removed is identified using a combination of the callback itself,
|
|
342
|
-
* and the set of the observables associated with it.
|
|
343
|
-
*
|
|
344
|
-
* @param callback the batch observable callback
|
|
345
|
-
* @param observables the observables associated with this batch observable callback
|
|
346
|
-
*/
|
|
347
|
-
removeBatchObservableCallback<AttributesTypes extends MetricAttributes = MetricAttributes>(callback: BatchObservableCallback<AttributesTypes>, observables: Observable<AttributesTypes>[]): void;
|
|
348
|
-
}
|
|
349
31
|
/**
|
|
350
32
|
* OpenTelemetry-based metrics implementation.
|
|
351
33
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Files as o}from"./packem_shared/Files-B7hlJcB4.js";import{waitForStorage as a}from"./packem_shared/waitForStorage-ChSBLhLc.js";import{f as s}from"./packem_shared/disk-storage-CbSSPnOf.js";import{default as l}from"./packem_shared/DiskStorageWithChecksum-CbXWpSOr.js";import{v as i}from"./packem_shared/local-meta-storage-CT1audnK.js";import{default as x}from"./packem_shared/MetaStorage-Y4m1dWgd.js";import{B as S,d as y,a as E}from"./packem_shared/storage-CoyB2O-Y.js";import{ERRORS as g,ErrorMap as c,UploadError as M,extractHttpStatus as T,isUploadError as n,mapStatusToErrorCode as R,throwErrorCode as k,wrapStorageError as B}from"./packem_shared/ERRORS-CyOuSMLY.js";import{createRetryWrapper as b,isRetryableError as h,retry as w}from"./packem_shared/isRetryableError-B6ZS_-5I.js";import{fileTypeFromBlob as O,fileTypeFromBuffer as D,fileTypeFromTokenizer as U,supportedExtensions as V,supportedMimeTypes as W}from"file-type";import{default as z}from"./packem_shared/File-BhfUgJjs.js";import{default as H}from"./packem_shared/NoOpMetrics-Dky06sf1.js";import{default as j}from"./packem_shared/OpenTelemetryMetrics-9uxQMSlg.js";import{Metadata as G}from"./packem_shared/Metadata-B6Ir0KO7.js";export{S as AbstractBaseStorage,s as DiskStorage,l as DiskStorageWithChecksum,g as ERRORS,c as ErrorMap,z as File,o as Files,i as LocalMetaStorage,x as MetaStorage,G as Metadata,H as NoOpMetrics,j as OpenTelemetryMetrics,M as UploadError,b as createRetryWrapper,y as defaultCloudStorageFileNameValidation,E as defaultFilesystemFileNameValidation,T as extractHttpStatus,O as fileTypeFromBlob,D as fileTypeFromBuffer,U as fileTypeFromTokenizer,h as isRetryableError,n as isUploadError,R as mapStatusToErrorCode,w as retry,V as supportedExtensions,W as supportedMimeTypes,k as throwErrorCode,a as waitForStorage,B as wrapStorageError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var r=Object.defineProperty;var e=(t,a)=>r(t,"name",{value:a,configurable:!0});import s from"./File-
|
|
1
|
+
var r=Object.defineProperty;var e=(t,a)=>r(t,"name",{value:a,configurable:!0});import s from"./File-BhfUgJjs.js";var i=Object.defineProperty,l=e((t,a)=>i(t,"name",{value:a,configurable:!0}),"t");class d extends s{static{e(this,"a")}static{l(this,"AwsLightFile")}Parts;UploadId;uri;partsUrls;partSize}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var u=(o,e)=>l(o,"name",{value:e,configurable:!0});import{Readable as p}from"node:stream";import{S as h}from"./s3-base-storage-
|
|
1
|
+
var l=Object.defineProperty;var u=(o,e)=>l(o,"name",{value:e,configurable:!0});import{Readable as p}from"node:stream";import{S as h}from"./s3-base-storage-f_EyFAAt.js";import{w as f,l as S}from"./aws-light-meta-storage-TPyQwLvk.js";import y from"./AwsLightFile-BSqjc_rD.js";var w=Object.defineProperty,C=u((o,e)=>w(o,"name",{value:e,configurable:!0}),"l");class K extends h{static name="aws-light";s3Api;constructor(e){const{bucket:t=process.env.S3_BUCKET||process.env.AWS_S3_BUCKET,region:r}=e;if(!t)throw new Error("S3 bucket is not defined");if(!r)throw new Error("S3 region is not defined");if(!e.accessKeyId)throw new Error("accessKeyId is required");if(!e.secretAccessKey)throw new Error("secretAccessKey is required");super({bucket:t,clientDirectUpload:e.clientDirectUpload,expiration:e.expiration?.maxAge?{maxAge:String(e.expiration.maxAge)}:void 0,filename:e.filename,logger:e.logger,metaStorage:e.metaStorage,metaStorageConfig:e.metaStorageConfig?{...e.metaStorageConfig,...e}:{...e},partSize:e.partSize,retryConfig:{...e.retryConfig,shouldRetry:C(i=>{const s=i;return s.statusCode&&[408,429,500,502,503,504].includes(s.statusCode)?!0:s.retryable??!1},"shouldRetry")}}),this.s3Api=new f({accessKeyId:e.accessKeyId,bucket:t,endpoint:e.endpoint,region:r,secretAccessKey:e.secretAccessKey,service:e.service,sessionToken:e.sessionToken});const{metaStorage:a,metaStorageConfig:n}=e;if(!a){const i={...e,...n,logger:this.logger};this.meta=new S(i)}}normalizeError(e){const t=e;return t.statusCode||t.code?{code:t.code||t.name,message:t.message,name:t.name,statusCode:t.statusCode||500}:super.normalizeError(e)}async update({id:e},t){if(this.config.clientDirectUpload){const r=await this.getMeta(e);return this.buildPresigned({...r,...t})}return super.update({id:e},t)}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const t=this.getS3Api(),{Body:r,ContentLength:a,ContentType:n,ETag:i,Expires:s,LastModified:g}=await this.retry(()=>t.getObject({Bucket:this.bucket,Key:e}));await this.checkIfExpired({expiredAt:s});const c=r instanceof ReadableStream?p.fromWeb(r):r,m=new p({read(){c.on("data",d=>{this.push(d)}),c.on("end",()=>{this.push(null)}),c.on("error",d=>{this.destroy(d)})}});return{headers:{"Content-Length":a?.toString()??"0","Content-Type":n,...i&&{ETag:i},...s&&{"X-Upload-Expires":s.toString()},...g&&{"Last-Modified":g.toString()}},size:Number(a),stream:m}})}get raw(){return this.s3Api.aws}getS3Api(){return this.s3Api}getFileClass(){return y}getAcl(){}async accessCheck(e=30){await this.s3Api.checkBucketAccess({Bucket:this.bucket})}}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});import i from"./File-
|
|
1
|
+
var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});import i from"./File-BhfUgJjs.js";var s=Object.defineProperty,u=t((e,r)=>s(e,"name",{value:r,configurable:!0}),"i");class c extends i{static{t(this,"s")}static{u(this,"AzureFile")}requestId;uri}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var r=(i,t)=>h(i,"name",{value:t,configurable:!0});import{BlobServiceClient as s,StorageSharedKeyCredential as p}from"@azure/storage-blob";import{throwErrorCode as c,ERRORS as l}from"./ERRORS-
|
|
1
|
+
var h=Object.defineProperty;var r=(i,t)=>h(i,"name",{value:t,configurable:!0});import{BlobServiceClient as s,StorageSharedKeyCredential as p}from"@azure/storage-blob";import{throwErrorCode as c,ERRORS as l}from"./ERRORS-CyOuSMLY.js";import u from"./MetaStorage-Y4m1dWgd.js";import{parseMetadata as f,stringifyMetadata as g}from"./Metadata-B6Ir0KO7.js";var N=Object.defineProperty,C=r((i,t)=>N(i,"name",{value:t,configurable:!0}),"c");let v=class extends u{static{r(this,"N")}constructor(t){super(t),this.config=t;const{client:a,...e}=t;if(a===void 0){const n=e.connectionString||process.env.AZURE_STORAGE_CONNECTION_STRING||void 0;if(n)this.client=s.fromConnectionString(n);else{const d=e.accountKey||process.env.AZURE_STORAGE_ACCOUNT_KEY||void 0,o=e.accountName||process.env.AZURE_STORAGE_ACCOUNT||void 0;if(!e.accountKey)throw new Error("Missing required parameter: Azure blob storage account key.");if(!e.accountName)throw new Error("Missing required parameter: Azure blob storage account name.");const m=new p(o,d);this.client=new s(t.endpoint??`https://${o}.blob.core.windows.net`,m)}}else this.client=a;if(!(e.containerName||process.env.AZURE_STORAGE_CONTAINER))throw new Error("Missing required parameter: Azure container name.");this.containerClient=this.client.getContainerClient(e.containerName)}config;static{C(this,"AzureMetaStorage")}client;containerClient;async get(t){const a=this.containerClient.getAppendBlobClient(this.getMetaName(t));let e;try{e=await a.getProperties()}catch{throw c(l.UNKNOWN_ERROR)}if(!e.metadata)throw c(l.FILE_NOT_FOUND);const n=e.metadata;return n.metadata&&typeof n.metadata=="string"&&(n.metadata=f(n.metadata)),n}async touch(t,a){return this.save(t,a)}async delete(t){await this.containerClient.getBlockBlobClient(this.getMetaName(t)).deleteIfExists()}async save(t,a){const e={...a};return e.metadata&&(e.metadata=g(a.metadata)),await this.containerClient.getAppendBlobClient(this.getMetaName(t)).setMetadata(e,{}),a}async list(){const t=[],a=this.containerClient.listBlobsFlat({prefix:this.prefix});for await(const e of a)t.push(e);return t.filter(e=>e.name.endsWith(this.suffix)).map(e=>({createdAt:e.properties.createdOn,id:this.getIdFromMetaName(e.name)}))}};export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var d=(h,t)=>y(h,"name",{value:t,configurable:!0});import{BlobServiceClient as m,StorageSharedKeyCredential as g}from"@azure/storage-blob";import{L as p}from"./path-D7rMc9nq-B718mbm6.js";import{d as f}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as c,ERRORS as l}from"./ERRORS-CyOuSMLY.js";import{B as w,t as b}from"./storage-CoyB2O-Y.js";import{createRetryWrapper as C}from"./isRetryableError-B6ZS_-5I.js";import{v as E}from"./local-meta-storage-CT1audnK.js";import O from"./AzureFile-Dgj2Tef4.js";import T from"./AzureSMetaStorage-DV2tNjKh.js";import{r as N,o as R}from"./part-match-B5fLLmFw.js";import{o as S}from"./has-content-Bx2p8Okx.js";var v=Object.defineProperty,F=d((h,t)=>v(h,"name",{value:t,configurable:!0}),"h");class z extends w{static name="azure";checksumTypes=["md5"];get raw(){return this.client}meta;client;containerClient;root;retry;constructor(t){if(super(t),!t.containerName)throw new Error("Missing required parameter: Azure container name.");const e=t.connectionString||process.env.AZURE_STORAGE_CONNECTION_STRING||void 0;if(e)this.client=m.fromConnectionString(e);else{const i=t.accountKey||process.env.AZURE_STORAGE_ACCOUNT_KEY||void 0,n=t.accountName||process.env.AZURE_STORAGE_ACCOUNT||void 0;if(!t.accountKey)throw new Error("Missing required parameter: Azure blob storage account key.");if(!t.accountName)throw new Error("Missing required parameter: Azure blob storage account name.");const a=new g(n,i);this.client=new m(t.endpoint??`https://${n}.blob.core.windows.net`,a)}this.containerClient=this.client.getContainerClient(t.containerName),this.root=t.root?p(t.root).replace(/^\//,""):"";const r={backoffMultiplier:2,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:F(i=>{const n=i;if(n.statusCode&&[408,429,500,502,503,504].includes(n.statusCode))return!0;if(i instanceof Error){const a=n.code;if(a==="ECONNRESET"||a==="ETIMEDOUT"||a==="ENOTFOUND"||a==="ECONNREFUSED")return!0}return!1},"shouldRetry"),...t.retryConfig};if(this.retry=C(r),t.metaStorage)this.meta=t.metaStorage;else{let i={...t,...t.metaStorageConfig,logger:this.logger};"directory"in i?(this.logger?.debug("Using local meta storage"),this.meta=new E(i)):(e===i.connectionString&&(i={...i,client:this.client}),this.meta=new T(i))}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(i=>{this.logger?.error("Storage access check failed: %O",i)})}async create(t){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const o=typeof t.ttl=="string"?b(t.ttl):t.ttl;o!==void 0&&(e.expiredAt=Date.now()+o)}const r=new O(e);r.name=this.namingFunction(r),await this.validate(r);try{const o=await this.getMeta(r.id);if(o.bytesWritten>=0)return o}catch{}const i=this.containerClient.getBlockBlobClient(this.getFullPath(r.name)),n={};for(const[o,s]of Object.entries(r.metadata||{}))n[o]=JSON.stringify(s);const a=await this.retry(()=>i.uploadData(Buffer.from(""),{blobHTTPHeaders:{blobContentType:r.contentType},metadata:{name:r.name,originalName:r.originalName,...n}}));return a.requestId===void 0?c(l.FILE_ERROR,"azure create upload error"):(r.requestId=a.requestId,r.uri=a._response.headers.get("location"),r.bytesWritten=0,await this.saveMeta(r),r.status="created",await this.onCreate(r),r)})}async delete({id:t}){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);e.status="deleted",await this.retry(()=>this.containerClient.getBlockBlobClient(this.getFullPath(e.name)).deleteIfExists()),await this.deleteMeta(e.id);const r={...e};return await this.onDelete(r),r})}async move(t,e){return this.instrumentOperation("move",async()=>{const r=await this.copy(t,e),i=this.getFullPath(t);return await this.retry(()=>this.containerClient.getBlockBlobClient(i).deleteIfExists()),r})}async write(t){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(!N(t,e))return c(l.FILE_CONFLICT);const r=await this.lock(t.id);try{if(S(t)){if((e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(!e.contentType||e.contentType==="application/octet-stream"))try{const{fileType:o,stream:s}=await f(t.body);o?.mime&&(e.contentType=o.mime),t.body=s}catch{}const i=this.containerClient.getBlockBlobClient(this.getFullPath(e.name)),n=new AbortController;t.body.on("error",()=>{n.abort()});const a=await this.retry(()=>i.uploadStream(t.body,void 0,void 0,{abortSignal:n.signal,blobHTTPHeaders:{blobContentType:e.contentType??"application/octet-stream"},metadata:e.metadata}));if(a.requestId===void 0)return c(l.FILE_ERROR,"azure write upload error");e.requestId=a.requestId,e.bytesWritten+=t.contentLength||0,e.status=R(e),e.status==="completed"&&(e.uri=a._response.headers.get("location"),await this.deleteMeta(e.id))}}finally{await this.unlock(t.id,r)}return e})}async get({id:t}){return this.instrumentOperation("get",async()=>{const e=this.containerClient.getBlockBlobClient(t);if(!await this.retry(()=>e.exists()))try{return await this.getMeta(t),c(l.GONE)}catch{return c(l.FILE_NOT_FOUND)}const r=await this.retry(()=>e.getProperties()),{contentLength:i,contentType:n,etag:a,expiresOn:o,lastModified:s,metadata:u}=r;return{content:await this.retry(()=>e.downloadToBuffer()),contentType:n,ETag:a,expiredAt:o,id:t,metadata:u||{},modifiedAt:s,name:u?.name||t,originalName:u?.originalName||"",size:i}})}async exists({id:t}){return this.instrumentOperation("exists",async()=>{try{await this.getMeta(t);const e=this.containerClient.getBlockBlobClient(t);return await this.retry(()=>e.exists())}catch{return!1}})}async copy(t,e){return this.instrumentOperation("copy",async()=>{const r=this.containerClient.getBlockBlobClient(this.getFullPath(t));if(!await this.retry(()=>r.exists()))try{return await this.getMeta(t),c(l.GONE)}catch{return c(l.FILE_NOT_FOUND)}const i=this.containerClient.getBlockBlobClient(this.getFullPath(e)),n=await this.retry(()=>i.beginCopyFromURL(r.url));return await this.retry(()=>n.pollUntilDone()),{...await this.getMeta(t),id:e,name:e}})}async list(t=1e3){return this.instrumentOperation("list",async()=>{const e=[];let r=!0,i;for(;r&&e.length<t;)try{const n=Math.min(t-e.length,1e3),a=this.containerClient.listBlobsFlat({includeMetadata:!0,prefix:this.root}).byPage({continuationToken:i,maxPageSize:n}),o=(await this.retry(()=>a.next())).value;if(o!==void 0&&"segment"in o){for(const s of o.segment.blobItems)if(!s.deleted&&(e.push({createdAt:s.properties.createdOn,id:s.name,modifiedAt:s.properties.lastModified}),e.length>=t))break}r=o?.continuationToken!==void 0,r&&(i=o.continuationToken)}catch(n){const a=this.normalizeError(n instanceof Error?n:new Error(String(n)));throw await this.onError(a),n}return e},{limit:t})}getFullPath(t){return this.assetFolder!==void 0?`${this.assetFolder}/${t}`:t}async accessCheck(){await this.retry(()=>this.containerClient.getProperties())}}export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var s=(a,t)=>n(a,"name",{value:t,configurable:!0});import{Readable as c}from"node:stream";import i from"mime";import{N as h}from"./cache-qV_5Umeq.js";var f=Object.defineProperty,l=s((a,t)=>f(a,"name",{value:t,configurable:!0}),"n");class y{static{s(this,"l")}constructor(t,r,e){this.storage=t,this.config=r,this.logger=e,this.cache=r.cache??new h}storage;static{l(this,"BaseTransformer")}config;logger;cache;async transformStream(t,r){const e=await this.transform(t,r);if(e&&"buffer"in e){const{buffer:o}=e;return{headers:{"Content-Length":o.length.toString(),"Content-Type":this.getContentTypeFromResult(e)},size:o.length,stream:c.from(o)}}throw new Error("Streaming transformation not supported for this transformer")}clearCache(t){if(!t){this.cache?.clear?.();return}if(!this.cache)return;if(typeof this.cache.keys!="function"){this.logger?.warn?.("clearCache(fileId) cannot scope its invalidation because the cache does not implement keys(); falling back to full clear()"),this.cache.clear?.();return}const r=`${t}:`;for(const e of this.cache.keys())typeof e=="string"&&(e===t||e.startsWith(r))&&this.cache.delete(e)}getCacheStats(){return{maxSize:-1,size:this.cache?.size??0}}getContentTypeFromResult(t){if(t?.format){const r=i.getType(t.format);if(r)return r}return"application/octet-stream"}}export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var a=(e,r)=>t(e,"name",{value:r,configurable:!0});import l from"./File-BhfUgJjs.js";var i=Object.defineProperty,o=a((e,r)=>i(e,"name",{value:r,configurable:!0}),"l");class c extends l{static{a(this,"p")}static{o(this,"BoxFile")}boxFileId;eTag;publicUrl}export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var r=(t,e)=>a(t,"name",{value:e,configurable:!0});import{v as o}from"./local-meta-storage-CT1audnK.js";var s=Object.defineProperty,c=r((t,e)=>s(t,"name",{value:e,configurable:!0}),"e");class l extends o{static{r(this,"l")}static{c(this,"BoxMetaStorage")}constructor(e){super(e)}}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var x=Object.defineProperty;var I=(r,t)=>x(r,"name",{value:t,configurable:!0});import{Readable as b}from"node:stream";import{BoxDeveloperTokenAuth as C,BoxClient as u,OAuthConfig as T,BoxOAuth as O,CcgConfig as S,BoxCcgAuth as U,BoxJwtAuth as L,JwtConfig as F}from"box-typescript-sdk-gen";import{throwErrorCode as v,ERRORS as B}from"./ERRORS-CyOuSMLY.js";import{B as R}from"./storage-CoyB2O-Y.js";import p from"./BoxFile-Be0S4N1L.js";import A from"./BoxMetaStorage-BUe5Qmqe.js";import{o as k,r as D}from"./part-match-B5fLLmFw.js";import{u as H}from"./update-size-DANV7aa2.js";import{o as _}from"./has-content-Bx2p8Okx.js";var M=Object.defineProperty,d=I((r,t)=>M(r,"name",{value:t,configurable:!0}),"c");const N="0",j=50*1024*1024,w={ensureReady:d(()=>Promise.resolve(),"ensureReady")},z=d(r=>{let t=0,e=r.length;for(;t<e&&r[t]==="/";)t+=1;for(;e>t&&r[e-1]==="/";)e-=1;return t===0&&e===r.length?r:r.slice(t,e)},"trimSlashes"),m=d(r=>{const t=z(r);if(!t)throw new Error("Box: key must not be empty");const e=t.split("/").filter(o=>o.length>0),a=e.pop()??"";if(!a)throw new Error(`Box: key "${r}" has no file name segment`);return{leaf:a,parents:e}},"splitKey"),P=d(async r=>{const t=[];for await(const e of r)t.push(Buffer.from(e));return Buffer.concat(t)},"collectStream"),g=d(r=>b.from(r),"bufferToReadable"),$=d(r=>"configJsonString"in r?F.fromConfigJsonString(r.configJsonString):F.fromConfigFile(r.configFilePath),"buildJwtConfig"),J=d(r=>[r.developerToken,r.oauth,r.ccg,r.jwt].filter(t=>t!==void 0).length,"countAuthMethods"),K=d(r=>{if(r.client)return{authHandle:w,client:r.client};if(J(r)>1)throw new Error("Box storage: pass exactly one of `developerToken`, `oauth`, `ccg`, or `jwt`.");if(r.developerToken!==void 0){const e=new C({token:r.developerToken});return{authHandle:w,client:new u({auth:e})}}if(r.oauth){const{clientId:e,clientSecret:a,refreshToken:o}=r.oauth,i=new T({clientId:e,clientSecret:a}),l=new O({config:i});let n;const s=d(async()=>{await l.tokenStorage.store({accessToken:"",refreshToken:o})},"seed");return{authHandle:{ensureReady:d(()=>(n||(n=s()),n),"ensureReady")},client:new u({auth:l})}}if(r.ccg){const{clientId:e,clientSecret:a,enterpriseId:o,userId:i}=r.ccg;if(!o&&!i)throw new Error("Box storage: `ccg` auth requires either `enterpriseId` or `userId`.");const l=new S({clientId:e,clientSecret:a,...o!==void 0&&{enterpriseId:o},...i!==void 0&&{userId:i}}),n=new U({config:l});return{authHandle:w,client:new u({auth:n})}}if(r.jwt){const e=$(r.jwt),a=new L({config:e});return{authHandle:w,client:new u({auth:a})}}const t=process.env.BOX_DEVELOPER_TOKEN;if(t){const e=new C({token:t});return{authHandle:w,client:new u({auth:e})}}throw new Error("Box storage: missing auth. Pass `client`, `developerToken`, `oauth`, `ccg`, or `jwt`. Env fallback: BOX_DEVELOPER_TOKEN.")},"resolveAuth"),q=d(r=>{if(r&&typeof r=="object"){const t=r,e=t.responseInfo?.code??t.responseInfo?.body?.code;return t.responseInfo?.statusCode===404||e==="not_found"||e==="file_not_found"||e==="folder_not_found"||e==="trashed"}return!1},"isNotFoundError"),E=d(r=>{if(r&&typeof r=="object"){const t=r,e=t.responseInfo?.code??t.responseInfo?.body?.code;return t.responseInfo?.statusCode===409||e==="item_name_in_use"||e==="conflict"}return!1},"isConflictError");class ne extends R{static name="box";checksumTypes=[];meta;authHandle;client;fileIdCache;folderIdCache;publicByDefault;rootFolderId;constructor(t){super(t),this.rootFolderId=t.rootFolderId??N,this.publicByDefault=t.publicByDefault??!1;const e=K(t);this.client=e.client,this.authHandle=e.authHandle,this.folderIdCache=new Map,this.fileIdCache=new Map,this.meta=t.metaStorage??new A(t.metaStorageConfig),this.isReady=!0}get raw(){return this.client}async create(t){return this.instrumentOperation("create",async()=>{const e=new p(t);e.name=this.namingFunction(e),await this.validate(e);try{const a=await this.getMeta(e.id);if(a.bytesWritten>=0)return a}catch{}return e.bytesWritten=0,e.status=k(e),await this.saveMeta(e),await this.onCreate(e),e})}async write(t){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(t.size!==void 0&&H(e,t.size),!D(t,e))throw new Error("File part does not match");const a=await this.lock(t.id);try{if(_(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");await this.authHandle.ensureReady();const o=await P(t.body),i=e.name||e.id,{leaf:l,parents:n}=m(i),s=await this.resolveFolderId(n,{create:!0}),h=await this.resolveExistingFileForUpload(i,s,l),c=await this.performUpload(h,s,l,o);c.id&&(this.fileIdCache.set(i,c.id),this.publicByDefault&&await this.ensureSharedLink(c.id)),e.bytesWritten=o.length,e.size=o.length,e.boxFileId=c.id,e.eTag=c.etag??void 0,e.ETag=c.etag??void 0}return e.status=k(e),e.status==="completed"&&await this.internalOnComplete(e),await this.saveMeta(e),e}finally{await this.unlock(t.id,a)}})}async delete({id:t}){return this.instrumentOperation("delete",async()=>{let e;try{e=await this.getMeta(t)}catch{}const a=e?.name??t;await this.authHandle.ensureReady();try{const o=e?.boxFileId??await this.resolveFileId(a);await this.client.files.deleteFileById(o),this.fileIdCache.delete(a)}catch(o){if(!q(o))throw o}return e?(e.status="deleted",await this.deleteMeta(e.id),await this.onDelete(e),e):Object.assign(new p({contentType:"application/octet-stream",metadata:{},originalName:t}),{id:t,name:t,status:"deleted"})})}async get({id:t}){return this.instrumentOperation("get",async()=>{let e,a=t;try{e=await this.checkIfExpired(await this.getMeta(t)),a=e.name??t}catch{}await this.authHandle.ensureReady();const o=e?.boxFileId??await this.resolveFileId(a),i=await this.client.files.getFileById(o),l=await this.client.downloads.getDownloadFileUrl(o),n=await fetch(l);if(!n.ok)throw new Error(`Box: download fetch failed (${n.status})`);const s=await n.arrayBuffer(),h=Buffer.from(s);return{content:h,contentType:e?.contentType??"application/octet-stream",ETag:e?.ETag??i.etag??void 0,expiredAt:e?.expiredAt,id:t,metadata:e?.metadata??{},modifiedAt:e?.modifiedAt??i.modifiedAt??i.contentModifiedAt??void 0,name:e?.name??i.name??a,originalName:e?.originalName??i.name??a,size:e?.size??i.size??h.length}})}async copy(t,e){return this.instrumentOperation("copy",async()=>{await this.authHandle.ensureReady();const a=await this.resolveFileId(t),{leaf:o,parents:i}=m(e),l=await this.resolveFolderId(i,{create:!0}),n=await this.client.files.copyFile(a,{name:o,parent:{id:l}});n.id&&this.fileIdCache.set(e,n.id);const s=new p({contentType:"application/octet-stream",metadata:{},originalName:e});return s.id=e,s.name=e,s.boxFileId=n.id,s.eTag=n.etag??void 0,s.ETag=n.etag??void 0,s})}async move(t,e){return this.instrumentOperation("move",async()=>{await this.authHandle.ensureReady();const a=await this.resolveFileId(t),{leaf:o,parents:i}=m(e),l=await this.resolveFolderId(i,{create:!0}),n=await this.client.files.updateFileById(a,{requestBody:{name:o,parent:{id:l}}});this.fileIdCache.delete(t),n.id&&this.fileIdCache.set(e,n.id);const s=new p({contentType:"application/octet-stream",metadata:{},originalName:e});s.id=e,s.name=e,s.boxFileId=n.id,s.eTag=n.etag??void 0,s.ETag=n.etag??void 0;try{await this.deleteMeta(t)}catch{}return s})}async list(t=1e3){return this.instrumentOperation("list",async()=>{await this.authHandle.ensureReady();const e=[];let a=0;const o=Math.min(t,1e3);for(;e.length<t;){const i=(await this.client.folders.getFolderItems(this.rootFolderId,{queryParams:{fields:["id","name","size","modified_at","etag","type"],limit:o,offset:a}})).entries??[];for(const l of i){const n=l;if(n.type!=="file"||!n.id||!n.name)continue;this.fileIdCache.set(n.name,n.id);const s=new p({contentType:"application/octet-stream",metadata:{},originalName:n.name});if(s.id=n.name,s.name=n.name,s.boxFileId=n.id,s.eTag=n.etag??void 0,s.ETag=n.etag??void 0,s.size=n.size??0,s.modifiedAt=n.modifiedAt??n.contentModifiedAt??void 0,e.push(s),e.length>=t)break}if(i.length<o)break;a+=i.length}return e},{limit:t})}async getReadUrl(t,e){if(e?.responseContentDisposition||e?.responseContentType)return v(B.METHOD_NOT_ALLOWED,"Box: `responseContentDisposition` / `responseContentType` are not supported — Box download URLs and shared-link URLs have no overrides.");await this.authHandle.ensureReady();const a=await this.resolveFileId(t);return this.publicByDefault?this.ensureSharedLink(a):this.client.downloads.getDownloadFileUrl(a)}async getUploadUrl(t,e){return v(B.METHOD_NOT_ALLOWED,"Box: `getUploadUrl` is not supported. Box uploads require a multipart POST with an `attributes` JSON part and a file bytes part; this doesn't fit the PUT-style upload-url contract. Use `write()` server-side, or the Box UI Elements / Box Content Uploader for browser flows.")}async findChildByName(t,e){let a=0;const o=1e3;for(;;){const i=(await this.client.folders.getFolderItems(t,{queryParams:{fields:["id","name","type"],limit:o,offset:a}})).entries??[];for(const l of i){const n=l;if(n.name===e&&n.id&&n.type)return{id:n.id,type:n.type}}if(i.length<o)return;a+=i.length}}folderCacheKey(t){return t.join("/")}async resolveFolderId(t,e){if(t.length===0)return this.rootFolderId;const a=this.folderCacheKey(t),o=this.folderIdCache.get(a);if(o)return o;let i=this.rootFolderId;const l=[];for(const n of t){l.push(n);const s=this.folderCacheKey(l),h=this.folderIdCache.get(s);if(h){i=h;continue}const c=await this.findChildByName(i,n);if(c&&c.type==="folder"){i=c.id,this.folderIdCache.set(s,i);continue}if(c&&c.type!=="folder")throw new Error(`Box: path segment "${n}" exists but is not a folder`);if(!e.create)throw new Error(`Box: folder "${l.join("/")}" not found`);try{const f=await this.client.folders.createFolder({name:n,parent:{id:i}});if(!f.id)throw new Error(`Box: createFolder did not return an id for "${n}"`);i=f.id,this.folderIdCache.set(s,i)}catch(f){if(E(f)){const y=await this.findChildByName(i,n);if(y&&y.type==="folder"){i=y.id,this.folderIdCache.set(s,i);continue}}throw f}}return this.folderIdCache.set(a,i),i}async resolveFileId(t){const e=this.fileIdCache.get(t);if(e)return e;const{leaf:a,parents:o}=m(t),i=await this.resolveFolderId(o,{create:!1}),l=await this.findChildByName(i,a);if(!l||l.type!=="file")throw new Error(`Box: file "${t}" not found`);return this.fileIdCache.set(t,l.id),l.id}async resolveExistingFileForUpload(t,e,a){const o=this.fileIdCache.get(t);if(o)return o;const i=await this.findChildByName(e,a);if(i){if(i.type==="file")return this.fileIdCache.set(t,i.id),i.id;throw new Error(`Box: "${t}" already exists as a non-file (${i.type})`)}}async performUpload(t,e,a,o){if(o.byteLength>j)return await this.client.chunkedUploads.uploadBigFile(g(o),a,o.byteLength,e);if(t){const l=((await this.client.uploads.uploadFileVersion(t,{attributes:{name:a},file:g(o)})).entries??[])[0];if(!l)throw new Error("Box: uploadFileVersion returned no file");return l}const i=((await this.client.uploads.uploadFile({attributes:{name:a,parent:{id:e}},file:g(o)})).entries??[])[0];if(!i)throw new Error("Box: uploadFile returned no file");return i}async ensureSharedLink(t){try{const e=(await this.client.sharedLinksFiles.addShareLinkToFile(t,{sharedLink:{access:"open"}},{fields:"shared_link"})).sharedLink;return(e?.downloadUrl??e?.url)||this.fetchSharedLinkUrl(t)}catch(e){if(E(e))return this.fetchSharedLinkUrl(t);throw e}}async fetchSharedLinkUrl(t){const e=(await this.client.sharedLinksFiles.getSharedLinkForFile(t,{fields:"shared_link"})).sharedLink,a=e?.downloadUrl??e?.url;if(!a)throw new Error("Box: file has no shared link. Call write() with publicByDefault: true, or addShareLinkToFile via storage.raw.");return a}internalOnComplete=d(t=>this.deleteMeta(t.id),"internalOnComplete")}export{ne as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var a=(e,t)=>n(e,"name",{value:t,configurable:!0});import r from"./File-BhfUgJjs.js";var u=Object.defineProperty,s=a((e,t)=>u(e,"name",{value:t,configurable:!0}),"e");class b extends r{static{a(this,"l")}static{s(this,"BunnyFile")}bunnyChecksum;bunnyPath}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var r=(t,e)=>a(t,"name",{value:e,configurable:!0});import{v as o}from"./local-meta-storage-CT1audnK.js";var s=Object.defineProperty,n=r((t,e)=>s(t,"name",{value:e,configurable:!0}),"e");class i extends o{static{r(this,"l")}static{n(this,"BunnyMetaStorage")}constructor(e){super(e)}}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=Object.defineProperty;var w=(n,t)=>T(n,"name",{value:t,configurable:!0});import*as c from"@bunny.net/storage-sdk";import{throwErrorCode as d,ERRORS as y,wrapStorageError as p}from"./ERRORS-CyOuSMLY.js";import{B as N}from"./storage-CoyB2O-Y.js";import m from"./BunnyFile-Dotl-lO9.js";import B from"./BunnyMetaStorage-D0mT6veJ.js";import{o as f,r as b}from"./part-match-B5fLLmFw.js";import{u as A}from"./update-size-DANV7aa2.js";import{o as _}from"./has-content-Bx2p8Okx.js";var R=Object.defineProperty,o=w((n,t)=>R(n,"name",{value:t,configurable:!0}),"o");const E=new Set(Object.values(c.regions.StorageRegion)),l=o(n=>`/${n.replace(/^\/+/u,"")}`,"toBunnyPath"),g=o(n=>n.replace(/^\/+/u,""),"fromBunnyPath"),U=o((n,t)=>{const e=n.replace(/\/+$/u,""),a=t.replace(/^\/+/u,"");return`${e}/${a}`},"joinPublicUrl"),C=o(async n=>{const t=[];for await(const e of n)t.push(Buffer.from(e));return Buffer.concat(t)},"collectStream"),S=o(n=>new ReadableStream({start(t){t.enqueue(new Uint8Array(n)),t.close()}}),"streamFromBuffer"),v=o(n=>{if(n){if(!E.has(n))throw new Error(`Bunny Storage: unsupported region "${n}". Pass one of ${[...E].join(", ")}.`);return n}},"parseRegion"),z=o(n=>{if(n.client)return n.client;const t=n.zone??process.env.BUNNY_STORAGE_ZONE??process.env.STORAGE_ZONE,e=n.accessKey??process.env.BUNNY_STORAGE_ACCESS_KEY??process.env.BUNNY_ACCESS_KEY??process.env.STORAGE_ACCESS_KEY,a=v(n.region??process.env.BUNNY_STORAGE_REGION??process.env.STORAGE_REGION);if(!t||!e||!a)throw new Error("Bunny Storage: missing credentials. Pass `zone` + `accessKey` + `region`, or set BUNNY_STORAGE_ZONE / BUNNY_STORAGE_ACCESS_KEY / BUNNY_STORAGE_REGION (SDK aliases: STORAGE_ZONE / STORAGE_ACCESS_KEY / STORAGE_REGION).");return c.zone.connect_with_accesskey(a,t,e)},"resolveClient"),P=o(async n=>Buffer.from(await new Response(n).arrayBuffer()),"collectFromWebStream"),h=o((n,t)=>{const e=n?.message,a=typeof e=="string"?e:"";return/^file not found/iu.test(a)?p(n,{adapter:"Bunny Storage",operation:t,status:404}):/^unauthorized access/iu.test(a)?p(n,{adapter:"Bunny Storage",operation:t,status:401}):/^unable to upload file/iu.test(a)?p(n,{adapter:"Bunny Storage",operation:t,status:400}):p(n,{adapter:"Bunny Storage",operation:t})},"wrapBunnyError");class L extends N{static name="bunny";checksumTypes=["SHA256"];meta;client;publicBaseUrl;zoneName;constructor(t){super(t),this.client=z(t),this.zoneName=c.zone.name(this.client),this.publicBaseUrl=t.publicBaseUrl,this.meta=t.metaStorage??new B(t.metaStorageConfig),this.isReady=!0}get raw(){return this.client}get zone(){return this.zoneName}async create(t){return this.instrumentOperation("create",async()=>{const e=new m(t);e.name=this.namingFunction(e),e.bunnyPath=l(e.name),await this.validate(e);try{const a=await this.getMeta(e.id);if(a.bytesWritten>=0)return a}catch{}return e.bytesWritten=0,e.status=f(e),await this.saveMeta(e),await this.onCreate(e),e})}async write(t){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(t.size!==void 0&&A(e,t.size),!b(t,e))throw new Error("File part does not match");const a=await this.lock(t.id);try{if(_(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const r=await C(t.body),s=l(e.name||e.id);try{await c.file.upload(this.client,s,S(r),{contentType:e.contentType,...t.checksum&&t.checksumAlgorithm==="sha256"&&{sha256Checksum:t.checksum}})}catch(i){throw h(i,"upload")}e.bytesWritten=r.length,e.size=r.length,e.bunnyPath=s}return e.status=f(e),e.status==="completed"&&await this.internalOnComplete(e),await this.saveMeta(e),e}finally{await this.unlock(t.id,a)}})}async delete({id:t}){return this.instrumentOperation("delete",async()=>{let e;try{e=await this.getMeta(t)}catch{}const a=e?.bunnyPath??l(e?.name??t);try{await c.file.remove(this.client,a)}catch(s){throw h(s,"delete")}if(e)return e.status="deleted",await this.deleteMeta(e.id),await this.onDelete(e),e;const r=new m({contentType:"application/octet-stream",metadata:{},originalName:t});return r.id=t,r.name=t,r.bunnyPath=a,r.status="deleted",r})}async get({id:t}){return this.instrumentOperation("get",async()=>{let e,a;try{e=await this.checkIfExpired(await this.getMeta(t)),a=e.bunnyPath??l(e.name??t)}catch{a=l(t)}let r;try{r=await c.file.get(this.client,a)}catch(i){throw h(i,"get")}let s;try{const i=await r.data();s=await P(i.stream)}catch(i){throw h(i,"download")}return{content:s,contentType:e?.contentType??r.contentType??"application/octet-stream",ETag:e?.ETag??r.checksum??void 0,expiredAt:e?.expiredAt,id:t,metadata:e?.metadata??{},modifiedAt:e?.modifiedAt??r.lastChanged?.toISOString(),name:e?.name??g(a),originalName:e?.originalName??g(a),size:e?.size??r.length??s.length}})}async copy(t,e){return this.instrumentOperation("copy",async()=>{const a=await this.get({id:t}),r=l(e),s=a.content,i=typeof a.size=="string"?Number(a.size):a.size??s.length;try{await c.file.upload(this.client,r,S(s),{contentType:a.contentType})}catch(O){throw h(O,"copy")}const u=new m({contentType:a.contentType,metadata:{},originalName:e});return u.id=e,u.name=e,u.bunnyPath=r,u.size=i,u.ETag=a.ETag,u.bunnyChecksum=a.ETag,u})}async move(t,e){return this.instrumentOperation("move",async()=>{const a=await this.copy(t,e);return await this.delete({id:t}),a})}async list(t=1e3){return this.instrumentOperation("list",async()=>{let e;try{e=await c.file.list(this.client,"/")}catch(a){throw h(a,"list")}return e.filter(a=>!a.isDirectory).slice(0,t).map(a=>{const r=a.path.endsWith(a.objectName)||!a.objectName?a.path:`${a.path.replace(/\/+$/u,"")}/${a.objectName}`,s=g(r),i=new m({contentType:a.contentType||"application/octet-stream",metadata:{},originalName:s});return i.id=s,i.name=s,i.bunnyPath=l(s),i.bunnyChecksum=a.checksum??void 0,i.ETag=a.checksum??void 0,i.size=a.length,i.modifiedAt=a.lastChanged?.toISOString(),i})},{limit:t})}async getReadUrl(t,e){return e?.responseContentDisposition?d(y.METHOD_NOT_ALLOWED,"Bunny Storage: `responseContentDisposition` is not supported — no override exists on Bunny Storage / Pull Zone URLs."):this.publicBaseUrl?U(this.publicBaseUrl,t):d(y.METHOD_NOT_ALLOWED,"Bunny Storage: `getReadUrl` requires `publicBaseUrl` (for example a Bunny Pull Zone or custom CDN hostname). The Storage API URL itself requires an AccessKey header and cannot be handed out as a public URL.")}async getUploadUrl(t,e){return d(y.METHOD_NOT_ALLOWED,"Bunny Storage: presigned PUT URLs are not supported — writes go through the Storage API with an AccessKey header. Upload server-side via the SDK or proxy through your application.")}internalOnComplete=o(t=>this.deleteMeta(t.id),"internalOnComplete")}export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:fs";import"node:fs/promises";import"node:stream";import"./local-meta-storage-CT1audnK.js";import{f as b}from"./disk-storage-CbSSPnOf.js";import"./path-D7rMc9nq-B718mbm6.js";import"./detect-file-type-5JhzC9RU.js";import"./ERRORS-CyOuSMLY.js";import"./storage-CoyB2O-Y.js";import"./File-BhfUgJjs.js";import"./part-match-B5fLLmFw.js";import"./update-size-DANV7aa2.js";import"./has-content-Bx2p8Okx.js";export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var o=(i,t)=>f(i,"name",{value:t,configurable:!0});import{createReadStream as g,createWriteStream as b}from"node:fs";import{truncate as w}from"node:fs/promises";import{Transform as E,pipeline as F}from"node:stream";import{f as C,y as v,m as W,s as R}from"./disk-storage-CbSSPnOf.js";import{y as S}from"./local-meta-storage-CT1audnK.js";import{d as T}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as p,ERRORS as n}from"./ERRORS-CyOuSMLY.js";import{LRUCache as N}from"lru-cache";import{createHash as O}from"node:crypto";import{u as k}from"./update-size-DANV7aa2.js";import{r as P,o as x}from"./part-match-B5fLLmFw.js";import{o as M}from"./has-content-Bx2p8Okx.js";var _=Object.defineProperty,I=o((i,t)=>_(i,"name",{value:t,configurable:!0}),"a");class L extends E{static{o(this,"n")}constructor(t,e){super(),this.path=e,this.hashes=t,this.hash=this.hashes.get(e)||O(this.hashes.algorithm),this.hashCopy=this.hash.copy()}path;static{I(this,"RangeChecksum")}hash;hashCopy;hashes;reset(){this.hashes.set(this.path,this.hashCopy)}digest(t="hex"){return this.hash.copy().digest(t)}_transform(t,e,s){this.push(t),this.hash.update(t),s()}_flush(t){t()}}var z=Object.defineProperty,U=o((i,t)=>z(i,"name",{value:t,configurable:!0}),"h");class A extends N{static{o(this,"p")}constructor(t="sha1",e){super({ttl:1e3,ttlAutopurge:!0,...e}),this.algorithm=t}algorithm;static{U(this,"RangeHasher")}hex(t){return this.get(t)?.copy().digest("hex")||""}base64(t){return this.get(t)?.copy().digest("base64")||""}async init(t,e=0){return this.get(t)?.copy()||this.updateFromFs(t,e)}digester(t){return new L(this,t)}async updateFromFs(t,e=0,s){const r=await this.fromFs(t,e,s);return this.set(t,r),r}fromFs(t,e=0,s){return new Promise((r,a)=>{const h=this.digester(t);s!==void 0&&(h.hash=s),g(t,{start:e}).on("error",a).on("end",()=>{r(h.hash)}).pipe(h).resume()})}}var H=Object.defineProperty,l=o((i,t)=>H(i,"name",{value:t,configurable:!0}),"d");class tt extends C{static{o(this,"O")}static{l(this,"DiskStorageWithChecksum")}hashes;constructor(t){super(t),this.hashes=new A(t?.checksum==="sha1"?"sha1":"md5")}async delete({id:t}){try{const e=await this.getMeta(t),s=this.getFilePath(e.name);this.hashes.delete(s),await S(s),await this.deleteMeta(t);const r={...e,status:"deleted"};return await this.onDelete(r),r}catch(e){this.logger?.error("[error]: Could not delete file: %O",e);const s=this.normalizeError(e instanceof Error?e:new Error(String(e)));await this.onError(s)}return{id:t}}async write(t){let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(t.size!==void 0&&k(e,t.size),!P(t,e))return p(n.FILE_CONFLICT);const s=this.getFilePath(e.name);try{const r=t.start||0;if(await v(s),(e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(e.bytesWritten=r),await this.hashes.init(s),M(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))return p(n.UNSUPPORTED_CHECKSUM_ALGORITHM);if((t.start===0||t.start===void 0)&&(e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(!e.contentType||e.contentType==="application/octet-stream"))try{const{fileType:m,stream:c}=await T(t.body);m?.mime&&(e.contentType=m.mime),t.body=c}catch{}const[a,h]=await this.lazyWrite({...t,...e});if(h)return await w(s,e.bytesWritten),p(h);typeof a!="number"&&await this.hashes.updateFromFs(s,e.bytesWritten),e.bytesWritten=a}return e.status=x(e),e.hash={algorithm:this.hashes.algorithm,value:this.hashes.hex(s)},e.status==="completed"&&this.hashes.delete(s),await this.saveMeta(e),e}catch(r){await this.hashes.updateFromFs(s,e.bytesWritten);const a=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(a),p(n.FILE_ERROR,(typeof a.message=="string"?a.message:String(r))||String(r))}}lazyWrite(t){return new Promise((e,s)=>{const r=this.getFilePath(t.name),a=b(r,{flags:"r+",start:t.start}),h=new W(t.contentLength||Number(t.size)-t.start),m=R(t.checksum,t.checksumAlgorithm),c=this.hashes.digester(r),y=!t.checksum,d=l(u=>{c.reset(),a.close(),e([Number.NaN,u])},"failWithCode");h.on("error",()=>{d(n.FILE_CONFLICT)}),m.on("error",()=>{d(n.CHECKSUM_MISMATCH)}),t.body.on("aborted",()=>{d(y?void 0:n.REQUEST_ABORTED)}),F(t.body,h,m,c,a,u=>{if(u){c.reset(),s(u);return}e([t.start+a.bytesWritten])})})}}export{tt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});import l from"./File-BhfUgJjs.js";var i=Object.defineProperty,o=t((e,r)=>i(e,"name",{value:r,configurable:!0}),"l");class b extends l{static{t(this,"e")}static{o(this,"DropboxFile")}path;publicUrl;rev}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});import{v as o}from"./local-meta-storage-CT1audnK.js";var s=Object.defineProperty,c=t((r,e)=>s(r,"name",{value:e,configurable:!0}),"e");class i extends o{static{t(this,"p")}static{c(this,"DropboxMetaStorage")}constructor(e){super(e)}}export{i as default};
|