@visulima/storage 1.0.0-alpha.30 → 1.0.0-alpha.31
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 +24 -0
- package/dist/adapter/nuxt/module.d.ts +4 -4
- package/dist/adapter/nuxt/node_modules/.bin/nuxi +2 -2
- package/dist/adapter/nuxt/node_modules/.bin/nuxt +2 -2
- package/dist/ai/ai-sdk/index.d.ts +3 -3
- package/dist/ai/claude/index.d.ts +2 -2
- package/dist/ai/openai/index.d.ts +3 -3
- package/dist/ai/tanstack/index.d.ts +2 -2
- package/dist/handler/http/fetch/index.d.ts +7 -7
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +4 -4
- 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 +5 -5
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AwsLightStorage-w21RxjUm.js → AwsLightStorage-DbQrK9m7.js} +1 -1
- package/dist/packem_shared/{AzureStorage-2kl7JDXs.js → AzureStorage-Cmr0nPDq.js} +1 -1
- package/dist/packem_shared/{BoxStorage-BUeEJoGL.js → BoxStorage-DYzAYPIr.js} +1 -1
- package/dist/packem_shared/{BunS3Storage-WM3rF6Fw.js → BunS3Storage-BvaFeKeu.js} +1 -1
- package/dist/packem_shared/{BunnyStorage-D3s2fRB3.js → BunnyStorage-DsQndiy5.js} +1 -1
- package/dist/packem_shared/{CloudinaryStorage-BBE2-aVz.js → CloudinaryStorage-DiK0T7N7.js} +1 -1
- package/dist/packem_shared/{DiskStorage-DL0GiG6k.js → DiskStorage-RvZNMWe7.js} +1 -1
- package/dist/packem_shared/{DiskStorageWithChecksum-BvUTn7O-.js → DiskStorageWithChecksum-eGOV3leX.js} +1 -1
- package/dist/packem_shared/{DropboxStorage-BL3OIdE_.js → DropboxStorage-Dfd78aJL.js} +1 -1
- package/dist/packem_shared/Files-CtggibJ-.js +1 -0
- package/dist/packem_shared/{FirebaseStorage-lXMXy3Pm.js → FirebaseStorage-C-FwZOYA.js} +1 -1
- package/dist/packem_shared/{FtpStorage-Dw94efNW.js → FtpStorage-DzaP89bG.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-udgXA5ia.js → GCSMetaStorage-DFIjFmn-.js} +1 -1
- package/dist/packem_shared/{GCStorage-ChY6uJuO.js → GCStorage-1vA3xkFO.js} +1 -1
- package/dist/packem_shared/{GoogleDriveStorage-C0NhBBWH.js → GoogleDriveStorage-D_RaKV_j.js} +1 -1
- package/dist/packem_shared/{Multipart-D9WIud9R.js → Multipart-C6Mw7V9W.js} +1 -1
- package/dist/packem_shared/{Multipart-CIFfQksD.js → Multipart-DkH4QwNs.js} +1 -1
- package/dist/packem_shared/{NetlifyBlobStorage-CO89TGvF.js → NetlifyBlobStorage-C-IkXF0_.js} +1 -1
- package/dist/packem_shared/{OneDriveStorage-jAN46vRm.js → OneDriveStorage-C7rqK2Wp.js} +1 -1
- package/dist/packem_shared/{PocketBaseStorage-DpOjOKAt.js → PocketBaseStorage-Cdgr5w88.js} +1 -1
- package/dist/packem_shared/{Rest-BuD3ySAg.js → Rest-DWrS4Z_j.js} +1 -1
- package/dist/packem_shared/{Rest-URrQ5FYM.js → Rest-DY1neM_3.js} +1 -1
- package/dist/packem_shared/{S3Storage-n1ohEZj4.js → S3Storage-Dn3l4WkO.js} +1 -1
- package/dist/packem_shared/{SftpStorage-Ban-WN8v.js → SftpStorage-CBW6MBLV.js} +1 -1
- package/dist/packem_shared/{SharePointStorage-BY90zh1c.js → SharePointStorage-r934t5HX.js} +1 -1
- package/dist/packem_shared/{SupabaseStorage-pNbHAE1Y.js → SupabaseStorage-DMRhLPNo.js} +1 -1
- package/dist/packem_shared/{Tus-TNG9HAY8.js → Tus-BMd67Cnb.js} +1 -1
- package/dist/packem_shared/{Tus-Fp_hx5ug.js → Tus-d2hPK5nV.js} +1 -1
- package/dist/packem_shared/{UploadThingStorage-BcmIE2dI.js → UploadThingStorage-BjF_gRMY.js} +1 -1
- package/dist/packem_shared/{VercelBlobStorage-s260zfFo.js → VercelBlobStorage-Dx2jywjl.js} +1 -1
- package/dist/packem_shared/{base-handler-core-BYDQditz.js → base-handler-core-Cwd9uq_E.js} +1 -1
- package/dist/packem_shared/{base-handler-fetch-DWzsPkmV.js → base-handler-fetch-_BD4V1W2.js} +1 -1
- package/dist/packem_shared/{base-handler-node-Dety2rQB.js → base-handler-node-BDNRnVIc.js} +1 -1
- package/dist/packem_shared/{defaultCloudStorageFileNameValidation-shIZX_7L.js → defaultCloudStorageFileNameValidation-hWLdEgOD.js} +1 -1
- package/dist/packem_shared/disk-storage-Bmvawf-b.js +1 -0
- package/dist/packem_shared/{disk-storage-with-checksum.d-mHcg2uLw.d.ts → disk-storage-with-checksum.d-Dm4agCey.d.ts} +1 -1
- package/dist/packem_shared/{executors.d-X4hz3zfu.d.ts → executors.d-Cut3Gstb.d.ts} +1 -1
- package/dist/packem_shared/{gcs-meta-storage-mZiqlX-9.js → gcs-meta-storage-Bwts-MUe.js} +1 -1
- package/dist/packem_shared/index.d-DSZjPbvW.d.ts +230 -0
- package/dist/packem_shared/{local-meta-storage.d-B11vHYNm.d.ts → local-meta-storage.d-qZQI1JUe.d.ts} +1 -1
- package/dist/packem_shared/{media-transformer.d-C3QvECD7.d.ts → media-transformer.d-lQ_RUjb5.d.ts} +2 -2
- package/dist/packem_shared/{rest-base-DI7xFXr5.js → rest-base-C-a7pXUc.js} +1 -1
- package/dist/packem_shared/{s3-base-storage-Dbexfg7p.js → s3-base-storage-Ek1HinGR.js} +1 -1
- package/dist/packem_shared/{s3-base-storage.d-V3N2nKCt.d.ts → s3-base-storage.d-CDIOMTpp.d.ts} +1 -1
- package/dist/packem_shared/storage-B-NDsI-o.js +1 -0
- package/dist/packem_shared/{storage.d-RteRC-cG.d.ts → storage.d-BoJgdi1n.d.ts} +19 -14
- package/dist/packem_shared/{tus-base.d-CygntIPM.d.ts → tus-base.d-C28C_AY9.d.ts} +3 -3
- package/dist/packem_shared/{types.d-ChNXbbHG.d.ts → types.d-C0MDnUYc.d.ts} +1 -1
- package/dist/packem_shared/{types.d-cI_cMxcZ.d.ts → types.d-CPxJpoPH.d.ts} +2 -2
- package/dist/packem_shared/{types.d-DxonY4XS.d.ts → types.d-DCPQvHDI.d.ts} +2 -2
- package/dist/storage/aws/index.d.ts +2 -2
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +2 -2
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +1 -1
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +2 -2
- package/dist/storage/box/index.js +1 -1
- package/dist/storage/bun-s3/index.d.ts +2 -2
- package/dist/storage/bun-s3/index.js +1 -1
- package/dist/storage/bunny/index.d.ts +2 -2
- package/dist/storage/bunny/index.js +1 -1
- package/dist/storage/cloudinary/index.d.ts +2 -2
- package/dist/storage/cloudinary/index.js +1 -1
- package/dist/storage/dropbox/index.d.ts +2 -2
- package/dist/storage/dropbox/index.js +1 -1
- package/dist/storage/firebase/index.d.ts +2 -2
- package/dist/storage/firebase/index.js +1 -1
- package/dist/storage/ftp/index.d.ts +2 -2
- package/dist/storage/ftp/index.js +1 -1
- package/dist/storage/gcs/index.d.ts +1 -1
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +2 -2
- package/dist/storage/google-drive/index.js +1 -1
- 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 +2 -2
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +4 -4
- package/dist/storage/onedrive/index.js +1 -1
- package/dist/storage/pocketbase/index.d.ts +2 -2
- package/dist/storage/pocketbase/index.js +1 -1
- package/dist/storage/sftp/index.d.ts +2 -2
- package/dist/storage/sftp/index.js +1 -1
- package/dist/storage/sharepoint/index.d.ts +3 -3
- package/dist/storage/sharepoint/index.js +1 -1
- package/dist/storage/supabase/index.d.ts +2 -2
- package/dist/storage/supabase/index.js +1 -1
- package/dist/storage/uploadthing/index.d.ts +2 -2
- package/dist/storage/uploadthing/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +2 -2
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +2 -2
- package/dist/transformer/image-transformer.d.ts +2 -2
- package/dist/transformer/index.d.ts +3 -3
- package/dist/transformer/video-transformer.d.ts +2 -2
- package/package.json +1 -1
- package/dist/packem_shared/Files-CJh9_N-9.js +0 -1
- package/dist/packem_shared/disk-storage-CKAJvhcj.js +0 -1
- package/dist/packem_shared/index.d-C4Fivh4I.d.ts +0 -94
- package/dist/packem_shared/storage-Dh0tJh7j.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/AzureFile-Dgj2Tef4.js";import{b as t}from"../../packem_shared/azure-meta-storage-C4SrMtT2.js";import{default as u}from"../../packem_shared/AzureStorage-
|
|
1
|
+
import{default as a}from"../../packem_shared/AzureFile-Dgj2Tef4.js";import{b as t}from"../../packem_shared/azure-meta-storage-C4SrMtT2.js";import{default as u}from"../../packem_shared/AzureStorage-Cmr0nPDq.js";export{a as AzureFile,t as AzureSMetaStorage,u as AzureStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { BoxClient } from 'box-typescript-sdk-gen';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/BoxFile-Be0S4N1L.js";import{default as r}from"../../packem_shared/BoxMetaStorage-DLdXbZaV.js";import{default as x}from"../../packem_shared/BoxStorage-
|
|
1
|
+
import{default as a}from"../../packem_shared/BoxFile-Be0S4N1L.js";import{default as r}from"../../packem_shared/BoxMetaStorage-DLdXbZaV.js";import{default as x}from"../../packem_shared/BoxStorage-DYzAYPIr.js";export{a as BoxFile,r as BoxMetaStorage,x as BoxStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/BunS3File-D-SRiyrm.js";import{default as r}from"../../packem_shared/BunS3MetaStorage-Bv_CTTMz.js";import{default as u}from"../../packem_shared/BunS3Storage-
|
|
1
|
+
import{default as t}from"../../packem_shared/BunS3File-D-SRiyrm.js";import{default as r}from"../../packem_shared/BunS3MetaStorage-Bv_CTTMz.js";import{default as u}from"../../packem_shared/BunS3Storage-BvaFeKeu.js";export{t as BunS3File,r as BunS3MetaStorage,u as BunS3Storage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import * as BunnyStorageSDK from '@bunny.net/storage-sdk';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/BunnyFile-Dotl-lO9.js";import{default as r}from"../../packem_shared/BunnyMetaStorage-DNMTSeoN.js";import{default as n}from"../../packem_shared/BunnyStorage-
|
|
1
|
+
import{default as t}from"../../packem_shared/BunnyFile-Dotl-lO9.js";import{default as r}from"../../packem_shared/BunnyMetaStorage-DNMTSeoN.js";import{default as n}from"../../packem_shared/BunnyStorage-DsQndiy5.js";export{t as BunnyFile,r as BunnyMetaStorage,n as BunnyStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { v2 } from 'cloudinary';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/CloudinaryFile-B5-m33eS.js";import{default as t}from"../../packem_shared/CloudinaryMetaStorage-DEBk5eQy.js";import{default as d}from"../../packem_shared/CloudinaryStorage-
|
|
1
|
+
import{default as r}from"../../packem_shared/CloudinaryFile-B5-m33eS.js";import{default as t}from"../../packem_shared/CloudinaryMetaStorage-DEBk5eQy.js";import{default as d}from"../../packem_shared/CloudinaryStorage-DiK0T7N7.js";export{r as CloudinaryFile,t as CloudinaryMetaStorage,d as CloudinaryStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { Dropbox } from 'dropbox';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../packem_shared/DropboxFile-BGVG2kXM.js";import{default as t}from"../../packem_shared/DropboxMetaStorage-C6vj1QDA.js";import{default as p}from"../../packem_shared/DropboxStorage-
|
|
1
|
+
import{default as e}from"../../packem_shared/DropboxFile-BGVG2kXM.js";import{default as t}from"../../packem_shared/DropboxMetaStorage-C6vj1QDA.js";import{default as p}from"../../packem_shared/DropboxStorage-Dfd78aJL.js";export{e as DropboxFile,t as DropboxMetaStorage,p as DropboxStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/FirebaseFile-JEu3plMP.js";import{default as o}from"../../packem_shared/FirebaseMetaStorage-CzyOim-J.js";import{default as s}from"../../packem_shared/FirebaseStorage-
|
|
1
|
+
import{default as r}from"../../packem_shared/FirebaseFile-JEu3plMP.js";import{default as o}from"../../packem_shared/FirebaseMetaStorage-CzyOim-J.js";import{default as s}from"../../packem_shared/FirebaseStorage-C-FwZOYA.js";export{r as FirebaseFile,o as FirebaseMetaStorage,s as FirebaseStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { AccessOptions } from 'basic-ftp';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/FtpFile-B8jaICTB.js";import{default as r}from"../../packem_shared/FtpMetaStorage-1Njy0DpU.js";import{default as p}from"../../packem_shared/FtpStorage-
|
|
1
|
+
import{default as a}from"../../packem_shared/FtpFile-B8jaICTB.js";import{default as r}from"../../packem_shared/FtpMetaStorage-1Njy0DpU.js";import{default as p}from"../../packem_shared/FtpStorage-DzaP89bG.js";export{a as FtpFile,r as FtpMetaStorage,p as FtpStorage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as File, t as MetaStorageOptions, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, H as HttpError, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, t as MetaStorageOptions, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, H as HttpError, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
3
|
import { RetryConfig } from 'gaxios';
|
|
4
4
|
import { GoogleAuthOptions, GoogleAuth } from 'google-auth-library';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/GCSConfig-BQ0OpVhe.js";import{default as t}from"../../packem_shared/GCSFile-CDQ6IWAz.js";import{E as C}from"../../packem_shared/gcs-meta-storage-
|
|
1
|
+
import{default as a}from"../../packem_shared/GCSConfig-BQ0OpVhe.js";import{default as t}from"../../packem_shared/GCSFile-CDQ6IWAz.js";import{E as C}from"../../packem_shared/gcs-meta-storage-Bwts-MUe.js";import{default as l}from"../../packem_shared/GCStorage-1vA3xkFO.js";export{a as GCSConfig,t as GCSFile,C as GCSMetaStorage,l as GCStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { drive_v3 } from '@googleapis/drive';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/GoogleDriveFile-D0aGfGbL.js";import{default as t}from"../../packem_shared/GoogleDriveMetaStorage-WGuUZPyx.js";import{default as f}from"../../packem_shared/GoogleDriveStorage-
|
|
1
|
+
import{default as r}from"../../packem_shared/GoogleDriveFile-D0aGfGbL.js";import{default as t}from"../../packem_shared/GoogleDriveMetaStorage-WGuUZPyx.js";import{default as f}from"../../packem_shared/GoogleDriveStorage-D_RaKV_j.js";export{r as GoogleDriveFile,t as GoogleDriveMetaStorage,f as GoogleDriveStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { D as DiskStorage, a as DiskStorageWithChecksum } from "../../packem_shared/disk-storage-with-checksum.d-
|
|
2
|
-
export { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
-
export { type L as LocalMetaStorageOptions } from "../../packem_shared/storage.d-
|
|
1
|
+
export { D as DiskStorage, a as DiskStorageWithChecksum } from "../../packem_shared/disk-storage-with-checksum.d-Dm4agCey.js";
|
|
2
|
+
export { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
3
|
+
export { type L as LocalMetaStorageOptions } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"../../packem_shared/disk-storage-
|
|
1
|
+
import{f as e}from"../../packem_shared/disk-storage-Bmvawf-b.js";import{default as t}from"../../packem_shared/DiskStorageWithChecksum-eGOV3leX.js";import{v as f}from"../../packem_shared/local-meta-storage-Bi0mK6gD.js";export{e as DiskStorage,t as DiskStorageWithChecksum,f as LocalMetaStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, R as RetryConfig, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, R as RetryConfig, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { getStore } from '@netlify/blobs';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../packem_shared/NetlifyBlobFile-PMZLJ8AC.js";import{default as a}from"../../packem_shared/NetlifyBlobMetaStorage-ClIFdTkT.js";import{default as r}from"../../packem_shared/NetlifyBlobStorage-
|
|
1
|
+
import{default as o}from"../../packem_shared/NetlifyBlobFile-PMZLJ8AC.js";import{default as a}from"../../packem_shared/NetlifyBlobMetaStorage-ClIFdTkT.js";import{default as r}from"../../packem_shared/NetlifyBlobStorage-C-IkXF0_.js";export{o as NetlifyBlobFile,a as NetlifyBlobMetaStorage,r as NetlifyBlobStorage};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as OneDriveFile, a as OneDriveStorageOptions } from "../../packem_shared/types.d-
|
|
2
|
-
export { type b as OneDriveClientCredentialsAuth, type c as OneDriveOAuthRefreshAuth } from "../../packem_shared/types.d-
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
4
|
-
import { L as LocalMetaStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { O as OneDriveFile, a as OneDriveStorageOptions } from "../../packem_shared/types.d-C0MDnUYc.js";
|
|
2
|
+
export { type b as OneDriveClientCredentialsAuth, type c as OneDriveOAuthRefreshAuth } from "../../packem_shared/types.d-C0MDnUYc.js";
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
|
+
import { L as LocalMetaStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
5
5
|
import { Client } from '@microsoft/microsoft-graph-client';
|
|
6
6
|
import 'node:stream';
|
|
7
7
|
import 'node:crypto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/OneDriveFile-XbVVKIJh.js";import{default as o}from"../../packem_shared/OneDriveMetaStorage-DS4f83X2.js";import{default as i}from"../../packem_shared/OneDriveStorage-
|
|
1
|
+
import{default as a}from"../../packem_shared/OneDriveFile-XbVVKIJh.js";import{default as o}from"../../packem_shared/OneDriveMetaStorage-DS4f83X2.js";import{default as i}from"../../packem_shared/OneDriveStorage-C7rqK2Wp.js";export{a as OneDriveFile,o as OneDriveMetaStorage,i as OneDriveStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/PocketBaseFile-CkAiSBb0.js";import{default as r}from"../../packem_shared/PocketBaseMetaStorage-B6utPncj.js";import{default as s}from"../../packem_shared/PocketBaseStorage-
|
|
1
|
+
import{default as t}from"../../packem_shared/PocketBaseFile-CkAiSBb0.js";import{default as r}from"../../packem_shared/PocketBaseMetaStorage-B6utPncj.js";import{default as s}from"../../packem_shared/PocketBaseStorage-Cdgr5w88.js";export{t as PocketBaseFile,r as PocketBaseMetaStorage,s as PocketBaseStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { ConnectOptions } from 'ssh2-sftp-client';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/SftpFile-CQCxZNVq.js";import{default as o}from"../../packem_shared/SftpMetaStorage-DYqXwCdM.js";import{default as p}from"../../packem_shared/SftpStorage-
|
|
1
|
+
import{default as a}from"../../packem_shared/SftpFile-CQCxZNVq.js";import{default as o}from"../../packem_shared/SftpMetaStorage-DYqXwCdM.js";import{default as p}from"../../packem_shared/SftpStorage-CBW6MBLV.js";export{a as SftpFile,o as SftpMetaStorage,p as SftpStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as OneDriveFile, a as OneDriveStorageOptions } from "../../packem_shared/types.d-
|
|
2
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
-
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { O as OneDriveFile, a as OneDriveStorageOptions } from "../../packem_shared/types.d-C0MDnUYc.js";
|
|
2
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
3
|
+
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
4
4
|
import { Readable } from 'node:stream';
|
|
5
5
|
import { Client } from '@microsoft/microsoft-graph-client';
|
|
6
6
|
import 'node:crypto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/SharePointFile-BA6X9Sxr.js";import{default as r}from"../../packem_shared/SharePointMetaStorage-DVM5-X6g.js";import{default as S}from"../../packem_shared/SharePointStorage-
|
|
1
|
+
import{default as t}from"../../packem_shared/SharePointFile-BA6X9Sxr.js";import{default as r}from"../../packem_shared/SharePointMetaStorage-DVM5-X6g.js";import{default as S}from"../../packem_shared/SharePointStorage-r934t5HX.js";export{t as SharePointFile,r as SharePointMetaStorage,S as SharePointStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { StorageClient } from '@supabase/storage-js';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/SupabaseFile-DZ1iv9gM.js";import{default as r}from"../../packem_shared/SupabaseMetaStorage-ivXoYVUu.js";import{default as p}from"../../packem_shared/SupabaseStorage-
|
|
1
|
+
import{default as t}from"../../packem_shared/SupabaseFile-DZ1iv9gM.js";import{default as r}from"../../packem_shared/SupabaseMetaStorage-ivXoYVUu.js";import{default as p}from"../../packem_shared/SupabaseStorage-DMRhLPNo.js";export{t as SupabaseFile,r as SupabaseMetaStorage,p as SupabaseStorage};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UTApi } from 'uploadthing/server';
|
|
2
|
-
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, F as File, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
2
|
+
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, F as File, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
4
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
import 'lru-cache';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../packem_shared/UploadThingFile-BpG9mE8K.js";import{default as r}from"../../packem_shared/UploadThingMetaStorage-BvKNzgm7.js";import{default as d}from"../../packem_shared/UploadThingStorage-
|
|
1
|
+
import{default as e}from"../../packem_shared/UploadThingFile-BpG9mE8K.js";import{default as r}from"../../packem_shared/UploadThingMetaStorage-BvKNzgm7.js";import{default as d}from"../../packem_shared/UploadThingStorage-BjF_gRMY.js";export{e as UploadThingFile,r as UploadThingMetaStorage,d as UploadThingStorage};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, F as File, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { L as LocalMetaStorageOptions, i as BaseStorageOptions, F as File, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-qZQI1JUe.js";
|
|
4
4
|
import { copy, del, list, put } from '@vercel/blob';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/VercelBlobFile-Cni_1qwD.js";import{default as a}from"../../packem_shared/VercelBlobMetaStorage-CwaqWucZ.js";import{default as f}from"../../packem_shared/VercelBlobStorage-
|
|
1
|
+
import{default as r}from"../../packem_shared/VercelBlobFile-Cni_1qwD.js";import{default as a}from"../../packem_shared/VercelBlobMetaStorage-CwaqWucZ.js";import{default as f}from"../../packem_shared/VercelBlobStorage-Dx2jywjl.js";export{r as VercelBlobFile,a as VercelBlobMetaStorage,f as VercelBlobStorage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-
|
|
2
|
-
import {
|
|
1
|
+
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
|
+
import { s as AudioTransformerConfig, t as AudioTransformResult, u as AudioResampleOptions, v as AudioChannelMixOptions, w as AudioTransformOptions, x as AudioTransformationStep, r as BaseTransformer } from "../packem_shared/types.d-DCPQvHDI.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-
|
|
3
|
-
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions,
|
|
2
|
+
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-BoJgdi1n.js";
|
|
3
|
+
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions, a as RotateOptions, b as ImageFormat, c as TransformOptions, S as SharpenOptions, B as BlurOptions, M as MedianOptions, d as CLAHEOptions, e as ConvolveOptions, f as ThresholdOptions, g as BooleanOptions, L as LinearOptions, h as RecombineOptions, i as ModulateOptions, j as TintOptions, G as GreyscaleOptions, k as ColourspaceOptions, E as ExtractChannelOptions, J as JoinChannelOptions, l as BandboolOptions, A as AffineOptions, D as DilateOptions, m as ErodeOptions, P as PipelineColourspaceOptions, n as ToColourspaceOptions, o as RemoveAlphaOptions, p as EnsureAlphaOptions, q as TransformationStep, r as BaseTransformer } from "../packem_shared/types.d-DCPQvHDI.js";
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { type
|
|
2
|
-
export { M as MediaTransformer } from "../packem_shared/media-transformer.d-
|
|
3
|
-
import { a as FileReturn } from "../packem_shared/storage.d-
|
|
1
|
+
export { type v as AudioChannelMixOptions, type u as AudioResampleOptions, type w as AudioTransformOptions, type t as AudioTransformResult, type x as AudioTransformationStep, type s as AudioTransformerConfig, r as BaseTransformer, type C as CropOptions, type b as ImageFormat, type I as ImageTransformerConfig, type U as MediaTransformQuery, type Q as MediaTransformResult, type W as MediaTransformationStep, type O as MediaTransformerConfig, type R as ResizeOptions, type a as RotateOptions, type c as TransformOptions, type T as TransformResult, type q as TransformationStep, type F as VideoCropOptions, type z as VideoResizeOptions, type H as VideoRotateOptions, type K as VideoTransformOptions, type y as VideoTransformResult, type N as VideoTransformationStep, type V as VideoTransformerConfig } from "../packem_shared/types.d-DCPQvHDI.js";
|
|
2
|
+
export { M as MediaTransformer } from "../packem_shared/media-transformer.d-lQ_RUjb5.js";
|
|
3
|
+
import { a as FileReturn } from "../packem_shared/storage.d-BoJgdi1n.js";
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-
|
|
2
|
-
import { V as VideoTransformerConfig,
|
|
1
|
+
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-BoJgdi1n.js";
|
|
2
|
+
import { V as VideoTransformerConfig, y as VideoTransformResult, z as VideoResizeOptions, F as VideoCropOptions, H as VideoRotateOptions, K as VideoTransformOptions, N as VideoTransformationStep, r as BaseTransformer } from "../packem_shared/types.d-DCPQvHDI.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/storage",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.31",
|
|
4
4
|
"description": "Visulima upload - Store files in a web-accessible location via a simplified API. Can automatically scale and rotate images. Includes S3, Azure, GCS and local filesystem-based backends with the most convenient features of each.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var b=Object.defineProperty;var c=(e,t)=>b(e,"name",{value:t,configurable:!0});import{Readable as n}from"node:stream";import{B as s}from"./storage-Dh0tJh7j.js";var g=Object.defineProperty,o=c((e,t)=>g(e,"name",{value:t,configurable:!0}),"f");const h=o(e=>typeof e=="object"&&e!==null&&typeof e.getReader=="function","isWebReadableStream"),z=o(e=>typeof e=="object"&&e!==null&&typeof e.pipe=="function"&&typeof e.read=="function","isNodeReadable"),w=o(async(e,t)=>{if(typeof e=="string"){const a=Buffer.from(e);return{size:a.byteLength,stream:n.from(a)}}if(Buffer.isBuffer(e))return{size:e.byteLength,stream:n.from(e)};if(e instanceof Uint8Array){const a=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return{size:a.byteLength,stream:n.from(a)}}if(e instanceof ArrayBuffer){const a=Buffer.from(e);return{size:a.byteLength,stream:n.from(a)}}if(ArrayBuffer.isView(e)){const a=e,r=Buffer.from(a.buffer,a.byteOffset,a.byteLength);return{size:r.byteLength,stream:n.from(r)}}if(typeof Blob<"u"&&e instanceof Blob)return{size:e.size,stream:n.fromWeb(e.stream())};if(h(e))return{size:t,stream:n.fromWeb(e)};if(z(e))return{size:t,stream:e};throw new TypeError(`Unsupported body type: ${Object.prototype.toString.call(e)}`)},"normalizeBody"),d=o((e,t)=>({contentType:e.contentType??"application/octet-stream",etag:e.ETag,key:e.name||e.id||t||"",lastModified:e.modifiedAt??e.createdAt,metadata:e.metadata,size:typeof e.size=="number"?e.size:void 0}),"toFileObject");class I{static{c(this,"Files")}static{o(this,"Files")}adapter;constructor(t){this.adapter=t.adapter}get raw(){return this.adapter.raw}async upload(t,a,r={}){s.assertSafeId(t);const{size:i,stream:p}=await w(a,r.size),f=r.size??i,y={...r.metadata??{},name:t,...r.contentType?{type:r.contentType}:{},...f===void 0?{}:{size:f}},m=await this.adapter.create({contentType:r.contentType,id:t,metadata:y,originalName:t,size:f,storageClass:r.storageClass}),u={body:p,contentLength:f,id:m.id,start:0},l=await this.adapter.write(u);return d(l,t)}async download(t){s.assertSafeId(t);const a=await this.adapter.get({id:t});return{body:a.content,contentType:a.contentType??"application/octet-stream",etag:a.ETag,key:t,lastModified:a.modifiedAt,metadata:a.metadata,size:typeof a.size=="number"?a.size:void 0}}async head(t){s.assertSafeId(t);const a=await this.adapter.getMeta(t);return d(a,t)}async exists(t){return s.assertSafeId(t),this.adapter.exists({id:t})}async delete(t){s.assertSafeId(t),await this.adapter.delete({id:t})}async copy(t,a,r){s.assertSafeId(t),s.assertSafeId(a);const i=await this.adapter.copy(t,a,r);return d(i,a)}async list(t={}){const a=(await this.adapter.list(t.limit??1e3)).map(r=>{const i=d(r);return i.key.startsWith("/")&&(i.key=i.key.slice(1)),i});return t.prefix?a.filter(r=>r.key.startsWith(t.prefix)):a}async url(t,a){return s.assertSafeId(t),this.adapter.getReadUrl(t,a)}async signedUploadUrl(t,a){return s.assertSafeId(t),this.adapter.getUploadUrl(t,a)}}export{I as Files,I as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var ct=Object.defineProperty;var d=(e,t)=>ct(e,"name",{value:t,configurable:!0});import{createReadStream as lt,createWriteStream as ut}from"node:fs";import{truncate as mt,stat as C,copyFile as A}from"node:fs/promises";import{Transform as Q,PassThrough as dt,pipeline as ht}from"node:stream";import{f as x,l as yt,w as H,U as b,_ as ft,i as gt,v as pt,B as wt,y as z}from"./local-meta-storage-Bi0mK6gD.js";import{createRequire as P}from"node:module";import{K as w,C as F,M as K,L as bt,Q as vt,O as Et}from"./path-D7rMc9nq-B718mbm6.js";import{S as St}from"./index-B4ETk0Lu.js";import{d as $t}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as p,ERRORS as h,isUploadError as Ot}from"./ERRORS-CyOuSMLY.js";import{createHash as Tt}from"node:crypto";import{B as Ft,a as kt,t as Nt}from"./storage-Dh0tJh7j.js";import Pt from"./File-BhfUgJjs.js";import{o as W,r as Dt}from"./part-match-B5fLLmFw.js";import{u as _t}from"./update-size-DANV7aa2.js";import{o as It}from"./has-content-Bx2p8Okx.js";var Mt=Object.defineProperty,Rt=d((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"i$4"),xt=Object.defineProperty,X=Rt((e,t)=>xt(e,"name",{value:t,configurable:!0}),"t");const Lt=P(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,jt=X(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,r]=$.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return $.getBuiltinModule(e)}return Lt(e)},"__cjs_getBuiltinModule"),{lstat:Ct,writeFile:At}=jt("node:fs/promises");var zt=Object.defineProperty,Wt=X((e,t)=>zt(e,"name",{value:t,configurable:!0}),"o");const R=Wt(async e=>{x(e);try{const t=await Ct(e);if(!t.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(yt(t))}'`)}catch(t){if(t.code==="ENOENT"){await H(w(b(e))),await At(e,new Uint8Array);return}throw t}},"ensureFile");var Bt=Object.defineProperty,q=d((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"t$2"),Ut=Object.defineProperty,Y=q((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"t"),Vt=Object.defineProperty,Qt=Y((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"t");let B=class extends Error{static{d(this,"l")}static{q(this,"c")}static{Y(this,"i")}static{Qt(this,"WalkError")}root;constructor(t,r){super(`${t instanceof Error?t.message:String(t)} for path "${r}"`),this.cause=t,this.root=r}get name(){return"WalkError"}set name(t){throw new Error("Cannot overwrite name of WalkError")}};var Ht=Object.defineProperty,Kt=d((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"n"),Xt=Object.defineProperty,G=Kt((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"t"),qt=Object.defineProperty,Yt=G((e,t)=>qt(e,"name",{value:t,configurable:!0}),"g");const U=Yt(e=>{const t=e.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`).replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${t}$`)},"globToRegExp");var Gt=Object.defineProperty,Jt=G((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"n");const N=Jt((e,t,r,i)=>Array.isArray(t)&&t.length>0&&!t.some(n=>e.endsWith(n))||r&&!r.some(n=>n.test(e))?!1:!i?.some(n=>n.test(e)),"walkInclude");var Zt=Object.defineProperty,J=d((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"u$1"),te=Object.defineProperty,L=J((e,t)=>te(e,"name",{value:t,configurable:!0}),"y");const ee=P(import.meta.url),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=L(e=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[t,r]=O.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return O.getBuiltinModule(e)}return ee(e)},"__cjs_getBuiltinModule"),{readdir:ie,realpath:ae,stat:se}=re("node:fs/promises");var ne=Object.defineProperty,g=L((e,t)=>ne(e,"name",{value:t,configurable:!0}),"r");const oe=g(async e=>{const t=bt(e),r=vt(t),i=await se(t);return{isDirectory:g(()=>i.isDirectory(),"isDirectory"),isFile:g(()=>i.isFile(),"isFile"),isSymbolicLink:g(()=>i.isSymbolicLink(),"isSymbolicLink"),name:r,path:t}},"_createWalkEntry");async function*k(e,{extensions:t,followSymlinks:r=!1,includeDirs:i=!0,includeFiles:n=!0,includeSymlinks:a=!0,match:s,maxDepth:l=Number.POSITIVE_INFINITY,skip:m}={}){if(x(e),l<0)return;const u=s?s.map(o=>typeof o=="string"?U(o):o):void 0,y=m?m.map(o=>typeof o=="string"?U(o):o):void 0;if(e=F(b(e)),i&&N(e,t,u,y)&&(yield await oe(e)),!(l<1||!N(e,void 0,void 0,y)))try{const o=await ie(e,{withFileTypes:!0});for(const c of o){let f=K(e,c.name);if(c.isSymbolicLink())if(r)f=await ae(f);else if(a&&N(f,t,u,y)){yield{isDirectory:g(()=>c.isDirectory(),"isDirectory"),isFile:g(()=>c.isFile(),"isFile"),isSymbolicLink:g(()=>c.isSymbolicLink(),"isSymbolicLink"),name:c.name,path:f};continue}else continue;c.isDirectory()?yield*k(f,{extensions:t,followSymlinks:r,includeDirs:i,includeFiles:n,includeSymlinks:a,match:u,maxDepth:l-1,skip:y}):c.isFile()&&n&&N(f,t,u,y)&&(yield{isDirectory:g(()=>c.isDirectory(),"isDirectory"),isFile:g(()=>c.isFile(),"isFile"),isSymbolicLink:g(()=>c.isSymbolicLink(),"isSymbolicLink"),name:c.name,path:f})}}catch(o){throw o instanceof B?o:new B(o,e)}}d(k,"f$2");J(k,"D");L(k,"g");g(k,"walk");var ce=Object.defineProperty,Z=d((e,t)=>ce(e,"name",{value:t,configurable:!0}),"t"),le=Object.defineProperty,j=Z((e,t)=>le(e,"name",{value:t,configurable:!0}),"t");const ue=P(import.meta.url),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,me=j(e=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[t,r]=T.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return T.getBuiltinModule(e)}return ue(e)},"__cjs_getBuiltinModule"),{accessSync:de}=me("node:fs");var he=Object.defineProperty,ye=j((e,t)=>he(e,"name",{value:t,configurable:!0}),"o");function D(e,t=ft){x(e),e=b(e);try{return de(e,t),!0}catch{return!1}}d(D,"i$1");Z(D,"d");j(D,"m");ye(D,"isAccessibleSync");var fe=Object.defineProperty,tt=d((e,t)=>fe(e,"name",{value:t,configurable:!0}),"v"),ge=Object.defineProperty,S=tt((e,t)=>ge(e,"name",{value:t,configurable:!0}),"i");const pe=P(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,et=S(e=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[t,r]=v.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return v.getBuiltinModule(e)}return pe(e)},"__cjs_getBuiltinModule"),{cwd:_}=v,{mkdir:we,rename:be,copyFile:ve,unlink:Ee}=et("node:fs/promises"),{mkdirSync:Se,renameSync:$e,copyFileSync:Oe,unlinkSync:Te}=et("node:fs");var Fe=Object.defineProperty,rt=S((e,t)=>Fe(e,"name",{value:t,configurable:!0}),"o");class ke extends Error{static{d(this,"V")}static{tt(this,"O")}static{S(this,"a")}static{rt(this,"SameDirectoryError")}constructor(t,r){super(`Source directory "${w(t)}" does not match destination directory "${w(r)}"`),this.name="SameDirectoryError"}}const it=rt((e,t)=>{if(!e||!t)throw new Error("Source and destination paths must not be empty");if(w(e)!==w(t))throw new ke(e,t)},"validateSameDirectory");var Ne=Object.defineProperty,Pe=S((e,t)=>Ne(e,"name",{value:t,configurable:!0}),"m$1");const at=Pe(async(e,t,{cwd:r,directoryMode:i,overwrite:n,validateDirectory:a})=>{if(r&&(e=F(r,e),t=F(r,t)),a&&it(e,t),!n&&await gt(t))throw new Error(`The destination file exists: ${t}`);await we(w(t),{mode:i,recursive:!0});try{await be(e,t)}catch(s){if(s.code==="EXDEV")await ve(e,t),await Ee(e);else throw s}},"internalMoveFile");var De=Object.defineProperty,_e=S((e,t)=>De(e,"name",{value:t,configurable:!0}),"m");const st=_e((e,t,{cwd:r,directoryMode:i,overwrite:n,validateDirectory:a})=>{if(r&&(e=F(r,e),t=F(r,t)),a&&it(e,t),!n&&D(t))throw new Error(`The destination file exists: ${t}`);Se(w(t),{mode:i,recursive:!0});try{$e(e,t)}catch(s){if(s.code==="EXDEV")Oe(e,t),Te(e);else throw s}},"internalMoveFileSync");var Ie=Object.defineProperty,I=S((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"i");const Me=I(async(e,t,r={})=>{const i={overwrite:!0,validateDirectory:!1,...r,cwd:r.cwd?b(r.cwd):_()};await at(e,t,i)},"move");I((e,t,r)=>{const i={overwrite:!0,validateDirectory:!1,...r};i.cwd=i.cwd?b(i.cwd):_(),st(e,t,i)},"moveSync");I(async(e,t,r)=>{const i={overwrite:!0,...r,validateDirectory:!0};i.cwd=i.cwd?b(i.cwd):_(),await at(e,t,i)},"rename");I((e,t,r)=>{const i={overwrite:!0,...r,validateDirectory:!0};i.cwd=i.cwd?b(i.cwd):_(),st(e,t,i)},"renameSync");var Re=Object.defineProperty,nt=d((e,t)=>Re(e,"name",{value:t,configurable:!0}),"r");class xe extends Q{static{d(this,"StreamChecksum")}constructor(t,r,i="base64"){super(),this.checksum=t,this.algorithm=r,this.encoding=i,this.hash=Tt(r)}checksum;algorithm;encoding;static{nt(this,"StreamChecksum")}length=0;digest="";hash;get calculatedDigest(){return this.digest}_transform(t,r,i){this.push(t),this.hash.update(t),this.length+=t.length,i()}_flush(t){this.digest=this.hash.digest(this.encoding),this.checksum&&this.checksum!==this.digest?t(new Error("Checksum mismatch")):t()}}const Le=nt((e,t,r="base64")=>t?new xe(e,t,r):new dt,"streamChecksum");var je=Object.defineProperty,Ce=d((e,t)=>je(e,"name",{value:t,configurable:!0}),"o");class Ae extends Q{static{d(this,"m")}constructor(t=Number.POSITIVE_INFINITY){super(),this.limit=t}limit;static{Ce(this,"StreamLength")}length=0;_transform(t,r,i){const n=this.length+t.length;this.limit>=n?(this.push(t),this.length=n,i()):i(new Error("Stream length limit exceeded"))}}var ze=Object.defineProperty,V=d((e,t)=>ze(e,"name",{value:t,configurable:!0}),"E");class E extends Ft{static name="disk";checksumTypes=["md5","sha1"];get raw(){return{directory:this.directory}}directory;meta;constructor(t){const r={...t,fileNameValidation:t.fileNameValidation??kt};if(super(r),this.directory=r.directory,r.metaStorage)this.meta=r.metaStorage;else{const i={...r,...r.metaStorageConfig,logger:this.logger};this.meta=new pt(i)}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(i=>{this.logger?.error("Storage access check failed: %O",i)})}normalizeError(t){return super.normalizeError(t)}async create(t){return this.instrumentOperation("create",async()=>{const r={...t};if(t.ttl){const a=typeof t.ttl=="string"?Nt(t.ttl):t.ttl;a!==void 0&&(r.expiredAt=Date.now()+a)}r.size!==void 0&&Number(r.size)<0&&p(h.REQUEST_ENTITY_TOO_LARGE,"Request entity too large");const i=new Pt(r);try{const a=await this.getMeta(i.id);if(a.status==="completed")return a}catch{}i.name=this.namingFunction(i),(i.size===void 0||Number.isNaN(i.size))&&(i.size===void 0||(i.size=this.maxUploadSize)),await this.validate(i);const n=this.getFilePath(i.name);try{await R(n),i.bytesWritten=0}catch(a){const s=this.normalizeError(a instanceof Error?a:new Error(String(a)));await this.onError(s),p(h.FILE_ERROR,s.message)}return i.status=W(i),await this.saveMeta(i),await this.onCreate(i),i})}async write(t){return this.instrumentOperation("write",async()=>{let r;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?r=t:(r=await this.getMeta(t.id),await this.checkIfExpired(r)),r.status==="completed")return r;if(t.size!==void 0&&_t(r,t.size),!Dt(t,r))return p(h.FILE_CONFLICT);const i=this.getFilePath(r.name),n=await this.lock(i);try{const a=t.start||0;if(await R(i),r.bytesWritten===0&&(r.bytesWritten=a),It(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))return p(h.UNSUPPORTED_CHECKSUM_ALGORITHM);if((t.start===0||t.start===void 0)&&(r.bytesWritten===0||Number.isNaN(r.bytesWritten))&&(!r.contentType||r.contentType==="application/octet-stream"))try{const{fileType:o,stream:c}=await $t(t.body);o?.mime&&(r.contentType=o.mime),t.body=c}catch{}const s=t.signal,l={...r,...t,body:t.body};s&&(l.signal=s);const[m,u]=await this.lazyWrite(l);if(u)return await mt(i,r.bytesWritten),p(u);const y=a+(t.contentLength||0);r.bytesWritten=Math.max(r.bytesWritten||0,y),r.bytesWritten=Math.max(r.bytesWritten||0,m),r.status=W(r),await this.saveMeta(r)}else await R(i),r.bytesWritten=0;return r}catch(a){if(Ot(a))throw a;const s=this.normalizeError(a instanceof Error?a:new Error(String(a)));return await this.onError(s),p(h.FILE_ERROR,(typeof s.message=="string"?s.message:String(a))||String(a))}finally{await this.unlock(i,n)}})}async get({id:t}){return this.instrumentOperation("get",async()=>{const r=await this.checkIfExpired(await this.meta.get(t)),{bytesWritten:i,contentType:n,expiredAt:a,metadata:s,modifiedAt:l,name:m,originalName:u,size:y}=r;let o;try{o=await wt(this.getFilePath(m),{buffer:!0})}catch(c){const f=c;if(f.code==="ENOENT"||f.code==="EPERM"){const M=this.normalizeError(c instanceof Error?c:new Error(f.message||String(c)));return await this.onError(M),p(h.FILE_NOT_FOUND,(typeof M.message=="string"?M.message:String(c))||String(c))}const ot=this.normalizeError(c instanceof Error?c:new Error(String(c)));throw await this.onError(ot),c}return{content:o,contentType:n,ETag:St(o),expiredAt:a,id:t,metadata:s,modifiedAt:l,name:m,originalName:u,size:y||i}})}async exists({id:t}){return this.instrumentOperation("exists",async()=>{try{const r=await this.getMeta(t),i=this.getFilePath(r.name);return await C(i),!0}catch{return!1}})}async getStream({id:t}){return this.instrumentOperation("getStream",async()=>{try{const r=await this.checkIfExpired(await this.meta.get(t)),{bytesWritten:i,contentType:n,expiredAt:a,modifiedAt:s,name:l,size:m}=r,u=lt(this.getFilePath(l));return{headers:{"Content-Length":String(m||i),"Content-Type":n,...a&&{"X-Upload-Expires":a.toString()},...s&&{"Last-Modified":s.toString()}},size:m||i,stream:u}}catch(r){const i=this.normalizeError(r instanceof Error?r:new Error(String(r)));throw await this.onError(i),p(h.FILE_NOT_FOUND,(typeof i.message=="string"?i.message:String(r))||String(r))}})}async delete({id:t}){return this.instrumentOperation("delete",async()=>{const r=await this.getMeta(t);await z(this.getFilePath(r.name)),await this.deleteMeta(t);const i={...r,status:"deleted"};return await this.onDelete(i),i})}async copy(t,r){return this.instrumentOperation("copy",async()=>{E.assertSafeId(t),E.assertSafeId(r);const i=await this.getMeta(t);return await A(this.getFilePath(i.name),this.getFilePath(r)),{...i,name:r}})}async move(t,r){return this.instrumentOperation("move",async()=>{E.assertSafeId(t),E.assertSafeId(r);const i=await this.getMeta(t),n=this.getFilePath(i.name),a=this.getFilePath(r);try{await Me(n,a)}catch(s){if(s?.code==="EXDEV")await A(n,a),await z(n);else{const l=this.normalizeError(s instanceof Error?s:new Error(String(s)));throw await this.onError(l),s}}return{...i,id:i.id,name:r}})}async list(){return this.instrumentOperation("list",async()=>{const t={followSymlinks:!1,includeDirs:!1,includeFiles:!0,skip:["*.META$"]},r=[],{directory:i}=this;for await(const n of k(i,t)){const{suffix:a}=this.meta,{path:s}=n;if(!s.includes(a)){const{birthtime:l,ctime:m,mtime:u}=await C(s);r.push({createdAt:l||m,id:s.replace(i,""),modifiedAt:u})}}return r})}getFilePath(t){return E.assertSafeId(t),Et(t)&&p(h.INVALID_FILE_NAME,`Invalid file id: "${t}"`),K(this.directory,t)}lazyWrite(t){return new Promise((r,i)=>{const n=ut(this.getFilePath(t.name),{flags:"r+",start:t.start}),a=new Ae(t.contentLength||t.size-t.start),s=Le(t.checksum,t.checksumAlgorithm),l=!t.checksum,{signal:m}=t,u=V(()=>{n.close(),a.destroy(),s.destroy()},"cleanupStreams"),y=V(o=>{u(),r([Number.NaN,o])},"failWithCode");if(a.on("error",()=>{y(h.FILE_CONFLICT)}),s.on("error",()=>{y(h.CHECKSUM_MISMATCH)}),t.body.on("aborted",()=>{y(l?void 0:h.REQUEST_ABORTED)}),t.body.on("error",o=>{u(),i(o)}),m?.aborted){y(l?void 0:h.REQUEST_ABORTED);return}m&&m.addEventListener("abort",()=>{u(),n.destroy(),a.destroy(),s.destroy(),t.body.destroy(),r([Number.NaN,l?void 0:h.REQUEST_ABORTED])}),ht(t.body,a,s,n,o=>{if(o){if(u(),m?.aborted){r([Number.NaN,l?void 0:h.REQUEST_ABORTED]);return}r([Number.NaN,h.FILE_ERROR]);return}r([t.start+n.bytesWritten])})})}async accessCheck(){await H(this.directory)}}export{E as f,Ae as m,Le as s,R as y};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { B as BaseStorage } from "./storage.d-RteRC-cG.js";
|
|
2
|
-
/**
|
|
3
|
-
* Web-standard and Node-native body types accepted by {@link Files.upload}.
|
|
4
|
-
*/
|
|
5
|
-
type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | NodeJS.ReadableStream | ReadableStream<Uint8Array> | string;
|
|
6
|
-
interface UploadOptions {
|
|
7
|
-
contentType?: string;
|
|
8
|
-
metadata?: Record<string, unknown>;
|
|
9
|
-
/**
|
|
10
|
-
* Explicit byte length. Required for {@link NodeJS.ReadableStream} and Web `ReadableStream`
|
|
11
|
-
* inputs because their length is not derivable from the value itself; ignored otherwise.
|
|
12
|
-
*/
|
|
13
|
-
size?: number;
|
|
14
|
-
storageClass?: string;
|
|
15
|
-
}
|
|
16
|
-
interface SignedReadUrlOptions {
|
|
17
|
-
expiresIn?: number;
|
|
18
|
-
responseContentDisposition?: string;
|
|
19
|
-
responseContentType?: string;
|
|
20
|
-
}
|
|
21
|
-
interface SignedUploadUrlOptions {
|
|
22
|
-
contentLength?: number;
|
|
23
|
-
contentType?: string;
|
|
24
|
-
expiresIn?: number;
|
|
25
|
-
}
|
|
26
|
-
interface ListOptions {
|
|
27
|
-
limit?: number;
|
|
28
|
-
prefix?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Provider-agnostic metadata-only view of an object.
|
|
32
|
-
*/
|
|
33
|
-
interface FileObject {
|
|
34
|
-
contentType: string;
|
|
35
|
-
etag?: string;
|
|
36
|
-
key: string;
|
|
37
|
-
lastModified?: Date | number | string;
|
|
38
|
-
metadata?: Record<string, unknown>;
|
|
39
|
-
size?: number;
|
|
40
|
-
}
|
|
41
|
-
interface DownloadResult extends FileObject {
|
|
42
|
-
body: Buffer;
|
|
43
|
-
}
|
|
44
|
-
interface FilesOptions<TStorage extends BaseStorage = BaseStorage> {
|
|
45
|
-
adapter: TStorage;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Files-SDK–style unified facade over a {@link BaseStorage} instance.
|
|
49
|
-
*
|
|
50
|
-
* Provides a small, consistent surface (`upload`, `download`, `head`, `exists`, `delete`, `copy`,
|
|
51
|
-
* `list`, `url`, `signedUploadUrl`) and a `raw` escape hatch to the adapter's native client.
|
|
52
|
-
*
|
|
53
|
-
* The facade uses the user-supplied `key` as both the storage path and the metadata id,
|
|
54
|
-
* so subsequent operations look up the object by the same key that was used to upload it.
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* import { Files, S3Storage } from "@visulima/storage";
|
|
58
|
-
*
|
|
59
|
-
* const files = new Files({
|
|
60
|
-
* adapter: new S3Storage({ bucket: "uploads", region: "us-east-1" }),
|
|
61
|
-
* });
|
|
62
|
-
*
|
|
63
|
-
* await files.upload("avatars/abc.png", buffer, { contentType: "image/png" });
|
|
64
|
-
* const head = await files.head("avatars/abc.png");
|
|
65
|
-
* const url = await files.url("avatars/abc.png", { expiresIn: 900 });
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
declare class Files<TStorage extends BaseStorage = BaseStorage> {
|
|
69
|
-
readonly adapter: TStorage;
|
|
70
|
-
constructor(options: FilesOptions<TStorage>);
|
|
71
|
-
/**
|
|
72
|
-
* Escape hatch to the adapter's native client (S3Client, BlobServiceClient, ...).
|
|
73
|
-
* Typed via the `TStorage` parameter, so pinning the adapter type at construction yields a
|
|
74
|
-
* typed view of the native client. Returns `undefined` when the adapter has no native client
|
|
75
|
-
* (e.g. DiskStorage).
|
|
76
|
-
*/
|
|
77
|
-
get raw(): TStorage["raw"];
|
|
78
|
-
upload(key: string, body: FileBody, options?: UploadOptions): Promise<FileObject>;
|
|
79
|
-
download(key: string): Promise<DownloadResult>;
|
|
80
|
-
head(key: string): Promise<FileObject>;
|
|
81
|
-
/**
|
|
82
|
-
* Resolves to `true` when an object exists at `key`, `false` otherwise. Never throws for a
|
|
83
|
-
* missing object.
|
|
84
|
-
*/
|
|
85
|
-
exists(key: string): Promise<boolean>;
|
|
86
|
-
delete(key: string): Promise<void>;
|
|
87
|
-
copy(source: string, destination: string, options?: {
|
|
88
|
-
storageClass?: string;
|
|
89
|
-
}): Promise<FileObject>;
|
|
90
|
-
list(options?: ListOptions): Promise<FileObject[]>;
|
|
91
|
-
url(key: string, options?: SignedReadUrlOptions): Promise<string>;
|
|
92
|
-
signedUploadUrl(key: string, options?: SignedUploadUrlOptions): Promise<string>;
|
|
93
|
-
}
|
|
94
|
-
export { DownloadResult as D, Files as F, ListOptions as L, SignedReadUrlOptions as S, UploadOptions as U, FileBody as a, FileObject as b, FilesOptions as c, SignedUploadUrlOptions as d };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var H=Object.defineProperty;var p=(t,e)=>H(t,"name",{value:e,configurable:!0});import{Readable as X}from"node:stream";import{setInterval as J}from"node:timers";import{inspect as Q}from"node:util";import{L as ee,O as I}from"./path-D7rMc9nq-B718mbm6.js";import te from"type-is";import re from"./NoOpMetrics-Dky06sf1.js";import{N as oe}from"./cache-qV_5Umeq.js";import{ErrorMap as M,throwErrorCode as E,ERRORS as $}from"./ERRORS-CyOuSMLY.js";import{randomUUID as se}from"node:crypto";import{LRUCache as ae}from"lru-cache";import{retry as ie}from"./isRetryableError-BhizNeAz.js";import{o as ne}from"./is-expired-1JuZjDtb.js";var ce=Object.defineProperty,le=p((t,e)=>ce(t,"name",{value:e,configurable:!0}),"y$3"),ue=Object.defineProperty,me=le((t,e)=>ue(t,"name",{value:e,configurable:!0}),"y"),ge=Object.defineProperty,C=me((t,e)=>ge(t,"name",{value:e,configurable:!0}),"i");const de=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,he=/^KIBI/,pe=/^MIBI/,fe=/^GIBI/,ye=/^TEBI/,be=/^PEBI/,we=/^EXBI/,ve=/^ZEBI/,Ee=/^YIBI/,$e=/^(.)IB$/,_={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},xe=C((t,e)=>{const r=new Intl.NumberFormat(e).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(e).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(t.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},"parseLocalizedNumber"),R=C(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),j=C((t,e)=>{const r={base:2,locale:"en-US",units:"metric",...e};if(typeof t!="string"||t.length===0)throw new TypeError("Value is not a string or is empty.");if(t.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=de.exec(t)?.groups;if(!o)return Number.NaN;const s=xe(o.value,r.locale),i=(o.type??"Bytes").toUpperCase().replace(he,"KILO").replace(pe,"MEGA").replace(fe,"GIGA").replace(ye,"TERA").replace(be,"PETA").replace(we,"EXA").replace(ve,"ZETTA").replace(Ee,"YOTTA").replace($e,"$1B"),n=_[r.units].findIndex(l=>l.short[0].toUpperCase()===i[0]),c=R(r.base);return s*c**n},"parseBytes");C((t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:o,locale:s,long:i,unit:n,units:c,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},a=R(r),d=Math.abs(t),m=e?.space??!0?" ":"",u=_[c],g=u.findIndex(w=>w.short===n);if(t===0){const w=Math.min(0,Math.max(g,u.length-1));return"0"+m+u[w][i?"long":"short"]}const h=g===-1?Math.min(Math.floor(Math.log(d)/Math.log(a)),u.length-1):g,N=u[h][i?"long":"short"],O=t/a**h,v=o<0?void 0:o;return new Intl.NumberFormat(s,{maximumFractionDigits:v,minimumFractionDigits:v,...l}).format(O)+m+N},"formatBytes");var Me=Object.defineProperty,Ne=p((t,e)=>Me(t,"name",{value:e,configurable:!0}),"u$3"),Oe=Object.defineProperty,Ae=Ne((t,e)=>Oe(t,"name",{value:e,configurable:!0}),"v"),Te=Object.defineProperty,Ce=Ae((t,e)=>Te(t,"name",{value:e,configurable:!0}),"D");const Se=Ce((t,e,r,o,s,i,n,c,l,a,d,m,u,g)=>{const h={d:o,h:s,m:i,mo:e,ms:c,s:n,w:r,y:t};return l!==void 0&&(h.future=l),a!==void 0&&(h.past=a),d!==void 0&&(h.decimal=d),m!==void 0&&(h.unitMap=m),u!==void 0&&(h.groupSeparator=u),g!==void 0&&(h.placeholderSeparator=g),h},"createDurationLanguage"),F={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Ie=Se(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",F,",","_");var Be=Object.defineProperty,Pe=p((t,e)=>Be(t,"name",{value:e,configurable:!0}),"o"),De=Object.defineProperty,Ue=Pe((t,e)=>De(t,"name",{value:e,configurable:!0}),"o"),ze=Object.defineProperty,je=Ue((t,e)=>ze(t,"name",{value:e,configurable:!0}),"o");const ke=je(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(t,o))throw new TypeError(`Missing required property: ${o}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const o of r)if(typeof t[o]!="string"&&typeof t[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var _e=Object.defineProperty,Re=p((t,e)=>_e(t,"name",{value:e,configurable:!0}),"w"),Fe=Object.defineProperty,Le=Re((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"S"),Ve=Object.defineProperty,Ge=Le((t,e)=>Ve(t,"name",{value:e,configurable:!0}),"h");const k={d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},A=/[-/\\^$*+?.()|[\]{}]/g,Ye=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Ze=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ke=/^[+-]?\d+(?:\.\d+)?$/,We=/^[-+]/,qe=Ge((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Ie}=e??{};ke(o);const s=o.decimal??".",i=o.groupSeparator??",",n=o.placeholderSeparator??"_",c=s.replaceAll(A,String.raw`\$&`),l=i.replaceAll(A,String.raw`\$&`),a=n.replaceAll(A,String.raw`\$&`),d=o.unitMap??F;let m=t.replaceAll(new RegExp(String.raw`(\d)[${a}${l}](\d)`,"g"),"$1$2");if(s!=="."&&(m=m.replace(c,".")),Ke.test(t)){const f=Number.parseFloat(m.trim());if(!Number.isNaN(f)){const y=d[r];if(y!==void 0)return f*k[y]}return}const u=Ye.exec(t);if(u){const f=Number.parseInt(u[1]??"0",10),y=Number.parseInt(u[2]??"0",10),x=Number.parseInt(u[3]??"0",10);return f*36e5+y*6e4+x*1e3}const g=Ze.exec(t);if(g){let f=0,y=0;g[2]!==void 0?(f=Number.parseInt(g[1]??"0",10),y=Number.parseInt(g[2],10)):g[1]!==void 0&&(y=Number.parseInt(g[1],10));const x=Number.parseInt(g[3]??"0",10);return f*36e5+y*6e4+x*1e3}const h=Object.keys(d).toSorted((f,y)=>y.length-f.length).map(f=>f.replaceAll(A,String.raw`\$&`)).join("|"),N=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${h})`,"gi");let O=0,v,w=!1,P=-1,D=0;for(N.lastIndex=0;(v=N.exec(m))!==null;){w||(P=v.index),w=!0;const f=v[1],y=v[2];if(!f||!y)continue;const x=f.trim(),K=x.startsWith("-")?-1:1,W=x.replace(We,""),U=Number.parseFloat(W),z=d[y.toLowerCase()];if(z===void 0)continue;const q=k[z];if(Number.isNaN(U))return;O+=K*U*q,D=N.lastIndex}const Y=m.slice(0,P).trim(),Z=m.slice(D).trim();if(!(w&&(Y.length>0||Z.length>0))&&w)return O},"parseDuration");var He=Object.defineProperty,Xe=p((t,e)=>He(t,"name",{value:e,configurable:!0}),"n$1");let Je=class extends ae{static{p(this,"u")}static{Xe(this,"Locker")}constructor(e){super({ttl:3e4,ttlAutopurge:!0,...e})}lock(e){if(this.get(e)!==void 0)throw new Error(`${e} is locked`);const r=se();return this.set(e,r),r}unlock(e,r){return this.get(e)!==r?!1:this.delete(e)}};var Qe=Object.defineProperty,et=p((t,e)=>Qe(t,"name",{value:e,configurable:!0}),"e$1");const T=et(t=>{if(t===Number(t))return t;if(!t)return;const e=qe(t);if(e!==void 0)return e},"toMilliseconds");var tt=Object.defineProperty,rt=p((t,e)=>tt(t,"name",{value:e,configurable:!0}),"t");let ot=class extends Error{static{p(this,"d")}static{rt(this,"ValidationError")}code;statusCode;body;headers;name="ValidationError";constructor(e,r,o,s){const i=typeof o=="string"?o:o?.message||"Validation error";super(i),this.code=e,this.statusCode=r,this.body=o,this.headers=s}};var st=Object.defineProperty,S=p((t,e)=>st(t,"name",{value:e,configurable:!0}),"e");const at=S(t=>t&&t[0].toUpperCase()+t.slice(1),"capitalize"),it=S(t=>{if(!Array.isArray(t))return t;const[e,r,o]=t;return{body:r,headers:o,statusCode:e}},"toResponse");class nt{static{p(this,"Validator")}constructor(e="ValidationError"){this.prefix=e}prefix;static{S(this,"Validator")}validators={};add(e){Object.entries(e).forEach(([r,o])=>{const s=`${this.prefix}${at(r)}`;if(this.validators[s]={...this.validators[s],...o},typeof this.validators[s].isValid!="function")throw new TypeError('Validation config "isValid" is missing, or it is not a function!')})}async verify(e){for(const[r,o]of Object.entries(this.validators))if(!await o.isValid(e)){const s=o.response||(r in M?M[r]:M.UnknownError),i=it(s),{body:n,headers:c,message:l,statusCode:a}=i;throw new ot(r,a,n||l,c)}}}const St=S(t=>t.name==="ValidationError","isValidationError");var ct=Object.defineProperty,B=p((t,e)=>ct(t,"name",{value:e,configurable:!0}),"i");const lt=B(t=>{if(typeof t.name=="string")return t.name;if(typeof t.title=="string")return t.title;if(typeof t.originalName=="string")return t.originalName;if(typeof t.filename=="string")return t.filename},"extractOriginalName"),L=B((t,e)=>{const r={...t};return Object.keys(e).forEach(o=>{const s=e[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s)){const i=r[o],n=i&&typeof i=="object"&&!Array.isArray(i)?i:{};r[o]=L(n,s)}else r[o]=s}),r},"deepMerge"),ut=B((t,e)=>{const r=L(t,e);Object.assign(t,r),t.originalName=lt(t.metadata)||t.originalName},"updateMetadata");var mt=Object.defineProperty,b=p((t,e)=>mt(t,"name",{value:e,configurable:!0}),"d");const gt=/(secret|password|passwd|pwd|token|api[_-]?key|credential|authorization|sas|signature|sessiontoken|connectionstring)/i,V=b(t=>{const e={};for(const[r,o]of Object.entries(t))typeof o=="string"&>.test(r)?e[r]="[REDACTED]":o&&typeof o=="object"&&!Array.isArray(o)&&o.constructor===Object?e[r]=V(o):e[r]=o;return e},"redactSecrets"),dt={allowMIME:["*/*"],filename:b(({id:t})=>t,"filename"),maxMetadataSize:"8MB",maxUploadSize:"5TB",onComplete:b(()=>{},"onComplete"),onCreate:b(()=>{},"onCreate"),onDelete:b(()=>{},"onDelete"),onError:b(()=>{},"onError"),onUpdate:b(()=>{},"onUpdate"),useRelativeLocation:!1,validation:{}},ht=b(t=>!t||t.length<3||t.length>255||I(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),It=b(t=>{if(!t||t.length<3||t.length>255||I(t))return!1;const e=t.toUpperCase();return!['"',"*",":","<",">","?","\\","|","../","\0"].some(r=>e.includes(r))},"defaultFilesystemFileNameValidation");class G{static{p(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];maxUploadSize;expiration;locker;namingFunction;validation=new nt;assetFolder=void 0;concurrency;constructor(e){const r={...dt,...e};this.onCreate=r.onCreate,this.onUpdate=r.onUpdate,this.onComplete=r.onComplete,this.onDelete=r.onDelete,this.onError=r.onError,this.namingFunction=r.filename,this.maxUploadSize=typeof r.maxUploadSize=="string"?j(r.maxUploadSize):r.maxUploadSize,this.maxMetadataSize=typeof r.maxMetadataSize=="string"?j(r.maxMetadataSize):r.maxMetadataSize,this.expiration=r.expiration,this.genericConfig=r,r.assetFolder!==void 0&&(this.assetFolder=ee(r.assetFolder)),this.locker=new Je({max:1e3,ttl:3e4,ttlAutopurge:!0}),this.cache=r.cache??new oe,this.logger=r.logger,this.metrics=r.metrics??new re,this.logger?.debug(`${this.constructor.name} config: ${Q(V({...e,logger:this.logger.constructor}))}`);const o=T(r.expiration?.purgeInterval);o&&this.startAutoPurge(o);const s={isValid(l){if(l.size===void 0)return!0;const a=l.size;if(a==null)return!1;const d=typeof a=="number"?a:Number(a);if(Number.isNaN(d)||d<0)return!1;const m=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(m)&&d<=m},response:M.RequestEntityTooLarge,value:this.maxUploadSize},i={isValid(l){return!!te.is(l.contentType,this.value)},response:M.UnsupportedMediaType,value:r.allowMIME},n=r.fileNameValidation??ht,c={isValid(l){return n(l.name)},response:M.InvalidFileName};this.validation.add({filename:c,mime:i,size:s}),this.validation.add({...r.validation})}get raw(){}async getReadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getReadUrl()`)}async getUploadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getUploadUrl()`)}get tusExtension(){const e=["creation","creation-with-upload","termination","checksum","creation-defer-length","concatenation"];return this.expiration&&e.push("expiration"),e}async validate(e){await this.validation.verify(e)}async exists(e){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id),!0}catch{return!1}})}normalizeError(e){const r={code:e.name,message:e.message,name:e.name,statusCode:500};return{...r,message:`[${this.constructor.name}] ${r.message}`}}get config(){return this.genericConfig}async saveMeta(e){return G.assertSafeId(e.id),this.updateTimestamps(e),this.cache.set(e.id,e),this.meta.save(e.id,e)}static assertSafeId(e){(!e||typeof e!="string"||e.includes("\0")||e.includes("../")||e.includes("..\\")||e===".."||e.startsWith("../")||e.startsWith("..\\")||I(e)||/^[A-Z]:[/\\]/i.test(e))&&E($.INVALID_FILE_NAME,`Invalid file id: "${e}"`)}async deleteMeta(e){return this.cache.delete(e),this.meta.delete(e)}async getMeta(e){try{const r=await this.meta.get(e);return this.cache.set(r.id,r),{...r}}catch(r){const o=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(o),E($.FILE_NOT_FOUND)}}async checkIfExpired(e){return ne(e)?(this.delete(e).catch(()=>{}),this.deleteMeta(e.id).catch(()=>{}),E($.GONE)):e}async purge(e){return this.instrumentOperation("purge",async()=>{const r=T(e||this.expiration?.maxAge),o={items:[],maxAgeMs:r};if(r){const s=Date.now()-r,i=(await this.list()).filter(n=>Number(new Date(this.expiration?.rolling&&n.modifiedAt||n.createdAt))<s);for await(const{id:n,...c}of i)try{const l=await this.delete({id:n});o.items.push({...l,...c})}catch(l){this.logger?.warn(`Failed to delete file ${n} during purge: ${l instanceof Error?l.message:String(l)}`)}o.items.length>0&&(this.logger?.info(`Purge: removed ${o.items.length} uploads`),this.metrics.gauge("storage.operations.purge.items_count",o.items.length,{storage:this.constructor.name.toLowerCase().replace("storage","")}))}return o})}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const r=await this.get({id:e}),o=X.from(r.content);return{headers:{"Content-Length":String(r.size),"Content-Type":r.contentType,...r.ETag&&{ETag:r.ETag},...r.modifiedAt&&{"Last-Modified":r.modifiedAt.toString()}},size:typeof r.size=="number"?r.size:void 0,stream:o}})}async list(e=1e3){return this.instrumentOperation("list",async()=>{throw new Error("Not implemented")})}async update({id:e},r){return this.instrumentOperation("update",async()=>{const o=await this.getMeta(e),s={...r};if("ttl"in s&&s.ttl!==void 0){const n=s.ttl,c=typeof n=="string"?T(n):n;c!==void 0&&(s.expiredAt=Date.now()+c),delete s.ttl}ut(o,s),await this.saveMeta(o);const i={...o,status:"updated"};return await this.onUpdate(i),i})}async deleteBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async a=>{try{return{file:await this.delete({id:a}),id:a,success:!0}}catch(d){const m=d instanceof Error?d.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:m,storage:o}),{error:m,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success?s.push(a.value.file):i.push({error:a.value.error,id:a.value.id}):i.push({error:a.reason?.message||"Delete failed",id:""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.delete.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.delete.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.delete.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async copyBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.copy.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async({destination:a,options:d,source:m})=>{try{return{file:await this.copy(m,a,d),id:a,success:!0}}catch(u){const g=u instanceof Error?u.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:g,storage:o}),{error:g,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Copy failed",id:a.value.id}):i.push({error:a.reason?.message||"Copy failed",id:""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.copy.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.copy.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async moveBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.move.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async({destination:a,source:d})=>{try{return{file:await this.move(d,a),id:a,success:!0}}catch(m){const u=m instanceof Error?m.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:u,storage:o}),{error:u,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Move failed",id:a.value.id}):i.push({error:a.reason?.message||"Move failed",id:a.reason?.id||""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.move.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.move.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async lock(e){const r=[...this.locker.keys()];return r.includes(e)?E($.FILE_LOCKED):this.config.concurrency&&typeof this.config.concurrency=="number"&&this.config.concurrency<r.length?E($.STORAGE_BUSY):this.locker.lock(e)}async unlock(e,r){if(r===void 0){this.locker.delete(e);return}this.locker.unlock(e,r)}async withLock(e,r){const o=await this.lock(e);try{return await r()}finally{await this.unlock(e,o)}}isUnsupportedChecksum(e=""){return!!e&&!this.checksumTypes.includes(e)}startAutoPurge(e){if(e>=2147483647)throw new Error("“purgeInterval” must be less than 2147483647 ms");J(()=>{this.purge().catch(r=>this.logger?.error(r))},e)}updateTimestamps(e){e.createdAt??=new Date().toISOString();const r=T(this.expiration?.maxAge);return r&&!e.expiredAt&&(e.expiredAt=this.expiration?.rolling?Date.now()+r:+new Date(e.createdAt)+r),e}getRetryConfig(){}runOperation(e,r,o){let s;typeof e?.retries=="number"?s={maxRetries:e.retries}:e?.retries&&(s=e.retries);const i={...this.getRetryConfig(),...s};o?.replayable===!1&&(i.maxRetries=0);const n=[];this.genericConfig.defaultSignal&&n.push(this.genericConfig.defaultSignal),e?.signal&&n.push(e.signal);let c;n.length===1?[c]=n:n.length>1&&(c=AbortSignal.any(n));const l=typeof e?.timeout=="number"?e.timeout:this.genericConfig.defaultTimeout,a=typeof l=="number"&&l>0?l:void 0,d=i.shouldRetry;i.shouldRetry=u=>c?.aborted||u instanceof Error&&u.name==="AbortError"?!1:d?d(u):!1;const m=b(u=>{if(u instanceof Error&&u.name==="AbortError")return u;const g=u instanceof Error&&u.message?u.message:"The operation was aborted",h=new Error(g,{cause:u});return h.name="AbortError",h},"toAbortError");return ie(async()=>{if(c?.aborted)throw m(c.reason);let u,g;if(a===void 0)g=c;else{const h=new AbortController;u=setTimeout(()=>{h.abort(new DOMException(`The operation timed out after ${a}ms`,"TimeoutError"))},a),g=c?AbortSignal.any([c,h.signal]):h.signal}try{return await r(g)}catch(h){throw g?.aborted?m(h):h}finally{u&&clearTimeout(u)}},i)}async instrumentOperation(e,r,o){const s=Date.now(),i={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,i);const n=await r(),c=Date.now()-s;return this.metrics.timing(`storage.operations.${e}.duration`,c,i),n&&typeof n=="object"&&"size"in n&&typeof n.size=="number"&&this.metrics.gauge("storage.files.size",n.size,{...i,operation:e}),n}catch(n){const c=Date.now()-s,l=n instanceof Error?n.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,c,{...i,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...i,error:l}),n}}}export{j as $,G as B,It as a,ot as b,ht as d,St as i,T as t,ut as u,qe as z};
|