@visulima/storage 1.0.0-alpha.17 → 1.0.0-alpha.19

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 (185) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE.md +3 -0
  3. package/dist/adapter/nuxt/module.d.ts +3 -3
  4. package/dist/adapter/nuxt/module.js +1 -93
  5. package/dist/handler/http/fetch/index.d.ts +6 -6
  6. package/dist/handler/http/fetch/index.js +1 -4
  7. package/dist/handler/http/hono/index.d.ts +3 -3
  8. package/dist/handler/http/hono/index.js +1 -65
  9. package/dist/handler/http/nextjs/index.d.ts +4 -4
  10. package/dist/handler/http/nextjs/index.js +1 -37
  11. package/dist/handler/http/node/index.d.ts +6 -6
  12. package/dist/handler/http/node/index.js +1 -8
  13. package/dist/handler/http/solid-start/index.d.ts +4 -4
  14. package/dist/handler/http/solid-start/index.js +1 -44
  15. package/dist/index.js +1 -13
  16. package/dist/openapi/index.js +1 -5
  17. package/dist/packem_shared/AwsLightFile-BTLiRxXj.js +1 -0
  18. package/dist/packem_shared/AwsLightMetaStorage-DHz1nf_H.js +1 -0
  19. package/dist/packem_shared/AwsLightStorage-CA9cdfJ6.js +1 -0
  20. package/dist/packem_shared/AzureFile-BKHru1zB.js +1 -0
  21. package/dist/packem_shared/AzureSMetaStorage-BqA4jUDJ.js +1 -0
  22. package/dist/packem_shared/AzureStorage-BKUjCymW.js +1 -0
  23. package/dist/packem_shared/BaseTransformer-D68eLyz1.js +1 -0
  24. package/dist/packem_shared/DiskStorage-DNjpDMX9.js +1 -0
  25. package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +1 -0
  26. package/dist/packem_shared/ERRORS-B9jkvKwx.js +1 -0
  27. package/dist/packem_shared/File-alcSNpLq.js +1 -0
  28. package/dist/packem_shared/GCSConfig-BQ0OpVhe.js +1 -0
  29. package/dist/packem_shared/GCSFile-CHjX_fJk.js +1 -0
  30. package/dist/packem_shared/GCSMetaStorage-CpxQ8wM9.js +1 -0
  31. package/dist/packem_shared/GCStorage-DAg1V55T.js +1 -0
  32. package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +1 -0
  33. package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +1 -0
  34. package/dist/packem_shared/MetaStorage-Y4m1dWgd.js +1 -0
  35. package/dist/packem_shared/Metadata-B6Ir0KO7.js +1 -0
  36. package/dist/packem_shared/Multipart-Bd9YFFn0.js +1 -0
  37. package/dist/packem_shared/Multipart-D5bcEvga.js +1 -0
  38. package/dist/packem_shared/NetlifyBlobFile-CpzkMKng.js +1 -0
  39. package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +1 -0
  40. package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +1 -0
  41. package/dist/packem_shared/NoOpMetrics-Dky06sf1.js +1 -0
  42. package/dist/packem_shared/OpenTelemetryMetrics-9uxQMSlg.js +1 -0
  43. package/dist/packem_shared/Rest-CYEBbtCD.js +1 -0
  44. package/dist/packem_shared/Rest-DoonVU7B.js +1 -0
  45. package/dist/packem_shared/S3File-Du6wP0Sz.js +1 -0
  46. package/dist/packem_shared/S3MetaStorage-vcriiosn.js +1 -0
  47. package/dist/packem_shared/S3Storage-Fx6-OSc-.js +1 -0
  48. package/dist/packem_shared/TUS_RESUMABLE-B7KtPVeC.js +1 -0
  49. package/dist/packem_shared/Tus-Bd_2Ki2G.js +1 -0
  50. package/dist/packem_shared/Tus-CUBCkuPE.js +1 -0
  51. package/dist/packem_shared/ValidationError-D8KKJiKA.js +1 -0
  52. package/dist/packem_shared/VercelBlobFile-CL9MjKcY.js +1 -0
  53. package/dist/packem_shared/VercelBlobMetaStorage-BsOTx-Su.js +1 -0
  54. package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +1 -0
  55. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  56. package/dist/packem_shared/aws-light-meta-storage-TPyQwLvk.js +4 -0
  57. package/dist/packem_shared/backblaze-DEflv87m.js +1 -0
  58. package/dist/packem_shared/base-handler-core-DaggCVsq.js +1 -0
  59. package/dist/packem_shared/base-handler-fetch-DnarP64X.js +1 -0
  60. package/dist/packem_shared/base-handler-node-BTes6sql.js +1 -0
  61. package/dist/packem_shared/cache-qV_5Umeq.js +1 -0
  62. package/dist/packem_shared/cloudflare-DLAeQvgD.js +1 -0
  63. package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +1 -0
  64. package/dist/packem_shared/digitalOcean-nhZUds87.js +1 -0
  65. package/dist/packem_shared/disk-storage-BvdK4bqF.js +5 -0
  66. package/dist/packem_shared/gcs-meta-storage-CvGkpzVE.js +1 -0
  67. package/dist/packem_shared/has-content-Bx2p8Okx.js +1 -0
  68. package/dist/packem_shared/headers-DC2MEOrK.js +27 -0
  69. package/dist/packem_shared/is-expired-1JuZjDtb.js +1 -0
  70. package/dist/packem_shared/isRetryableError-DQNSZiBc.js +1 -0
  71. package/dist/packem_shared/isValidMediaType-B-2UKjZx.js +1 -0
  72. package/dist/packem_shared/local-meta-storage-Bkwqi_gi.js +1 -0
  73. package/dist/packem_shared/{media-transformer.d-ChmjTvjc.d.ts → media-transformer.d-CY9CsEOe.d.ts} +1 -1
  74. package/dist/packem_shared/minio-BWwgGXeE.js +1 -0
  75. package/dist/packem_shared/multipart-base-C6OjBwMS.js +1 -0
  76. package/dist/packem_shared/part-match-DqD5U7An.js +1 -0
  77. package/dist/packem_shared/path-D7rMc9nq-B718mbm6.js +1 -0
  78. package/dist/packem_shared/response-builder-Wdo_fvcF.js +1 -0
  79. package/dist/packem_shared/rest-base-B2Dv7esY.js +1 -0
  80. package/dist/packem_shared/restOpenApiSpec-PaIVbESh.js +1 -0
  81. package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +1 -0
  82. package/dist/packem_shared/sharedGet-Ce7WGAsc.js +1 -0
  83. package/dist/packem_shared/storage-m_Cxgiih.js +1 -0
  84. package/dist/packem_shared/tigris-DZoyrMNd.js +1 -0
  85. package/dist/packem_shared/transformOpenApiSpec-C0vEbDTO.js +1 -0
  86. package/dist/packem_shared/{tus-base.d-CpLzyd-S.d.ts → tus-base.d-DNZRXR9X.d.ts} +2 -2
  87. package/dist/packem_shared/tusOpenApiSpec-DF0-hlWV.js +1 -0
  88. package/dist/packem_shared/{types.d-DBjmJvIT.d.ts → types.d-BCN94sB_.d.ts} +1 -1
  89. package/dist/packem_shared/{types.d-DviSTLOg.d.ts → types.d-D4caL2Fp.d.ts} +1 -1
  90. package/dist/packem_shared/update-size-DANV7aa2.js +1 -0
  91. package/dist/packem_shared/validator-DK41xp8N.js +1 -0
  92. package/dist/packem_shared/waitForStorage-ChSBLhLc.js +1 -0
  93. package/dist/packem_shared/wasabi-Dmce4x9s.js +1 -0
  94. package/dist/packem_shared/xhrOpenApiSpec-nyoboz83.js +1 -0
  95. package/dist/storage/aws/clients/index.js +1 -6
  96. package/dist/storage/aws/index.js +1 -3
  97. package/dist/storage/aws-light/index.js +1 -3
  98. package/dist/storage/azure/index.js +1 -3
  99. package/dist/storage/gcs/index.js +1 -4
  100. package/dist/storage/local/index.js +1 -3
  101. package/dist/storage/netlify-blob/index.js +1 -3
  102. package/dist/storage/vercel-blob/index.js +1 -3
  103. package/dist/transformer/audio-transformer.d.ts +1 -1
  104. package/dist/transformer/audio-transformer.js +1 -278
  105. package/dist/transformer/image-transformer.d.ts +1 -1
  106. package/dist/transformer/image-transformer.js +1 -1100
  107. package/dist/transformer/index.d.ts +2 -2
  108. package/dist/transformer/index.js +1 -4
  109. package/dist/transformer/video-transformer.d.ts +1 -1
  110. package/dist/transformer/video-transformer.js +1 -310
  111. package/package.json +18 -18
  112. package/dist/packem_shared/AwsLightFile-C-Nd5rtl.js +0 -11
  113. package/dist/packem_shared/AwsLightMetaStorage-BIDb5EPg.js +0 -4
  114. package/dist/packem_shared/AwsLightStorage-CMuKw4bI.js +0 -133
  115. package/dist/packem_shared/AzureFile-C0kug4w4.js +0 -8
  116. package/dist/packem_shared/AzureSMetaStorage-BEbXX9Uk.js +0 -89
  117. package/dist/packem_shared/AzureStorage-98-LRZ1e.js +0 -359
  118. package/dist/packem_shared/BaseTransformer-9965D4pb.js +0 -83
  119. package/dist/packem_shared/DiskStorage-COMe_G42.js +0 -12
  120. package/dist/packem_shared/DiskStorageWithChecksum-BVaaZiyS.js +0 -249
  121. package/dist/packem_shared/ERRORS-D0apMqnc.js +0 -97
  122. package/dist/packem_shared/File-CPUhj3DI.js +0 -69
  123. package/dist/packem_shared/GCSConfig-vPP22kN6.js +0 -11
  124. package/dist/packem_shared/GCSFile-DaDiCKE2.js +0 -8
  125. package/dist/packem_shared/GCSMetaStorage-BygVH0Ee.js +0 -7
  126. package/dist/packem_shared/GCStorage-4hSx_bN1.js +0 -410
  127. package/dist/packem_shared/LocalMetaStorage-DvnZqf61.js +0 -7
  128. package/dist/packem_shared/MediaTransformer-BRRqYA0E.js +0 -1202
  129. package/dist/packem_shared/MetaStorage-pECeFOad.js +0 -46
  130. package/dist/packem_shared/Metadata-DRLXeJ0F.js +0 -89
  131. package/dist/packem_shared/Multipart-BzzvNxt4.js +0 -128
  132. package/dist/packem_shared/Multipart-DLtFLQ8s.js +0 -163
  133. package/dist/packem_shared/NetlifyBlobFile-CfyJtGWN.js +0 -14
  134. package/dist/packem_shared/NetlifyBlobMetaStorage-eJT6RFy9.js +0 -9
  135. package/dist/packem_shared/NetlifyBlobStorage-nPv7iIAG.js +0 -376
  136. package/dist/packem_shared/NoOpMetrics-DhAk5rXc.js +0 -10
  137. package/dist/packem_shared/OpenTelemetryMetrics-BnxhqIaH.js +0 -67
  138. package/dist/packem_shared/Rest-DEa7IA9R.js +0 -267
  139. package/dist/packem_shared/Rest-qhMbCn5a.js +0 -228
  140. package/dist/packem_shared/S3File-BXCuJaQZ.js +0 -11
  141. package/dist/packem_shared/S3MetaStorage-yT4CznlV.js +0 -77
  142. package/dist/packem_shared/S3Storage-wi5XT-yu.js +0 -317
  143. package/dist/packem_shared/TUS_RESUMABLE-Dtfsffnj.js +0 -434
  144. package/dist/packem_shared/Tus-Ck0Hdle5.js +0 -195
  145. package/dist/packem_shared/Tus-_0vCdHyB.js +0 -200
  146. package/dist/packem_shared/ValidationError-BfF1aE4h.js +0 -26
  147. package/dist/packem_shared/VercelBlobFile-DkFIIb9Q.js +0 -18
  148. package/dist/packem_shared/VercelBlobMetaStorage-DjFmi4vp.js +0 -9
  149. package/dist/packem_shared/VercelBlobStorage-CmMgiDgr.js +0 -261
  150. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  151. package/dist/packem_shared/aws-light-meta-storage-BGZEiY3y.js +0 -447
  152. package/dist/packem_shared/backblaze-BlMnIcBC.js +0 -20
  153. package/dist/packem_shared/base-handler-core-lVB-D59L.js +0 -306
  154. package/dist/packem_shared/base-handler-fetch-CitgN-Aw.js +0 -291
  155. package/dist/packem_shared/base-handler-node-BiO2DF87.js +0 -731
  156. package/dist/packem_shared/cache-B88MXQ_2.js +0 -18
  157. package/dist/packem_shared/cloudflare-Bi1q8wXE.js +0 -21
  158. package/dist/packem_shared/defaultCloudStorageFileNameValidation-Brw40ZEP.js +0 -11
  159. package/dist/packem_shared/digitalOcean-CWQRJM3L.js +0 -21
  160. package/dist/packem_shared/disk-storage-D9RfoKjW.js +0 -832
  161. package/dist/packem_shared/gcs-meta-storage-8FovEDbW.js +0 -159
  162. package/dist/packem_shared/has-content-CY66ehMK.js +0 -3
  163. package/dist/packem_shared/headers-YLRp1dLo.js +0 -1318
  164. package/dist/packem_shared/is-expired-CTThU1q5.js +0 -8
  165. package/dist/packem_shared/isRetryableError-Dycp7127.js +0 -82
  166. package/dist/packem_shared/isValidMediaType-BeDgiObq.js +0 -35
  167. package/dist/packem_shared/local-meta-storage-D-pPc3FI.js +0 -658
  168. package/dist/packem_shared/minio-C2YBZQOw.js +0 -22
  169. package/dist/packem_shared/multipart-base-C994naBi.js +0 -102
  170. package/dist/packem_shared/part-match-Dt738Ddb.js +0 -96
  171. package/dist/packem_shared/path-aV9lMdcn-DMU5H1-h.js +0 -162
  172. package/dist/packem_shared/response-builder-BtnRiBUI.js +0 -45
  173. package/dist/packem_shared/rest-base-k1ory8uB.js +0 -457
  174. package/dist/packem_shared/restOpenApiSpec-BBJ_SiPE.js +0 -800
  175. package/dist/packem_shared/s3-base-storage-zUO8u8Cp.js +0 -510
  176. package/dist/packem_shared/sharedGet-CkSLSnMd.js +0 -1022
  177. package/dist/packem_shared/storage-5XW1E7XU.js +0 -1188
  178. package/dist/packem_shared/tigris-Hac8TKnX.js +0 -21
  179. package/dist/packem_shared/transformOpenApiSpec-BodFhFls.js +0 -975
  180. package/dist/packem_shared/tusOpenApiSpec-DzppyJTW.js +0 -740
  181. package/dist/packem_shared/update-size-CCGm6i1J.js +0 -8
  182. package/dist/packem_shared/validator-DuO17wFF.js +0 -79
  183. package/dist/packem_shared/waitForStorage-Cscw85sx.js +0 -18
  184. package/dist/packem_shared/wasabi-DIyflHSd.js +0 -21
  185. package/dist/packem_shared/xhrOpenApiSpec-CXz7BC5J.js +0 -264
@@ -0,0 +1,27 @@
1
+ var ke=Object.defineProperty;var n=(a,e)=>ke(a,"name",{value:e,configurable:!0});import{g as Ne}from"./_commonjsHelpers-D6W6KoPK.js";import Re from"path";var V={exports:{}},J,pe;function Me(){if(pe)return J;pe=1;var a=Object.defineProperty,e=n((i,o)=>a(i,"name",{value:o,configurable:!0}),"i");/*!
2
+ * depd
3
+ * Copyright(c) 2014-2018 Douglas Christopher Wilson
4
+ * MIT Licensed
5
+ */var t=Re.relative;J=d;var r=process.cwd();function s(i,o){for(var f=i.split(/[ ,]+/),c=String(o).toLowerCase(),l=0;l<f.length;l++){var w=f[l];if(w&&(w==="*"||w.toLowerCase()===c))return!0}return!1}n(s,"containsNamespace"),e(s,"containsNamespace");function u(i,o,f){var c=Object.getOwnPropertyDescriptor(i,o),l=c.value;return c.get=e(function(){return l},"getter"),c.writable&&(c.set=e(function(w){return l=w},"setter")),delete c.value,delete c.writable,Object.defineProperty(i,o,c),c}n(u,"convertDataDescriptorToAccessor"),e(u,"convertDataDescriptorToAccessor");function p(i){for(var o="",f=0;f<i;f++)o+=", arg"+f;return o.substr(2)}n(p,"createArgumentsString"),e(p,"createArgumentsString");function m(i){var o=this.name+": "+this.namespace;this.message&&(o+=" deprecated "+this.message);for(var f=0;f<i.length;f++)o+=`
6
+ at `+i[f].toString();return o}n(m,"createStackString"),e(m,"createStackString");function d(i){if(!i)throw new TypeError("argument namespace is required");var o=b(),f=P(o[1]),c=f[0];function l(w){O.call(l,w)}return n(l,"t"),e(l,"deprecate"),l._file=c,l._ignored=x(i),l._namespace=i,l._traced=$(i),l._warned=Object.create(null),l.function=C,l.property=v,l}n(d,"depd"),e(d,"depd");function y(i,o){var f=typeof i.listenerCount!="function"?i.listeners(o).length:i.listenerCount(o);return f>0}n(y,"eehaslisteners"),e(y,"eehaslisteners");function x(i){if(process.noDeprecation)return!0;var o=process.env.NO_DEPRECATION||"";return s(o,i)}n(x,"isignored"),e(x,"isignored");function $(i){if(process.traceDeprecation)return!0;var o=process.env.TRACE_DEPRECATION||"";return s(o,i)}n($,"istraced"),e($,"istraced");function O(i,o){var f=y(process,"deprecation");if(!(!f&&this._ignored)){var c,l,w,j,T=0,q=!1,R=b(),_=this._file;for(o?(j=o,w=P(R[1]),w.name=j.name,_=w[0]):(T=2,j=P(R[T]),w=j);T<R.length;T++)if(c=P(R[T]),l=c[0],l===_)q=!0;else if(l===this._file)_=this._file;else if(q)break;var G=c?j.join(":")+"__"+c.join(":"):void 0;if(!(G!==void 0&&G in this._warned)){this._warned[G]=!0;var H=i;if(H||(H=w===j||!w.name?k(j):k(w)),f){var Te=S(this._namespace,H,R.slice(T));process.emit("deprecation",Te);return}var Ae=process.stderr.isTTY?N:I,Le=Ae.call(this,H,c,R.slice(T));process.stderr.write(Le+`
7
+ `,"utf8")}}}n(O,"log"),e(O,"log");function P(i){var o=i.getFileName()||"<anonymous>",f=i.getLineNumber(),c=i.getColumnNumber();i.isEval()&&(o=i.getEvalOrigin()+", "+o);var l=[o,f,c];return l.callSite=i,l.name=i.getFunctionName(),l}n(P,"callSiteLocation"),e(P,"callSiteLocation");function k(i){var o=i.callSite,f=i.name;f||(f="<anonymous@"+h(i)+">");var c=o.getThis(),l=c&&o.getTypeName();return l==="Object"&&(l=void 0),l==="Function"&&(l=c.name||l),l&&o.getMethodName()?l+"."+f:f}n(k,"defaultMessage"),e(k,"defaultMessage");function I(i,o,f){var c=new Date().toUTCString(),l=c+" "+this._namespace+" deprecated "+i;if(this._traced){for(var w=0;w<f.length;w++)l+=`
8
+ at `+f[w].toString();return l}return o&&(l+=" at "+h(o)),l}n(I,"formatPlain"),e(I,"formatPlain");function N(i,o,f){var c="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+i+"\x1B[39m";if(this._traced){for(var l=0;l<f.length;l++)c+=`
9
+ \x1B[36mat `+f[l].toString()+"\x1B[39m";return c}return o&&(c+=" \x1B[36m"+h(o)+"\x1B[39m"),c}n(N,"formatColor"),e(N,"formatColor");function h(i){return t(r,i[0])+":"+i[1]+":"+i[2]}n(h,"formatLocation"),e(h,"formatLocation");function b(){var i=Error.stackTraceLimit,o={},f=Error.prepareStackTrace;Error.prepareStackTrace=g,Error.stackTraceLimit=Math.max(10,i),Error.captureStackTrace(o);var c=o.stack.slice(1);return Error.prepareStackTrace=f,Error.stackTraceLimit=i,c}n(b,"getStack"),e(b,"getStack");function g(i,o){return o}n(g,"prepareObjectStackTrace"),e(g,"prepareObjectStackTrace");function C(i,o){if(typeof i!="function")throw new TypeError("argument fn must be a function");var f=p(i.length),c=b(),l=P(c[1]);l.name=i.name;var w=new Function("fn","log","deprecate","message","site",`"use strict"
10
+ return function (`+f+`) {log.call(deprecate, message, site)
11
+ return fn.apply(this, arguments)
12
+ }`)(i,O,this,o,l);return w}n(C,"wrapfunction"),e(C,"wrapfunction");function v(i,o,f){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("argument obj must be object");var c=Object.getOwnPropertyDescriptor(i,o);if(!c)throw new TypeError("must call property on owner object");if(!c.configurable)throw new TypeError("property must be configurable");var l=this,w=b(),j=P(w[1]);j.name=o,"value"in c&&(c=u(i,o));var T=c.get,q=c.set;typeof T=="function"&&(c.get=e(function(){return O.call(l,f,j),T.apply(this,arguments)},"getter")),typeof q=="function"&&(c.set=e(function(){return O.call(l,f,j),q.apply(this,arguments)},"setter")),Object.defineProperty(i,o,c)}n(v,"wrapproperty"),e(v,"wrapproperty");function S(i,o,f){var c=new Error,l;return Object.defineProperty(c,"constructor",{value:S}),Object.defineProperty(c,"message",{configurable:!0,enumerable:!1,value:o,writable:!0}),Object.defineProperty(c,"name",{enumerable:!1,configurable:!0,value:"DeprecationError",writable:!0}),Object.defineProperty(c,"namespace",{configurable:!0,enumerable:!1,value:i,writable:!0}),Object.defineProperty(c,"stack",{configurable:!0,enumerable:!1,get:e(function(){return l!==void 0?l:l=m.call(this,f)},"get"),set:e(function(w){l=w},"setter")}),c}return n(S,"DeprecationError"),e(S,"DeprecationError"),J}n(Me,"requireDepd");var X,he;function Ie(){if(he)return X;he=1;var a=Object.defineProperty,e=n((s,u)=>a(s,"name",{value:u,configurable:!0}),"n");X=Object.setPrototypeOf||({__proto__:[]}instanceof Array?t:r);function t(s,u){return s.__proto__=u,s}n(t,"setProtoOf"),e(t,"setProtoOf");function r(s,u){for(var p in u)Object.prototype.hasOwnProperty.call(s,p)||(s[p]=u[p]);return s}return n(r,"mixinProperties"),e(r,"mixinProperties"),X}n(Ie,"requireSetprototypeof");var K,me;function qe(){return me||(me=1,K={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),K}n(qe,"requireCodes");var Y,de;function De(){if(de)return Y;de=1;var a=Object.defineProperty,e=n((d,y)=>a(d,"name",{value:y,configurable:!0}),"r");/*!
13
+ * statuses
14
+ * Copyright(c) 2014 Jonathan Ong
15
+ * Copyright(c) 2016 Douglas Christopher Wilson
16
+ * MIT Licensed
17
+ */var t=qe();Y=m,m.message=t,m.code=r(t),m.codes=s(t),m.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},m.empty={204:!0,205:!0,304:!0},m.retry={502:!0,503:!0,504:!0};function r(d){var y={};return Object.keys(d).forEach(e(function(x){var $=d[x],O=Number(x);y[$.toLowerCase()]=O},"forEachCode")),y}n(r,"createMessageToStatusCodeMap"),e(r,"createMessageToStatusCodeMap");function s(d){return Object.keys(d).map(e(function(y){return Number(y)},"mapCode"))}n(s,"createStatusCodeList"),e(s,"createStatusCodeList");function u(d){var y=d.toLowerCase();if(!Object.prototype.hasOwnProperty.call(m.code,y))throw new Error('invalid status message: "'+d+'"');return m.code[y]}n(u,"getStatusCode"),e(u,"getStatusCode");function p(d){if(!Object.prototype.hasOwnProperty.call(m.message,d))throw new Error("invalid status code: "+d);return m.message[d]}n(p,"getStatusMessage"),e(p,"getStatusMessage");function m(d){if(typeof d=="number")return p(d);if(typeof d!="string")throw new TypeError("code must be a number or string");var y=parseInt(d,10);return isNaN(y)?u(d):p(y)}return n(m,"status"),e(m,"status"),Y}n(De,"requireStatuses");var z={exports:{}},U={exports:{}},ge;function Fe(){if(ge)return U.exports;ge=1;var a=Object.defineProperty,e=n((t,r)=>a(t,"name",{value:r,configurable:!0}),"o");return typeof Object.create=="function"?U.exports=e(function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):U.exports=e(function(t,r){if(r){t.super_=r;var s=e(function(){},"TempCtor");s.prototype=r.prototype,t.prototype=new s,t.prototype.constructor=t}},"inherits"),U.exports}n(Fe,"requireInherits_browser");var ve;function We(){if(ve)return z.exports;ve=1;try{var a=require("util");if(typeof a.inherits!="function")throw"";z.exports=a.inherits}catch{z.exports=Fe()}return z.exports}n(We,"requireInherits");var Q,ye;function He(){if(ye)return Q;ye=1;var a=Object.defineProperty,e=n((r,s)=>a(r,"name",{value:s,configurable:!0}),"t");/*!
18
+ * toidentifier
19
+ * Copyright(c) 2016 Douglas Christopher Wilson
20
+ * MIT Licensed
21
+ */Q=t;function t(r){return r.split(" ").map(function(s){return s.slice(0,1).toUpperCase()+s.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}return n(t,"toIdentifier"),e(t,"toIdentifier"),Q}n(He,"requireToidentifier");var be;function ze(){return be||(be=1,(function(a){var e=Object.defineProperty,t=n((h,b)=>e(h,"name",{value:b,configurable:!0}),"u");/*!
22
+ * http-errors
23
+ * Copyright(c) 2014 Jonathan Ong
24
+ * Copyright(c) 2016 Douglas Christopher Wilson
25
+ * MIT Licensed
26
+ */var r=Me()("http-errors"),s=Ie(),u=De(),p=We(),m=He();a.exports=y,a.exports.HttpError=x(),a.exports.isHttpError=O(a.exports.HttpError),I(a.exports,u.codes,a.exports.HttpError);function d(h){return+(String(h).charAt(0)+"00")}n(d,"codeClass"),t(d,"codeClass");function y(){for(var h,b,g=500,C={},v=0;v<arguments.length;v++){var S=arguments[v],i=typeof S;if(i==="object"&&S instanceof Error)h=S,g=h.status||h.statusCode||g;else if(i==="number"&&v===0)g=S;else if(i==="string")b=S;else if(i==="object")C=S;else throw new TypeError("argument #"+(v+1)+" unsupported type "+i)}typeof g=="number"&&(g<400||g>=600)&&r("non-error status code; use only 4xx or 5xx status codes"),(typeof g!="number"||!u.message[g]&&(g<400||g>=600))&&(g=500);var o=y[g]||y[d(g)];h||(h=o?new o(b):new Error(b||u.message[g]),Error.captureStackTrace(h,y)),(!o||!(h instanceof o)||h.status!==g)&&(h.expose=g<500,h.status=h.statusCode=g);for(var f in C)f!=="status"&&f!=="statusCode"&&(h[f]=C[f]);return h}n(y,"createError"),t(y,"createError");function x(){function h(){throw new TypeError("cannot construct abstract class")}return n(h,"e"),t(h,"HttpError"),p(h,Error),h}n(x,"createHttpErrorConstructor"),t(x,"createHttpErrorConstructor");function $(h,b,g){var C=N(b);function v(S){var i=S??u.message[g],o=new Error(i);return Error.captureStackTrace(o,v),s(o,v.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:i,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:C,writable:!0}),o}return n(v,"t"),t(v,"ClientError"),p(v,h),k(v,C),v.prototype.status=g,v.prototype.statusCode=g,v.prototype.expose=!0,v}n($,"createClientErrorConstructor"),t($,"createClientErrorConstructor");function O(h){return t(function(b){return!b||typeof b!="object"?!1:b instanceof h?!0:b instanceof Error&&typeof b.expose=="boolean"&&typeof b.statusCode=="number"&&b.status===b.statusCode},"isHttpError")}n(O,"createIsHttpErrorFunction"),t(O,"createIsHttpErrorFunction");function P(h,b,g){var C=N(b);function v(S){var i=S??u.message[g],o=new Error(i);return Error.captureStackTrace(o,v),s(o,v.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:i,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:C,writable:!0}),o}return n(v,"t"),t(v,"ServerError"),p(v,h),k(v,C),v.prototype.status=g,v.prototype.statusCode=g,v.prototype.expose=!1,v}n(P,"createServerErrorConstructor"),t(P,"createServerErrorConstructor");function k(h,b){var g=Object.getOwnPropertyDescriptor(h,"name");g&&g.configurable&&(g.value=b,Object.defineProperty(h,"name",g))}n(k,"nameFunc"),t(k,"nameFunc");function I(h,b,g){b.forEach(t(function(C){var v,S=m(u.message[C]);switch(d(C)){case 400:v=$(g,S,C);break;case 500:v=P(g,S,C);break}v&&(h[C]=v,h[S]=v)},"forEachCode"))}n(I,"populateConstructorExports"),t(I,"populateConstructorExports");function N(h){return h.slice(-5)==="Error"?h:h+"Error"}n(N,"toClassName"),t(N,"toClassName")})(V)),V.exports}n(ze,"requireHttpErrors");var Ue=ze();const Tt=Ne(Ue);var Be=Object.defineProperty,we=n((a,e)=>Be(a,"name",{value:e,configurable:!0}),"t$2");function A(a,e=";"){let t=e===";"?/(?:^|;)\s*([^=;\s]+)(\s*=\s*(?:"((?:[^"\\]|\\.)*)"|((?:[^;]|\\\;)+))?)?/g:/(?:^|,)\s*([^=,\s]+)(\s*=\s*(?:"((?:[^"\\]|\\.)*)"|((?:[^,]|\\\,)+))?)?/g,r=[],s;for(;(s=t.exec(a))!==null;){let u=s[1].trim(),p;s[2]&&(p=(s[3]||s[4]||"").replace(/\\(.)/g,"$1").trim()),r.push([u,p])}return r}n(A,"parseParams");we(A,"parseParams");function L(a){return a.includes('"')||a.includes(";")||a.includes(" ")?`"${a.replace(/"/g,'\\"')}"`:a}n(L,"quote");we(L,"quote");var _e=Object.defineProperty,M=n((a,e)=>_e(a,"name",{value:e,configurable:!0}),"t$1");function Ce(a){return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()}n(Ce,"capitalize");M(Ce,"capitalize");function W(a){return a!=null&&typeof a[Symbol.iterator]=="function"}n(W,"isIterable");M(W,"isIterable");function Se(a){return a instanceof Date&&!isNaN(a.getTime())}n(Se,"isValidDate");M(Se,"isValidDate");function E(a){return a==="*"||/^(W\/)?".*"$/.test(a)?a:`"${a}"`}n(E,"quoteEtag");M(E,"quoteEtag");function Z(a){let e=a instanceof Date?a.getTime():a;return Math.floor(e/1e3)}n(Z,"removeMilliseconds");M(Z,"removeMilliseconds");const Ge=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT$/;function xe(a){if(!Ge.test(a))return null;let e=Date.parse(a);return isNaN(e)?null:e}n(xe,"parseHttpDate");M(xe,"parseHttpDate");var Ve=Object.defineProperty,Je=n((a,e)=>Ve(a,"name",{value:e,configurable:!0}),"l$3");class B{static{n(this,"Accept")}static{Je(this,"Accept")}#e;constructor(e){if(e)return B.from(e);this.#e=new Map}#t(){this.#e=new Map([...this.#e].sort((e,t)=>t[1]-e[1]))}get mediaTypes(){return Array.from(this.#e.keys())}get weights(){return Array.from(this.#e.values())}get size(){return this.#e.size}accepts(e){return this.getWeight(e)>0}getWeight(e){let[t,r]=e.toLowerCase().split("/");for(let[s,u]of this){let[p,m]=s.split("/");if((p===t||p==="*"||t==="*")&&(m===r||m==="*"||r==="*"))return u}return 0}getPreferred(e){let t=e.map(r=>[r,this.getWeight(r)]).sort((r,s)=>s[1]-r[1])[0];return t!==void 0&&t[1]>0?t[0]:null}get(e){return this.#e.get(e.toLowerCase())??null}set(e,t=1){this.#e.set(e.toLowerCase(),t),this.#t()}delete(e){this.#e.delete(e.toLowerCase())}has(e){return this.#e.has(e.toLowerCase())}clear(){this.#e.clear()}entries(){return this.#e.entries()}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[r,s]of this)e.call(t,r,s,this)}toString(){let e=[];for(let[t,r]of this.#e)e.push(`${t}${r===1?"":`;q=${r}`}`);return e.join(",")}static from(e){let t=new B;if(e!==null){if(typeof e=="string")for(let r of e.split(/\s*,\s*/)){let s=A(r);if(s.length<1)continue;let u=s[0][0],p=1;for(let m=1;m<s.length;m++){let[d,y]=s[m];if(d==="q"){p=Number(y);break}}t.#e.set(u.toLowerCase(),p)}else if(W(e))for(let r of e)Array.isArray(r)?t.#e.set(r[0].toLowerCase(),r[1]):t.#e.set(r.toLowerCase(),1);else for(let r of Object.getOwnPropertyNames(e))t.#e.set(r.toLowerCase(),e[r]);t.#t()}return t}}var Xe=Object.defineProperty,Ke=n((a,e)=>Xe(a,"name",{value:e,configurable:!0}),"h$1");class ee{static{n(this,"AcceptEncoding")}static{Ke(this,"AcceptEncoding")}#e;constructor(e){if(e)return ee.from(e);this.#e=new Map}#t(){this.#e=new Map([...this.#e].sort((e,t)=>t[1]-e[1]))}get encodings(){return Array.from(this.#e.keys())}get weights(){return Array.from(this.#e.values())}get size(){return this.#e.size}accepts(e){return e.toLowerCase()==="identity"||this.getWeight(e)>0}getWeight(e){let t=e.toLowerCase();for(let[r,s]of this)if(r===t||r==="*"||t==="*")return s;return 0}getPreferred(e){let t=e.map(r=>[r,this.getWeight(r)]).sort((r,s)=>s[1]-r[1])[0];return t!==void 0&&t[1]>0?t[0]:null}get(e){return this.#e.get(e.toLowerCase())??null}set(e,t=1){this.#e.set(e.toLowerCase(),t),this.#t()}delete(e){this.#e.delete(e.toLowerCase())}has(e){return this.#e.has(e.toLowerCase())}clear(){this.#e.clear()}entries(){return this.#e.entries()}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[r,s]of this)e.call(t,r,s,this)}toString(){let e=[];for(let[t,r]of this.#e)e.push(`${t}${r===1?"":`;q=${r}`}`);return e.join(",")}static from(e){let t=new ee;if(e!==null){if(typeof e=="string")for(let r of e.split(/\s*,\s*/)){let s=A(r);if(s.length<1)continue;let u=s[0][0],p=1;for(let m=1;m<s.length;m++){let[d,y]=s[m];if(d==="q"){p=Number(y);break}}t.#e.set(u.toLowerCase(),p)}else if(W(e))for(let r of e)Array.isArray(r)?t.#e.set(r[0].toLowerCase(),r[1]):t.#e.set(r.toLowerCase(),1);else for(let r of Object.getOwnPropertyNames(e))t.#e.set(r.toLowerCase(),e[r]);t.#t()}return t}}var Ye=Object.defineProperty,Qe=n((a,e)=>Ye(a,"name",{value:e,configurable:!0}),"l$2");class te{static{n(this,"AcceptLanguage")}static{Qe(this,"AcceptLanguage")}#e;constructor(e){if(e)return te.from(e);this.#e=new Map}#t(){this.#e=new Map([...this.#e].sort((e,t)=>t[1]-e[1]))}get languages(){return Array.from(this.#e.keys())}get weights(){return Array.from(this.#e.values())}get size(){return this.#e.size}accepts(e){return this.getWeight(e)>0}getWeight(e){let[t,r]=e.toLowerCase().split("-");for(let[s,u]of this){let[p,m]=s.split("-");if((p===t||p==="*"||t==="*")&&(m===r||m===void 0||r===void 0))return u}return 0}getPreferred(e){let t=e.map(r=>[r,this.getWeight(r)]).sort((r,s)=>s[1]-r[1])[0];return t!==void 0&&t[1]>0?t[0]:null}get(e){return this.#e.get(e.toLowerCase())??null}set(e,t=1){this.#e.set(e.toLowerCase(),t),this.#t()}delete(e){this.#e.delete(e.toLowerCase())}has(e){return this.#e.has(e.toLowerCase())}clear(){this.#e.clear()}entries(){return this.#e.entries()}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[r,s]of this)e.call(t,r,s,this)}toString(){let e=[];for(let[t,r]of this.#e)e.push(`${t}${r===1?"":`;q=${r}`}`);return e.join(",")}static from(e){let t=new te;if(e!==null){if(typeof e=="string")for(let r of e.split(/\s*,\s*/)){let s=A(r);if(s.length<1)continue;let u=s[0][0],p=1;for(let m=1;m<s.length;m++){let[d,y]=s[m];if(d==="q"){p=Number(y);break}}t.#e.set(u.toLowerCase(),p)}else if(W(e))for(let r of e)Array.isArray(r)?t.#e.set(r[0].toLowerCase(),r[1]):t.#e.set(r.toLowerCase(),1);else for(let r of Object.getOwnPropertyNames(e))t.#e.set(r.toLowerCase(),e[r]);t.#t()}return t}}var Ze=Object.defineProperty,et=n((a,e)=>Ze(a,"name",{value:e,configurable:!0}),"s$2");class re{static{n(this,"CacheControl")}static{et(this,"CacheControl")}maxAge;maxStale;minFresh;sMaxage;noCache;noStore;noTransform;onlyIfCached;mustRevalidate;proxyRevalidate;mustUnderstand;private;public;immutable;staleWhileRevalidate;staleIfError;constructor(e){if(e)return re.from(e)}toString(){let e=[];return this.public&&e.push("public"),this.private&&e.push("private"),typeof this.maxAge=="number"&&e.push(`max-age=${this.maxAge}`),typeof this.sMaxage=="number"&&e.push(`s-maxage=${this.sMaxage}`),this.noCache&&e.push("no-cache"),this.noStore&&e.push("no-store"),this.noTransform&&e.push("no-transform"),this.onlyIfCached&&e.push("only-if-cached"),this.mustRevalidate&&e.push("must-revalidate"),this.proxyRevalidate&&e.push("proxy-revalidate"),this.mustUnderstand&&e.push("must-understand"),this.immutable&&e.push("immutable"),typeof this.staleWhileRevalidate=="number"&&e.push(`stale-while-revalidate=${this.staleWhileRevalidate}`),typeof this.staleIfError=="number"&&e.push(`stale-if-error=${this.staleIfError}`),typeof this.maxStale=="number"&&e.push(`max-stale=${this.maxStale}`),typeof this.minFresh=="number"&&e.push(`min-fresh=${this.minFresh}`),e.join(", ")}static from(e){let t=new re;if(e!==null)if(typeof e=="string"){let r=A(e,",");if(r.length>0)for(let[s,u]of r)switch(s){case"max-age":t.maxAge=Number(u);break;case"max-stale":t.maxStale=Number(u);break;case"min-fresh":t.minFresh=Number(u);break;case"s-maxage":t.sMaxage=Number(u);break;case"no-cache":t.noCache=!0;break;case"no-store":t.noStore=!0;break;case"no-transform":t.noTransform=!0;break;case"only-if-cached":t.onlyIfCached=!0;break;case"must-revalidate":t.mustRevalidate=!0;break;case"proxy-revalidate":t.proxyRevalidate=!0;break;case"must-understand":t.mustUnderstand=!0;break;case"private":t.private=!0;break;case"public":t.public=!0;break;case"immutable":t.immutable=!0;break;case"stale-while-revalidate":t.staleWhileRevalidate=Number(u);break;case"stale-if-error":t.staleIfError=Number(u);break}}else t.maxAge=e.maxAge,t.maxStale=e.maxStale,t.minFresh=e.minFresh,t.sMaxage=e.sMaxage,t.noCache=e.noCache,t.noStore=e.noStore,t.noTransform=e.noTransform,t.onlyIfCached=e.onlyIfCached,t.mustRevalidate=e.mustRevalidate,t.proxyRevalidate=e.proxyRevalidate,t.mustUnderstand=e.mustUnderstand,t.private=e.private,t.public=e.public,t.immutable=e.immutable,t.staleWhileRevalidate=e.staleWhileRevalidate,t.staleIfError=e.staleIfError;return t}}var tt=Object.defineProperty,fe=n((a,e)=>tt(a,"name",{value:e,configurable:!0}),"l$1");class D{static{n(this,"ContentDisposition")}static{fe(this,"ContentDisposition")}filename;filenameSplat;name;type;constructor(e){if(e)return D.from(e)}get preferredFilename(){let e=this.filenameSplat;if(e){let t=Ee(e);if(t)return t}return this.filename}toString(){if(!this.type)return"";let e=[this.type];return this.name&&e.push(`name=${L(this.name)}`),this.filename&&e.push(`filename=${L(this.filename)}`),this.filenameSplat&&e.push(`filename*=${L(this.filenameSplat)}`),e.join("; ")}static from(e){let t=new D;if(e!==null)if(typeof e=="string"){let r=A(e);if(r.length>0){t.type=r[0][0];for(let[s,u]of r.slice(1))s==="filename"?t.filename=u:s==="filename*"?t.filenameSplat=u:s==="name"&&(t.name=u)}}else t.filename=e.filename,t.filenameSplat=e.filenameSplat,t.name=e.name,t.type=e.type;return t}}function Ee(a){let e=a.match(/^([\w-]+)'([^']*)'(.+)$/);if(!e)return null;let[,t,,r]=e,s=$e(r);try{let u=new TextDecoder(t),p=new Uint8Array(s.split("").map(m=>m.charCodeAt(0)));return u.decode(p)}catch(u){return console.warn(`Failed to decode filename from charset ${t}:`,u),s}}n(Ee,"c");fe(Ee,"decodeFilenameSplat");function $e(a){return a.replace(/\+/g," ").replace(/%([0-9A-Fa-f]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}n($e,"d");fe($e,"percentDecode");var rt=Object.defineProperty,at=n((a,e)=>rt(a,"name",{value:e,configurable:!0}),"s$1");class ae{static{n(this,"ContentRange")}static{at(this,"ContentRange")}unit="";start=null;end=null;size;constructor(e){if(e)return ae.from(e)}toString(){if(!this.unit||this.size===void 0)return"";let e=this.start!==null&&this.end!==null?`${this.start}-${this.end}`:"*";return`${this.unit} ${e}/${this.size}`}static from(e){let t=new ae;if(e!==null)if(typeof e=="string"){let r=e.match(/^(\w+)\s+(?:(\d+)-(\d+)|\*)\/((?:\d+|\*))$/);r&&(t.unit=r[1],t.start=r[2]?parseInt(r[2],10):null,t.end=r[3]?parseInt(r[3],10):null,t.size=r[4]==="*"?"*":parseInt(r[4],10))}else e.unit!==void 0&&(t.unit=e.unit),e.start!==void 0&&(t.start=e.start),e.end!==void 0&&(t.end=e.end),e.size!==void 0&&(t.size=e.size);return t}}var nt=Object.defineProperty,st=n((a,e)=>nt(a,"name",{value:e,configurable:!0}),"i$4");class F{static{n(this,"ContentType")}static{st(this,"ContentType")}boundary;charset;mediaType;constructor(e){if(e)return F.from(e)}toString(){if(!this.mediaType)return"";let e=[this.mediaType];return this.charset&&e.push(`charset=${L(this.charset)}`),this.boundary&&e.push(`boundary=${L(this.boundary)}`),e.join("; ")}static from(e){let t=new F;if(e!==null)if(typeof e=="string"){let r=A(e);if(r.length>0){t.mediaType=r[0][0];for(let[s,u]of r.slice(1))s==="boundary"?t.boundary=u:s==="charset"&&(t.charset=u)}}else t.boundary=e.boundary,t.charset=e.charset,t.mediaType=e.mediaType;return t}}var it=Object.defineProperty,ot=n((a,e)=>it(a,"name",{value:e,configurable:!0}),"i$3");class ne{static{n(this,"Cookie")}static{ot(this,"Cookie")}#e;constructor(e){if(e)return ne.from(e);this.#e=new Map}get names(){return Array.from(this.#e.keys())}get values(){return Array.from(this.#e.values())}get size(){return this.#e.size}get(e){return this.#e.get(e)??null}set(e,t){this.#e.set(e,t)}delete(e){this.#e.delete(e)}has(e){return this.#e.has(e)}clear(){this.#e.clear()}entries(){return this.#e.entries()}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[r,s]of this)e.call(t,r,s,this)}toString(){let e=[];for(let[t,r]of this.#e)e.push(`${t}=${L(r)}`);return e.join("; ")}static from(e){let t=new ne;if(e!==null)if(typeof e=="string"){let r=A(e);for(let[s,u]of r)t.#e.set(s,u??"")}else if(W(e))for(let[r,s]of e)t.#e.set(r,s);else for(let r of Object.getOwnPropertyNames(e))t.#e.set(r,e[r]);return t}}var ut=Object.defineProperty,lt=n((a,e)=>ut(a,"name",{value:e,configurable:!0}),"i$2");class se{static{n(this,"IfMatch")}static{lt(this,"IfMatch")}tags=[];constructor(e){if(e)return se.from(e)}has(e){return this.tags.includes(E(e))}matches(e){if(this.tags.length===0||this.tags.includes("*"))return!0;let t=E(e);if(t.startsWith("W/"))return!1;for(let r of this.tags)if(!r.startsWith("W/")&&r===t)return!0;return!1}toString(){return this.tags.join(", ")}static from(e){let t=new se;return e!==null&&(typeof e=="string"?t.tags.push(...e.split(/\s*,\s*/).map(E)):Array.isArray(e)?t.tags.push(...e.map(E)):t.tags.push(...e.tags.map(E))),t}}var ct=Object.defineProperty,ft=n((a,e)=>ct(a,"name",{value:e,configurable:!0}),"i$1");class ie{static{n(this,"IfNoneMatch")}static{ft(this,"IfNoneMatch")}tags=[];constructor(e){if(e)return ie.from(e)}has(e){return this.tags.includes(E(e))}matches(e){return this.has(e)||this.tags.includes("*")}toString(){return this.tags.join(", ")}static from(e){let t=new ie;return e!==null&&(typeof e=="string"?t.tags.push(...e.split(/\s*,\s*/).map(E)):Array.isArray(e)?t.tags.push(...e.map(E)):t.tags.push(...e.tags.map(E))),t}}var pt=Object.defineProperty,ht=n((a,e)=>pt(a,"name",{value:e,configurable:!0}),"l");class oe{static{n(this,"IfRange")}static{ht(this,"IfRange")}value="";constructor(e){if(e)return oe.from(e)}matches(e){if(!this.value)return!0;let t=xe(this.value);if(t!==null&&e.lastModified!=null)return Z(t)===Z(e.lastModified);if(e.etag!=null){let r=E(this.value),s=E(e.etag);return r.startsWith("W/")||s.startsWith("W/")?!1:r===s}return!1}toString(){return this.value}static from(e){let t=new oe;return e!==null&&(typeof e=="string"?t.value=e:t.value=e.toUTCString()),t}}var mt=Object.defineProperty,dt=n((a,e)=>mt(a,"name",{value:e,configurable:!0}),"a$2");class ue{static{n(this,"Range")}static{dt(this,"Range")}unit="";ranges=[];constructor(e){if(e)return ue.from(e)}canSatisfy(e){if(!this.unit||this.ranges.length===0)return!1;for(let t of this.ranges)if(t.start===void 0&&t.end===void 0||t.start!==void 0&&t.end!==void 0&&t.start>t.end)return!1;for(let t of this.ranges)if(t.start===void 0||t.start<e)return!0;return!1}normalize(e){return this.canSatisfy(e)?this.ranges.map(t=>{if(t.start!==void 0&&t.end!==void 0)return{start:t.start,end:Math.min(t.end,e-1)};if(t.start!==void 0)return{start:t.start,end:e-1};{let r=t.end;return{start:Math.max(0,e-r),end:e-1}}}):[]}toString(){if(!this.unit||this.ranges.length===0)return"";let e=this.ranges.map(t=>t.start!==void 0&&t.end!==void 0?`${t.start}-${t.end}`:t.start!==void 0?`${t.start}-`:t.end!==void 0?`-${t.end}`:"");return`${this.unit}=${e.join(",")}`}static from(e){let t=new ue;if(e!==null)if(typeof e=="string"){let r=e.match(/^(\w+)=(.+)$/);if(r){t.unit=r[1];let s=r[2].split(","),u=!1;for(let p of s){let m=p.trim().match(/^(\d*)-(\d*)$/);if(!m){u=!0;continue}let[,d,y]=m;if(!d&&!y){u=!0;continue}let x=d?parseInt(d,10):void 0,$=y?parseInt(y,10):void 0;if(x!==void 0&&$!==void 0&&x>$){u=!0;continue}t.ranges.push({start:x,end:$})}u&&(t.ranges=[])}}else e.unit!==void 0&&(t.unit=e.unit),e.ranges!==void 0&&(t.ranges=e.ranges);return t}}var gt=Object.defineProperty,vt=n((a,e)=>gt(a,"name",{value:e,configurable:!0}),"r");class le{static{n(this,"SetCookie")}static{vt(this,"SetCookie")}domain;expires;httpOnly;maxAge;name;partitioned;path;sameSite;secure;value;constructor(e){if(e)return le.from(e)}toString(){if(!this.name)return"";let e=[`${this.name}=${L(this.value||"")}`];return this.domain&&e.push(`Domain=${this.domain}`),this.expires&&e.push(`Expires=${this.expires.toUTCString()}`),this.httpOnly&&e.push("HttpOnly"),this.maxAge!=null&&e.push(`Max-Age=${this.maxAge}`),this.partitioned&&e.push("Partitioned"),this.path&&e.push(`Path=${this.path}`),this.sameSite&&e.push(`SameSite=${this.sameSite}`),this.secure&&e.push("Secure"),e.join("; ")}static from(e){let t=new le;if(e!==null)if(typeof e=="string"){let r=A(e);if(r.length>0){t.name=r[0][0],t.value=r[0][1];for(let[s,u]of r.slice(1))switch(s.toLowerCase()){case"domain":t.domain=u;break;case"expires":{if(typeof u=="string"){let p=new Date(u);Se(p)&&(t.expires=p)}break}case"httponly":t.httpOnly=!0;break;case"max-age":{if(typeof u=="string"){let p=parseInt(u,10);isNaN(p)||(t.maxAge=p)}break}case"partitioned":t.partitioned=!0;break;case"path":t.path=u;break;case"samesite":typeof u=="string"&&/strict|lax|none/i.test(u)&&(t.sameSite=Ce(u));break;case"secure":t.secure=!0;break}}}else t.domain=e.domain,t.expires=e.expires,t.httpOnly=e.httpOnly,t.maxAge=e.maxAge,t.name=e.name,t.partitioned=e.partitioned,t.path=e.path,t.sameSite=e.sameSite,t.secure=e.secure,t.value=e.value;return t}}var yt=Object.defineProperty,bt=n((a,e)=>yt(a,"name",{value:e,configurable:!0}),"o$1");class ce{static{n(this,"Vary")}static{bt(this,"Vary")}#e;constructor(e){if(e)return ce.from(e);this.#e=new Set}get headerNames(){return Array.from(this.#e)}get size(){return this.#e.size}has(e){return this.#e.has(e.toLowerCase())}add(e){let t=e.trim();t&&this.#e.add(t.toLowerCase())}delete(e){this.#e.delete(e.toLowerCase())}clear(){this.#e.clear()}forEach(e,t){for(let r of this)e.call(t,r,this)}[Symbol.iterator](){return this.#e.values()}toString(){return Array.from(this.#e).join(", ")}static from(e){let t=new ce;if(e!==null)if(typeof e=="string")for(let r of e.split(",")){let s=r.trim();s&&t.#e.add(s.toLowerCase())}else if(Array.isArray(e))for(let r of e){let s=r.trim();s&&t.#e.add(s.toLowerCase())}else for(let r of e.headerNames){let s=r.trim();s&&t.#e.add(s.toLowerCase())}return t}}var wt=Object.defineProperty,Ct=n((a,e)=>wt(a,"name",{value:e,configurable:!0}),"t");const St={ct:"CT",etag:"ETag",te:"TE",www:"WWW",x:"X",xss:"XSS"};function je(a){return a.toLowerCase().split("-").map(e=>St[e]||e.charAt(0).toUpperCase()+e.slice(1)).join("-")}n(je,"canonicalHeaderName");Ct(je,"canonicalHeaderName");var xt=Object.defineProperty,Oe=n((a,e)=>xt(a,"name",{value:e,configurable:!0}),"a");const Pe=`\r
27
+ `;function Et(a){let e=new Headers;for(let t of a.split(Pe)){let r=t.match(/^([^:]+):(.*)/);r&&e.append(r[1].trim(),r[2].trim())}return e}n(Et,"parse");Oe(Et,"parse");function $t(a){let e="";for(let[t,r]of a)e&&(e+=Pe),e+=`${je(t)}: ${r}`;return e}n($t,"stringify");Oe($t,"stringify");const At={acceptsMediaType(a,e){const t=this.parseAccept(a);return t?t.accepts(e):!1},createCacheControl(a){const e=[];return a.public&&e.push("public"),a.private&&e.push("private"),a.noCache&&e.push("no-cache"),a.noStore&&e.push("no-store"),a.immutable&&e.push("immutable"),a.mustRevalidate&&e.push("must-revalidate"),a.proxyRevalidate&&e.push("proxy-revalidate"),a.maxAge!==void 0&&e.push(`max-age=${a.maxAge}`),a.sMaxAge!==void 0&&e.push(`s-maxage=${a.sMaxAge}`),a.minFresh!==void 0&&e.push(`min-fresh=${a.minFresh}`),a.staleWhileRevalidate!==void 0&&e.push(`stale-while-revalidate=${a.staleWhileRevalidate}`),a.staleIfError!==void 0&&e.push(`stale-if-error=${a.staleIfError}`),e.join(", ")},createCacheControlPreset(a){const e={immutable:{immutable:!0,maxAge:31536e3},"no-cache":{noCache:!0},"no-store":{noStore:!0},private:{maxAge:3600,private:!0},public:{maxAge:3600,public:!0}};return this.createCacheControl(e[a])},createContentDisposition(a){return new D({type:a.type,...a.filename&&{filename:a.filename},...a.filenameSplat&&{filenameSplat:a.filenameSplat}}).toString()},createContentType(a){return new F({mediaType:a.mediaType,...a.charset&&{charset:a.charset},...a.boundary&&{boundary:a.boundary}}).toString()},ensureCharset(a,e="utf8"){const t=this.parseContentType(a);return t?(t.charset||(t.charset=e),t.toString()):a},fromHeaders(a){const e=new Headers;return Array.isArray(a)?a.forEach(([t,r])=>{e.set(t,Array.isArray(r)?r.join(", "):String(r))}):Object.entries(a).forEach(([t,r])=>{e.set(t,Array.isArray(r)?r.join(", "):String(r))}),e},getPreferredMediaType(a,e){const t=this.parseAccept(a);if(t){for(const r of e)if(t.accepts(r))return r}},parseAccept(a){if(a)try{return new B(a)}catch{return}},parseContentDisposition(a){if(a)try{return new D(a)}catch{return}},parseContentType(a){if(a)try{return new F(a)}catch{return}}};export{At as H,Ue as h,Tt as n};
@@ -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 b=Object.defineProperty;var d=(e,t)=>b(e,"name",{value:t,configurable:!0});var R=Object.defineProperty,i=d((e,t)=>R(e,"name",{value:t,configurable:!0}),"o");const l={backoffMultiplier:2,calculateDelay:void 0,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:i(()=>!0,"shouldRetry")},p=i((e,t,a,o)=>{const r=t*a**e;return Math.min(r,o)},"calculateExponentialBackoff"),D=i(e=>new Promise(t=>{setTimeout(t,e)}),"sleep"),C=i((e,t=l.retryableStatusCodes)=>{if(e instanceof Error){const a=e.code,o=e.name;if(a==="ECONNRESET"||a==="ETIMEDOUT"||a==="ENOTFOUND"||a==="ECONNREFUSED"||a==="EAI_AGAIN"||o==="NetworkError"||o==="TimeoutError")return!0;const r=e;if(r.$metadata){const u=r.$metadata.httpStatusCode;if(u&&t.includes(u)||r.$fault==="server")return!0}if(r.statusCode&&t.includes(r.statusCode))return!0;const{retryable:s}=r;return s===!0||typeof s=="string"&&s==="true"}return!1},"isRetryableError"),h=i(async(e,t={})=>{const{backoffMultiplier:a=l.backoffMultiplier,calculateDelay:o=l.calculateDelay,initialDelay:r=l.initialDelay,maxDelay:s=l.maxDelay,maxRetries:u=l.maxRetries,retryableStatusCodes:m=l.retryableStatusCodes,shouldRetry:E=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(!(E(c)||C(c,m)))throw c;const y=o?o(n,c):p(n,r,a,s);y!==void 0&&y>0&&await D(y)}throw f},"retry"),N=i((e={})=>t=>h(t,e),"createRetryWrapper");export{N as createRetryWrapper,C as isRetryableError,h 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 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 x,M as E,J as ie,K as ne,L as A}from"./path-D7rMc9nq-B718mbm6.js";import{throwErrorCode as D,ERRORS as R}from"./ERRORS-B9jkvKwx.js";import se from"./MetaStorage-Y4m1dWgd.js";import{stringifyMetadata as ce,parseMetadata as ue}from"./Metadata-B6Ir0KO7.js";const P=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,W=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=W(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:U,mkdir:_e}=Te("node:fs/promises");var Me=Object.defineProperty,ke=W((e,t)=>Me(e,"name",{value:t,configurable:!0}),"o");const ze=ke(async e=>{$(e);try{const t=await U(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 U(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(S(r))}'`,{cause:t})}},"ensureDir");var Ne=Object.defineProperty,l=o((e,t)=>Ne(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 T(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(T,"h$1");l(T,"O");s(T,"getDefaultExportFromNamespaceIfPresent");p(T,"getDefaultExportFromNamespaceIfPresent");function _(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.keys(e).length===1?e.default:e}o(_,"x");l(_,"P");s(_,"getDefaultExportFromNamespaceIfNotNamed");p(_,"getDefaultExportFromNamespaceIfNotNamed");function M(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(M,"y$2");l(M,"_");s(M,"getAugmentedNamespace");p(M,"getAugmentedNamespace");var C,I;function k(){return I||(I=1,C=["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"]),C}o(k,"w$2");l(k,"k");s(k,"requireBinaryExtensions");var Se=k();const Ue=O(Se);var Ce=Object.defineProperty,n=s((e,t)=>Ce(e,"name",{value:t,configurable:!0}),"r");const Ie=new Set(Ue),Le=new Set(["/","\\",void 0]),L=Symbol.for("pathe:normalizedAlias"),qe=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,We=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[L])return e;const t=Object.fromEntries(Object.entries(e).toSorted(([r],[a])=>We(r,a)));for(const r in t)for(const a in t)a===r||r.startsWith(a)||t[r].startsWith(a)&&Le.has(t[r][a.length])&&(t[r]=t[a]+t[r].slice(a.length));return Object.defineProperty(t,L,{enumerable:!1,value:!0}),t},"normalizeAliases");n((e,t)=>{e=x(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 E(a,e.slice(r.length))}return e},"resolveAlias");n(e=>qe.exec(e)?.[2],"filename");n((e,t)=>{e=x(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 E(r,e.slice(a.length))}return e},"reverseResolveAlias");const Ve=/^(?:\.?\.[/\\]|\.\.\B)/,Je=/^(?:msys|cygwin)$/;n(e=>Ve.test(e)||e==="..","isRelative");n(e=>Ie.has(ie(e).slice(1).toLowerCase()),"isBinaryPath");const z=n(e=>x(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,N=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=N(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=N((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"o");async function u(e,t=P){$(e),e=z(e);try{return await He(e,t),!0}catch{return!1}}o(u,"i$5");J(u,"d");N(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=z(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,(B,F)=>{B?te(B):ee(r?F:F.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 zt=kt(async(e,t={})=>{$(e);try{await Tt(e)}catch{}try{await _t(e,wt(t))}catch{}},"remove");var Nt=Object.defineProperty,Bt=o((e,t)=>Nt(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 Ut=Object.defineProperty,Ct=o((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"t"),It=Object.defineProperty,Lt=Ct((e,t)=>It(e,"name",{value:t,configurable:!0}),"r"),qt=Object.defineProperty,Wt=Lt((e,t)=>qt(e,"name",{value:t,configurable:!0}),"f");const Vt=new TextEncoder,Jt=Wt(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:q,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=z(e);const a=`${e}.tmp`;try{const i=await u(e,P);if(!i&&r.recursive){const f=ne(e);await u(f,P)||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 q(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 q(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,j=o((e,t)=>sr(e,"name",{value:t,configurable:!0}),"a");let vr=class extends se{static{o(this,"O")}static{j(this,"LocalMetaStorage")}directory;constructor(t){super(t),this.directory=A(t?.directory||E(oe(),"Upload_meta")),this.accessCheck().catch(r=>{this.logger?.error("Metadata storage access check failed: %O",r)})}getMetaPath=j(t=>A(`${this.directory}/${this.prefix}${t}${this.suffix}`),"getMetaPath");getIdFromPath=j(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 D(R.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?D(R.FILE_NOT_FOUND):r}}async delete(t){await zt(this.getMetaPath(t))}async accessCheck(){await ze(this.directory)}};export{dt as B,vr as O,z as U,P as _,$ as f,u as i,S as l,ze as w,zt as y};
@@ -1,5 +1,5 @@
1
1
  import { F as File, a as FileReturn, B as BaseStorage } from "./storage.d-BOMUJD96.js";
2
- import { O as MediaTransformerConfig, Q as MediaTransformResult } from "./types.d-DBjmJvIT.js";
2
+ import { O as MediaTransformerConfig, Q as MediaTransformResult } from "./types.d-BCN94sB_.js";
3
3
  /**
4
4
  * Unified media transformer that automatically detects media type and routes to appropriate transformer.
5
5
  * @template TFile The file type used by this transformer.
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var o=(s,e)=>t(s,"name",{value:e,configurable:!0});var E=Object.defineProperty,I=o((s,e)=>E(s,"name",{value:e,configurable:!0}),"t");const i=I(s=>{const{accessKeyId:e,endpoint:r,region:c,secretAccessKey:n}=s??{accessKeyId:process.env.AWS_ACCESS_KEY_ID||process.env.MINIO_ACCESS_KEY_ID||process.env.MINIO_ACCESS_KEY,endpoint:process.env.AWS_ENDPOINT||process.env.MINIO_ENDPOINT,region:process.env.AWS_REGION||process.env.MINIO_REGION,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY||process.env.MINIO_SECRET_ACCESS_KEY||process.env.MINIO_SECRET_KEY};if(!c||!e||!n||!r)throw new Error("Missing required parameters for Minio client.");return{credentials:{accessKeyId:e,secretAccessKey:n},endpoint:r,forcePathStyle:!0,region:c}},"minio");export{i as default};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var d=(s,t)=>u(s,"name",{value:t,configurable:!0});import{n as g}from"./headers-DC2MEOrK.js";var p=Object.defineProperty,b=d((s,t)=>p(s,"name",{value:t,configurable:!0}),"l");class f{static{d(this,"F")}static{b(this,"MultipartBase")}async handlePost(t,i,m){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 l=await this.storage.create(r),c=this.createStreamFromBytes(t.bytes);await this.storage.write({body:c,contentLength:t.size,id:l.id,start:0});const o=await this.storage.write({body:this.createEmptyStream(),contentLength:0,id:l.id,start:t.size});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 h=this.buildFileUrl(m,a);return{...a,headers:{Location:h,...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 g(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{f as F};
@@ -0,0 +1 @@
1
+ var v=Object.defineProperty;var i=(e,t)=>v(e,"name",{value:t,configurable:!0});import{PassThrough as z,Transform as F}from"node:stream";import{fileTypeFromBuffer as l}from"file-type";var g=Object.defineProperty,p=i((e,t)=>g(e,"name",{value:t,configurable:!0}),"f");const O=p(async e=>{try{return await l(e)}catch{return}},"detectFileTypeFromBuffer"),W=p(async(e,t)=>{const y=t?.sampleSize??4100;let u;const f=[];let s=0,n=!1,c;const o=new z({highWaterMark:0}),a=new F({objectMode:!1,transform(r,m,T){if(!n&&(f.push(r),s+=r.length,s>=y||s>0)){n=!0;const h=Buffer.concat(f);c=l(h).then(d=>(u=d,d)).catch(()=>{})}T(void 0,r)}});return e.pipe(a).pipe(o),e.on("error",r=>{a.destroy(r),o.destroy(r)}),a.on("error",r=>{o.destroyed||o.destroy(r)}),await Promise.race([new Promise(r=>{if(n){r();return}const m=setTimeout(r,10);a.once("data",()=>{clearTimeout(m),r()}),a.once("end",()=>{clearTimeout(m),r()})}),new Promise(r=>{setTimeout(r,10)})]),c&&await Promise.race([c.then(()=>{}),new Promise(r=>{setTimeout(r,150)})]).catch(()=>{}),{fileType:u,stream:o}},"detectFileTypeFromStream");var P=Object.defineProperty,b=i((e,t)=>P(e,"name",{value:t,configurable:!0}),"t");const k=b(e=>e.bytesWritten===e.size?"completed":e.createdAt?"part":"created","getFileStatus");var w=Object.defineProperty,j=i((e,t)=>w(e,"name",{value:t,configurable:!0}),"i");const x=j((e,t)=>e.size!==void 0&&t.size!==void 0&&e.size>0&&t.size>0&&e.size>t.size?!1:t.size===void 0?!0:(e.start||0)+(e.contentLength||0)<=t.size,"partMatch");export{O as a,W as d,k as o,x as r};
@@ -0,0 +1 @@
1
+ var Vt=Object.defineProperty;var he=(s,u)=>Vt(s,"name",{value:u,configurable:!0});var Ht=Object.defineProperty,Jt=he((s,u)=>Ht(s,"name",{value:u,configurable:!0}),"$e"),Kt=Object.defineProperty,V=Jt((s,u)=>Kt(s,"name",{value:u,configurable:!0}),"W"),Qt=Object.defineProperty,a=V((s,u)=>Qt(s,"name",{value:u,configurable:!0}),"u$1");let ge=a(()=>{var s=(()=>{var u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,b=a((e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},"ne"),A=a((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!g.call(e,r)&&r!==n&&u(e,r,{get:a(()=>t[r],"get"),enumerable:!(o=c(t,r))||o.enumerable});return e},"ae"),m=a(e=>A(u({},"__esModule",{value:!0}),e),"oe"),P={};b(P,{zeptomatch:a(()=>pe,"zeptomatch")});var H=a(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let i=0,h=l.length;i<h;i++)n.push(l[i])}return Array.from(t)},"M"),be=a(e=>{let t="";const n=H(e);for(let o=0,r=n.length;o<r;o++){const l=n[o];if(!l.regex)continue;const i=l.regex.flags;if(t||(t=i),t!==i)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${i}"`)}return t},"se"),J=a((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const i=ve(e.children.map(h=>J(h,t,n)).filter(Boolean));if(i?.length){const h=e.children.some(W=>!W.regex||!(W.partial??t)),x=i.length>1||r&&(!l.length||h);l+=x?r?"(?:$|":"(?:":"",l+=i.join("|"),l+=x?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),we=a((e,t)=>{const n=new Map,o=H(e);for(let r=o.length-1;r>=0;r--){const l=J(o[r],t,n);if(!(r>0))return l}return""},"ie"),ve=a(e=>Array.from(new Set(e)),"ue"),S=a((e,t,n)=>S.compile(e,n).test(t),"R");S.compile=(e,t)=>{const n=t?.partial??!1,o=we(e,n),r=be(e);return new RegExp(`^(?:${o})$`,r)};var ye=S,je=a((e,t)=>{const n=ye.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),Me=je,Ae=a(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Ae,K=a(e=>Array.isArray(e),"j"),R=a(e=>typeof e=="function","_"),ke=a(e=>e.length===0,"he"),Oe=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ee=a(e=>typeof e=="number","de"),Ie=a(e=>typeof e=="object"&&e!==null,"xe"),Pe=a(e=>e instanceof RegExp,"me"),Re=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Q=a(e=>typeof e=="string","A"),y=a(e=>e===void 0,"f"),We=a(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),T=a((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=j(t)(o),l=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${l}`)},"I"),f=a((e,t)=>K(e)?Ze(e,t):Q(e)?X(e,t):_e(e,t),"i"),Ze=a((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let l=o.index,i=l;for(;i<r.length&&r.charCodeAt(i)in n;)i+=1;if(i>l){if(!y(t)&&!o.options.silent){const h=r.slice(l,i),x=R(t)?t(h,r,`${l}`):t;y(x)||o.output.push(x)}o.index=i}return!0}},"we"),_e=a((e,t)=>{if(Be(e))return X(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return Re(e)&&R(t)&&!Oe(t)?Ce(r,t):Se(r,t)}},"$e"),Ce=a((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const l=e.exec(r);if(l){const i=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${o}`);y(h)||n.output.push(h)}return n.index=i,!0}else return!1},"Ee"),Se=a((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const l=e.lastIndex;if(!y(t)&&!n.options.silent){const i=R(t)?t(r.slice(o,l),r,`${o}`):t;y(i)||n.output.push(i)}return n.index=l,!0}else return!1},"Ce"),X=a((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!y(t)&&!n.options.silent){const l=R(t)?t(e,r,`${o}`):t;y(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),q=a((e,t,n,o)=>{const r=j(e),l=t>1;return F(L(ee(i=>{let h=0;for(;h<n;){const x=i.index;if(!r(i)||(h+=1,i.index===x))break}return h>=t},l),o))},"k"),Y=a((e,t)=>q(e,0,1,t),"L"),C=a((e,t)=>q(e,0,1/0,t),"$"),qe=a((e,t)=>q(e,1,1/0,t),"Re"),O=a((e,t)=>{const n=e.map(j);return F(L(ee(o=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](o))return!1;return!0}),t))},"x"),w=a((e,t)=>{const n=e.map(j);return F(L(o=>{for(let r=0,l=n.length;r<l;r++)if(n[r](o))return!0;return!1},t))},"p"),ee=a((e,t=!0,n=!1)=>{const o=j(e);return t?r=>{const l=r.index,i=r.output.length,h=o(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==i&&(r.output.length=i)),h}:o},"q"),L=a((e,t)=>{const n=j(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const l=o.output.splice(r,1/0),i=t(l);return y(i)||o.output.push(i),!0}else return!1}:n},"B"),F=(()=>{let e=0;return t=>{const n=j(t),o=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const i=r.index,h=(l=r.cache)[o]||(l[o]={indexMax:-1,queue:[]}),x=h.queue;if(i<=h.indexMax){const Z=h.store||(h.store=new Map);if(x.length){for(let I=0,Gt=x.length;I<Gt;I+=2){const Ut=x[I*2],Dt=x[I*2+1];Z.set(Ut,Dt)}x.length=0}const v=Z.get(i);if(v===!1)return!1;if(Ee(v))return r.index=v,!0;if(v)return r.index=v.index,v.output?.length&&r.output.push(...v.output),!0}const W=r.output.length,Nt=n(r);if(h.indexMax=Math.max(h.indexMax,i),Nt){const Z=r.index,v=r.output.length;if(v>W){const I=r.output.slice(W,v);x.push(i,{index:Z,output:I})}else x.push(i,Z);return!0}else return x.push(i,!1),!1}}})(),te=a(e=>{let t;return n=>(t||(t=j(e())),t(n))},"G"),j=We(e=>{if(R(e))return ke(e)?te(e):e;if(Q(e)||Pe(e))return f(e);if(K(e))return O(e);if(Ie(e))return w(Object.values(e));throw new Error("Invalid rule")}),z=a(e=>e,"d"),Le=a(e=>typeof e=="string","ke"),Fe=a(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const l=r?.partial?n:t,i=l.get(o);if(i!==void 0)return i;const h=e(o,r);return l.set(o,h),h}},"Be"),Ne=a(e=>{const t={},n={};return(o,r)=>{const l=r?.partial?n:t;return l[o]??(l[o]=e(o,r))}},"Pe"),Ge=f(/\\./,z),Ue=f(/./,z),De=f(/\*\*\*+/,"*"),Ve=f(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),He=f(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Je=C(w([Ge,De,Ve,He,Ue])),Ke=Je,Qe=a(e=>T(e,Ke,{memoization:!1}).join(""),"Ie"),Te=Qe,ne="abcdefghijklmnopqrstuvwxyz",Xe=a(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ne[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),re=a(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ne.indexOf(e[n])+1;return t},"V"),N=a((e,t)=>{if(t<e)return N(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),Ye=a((e,t,n)=>N(e,t).map(o=>String(o).padStart(n,"0")),"qe"),oe=a((e,t)=>N(re(e),re(t)).map(Xe),"W"),d=a(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=a(e=>({children:e}),"y"),E=(()=>{const e=a((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,i=r.length;l<i;l++)e(r[l],n,o)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],l=t[n];e(r,l,o)}return t[0]}})(),M=a(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),et=f(/\\./,d),tt=f(/[$.*+?^(){}[\]\|]/,e=>d(`\\${e}`)),nt=f(/[\\\/]/,M),rt=f(/[^$.*+?^(){}[\]\|\\\/]+/,d),ot=f(/^(?:!!)*!(.*)$/,(e,t)=>d(`(?!^${pe.compile(t).source}$).*?`)),st=f(/^(!!)+/),lt=w([ot,st]),ut=f(/\/(\*\*\/)+/,()=>B([E([M(),d(".+?"),M()]),M()])),at=f(/^(\*\*\/)+/,()=>B([d("^"),E([d(".*?"),M()])])),ct=f(/\/(\*\*)$/,()=>B([E([M(),d(".*?")]),d("$")])),it=f(/\*\*/,()=>d(".*?")),se=w([ut,at,ct,it]),ft=f(/\*\/(?!\*\*\/|\*$)/,()=>E([d("[^\\\\/]*?"),M()])),pt=f(/\*/,()=>d("[^\\\\/]*")),le=w([ft,pt]),ue=f("?",()=>d("[^\\\\/]")),ht=f("[",z),gt=f("]",z),dt=f(/[!^]/,"^\\\\/"),xt=f(/[a-z]-[a-z]|[0-9]-[0-9]/i,z),$t=f(/\\./,z),mt=f(/[$.*+?^(){}[\|]/,e=>`\\${e}`),bt=f(/[\\\/]/,"\\\\/"),wt=f(/[^$.*+?^(){}[\]\|\\\/]+/,z),vt=w([$t,mt,bt,xt,wt]),ae=O([ht,Y(dt),C(vt),gt],e=>d(e.join(""))),yt=f("{","(?:"),jt=f("}",")"),Mt=f(/(\d+)\.\.(\d+)/,(e,t,n)=>Ye(+t,+n,Math.min(t.length,n.length)).join("|")),At=f(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>oe(t,n).join("|")),zt=f(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>oe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),kt=w([Mt,At,zt]),ce=O([yt,kt,jt],e=>d(e.join(""))),Ot=f("{"),Et=f("}"),It=f(","),Pt=f(/\\./,d),Rt=f(/[$.*+?^(){[\]\|]/,e=>d(`\\${e}`)),Bt=f(/[\\\/]/,M),Wt=f(/[^$.*+?^(){}[\]\|\\\/,]+/,d),Zt=te(()=>fe),_t=f("",()=>d("(?:)")),Ct=qe(w([se,le,ue,ae,ce,Zt,Pt,Rt,Bt,Wt]),E),ie=w([Ct,_t]),fe=O([Ot,Y(O([ie,C(O([It,ie]))])),Et],B),St=C(w([lt,se,le,ue,ae,ce,fe,et,tt,nt,rt]),E),qt=St,Lt=a(e=>T(e,qt,{memoization:!1})[0],"kr"),Ft=Lt,G=a((e,t,n)=>G.compile(e,n).test(t),"N");G.compile=(()=>{const e=Ne((n,o)=>Me(Ft(Te(n)),o)),t=Fe((n,o)=>ze(n.map(r=>e(r,o))));return(n,o)=>Le(n)?e(n,o):t(n,o)})();var pe=G;return m(P)})();return s.default||s},"_lazyMatch"),U;const Tt=a((s,u)=>(U||(U=ge(),ge=null),U(s,u)),"default");var Xt=Object.defineProperty,Yt=V((s,u)=>Xt(s,"name",{value:u,configurable:!0}),"t$1");const en=/^[A-Z]:\//i,k=Yt((s="")=>s&&s.replaceAll("\\","/").replace(en,u=>u.toUpperCase()),"normalizeWindowsPath");var tn=Object.defineProperty,$=V((s,u)=>tn(s,"name",{value:u,configurable:!0}),"r");const nn=/^[/\\]{2}/,rn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,xe=/^[A-Z]:$/i,de=/^\/([A-Z]:)?$/i,on=/.(\.[^./]+)$/,sn=/^[/\\]|^[a-z]:[/\\]/i,ln=/\/$/,un=$(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),$e=$((s,u)=>{let c="",p=0,g=-1,b=0,A;for(let m=0;m<=s.length;++m){if(m<s.length)A=s[m];else{if(A==="/")break;A="/"}if(A==="/"){if(!(g===m-1||b===1))if(b===2){if(c.length<2||p!==2||!c.endsWith(".")||c.at(-2)!=="."){if(c.length>2){const P=c.lastIndexOf("/");P===-1?(c="",p=0):(c=c.slice(0,P),p=c.length-1-c.lastIndexOf("/")),g=m,b=0;continue}else if(c.length>0){c="",p=0,g=m,b=0;continue}}u&&(c+=c.length>0?"/..":"..",p=2)}else c.length>0?c+=`/${s.slice(g+1,m)}`:c=s.slice(g+1,m),p=m-g-1;g=m,b=0}else A==="."&&b!==-1?++b:b=-1}return c},"normalizeString"),_=$(s=>rn.test(s),"isAbsolute"),me=$(function(s){if(s.length===0)return".";s=k(s);const u=nn.exec(s),c=_(s),p=s.at(-1)==="/";return s=$e(s,!c),s.length===0?c?"/":p?"./":".":(p&&(s+="/"),xe.test(s)&&(s+="/"),u?c?`//${s}`:`//./${s}`:c&&!_(s)?`/${s}`:s)},"normalize"),hn=$((...s)=>{let u="";for(const c of s)if(c)if(u.length>0){const p=u.at(-1)==="/",g=c[0]==="/";p&&g?u+=c.slice(1):u+=p||g?c:`/${c}`}else u+=c;return me(u)},"join"),D=$(function(...s){s=s.map(p=>k(p));let u="",c=!1;for(let p=s.length-1;p>=-1&&!c;p--){const g=p>=0?s[p]:un();!g||g.length===0||(u=`${g}/${u}`,c=_(g))}return u=$e(u,!c),c&&!_(u)?`/${u}`:u.length>0?u:"."},"resolve");$(function(s){return k(s)},"toNamespacedPath");const an=$(function(s){return on.exec(k(s))?.[1]??""},"extname");$(function(s,u){const c=D(s).replace(de,"$1").split("/"),p=D(u).replace(de,"$1").split("/");if(p[0][1]===":"&&c[0][1]===":"&&c[0]!==p[0])return p.join("/");const g=[...c];for(const b of g){if(p[0]!==b)break;c.shift(),p.shift()}return[...c.map(()=>".."),...p].join("/")},"relative");const cn=$(s=>{const u=k(s).replace(ln,"").split("/").slice(0,-1);return u.length===1&&xe.test(u[0])&&(u[0]=`${u[0]}/`),u.join("/")||(_(s)?"/":".")},"dirname");$(function(s){const u=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return k(s.root?D(...u):u.join("/"))},"format");const fn=$((s,u)=>{const c=k(s).split("/").pop();return u&&c.endsWith(u)?c.slice(0,-u.length):c},"basename");$(function(s){const u=sn.exec(s)?.[0]?.replaceAll("\\","/")??"",c=fn(s),p=an(c);return{base:c,dir:cn(s),ext:p,name:c.slice(0,c.length-p.length),root:u}},"parse");$((s,u)=>Tt(u,me(s)),"matchesGlob");export{k as A,D as C,an as J,cn as K,me as L,hn as M,_ as O,fn as Q};
@@ -0,0 +1 @@
1
+ var u=Object.defineProperty;var l=(e,r)=>u(e,"name",{value:r,configurable:!0});import g from"mime";import{H as s}from"./headers-DC2MEOrK.js";var f=Object.defineProperty,o=l((e,r)=>f(e,"name",{value:r,configurable:!0}),"i");const a="Content-Type",b=o((e,r={},t=200)=>({...e,headers:r,statusCode:t}),"buildResponseFile"),T=o((e,r,t={})=>({Location:r,...e.expiredAt===void 0?{}:{"X-Upload-Expires":e.expiredAt.toString()},...e.ETag===void 0?{}:{ETag:e.ETag},...t}),"buildFileHeaders"),v=o((e,r)=>{const t=e.metadata||{},n={"x-chunked-upload":"true","x-upload-complete":r?"true":"false","x-upload-offset":String(e.bytesWritten||0)};return Array.isArray(t._chunks)&&t._chunks.length>0&&(n["x-received-chunks"]=JSON.stringify(t._chunks)),n},"buildChunkedUploadHeaders");o((e,r,t,n,i)=>{const c=new URL(e||"/","http://localhost"),{pathname:p}=c,d=`${p}/${r}.${g.getExtension(t)}`;return n?d:`${i||""}${d}`},"buildLocationHeader");const x=o(e=>({"Content-Length":String(e.size||0),"Content-Type":e.contentType,...e.expiredAt===void 0?{}:{"X-Upload-Expires":e.expiredAt.toString()},...e.modifiedAt===void 0?{}:{"Last-Modified":e.modifiedAt.toString()},...e.ETag===void 0?{}:{ETag:e.ETag}}),"buildFileMetadataHeaders"),E=o(e=>{const r={};for(const[t,n]of Object.entries(e))r[t]=Array.isArray(n)?n.join(", "):String(n);return r},"convertHeadersToString");o(e=>({error:{code:e.code||e.name||"Error",message:e.message||"Unknown error",name:e.name||"Error"}}),"buildErrorResponseBody");o((e,r={})=>{const t={...r};let n;if(typeof e=="string"){if(n=e,t[a]===void 0)t[a]=s.createContentType({mediaType:"text/plain"});else{const i=Array.isArray(t[a])?t[a].join(", "):String(t[a]);t[a]=s.ensureCharset(i)}t["Content-Length"]===void 0&&(t["Content-Length"]=Buffer.byteLength(e))}else e instanceof Buffer?n=e:(n=JSON.stringify(e||{}),t[a]||(t[a]=s.createContentType({charset:"utf8",mediaType:"application/json"})));return{data:n,headers:t}},"prepareResponseBody");o(e=>{const r={...e};return"content"in r&&delete r.content,"stream"in r&&delete r.stream,r},"cleanFileData");export{T as a,b,v as c,x as d,E as e};
@@ -0,0 +1 @@
1
+ var A=Object.defineProperty;var y=(s,t)=>A(s,"name",{value:t,configurable:!0});import{n as d}from"./headers-DC2MEOrK.js";import{hasBody as E}from"type-is";import{a as h}from"./base-handler-core-DaggCVsq.js";import{ERRORS as X}from"./ERRORS-B9jkvKwx.js";import{b,a as z,c as v,d as T}from"./response-builder-Wdo_fvcF.js";var D=Object.defineProperty,f=y((s,t)=>D(s,"name",{value:t,configurable:!0}),"a$1");const L=f((s,t={})=>{const e=h(s,"x-file-metadata",!0);if(!e)return t;try{return{...t,...JSON.parse(e)}}catch{return t}},"parseMetadata"),P=f(s=>{if(!s)return;const t=2e3,e=s.length>t?s.slice(0,Math.max(0,t)):s,r=e.toLowerCase().indexOf("filename");if(r===-1)return;let a=r+8;for(;a<e.length&&(e[a]==="*"||e[a]===" "||e[a]===" ");)a++;if(a>=e.length||e[a]!=="=")return;for(a++;a<e.length&&(e[a]===" "||e[a]===" ");)a++;if(a>=e.length)return;let o=a,n;const i=e[a];return i==='"'||i==="'"?(o=a+1,n=e.indexOf(i,o),n===-1&&(n=e.indexOf(";",o),n===-1&&(n=e.length))):(n=e.indexOf(";",o),n===-1&&(n=e.length)),o>=n?void 0:e.substring(o,n).trim()||void 0},"parseContentDispositionValue"),I=f(s=>{const t=h(s,"content-disposition",!0);return P(t)},"parseContentDisposition"),R=f(s=>{const t=h(s,"x-chunked-upload",!0)==="true",e=h(s,"x-chunk-offset",!0),r=h(s,"x-total-size",!0),a={isChunkedUpload:t};if(e){const o=Number.parseInt(e,10);!Number.isNaN(o)&&o>=0&&(a.chunkOffset=o)}if(r){const o=Number.parseInt(r,10);!Number.isNaN(o)&&o>0&&(a.totalSize=o)}return a},"parseChunkHeaders"),Z=f((s,t=!1)=>{const e=h(s,"x-chunked-upload",!0)==="true";if(!(t&&e)){if(!E(s))throw d(400,"Request body is required");if(Number.parseInt(h(s,"content-length")||"0",10)===0&&!e)throw d(400,"Content-Length is required and must be greater than 0")}},"validateRequestBody"),ee=f((s,t=!1,e)=>{const r=h(s,"x-chunked-upload",!0)==="true",a=Number.parseInt(h(s,"content-length")||"0",10);if(!t&&!r&&a===0)throw d(400,"Content-Length is required and must be greater than 0");if(e!==void 0&&a>e)throw d(413,`File size exceeds maximum allowed size of ${e} bytes`);return a},"validateContentLength"),te=f((s,t,e="application/octet-stream")=>{const r=I(s),a=L(s),{isChunkedUpload:o,totalSize:n}=R(s),i=o&&n?n:t;return o&&n&&(a._chunkedUpload=!0,a._chunks=[],a._totalSize=n),{contentType:e,metadata:a,originalName:r,size:i}},"extractFileInit");f((s,t,e)=>{if(Number.isNaN(s)||s<0)throw d(400,"X-Chunk-Offset must be a valid non-negative number");if(s+t>e)throw d(400,`Chunk exceeds file size. Offset: ${s}, Size: ${t}, Total: ${e}`)},"validateChunk");f((s,t="application/octet-stream")=>h(s,"content-type")||t,"getContentType");var W=Object.defineProperty,g=y((s,t)=>W(s,"name",{value:t,configurable:!0}),"a");const N=g((s,t)=>{if(s.length===0)return!1;const e=[...s].toSorted((o,n)=>o.offset-n.offset),r=e[0];if(r?.offset!==0)return!1;let a=r.length;for(let o=1;o<e.length;o+=1){const n=e[o];if(n){if(n.offset>a)return!1;a=Math.max(a,n.offset+n.length)}}return a>=t},"isUploadComplete"),H=g((s,t,e,r)=>{if(Number.isNaN(s)||s<0)throw new Error("Chunk offset must be a valid non-negative number");if(t<=0)throw new Error("Chunk length must be greater than 0");if(r!==void 0&&t>r)throw new Error(`Chunk size exceeds maximum allowed size of ${r} bytes`);if(s+t>e)throw new Error(`Chunk exceeds file size. Offset: ${s}, Size: ${t}, Total: ${e}`)},"validateChunk"),B=g((s,t)=>{const e=s.find(r=>r.offset===t.offset&&r.length===t.length);return e?t.checksum&&e.checksum!==t.checksum?s.map(r=>r.offset===t.offset?{...r,checksum:t.checksum}:r):s:[...s,t]},"trackChunk"),j=g((s,t)=>{if(s.length===0||t===0)return{bytesWritten:0,percentage:0};const e=[...s].toSorted((n,i)=>n.offset-i.offset);let r=0,a=0;for(const n of e){const i=n.offset+n.length;n.offset<=a?r=Math.max(r,i):r+=n.length,a=Math.max(a,i)}r=Math.min(r,t);const o=t>0?r/t*100:0;return{bytesWritten:r,percentage:o}},"calculateUploadProgress");g(s=>{const t=s.metadata||{};if(t._chunkedUpload===!0&&Array.isArray(t._chunks)){const e=typeof t._totalSize=="number"?t._totalSize:s.size||0;return j(t._chunks,e).bytesWritten}return s.bytesWritten||0},"getBytesWritten");const F=g(s=>(s.metadata||{})._chunkedUpload===!0,"isChunkedUpload"),U=g(s=>{const t=s.metadata||{};if(t._chunkedUpload===!0&&typeof t._totalSize=="number")return t._totalSize},"getTotalSize");var q=Object.defineProperty,$=y((s,t)=>q(s,"name",{value:t,configurable:!0}),"U");class se{static{y(this,"A")}static{$(this,"RestBase")}async deleteSingle(t){const e=await this.storage.delete({id:t});if(e.status===void 0)throw d(404,"File not found");return{...e,headers:{},statusCode:204}}async handlePost(t,e,r,a,o){if(e&&t.size!==void 0){const c=typeof t.size=="number"?t.size:Number.parseInt(String(t.size),10);if(c>0&&c>this.storage.maxUploadSize)throw d(413,`File size exceeds maximum allowed size of ${this.storage.maxUploadSize} bytes`)}const n=await this.storage.create(t);if(e){const c=this.buildFileUrl(r,n);return b(n,{...z(n,c),"X-Chunked-Upload":"true","X-Upload-ID":n.id},201)}const i=await this.storage.write({body:a,contentLength:o,id:n.id,start:0}),l=this.buildFileUrl(r,i);return b(i,z(i,l),201)}async handlePut(t,e,r,a,o,n){let i,l=!1;try{await this.storage.getMeta(t),l=!0,n&&await this.storage.update({id:t},{metadata:n}),i=await this.storage.write({body:a,contentLength:o,id:t,start:0})}catch(m){const S=m;if(S.UploadErrorCode===X.FILE_NOT_FOUND||S.code==="ENOENT")try{const C=await this.storage.create(e);i=await this.storage.write({body:a,contentLength:o,id:C.id,start:0})}catch(C){throw C}else throw m}const c=this.buildFileUrl(r,i);return b(i,z(i,c),l?200:201)}async handlePatch(t,e,r,a,o,n){let i=await this.storage.getMeta(t);const l=i.metadata||{},c=F(i);if(c){const u=U(i);u&&i.size!==u&&(i={...i,size:u})}const m=typeof l._totalSize=="number"?l._totalSize:i.size||0;if(!c)throw d(400,"File is not a chunked upload. Use POST or PUT for full file uploads.");const S=100*1024*1024;try{H(e,r,m,S)}catch(u){throw u instanceof Error&&u.message.includes("exceeds maximum")?d(413,u.message):d(400,u instanceof Error?u.message:String(u))}if(i.status==="completed"){const u=this.buildFileUrl(o,i);return b(i,{...z(i,u),"X-Upload-Complete":"true"},200)}const C=Array.isArray(l._chunks)?l._chunks:[],x=B(C,{checksum:a,length:r,offset:e}),O={...l,_chunks:x};await this.storage.update({id:t},{metadata:O});let p=await this.storage.write({body:n,contentLength:r,id:t,start:e}),k=p.bytesWritten>=m;c&&(k=N(x,m),p.status==="completed"&&!k&&(await this.storage.update({id:t},{status:"part"}),p={...p,status:"part"}));const w=k&&p.bytesWritten!==m?{...p,bytesWritten:m}:p,_=this.buildFileUrl(o,w),M={...z(w,_),...v(w,k),"x-upload-offset":String(w.bytesWritten||0)};return b(w,M,k?200:202)}async handleHead(t){let e=await this.storage.getMeta(t);const r=F(e);if(r){const o=U(e);o&&e.size!==o&&(e={...e,size:o})}const a={...T(e)};if(r){const o=e.metadata||{},n=U(e)||e.size||0,i=Array.isArray(o._chunks)?o._chunks:[],l=N(i,n);Object.assign(a,v(e,l))}return b(e,a,200)}handleOptions(t,e){return{headers:{"Access-Control-Allow-Headers":"Authorization, Content-Type, Content-Length, Content-Disposition, X-File-Metadata, X-Chunked-Upload, X-Total-Size, X-Chunk-Offset, X-Chunk-Checksum","Access-Control-Allow-Methods":t.map(r=>r.toUpperCase()).join(", "),"Access-Control-Max-Age":86400,"X-Max-Upload-Size":String(e)},statusCode:204}}async deleteBatch(t){const e=await this.storage.deleteBatch(t);if(e.successfulCount===0&&e.failedCount>0){const r=e.failed.map(a=>a.id).join(", ");throw d(404,`Failed to delete files: ${r}`)}return{data:e.successful,headers:e.failedCount>0?{"X-Delete-Errors":JSON.stringify(e.failed),"X-Delete-Failed":String(e.failedCount),"X-Delete-Successful":String(e.successfulCount)}:{"X-Delete-Successful":String(e.successfulCount)},statusCode:e.successfulCount===t.length?204:207}}get storage(){throw new Error("storage must be implemented")}buildFileUrl(t,e){throw new Error("buildFileUrl must be implemented")}}export{se as A,ee as a,R as b,P as c,te as e,I as p,Z as v};
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var i=(t,e)=>d(t,"name",{value:e,configurable:!0});import{createHash as p}from"node:crypto";import{createPaginationMetaSchemaObject as c,createPaginationSchemaObject as l}from"@visulima/pagination";import{sharedFileMetaSchemaObject as m,sharedErrorSchemaObject as u,sharedFileMetaExampleObject as h,sharedGetList as f,sharedGet as y,sharedGetMeta as g}from"./sharedGet-Ce7WGAsc.js";var k=Object.defineProperty,U=i((t,e)=>k(t,"name",{value:e,configurable:!0}),"o");const R=U((t,e,o)=>{const{supportedTransformerFormat:r,tags:s,transformer:n}={tags:["REST"],transformer:!1,...o},a=p("sha256").update(e).digest("base64");return{components:{examples:h,parameters:{UploadIDinPath:{description:"Upload ID",in:"path",name:"id",schema:{type:"string"}}},responses:{404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"}},schemas:{"X-Chunk-Checksum":{description:"SHA256 checksum of the chunk data for validation. Format: 'sha256 <base64-encoded-checksum>'.",type:"string"},"X-Chunk-Offset":{description:"Byte offset for the chunk being uploaded. Required for PATCH requests in chunked uploads.",type:"integer"},"X-Chunked-Upload":{description:"Header to indicate chunked upload initialization. Set to 'true' to initialize a chunked upload session.",enum:["true"],type:"string"},"X-Chunked-Upload-Response":{description:"Indicates this is a chunked upload session. Returned in HEAD responses.",enum:["true"],type:"string"},"X-Received-Chunks":{description:"JSON array of received chunk offsets. Used for resumable uploads.",type:"string"},"X-Total-Size":{description:"Total size of the file in bytes for chunked uploads. Required when X-Chunked-Upload is 'true'.",type:"integer"},"X-Upload-Complete":{description:"Indicates if the upload is complete. Set to 'true' when all chunks have been uploaded.",enum:["true","false"],type:"string"},"X-Upload-Offset":{description:"Current upload offset in bytes. Returned in responses for chunked uploads.",type:"integer"},...l("FileMetaPagination",{$ref:"#/components/schemas/PaginationMeta"},"#/components/schemas/PaginationMeta"),...c("PaginationMeta"),...u,...m}},paths:{[`${e.replace(/\/$/,"")}/{id}/metadata`]:{get:g(`${a}RestGetFileMeta`,s)},[`${e.replace(/\/$/,"")}/{id}`]:{delete:{description:"Delete a single file",operationId:`${a}RestDeleteFile`,parameters:[{$ref:"#/components/parameters/UploadIDinPath"}],responses:{204:{description:"No Content - File deleted successfully"},404:{$ref:"#/components/responses/404"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Delete file",tags:s},get:y(`${a}RestGetFile`,s,n,r),head:{description:"Get file metadata and upload progress. For chunked uploads, returns progress information including current offset and completion status.",operationId:`${a}RestHeadFile`,parameters:[{$ref:"#/components/parameters/UploadIDinPath"}],responses:{200:{description:"OK",headers:{"Content-Length":{description:"File size in bytes",schema:{type:"integer"}},"Content-Type":{description:"MIME type of the file",schema:{type:"string"}},ETag:{description:"Entity tag for caching",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},"Last-Modified":{description:"Last modified date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},"X-Chunked-Upload":{description:"Indicates this is a chunked upload session",schema:{$ref:"#/components/schemas/X-Chunked-Upload-Response"}},"X-Received-Chunks":{description:"JSON array of received chunk offsets (chunked uploads only)",schema:{$ref:"#/components/schemas/X-Received-Chunks"}},"X-Upload-Complete":{description:"Indicates if upload is complete (chunked uploads only)",schema:{$ref:"#/components/schemas/X-Upload-Complete"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},"X-Upload-Offset":{description:"Current upload offset in bytes (chunked uploads only)",schema:{$ref:"#/components/schemas/X-Upload-Offset"}}}},404:{$ref:"#/components/responses/404"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get file metadata",tags:s},patch:{description:"Upload a chunk for chunked uploads. Requires X-Chunk-Offset header and chunk data in the request body.",operationId:`${a}RestPatchChunk`,parameters:[{$ref:"#/components/parameters/UploadIDinPath"},{description:"Byte offset for this chunk",in:"header",name:"X-Chunk-Offset",required:!0,schema:{$ref:"#/components/schemas/X-Chunk-Offset"}},{description:"SHA256 checksum of the chunk (optional)",in:"header",name:"X-Chunk-Checksum",required:!1,schema:{$ref:"#/components/schemas/X-Chunk-Checksum"}}],requestBody:{content:{"application/octet-stream":{description:"Chunk data as raw binary",schema:{format:"binary",type:"string"}}},description:"Chunk data",required:!0},responses:{200:{description:"Chunk uploaded successfully",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Complete":{description:"Indicates if upload is complete",schema:{$ref:"#/components/schemas/X-Upload-Complete"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},"X-Upload-Offset":{description:"Current upload offset after this chunk",schema:{$ref:"#/components/schemas/X-Upload-Offset"}}}},201:{description:"Upload completed (all chunks received)",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Complete":{description:"Upload is complete",schema:{enum:["true"],type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},400:{content:{"application/json":{example:{error:{code:"BadRequest",message:"X-Chunk-Offset header is required"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Bad Request"},404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Upload session not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},413:{content:{"application/json":{example:{error:{code:"RequestEntityTooLarge",message:"Chunk size exceeds maximum allowed size of 104857600 bytes"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Request Entity Too Large"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Upload chunk",tags:s},put:{description:"Create or update a file. Requires file ID in the URL path. If file exists, it will be overwritten.",operationId:`${a}RestPutFile`,parameters:[{$ref:"#/components/parameters/UploadIDinPath"}],requestBody:{content:{"application/octet-stream":{description:"File data as raw binary",schema:{format:"binary",type:"string"}}},description:"File data",required:!0},responses:{200:{description:"File updated successfully",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},201:{description:"File created successfully",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},400:{content:{"application/json":{example:{error:{code:"BadRequest",message:"Request body is required"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Bad Request"},413:{content:{"application/json":{example:{error:{code:"RequestEntityTooLarge",message:"File size exceeds maximum allowed size"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Request Entity Too Large"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Create or update file",tags:s}},[e.trimEnd()]:{delete:{description:'Delete multiple files. Supports batch delete via query parameter (?ids=id1,id2,id3) or JSON body ({ids: ["id1", "id2"]} or ["id1", "id2"]).',operationId:`${a}RestBatchDelete`,parameters:[{description:"Comma-separated list of file IDs to delete",in:"query",name:"ids",required:!1,schema:{example:"id1,id2,id3",type:"string"}}],requestBody:{content:{"application/json":{schema:{oneOf:[{properties:{ids:{description:"Array of file IDs to delete",items:{type:"string"},type:"array"}},required:["ids"],type:"object"},{description:"Array of file IDs to delete",items:{type:"string"},type:"array"}]}}},description:"File IDs to delete (optional if using query parameter)",required:!1},responses:{204:{description:"All files deleted successfully"},207:{description:"Multi-Status - Some files deleted successfully",headers:{"X-Delete-Errors":{description:"JSON array of deletion errors",schema:{type:"string"}},"X-Delete-Failed":{description:"Number of files that failed to delete",schema:{type:"integer"}},"X-Delete-Successful":{description:"Number of files successfully deleted",schema:{type:"integer"}}}},400:{content:{"application/json":{example:{error:{code:"BadRequest",message:"No file IDs provided"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Bad Request"},404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Failed to delete files: id1, id2"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Batch delete files",tags:s},get:f(`${a}RestGetList`,s),post:{description:"Upload a file with raw binary data or initialize a chunked upload session. For chunked uploads, set X-Chunked-Upload: true and X-Total-Size headers.",operationId:`${a}RestPostFile`,parameters:[{description:"Set to 'true' to initialize a chunked upload session",in:"header",name:"X-Chunked-Upload",required:!1,schema:{$ref:"#/components/schemas/X-Chunked-Upload"}},{description:"Total size of the file in bytes (required for chunked uploads)",in:"header",name:"X-Total-Size",required:!1,schema:{$ref:"#/components/schemas/X-Total-Size"}},{description:"Optional filename",in:"header",name:"Content-Disposition",required:!1,schema:{example:'attachment; filename="photo.jpg"',type:"string"}},{description:"Optional JSON metadata",in:"header",name:"X-File-Metadata",required:!1,schema:{example:'{"description":"My photo"}',type:"string"}}],requestBody:{content:{"application/octet-stream":{description:"File data as raw binary. For chunked upload initialization, body can be empty.",schema:{format:"binary",type:"string"}}},description:"File data (optional for chunked upload initialization)",required:!1},responses:{200:{description:"The file already exists, send a resume request",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},201:{description:"File uploaded successfully or chunked upload session initialized",headers:{ETag:{description:"Upload ETag",schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},Location:{description:"File URL or chunked upload session URL",schema:{example:`${t}${e}/file-id`,format:"uri",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},400:{content:{"application/json":{example:{error:{code:"BadRequest",message:"Request body is required for non-chunked uploads"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Bad Request"},413:{content:{"application/json":{example:{error:{code:"RequestEntityTooLarge",message:"File size exceeds maximum allowed size"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Request Entity Too Large"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Upload file or initialize chunked upload",tags:s}}}}},"swaggerSpec");export{R as default};
@@ -0,0 +1 @@
1
+ var U=Object.defineProperty;var d=(o,t)=>U(o,"name",{value:t,configurable:!0});import{Readable as y}from"node:stream";import{z as E,B as M,$ as C,t as O}from"./storage-m_Cxgiih.js";import{r as A,d as T,o as f}from"./part-match-DqD5U7An.js";import{throwErrorCode as p,ERRORS as m}from"./ERRORS-B9jkvKwx.js";import{createRetryWrapper as I}from"./isRetryableError-DQNSZiBc.js";import{O as b}from"./local-meta-storage-Bkwqi_gi.js";import{u as z}from"./update-size-DANV7aa2.js";import{o as R}from"./has-content-Bx2p8Okx.js";import{o as x}from"./is-expired-1JuZjDtb.js";var B=Object.defineProperty,v=d((o,t)=>B(o,"name",{value:t,configurable:!0}),"o$1");const L=v((o,t)=>{const e={};return Object.keys(o).forEach(r=>{e[r]=t(o[r])}),e},"mapValues");var N=Object.defineProperty,$=d((o,t)=>N(o,"name",{value:t,configurable:!0}),"t");const K=$(o=>o===Number(o)?o:(E(o)??0)/1e3,"toSeconds");var j=Object.defineProperty,g=d((o,t)=>j(o,"name",{value:t,configurable:!0}),"u");const D=5*1024*1024,F=16*1024*1024;class Z extends M{static{d(this,"S3BaseStorage")}static{g(this,"S3BaseStorage")}checksumTypes=["md5","crc32","crc32c","sha1","sha256"];bucket;meta;MAX_PARTS=1e4;partSize;retry;constructor(t){if(super(t),this.bucket=t.bucket,this.partSize=typeof t.partSize=="string"?C(t.partSize):t.partSize||F,this.partSize<D)throw new Error("Minimum allowed partSize value is 5MB");const e={backoffMultiplier:2,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:g(s=>{const a=s;return a.statusCode&&[408,429,500,502,503,504].includes(a.statusCode)?!0:a.retryable??!1},"shouldRetry"),...t.retryConfig};this.retry=I(e);const{metaStorage:r,metaStorageConfig:n}=t;if(r)this.meta=r;else{const s={...t,...n,logger:this.logger};"directory"in s?(this.logger?.debug("Using local meta storage"),this.meta=new b(s)):this.meta=new b(s)}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(s=>{this.logger?.error("Storage access check failed: %O",s)})}async create(t){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const i=typeof t.ttl=="string"?O(t.ttl):t.ttl;i!==void 0&&(e.expiredAt=Date.now()+i)}const r=new(this.getFileClass())(e);r.name=this.namingFunction(r),await this.validate(r);try{const i=await this.getMeta(r.id);if(i.bytesWritten>=0)return i}catch{}const n=this.getS3Api();let s;try{s=await this.retry(()=>n.createMultipartUpload({ACL:this.getAcl(),Bucket:this.bucket,ContentType:r.contentType,Key:r.name,Metadata:L({originalName:r.originalName,...r.metadata},i=>encodeURI(String(i)))}))}catch{return p(m.FILE_ERROR,"s3 create upload error")}const{UploadId:a}=s||{};return a?(r.UploadId=a,r.bytesWritten=0,this.config.clientDirectUpload&&(r.partSize??=this.partSize),await this.saveMeta(r),r.status="created",await this.onCreate(r),this.config.clientDirectUpload?this.buildPresigned(r):r):p(m.FILE_ERROR,"s3 create upload error")})}async write(t){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(typeof t.size=="number"&&t.size>0&&z(e,t.size),!A(t,e))return p(m.FILE_CONFLICT);if(this.config.clientDirectUpload)return this.buildPresigned(e);e.Parts??=await this.getParts(e),e.bytesWritten=e.Parts.map(r=>r.Size||0).reduce((r,n)=>r+n,0),await this.lock(t.id);try{if(R(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))return p(m.UNSUPPORTED_CHECKSUM_ALGORITHM);if(e.Parts.length===0&&(!e.contentType||e.contentType==="application/octet-stream"))try{const l=t.body instanceof y?t.body:y.fromWeb(t.body),{fileType:c,stream:u}=await T(l);c?.mime&&(e.contentType=c.mime),t.body=u}catch{}if(e.Parts.length>this.MAX_PARTS)throw new Error(`Exceeded ${this.MAX_PARTS} as part of the upload to ${this.bucket}.`);const r=e.Parts.length+1,n=this.getS3Api(),s=e.UploadId;if(!s)throw new Error("UploadId is required");const{ETag:a}=await this.retry(()=>n.uploadPart({Body:t.body,Bucket:this.bucket,ContentLength:t.contentLength||0,Key:e.name,PartNumber:r,UploadId:s,...t.checksumAlgorithm==="md5"?{ContentMD5:t.checksum}:{}})),i={ETag:a,PartNumber:r,Size:t.contentLength};e.Parts=[...e.Parts,i],e.bytesWritten+=t.contentLength||0}if(this.cache.set(e.id,e),e.status=f(e),e.status==="completed"){const[r]=await this.internalOnComplete(e);delete e.Parts,e.uri=r.Location,e.ETag=r.ETag}}finally{await this.unlock(t.id)}return e})}async delete({id:t}){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);e.status="deleted",await Promise.all([this.deleteMeta(e.id),this.retry(()=>this.abortMultipartUpload(e))]);const r={...e};return await this.onDelete(r),r})}async copy(t,e,r){return this.instrumentOperation("copy",async()=>{const n=await this.getMeta(t),s=`${this.bucket}/${t}`;let a=this.bucket,i=e;if(e.startsWith("/")){const[,c,...u]=e.split("/");a=c||this.bucket,i=u.join("/")}const l=this.getS3Api();return await this.retry(()=>l.copyObject({Bucket:a,CopySource:s,Key:i,...r?.storageClass&&{StorageClass:r.storageClass}})),{...n,id:i,name:i}})}async move(t,e){return this.instrumentOperation("move",async()=>{await this.copy(t,e);const r=this.getS3Api();return await this.retry(()=>r.deleteObject({Bucket:this.bucket,Key:t})),await this.getMeta(e)})}async list(t=1e3){return this.instrumentOperation("list",async()=>{const e=this.getS3Api();let r={Bucket:this.bucket,MaxKeys:t};const n=[];let s=!0;for(;s;)try{const a=await this.retry(()=>e.listObjectsV2(r));for(const{Key:i,LastModified:l}of a?.Contents||[])if(i!==void 0){const{Expires:c}=await this.retry(()=>e.headObject({Bucket:this.bucket,Key:i}));c&&x({expiredAt:c})?await this.delete({id:i}):n.push({id:i,...l&&{createdAt:l}})}s=a.IsTruncated||!1,s&&a.NextContinuationToken&&(r={...r,ContinuationToken:a.NextContinuationToken})}catch(a){const i=this.normalizeError(a instanceof Error?a:new Error(String(a)));throw await this.onError(i),a}return n},{limit:t})}async exists({id:t}){return this.instrumentOperation("exists",async()=>{try{await this.getMeta(t);const e=this.getS3Api();return await this.retry(()=>e.headObject({Bucket:this.bucket,Key:t})),!0}catch{return!1}})}async get({id:t}){return this.instrumentOperation("get",async()=>{const e=this.getS3Api(),{Body:r,ContentLength:n,ContentType:s,ETag:a,Expires:i,LastModified:l,Metadata:c}=await this.retry(()=>e.getObject({Bucket:this.bucket,Key:t}));await this.checkIfExpired({expiredAt:i});const u=[];if(r)if(r instanceof y)for await(const h of r)u.push(h instanceof Uint8Array?h:new Uint8Array(h));else{const h=r.getReader();for(;;){const{done:k,value:P}=await h.read();if(k)break;u.push(P)}}const{originalName:w,...S}=c||{};return{content:Buffer.concat(u),contentType:s,ETag:a,expiredAt:i,id:t,metadata:S,modifiedAt:l,name:t,originalName:w||t,size:Number(n)}})}async buildPresigned(t){const e=t;if(e.Parts?.length||(e.Parts=await this.getParts(t)),e.bytesWritten=e.Parts.map(r=>r.Size||0).reduce((r,n)=>r+n,0),t.status=f(e),e.partsUrls?.length||(e.partsUrls=await this.getPartsPresignedUrls(t)),t.status==="completed"){const[r]=await this.internalOnComplete(t);return delete e.Parts,e.uri=r.Location,t}return t}async getPartsPresignedUrls(t){t.partSize??=this.partSize;const e=t.UploadId;if(!e)throw new Error("UploadId is required for getting presigned URLs");const r=Math.trunc(t.size/this.partSize)+1,n=[],s=Math.trunc(K(this.config.expiration?.maxAge||"6hrs")),a=this.getS3Api();for(let i=0;i<r;i++)n.push(a.getPresignedUrl({Bucket:this.bucket,expiresIn:s,Key:t.name,PartNumber:i+1,UploadId:e}));return Promise.all(n)}async getParts(t){const e=this.getS3Api(),r=t.UploadId;if(!r)throw new Error("UploadId is required");const{Parts:n=[]}=await this.retry(()=>e.listParts({Bucket:this.bucket,Key:t.name,UploadId:r}));return n}completeMultipartUpload(t){const e=this.getS3Api(),r=t.UploadId;if(!r)throw new Error("UploadId is required");const n=t.Parts?.map(({ETag:s,PartNumber:a})=>{if(!s||!a)throw new Error("ETag and PartNumber are required");return{ETag:s,PartNumber:a}})||[];return this.retry(()=>e.completeMultipartUpload({Bucket:this.bucket,Key:t.name,Parts:n,UploadId:r}))}async abortMultipartUpload(t){if(t.status!=="completed")try{const e=this.getS3Api(),r=t.UploadId;if(!r)return;await this.retry(()=>e.abortMultipartUpload({Bucket:this.bucket,Key:t.name,UploadId:r}))}catch(e){this.logger?.error("abortMultipartUploadError: ",e);const r=this.normalizeError(e instanceof Error?e:new Error(String(e)));await this.onError(r)}}internalOnComplete=g(async t=>{const[e]=await Promise.all([this.completeMultipartUpload(t),this.deleteMeta(t.id)]);return[e,t]},"internalOnComplete")}export{Z as S};
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var d=(e,t)=>g(e,"name",{value:t,configurable:!0});var y=Object.defineProperty,r=d((e,t)=>y(e,"name",{value:t,configurable:!0}),"a");const l={value:{createdAt:"2022-12-16T10:35:17.466Z",id:"391c9157ec481ac6-f72b2d884632d7e6-cdeb2056546033e3",modifiedAt:"2022-12-16T10:35:17.470Z"}},s=r((e,t)=>e.map(i=>({...i,description:`[${t}] ${i.description}`,"x-group":t})),"createParameterGroup"),u=r((e,t=["jpeg","png","webp","avif","tiff","gif","mp4","webm","mkv","ogg","mp3","wav","aac","flac"])=>{if(!e)return[];const i=s([{description:"Output format for the transformed media",in:"query",name:"format",schema:{enum:t,type:"string"}},{description:"Quality setting (0-100 for images, affects compression)",in:"query",name:"quality",schema:{maximum:100,minimum:1,type:"integer"}}],"Common"),n=s([{description:"Desired width in pixels",in:"query",name:"width",schema:{minimum:1,type:"integer"}},{description:"Desired height in pixels",in:"query",name:"height",schema:{minimum:1,type:"integer"}},{description:"Resize fit mode",in:"query",name:"fit",schema:{enum:["cover","contain","fill","inside","outside"],type:"string"}},{description:"Position for cover/contain fits",in:"query",name:"position",schema:{oneOf:[{enum:["top","right","bottom","left","center"],type:"string"},{minimum:0,type:"integer"}]}},{description:"Avoid enlarging images smaller than specified dimensions",in:"query",name:"withoutEnlargement",schema:{type:"boolean"}},{description:"Avoid reducing images larger than specified dimensions",in:"query",name:"withoutReduction",schema:{type:"boolean"}},{description:"Resize kernel algorithm",in:"query",name:"kernel",schema:{enum:["nearest","cubic","mitchell","lanczos2","lanczos3"],type:"string"}},{description:"Fast shrink on load for large images",in:"query",name:"fastShrinkOnLoad",schema:{type:"boolean"}},{description:"Crop area left offset",in:"query",name:"left",schema:{minimum:0,type:"integer"}},{description:"Crop area top offset",in:"query",name:"top",schema:{minimum:0,type:"integer"}},{description:"Crop area width",in:"query",name:"cropWidth",schema:{minimum:1,type:"integer"}},{description:"Crop area height",in:"query",name:"cropHeight",schema:{minimum:1,type:"integer"}},{description:"Rotation angle in degrees. Note: angles other than 90°, 180°, and 270° require interpolation and may affect quality",in:"query",name:"angle",schema:{type:"number"}},{description:"Background color for rotation (hex, rgb, or color name)",in:"query",name:"background",schema:{type:"string"}},{description:"Apply blur effect",in:"query",name:"blur",schema:{type:"boolean"}},{description:"Apply sharpening",in:"query",name:"sharpen",schema:{type:"boolean"}},{description:"Apply median filter with specified size",in:"query",name:"median",schema:{minimum:1,type:"integer"}},{description:"Apply CLAHE (Contrast Limited Adaptive Histogram Equalization)",in:"query",name:"clahe",schema:{type:"boolean"}},{description:"Apply thresholding with specified value (0-255)",in:"query",name:"threshold",schema:{maximum:255,minimum:0,type:"integer"}},{description:"Apply gamma correction",in:"query",name:"gamma",schema:{type:"boolean"}},{description:"Negate (invert) the image",in:"query",name:"negate",schema:{type:"boolean"}},{description:"Normalise the image",in:"query",name:"normalise",schema:{type:"boolean"}},{description:"Flatten alpha channel",in:"query",name:"flatten",schema:{type:"boolean"}},{description:"Unflatten alpha channel",in:"query",name:"unflatten",schema:{type:"boolean"}},{description:"Flip image vertically",in:"query",name:"flip",schema:{type:"boolean"}},{description:"Flop image horizontally",in:"query",name:"flop",schema:{type:"boolean"}},{description:"Convert to greyscale",in:"query",name:"greyscale",schema:{type:"boolean"}},{description:"Apply modulation effects",in:"query",name:"modulate",schema:{type:"boolean"}},{description:"Brightness multiplier for modulation",in:"query",name:"brightness",schema:{type:"number"}},{description:"Saturation multiplier for modulation",in:"query",name:"saturation",schema:{type:"number"}},{description:"Hue rotation in degrees for modulation",in:"query",name:"hue",schema:{type:"integer"}},{description:"Lightness adjustment for modulation",in:"query",name:"lightness",schema:{type:"integer"}},{description:"Apply tinting",in:"query",name:"tint",schema:{type:"boolean"}},{description:"Convert colourspace",in:"query",name:"colourspace",schema:{enum:["srgb","rgb","cmyk","lab","b-w"],type:"string"}},{description:"Apply affine transformation",in:"query",name:"affine",schema:{type:"boolean"}},{description:"Apply dilation",in:"query",name:"dilate",schema:{type:"boolean"}},{description:"Apply erosion",in:"query",name:"erode",schema:{type:"boolean"}},{description:"Set pipeline colourspace",in:"query",name:"pipelineColourspace",schema:{type:"boolean"}},{description:"Convert to colourspace",in:"query",name:"toColourspace",schema:{type:"boolean"}},{description:"Remove alpha channel",in:"query",name:"removeAlpha",schema:{type:"boolean"}},{description:"Ensure alpha channel",in:"query",name:"ensureAlpha",schema:{type:"boolean"}}],"Image"),m=s([{description:"Desired width in pixels",in:"query",name:"width",schema:{minimum:1,type:"integer"}},{description:"Desired height in pixels",in:"query",name:"height",schema:{minimum:1,type:"integer"}},{description:"Video frame rate in Hz",in:"query",name:"frameRate",schema:{minimum:1,type:"number"}},{description:"Video key frame interval in seconds",in:"query",name:"keyFrameInterval",schema:{minimum:.1,type:"number"}}],"Video"),o=s([{description:"Target bitrate in bits per second",in:"query",name:"bitrate",schema:{minimum:1,type:"integer"}},{description:"Video or audio codec",in:"query",name:"codec",schema:{enum:["avc","hevc","vp8","vp9","av1","aac","opus","mp3","vorbis","flac"],type:"string"}}],"Video/Audio"),h=s([{description:"Audio channel count",in:"query",name:"numberOfChannels",schema:{enum:[1,2,3,4,5,6,7,8],type:"integer"}},{description:"Audio sample rate in Hz",in:"query",name:"sampleRate",schema:{enum:[8e3,11025,16e3,22050,32e3,44100,48e3,88200,96e3,192e3],type:"integer"}}],"Audio");let a=[];a=[...a,...i],(e===!0||e==="image")&&(a=[...a,...n]),(e===!0||e==="video")&&(a=[...a,...m]),(e===!0||e==="video"||e==="audio")&&(a=[...a,...o]),(e===!0||e==="audio")&&(a=[...a,...h]);const p=new Set;return a.filter(c=>p.has(c.name)?!1:(p.add(c.name),!0))},"getTransformationParameters"),q=r((e,t=["jpeg","png","webp","avif","tiff","gif","mp4","webm","mkv","ogg","mp3","wav","aac","flac"])=>{const i=u(e,t),n={};return i.forEach(m=>{const o=m["x-group"]||"Other";n[o]||(n[o]=[]),n[o].push(m.name)}),{groups:n,parameters:i}},"getOrganizedTransformationParameters"),f=r(e=>e?{"X-Media-Type":{description:"Type of media (image/video/audio)",schema:{enum:["image","video","audio"],type:"string"}},"X-Original-Format":{description:"Original file format",schema:{type:"string"}},"X-Transformed-Format":{description:"Transformed file format",schema:{type:"string"}}}:{},"getTransformationHeaders"),b=r(e=>e?{400:{content:{"application/json":{examples:{ValidationError:{value:{error:{code:"INVALID_PARAMS_FOR_IMAGE",details:{invalidParams:["codec","bitrate"],mediaType:"image",validParams:["format","quality","width","height","fit","position","withoutEnlargement","withoutReduction","kernel","fastShrinkOnLoad","left","top","cropWidth","cropHeight","angle","background","blur","sharpen","median","clahe","threshold","gamma","negate","normalise","flatten","unflatten","flip","flop","greyscale","modulate","brightness","saturation","hue","lightness","tint","colourspace","affine","dilate","erode","pipelineColourspace","toColourspace","removeAlpha","ensureAlpha"]},message:"Invalid query parameters for image transformation: codec, bitrate. Images support: format, quality, width, height, fit, position, withoutEnlargement, withoutReduction, kernel, fastShrinkOnLoad, left, top, cropWidth, cropHeight, angle, background, blur, sharpen, median, clahe, threshold, gamma, negate, normalise, flatten, unflatten, flip, flop, greyscale, modulate, brightness, saturation, hue, lightness, tint, colourspace, affine, dilate, erode, pipelineColourspace, toColourspace, removeAlpha, ensureAlpha. Video/audio parameters (codec, bitrate) are not supported for images.",name:"ValidationError"}}}},schema:{$ref:"#/components/schemas/ValidationError"}}},description:"Invalid transformation parameters"},413:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"File too large for transformation"},415:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Unsupported media type for transformation"}}:{},"getTransformationErrorResponses"),I=r((e,t,i,n)=>({description:"Get the uploaded file with optional media transformation support",operationId:e,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}},...u(i,n)],responses:{200:{content:{"*/*":{schema:{description:i?"Transformed file content":"File content",format:"binary",type:"string"}}},description:i?"File retrieved and transformed successfully":"File retrieved successfully",headers:{"Content-Type":{description:`MIME type of the file${i?" (or transformed file)":""}`,schema:{type:"string"}},ETag:{description:`Upload ETag${i?" (or transformed file ETag)":""}`,schema:{example:"d41d8cd98f00b204e9800998ecf8427e",type:"string"}},"Last-Modified":{description:"Upload last modified date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},...f(i),"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},...b(i),404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"Not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get the uploaded file",tags:t}),"sharedGet"),v=r((e,t)=>({description:"Get the uploaded file metadata",operationId:e,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}}],responses:{200:{content:{"application/json":{schema:{$ref:"#/components/schemas/FileMeta"}}},description:"OK",headers:{"Last-Modified":{description:"Upload last modified date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}},"X-Upload-Expires":{description:"Upload expiration date",schema:{example:"2021-08-25T11:12:26.635Z",format:"date-time",type:"string"}}}},404:{content:{"application/json":{example:{error:{code:"FileNotFound",message:"File metadata not found"}},schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get the uploaded file metadata",tags:t}),"sharedGetMeta"),E={Error:{description:"Error",properties:{error:{properties:{code:{minLength:1,type:"string"},message:{minLength:1,type:"string"},name:{minLength:3,type:"string"}},required:["message"],type:"object"}},required:["error"],type:"object"},ValidationError:{description:"Validation error response",properties:{code:{enum:["INVALID_PARAMS_FOR_IMAGE","INVALID_PARAMS_FOR_VIDEO","INVALID_PARAMS_FOR_AUDIO","INVALID_FIT_VALUE","INVALID_ANGLE_VALUE","INVALID_FORMAT","INCOMPLETE_CROP_PARAMS","INVALID_VIDEO_CODEC","INVALID_VIDEO_FORMAT","INVALID_WIDTH","INVALID_HEIGHT","INVALID_BITRATE","INVALID_FRAME_RATE","INVALID_KEY_FRAME_INTERVAL","INVALID_AUDIO_CODEC","INVALID_AUDIO_FORMAT","INVALID_CHANNEL_COUNT","INVALID_SAMPLE_RATE"],type:"string"},details:{properties:{invalidParams:{items:{type:"string"},type:"array"},mediaType:{enum:["image","video","audio"],type:"string"},suggestions:{items:{type:"string"},type:"array"},validParams:{items:{type:"string"},type:"array"}},required:["invalidParams","validParams","mediaType"],type:"object"},message:{type:"string"},name:{enum:["ValidationError"],type:"string"}},required:["code","details","message","name"],type:"object"}},L={FileMeta:{description:"File meta",properties:{bytesWritten:{type:"integer"},contentType:{type:"string"},createdAt:{format:"date-time",type:"string"},id:{minLength:1,type:"string"},metadata:{type:"object"},name:{minLength:1,type:"string"},originalName:{minLength:1,type:"string"},status:{enum:["completed","part","deleted","created"],type:"string"}},type:"object"}},_={FileMeta:{value:[l]},FileMetaPagination:{value:{data:[l.value],meta:{firstPage:1,firstPageUrl:"/?page=1",lastPage:1,lastPageUrl:"/?page=10",nextPageUrl:"/?page=2",page:1,perPage:1,previousPageUrl:void 0,total:1}}}},F=r((e,t)=>({description:"List upload",operationId:e,parameters:[{description:"Maximum number of elements to retrieve.",in:"query",name:"limit",schema:{nullable:!0,type:"integer"}},{description:"Page number. Use only for pagination.",in:"query",name:"page",schema:{nullable:!0,type:"integer"}}],responses:{200:{content:{"application/json":{examples:{Default:{$ref:"#/components/examples/FileMeta"},Pagination:{$ref:"#/components/examples/FileMetaPagination"}},schema:{$ref:"#/components/schemas/FileMeta"}}},description:"OK"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"List upload",tags:t}),"sharedGetList");export{q as getOrganizedTransformationParameters,E as sharedErrorSchemaObject,_ as sharedFileMetaExampleObject,L as sharedFileMetaSchemaObject,I as sharedGet,F as sharedGetList,v as sharedGetMeta};
@@ -0,0 +1 @@
1
+ var Z=Object.defineProperty;var y=(t,e)=>Z(t,"name",{value:e,configurable:!0});import{Readable as q}from"node:stream";import{setInterval as W}from"node:timers";import{inspect as X}from"node:util";import{L as H,O as j}from"./path-D7rMc9nq-B718mbm6.js";import J from"type-is";import Q from"./NoOpMetrics-Dky06sf1.js";import{N as ee}from"./cache-qV_5Umeq.js";import{ErrorMap as T,throwErrorCode as M,ERRORS as N}from"./ERRORS-B9jkvKwx.js";import{LRUCache as te}from"lru-cache";import{V as re}from"./validator-DK41xp8N.js";import{o as oe}from"./is-expired-1JuZjDtb.js";var se=Object.defineProperty,ae=y((t,e)=>se(t,"name",{value:e,configurable:!0}),"y$2"),ie=Object.defineProperty,ne=ae((t,e)=>ie(t,"name",{value:e,configurable:!0}),"y"),ce=Object.defineProperty,O=ne((t,e)=>ce(t,"name",{value:e,configurable:!0}),"i");const le=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,ue=/^KIBI/,me=/^MIBI/,ge=/^GIBI/,pe=/^TEBI/,he=/^PEBI/,de=/^EXBI/,fe=/^ZEBI/,ye=/^YIBI/,be=/^(.)IB$/,U={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},we=O((t,e)=>{const r=new Intl.NumberFormat(e).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(e).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(t.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},"parseLocalizedNumber"),_=O(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),D=O((t,e)=>{const r={base:2,locale:"en-US",units:"metric",...e};if(typeof t!="string"||t.length===0)throw new TypeError("Value is not a string or is empty.");if(t.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=le.exec(t)?.groups;if(!o)return Number.NaN;const i=we(o.value,r.locale),a=(o.type??"Bytes").toUpperCase().replace(ue,"KILO").replace(me,"MEGA").replace(ge,"GIGA").replace(pe,"TERA").replace(he,"PETA").replace(de,"EXA").replace(fe,"ZETTA").replace(ye,"YOTTA").replace(be,"$1B"),n=U[r.units].findIndex(c=>c.short[0].toUpperCase()===a[0]),l=_(r.base);return i*l**n},"parseBytes");O((t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:o,locale:i,long:a,unit:n,units:l,...c}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},s=_(r),m=Math.abs(t),u=e?.space??!0?" ":"",g=U[l],p=g.findIndex(w=>w.short===n);if(t===0){const w=Math.min(0,Math.max(p,g.length-1));return"0"+u+g[w][a?"long":"short"]}const f=p===-1?Math.min(Math.floor(Math.log(m)/Math.log(s)),g.length-1):p,$=g[f][a?"long":"short"],x=t/s**f,v=o<0?void 0:o;return new Intl.NumberFormat(i,{maximumFractionDigits:v,minimumFractionDigits:v,...c}).format(x)+u+$},"formatBytes");var ve=Object.defineProperty,Ee=y((t,e)=>ve(t,"name",{value:e,configurable:!0}),"u$1"),$e=Object.defineProperty,xe=Ee((t,e)=>$e(t,"name",{value:e,configurable:!0}),"v"),Me=Object.defineProperty,Ne=xe((t,e)=>Me(t,"name",{value:e,configurable:!0}),"D");const Se=Ne((t,e,r,o,i,a,n,l,c,s,m,u,g,p)=>{const f={d:o,h:i,m:a,mo:e,ms:l,s:n,w:r,y:t};return c!==void 0&&(f.future=c),s!==void 0&&(f.past=s),m!==void 0&&(f.decimal=m),u!==void 0&&(f.unitMap=u),g!==void 0&&(f.groupSeparator=g),p!==void 0&&(f.placeholderSeparator=p),f},"createDurationLanguage"),k={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Be=Se(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",k,",","_");var Oe=Object.defineProperty,Te=y((t,e)=>Oe(t,"name",{value:e,configurable:!0}),"o$1"),Pe=Object.defineProperty,Ce=Te((t,e)=>Pe(t,"name",{value:e,configurable:!0}),"o"),Ae=Object.defineProperty,Ie=Ce((t,e)=>Ae(t,"name",{value:e,configurable:!0}),"o");const ze=Ie(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(t,o))throw new TypeError(`Missing required property: ${o}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const o of r)if(typeof t[o]!="string"&&typeof t[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var De=Object.defineProperty,Fe=y((t,e)=>De(t,"name",{value:e,configurable:!0}),"w"),je=Object.defineProperty,Ue=Fe((t,e)=>je(t,"name",{value:e,configurable:!0}),"S"),_e=Object.defineProperty,ke=Ue((t,e)=>_e(t,"name",{value:e,configurable:!0}),"h");const F={d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},S=/[-/\\^$*+?.()|[\]{}]/g,Re=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Le=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ge=/^[+-]?\d+(?:\.\d+)?$/,Ve=/^[-+]/,Ye=ke((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Be}=e??{};ze(o);const i=o.decimal??".",a=o.groupSeparator??",",n=o.placeholderSeparator??"_",l=i.replaceAll(S,String.raw`\$&`),c=a.replaceAll(S,String.raw`\$&`),s=n.replaceAll(S,String.raw`\$&`),m=o.unitMap??k;let u=t.replaceAll(new RegExp(String.raw`(\d)[${s}${c}](\d)`,"g"),"$1$2");if(i!=="."&&(u=u.replace(l,".")),Ge.test(t)){const h=Number.parseFloat(u.trim());if(!Number.isNaN(h)){const d=m[r];if(d!==void 0)return h*F[d]}return}const g=Re.exec(t);if(g){const h=Number.parseInt(g[1]??"0",10),d=Number.parseInt(g[2]??"0",10),E=Number.parseInt(g[3]??"0",10);return h*36e5+d*6e4+E*1e3}const p=Le.exec(t);if(p){let h=0,d=0;p[2]!==void 0?(h=Number.parseInt(p[1]??"0",10),d=Number.parseInt(p[2],10)):p[1]!==void 0&&(d=Number.parseInt(p[1],10));const E=Number.parseInt(p[3]??"0",10);return h*36e5+d*6e4+E*1e3}const f=Object.keys(m).toSorted((h,d)=>d.length-h.length).map(h=>h.replaceAll(S,String.raw`\$&`)).join("|"),$=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${f})`,"gi");let x=0,v,w=!1,C=-1,A=0;for($.lastIndex=0;(v=$.exec(u))!==null;){w||(C=v.index),w=!0;const h=v[1],d=v[2];if(!h||!d)continue;const E=h.trim(),V=E.startsWith("-")?-1:1,Y=E.replace(Ve,""),I=Number.parseFloat(Y),z=m[d.toLowerCase()];if(z===void 0)continue;const K=F[z];if(Number.isNaN(I))return;x+=V*I*K,A=$.lastIndex}const L=u.slice(0,C).trim(),G=u.slice(A).trim();if(!(w&&(L.length>0||G.length>0))&&w)return x},"parseDuration");var Ke=Object.defineProperty,Ze=y((t,e)=>Ke(t,"name",{value:e,configurable:!0}),"e");const B=Ze(t=>{if(t===Number(t))return t;if(!t)return;const e=Ye(t);if(e!==void 0)return e},"toMilliseconds");var qe=Object.defineProperty,We=y((t,e)=>qe(t,"name",{value:e,configurable:!0}),"r");class Xe extends te{static{y(this,"o")}static{We(this,"Locker")}constructor(e){super({ttl:1e3,ttlAutopurge:!0,...e})}lock(e){if(this.get(e))throw new Error(`${e} is locked`);return this.set(e,e),e}unlock(e){this.delete(e)}}var He=Object.defineProperty,P=y((t,e)=>He(t,"name",{value:e,configurable:!0}),"i");const Je=P(t=>{if(typeof t.name=="string")return t.name;if(typeof t.title=="string")return t.title;if(typeof t.originalName=="string")return t.originalName;if(typeof t.filename=="string")return t.filename},"extractOriginalName"),R=P((t,e)=>{const r={...t};return Object.keys(e).forEach(o=>{const i=e[o];if(i!==null&&typeof i=="object"&&!Array.isArray(i)){const a=r[o],n=a&&typeof a=="object"&&!Array.isArray(a)?a:{};r[o]=R(n,i)}else r[o]=i}),r},"deepMerge"),Qe=P((t,e)=>{const r=R(t,e);Object.assign(t,r),t.originalName=Je(t.metadata)||t.originalName},"updateMetadata");var et=Object.defineProperty,b=y((t,e)=>et(t,"name",{value:e,configurable:!0}),"g");const tt={allowMIME:["*/*"],filename:b(({id:t})=>t,"filename"),maxMetadataSize:"8MB",maxUploadSize:"5TB",onComplete:b(()=>{},"onComplete"),onCreate:b(()=>{},"onCreate"),onDelete:b(()=>{},"onDelete"),onError:b(()=>{},"onError"),onUpdate:b(()=>{},"onUpdate"),useRelativeLocation:!1,validation:{}},rt=b(t=>!t||t.length<3||t.length>255||j(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),dt=b(t=>{if(!t||t.length<3||t.length>255||j(t))return!1;const e=t.toUpperCase();return!['"',"*",":","<",">","?","\\","|","../","\0"].some(r=>e.includes(r))},"defaultFilesystemFileNameValidation");class ft{static{y(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];maxUploadSize;expiration;locker;namingFunction;validation=new re;assetFolder=void 0;concurrency;constructor(e){const r={...tt,...e};this.onCreate=r.onCreate,this.onUpdate=r.onUpdate,this.onComplete=r.onComplete,this.onDelete=r.onDelete,this.onError=r.onError,this.namingFunction=r.filename,this.maxUploadSize=typeof r.maxUploadSize=="string"?D(r.maxUploadSize):r.maxUploadSize,this.maxMetadataSize=typeof r.maxMetadataSize=="string"?D(r.maxMetadataSize):r.maxMetadataSize,this.expiration=r.expiration,this.genericConfig=r,r.assetFolder!==void 0&&(this.assetFolder=H(r.assetFolder)),this.locker=new Xe({max:1e3,ttl:3e4,ttlAutopurge:!0}),this.cache=r.cache??new ee,this.logger=r.logger,this.metrics=r.metrics??new Q,this.logger?.debug(`${this.constructor.name} config: ${X({...e,logger:this.logger.constructor})}`);const o=B(r.expiration?.purgeInterval);o&&this.startAutoPurge(o);const i={isValid(c){if(c.size===void 0)return!0;const s=c.size;if(s==null)return!1;const m=typeof s=="number"?s:Number(s);if(Number.isNaN(m)||m<0)return!1;const u=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(u)&&m<=u},response:T.RequestEntityTooLarge,value:this.maxUploadSize},a={isValid(c){return!!J.is(c.contentType,this.value)},response:T.UnsupportedMediaType,value:r.allowMIME},n=r.fileNameValidation??rt,l={isValid(c){return n(c.name)},response:T.InvalidFileName};this.validation.add({filename:l,mime:a,size:i}),this.validation.add({...r.validation})}get tusExtension(){const e=["creation","creation-with-upload","termination","checksum","creation-defer-length","concatenation"];return this.expiration&&e.push("expiration"),e}async validate(e){await this.validation.verify(e)}async exists(e){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id),!0}catch{return!1}})}normalizeError(e){const r={code:e.name,message:e.message,name:e.name,statusCode:500};return{...r,message:`[${this.constructor.name}] ${r.message}`}}get config(){return this.genericConfig}async saveMeta(e){return this.updateTimestamps(e),this.cache.set(e.id,e),this.meta.save(e.id,e)}async deleteMeta(e){return this.cache.delete(e),this.meta.delete(e)}async getMeta(e){try{const r=await this.meta.get(e);return this.cache.set(r.id,r),{...r}}catch(r){const o=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(o),M(N.FILE_NOT_FOUND)}}async checkIfExpired(e){return oe(e)?(this.delete(e).catch(()=>{}),this.deleteMeta(e.id).catch(()=>{}),M(N.GONE)):e}async purge(e){return this.instrumentOperation("purge",async()=>{const r=B(e||this.expiration?.maxAge),o={items:[],maxAgeMs:r};if(r){const i=Date.now()-r,a=(await this.list()).filter(n=>Number(new Date(this.expiration?.rolling&&n.modifiedAt||n.createdAt))<i);for await(const{id:n,...l}of a)try{const c=await this.delete({id:n});o.items.push({...c,...l})}catch(c){this.logger?.warn(`Failed to delete file ${n} during purge: ${c instanceof Error?c.message:String(c)}`)}o.items.length>0&&(this.logger?.info(`Purge: removed ${o.items.length} uploads`),this.metrics.gauge("storage.operations.purge.items_count",o.items.length,{storage:this.constructor.name.toLowerCase().replace("storage","")}))}return o})}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const r=await this.get({id:e}),o=q.from(r.content);return{headers:{"Content-Length":String(r.size),"Content-Type":r.contentType,...r.ETag&&{ETag:r.ETag},...r.modifiedAt&&{"Last-Modified":r.modifiedAt.toString()}},size:typeof r.size=="number"?r.size:void 0,stream:o}})}async list(e=1e3){return this.instrumentOperation("list",async()=>{throw new Error("Not implemented")})}async update({id:e},r){return this.instrumentOperation("update",async()=>{const o=await this.getMeta(e),i={...r};if("ttl"in i&&i.ttl!==void 0){const n=i.ttl,l=typeof n=="string"?B(n):n;l!==void 0&&(i.expiredAt=Date.now()+l),delete i.ttl}Qe(o,i),await this.saveMeta(o);const a={...o,status:"updated"};return await this.onUpdate(a),a})}async deleteBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async s=>{try{return{file:await this.delete({id:s}),id:s,success:!0}}catch(m){const u=m instanceof Error?m.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:u,storage:o}),{error:u,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success?i.push(s.value.file):a.push({error:s.value.error,id:s.value.id}):a.push({error:s.reason?.message||"Delete failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.delete.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.delete.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.delete.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async copyBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.copy.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async({destination:s,options:m,source:u})=>{try{return{file:await this.copy(u,s,m),id:s,success:!0}}catch(g){const p=g instanceof Error?g.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:p,storage:o}),{error:p,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success&&s.value.file?i.push(s.value.file):a.push({error:s.value.error||"Copy failed",id:s.value.id}):a.push({error:s.reason?.message||"Copy failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.copy.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.copy.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async moveBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.move.count",1,{batch_size:e.length,storage:o});const i=[],a=[],n=e.map(async({destination:s,source:m})=>{try{return{file:await this.move(m,s),id:s,success:!0}}catch(u){const g=u instanceof Error?u.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:g,storage:o}),{error:g,id:s,success:!1}}}),l=await Promise.allSettled(n);for(const s of l)s.status==="fulfilled"?s.value.success&&s.value.file?i.push(s.value.file):a.push({error:s.value.error||"Move failed",id:s.value.id}):a.push({error:s.reason?.message||"Move failed",id:s.reason?.id||""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.move.success_count",i.length,{storage:o}),this.metrics.gauge("storage.operations.batch.move.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:i,successfulCount:i.length}}async lock(e){const r=[...this.locker.keys()];return r.includes(e)?M(N.FILE_LOCKED):this.config.concurrency&&typeof this.config.concurrency=="number"&&this.config.concurrency<r.length?M(N.STORAGE_BUSY):(this.locker.set(e,e),e)}async unlock(e){this.locker.unlock(e)}isUnsupportedChecksum(e=""){return!!e&&!this.checksumTypes.includes(e)}startAutoPurge(e){if(e>=2147483647)throw new Error("“purgeInterval” must be less than 2147483647 ms");W(()=>{this.purge().catch(r=>this.logger?.error(r))},e)}updateTimestamps(e){e.createdAt??=new Date().toISOString();const r=B(this.expiration?.maxAge);return r&&!e.expiredAt&&(e.expiredAt=this.expiration?.rolling?Date.now()+r:+new Date(e.createdAt)+r),e}async instrumentOperation(e,r,o){const i=Date.now(),a={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,a);const n=await r(),l=Date.now()-i;return this.metrics.timing(`storage.operations.${e}.duration`,l,a),n&&typeof n=="object"&&"size"in n&&typeof n.size=="number"&&this.metrics.gauge("storage.files.size",n.size,{...a,operation:e}),n}catch(n){const l=Date.now()-i,c=n instanceof Error?n.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,l,{...a,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...a,error:c}),n}}}export{D as $,ft as B,dt as a,rt as d,B as t,Qe as u,Ye as z};
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var c=(s,e)=>n(s,"name",{value:e,configurable:!0});var o=Object.defineProperty,S=c((s,e)=>o(s,"name",{value:e,configurable:!0}),"t");const a=S(s=>{const{accessKeyId:e,endpoint:t,secretAccessKey:r}=s??{accessKeyId:process.env.AWS_ACCESS_KEY_ID||process.env.TIGRIS_ACCESS_KEY_ID||process.env.TIGRIS_ACCESS_KEY,endpoint:process.env.TIGRIS_ENDPOINT,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY||process.env.TIGRIS_SECRET_ACCESS_KEY||process.env.TIGRIS_SECRET_KEY};if(!e||!r)throw new Error("Missing required parameters for Tigris client.");return{credentials:{accessKeyId:e,secretAccessKey:r},endpoint:t??"https://t3.storage.dev",forcePathStyle:!1,region:"auto"}},"tigris");export{a as default};
@@ -0,0 +1 @@
1
+ var a=Object.defineProperty;var n=(e,t)=>a(e,"name",{value:t,configurable:!0});import{createHash as i}from"node:crypto";import{createPaginationMetaSchemaObject as o,createPaginationSchemaObject as s}from"@visulima/pagination";import{sharedFileMetaSchemaObject as p,sharedErrorSchemaObject as m,sharedFileMetaExampleObject as c}from"./sharedGet-Ce7WGAsc.js";var d=Object.defineProperty,l=n((e,t)=>d(e,"name",{value:t,configurable:!0}),"n");const g=l((e="/",t=["Transform"])=>{const r=i("sha256").update(e).digest("base64");return{components:{examples:c,parameters:{Affine:{description:"Apply affine transformation",in:"query",name:"affine",schema:{type:"boolean"}},Angle:{description:"Rotation angle in degrees. Note: angles other than 90°, 180°, and 270° require interpolation and may affect quality",in:"query",name:"angle",schema:{type:"number"}},Background:{description:"Background color for rotation (hex, rgb, or color name)",in:"query",name:"background",schema:{type:"string"}},Bitrate:{description:"Target bitrate in bits per second",in:"query",name:"bitrate",schema:{minimum:1,type:"integer"}},Blur:{description:"Apply blur effect",in:"query",name:"blur",schema:{type:"boolean"}},Brightness:{description:"Brightness multiplier for modulation",in:"query",name:"brightness",schema:{type:"number"}},Clahe:{description:"Apply CLAHE (Contrast Limited Adaptive Histogram Equalization)",in:"query",name:"clahe",schema:{type:"boolean"}},Codec:{description:"Video or audio codec",in:"query",name:"codec",schema:{enum:["avc","hevc","vp8","vp9","av1","aac","opus","mp3","vorbis","flac"],type:"string"}},Colourspace:{description:"Convert colourspace",in:"query",name:"colourspace",schema:{enum:["srgb","rgb","cmyk","lab","b-w"],type:"string"}},CropHeight:{description:"Crop area height",in:"query",name:"cropHeight",schema:{minimum:1,type:"integer"}},CropWidth:{description:"Crop area width",in:"query",name:"cropWidth",schema:{minimum:1,type:"integer"}},Dilate:{description:"Apply dilation",in:"query",name:"dilate",schema:{type:"boolean"}},EnsureAlpha:{description:"Ensure alpha channel",in:"query",name:"ensureAlpha",schema:{type:"boolean"}},Erode:{description:"Apply erosion",in:"query",name:"erode",schema:{type:"boolean"}},FastShrinkOnLoad:{description:"Fast shrink on load for large images",in:"query",name:"fastShrinkOnLoad",schema:{type:"boolean"}},FileID:{description:"File identifier",in:"path",name:"id",required:!0,schema:{type:"string"}},Fit:{description:"Resize fit mode",in:"query",name:"fit",schema:{enum:["cover","contain","fill","inside","outside"],type:"string"}},Flatten:{description:"Flatten alpha channel",in:"query",name:"flatten",schema:{type:"boolean"}},Flip:{description:"Flip image vertically",in:"query",name:"flip",schema:{type:"boolean"}},Flop:{description:"Flop image horizontally",in:"query",name:"flop",schema:{type:"boolean"}},Format:{description:"Output format for the transformed media",in:"query",name:"format",schema:{enum:["jpeg","png","webp","avif","tiff","gif","mp4","webm","mkv","ogg","mp3","wav","aac","flac"],type:"string"}},FrameRate:{description:"Video frame rate in Hz",in:"query",name:"frameRate",schema:{minimum:1,type:"number"}},Gamma:{description:"Apply gamma correction",in:"query",name:"gamma",schema:{type:"boolean"}},Greyscale:{description:"Convert to greyscale",in:"query",name:"greyscale",schema:{type:"boolean"}},Height:{description:"Desired height in pixels",in:"query",name:"height",schema:{minimum:1,type:"integer"}},Hue:{description:"Hue rotation in degrees for modulation",in:"query",name:"hue",schema:{type:"integer"}},Kernel:{description:"Resize kernel algorithm",in:"query",name:"kernel",schema:{enum:["nearest","cubic","mitchell","lanczos2","lanczos3"],type:"string"}},KeyFrameInterval:{description:"Video key frame interval in seconds",in:"query",name:"keyFrameInterval",schema:{minimum:.1,type:"number"}},Left:{description:"Crop area left offset",in:"query",name:"left",schema:{minimum:0,type:"integer"}},Lightness:{description:"Lightness adjustment for modulation",in:"query",name:"lightness",schema:{type:"integer"}},Median:{description:"Apply median filter with specified size",in:"query",name:"median",schema:{minimum:1,type:"integer"}},Modulate:{description:"Apply modulation effects",in:"query",name:"modulate",schema:{type:"boolean"}},Negate:{description:"Negate (invert) the image",in:"query",name:"negate",schema:{type:"boolean"}},Normalise:{description:"Normalise the image",in:"query",name:"normalise",schema:{type:"boolean"}},NumberOfChannels:{description:"Audio channel count",in:"query",name:"numberOfChannels",schema:{enum:[1,2,3,4,5,6,7,8],type:"integer"}},PipelineColourspace:{description:"Set pipeline colourspace",in:"query",name:"pipelineColourspace",schema:{type:"boolean"}},Position:{description:"Position for cover/contain fits",in:"query",name:"position",schema:{oneOf:[{enum:["top","right","bottom","left","center"],type:"string"},{minimum:0,type:"integer"}]}},Quality:{description:"Quality setting (0-100 for images, affects compression)",in:"query",name:"quality",schema:{maximum:100,minimum:1,type:"integer"}},RemoveAlpha:{description:"Remove alpha channel",in:"query",name:"removeAlpha",schema:{type:"boolean"}},SampleRate:{description:"Audio sample rate in Hz",in:"query",name:"sampleRate",schema:{enum:[8e3,11025,16e3,22050,32e3,44100,48e3,88200,96e3,192e3],type:"integer"}},Saturation:{description:"Saturation multiplier for modulation",in:"query",name:"saturation",schema:{type:"number"}},Sharpen:{description:"Apply sharpening",in:"query",name:"sharpen",schema:{type:"boolean"}},Threshold:{description:"Apply thresholding with specified value (0-255)",in:"query",name:"threshold",schema:{maximum:255,minimum:0,type:"integer"}},Tint:{description:"Apply tinting",in:"query",name:"tint",schema:{type:"boolean"}},ToColourspace:{description:"Convert to colourspace",in:"query",name:"toColourspace",schema:{type:"boolean"}},Top:{description:"Crop area top offset",in:"query",name:"top",schema:{minimum:0,type:"integer"}},Unflatten:{description:"Unflatten alpha channel",in:"query",name:"unflatten",schema:{type:"boolean"}},Width:{description:"Desired width in pixels",in:"query",name:"width",schema:{minimum:1,type:"integer"}},WithoutEnlargement:{description:"Avoid enlarging images smaller than specified dimensions",in:"query",name:"withoutEnlargement",schema:{type:"boolean"}},WithoutReduction:{description:"Avoid reducing images larger than specified dimensions",in:"query",name:"withoutReduction",schema:{type:"boolean"}}},responses:{404:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"}},schemas:{...s("FileMetaPagination",{$ref:"#/components/schemas/PaginationMeta"},"#/components/schemas/PaginationMeta"),...o("PaginationMeta"),...m,...p,MediaTransformResult:{description:"Result of media transformation",properties:{bitrate:{description:"Bitrate for video/audio (bits per second)",type:"integer"},buffer:{description:"Binary data buffer (not included in JSON response)",type:"string"},duration:{description:"Duration for video/audio in seconds",type:"number"},format:{description:"Output format",type:"string"},height:{description:"Height for image/video in pixels",type:"integer"},mediaType:{description:"Type of media",enum:["image","video","audio"],type:"string"},numberOfChannels:{description:"Audio channel count",type:"integer"},originalFile:{$ref:"#/components/schemas/FileMeta"},sampleRate:{description:"Audio sample rate in Hz",type:"integer"},size:{description:"File size in bytes",type:"integer"},width:{description:"Width for image/video in pixels",type:"integer"}},required:["format","mediaType","originalFile","size"],type:"object"},ValidationError:{description:"Validation error response",properties:{code:{enum:["INVALID_PARAMS_FOR_IMAGE","INVALID_PARAMS_FOR_VIDEO","INVALID_PARAMS_FOR_AUDIO","INVALID_FIT_VALUE","INVALID_ANGLE_VALUE","INVALID_FORMAT","INCOMPLETE_CROP_PARAMS","INVALID_VIDEO_CODEC","INVALID_VIDEO_FORMAT","INVALID_WIDTH","INVALID_HEIGHT","INVALID_BITRATE","INVALID_FRAME_RATE","INVALID_KEY_FRAME_INTERVAL","INVALID_AUDIO_CODEC","INVALID_AUDIO_FORMAT","INVALID_CHANNEL_COUNT","INVALID_SAMPLE_RATE"],type:"string"},details:{properties:{invalidParams:{items:{type:"string"},type:"array"},mediaType:{enum:["image","video","audio"],type:"string"},suggestions:{items:{type:"string"},type:"array"},validParams:{items:{type:"string"},type:"array"}},required:["invalidParams","validParams","mediaType"],type:"object"},message:{type:"string"},name:{enum:["ValidationError"],type:"string"}},required:["code","details","message","name"],type:"object"}}},paths:{[`${e.replace(/\/$/,"")}/{id}/transform`]:{get:{description:"Get transformation metadata for a file without downloading. Returns information about supported transformations and current file properties.",operationId:`${r}TransformGetMetadata`,parameters:[{$ref:"#/components/parameters/FileID"}],responses:{200:{content:{"application/json":{schema:{description:"File transformation metadata",properties:{bitrate:{description:"Current bitrate for video/audio",type:"integer"},dimensions:{description:"Dimensions for image/video",properties:{height:{type:"integer"},width:{type:"integer"}},type:"object"},duration:{description:"Duration for video/audio in seconds",type:"number"},mediaType:{description:"Detected media type",enum:["image","video","audio"],type:"string"},numberOfChannels:{description:"Current channel count for audio",type:"integer"},originalFormat:{description:"Original file format",type:"string"},sampleRate:{description:"Current sample rate for audio",type:"integer"},supportedFormats:{description:"Supported output formats for this media type",items:{type:"string"},type:"array"},supportedParameters:{description:"Supported transformation parameters",items:{type:"string"},type:"array"}},required:["mediaType","supportedFormats","supportedParameters"],type:"object"}}},description:"Transformation metadata"},404:{$ref:"#/components/responses/404"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Get transformation metadata",tags:t}},[`${e.replace(/\/$/,"")}/{id}`]:{get:{description:"Retrieve and transform a file with optional media transformations. Supports resizing, cropping, format conversion, and codec changes based on query parameters.",operationId:`${r}TransformGetFile`,parameters:[{$ref:"#/components/parameters/FileID"},{$ref:"#/components/parameters/Format"},{$ref:"#/components/parameters/Quality"},{$ref:"#/components/parameters/Width"},{$ref:"#/components/parameters/Height"},{$ref:"#/components/parameters/Fit"},{$ref:"#/components/parameters/Position"},{$ref:"#/components/parameters/WithoutEnlargement"},{$ref:"#/components/parameters/WithoutReduction"},{$ref:"#/components/parameters/Left"},{$ref:"#/components/parameters/Top"},{$ref:"#/components/parameters/CropWidth"},{$ref:"#/components/parameters/CropHeight"},{$ref:"#/components/parameters/Angle"},{$ref:"#/components/parameters/Background"},{$ref:"#/components/parameters/Kernel"},{$ref:"#/components/parameters/FastShrinkOnLoad"},{$ref:"#/components/parameters/Blur"},{$ref:"#/components/parameters/Sharpen"},{$ref:"#/components/parameters/Median"},{$ref:"#/components/parameters/Clahe"},{$ref:"#/components/parameters/Threshold"},{$ref:"#/components/parameters/Gamma"},{$ref:"#/components/parameters/Negate"},{$ref:"#/components/parameters/Normalise"},{$ref:"#/components/parameters/Flatten"},{$ref:"#/components/parameters/Unflatten"},{$ref:"#/components/parameters/Flip"},{$ref:"#/components/parameters/Flop"},{$ref:"#/components/parameters/Greyscale"},{$ref:"#/components/parameters/Modulate"},{$ref:"#/components/parameters/Brightness"},{$ref:"#/components/parameters/Saturation"},{$ref:"#/components/parameters/Hue"},{$ref:"#/components/parameters/Lightness"},{$ref:"#/components/parameters/Tint"},{$ref:"#/components/parameters/Colourspace"},{$ref:"#/components/parameters/Affine"},{$ref:"#/components/parameters/Dilate"},{$ref:"#/components/parameters/Erode"},{$ref:"#/components/parameters/PipelineColourspace"},{$ref:"#/components/parameters/ToColourspace"},{$ref:"#/components/parameters/RemoveAlpha"},{$ref:"#/components/parameters/EnsureAlpha"},{$ref:"#/components/parameters/Codec"},{$ref:"#/components/parameters/Bitrate"},{$ref:"#/components/parameters/FrameRate"},{$ref:"#/components/parameters/KeyFrameInterval"},{$ref:"#/components/parameters/NumberOfChannels"},{$ref:"#/components/parameters/SampleRate"}],responses:{200:{content:{"*/*":{schema:{description:"Transformed media file",format:"binary",type:"string"}}},description:"Transformed file returned successfully",headers:{"Content-Type":{description:"MIME type of the transformed file",schema:{type:"string"}},ETag:{description:"ETag of the transformed file",schema:{type:"string"}},"X-Media-Type":{description:"Type of media (image/video/audio)",schema:{enum:["image","video","audio"],type:"string"}},"X-Original-Format":{description:"Original file format",schema:{type:"string"}},"X-Transformed-Format":{description:"Transformed file format",schema:{type:"string"}}}},400:{content:{"application/json":{examples:{ValidationError:{value:{error:{code:"INVALID_PARAMS_FOR_IMAGE",details:{invalidParams:["codec","bitrate"],mediaType:"image",validParams:["format","quality","width","height","fit","position","withoutEnlargement","withoutReduction","left","top","cropWidth","cropHeight","angle","background"]},message:"Invalid query parameters for image transformation: codec, bitrate. Images support: format, quality, width, height, fit, position, withoutEnlargement, withoutReduction, left, top, cropWidth, cropHeight, angle, background. Video/audio parameters (codec, bitrate) are not supported for images.",name:"ValidationError"}}}},schema:{$ref:"#/components/schemas/ValidationError"}}},description:"Invalid transformation parameters"},404:{$ref:"#/components/responses/404"},413:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"File too large for transformation"},415:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Unsupported media type for transformation"},default:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Error"}},summary:"Transform and retrieve file",tags:t}}}}},"swaggerSpec");export{g as default};
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { U as UploadFile, i as ResponseBodyType, B as BaseStorage, j as ErrorResponses } from "./storage.d-BOMUJD96.js";
3
3
  import 'node:stream';
4
- import { M as MediaTransformer } from "./media-transformer.d-ChmjTvjc.js";
5
- import { U as UploadOptions } from "./types.d-DviSTLOg.js";
4
+ import { M as MediaTransformer } from "./media-transformer.d-CY9CsEOe.js";
5
+ import { U as UploadOptions } from "./types.d-D4caL2Fp.js";
6
6
  import 'node:crypto';
7
7
  import 'node:http';
8
8
  import 'lru-cache';
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var o=(t,a)=>c(t,"name",{value:a,configurable:!0});import{createHash as d}from"node:crypto";import{createPaginationMetaSchemaObject as m,createPaginationSchemaObject as p}from"@visulima/pagination";import{sharedGet as u,sharedFileMetaSchemaObject as l,sharedErrorSchemaObject as f,sharedFileMetaExampleObject as T,sharedGetList as b,sharedGetMeta as r}from"./sharedGet-Ce7WGAsc.js";var U=Object.defineProperty,g=o((t,a)=>U(t,"name",{value:a,configurable:!0}),"o");const R=g((t,a)=>{const{supportedTransformerFormat:i,tags:e,transformer:h}={tags:["Tus"],transformer:!1,...a},s=d("sha256").update(t).digest("base64"),n=u(`${s}TusGetFile`,e,h,i);return{components:{examples:T,responses:{404:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Not Found"}},schemas:{"Tus-Checksum-Algorithm":{description:"Added by the checksum extension. The Tus-Checksum-Algorithm response header MUST be a comma-separated list of the checksum algorithms supported by the server.",type:"string"},"Tus-Extension":{description:"The Tus-Extension response header MUST be a comma-separated list of the extensions supported by the Server. If no extensions are supported, the Tus-Extension header MUST be omitted.",type:"string"},"Tus-Max-Size":{description:"The Tus-Max-Size response header MUST be a non-negative integer indicating the maximum allowed size of an entire upload in bytes. The Server SHOULD set this header if there is a known hard limit.",type:"integer"},"Tus-Resumable":{description:"Protocol version",enum:["1.0.0"],type:"string"},"Tus-Version":{description:"The Tus-Version response header MUST be a comma-separated list of protocol versions supported by the Server. The list MUST be sorted by Server's preference where the first one is the most preferred one.",type:"string"},"Upload-Checksum":{description:"Added by the checksum extension. The Upload-Checksum request header contains information about the checksum of the current body payload. The header MUST consist of the name of the used checksum algorithm and the Base64 encoded checksum separated by a space.",type:"string"},"Upload-Length":{description:"The Upload-Length request and response header indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. In the concatenation extension, the Client MUST NOT include the Upload-Length header in the final upload creation",type:"integer"},"Upload-Offset":{description:"The Upload-Offset request and response header indicates a byte offset within a resource. The value MUST be a non-negative integer.",type:"integer"},...p("FileMetaPagination",{$ref:"#/components/schemas/PaginationMeta"},"#/components/schemas/PaginationMeta"),...m("PaginationMeta"),...f,...l}},paths:{[`${t.replace(/\/$/,"")}/{id}/metadata`]:{get:{...r(`${s}TusGetFileMeta`,e),parameters:[...r(`${s}TusGetFileMeta`,e).parameters,{description:"Version of the protocol supported by the client",in:"header",name:"Tus-Resumable",required:!0,schema:{$ref:"#/components/schemas/Tus-Resumable"}}]}},[`${t.replace(/\/$/,"")}/{id}`]:{delete:{description:"When receiving a DELETE request for an existing upload the Server SHOULD free associated resources and MUST respond with the 204 No Content status confirming that the upload was terminated. For all future requests to this URL, the Server SHOULD respond with the 404 Not Found or 410 Gone status.",operationId:`${s}TusFilesDelete`,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}},{in:"header",name:"Tus-Resumable",required:!0,schema:{$ref:"#/components/schemas/Tus-Resumable"}}],responses:{204:{description:"Upload was terminated",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},412:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Precondition Failed",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Tus-Version":{schema:{$ref:"#/components/schemas/Tus-Version"}}}}},summary:"Added by the Termination extension.",tags:e},get:{...n,parameters:[...n.parameters,{description:"Version of the protocol supported by the client",in:"header",name:"Tus-Resumable",required:!0,schema:{$ref:"#/components/schemas/Tus-Resumable"}}]},head:{description:"Used to determine the offset at which the upload should be continued.",operationId:`${s}TusFilesHead`,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}},{in:"header",name:"Tus-Resumable",required:!0,schema:{$ref:"#/components/schemas/Tus-Resumable"}}],responses:{200:{description:"Returns offset",headers:{"Cache-Control":{schema:{enum:["no-store"],type:"string"}},"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Upload-Length":{schema:{$ref:"#/components/schemas/Upload-Length"}},"Upload-Offset":{schema:{$ref:"#/components/schemas/Upload-Offset"}}}},403:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},404:{$ref:"#/components/responses/404"},410:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"If the resource is not found, the Server SHOULD return either the 404 Not Found, 410 Gone or 403 Forbidden status without the Upload-Offset header.",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},412:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Precondition Failed",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Tus-Version":{schema:{$ref:"#/components/schemas/Tus-Version"}}}}},summary:"Used to determine the offset at which the upload should be continued.",tags:e},patch:{description:"The Server SHOULD accept PATCH requests against any upload URL and apply the bytes contained in the message at the given offset specified by the Upload-Offset header. All PATCH requests MUST use Content-Type: application/offset+octet-stream, otherwise the server SHOULD return a 415 Unsupported Media Type status.",operationId:`${s}TusFilePatch`,parameters:[{in:"path",name:"id",required:!0,schema:{type:"string"}},{in:"header",name:"Tus-Resumable",required:!0,schema:{$ref:"#/components/schemas/Tus-Resumable"}},{description:"Length of the body of this request",in:"header",name:"Content-Length",required:!0,schema:{type:"integer"}},{in:"header",name:"Upload-Offset",required:!0,schema:{$ref:"#/components/schemas/Upload-Offset"}},{in:"header",name:"Upload-Checksum",schema:{$ref:"#/components/schemas/Upload-Checksum"}}],requestBody:{content:{"application/offset+octet-stream":{schema:{type:"string"}}},description:"Remaining (possibly partial) content of the file. Required if Content-Length > 0.",required:!1},responses:{204:{description:"Upload offset was updated",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Upload-Expires":{description:"Added by the expiration extension. The Upload-Expires response header indicates the time after which the unfinished upload expires. A Server MAY wish to remove incomplete upload after a given period of time to prevent abandoned upload from taking up extra storage. The Client SHOULD use this header to determine if an upload is still valid before attempting to resume the upload. This header MUST be included in every PATCH response if the upload is going to expire. If the expiration is known at the creation, the Upload-Expires header MUST be included in the response to the initial POST request. Its value MAY change over time. If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the 404 Not Found or 410 Gone status. The latter one SHOULD be used if the Server is keeping track of expired upload. In both cases the Client SHOULD start a new upload. The value of the Upload-Expires header MUST be in RFC 7231 datetime format.",schema:{type:"string"}},"Upload-Offset":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},400:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Added by the checksum extension. The checksum algorithm is not supported by the server",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},403:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"In the concatenation extension, the Server MUST respond with the 403 Forbidden status to PATCH requests against a final upload URL and MUST NOT modify the final or its partial upload.",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},404:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"PATCH request against a non-existent resource",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},409:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"PATCH request with Upload-Offset unequal to the offset of the resource on the server. The Upload-Offset header's value MUST be equal to the current offset of the resource.",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},410:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"PATCH request against a non-existent resource",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},412:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Precondition Failed",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Tus-Version":{schema:{$ref:"#/components/schemas/Tus-Version"}}}},415:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Content-Type was not application/offset+octet-stream",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},460:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Added by the checksum extension. Checksums mismatch",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}}},summary:"Used to resume the upload",tags:e}},[t.trimEnd()]:{get:b(`${s}TusGetList`,e),options:{operationId:`${s}TusOptions`,responses:{204:{description:"Success",headers:{"Tus-Checksum-Algorithm":{schema:{$ref:"#/components/schemas/Tus-Checksum-Algorithm"}},"Tus-Extension":{schema:{$ref:"#/components/schemas/Tus-Extension"}},"Tus-Max-Size":{schema:{$ref:"#/components/schemas/Tus-Max-Size"}},"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Tus-Version":{schema:{$ref:"#/components/schemas/Tus-Version"}}}}},summary:"Request to gather information about the Server's current configuration",tags:e},post:{description:"Endpoint for the Creation extension. Modified by the Creation With Upload extension.",operationId:`${s}TusCreate`,parameters:[{description:"Must be 0 for creation extension. May be a positive number for Creation With Upload extension.",in:"header",name:"Content-Length",schema:{type:"integer"}},{in:"header",name:"Upload-Length",schema:{$ref:"#/components/schemas/Upload-Length"}},{in:"header",name:"Tus-Resumable",schema:{$ref:"#/components/schemas/Tus-Resumable"}},{description:"Added by the Creation extension. The Upload-Metadata request and response header MUST consist of one or more comma-separated key-value pairs. The key and value MUST be separated by a space. The key MUST NOT contain spaces and commas and MUST NOT be empty. The key SHOULD be ASCII encoded and the value MUST be Base64 encoded. All keys MUST be unique. The value MAY be empty. In these cases, the space, which would normally separate the key and the value, MAY be left out. Since metadata can contain arbitrary binary values, Servers SHOULD carefully validate metadata values or sanitize them before using them as header values to avoid header smuggling.",in:"header",name:"Upload-Metadata",schema:{type:"string"}},{description:"Added by the Concatenation extension. The Upload-Concat request and response header MUST be set in both partial and final upload creation requests. It indicates whether the upload is either a partial or final upload. If the upload is a partial one, the header value MUST be partial. In the case of a final upload, its value MUST be final followed by a semicolon and a space-separated list of partial upload URLs that will be concatenated. The partial upload URLs MAY be absolute or relative and MUST NOT contain spaces as defined in RFC 3986.",in:"header",name:"Upload-Concat",schema:{type:"string"}},{description:"Added by the Creation Defer Length extension. The Upload-Defer-Length request and response header indicates that the size of the upload is not known currently and will be transferred later. Its value MUST be 1. If the length of an upload is not deferred, this header MUST be omitted.",in:"header",name:"Upload-Defer-Length",schema:{enum:[1],type:"integer"}},{in:"header",name:"Upload-Offset",schema:{$ref:"#/components/schemas/Upload-Offset"}},{in:"header",name:"Upload-Checksum",schema:{$ref:"#/components/schemas/Upload-Checksum"}}],requestBody:{content:{"application/offset+octet-stream":{schema:{type:"string"}}},description:"(Possibly partial) content of the file. Required if Content-Length > 0.",required:!1},responses:{201:{description:"Created",headers:{Location:{description:"Url of the created resource.",schema:{type:"string"}},"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Upload-Expires":{description:"Added by the Creation With Upload Extension in combination with the expiration extension. The Upload-Expires response header indicates the time after which the unfinished upload expires. A Server MAY wish to remove incomplete upload after a given period of time to prevent abandoned upload from taking up extra storage. The Client SHOULD use this header to determine if an upload is still valid before attempting to resume the upload. This header MUST be included in every PATCH response if the upload is going to expire. If the expiration is known at the creation, the Upload-Expires header MUST be included in the response to the initial POST request. Its value MAY change over time. If a Client does attempt to resume an upload which has since been removed by the Server, the Server SHOULD respond with the 404 Not Found or 410 Gone status. The latter one SHOULD be used if the Server is keeping track of expired upload. In both cases the Client SHOULD start a new upload. The value of the Upload-Expires header MUST be in RFC 7231 datetime format.",schema:{type:"string"}},"Upload-Offset":{schema:{$ref:"#/components/schemas/Upload-Offset"}}}},400:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Added by the Creation With Upload Extension in combination with the checksum extension. The checksum algorithm is not supported by the server",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},412:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Precondition Failed",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}},"Tus-Version":{schema:{$ref:"#/components/schemas/Tus-Version"}}}},413:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"If the length of the upload exceeds the maximum, which MAY be specified using the Tus-Max-Size header, the Server MUST respond with the 413 Request Entity Too Large status.",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},415:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Added by the Creation With Upload Extension. Content-Type was not application/offset+octet-stream",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}},460:{content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}},description:"Added by the Creation With Upload Extension in combination with the checksum extension. Checksums mismatch",headers:{"Tus-Resumable":{schema:{$ref:"#/components/schemas/Tus-Resumable"}}}}},summary:"An empty POST request is used to create a new upload resource. The Upload-Length header indicates the size of the entire upload in bytes. If the Creation With Upload extension is available, the Client MAY include parts of the upload in the initial Creation request",tags:e}}}}},"swaggerSpec");export{R as default};
@@ -705,4 +705,4 @@ interface AudioTransformerConfig extends BaseTransformerConfig {
705
705
  /** Maximum audio size to process (in bytes) */
706
706
  maxAudioSize?: number;
707
707
  }
708
- export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, ToColourspaceOptions as F, GreyscaleOptions as G, RemoveAlphaOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, EnsureAlphaOptions as K, LinearOptions as L, MedianOptions as M, TransformationStep as N, MediaTransformerConfig as O, PipelineColourspaceOptions as P, MediaTransformResult as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, AudioTransformResult as a, AudioResampleOptions as b, AudioChannelMixOptions as c, AudioTransformOptions as d, AudioTransformationStep as e, VideoTransformResult as f, VideoResizeOptions as g, VideoCropOptions as h, VideoRotateOptions as i, VideoTransformOptions as j, VideoTransformationStep as k, RotateOptions as l, ImageFormat as m, TransformOptions as n, BlurOptions as o, CLAHEOptions as p, ConvolveOptions as q, ThresholdOptions as r, BooleanOptions as s, RecombineOptions as t, ModulateOptions as u, TintOptions as v, ColourspaceOptions as w, BandboolOptions as x, AffineOptions as y, ErodeOptions as z };
708
+ export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, ToColourspaceOptions as F, GreyscaleOptions as G, RemoveAlphaOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, EnsureAlphaOptions as K, LinearOptions as L, MedianOptions as M, TransformationStep as N, MediaTransformerConfig as O, PipelineColourspaceOptions as P, MediaTransformResult as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, VideoTransformResult as a, VideoResizeOptions as b, VideoCropOptions as c, VideoRotateOptions as d, VideoTransformOptions as e, VideoTransformationStep as f, AudioTransformResult as g, AudioResampleOptions as h, AudioChannelMixOptions as i, AudioTransformOptions as j, AudioTransformationStep as k, RotateOptions as l, ImageFormat as m, TransformOptions as n, BlurOptions as o, CLAHEOptions as p, ConvolveOptions as q, ThresholdOptions as r, BooleanOptions as s, RecombineOptions as t, ModulateOptions as u, TintOptions as v, ColourspaceOptions as w, BandboolOptions as x, AffineOptions as y, ErodeOptions as z };
@@ -3,7 +3,7 @@ import { IncomingMessage } from 'node:http';
3
3
  import { Readable } from 'node:stream';
4
4
  import { PaginationResult } from '@visulima/pagination';
5
5
  import { U as UploadFile, B as BaseStorage, f as UploadError, g as UploadEventType } from "./storage.d-BOMUJD96.js";
6
- import { M as MediaTransformer } from "./media-transformer.d-ChmjTvjc.js";
6
+ import { M as MediaTransformer } from "./media-transformer.d-CY9CsEOe.js";
7
7
  type WebRequest = globalThis.Request;
8
8
  type WebResponse = globalThis.Response;
9
9
  interface BaseResponse {