@visulima/storage 1.0.0-alpha.8 → 1.0.0

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 (424) hide show
  1. package/CHANGELOG.md +578 -0
  2. package/LICENSE.md +237 -568
  3. package/README.md +82 -466
  4. package/dist/adapter/nuxt/module.d.ts +41 -34
  5. package/dist/adapter/nuxt/module.js +1 -93
  6. package/dist/adapter/nuxt/package.json +0 -6
  7. package/dist/ai/ai-sdk/index.d.ts +113 -0
  8. package/dist/ai/ai-sdk/index.js +1 -0
  9. package/dist/ai/claude/index.d.ts +177 -0
  10. package/dist/ai/claude/index.js +1 -0
  11. package/dist/ai/openai/index.d.ts +205 -0
  12. package/dist/ai/openai/index.js +1 -0
  13. package/dist/ai/tanstack/index.d.ts +115 -0
  14. package/dist/ai/tanstack/index.js +1 -0
  15. package/dist/handler/http/fetch/index.d.ts +303 -4
  16. package/dist/handler/http/fetch/index.js +1 -4
  17. package/dist/handler/http/hono/index.d.ts +73 -64
  18. package/dist/handler/http/hono/index.js +1 -65
  19. package/dist/handler/http/nextjs/index.d.ts +66 -58
  20. package/dist/handler/http/nextjs/index.js +1 -37
  21. package/dist/handler/http/node/index.d.ts +368 -4
  22. package/dist/handler/http/node/index.js +1 -8
  23. package/dist/handler/http/solid-start/index.d.ts +66 -57
  24. package/dist/handler/http/solid-start/index.js +1 -44
  25. package/dist/index.d.ts +106 -17
  26. package/dist/index.js +1 -13
  27. package/dist/openapi/index.d.ts +24 -5
  28. package/dist/openapi/index.js +1 -5
  29. package/dist/packem_shared/AbstractBaseStorage-Ba7cLu-t.js +1 -0
  30. package/dist/packem_shared/AwsLightFile-CpZrubaV.js +1 -0
  31. package/dist/packem_shared/AwsLightMetaStorage-DPqJ9LTr.js +1 -0
  32. package/dist/packem_shared/AwsLightStorage-DTBVxHXO.js +1 -0
  33. package/dist/packem_shared/AzureFile-DFSaVe25.js +1 -0
  34. package/dist/packem_shared/AzureSMetaStorage-ByzM6Aix.js +1 -0
  35. package/dist/packem_shared/AzureStorage-BFsD4qbF.js +1 -0
  36. package/dist/packem_shared/BaseTransformer-Buw5lX_3.js +1 -0
  37. package/dist/packem_shared/BoxFile-CseIoPW1.js +1 -0
  38. package/dist/packem_shared/BoxMetaStorage-DFwhEI9C.js +1 -0
  39. package/dist/packem_shared/BoxStorage-B_t-OVzf.js +1 -0
  40. package/dist/packem_shared/BunS3File-BcYmsz1n.js +1 -0
  41. package/dist/packem_shared/BunS3MetaStorage-DFwhEI9C.js +1 -0
  42. package/dist/packem_shared/BunS3Storage-CB_pZWlV.js +1 -0
  43. package/dist/packem_shared/BunnyFile-BgEOlcYI.js +1 -0
  44. package/dist/packem_shared/BunnyMetaStorage-DFwhEI9C.js +1 -0
  45. package/dist/packem_shared/BunnyStorage-CILSK4_Z.js +1 -0
  46. package/dist/packem_shared/CloudinaryFile-Bo5B-vM1.js +1 -0
  47. package/dist/packem_shared/CloudinaryMetaStorage-D_vNzewL.js +1 -0
  48. package/dist/packem_shared/CloudinaryStorage-DiCbdAi_.js +1 -0
  49. package/dist/packem_shared/DiskStorage-Kp5t3vnF.js +1 -0
  50. package/dist/packem_shared/DiskStorageWithChecksum-Bh6w-Iu8.js +1 -0
  51. package/dist/packem_shared/DropboxFile-BFb7eOzy.js +1 -0
  52. package/dist/packem_shared/DropboxMetaStorage-DFwhEI9C.js +1 -0
  53. package/dist/packem_shared/DropboxStorage-H8bd8hEz.js +1 -0
  54. package/dist/packem_shared/ERRORS-BIBxE2oR.js +1 -0
  55. package/dist/packem_shared/File-W8aOo15X.js +1 -0
  56. package/dist/packem_shared/Files-BA3mpDwz.js +1 -0
  57. package/dist/packem_shared/FirebaseFile-BLaBxa2A.js +1 -0
  58. package/dist/packem_shared/FirebaseMetaStorage-D_vNzewL.js +1 -0
  59. package/dist/packem_shared/FirebaseStorage-Dgk4XyMr.js +2 -0
  60. package/dist/packem_shared/FtpFile-ClWDYnt2.js +1 -0
  61. package/dist/packem_shared/FtpMetaStorage-DFwhEI9C.js +1 -0
  62. package/dist/packem_shared/FtpStorage-g_DjiR-C.js +1 -0
  63. package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
  64. package/dist/packem_shared/GCSFile-Cero7qZN.js +1 -0
  65. package/dist/packem_shared/GCSMetaStorage-3fLTlRd4.js +1 -0
  66. package/dist/packem_shared/GCStorage-DUfwVFd3.js +1 -0
  67. package/dist/packem_shared/GoogleDriveFile-DHpLhzg9.js +1 -0
  68. package/dist/packem_shared/GoogleDriveMetaStorage-DqkgoE46.js +1 -0
  69. package/dist/packem_shared/GoogleDriveStorage-D0-5egHE.js +1 -0
  70. package/dist/packem_shared/LocalMetaStorage-Bp5mVc76.js +1 -0
  71. package/dist/packem_shared/MediaTransformer-D2kUsklW.js +1 -0
  72. package/dist/packem_shared/MemoryMetaStorage-Ksgh9pe7.js +1 -0
  73. package/dist/packem_shared/MemoryStorage-DzSTdlAq.js +1 -0
  74. package/dist/packem_shared/MetaStorage-DPEUyWgN.js +1 -0
  75. package/dist/packem_shared/Metadata-B7CcBueg.js +1 -0
  76. package/dist/packem_shared/Multipart-Btj2mo9r.js +1 -0
  77. package/dist/packem_shared/Multipart-C4GpuHMU.js +1 -0
  78. package/dist/packem_shared/NetlifyBlobFile-DoFhkzaH.js +1 -0
  79. package/dist/packem_shared/NetlifyBlobMetaStorage-D_vNzewL.js +1 -0
  80. package/dist/packem_shared/NetlifyBlobStorage-DZdCmOVW.js +1 -0
  81. package/dist/packem_shared/NoOpMetrics-BLo6u4NY.js +1 -0
  82. package/dist/packem_shared/OneDriveFile-CNNJYI43.js +1 -0
  83. package/dist/packem_shared/OneDriveMetaStorage-DqkgoE46.js +1 -0
  84. package/dist/packem_shared/OneDriveStorage-CvJetV7_.js +1 -0
  85. package/dist/packem_shared/OpenTelemetryMetrics-DJDQsNKp.js +1 -0
  86. package/dist/packem_shared/PocketBaseFile-DpJpxl3e.js +1 -0
  87. package/dist/packem_shared/PocketBaseMetaStorage-CpvDRnSu.js +1 -0
  88. package/dist/packem_shared/PocketBaseStorage-BPil-koe.js +1 -0
  89. package/dist/packem_shared/Rest-BehVaxbl.js +1 -0
  90. package/dist/packem_shared/Rest-ymPCZkKR.js +1 -0
  91. package/dist/packem_shared/S3File-CpZrubaV.js +1 -0
  92. package/dist/packem_shared/S3MetaStorage-CMonflzp.js +1 -0
  93. package/dist/packem_shared/S3Storage-wslqssvr.js +1 -0
  94. package/dist/packem_shared/SftpFile-ClWDYnt2.js +1 -0
  95. package/dist/packem_shared/SftpMetaStorage-DFwhEI9C.js +1 -0
  96. package/dist/packem_shared/SftpStorage-BVbMtS2b.js +1 -0
  97. package/dist/packem_shared/SharePointFile-Blz9FS4h.js +1 -0
  98. package/dist/packem_shared/SharePointMetaStorage-DFwhEI9C.js +1 -0
  99. package/dist/packem_shared/SharePointStorage-DWjvR5oZ.js +1 -0
  100. package/dist/packem_shared/SupabaseFile-Bo5B-vM1.js +1 -0
  101. package/dist/packem_shared/SupabaseMetaStorage-DqkgoE46.js +1 -0
  102. package/dist/packem_shared/SupabaseStorage-BiKmYKb6.js +1 -0
  103. package/dist/packem_shared/TUS_RESUMABLE-CyTSRvPU.js +1 -0
  104. package/dist/packem_shared/Tus-BgbON_wQ.js +1 -0
  105. package/dist/packem_shared/Tus-v6jzkaIO.js +1 -0
  106. package/dist/packem_shared/UploadControl-DZJhI9Wh.js +1 -0
  107. package/dist/packem_shared/UploadThingFile-BTFMpcIA.js +1 -0
  108. package/dist/packem_shared/UploadThingMetaStorage-D_vNzewL.js +1 -0
  109. package/dist/packem_shared/UploadThingStorage-jrEnANC5.js +1 -0
  110. package/dist/packem_shared/ValidationError-3B06DFyE.js +1 -0
  111. package/dist/packem_shared/VercelBlobFile-CVQwKlZk.js +1 -0
  112. package/dist/packem_shared/VercelBlobMetaStorage-DFwhEI9C.js +1 -0
  113. package/dist/packem_shared/VercelBlobStorage-Y-cDgH30.js +1 -0
  114. package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +1 -0
  115. package/dist/packem_shared/agentsCopyFile-Dl5iffdH.js +1 -0
  116. package/dist/packem_shared/akamai-DthkaFul.js +1 -0
  117. package/dist/packem_shared/alibaba-BEi25O1g.js +1 -0
  118. package/dist/packem_shared/approval-fVHwBp7u.js +1 -0
  119. package/dist/packem_shared/approval.d-CMAYH9GF.d.ts +75 -0
  120. package/dist/packem_shared/aws-light-meta-storage-DGrn72VJ.js +4 -0
  121. package/dist/packem_shared/azure-meta-storage-ClbEsfI4.js +1 -0
  122. package/dist/packem_shared/backblaze-m1N5NZ9q.js +1 -0
  123. package/dist/packem_shared/base-handler-core-EeV8gZck.js +1 -0
  124. package/dist/packem_shared/base-handler-fetch-CHzsgb7C.js +1 -0
  125. package/dist/packem_shared/base-handler-node-BjpW8pGi.js +1 -0
  126. package/dist/packem_shared/cache-Cw3QjoVN.js +1 -0
  127. package/dist/packem_shared/claudeCopyFile-BX9O4ORk.js +1 -0
  128. package/dist/packem_shared/cloudflare-CdUTErlo.js +1 -0
  129. package/dist/packem_shared/copyFile-49FtxXcm.js +1 -0
  130. package/dist/packem_shared/copyFile-BUPezT_c.js +1 -0
  131. package/dist/packem_shared/createResponsesFileTools-6Tvt2PNr.js +1 -0
  132. package/dist/packem_shared/createRetryWrapper-CxgiV_hH.js +1 -0
  133. package/dist/packem_shared/detect-file-type-BA7UBLKA.js +1 -0
  134. package/dist/packem_shared/digitalOcean-B2uB6pgz.js +1 -0
  135. package/dist/packem_shared/disk-storage-DIn-VnCh.js +1 -0
  136. package/dist/packem_shared/disk-storage-with-checksum.d-B-VGEsfl.d.ts +156 -0
  137. package/dist/packem_shared/executors-BDzMjc4y.js +1 -0
  138. package/dist/packem_shared/executors.d-BZP2rWo3.d.ts +69 -0
  139. package/dist/packem_shared/exoscale-BDa1Gjth.js +1 -0
  140. package/dist/packem_shared/filebase-CsFYJIwB.js +1 -0
  141. package/dist/packem_shared/files.d-CH0iLBNC.d.ts +655 -0
  142. package/dist/packem_shared/gcs-meta-storage-Dy37wCjI.js +1 -0
  143. package/dist/packem_shared/get-file-status-y3wTtDQs.js +1 -0
  144. package/dist/packem_shared/getFormatFromContentType-DCTTPQHm.js +1 -0
  145. package/dist/packem_shared/has-content-50BsqrWw.js +1 -0
  146. package/dist/packem_shared/headers-BAiAKekR.js +26 -0
  147. package/dist/packem_shared/hetzner-BGGFiRGD.js +1 -0
  148. package/dist/packem_shared/ibmCos-j-3TfJ5p.js +1 -0
  149. package/dist/packem_shared/idriveE2-C6pQ5pQ0.js +1 -0
  150. package/dist/packem_shared/index-nZWCQrSe.js +5 -0
  151. package/dist/packem_shared/internal-D_cZIFwI.js +1 -0
  152. package/dist/packem_shared/is-expired-CBEk6XBi.js +1 -0
  153. package/dist/packem_shared/local-meta-storage-C2T92TYb.js +11 -0
  154. package/dist/packem_shared/local-meta-storage.d-D9PBfkn6.d.ts +21 -0
  155. package/dist/packem_shared/media-transformer.d-Quf4ai47.d.ts +331 -0
  156. package/dist/packem_shared/memory-storage.d-4EU1cMt1.d.ts +101 -0
  157. package/dist/packem_shared/minio-NKquuBfS.js +1 -0
  158. package/dist/packem_shared/multipart-base-BOzY19lb.js +1 -0
  159. package/dist/packem_shared/oauth-refresh-EdGzlcOZ.js +1 -0
  160. package/dist/packem_shared/oracleCloud-DslqNpn6.js +1 -0
  161. package/dist/packem_shared/ovhCloud-CMHE6uLV.js +1 -0
  162. package/dist/packem_shared/part-match-D-9dGX42.js +1 -0
  163. package/dist/packem_shared/path-0oTTdkvl-BVg7lYf5.js +1 -0
  164. package/dist/packem_shared/posix-dirname-CfpH5wZi.js +1 -0
  165. package/dist/packem_shared/response-builder-CbSA8qPa.js +1 -0
  166. package/dist/packem_shared/rest-base-CynUg0mH.js +1 -0
  167. package/dist/packem_shared/restOpenApiSpec-Csv513qf.js +1 -0
  168. package/dist/packem_shared/s3-base-storage-DXZYN24h.js +1 -0
  169. package/dist/packem_shared/s3-base-storage.d-BQgP5B-t.d.ts +287 -0
  170. package/dist/packem_shared/scaleway-U1In3v70.js +1 -0
  171. package/dist/packem_shared/sharedErrorSchemaObject-YN65aAKj.js +1 -0
  172. package/dist/packem_shared/storage-Cyy73Y6r.js +1 -0
  173. package/dist/packem_shared/storage.d-CEM1upWM.d.ts +1176 -0
  174. package/dist/packem_shared/storj-Cb59q9kF.js +1 -0
  175. package/dist/packem_shared/sync-DhR3536K.js +1 -0
  176. package/dist/packem_shared/tencent-Q1y2GENc.js +1 -0
  177. package/dist/packem_shared/tigris-BELKoyyp.js +1 -0
  178. package/dist/packem_shared/transformOpenApiSpec-CIEAgpBD.js +1 -0
  179. package/dist/packem_shared/tus-base.d-DLzKE54M.d.ts +106 -0
  180. package/dist/packem_shared/tusOpenApiSpec-D96B03t5.js +1 -0
  181. package/dist/packem_shared/types.d-Bon9GVVe.d.ts +104 -0
  182. package/dist/packem_shared/types.d-CggTCgXr.d.ts +49 -0
  183. package/dist/packem_shared/types.d-CrUWY4On.d.ts +720 -0
  184. package/dist/packem_shared/update-size-DuNuLyxj.js +1 -0
  185. package/dist/packem_shared/vultr-B491cQ4e.js +1 -0
  186. package/dist/packem_shared/waitForStorage-ByQmG4xF.js +1 -0
  187. package/dist/packem_shared/wasabi-DFrwIoab.js +1 -0
  188. package/dist/packem_shared/xhrOpenApiSpec-DQR4h6M8.js +1 -0
  189. package/dist/packem_shared/yandex-CwzHuEKP.js +1 -0
  190. package/dist/storage/aws/clients/index.d.ts +612 -6
  191. package/dist/storage/aws/clients/index.js +1 -6
  192. package/dist/storage/aws/index.d.ts +332 -4
  193. package/dist/storage/aws/index.js +1 -3
  194. package/dist/storage/aws-light/index.d.ts +259 -4
  195. package/dist/storage/aws-light/index.js +1 -3
  196. package/dist/storage/azure/index.d.ts +236 -4
  197. package/dist/storage/azure/index.js +1 -3
  198. package/dist/storage/box/index.d.ts +189 -0
  199. package/dist/storage/box/index.js +1 -0
  200. package/dist/storage/bun-s3/index.d.ts +200 -0
  201. package/dist/storage/bun-s3/index.js +1 -0
  202. package/dist/storage/bunny/index.d.ts +119 -0
  203. package/dist/storage/bunny/index.js +1 -0
  204. package/dist/storage/cloudinary/index.d.ts +121 -0
  205. package/dist/storage/cloudinary/index.js +1 -0
  206. package/dist/storage/dropbox/index.d.ts +132 -0
  207. package/dist/storage/dropbox/index.js +1 -0
  208. package/dist/storage/firebase/index.d.ts +192 -0
  209. package/dist/storage/firebase/index.js +1 -0
  210. package/dist/storage/ftp/index.d.ts +91 -0
  211. package/dist/storage/ftp/index.js +1 -0
  212. package/dist/storage/gcs/index.d.ts +195 -5
  213. package/dist/storage/gcs/index.js +1 -4
  214. package/dist/storage/google-drive/index.d.ts +148 -0
  215. package/dist/storage/google-drive/index.js +1 -0
  216. package/dist/storage/local/index.d.ts +7 -4
  217. package/dist/storage/local/index.js +1 -3
  218. package/dist/storage/memory/index.d.ts +6 -0
  219. package/dist/storage/memory/index.js +1 -0
  220. package/dist/storage/netlify-blob/index.d.ts +147 -4
  221. package/dist/storage/netlify-blob/index.js +1 -3
  222. package/dist/storage/onedrive/index.d.ts +103 -0
  223. package/dist/storage/onedrive/index.js +1 -0
  224. package/dist/storage/pocketbase/index.d.ts +172 -0
  225. package/dist/storage/pocketbase/index.js +1 -0
  226. package/dist/storage/sftp/index.d.ts +92 -0
  227. package/dist/storage/sftp/index.js +1 -0
  228. package/dist/storage/sharepoint/index.d.ts +180 -0
  229. package/dist/storage/sharepoint/index.js +1 -0
  230. package/dist/storage/supabase/index.d.ts +115 -0
  231. package/dist/storage/supabase/index.js +1 -0
  232. package/dist/storage/uploadthing/index.d.ts +95 -0
  233. package/dist/storage/uploadthing/index.js +1 -0
  234. package/dist/storage/vercel-blob/index.d.ts +189 -4
  235. package/dist/storage/vercel-blob/index.js +1 -3
  236. package/dist/transformer/audio-transformer.d.ts +127 -125
  237. package/dist/transformer/audio-transformer.js +1 -278
  238. package/dist/transformer/image-transformer.d.ts +573 -568
  239. package/dist/transformer/image-transformer.js +1 -1100
  240. package/dist/transformer/index.d.ts +62 -5
  241. package/dist/transformer/index.js +1 -4
  242. package/dist/transformer/video-transformer.d.ts +144 -142
  243. package/dist/transformer/video-transformer.js +1 -310
  244. package/package.json +202 -50
  245. package/dist/handler/base/base-handler-core.d.ts +0 -91
  246. package/dist/handler/base/base-handler-fetch.d.ts +0 -76
  247. package/dist/handler/base/base-handler-node.d.ts +0 -137
  248. package/dist/handler/multipart/multipart-base.d.ts +0 -84
  249. package/dist/handler/multipart/multipart-fetch.d.ts +0 -64
  250. package/dist/handler/multipart/multipart.d.ts +0 -49
  251. package/dist/handler/rest/rest-base.d.ts +0 -106
  252. package/dist/handler/rest/rest-fetch.d.ts +0 -88
  253. package/dist/handler/rest/rest.d.ts +0 -93
  254. package/dist/handler/tus/tus-base.d.ts +0 -152
  255. package/dist/handler/tus/tus-fetch.d.ts +0 -72
  256. package/dist/handler/tus/tus.d.ts +0 -78
  257. package/dist/handler/types.d.ts +0 -53
  258. package/dist/handler/utils/request-parser.d.ts +0 -72
  259. package/dist/handler/utils/response-builder.d.ts +0 -83
  260. package/dist/handler/utils/storage-utils.d.ts +0 -10
  261. package/dist/handler/utils/stream-utils.d.ts +0 -29
  262. package/dist/handler/utils/upload-handlers.d.ts +0 -76
  263. package/dist/metrics/index.d.ts +0 -2
  264. package/dist/metrics/no-op-metrics.d.ts +0 -15
  265. package/dist/metrics/opentelemetry-metrics.d.ts +0 -55
  266. package/dist/openapi/rest.d.ts +0 -7
  267. package/dist/openapi/shared.d.ts +0 -13
  268. package/dist/openapi/transform.d.ts +0 -3
  269. package/dist/openapi/tus.d.ts +0 -7
  270. package/dist/openapi/xhr.d.ts +0 -7
  271. package/dist/packem_shared/AwsLightFile-tTneXZgG.js +0 -11
  272. package/dist/packem_shared/AwsLightMetaStorage-BWSOtVaN.js +0 -4
  273. package/dist/packem_shared/AwsLightStorage-Blv-GP4v.js +0 -133
  274. package/dist/packem_shared/AzureFile-CesgFzps.js +0 -8
  275. package/dist/packem_shared/AzureSMetaStorage-CFs-OYJT.js +0 -88
  276. package/dist/packem_shared/AzureStorage-B0v048hG.js +0 -357
  277. package/dist/packem_shared/BaseTransformer-C2gLib6v.js +0 -82
  278. package/dist/packem_shared/DiskStorage-BlltBst6.js +0 -12
  279. package/dist/packem_shared/DiskStorageWithChecksum-BJTmMklc.js +0 -238
  280. package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
  281. package/dist/packem_shared/File-Bb3P23dr.js +0 -69
  282. package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
  283. package/dist/packem_shared/GCSFile-BIEunhAN.js +0 -8
  284. package/dist/packem_shared/GCSMetaStorage-BYhwecZl.js +0 -7
  285. package/dist/packem_shared/GCStorage-BmnoK7Rz.js +0 -406
  286. package/dist/packem_shared/LocalMetaStorage-CZHhKkMd.js +0 -7
  287. package/dist/packem_shared/MediaTransformer-D6658DL1.js +0 -1197
  288. package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
  289. package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
  290. package/dist/packem_shared/Multipart-5Xpy7WhY.js +0 -163
  291. package/dist/packem_shared/Multipart-C-iU9LXj.js +0 -128
  292. package/dist/packem_shared/NetlifyBlobFile-CXzyjqrD.js +0 -14
  293. package/dist/packem_shared/NetlifyBlobMetaStorage-DxZ5aDvD.js +0 -9
  294. package/dist/packem_shared/NetlifyBlobStorage-CLPtjHqd.js +0 -376
  295. package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
  296. package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
  297. package/dist/packem_shared/Rest-DO7OslCs.js +0 -267
  298. package/dist/packem_shared/Rest-DTaszQ6n.js +0 -228
  299. package/dist/packem_shared/S3File-DZiyk9Qt.js +0 -11
  300. package/dist/packem_shared/S3MetaStorage-Dz9aDabA.js +0 -76
  301. package/dist/packem_shared/S3Storage-DHmTk-hU.js +0 -316
  302. package/dist/packem_shared/TUS_RESUMABLE-BfguFdM1.js +0 -434
  303. package/dist/packem_shared/Tus-BQItPVAC.js +0 -200
  304. package/dist/packem_shared/Tus-BibjweWH.js +0 -195
  305. package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
  306. package/dist/packem_shared/VercelBlobFile-BCg4aTEq.js +0 -18
  307. package/dist/packem_shared/VercelBlobMetaStorage-Bd9F-VFm.js +0 -9
  308. package/dist/packem_shared/VercelBlobStorage-DD9LMOS6.js +0 -261
  309. package/dist/packem_shared/_commonjsHelpers-B85MJLTf.js +0 -5
  310. package/dist/packem_shared/aws-light-meta-storage-DKJBgbR6.js +0 -446
  311. package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
  312. package/dist/packem_shared/base-handler-core-DLEVHemv.js +0 -303
  313. package/dist/packem_shared/base-handler-fetch-A7V0N6AJ.js +0 -291
  314. package/dist/packem_shared/base-handler-node-Dx7ce3sU.js +0 -730
  315. package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
  316. package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
  317. package/dist/packem_shared/defaultCloudStorageFileNameValidation-DUuacjWv.js +0 -11
  318. package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
  319. package/dist/packem_shared/disk-storage-Bh2wy3YW.js +0 -810
  320. package/dist/packem_shared/gcs-meta-storage-DqNjM7DP.js +0 -158
  321. package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
  322. package/dist/packem_shared/headers-C9DasoT1.js +0 -1318
  323. package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
  324. package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
  325. package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
  326. package/dist/packem_shared/local-meta-storage-By-3SNBI.js +0 -649
  327. package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
  328. package/dist/packem_shared/multipart-base-BY0rhkw5.js +0 -102
  329. package/dist/packem_shared/part-match-BMNqHDYD.js +0 -96
  330. package/dist/packem_shared/path-CR6YkPXX-7R1-9CMk.js +0 -161
  331. package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
  332. package/dist/packem_shared/rest-base-Bt9Np3M8.js +0 -457
  333. package/dist/packem_shared/restOpenApiSpec-D1JC_Jto.js +0 -800
  334. package/dist/packem_shared/s3-base-storage-C1DIHTYY.js +0 -510
  335. package/dist/packem_shared/sharedGet-Cpo7QUyu.js +0 -1019
  336. package/dist/packem_shared/storage-C6NSXb8h.js +0 -1175
  337. package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
  338. package/dist/packem_shared/transformOpenApiSpec-DWM5WtnN.js +0 -975
  339. package/dist/packem_shared/tusOpenApiSpec-mBZkl7he.js +0 -740
  340. package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
  341. package/dist/packem_shared/validator-BeX_lJet.js +0 -78
  342. package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
  343. package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
  344. package/dist/packem_shared/xhrOpenApiSpec-B1V5Dxrj.js +0 -264
  345. package/dist/storage/aws/clients/backblaze.d.ts +0 -12
  346. package/dist/storage/aws/clients/cloudflare.d.ts +0 -13
  347. package/dist/storage/aws/clients/digital-ocean.d.ts +0 -12
  348. package/dist/storage/aws/clients/minio.d.ts +0 -13
  349. package/dist/storage/aws/clients/tigris.d.ts +0 -12
  350. package/dist/storage/aws/clients/types.d.ts +0 -95
  351. package/dist/storage/aws/clients/wasabi.d.ts +0 -12
  352. package/dist/storage/aws/s3-base-storage.d.ts +0 -248
  353. package/dist/storage/aws/s3-client-adapter.d.ts +0 -110
  354. package/dist/storage/aws/s3-file.d.ts +0 -10
  355. package/dist/storage/aws/s3-meta-storage.d.ts +0 -15
  356. package/dist/storage/aws/s3-storage.d.ts +0 -70
  357. package/dist/storage/aws/types.d.ts +0 -119
  358. package/dist/storage/aws-light/aws-light-api-adapter.d.ts +0 -130
  359. package/dist/storage/aws-light/aws-light-file.d.ts +0 -10
  360. package/dist/storage/aws-light/aws-light-meta-storage.d.ts +0 -19
  361. package/dist/storage/aws-light/aws-light-storage.d.ts +0 -65
  362. package/dist/storage/aws-light/types.d.ts +0 -37
  363. package/dist/storage/azure/azure-file.d.ts +0 -6
  364. package/dist/storage/azure/azure-meta-storage.d.ts +0 -15
  365. package/dist/storage/azure/azure-storage.d.ts +0 -69
  366. package/dist/storage/azure/types.d.ts +0 -62
  367. package/dist/storage/gcs/fetch-error.d.ts +0 -11
  368. package/dist/storage/gcs/gcs-config.d.ts +0 -2
  369. package/dist/storage/gcs/gcs-file.d.ts +0 -6
  370. package/dist/storage/gcs/gcs-meta-storage.d.ts +0 -27
  371. package/dist/storage/gcs/gcs-storage.d.ts +0 -91
  372. package/dist/storage/gcs/types.d.ts +0 -55
  373. package/dist/storage/gcs/utils.d.ts +0 -7
  374. package/dist/storage/local/disk-storage-with-checksum.d.ts +0 -15
  375. package/dist/storage/local/disk-storage.d.ts +0 -135
  376. package/dist/storage/local/local-meta-storage.d.ts +0 -32
  377. package/dist/storage/meta-storage.d.ts +0 -30
  378. package/dist/storage/netlify-blob/netlify-blob-file.d.ts +0 -12
  379. package/dist/storage/netlify-blob/netlify-blob-meta-storage.d.ts +0 -7
  380. package/dist/storage/netlify-blob/netlify-blob-storage.d.ts +0 -93
  381. package/dist/storage/netlify-blob/types.d.ts +0 -30
  382. package/dist/storage/storage.d.ts +0 -353
  383. package/dist/storage/types.d.ts +0 -221
  384. package/dist/storage/utils/file/file.d.ts +0 -25
  385. package/dist/storage/utils/file/get-file-status.d.ts +0 -9
  386. package/dist/storage/utils/file/has-content.d.ts +0 -9
  387. package/dist/storage/utils/file/index.d.ts +0 -10
  388. package/dist/storage/utils/file/is-expired.d.ts +0 -8
  389. package/dist/storage/utils/file/metadata.d.ts +0 -18
  390. package/dist/storage/utils/file/part-match.d.ts +0 -11
  391. package/dist/storage/utils/file/types.d.ts +0 -37
  392. package/dist/storage/utils/file/update-metadata.d.ts +0 -10
  393. package/dist/storage/utils/file/update-size.d.ts +0 -10
  394. package/dist/storage/vercel-blob/types.d.ts +0 -32
  395. package/dist/storage/vercel-blob/vercel-blob-file.d.ts +0 -16
  396. package/dist/storage/vercel-blob/vercel-blob-meta-storage.d.ts +0 -7
  397. package/dist/storage/vercel-blob/vercel-blob-storage.d.ts +0 -76
  398. package/dist/transformer/base-transformer.d.ts +0 -63
  399. package/dist/transformer/media-transformer.d.ts +0 -332
  400. package/dist/transformer/types.d.ts +0 -652
  401. package/dist/transformer/utils.d.ts +0 -33
  402. package/dist/transformer/validation-error.d.ts +0 -23
  403. package/dist/utils/cache.d.ts +0 -32
  404. package/dist/utils/chunked-upload.d.ts +0 -65
  405. package/dist/utils/detect-file-type.d.ts +0 -28
  406. package/dist/utils/errors.d.ts +0 -74
  407. package/dist/utils/file-path-url-matcher.d.ts +0 -18
  408. package/dist/utils/headers.d.ts +0 -111
  409. package/dist/utils/http.d.ts +0 -92
  410. package/dist/utils/locker.d.ts +0 -26
  411. package/dist/utils/pipes/stream-checksum.d.ts +0 -47
  412. package/dist/utils/pipes/stream-length.d.ts +0 -22
  413. package/dist/utils/primitives/get-last-one.d.ts +0 -3
  414. package/dist/utils/primitives/is-record.d.ts +0 -2
  415. package/dist/utils/primitives/map-values.d.ts +0 -9
  416. package/dist/utils/primitives/pick.d.ts +0 -2
  417. package/dist/utils/primitives/to-milliseconds.d.ts +0 -12
  418. package/dist/utils/primitives/to-seconds.d.ts +0 -12
  419. package/dist/utils/range-checksum.d.ts +0 -33
  420. package/dist/utils/range-hasher.d.ts +0 -46
  421. package/dist/utils/retry.d.ts +0 -64
  422. package/dist/utils/types.d.ts +0 -108
  423. package/dist/utils/validation-error.d.ts +0 -22
  424. package/dist/utils/validator.d.ts +0 -36
@@ -1,1318 +0,0 @@
1
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js';
2
- import require$$0 from 'path';
3
-
4
- var httpErrors = {exports: {}};
5
-
6
- var depd_1;
7
- var hasRequiredDepd;
8
-
9
- function requireDepd () {
10
- if (hasRequiredDepd) return depd_1;
11
- hasRequiredDepd = 1;
12
- /*!
13
- * depd
14
- * Copyright(c) 2014-2018 Douglas Christopher Wilson
15
- * MIT Licensed
16
- */
17
- var relative = require$$0.relative;
18
- depd_1 = depd;
19
- var basePath = process.cwd();
20
- function containsNamespace(str, namespace) {
21
- var vals = str.split(/[ ,]+/);
22
- var ns = String(namespace).toLowerCase();
23
- for (var i = 0; i < vals.length; i++) {
24
- var val = vals[i];
25
- if (val && (val === "*" || val.toLowerCase() === ns)) {
26
- return true;
27
- }
28
- }
29
- return false;
30
- }
31
- function convertDataDescriptorToAccessor(obj, prop, message) {
32
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
33
- var value = descriptor.value;
34
- descriptor.get = function getter() {
35
- return value;
36
- };
37
- if (descriptor.writable) {
38
- descriptor.set = function setter(val) {
39
- return value = val;
40
- };
41
- }
42
- delete descriptor.value;
43
- delete descriptor.writable;
44
- Object.defineProperty(obj, prop, descriptor);
45
- return descriptor;
46
- }
47
- function createArgumentsString(arity) {
48
- var str = "";
49
- for (var i = 0; i < arity; i++) {
50
- str += ", arg" + i;
51
- }
52
- return str.substr(2);
53
- }
54
- function createStackString(stack) {
55
- var str = this.name + ": " + this.namespace;
56
- if (this.message) {
57
- str += " deprecated " + this.message;
58
- }
59
- for (var i = 0; i < stack.length; i++) {
60
- str += "\n at " + stack[i].toString();
61
- }
62
- return str;
63
- }
64
- function depd(namespace) {
65
- if (!namespace) {
66
- throw new TypeError("argument namespace is required");
67
- }
68
- var stack = getStack();
69
- var site = callSiteLocation(stack[1]);
70
- var file = site[0];
71
- function deprecate(message) {
72
- log.call(deprecate, message);
73
- }
74
- deprecate._file = file;
75
- deprecate._ignored = isignored(namespace);
76
- deprecate._namespace = namespace;
77
- deprecate._traced = istraced(namespace);
78
- deprecate._warned = /* @__PURE__ */ Object.create(null);
79
- deprecate.function = wrapfunction;
80
- deprecate.property = wrapproperty;
81
- return deprecate;
82
- }
83
- function eehaslisteners(emitter, type) {
84
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
85
- return count > 0;
86
- }
87
- function isignored(namespace) {
88
- if (process.noDeprecation) {
89
- return true;
90
- }
91
- var str = process.env.NO_DEPRECATION || "";
92
- return containsNamespace(str, namespace);
93
- }
94
- function istraced(namespace) {
95
- if (process.traceDeprecation) {
96
- return true;
97
- }
98
- var str = process.env.TRACE_DEPRECATION || "";
99
- return containsNamespace(str, namespace);
100
- }
101
- function log(message, site) {
102
- var haslisteners = eehaslisteners(process, "deprecation");
103
- if (!haslisteners && this._ignored) {
104
- return;
105
- }
106
- var caller;
107
- var callFile;
108
- var callSite;
109
- var depSite;
110
- var i = 0;
111
- var seen = false;
112
- var stack = getStack();
113
- var file = this._file;
114
- if (site) {
115
- depSite = site;
116
- callSite = callSiteLocation(stack[1]);
117
- callSite.name = depSite.name;
118
- file = callSite[0];
119
- } else {
120
- i = 2;
121
- depSite = callSiteLocation(stack[i]);
122
- callSite = depSite;
123
- }
124
- for (; i < stack.length; i++) {
125
- caller = callSiteLocation(stack[i]);
126
- callFile = caller[0];
127
- if (callFile === file) {
128
- seen = true;
129
- } else if (callFile === this._file) {
130
- file = this._file;
131
- } else if (seen) {
132
- break;
133
- }
134
- }
135
- var key = caller ? depSite.join(":") + "__" + caller.join(":") : void 0;
136
- if (key !== void 0 && key in this._warned) {
137
- return;
138
- }
139
- this._warned[key] = true;
140
- var msg = message;
141
- if (!msg) {
142
- msg = callSite === depSite || !callSite.name ? defaultMessage(depSite) : defaultMessage(callSite);
143
- }
144
- if (haslisteners) {
145
- var err = DeprecationError(this._namespace, msg, stack.slice(i));
146
- process.emit("deprecation", err);
147
- return;
148
- }
149
- var format = process.stderr.isTTY ? formatColor : formatPlain;
150
- var output = format.call(this, msg, caller, stack.slice(i));
151
- process.stderr.write(output + "\n", "utf8");
152
- }
153
- function callSiteLocation(callSite) {
154
- var file = callSite.getFileName() || "<anonymous>";
155
- var line = callSite.getLineNumber();
156
- var colm = callSite.getColumnNumber();
157
- if (callSite.isEval()) {
158
- file = callSite.getEvalOrigin() + ", " + file;
159
- }
160
- var site = [file, line, colm];
161
- site.callSite = callSite;
162
- site.name = callSite.getFunctionName();
163
- return site;
164
- }
165
- function defaultMessage(site) {
166
- var callSite = site.callSite;
167
- var funcName = site.name;
168
- if (!funcName) {
169
- funcName = "<anonymous@" + formatLocation(site) + ">";
170
- }
171
- var context = callSite.getThis();
172
- var typeName = context && callSite.getTypeName();
173
- if (typeName === "Object") {
174
- typeName = void 0;
175
- }
176
- if (typeName === "Function") {
177
- typeName = context.name || typeName;
178
- }
179
- return typeName && callSite.getMethodName() ? typeName + "." + funcName : funcName;
180
- }
181
- function formatPlain(msg, caller, stack) {
182
- var timestamp = (/* @__PURE__ */ new Date()).toUTCString();
183
- var formatted = timestamp + " " + this._namespace + " deprecated " + msg;
184
- if (this._traced) {
185
- for (var i = 0; i < stack.length; i++) {
186
- formatted += "\n at " + stack[i].toString();
187
- }
188
- return formatted;
189
- }
190
- if (caller) {
191
- formatted += " at " + formatLocation(caller);
192
- }
193
- return formatted;
194
- }
195
- function formatColor(msg, caller, stack) {
196
- var formatted = "\x1B[36;1m" + this._namespace + "\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m" + msg + "\x1B[39m";
197
- if (this._traced) {
198
- for (var i = 0; i < stack.length; i++) {
199
- formatted += "\n \x1B[36mat " + stack[i].toString() + "\x1B[39m";
200
- }
201
- return formatted;
202
- }
203
- if (caller) {
204
- formatted += " \x1B[36m" + formatLocation(caller) + "\x1B[39m";
205
- }
206
- return formatted;
207
- }
208
- function formatLocation(callSite) {
209
- return relative(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
210
- }
211
- function getStack() {
212
- var limit = Error.stackTraceLimit;
213
- var obj = {};
214
- var prep = Error.prepareStackTrace;
215
- Error.prepareStackTrace = prepareObjectStackTrace;
216
- Error.stackTraceLimit = Math.max(10, limit);
217
- Error.captureStackTrace(obj);
218
- var stack = obj.stack.slice(1);
219
- Error.prepareStackTrace = prep;
220
- Error.stackTraceLimit = limit;
221
- return stack;
222
- }
223
- function prepareObjectStackTrace(obj, stack) {
224
- return stack;
225
- }
226
- function wrapfunction(fn, message) {
227
- if (typeof fn !== "function") {
228
- throw new TypeError("argument fn must be a function");
229
- }
230
- var args = createArgumentsString(fn.length);
231
- var stack = getStack();
232
- var site = callSiteLocation(stack[1]);
233
- site.name = fn.name;
234
- var deprecatedfn = new Function(
235
- "fn",
236
- "log",
237
- "deprecate",
238
- "message",
239
- "site",
240
- '"use strict"\nreturn function (' + args + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}"
241
- )(fn, log, this, message, site);
242
- return deprecatedfn;
243
- }
244
- function wrapproperty(obj, prop, message) {
245
- if (!obj || typeof obj !== "object" && typeof obj !== "function") {
246
- throw new TypeError("argument obj must be object");
247
- }
248
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
249
- if (!descriptor) {
250
- throw new TypeError("must call property on owner object");
251
- }
252
- if (!descriptor.configurable) {
253
- throw new TypeError("property must be configurable");
254
- }
255
- var deprecate = this;
256
- var stack = getStack();
257
- var site = callSiteLocation(stack[1]);
258
- site.name = prop;
259
- if ("value" in descriptor) {
260
- descriptor = convertDataDescriptorToAccessor(obj, prop);
261
- }
262
- var get = descriptor.get;
263
- var set = descriptor.set;
264
- if (typeof get === "function") {
265
- descriptor.get = function getter() {
266
- log.call(deprecate, message, site);
267
- return get.apply(this, arguments);
268
- };
269
- }
270
- if (typeof set === "function") {
271
- descriptor.set = function setter() {
272
- log.call(deprecate, message, site);
273
- return set.apply(this, arguments);
274
- };
275
- }
276
- Object.defineProperty(obj, prop, descriptor);
277
- }
278
- function DeprecationError(namespace, message, stack) {
279
- var error = new Error();
280
- var stackString;
281
- Object.defineProperty(error, "constructor", {
282
- value: DeprecationError
283
- });
284
- Object.defineProperty(error, "message", {
285
- configurable: true,
286
- enumerable: false,
287
- value: message,
288
- writable: true
289
- });
290
- Object.defineProperty(error, "name", {
291
- enumerable: false,
292
- configurable: true,
293
- value: "DeprecationError",
294
- writable: true
295
- });
296
- Object.defineProperty(error, "namespace", {
297
- configurable: true,
298
- enumerable: false,
299
- value: namespace,
300
- writable: true
301
- });
302
- Object.defineProperty(error, "stack", {
303
- configurable: true,
304
- enumerable: false,
305
- get: function() {
306
- if (stackString !== void 0) {
307
- return stackString;
308
- }
309
- return stackString = createStackString.call(this, stack);
310
- },
311
- set: function setter(val) {
312
- stackString = val;
313
- }
314
- });
315
- return error;
316
- }
317
- return depd_1;
318
- }
319
-
320
- var setprototypeof;
321
- var hasRequiredSetprototypeof;
322
-
323
- function requireSetprototypeof () {
324
- if (hasRequiredSetprototypeof) return setprototypeof;
325
- hasRequiredSetprototypeof = 1;
326
- setprototypeof = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
327
- function setProtoOf(obj, proto) {
328
- obj.__proto__ = proto;
329
- return obj;
330
- }
331
- function mixinProperties(obj, proto) {
332
- for (var prop in proto) {
333
- if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
334
- obj[prop] = proto[prop];
335
- }
336
- }
337
- return obj;
338
- }
339
- return setprototypeof;
340
- }
341
-
342
- var codes;
343
- var hasRequiredCodes;
344
-
345
- function requireCodes () {
346
- if (hasRequiredCodes) return codes;
347
- hasRequiredCodes = 1;
348
- codes = {
349
- "100": "Continue",
350
- "101": "Switching Protocols",
351
- "102": "Processing",
352
- "103": "Early Hints",
353
- "200": "OK",
354
- "201": "Created",
355
- "202": "Accepted",
356
- "203": "Non-Authoritative Information",
357
- "204": "No Content",
358
- "205": "Reset Content",
359
- "206": "Partial Content",
360
- "207": "Multi-Status",
361
- "208": "Already Reported",
362
- "226": "IM Used",
363
- "300": "Multiple Choices",
364
- "301": "Moved Permanently",
365
- "302": "Found",
366
- "303": "See Other",
367
- "304": "Not Modified",
368
- "305": "Use Proxy",
369
- "307": "Temporary Redirect",
370
- "308": "Permanent Redirect",
371
- "400": "Bad Request",
372
- "401": "Unauthorized",
373
- "402": "Payment Required",
374
- "403": "Forbidden",
375
- "404": "Not Found",
376
- "405": "Method Not Allowed",
377
- "406": "Not Acceptable",
378
- "407": "Proxy Authentication Required",
379
- "408": "Request Timeout",
380
- "409": "Conflict",
381
- "410": "Gone",
382
- "411": "Length Required",
383
- "412": "Precondition Failed",
384
- "413": "Payload Too Large",
385
- "414": "URI Too Long",
386
- "415": "Unsupported Media Type",
387
- "416": "Range Not Satisfiable",
388
- "417": "Expectation Failed",
389
- "418": "I'm a Teapot",
390
- "421": "Misdirected Request",
391
- "422": "Unprocessable Entity",
392
- "423": "Locked",
393
- "424": "Failed Dependency",
394
- "425": "Too Early",
395
- "426": "Upgrade Required",
396
- "428": "Precondition Required",
397
- "429": "Too Many Requests",
398
- "431": "Request Header Fields Too Large",
399
- "451": "Unavailable For Legal Reasons",
400
- "500": "Internal Server Error",
401
- "501": "Not Implemented",
402
- "502": "Bad Gateway",
403
- "503": "Service Unavailable",
404
- "504": "Gateway Timeout",
405
- "505": "HTTP Version Not Supported",
406
- "506": "Variant Also Negotiates",
407
- "507": "Insufficient Storage",
408
- "508": "Loop Detected",
409
- "509": "Bandwidth Limit Exceeded",
410
- "510": "Not Extended",
411
- "511": "Network Authentication Required"
412
- };
413
- return codes;
414
- }
415
-
416
- var statuses;
417
- var hasRequiredStatuses;
418
-
419
- function requireStatuses () {
420
- if (hasRequiredStatuses) return statuses;
421
- hasRequiredStatuses = 1;
422
- /*!
423
- * statuses
424
- * Copyright(c) 2014 Jonathan Ong
425
- * Copyright(c) 2016 Douglas Christopher Wilson
426
- * MIT Licensed
427
- */
428
- var codes = requireCodes();
429
- statuses = status;
430
- status.message = codes;
431
- status.code = createMessageToStatusCodeMap(codes);
432
- status.codes = createStatusCodeList(codes);
433
- status.redirect = {
434
- 300: true,
435
- 301: true,
436
- 302: true,
437
- 303: true,
438
- 305: true,
439
- 307: true,
440
- 308: true
441
- };
442
- status.empty = {
443
- 204: true,
444
- 205: true,
445
- 304: true
446
- };
447
- status.retry = {
448
- 502: true,
449
- 503: true,
450
- 504: true
451
- };
452
- function createMessageToStatusCodeMap(codes2) {
453
- var map = {};
454
- Object.keys(codes2).forEach(function forEachCode(code) {
455
- var message = codes2[code];
456
- var status2 = Number(code);
457
- map[message.toLowerCase()] = status2;
458
- });
459
- return map;
460
- }
461
- function createStatusCodeList(codes2) {
462
- return Object.keys(codes2).map(function mapCode(code) {
463
- return Number(code);
464
- });
465
- }
466
- function getStatusCode(message) {
467
- var msg = message.toLowerCase();
468
- if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
469
- throw new Error('invalid status message: "' + message + '"');
470
- }
471
- return status.code[msg];
472
- }
473
- function getStatusMessage(code) {
474
- if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
475
- throw new Error("invalid status code: " + code);
476
- }
477
- return status.message[code];
478
- }
479
- function status(code) {
480
- if (typeof code === "number") {
481
- return getStatusMessage(code);
482
- }
483
- if (typeof code !== "string") {
484
- throw new TypeError("code must be a number or string");
485
- }
486
- var n = parseInt(code, 10);
487
- if (!isNaN(n)) {
488
- return getStatusMessage(n);
489
- }
490
- return getStatusCode(code);
491
- }
492
- return statuses;
493
- }
494
-
495
- var inherits = {exports: {}};
496
-
497
- var inherits_browser = {exports: {}};
498
-
499
- var hasRequiredInherits_browser;
500
-
501
- function requireInherits_browser () {
502
- if (hasRequiredInherits_browser) return inherits_browser.exports;
503
- hasRequiredInherits_browser = 1;
504
- if (typeof Object.create === "function") {
505
- inherits_browser.exports = function inherits(ctor, superCtor) {
506
- if (superCtor) {
507
- ctor.super_ = superCtor;
508
- ctor.prototype = Object.create(superCtor.prototype, {
509
- constructor: {
510
- value: ctor,
511
- enumerable: false,
512
- writable: true,
513
- configurable: true
514
- }
515
- });
516
- }
517
- };
518
- } else {
519
- inherits_browser.exports = function inherits(ctor, superCtor) {
520
- if (superCtor) {
521
- ctor.super_ = superCtor;
522
- var TempCtor = function() {
523
- };
524
- TempCtor.prototype = superCtor.prototype;
525
- ctor.prototype = new TempCtor();
526
- ctor.prototype.constructor = ctor;
527
- }
528
- };
529
- }
530
- return inherits_browser.exports;
531
- }
532
-
533
- var hasRequiredInherits;
534
-
535
- function requireInherits () {
536
- if (hasRequiredInherits) return inherits.exports;
537
- hasRequiredInherits = 1;
538
- try {
539
- var util = require("util");
540
- if (typeof util.inherits !== "function") throw "";
541
- inherits.exports = util.inherits;
542
- } catch (e) {
543
- inherits.exports = requireInherits_browser();
544
- }
545
- return inherits.exports;
546
- }
547
-
548
- var toidentifier;
549
- var hasRequiredToidentifier;
550
-
551
- function requireToidentifier () {
552
- if (hasRequiredToidentifier) return toidentifier;
553
- hasRequiredToidentifier = 1;
554
- /*!
555
- * toidentifier
556
- * Copyright(c) 2016 Douglas Christopher Wilson
557
- * MIT Licensed
558
- */
559
- toidentifier = toIdentifier;
560
- function toIdentifier(str) {
561
- return str.split(" ").map(function(token) {
562
- return token.slice(0, 1).toUpperCase() + token.slice(1);
563
- }).join("").replace(/[^ _0-9a-z]/gi, "");
564
- }
565
- return toidentifier;
566
- }
567
-
568
- var hasRequiredHttpErrors;
569
-
570
- function requireHttpErrors () {
571
- if (hasRequiredHttpErrors) return httpErrors.exports;
572
- hasRequiredHttpErrors = 1;
573
- (function (module) {
574
- /*!
575
- * http-errors
576
- * Copyright(c) 2014 Jonathan Ong
577
- * Copyright(c) 2016 Douglas Christopher Wilson
578
- * MIT Licensed
579
- */
580
- var deprecate = requireDepd()("http-errors");
581
- var setPrototypeOf = requireSetprototypeof();
582
- var statuses = requireStatuses();
583
- var inherits = requireInherits();
584
- var toIdentifier = requireToidentifier();
585
- module.exports = createError;
586
- module.exports.HttpError = createHttpErrorConstructor();
587
- module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError);
588
- populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError);
589
- function codeClass(status) {
590
- return Number(String(status).charAt(0) + "00");
591
- }
592
- function createError() {
593
- var err;
594
- var msg;
595
- var status = 500;
596
- var props = {};
597
- for (var i = 0; i < arguments.length; i++) {
598
- var arg = arguments[i];
599
- var type = typeof arg;
600
- if (type === "object" && arg instanceof Error) {
601
- err = arg;
602
- status = err.status || err.statusCode || status;
603
- } else if (type === "number" && i === 0) {
604
- status = arg;
605
- } else if (type === "string") {
606
- msg = arg;
607
- } else if (type === "object") {
608
- props = arg;
609
- } else {
610
- throw new TypeError("argument #" + (i + 1) + " unsupported type " + type);
611
- }
612
- }
613
- if (typeof status === "number" && (status < 400 || status >= 600)) {
614
- deprecate("non-error status code; use only 4xx or 5xx status codes");
615
- }
616
- if (typeof status !== "number" || !statuses.message[status] && (status < 400 || status >= 600)) {
617
- status = 500;
618
- }
619
- var HttpError = createError[status] || createError[codeClass(status)];
620
- if (!err) {
621
- err = HttpError ? new HttpError(msg) : new Error(msg || statuses.message[status]);
622
- Error.captureStackTrace(err, createError);
623
- }
624
- if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
625
- err.expose = status < 500;
626
- err.status = err.statusCode = status;
627
- }
628
- for (var key in props) {
629
- if (key !== "status" && key !== "statusCode") {
630
- err[key] = props[key];
631
- }
632
- }
633
- return err;
634
- }
635
- function createHttpErrorConstructor() {
636
- function HttpError() {
637
- throw new TypeError("cannot construct abstract class");
638
- }
639
- inherits(HttpError, Error);
640
- return HttpError;
641
- }
642
- function createClientErrorConstructor(HttpError, name, code) {
643
- var className = toClassName(name);
644
- function ClientError(message) {
645
- var msg = message != null ? message : statuses.message[code];
646
- var err = new Error(msg);
647
- Error.captureStackTrace(err, ClientError);
648
- setPrototypeOf(err, ClientError.prototype);
649
- Object.defineProperty(err, "message", {
650
- enumerable: true,
651
- configurable: true,
652
- value: msg,
653
- writable: true
654
- });
655
- Object.defineProperty(err, "name", {
656
- enumerable: false,
657
- configurable: true,
658
- value: className,
659
- writable: true
660
- });
661
- return err;
662
- }
663
- inherits(ClientError, HttpError);
664
- nameFunc(ClientError, className);
665
- ClientError.prototype.status = code;
666
- ClientError.prototype.statusCode = code;
667
- ClientError.prototype.expose = true;
668
- return ClientError;
669
- }
670
- function createIsHttpErrorFunction(HttpError) {
671
- return function isHttpError(val) {
672
- if (!val || typeof val !== "object") {
673
- return false;
674
- }
675
- if (val instanceof HttpError) {
676
- return true;
677
- }
678
- return val instanceof Error && typeof val.expose === "boolean" && typeof val.statusCode === "number" && val.status === val.statusCode;
679
- };
680
- }
681
- function createServerErrorConstructor(HttpError, name, code) {
682
- var className = toClassName(name);
683
- function ServerError(message) {
684
- var msg = message != null ? message : statuses.message[code];
685
- var err = new Error(msg);
686
- Error.captureStackTrace(err, ServerError);
687
- setPrototypeOf(err, ServerError.prototype);
688
- Object.defineProperty(err, "message", {
689
- enumerable: true,
690
- configurable: true,
691
- value: msg,
692
- writable: true
693
- });
694
- Object.defineProperty(err, "name", {
695
- enumerable: false,
696
- configurable: true,
697
- value: className,
698
- writable: true
699
- });
700
- return err;
701
- }
702
- inherits(ServerError, HttpError);
703
- nameFunc(ServerError, className);
704
- ServerError.prototype.status = code;
705
- ServerError.prototype.statusCode = code;
706
- ServerError.prototype.expose = false;
707
- return ServerError;
708
- }
709
- function nameFunc(func, name) {
710
- var desc = Object.getOwnPropertyDescriptor(func, "name");
711
- if (desc && desc.configurable) {
712
- desc.value = name;
713
- Object.defineProperty(func, "name", desc);
714
- }
715
- }
716
- function populateConstructorExports(exports$1, codes, HttpError) {
717
- codes.forEach(function forEachCode(code) {
718
- var CodeError;
719
- var name = toIdentifier(statuses.message[code]);
720
- switch (codeClass(code)) {
721
- case 400:
722
- CodeError = createClientErrorConstructor(HttpError, name, code);
723
- break;
724
- case 500:
725
- CodeError = createServerErrorConstructor(HttpError, name, code);
726
- break;
727
- }
728
- if (CodeError) {
729
- exports$1[code] = CodeError;
730
- exports$1[name] = CodeError;
731
- }
732
- });
733
- }
734
- function toClassName(name) {
735
- return name.slice(-5) === "Error" ? name : name + "Error";
736
- }
737
- } (httpErrors));
738
- return httpErrors.exports;
739
- }
740
-
741
- var httpErrorsExports = requireHttpErrors();
742
- const createHttpError = /*@__PURE__*/getDefaultExportFromCjs(httpErrorsExports);
743
-
744
- function parseParams(input, delimiter = ";") {
745
- let parser = delimiter === ";" ? /(?:^|;)\s*([^=;\s]+)(\s*=\s*(?:"((?:[^"\\]|\\.)*)"|((?:[^;]|\\\;)+))?)?/g : /(?:^|,)\s*([^=,\s]+)(\s*=\s*(?:"((?:[^"\\]|\\.)*)"|((?:[^,]|\\\,)+))?)?/g;
746
- let params = [];
747
- let match;
748
- while ((match = parser.exec(input)) !== null) {
749
- let key = match[1].trim();
750
- let value;
751
- if (match[2]) {
752
- value = (match[3] || match[4] || "").replace(/\\(.)/g, "$1").trim();
753
- }
754
- params.push([key, value]);
755
- }
756
- return params;
757
- }
758
- function quote(value) {
759
- if (value.includes('"') || value.includes(";") || value.includes(" ")) {
760
- return `"${value.replace(/"/g, '\\"')}"`;
761
- }
762
- return value;
763
- }
764
-
765
- function isIterable(value) {
766
- return value != null && typeof value[Symbol.iterator] === "function";
767
- }
768
-
769
- class Accept {
770
- #map;
771
- constructor(init) {
772
- if (init)
773
- return Accept.from(init);
774
- this.#map = /* @__PURE__ */ new Map();
775
- }
776
- #sort() {
777
- this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]));
778
- }
779
- /**
780
- * An array of all media types in the header.
781
- */
782
- get mediaTypes() {
783
- return Array.from(this.#map.keys());
784
- }
785
- /**
786
- * An array of all weights (q values) in the header.
787
- */
788
- get weights() {
789
- return Array.from(this.#map.values());
790
- }
791
- /**
792
- * The number of media types in the `Accept` header.
793
- */
794
- get size() {
795
- return this.#map.size;
796
- }
797
- /**
798
- * Returns `true` if the header matches the given media type (i.e. it is "acceptable").
799
- *
800
- * @param mediaType The media type to check
801
- * @returns `true` if the media type is acceptable, `false` otherwise
802
- */
803
- accepts(mediaType) {
804
- return this.getWeight(mediaType) > 0;
805
- }
806
- /**
807
- * Gets the weight of a given media type. Also supports wildcards, so e.g. `text/*` will match `text/html`.
808
- *
809
- * @param mediaType The media type to get the weight of
810
- * @returns The weight of the media type
811
- */
812
- getWeight(mediaType) {
813
- let [type, subtype] = mediaType.toLowerCase().split("/");
814
- for (let [key, value] of this) {
815
- let [t, s] = key.split("/");
816
- if ((t === type || t === "*" || type === "*") && (s === subtype || s === "*" || subtype === "*")) {
817
- return value;
818
- }
819
- }
820
- return 0;
821
- }
822
- /**
823
- * Returns the most preferred media type from the given list of media types.
824
- *
825
- * @param mediaTypes The list of media types to choose from
826
- * @returns The most preferred media type or `null` if none match
827
- */
828
- getPreferred(mediaTypes) {
829
- let sorted = mediaTypes.map((mediaType) => [mediaType, this.getWeight(mediaType)]).sort((a, b) => b[1] - a[1]);
830
- let first = sorted[0];
831
- return first !== void 0 && first[1] > 0 ? first[0] : null;
832
- }
833
- /**
834
- * Returns the weight of a media type. If it is not in the header verbatim, this returns `null`.
835
- *
836
- * @param mediaType The media type to get the weight of
837
- * @returns The weight of the media type, or `null` if it is not in the header
838
- */
839
- get(mediaType) {
840
- return this.#map.get(mediaType.toLowerCase()) ?? null;
841
- }
842
- /**
843
- * Sets a media type with the given weight.
844
- *
845
- * @param mediaType The media type to set
846
- * @param weight The weight of the media type (default: `1`)
847
- */
848
- set(mediaType, weight = 1) {
849
- this.#map.set(mediaType.toLowerCase(), weight);
850
- this.#sort();
851
- }
852
- /**
853
- * Removes the given media type from the header.
854
- *
855
- * @param mediaType The media type to remove
856
- */
857
- delete(mediaType) {
858
- this.#map.delete(mediaType.toLowerCase());
859
- }
860
- /**
861
- * Checks if a media type is in the header.
862
- *
863
- * @param mediaType The media type to check
864
- * @returns `true` if the media type is in the header (verbatim), `false` otherwise
865
- */
866
- has(mediaType) {
867
- return this.#map.has(mediaType.toLowerCase());
868
- }
869
- /**
870
- * Removes all media types from the header.
871
- */
872
- clear() {
873
- this.#map.clear();
874
- }
875
- /**
876
- * Returns an iterator of all media type and weight pairs.
877
- *
878
- * @returns An iterator of `[mediaType, weight]` tuples
879
- */
880
- entries() {
881
- return this.#map.entries();
882
- }
883
- [Symbol.iterator]() {
884
- return this.entries();
885
- }
886
- /**
887
- * Invokes the callback for each media type and weight pair.
888
- *
889
- * @param callback The function to call for each pair
890
- * @param thisArg The value to use as `this` when calling the callback
891
- */
892
- forEach(callback, thisArg) {
893
- for (let [mediaType, weight] of this) {
894
- callback.call(thisArg, mediaType, weight, this);
895
- }
896
- }
897
- /**
898
- * Returns the string representation of the header value.
899
- *
900
- * @returns The header value as a string
901
- */
902
- toString() {
903
- let pairs = [];
904
- for (let [mediaType, weight] of this.#map) {
905
- pairs.push(`${mediaType}${weight === 1 ? "" : `;q=${weight}`}`);
906
- }
907
- return pairs.join(",");
908
- }
909
- /**
910
- * Parse an Accept header value.
911
- *
912
- * @param value The header value (string, init object, or null)
913
- * @returns An Accept instance (empty if null)
914
- */
915
- static from(value) {
916
- let header = new Accept();
917
- if (value !== null) {
918
- if (typeof value === "string") {
919
- for (let piece of value.split(/\s*,\s*/)) {
920
- let params = parseParams(piece);
921
- if (params.length < 1)
922
- continue;
923
- let mediaType = params[0][0];
924
- let weight = 1;
925
- for (let i = 1; i < params.length; i++) {
926
- let [key, val] = params[i];
927
- if (key === "q") {
928
- weight = Number(val);
929
- break;
930
- }
931
- }
932
- header.#map.set(mediaType.toLowerCase(), weight);
933
- }
934
- } else if (isIterable(value)) {
935
- for (let mediaType of value) {
936
- if (Array.isArray(mediaType)) {
937
- header.#map.set(mediaType[0].toLowerCase(), mediaType[1]);
938
- } else {
939
- header.#map.set(mediaType.toLowerCase(), 1);
940
- }
941
- }
942
- } else {
943
- for (let mediaType of Object.getOwnPropertyNames(value)) {
944
- header.#map.set(mediaType.toLowerCase(), value[mediaType]);
945
- }
946
- }
947
- header.#sort();
948
- }
949
- return header;
950
- }
951
- }
952
-
953
- class ContentDisposition {
954
- filename;
955
- filenameSplat;
956
- name;
957
- type;
958
- constructor(init) {
959
- if (init)
960
- return ContentDisposition.from(init);
961
- }
962
- /**
963
- * The preferred filename for the content, using the `filename*` parameter if present, falling back to the `filename` parameter.
964
- *
965
- * From [RFC 6266](https://tools.ietf.org/html/rfc6266):
966
- *
967
- * Many user agent implementations predating this specification do not understand the "filename*" parameter.
968
- * Therefore, when both "filename" and "filename*" are present in a single header field value, recipients SHOULD
969
- * pick "filename*" and ignore "filename". This way, senders can avoid special-casing specific user agents by
970
- * sending both the more expressive "filename*" parameter, and the "filename" parameter as fallback for legacy recipients.
971
- */
972
- get preferredFilename() {
973
- let filenameSplat = this.filenameSplat;
974
- if (filenameSplat) {
975
- let decodedFilename = decodeFilenameSplat(filenameSplat);
976
- if (decodedFilename)
977
- return decodedFilename;
978
- }
979
- return this.filename;
980
- }
981
- /**
982
- * Returns the string representation of the header value.
983
- *
984
- * @returns The header value as a string
985
- */
986
- toString() {
987
- if (!this.type) {
988
- return "";
989
- }
990
- let parts = [this.type];
991
- if (this.name) {
992
- parts.push(`name=${quote(this.name)}`);
993
- }
994
- if (this.filename) {
995
- parts.push(`filename=${quote(this.filename)}`);
996
- }
997
- if (this.filenameSplat) {
998
- parts.push(`filename*=${quote(this.filenameSplat)}`);
999
- }
1000
- return parts.join("; ");
1001
- }
1002
- /**
1003
- * Parse a Content-Disposition header value.
1004
- *
1005
- * @param value The header value (string, init object, or null)
1006
- * @returns A ContentDisposition instance (empty if null)
1007
- */
1008
- static from(value) {
1009
- let header = new ContentDisposition();
1010
- if (value !== null) {
1011
- if (typeof value === "string") {
1012
- let params = parseParams(value);
1013
- if (params.length > 0) {
1014
- header.type = params[0][0];
1015
- for (let [name, val] of params.slice(1)) {
1016
- if (name === "filename") {
1017
- header.filename = val;
1018
- } else if (name === "filename*") {
1019
- header.filenameSplat = val;
1020
- } else if (name === "name") {
1021
- header.name = val;
1022
- }
1023
- }
1024
- }
1025
- } else {
1026
- header.filename = value.filename;
1027
- header.filenameSplat = value.filenameSplat;
1028
- header.name = value.name;
1029
- header.type = value.type;
1030
- }
1031
- }
1032
- return header;
1033
- }
1034
- }
1035
- function decodeFilenameSplat(value) {
1036
- let match = value.match(/^([\w-]+)'([^']*)'(.+)$/);
1037
- if (!match)
1038
- return null;
1039
- let [, charset, , encodedFilename] = match;
1040
- let decodedFilename = percentDecode(encodedFilename);
1041
- try {
1042
- let decoder = new TextDecoder(charset);
1043
- let bytes = new Uint8Array(decodedFilename.split("").map((char) => char.charCodeAt(0)));
1044
- return decoder.decode(bytes);
1045
- } catch (error) {
1046
- console.warn(`Failed to decode filename from charset ${charset}:`, error);
1047
- return decodedFilename;
1048
- }
1049
- }
1050
- function percentDecode(value) {
1051
- return value.replace(/\+/g, " ").replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => {
1052
- return String.fromCharCode(parseInt(hex, 16));
1053
- });
1054
- }
1055
-
1056
- class ContentType {
1057
- boundary;
1058
- charset;
1059
- mediaType;
1060
- constructor(init) {
1061
- if (init)
1062
- return ContentType.from(init);
1063
- }
1064
- /**
1065
- * Returns the string representation of the header value.
1066
- *
1067
- * @returns The header value as a string
1068
- */
1069
- toString() {
1070
- if (!this.mediaType) {
1071
- return "";
1072
- }
1073
- let parts = [this.mediaType];
1074
- if (this.charset) {
1075
- parts.push(`charset=${quote(this.charset)}`);
1076
- }
1077
- if (this.boundary) {
1078
- parts.push(`boundary=${quote(this.boundary)}`);
1079
- }
1080
- return parts.join("; ");
1081
- }
1082
- /**
1083
- * Parse a Content-Type header value.
1084
- *
1085
- * @param value The header value (string, init object, or null)
1086
- * @returns A ContentType instance (empty if null)
1087
- */
1088
- static from(value) {
1089
- let header = new ContentType();
1090
- if (value !== null) {
1091
- if (typeof value === "string") {
1092
- let params = parseParams(value);
1093
- if (params.length > 0) {
1094
- header.mediaType = params[0][0];
1095
- for (let [name, val] of params.slice(1)) {
1096
- if (name === "boundary") {
1097
- header.boundary = val;
1098
- } else if (name === "charset") {
1099
- header.charset = val;
1100
- }
1101
- }
1102
- }
1103
- } else {
1104
- header.boundary = value.boundary;
1105
- header.charset = value.charset;
1106
- header.mediaType = value.mediaType;
1107
- }
1108
- }
1109
- return header;
1110
- }
1111
- }
1112
-
1113
- const HeaderUtilities = {
1114
- /**
1115
- * Check if client accepts a specific media type based on Accept header.
1116
- * @param acceptHeader HTTP Accept header value
1117
- * @param mediaType Media type to check for acceptance
1118
- * @returns True if the media type is accepted by the client
1119
- */
1120
- acceptsMediaType(acceptHeader, mediaType) {
1121
- const accept = this.parseAccept(acceptHeader);
1122
- return accept ? accept.accepts(mediaType) : false;
1123
- },
1124
- /**
1125
- * Create Cache-Control header value from options.
1126
- * @param options Cache control directives configuration
1127
- * @returns Cache-Control header value string
1128
- */
1129
- createCacheControl(options) {
1130
- const directives = [];
1131
- if (options.public) {
1132
- directives.push("public");
1133
- }
1134
- if (options.private) {
1135
- directives.push("private");
1136
- }
1137
- if (options.noCache) {
1138
- directives.push("no-cache");
1139
- }
1140
- if (options.noStore) {
1141
- directives.push("no-store");
1142
- }
1143
- if (options.immutable) {
1144
- directives.push("immutable");
1145
- }
1146
- if (options.mustRevalidate) {
1147
- directives.push("must-revalidate");
1148
- }
1149
- if (options.proxyRevalidate) {
1150
- directives.push("proxy-revalidate");
1151
- }
1152
- if (options.maxAge !== void 0) {
1153
- directives.push(`max-age=${options.maxAge}`);
1154
- }
1155
- if (options.sMaxAge !== void 0) {
1156
- directives.push(`s-maxage=${options.sMaxAge}`);
1157
- }
1158
- if (options.minFresh !== void 0) {
1159
- directives.push(`min-fresh=${options.minFresh}`);
1160
- }
1161
- if (options.staleWhileRevalidate !== void 0) {
1162
- directives.push(`stale-while-revalidate=${options.staleWhileRevalidate}`);
1163
- }
1164
- if (options.staleIfError !== void 0) {
1165
- directives.push(`stale-if-error=${options.staleIfError}`);
1166
- }
1167
- return directives.join(", ");
1168
- },
1169
- /**
1170
- * Create common cache control presets with predefined configurations.
1171
- * @param preset Preset name ('no-cache', 'no-store', 'public', 'private', or 'immutable')
1172
- * @returns Cache-Control header value string for the preset
1173
- */
1174
- createCacheControlPreset(preset) {
1175
- const presets = {
1176
- immutable: { immutable: true, maxAge: 31536e3 },
1177
- // 1 year
1178
- "no-cache": { noCache: true },
1179
- "no-store": { noStore: true },
1180
- private: { maxAge: 3600, private: true },
1181
- // 1 hour default
1182
- public: { maxAge: 3600, public: true }
1183
- // 1 hour default
1184
- };
1185
- return this.createCacheControl(presets[preset]);
1186
- },
1187
- /**
1188
- * Create Content-Disposition header for file downloads with optional filename.
1189
- * @param options
1190
- * @param options.filename Filename for the download
1191
- * @param options.filenameSplat Alternative filename format
1192
- * @param options.type Disposition type ('inline' or 'attachment')
1193
- * @returns Content-Disposition header value string
1194
- */
1195
- createContentDisposition(options) {
1196
- const disposition = new ContentDisposition({
1197
- type: options.type,
1198
- ...options.filename && { filename: options.filename },
1199
- ...options.filenameSplat && { filenameSplat: options.filenameSplat }
1200
- });
1201
- return disposition.toString();
1202
- },
1203
- /**
1204
- * Create Content-Type header value from structured data with optional charset and boundary.
1205
- * @param options
1206
- * @param options.boundary Multipart boundary string
1207
- * @param options.charset Character encoding (e.g., 'utf8')
1208
- * @param options.mediaType MIME media type (e.g., 'application/json')
1209
- * @returns Content-Type header value string
1210
- */
1211
- createContentType(options) {
1212
- const contentType = new ContentType({
1213
- mediaType: options.mediaType,
1214
- ...options.charset && { charset: options.charset },
1215
- ...options.boundary && { boundary: options.boundary }
1216
- });
1217
- return contentType.toString();
1218
- },
1219
- /**
1220
- * Get content type with charset if not already present.
1221
- * @param contentType Content-Type header value to ensure charset for
1222
- * @param defaultCharset Default charset to use if not present (default: 'utf8')
1223
- * @returns Content-Type header value with charset ensured
1224
- */
1225
- ensureCharset(contentType, defaultCharset = "utf8") {
1226
- const ct = this.parseContentType(contentType);
1227
- if (!ct) {
1228
- return contentType;
1229
- }
1230
- if (!ct.charset) {
1231
- ct.charset = defaultCharset;
1232
- }
1233
- return ct.toString();
1234
- },
1235
- /**
1236
- * Convert our Headers type to native Headers object.
1237
- * @param headers Headers in array or object format
1238
- * @returns Headers instance with converted header values
1239
- */
1240
- fromHeaders(headers) {
1241
- const enhanced = new Headers();
1242
- if (Array.isArray(headers)) {
1243
- headers.forEach(([name, value]) => {
1244
- enhanced.set(name, Array.isArray(value) ? value.join(", ") : String(value));
1245
- });
1246
- } else {
1247
- Object.entries(headers).forEach(([name, value]) => {
1248
- enhanced.set(name, Array.isArray(value) ? value.join(", ") : String(value));
1249
- });
1250
- }
1251
- return enhanced;
1252
- },
1253
- /**
1254
- * Get preferred media type from Accept header based on quality factors and supported types.
1255
- * @param acceptHeader HTTP Accept header value
1256
- * @param supportedTypes Array of supported MIME types to match against
1257
- * @returns Best matching media type or undefined if no match found
1258
- */
1259
- getPreferredMediaType(acceptHeader, supportedTypes) {
1260
- const accept = this.parseAccept(acceptHeader);
1261
- if (!accept) {
1262
- return void 0;
1263
- }
1264
- for (const type of supportedTypes) {
1265
- if (accept.accepts(type)) {
1266
- return type;
1267
- }
1268
- }
1269
- return void 0;
1270
- },
1271
- /**
1272
- * Parse Accept header with quality factor support.
1273
- * @param headerValue HTTP Accept header value to parse
1274
- * @returns Accept instance or undefined if header is invalid or missing
1275
- */
1276
- parseAccept(headerValue) {
1277
- if (!headerValue) {
1278
- return void 0;
1279
- }
1280
- try {
1281
- return new Accept(headerValue);
1282
- } catch {
1283
- return void 0;
1284
- }
1285
- },
1286
- /**
1287
- * Parse Content-Disposition header into structured object.
1288
- * @param headerValue HTTP Content-Disposition header value to parse
1289
- * @returns ContentDisposition instance or undefined if header is invalid or missing
1290
- */
1291
- parseContentDisposition(headerValue) {
1292
- if (!headerValue) {
1293
- return void 0;
1294
- }
1295
- try {
1296
- return new ContentDisposition(headerValue);
1297
- } catch {
1298
- return void 0;
1299
- }
1300
- },
1301
- /**
1302
- * Parse Content-Type header with structured access to media type, charset, and boundary.
1303
- * @param headerValue HTTP Content-Type header value to parse
1304
- * @returns ContentType instance or undefined if header is invalid or missing
1305
- */
1306
- parseContentType(headerValue) {
1307
- if (!headerValue) {
1308
- return void 0;
1309
- }
1310
- try {
1311
- return new ContentType(headerValue);
1312
- } catch {
1313
- return void 0;
1314
- }
1315
- }
1316
- };
1317
-
1318
- export { HeaderUtilities as H, createHttpError as c, httpErrorsExports as h };