@visulima/storage 1.0.0-alpha.30 → 1.0.0-alpha.32
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 +45 -0
- package/README.md +2 -2
- 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 +6 -5
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AwsLightStorage-w21RxjUm.js → AwsLightStorage-B1jNF7sv.js} +1 -1
- package/dist/packem_shared/AzureStorage-B4E6VLn5.js +1 -0
- package/dist/packem_shared/{BoxMetaStorage-DLdXbZaV.js → BoxMetaStorage-nESVquA1.js} +1 -1
- package/dist/packem_shared/BoxStorage-CHYDrcxw.js +1 -0
- package/dist/packem_shared/{BunS3MetaStorage-Bv_CTTMz.js → BunS3MetaStorage-BkZx5q4w.js} +1 -1
- package/dist/packem_shared/BunS3Storage-BopE7kmX.js +1 -0
- package/dist/packem_shared/{BunnyMetaStorage-DNMTSeoN.js → BunnyMetaStorage-bB8NXGUI.js} +1 -1
- package/dist/packem_shared/BunnyStorage-C3IBxJqr.js +1 -0
- package/dist/packem_shared/{CloudinaryMetaStorage-DEBk5eQy.js → CloudinaryMetaStorage-BzibHydK.js} +1 -1
- package/dist/packem_shared/CloudinaryStorage-Cj00ZXWV.js +1 -0
- package/dist/packem_shared/DiskStorage-BrAb28Je.js +1 -0
- package/dist/packem_shared/DiskStorageWithChecksum-BX85CHJ6.js +1 -0
- package/dist/packem_shared/{DropboxMetaStorage-C6vj1QDA.js → DropboxMetaStorage-Bfm5bblb.js} +1 -1
- package/dist/packem_shared/DropboxStorage-Btz9h9Mj.js +1 -0
- package/dist/packem_shared/Files-tnc_buzM.js +1 -0
- package/dist/packem_shared/{FirebaseMetaStorage-CzyOim-J.js → FirebaseMetaStorage-CshnJMb0.js} +1 -1
- package/dist/packem_shared/FirebaseStorage-Y9P6Dx8I.js +2 -0
- package/dist/packem_shared/{FtpMetaStorage-1Njy0DpU.js → FtpMetaStorage-CoyWJafY.js} +1 -1
- package/dist/packem_shared/FtpStorage-DCKPMX0z.js +1 -0
- package/dist/packem_shared/{GCSMetaStorage-udgXA5ia.js → GCSMetaStorage-CfZj52hQ.js} +1 -1
- package/dist/packem_shared/GCStorage-hfL1u2KQ.js +1 -0
- package/dist/packem_shared/{GoogleDriveMetaStorage-WGuUZPyx.js → GoogleDriveMetaStorage-CBSdEQr6.js} +1 -1
- package/dist/packem_shared/GoogleDriveStorage-C7iuV7qb.js +1 -0
- package/dist/packem_shared/{LocalMetaStorage-QMKL7McF.js → LocalMetaStorage-DSwsmdt7.js} +1 -1
- package/dist/packem_shared/MemoryMetaStorage-DEzfBNgL.js +1 -0
- package/dist/packem_shared/{Multipart-CIFfQksD.js → Multipart-kQ5wJQaV.js} +1 -1
- package/dist/packem_shared/{Multipart-D9WIud9R.js → Multipart-qaEOWKz1.js} +1 -1
- package/dist/packem_shared/{NetlifyBlobMetaStorage-ClIFdTkT.js → NetlifyBlobMetaStorage-CqluIgV0.js} +1 -1
- package/dist/packem_shared/NetlifyBlobStorage-CkMw9Uyv.js +1 -0
- package/dist/packem_shared/{OneDriveMetaStorage-DS4f83X2.js → OneDriveMetaStorage-DPTNMpeq.js} +1 -1
- package/dist/packem_shared/OneDriveStorage-CEGYb6OC.js +1 -0
- package/dist/packem_shared/{PocketBaseMetaStorage-B6utPncj.js → PocketBaseMetaStorage-CemTT_01.js} +1 -1
- package/dist/packem_shared/PocketBaseStorage-BZNzWj09.js +1 -0
- package/dist/packem_shared/{Rest-URrQ5FYM.js → Rest-BAcUFAgk.js} +1 -1
- package/dist/packem_shared/{Rest-BuD3ySAg.js → Rest-DukkeDZe.js} +1 -1
- package/dist/packem_shared/S3Storage-7hG3izjU.js +1 -0
- package/dist/packem_shared/{SftpMetaStorage-DYqXwCdM.js → SftpMetaStorage-Cs8b7uBO.js} +1 -1
- package/dist/packem_shared/SftpStorage-DnigT9GT.js +1 -0
- package/dist/packem_shared/{SharePointMetaStorage-DVM5-X6g.js → SharePointMetaStorage-DTVKAx6f.js} +1 -1
- package/dist/packem_shared/{SharePointStorage-BY90zh1c.js → SharePointStorage-D1cWu-14.js} +1 -1
- package/dist/packem_shared/{SupabaseMetaStorage-ivXoYVUu.js → SupabaseMetaStorage-D_fGv0d6.js} +1 -1
- package/dist/packem_shared/SupabaseStorage-DbIUa6NZ.js +1 -0
- package/dist/packem_shared/{Tus-Fp_hx5ug.js → Tus-BYTcw17H.js} +1 -1
- package/dist/packem_shared/{Tus-TNG9HAY8.js → Tus-BrP4RFTg.js} +1 -1
- package/dist/packem_shared/{UploadThingMetaStorage-BvKNzgm7.js → UploadThingMetaStorage-CAQ1uTfv.js} +1 -1
- package/dist/packem_shared/UploadThingStorage-B1qw1GrM.js +1 -0
- package/dist/packem_shared/{VercelBlobMetaStorage-CwaqWucZ.js → VercelBlobMetaStorage-DY4zAB6M.js} +1 -1
- package/dist/packem_shared/VercelBlobStorage-u6xmp8ox.js +1 -0
- package/dist/packem_shared/{base-handler-core-BYDQditz.js → base-handler-core-Ccvdhx-k.js} +1 -1
- package/dist/packem_shared/{base-handler-fetch-DWzsPkmV.js → base-handler-fetch-DzbThEWy.js} +1 -1
- package/dist/packem_shared/{base-handler-node-Dety2rQB.js → base-handler-node-CmCpLlBt.js} +1 -1
- package/dist/packem_shared/default-BrhEhSqN.js +1 -0
- package/dist/packem_shared/{defaultCloudStorageFileNameValidation-shIZX_7L.js → defaultCloudStorageFileNameValidation-DwDn0XB5.js} +1 -1
- package/dist/packem_shared/disk-storage-fWizVrge.js +1 -0
- package/dist/packem_shared/{disk-storage-with-checksum.d-mHcg2uLw.d.ts → disk-storage-with-checksum.d-aYBmkg45.d.ts} +8 -2
- package/dist/packem_shared/{executors.d-X4hz3zfu.d.ts → executors.d-WGJGPSZs.d.ts} +1 -1
- package/dist/packem_shared/{gcs-meta-storage-mZiqlX-9.js → gcs-meta-storage-COq32th7.js} +1 -1
- package/dist/packem_shared/get-file-status-DLS18Zvd.js +1 -0
- package/dist/packem_shared/index.d-CYdFIB-w.d.ts +455 -0
- package/dist/packem_shared/isRetryableError-CBZ65V6T.js +1 -0
- package/dist/packem_shared/local-meta-storage-Dr891Iy7.js +1 -0
- package/dist/packem_shared/{local-meta-storage.d-B11vHYNm.d.ts → local-meta-storage.d-CuvN-KQ3.d.ts} +1 -1
- package/dist/packem_shared/{media-transformer.d-C3QvECD7.d.ts → media-transformer.d-DfU7VbFl.d.ts} +2 -2
- package/dist/packem_shared/memory-storage.d-DRbE0WMO.d.ts +101 -0
- package/dist/packem_shared/part-match-D_NwyoF3.js +1 -0
- package/dist/packem_shared/{path-D7rMc9nq-B718mbm6.js → path-D7rMc9nq-CPbxyMDy.js} +1 -1
- package/dist/packem_shared/{rest-base-DI7xFXr5.js → rest-base-xrnOBxS9.js} +1 -1
- package/dist/packem_shared/s3-base-storage-CqAyWHR6.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-V3N2nKCt.d.ts → s3-base-storage.d-BrHiKWFw.d.ts} +9 -2
- package/dist/packem_shared/storage-uhIhcN-O.js +1 -0
- package/dist/packem_shared/{storage.d-RteRC-cG.d.ts → storage.d-X6TimMHY.d.ts} +42 -15
- package/dist/packem_shared/{tus-base.d-CygntIPM.d.ts → tus-base.d-Ds7xYAJC.d.ts} +3 -3
- package/dist/packem_shared/{types.d-cI_cMxcZ.d.ts → types.d-B72PbsLY.d.ts} +2 -2
- package/dist/packem_shared/{types.d-DxonY4XS.d.ts → types.d-C4QumoP1.d.ts} +2 -2
- package/dist/packem_shared/{types.d-ChNXbbHG.d.ts → types.d-a1grKnaX.d.ts} +1 -1
- package/dist/storage/aws/index.d.ts +9 -3
- 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/memory/index.d.ts +6 -0
- package/dist/storage/memory/index.js +1 -0
- 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 +6 -2
- package/dist/packem_shared/AzureStorage-2kl7JDXs.js +0 -1
- package/dist/packem_shared/BoxStorage-BUeEJoGL.js +0 -1
- package/dist/packem_shared/BunS3Storage-WM3rF6Fw.js +0 -1
- package/dist/packem_shared/BunnyStorage-D3s2fRB3.js +0 -1
- package/dist/packem_shared/CloudinaryStorage-BBE2-aVz.js +0 -1
- package/dist/packem_shared/DiskStorage-DL0GiG6k.js +0 -1
- package/dist/packem_shared/DiskStorageWithChecksum-BvUTn7O-.js +0 -1
- package/dist/packem_shared/DropboxStorage-BL3OIdE_.js +0 -1
- package/dist/packem_shared/Files-CJh9_N-9.js +0 -1
- package/dist/packem_shared/FirebaseStorage-lXMXy3Pm.js +0 -2
- package/dist/packem_shared/FtpStorage-Dw94efNW.js +0 -1
- package/dist/packem_shared/GCStorage-ChY6uJuO.js +0 -1
- package/dist/packem_shared/GoogleDriveStorage-C0NhBBWH.js +0 -1
- package/dist/packem_shared/NetlifyBlobStorage-CO89TGvF.js +0 -1
- package/dist/packem_shared/OneDriveStorage-jAN46vRm.js +0 -1
- package/dist/packem_shared/PocketBaseStorage-DpOjOKAt.js +0 -1
- package/dist/packem_shared/S3Storage-n1ohEZj4.js +0 -1
- package/dist/packem_shared/SftpStorage-Ban-WN8v.js +0 -1
- package/dist/packem_shared/SupabaseStorage-pNbHAE1Y.js +0 -1
- package/dist/packem_shared/UploadThingStorage-BcmIE2dI.js +0 -1
- package/dist/packem_shared/VercelBlobStorage-s260zfFo.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/isRetryableError-BhizNeAz.js +0 -1
- package/dist/packem_shared/local-meta-storage-Bi0mK6gD.js +0 -1
- package/dist/packem_shared/part-match-B5fLLmFw.js +0 -1
- package/dist/packem_shared/s3-base-storage-Dbexfg7p.js +0 -1
- package/dist/packem_shared/storage-Dh0tJh7j.js +0 -1
|
@@ -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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as e}from"../../packem_shared/DropboxFile-BGVG2kXM.js";import{default as t}from"../../packem_shared/DropboxMetaStorage-Bfm5bblb.js";import{default as p}from"../../packem_shared/DropboxStorage-Btz9h9Mj.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as r}from"../../packem_shared/FirebaseFile-JEu3plMP.js";import{default as o}from"../../packem_shared/FirebaseMetaStorage-CshnJMb0.js";import{default as s}from"../../packem_shared/FirebaseStorage-Y9P6Dx8I.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as a}from"../../packem_shared/FtpFile-B8jaICTB.js";import{default as r}from"../../packem_shared/FtpMetaStorage-CoyWJafY.js";import{default as p}from"../../packem_shared/FtpStorage-DCKPMX0z.js";export{a as FtpFile,r as FtpMetaStorage,p as FtpStorage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as File,
|
|
1
|
+
import { F as File, h 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-X6TimMHY.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-COq32th7.js";import{default as l}from"../../packem_shared/GCStorage-hfL1u2KQ.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as r}from"../../packem_shared/GoogleDriveFile-D0aGfGbL.js";import{default as t}from"../../packem_shared/GoogleDriveMetaStorage-CBSdEQr6.js";import{default as f}from"../../packem_shared/GoogleDriveStorage-C7iuV7qb.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-aYBmkg45.js";
|
|
2
|
+
export { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.js";
|
|
3
|
+
export { type L as LocalMetaStorageOptions } from "../../packem_shared/storage.d-X6TimMHY.js";
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:http';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{p as e}from"../../packem_shared/disk-storage-fWizVrge.js";import{default as t}from"../../packem_shared/DiskStorageWithChecksum-BX85CHJ6.js";import{v as f}from"../../packem_shared/local-meta-storage-Dr891Iy7.js";export{e as DiskStorage,t as DiskStorageWithChecksum,f as LocalMetaStorage};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { M as MemoryMetaStorage, a as MemoryStorage, type b as MemoryStorageOptions, a as default } from "../../packem_shared/memory-storage.d-DRbE0WMO.js";
|
|
2
|
+
import 'node:stream';
|
|
3
|
+
import "../../packem_shared/storage.d-X6TimMHY.js";
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
import 'lru-cache';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as o}from"../../packem_shared/MemoryMetaStorage-DEzfBNgL.js";import{default as t,default as f}from"../../packem_shared/default-BrhEhSqN.js";export{o as MemoryMetaStorage,t as MemoryStorage,f as default};
|
|
@@ -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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as o}from"../../packem_shared/NetlifyBlobFile-PMZLJ8AC.js";import{default as a}from"../../packem_shared/NetlifyBlobMetaStorage-CqluIgV0.js";import{default as r}from"../../packem_shared/NetlifyBlobStorage-CkMw9Uyv.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-a1grKnaX.js";
|
|
2
|
+
export { type b as OneDriveClientCredentialsAuth, type c as OneDriveOAuthRefreshAuth } from "../../packem_shared/types.d-a1grKnaX.js";
|
|
3
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.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-X6TimMHY.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-
|
|
1
|
+
import{default as a}from"../../packem_shared/OneDriveFile-XbVVKIJh.js";import{default as o}from"../../packem_shared/OneDriveMetaStorage-DPTNMpeq.js";import{default as i}from"../../packem_shared/OneDriveStorage-CEGYb6OC.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as t}from"../../packem_shared/PocketBaseFile-CkAiSBb0.js";import{default as r}from"../../packem_shared/PocketBaseMetaStorage-CemTT_01.js";import{default as s}from"../../packem_shared/PocketBaseStorage-BZNzWj09.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as a}from"../../packem_shared/SftpFile-CQCxZNVq.js";import{default as o}from"../../packem_shared/SftpMetaStorage-Cs8b7uBO.js";import{default as p}from"../../packem_shared/SftpStorage-DnigT9GT.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-a1grKnaX.js";
|
|
2
|
+
import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.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-X6TimMHY.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-
|
|
1
|
+
import{default as t}from"../../packem_shared/SharePointFile-BA6X9Sxr.js";import{default as r}from"../../packem_shared/SharePointMetaStorage-DTVKAx6f.js";import{default as S}from"../../packem_shared/SharePointStorage-D1cWu-14.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as t}from"../../packem_shared/SupabaseFile-DZ1iv9gM.js";import{default as r}from"../../packem_shared/SupabaseMetaStorage-D_fGv0d6.js";import{default as p}from"../../packem_shared/SupabaseStorage-DbIUa6NZ.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as e}from"../../packem_shared/UploadThingFile-BpG9mE8K.js";import{default as r}from"../../packem_shared/UploadThingMetaStorage-CAQ1uTfv.js";import{default as d}from"../../packem_shared/UploadThingStorage-B1qw1GrM.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-X6TimMHY.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-CuvN-KQ3.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-
|
|
1
|
+
import{default as r}from"../../packem_shared/VercelBlobFile-Cni_1qwD.js";import{default as a}from"../../packem_shared/VercelBlobMetaStorage-DY4zAB6M.js";import{default as f}from"../../packem_shared/VercelBlobStorage-u6xmp8ox.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 { A as AudioTransformerConfig,
|
|
1
|
+
import { F as File, a as FileReturn, B as BaseStorage } from "../packem_shared/storage.d-X6TimMHY.js";
|
|
2
|
+
import { A as AudioTransformerConfig, h as AudioTransformResult, i as AudioResampleOptions, j as AudioChannelMixOptions, k as AudioTransformOptions, l as AudioTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-C4QumoP1.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-X6TimMHY.js";
|
|
3
|
+
import { I as ImageTransformerConfig, T as TransformResult, R as ResizeOptions, C as CropOptions, m as RotateOptions, n as ImageFormat, o as TransformOptions, S as SharpenOptions, p as BlurOptions, q as MedianOptions, r as CLAHEOptions, s as ConvolveOptions, t as ThresholdOptions, u as BooleanOptions, L as LinearOptions, v as RecombineOptions, w as ModulateOptions, x as TintOptions, G as GreyscaleOptions, y as ColourspaceOptions, E as ExtractChannelOptions, J as JoinChannelOptions, z as BandboolOptions, D as AffineOptions, F as DilateOptions, H as ErodeOptions, P as PipelineColourspaceOptions, K as ToColourspaceOptions, N as RemoveAlphaOptions, O as EnsureAlphaOptions, Q as TransformationStep, B as BaseTransformer } from "../packem_shared/types.d-C4QumoP1.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 j as AudioChannelMixOptions, type i as AudioResampleOptions, type k as AudioTransformOptions, type h as AudioTransformResult, type l as AudioTransformationStep, type A as AudioTransformerConfig, B as BaseTransformer, type C as CropOptions, type n as ImageFormat, type I as ImageTransformerConfig, type U as MediaTransformQuery, type g as MediaTransformResult, type W as MediaTransformationStep, type M as MediaTransformerConfig, type R as ResizeOptions, type m as RotateOptions, type o as TransformOptions, type T as TransformResult, type Q as TransformationStep, type c as VideoCropOptions, type b as VideoResizeOptions, type d as VideoRotateOptions, type e as VideoTransformOptions, type a as VideoTransformResult, type f as VideoTransformationStep, type V as VideoTransformerConfig } from "../packem_shared/types.d-C4QumoP1.js";
|
|
2
|
+
export { M as MediaTransformer } from "../packem_shared/media-transformer.d-DfU7VbFl.js";
|
|
3
|
+
import { a as FileReturn } from "../packem_shared/storage.d-X6TimMHY.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-X6TimMHY.js";
|
|
2
|
+
import { V as VideoTransformerConfig, a as VideoTransformResult, b as VideoResizeOptions, c as VideoCropOptions, d as VideoRotateOptions, e as VideoTransformOptions, f as VideoTransformationStep, B as BaseTransformer } from "../packem_shared/types.d-C4QumoP1.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.32",
|
|
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",
|
|
@@ -120,6 +120,10 @@
|
|
|
120
120
|
"types": "./dist/storage/local/index.d.ts",
|
|
121
121
|
"import": "./dist/storage/local/index.js"
|
|
122
122
|
},
|
|
123
|
+
"./provider/memory": {
|
|
124
|
+
"types": "./dist/storage/memory/index.d.ts",
|
|
125
|
+
"import": "./dist/storage/memory/index.js"
|
|
126
|
+
},
|
|
123
127
|
"./provider/ftp": {
|
|
124
128
|
"types": "./dist/storage/ftp/index.d.ts",
|
|
125
129
|
"import": "./dist/storage/ftp/index.js"
|
|
@@ -263,7 +267,7 @@
|
|
|
263
267
|
"dependencies": {
|
|
264
268
|
"@remix-run/multipart-parser": "0.16.0",
|
|
265
269
|
"@sindresorhus/fnv1a": "3.1.0",
|
|
266
|
-
"@visulima/pagination": "5.0.0-alpha.
|
|
270
|
+
"@visulima/pagination": "5.0.0-alpha.12",
|
|
267
271
|
"file-type": "22.0.1",
|
|
268
272
|
"lru-cache": "11.4.0",
|
|
269
273
|
"mime": "^4.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var y=(d,t)=>f(d,"name",{value:t,configurable:!0});import{L as b}from"./path-D7rMc9nq-B718mbm6.js";import{d as C}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as c,ERRORS as u}from"./ERRORS-CyOuSMLY.js";import{B as w,t as O}from"./storage-Dh0tJh7j.js";import{v as T}from"./local-meta-storage-Bi0mK6gD.js";import{c as k,b as E,a as p,d as m}from"./azure-meta-storage-C4SrMtT2.js";import S from"./AzureFile-Dgj2Tef4.js";import{r as F,o as N}from"./part-match-B5fLLmFw.js";import{o as v}from"./has-content-Bx2p8Okx.js";var B=Object.defineProperty,R=y((d,t)=>B(d,"name",{value:t,configurable:!0}),"f");class q extends w{static name="azure";checksumTypes=["md5"];get raw(){return this.client}meta;client;containerClient;root;resolvedRetryConfig;signer;sasToken;anonymous;constructor(t){if(super(t),!t.containerName)throw new Error("Missing required parameter: Azure container name.");const{anonymous:r,client:e,sasToken:n,signer:s}=k(t);this.client=e,this.signer=s,this.sasToken=n,this.anonymous=r,this.containerClient=this.client.getContainerClient(t.containerName),this.root=t.root?b(t.root).replace(/^\//,""):"";const o={backoffMultiplier:2,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:R(a=>{const i=a;if(i.statusCode&&[408,429,500,502,503,504].includes(i.statusCode))return!0;if(a instanceof Error){const l=i.code;if(l==="ECONNRESET"||l==="ETIMEDOUT"||l==="ENOTFOUND"||l==="ECONNREFUSED")return!0}return!1},"shouldRetry"),...t.retryConfig};if(this.resolvedRetryConfig=o,t.metaStorage)this.meta=t.metaStorage;else{let a={...t,...t.metaStorageConfig,logger:this.logger};if("directory"in a)this.logger?.debug("Using local meta storage"),this.meta=new T(a);else{const i=t.metaStorageConfig;i&&["accountKey","accountName","connectionString","credential","endpoint","sasToken"].some(l=>l in i)||(a={...a,client:this.client}),this.meta=new E(a)}}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(a=>{this.logger?.error("Storage access check failed: %O",a)})}getRetryConfig(){return this.resolvedRetryConfig}async create(t,r){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const i=typeof t.ttl=="string"?O(t.ttl):t.ttl;i!==void 0&&(e.expiredAt=Date.now()+i)}const n=new S(e);n.name=this.namingFunction(n),await this.validate(n);try{const i=await this.getMeta(n.id);if(i.bytesWritten>=0)return i}catch{}const s=this.containerClient.getBlockBlobClient(this.getFullPath(n.name)),o={};for(const[i,l]of Object.entries(n.metadata||{}))o[i]=JSON.stringify(l);const a=await this.runOperation(r,i=>s.uploadData(Buffer.from(""),{abortSignal:i,blobHTTPHeaders:{blobContentType:n.contentType},metadata:{name:n.name,originalName:n.originalName,...o}}));return a.requestId===void 0?c(u.FILE_ERROR,"azure create upload error"):(n.requestId=a.requestId,n.uri=a._response.headers.get("location"),n.bytesWritten=0,await this.saveMeta(n),n.status="created",await this.onCreate(n),n)})}async delete({id:t},r){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);e.status="deleted",await this.runOperation(r,s=>this.containerClient.getBlockBlobClient(this.getFullPath(e.name)).deleteIfExists({abortSignal:s})),await this.deleteMeta(e.id);const n={...e};return await this.onDelete(n),n})}async move(t,r,e){return this.instrumentOperation("move",async()=>{const n=await this.copy(t,r,e),s=this.getFullPath(t);return await this.runOperation(e,o=>this.containerClient.getBlockBlobClient(s).deleteIfExists({abortSignal:o})),n})}async write(t,r){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(!F(t,e))return c(u.FILE_CONFLICT);const n=await this.lock(t.id);try{if(v(t)){if((e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(!e.contentType||e.contentType==="application/octet-stream"))try{const{fileType:i,stream:l}=await C(t.body);i?.mime&&(e.contentType=i.mime),t.body=l}catch{}const s=this.containerClient.getBlockBlobClient(this.getFullPath(e.name)),o=new AbortController;t.body.on("error",()=>{o.abort()});const a=await this.runOperation(r,i=>{const l=i?AbortSignal.any([o.signal,i]):o.signal;return s.uploadStream(t.body,void 0,void 0,{abortSignal:l,blobHTTPHeaders:{blobContentType:e.contentType??"application/octet-stream"},metadata:e.metadata})},{replayable:!1});if(a.requestId===void 0)return c(u.FILE_ERROR,"azure write upload error");e.requestId=a.requestId,e.bytesWritten+=t.contentLength||0,e.status=N(e),e.status==="completed"&&(e.uri=a._response.headers.get("location"),await this.deleteMeta(e.id))}}finally{await this.unlock(t.id,n)}return e})}async get({id:t},r){return this.instrumentOperation("get",async()=>{const e=this.containerClient.getBlockBlobClient(this.getFullPath(t));if(!await this.runOperation(r,h=>e.exists({abortSignal:h})))try{return await this.getMeta(t),c(u.GONE)}catch{return c(u.FILE_NOT_FOUND)}const n=await this.runOperation(r,h=>e.getProperties({abortSignal:h})),{contentLength:s,contentType:o,etag:a,expiresOn:i,lastModified:l,metadata:g}=n;return{content:await this.runOperation(r,h=>e.downloadToBuffer(0,void 0,{abortSignal:h})),contentType:o,ETag:a,expiredAt:i,id:t,metadata:g||{},modifiedAt:l,name:g?.name||t,originalName:g?.originalName||"",size:s}})}async exists({id:t},r){return this.instrumentOperation("exists",async()=>{try{await this.getMeta(t);const e=this.containerClient.getBlockBlobClient(this.getFullPath(t));return await this.runOperation(r,n=>e.exists({abortSignal:n}))}catch{return!1}})}async copy(t,r,e){return this.instrumentOperation("copy",async()=>{const n=this.containerClient.getBlockBlobClient(this.getFullPath(t));if(!await this.runOperation(e,i=>n.exists({abortSignal:i})))try{return await this.getMeta(t),c(u.GONE)}catch{return c(u.FILE_NOT_FOUND)}const s=this.containerClient.getBlockBlobClient(this.getFullPath(r));let o=n.url;this.signer?.kind==="userDelegation"?o=await p(this.containerClient.getBlobClient(this.getFullPath(t)),this.signer,{expiresIn:300,permissions:"r"}):this.sasToken&&(o=m(n.url,this.sasToken));const a=await this.runOperation(e,i=>s.beginCopyFromURL(o,{abortSignal:i}));return await this.runOperation(e,()=>a.pollUntilDone()),{...await this.getMeta(t),id:r,name:r}})}async list(t=1e3,r){return this.instrumentOperation("list",async()=>{const e=[];let n=!0,s;for(;n&&e.length<t;)try{const o=Math.min(t-e.length,1e3),a=(await this.runOperation(r,i=>this.containerClient.listBlobsFlat({abortSignal:i,includeMetadata:!0,prefix:this.root}).byPage({continuationToken:s,maxPageSize:o}).next())).value;if(a!==void 0&&"segment"in a){for(const i of a.segment.blobItems)if(!i.deleted&&(e.push({createdAt:i.properties.createdOn,id:i.name,modifiedAt:i.properties.lastModified}),e.length>=t))break}n=a?.continuationToken!==void 0,n&&(s=a.continuationToken)}catch(o){const a=this.normalizeError(o instanceof Error?o:new Error(String(o)));throw await this.onError(a),o}return e},{limit:t})}async getReadUrl(t,r){const e=this.containerClient.getBlobClient(this.getFullPath(t));return this.signer?p(e,this.signer,{expiresIn:r?.expiresIn??3600,permissions:"r",...r?.responseContentDisposition&&{contentDisposition:r.responseContentDisposition},...r?.responseContentType&&{contentType:r.responseContentType}}):this.sasToken?m(e.url,this.sasToken):this.anonymous?e.url:c(u.METHOD_NOT_ALLOWED,"azure: cannot produce a read URL without a shared key, Microsoft Entra credential, or SAS token. Construct the adapter with accountKey + accountName, a connectionString containing an account key, a credential + accountName, or a sasToken.")}async getUploadUrl(t,r){const e=this.containerClient.getBlobClient(this.getFullPath(t));return this.signer?p(e,this.signer,{expiresIn:r?.expiresIn??3600,permissions:"cw"}):this.sasToken?m(e.url,this.sasToken):c(u.METHOD_NOT_ALLOWED,"azure: cannot produce an upload URL without a shared key, Microsoft Entra credential, or SAS token. Anonymous (public-container) access is read-only.")}getFullPath(t){return this.assetFolder!==void 0?`${this.assetFolder}/${t}`:t}async accessCheck(){await this.runOperation(void 0,t=>this.containerClient.getProperties({abortSignal:t}))}}export{q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var x=Object.defineProperty;var C=(a,e)=>x(a,"name",{value:e,configurable:!0});import{Readable as b}from"node:stream";import{BoxDeveloperTokenAuth as F,BoxClient as p,OAuthConfig as T,BoxOAuth as S,CcgConfig as U,BoxCcgAuth as L,BoxJwtAuth as R,JwtConfig as v}from"box-typescript-sdk-gen";import{throwErrorCode as B,ERRORS as k}from"./ERRORS-CyOuSMLY.js";import{B as A}from"./storage-Dh0tJh7j.js";import w from"./BoxFile-Be0S4N1L.js";import D from"./BoxMetaStorage-DLdXbZaV.js";import{o as E,r as H}from"./part-match-B5fLLmFw.js";import{u as _}from"./update-size-DANV7aa2.js";import{o as N}from"./has-content-Bx2p8Okx.js";var M=Object.defineProperty,c=C((a,e)=>M(a,"name",{value:e,configurable:!0}),"u");const j="0",$=50*1024*1024,m={ensureReady:c(()=>Promise.resolve(),"ensureReady")},z=c(a=>{let e=0,i=a.length;for(;e<i&&a[e]==="/";)e+=1;for(;i>e&&a[i-1]==="/";)i-=1;return e===0&&i===a.length?a:a.slice(e,i)},"trimSlashes"),y=c(a=>{const e=z(a);if(!e)throw new Error("Box: key must not be empty");const i=e.split("/").filter(r=>r.length>0),t=i.pop()??"";if(!t)throw new Error(`Box: key "${a}" has no file name segment`);return{leaf:t,parents:i}},"splitKey"),P=c(async a=>{const e=[];for await(const i of a)e.push(Buffer.from(i));return Buffer.concat(e)},"collectStream"),I=c(a=>b.from(a),"bufferToReadable"),J=c(a=>"configJsonString"in a?v.fromConfigJsonString(a.configJsonString):v.fromConfigFile(a.configFilePath),"buildJwtConfig"),K=c(a=>[a.developerToken,a.oauth,a.ccg,a.jwt].filter(e=>e!==void 0).length,"countAuthMethods"),q=c(a=>{if(a.client)return{authHandle:m,client:a.client};if(K(a)>1)throw new Error("Box storage: pass exactly one of `developerToken`, `oauth`, `ccg`, or `jwt`.");if(a.developerToken!==void 0){const i=new F({token:a.developerToken});return{authHandle:m,client:new p({auth:i})}}if(a.oauth){const{clientId:i,clientSecret:t,refreshToken:r}=a.oauth,s=new T({clientId:i,clientSecret:t}),n=new S({config:s});let l;const o=c(async()=>{await n.tokenStorage.store({accessToken:"",refreshToken:r})},"seed");return{authHandle:{ensureReady:c(()=>(l||(l=o()),l),"ensureReady")},client:new p({auth:n})}}if(a.ccg){const{clientId:i,clientSecret:t,enterpriseId:r,userId:s}=a.ccg;if(!r&&!s)throw new Error("Box storage: `ccg` auth requires either `enterpriseId` or `userId`.");const n=new U({clientId:i,clientSecret:t,...r!==void 0&&{enterpriseId:r},...s!==void 0&&{userId:s}}),l=new L({config:n});return{authHandle:m,client:new p({auth:l})}}if(a.jwt){const i=J(a.jwt),t=new R({config:i});return{authHandle:m,client:new p({auth:t})}}const e=process.env.BOX_DEVELOPER_TOKEN;if(e){const i=new F({token:e});return{authHandle:m,client:new p({auth:i})}}throw new Error("Box storage: missing auth. Pass `client`, `developerToken`, `oauth`, `ccg`, or `jwt`. Env fallback: BOX_DEVELOPER_TOKEN.")},"resolveAuth"),W=c(a=>{if(a&&typeof a=="object"){const e=a,i=e.responseInfo?.code??e.responseInfo?.body?.code;return e.responseInfo?.statusCode===404||i==="not_found"||i==="file_not_found"||i==="folder_not_found"||i==="trashed"}return!1},"isNotFoundError"),O=c(a=>{if(a&&typeof a=="object"){const e=a,i=e.responseInfo?.code??e.responseInfo?.body?.code;return e.responseInfo?.statusCode===409||i==="item_name_in_use"||i==="conflict"}return!1},"isConflictError");class ae extends A{static name="box";checksumTypes=[];meta;authHandle;client;fileIdCache;folderIdCache;publicByDefault;rootFolderId;constructor(e){super(e),this.rootFolderId=e.rootFolderId??j,this.publicByDefault=e.publicByDefault??!1;const i=q(e);this.client=i.client,this.authHandle=i.authHandle,this.folderIdCache=new Map,this.fileIdCache=new Map,this.meta=e.metaStorage??new D(e.metaStorageConfig),this.isReady=!0}get raw(){return this.client}async create(e,i){return this.instrumentOperation("create",async()=>{const t=new w(e);t.name=this.namingFunction(t),await this.validate(t);try{const r=await this.getMeta(t.id);if(r.bytesWritten>=0)return r}catch{}return t.bytesWritten=0,t.status=E(t),await this.saveMeta(t),await this.onCreate(t),t})}async write(e,i){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&_(t,e.size),!H(e,t))throw new Error("File part does not match");const r=await this.lock(e.id);try{if(N(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");await this.authHandle.ensureReady();const s=await P(e.body),n=t.name||t.id,{leaf:l,parents:o}=y(n),d=await this.resolveFolderId(o,{create:!0},i),f=await this.resolveExistingFileForUpload(n,d,l,i),h=await this.performUpload(f,d,l,s,i);h.id&&(this.fileIdCache.set(n,h.id),this.publicByDefault&&await this.ensureSharedLink(h.id,i)),t.bytesWritten=s.length,t.size=s.length,t.boxFileId=h.id,t.eTag=h.etag??void 0,t.ETag=h.etag??void 0}return t.status=E(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,r)}})}async delete({id:e},i){return this.instrumentOperation("delete",async()=>{let t;try{t=await this.getMeta(e)}catch{}const r=t?.name??e;await this.authHandle.ensureReady();try{const s=t?.boxFileId??await this.resolveFileId(r,i);await this.runOperation(i,()=>this.client.files.deleteFileById(s)),this.fileIdCache.delete(r)}catch(s){if(!W(s))throw s}return t?(t.status="deleted",await this.deleteMeta(t.id),await this.onDelete(t),t):Object.assign(new w({contentType:"application/octet-stream",metadata:{},originalName:e}),{id:e,name:e,status:"deleted"})})}async get({id:e},i){return this.instrumentOperation("get",async()=>{let t,r=e;try{t=await this.checkIfExpired(await this.getMeta(e)),r=t.name??e}catch{}await this.authHandle.ensureReady();const s=t?.boxFileId??await this.resolveFileId(r,i),n=await this.runOperation(i,()=>this.client.files.getFileById(s)),l=await this.runOperation(i,()=>this.client.downloads.getDownloadFileUrl(s)),o=await this.runOperation(i,()=>fetch(l));if(!o.ok)throw new Error(`Box: download fetch failed (${o.status})`);const d=await this.runOperation(i,()=>o.arrayBuffer()),f=Buffer.from(d);return{content:f,contentType:t?.contentType??"application/octet-stream",ETag:t?.ETag??n.etag??void 0,expiredAt:t?.expiredAt,id:e,metadata:t?.metadata??{},modifiedAt:t?.modifiedAt??n.modifiedAt??n.contentModifiedAt??void 0,name:t?.name??n.name??r,originalName:t?.originalName??n.name??r,size:t?.size??n.size??f.length}})}async copy(e,i,t){return this.instrumentOperation("copy",async()=>{await this.authHandle.ensureReady();const r=await this.resolveFileId(e,t),{leaf:s,parents:n}=y(i),l=await this.resolveFolderId(n,{create:!0},t),o=await this.runOperation(t,()=>this.client.files.copyFile(r,{name:s,parent:{id:l}}));o.id&&this.fileIdCache.set(i,o.id);const d=new w({contentType:"application/octet-stream",metadata:{},originalName:i});return d.id=i,d.name=i,d.boxFileId=o.id,d.eTag=o.etag??void 0,d.ETag=o.etag??void 0,d})}async move(e,i,t){return this.instrumentOperation("move",async()=>{await this.authHandle.ensureReady();const r=await this.resolveFileId(e,t),{leaf:s,parents:n}=y(i),l=await this.resolveFolderId(n,{create:!0},t),o=await this.runOperation(t,()=>this.client.files.updateFileById(r,{requestBody:{name:s,parent:{id:l}}}));this.fileIdCache.delete(e),o.id&&this.fileIdCache.set(i,o.id);const d=new w({contentType:"application/octet-stream",metadata:{},originalName:i});d.id=i,d.name=i,d.boxFileId=o.id,d.eTag=o.etag??void 0,d.ETag=o.etag??void 0;try{await this.deleteMeta(e)}catch{}return d})}async list(e=1e3,i){return this.instrumentOperation("list",async()=>{await this.authHandle.ensureReady();const t=[];let r=0;const s=Math.min(e,1e3);for(;t.length<e;){const n=(await this.runOperation(i,()=>this.client.folders.getFolderItems(this.rootFolderId,{queryParams:{fields:["id","name","size","modified_at","etag","type"],limit:s,offset:r}}))).entries??[];for(const l of n){const o=l;if(o.type!=="file"||!o.id||!o.name)continue;this.fileIdCache.set(o.name,o.id);const d=new w({contentType:"application/octet-stream",metadata:{},originalName:o.name});if(d.id=o.name,d.name=o.name,d.boxFileId=o.id,d.eTag=o.etag??void 0,d.ETag=o.etag??void 0,d.size=o.size??0,d.modifiedAt=o.modifiedAt??o.contentModifiedAt??void 0,t.push(d),t.length>=e)break}if(n.length<s)break;r+=n.length}return t},{limit:e})}async getReadUrl(e,i){if(i?.responseContentDisposition||i?.responseContentType)return B(k.METHOD_NOT_ALLOWED,"Box: `responseContentDisposition` / `responseContentType` are not supported — Box download URLs and shared-link URLs have no overrides.");await this.authHandle.ensureReady();const t=await this.resolveFileId(e);return this.publicByDefault?this.ensureSharedLink(t):this.client.downloads.getDownloadFileUrl(t)}async getUploadUrl(e,i){return B(k.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(e,i,t){let r=0;const s=1e3;for(;;){const n=(await this.runOperation(t,()=>this.client.folders.getFolderItems(e,{queryParams:{fields:["id","name","type"],limit:s,offset:r}}))).entries??[];for(const l of n){const o=l;if(o.name===i&&o.id&&o.type)return{id:o.id,type:o.type}}if(n.length<s)return;r+=n.length}}folderCacheKey(e){return e.join("/")}async resolveFolderId(e,i,t){if(e.length===0)return this.rootFolderId;const r=this.folderCacheKey(e),s=this.folderIdCache.get(r);if(s)return s;let n=this.rootFolderId;const l=[];for(const o of e){l.push(o);const d=this.folderCacheKey(l),f=this.folderIdCache.get(d);if(f){n=f;continue}const h=await this.findChildByName(n,o,t);if(h&&h.type==="folder"){n=h.id,this.folderIdCache.set(d,n);continue}if(h&&h.type!=="folder")throw new Error(`Box: path segment "${o}" exists but is not a folder`);if(!i.create)throw new Error(`Box: folder "${l.join("/")}" not found`);try{const u=await this.runOperation(t,()=>this.client.folders.createFolder({name:o,parent:{id:n}}));if(!u.id)throw new Error(`Box: createFolder did not return an id for "${o}"`);n=u.id,this.folderIdCache.set(d,n)}catch(u){if(O(u)){const g=await this.findChildByName(n,o,t);if(g&&g.type==="folder"){n=g.id,this.folderIdCache.set(d,n);continue}}throw u}}return this.folderIdCache.set(r,n),n}async resolveFileId(e,i){const t=this.fileIdCache.get(e);if(t)return t;const{leaf:r,parents:s}=y(e),n=await this.resolveFolderId(s,{create:!1},i),l=await this.findChildByName(n,r,i);if(!l||l.type!=="file")throw new Error(`Box: file "${e}" not found`);return this.fileIdCache.set(e,l.id),l.id}async resolveExistingFileForUpload(e,i,t,r){const s=this.fileIdCache.get(e);if(s)return s;const n=await this.findChildByName(i,t,r);if(n){if(n.type==="file")return this.fileIdCache.set(e,n.id),n.id;throw new Error(`Box: "${e}" already exists as a non-file (${n.type})`)}}async performUpload(e,i,t,r,s){if(r.byteLength>$)return await this.runOperation(s,()=>this.client.chunkedUploads.uploadBigFile(I(r),t,r.byteLength,i));if(e){const l=((await this.runOperation(s,()=>this.client.uploads.uploadFileVersion(e,{attributes:{name:t},file:I(r)}))).entries??[])[0];if(!l)throw new Error("Box: uploadFileVersion returned no file");return l}const n=((await this.runOperation(s,()=>this.client.uploads.uploadFile({attributes:{name:t,parent:{id:i}},file:I(r)}))).entries??[])[0];if(!n)throw new Error("Box: uploadFile returned no file");return n}async ensureSharedLink(e,i){try{const t=(await this.runOperation(i,()=>this.client.sharedLinksFiles.addShareLinkToFile(e,{sharedLink:{access:"open"}},{fields:"shared_link"}))).sharedLink;return(t?.downloadUrl??t?.url)||this.fetchSharedLinkUrl(e,i)}catch(t){if(O(t))return this.fetchSharedLinkUrl(e,i);throw t}}async fetchSharedLinkUrl(e,i){const t=(await this.runOperation(i,()=>this.client.sharedLinksFiles.getSharedLinkForFile(e,{fields:"shared_link"}))).sharedLink,r=t?.downloadUrl??t?.url;if(!r)throw new Error("Box: file has no shared link. Call write() with publicByDefault: true, or addShareLinkToFile via storage.raw.");return r}internalOnComplete=c(e=>this.deleteMeta(e.id),"internalOnComplete")}export{ae as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var g=(r,e)=>T(r,"name",{value:e,configurable:!0});import{Readable as b}from"node:stream";import{wrapStorageError as h}from"./ERRORS-CyOuSMLY.js";import{B as E}from"./storage-Dh0tJh7j.js";import l from"./BunS3File-D-SRiyrm.js";import O from"./BunS3MetaStorage-Bv_CTTMz.js";import{o as f,r as I}from"./part-match-B5fLLmFw.js";import{u as v}from"./update-size-DANV7aa2.js";import{o as C}from"./has-content-Bx2p8Okx.js";var k=Object.defineProperty,p=g((r,e)=>k(r,"name",{value:e,configurable:!0}),"c");const c=p(r=>r.replace(/^\/+/u,""),"toKey"),z=p(async r=>{const e=[];for await(const i of r)e.push(Buffer.from(i));return Buffer.concat(e)},"collectStream"),B=p(r=>{const e=r?.code;return typeof e=="string"&&/nosuchkey|notfound/iu.test(e)},"isNotFoundError"),u=p((r,e)=>{const i=r?.code,t=typeof i=="string"?i:"";return/nosuchkey|notfound/iu.test(t)?h(r,{adapter:"Bun S3",operation:e,status:404}):/accessdenied|forbidden|ERR_S3_INVALID_SIGNATURE|ERR_S3_MISSING_CREDENTIALS/iu.test(t)?h(r,{adapter:"Bun S3",operation:e,status:403}):h(r,{adapter:"Bun S3",operation:e})},"wrapBunS3Error"),M=p(r=>{if(r.client)return r.client;const e=globalThis.Bun;if(!e?.S3Client)throw new Error("BunS3Storage requires the Bun runtime (Bun.S3Client). Run this under Bun, or pass a pre-built `client` instance. For Node/edge runtimes use the `aws` or `aws-light` provider instead.");return new e.S3Client({accessKeyId:r.accessKeyId,acl:r.acl,bucket:r.bucket,endpoint:r.endpoint,region:r.region,secretAccessKey:r.secretAccessKey,sessionToken:r.sessionToken,virtualHostedStyle:r.virtualHostedStyle})},"resolveClient");class L extends E{static name="bun-s3";meta;client;constructor(e){super(e),this.client=M(e),this.meta=e.metaStorage??new O(e.metaStorageConfig),this.isReady=!0}get raw(){return this.client}async create(e,i){return this.instrumentOperation("create",async()=>{const t=new l(e);t.name=this.namingFunction(t),t.bunS3Key=c(t.name),await this.validate(t);try{const n=await this.getMeta(t.id);if(n.bytesWritten>=0)return n}catch{}return t.bytesWritten=0,t.status=f(t),await this.saveMeta(t),await this.onCreate(t),t})}async write(e,i){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&v(t,e.size),!I(e,t))throw new Error("File part does not match");const n=await this.lock(e.id);try{if(C(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const s=await z(e.body),a=c(t.name||t.id);try{await this.runOperation(i,()=>this.client.write(a,s,{type:t.contentType}))}catch(o){throw u(o,"upload")}t.bytesWritten=s.length,t.size=s.length,t.bunS3Key=a}return t.status=f(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,n)}})}async delete({id:e},i){return this.instrumentOperation("delete",async()=>{let t;try{t=await this.getMeta(e)}catch{}const n=t?.bunS3Key??c(t?.name??e);try{await this.runOperation(i,()=>this.client.delete(n))}catch(a){if(!B(a))throw u(a,"delete")}if(t)return t.status="deleted",await this.deleteMeta(t.id),await this.onDelete(t),t;const s=new l({contentType:"application/octet-stream",metadata:{},originalName:e});return s.id=e,s.name=e,s.bunS3Key=n,s.status="deleted",s})}async get({id:e},i){return this.instrumentOperation("get",async()=>{let t,n;try{t=await this.checkIfExpired(await this.getMeta(e)),n=t.bunS3Key??c(t.name??e)}catch{n=c(e)}const s=this.client.file(n);let a,o;try{t||(o=await this.runOperation(i,()=>s.stat())),a=Buffer.from(await this.runOperation(i,()=>s.arrayBuffer()))}catch(d){throw u(d,"get")}return{content:a,contentType:t?.contentType??o?.type??"application/octet-stream",ETag:t?.ETag??o?.etag??void 0,expiredAt:t?.expiredAt,id:e,metadata:t?.metadata??{},modifiedAt:t?.modifiedAt??o?.lastModified?.toISOString(),name:t?.name??n,originalName:t?.originalName??n,size:t?.size??o?.size??a.length}})}async getStream({id:e},i){return this.instrumentOperation("getStream",async()=>{let t,n;try{t=await this.checkIfExpired(await this.getMeta(e)),n=t.bunS3Key??c(t.name??e)}catch{n=c(e)}const s=this.client.file(n);let a,o;try{a=await this.runOperation(i,()=>s.stat()),o=s.stream()}catch(S){throw u(S,"getStream")}const d=t?.size??a.size,w=t?.contentType??a.type??"application/octet-stream",m=t?.ETag??a.etag,y=t?.modifiedAt??a.lastModified?.toISOString();return{headers:{"Content-Length":String(d??0),"Content-Type":w,...m&&{ETag:m},...y&&{"Last-Modified":String(y)}},size:typeof d=="number"?d:void 0,stream:b.fromWeb(o)}})}async copy(e,i,t){return this.instrumentOperation("copy",async()=>{const n=await this.get({id:e},t),s=c(i);try{await this.runOperation(t,()=>this.client.write(s,n.content,{type:n.contentType}))}catch(o){throw u(o,"copy")}const a=new l({contentType:n.contentType,metadata:{},originalName:i});return a.id=i,a.name=i,a.bunS3Key=s,a.size=typeof n.size=="string"?Number(n.size):n.size??n.content.length,a.ETag=n.ETag,a.bunS3ETag=n.ETag,a})}async move(e,i,t){return this.instrumentOperation("move",async()=>{const n=await this.copy(e,i,t);return await this.delete({id:e},t),n})}async list(e=1e3,i){return this.instrumentOperation("list",async()=>{let t;try{t=await this.runOperation(i,()=>this.client.list({maxKeys:e}))}catch(n){throw u(n,"list")}return(t.contents??[]).filter(n=>!!n.key).slice(0,e).map(n=>{const s=c(n.key),a=new l({contentType:"application/octet-stream",metadata:{},originalName:s});return a.id=s,a.name=s,a.bunS3Key=s,a.size=n.size,a.ETag=n.eTag??void 0,a.bunS3ETag=n.eTag??void 0,a.modifiedAt=n.lastModified?new Date(n.lastModified).toISOString():void 0,a})},{limit:e})}async getReadUrl(e,i){return this.client.file(c(e)).presign({...i?.responseContentDisposition&&{contentDisposition:i.responseContentDisposition},...i?.expiresIn!==void 0&&{expiresIn:i.expiresIn},method:"GET",...i?.responseContentType&&{type:i.responseContentType}})}async getUploadUrl(e,i){return this.client.presign(c(e),{...i?.expiresIn!==void 0&&{expiresIn:i.expiresIn},method:"PUT",...i?.contentType&&{type:i.contentType}})}internalOnComplete=p(e=>this.deleteMeta(e.id),"internalOnComplete")}export{L as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var N=Object.defineProperty;var f=(n,t)=>N(n,"name",{value:t,configurable:!0});import*as u from"@bunny.net/storage-sdk";import{throwErrorCode as y,ERRORS as g,wrapStorageError as m}from"./ERRORS-CyOuSMLY.js";import{B}from"./storage-Dh0tJh7j.js";import d from"./BunnyFile-Dotl-lO9.js";import b from"./BunnyMetaStorage-DNMTSeoN.js";import{o as E,r as A}from"./part-match-B5fLLmFw.js";import{u as _}from"./update-size-DANV7aa2.js";import{o as R}from"./has-content-Bx2p8Okx.js";var U=Object.defineProperty,c=f((n,t)=>U(n,"name",{value:t,configurable:!0}),"u");const O=new Set(Object.values(u.regions.StorageRegion)),h=c(n=>`/${n.replace(/^\/+/u,"")}`,"toBunnyPath"),w=c(n=>n.replace(/^\/+/u,""),"fromBunnyPath"),C=c((n,t)=>{const r=n.replace(/\/+$/u,""),e=t.replace(/^\/+/u,"");return`${r}/${e}`},"joinPublicUrl"),v=c(async n=>{const t=[];for await(const r of n)t.push(Buffer.from(r));return Buffer.concat(t)},"collectStream"),S=c(n=>new ReadableStream({start(t){t.enqueue(new Uint8Array(n)),t.close()}}),"streamFromBuffer"),z=c(n=>{if(n){if(!O.has(n))throw new Error(`Bunny Storage: unsupported region "${n}". Pass one of ${[...O].join(", ")}.`);return n}},"parseRegion"),P=c(n=>{if(n.client)return n.client;const t=n.zone??process.env.BUNNY_STORAGE_ZONE??process.env.STORAGE_ZONE,r=n.accessKey??process.env.BUNNY_STORAGE_ACCESS_KEY??process.env.BUNNY_ACCESS_KEY??process.env.STORAGE_ACCESS_KEY,e=z(n.region??process.env.BUNNY_STORAGE_REGION??process.env.STORAGE_REGION);if(!t||!r||!e)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 u.zone.connect_with_accesskey(e,t,r)},"resolveClient"),k=c(async n=>Buffer.from(await new Response(n).arrayBuffer()),"collectFromWebStream"),p=c((n,t)=>{const r=n?.message,e=typeof r=="string"?r:"";return/^file not found/iu.test(e)?m(n,{adapter:"Bunny Storage",operation:t,status:404}):/^unauthorized access/iu.test(e)?m(n,{adapter:"Bunny Storage",operation:t,status:401}):/^unable to upload file/iu.test(e)?m(n,{adapter:"Bunny Storage",operation:t,status:400}):m(n,{adapter:"Bunny Storage",operation:t})},"wrapBunnyError");class x extends B{static name="bunny";checksumTypes=["SHA256"];meta;client;publicBaseUrl;zoneName;constructor(t){super(t),this.client=P(t),this.zoneName=u.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,r){return this.instrumentOperation("create",async()=>{const e=new d(t);e.name=this.namingFunction(e),e.bunnyPath=h(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=E(e),await this.saveMeta(e),await this.onCreate(e),e})}async write(t,r){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&&_(e,t.size),!A(t,e))throw new Error("File part does not match");const a=await this.lock(t.id);try{if(R(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const i=await v(t.body),o=h(e.name||e.id);try{await this.runOperation(r,()=>u.file.upload(this.client,o,S(i),{contentType:e.contentType,...t.checksum&&t.checksumAlgorithm==="sha256"&&{sha256Checksum:t.checksum}}))}catch(s){throw p(s,"upload")}e.bytesWritten=i.length,e.size=i.length,e.bunnyPath=o}return e.status=E(e),e.status==="completed"&&await this.internalOnComplete(e),await this.saveMeta(e),e}finally{await this.unlock(t.id,a)}})}async delete({id:t},r){return this.instrumentOperation("delete",async()=>{let e;try{e=await this.getMeta(t)}catch{}const a=e?.bunnyPath??h(e?.name??t);try{await this.runOperation(r,()=>u.file.remove(this.client,a))}catch(o){throw p(o,"delete")}if(e)return e.status="deleted",await this.deleteMeta(e.id),await this.onDelete(e),e;const i=new d({contentType:"application/octet-stream",metadata:{},originalName:t});return i.id=t,i.name=t,i.bunnyPath=a,i.status="deleted",i})}async get({id:t},r){return this.instrumentOperation("get",async()=>{let e,a;try{e=await this.checkIfExpired(await this.getMeta(t)),a=e.bunnyPath??h(e.name??t)}catch{a=h(t)}let i;try{i=await this.runOperation(r,()=>u.file.get(this.client,a))}catch(s){throw p(s,"get")}let o;try{const s=await this.runOperation(r,()=>i.data());o=await k(s.stream)}catch(s){throw p(s,"download")}return{content:o,contentType:e?.contentType??i.contentType??"application/octet-stream",ETag:e?.ETag??i.checksum??void 0,expiredAt:e?.expiredAt,id:t,metadata:e?.metadata??{},modifiedAt:e?.modifiedAt??i.lastChanged?.toISOString(),name:e?.name??w(a),originalName:e?.originalName??w(a),size:e?.size??i.length??o.length}})}async copy(t,r,e){return this.instrumentOperation("copy",async()=>{const a=await this.get({id:t},e),i=h(r),o=a.content,s=typeof a.size=="string"?Number(a.size):a.size??o.length;try{await this.runOperation(e,()=>u.file.upload(this.client,i,S(o),{contentType:a.contentType}))}catch(T){throw p(T,"copy")}const l=new d({contentType:a.contentType,metadata:{},originalName:r});return l.id=r,l.name=r,l.bunnyPath=i,l.size=s,l.ETag=a.ETag,l.bunnyChecksum=a.ETag,l})}async move(t,r,e){return this.instrumentOperation("move",async()=>{const a=await this.copy(t,r,e);return await this.delete({id:t},e),a})}async list(t=1e3,r){return this.instrumentOperation("list",async()=>{let e;try{e=await this.runOperation(r,()=>u.file.list(this.client,"/"))}catch(a){throw p(a,"list")}return e.filter(a=>!a.isDirectory).slice(0,t).map(a=>{const i=a.path.endsWith(a.objectName)||!a.objectName?a.path:`${a.path.replace(/\/+$/u,"")}/${a.objectName}`,o=w(i),s=new d({contentType:a.contentType||"application/octet-stream",metadata:{},originalName:o});return s.id=o,s.name=o,s.bunnyPath=h(o),s.bunnyChecksum=a.checksum??void 0,s.ETag=a.checksum??void 0,s.size=a.length,s.modifiedAt=a.lastChanged?.toISOString(),s})},{limit:t})}async getReadUrl(t,r){return r?.responseContentDisposition?y(g.METHOD_NOT_ALLOWED,"Bunny Storage: `responseContentDisposition` is not supported — no override exists on Bunny Storage / Pull Zone URLs."):this.publicBaseUrl?C(this.publicBaseUrl,t):y(g.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,r){return y(g.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=c(t=>this.deleteMeta(t.id),"internalOnComplete")}export{x as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var u=(n,e)=>h(n,"name",{value:e,configurable:!0});import{v2 as l}from"cloudinary";import{throwErrorCode as d,ERRORS as m}from"./ERRORS-CyOuSMLY.js";import{B as f}from"./storage-Dh0tJh7j.js";import c from"./CloudinaryFile-B5-m33eS.js";import w from"./CloudinaryMetaStorage-DEBk5eQy.js";import{o as y,r as v}from"./part-match-B5fLLmFw.js";import{u as _}from"./update-size-DANV7aa2.js";import{o as g}from"./has-content-Bx2p8Okx.js";var T=Object.defineProperty,p=u((n,e)=>T(n,"name",{value:e,configurable:!0}),"c");const O=p(async n=>{const e=[];for await(const a of n)e.push(Buffer.from(a));return Buffer.concat(e)},"collectStream"),E=p(n=>{if(!n)return{};const e=n.match(/^cloudinary:\/\/([^:]+):([^@]+)@(.+)$/);return e?{apiKey:e[1],apiSecret:e[2],cloudName:e[3]}:{}},"parseCloudinaryUrl");class R extends f{static name="cloudinary";checksumTypes=[];meta;client;defaultUrlExpiresIn;deliveryType;resourceType;secure;constructor(e){if(super(e),this.resourceType=e.resourceType??"raw",this.deliveryType=e.type??"upload",this.secure=e.secure??!0,this.defaultUrlExpiresIn=e.defaultUrlExpiresIn??3600,e.client)this.client=e.client;else{const a=E(process.env.CLOUDINARY_URL),t=e.cloudName??process.env.CLOUDINARY_CLOUD_NAME??a.cloudName,r=e.apiKey??process.env.CLOUDINARY_API_KEY??a.apiKey,i=e.apiSecret??process.env.CLOUDINARY_API_SECRET??a.apiSecret;if(!t)throw new Error("Cloudinary storage: `cloudName` is required (or set CLOUDINARY_CLOUD_NAME / CLOUDINARY_URL).");l.config({api_key:r,api_secret:i,cloud_name:t,secure:this.secure}),this.client=l}this.meta=e.metaStorage??new w(e.metaStorageConfig),this.isReady=!0}get raw(){return this.client}async create(e,a){return this.instrumentOperation("create",async()=>{const t=new c(e);t.name=this.namingFunction(t),t.path=t.name,await this.validate(t);try{const r=await this.getMeta(t.id);if(r.bytesWritten>=0)return r}catch{}return t.bytesWritten=0,t.status=y(t),await this.saveMeta(t),await this.onCreate(t),t})}async write(e,a){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&_(t,e.size),!v(e,t))throw new Error("File part does not match");const r=await this.lock(e.id);try{if(g(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const i=await O(e.body),s=t.path??t.name,o=await this.runOperation(a,()=>this.uploadBuffer(s,i));t.bytesWritten=i.length,t.size=i.length,t.path=o.public_id??s,t.publicUrl=o.secure_url??o.url,t.ETag=o.version===void 0?void 0:String(o.version)}return t.status=y(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,r)}})}async delete({id:e},a){return this.instrumentOperation("delete",async()=>{let t;try{t=await this.getMeta(e)}catch{}const r=t?.path??t?.name??e;return await this.runOperation(a,()=>this.client.uploader.destroy(r,{invalidate:!0,resource_type:this.resourceType,type:this.deliveryType})),t?(t.status="deleted",await this.deleteMeta(t.id),await this.onDelete(t),t):Object.assign(new c({contentType:"application/octet-stream",metadata:{},originalName:e}),{id:e,name:e,path:r,status:"deleted"})})}async exists({id:e},a){return this.instrumentOperation("exists",async()=>{let t=e;try{t=(await this.getMeta(e)).path??e}catch{}try{return await this.runOperation(a,()=>this.client.api.resource(t,{resource_type:this.resourceType,type:this.deliveryType})),!0}catch{return!1}})}async get({id:e},a){return this.instrumentOperation("get",async()=>{let t=e,r;try{r=await this.checkIfExpired(await this.getMeta(e)),t=r.path??r.name??e}catch{}const i=await this.runOperation(a,()=>this.client.api.resource(t,{resource_type:this.resourceType,type:this.deliveryType})),s=await this.runOperation(a,()=>fetch(this.client.url(t,{resource_type:this.resourceType,secure:this.secure,type:this.deliveryType})));if(!s.ok)throw new Error(`Cloudinary: object not found at "${t}"`);const o=Buffer.from(await s.arrayBuffer());return{content:o,contentType:r?.contentType??(i.resource_type&&i.format?`${i.resource_type}/${i.format}`:void 0)??"application/octet-stream",ETag:r?.ETag??(i.version===void 0?void 0:String(i.version)),expiredAt:r?.expiredAt,id:e,metadata:r?.metadata??{},modifiedAt:r?.modifiedAt,name:r?.name??t,originalName:r?.originalName??t,size:r?.size??(typeof i.bytes=="number"?i.bytes:o.length)}})}async copy(e,a,t){return this.instrumentOperation("copy",async()=>{const r=(await this.getMetaSafe(e))?.path??e,i=this.client.url(r,{resource_type:this.resourceType,secure:this.secure,type:this.deliveryType});await this.runOperation(t,()=>this.client.uploader.upload(i,{overwrite:!0,public_id:a,resource_type:this.resourceType,type:this.deliveryType}));const s=new c({contentType:"application/octet-stream",metadata:{},originalName:a});return s.id=a,s.name=a,s.path=a,s})}async move(e,a,t){return this.instrumentOperation("move",async()=>{const r=(await this.getMetaSafe(e))?.path??e;await this.runOperation(t,()=>this.client.uploader.rename(r,a,{resource_type:this.resourceType}));const i=new c({contentType:"application/octet-stream",metadata:{},originalName:a});i.id=a,i.name=a,i.path=a;try{await this.deleteMeta(e)}catch{}return i})}async list(e=1e3,a){return this.instrumentOperation("list",async()=>{const{resources:t}=await this.runOperation(a,()=>this.client.api.resources({max_results:e,resource_type:this.resourceType,type:this.deliveryType}));return(t??[]).map(r=>{const i=new c({contentType:r.resource_type&&r.format?`${r.resource_type}/${r.format}`:"application/octet-stream",metadata:{},originalName:r.public_id});return i.id=r.public_id,i.name=r.public_id,i.path=r.public_id,i.size=typeof r.bytes=="number"?r.bytes:void 0,i.createdAt=r.created_at??void 0,i.ETag=r.version===void 0?void 0:String(r.version),i})},{limit:e})}async getReadUrl(e,a){if(this.deliveryType==="upload")return this.client.url(e,{resource_type:this.resourceType,secure:this.secure,type:this.deliveryType});const t=a?.expiresIn??this.defaultUrlExpiresIn,r=e.lastIndexOf("."),i=r>0?e.slice(r+1):"";try{return this.client.utils.private_download_url(e,i,{expires_at:Math.floor(Date.now()/1e3)+t,resource_type:this.resourceType,type:this.deliveryType})}catch(s){return d(m.METHOD_NOT_ALLOWED,s instanceof Error?s.message:"Cloudinary: private_download_url failed")}}uploadBuffer(e,a){return new Promise((t,r)=>{this.client.uploader.upload_stream({overwrite:!0,public_id:e,resource_type:this.resourceType,type:this.deliveryType},(i,s)=>{if(i||!s){r(i instanceof Error?i:new Error(i?.message??"Cloudinary: upload failed"));return}t(s)}).end(a)})}async getMetaSafe(e){try{return await this.getMeta(e)}catch{return}}internalOnComplete=p(e=>this.deleteMeta(e.id),"internalOnComplete")}export{R as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"node:fs";import"node:fs/promises";import"node:stream";import"./local-meta-storage-Bi0mK6gD.js";import{f as c}from"./disk-storage-CKAJvhcj.js";import"./path-D7rMc9nq-B718mbm6.js";import"./index-B4ETk0Lu.js";import"./detect-file-type-5JhzC9RU.js";import"./ERRORS-CyOuSMLY.js";import"./storage-Dh0tJh7j.js";import"./File-BhfUgJjs.js";import"./part-match-B5fLLmFw.js";import"./update-size-DANV7aa2.js";import"./has-content-Bx2p8Okx.js";export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
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-CKAJvhcj.js";import{y as S}from"./local-meta-storage-Bi0mK6gD.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var E=Object.defineProperty;var O=(a,e)=>E(a,"name",{value:e,configurable:!0});import{DropboxResponseError as v,DropboxAuth as d,Dropbox as f}from"dropbox";import{throwErrorCode as y,ERRORS as w}from"./ERRORS-CyOuSMLY.js";import{c as D}from"./oauth-refresh-Dg2ybc6_.js";import{B as S}from"./storage-Dh0tJh7j.js";import p from"./DropboxFile-BGVG2kXM.js";import x from"./DropboxMetaStorage-C6vj1QDA.js";import{o as b,r as B}from"./part-match-B5fLLmFw.js";import{u as R}from"./update-size-DANV7aa2.js";import{o as H}from"./has-content-Bx2p8Okx.js";var U=Object.defineProperty,c=O((a,e)=>U(a,"name",{value:e,configurable:!0}),"c");const T=14400,C=150*1024*1024,u=8*1024*1024,g=c((a,e)=>{a.auth.setAccessToken(e)},"setAccessToken"),L=c(a=>a.auth.getAccessToken(),"getAccessToken"),k=c(a=>{let e=0,s=a.length;for(;e<s&&a[e]==="/";)e+=1;for(;s>e&&a[s-1]==="/";)s-=1;return e===0&&s===a.length?a:a.slice(e,s)},"trimSlashes"),F=c(async a=>{const e=[];for await(const s of a)e.push(Buffer.from(s));return Buffer.concat(e)},"collectStream"),A=c(a=>a.includes("?dl=0")?a.replace("?dl=0","?dl=1"):a.includes("?dl=")?a:a+(a.includes("?")?"&dl=1":"?dl=1"),"rewriteSharedLinkForDirectDownload"),P=c((a,e)=>(g(a,e),{ensureAccessToken:c(()=>Promise.resolve(),"ensureAccessToken"),getAccessToken:c(()=>Promise.resolve(e),"getAccessToken")}),"createStaticAccessTokenAuth"),K=c((a,e)=>{const s=c(async()=>{const t=await e();return g(a,t),t},"ensure");return{async ensureAccessToken(){await s()},getAccessToken:s}},"createCallableAccessTokenAuth"),_=c((a,e)=>{const s=D({buildBody:c(()=>new URLSearchParams({client_id:e.appKey,grant_type:"refresh_token",refresh_token:e.refreshToken,...e.appSecret&&{client_secret:e.appSecret}}),"buildBody"),onRefresh:c(t=>{g(a,t)},"onRefresh"),provider:"Dropbox",tokenUrl:"https://api.dropboxapi.com/oauth2/token"});return{async ensureAccessToken(){await s.getAccessToken()},getAccessToken:c(()=>s.getAccessToken(),"getAccessToken")}},"createRefreshTokenAuth"),M=c(a=>{if(a.client){const i=a.client;return{authHandle:{ensureAccessToken:c(()=>Promise.resolve(),"ensureAccessToken"),getAccessToken:c(()=>Promise.resolve(L(i)),"getAccessToken")},client:i}}const e=a.accessToken,s=a.refreshToken!==void 0||a.appKey!==void 0||a.appSecret!==void 0;if(e!==void 0&&s)throw new Error("Dropbox storage: pass exactly one of `accessToken` or `refreshToken` (with `appKey`).");if(e!==void 0){const i=new d({accessToken:typeof e=="string"?e:void 0}),n=new f({auth:i});return{authHandle:typeof e=="function"?K(n,e):P(n,e),client:n}}if(s){if(!a.refreshToken||!a.appKey)throw new Error("Dropbox storage: refresh-token auth requires both `refreshToken` and `appKey`.");const i=new d({}),n=new f({auth:i});return{authHandle:_(n,{appKey:a.appKey,...a.appSecret&&{appSecret:a.appSecret},refreshToken:a.refreshToken}),client:n}}const t=process.env.DROPBOX_ACCESS_TOKEN;if(t){const i=new d({accessToken:t}),n=new f({auth:i});return{authHandle:P(n,t),client:n}}const o=process.env.DROPBOX_REFRESH_TOKEN,r=process.env.DROPBOX_APP_KEY;if(o&&r){const i=process.env.DROPBOX_APP_SECRET,n=new d({}),l=new f({auth:n});return{authHandle:_(l,{appKey:r,...i&&{appSecret:i},refreshToken:o}),client:l}}throw new Error("Dropbox storage: missing auth. Pass `client`, `accessToken`, or `refreshToken` + `appKey`. Env fallbacks: DROPBOX_ACCESS_TOKEN, or DROPBOX_REFRESH_TOKEN + DROPBOX_APP_KEY (+ DROPBOX_APP_SECRET).")},"resolveAuth");class J extends S{static name="dropbox";checksumTypes=[];meta;authHandle;client;defaultUrlExpiresIn;publicByDefault;rootFolderPath;constructor(e){super(e),this.rootFolderPath=k(e.rootFolderPath??""),this.publicByDefault=e.publicByDefault??!1,this.defaultUrlExpiresIn=Math.min(e.defaultUrlExpiresIn??3600,T);const s=M(e);this.client=s.client,this.authHandle=s.authHandle,this.meta=e.metaStorage??new x(e.metaStorageConfig),this.isReady=!0}get raw(){return this.client}async create(e,s){return this.instrumentOperation("create",async()=>{const t=new p(e);t.name=this.namingFunction(t),t.path=this.keyToPath(t.name),await this.validate(t);try{const o=await this.getMeta(t.id);if(o.bytesWritten>=0)return o}catch{}return t.bytesWritten=0,t.status=b(t),await this.saveMeta(t),await this.onCreate(t),t})}async write(e,s){return this.instrumentOperation("write",async()=>{let t;if("contentType"in e&&"metadata"in e&&!("body"in e)&&!("start"in e)?t=e:(t=await this.getMeta(e.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(e.size!==void 0&&R(t,e.size),!B(e,t))throw new Error("File part does not match");const o=await this.lock(e.id);try{if(H(e)){if(this.isUnsupportedChecksum(e.checksumAlgorithm))throw new Error("Unsupported checksum algorithm");const r=await F(e.body),i=t.path??this.keyToPath(t.name||t.id);await this.authHandle.ensureAccessToken();const n=r.byteLength<=C?await this.uploadSimple(i,r,s):await this.uploadSession(i,r,s);t.bytesWritten=r.length,t.size=r.length,t.path=n.path_display??i,t.rev=n.rev,t.ETag=n.rev}return t.status=b(t),t.status==="completed"&&await this.internalOnComplete(t),await this.saveMeta(t),t}finally{await this.unlock(e.id,o)}})}async delete({id:e},s){return this.instrumentOperation("delete",async()=>{let t;try{t=await this.getMeta(e)}catch{}const o=t?.path??this.keyToPath(t?.name??e);await this.authHandle.ensureAccessToken();try{await this.runOperation(s,()=>this.client.filesDeleteV2({path:o}))}catch(r){if(!N(r))throw r}return t?(t.status="deleted",await this.deleteMeta(t.id),await this.onDelete(t),t):Object.assign(new p({contentType:"application/octet-stream",metadata:{},originalName:e}),{id:e,name:e,path:o,status:"deleted"})})}async get({id:e},s){return this.instrumentOperation("get",async()=>{let t,o=this.keyToPath(e);try{t=await this.checkIfExpired(await this.getMeta(e)),o=t.path??this.keyToPath(t.name??e)}catch{}await this.authHandle.ensureAccessToken();const r=(await this.runOperation(s,()=>this.client.filesDownload({path:o}))).result;let i;if(r.fileBinary instanceof Uint8Array)i=Buffer.from(r.fileBinary.buffer,r.fileBinary.byteOffset,r.fileBinary.byteLength);else if(r.fileBlob instanceof Blob)i=Buffer.from(await r.fileBlob.arrayBuffer());else throw new TypeError("Dropbox: unexpected download response shape — neither fileBinary nor fileBlob present");return{content:i,contentType:t?.contentType??"application/octet-stream",ETag:t?.ETag??r.rev,expiredAt:t?.expiredAt,id:e,metadata:t?.metadata??{},modifiedAt:t?.modifiedAt??r.server_modified,name:t?.name??r.name,originalName:t?.originalName??r.name,size:t?.size??r.size??i.length}})}async copy(e,s,t){return this.instrumentOperation("copy",async()=>{const o=this.keyToPath(e),r=this.keyToPath(s);await this.authHandle.ensureAccessToken(),await this.runOperation(t,()=>this.client.filesCopyV2({from_path:o,to_path:r}));const i=new p({contentType:"application/octet-stream",metadata:{},originalName:s});return i.id=s,i.name=s,i.path=r,i})}async move(e,s,t){return this.instrumentOperation("move",async()=>{const o=this.keyToPath(e),r=this.keyToPath(s);await this.authHandle.ensureAccessToken(),await this.runOperation(t,()=>this.client.filesMoveV2({from_path:o,to_path:r}));const i=new p({contentType:"application/octet-stream",metadata:{},originalName:s});i.id=s,i.name=s,i.path=r;try{await this.deleteMeta(e)}catch{}return i})}async list(e=1e3,s){return this.instrumentOperation("list",async()=>{await this.authHandle.ensureAccessToken();const t=await this.runOperation(s,()=>this.client.filesListFolder({limit:e,path:this.rootFolderPath?`/${this.rootFolderPath}`:"",recursive:!0})),{result:o}=t,r=[];for(const i of o.entries){if(i[".tag"]!=="file")continue;const n=i,l=n.path_display??n.path_lower??`/${n.name}`,m=this.pathToKey(l);if(!m)continue;const h=new p({contentType:"application/octet-stream",metadata:{},originalName:n.name});h.id=m,h.name=m,h.path=l,h.size=n.size,h.rev=n.rev,h.ETag=n.rev,h.modifiedAt=n.server_modified,r.push(h)}return r},{limit:e})}async getReadUrl(e,s){if(s?.responseContentDisposition)return y(w.METHOD_NOT_ALLOWED,"Dropbox: `responseContentDisposition` is not supported — Dropbox temporary links have no Content-Disposition override.");const t=s?.expiresIn??this.defaultUrlExpiresIn;return t>T?y(w.METHOD_NOT_ALLOWED,`Dropbox: \`expiresIn\` of ${t}s exceeds the ${T}s (4h) maximum. Use \`publicByDefault: true\` for a permanent shared link.`):(await this.authHandle.ensureAccessToken(),this.publicByDefault?await this.createPublicSharedLink(e):(await this.client.filesGetTemporaryLink({path:this.keyToPath(e)})).result.link)}async getUploadUrl(e,s){return y(w.METHOD_NOT_ALLOWED,"Dropbox: presigned upload URLs use POST with a raw body, which doesn't fit the PUT-style upload-url contract. Use `write()` or `storage.raw.filesGetTemporaryUploadLink(...)` directly.")}keyToPath(e){const s=k(e),t=[];return this.rootFolderPath&&t.push(this.rootFolderPath),s&&t.push(s),t.length===0?"":`/${t.join("/")}`}pathToKey(e){const s=k(e);if(!this.rootFolderPath)return s;if(s===this.rootFolderPath)return"";const t=`${this.rootFolderPath}/`;return s.startsWith(t)?s.slice(t.length):s}async uploadSimple(e,s,t){return(await this.runOperation(t,()=>this.client.filesUpload({contents:s,mode:{".tag":"overwrite"},mute:!0,path:e}))).result}async uploadSession(e,s,t){const o=s.byteLength;let r=0;const i=(await this.runOperation(t,()=>this.client.filesUploadSessionStart({close:!1,contents:s.subarray(r,Math.min(r+u,o))}))).result.session_id;for(r=Math.min(r+u,o);o-r>u;){const l=s.subarray(r,r+u);await this.runOperation(t,()=>this.client.filesUploadSessionAppendV2({close:!1,contents:l,cursor:{offset:r,session_id:i}})),r+=u}const n=s.subarray(r,o);return(await this.runOperation(t,()=>this.client.filesUploadSessionFinish({commit:{mode:{".tag":"overwrite"},mute:!0,path:e},contents:n,cursor:{offset:r,session_id:i}}))).result}async createPublicSharedLink(e){try{const s=await this.client.sharingCreateSharedLinkWithSettings({path:this.keyToPath(e),settings:{requested_visibility:{".tag":"public"}}});return A(s.result.url)}catch(s){if(s instanceof v){const t=s.error?.shared_link_already_exists?.metadata?.url;if(typeof t=="string"&&t.length>0)return A(t)}throw s}}internalOnComplete=c(e=>this.deleteMeta(e.id),"internalOnComplete")}const N=c(a=>{if(!(a instanceof v))return!1;if(a.status===404)return!0;const e=[],s=c((t,o)=>{if(o>6||t===null||typeof t!="object")return;const r=t,i=r[".tag"];typeof i=="string"&&e.push(i);for(const n of Object.values(r))n&&typeof n=="object"&&s(n,o+1)},"walk");return s(a.error,0),e.includes("not_found")||e.includes("not_file")||e.includes("not_folder")},"isNotFoundError");export{J as default};
|
|
@@ -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,2 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var h=(s,t)=>g(s,"name",{value:t,configurable:!0});import{readFileSync as w}from"node:fs";import{getApps as b,getApp as m,initializeApp as O,cert as k}from"firebase-admin/app";import{getStorage as A}from"firebase-admin/storage";import{throwErrorCode as d,ERRORS as f}from"./ERRORS-CyOuSMLY.js";import{B as T}from"./storage-Dh0tJh7j.js";import o from"./FirebaseFile-JEu3plMP.js";import I from"./FirebaseMetaStorage-CzyOim-J.js";import{o as y,r as v}from"./part-match-B5fLLmFw.js";import{u as S}from"./update-size-DANV7aa2.js";import{o as _}from"./has-content-Bx2p8Okx.js";var N=Object.defineProperty,u=h((s,t)=>N(s,"name",{value:t,configurable:!0}),"l");const U=3600,R=u(async s=>{const t=[];for await(const i of s)t.push(Buffer.from(i));return Buffer.concat(t)},"collectStream"),B=u(s=>typeof s=="object"&&s!==null&&typeof s.file=="function"&&typeof s.getFiles=="function","isBucket");class E extends T{static name="firebase";checksumTypes=[];meta;bucket;bucketName;defaultUrlExpiresIn;publicBaseUrl;constructor(t){if(super(t),this.defaultUrlExpiresIn=t.defaultUrlExpiresIn??U,this.publicBaseUrl=t.publicBaseUrl?.replace(/\/+$/,""),t.app&&B(t.app))this.bucket=t.app,this.bucketName=t.app.name??"";else{const i=t.bucket??process.env.FIREBASE_STORAGE_BUCKET;if(!i)throw new Error("Firebase storage: `bucket` is required (or set FIREBASE_STORAGE_BUCKET).");this.bucketName=i;const e=t.app??E.resolveApp(t,i);this.bucket=A(e).bucket(i)}this.meta=t.metaStorage??new I(t.metaStorageConfig),this.isReady=!0}get raw(){return this.bucket}async create(t,i){return this.instrumentOperation("create",async()=>{const e=new o(t);e.name=this.namingFunction(e),e.bucket=this.bucketName,e.path=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=y(e),await this.saveMeta(e),await this.onCreate(e),e})}async write(t,i){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&&S(e,t.size),!v(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 R(t.body),c=e.path??e.name;await this.runOperation(i,()=>this.bucket.file(c).save(r,{contentType:e.contentType,resumable:!1})),e.bytesWritten=r.length,e.size=r.length,e.path=c}return e.status=y(e),e.status==="completed"&&await this.internalOnComplete(e),await this.saveMeta(e),e}finally{await this.unlock(t.id,a)}})}async delete({id:t},i){return this.instrumentOperation("delete",async()=>{let e;try{e=await this.getMeta(t)}catch{}const a=e?.path??e?.name??t;return await this.runOperation(i,()=>this.bucket.file(a).delete({ignoreNotFound:!0})),e?(e.status="deleted",await this.deleteMeta(e.id),await this.onDelete(e),e):Object.assign(new o({contentType:"application/octet-stream",metadata:{},originalName:t}),{bucket:this.bucketName,id:t,name:t,path:a,status:"deleted"})})}async exists({id:t},i){return this.instrumentOperation("exists",async()=>{let e=t;try{e=(await this.getMeta(t)).path??t}catch{}try{const[a]=await this.runOperation(i,()=>this.bucket.file(e).exists());return a}catch{return!1}})}async get({id:t},i){return this.instrumentOperation("get",async()=>{let e=t,a;try{a=await this.checkIfExpired(await this.getMeta(t)),e=a.path??a.name??t}catch{}const r=this.bucket.file(e),[c]=await this.runOperation(i,()=>r.download());let n={};try{[n]=await this.runOperation(i,()=>r.getMetadata())}catch{}return{content:c,contentType:a?.contentType??n.contentType??"application/octet-stream",ETag:a?.ETag??n.etag,expiredAt:a?.expiredAt,id:t,metadata:a?.metadata??{},modifiedAt:a?.modifiedAt??n.updated,name:a?.name??e,originalName:a?.originalName??e,size:a?.size??(n.size===void 0?c.length:Number(n.size))}})}async copy(t,i,e){return this.instrumentOperation("copy",async()=>{const a=(await this.getMetaSafe(t))?.path??t;await this.runOperation(e,()=>this.bucket.file(a).copy(this.bucket.file(i)));const r=new o({contentType:"application/octet-stream",metadata:{},originalName:i});return r.id=i,r.name=i,r.path=i,r.bucket=this.bucketName,r})}async move(t,i,e){return this.instrumentOperation("move",async()=>{const a=(await this.getMetaSafe(t))?.path??t;await this.runOperation(e,()=>this.bucket.file(a).move(i));const r=new o({contentType:"application/octet-stream",metadata:{},originalName:i});r.id=i,r.name=i,r.path=i,r.bucket=this.bucketName;try{await this.deleteMeta(t)}catch{}return r})}async list(t=1e3,i){return this.instrumentOperation("list",async()=>{const[e]=await this.runOperation(i,()=>this.bucket.getFiles({maxResults:t}));return(e??[]).map(a=>{const r=new o({contentType:"application/octet-stream",metadata:{},originalName:a.name});return r.id=a.name,r.name=a.name,r.path=a.name,r.bucket=this.bucketName,r})},{limit:t})}async getReadUrl(t,i){if(this.publicBaseUrl)return`${this.publicBaseUrl}/${t}`;const e=i?.expiresIn??this.defaultUrlExpiresIn;try{const[a]=await this.bucket.file(t).getSignedUrl({action:"read",expires:Date.now()+e*1e3});return a}catch(a){return d(f.METHOD_NOT_ALLOWED,a instanceof Error?a.message:"Firebase: getSignedUrl failed")}}async getUploadUrl(t,i){const e=i?.expiresIn??this.defaultUrlExpiresIn;try{const[a]=await this.bucket.file(t).getSignedUrl({action:"write",contentType:i?.contentType,expires:Date.now()+e*1e3});return a}catch(a){return d(f.METHOD_NOT_ALLOWED,a instanceof Error?a.message:"Firebase: getSignedUrl failed")}}static resolveApp(t,i){const{appName:e}=t,a=b();if(e?a.find(p=>p.name===e):a[0])return e?m(e):m();const r=t.projectId??process.env.FIREBASE_PROJECT_ID??process.env.GOOGLE_CLOUD_PROJECT??process.env.GCLOUD_PROJECT;let c=t.credentials?.clientEmail??process.env.FIREBASE_CLIENT_EMAIL,n=t.credentials?.privateKey??process.env.FIREBASE_PRIVATE_KEY;const l=t.serviceAccountPath??process.env.GOOGLE_APPLICATION_CREDENTIALS;if((!c||!n)&&l){const p=JSON.parse(w(l,"utf8"));c??=p.client_email,n??=p.private_key}if(!c||!n)throw new Error("Firebase storage: service-account credentials are required. Provide `credentials` ({ clientEmail, privateKey }), `serviceAccountPath`, or set FIREBASE_CLIENT_EMAIL / FIREBASE_PRIVATE_KEY / GOOGLE_APPLICATION_CREDENTIALS.");return O({credential:k({clientEmail:c,privateKey:n.replaceAll(String.raw`\n`,`
|
|
2
|
-
`),projectId:r}),projectId:r,storageBucket:i},e)}async getMetaSafe(t){try{return await this.getMeta(t)}catch{return}}internalOnComplete=u(t=>this.deleteMeta(t.id),"internalOnComplete")}export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var F=Object.defineProperty;var O=(o,a)=>F(o,"name",{value:a,configurable:!0});import{Readable as y,Writable as v}from"node:stream";import{Client as M}from"basic-ftp";import{S as k}from"./index-B4ETk0Lu.js";import{throwErrorCode as u,ERRORS as m}from"./ERRORS-CyOuSMLY.js";import{B as E}from"./storage-Dh0tJh7j.js";import P from"./FtpFile-B8jaICTB.js";import A from"./FtpMetaStorage-1Njy0DpU.js";import{i as f,n as $,o as D}from"./posix-dirname-CiHXPPnw.js";import{o as b,r as R}from"./part-match-B5fLLmFw.js";import{u as L}from"./update-size-DANV7aa2.js";import{o as S}from"./has-content-Bx2p8Okx.js";var x=Object.defineProperty,l=O((o,a)=>x(o,"name",{value:a,configurable:!0}),"u");const d=l(o=>{const a=o?.code;if(a===550||a===450||a===553)return!0;const e=o instanceof Error?o.message:String(o);return/no such file|not exist|cannot find|file unavailable/i.test(e)},"isNotFoundError"),g=l(o=>{if(o instanceof Error&&o.name==="AbortError")return o;const a=new Error(o instanceof Error&&o.message?o.message:"The operation was aborted",{cause:o});return a.name="AbortError",a},"toAbortError"),T=l(async(o,a)=>{const e=[],t=new v({write(n,r,i){e.push(Buffer.from(n)),i()}});return await o.downloadTo(t,a),Buffer.concat(e)},"downloadToBuffer");class G extends E{static name="ftp";checksumTypes=[];meta;connection;rootFolderPath;constructor(a){super(a),this.connection=a.connection,this.rootFolderPath=f(a.rootFolderPath??""),this.meta=a.metaStorage??new A(a.metaStorageConfig),this.isReady=!0}async create(a,e){return this.instrumentOperation("create",async()=>{const t=new P(a);t.name=this.namingFunction(t),t.path=this.keyToPath(t.name),await this.validate(t);try{const n=await this.getMeta(t.id);if(n.status==="completed")return n}catch{}return t.bytesWritten=0,t.status=b(t),await this.saveMeta(t),await this.onCreate(t),t})}async write(a,e){return this.instrumentOperation("write",async()=>{let t;if("contentType"in a&&"metadata"in a&&!("body"in a)&&!("start"in a)?t=a:(t=await this.getMeta(a.id),await this.checkIfExpired(t)),t.status==="completed")return t;if(a.size!==void 0&&L(t,a.size),!R(a,t))return u(m.FILE_CONFLICT);const n=await this.lock(a.id);try{if(S(a)){if(this.isUnsupportedChecksum(a.checksumAlgorithm))return u(m.UNSUPPORTED_CHECKSUM_ALGORITHM);if(a.start>0)return u(m.METHOD_NOT_ALLOWED,"FTP storage does not support chunked or resumable uploads; send the file in a single request.");const r=await $(a.body),i=t.path??this.keyToPath(t.name||t.id);await this.runOperation(e,c=>this.run(c,async s=>{await this.ensureRemoteDirectory(s,i),await s.uploadFrom(y.from(r),i)})),t.bytesWritten=r.length,t.size=r.length,t.path=i,t.ETag=k(r)}return t.status=b(t),await this.saveMeta(t),t}finally{await this.unlock(a.id,n)}})}async get({id:a},e){return this.instrumentOperation("get",async()=>{const t=await this.checkIfExpired(await this.getMeta(a)),n=t.path??this.keyToPath(t.name||a),r=await this.runOperation(e,i=>this.run(i,async c=>{try{return await T(c,n)}catch(s){if(d(s))return u(m.FILE_NOT_FOUND);throw s}}));return{content:r,contentType:t.contentType,ETag:t.ETag??k(r),expiredAt:t.expiredAt,id:a,metadata:t.metadata,modifiedAt:t.modifiedAt,name:t.name,originalName:t.originalName,size:t.size??r.length}})}async delete({id:a},e){return this.instrumentOperation("delete",async()=>{const t=await this.getMeta(a),n=t.path??this.keyToPath(t.name||a);await this.runOperation(e,i=>this.run(i,async c=>{try{await c.remove(n)}catch(s){if(!d(s))throw s}})),await this.deleteMeta(a);const r={...t,status:"deleted"};return await this.onDelete(r),r})}async copy(a,e,t){return this.instrumentOperation("copy",async()=>{const n=await this.getMeta(a),r=n.path??this.keyToPath(n.name||a),i=this.keyToPath(e);await this.runOperation(t,s=>this.run(s,async h=>{const p=await T(h,r);await this.ensureRemoteDirectory(h,i),await h.uploadFrom(y.from(p),i)}));const c={...n,id:e,name:e,path:i};return await this.saveMeta(c),c})}async move(a,e,t){return this.instrumentOperation("move",async()=>{const n=await this.getMeta(a),r=n.path??this.keyToPath(n.name||a),i=this.keyToPath(e);await this.runOperation(t,s=>this.run(s,async h=>{try{await this.ensureRemoteDirectory(h,i),await h.rename(r,i)}catch(p){try{const w=await T(h,r);await this.ensureRemoteDirectory(h,i),await h.uploadFrom(y.from(w),i),await h.remove(r)}catch(w){throw new AggregateError([p,w],`FTP move failed: rename and copy+delete fallback both failed for "${r}" → "${i}"`)}}}));const c={...n,id:e,name:e,path:i};await this.saveMeta(c);try{await this.deleteMeta(a)}catch{}return c})}async list(a=1e3,e){return this.instrumentOperation("list",async()=>{const t=this.keyToPath("");return this.runOperation(e,n=>this.run(n,async r=>{const i=[];return await this.walkList(r,t,i),i}))})}async exists({id:a},e){return this.instrumentOperation("exists",async()=>{let t;try{t=await this.getMeta(a)}catch{return!1}const n=t.path??this.keyToPath(t.name||a);return this.runOperation(e,r=>this.run(r,async i=>{try{return await i.size(n),!0}catch(c){if(d(c))return!1;throw c}}))})}async walkList(a,e,t){let n;try{n=await a.list(e||".")}catch(r){if(d(r))return;throw r}for(const r of n){const i=e?`${e}/${r.name}`:r.name;if(r.isDirectory){await this.walkList(a,i,t);continue}if(!r.isFile)continue;const c=this.pathToKey(i);if(!c)continue;const s=new P({contentType:"application/octet-stream",metadata:{},originalName:r.name});s.id=c,s.name=c,s.path=i,s.size=r.size,r.modifiedAt&&(s.modifiedAt=r.modifiedAt.toISOString()),t.push(s)}}async run(a,e){const t=new M;if(a?.aborted)throw g(a.reason);const n=l(()=>{t.close()},"onAbort");a?.addEventListener("abort",n,{once:!0});try{if(await t.access(this.connection),a?.aborted)throw g(a.reason);return await e(t)}catch(r){throw a?.aborted?g(r):r}finally{a?.removeEventListener("abort",n),t.close()}}async ensureRemoteDirectory(a,e){const t=D(e);t&&(await a.ensureDir(t),await a.cd("/"))}keyToPath(a){const e=f(a);e&&E.assertSafeId(e);const t=[];return this.rootFolderPath&&t.push(this.rootFolderPath),e&&t.push(e),t.length===0?"":`/${t.join("/")}`}pathToKey(a){const e=f(a);if(!this.rootFolderPath)return e;if(e===this.rootFolderPath)return"";const t=`${this.rootFolderPath}/`;return e.startsWith(t)?e.slice(t.length):e}}export{G as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var y=Object.defineProperty;var h=(l,t)=>y(l,"name",{value:t,configurable:!0});import{randomUUID as w}from"node:crypto";import{request as b}from"gaxios";import{GoogleAuth as C}from"google-auth-library";import{r as R,E,b as U,g as k,d}from"./gcs-meta-storage-mZiqlX-9.js";import{d as $}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as I,ERRORS as S}from"./ERRORS-CyOuSMLY.js";import{B as v,t as O}from"./storage-Dh0tJh7j.js";import{v as T}from"./local-meta-storage-Bi0mK6gD.js";import m from"./GCSConfig-BQ0OpVhe.js";import B from"./GCSFile-CDQ6IWAz.js";import{r as A,o as j}from"./part-match-B5fLLmFw.js";import{o as x}from"./has-content-Bx2p8Okx.js";var P=Object.defineProperty,G=h((l,t)=>P(l,"name",{value:t,configurable:!0}),"e");class q extends Error{static{h(this,"o")}constructor(t,a,e){super(t),this.code=a,this.config=e}code;config;static{G(this,"FetchError")}name="FetchError"}var W=Object.defineProperty,g=h((l,t)=>W(l,"name",{value:t,configurable:!0}),"m");const M=g(l=>l>=200&&l<300||l===308||l===499,"validateStatus");class f extends v{static name="gcs";checksumTypes=["md5","crc32c"];get raw(){return this.authClient}meta;bucket;authClient;storageBaseURI;uploadBaseURI;isCustomEndpoint=!1;retryOptions={};useAuthWithCustomEndpoint;userProject;constructor(t){super(t);const a=t.bucket||process.env.GCS_BUCKET;if(!a)throw new Error("GCS bucket is not defined");if(!t.projectId)throw new Error("Sorry, we cannot connect to Cloud Services without a project ID.");this.bucket=a,this.storageBaseURI=`${t.storageAPI||m.storageAPI}/${this.bucket}/o`,this.uploadBaseURI=`${t.uploadAPI||m.uploadAPI}/${this.bucket}/o`,this.isCustomEndpoint=new URL(this.storageBaseURI).hostname!=="storage.googleapis.com";const{retryOptions:e,useAuthWithCustomEndpoint:r,userProject:i}=t;this.userProject=i,this.useAuthWithCustomEndpoint=r||!1,this.retryOptions={...R,...e},t.scopes||=m.authScopes,this.authClient=new C(t);const{bucket:o,metaStorage:c,metaStorageConfig:u,projectId:s}=t;if(c)this.meta=c;else{let n={...t,...u,logger:this.logger};"directory"in n?(this.logger?.debug("Using local meta storage"),this.meta=new T(n)):(o===n.bucket&&s===n.projectId&&(n={...n,authClient:this.authClient}),this.meta=new E(n))}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(n=>{this.logger?.error("Storage access check failed: %O",n)})}normalizeError(t){if(t.config){const a=+t.code||500;return{code:`GCS${a}`,message:t.message,name:t.name,retryable:a>=499,statusCode:a}}return{code:"GenericUploadError",message:`[${this.constructor.name}] ${t.message}`,name:t.name,statusCode:500}}async create(t,a){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const s=typeof t.ttl=="string"?O(t.ttl):t.ttl;s!==void 0&&(e.expiredAt=Date.now()+s)}const r=new B(e);r.name=this.namingFunction(r),await this.validate(r);try{const s=await this.getMeta(r.id);return s.bytesWritten=await this.internalWrite(s,a),s}catch{}const i={"Content-Type":"application/json; charset=utf-8","X-Goog-Upload-Command":"start","X-Goog-Upload-Protocol":"resumable","X-Upload-Content-Length":r.size.toString(),"X-Upload-Content-Type":r.contentType},o={body:JSON.stringify({metadata:r.metadata}),headers:i,method:"POST",params:{name:r.name,size:r.size,uploadType:"resumable"},url:this.uploadBaseURI},c=await this.makeRequest(o,a);if(c.status!==200)throw new Error("Expected 200 response from GCS");const u=c.headers.get("X-Goog-Upload-Status")||c.headers.get("x-goog-upload-status");if(u!=="active")throw new Error(`X-Goog-Upload-Status response header expected 'active' got: ${u}`);return r.uri=c.headers.get("location"),this.config.clientDirectUpload?(r.GCSUploadURI=r.uri,this.logger?.debug("send uploadURI to client: %s",r.GCSUploadURI),r.status="created",r):(r.bytesWritten=0,await this.saveMeta(r),r.status="created",await this.onCreate(r),r)})}async write(t,a){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(!A(t,e))return I(S.FILE_CONFLICT);const r=await this.lock(t.id);try{if(x(t)&&(e.bytesWritten===0||Number.isNaN(e.bytesWritten))&&(!e.contentType||e.contentType==="application/octet-stream"))try{const{fileType:i,stream:o}=await $(t.body);i?.mime&&(e.contentType=i.mime),t.body=o}catch{}e.bytesWritten=await this.internalWrite({...e,...t},a),e.status=j(e),e.status==="completed"&&(e.uri=`${this.storageBaseURI}/${e.name}`,await this.internalOnComplete(e))}finally{await this.unlock(t.id,r)}return e})}async delete({id:t},a){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);if(!e.uri)throw new Error(`File ${t} does not have a valid URI`);e.status="deleted",await this.makeRequest({method:"DELETE",url:e.uri,validateStatus:M},a),await this.deleteMeta(e.id);const r={...e};return await this.onDelete(r),r})}async copy(t,a,e){return this.instrumentOperation("copy",async()=>{const r=new URL(`/${this.bucket}/${t}`,"file://"),i=new URL(encodeURI(a),r).pathname,[,o,...c]=i.split("/"),u=c.join("/"),s=`${this.storageBaseURI}/${t}/rewriteTo/b/${o}/o/${u}`;let n={};const p={body:"",headers:{"Content-Type":"application/json"},method:"POST",url:s};do p.body=n.rewriteToken?JSON.stringify({rewriteToken:n.rewriteToken}):"",n=(await this.makeRequest(p,e)).data||{};while(n.rewriteToken);return await this.getMeta(a)})}async move(t,a,e){return this.instrumentOperation("move",async()=>{const r=await this.copy(t,a,e),i=`${this.storageBaseURI}/${t}`;return await this.makeRequest({method:"DELETE",url:i},e),r})}async get({id:t},a){return this.instrumentOperation("get",async()=>{const{data:e}=await this.makeRequest({params:{alt:"json"},url:`${this.storageBaseURI}/${t}`},a);if(await this.checkIfExpired({expiredAt:e.timeDeleted}),!e.uri)throw new Error("File URI not found");const r=(await this.makeRequest({params:{alt:"media"},url:e.uri},a)).data;let i;if(typeof r=="string")i=Buffer.from(r,"utf8");else if(r&&typeof r=="object"&&"data"in r){const o=r.data;i=Buffer.from(o)}else i=Buffer.from(r);return{...e,content:i}})}async exists({id:t},a){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(t),await this.makeRequest({method:"HEAD",url:`${this.storageBaseURI}/${t}`},a),!0}catch{return!1}})}async list(t=1e3,a){return this.instrumentOperation("list",async()=>{const e=[],r=Math.min(t,1e3);let i=!0,o={params:{maxResults:r},url:this.storageBaseURI};for(;i&&e.length<t;)try{const{data:c}=await this.makeRequest(o,a);for(const{name:u,timeCreated:s,updated:n}of c?.items||[]){if(e.length>=t)break;e.push({createdAt:s,id:u,modifiedAt:n})}i=c?.nextPageToken!==void 0,i&&e.length<t&&(o={...o,params:{...o.params,maxResults:Math.min(r,t-e.length),pageToken:c.nextPageToken}})}catch(c){const u=this.normalizeError(c instanceof Error?c:new Error(String(c)));throw await this.onError(u),c}return e},{limit:t})}async internalWrite(t,a){const{body:e,bytesWritten:r,size:i,uri:o=""}=t,c=U(t),u={method:"PUT"};if(e?.on){const s=new AbortController;e.on("aborted",()=>{s.abort()}),u.body=e,u.signal=s.signal,u.retry=!1}u.headers={Accept:"application/json","Content-Range":c,...i===r?{"X-Goog-Upload-Command":"upload, finalize"}:{}};try{const s=await this.makeRequest({url:o,...u},a);if(s.status===308){const n=s.headers.get("range");return n?k(n):0}if(s.status===200)return this.logger?.debug("uploaded %O",s.data),i;throw new q(String(s.data),`GCS${s.status}`,{uri:o})}catch(s){this.logger?.error(o,s);const n=this.normalizeError(s instanceof Error?s:new Error(String(s)));throw await this.onError(n),s}}internalOnComplete=g(t=>this.deleteMeta(t.id),"internalOnComplete");static buildCallSignal(t,a){const e=[];if(a&&e.push(a),t?.signal&&e.push(t.signal),e.length!==0)return e.length===1?e[0]:AbortSignal.any(e)}async makeRequest(t,a){typeof t.url=="string"&&(t.url=t.url.replaceAll("/:",":"));const e=f.buildCallSignal(a,t.signal);let r=this.retryOptions;if(a?.retries!==void 0){const o=typeof a.retries=="number"?a.retries:a.retries.maxRetries;typeof o=="number"&&(r={...this.retryOptions,retry:o})}const i=typeof a?.timeout=="number"&&a.timeout>0?a.timeout:6e4;return t={...t,headers:{"User-Agent":`${d.name}/${d.version}`,"x-goog-api-client":`gl-node/${process.versions.node} gccl/${d.version} gccl-invocation-id/${w()}`,...t.headers},params:{...this.userProject===void 0?{}:{userProject:this.userProject},...t.params},retry:t.retry===!1?!1:a?.retries!==0,retryConfig:r,timeout:i,...e?{signal:e}:{}},this.isCustomEndpoint&&!this.useAuthWithCustomEndpoint?b(t):this.authClient.request(t)}async accessCheck(){return this.makeRequest({url:this.storageBaseURI.replace("/o","")})}}export{f as default};
|