@zuplo/runtime 6.59.6 → 6.59.8

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.
@@ -22,8 +22,8 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- var ge=Object.create;var P=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var r=(e,t)=>P(e,"name",{value:t,configurable:!0});var ot=(e,t)=>()=>(e&&(t=e(e=0)),t);var it=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),st=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},j=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _e(t))!he.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(s=de(t,o))||s.enumerable});return e};var ct=(e,t,n)=>(n=e!=null?ge(Ee(e)):{},j(t||!e||!e.__esModule?P(n,"default",{value:e,enumerable:!0}):n,e)),lt=e=>j(P({},"__esModule",{value:!0}),e);var W=class extends Error{static{r(this,"SystemError")}constructor(t,n){super(t,n),this.name="InternalError"}},y=class extends Error{static{r(this,"RuntimeError")}extensionMembers;constructor(t,n){typeof t=="string"?super(t,n):(super(t.message,n),this.extensionMembers=t.extensionMembers),this.name="RuntimeError"}},q=class extends y{static{r(this,"ConfigurationError")}constructor(t,n){super(t,n),this.name="ConfigurationError"}};var ft="zuplo-request-id",me="zp-rid",Oe="zp-body-removed",ye="cf-ray",gt="x-forwarded-scheme",dt="x-forwarded-proto",_t="x-scheme",Re="cf-ipcity",be="cf-ipcontinent",Ae="cf-ipcountry",xe="cf-iplongitude",Le="cf-iplatitude",Et="cf-region",ht="cf-region-code",mt="cf-metro-code",Ot="cf-postal-code",yt="cf-timezone",Rt="zp-ipcity",bt="zp-ipcontinent",At="zp-ipcountry",xt="zp-iplongitude",Lt="zp-iplatitude",Te="zp-asn",Pe="zp-asorg",Ie="zp-colo",Ce="zp-postalcode",Se="zp-metrocode",we="zp-region",Ue="zp-regioncode",Ne="zp-timezone",Tt="zp-http-protocol",N="zp-local-service",De="x-akamai-edgescape",Pt=[De,N],It=[Re,be,Ae,xe,Le,Te,Pe,Ie,Ce,Se,we,Ue,Ne],Ct=["zp-","cf-"],St=[me,ye,Oe];var wt=Symbol("zuplo_meters"),Ut=Symbol("zuplo_dynamic_meters"),Nt="system-logger";var Me=!1;function L(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}r(L,"code");function T(e,t){return Me?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}r(T,"run");function ze(e){return T(e,L([31],39))}r(ze,"red");function ve(e){return T(e,L([32],39))}r(ve,"green");function He(e){return T(e,L([33],39))}r(He,"yellow");function Ze(e){return T(e,L([34],39))}r(Ze,"blue");function Fe(e){return T(e,L([35],39))}r(Fe,"magenta");function Ge(e){return T(e,L([36],39))}r(Ge,"cyan");var Mt=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var J=[ze,ve,He,Ze,Fe,Ge];function $e(e){let t=0,n=e.length,s=0;if(n>0)for(;s<n;)t=(t<<5)-t+e.charCodeAt(s++)|0;return t}r($e,"hashCode");function K(e){let t=Math.abs($e(e));return J[t%J.length]}r(K,"generateColor");function X(e,t,...n){let s=0,o=n.length,u=String(t).replace(/%[sdjoO%]/g,i=>{if(i==="%%")return"%";if(s>=o)return i;switch(i){case"%s":return String(n[s++]);case"%d":return Number(n[s++]).toString();case"%o":return e(n[s++]).split(`
26
- `).map(l=>l.trim()).join(" ");case"%O":return e(n[s++]);case"%j":try{return JSON.stringify(n[s++])}catch{return"[Circular]"}default:return i}});for(let i of n.splice(s))i===null||!(typeof i=="object"&&i!==null)?u+=" "+i:u+=" "+e(i);return u}r(X,"format");function R(e,t,n,s){let o={seen:[],stylize:Ve,showHidden:t??!1,depth:n??2,colors:s??!1,customInspect:!0};return o.colors&&(o.stylize=Be),w(o,e,o.depth)}r(R,"inspect");R.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};R.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Ve(e,t){return e}r(Ve,"stylizeNoColor");function ke(e){return typeof e=="boolean"}r(ke,"isBoolean");function ee(e){return e===void 0}r(ee,"isUndefined");function Be(e,t){let n=R.styles[t];return n?"\x1B["+R.colors[n][0]+"m"+e+"\x1B["+R.colors[n][1]+"m":e}r(Be,"stylizeWithColor");function D(e){return typeof e=="function"}r(D,"isFunction");function te(e){return typeof e=="string"}r(te,"isString");function Ye(e){return typeof e=="number"}r(Ye,"isNumber");function ne(e){return e===null}r(ne,"isNull");function re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r(re,"hasOwn");function M(e){return Z(e)&&F(e)==="[object RegExp]"}r(M,"isRegExp");function Z(e){return typeof e=="object"&&e!==null}r(Z,"isObject");function z(e){return Z(e)&&(F(e)==="[object Error]"||e instanceof Error)}r(z,"isError");function Q(e){return Z(e)&&F(e)==="[object Date]"}r(Q,"isDate");function F(e){return Object.prototype.toString.call(e)}r(F,"objectToString");function je(e){let t={};return e.forEach(function(n,s){t[n]=!0}),t}r(je,"arrayToHash");function We(e,t,n,s,o){let u=[];for(let i=0,l=t.length;i<l;++i)re(t,String(i))?u.push(H(e,t,n,s,String(i),!0)):u.push("");return o.forEach(function(i){i.match(/^\d+$/)||u.push(H(e,t,n,s,i,!0))}),u}r(We,"formatArray");function v(e){return"["+Error.prototype.toString.call(e)+"]"}r(v,"formatError");function w(e,t,n){if(e.customInspect&&t&&D(t.inspect)&&t.inspect!==R&&!(t.constructor&&t.constructor.prototype===t)){let a=t.inspect(n,e);return te(a)||(a=w(e,a,n)),a}let s=qe(e,t);if(s)return s;let o=Object.keys(t),u=je(o);try{e.showHidden&&Object.getOwnPropertyNames&&(o=Object.getOwnPropertyNames(t))}catch{}if(z(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return v(t);if(o.length===0){if(D(t)){let a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(M(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Q(t))return e.stylize(Date.prototype.toString.call(t),"date");if(z(t))return v(t)}let i="",l=!1,p=["{","}"];if(Array.isArray(t)&&(l=!0,p=["[","]"]),D(t)&&(i=" [Function"+(t.name?": "+t.name:"")+"]"),M(t)&&(i=" "+RegExp.prototype.toString.call(t)),Q(t)&&(i=" "+Date.prototype.toUTCString.call(t)),z(t)&&(i=" "+v(t)),o.length===0&&(!l||t.length==0))return p[0]+i+p[1];if(n<0)return M(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);let c;return l?c=We(e,t,n,u,o):c=o.map(function(a){return H(e,t,n,u,a,l)}),e.seen.pop(),Je(c,i,p)}r(w,"formatValue");function H(e,t,n,s,o,u){let i,l,p;p={value:void 0};try{p.value=t[o]}catch{}try{Object.getOwnPropertyDescriptor&&(p=Object.getOwnPropertyDescriptor(t,o)||p)}catch{}if(p.get?p.set?l=e.stylize("[Getter/Setter]","special"):l=e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),re(s,o)||(i="["+o+"]"),l||(e.seen.indexOf(p.value)<0?(ne(n)?l=w(e,p.value,null):l=w(e,p.value,n-1),l.indexOf(`
25
+ var de=Object.create;var P=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var r=(e,t)=>P(e,"name",{value:t,configurable:!0});var ot=(e,t)=>()=>(e&&(t=e(e=0)),t);var it=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),st=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},j=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _e(t))!he.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(s=ge(t,o))||s.enumerable});return e};var ct=(e,t,n)=>(n=e!=null?de(Ee(e)):{},j(t||!e||!e.__esModule?P(n,"default",{value:e,enumerable:!0}):n,e)),lt=e=>j(P({},"__esModule",{value:!0}),e);var W=class extends Error{static{r(this,"SystemError")}constructor(t,n){super(t,n),this.name="InternalError"}},y=class extends Error{static{r(this,"RuntimeError")}extensionMembers;constructor(t,n){typeof t=="string"?super(t,n):(super(t.message,n),this.extensionMembers=t.extensionMembers),this.name="RuntimeError"}},q=class extends y{static{r(this,"ConfigurationError")}constructor(t,n){super(t,n),this.name="ConfigurationError"}};var ft="zuplo-request-id",me="zp-rid",Oe="zp-body-removed",ye="cf-ray",dt="x-forwarded-scheme",gt="x-forwarded-proto",_t="x-scheme",Re="cf-ipcity",be="cf-ipcontinent",Ae="cf-ipcountry",xe="cf-iplongitude",Le="cf-iplatitude",Et="cf-region",ht="cf-region-code",mt="cf-metro-code",Ot="cf-postal-code",yt="cf-timezone",Rt="zp-ipcity",bt="zp-ipcontinent",At="zp-ipcountry",xt="zp-iplongitude",Lt="zp-iplatitude",Te="zp-asn",Pe="zp-asorg",Ie="zp-colo",Ce="zp-postalcode",Se="zp-metrocode",we="zp-region",Ue="zp-regioncode",Ne="zp-timezone",Tt="zp-http-protocol",N="zp-local-service",De="x-akamai-edgescape",Pt=[De,N],It=[Re,be,Ae,xe,Le,Te,Pe,Ie,Ce,Se,we,Ue,Ne],Ct=["zp-","cf-"],St=[me,ye,Oe];var wt=Symbol("zuplo_meters"),Ut=Symbol("zuplo_dynamic_meters"),Nt="system-logger";var Me=!1;function L(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}r(L,"code");function T(e,t){return Me?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}r(T,"run");function ve(e){return T(e,L([31],39))}r(ve,"red");function ze(e){return T(e,L([32],39))}r(ze,"green");function He(e){return T(e,L([33],39))}r(He,"yellow");function Ze(e){return T(e,L([34],39))}r(Ze,"blue");function Fe(e){return T(e,L([35],39))}r(Fe,"magenta");function Ge(e){return T(e,L([36],39))}r(Ge,"cyan");var Mt=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");var J=[ve,ze,He,Ze,Fe,Ge];function $e(e){let t=0,n=e.length,s=0;if(n>0)for(;s<n;)t=(t<<5)-t+e.charCodeAt(s++)|0;return t}r($e,"hashCode");function K(e){let t=Math.abs($e(e));return J[t%J.length]}r(K,"generateColor");function X(e,t,...n){let s=0,o=n.length,u=String(t).replace(/%[sdjoO%]/g,i=>{if(i==="%%")return"%";if(s>=o)return i;switch(i){case"%s":return String(n[s++]);case"%d":return Number(n[s++]).toString();case"%o":return e(n[s++]).split(`
26
+ `).map(l=>l.trim()).join(" ");case"%O":return e(n[s++]);case"%j":try{return JSON.stringify(n[s++])}catch{return"[Circular]"}default:return i}});for(let i of n.splice(s))i===null||!(typeof i=="object"&&i!==null)?u+=" "+i:u+=" "+e(i);return u}r(X,"format");function R(e,t,n,s){let o={seen:[],stylize:Ve,showHidden:t??!1,depth:n??2,colors:s??!1,customInspect:!0};return o.colors&&(o.stylize=Be),w(o,e,o.depth)}r(R,"inspect");R.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};R.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Ve(e,t){return e}r(Ve,"stylizeNoColor");function ke(e){return typeof e=="boolean"}r(ke,"isBoolean");function ee(e){return e===void 0}r(ee,"isUndefined");function Be(e,t){let n=R.styles[t];return n?"\x1B["+R.colors[n][0]+"m"+e+"\x1B["+R.colors[n][1]+"m":e}r(Be,"stylizeWithColor");function D(e){return typeof e=="function"}r(D,"isFunction");function te(e){return typeof e=="string"}r(te,"isString");function Ye(e){return typeof e=="number"}r(Ye,"isNumber");function ne(e){return e===null}r(ne,"isNull");function re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r(re,"hasOwn");function M(e){return Z(e)&&F(e)==="[object RegExp]"}r(M,"isRegExp");function Z(e){return typeof e=="object"&&e!==null}r(Z,"isObject");function v(e){return Z(e)&&(F(e)==="[object Error]"||e instanceof Error)}r(v,"isError");function Q(e){return Z(e)&&F(e)==="[object Date]"}r(Q,"isDate");function F(e){return Object.prototype.toString.call(e)}r(F,"objectToString");function je(e){let t={};return e.forEach(function(n,s){t[n]=!0}),t}r(je,"arrayToHash");function We(e,t,n,s,o){let u=[];for(let i=0,l=t.length;i<l;++i)re(t,String(i))?u.push(H(e,t,n,s,String(i),!0)):u.push("");return o.forEach(function(i){i.match(/^\d+$/)||u.push(H(e,t,n,s,i,!0))}),u}r(We,"formatArray");function z(e){return"["+Error.prototype.toString.call(e)+"]"}r(z,"formatError");function w(e,t,n){if(e.customInspect&&t&&D(t.inspect)&&t.inspect!==R&&!(t.constructor&&t.constructor.prototype===t)){let a=t.inspect(n,e);return te(a)||(a=w(e,a,n)),a}let s=qe(e,t);if(s)return s;let o=Object.keys(t),u=je(o);try{e.showHidden&&Object.getOwnPropertyNames&&(o=Object.getOwnPropertyNames(t))}catch{}if(v(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return z(t);if(o.length===0){if(D(t)){let a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(M(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Q(t))return e.stylize(Date.prototype.toString.call(t),"date");if(v(t))return z(t)}let i="",l=!1,p=["{","}"];if(Array.isArray(t)&&(l=!0,p=["[","]"]),D(t)&&(i=" [Function"+(t.name?": "+t.name:"")+"]"),M(t)&&(i=" "+RegExp.prototype.toString.call(t)),Q(t)&&(i=" "+Date.prototype.toUTCString.call(t)),v(t)&&(i=" "+z(t)),o.length===0&&(!l||t.length==0))return p[0]+i+p[1];if(n<0)return M(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);let c;return l?c=We(e,t,n,u,o):c=o.map(function(a){return H(e,t,n,u,a,l)}),e.seen.pop(),Je(c,i,p)}r(w,"formatValue");function H(e,t,n,s,o,u){let i,l,p;p={value:void 0};try{p.value=t[o]}catch{}try{Object.getOwnPropertyDescriptor&&(p=Object.getOwnPropertyDescriptor(t,o)||p)}catch{}if(p.get?p.set?l=e.stylize("[Getter/Setter]","special"):l=e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),re(s,o)||(i="["+o+"]"),l||(e.seen.indexOf(p.value)<0?(ne(n)?l=w(e,p.value,null):l=w(e,p.value,n-1),l.indexOf(`
27
27
  `)>-1&&(u?l=l.split(`
28
28
  `).map(function(c){return" "+c}).join(`
29
29
  `).substr(2):l=`
@@ -32,5 +32,5 @@ var ge=Object.create;var P=Object.defineProperty;var de=Object.getOwnPropertyDes
32
32
  `))):l=e.stylize("[Circular]","special")),ee(i)){if(u&&o.match(/^\d+$/))return l;i=JSON.stringify(""+o),i.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+l}r(H,"formatProperty");function qe(e,t){if(ee(t))return e.stylize("undefined","undefined");if(te(t)){let n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(Ye(t))return e.stylize(""+t,"number");if(ke(t))return e.stylize(""+t,"boolean");if(ne(t))return e.stylize("null","null")}r(qe,"formatPrimitive");function Je(e,t,n){let s=0;return e.reduce(function(u,i){return s++,i.indexOf(`
33
33
  `)>=0&&s++,u+i.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(t===""?"":t+`
34
34
  `)+" "+e.join(`,
35
- `)+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}r(Je,"reduceToSingleString");var oe=r((e,...t)=>X(R,e,t),"format");var G=class{static{r(this,"Debugger")}manager;ns;color;last;enabled;constructor(t,n){this.manager=t,this.ns=n,this.color=K(n),this.last=0,this.enabled=t.enabled.some(s=>s.test(n))}log(...t){if(!this.enabled)return;let n,s=t[0];typeof s=="function"?n=s():n=String(s);let o=Date.now()-(this.last||Date.now());n=oe(n,...t);let u=`${this.color(this.ns)} ${n} ${this.color(`+${o}ms`)}`;console.log(u),this.last=Date.now()}},$=class{static{r(this,"DebugManager")}debuggers;enabled;constructor(t){this.debuggers=new Map,this.enabled=t??[]}};function Ke(e){return!e||e.length===0?[]:(e=e.replace(/\s/g,"").replace(/\*/g,".+"),e.split(",").map(t=>new RegExp(`^${t}$`)))}r(Ke,"extract");var U;function ie(e){let t=globalThis.DEBUG;U||(U=new $(Ke(t)));let n=new G(U,e);return U.debuggers.set(e,n),Object.assign(n.log.bind(n),{self:n})}r(ie,"debug");function Xe(e){if(e.length>=255)throw new TypeError("Alphabet too long");let t=new Uint8Array(256);for(let c=0;c<t.length;c++)t[c]=255;for(let c=0;c<e.length;c++){let a=e.charAt(c),g=a.charCodeAt(0);if(t[g]!==255)throw new TypeError(a+" is ambiguous");t[g]=c}let n=e.length,s=e.charAt(0),o=Math.log(n)/Math.log(256),u=Math.log(256)/Math.log(n);function i(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";let a=0,g=0,d=0,_=c.length;for(;d!==_&&c[d]===0;)d++,a++;let h=(_-d)*u+1>>>0,E=new Uint8Array(h);for(;d!==_;){let f=c[d],A=0;for(let O=h-1;(f!==0||A<g)&&O!==-1;O--,A++)f+=256*E[O]>>>0,E[O]=f%n>>>0,f=f/n>>>0;if(f!==0)throw new Error("Non-zero carry");g=A,d++}let m=h-g;for(;m!==h&&E[m]===0;)m++;let S=s.repeat(a);for(;m<h;++m)S+=e.charAt(E[m]);return S}r(i,"encode");function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;let a=0,g=0,d=0;for(;c[a]===s;)g++,a++;let _=(c.length-a)*o+1>>>0,h=new Uint8Array(_);for(;c[a];){let f=t[c.charCodeAt(a)];if(f===255)return;let A=0;for(let O=_-1;(f!==0||A<d)&&O!==-1;O--,A++)f+=n*h[O]>>>0,h[O]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");d=A,a++}let E=_-d;for(;E!==_&&h[E]===0;)E++;let m=new Uint8Array(g+(_-E)),S=g;for(;E!==_;)m[S++]=h[E++];return m}r(l,"decodeUnsafe");function p(c){let a=l(c);if(a)return a;throw new Error("Non-base"+n+" character")}return r(p,"decode"),{encode:i,decodeUnsafe:l,decode:p}}r(Xe,"base");var se=Xe;var Qe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ce=se(Qe);var x=ie("zuplo:runtime:external-service");function et(){let e,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:t}=b.instance.runtime;if(t&&t!=="undefined")try{let n=atob(t);e=JSON.parse(n)}catch{}return e}r(et,"getServiceAuth");async function le(e,t){let n=et();if(n)if(x(`Using external service auth. ClientId: ${n.clientId})`),typeof e=="string"){let s=new URL(e),o=s.hostname,u=t??{},i=new Headers(u.headers||{});i.set("CF-Access-Client-Id",n.clientId),i.set("CF-Access-Client-Secret",n.clientSecret),u.headers=i;let l;if(n.customServiceMapping&&n.customServiceMapping[o])l=`https://${n.customServiceMapping[o]}`;else if(b.instance.useLegacyServiceRouting)l=`https://${o}.zuptunnel.com`;else{x("Using sha256 service routing");let a=b.instance.build;if(a.ACCOUNT_NAME&&a.PROJECT_NAME&&a.ENVIRONMENT_TYPE){let g=await tt(o,a.ACCOUNT_NAME,a.PROJECT_NAME,a.ENVIRONMENT_TYPE),d=ae(a.ENVIRONMENT_TYPE),_=await V(`${a.ACCOUNT_NAME}-${a.PROJECT_NAME}-${d}`);_==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||_==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?l=`https://${g}.zuptunnel.com`:l=`https://${g}.t.zuplo.app`}else throw x("Cannot use sha256 service routing, missing build variables"),new y("Failed to generate fully qualified tunnel url.")}let p=new URL(`${l}${s.pathname}${s.search}`);x(`Calling external service: ${p.toString()}`);let c=await I(p.toString(),u);if(c.status===403&&c.headers.get("cf-access-domain")!==null)throw C.console.error("403 Forbidden when calling external service.",{clientId:n.clientId,tunnelHost:l}),new y("Could not connect to secure tunnel.");return c}else throw x("Cannot call external service with Request object"),new y("Currently, we only support fetch(<some_string>, ...).");else throw x("There is no external service auth configured for this zup."),new y("There are no external services configured for this zup.")}r(le,"externalServiceHandler");async function ue(e,t){if(typeof e=="string"){let n=new URL(e),s=n.hostname,o=t??{},u=`http://${s}.zuplo.svc.cluster.local:9000`,i=new URL(`${u}${n.pathname}${n.search}`),l=new Headers(o.headers||{});return l.set(N,s),o.headers=l,await I(i.toString(),o)}else throw new y("Currently, we only support fetch(<some_string>, ...).")}r(ue,"clusterServiceHandler");async function tt(e,t,n,s){let o=e.toLowerCase(),u=t.toLowerCase(),i=n.toLowerCase(),l=ae(s);x(`Hashing service name: ${u}-${o}.${u}-${i}-${l}`);let p=await V(`${u}-${o}`),c=await V(`${u}-${i}-${l}`);return`${p}.${c}`}r(tt,"hashServiceName");async function V(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(u=>u.toString(16).padStart(2,"0")).join("").slice(0,-1)}r(V,"hashSegment");function ae(e){let t=e.toLowerCase();switch(t){case"production":case"preview":return t;default:return"working-copy"}}r(ae,"sanitizeEnvironmentType");var k=new Map;k.set("service:",le);k.set("local:",ue);var I=globalThis.fetch;function B(e,t){let n=nt(t);if(typeof e=="string"){let s=new URL(e),o=k.get(s.protocol);return o?o(e,n):I(e,n)}else return I(e,n)}r(B,"internalFetch");globalThis.fetch=B;var nt=r(e=>{if(!e||e instanceof Request)return e;let t=e;if(!t.zuplo)return e;let n=e;return n.cf={cacheEverything:t.zuplo?.cacheEverything,cacheTtl:t.zuplo?.cacheTtlSeconds},delete e.zuplo,e},"transformInit");var rt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:B},C=rt;var Y="2025-02-06",pe=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0}});function fe(){return new b({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:Y,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:pe[Y]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}r(fe,"getMockEnvironment");var b=class e{static{r(this,"Environment")}config;static#e;static#t=!1;static initialize(t){this.#e||(this.#e=new e(t),this.#t=!0)}static get instance(){return this.#t||(C.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#e=fe()),this.#e}constructor({build:t,runtime:n}){let s;try{if(n.ZUPLO_SYSTEM_CONFIGURATIONS){let o=new TextDecoder().decode(ce.decode(n.ZUPLO_SYSTEM_CONFIGURATIONS)),u=JSON.parse(o);for(let i of Object.keys(u))n[i]||(n[i]=u[i])}if(n.__ZUPLO_CONFIG){let o=atob(n.__ZUPLO_CONFIG);s=JSON.parse(o)}}catch(o){C.console.error("Failed to parse runtime configuration",o)}this.config=s??{},this.build=t,this.runtime=n,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}get rateLimitServiceTimeoutMs(){let t=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,n=this.config.rate_limit_service_timeout_ms,s=t??n;if(!s)return 500;let o=Number(s);return Number.isFinite(o)&&o>0?o:500}};export{r as a,ot as b,it as c,st as d,ct as e,lt as f,ie as g,W as h,y as i,q as j,b as k,ft as l,me as m,Oe as n,ye as o,gt as p,dt as q,_t as r,Re as s,be as t,Ae as u,xe as v,Le as w,Et as x,ht as y,mt as z,Ot as A,yt as B,Rt as C,bt as D,At as E,xt as F,Lt as G,Te as H,Pe as I,Ie as J,Ce as K,Se as L,we as M,Ue as N,Ne as O,Tt as P,N as Q,De as R,Pt as S,It as T,Ct as U,St as V,wt as W,Ut as X,Nt as Y,C as Z};
36
- /*! For license information please see chunk-SSAQ7DDU.js.LEGAL.txt */
35
+ `)+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}r(Je,"reduceToSingleString");var oe=r((e,...t)=>X(R,e,t),"format");var G=class{static{r(this,"Debugger")}manager;ns;color;last;enabled;constructor(t,n){this.manager=t,this.ns=n,this.color=K(n),this.last=0,this.enabled=t.enabled.some(s=>s.test(n))}log(...t){if(!this.enabled)return;let n,s=t[0];typeof s=="function"?n=s():n=String(s);let o=Date.now()-(this.last||Date.now());n=oe(n,...t);let u=`${this.color(this.ns)} ${n} ${this.color(`+${o}ms`)}`;console.log(u),this.last=Date.now()}},$=class{static{r(this,"DebugManager")}debuggers;enabled;constructor(t){this.debuggers=new Map,this.enabled=t??[]}};function Ke(e){return!e||e.length===0?[]:(e=e.replace(/\s/g,"").replace(/\*/g,".+"),e.split(",").map(t=>new RegExp(`^${t}$`)))}r(Ke,"extract");var U;function ie(e){let t=globalThis.DEBUG;U||(U=new $(Ke(t)));let n=new G(U,e);return U.debuggers.set(e,n),Object.assign(n.log.bind(n),{self:n})}r(ie,"debug");function Xe(e){if(e.length>=255)throw new TypeError("Alphabet too long");let t=new Uint8Array(256);for(let c=0;c<t.length;c++)t[c]=255;for(let c=0;c<e.length;c++){let a=e.charAt(c),d=a.charCodeAt(0);if(t[d]!==255)throw new TypeError(a+" is ambiguous");t[d]=c}let n=e.length,s=e.charAt(0),o=Math.log(n)/Math.log(256),u=Math.log(256)/Math.log(n);function i(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";let a=0,d=0,g=0,_=c.length;for(;g!==_&&c[g]===0;)g++,a++;let h=(_-g)*u+1>>>0,E=new Uint8Array(h);for(;g!==_;){let f=c[g],A=0;for(let O=h-1;(f!==0||A<d)&&O!==-1;O--,A++)f+=256*E[O]>>>0,E[O]=f%n>>>0,f=f/n>>>0;if(f!==0)throw new Error("Non-zero carry");d=A,g++}let m=h-d;for(;m!==h&&E[m]===0;)m++;let S=s.repeat(a);for(;m<h;++m)S+=e.charAt(E[m]);return S}r(i,"encode");function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;let a=0,d=0,g=0;for(;c[a]===s;)d++,a++;let _=(c.length-a)*o+1>>>0,h=new Uint8Array(_);for(;c[a];){let f=t[c.charCodeAt(a)];if(f===255)return;let A=0;for(let O=_-1;(f!==0||A<g)&&O!==-1;O--,A++)f+=n*h[O]>>>0,h[O]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");g=A,a++}let E=_-g;for(;E!==_&&h[E]===0;)E++;let m=new Uint8Array(d+(_-E)),S=d;for(;E!==_;)m[S++]=h[E++];return m}r(l,"decodeUnsafe");function p(c){let a=l(c);if(a)return a;throw new Error("Non-base"+n+" character")}return r(p,"decode"),{encode:i,decodeUnsafe:l,decode:p}}r(Xe,"base");var se=Xe;var Qe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",ce=se(Qe);var x=ie("zuplo:runtime:external-service");function et(){let e,{__ZUPLO_EXTERNAL_SERVICE_TOKEN:t}=b.instance.runtime;if(t&&t!=="undefined")try{let n=atob(t);e=JSON.parse(n)}catch{}return e}r(et,"getServiceAuth");async function le(e,t){let n=et();if(n)if(x(`Using external service auth. ClientId: ${n.clientId})`),typeof e=="string"){let s=new URL(e),o=s.hostname,u=t??{},i=new Headers(u.headers||{});i.set("CF-Access-Client-Id",n.clientId),i.set("CF-Access-Client-Secret",n.clientSecret),u.headers=i;let l;if(n.customServiceMapping&&n.customServiceMapping[o])l=`https://${n.customServiceMapping[o]}`;else if(b.instance.useLegacyServiceRouting)l=`https://${o}.zuptunnel.com`;else{x("Using sha256 service routing");let a=b.instance.build;if(a.ACCOUNT_NAME&&a.PROJECT_NAME&&a.ENVIRONMENT_TYPE){let d=await tt(o,a.ACCOUNT_NAME,a.PROJECT_NAME,a.ENVIRONMENT_TYPE),g=ae(a.ENVIRONMENT_TYPE),_=await V(`${a.ACCOUNT_NAME}-${a.PROJECT_NAME}-${g}`);_==="40d7ad502f5d743997999594c177184a00161a77865423511f3a1ea21eb5a5e"||_==="d05bffe8fa91a300187d2cf43e8aa4a56bd809c442ae10d1ee49af7d29a5a11"?l=`https://${d}.zuptunnel.com`:l=`https://${d}.t.zuplo.app`}else throw x("Cannot use sha256 service routing, missing build variables"),new y("Failed to generate fully qualified tunnel url.")}let p=new URL(`${l}${s.pathname}${s.search}`);x(`Calling external service: ${p.toString()}`);let c=await I(p.toString(),u);if(c.status===403&&c.headers.get("cf-access-domain")!==null)throw C.console.error("403 Forbidden when calling external service.",{clientId:n.clientId,tunnelHost:l}),new y("Could not connect to secure tunnel.");return c}else throw x("Cannot call external service with Request object"),new y("Currently, we only support fetch(<some_string>, ...).");else throw x("There is no external service auth configured for this zup."),new y("There are no external services configured for this zup.")}r(le,"externalServiceHandler");async function ue(e,t){if(typeof e=="string"){let n=new URL(e),s=n.hostname,o=t??{},u=`http://${s}.zuplo.svc.cluster.local:9000`,i=new URL(`${u}${n.pathname}${n.search}`),l=new Headers(o.headers||{});return l.set(N,s),o.headers=l,await I(i.toString(),o)}else throw new y("Currently, we only support fetch(<some_string>, ...).")}r(ue,"clusterServiceHandler");async function tt(e,t,n,s){let o=e.toLowerCase(),u=t.toLowerCase(),i=n.toLowerCase(),l=ae(s);x(`Hashing service name: ${u}-${o}.${u}-${i}-${l}`);let p=await V(`${u}-${o}`),c=await V(`${u}-${i}-${l}`);return`${p}.${c}`}r(tt,"hashServiceName");async function V(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(u=>u.toString(16).padStart(2,"0")).join("").slice(0,-1)}r(V,"hashSegment");function ae(e){let t=e.toLowerCase();switch(t){case"production":case"preview":return t;default:return"working-copy"}}r(ae,"sanitizeEnvironmentType");var k=new Map;k.set("service:",le);k.set("local:",ue);var I=globalThis.fetch;function B(e,t){let n=nt(t);if(typeof e=="string"){let s=new URL(e),o=k.get(s.protocol);return o?o(e,n):I(e,n)}else return I(e,n)}r(B,"internalFetch");globalThis.fetch=B;var nt=r(e=>{if(!e||e instanceof Request)return e;let t=e;if(!t.zuplo)return e;let n=e;return n.cf={cacheEverything:t.zuplo?.cacheEverything,cacheTtl:t.zuplo?.cacheTtlSeconds},delete e.zuplo,e},"transformInit");var rt={console:{log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console),assert:console.assert.bind(console),clear:console.clear.bind(console),count:console.count.bind(console),countReset:console.countReset.bind(console),dir:console.dir.bind(console),dirxml:console.dirxml.bind(console),group:console.group.bind(console),groupCollapsed:console.groupCollapsed.bind(console),groupEnd:console.groupEnd.bind(console),table:console.table.bind(console),time:console.time.bind(console),timeEnd:console.timeEnd.bind(console),timeLog:console.timeLog.bind(console),timeStamp:console.timeStamp.bind(console),trace:console.trace.bind(console),profile:console.profile.bind(console),profileEnd:console.profileEnd.bind(console)},fetch:B},C=rt;var Y="2025-02-06",pe=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!1,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2024-09-02":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!1,useForwardRedirectsPropOnUrlForwardHandler:!1},"2025-02-06":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0,allowCustomPorts:!0,removeLegacyLogInitialization:!0,useForwardRedirectsPropOnUrlForwardHandler:!0}});function fe(){return new b({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:Y,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,IS_LOCAL_DEVELOPMENT:!1,COMPATIBILITY_FLAGS:pe[Y]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}r(fe,"getMockEnvironment");var b=class e{static{r(this,"Environment")}config;static#e;static#t=!1;static initialize(t){this.#e||(this.#e=new e(t),this.#t=!0)}static get instance(){return this.#t||(C.console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#e=fe()),this.#e}constructor({build:t,runtime:n}){let s;try{if(n.ZUPLO_SYSTEM_CONFIGURATIONS){let o=new TextDecoder().decode(ce.decode(n.ZUPLO_SYSTEM_CONFIGURATIONS)),u=JSON.parse(o);for(let i of Object.keys(u))n[i]||(n[i]=u[i])}if(n.__ZUPLO_CONFIG){let o=atob(n.__ZUPLO_CONFIG);s=JSON.parse(o)}}catch(o){C.console.error("Failed to parse runtime configuration",o)}this.config=s??{},this.build=t,this.runtime=n,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useLegacyServiceRouting(){return this.config.use_legacy_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get zuploEdgeApiUrl(){return this.config.zuplo_edge_api_url??"https://api.zuploedge.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get zuploClientAuthBucketId(){return this.config.zuplo_auth_client_bucket_id??"auth_o8PUdhKxSTOiB794GWPwLQCD"}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get developerApiUrl(){return this.config.developer_api_url??"https://dev.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuploedge.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuploedge.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuploedge.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuploedge.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get authClientId(){return this.config.auth_client_id??this.runtime.__ZUPLO_AUTH_CLIENT_ID}get authClientSecret(){return this.config.auth_client_secret??this.runtime.__ZUPLO_AUTH_CLIENT_SECRET}get authPublicKey(){return this.config.auth_public_key??this.runtime.__ZUPLO_AUTH_PUBLIC_KEY}get authPrivateKey(){return this.config.auth_private_key??this.runtime.__ZUPLO_AUTH_PRIVATE_KEY}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isManagedDedicated(){return this.runtime.__ZUPLO_IS_MANAGED_DEDICATED==="true"}get isDeno(){if(this.runtime.__ZUPLO_RUNTIME_TYPE)return this.runtime.__ZUPLO_RUNTIME_TYPE==="deno";if(this.config.runtime_type)return this.config.runtime_type==="deno";{let t=typeof globalThis.Deno<"u"&&globalThis.Deno.version&&globalThis.Deno.version.deno;return typeof WebSocketPair!="function"&&t}}get isLocalDevelopment(){return this.build.IS_LOCAL_DEVELOPMENT}get isTestMode(){return!!this.runtime.__ZUPLO_TEST_MODE}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}get rateLimitServiceTimeoutMs(){let t=this.runtime.__ZUPLO_RATE_LIMIT_TIMEOUT_MS,n=this.config.rate_limit_service_timeout_ms,s=t??n;if(!s)return 500;let o=Number(s);return Number.isFinite(o)&&o>0?o:500}};export{r as a,ot as b,it as c,st as d,ct as e,lt as f,ie as g,W as h,y as i,q as j,b as k,ft as l,me as m,Oe as n,ye as o,dt as p,gt as q,_t as r,Re as s,be as t,Ae as u,xe as v,Le as w,Et as x,ht as y,mt as z,Ot as A,yt as B,Rt as C,bt as D,At as E,xt as F,Lt as G,Te as H,Pe as I,Ie as J,Ce as K,Se as L,we as M,Ue as N,Ne as O,Tt as P,N as Q,De as R,Pt as S,It as T,Ct as U,St as V,wt as W,Ut as X,Nt as Y,C as Z};
36
+ /*! For license information please see chunk-6JMEGIXE.js.LEGAL.txt */
@@ -0,0 +1,25 @@
1
+
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Zuplo, Inc. All rights reserved.
4
+ *
5
+ * This software and associated documentation files (the "Software") is intended to be used
6
+ * only by Zuplo customers solely to develop and test applications that will be deployed
7
+ * to Zuplo hosted services. You and others in your organization may use these files on your
8
+ * Development Devices solely for the above stated purpose.
9
+ *
10
+ * Outside of uses stated above, no license is granted for any other purpose including
11
+ * without limitation the rights to use, copy, modify, merge, publish, distribute,
12
+ * sublicense, host, and/or sell copies of the Software.
13
+ *
14
+ * The software may include third party components with separate legal notices or governed by
15
+ * other agreements, as described in licenses either embedded in or accompanying the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
20
+ * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ * DEALINGS IN THE SOFTWARE.
23
+ *--------------------------------------------------------------------------------------------*/
24
+
25
+ import{a as e,k as o}from"./chunk-6JMEGIXE.js";var s={MCP_TOOL_USAGE:"mcp_tool_usage"};var r=class{static{e(this,"BaseAnalyticsEvent")}eventId;requestId;timestamp;accountName;projectName;deploymentName;unit;value;constructor(t){this.eventId=t.eventId,this.requestId=t.requestId,this.timestamp=t.timestamp??new Date,this.accountName=t.accountName,this.projectName=t.projectName,this.deploymentName=t.deploymentName,this.unit=t.unit,this.value=t.value}};var i=class extends r{static{e(this,"McpToolUsageEvent")}eventType=s.MCP_TOOL_USAGE;metadata;constructor(t){t.metadata.toolName.trim()||(t.metadata.toolName="unknown"),t.metadata.toolVersion.trim()||(t.metadata.toolVersion="unknown"),t.metadata.toolPath.trim()||(t.metadata.toolPath="unknown"),t.metadata.toolMethod.trim()||(t.metadata.toolMethod="unknown"),t.metadata.toolOperationId.trim()||(t.metadata.toolOperationId="unknown"),super(t),this.metadata=t.metadata}};var d={[s.MCP_TOOL_USAGE]:i};function c(a,t){let n=d[a];return new n(t)}e(c,"createAnalyticsEvent");var v=class{static{e(this,"ZuploGatewayAnalyticsContext")}#t;#e;constructor(t){this.#t=[],this.#e=t}addAnalyticsEvent(t,n,p,m){let l=this.createAnalyticsEvent(t,n,p,m);this.#t.push(l)}getAnalyticsEvents(){return this.#t}createAnalyticsEvent(t,n,p,m){return c(n,{eventId:crypto.randomUUID(),requestId:this.#e,accountName:o.instance.build.ACCOUNT_NAME??"unknown",projectName:o.instance.build.PROJECT_NAME??"unknown",deploymentName:o.instance.deploymentName??"unknown",metadata:p,unit:m,value:t})}};export{v as a};
@@ -22,4 +22,4 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{a as i,k as o}from"./chunk-SSAQ7DDU.js";var p=(n=>(n.Build="build-data",n.CorsPreflight="cors-preflight",n.DeveloperPortal="developer-portal",n.ZudokuPortal="zudoku-portal",n.DeveloperPortalLegacy="developer-portal-legacy",n.StripePlugin="stripe-plugin",n.EmptyGatewayCatchall="empty-gateway-catchall",n.Ping="ping",n.UnmatchedPath="unmatched-path",n))(p||{});var g=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function l(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!g.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):e.startsWith("ZUDOKU_")?!e.startsWith("ZUDOKU_PUBLIC_"):!1}i(l,"isRestrictedEnvVariableName");function _(e){return!!e.startsWith("ZUPLO_")}i(_,"isZuploReadableEnvVariableName");var d=new Proxy({},{get(e,t){let r=String(t);switch(r){case"ZUPLO_ENVIRONMENT_TYPE":return o.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return o.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return o.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return o.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return o.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return o.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return o.instance.build.COMPATIBILITY_DATE}if(!(l(r)&&!_(r)))return o.instance.runtime[r]}});function f(e,t,r){return`_${a(`${e}_${t}_${r}`)}`}i(f,"getRawOperationDataIdentifierName");function L(e,t,r,s){return`_${a(e.toLowerCase())}_${t.toLowerCase()}_${r.toLowerCase()}_${s.toLowerCase()}`}i(L,"getIdForParameterSchema");function E(e,t,r){return`_${a(e.toLowerCase())}_${t.toLowerCase()}_rb_${a(r.toLowerCase())}`}i(E,"getIdForRequestBodySchema");function C(e,t){return`_${a(e)}_${a(t)}`}i(C,"getIdForRefSchema");function a(e){let t=e.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(t)||(t="_"+t),t}i(a,"sanitizedIdentifierName");export{p as a,l as b,_ as c,d,f as e,L as f,E as g,C as h,a as i};
25
+ import{a as i,k as o}from"./chunk-6JMEGIXE.js";var p=(n=>(n.Build="build-data",n.CorsPreflight="cors-preflight",n.DeveloperPortal="developer-portal",n.ZudokuPortal="zudoku-portal",n.DeveloperPortalLegacy="developer-portal-legacy",n.StripePlugin="stripe-plugin",n.EmptyGatewayCatchall="empty-gateway-catchall",n.Ping="ping",n.UnmatchedPath="unmatched-path",n))(p||{});var g=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function l(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!g.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):e.startsWith("ZUDOKU_")?!e.startsWith("ZUDOKU_PUBLIC_"):!1}i(l,"isRestrictedEnvVariableName");function _(e){return!!e.startsWith("ZUPLO_")}i(_,"isZuploReadableEnvVariableName");var d=new Proxy({},{get(e,t){let r=String(t);switch(r){case"ZUPLO_ENVIRONMENT_TYPE":return o.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return o.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return o.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return o.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return o.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return o.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return o.instance.build.COMPATIBILITY_DATE}if(!(l(r)&&!_(r)))return o.instance.runtime[r]}});function f(e,t,r){return`_${a(`${e}_${t}_${r}`)}`}i(f,"getRawOperationDataIdentifierName");function L(e,t,r,s){return`_${a(e.toLowerCase())}_${t.toLowerCase()}_${r.toLowerCase()}_${s.toLowerCase()}`}i(L,"getIdForParameterSchema");function E(e,t,r){return`_${a(e.toLowerCase())}_${t.toLowerCase()}_rb_${a(r.toLowerCase())}`}i(E,"getIdForRequestBodySchema");function C(e,t){return`_${a(e)}_${a(t)}`}i(C,"getIdForRefSchema");function a(e){let t=e.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(t)||(t="_"+t),t}i(a,"sanitizedIdentifierName");export{p as a,l as b,_ as c,d,f as e,L as f,E as g,C as h,a as i};