@visulima/storage 1.0.0-alpha.27 → 1.0.0-alpha.29

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.
Files changed (190) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -2
  3. package/dist/adapter/nuxt/module.d.ts +4 -4
  4. package/dist/adapter/nuxt/node_modules/.bin/nuxi +2 -2
  5. package/dist/adapter/nuxt/node_modules/.bin/nuxt +2 -2
  6. package/dist/ai/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai/claude/index.d.ts +2 -2
  8. package/dist/ai/openai/index.d.ts +3 -3
  9. package/dist/ai/tanstack/index.d.ts +2 -2
  10. package/dist/handler/http/fetch/index.d.ts +7 -7
  11. package/dist/handler/http/fetch/index.js +1 -1
  12. package/dist/handler/http/hono/index.d.ts +4 -4
  13. package/dist/handler/http/hono/index.js +1 -1
  14. package/dist/handler/http/nextjs/index.d.ts +4 -4
  15. package/dist/handler/http/nextjs/index.js +1 -1
  16. package/dist/handler/http/node/index.d.ts +7 -7
  17. package/dist/handler/http/node/index.js +1 -1
  18. package/dist/handler/http/solid-start/index.d.ts +4 -4
  19. package/dist/handler/http/solid-start/index.js +1 -1
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +1 -1
  22. package/dist/packem_shared/{AwsLightMetaStorage-DHz1nf_H.js → AwsLightMetaStorage-B-iQbToR.js} +1 -1
  23. package/dist/packem_shared/AwsLightStorage-w21RxjUm.js +1 -0
  24. package/dist/packem_shared/AzureSMetaStorage-CR-lfQNQ.js +1 -0
  25. package/dist/packem_shared/AzureStorage-2kl7JDXs.js +1 -0
  26. package/dist/packem_shared/BoxMetaStorage-DLdXbZaV.js +1 -0
  27. package/dist/packem_shared/BoxStorage-BUeEJoGL.js +1 -0
  28. package/dist/packem_shared/BunS3File-D-SRiyrm.js +1 -0
  29. package/dist/packem_shared/BunS3MetaStorage-Bv_CTTMz.js +1 -0
  30. package/dist/packem_shared/BunS3Storage-WM3rF6Fw.js +1 -0
  31. package/dist/packem_shared/BunnyMetaStorage-DNMTSeoN.js +1 -0
  32. package/dist/packem_shared/BunnyStorage-D3s2fRB3.js +1 -0
  33. package/dist/packem_shared/CloudinaryFile-B5-m33eS.js +1 -0
  34. package/dist/packem_shared/CloudinaryMetaStorage-DEBk5eQy.js +1 -0
  35. package/dist/packem_shared/CloudinaryStorage-BBE2-aVz.js +1 -0
  36. package/dist/packem_shared/DiskStorage-DL0GiG6k.js +1 -0
  37. package/dist/packem_shared/{DiskStorageWithChecksum-CbXWpSOr.js → DiskStorageWithChecksum-BvUTn7O-.js} +1 -1
  38. package/dist/packem_shared/{DropboxMetaStorage-CICuUZ1n.js → DropboxMetaStorage-C6vj1QDA.js} +1 -1
  39. package/dist/packem_shared/DropboxStorage-BL3OIdE_.js +1 -0
  40. package/dist/packem_shared/{Files-B7hlJcB4.js → Files-CJh9_N-9.js} +1 -1
  41. package/dist/packem_shared/FirebaseFile-JEu3plMP.js +1 -0
  42. package/dist/packem_shared/FirebaseMetaStorage-CzyOim-J.js +1 -0
  43. package/dist/packem_shared/FirebaseStorage-lXMXy3Pm.js +2 -0
  44. package/dist/packem_shared/FtpFile-B8jaICTB.js +1 -0
  45. package/dist/packem_shared/FtpMetaStorage-1Njy0DpU.js +1 -0
  46. package/dist/packem_shared/FtpStorage-Dw94efNW.js +1 -0
  47. package/dist/packem_shared/{GCSMetaStorage-CqP9ifYB.js → GCSMetaStorage-DvRxZhmq.js} +1 -1
  48. package/dist/packem_shared/GCStorage-U4f4WsWC.js +1 -0
  49. package/dist/packem_shared/{GoogleDriveMetaStorage-rghGy3Fa.js → GoogleDriveMetaStorage-WGuUZPyx.js} +1 -1
  50. package/dist/packem_shared/GoogleDriveStorage-C0NhBBWH.js +1 -0
  51. package/dist/packem_shared/{LocalMetaStorage-B5uh1snG.js → LocalMetaStorage-QMKL7McF.js} +1 -1
  52. package/dist/packem_shared/{Multipart-7FSSy2n1.js → Multipart-CIFfQksD.js} +1 -1
  53. package/dist/packem_shared/{Multipart-DACQFsrn.js → Multipart-D9WIud9R.js} +1 -1
  54. package/dist/packem_shared/NetlifyBlobMetaStorage-ClIFdTkT.js +1 -0
  55. package/dist/packem_shared/NetlifyBlobStorage-CO89TGvF.js +1 -0
  56. package/dist/packem_shared/OneDriveMetaStorage-DS4f83X2.js +1 -0
  57. package/dist/packem_shared/OneDriveStorage-jAN46vRm.js +1 -0
  58. package/dist/packem_shared/PocketBaseFile-CkAiSBb0.js +1 -0
  59. package/dist/packem_shared/PocketBaseMetaStorage-B6utPncj.js +1 -0
  60. package/dist/packem_shared/PocketBaseStorage-DpOjOKAt.js +1 -0
  61. package/dist/packem_shared/{Rest-5NwM1xYj.js → Rest-BuD3ySAg.js} +1 -1
  62. package/dist/packem_shared/{Rest-y8Vz2Rt0.js → Rest-URrQ5FYM.js} +1 -1
  63. package/dist/packem_shared/S3Storage-n1ohEZj4.js +1 -0
  64. package/dist/packem_shared/SftpFile-CQCxZNVq.js +1 -0
  65. package/dist/packem_shared/SftpMetaStorage-DYqXwCdM.js +1 -0
  66. package/dist/packem_shared/SftpStorage-Ban-WN8v.js +1 -0
  67. package/dist/packem_shared/SharePointFile-BA6X9Sxr.js +1 -0
  68. package/dist/packem_shared/SharePointMetaStorage-DVM5-X6g.js +1 -0
  69. package/dist/packem_shared/SharePointStorage-BY90zh1c.js +1 -0
  70. package/dist/packem_shared/SupabaseMetaStorage-ivXoYVUu.js +1 -0
  71. package/dist/packem_shared/SupabaseStorage-pNbHAE1Y.js +1 -0
  72. package/dist/packem_shared/{Tus-CJMcygk7.js → Tus-Fp_hx5ug.js} +1 -1
  73. package/dist/packem_shared/{Tus-BCVAbJIi.js → Tus-TNG9HAY8.js} +1 -1
  74. package/dist/packem_shared/UploadThingMetaStorage-BvKNzgm7.js +1 -0
  75. package/dist/packem_shared/UploadThingStorage-BcmIE2dI.js +1 -0
  76. package/dist/packem_shared/{VercelBlobMetaStorage-Do9ZoKrl.js → VercelBlobMetaStorage-CwaqWucZ.js} +1 -1
  77. package/dist/packem_shared/VercelBlobStorage-C89IUiQ1.js +1 -0
  78. package/dist/packem_shared/alibaba-BJQ6ijoK.js +1 -0
  79. package/dist/packem_shared/aws-light-meta-storage-CstQBYXG.js +4 -0
  80. package/dist/packem_shared/azure-meta-storage-C4SrMtT2.js +1 -0
  81. package/dist/packem_shared/{base-handler-core-BfwZ1RS1.js → base-handler-core-BYDQditz.js} +1 -1
  82. package/dist/packem_shared/{base-handler-fetch-CLxqXTQf.js → base-handler-fetch-DWzsPkmV.js} +1 -1
  83. package/dist/packem_shared/{base-handler-node-DBZjcqsp.js → base-handler-node-Dety2rQB.js} +1 -1
  84. package/dist/packem_shared/defaultCloudStorageFileNameValidation-shIZX_7L.js +1 -0
  85. package/dist/packem_shared/disk-storage-CKAJvhcj.js +1 -0
  86. package/dist/packem_shared/{disk-storage-with-checksum.d-BQMXA4Wl.d.ts → disk-storage-with-checksum.d-mHcg2uLw.d.ts} +1 -1
  87. package/dist/packem_shared/{executors.d-UtkeCbk1.d.ts → executors.d-X4hz3zfu.d.ts} +1 -1
  88. package/dist/packem_shared/exoscale-O0HzxoDz.js +1 -0
  89. package/dist/packem_shared/filebase-D-urO4Ob.js +1 -0
  90. package/dist/packem_shared/{gcs-meta-storage-XB-UPJn6.js → gcs-meta-storage-Br_I-m9X.js} +1 -1
  91. package/dist/packem_shared/ibmCos-Rx_yku4H.js +1 -0
  92. package/dist/packem_shared/idriveE2-BFhw0Vwy.js +1 -0
  93. package/dist/packem_shared/index-B4ETk0Lu.js +5 -0
  94. package/dist/packem_shared/{index.d-DotjipuX.d.ts → index.d-C4Fivh4I.d.ts} +7 -2
  95. package/dist/packem_shared/isRetryableError-BhizNeAz.js +1 -0
  96. package/dist/packem_shared/{local-meta-storage-CT1audnK.js → local-meta-storage-Bi0mK6gD.js} +1 -1
  97. package/dist/packem_shared/{local-meta-storage.d-B5R1nswK.d.ts → local-meta-storage.d-B11vHYNm.d.ts} +1 -1
  98. package/dist/packem_shared/{media-transformer.d-DK7NJncf.d.ts → media-transformer.d-j1W9HAXw.d.ts} +2 -2
  99. package/dist/packem_shared/oracleCloud-D5T9s4JV.js +1 -0
  100. package/dist/packem_shared/ovhCloud-DCwef2fe.js +1 -0
  101. package/dist/packem_shared/posix-dirname-CiHXPPnw.js +1 -0
  102. package/dist/packem_shared/{rest-base-CCv78k7h.js → rest-base-DI7xFXr5.js} +1 -1
  103. package/dist/packem_shared/s3-base-storage-Dbexfg7p.js +1 -0
  104. package/dist/packem_shared/{s3-base-storage.d-BROGYJ4F.d.ts → s3-base-storage.d-V3N2nKCt.d.ts} +31 -22
  105. package/dist/packem_shared/scaleway-ygRXOss9.js +1 -0
  106. package/dist/packem_shared/storage-Dh0tJh7j.js +1 -0
  107. package/dist/packem_shared/{storage.d-Cr6f2lac.d.ts → storage.d-RteRC-cG.d.ts} +131 -65
  108. package/dist/packem_shared/tencent-CAcAGaIW.js +1 -0
  109. package/dist/packem_shared/{tus-base.d-4-ZfDQwl.d.ts → tus-base.d-wZsb3umJ.d.ts} +3 -3
  110. package/dist/packem_shared/{types.d-C8eSxqX9.d.ts → types.d-B5qPfCr5.d.ts} +2 -2
  111. package/dist/packem_shared/types.d-ChNXbbHG.d.ts +104 -0
  112. package/dist/packem_shared/{types.d-BgCmSE94.d.ts → types.d-DzPvh74p.d.ts} +2 -2
  113. package/dist/packem_shared/vultr-lK9L-sFk.js +1 -0
  114. package/dist/packem_shared/yandex-ZwvE77v4.js +1 -0
  115. package/dist/storage/aws/clients/index.d.ts +372 -1
  116. package/dist/storage/aws/clients/index.js +1 -1
  117. package/dist/storage/aws/index.d.ts +13 -13
  118. package/dist/storage/aws/index.js +1 -1
  119. package/dist/storage/aws-light/index.d.ts +13 -13
  120. package/dist/storage/aws-light/index.js +1 -1
  121. package/dist/storage/azure/index.d.ts +82 -14
  122. package/dist/storage/azure/index.js +1 -1
  123. package/dist/storage/box/index.d.ts +12 -9
  124. package/dist/storage/box/index.js +1 -1
  125. package/dist/storage/bun-s3/index.d.ts +200 -0
  126. package/dist/storage/bun-s3/index.js +1 -0
  127. package/dist/storage/bunny/index.d.ts +13 -10
  128. package/dist/storage/bunny/index.js +1 -1
  129. package/dist/storage/cloudinary/index.d.ts +121 -0
  130. package/dist/storage/cloudinary/index.js +1 -0
  131. package/dist/storage/dropbox/index.d.ts +13 -10
  132. package/dist/storage/dropbox/index.js +1 -1
  133. package/dist/storage/firebase/index.d.ts +192 -0
  134. package/dist/storage/firebase/index.js +1 -0
  135. package/dist/storage/ftp/index.d.ts +85 -0
  136. package/dist/storage/ftp/index.js +1 -0
  137. package/dist/storage/gcs/index.d.ts +19 -10
  138. package/dist/storage/gcs/index.js +1 -1
  139. package/dist/storage/google-drive/index.d.ts +12 -9
  140. package/dist/storage/google-drive/index.js +1 -1
  141. package/dist/storage/local/index.d.ts +3 -3
  142. package/dist/storage/local/index.js +1 -1
  143. package/dist/storage/netlify-blob/index.d.ts +15 -12
  144. package/dist/storage/netlify-blob/index.js +1 -1
  145. package/dist/storage/onedrive/index.d.ts +22 -111
  146. package/dist/storage/onedrive/index.js +1 -1
  147. package/dist/storage/pocketbase/index.d.ts +172 -0
  148. package/dist/storage/pocketbase/index.js +1 -0
  149. package/dist/storage/sftp/index.d.ts +86 -0
  150. package/dist/storage/sftp/index.js +1 -0
  151. package/dist/storage/sharepoint/index.d.ts +180 -0
  152. package/dist/storage/sharepoint/index.js +1 -0
  153. package/dist/storage/supabase/index.d.ts +14 -10
  154. package/dist/storage/supabase/index.js +1 -1
  155. package/dist/storage/uploadthing/index.d.ts +14 -10
  156. package/dist/storage/uploadthing/index.js +1 -1
  157. package/dist/storage/vercel-blob/index.d.ts +13 -10
  158. package/dist/storage/vercel-blob/index.js +1 -1
  159. package/dist/transformer/audio-transformer.d.ts +2 -2
  160. package/dist/transformer/image-transformer.d.ts +2 -2
  161. package/dist/transformer/index.d.ts +3 -3
  162. package/dist/transformer/video-transformer.d.ts +2 -2
  163. package/package.json +55 -3
  164. package/dist/packem_shared/AwsLightStorage-SH7j-myh.js +0 -1
  165. package/dist/packem_shared/AzureSMetaStorage-DV2tNjKh.js +0 -1
  166. package/dist/packem_shared/AzureStorage-BVYMFEBP.js +0 -1
  167. package/dist/packem_shared/BoxMetaStorage-BUe5Qmqe.js +0 -1
  168. package/dist/packem_shared/BoxStorage-CgC81_So.js +0 -1
  169. package/dist/packem_shared/BunnyMetaStorage-D0mT6veJ.js +0 -1
  170. package/dist/packem_shared/BunnyStorage-Bl4usdVT.js +0 -1
  171. package/dist/packem_shared/DiskStorage-B5uIDVXr.js +0 -1
  172. package/dist/packem_shared/DropboxStorage-CPjhDN5B.js +0 -1
  173. package/dist/packem_shared/GCStorage-XSBKVx90.js +0 -1
  174. package/dist/packem_shared/GoogleDriveStorage-DuB6glUk.js +0 -1
  175. package/dist/packem_shared/NetlifyBlobMetaStorage-BcRFPky8.js +0 -1
  176. package/dist/packem_shared/NetlifyBlobStorage-C4qkJv1R.js +0 -1
  177. package/dist/packem_shared/OneDriveMetaStorage-B_BkGLzW.js +0 -1
  178. package/dist/packem_shared/OneDriveStorage-Cu0cGcrh.js +0 -1
  179. package/dist/packem_shared/S3Storage-D8dopWoO.js +0 -1
  180. package/dist/packem_shared/SupabaseMetaStorage-BR1UGqnj.js +0 -1
  181. package/dist/packem_shared/SupabaseStorage-CCtMTiN5.js +0 -1
  182. package/dist/packem_shared/UploadThingMetaStorage-DyGNyaAq.js +0 -1
  183. package/dist/packem_shared/UploadThingStorage-B_fNzNFO.js +0 -1
  184. package/dist/packem_shared/VercelBlobStorage-D5zy4PPQ.js +0 -1
  185. package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +0 -4
  186. package/dist/packem_shared/defaultCloudStorageFileNameValidation-6URTv-Mp.js +0 -1
  187. package/dist/packem_shared/disk-storage-CbSSPnOf.js +0 -5
  188. package/dist/packem_shared/isRetryableError-B6ZS_-5I.js +0 -1
  189. package/dist/packem_shared/s3-base-storage-f_EyFAAt.js +0 -1
  190. package/dist/packem_shared/storage-CoyB2O-Y.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Readable } from 'node:stream';
2
- import { F as File, M as MetaStorage, d as createRetryWrapper, e as FileInit, B as BaseStorage, R as RetryConfig, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-Cr6f2lac.js";
2
+ import { F as File, M as MetaStorage, d as createRetryWrapper, R as RetryConfig, e as FileInit, B as BaseStorage, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-RteRC-cG.js";
3
3
  /**
4
4
  * Part interface for multipart uploads.
5
5
  */
@@ -19,6 +19,13 @@ interface S3CompatibleFile extends File {
19
19
  uri?: string;
20
20
  }
21
21
  /**
22
+ * Per-call options forwarded to the underlying AWS SDK send().
23
+ */
24
+ interface S3CallOptions {
25
+ /** Forwarded to `client.send(command, { abortSignal })`. */
26
+ signal?: AbortSignal;
27
+ }
28
+ /**
22
29
  * S3 API operations interface that must be implemented by concrete storage classes.
23
30
  */
24
31
  interface S3ApiOperations {
@@ -26,7 +33,7 @@ interface S3ApiOperations {
26
33
  Bucket: string;
27
34
  Key: string;
28
35
  UploadId: string;
29
- }) => Promise<void>;
36
+ }, options?: S3CallOptions) => Promise<void>;
30
37
  checkBucketAccess: (params: {
31
38
  Bucket: string;
32
39
  }) => Promise<void>;
@@ -38,7 +45,7 @@ interface S3ApiOperations {
38
45
  PartNumber: number;
39
46
  }[];
40
47
  UploadId: string;
41
- }) => Promise<{
48
+ }, options?: S3CallOptions) => Promise<{
42
49
  ETag?: string;
43
50
  Location: string;
44
51
  }>;
@@ -47,24 +54,24 @@ interface S3ApiOperations {
47
54
  CopySource: string;
48
55
  Key: string;
49
56
  StorageClass?: string;
50
- }) => Promise<void>;
57
+ }, options?: S3CallOptions) => Promise<void>;
51
58
  createMultipartUpload: (params: {
52
59
  ACL?: string;
53
60
  Bucket: string;
54
61
  ContentType?: string;
55
62
  Key: string;
56
63
  Metadata?: Record<string, string>;
57
- }) => Promise<{
64
+ }, options?: S3CallOptions) => Promise<{
58
65
  UploadId: string;
59
66
  }>;
60
67
  deleteObject: (params: {
61
68
  Bucket: string;
62
69
  Key: string;
63
- }) => Promise<void>;
70
+ }, options?: S3CallOptions) => Promise<void>;
64
71
  getObject: (params: {
65
72
  Bucket: string;
66
73
  Key: string;
67
- }) => Promise<{
74
+ }, options?: S3CallOptions) => Promise<{
68
75
  Body?: ReadableStream | Readable;
69
76
  ContentLength?: number;
70
77
  ContentType?: string;
@@ -83,7 +90,7 @@ interface S3ApiOperations {
83
90
  headObject: (params: {
84
91
  Bucket: string;
85
92
  Key: string;
86
- }) => Promise<{
93
+ }, options?: S3CallOptions) => Promise<{
87
94
  ContentLength?: number;
88
95
  ContentType?: string;
89
96
  ETag?: string;
@@ -95,7 +102,7 @@ interface S3ApiOperations {
95
102
  Bucket: string;
96
103
  ContinuationToken?: string;
97
104
  MaxKeys?: number;
98
- }) => Promise<{
105
+ }, options?: S3CallOptions) => Promise<{
99
106
  Contents?: {
100
107
  Key?: string;
101
108
  LastModified?: Date;
@@ -107,7 +114,7 @@ interface S3ApiOperations {
107
114
  Bucket: string;
108
115
  Key: string;
109
116
  UploadId: string;
110
- }) => Promise<{
117
+ }, options?: S3CallOptions) => Promise<{
111
118
  Parts?: Part[];
112
119
  }>;
113
120
  uploadPart: (params: {
@@ -118,7 +125,7 @@ interface S3ApiOperations {
118
125
  Key: string;
119
126
  PartNumber: number;
120
127
  UploadId: string;
121
- }) => Promise<{
128
+ }, options?: S3CallOptions) => Promise<{
122
129
  ETag: string;
123
130
  }>;
124
131
  }
@@ -137,6 +144,7 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
137
144
  protected readonly MAX_PARTS = 1e4;
138
145
  protected readonly partSize: number;
139
146
  protected readonly retry: ReturnType<typeof createRetryWrapper>;
147
+ protected readonly resolvedRetryConfig: RetryConfig;
140
148
  /**
141
149
  * Abstract method to get S3 API operations implementation.
142
150
  */
@@ -166,34 +174,35 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
166
174
  partSize?: number | string;
167
175
  retryConfig?: RetryConfig;
168
176
  });
177
+ protected override getRetryConfig(): RetryConfig;
169
178
  /**
170
179
  * Creates a new S3 multipart upload.
171
180
  */
172
- create(config: FileInit): Promise<TFile>;
181
+ create(config: FileInit, options?: OperationOptions): Promise<TFile>;
173
182
  /**
174
183
  * Writes data to an S3 multipart upload.
175
184
  */
176
- write(part: FilePart | FileQuery | TFile): Promise<TFile>;
185
+ write(part: FilePart | FileQuery | TFile, options?: OperationOptions): Promise<TFile>;
177
186
  /**
178
187
  * Deletes an upload and its metadata.
179
188
  */
180
189
  delete({
181
190
  id
182
- }: FileQuery): Promise<TFile>;
191
+ }: FileQuery, options?: OperationOptions): Promise<TFile>;
183
192
  /**
184
193
  * Copies an upload file to a new location.
185
194
  */
186
- copy(name: string, destination: string, options?: {
195
+ copy(name: string, destination: string, options?: OperationOptions & {
187
196
  storageClass?: string;
188
197
  }): Promise<TFile>;
189
198
  /**
190
199
  * Moves an upload file to a new location.
191
200
  */
192
- move(name: string, destination: string): Promise<TFile>;
201
+ move(name: string, destination: string, options?: OperationOptions): Promise<TFile>;
193
202
  /**
194
203
  * Lists files in the bucket.
195
204
  */
196
- override list(limit?: number): Promise<TFile[]>;
205
+ override list(limit?: number, options?: OperationOptions): Promise<TFile[]>;
197
206
  /**
198
207
  * Checks if a file exists by verifying both metadata and the actual S3 object.
199
208
  * Returns true only if both the metadata and the S3 object exist.
@@ -202,17 +211,17 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
202
211
  */
203
212
  override exists({
204
213
  id
205
- }: FileQuery): Promise<boolean>;
214
+ }: FileQuery, options?: OperationOptions): Promise<boolean>;
206
215
  /**
207
216
  * Gets an uploaded file by ID.
208
217
  */
209
218
  get({
210
219
  id
211
- }: FileQuery): Promise<FileReturn>;
220
+ }: FileQuery, options?: OperationOptions): Promise<FileReturn>;
212
221
  /**
213
222
  * Gets file stream (abstract - must be implemented by subclasses due to stream differences).
214
223
  */
215
- abstract override getStream(query: FileQuery): Promise<{
224
+ abstract override getStream(query: FileQuery, options?: OperationOptions): Promise<{
216
225
  headers?: Record<string, string>;
217
226
  size?: number;
218
227
  stream: Readable;
@@ -239,7 +248,7 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
239
248
  /**
240
249
  * Aborts a multipart upload.
241
250
  */
242
- protected abortMultipartUpload(file: TFile): Promise<void>;
251
+ protected abortMultipartUpload(file: TFile, options?: OperationOptions): Promise<void>;
243
252
  /**
244
253
  * Internal onComplete handler.
245
254
  */
@@ -248,4 +257,4 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
248
257
  Location: string;
249
258
  }, TFile]>;
250
259
  }
251
- export { Part as P, S3ApiOperations as S, S3BaseStorage as a };
260
+ export { Part as P, S3CallOptions as S, S3ApiOperations as a, S3BaseStorage as b };
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var n=(e,r)=>a(e,"name",{value:r,configurable:!0});var S=Object.defineProperty,t=n((e,r)=>S(e,"name",{value:r,configurable:!0}),"t");const o=new Set(["fr-par","nl-ams","pl-waw"]),C=t(e=>{const r=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.SCALEWAY_ACCESS_KEY_ID??process.env.SCALEWAY_ACCESS_KEY,E=e?.endpoint??process.env.SCALEWAY_ENDPOINT,s=e?.region??process.env.SCALEWAY_REGION,c=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.SCALEWAY_SECRET_ACCESS_KEY??process.env.SCALEWAY_SECRET_KEY;if(!s||!r||!c)throw new Error("Missing required parameters for Scaleway Object Storage client.");if(!o.has(s))throw new Error(`Invalid Scaleway region "${s}". Expected one of: ${[...o].join(", ")}.`);return{credentials:{accessKeyId:r,secretAccessKey:c},endpoint:E??`https://s3.${s}.scw.cloud`,forcePathStyle:!1,region:s}},"scaleway");export{C as default};
@@ -0,0 +1 @@
1
+ var H=Object.defineProperty;var p=(t,e)=>H(t,"name",{value:e,configurable:!0});import{Readable as X}from"node:stream";import{setInterval as J}from"node:timers";import{inspect as Q}from"node:util";import{L as ee,O as I}from"./path-D7rMc9nq-B718mbm6.js";import te from"type-is";import re from"./NoOpMetrics-Dky06sf1.js";import{N as oe}from"./cache-qV_5Umeq.js";import{ErrorMap as M,throwErrorCode as E,ERRORS as $}from"./ERRORS-CyOuSMLY.js";import{randomUUID as se}from"node:crypto";import{LRUCache as ae}from"lru-cache";import{retry as ie}from"./isRetryableError-BhizNeAz.js";import{o as ne}from"./is-expired-1JuZjDtb.js";var ce=Object.defineProperty,le=p((t,e)=>ce(t,"name",{value:e,configurable:!0}),"y$3"),ue=Object.defineProperty,me=le((t,e)=>ue(t,"name",{value:e,configurable:!0}),"y"),ge=Object.defineProperty,C=me((t,e)=>ge(t,"name",{value:e,configurable:!0}),"i");const de=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,he=/^KIBI/,pe=/^MIBI/,fe=/^GIBI/,ye=/^TEBI/,be=/^PEBI/,we=/^EXBI/,ve=/^ZEBI/,Ee=/^YIBI/,$e=/^(.)IB$/,_={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},xe=C((t,e)=>{const r=new Intl.NumberFormat(e).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(e).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(t.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},"parseLocalizedNumber"),R=C(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),j=C((t,e)=>{const r={base:2,locale:"en-US",units:"metric",...e};if(typeof t!="string"||t.length===0)throw new TypeError("Value is not a string or is empty.");if(t.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=de.exec(t)?.groups;if(!o)return Number.NaN;const s=xe(o.value,r.locale),i=(o.type??"Bytes").toUpperCase().replace(he,"KILO").replace(pe,"MEGA").replace(fe,"GIGA").replace(ye,"TERA").replace(be,"PETA").replace(we,"EXA").replace(ve,"ZETTA").replace(Ee,"YOTTA").replace($e,"$1B"),n=_[r.units].findIndex(l=>l.short[0].toUpperCase()===i[0]),c=R(r.base);return s*c**n},"parseBytes");C((t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:o,locale:s,long:i,unit:n,units:c,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},a=R(r),d=Math.abs(t),m=e?.space??!0?" ":"",u=_[c],g=u.findIndex(w=>w.short===n);if(t===0){const w=Math.min(0,Math.max(g,u.length-1));return"0"+m+u[w][i?"long":"short"]}const h=g===-1?Math.min(Math.floor(Math.log(d)/Math.log(a)),u.length-1):g,N=u[h][i?"long":"short"],O=t/a**h,v=o<0?void 0:o;return new Intl.NumberFormat(s,{maximumFractionDigits:v,minimumFractionDigits:v,...l}).format(O)+m+N},"formatBytes");var Me=Object.defineProperty,Ne=p((t,e)=>Me(t,"name",{value:e,configurable:!0}),"u$3"),Oe=Object.defineProperty,Ae=Ne((t,e)=>Oe(t,"name",{value:e,configurable:!0}),"v"),Te=Object.defineProperty,Ce=Ae((t,e)=>Te(t,"name",{value:e,configurable:!0}),"D");const Se=Ce((t,e,r,o,s,i,n,c,l,a,d,m,u,g)=>{const h={d:o,h:s,m:i,mo:e,ms:c,s:n,w:r,y:t};return l!==void 0&&(h.future=l),a!==void 0&&(h.past=a),d!==void 0&&(h.decimal=d),m!==void 0&&(h.unitMap=m),u!==void 0&&(h.groupSeparator=u),g!==void 0&&(h.placeholderSeparator=g),h},"createDurationLanguage"),F={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Ie=Se(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",F,",","_");var Be=Object.defineProperty,Pe=p((t,e)=>Be(t,"name",{value:e,configurable:!0}),"o"),De=Object.defineProperty,Ue=Pe((t,e)=>De(t,"name",{value:e,configurable:!0}),"o"),ze=Object.defineProperty,je=Ue((t,e)=>ze(t,"name",{value:e,configurable:!0}),"o");const ke=je(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(t,o))throw new TypeError(`Missing required property: ${o}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const o of r)if(typeof t[o]!="string"&&typeof t[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var _e=Object.defineProperty,Re=p((t,e)=>_e(t,"name",{value:e,configurable:!0}),"w"),Fe=Object.defineProperty,Le=Re((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"S"),Ve=Object.defineProperty,Ge=Le((t,e)=>Ve(t,"name",{value:e,configurable:!0}),"h");const k={d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},A=/[-/\\^$*+?.()|[\]{}]/g,Ye=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Ze=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ke=/^[+-]?\d+(?:\.\d+)?$/,We=/^[-+]/,qe=Ge((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Ie}=e??{};ke(o);const s=o.decimal??".",i=o.groupSeparator??",",n=o.placeholderSeparator??"_",c=s.replaceAll(A,String.raw`\$&`),l=i.replaceAll(A,String.raw`\$&`),a=n.replaceAll(A,String.raw`\$&`),d=o.unitMap??F;let m=t.replaceAll(new RegExp(String.raw`(\d)[${a}${l}](\d)`,"g"),"$1$2");if(s!=="."&&(m=m.replace(c,".")),Ke.test(t)){const f=Number.parseFloat(m.trim());if(!Number.isNaN(f)){const y=d[r];if(y!==void 0)return f*k[y]}return}const u=Ye.exec(t);if(u){const f=Number.parseInt(u[1]??"0",10),y=Number.parseInt(u[2]??"0",10),x=Number.parseInt(u[3]??"0",10);return f*36e5+y*6e4+x*1e3}const g=Ze.exec(t);if(g){let f=0,y=0;g[2]!==void 0?(f=Number.parseInt(g[1]??"0",10),y=Number.parseInt(g[2],10)):g[1]!==void 0&&(y=Number.parseInt(g[1],10));const x=Number.parseInt(g[3]??"0",10);return f*36e5+y*6e4+x*1e3}const h=Object.keys(d).toSorted((f,y)=>y.length-f.length).map(f=>f.replaceAll(A,String.raw`\$&`)).join("|"),N=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${h})`,"gi");let O=0,v,w=!1,P=-1,D=0;for(N.lastIndex=0;(v=N.exec(m))!==null;){w||(P=v.index),w=!0;const f=v[1],y=v[2];if(!f||!y)continue;const x=f.trim(),K=x.startsWith("-")?-1:1,W=x.replace(We,""),U=Number.parseFloat(W),z=d[y.toLowerCase()];if(z===void 0)continue;const q=k[z];if(Number.isNaN(U))return;O+=K*U*q,D=N.lastIndex}const Y=m.slice(0,P).trim(),Z=m.slice(D).trim();if(!(w&&(Y.length>0||Z.length>0))&&w)return O},"parseDuration");var He=Object.defineProperty,Xe=p((t,e)=>He(t,"name",{value:e,configurable:!0}),"n$1");let Je=class extends ae{static{p(this,"u")}static{Xe(this,"Locker")}constructor(e){super({ttl:3e4,ttlAutopurge:!0,...e})}lock(e){if(this.get(e)!==void 0)throw new Error(`${e} is locked`);const r=se();return this.set(e,r),r}unlock(e,r){return this.get(e)!==r?!1:this.delete(e)}};var Qe=Object.defineProperty,et=p((t,e)=>Qe(t,"name",{value:e,configurable:!0}),"e$1");const T=et(t=>{if(t===Number(t))return t;if(!t)return;const e=qe(t);if(e!==void 0)return e},"toMilliseconds");var tt=Object.defineProperty,rt=p((t,e)=>tt(t,"name",{value:e,configurable:!0}),"t");let ot=class extends Error{static{p(this,"d")}static{rt(this,"ValidationError")}code;statusCode;body;headers;name="ValidationError";constructor(e,r,o,s){const i=typeof o=="string"?o:o?.message||"Validation error";super(i),this.code=e,this.statusCode=r,this.body=o,this.headers=s}};var st=Object.defineProperty,S=p((t,e)=>st(t,"name",{value:e,configurable:!0}),"e");const at=S(t=>t&&t[0].toUpperCase()+t.slice(1),"capitalize"),it=S(t=>{if(!Array.isArray(t))return t;const[e,r,o]=t;return{body:r,headers:o,statusCode:e}},"toResponse");class nt{static{p(this,"Validator")}constructor(e="ValidationError"){this.prefix=e}prefix;static{S(this,"Validator")}validators={};add(e){Object.entries(e).forEach(([r,o])=>{const s=`${this.prefix}${at(r)}`;if(this.validators[s]={...this.validators[s],...o},typeof this.validators[s].isValid!="function")throw new TypeError('Validation config "isValid" is missing, or it is not a function!')})}async verify(e){for(const[r,o]of Object.entries(this.validators))if(!await o.isValid(e)){const s=o.response||(r in M?M[r]:M.UnknownError),i=it(s),{body:n,headers:c,message:l,statusCode:a}=i;throw new ot(r,a,n||l,c)}}}const St=S(t=>t.name==="ValidationError","isValidationError");var ct=Object.defineProperty,B=p((t,e)=>ct(t,"name",{value:e,configurable:!0}),"i");const lt=B(t=>{if(typeof t.name=="string")return t.name;if(typeof t.title=="string")return t.title;if(typeof t.originalName=="string")return t.originalName;if(typeof t.filename=="string")return t.filename},"extractOriginalName"),L=B((t,e)=>{const r={...t};return Object.keys(e).forEach(o=>{const s=e[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s)){const i=r[o],n=i&&typeof i=="object"&&!Array.isArray(i)?i:{};r[o]=L(n,s)}else r[o]=s}),r},"deepMerge"),ut=B((t,e)=>{const r=L(t,e);Object.assign(t,r),t.originalName=lt(t.metadata)||t.originalName},"updateMetadata");var mt=Object.defineProperty,b=p((t,e)=>mt(t,"name",{value:e,configurable:!0}),"d");const gt=/(secret|password|passwd|pwd|token|api[_-]?key|credential|authorization|sas|signature|sessiontoken|connectionstring)/i,V=b(t=>{const e={};for(const[r,o]of Object.entries(t))typeof o=="string"&&gt.test(r)?e[r]="[REDACTED]":o&&typeof o=="object"&&!Array.isArray(o)&&o.constructor===Object?e[r]=V(o):e[r]=o;return e},"redactSecrets"),dt={allowMIME:["*/*"],filename:b(({id:t})=>t,"filename"),maxMetadataSize:"8MB",maxUploadSize:"5TB",onComplete:b(()=>{},"onComplete"),onCreate:b(()=>{},"onCreate"),onDelete:b(()=>{},"onDelete"),onError:b(()=>{},"onError"),onUpdate:b(()=>{},"onUpdate"),useRelativeLocation:!1,validation:{}},ht=b(t=>!t||t.length<3||t.length>255||I(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),It=b(t=>{if(!t||t.length<3||t.length>255||I(t))return!1;const e=t.toUpperCase();return!['"',"*",":","<",">","?","\\","|","../","\0"].some(r=>e.includes(r))},"defaultFilesystemFileNameValidation");class G{static{p(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];maxUploadSize;expiration;locker;namingFunction;validation=new nt;assetFolder=void 0;concurrency;constructor(e){const r={...dt,...e};this.onCreate=r.onCreate,this.onUpdate=r.onUpdate,this.onComplete=r.onComplete,this.onDelete=r.onDelete,this.onError=r.onError,this.namingFunction=r.filename,this.maxUploadSize=typeof r.maxUploadSize=="string"?j(r.maxUploadSize):r.maxUploadSize,this.maxMetadataSize=typeof r.maxMetadataSize=="string"?j(r.maxMetadataSize):r.maxMetadataSize,this.expiration=r.expiration,this.genericConfig=r,r.assetFolder!==void 0&&(this.assetFolder=ee(r.assetFolder)),this.locker=new Je({max:1e3,ttl:3e4,ttlAutopurge:!0}),this.cache=r.cache??new oe,this.logger=r.logger,this.metrics=r.metrics??new re,this.logger?.debug(`${this.constructor.name} config: ${Q(V({...e,logger:this.logger.constructor}))}`);const o=T(r.expiration?.purgeInterval);o&&this.startAutoPurge(o);const s={isValid(l){if(l.size===void 0)return!0;const a=l.size;if(a==null)return!1;const d=typeof a=="number"?a:Number(a);if(Number.isNaN(d)||d<0)return!1;const m=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(m)&&d<=m},response:M.RequestEntityTooLarge,value:this.maxUploadSize},i={isValid(l){return!!te.is(l.contentType,this.value)},response:M.UnsupportedMediaType,value:r.allowMIME},n=r.fileNameValidation??ht,c={isValid(l){return n(l.name)},response:M.InvalidFileName};this.validation.add({filename:c,mime:i,size:s}),this.validation.add({...r.validation})}get raw(){}async getReadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getReadUrl()`)}async getUploadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getUploadUrl()`)}get tusExtension(){const e=["creation","creation-with-upload","termination","checksum","creation-defer-length","concatenation"];return this.expiration&&e.push("expiration"),e}async validate(e){await this.validation.verify(e)}async exists(e){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id),!0}catch{return!1}})}normalizeError(e){const r={code:e.name,message:e.message,name:e.name,statusCode:500};return{...r,message:`[${this.constructor.name}] ${r.message}`}}get config(){return this.genericConfig}async saveMeta(e){return G.assertSafeId(e.id),this.updateTimestamps(e),this.cache.set(e.id,e),this.meta.save(e.id,e)}static assertSafeId(e){(!e||typeof e!="string"||e.includes("\0")||e.includes("../")||e.includes("..\\")||e===".."||e.startsWith("../")||e.startsWith("..\\")||I(e)||/^[A-Z]:[/\\]/i.test(e))&&E($.INVALID_FILE_NAME,`Invalid file id: "${e}"`)}async deleteMeta(e){return this.cache.delete(e),this.meta.delete(e)}async getMeta(e){try{const r=await this.meta.get(e);return this.cache.set(r.id,r),{...r}}catch(r){const o=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(o),E($.FILE_NOT_FOUND)}}async checkIfExpired(e){return ne(e)?(this.delete(e).catch(()=>{}),this.deleteMeta(e.id).catch(()=>{}),E($.GONE)):e}async purge(e){return this.instrumentOperation("purge",async()=>{const r=T(e||this.expiration?.maxAge),o={items:[],maxAgeMs:r};if(r){const s=Date.now()-r,i=(await this.list()).filter(n=>Number(new Date(this.expiration?.rolling&&n.modifiedAt||n.createdAt))<s);for await(const{id:n,...c}of i)try{const l=await this.delete({id:n});o.items.push({...l,...c})}catch(l){this.logger?.warn(`Failed to delete file ${n} during purge: ${l instanceof Error?l.message:String(l)}`)}o.items.length>0&&(this.logger?.info(`Purge: removed ${o.items.length} uploads`),this.metrics.gauge("storage.operations.purge.items_count",o.items.length,{storage:this.constructor.name.toLowerCase().replace("storage","")}))}return o})}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const r=await this.get({id:e}),o=X.from(r.content);return{headers:{"Content-Length":String(r.size),"Content-Type":r.contentType,...r.ETag&&{ETag:r.ETag},...r.modifiedAt&&{"Last-Modified":r.modifiedAt.toString()}},size:typeof r.size=="number"?r.size:void 0,stream:o}})}async list(e=1e3){return this.instrumentOperation("list",async()=>{throw new Error("Not implemented")})}async update({id:e},r){return this.instrumentOperation("update",async()=>{const o=await this.getMeta(e),s={...r};if("ttl"in s&&s.ttl!==void 0){const n=s.ttl,c=typeof n=="string"?T(n):n;c!==void 0&&(s.expiredAt=Date.now()+c),delete s.ttl}ut(o,s),await this.saveMeta(o);const i={...o,status:"updated"};return await this.onUpdate(i),i})}async deleteBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async a=>{try{return{file:await this.delete({id:a}),id:a,success:!0}}catch(d){const m=d instanceof Error?d.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:m,storage:o}),{error:m,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success?s.push(a.value.file):i.push({error:a.value.error,id:a.value.id}):i.push({error:a.reason?.message||"Delete failed",id:""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.delete.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.delete.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.delete.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async copyBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.copy.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async({destination:a,options:d,source:m})=>{try{return{file:await this.copy(m,a,d),id:a,success:!0}}catch(u){const g=u instanceof Error?u.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:g,storage:o}),{error:g,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Copy failed",id:a.value.id}):i.push({error:a.reason?.message||"Copy failed",id:""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.copy.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.copy.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async moveBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.move.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async({destination:a,source:d})=>{try{return{file:await this.move(d,a),id:a,success:!0}}catch(m){const u=m instanceof Error?m.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:u,storage:o}),{error:u,id:a,success:!1}}}),c=await Promise.allSettled(n);for(const a of c)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Move failed",id:a.value.id}):i.push({error:a.reason?.message||"Move failed",id:a.reason?.id||""});const l=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",l,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.move.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.move.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.length}}async lock(e){const r=[...this.locker.keys()];return r.includes(e)?E($.FILE_LOCKED):this.config.concurrency&&typeof this.config.concurrency=="number"&&this.config.concurrency<r.length?E($.STORAGE_BUSY):this.locker.lock(e)}async unlock(e,r){if(r===void 0){this.locker.delete(e);return}this.locker.unlock(e,r)}async withLock(e,r){const o=await this.lock(e);try{return await r()}finally{await this.unlock(e,o)}}isUnsupportedChecksum(e=""){return!!e&&!this.checksumTypes.includes(e)}startAutoPurge(e){if(e>=2147483647)throw new Error("“purgeInterval” must be less than 2147483647 ms");J(()=>{this.purge().catch(r=>this.logger?.error(r))},e)}updateTimestamps(e){e.createdAt??=new Date().toISOString();const r=T(this.expiration?.maxAge);return r&&!e.expiredAt&&(e.expiredAt=this.expiration?.rolling?Date.now()+r:+new Date(e.createdAt)+r),e}getRetryConfig(){}runOperation(e,r,o){let s;typeof e?.retries=="number"?s={maxRetries:e.retries}:e?.retries&&(s=e.retries);const i={...this.getRetryConfig(),...s};o?.replayable===!1&&(i.maxRetries=0);const n=[];this.genericConfig.defaultSignal&&n.push(this.genericConfig.defaultSignal),e?.signal&&n.push(e.signal);let c;n.length===1?[c]=n:n.length>1&&(c=AbortSignal.any(n));const l=typeof e?.timeout=="number"?e.timeout:this.genericConfig.defaultTimeout,a=typeof l=="number"&&l>0?l:void 0,d=i.shouldRetry;i.shouldRetry=u=>c?.aborted||u instanceof Error&&u.name==="AbortError"?!1:d?d(u):!1;const m=b(u=>{if(u instanceof Error&&u.name==="AbortError")return u;const g=u instanceof Error&&u.message?u.message:"The operation was aborted",h=new Error(g,{cause:u});return h.name="AbortError",h},"toAbortError");return ie(async()=>{if(c?.aborted)throw m(c.reason);let u,g;if(a===void 0)g=c;else{const h=new AbortController;u=setTimeout(()=>{h.abort(new DOMException(`The operation timed out after ${a}ms`,"TimeoutError"))},a),g=c?AbortSignal.any([c,h.signal]):h.signal}try{return await r(g)}catch(h){throw g?.aborted?m(h):h}finally{u&&clearTimeout(u)}},i)}async instrumentOperation(e,r,o){const s=Date.now(),i={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,i);const n=await r(),c=Date.now()-s;return this.metrics.timing(`storage.operations.${e}.duration`,c,i),n&&typeof n=="object"&&"size"in n&&typeof n.size=="number"&&this.metrics.gauge("storage.files.size",n.size,{...i,operation:e}),n}catch(n){const c=Date.now()-s,l=n instanceof Error?n.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,c,{...i,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...i,error:l}),n}}}export{j as $,G as B,It as a,ot as b,ht as d,St as i,T as t,ut as u,qe as z};
@@ -273,6 +273,70 @@ declare class Locker<K extends string = string> extends LRUCache<K, string, numb
273
273
  unlock(key: K, token: string): boolean;
274
274
  }
275
275
  /**
276
+ * Retry configuration options for storage operations
277
+ */
278
+ interface RetryConfig {
279
+ /**
280
+ * Multiplier for exponential backoff (e.g., 2 means delays double each retry)
281
+ * @default 2
282
+ */
283
+ backoffMultiplier?: number;
284
+ /**
285
+ * Custom function to calculate delay for a specific retry attempt
286
+ * @param attempt The current retry attempt (0-indexed)
287
+ * @param error The error that occurred
288
+ * @returns Delay in milliseconds, or undefined to use default exponential backoff
289
+ */
290
+ calculateDelay?: (attempt: number, error: unknown) => number | undefined;
291
+ /**
292
+ * Initial delay in milliseconds before first retry
293
+ * @default 1000
294
+ */
295
+ initialDelay?: number;
296
+ /**
297
+ * Maximum delay in milliseconds between retries
298
+ * @default 30000
299
+ */
300
+ maxDelay?: number;
301
+ /**
302
+ * Maximum number of retry attempts
303
+ * @default 3
304
+ */
305
+ maxRetries?: number;
306
+ /**
307
+ * HTTP status codes that should trigger a retry
308
+ * @default [408, 429, 500, 502, 503, 504]
309
+ */
310
+ retryableStatusCodes?: number[];
311
+ /**
312
+ * Custom function to determine if an error should be retried
313
+ * @param error The error that occurred
314
+ * @returns true if the error should be retried, false otherwise
315
+ */
316
+ shouldRetry?: (error: unknown) => boolean;
317
+ }
318
+ /**
319
+ * Determines if an error is retryable based on common patterns
320
+ * @param error The error to check
321
+ * @param retryableStatusCodes HTTP status codes that should trigger retry
322
+ * @returns true if the error is retryable
323
+ */
324
+ declare const isRetryableError: (error: unknown, retryableStatusCodes?: number[]) => boolean;
325
+ /**
326
+ * Retry an async operation with exponential backoff
327
+ * @param fn The async function to retry
328
+ * @param config Retry configuration
329
+ * @returns The result of the function
330
+ * @throws The last error if all retries are exhausted
331
+ */
332
+ declare const retry: <T>(function_: () => Promise<T>, config?: RetryConfig) => Promise<T>;
333
+ /**
334
+ * Create a retry wrapper function with pre-configured settings.
335
+ * @param config Retry configuration
336
+ * @returns A function that wraps async operations with retry logic
337
+ */
338
+ declare const createRetryWrapper: (config?: RetryConfig) => <T>(function_: () => Promise<T>) => Promise<T>;
339
+ /**
276
340
  * Configurable validation system for file upload constraints.
277
341
  * Supports multiple validation rules with custom error responses.
278
342
  * @template T - The type being validated
@@ -420,70 +484,6 @@ declare class MetaStorage<T extends File = File> {
420
484
  getMetaName(id: string): string;
421
485
  getIdFromMetaName(name: string): string;
422
486
  }
423
- /**
424
- * Retry configuration options for storage operations
425
- */
426
- interface RetryConfig {
427
- /**
428
- * Multiplier for exponential backoff (e.g., 2 means delays double each retry)
429
- * @default 2
430
- */
431
- backoffMultiplier?: number;
432
- /**
433
- * Custom function to calculate delay for a specific retry attempt
434
- * @param attempt The current retry attempt (0-indexed)
435
- * @param error The error that occurred
436
- * @returns Delay in milliseconds, or undefined to use default exponential backoff
437
- */
438
- calculateDelay?: (attempt: number, error: unknown) => number | undefined;
439
- /**
440
- * Initial delay in milliseconds before first retry
441
- * @default 1000
442
- */
443
- initialDelay?: number;
444
- /**
445
- * Maximum delay in milliseconds between retries
446
- * @default 30000
447
- */
448
- maxDelay?: number;
449
- /**
450
- * Maximum number of retry attempts
451
- * @default 3
452
- */
453
- maxRetries?: number;
454
- /**
455
- * HTTP status codes that should trigger a retry
456
- * @default [408, 429, 500, 502, 503, 504]
457
- */
458
- retryableStatusCodes?: number[];
459
- /**
460
- * Custom function to determine if an error should be retried
461
- * @param error The error that occurred
462
- * @returns true if the error should be retried, false otherwise
463
- */
464
- shouldRetry?: (error: unknown) => boolean;
465
- }
466
- /**
467
- * Determines if an error is retryable based on common patterns
468
- * @param error The error to check
469
- * @param retryableStatusCodes HTTP status codes that should trigger retry
470
- * @returns true if the error is retryable
471
- */
472
- declare const isRetryableError: (error: unknown, retryableStatusCodes?: number[]) => boolean;
473
- /**
474
- * Retry an async operation with exponential backoff
475
- * @param fn The async function to retry
476
- * @param config Retry configuration
477
- * @returns The result of the function
478
- * @throws The last error if all retries are exhausted
479
- */
480
- declare const retry: <T>(function_: () => Promise<T>, config?: RetryConfig) => Promise<T>;
481
- /**
482
- * Create a retry wrapper function with pre-configured settings.
483
- * @param config Retry configuration
484
- * @returns A function that wraps async operations with retry logic
485
- */
486
- declare const createRetryWrapper: (config?: RetryConfig) => <T>(function_: () => Promise<T>) => Promise<T>;
487
487
  type OnCreate<TFile extends File = File> = (file: TFile) => Promise<void> | void;
488
488
  type OnUpdate<TFile extends File = File> = (file: TFile) => Promise<void> | void;
489
489
  type OnComplete<TFile extends File = File, TResponse = unknown, TRequest = unknown> = (file: TFile, response: TResponse, request?: TRequest) => Promise<void> | void;
@@ -605,6 +605,19 @@ interface GenericStorageConfig {
605
605
  cacheTTL?: number;
606
606
  /** Supported checksum algorithms */
607
607
  checksumTypes?: string[];
608
+ /**
609
+ * Default abort signal merged into every operation. A per-call
610
+ * `OperationOptions.signal` is combined with this, not replaced — either
611
+ * one aborts the call. Note this signal lives for the storage instance's
612
+ * lifetime: once it aborts, every subsequent operation fails fast.
613
+ */
614
+ defaultSignal?: AbortSignal;
615
+ /**
616
+ * Default per-operation timeout in milliseconds, applied per retry
617
+ * attempt when a call omits `OperationOptions.timeout`. A per-call
618
+ * `timeout` (including `0` to explicitly disable) takes precedence.
619
+ */
620
+ defaultTimeout?: number;
608
621
  /** Logger instance */
609
622
  logger?: Console;
610
623
  /** Maximum file size */
@@ -615,6 +628,32 @@ interface GenericStorageConfig {
615
628
  retryConfig?: RetryConfig;
616
629
  }
617
630
  /**
631
+ * Per-operation overrides for cancellation, deadlines and retries.
632
+ *
633
+ * Threaded through the public storage operations down to the backend SDK call.
634
+ * Backends that wrap an SDK with native cancellation honour `signal`/`timeout`
635
+ * directly; backends without a cancellation primitive still fail fast at the
636
+ * storage layer, but the provider request may continue in the background.
637
+ */
638
+ interface OperationOptions {
639
+ /**
640
+ * Retry override for this call. A number is treated as `maxRetries`; an
641
+ * object is shallow-merged over the backend's configured `RetryConfig`.
642
+ * Aborted and timed-out operations are never retried regardless of this.
643
+ */
644
+ retries?: number | RetryConfig;
645
+ /**
646
+ * Abort the operation when this signal fires. Merged with any
647
+ * per-call `timeout` via `AbortSignal.any`.
648
+ */
649
+ signal?: AbortSignal;
650
+ /**
651
+ * Per-operation timeout in milliseconds. `0` or a negative value
652
+ * disables the timeout. Applied per retry attempt.
653
+ */
654
+ timeout?: number;
655
+ }
656
+ /**
618
657
  * Batch operation result for a single file
619
658
  */
620
659
  interface BatchOperationResult<T extends File = File> {
@@ -1023,6 +1062,33 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
1023
1062
  protected startAutoPurge(purgeInterval: number): void;
1024
1063
  protected updateTimestamps(file: TFile): TFile;
1025
1064
  /**
1065
+ * Backend-resolved retry configuration that {@link runOperation} layers
1066
+ * per-call overrides on top of. Subclasses that build a `RetryConfig`
1067
+ * (S3, Azure, Netlify, …) override this; the default (`undefined`) makes
1068
+ * `runOperation` fall back to the retry engine's own defaults.
1069
+ */
1070
+ protected getRetryConfig(): RetryConfig | undefined;
1071
+ /**
1072
+ * Runs a backend SDK call with per-operation cancellation, timeout and
1073
+ * retry handling.
1074
+ *
1075
+ * The provided `signal` is the merge of the caller's `options.signal` and
1076
+ * a fresh per-attempt `options.timeout` deadline (via `AbortSignal.any` /
1077
+ * `AbortSignal.timeout`). Pass it to the underlying SDK so the provider
1078
+ * request is actually cancelled rather than merely abandoned.
1079
+ *
1080
+ * Aborted or timed-out calls are never retried. Pass
1081
+ * `{ replayable: false }` for operations whose body is a one-shot stream —
1082
+ * a consumed `Readable`/`ReadableStream` cannot be safely re-sent, so the
1083
+ * retry count is forced to zero.
1084
+ * @param options Per-call overrides (`signal`, `timeout`, `retries`).
1085
+ * @param function_ Receives the merged abort signal for the attempt.
1086
+ * @param operationConfig `replayable: false` disables retries for non-replayable bodies.
1087
+ */
1088
+ protected runOperation<T>(options: OperationOptions | undefined, function_: (signal: AbortSignal | undefined) => Promise<T>, operationConfig?: {
1089
+ replayable?: boolean;
1090
+ }): Promise<T>;
1091
+ /**
1026
1092
  * Instruments a storage operation with metrics and error tracking.
1027
1093
  * @param operation Operation name (e.g., "create", "delete", "copy").
1028
1094
  * @param function_ The operation function to execute.
@@ -1037,4 +1103,4 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
1037
1103
  */
1038
1104
  protected instrumentOperation<T>(operation: string, function_: () => Promise<T>, attributes?: Record<string, string | number>): Promise<T>;
1039
1105
  }
1040
- export { throwErrorCode as $, RangeHasher as A, BaseStorage as B, Cache as C, DiskStorageOptions as D, ERRORS as E, File as F, ResponseBody as G, HttpError as H, IncomingMessageWithBody as I, ResponseTuple as J, UploadResponse as K, LocalMetaStorageOptions as L, MetaStorage as M, ValidationError as N, OnComplete as O, PurgeList as P, ValidatorConfig as Q, RetryConfig as R, defaultCloudStorageFileNameValidation as S, defaultFilesystemFileNameValidation as T, UploadFile as U, Validation as V, extractHttpStatus as W, isRetryableError as X, isUploadError as Y, mapStatusToErrorCode as Z, retry as _, FileReturn as a, wrapStorageError as a0, UploadError as b, UploadEventType as c, createRetryWrapper as d, FileInit as e, FilePart as f, FileQuery as g, DiskStorageWithChecksumOptions as h, ResponseBodyType as i, ErrorResponses as j, Metrics as k, BaseStorageOptions as l, BatchOperationResponse as m, BatchOperationResult as n, ErrorMap as o, ExpirationOptions as p, Header as q, Headers as r, HttpErrorBody as s, MetaStorageOptions as t, Metadata as u, OnCreate as v, OnDelete as w, OnError as x, OnUpdate as y, RangeChecksum as z };
1106
+ export { throwErrorCode as $, RangeChecksum as A, BaseStorage as B, RangeHasher as C, DiskStorageOptions as D, ERRORS as E, File as F, ResponseBody as G, HttpError as H, IncomingMessageWithBody as I, ResponseTuple as J, UploadResponse as K, LocalMetaStorageOptions as L, MetaStorage as M, ValidationError as N, OperationOptions as O, PurgeList as P, ValidatorConfig as Q, RetryConfig as R, defaultCloudStorageFileNameValidation as S, defaultFilesystemFileNameValidation as T, UploadFile as U, Validation as V, extractHttpStatus as W, isRetryableError as X, isUploadError as Y, mapStatusToErrorCode as Z, retry as _, FileReturn as a, wrapStorageError as a0, Cache as a1, UploadError as b, UploadEventType as c, createRetryWrapper as d, FileInit as e, FilePart as f, FileQuery as g, DiskStorageWithChecksumOptions as h, BaseStorageOptions as i, ResponseBodyType as j, ErrorResponses as k, Metrics as l, BatchOperationResponse as m, BatchOperationResult as n, ErrorMap as o, ExpirationOptions as p, Header as q, Headers as r, HttpErrorBody as s, MetaStorageOptions as t, Metadata as u, OnComplete as v, OnCreate as w, OnDelete as x, OnError as y, OnUpdate as z };
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var n=(e,s)=>t(e,"name",{value:s,configurable:!0});var E=Object.defineProperty,a=n((e,s)=>E(e,"name",{value:s,configurable:!0}),"c");const T=a(e=>{const s=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.TENCENT_SECRET_ID,o=e?.endpoint??process.env.TENCENT_ENDPOINT,r=e?.region??process.env.TENCENT_REGION,c=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.TENCENT_SECRET_KEY;if(!r||!s||!c)throw new Error("Missing required parameters for Tencent Cloud COS client.");return{credentials:{accessKeyId:s,secretAccessKey:c},endpoint:o??`https://cos.${r}.myqcloud.com`,forcePathStyle:!1,region:r}},"tencent");export{T as default};
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import { U as UploadFile, i as ResponseBodyType, B as BaseStorage, j as ErrorResponses } from "./storage.d-Cr6f2lac.js";
2
+ import { U as UploadFile, j as ResponseBodyType, B as BaseStorage, k as ErrorResponses } from "./storage.d-RteRC-cG.js";
3
3
  import 'node:stream';
4
- import { M as MediaTransformer } from "./media-transformer.d-DK7NJncf.js";
5
- import { U as UploadOptions } from "./types.d-BgCmSE94.js";
4
+ import { M as MediaTransformer } from "./media-transformer.d-j1W9HAXw.js";
5
+ import { U as UploadOptions } from "./types.d-DzPvh74p.js";
6
6
  import 'node:crypto';
7
7
  import 'node:http';
8
8
  import 'lru-cache';
@@ -1,4 +1,4 @@
1
- import { C as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-Cr6f2lac.js";
1
+ import { a1 as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-RteRC-cG.js";
2
2
  import { Readable } from 'node:stream';
3
3
  /**
4
4
  * Base transformer configuration with common properties
@@ -717,4 +717,4 @@ interface AudioTransformerConfig extends BaseTransformerConfig {
717
717
  /** Maximum audio size to process (in bytes) */
718
718
  maxAudioSize?: number;
719
719
  }
720
- export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, ToColourspaceOptions as F, GreyscaleOptions as G, RemoveAlphaOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, EnsureAlphaOptions as K, LinearOptions as L, MedianOptions as M, TransformationStep as N, MediaTransformerConfig as O, PipelineColourspaceOptions as P, MediaTransformResult as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, VideoTransformResult as a, VideoResizeOptions as b, VideoCropOptions as c, VideoRotateOptions as d, VideoTransformOptions as e, VideoTransformationStep as f, AudioTransformResult as g, AudioResampleOptions as h, AudioChannelMixOptions as i, AudioTransformOptions as j, AudioTransformationStep as k, RotateOptions as l, ImageFormat as m, TransformOptions as n, BlurOptions as o, CLAHEOptions as p, ConvolveOptions as q, ThresholdOptions as r, BooleanOptions as s, RecombineOptions as t, ModulateOptions as u, TintOptions as v, ColourspaceOptions as w, BandboolOptions as x, AffineOptions as y, ErodeOptions as z };
720
+ export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, AffineOptions as D, ExtractChannelOptions as E, DilateOptions as F, GreyscaleOptions as G, ErodeOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, ToColourspaceOptions as K, LinearOptions as L, MediaTransformerConfig as M, RemoveAlphaOptions as N, EnsureAlphaOptions as O, PipelineColourspaceOptions as P, TransformationStep as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, AudioTransformResult as a, AudioResampleOptions as b, AudioChannelMixOptions as c, AudioTransformOptions as d, AudioTransformationStep as e, VideoTransformResult as f, VideoResizeOptions as g, VideoCropOptions as h, VideoRotateOptions as i, VideoTransformOptions as j, VideoTransformationStep as k, MediaTransformResult as l, RotateOptions as m, ImageFormat as n, TransformOptions as o, BlurOptions as p, MedianOptions as q, CLAHEOptions as r, ConvolveOptions as s, ThresholdOptions as t, BooleanOptions as u, RecombineOptions as v, ModulateOptions as w, TintOptions as x, ColourspaceOptions as y, BandboolOptions as z };
@@ -0,0 +1,104 @@
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions } from "./storage.d-RteRC-cG.js";
2
+ import 'node:stream';
3
+ import { Client } from '@microsoft/microsoft-graph-client';
4
+ declare class OneDriveFile extends File {
5
+ driveItemId?: string;
6
+ eTag?: string;
7
+ webUrl?: string;
8
+ }
9
+ interface OneDriveClientCredentialsAuth {
10
+ /**
11
+ * Microsoft Entra (Azure AD) application (client) ID.
12
+ */
13
+ clientId: string;
14
+ /**
15
+ * Application (client) secret.
16
+ */
17
+ clientSecret: string;
18
+ /**
19
+ * Microsoft Entra tenant ID (GUID or domain name).
20
+ */
21
+ tenantId: string;
22
+ }
23
+ interface OneDriveOAuthRefreshAuth {
24
+ /**
25
+ * Microsoft Entra application (client) ID.
26
+ */
27
+ clientId: string;
28
+ /**
29
+ * Application client secret. Required for confidential clients (default).
30
+ * Public clients may omit it if the app registration allows.
31
+ */
32
+ clientSecret?: string;
33
+ /**
34
+ * OAuth2 refresh token obtained from an interactive sign-in flow.
35
+ */
36
+ refreshToken: string;
37
+ /**
38
+ * Tenant ID — `"common"`, `"consumers"`, `"organizations"`, or a tenant
39
+ * GUID/domain. Defaults to `"common"`.
40
+ */
41
+ tenantId?: string;
42
+ }
43
+ interface OneDriveStorageOptions extends BaseStorageOptions {
44
+ /**
45
+ * Static or dynamic access token. Pass a string for a one-shot token, or
46
+ * a function returning a fresh token on each call.
47
+ */
48
+ accessToken?: string | (() => string | Promise<string>);
49
+ /**
50
+ * Pre-built `@microsoft/microsoft-graph-client` `Client`. Escape hatch for
51
+ * callers that wire up their own `AuthenticationProvider` (e.g. with
52
+ * `@azure/identity` or `@azure/msal-node`).
53
+ */
54
+ client?: Client;
55
+ /**
56
+ * Client-credentials auth — for app-only / daemon scenarios.
57
+ * Cannot be used with `/me/drive`; you must target via `driveId`,
58
+ * `siteId`, or `userId`.
59
+ */
60
+ clientCredentials?: OneDriveClientCredentialsAuth;
61
+ /**
62
+ * Timeout, in milliseconds, for polling the async-copy monitor URL.
63
+ * Defaults to 60_000 (60s).
64
+ */
65
+ copyTimeoutMs?: number;
66
+ /**
67
+ * Target drive by ID. Mutually exclusive with `siteId` and `userId`.
68
+ */
69
+ driveId?: string;
70
+ /**
71
+ * Configure metafiles storage. Defaults to local tmp directory.
72
+ */
73
+ metaStorageConfig?: LocalMetaStorageOptions;
74
+ /**
75
+ * OAuth2 refresh-token auth — for delegated user scenarios. Exchanges
76
+ * the refresh token at the Microsoft identity platform and caches the
77
+ * resulting access token until ~60s before expiry.
78
+ */
79
+ oauth?: OneDriveOAuthRefreshAuth;
80
+ /**
81
+ * When `true`, `getReadUrl` creates an anonymous shared link with
82
+ * `view` permission. Otherwise it returns the short-lived pre-authenticated
83
+ * `@microsoft.graph.downloadUrl` from the item metadata.
84
+ */
85
+ publicByDefault?: boolean;
86
+ /**
87
+ * Logical "bucket root" — virtual keys live under this folder path within
88
+ * the target drive. Must already exist; the adapter does not create
89
+ * folders. Defaults to drive root.
90
+ */
91
+ rootFolderPath?: string;
92
+ /**
93
+ * Target a SharePoint site's default drive. Mutually exclusive with
94
+ * `driveId` and `userId`.
95
+ */
96
+ siteId?: string;
97
+ /**
98
+ * Target a specific user's drive. Mutually exclusive with `driveId` and
99
+ * `siteId`. Required when using `clientCredentials` auth (Graph does not
100
+ * accept `/me/drive` for app-only tokens).
101
+ */
102
+ userId?: string;
103
+ }
104
+ export { OneDriveFile as O, OneDriveStorageOptions as a, OneDriveClientCredentialsAuth as b, OneDriveOAuthRefreshAuth as c };
@@ -2,8 +2,8 @@ import { EventEmitter } from 'node:events';
2
2
  import { IncomingMessage } from 'node:http';
3
3
  import { Readable } from 'node:stream';
4
4
  import { PaginationResult } from '@visulima/pagination';
5
- import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-Cr6f2lac.js";
6
- import { M as MediaTransformer } from "./media-transformer.d-DK7NJncf.js";
5
+ import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-RteRC-cG.js";
6
+ import { M as MediaTransformer } from "./media-transformer.d-j1W9HAXw.js";
7
7
  type WebRequest = globalThis.Request;
8
8
  type WebResponse = globalThis.Response;
9
9
  interface BaseResponse {
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});var n=Object.defineProperty,E=t((e,r)=>n(e,"name",{value:r,configurable:!0}),"o");const _=E(e=>{const r=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.VULTR_ACCESS_KEY_ID??process.env.VULTR_ACCESS_KEY,s=e?.location??process.env.VULTR_LOCATION,c=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.VULTR_SECRET_ACCESS_KEY??process.env.VULTR_SECRET_KEY;if(!s||!r||!c)throw new Error("Missing required parameters for Vultr Object Storage client.");return{credentials:{accessKeyId:r,secretAccessKey:c},endpoint:`https://${s}.vultrobjects.com`,forcePathStyle:!1,region:s}},"vultr");export{_ as default};
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var n=(e,r)=>o(e,"name",{value:r,configurable:!0});var a=Object.defineProperty,E=n((e,r)=>a(e,"name",{value:r,configurable:!0}),"t");const _=E(e=>{const r=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.YANDEX_ACCESS_KEY_ID,c=e?.endpoint??process.env.YANDEX_ENDPOINT,t=e?.region??process.env.AWS_REGION??process.env.YANDEX_REGION??"ru-central1",s=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.YANDEX_SECRET_ACCESS_KEY;if(!r||!s)throw new Error("Missing required parameters for Yandex Object Storage client.");return{credentials:{accessKeyId:r,secretAccessKey:s},endpoint:c??"https://storage.yandexcloud.net",forcePathStyle:!1,region:t}},"yandex");export{_ as default};