@visulima/storage 1.0.0-alpha.3 → 1.0.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/CHANGELOG.md +385 -0
  2. package/LICENSE.md +213 -573
  3. package/README.md +83 -470
  4. package/dist/adapter/nuxt/module.d.ts +41 -34
  5. package/dist/adapter/nuxt/module.js +1 -93
  6. package/dist/adapter/nuxt/node_modules/.bin/nuxi +22 -0
  7. package/dist/adapter/nuxt/node_modules/.bin/nuxt +22 -0
  8. package/dist/adapter/nuxt/package.json +0 -6
  9. package/dist/ai/ai-sdk/index.d.ts +113 -0
  10. package/dist/ai/ai-sdk/index.js +1 -0
  11. package/dist/ai/claude/index.d.ts +177 -0
  12. package/dist/ai/claude/index.js +1 -0
  13. package/dist/ai/openai/index.d.ts +205 -0
  14. package/dist/ai/openai/index.js +1 -0
  15. package/dist/ai/tanstack/index.d.ts +115 -0
  16. package/dist/ai/tanstack/index.js +1 -0
  17. package/dist/handler/http/fetch/index.d.ts +303 -4
  18. package/dist/handler/http/fetch/index.js +1 -4
  19. package/dist/handler/http/hono/index.d.ts +73 -64
  20. package/dist/handler/http/hono/index.js +1 -65
  21. package/dist/handler/http/nextjs/index.d.ts +66 -58
  22. package/dist/handler/http/nextjs/index.js +1 -37
  23. package/dist/handler/http/node/index.d.ts +361 -4
  24. package/dist/handler/http/node/index.js +1 -4
  25. package/dist/handler/http/solid-start/index.d.ts +66 -57
  26. package/dist/handler/http/solid-start/index.js +1 -44
  27. package/dist/index.d.ts +58 -17
  28. package/dist/index.js +1 -13
  29. package/dist/openapi/index.d.ts +24 -5
  30. package/dist/openapi/index.js +1 -5
  31. package/dist/packem_shared/AwsLightFile-BSqjc_rD.js +1 -0
  32. package/dist/packem_shared/AwsLightMetaStorage-B-iQbToR.js +1 -0
  33. package/dist/packem_shared/AwsLightStorage-DbQrK9m7.js +1 -0
  34. package/dist/packem_shared/AzureFile-Dgj2Tef4.js +1 -0
  35. package/dist/packem_shared/AzureSMetaStorage-CR-lfQNQ.js +1 -0
  36. package/dist/packem_shared/AzureStorage-Cmr0nPDq.js +1 -0
  37. package/dist/packem_shared/BaseTransformer-Fpcuz4kj.js +1 -0
  38. package/dist/packem_shared/BoxFile-Be0S4N1L.js +1 -0
  39. package/dist/packem_shared/BoxMetaStorage-DLdXbZaV.js +1 -0
  40. package/dist/packem_shared/BoxStorage-DYzAYPIr.js +1 -0
  41. package/dist/packem_shared/BunS3File-D-SRiyrm.js +1 -0
  42. package/dist/packem_shared/BunS3MetaStorage-Bv_CTTMz.js +1 -0
  43. package/dist/packem_shared/BunS3Storage-BvaFeKeu.js +1 -0
  44. package/dist/packem_shared/BunnyFile-Dotl-lO9.js +1 -0
  45. package/dist/packem_shared/BunnyMetaStorage-DNMTSeoN.js +1 -0
  46. package/dist/packem_shared/BunnyStorage-DsQndiy5.js +1 -0
  47. package/dist/packem_shared/CloudinaryFile-B5-m33eS.js +1 -0
  48. package/dist/packem_shared/CloudinaryMetaStorage-DEBk5eQy.js +1 -0
  49. package/dist/packem_shared/CloudinaryStorage-DiK0T7N7.js +1 -0
  50. package/dist/packem_shared/DiskStorage-RvZNMWe7.js +1 -0
  51. package/dist/packem_shared/DiskStorageWithChecksum-eGOV3leX.js +1 -0
  52. package/dist/packem_shared/DropboxFile-BGVG2kXM.js +1 -0
  53. package/dist/packem_shared/DropboxMetaStorage-C6vj1QDA.js +1 -0
  54. package/dist/packem_shared/DropboxStorage-Dfd78aJL.js +1 -0
  55. package/dist/packem_shared/ERRORS-CyOuSMLY.js +1 -0
  56. package/dist/packem_shared/File-BhfUgJjs.js +1 -0
  57. package/dist/packem_shared/Files-CtggibJ-.js +1 -0
  58. package/dist/packem_shared/FirebaseFile-JEu3plMP.js +1 -0
  59. package/dist/packem_shared/FirebaseMetaStorage-CzyOim-J.js +1 -0
  60. package/dist/packem_shared/FirebaseStorage-C-FwZOYA.js +2 -0
  61. package/dist/packem_shared/FtpFile-B8jaICTB.js +1 -0
  62. package/dist/packem_shared/FtpMetaStorage-1Njy0DpU.js +1 -0
  63. package/dist/packem_shared/FtpStorage-DzaP89bG.js +1 -0
  64. package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
  65. package/dist/packem_shared/GCSFile-CDQ6IWAz.js +1 -0
  66. package/dist/packem_shared/GCSMetaStorage-DFIjFmn-.js +1 -0
  67. package/dist/packem_shared/GCStorage-1vA3xkFO.js +1 -0
  68. package/dist/packem_shared/GoogleDriveFile-D0aGfGbL.js +1 -0
  69. package/dist/packem_shared/GoogleDriveMetaStorage-WGuUZPyx.js +1 -0
  70. package/dist/packem_shared/GoogleDriveStorage-D_RaKV_j.js +1 -0
  71. package/dist/packem_shared/LocalMetaStorage-QMKL7McF.js +1 -0
  72. package/dist/packem_shared/MediaTransformer-D-1c9Q_k.js +1 -0
  73. package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
  74. package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
  75. package/dist/packem_shared/Multipart-C6Mw7V9W.js +1 -0
  76. package/dist/packem_shared/Multipart-DkH4QwNs.js +1 -0
  77. package/dist/packem_shared/NetlifyBlobFile-PMZLJ8AC.js +1 -0
  78. package/dist/packem_shared/NetlifyBlobMetaStorage-ClIFdTkT.js +1 -0
  79. package/dist/packem_shared/NetlifyBlobStorage-C-IkXF0_.js +1 -0
  80. package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
  81. package/dist/packem_shared/OneDriveFile-XbVVKIJh.js +1 -0
  82. package/dist/packem_shared/OneDriveMetaStorage-DS4f83X2.js +1 -0
  83. package/dist/packem_shared/OneDriveStorage-C7rqK2Wp.js +1 -0
  84. package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
  85. package/dist/packem_shared/PocketBaseFile-CkAiSBb0.js +1 -0
  86. package/dist/packem_shared/PocketBaseMetaStorage-B6utPncj.js +1 -0
  87. package/dist/packem_shared/PocketBaseStorage-Cdgr5w88.js +1 -0
  88. package/dist/packem_shared/Rest-DWrS4Z_j.js +1 -0
  89. package/dist/packem_shared/Rest-DY1neM_3.js +1 -0
  90. package/dist/packem_shared/S3File-BfmCOET4.js +1 -0
  91. package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
  92. package/dist/packem_shared/S3Storage-Dn3l4WkO.js +1 -0
  93. package/dist/packem_shared/SftpFile-CQCxZNVq.js +1 -0
  94. package/dist/packem_shared/SftpMetaStorage-DYqXwCdM.js +1 -0
  95. package/dist/packem_shared/SftpStorage-CBW6MBLV.js +1 -0
  96. package/dist/packem_shared/SharePointFile-BA6X9Sxr.js +1 -0
  97. package/dist/packem_shared/SharePointMetaStorage-DVM5-X6g.js +1 -0
  98. package/dist/packem_shared/SharePointStorage-r934t5HX.js +1 -0
  99. package/dist/packem_shared/SupabaseFile-DZ1iv9gM.js +1 -0
  100. package/dist/packem_shared/SupabaseMetaStorage-ivXoYVUu.js +1 -0
  101. package/dist/packem_shared/SupabaseStorage-DMRhLPNo.js +1 -0
  102. package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
  103. package/dist/packem_shared/Tus-BMd67Cnb.js +1 -0
  104. package/dist/packem_shared/Tus-d2hPK5nV.js +1 -0
  105. package/dist/packem_shared/UploadThingFile-BpG9mE8K.js +1 -0
  106. package/dist/packem_shared/UploadThingMetaStorage-BvKNzgm7.js +1 -0
  107. package/dist/packem_shared/UploadThingStorage-BjF_gRMY.js +1 -0
  108. package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
  109. package/dist/packem_shared/VercelBlobFile-Cni_1qwD.js +1 -0
  110. package/dist/packem_shared/VercelBlobMetaStorage-CwaqWucZ.js +1 -0
  111. package/dist/packem_shared/VercelBlobStorage-Dx2jywjl.js +1 -0
  112. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  113. package/dist/packem_shared/agentsListFiles-R-CnGKc4.js +1 -0
  114. package/dist/packem_shared/akamai-BYS9pP8S.js +1 -0
  115. package/dist/packem_shared/alibaba-BJQ6ijoK.js +1 -0
  116. package/dist/packem_shared/approval-BBeX3o4E.js +1 -0
  117. package/dist/packem_shared/approval.d-CMAYH9GF.d.ts +75 -0
  118. package/dist/packem_shared/aws-light-meta-storage-CstQBYXG.js +4 -0
  119. package/dist/packem_shared/azure-meta-storage-C4SrMtT2.js +1 -0
  120. package/dist/packem_shared/backblaze-CvdtCvJL.js +1 -0
  121. package/dist/packem_shared/base-handler-core-Cwd9uq_E.js +1 -0
  122. package/dist/packem_shared/base-handler-fetch-_BD4V1W2.js +1 -0
  123. package/dist/packem_shared/base-handler-node-BDNRnVIc.js +1 -0
  124. package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
  125. package/dist/packem_shared/claudeListFiles-DAezbKEi.js +1 -0
  126. package/dist/packem_shared/cloudflare-Bm_Pg6yx.js +1 -0
  127. package/dist/packem_shared/createResponsesFileTools-BCep-qdO.js +1 -0
  128. package/dist/packem_shared/defaultCloudStorageFileNameValidation-hWLdEgOD.js +1 -0
  129. package/dist/packem_shared/detect-file-type-5JhzC9RU.js +1 -0
  130. package/dist/packem_shared/digitalOcean-Lj1NfDzc.js +1 -0
  131. package/dist/packem_shared/disk-storage-Bmvawf-b.js +1 -0
  132. package/dist/packem_shared/disk-storage-with-checksum.d-Dm4agCey.d.ts +150 -0
  133. package/dist/packem_shared/executors-DG6hGtvm.js +1 -0
  134. package/dist/packem_shared/executors.d-Cut3Gstb.d.ts +65 -0
  135. package/dist/packem_shared/exoscale-O0HzxoDz.js +1 -0
  136. package/dist/packem_shared/filebase-D-urO4Ob.js +1 -0
  137. package/dist/packem_shared/gcs-meta-storage-Bwts-MUe.js +1 -0
  138. package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
  139. package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
  140. package/dist/packem_shared/hetzner-DDxE7Gy7.js +1 -0
  141. package/dist/packem_shared/ibmCos-Rx_yku4H.js +1 -0
  142. package/dist/packem_shared/idriveE2-BFhw0Vwy.js +1 -0
  143. package/dist/packem_shared/index-B4ETk0Lu.js +5 -0
  144. package/dist/packem_shared/index.d-DSZjPbvW.d.ts +230 -0
  145. package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
  146. package/dist/packem_shared/isRetryableError-BhizNeAz.js +1 -0
  147. package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
  148. package/dist/packem_shared/listFiles-B6VF05d-.js +1 -0
  149. package/dist/packem_shared/listFiles-BtP6VnUp.js +1 -0
  150. package/dist/packem_shared/local-meta-storage-Bi0mK6gD.js +1 -0
  151. package/dist/packem_shared/local-meta-storage.d-qZQI1JUe.d.ts +21 -0
  152. package/dist/packem_shared/media-transformer.d-lQ_RUjb5.d.ts +331 -0
  153. package/dist/packem_shared/minio-T_Z3iEy7.js +1 -0
  154. package/dist/packem_shared/multipart-base-BxckfvQf.js +1 -0
  155. package/dist/packem_shared/oauth-refresh-Dg2ybc6_.js +1 -0
  156. package/dist/packem_shared/oracleCloud-D5T9s4JV.js +1 -0
  157. package/dist/packem_shared/ovhCloud-DCwef2fe.js +1 -0
  158. package/dist/packem_shared/part-match-B5fLLmFw.js +1 -0
  159. package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
  160. package/dist/packem_shared/posix-dirname-CiHXPPnw.js +1 -0
  161. package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
  162. package/dist/packem_shared/rest-base-C-a7pXUc.js +1 -0
  163. package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
  164. package/dist/packem_shared/s3-base-storage-Ek1HinGR.js +1 -0
  165. package/dist/packem_shared/s3-base-storage.d-CDIOMTpp.d.ts +260 -0
  166. package/dist/packem_shared/scaleway-ygRXOss9.js +1 -0
  167. package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
  168. package/dist/packem_shared/storage-B-NDsI-o.js +1 -0
  169. package/dist/packem_shared/storage.d-BoJgdi1n.d.ts +1111 -0
  170. package/dist/packem_shared/storj-CVA9mM-7.js +1 -0
  171. package/dist/packem_shared/tencent-CAcAGaIW.js +1 -0
  172. package/dist/packem_shared/tigris-wmhjfsH2.js +1 -0
  173. package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
  174. package/dist/packem_shared/tus-base.d-C28C_AY9.d.ts +99 -0
  175. package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
  176. package/dist/packem_shared/types.d-C0MDnUYc.d.ts +104 -0
  177. package/dist/packem_shared/types.d-CPxJpoPH.d.ts +49 -0
  178. package/dist/packem_shared/types.d-DCPQvHDI.d.ts +720 -0
  179. package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
  180. package/dist/packem_shared/vultr-lK9L-sFk.js +1 -0
  181. package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
  182. package/dist/packem_shared/wasabi-JQzxdrFy.js +1 -0
  183. package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
  184. package/dist/packem_shared/yandex-ZwvE77v4.js +1 -0
  185. package/dist/storage/aws/clients/index.d.ts +612 -6
  186. package/dist/storage/aws/clients/index.js +1 -6
  187. package/dist/storage/aws/index.d.ts +321 -4
  188. package/dist/storage/aws/index.js +1 -3
  189. package/dist/storage/aws-light/index.d.ts +254 -4
  190. package/dist/storage/aws-light/index.js +1 -3
  191. package/dist/storage/azure/index.d.ts +217 -4
  192. package/dist/storage/azure/index.js +1 -3
  193. package/dist/storage/box/index.d.ts +189 -0
  194. package/dist/storage/box/index.js +1 -0
  195. package/dist/storage/bun-s3/index.d.ts +200 -0
  196. package/dist/storage/bun-s3/index.js +1 -0
  197. package/dist/storage/bunny/index.d.ts +119 -0
  198. package/dist/storage/bunny/index.js +1 -0
  199. package/dist/storage/cloudinary/index.d.ts +121 -0
  200. package/dist/storage/cloudinary/index.js +1 -0
  201. package/dist/storage/dropbox/index.d.ts +132 -0
  202. package/dist/storage/dropbox/index.js +1 -0
  203. package/dist/storage/firebase/index.d.ts +192 -0
  204. package/dist/storage/firebase/index.js +1 -0
  205. package/dist/storage/ftp/index.d.ts +85 -0
  206. package/dist/storage/ftp/index.js +1 -0
  207. package/dist/storage/gcs/index.d.ts +181 -5
  208. package/dist/storage/gcs/index.js +1 -4
  209. package/dist/storage/google-drive/index.d.ts +148 -0
  210. package/dist/storage/google-drive/index.js +1 -0
  211. package/dist/storage/local/index.d.ts +7 -4
  212. package/dist/storage/local/index.js +1 -3
  213. package/dist/storage/netlify-blob/index.d.ts +147 -4
  214. package/dist/storage/netlify-blob/index.js +1 -3
  215. package/dist/storage/onedrive/index.d.ts +103 -0
  216. package/dist/storage/onedrive/index.js +1 -0
  217. package/dist/storage/pocketbase/index.d.ts +172 -0
  218. package/dist/storage/pocketbase/index.js +1 -0
  219. package/dist/storage/sftp/index.d.ts +86 -0
  220. package/dist/storage/sftp/index.js +1 -0
  221. package/dist/storage/sharepoint/index.d.ts +180 -0
  222. package/dist/storage/sharepoint/index.js +1 -0
  223. package/dist/storage/supabase/index.d.ts +115 -0
  224. package/dist/storage/supabase/index.js +1 -0
  225. package/dist/storage/uploadthing/index.d.ts +95 -0
  226. package/dist/storage/uploadthing/index.js +1 -0
  227. package/dist/storage/vercel-blob/index.d.ts +189 -4
  228. package/dist/storage/vercel-blob/index.js +1 -3
  229. package/dist/transformer/audio-transformer.d.ts +127 -125
  230. package/dist/transformer/audio-transformer.js +1 -278
  231. package/dist/transformer/image-transformer.d.ts +573 -568
  232. package/dist/transformer/image-transformer.js +1 -1100
  233. package/dist/transformer/index.d.ts +62 -5
  234. package/dist/transformer/index.js +1 -4
  235. package/dist/transformer/video-transformer.d.ts +144 -142
  236. package/dist/transformer/video-transformer.js +1 -310
  237. package/package.json +195 -47
  238. package/dist/handler/base/base-handler-core.d.ts +0 -91
  239. package/dist/handler/base/base-handler-fetch.d.ts +0 -76
  240. package/dist/handler/base/base-handler-node.d.ts +0 -137
  241. package/dist/handler/multipart/multipart-base.d.ts +0 -84
  242. package/dist/handler/multipart/multipart-fetch.d.ts +0 -64
  243. package/dist/handler/multipart/multipart.d.ts +0 -49
  244. package/dist/handler/rest/rest-base.d.ts +0 -106
  245. package/dist/handler/rest/rest-fetch.d.ts +0 -88
  246. package/dist/handler/rest/rest.d.ts +0 -93
  247. package/dist/handler/tus/tus-base.d.ts +0 -152
  248. package/dist/handler/tus/tus-fetch.d.ts +0 -72
  249. package/dist/handler/tus/tus.d.ts +0 -78
  250. package/dist/handler/types.d.ts +0 -53
  251. package/dist/handler/utils/request-parser.d.ts +0 -72
  252. package/dist/handler/utils/response-builder.d.ts +0 -83
  253. package/dist/handler/utils/storage-utils.d.ts +0 -10
  254. package/dist/handler/utils/stream-utils.d.ts +0 -29
  255. package/dist/handler/utils/upload-handlers.d.ts +0 -76
  256. package/dist/metrics/index.d.ts +0 -2
  257. package/dist/metrics/no-op-metrics.d.ts +0 -15
  258. package/dist/metrics/opentelemetry-metrics.d.ts +0 -55
  259. package/dist/openapi/rest.d.ts +0 -7
  260. package/dist/openapi/shared.d.ts +0 -13
  261. package/dist/openapi/transform.d.ts +0 -3
  262. package/dist/openapi/tus.d.ts +0 -7
  263. package/dist/openapi/xhr.d.ts +0 -7
  264. package/dist/packem_shared/AwsLightFile-tTneXZgG.js +0 -11
  265. package/dist/packem_shared/AwsLightMetaStorage-BWSOtVaN.js +0 -4
  266. package/dist/packem_shared/AwsLightStorage-Blv-GP4v.js +0 -133
  267. package/dist/packem_shared/AzureFile-CesgFzps.js +0 -8
  268. package/dist/packem_shared/AzureSMetaStorage-CFs-OYJT.js +0 -88
  269. package/dist/packem_shared/AzureStorage-B0v048hG.js +0 -357
  270. package/dist/packem_shared/BaseTransformer-C2gLib6v.js +0 -82
  271. package/dist/packem_shared/DiskStorage-BlltBst6.js +0 -12
  272. package/dist/packem_shared/DiskStorageWithChecksum-BJTmMklc.js +0 -238
  273. package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
  274. package/dist/packem_shared/File-Bb3P23dr.js +0 -69
  275. package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
  276. package/dist/packem_shared/GCSFile-BIEunhAN.js +0 -8
  277. package/dist/packem_shared/GCSMetaStorage-BMFEdzJ7.js +0 -7
  278. package/dist/packem_shared/GCStorage-DnhiwaS9.js +0 -406
  279. package/dist/packem_shared/LocalMetaStorage-CZHhKkMd.js +0 -7
  280. package/dist/packem_shared/MediaTransformer-D6658DL1.js +0 -1197
  281. package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
  282. package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
  283. package/dist/packem_shared/Multipart-CNFK_Okz.js +0 -163
  284. package/dist/packem_shared/Multipart-CtUL7BQw.js +0 -128
  285. package/dist/packem_shared/NetlifyBlobFile-CXzyjqrD.js +0 -14
  286. package/dist/packem_shared/NetlifyBlobMetaStorage-DxZ5aDvD.js +0 -9
  287. package/dist/packem_shared/NetlifyBlobStorage-CLPtjHqd.js +0 -376
  288. package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
  289. package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
  290. package/dist/packem_shared/Rest-CAOAEkOj.js +0 -267
  291. package/dist/packem_shared/Rest-DNuLwBrK.js +0 -228
  292. package/dist/packem_shared/S3File-DZiyk9Qt.js +0 -11
  293. package/dist/packem_shared/S3MetaStorage-Dz9aDabA.js +0 -76
  294. package/dist/packem_shared/S3Storage-DHmTk-hU.js +0 -316
  295. package/dist/packem_shared/TUS_RESUMABLE-GJzZ9R-f.js +0 -434
  296. package/dist/packem_shared/Tus-B8PmlMgR.js +0 -200
  297. package/dist/packem_shared/Tus-C4F1aYOl.js +0 -195
  298. package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
  299. package/dist/packem_shared/VercelBlobFile-BCg4aTEq.js +0 -18
  300. package/dist/packem_shared/VercelBlobMetaStorage-Bd9F-VFm.js +0 -9
  301. package/dist/packem_shared/VercelBlobStorage-DD9LMOS6.js +0 -261
  302. package/dist/packem_shared/_commonjsHelpers-B85MJLTf.js +0 -5
  303. package/dist/packem_shared/aws-light-meta-storage-DKJBgbR6.js +0 -446
  304. package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
  305. package/dist/packem_shared/base-handler-core-BKuf4YLT.js +0 -303
  306. package/dist/packem_shared/base-handler-fetch-Cr0hLiqg.js +0 -291
  307. package/dist/packem_shared/base-handler-node-gk5aN9Cx.js +0 -730
  308. package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
  309. package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
  310. package/dist/packem_shared/defaultCloudStorageFileNameValidation-DUuacjWv.js +0 -11
  311. package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
  312. package/dist/packem_shared/disk-storage-Bh2wy3YW.js +0 -810
  313. package/dist/packem_shared/gcs-meta-storage-0tgMNnPO.js +0 -158
  314. package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
  315. package/dist/packem_shared/headers-DoS5nwM-.js +0 -3220
  316. package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
  317. package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
  318. package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
  319. package/dist/packem_shared/local-meta-storage-By-3SNBI.js +0 -649
  320. package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
  321. package/dist/packem_shared/multipart-base-B3i67SSX.js +0 -102
  322. package/dist/packem_shared/part-match-BMNqHDYD.js +0 -96
  323. package/dist/packem_shared/path-CR6YkPXX-7R1-9CMk.js +0 -161
  324. package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
  325. package/dist/packem_shared/rest-base-GRCcnan7.js +0 -457
  326. package/dist/packem_shared/restOpenApiSpec-CwcHHY2C.js +0 -800
  327. package/dist/packem_shared/s3-base-storage-C1DIHTYY.js +0 -510
  328. package/dist/packem_shared/sharedGet-Cpo7QUyu.js +0 -1019
  329. package/dist/packem_shared/storage-C6NSXb8h.js +0 -1175
  330. package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
  331. package/dist/packem_shared/transformOpenApiSpec-DWM5WtnN.js +0 -975
  332. package/dist/packem_shared/tusOpenApiSpec-6ohiToBy.js +0 -740
  333. package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
  334. package/dist/packem_shared/validator-BeX_lJet.js +0 -78
  335. package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
  336. package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
  337. package/dist/packem_shared/xhrOpenApiSpec-DS17brnx.js +0 -264
  338. package/dist/storage/aws/clients/backblaze.d.ts +0 -12
  339. package/dist/storage/aws/clients/cloudflare.d.ts +0 -13
  340. package/dist/storage/aws/clients/digital-ocean.d.ts +0 -12
  341. package/dist/storage/aws/clients/minio.d.ts +0 -13
  342. package/dist/storage/aws/clients/tigris.d.ts +0 -12
  343. package/dist/storage/aws/clients/types.d.ts +0 -95
  344. package/dist/storage/aws/clients/wasabi.d.ts +0 -12
  345. package/dist/storage/aws/s3-base-storage.d.ts +0 -248
  346. package/dist/storage/aws/s3-client-adapter.d.ts +0 -110
  347. package/dist/storage/aws/s3-file.d.ts +0 -10
  348. package/dist/storage/aws/s3-meta-storage.d.ts +0 -15
  349. package/dist/storage/aws/s3-storage.d.ts +0 -70
  350. package/dist/storage/aws/types.d.ts +0 -119
  351. package/dist/storage/aws-light/aws-light-api-adapter.d.ts +0 -130
  352. package/dist/storage/aws-light/aws-light-file.d.ts +0 -10
  353. package/dist/storage/aws-light/aws-light-meta-storage.d.ts +0 -19
  354. package/dist/storage/aws-light/aws-light-storage.d.ts +0 -65
  355. package/dist/storage/aws-light/types.d.ts +0 -37
  356. package/dist/storage/azure/azure-file.d.ts +0 -6
  357. package/dist/storage/azure/azure-meta-storage.d.ts +0 -15
  358. package/dist/storage/azure/azure-storage.d.ts +0 -69
  359. package/dist/storage/azure/types.d.ts +0 -62
  360. package/dist/storage/gcs/fetch-error.d.ts +0 -11
  361. package/dist/storage/gcs/gcs-config.d.ts +0 -2
  362. package/dist/storage/gcs/gcs-file.d.ts +0 -6
  363. package/dist/storage/gcs/gcs-meta-storage.d.ts +0 -27
  364. package/dist/storage/gcs/gcs-storage.d.ts +0 -91
  365. package/dist/storage/gcs/types.d.ts +0 -55
  366. package/dist/storage/gcs/utils.d.ts +0 -7
  367. package/dist/storage/local/disk-storage-with-checksum.d.ts +0 -15
  368. package/dist/storage/local/disk-storage.d.ts +0 -135
  369. package/dist/storage/local/local-meta-storage.d.ts +0 -32
  370. package/dist/storage/meta-storage.d.ts +0 -30
  371. package/dist/storage/netlify-blob/netlify-blob-file.d.ts +0 -12
  372. package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +0 -7
  373. package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
  374. package/dist/storage/netlify-blob/types.d.ts +0 -30
  375. package/dist/storage/storage.d.ts +0 -353
  376. package/dist/storage/types.d.ts +0 -221
  377. package/dist/storage/utils/file/file.d.ts +0 -25
  378. package/dist/storage/utils/file/get-file-status.d.ts +0 -9
  379. package/dist/storage/utils/file/has-content.d.ts +0 -9
  380. package/dist/storage/utils/file/index.d.ts +0 -10
  381. package/dist/storage/utils/file/is-expired.d.ts +0 -8
  382. package/dist/storage/utils/file/metadata.d.ts +0 -18
  383. package/dist/storage/utils/file/part-match.d.ts +0 -11
  384. package/dist/storage/utils/file/types.d.ts +0 -37
  385. package/dist/storage/utils/file/update-metadata.d.ts +0 -10
  386. package/dist/storage/utils/file/update-size.d.ts +0 -10
  387. package/dist/storage/vercel-blob/types.d.ts +0 -32
  388. package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
  389. package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -7
  390. package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +0 -76
  391. package/dist/transformer/base-transformer.d.ts +0 -63
  392. package/dist/transformer/media-transformer.d.ts +0 -332
  393. package/dist/transformer/types.d.ts +0 -652
  394. package/dist/transformer/utils.d.ts +0 -33
  395. package/dist/transformer/validation-error.d.ts +0 -23
  396. package/dist/utils/cache.d.ts +0 -32
  397. package/dist/utils/chunked-upload.d.ts +0 -65
  398. package/dist/utils/detect-file-type.d.ts +0 -28
  399. package/dist/utils/errors.d.ts +0 -74
  400. package/dist/utils/file-path-url-matcher.d.ts +0 -18
  401. package/dist/utils/headers.d.ts +0 -111
  402. package/dist/utils/http.d.ts +0 -92
  403. package/dist/utils/locker.d.ts +0 -26
  404. package/dist/utils/pipes/stream-checksum.d.ts +0 -47
  405. package/dist/utils/pipes/stream-length.d.ts +0 -22
  406. package/dist/utils/primitives/get-last-one.d.ts +0 -3
  407. package/dist/utils/primitives/is-record.d.ts +0 -2
  408. package/dist/utils/primitives/map-values.d.ts +0 -9
  409. package/dist/utils/primitives/pick.d.ts +0 -2
  410. package/dist/utils/primitives/to-milliseconds.d.ts +0 -12
  411. package/dist/utils/primitives/to-seconds.d.ts +0 -12
  412. package/dist/utils/range-checksum.d.ts +0 -33
  413. package/dist/utils/range-hasher.d.ts +0 -46
  414. package/dist/utils/retry.d.ts +0 -64
  415. package/dist/utils/types.d.ts +0 -108
  416. package/dist/utils/validation-error.d.ts +0 -22
  417. package/dist/utils/validator.d.ts +0 -36
@@ -0,0 +1,230 @@
1
+ import { O as OperationOptions, B as BaseStorage } from "./storage.d-BoJgdi1n.js";
2
+ /**
3
+ * Web-standard and Node-native body types accepted by {@link Files.upload}.
4
+ */
5
+ type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | NodeJS.ReadableStream | ReadableStream<Uint8Array> | string;
6
+ interface UploadOptions {
7
+ contentType?: string;
8
+ metadata?: Record<string, unknown>;
9
+ /**
10
+ * Explicit byte length. Required for {@link NodeJS.ReadableStream} and Web `ReadableStream`
11
+ * inputs because their length is not derivable from the value itself; ignored otherwise.
12
+ */
13
+ size?: number;
14
+ storageClass?: string;
15
+ }
16
+ interface SignedReadUrlOptions {
17
+ expiresIn?: number;
18
+ responseContentDisposition?: string;
19
+ responseContentType?: string;
20
+ }
21
+ interface SignedUploadUrlOptions {
22
+ contentLength?: number;
23
+ contentType?: string;
24
+ expiresIn?: number;
25
+ }
26
+ interface ListOptions {
27
+ limit?: number;
28
+ prefix?: string;
29
+ }
30
+ /**
31
+ * Provider-agnostic metadata-only view of an object.
32
+ */
33
+ interface FileObject {
34
+ contentType: string;
35
+ etag?: string;
36
+ key: string;
37
+ lastModified?: Date | number | string;
38
+ metadata?: Record<string, unknown>;
39
+ size?: number;
40
+ }
41
+ interface DownloadResult extends FileObject {
42
+ body: Buffer;
43
+ }
44
+ interface FilesOptions<TStorage extends BaseStorage = BaseStorage> {
45
+ adapter: TStorage;
46
+ /**
47
+ * Default {@link OperationOptions} (`signal`, `timeout`, `retries`) merged into every call.
48
+ * Per-call overrides win. The `signal` is combined with any per-call `signal` via
49
+ * `AbortSignal.any`, so either one aborts the operation.
50
+ */
51
+ defaults?: OperationOptions;
52
+ /**
53
+ * Namespace every key under this prefix. Reads, writes, copies, listings, URLs, and signed
54
+ * uploads all resolve keys as `${prefix}/${key}`; returned keys (including from `list()`) have
55
+ * the prefix stripped back off. Leading/trailing slashes are normalized so `"/users/"` and
56
+ * `"users"` behave identically.
57
+ *
58
+ * `list()` scopes results on a path boundary, so `prefix: "users"` never matches the sibling
59
+ * `users-archive/`.
60
+ */
61
+ prefix?: string;
62
+ }
63
+ /**
64
+ * One item in a bulk upload call.
65
+ */
66
+ interface BulkUploadItem extends UploadOptions {
67
+ body: FileBody;
68
+ key: string;
69
+ }
70
+ /**
71
+ * Per-call options shared by every bulk method (`upload`, `download`, `head`, `exists`, `delete`).
72
+ */
73
+ interface BulkOptions extends OperationOptions {
74
+ /**
75
+ * Maximum number of in-flight operations.
76
+ * @default 8
77
+ */
78
+ concurrency?: number;
79
+ /**
80
+ * When `true`, stop dispatching new operations as soon as one fails. The already-issued
81
+ * operations still complete. Defaults to `false`: every key is attempted and per-key failures
82
+ * are collected in `errors`.
83
+ * @default false
84
+ */
85
+ stopOnError?: boolean;
86
+ }
87
+ interface BulkError {
88
+ error: Error;
89
+ key: string;
90
+ }
91
+ interface BulkUploadResult {
92
+ errors?: BulkError[];
93
+ uploaded: FileObject[];
94
+ }
95
+ interface BulkDownloadResult {
96
+ downloaded: DownloadResult[];
97
+ errors?: BulkError[];
98
+ }
99
+ interface BulkHeadResult {
100
+ errors?: BulkError[];
101
+ files: FileObject[];
102
+ }
103
+ interface BulkExistsResult {
104
+ errors?: BulkError[];
105
+ existing: string[];
106
+ missing: string[];
107
+ }
108
+ interface BulkDeleteResult {
109
+ deleted: string[];
110
+ errors?: BulkError[];
111
+ }
112
+ /**
113
+ * Provider-agnostic facade over a {@link BaseStorage} instance.
114
+ *
115
+ * Provides a small, consistent surface (`upload`, `download`, `head`, `exists`, `delete`, `copy`,
116
+ * `list`, `url`, `signedUploadUrl`) and a `raw` escape hatch to the adapter's native client.
117
+ *
118
+ * Each operation accepts per-call `signal`, `timeout`, and `retries` via {@link OperationOptions};
119
+ * defaults set on the constructor are merged in (per-call wins). Single-key methods also accept an
120
+ * array of keys (or {@link BulkUploadItem}s for `upload`) to run a bounded-concurrency batch and
121
+ * return a structured `{ ..., errors? }` result instead of throwing on partial failure.
122
+ *
123
+ * When constructed with a `prefix`, every key is resolved relative to the prefix and the prefix is
124
+ * stripped back off the keys returned in results — application code works in its own namespace.
125
+ * @example
126
+ * ```ts
127
+ * import { Files, S3Storage } from "@visulima/storage";
128
+ *
129
+ * const files = new Files({
130
+ * adapter: new S3Storage({ bucket: "uploads", region: "us-east-1" }),
131
+ * prefix: "users",
132
+ * defaults: { timeout: 30_000 },
133
+ * });
134
+ *
135
+ * await files.upload("123/avatar.png", buffer, { contentType: "image/png" });
136
+ * const head = await files.head("123/avatar.png"); // reads users/123/avatar.png
137
+ * const url = await files.url("123/avatar.png", { expiresIn: 900 });
138
+ *
139
+ * const { uploaded, errors } = await files.upload([
140
+ * { key: "a.png", body: a, contentType: "image/png" },
141
+ * { key: "b.png", body: b },
142
+ * ], { concurrency: 4 });
143
+ * ```
144
+ */
145
+ declare class Files<TStorage extends BaseStorage = BaseStorage> {
146
+ readonly adapter: TStorage;
147
+ private readonly defaults;
148
+ private readonly prefix;
149
+ constructor(options: FilesOptions<TStorage>);
150
+ /**
151
+ * Escape hatch to the adapter's native client (S3Client, BlobServiceClient, ...).
152
+ * Typed via the `TStorage` parameter, so pinning the adapter type at construction yields a
153
+ * typed view of the native client. Returns `undefined` when the adapter has no native client
154
+ * (e.g. DiskStorage).
155
+ */
156
+ get raw(): TStorage["raw"];
157
+ /** Resolve a caller-supplied key into the underlying storage key. */
158
+ private resolveKey;
159
+ /**
160
+ * Strip the constructor prefix off a key returned by the adapter. Returns `null` when the key
161
+ * is outside the prefix or is the bare prefix itself (used to filter `list()` results on a path
162
+ * boundary and drop any synthetic directory entry the adapter may emit).
163
+ */
164
+ private stripPrefix;
165
+ private mergeOptions;
166
+ /**
167
+ * Upload a single object, or — when passed an array of {@link BulkUploadItem}s — bulk-upload
168
+ * many in one call with bounded concurrency.
169
+ */
170
+ upload(key: string, body: FileBody, options?: OperationOptions & UploadOptions): Promise<FileObject>;
171
+ upload(items: BulkUploadItem[], options?: BulkOptions): Promise<BulkUploadResult>;
172
+ private uploadOne;
173
+ private uploadMany;
174
+ /**
175
+ * Download a single object, or — when passed an array of keys — bulk-download many in one
176
+ * call with bounded concurrency.
177
+ */
178
+ download(key: string, options?: OperationOptions): Promise<DownloadResult>;
179
+ download(keys: string[], options?: BulkOptions): Promise<BulkDownloadResult>;
180
+ private downloadOne;
181
+ private downloadMany;
182
+ /**
183
+ * Fetch metadata for a single object, or — when passed an array of keys — bulk-head many in
184
+ * one call with bounded concurrency.
185
+ */
186
+ head(key: string, options?: OperationOptions): Promise<FileObject>;
187
+ head(keys: string[], options?: BulkOptions): Promise<BulkHeadResult>;
188
+ private headOne;
189
+ private headMany;
190
+ /**
191
+ * Resolves to `true`/`false` for a single key, or — when passed an array — splits the keys
192
+ * into `existing` and `missing` arrays. Hard errors (auth, transport) are reported in
193
+ * `errors`. Never throws for a missing object.
194
+ */
195
+ exists(key: string, options?: OperationOptions): Promise<boolean>;
196
+ exists(keys: string[], options?: BulkOptions): Promise<BulkExistsResult>;
197
+ private existsOne;
198
+ private existsMany;
199
+ /**
200
+ * Delete a single object (resolves to `void`, throws on failure), or — when passed an array
201
+ * of keys — delete many in one call. Adapters with a native bulk-delete primitive (S3's
202
+ * `DeleteObjects`, Supabase's `remove`, UploadThing's `deleteFiles`) use it via
203
+ * {@link BaseStorage.deleteBatch}; otherwise the keys are fanned out with bounded concurrency.
204
+ */
205
+ delete(key: string, options?: OperationOptions): Promise<void>;
206
+ delete(keys: string[], options?: BulkOptions): Promise<BulkDeleteResult>;
207
+ private deleteOne;
208
+ private deleteMany;
209
+ /**
210
+ * Copy `source` to `destination` (both resolved under any constructor prefix). Returns the
211
+ * destination object's metadata with the caller-facing (un-prefixed) key.
212
+ */
213
+ copy(source: string, destination: string, options?: OperationOptions & {
214
+ storageClass?: string;
215
+ }): Promise<FileObject>;
216
+ /**
217
+ * List objects in the bucket. Returned keys have any constructor prefix stripped off, and
218
+ * keys outside the prefix namespace (e.g. `users-archive/` when prefix is `users`) are filtered
219
+ * out. The optional `prefix` filter is interpreted *relative to the constructor prefix*.
220
+ *
221
+ * **Caveat with constructor prefix**: `limit` is applied by the underlying adapter *before*
222
+ * the path-boundary filter runs, so the returned array may contain fewer than `limit` items
223
+ * even when more in-namespace objects exist. Page through with adapter-specific APIs when you
224
+ * need an exact in-namespace count.
225
+ */
226
+ list(options?: ListOptions & OperationOptions): Promise<FileObject[]>;
227
+ url(key: string, options?: OperationOptions & SignedReadUrlOptions): Promise<string>;
228
+ signedUploadUrl(key: string, options?: OperationOptions & SignedUploadUrlOptions): Promise<string>;
229
+ }
230
+ export { BulkDeleteResult as B, DownloadResult as D, Files as F, ListOptions as L, SignedReadUrlOptions as S, UploadOptions as U, BulkDownloadResult as a, BulkError as b, BulkExistsResult as c, BulkHeadResult as d, BulkOptions as e, BulkUploadItem as f, BulkUploadResult as g, FileBody as h, FileObject as i, FilesOptions as j, SignedUploadUrlOptions as k };
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});var i=Object.defineProperty,n=t((e,r)=>i(e,"name",{value:r,configurable:!0}),"t");const p=n(e=>e.expiredAt?Date.now()>+new Date(e.expiredAt):!1,"isExpired");export{p as o};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var d=(e,t)=>m(e,"name",{value:t,configurable:!0});var b=Object.defineProperty,i=d((e,t)=>b(e,"name",{value:t,configurable:!0}),"u");const l={backoffMultiplier:2,calculateDelay:void 0,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:i(()=>!1,"shouldRetry")},p=i((e,t,r,o)=>{const a=Math.min(t*r**e,o);return Math.floor(Math.random()*a)},"calculateExponentialBackoff"),D=i(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),h=i((e,t=l.retryableStatusCodes)=>{if(e instanceof Error){const r=e.code,o=e.name;if(o==="AbortError"||r==="ABORT_ERR")return!1;if(r==="ECONNRESET"||r==="ETIMEDOUT"||r==="ENOTFOUND"||r==="ECONNREFUSED"||r==="EAI_AGAIN"||o==="NetworkError"||o==="TimeoutError")return!0;const a=e;if(a.$metadata){const u=a.$metadata.httpStatusCode;if(u&&t.includes(u)||a.$fault==="server")return!0}if(a.statusCode&&t.includes(a.statusCode))return!0;const{retryable:s}=a;return s===!0||typeof s=="string"&&s==="true"}return!1},"isRetryableError"),C=i(async(e,t={})=>{const{backoffMultiplier:r=l.backoffMultiplier,calculateDelay:o=l.calculateDelay,initialDelay:a=l.initialDelay,maxDelay:s=l.maxDelay,maxRetries:u=l.maxRetries,retryableStatusCodes:E=l.retryableStatusCodes,shouldRetry:R=l.shouldRetry}=t;let f;for(let n=0;n<=u;n+=1)try{return await e()}catch(c){if(f=c,n>=u)break;if(!(R(c)||h(c,E)))throw c;const y=o?o(n,c):p(n,a,r,s);y!==void 0&&y>0&&await D(y)}throw f},"retry"),N=i((e={})=>t=>C(t,e),"createRetryWrapper");export{N as createRetryWrapper,h as isRetryableError,C as retry};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import s from"mime";var m=Object.defineProperty,o=r((e,t)=>m(e,"name",{value:t,configurable:!0}),"i");const d=o((e,t)=>e?e.startsWith(`${t}/`):!1,"isValidMediaType"),l=o(e=>{if(e)return s.getExtension(e)||void 0},"getFormatFromContentType"),c=o((e,t,i)=>{const a=typeof e.size=="string"?Number.parseInt(e.size,10):e.size;if(i?.maxSize&&a>i.maxSize)throw new Error(`${t} size ${a} exceeds maximum allowed size ${i.maxSize}`);if(!d(e.contentType,t))throw new Error(`File is not ${t==="image"?"an":"a"} ${t}: ${e.contentType}`);const n=l(e.contentType);if(i?.supportedFormats&&n&&!i.supportedFormats.includes(n))throw new Error(`Unsupported ${t} format: ${n}`)},"validateMediaFile"),u=o(e=>e?!!s.getExtension(e):!1,"isKnownContentType");export{l as getFormatFromContentType,u as isKnownContentType,d as isValidMediaType,c as validateMediaFile};
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var n=(e,i)=>o(e,"name",{value:i,configurable:!0});import{toolDefinition as t}from"@tanstack/ai";import{T as l,e as p}from"./executors-DG6hGtvm.js";var d=Object.defineProperty,r=n((e,i)=>d(e,"name",{value:i,configurable:!0}),"i");const u=r(e=>t({description:l.listFiles.description,inputSchema:l.listFiles.input,name:"listFiles"}).server(i=>p.listFiles(e,i)),"listFiles"),m=r(e=>t({description:l.getFileMetadata.description,inputSchema:l.getFileMetadata.input,name:"getFileMetadata"}).server(i=>p.getFileMetadata(e,i)),"getFileMetadata"),g=r(e=>t({description:l.downloadFile.description,inputSchema:l.downloadFile.input,name:"downloadFile"}).server(i=>p.downloadFile(e,i)),"downloadFile"),v=r(e=>t({description:l.getFileUrl.description,inputSchema:l.getFileUrl.input,name:"getFileUrl"}).server(i=>p.getFileUrl(e,i)),"getFileUrl"),U=r((e,{needsApproval:i=!0}={})=>t({description:l.uploadFile.description,inputSchema:l.uploadFile.input,name:"uploadFile",needsApproval:i}).server(a=>p.uploadFile(e,a)),"uploadFile"),S=r((e,{needsApproval:i=!0}={})=>t({description:l.deleteFile.description,inputSchema:l.deleteFile.input,name:"deleteFile",needsApproval:i}).server(a=>p.deleteFile(e,a)),"deleteFile"),A=r((e,{needsApproval:i=!0}={})=>t({description:l.copyFile.description,inputSchema:l.copyFile.input,name:"copyFile",needsApproval:i}).server(a=>p.copyFile(e,a)),"copyFile"),h=r((e,{needsApproval:i=!0}={})=>t({description:l.signUploadUrl.description,inputSchema:l.signUploadUrl.input,name:"signUploadUrl",needsApproval:i}).server(a=>p.signUploadUrl(e,a)),"signUploadUrl");export{A as copyFile,S as deleteFile,g as downloadFile,m as getFileMetadata,v as getFileUrl,u as listFiles,h as signUploadUrl,U as uploadFile};
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{tool as p}from"ai";import{T as t,e as o}from"./executors-DG6hGtvm.js";var r=Object.defineProperty,l=n((e,i)=>r(e,"name",{value:i,configurable:!0}),"i");const F=l(e=>p({description:t.listFiles.description,execute:l(i=>o.listFiles(e,i),"execute"),inputSchema:t.listFiles.input}),"listFiles"),x=l(e=>p({description:t.getFileMetadata.description,execute:l(i=>o.getFileMetadata(e,i),"execute"),inputSchema:t.getFileMetadata.input}),"getFileMetadata"),g=l(e=>p({description:t.downloadFile.description,execute:l(i=>o.downloadFile(e,i),"execute"),inputSchema:t.downloadFile.input}),"downloadFile"),U=l(e=>p({description:t.getFileUrl.description,execute:l(i=>o.getFileUrl(e,i),"execute"),inputSchema:t.getFileUrl.input}),"getFileUrl"),m=l((e,{needsApproval:i=!0}={})=>p({description:t.uploadFile.description,execute:l(d=>o.uploadFile(e,d),"execute"),inputSchema:t.uploadFile.input,needsApproval:i}),"uploadFile"),v=l((e,{needsApproval:i=!0}={})=>p({description:t.deleteFile.description,execute:l(d=>o.deleteFile(e,d),"execute"),inputSchema:t.deleteFile.input,needsApproval:i}),"deleteFile"),S=l((e,{needsApproval:i=!0}={})=>p({description:t.copyFile.description,execute:l(d=>o.copyFile(e,d),"execute"),inputSchema:t.copyFile.input,needsApproval:i}),"copyFile"),A=l((e,{needsApproval:i=!0}={})=>p({description:t.signUploadUrl.description,execute:l(d=>o.signUploadUrl(e,d),"execute"),inputSchema:t.signUploadUrl.input,needsApproval:i}),"signUploadUrl");export{S as copyFile,v as deleteFile,g as downloadFile,x as getFileMetadata,U as getFileUrl,F as listFiles,A as signUploadUrl,m as uploadFile};
@@ -0,0 +1 @@
1
+ var re=Object.defineProperty;var o=(e,t)=>re(e,"name",{value:t,configurable:!0});import{utimes as ae}from"node:fs/promises";import{tmpdir as oe}from"node:os";import{createRequire as m}from"node:module";import{A as T,M as _,J as ie,K as ne,L as R}from"./path-D7rMc9nq-B718mbm6.js";import{throwErrorCode as j,ERRORS as P}from"./ERRORS-CyOuSMLY.js";import se from"./MetaStorage-Y4m1dWgd.js";import{stringifyMetadata as ce,parseMetadata as ue}from"./Metadata-B6Ir0KO7.js";const E=0,le=4;var fe=Object.defineProperty,pe=o((e,t)=>fe(e,"name",{value:t,configurable:!0}),"t$6"),me=Object.defineProperty,de=pe((e,t)=>me(e,"name",{value:t,configurable:!0}),"t"),ge=Object.defineProperty,be=de((e,t)=>ge(e,"name",{value:t,configurable:!0}),"n");const $=be(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var ve=Object.defineProperty,ye=o((e,t)=>ve(e,"name",{value:t,configurable:!0}),"i$8"),he=Object.defineProperty,$e=ye((e,t)=>he(e,"name",{value:t,configurable:!0}),"r"),we=Object.defineProperty,Oe=$e((e,t)=>we(e,"name",{value:t,configurable:!0}),"i");const S=Oe(e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},"getFileInfoType");var je=Object.defineProperty,Pe=o((e,t)=>je(e,"name",{value:t,configurable:!0}),"i$7"),xe=Object.defineProperty,q=Pe((e,t)=>xe(e,"name",{value:t,configurable:!0}),"s");const Ee=m(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Te=q(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,r]=d.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return d.getBuiltinModule(e)}return Ee(e)},"__cjs_getBuiltinModule"),{lstat:I,mkdir:_e}=Te("node:fs/promises");var Me=Object.defineProperty,ke=q((e,t)=>Me(e,"name",{value:t,configurable:!0}),"o");const Ne=ke(async e=>{$(e);try{const t=await I(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(S(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{await _e(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const r=await I(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(S(r))}'`,{cause:t})}},"ensureDir");var ze=Object.defineProperty,l=o((e,t)=>ze(e,"name",{value:t,configurable:!0}),"n$7"),Be=Object.defineProperty,s=l((e,t)=>Be(e,"name",{value:t,configurable:!0}),"a");const Fe=m(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ae=s(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return Fe(e)},"__cjs_getBuiltinModule"),{fileURLToPath:De}=Ae("node:url");var Re=Object.defineProperty,p=s((e,t)=>Re(e,"name",{value:t,configurable:!0}),"t$1");function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(O,"m$4");l(O,"d");s(O,"getDefaultExportFromCjs");p(O,"getDefaultExportFromCjs");function M(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(M,"h$1");l(M,"O");s(M,"getDefaultExportFromNamespaceIfPresent");p(M,"getDefaultExportFromNamespaceIfPresent");function k(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.keys(e).length===1?e.default:e}o(k,"x");l(k,"P");s(k,"getDefaultExportFromNamespaceIfNotNamed");p(k,"getDefaultExportFromNamespaceIfNotNamed");function N(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=p(s(l(o(function a(){var i=!1;try{i=this instanceof a}catch{}return i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)},"a"),"s"),"a"),"a");r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,i.get?i:{enumerable:!0,get:p(function(){return e[a]},"get")})}),r}o(N,"y$2");l(N,"_");s(N,"getAugmentedNamespace");p(N,"getAugmentedNamespace");var L,U;function z(){return U||(U=1,L=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),L}o(z,"w$2");l(z,"k");s(z,"requireBinaryExtensions");var Se=z();const Ie=O(Se);var Le=Object.defineProperty,n=s((e,t)=>Le(e,"name",{value:t,configurable:!0}),"r");const Ue=new Set(Ie),Ce=new Set(["/","\\",void 0]),C=Symbol.for("pathe:normalizedAlias"),We=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,qe=n((e,t)=>t.split("/").length-e.split("/").length,"compareAliases"),w=n((e="/")=>{const t=e.at(-1);return t==="/"||t==="\\"},"hasTrailingSlash"),V=n(e=>{if(e[C])return e;const t=Object.fromEntries(Object.entries(e).toSorted(([r],[a])=>qe(r,a)));for(const r in t)for(const a in t)a===r||r.startsWith(a)||t[r].startsWith(a)&&Ce.has(t[r][a.length])&&(t[r]=t[a]+t[r].slice(a.length));return Object.defineProperty(t,C,{enumerable:!1,value:!0}),t},"normalizeAliases");n((e,t)=>{e=T(e),t=V(t);for(const[r,a]of Object.entries(t)){if(!e.startsWith(r))continue;const i=w(r)?r.slice(0,-1):r;if(w(e[i.length]))return _(a,e.slice(r.length))}return e},"resolveAlias");n(e=>We.exec(e)?.[2],"filename");n((e,t)=>{e=T(e),t=V(t);for(const[r,a]of Object.entries(t).toReversed()){if(!e.startsWith(a))continue;const i=w(a)?a.slice(0,-1):a;if(w(e[i.length]))return _(r,e.slice(a.length))}return e},"reverseResolveAlias");const Ve=/^(?:\.?\.[/\\]|\.\.\B)/,Je=/^(?:msys|cygwin)$/;n(e=>Ve.test(e)||e==="..","isRelative");n(e=>Ue.has(ie(e).slice(1).toLowerCase()),"isBinaryPath");const B=n(e=>T(e instanceof URL?De(e):e),"toPath");n(()=>{if(!globalThis.process)return!1;if(globalThis.process.platform==="win32"||globalThis.process.platform==="cygwin")return!0;const e=globalThis.process.env.OSTYPE;return typeof e!="string"?!1:Je.test(e)},"isWindows");var Ke=Object.defineProperty,J=o((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"t$4"),Xe=Object.defineProperty,F=J((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"s");const Ye=m(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=F(e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,r]=b.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return b.getBuiltinModule(e)}return Ye(e)},"__cjs_getBuiltinModule"),{access:He}=Ge("node:fs/promises");var Qe=Object.defineProperty,Ze=F((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"o");async function u(e,t=E){$(e),e=B(e);try{return await He(e,t),!0}catch{return!1}}o(u,"i$5");J(u,"d");F(u,"m");Ze(u,"isAccessible");var et=Object.defineProperty,K=o((e,t)=>et(e,"name",{value:t,configurable:!0}),"t$3"),tt=Object.defineProperty,X=K((e,t)=>tt(e,"name",{value:t,configurable:!0}),"t"),rt=Object.defineProperty,at=X((e,t)=>rt(e,"name",{value:t,configurable:!0}),"o");let ot=class extends Error{static{o(this,"c")}static{K(this,"i")}static{X(this,"n")}static{at(this,"PermissionError")}constructor(t){super(`EPERM: Operation not permitted, ${t}`)}get code(){return"EPERM"}set code(t){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(t){throw new Error("Cannot overwrite name of PermissionError")}};var it=Object.defineProperty,nt=o((e,t)=>it(e,"name",{value:t,configurable:!0}),"f$4"),st=Object.defineProperty,Y=nt((e,t)=>st(e,"name",{value:t,configurable:!0}),"i");const ct=m(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=Y(e=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[t,r]=v.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return v.getBuiltinModule(e)}return ct(e)},"__cjs_getBuiltinModule"),{readFile:ut}=G("node:fs/promises"),{unzip:lt,brotliDecompress:ft}=G("node:zlib");var pt=Object.defineProperty,H=Y((e,t)=>pt(e,"name",{value:t,configurable:!0}),"n");const mt={brotli:ft,gzip:lt,none:H((e,t)=>{t(null,e)},"none")},dt=H(async(e,t)=>{if($(e),e=B(e),!await u(e))throw new ot(`unable to read the non-accessible file: ${e}`);if(!await u(e,le))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:r,compression:a,encoding:i,flag:c}=t??{};return await ut(e,c?{encoding:i,flag:c}:{encoding:i}).then(async f=>await new Promise((ee,te)=>{mt[a??"none"](f,(A,D)=>{A?te(A):ee(r?D:D.toString())})})).catch(f=>{throw f})},"readFile");var gt=Object.defineProperty,bt=o((e,t)=>gt(e,"name",{value:t,configurable:!0}),"a$4"),vt=Object.defineProperty,yt=bt((e,t)=>vt(e,"name",{value:t,configurable:!0}),"t"),ht=Object.defineProperty,$t=yt((e,t)=>ht(e,"name",{value:t,configurable:!0}),"t");const wt=$t(e=>{const t={force:!0,recursive:!0};return e?.maxRetries!==void 0&&(t.maxRetries=e.maxRetries),e?.retryDelay!==void 0&&(t.retryDelay=e.retryDelay),t},"buildRmOptions");var Ot=Object.defineProperty,jt=o((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"i$2"),Pt=Object.defineProperty,Q=jt((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"s");const xt=m(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=Q(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,r]=y.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return y.getBuiltinModule(e)}return xt(e)},"__cjs_getBuiltinModule"),{unlink:Tt,rm:_t}=Et("node:fs/promises");var Mt=Object.defineProperty,kt=Q((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"i");const Nt=kt(async(e,t={})=>{$(e);try{await Tt(e)}catch{}try{await _t(e,wt(t))}catch{}},"remove");var zt=Object.defineProperty,Bt=o((e,t)=>zt(e,"name",{value:t,configurable:!0}),"a$2"),Ft=Object.defineProperty,At=Bt((e,t)=>Ft(e,"name",{value:t,configurable:!0}),"t"),Dt=Object.defineProperty,Rt=At((e,t)=>Dt(e,"name",{value:t,configurable:!0}),"e");const St=Rt(e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},"assertValidFileContents");var It=Object.defineProperty,Lt=o((e,t)=>It(e,"name",{value:t,configurable:!0}),"t"),Ut=Object.defineProperty,Ct=Lt((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"r"),Wt=Object.defineProperty,qt=Ct((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"f");const Vt=new TextEncoder,Jt=qt(e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return Vt.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},"toUint8Array");var Kt=Object.defineProperty,Xt=o((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"m"),Yt=Object.defineProperty,Z=Xt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"s");const Gt=m(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=Z(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(e)}return Gt(e)},"__cjs_getBuiltinModule"),{mkdir:Qt,writeFile:Zt,stat:er,rename:W,chown:tr,chmod:rr,unlink:ar}=Ht("node:fs/promises");var or=Object.defineProperty,ir=Z((e,t)=>or(e,"name",{value:t,configurable:!0}),"d");const nr=ir(async(e,t,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},$(e),St(t),e=B(e);const a=`${e}.tmp`;try{const i=await u(e,E);if(!i&&r.recursive){const f=ne(e);await u(f,E)||await Qt(f,{recursive:!0})}let c;if(await Zt(a,Jt(t),{encoding:r.encoding,flag:r.flag}),i&&!r.overwrite&&(c=await er(e),r.chown??={gid:c.gid,uid:c.uid},await W(e,`${e}.bak`)),r.chown)try{await tr(a,r.chown.uid,r.chown.gid)}catch{}await rr(a,c&&!r.mode?c.mode:r.mode??438),await W(a,e)}catch(i){throw new Error(`Failed to write file at: ${e} - ${i.message}`,{cause:i})}finally{await u(a)&&await ar(`${e}.tmp`)}},"writeFile");var sr=Object.defineProperty,x=o((e,t)=>sr(e,"name",{value:t,configurable:!0}),"a");let vr=class extends se{static{o(this,"v")}static{x(this,"LocalMetaStorage")}directory;constructor(t){super(t),this.directory=R(t?.directory||_(oe(),"Upload_meta")),this.accessCheck().catch(r=>{this.logger?.error("Metadata storage access check failed: %O",r)})}getMetaPath=x(t=>{const r=R(`${this.directory}/${this.prefix}${t}${this.suffix}`),a=this.directory.endsWith("/")?this.directory:`${this.directory}/`;return r.startsWith(a)?r:j(P.INVALID_FILE_NAME,`Invalid id: "${t}" resolves outside the meta directory`)},"getMetaPath");getIdFromPath=x(t=>t.slice(`${this.directory}/${this.prefix}`.length,-this.suffix.length),"getIdFromPath");async save(t,r){await this.accessCheck();const a={...r};return a.metadata&&(a.metadata=ce(r.metadata)),await nr(this.getMetaPath(t),JSON.stringify(a),{recursive:!0}),r}async touch(t,r){const a=new Date;return await ae(this.getMetaPath(t),a,a),r}async get(t){try{const r=await dt(this.getMetaPath(t));if(r===void 0)throw j(P.FILE_NOT_FOUND);const a=JSON.parse(r);return a.metadata&&typeof a.metadata=="string"&&(a.metadata=ue(a.metadata)),a}catch(r){const a=r,i=r instanceof SyntaxError;throw a.code==="ENOENT"||i?j(P.FILE_NOT_FOUND):r}}async delete(t){await Nt(this.getMetaPath(t))}async accessCheck(){await Ne(this.directory)}};export{dt as B,B as U,E as _,$ as f,u as i,S as l,vr as v,Ne as w,Nt as y};
@@ -0,0 +1,21 @@
1
+ import { F as File, L as LocalMetaStorageOptions, M as MetaStorage } from "./storage.d-BoJgdi1n.js";
2
+ import 'node:stream';
3
+ /**
4
+ * Stores upload metafiles on local disk
5
+ */
6
+ declare class LocalMetaStorage<T extends File = File> extends MetaStorage<T> {
7
+ readonly directory: string;
8
+ constructor(config?: LocalMetaStorageOptions);
9
+ /**
10
+ * Returns metafile path.
11
+ * @param id upload id
12
+ * @throws {UploadError} If the id resolves to a path outside the meta directory (e.g. via `..` traversal or absolute paths).
13
+ */
14
+ getMetaPath: (id: string) => string;
15
+ override save(id: string, file: T): Promise<T>;
16
+ override touch(id: string, file: T): Promise<T>;
17
+ override get(id: string): Promise<T>;
18
+ override delete(id: string): Promise<void>;
19
+ private accessCheck;
20
+ }
21
+ export { LocalMetaStorage as L };
@@ -0,0 +1,331 @@
1
+ import { F as File, a as FileReturn, B as BaseStorage } from "./storage.d-BoJgdi1n.js";
2
+ import { O as MediaTransformerConfig, Q as MediaTransformResult } from "./types.d-DCPQvHDI.js";
3
+ /**
4
+ * Unified media transformer that automatically detects media type and routes to appropriate transformer.
5
+ * @template TFile The file type used by this transformer.
6
+ * @template TFileReturn The return type for file retrieval operations.
7
+ *
8
+ * Supports transformations via query parameters for on-demand media processing across all supported formats.
9
+ * @example
10
+ * // eslint-disable-next-line jsdoc/match-description
11
+ * ```ts
12
+ * const transformer = new MediaTransformer(storage, {
13
+ * maxImageSize: 10 * 1024 * 1024, // 10MB
14
+ * maxVideoSize: 100 * 1024 * 1024, // 100MB
15
+ * maxAudioSize: 50 * 1024 * 1024, // 50MB
16
+ * cache: new MapCache(), // In-memory caching
17
+ * saveTransformedFiles: true // Persist transformed files to storage
18
+ * });
19
+ *
20
+ * // Handle transformation via query parameters
21
+ * const result = await transformer.handle('file-id', {
22
+ * width: 800,
23
+ * height: 600,
24
+ * fit: 'cover',
25
+ * format: 'webp',
26
+ * quality: 80
27
+ * });
28
+ *
29
+ * // Fetch with URL query string
30
+ * const result = await transformer.fetch('file-id', 'width=1280&height=720&codec=avc&bitrate=2000000');
31
+ *
32
+ * // Clear all cached transformed files
33
+ * transformer.clearSavedTransformedFiles();
34
+ * ```
35
+ *
36
+ * ## Configuration Options
37
+ *
38
+ * - `saveTransformedFiles`: Persist transformed files to storage for reuse (default: false)
39
+ * - `cache`: Cache instance for in-memory caching (optional)
40
+ * - `maxImageSize/maxVideoSize/maxAudioSize`: Size limits for processing
41
+ * - `cacheTtl`: Cache time-to-live in seconds
42
+ *
43
+ * ## Supported Query Parameters
44
+ *
45
+ * ### Common Parameters
46
+ * - `format`: Output format (jpeg/png/webp/avif/mp4/webm/mkv/mp3/wav/ogg/aac/flac)
47
+ * - `quality`: Quality for images (0-100), bitrate for video/audio
48
+ *
49
+ * ### Image Parameters
50
+ * - `width`: Width in pixels
51
+ * - `height`: Height in pixels
52
+ * - `fit`: Resize fit mode - cover/contain/fill/inside/outside
53
+ * - `position`: Position for cover/contain fits
54
+ * - `withoutEnlargement`: Avoid enlarging smaller images (boolean)
55
+ * - `withoutReduction`: Avoid reducing larger images (boolean)
56
+ * - `kernel`: Resize kernel - nearest/cubic/mitchell/lanczos2/lanczos3
57
+ * - `fastShrinkOnLoad`: Fast shrink on load (boolean)
58
+ * - `left/top/cropWidth/cropHeight`: Crop parameters
59
+ * - `angle`: Rotation angle in degrees (any number, but angles other than 90°/180°/270° use interpolation and may affect quality)
60
+ * - `background`: Background color for rotation
61
+ * - `blur`: Apply blur effect (boolean)
62
+ * - `sharpen`: Apply sharpening (boolean)
63
+ * - `median`: Apply median filter with size (number)
64
+ * // eslint-disable-next-line jsdoc/match-description
65
+ * - `clahe`: Apply CLAHE (Contrast Limited Adaptive Histogram Equalization) (boolean)
66
+ * - `threshold`: Apply thresholding with value (0-255)
67
+ * - `gamma`: Apply gamma correction (boolean)
68
+ * - `negate`: Negate (invert) the image (boolean)
69
+ * - `normalise/normalize`: Normalise the image (boolean)
70
+ * - `flatten`: Flatten alpha channel (boolean)
71
+ * - `unflatten`: Unflatten alpha channel (boolean)
72
+ * - `flip`: Flip image vertically (boolean)
73
+ * - `flop`: Flop image horizontally (boolean)
74
+ * - `greyscale/grayscale`: Convert to greyscale (boolean)
75
+ * - `modulate`: Apply modulation effects (boolean)
76
+ * - `brightness`: Brightness multiplier for modulation (number)
77
+ * - `saturation`: Saturation multiplier for modulation (number)
78
+ * - `hue`: Hue rotation in degrees for modulation (number)
79
+ * // eslint-disable-next-line jsdoc/match-description
80
+ * - `lightness`: Lightness adjustment for modulation (number)
81
+ * - `tint`: Apply tinting (boolean)
82
+ * - `colourspace`: Convert colourspace - srgb/rgb/cmyk/lab/b-w
83
+ *
84
+ * ### Video Parameters
85
+ * - `width/height/fit`: Same as images
86
+ * - `codec`: Video codec - avc/hevc/vp8/vp9/av1
87
+ * - `bitrate`: Video bitrate in bits per second
88
+ * - `frameRate`: Frame rate in Hz
89
+ * - `keyFrameInterval`: Key frame interval in seconds
90
+ * - `angle`: Rotation angle in degrees (any number, but angles other than 90°/180°/270° use interpolation and may affect quality)
91
+ * - `background`: Background color for rotation
92
+ *
93
+ * ### Audio Parameters
94
+ * - `sampleRate`: Sample rate in Hz
95
+ * - `numberOfChannels`: Number of channels
96
+ * - `codec`: Audio codec - aac/opus/mp3/vorbis/flac
97
+ * - `bitrate`: Audio bitrate in bits per second
98
+ *
99
+ * ## File Persistence
100
+ *
101
+ * When `saveTransformedFiles` is enabled, transformed files are automatically saved to storage
102
+ * with deterministic IDs based on the original file and transformation parameters. Subsequent
103
+ * requests for the same transformation will serve the cached file directly, improving performance
104
+ * and reducing processing costs.
105
+ */
106
+ declare class MediaTransformer<TFile extends File = File, TFileReturn extends FileReturn = FileReturn> {
107
+ private readonly storage;
108
+ private readonly imageTransformer?;
109
+ private readonly videoTransformer?;
110
+ private readonly audioTransformer?;
111
+ private readonly config;
112
+ private readonly logger;
113
+ /**
114
+ * Creates a new MediaTransformer instance.
115
+ * @param storage The storage backend for retrieving and storing media files.
116
+ * @param config Configuration options for the media transformer including transformer classes and settings.
117
+ * @throws Error if no transformer classes are provided in the configuration.
118
+ */
119
+ constructor(storage: BaseStorage<TFile, TFileReturn>, config?: MediaTransformerConfig<TFile, TFileReturn>);
120
+ supportedFormats(): string[];
121
+ /**
122
+ * Handles media transformation based on query parameters.
123
+ * @param fileId File identifier.
124
+ * @param query Query parameters for transformation.
125
+ * @returns Unified transformation result.
126
+ */
127
+ handle(fileId: string, query: Record<string, string | undefined> | URLSearchParams | string): Promise<MediaTransformResult>;
128
+ /**
129
+ * Fetches media transformation with URL query string support.
130
+ * @param fileId File identifier.
131
+ * @param queryString URL query string (e.g., "width=800&amp;height=600&amp;format=webp").
132
+ * @returns Unified transformation result.
133
+ */
134
+ fetch(fileId: string, queryString: string): Promise<MediaTransformResult>;
135
+ /**
136
+ * Clears cache for a specific file across all transformers.
137
+ * @param fileId Optional file identifier to clear cache for. If omitted, clears all cache.
138
+ */
139
+ clearCache(fileId?: string): void;
140
+ /**
141
+ * Clears all saved transformed files from storage.
142
+ * @remarks This is a maintenance operation and may take time for large numbers of files.
143
+ */
144
+ clearSavedTransformedFiles(): Promise<void>;
145
+ /**
146
+ * Clears saved transformed files for a specific original file.
147
+ * @param originalFileId Original file identifier to clear transformed files for.
148
+ */
149
+ clearSavedTransformedFilesForFile(originalFileId: string): Promise<void>;
150
+ /**
151
+ * Gets cache statistics (combined from all transformers).
152
+ * @returns Cache statistics for audio, image, and video transformers.
153
+ */
154
+ getCacheStats(): {
155
+ audio?: {
156
+ maxSize: number;
157
+ size: number;
158
+ };
159
+ image?: {
160
+ maxSize: number;
161
+ size: number;
162
+ };
163
+ video?: {
164
+ maxSize: number;
165
+ size: number;
166
+ };
167
+ };
168
+ /**
169
+ * Validates query parameters for the given media type.
170
+ * @param query The query parameters to validate.
171
+ * @param mediaType The media type being validated ('image', 'video', or 'audio').
172
+ * @throws {ValidationError} When invalid parameters are provided.
173
+ */
174
+ private validateQueryParameters;
175
+ /**
176
+ * Validates query parameters for image transformations. Checks for invalid video/audio-only parameters, invalid fit values, invalid rotation angles, invalid formats, and incomplete crop parameter sets.
177
+ * @param query Query parameters to validate.
178
+ * @throws {ValidationError} When validation fails.
179
+ */
180
+ private validateImageQueryParameters;
181
+ /**
182
+ * Validates query parameters for video transformations. Checks for invalid audio-only parameters, invalid fit values, invalid rotation angles, invalid codecs, invalid formats, incomplete crop parameter sets, and invalid numeric values.
183
+ * @param query Query parameters to validate.
184
+ * @throws {ValidationError} When validation fails.
185
+ */
186
+ private validateVideoQueryParameters;
187
+ /**
188
+ * Generates a unique ID for transformed files based on original file and transformations.
189
+ * @param originalFileId The original file identifier.
190
+ * @param query The transformation query parameters.
191
+ * @param mediaType The media type (image, video, audio).
192
+ * @returns Unique deterministic identifier for the transformed file.
193
+ * @private
194
+ */
195
+ private generateTransformedFileId;
196
+ /**
197
+ * Checks if the query contains any transformations.
198
+ * @param query The transformation query parameters.
199
+ * @returns True if any transformations are requested.
200
+ * @private
201
+ */
202
+ private hasTransformations;
203
+ /**
204
+ * Creates a MediaTransformResult from a stored transformed file.
205
+ * @param storedFile The stored transformed file.
206
+ * @param mediaType The media type (image, video, audio).
207
+ * @param originalFile The original file information.
208
+ * @returns Media transformation result with metadata.
209
+ * @private
210
+ */
211
+ private createMediaTransformResult;
212
+ /**
213
+ * Extracts format from content type.
214
+ * @param contentType MIME content type string.
215
+ * @returns Format string extracted from content type.
216
+ * @private
217
+ */
218
+ private getFormatFromContentType;
219
+ /**
220
+ * Saves transformed file to storage.
221
+ * @param result The transformation result to save.
222
+ * @param originalFileId The original file identifier.
223
+ * @param query The transformation query parameters.
224
+ * @param mediaType The media type (image, video, audio).
225
+ * @returns Promise that resolves when file is saved.
226
+ * @private
227
+ */
228
+ private saveTransformedFile;
229
+ /**
230
+ * Validates query parameters for audio transformations. Checks for invalid video-only parameters, invalid codecs, invalid formats, and invalid numeric values.
231
+ * @param query Query parameters to validate.
232
+ * @throws {ValidationError} When validation fails.
233
+ */
234
+ private validateAudioQueryParameters;
235
+ /**
236
+ * Handles image transformation.
237
+ * @param fileId The file identifier.
238
+ * @param query The transformation query parameters.
239
+ * @returns Promise resolving to media transformation result.
240
+ * @private
241
+ */
242
+ private handleImageTransformation;
243
+ /**
244
+ * Handles video transformation.
245
+ * @param fileId The file identifier.
246
+ * @param query The transformation query parameters.
247
+ * @returns Promise resolving to media transformation result.
248
+ * @private
249
+ */
250
+ private handleVideoTransformation;
251
+ /**
252
+ * Handles audio transformation.
253
+ * @param fileId The file identifier.
254
+ * @param query The transformation query parameters.
255
+ * @returns Promise resolving to media transformation result.
256
+ * @private
257
+ */
258
+ private handleAudioTransformation;
259
+ /**
260
+ * Parses query parameters from various input formats.
261
+ * @param query Query parameters in various formats.
262
+ * @returns Normalized MediaTransformQuery object.
263
+ * @private
264
+ */
265
+ private parseQuery;
266
+ /**
267
+ * Parses boolean parameter from string.
268
+ * @param value String value to parse.
269
+ * @returns Boolean value or undefined.
270
+ * @private
271
+ */
272
+ private parseBooleanParameter;
273
+ /**
274
+ * Parses URLSearchParams into MediaTransformQuery.
275
+ * @param parameters URL search parameters object.
276
+ * @returns MediaTransformQuery object with parsed parameters.
277
+ * @private
278
+ */
279
+ private parseURLSearchParams;
280
+ /**
281
+ * Detects media type from MIME type.
282
+ * @param contentType MIME content type string.
283
+ * @returns Detected media type.
284
+ * @throws Error if content type is missing or unsupported.
285
+ * @private
286
+ */
287
+ private detectMediaType;
288
+ /**
289
+ * Checks if query has image transformations.
290
+ * @param query The transformation query parameters.
291
+ * @returns True if image transformations are requested.
292
+ * @private
293
+ */
294
+ private hasImageTransformations;
295
+ /**
296
+ * Checks if query has video transformations.
297
+ * @param query The transformation query parameters.
298
+ * @returns True if video transformations are requested.
299
+ * @private
300
+ */
301
+ private hasVideoTransformations;
302
+ /**
303
+ * Checks if query has audio transformations.
304
+ * @param query The transformation query parameters.
305
+ * @returns True if audio transformations are requested.
306
+ * @private
307
+ */
308
+ private hasAudioTransformations;
309
+ /**
310
+ * Converts ImageTransformer result to unified format.
311
+ * @param result The image transformation result.
312
+ * @returns Unified media transformation result.
313
+ * @private
314
+ */
315
+ private convertImageResult;
316
+ /**
317
+ * Converts VideoTransformer result to unified format.
318
+ * @param result The video transformation result.
319
+ * @returns Unified media transformation result.
320
+ * @private
321
+ */
322
+ private convertVideoResult;
323
+ /**
324
+ * Converts AudioTransformer result to unified format.
325
+ * @param result The audio transformation result.
326
+ * @returns Unified media transformation result.
327
+ * @private
328
+ */
329
+ private convertAudioResult;
330
+ }
331
+ export { MediaTransformer as M };
@@ -0,0 +1 @@
1
+ var E=Object.defineProperty;var o=(e,s)=>E(e,"name",{value:s,configurable:!0});var t=Object.defineProperty,I=o((e,s)=>t(e,"name",{value:s,configurable:!0}),"t");const S=I(e=>{const s=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.MINIO_ACCESS_KEY_ID??process.env.MINIO_ACCESS_KEY,r=e?.endpoint??process.env.AWS_ENDPOINT??process.env.MINIO_ENDPOINT,n=e?.region??process.env.AWS_REGION??process.env.MINIO_REGION,c=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.MINIO_SECRET_ACCESS_KEY??process.env.MINIO_SECRET_KEY;if(!n||!s||!c||!r)throw new Error("Missing required parameters for Minio client.");return{credentials:{accessKeyId:s,secretAccessKey:c},endpoint:r,forcePathStyle:!0,region:n}},"minio");export{S as default};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var d=(s,t)=>h(s,"name",{value:t,configurable:!0});import{n as p}from"./headers-DC2MEOrK.js";var g=Object.defineProperty,b=d((s,t)=>g(s,"name",{value:t,configurable:!0}),"d");class y{static{d(this,"F")}static{b(this,"MultipartBase")}async handlePost(t,i,l){const r={contentType:t.mediaType||"application/octet-stream",metadata:{},originalName:t.filename,size:t.size};for(const e of i)if(!e.isFile&&e.name){let n={};if(e.name==="metadata"&&e.text)try{n=JSON.parse(e.text)}catch{}else e.name&&(n={[e.name]:e.text});Object.assign(r.metadata,n)}const m=await this.storage.create(r),c=this.createStreamFromBytes(t.bytes),o=await this.storage.write({body:c,contentLength:t.size,id:m.id,start:0});let a=o;if(Object.keys(r.metadata).length>0){const e={...o.metadata,...r.metadata};a={...await this.storage.update({id:o.id},{metadata:e}),status:o.status}}const u=this.buildFileUrl(l,a);return{...a,headers:{Location:u,...a.expiredAt===void 0?{}:{"X-Upload-Expires":a.expiredAt.toString()},...a.ETag===void 0?{}:{ETag:a.ETag}},statusCode:200}}async handleDelete(t){const i=await this.storage.delete({id:t});if(i.status===void 0)throw p(404,"File not found");return{...i,headers:{},statusCode:204}}get storage(){throw new Error("storage must be implemented")}buildFileUrl(t,i){throw new Error("buildFileUrl must be implemented")}}export{y as F};