@visulima/storage 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (307) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/LICENSE.md +1256 -512
  3. package/README.md +4 -4
  4. package/dist/adapter/nuxt/module.d.ts +41 -34
  5. package/dist/adapter/nuxt/module.js +1 -93
  6. package/dist/handler/http/fetch/index.d.ts +297 -4
  7. package/dist/handler/http/fetch/index.js +1 -4
  8. package/dist/handler/http/hono/index.d.ts +1474 -58
  9. package/dist/handler/http/hono/index.js +1 -65
  10. package/dist/handler/http/nextjs/index.d.ts +66 -58
  11. package/dist/handler/http/nextjs/index.js +1 -37
  12. package/dist/handler/http/node/index.d.ts +361 -4
  13. package/dist/handler/http/node/index.js +1 -4
  14. package/dist/handler/http/solid-start/index.d.ts +66 -57
  15. package/dist/handler/http/solid-start/index.js +1 -44
  16. package/dist/index.d.ts +376 -17
  17. package/dist/index.js +1 -13
  18. package/dist/openapi/index.d.ts +24 -5
  19. package/dist/openapi/index.js +1 -5
  20. package/dist/packem_shared/AwsLightFile-BTLiRxXj.js +1 -0
  21. package/dist/packem_shared/AwsLightMetaStorage-DHz1nf_H.js +1 -0
  22. package/dist/packem_shared/AwsLightStorage-CA9cdfJ6.js +1 -0
  23. package/dist/packem_shared/AzureFile-BKHru1zB.js +1 -0
  24. package/dist/packem_shared/AzureSMetaStorage-BqA4jUDJ.js +1 -0
  25. package/dist/packem_shared/AzureStorage-BKUjCymW.js +1 -0
  26. package/dist/packem_shared/BaseTransformer-D68eLyz1.js +1 -0
  27. package/dist/packem_shared/DiskStorage-DNjpDMX9.js +1 -0
  28. package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +1 -0
  29. package/dist/packem_shared/ERRORS-B9jkvKwx.js +1 -0
  30. package/dist/packem_shared/File-alcSNpLq.js +1 -0
  31. package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
  32. package/dist/packem_shared/GCSFile-CHjX_fJk.js +1 -0
  33. package/dist/packem_shared/GCSMetaStorage-1UQIN9IN.js +1 -0
  34. package/dist/packem_shared/GCStorage-PJRb2WWC.js +1 -0
  35. package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +1 -0
  36. package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +1 -0
  37. package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
  38. package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
  39. package/dist/packem_shared/Multipart-Bd9YFFn0.js +1 -0
  40. package/dist/packem_shared/Multipart-D5bcEvga.js +1 -0
  41. package/dist/packem_shared/NetlifyBlobFile-CpzkMKng.js +1 -0
  42. package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +1 -0
  43. package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +1 -0
  44. package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
  45. package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
  46. package/dist/packem_shared/Rest-CYEBbtCD.js +1 -0
  47. package/dist/packem_shared/Rest-DoonVU7B.js +1 -0
  48. package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +20357 -0
  49. package/dist/packem_shared/S3File-Du6wP0Sz.js +1 -0
  50. package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
  51. package/dist/packem_shared/S3Storage-Fx6-OSc-.js +1 -0
  52. package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
  53. package/dist/packem_shared/Tus-Bd_2Ki2G.js +1 -0
  54. package/dist/packem_shared/Tus-CUBCkuPE.js +1 -0
  55. package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
  56. package/dist/packem_shared/VercelBlobFile-CL9MjKcY.js +1 -0
  57. package/dist/packem_shared/VercelBlobMetaStorage-BsOTx-Su.js +1 -0
  58. package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +1 -0
  59. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  60. package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +4 -0
  61. package/dist/packem_shared/backblaze-DEflv87m.js +1 -0
  62. package/dist/packem_shared/base-handler-core-DaggCVsq.js +1 -0
  63. package/dist/packem_shared/base-handler-fetch-DnarP64X.js +1 -0
  64. package/dist/packem_shared/base-handler-node-BTes6sql.js +1 -0
  65. package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
  66. package/dist/packem_shared/cloudflare-DLAeQvgD.js +1 -0
  67. package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +1 -0
  68. package/dist/packem_shared/digitalOcean-nhZUds87.js +1 -0
  69. package/dist/packem_shared/disk-storage-BvdK4bqF.js +5 -0
  70. package/dist/packem_shared/disk-storage-with-checksum.d-hEoe2ugb.d.ts +148 -0
  71. package/dist/packem_shared/gcs-meta-storage-DXqBZ3Xm.js +1 -0
  72. package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
  73. package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
  74. package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
  75. package/dist/packem_shared/isRetryableError-DQNSZiBc.js +1 -0
  76. package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
  77. package/dist/packem_shared/local-meta-storage-Bkwqi_gi.js +1 -0
  78. package/dist/packem_shared/local-meta-storage.d-Dop9RP9k.d.ts +20 -0
  79. package/dist/packem_shared/media-transformer.d-LGdEjx6A.d.ts +331 -0
  80. package/dist/packem_shared/minio-BWwgGXeE.js +1 -0
  81. package/dist/packem_shared/multipart-base-C6OjBwMS.js +1 -0
  82. package/dist/packem_shared/part-match-DqD5U7An.js +1 -0
  83. package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
  84. package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
  85. package/dist/packem_shared/rest-base-B2Dv7esY.js +1 -0
  86. package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
  87. package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +1 -0
  88. package/dist/packem_shared/s3-base-storage.d-CczjSe98.d.ts +251 -0
  89. package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
  90. package/dist/packem_shared/storage-m_Cxgiih.js +1 -0
  91. package/dist/packem_shared/storage.d-BOMUJD96.d.ts +939 -0
  92. package/dist/packem_shared/tigris-DZoyrMNd.js +1 -0
  93. package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
  94. package/dist/packem_shared/tus-base.d-C20dSee8.d.ts +99 -0
  95. package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
  96. package/dist/packem_shared/types.d-B4hqF6yH.d.ts +708 -0
  97. package/dist/packem_shared/types.d-CNvyxOka.d.ts +49 -0
  98. package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
  99. package/dist/packem_shared/validator-DK41xp8N.js +1 -0
  100. package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
  101. package/dist/packem_shared/wasabi-Dmce4x9s.js +1 -0
  102. package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
  103. package/dist/storage/aws/clients/index.d.ts +166 -6
  104. package/dist/storage/aws/clients/index.js +1 -6
  105. package/dist/storage/aws/index.d.ts +320 -4
  106. package/dist/storage/aws/index.js +1 -3
  107. package/dist/storage/aws-light/index.d.ts +252 -4
  108. package/dist/storage/aws-light/index.js +1 -3
  109. package/dist/storage/azure/index.d.ts +10422 -4
  110. package/dist/storage/azure/index.js +1 -3
  111. package/dist/storage/gcs/index.d.ts +4107 -5
  112. package/dist/storage/gcs/index.js +1 -4
  113. package/dist/storage/local/index.d.ts +7 -4
  114. package/dist/storage/local/index.js +1 -3
  115. package/dist/storage/netlify-blob/index.d.ts +142 -4
  116. package/dist/storage/netlify-blob/index.js +1 -3
  117. package/dist/storage/vercel-blob/index.d.ts +129 -4
  118. package/dist/storage/vercel-blob/index.js +1 -3
  119. package/dist/transformer/audio-transformer.d.ts +127 -125
  120. package/dist/transformer/audio-transformer.js +1 -278
  121. package/dist/transformer/image-transformer.d.ts +569 -568
  122. package/dist/transformer/image-transformer.js +1 -1100
  123. package/dist/transformer/index.d.ts +62 -5
  124. package/dist/transformer/index.js +1 -4
  125. package/dist/transformer/video-transformer.d.ts +144 -142
  126. package/dist/transformer/video-transformer.js +1 -310
  127. package/package.json +60 -60
  128. package/dist/handler/base/base-handler-core.d.ts +0 -91
  129. package/dist/handler/base/base-handler-fetch.d.ts +0 -76
  130. package/dist/handler/base/base-handler-node.d.ts +0 -137
  131. package/dist/handler/multipart/multipart-base.d.ts +0 -84
  132. package/dist/handler/multipart/multipart-fetch.d.ts +0 -64
  133. package/dist/handler/multipart/multipart.d.ts +0 -49
  134. package/dist/handler/rest/rest-base.d.ts +0 -106
  135. package/dist/handler/rest/rest-fetch.d.ts +0 -88
  136. package/dist/handler/rest/rest.d.ts +0 -93
  137. package/dist/handler/tus/tus-base.d.ts +0 -152
  138. package/dist/handler/tus/tus-fetch.d.ts +0 -72
  139. package/dist/handler/tus/tus.d.ts +0 -78
  140. package/dist/handler/types.d.ts +0 -53
  141. package/dist/handler/utils/request-parser.d.ts +0 -72
  142. package/dist/handler/utils/response-builder.d.ts +0 -83
  143. package/dist/handler/utils/storage-utils.d.ts +0 -10
  144. package/dist/handler/utils/stream-utils.d.ts +0 -29
  145. package/dist/handler/utils/upload-handlers.d.ts +0 -76
  146. package/dist/metrics/index.d.ts +0 -2
  147. package/dist/metrics/no-op-metrics.d.ts +0 -15
  148. package/dist/metrics/opentelemetry-metrics.d.ts +0 -55
  149. package/dist/openapi/rest.d.ts +0 -7
  150. package/dist/openapi/shared.d.ts +0 -13
  151. package/dist/openapi/transform.d.ts +0 -3
  152. package/dist/openapi/tus.d.ts +0 -7
  153. package/dist/openapi/xhr.d.ts +0 -7
  154. package/dist/packem_shared/AwsLightFile-tTneXZgG.js +0 -11
  155. package/dist/packem_shared/AwsLightMetaStorage-BWSOtVaN.js +0 -4
  156. package/dist/packem_shared/AwsLightStorage-Cwkkc-z3.js +0 -133
  157. package/dist/packem_shared/AzureFile-CesgFzps.js +0 -8
  158. package/dist/packem_shared/AzureSMetaStorage-CFs-OYJT.js +0 -88
  159. package/dist/packem_shared/AzureStorage-9MoV2W8q.js +0 -357
  160. package/dist/packem_shared/BaseTransformer-C2gLib6v.js +0 -82
  161. package/dist/packem_shared/DiskStorage-CJtTzMQ3.js +0 -12
  162. package/dist/packem_shared/DiskStorageWithChecksum-BgrG8pvC.js +0 -238
  163. package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
  164. package/dist/packem_shared/File-Bb3P23dr.js +0 -69
  165. package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
  166. package/dist/packem_shared/GCSFile-BIEunhAN.js +0 -8
  167. package/dist/packem_shared/GCSMetaStorage-sYiSjLUx.js +0 -7
  168. package/dist/packem_shared/GCStorage-DPl1_DAm.js +0 -406
  169. package/dist/packem_shared/LocalMetaStorage-CZHhKkMd.js +0 -7
  170. package/dist/packem_shared/MediaTransformer-D6658DL1.js +0 -1197
  171. package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
  172. package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
  173. package/dist/packem_shared/Multipart-CNFK_Okz.js +0 -163
  174. package/dist/packem_shared/Multipart-CtUL7BQw.js +0 -128
  175. package/dist/packem_shared/NetlifyBlobFile-CXzyjqrD.js +0 -14
  176. package/dist/packem_shared/NetlifyBlobMetaStorage-DxZ5aDvD.js +0 -9
  177. package/dist/packem_shared/NetlifyBlobStorage-C6AX-X0P.js +0 -376
  178. package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
  179. package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
  180. package/dist/packem_shared/Rest-CAOAEkOj.js +0 -267
  181. package/dist/packem_shared/Rest-DNuLwBrK.js +0 -228
  182. package/dist/packem_shared/S3File-DZiyk9Qt.js +0 -11
  183. package/dist/packem_shared/S3MetaStorage-Dz9aDabA.js +0 -76
  184. package/dist/packem_shared/S3Storage-CgheE2yH.js +0 -316
  185. package/dist/packem_shared/TUS_RESUMABLE-GJzZ9R-f.js +0 -434
  186. package/dist/packem_shared/Tus-B8PmlMgR.js +0 -200
  187. package/dist/packem_shared/Tus-C4F1aYOl.js +0 -195
  188. package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
  189. package/dist/packem_shared/VercelBlobFile-BCg4aTEq.js +0 -18
  190. package/dist/packem_shared/VercelBlobMetaStorage-Bd9F-VFm.js +0 -9
  191. package/dist/packem_shared/VercelBlobStorage-BbuEYhOz.js +0 -261
  192. package/dist/packem_shared/_commonjsHelpers-B85MJLTf.js +0 -5
  193. package/dist/packem_shared/aws-light-meta-storage-DKJBgbR6.js +0 -446
  194. package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
  195. package/dist/packem_shared/base-handler-core-BKuf4YLT.js +0 -303
  196. package/dist/packem_shared/base-handler-fetch-Cr0hLiqg.js +0 -291
  197. package/dist/packem_shared/base-handler-node-gk5aN9Cx.js +0 -730
  198. package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
  199. package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
  200. package/dist/packem_shared/defaultCloudStorageFileNameValidation-oVDgf-Sw.js +0 -11
  201. package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
  202. package/dist/packem_shared/disk-storage-DkDoHnKB.js +0 -810
  203. package/dist/packem_shared/gcs-meta-storage-etw4wuh5.js +0 -158
  204. package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
  205. package/dist/packem_shared/headers-DoS5nwM-.js +0 -3220
  206. package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
  207. package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
  208. package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
  209. package/dist/packem_shared/local-meta-storage-By-3SNBI.js +0 -649
  210. package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
  211. package/dist/packem_shared/multipart-base-B3i67SSX.js +0 -102
  212. package/dist/packem_shared/part-match-BMNqHDYD.js +0 -96
  213. package/dist/packem_shared/path-CR6YkPXX-7R1-9CMk.js +0 -161
  214. package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
  215. package/dist/packem_shared/rest-base-GRCcnan7.js +0 -457
  216. package/dist/packem_shared/restOpenApiSpec-CwcHHY2C.js +0 -800
  217. package/dist/packem_shared/s3-base-storage-xw6NJFX7.js +0 -510
  218. package/dist/packem_shared/sharedGet-Cpo7QUyu.js +0 -1019
  219. package/dist/packem_shared/storage-BwdYUHs3.js +0 -864
  220. package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
  221. package/dist/packem_shared/transformOpenApiSpec-DWM5WtnN.js +0 -975
  222. package/dist/packem_shared/tusOpenApiSpec-6ohiToBy.js +0 -740
  223. package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
  224. package/dist/packem_shared/validator-BeX_lJet.js +0 -78
  225. package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
  226. package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
  227. package/dist/packem_shared/xhrOpenApiSpec-DS17brnx.js +0 -264
  228. package/dist/storage/aws/clients/backblaze.d.ts +0 -12
  229. package/dist/storage/aws/clients/cloudflare.d.ts +0 -13
  230. package/dist/storage/aws/clients/digital-ocean.d.ts +0 -12
  231. package/dist/storage/aws/clients/minio.d.ts +0 -13
  232. package/dist/storage/aws/clients/tigris.d.ts +0 -12
  233. package/dist/storage/aws/clients/types.d.ts +0 -95
  234. package/dist/storage/aws/clients/wasabi.d.ts +0 -12
  235. package/dist/storage/aws/s3-base-storage.d.ts +0 -248
  236. package/dist/storage/aws/s3-client-adapter.d.ts +0 -110
  237. package/dist/storage/aws/s3-file.d.ts +0 -10
  238. package/dist/storage/aws/s3-meta-storage.d.ts +0 -15
  239. package/dist/storage/aws/s3-storage.d.ts +0 -70
  240. package/dist/storage/aws/types.d.ts +0 -119
  241. package/dist/storage/aws-light/aws-light-api-adapter.d.ts +0 -130
  242. package/dist/storage/aws-light/aws-light-file.d.ts +0 -10
  243. package/dist/storage/aws-light/aws-light-meta-storage.d.ts +0 -19
  244. package/dist/storage/aws-light/aws-light-storage.d.ts +0 -65
  245. package/dist/storage/aws-light/types.d.ts +0 -37
  246. package/dist/storage/azure/azure-file.d.ts +0 -6
  247. package/dist/storage/azure/azure-meta-storage.d.ts +0 -15
  248. package/dist/storage/azure/azure-storage.d.ts +0 -69
  249. package/dist/storage/azure/types.d.ts +0 -62
  250. package/dist/storage/gcs/fetch-error.d.ts +0 -11
  251. package/dist/storage/gcs/gcs-config.d.ts +0 -2
  252. package/dist/storage/gcs/gcs-file.d.ts +0 -6
  253. package/dist/storage/gcs/gcs-meta-storage.d.ts +0 -27
  254. package/dist/storage/gcs/gcs-storage.d.ts +0 -91
  255. package/dist/storage/gcs/types.d.ts +0 -55
  256. package/dist/storage/gcs/utils.d.ts +0 -7
  257. package/dist/storage/local/disk-storage-with-checksum.d.ts +0 -15
  258. package/dist/storage/local/disk-storage.d.ts +0 -135
  259. package/dist/storage/local/local-meta-storage.d.ts +0 -32
  260. package/dist/storage/meta-storage.d.ts +0 -30
  261. package/dist/storage/netlify-blob/netlify-blob-file.d.ts +0 -12
  262. package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +0 -7
  263. package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
  264. package/dist/storage/netlify-blob/types.d.ts +0 -30
  265. package/dist/storage/storage.d.ts +0 -353
  266. package/dist/storage/types.d.ts +0 -221
  267. package/dist/storage/utils/file/file.d.ts +0 -25
  268. package/dist/storage/utils/file/get-file-status.d.ts +0 -9
  269. package/dist/storage/utils/file/has-content.d.ts +0 -9
  270. package/dist/storage/utils/file/index.d.ts +0 -10
  271. package/dist/storage/utils/file/is-expired.d.ts +0 -8
  272. package/dist/storage/utils/file/metadata.d.ts +0 -18
  273. package/dist/storage/utils/file/part-match.d.ts +0 -11
  274. package/dist/storage/utils/file/types.d.ts +0 -37
  275. package/dist/storage/utils/file/update-metadata.d.ts +0 -10
  276. package/dist/storage/utils/file/update-size.d.ts +0 -10
  277. package/dist/storage/vercel-blob/types.d.ts +0 -32
  278. package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
  279. package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -7
  280. package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +0 -76
  281. package/dist/transformer/base-transformer.d.ts +0 -63
  282. package/dist/transformer/media-transformer.d.ts +0 -332
  283. package/dist/transformer/types.d.ts +0 -652
  284. package/dist/transformer/utils.d.ts +0 -33
  285. package/dist/transformer/validation-error.d.ts +0 -23
  286. package/dist/utils/cache.d.ts +0 -32
  287. package/dist/utils/chunked-upload.d.ts +0 -65
  288. package/dist/utils/detect-file-type.d.ts +0 -28
  289. package/dist/utils/errors.d.ts +0 -74
  290. package/dist/utils/file-path-url-matcher.d.ts +0 -18
  291. package/dist/utils/headers.d.ts +0 -111
  292. package/dist/utils/http.d.ts +0 -92
  293. package/dist/utils/locker.d.ts +0 -26
  294. package/dist/utils/pipes/stream-checksum.d.ts +0 -47
  295. package/dist/utils/pipes/stream-length.d.ts +0 -22
  296. package/dist/utils/primitives/get-last-one.d.ts +0 -3
  297. package/dist/utils/primitives/is-record.d.ts +0 -2
  298. package/dist/utils/primitives/map-values.d.ts +0 -9
  299. package/dist/utils/primitives/pick.d.ts +0 -2
  300. package/dist/utils/primitives/to-milliseconds.d.ts +0 -12
  301. package/dist/utils/primitives/to-seconds.d.ts +0 -12
  302. package/dist/utils/range-checksum.d.ts +0 -33
  303. package/dist/utils/range-hasher.d.ts +0 -46
  304. package/dist/utils/retry.d.ts +0 -64
  305. package/dist/utils/types.d.ts +0 -108
  306. package/dist/utils/validation-error.d.ts +0 -22
  307. package/dist/utils/validator.d.ts +0 -36
@@ -0,0 +1,49 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { IncomingMessage } from 'node:http';
3
+ import { Readable } from 'node:stream';
4
+ import { PaginationResult } from '@visulima/pagination';
5
+ import { U as UploadFile, B as BaseStorage, f as UploadError, g as UploadEventType } from "./storage.d-BOMUJD96.js";
6
+ import { M as MediaTransformer } from "./media-transformer.d-LGdEjx6A.js";
7
+ type WebRequest = globalThis.Request;
8
+ type WebResponse = globalThis.Response;
9
+ interface BaseResponse {
10
+ headers: Record<string, number | string>;
11
+ statusCode: number;
12
+ }
13
+ interface StreamingResponse extends BaseResponse {
14
+ /** Total size of the stream (for Content-Length header) */
15
+ size?: number;
16
+ /** Stream of data to send */
17
+ stream: Readable;
18
+ }
19
+ interface RequestEvent {
20
+ request: Pick<IncomingMessage, "headers" | "method" | "url">;
21
+ }
22
+ type AsyncHandler<Request, Response> = (request: Request, response: Response) => Promise<void | ResponseFile<UploadFile> | ResponseList<UploadFile> | StreamingResponse>;
23
+ type Handlers = "delete" | "download" | "get" | "head" | "options" | "patch" | "post" | "put";
24
+ type MethodHandler<Request, Response> = { [h in Handlers]?: AsyncHandler<Request, Response> };
25
+ type UploadEvent<TFile extends UploadFile> = RequestEvent & TFile;
26
+ type UploadErrorEvent = RequestEvent & UploadError;
27
+ type ResponseFile<TFile extends UploadFile> = BaseResponse & TFile & {
28
+ /** Optional stream for streaming responses instead of content buffer */
29
+ stream?: Readable;
30
+ };
31
+ type ResponseList<TFile extends UploadFile> = BaseResponse & {
32
+ data: PaginationResult<TFile> | TFile[];
33
+ };
34
+ interface BaseHandler<TFile extends UploadFile> extends EventEmitter {
35
+ emit: ((event: "error", error: UploadErrorEvent) => boolean) & ((event: UploadEventType, payload: UploadEvent<TFile>) => boolean);
36
+ fetch: (request: WebRequest) => Promise<WebResponse>;
37
+ off: ((event: "error", listener: (error: UploadErrorEvent) => void) => this) & ((event: UploadEventType, listener: (payload: UploadEvent<TFile>) => void) => this);
38
+ on: ((event: "error", listener: (error: UploadErrorEvent) => void) => this) & ((event: UploadEventType, listener: (payload: UploadEvent<TFile>) => void) => this);
39
+ }
40
+ interface UploadOptions<TFile extends UploadFile> {
41
+ disableTerminationForFinishedUploads?: boolean;
42
+ /** Maximum file size for multipart parser (default: min(storage.maxUploadSize, 1GB)) */
43
+ maxFileSize?: number;
44
+ /** Maximum header size for multipart parser (default: 64KB) */
45
+ maxHeaderSize?: number;
46
+ mediaTransformer?: MediaTransformer;
47
+ storage: BaseStorage<TFile>;
48
+ }
49
+ export { AsyncHandler as A, BaseHandler as B, Handlers as H, MethodHandler as M, ResponseFile as R, UploadOptions as U, ResponseList as a, RequestEvent as b, UploadErrorEvent as c, UploadEvent as d };
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var a=(e,t)=>i(e,"name",{value:t,configurable:!0});var r=Object.defineProperty,u=a((e,t)=>r(e,"name",{value:t,configurable:!0}),"t");const o=u((e,t)=>(t<e.size&&(e.size=t),e),"updateSize");export{o as u};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var e=(r,t)=>p(r,"name",{value:t,configurable:!0});import{ErrorMap as d}from"./ERRORS-B9jkvKwx.js";var u=Object.defineProperty,y=e((r,t)=>u(r,"name",{value:t,configurable:!0}),"t");let V=class extends Error{static{e(this,"d")}static{y(this,"ValidationError")}code;statusCode;body;headers;name="ValidationError";constructor(t,a,i,s){const n=typeof i=="string"?i:i?.message||"Validation error";super(n),this.code=t,this.statusCode=a,this.body=i,this.headers=s}};var v=Object.defineProperty,o=e((r,t)=>v(r,"name",{value:t,configurable:!0}),"e");const E=o(r=>r&&r[0].toUpperCase()+r.slice(1),"capitalize"),b=o(r=>{if(!Array.isArray(r))return r;const[t,a,i]=r;return{body:a,headers:i,statusCode:t}},"toResponse");class x{static{e(this,"Validator")}constructor(t="ValidationError"){this.prefix=t}prefix;static{o(this,"Validator")}validators={};add(t){Object.entries(t).forEach(([a,i])=>{const s=`${this.prefix}${E(a)}`;if(this.validators[s]={...this.validators[s],...i},typeof this.validators[s].isValid!="function")throw new TypeError('Validation config "isValid" is missing, or it is not a function!')})}async verify(t){for(const[a,i]of Object.entries(this.validators))if(!await i.isValid(t)){const s=i.response||(a in d?d[a]:d.UnknownError),n=b(s),{body:c,headers:l,message:f,statusCode:h}=n;throw new V(a,h,c||f,l)}}}const C=o(r=>r.name==="ValidationError","isValidationError");export{x as V,V as d,C as i};
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var a=(e,t)=>i(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,s=a((e,t)=>n(e,"name",{value:t,configurable:!0}),"o");const u=s(async(e,t=5e3)=>{if(e.isReady)return;const o=Date.now();for(;!e.isReady&&Date.now()-o<t;)await new Promise(r=>{setTimeout(()=>{r()},100)});if(!e.isReady)throw new Error("Storage initialization timeout")},"waitForStorage");export{u as waitForStorage};
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var n=(s,e)=>o(s,"name",{value:e,configurable:!0});var A=Object.defineProperty,S=n((s,e)=>A(s,"name",{value:e,configurable:!0}),"n");const E=S(s=>{const{accessKeyId:e,region:r,secretAccessKey:c}=s??{accessKeyId:process.env.AWS_ACCESS_KEY_ID||process.env.WASABI_ACCESS_KEY_ID||process.env.WASABI_ACCESS_KEY,region:process.env.AWS_REGION||process.env.WASABI_REGION,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY||process.env.WASABI_SECRET_ACCESS_KEY||process.env.WASABI_SECRET_KEY};if(!r||!e||!c)throw new Error("Missing required parameters for Wasabi client.");return{apiVersion:"2006-03-01",credentials:{accessKeyId:e,secretAccessKey:c},endpoint:`https://s3.${r}.wasabisys.com`,region:r}},"wasabi");export{E as default};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var o=(a,e)=>p(a,"name",{value:e,configurable:!0});import{createHash as d}from"node:crypto";import{createPaginationMetaSchemaObject as c,createPaginationSchemaObject as m}from"@visulima/pagination";import{sharedFileMetaSchemaObject as l,sharedErrorSchemaObject as f,sharedFileMetaExampleObject as h,sharedGetList as u,sharedGet as g,sharedGetMeta as E}from"./sharedGet-Ce7WGAsc.js";var y=Object.defineProperty,x=o((a,e)=>y(a,"name",{value:e,configurable:!0}),"o");const T=x((a,e,s)=>{const{supportedTransformerFormat:i,tags:t,transformer:n}={tags:["Multipart"],transformer:!1,...s},r=d("sha256").update(e).digest("base64");return{components:{examples:h,parameters:{UploadIDinPath:{description:"Upload ID",in:"path",name:"id",schema:{type:"string"}}},responses:{404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"}},schemas:{...m("FileMetaPagination",{$ref:"#/components/schemas/PaginationMeta"},"#/components/schemas/PaginationMeta"),...c("PaginationMeta"),...f,...l}},paths:{[`${e.replace(/\/$/,"")}/{id}/metadata`]:{get:E(`${r}MultipartGetFileMeta`,t)},[`${e.replace(/\/$/,"")}/{id}`]:{delete:{description:"Cancel upload",operationId:`${r}MultipartCancel`,parameters:[{$ref:"#/components/parameters/UploadIDinPath"}],responses:{204:{description:"No Content"}},summary:"Cancel upload",tags:t},get:g(`${r}TusGetFile`,t,n,i)},[e.trimEnd()]:{get:u(`${r}MultipartGetList`,t),post:{description:"Create upload",operationId:`${r}MultipartCreate`,requestBody:{content:{"multipart/form-data":{schema:{properties:{file:{description:"File to upload",format:"binary",type:"string"},metadata:{description:"JSON stringifies metadata",example:'{ "name": "video.mp4", "mimeType": "video/mp4", "size": 741, "lastModified": 1631750105530 }',type:"string"}},type:"object"}}},description:"Upload Metadata",required:!1},responses:{200:{description:"The file already exists, send a resume request",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"Resumable URI",schema:{example:`${a}/files?uploadType=Upload&upload_id=2b62dbec20048158af963572fbdf89c6`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},201:{description:"Upload accepted, send the file contents",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"Resumable URI",schema:{example:`${a}/files?uploadType=Upload&upload_id=2b62dbec20048158af963572fbdf89c6`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},400:{content:{"application/json":{example:{error:{code:"InvalidFileName",message:"Invalid file name",name:"ValidationError"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Bad Request"},413:{content:{"application/json":{example:{error:{code:"RequestEntityTooLarge",message:"Request entity too large",name:"ValidationError"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Request Entity Too Large"},415:{content:{"application/json":{example:{error:{code:"UnsupportedMediaType",message:"Unsupported media type",name:"ValidationError"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Unsupported Media Type"},423:{content:{"application/json":{example:{error:{code:"FileLocked",message:"File locked"}},schema:{$ref:"#/components/schemas/Error"}}},description:"File locked"},500:{content:{"application/json":{example:{error:{code:"GenericUploadError",message:"Generic Upload Error"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Internal Server Error"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Create upload",tags:t}}}}},"swaggerSpec");export{T as default};
@@ -1,6 +1,166 @@
1
- export { default as backblaze } from "./backblaze.d.ts";
2
- export { default as cloudflare } from "./cloudflare.d.ts";
3
- export { default as digitalOcean } from "./digital-ocean.d.ts";
4
- export { default as minio } from "./minio.d.ts";
5
- export { default as tigris } from "./tigris.d.ts";
6
- export { default as wasabi } from "./wasabi.d.ts";
1
+ import { S as S3ClientConfig } from "../../../packem_shared/S3Client.d-CZ62Jztg.js";
2
+ import '@aws-sdk/middleware-flexible-checksums';
3
+ import '@aws-sdk/middleware-host-header';
4
+ import '@aws-sdk/middleware-sdk-s3';
5
+ import '@aws-sdk/middleware-user-agent';
6
+ import '@smithy/types';
7
+ import '@smithy/config-resolver';
8
+ import '@smithy/eventstream-serde-config-resolver';
9
+ import '@smithy/middleware-endpoint';
10
+ import '@smithy/middleware-retry';
11
+ import '@smithy/protocol-http';
12
+ import '@smithy/smithy-client';
13
+ import 'node:stream';
14
+ import '@aws-sdk/core/httpAuthSchemes';
15
+ type CreateCloudflareClientParameters = {
16
+ /**
17
+ * Cloudflare R2 access key ID.
18
+ */
19
+ accessKeyId: string;
20
+ /**
21
+ * Cloudflare account ID.
22
+ */
23
+ accountId: string;
24
+ /**
25
+ * The jurisdiction where the data is stored.
26
+ *
27
+ * Only use this if you created your R2 bucket using a jurisdiction.
28
+ */
29
+ jurisdiction?: "eu" | "fedramp";
30
+ /**
31
+ * Cloudflare R2 secret access key.
32
+ */
33
+ secretAccessKey: string;
34
+ };
35
+ type CreateMinioClientParameters = {
36
+ /**
37
+ * Minio access key ID.
38
+ */
39
+ accessKeyId: string;
40
+ /**
41
+ * Minio endpoint.
42
+ */
43
+ endpoint: string;
44
+ /**
45
+ * Minio region.
46
+ */
47
+ region: string;
48
+ /**
49
+ * Minio secret access key.
50
+ */
51
+ secretAccessKey: string;
52
+ };
53
+ type CreateBackblazeClientParameters = {
54
+ /**
55
+ * Backblaze B2 application key.
56
+ */
57
+ applicationKey: string;
58
+ /**
59
+ * Backblaze B2 application key ID.
60
+ */
61
+ applicationKeyId: string;
62
+ /**
63
+ * Backblaze B2 region.
64
+ */
65
+ region: string;
66
+ };
67
+ type CreateWasabiClientParameters = {
68
+ /**
69
+ * Wasabi access key ID.
70
+ */
71
+ accessKeyId: string;
72
+ /**
73
+ * Wasabi region.
74
+ */
75
+ region: string;
76
+ /**
77
+ * Wasabi secret access key.
78
+ */
79
+ secretAccessKey: string;
80
+ };
81
+ type CreateDigitalOceanClientParameters = {
82
+ /**
83
+ * DigitalOcean Spaces key.
84
+ */
85
+ key: string;
86
+ /**
87
+ * DigitalOcean Spaces region.
88
+ */
89
+ region: string;
90
+ /**
91
+ * DigitalOcean Spaces secret.
92
+ */
93
+ secret: string;
94
+ };
95
+ type CreateTigrisClientParameters = {
96
+ /**
97
+ * Tigris access key ID.
98
+ */
99
+ accessKeyId: string;
100
+ /**
101
+ * Tigris endpoint.
102
+ * @default `https://t3.storage.dev`
103
+ */
104
+ endpoint?: string;
105
+ /**
106
+ * Tigris secret access key.
107
+ */
108
+ secretAccessKey: string;
109
+ };
110
+ /**
111
+ * Create a Backblaze B2 client, compatible with the S3 API.
112
+ *
113
+ * Optionally, you can omit the parameters and use the following environment variables:
114
+ * - `B2_REGION`
115
+ * - `B2_APP_KEY_ID`
116
+ * - `B2_APP_KEY`
117
+ */
118
+ declare const backblaze: (parameters?: CreateBackblazeClientParameters) => S3ClientConfig;
119
+ /**
120
+ * Create a Cloudflare R2 client, compatible with the S3 API.
121
+ *
122
+ * Optionally, you can omit the parameters and use the following environment variables:
123
+ * - `CLOUDFLARE_ACCOUNT_ID`
124
+ * - `AWS_ACCESS_KEY_ID`
125
+ * - `AWS_SECRET_ACCESS_KEY`
126
+ * - `CLOUDFLARE_JURISDICTION`
127
+ */
128
+ declare const cloudflare: (parameters?: CreateCloudflareClientParameters) => S3ClientConfig;
129
+ /**
130
+ * Create a DigitalOcean Spaces client, compatible with the S3 API.
131
+ *
132
+ * Optionally, you can omit the parameters and use the following environment variables:
133
+ * - `SPACES_REGION`
134
+ * - `SPACES_KEY`
135
+ * - `SPACES_SECRET`
136
+ */
137
+ declare const digitalOcean: (parameters?: CreateDigitalOceanClientParameters) => S3ClientConfig;
138
+ /**
139
+ * Create a Minio client, compatible with the S3 API.
140
+ *
141
+ * Optionally, you can omit the parameters and use the following environment variables:
142
+ * - `AWS_REGION`
143
+ * - `AWS_ACCESS_KEY_ID`
144
+ * - `AWS_SECRET_ACCESS_KEY`
145
+ * - `MINIO_ENDPOINT`
146
+ */
147
+ declare const minio: (parameters?: CreateMinioClientParameters) => S3ClientConfig;
148
+ /**
149
+ * Create a Tigris client, compatible with the S3 API.
150
+ *
151
+ * Optionally, you can omit the parameters and use the following environment variables:
152
+ * - `AWS_ACCESS_KEY_ID`
153
+ * - `AWS_SECRET_ACCESS_KEY`
154
+ * - `TIGRIS_ENDPOINT`
155
+ */
156
+ declare const tigris: (parameters?: CreateTigrisClientParameters) => S3ClientConfig;
157
+ /**
158
+ * Create a Wasabi client, compatible with the S3 API.
159
+ *
160
+ * Optionally, you can omit the parameters and use the following environment variables:
161
+ * - `WASABI_REGION`
162
+ * - `AWS_ACCESS_KEY_ID`
163
+ * - `AWS_SECRET_ACCESS_KEY`
164
+ */
165
+ declare const wasabi: (parameters?: CreateWasabiClientParameters) => S3ClientConfig;
166
+ export { backblaze, cloudflare, digitalOcean, minio, tigris, wasabi };
@@ -1,6 +1 @@
1
- export { backblaze } from '../../../packem_shared/backblaze-BlMnIcBC.js';
2
- export { cloudflare } from '../../../packem_shared/cloudflare-Bi1q8wXE.js';
3
- export { default as digitalOcean } from '../../../packem_shared/digitalOcean-CWQRJM3L.js';
4
- export { default as minio } from '../../../packem_shared/minio-C2YBZQOw.js';
5
- export { default as tigris } from '../../../packem_shared/tigris-Hac8TKnX.js';
6
- export { default as wasabi } from '../../../packem_shared/wasabi-DIyflHSd.js';
1
+ import{backblaze as r}from"../../../packem_shared/backblaze-DEflv87m.js";import{cloudflare as t}from"../../../packem_shared/cloudflare-DLAeQvgD.js";import{default as l}from"../../../packem_shared/digitalOcean-nhZUds87.js";import{default as m}from"../../../packem_shared/minio-BWwgGXeE.js";import{default as p}from"../../../packem_shared/tigris-DZoyrMNd.js";import{default as x}from"../../../packem_shared/wasabi-Dmce4x9s.js";export{r as backblaze,t as cloudflare,l as digitalOcean,m as minio,p as tigris,x as wasabi};
@@ -1,4 +1,320 @@
1
- export { default as S3File } from "./s3-file.d.ts";
2
- export { default as S3MetaStorage } from "./s3-meta-storage.d.ts";
3
- export { default as S3Storage } from "./s3-storage.d.ts";
4
- export type { AwsError, AWSErrorV2, S3MetaStorageOptions, S3StorageOptions } from "./types.d.ts";
1
+ import { F as File, m as MetaStorageOptions, k as BaseStorageOptions, L as LocalMetaStorageOptions, M as MetaStorage, H as HttpError, e as FileQuery, b as FileInit } from "../../packem_shared/storage.d-BOMUJD96.js";
2
+ import { Readable } from 'node:stream';
3
+ import { P as Part, S as S3ApiOperations, a as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-CczjSe98.js";
4
+ import { S as S3ClientConfig, O as ObjectCannedACL, a as S3Client } from "../../packem_shared/S3Client.d-CZ62Jztg.js";
5
+ import { ResponseMetadata } from '@smithy/types';
6
+ import 'node:crypto';
7
+ import 'node:http';
8
+ import 'lru-cache';
9
+ import '@aws-sdk/middleware-flexible-checksums';
10
+ import '@aws-sdk/middleware-host-header';
11
+ import '@aws-sdk/middleware-sdk-s3';
12
+ import '@aws-sdk/middleware-user-agent';
13
+ import '@smithy/config-resolver';
14
+ import '@smithy/eventstream-serde-config-resolver';
15
+ import '@smithy/middleware-endpoint';
16
+ import '@smithy/middleware-retry';
17
+ import '@smithy/protocol-http';
18
+ import '@smithy/smithy-client';
19
+ import '@aws-sdk/core/httpAuthSchemes';
20
+ declare class S3File extends File {
21
+ Parts?: Part[];
22
+ UploadId?: string;
23
+ uri?: string;
24
+ partsUrls?: string[];
25
+ partSize?: number;
26
+ }
27
+ type S3MetaStorageOptions = MetaStorageOptions & S3ClientConfig & {
28
+ bucket?: string;
29
+ keyFile?: string;
30
+ };
31
+ type S3StorageOptions = BaseStorageOptions & S3ClientConfig & {
32
+ /**
33
+ * Specifying access rules for uploaded files.
34
+ */
35
+ acl?: ObjectCannedACL;
36
+ /**
37
+ * S3 bucket name.
38
+ * @default 'node-Upload'
39
+ */
40
+ bucket?: string;
41
+ /**
42
+ * Force compatible client upload directly to S3 storage
43
+ */
44
+ clientDirectUpload?: boolean;
45
+ /**
46
+ * @deprecated Use standard auth providers
47
+ */
48
+ keyFile?: string;
49
+ /**
50
+ * Configure metafiles storage
51
+ * @example
52
+ * Using local metafiles
53
+ * ```ts
54
+ * const storage = new S3Storage({
55
+ * bucket: 'upload',
56
+ * region: 'eu-west-3',
57
+ * metaStorageConfig: { directory: '/tmp/upload-metafiles' }
58
+ * })
59
+ * ```
60
+ * Using a separate bucket for metafiles
61
+ * ```ts
62
+ * const storage = new S3Storage({
63
+ * bucket: 'upload',
64
+ * region: 'eu-west-3',
65
+ * metaStorageConfig: { bucket: 'upload-metafiles' }
66
+ * })
67
+ * ```
68
+ */
69
+ metaStorageConfig?: LocalMetaStorageOptions | S3MetaStorageOptions;
70
+ /**
71
+ * The parts size that the client should use for presigned multipart unloading.
72
+ * @default '16MB'
73
+ */
74
+ partSize?: number | string;
75
+ };
76
+ /**
77
+ * SDK V3
78
+ * A structure containing information about a service or networking error.
79
+ */
80
+ interface AwsError extends Error {
81
+ $fault?: "client" | "server";
82
+ $metadata: ResponseMetadata;
83
+ $service?: string;
84
+ Code?: string;
85
+ Type?: string;
86
+ }
87
+ /**
88
+ * SDK V2
89
+ * A structure containing information about a service or networking error.
90
+ */
91
+ interface AWSErrorV2 extends Error {
92
+ /**
93
+ * CloudFront request ID associated with the response.
94
+ */
95
+ cfId: string;
96
+ /**
97
+ * A unique short code representing the error that was emitted.
98
+ */
99
+ code: string;
100
+ /**
101
+ * Second request ID associated with the response from S3.
102
+ */
103
+ extendedRequestId: string;
104
+ /**
105
+ * Set when a networking error occurs to easily identify the endpoint of the request.
106
+ */
107
+ hostname: string;
108
+ /**
109
+ * A longer human readable error message.
110
+ */
111
+ message: string;
112
+ /**
113
+ * Set when a networking error occurs to easily identify the region of the request.
114
+ */
115
+ region: string;
116
+ /**
117
+ * The unique request ID associated with the response.
118
+ */
119
+ requestId: string;
120
+ /**
121
+ * Whether the error message is retryable.
122
+ */
123
+ retryable: boolean;
124
+ /**
125
+ * Amount of time (in seconds) that the request waited before being resent.
126
+ */
127
+ retryDelay: number;
128
+ /**
129
+ * In the case of a request that reached the service, this value contains the response status code.
130
+ */
131
+ statusCode: number;
132
+ /**
133
+ * The date time object when the error occurred.
134
+ */
135
+ time: Date;
136
+ }
137
+ declare class S3MetaStorage<T extends File = File> extends MetaStorage<T> {
138
+ config: S3MetaStorageOptions;
139
+ private readonly bucket;
140
+ private readonly client;
141
+ constructor(config: S3MetaStorageOptions);
142
+ override get(id: string): Promise<T>;
143
+ override touch(id: string, file: T): Promise<T>;
144
+ override delete(id: string): Promise<void>;
145
+ override save(id: string, file: T): Promise<T>;
146
+ private accessCheck;
147
+ }
148
+ type ReadableStream = globalThis.ReadableStream;
149
+ /**
150
+ * Adapter that wraps AWS SDK S3Client to implement S3ApiOperations interface.
151
+ */
152
+ declare class S3ClientAdapter implements S3ApiOperations {
153
+ private readonly client;
154
+ constructor(client: S3Client, _bucket: string);
155
+ createMultipartUpload(params: {
156
+ ACL?: string;
157
+ Bucket: string;
158
+ ContentType?: string;
159
+ Key: string;
160
+ Metadata?: Record<string, string>;
161
+ }): Promise<{
162
+ UploadId: string;
163
+ }>;
164
+ uploadPart(params: {
165
+ Body: Readable | ReadableStream | Uint8Array;
166
+ Bucket: string;
167
+ ContentLength?: number;
168
+ ContentMD5?: string;
169
+ Key: string;
170
+ PartNumber: number;
171
+ UploadId: string;
172
+ }): Promise<{
173
+ ETag: string;
174
+ }>;
175
+ completeMultipartUpload(params: {
176
+ Bucket: string;
177
+ Key: string;
178
+ Parts: {
179
+ ETag: string;
180
+ PartNumber: number;
181
+ }[];
182
+ UploadId: string;
183
+ }): Promise<{
184
+ ETag?: string;
185
+ Location: string;
186
+ }>;
187
+ abortMultipartUpload(params: {
188
+ Bucket: string;
189
+ Key: string;
190
+ UploadId: string;
191
+ }): Promise<void>;
192
+ listParts(params: {
193
+ Bucket: string;
194
+ Key: string;
195
+ UploadId: string;
196
+ }): Promise<{
197
+ Parts?: Part[];
198
+ }>;
199
+ getObject(params: {
200
+ Bucket: string;
201
+ Key: string;
202
+ }): Promise<{
203
+ Body?: ReadableStream | Readable;
204
+ ContentLength?: number;
205
+ ContentType?: string;
206
+ ETag?: string;
207
+ Expires?: Date;
208
+ LastModified?: Date;
209
+ Metadata?: Record<string, string>;
210
+ }>;
211
+ headObject(params: {
212
+ Bucket: string;
213
+ Key: string;
214
+ }): Promise<{
215
+ ContentLength?: number;
216
+ ContentType?: string;
217
+ ETag?: string;
218
+ Expires?: Date;
219
+ LastModified?: Date;
220
+ }>;
221
+ deleteObject(params: {
222
+ Bucket: string;
223
+ Key: string;
224
+ }): Promise<void>;
225
+ copyObject(params: {
226
+ Bucket: string;
227
+ CopySource: string;
228
+ Key: string;
229
+ StorageClass?: string;
230
+ }): Promise<void>;
231
+ listObjectsV2(params: {
232
+ Bucket: string;
233
+ ContinuationToken?: string;
234
+ MaxKeys?: number;
235
+ }): Promise<{
236
+ Contents?: {
237
+ Key?: string;
238
+ LastModified?: Date;
239
+ }[];
240
+ IsTruncated?: boolean;
241
+ NextContinuationToken?: string;
242
+ }>;
243
+ getPresignedUrl(params: {
244
+ Bucket: string;
245
+ expiresIn: number;
246
+ Key: string;
247
+ PartNumber: number;
248
+ UploadId: string;
249
+ }): Promise<string>;
250
+ checkBucketAccess(params: {
251
+ Bucket: string;
252
+ }): Promise<void>;
253
+ }
254
+ /**
255
+ * Amazon S3 storage implementation.
256
+ * @example
257
+ * ```ts
258
+ * const storage = new S3Storage({
259
+ * bucket: <YOUR_BUCKET>,
260
+ * endpoint: <YOUR_ENDPOINT>,
261
+ * region: <YOUR_REGION>,
262
+ * credentials: {
263
+ * accessKeyId: <YOUR_ACCESS_KEY_ID>,
264
+ * secretAccessKey: <YOUR_SECRET_ACCESS_KEY>
265
+ * },
266
+ * metaStorageConfig: { directory: '/tmp/upload-metafiles' }
267
+ * });
268
+ * ```
269
+ * @remarks
270
+ * ## Error Handling
271
+ * - S3 API errors are normalized with AWS-specific context
272
+ * - Errors include S3 error codes and metadata for debugging
273
+ * - Batch operations handle individual failures gracefully
274
+ *
275
+ * ## Retry Behavior
276
+ * - All S3 API calls are wrapped with configurable retry logic via `retryConfig` option
277
+ * - Default retryable status codes: 408 (Request Timeout), 429 (Too Many Requests),
278
+ * 500 (Internal Server Error), 502 (Bad Gateway), 503 (Service Unavailable), 504 (Gateway Timeout)
279
+ * - Retries server-side faults ($fault === "server") automatically
280
+ * - Custom `shouldRetry` function can be provided for advanced retry logic
281
+ * - Default retry configuration: maxRetries: 3, initialDelay: 1000ms, maxDelay: 30000ms, backoffMultiplier: 2 (exponential backoff)
282
+ * - Retry wrapper handles transient network errors and rate limiting
283
+ *
284
+ * ## Multipart Uploads
285
+ * - Large files are automatically split into multipart uploads
286
+ * - Maximum 10,000 parts per upload (S3 limitation)
287
+ * - Part size is configurable (default: 16MB, minimum: 5MB)
288
+ * - Failed multipart uploads are automatically aborted
289
+ *
290
+ * ## Supported Operations
291
+ * - ✅ create, write, delete, get, getStream, list, update, copy, move
292
+ * - ✅ Batch operations: deleteBatch, copyBatch, moveBatch (inherited from BaseStorage)
293
+ * - ✅ exists: Implemented (checks metadata and S3 object)
294
+ * - ❌ getUrl: Not implemented (presigned URLs available via buildPresigned for clientDirectUpload)
295
+ * - ❌ getUploadUrl: Not implemented (presigned URLs available via buildPresigned for clientDirectUpload)
296
+ */
297
+ declare class S3Storage extends S3BaseStorage {
298
+ static override readonly name: string;
299
+ private s3Api;
300
+ constructor(config: S3StorageOptions);
301
+ /**
302
+ * Normalizes AWS S3 errors with S3-specific context.
303
+ */
304
+ override normalizeError(error: AwsError): HttpError;
305
+ override update({
306
+ id
307
+ }: FileQuery, metadata: Partial<S3File>): Promise<S3File>;
308
+ override getStream({
309
+ id
310
+ }: FileQuery): Promise<{
311
+ headers?: Record<string, string>;
312
+ size?: number;
313
+ stream: Readable;
314
+ }>;
315
+ protected getS3Api(): S3ClientAdapter;
316
+ protected getFileClass(): new (config: FileInit) => S3File;
317
+ protected getAcl(): string | undefined;
318
+ protected accessCheck(_maxWaitTime?: number): Promise<void>;
319
+ }
320
+ export { type AWSErrorV2, type AwsError, S3File, S3MetaStorage, type S3MetaStorageOptions, S3Storage, type S3StorageOptions };
@@ -1,3 +1 @@
1
- export { default as S3File } from '../../packem_shared/S3File-DZiyk9Qt.js';
2
- export { default as S3MetaStorage } from '../../packem_shared/S3MetaStorage-Dz9aDabA.js';
3
- export { default as S3Storage } from '../../packem_shared/S3Storage-CgheE2yH.js';
1
+ import{default as t}from"../../packem_shared/S3File-Du6wP0Sz.js";import{default as r}from"../../packem_shared/S3MetaStorage-vcriiosn.js";import{default as S}from"../../packem_shared/S3Storage-Fx6-OSc-.js";export{t as S3File,r as S3MetaStorage,S as S3Storage};