@zuplo/cli 7.1.10 → 7.2.1

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 (37) hide show
  1. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
  2. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
  3. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +4 -2
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
  7. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  8. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
  9. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +4 -2
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  19. package/node_modules/@zuplo/core/customer.cli.minified.js +1 -1
  20. package/node_modules/@zuplo/core/index.minified.js +1 -1
  21. package/node_modules/@zuplo/core/package.json +1 -1
  22. package/node_modules/@zuplo/graphql/package.json +1 -1
  23. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  24. package/node_modules/@zuplo/otel/package.json +1 -1
  25. package/node_modules/@zuplo/runtime/out/esm/chunk-GK3X4WPN.js +409 -0
  26. package/node_modules/@zuplo/runtime/out/esm/chunk-GK3X4WPN.js.map +1 -0
  27. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  28. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  29. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  30. package/node_modules/@zuplo/runtime/out/types/index.d.ts +286 -15
  31. package/node_modules/@zuplo/runtime/package.json +1 -1
  32. package/node_modules/default-browser/package.json +1 -1
  33. package/node_modules/default-browser/windows.js +3 -1
  34. package/package.json +6 -6
  35. package/node_modules/@zuplo/runtime/out/esm/chunk-DEKK4CFE.js +0 -382
  36. package/node_modules/@zuplo/runtime/out/esm/chunk-DEKK4CFE.js.map +0 -1
  37. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DEKK4CFE.js.LEGAL.txt → chunk-GK3X4WPN.js.LEGAL.txt} +0 -0
@@ -572,7 +572,7 @@ globstar while`,s,fe,o,ae,rt),this.matchOne(s.slice(fe),o.slice(ae),f))return th
572
572
  `),stderr:x.join(`
573
573
  `),exitCode:P},"Tar process logs")}}t(AZt,"tarFolder");async function NZt({tarFilePath:s,outputDir:o,logger:f}){let d=[],y=[],x;try{await new Promise((P,F)=>{let J=yit("sh",["-c",`tar -xvf ${s} -C ${o};`]);J.stdout.on("data",V=>{let ye=V.toString().trim();ye.length>0&&d.push(ye.trim())}),J.stderr.on("data",V=>{let ye=V.toString().trim();ye.length>0&&y.push(ye.trim())}),J.on("close",V=>{x=V,V===0?P():F(new Error(`tar process exited with code ${V}`))}),J.on("error",V=>{F(V)})})}catch(P){throw new Error("Failed to untar file",{cause:P})}finally{f.info({stdout:d.join(`
574
574
  `),stderr:y.join(`
575
- `),exitCode:x},"Untar process logs")}}t(NZt,"untarFile");async function IZt(s){if(await uAe(s))return await GN.rm(s,{recursive:!0})}t(IZt,"deleteFolder");var ru=fAe;var klt=B_(zst(),1);var $st=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-configuration-loader-v2","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var WV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},str=/[$_\p{ID_Start}]/u,atr=/[$_\u200C\u200D\p{ID_Continue}]/u,VAe=".*";function otr(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(otr,"Re");function qst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let J=s.substr(F,1);if(F===d+1&&str.test(J)||F!==d+1&&atr.test(J)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",J=d+1,V=!1;if(s[J]==="?"){x(`Pattern cannot start with "?" at ${J}`);continue}for(;J<s.length;){if(!otr(s[J],!1)){x(`Invalid character '${s[J]}' at ${J}.`),V=!0;break}if(s[J]==="\\"){F+=s[J++]+s[J++];continue}if(s[J]===")"){if(P--,P===0){J++;break}}else if(s[J]==="("&&(P++,s[J+1]!=="?")){x(`Capturing groups are not allowed at ${J}`),V=!0;break}F+=s[J++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=J;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(qst,"v");function Vst(s,o={}){let f=qst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${pT(o.delimiter)}]+?`,y=[],x=0,P=0,F="",J=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new WV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new WV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=VAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===VAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),J.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);J.add(Ci),y.push(new WV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Vst,"D");function pT(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pT,"S");function Jst(s){return s&&s.ignoreCase?"ui":"u"}t(Jst,"X");function ctr(s,o,f){return Hst(Vst(s,f),o,f)}t(ctr,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Hst(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=pT(F.value):d+=`(?:${pT(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let J=`[^${pT(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=J:F.type===0&&(V=VAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${pT(F.prefix)}(${V})${pT(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${pT(F.prefix)}`,d+=`((?:${V})(?:`,d+=pT(F.suffix),d+=pT(F.prefix),d+=`(?:${V}))*)${pT(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${pT(f.endsWith)}]|$`,x=`[${pT(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Jst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Jst(f))}t(Hst,"F");var ZN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},ltr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},utr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ftr(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(ftr,"J");function Gst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(Gst,"Q");function _tr(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t(_tr,"Ee");function Yst(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t(Yst,"W");var Kst=["ftp","file","http","https","ws","wss"];function Xst(s){if(!s)return!0;for(let o of Kst)if(s.test(o))return!0;return!1}t(Xst,"N");function ptr(s,o){if(s=Gst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(ptr,"te");function dtr(s,o){if(s=Gst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(dtr,"re");function mtr(s,o){return o||s===""?s:Yst(s)?eat(s):Qst(s)}t(mtr,"ne");function htr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(htr,"se");function gtr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(gtr,"ie");function ytr(s,o,f){if(f||s==="")return s;if(o&&!Kst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(ytr,"ae");function vtr(s,o,f){return Zst(o)===s&&(s=""),f||s===""?s:tat(s)}t(vtr,"oe");function btr(s,o){return s=_tr(s,":"),o||s===""?s:HAe(s)}t(btr,"ce");function Zst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Zst,"_");function HAe(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t(HAe,"y");function Str(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Str,"le");function Ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Ttr,"fe");function Qst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Qst,"z");function eat(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(eat,"j");function tat(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(tat,"K");function xtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(xtr,"he");function Etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(Etr,"ue");function Ctr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(Ctr,"de");function ktr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(ktr,"pe");var wtr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=qst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,ZN),s.encodePart=HAe;let o=ctr(this.#w(),void 0,s);this.#p=Xst(o)}},qAe=["protocol","username","password","hostname","port","pathname","search","hash"],XN="*";function Wst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Wst,"ge");function JP(s,o){return o?JV(s):s}t(JP,"b");function $V(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=JP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=JP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=JP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=JP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=JP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=JP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=JP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=JP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=btr(o.protocol,f)),typeof o.username=="string"&&(s.username=gtr(o.username,f)),typeof o.password=="string"&&(s.password=htr(o.password,f)),typeof o.hostname=="string"&&(s.hostname=mtr(o.hostname,f)),typeof o.port=="string"&&(s.port=vtr(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!ftr(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=JP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=ytr(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=dtr(o.search,f)),typeof o.hash=="string"&&(s.hash=ptr(o.hash,f)),s}t($V,"w");function JV(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t(JV,"C");function Dtr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Dtr,"Oe");function Ptr(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${Dtr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=JV(F.value);continue}x+=`{${JV(F.value)}}${Y9(F.modifier)}`;continue}let J=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&J&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=JV(F.prefix),J&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?J||(x+=`(${d})`):F.type===0&&(!J&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&J&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=JV(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(Ptr,"ke");var rat=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new wtr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:XN,protocol:XN,username:XN,password:XN,hostname:XN,port:XN,search:XN,hash:XN};this.#e=$V(x,s,!0),Zst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of qAe){if(!(P in this.#e))continue;let F={},J=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,ZN),F.encodePart=HAe;break;case"username":Object.assign(F,ZN),F.encodePart=Str;break;case"password":Object.assign(F,ZN),F.encodePart=Ttr;break;case"hostname":Object.assign(F,ltr),Yst(J)?F.encodePart=eat:F.encodePart=Qst;break;case"port":Object.assign(F,ZN),F.encodePart=tat;break;case"pathname":Xst(this.#r.protocol)?(Object.assign(F,utr,y),F.encodePart=xtr):(Object.assign(F,ZN,y),F.encodePart=Etr);break;case"search":Object.assign(F,ZN,y),F.encodePart=Ctr;break;case"hash":Object.assign(F,ZN,y),F.encodePart=ktr;break}try{this.#s[P]=Vst(J,F),this.#r[P]=Hst(this.#s[P],this.#t[P],F),this.#n[P]=Ptr(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return!1}let d;for(d of qAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of qAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,J]of this.#t[y].entries())if(typeof J=="string"||typeof J=="number"){let V=x[F+1];P[J]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,J)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<J[V])return-1;if(F[V]!==J[V])return 1}return 0},"o"),y=new WV(3,"","","","",3),x=new WV(0,"","","","",3),P=t((F,J)=>{let V=0;for(;V<Math.min(F.length,J.length);++V){let ye=d(F[V],J[V]);if(ye)return ye}return F.length===J.length?0:d(F[V]??y,J[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=rat);import{AssertionError as Atr}from"node:assert";function WP(s,o){if(s===!1)throw new Atr({message:o})}t(WP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function qP(s){return s.type===Wo.Property}t(qP,"isAstProperty");function GAe(s){return s.type===Wo.Array}t(GAe,"isAstArray");function hO(s){return s.type===Wo.Literal}t(hO,"isAstLiteral");function QN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(QN,"assertAstObject");import{findNodeAtLocation as Ntr,getNodeValue as Itr,printParseErrorCode as Otr,visit as Ftr}from"jsonc-parser";var Ltr={DEFAULT:{allowTrailingComma:!1}};function qV(s,o=[],f=Ltr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(J){d.type==="property"&&(d.length=J-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(J){return d.children?.push(J),J}t(x,"onValue"),Ftr(s,{onObjectBegin:t((J,V,ye)=>{d=x({type:"object",offset:J,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((J,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:J,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((J,V)=>{y(J+V),d.length=J+V-d.offset,d=d.parent,y(J+V)},"onObjectEnd"),onArrayBegin:t((J,V,ye,fe)=>{d=x({type:"array",offset:J,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((J,V)=>{d.length=J+V-d.offset,d=d.parent,y(J+V)},"onArrayEnd"),onLiteralValue:t((J,V,ye,fe,ae)=>{x({type:Rtr(J),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:J}),y(V+ye)},"onLiteralValue"),onSeparator:t((J,V)=>{d.type==="property"&&(J===":"?d.colonOffset=V:J===","&&y(V))},"onSeparator"),onError:t((J,V,ye,fe,ae)=>{o.push({error:J,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(qV,"parse");function Rtr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(Rtr,"getNodeType");function YAe(s,o){return Ntr(s,o)}t(YAe,"findNodeAtLocation");function VV(s){return Itr(s)}t(VV,"getNodeValue");function nat(s){return Otr(s)}t(nat,"printParseErrorCode");var HV=class{static{t(this,"AstAdapter")}parse(o){let d=qV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){WP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var Mtr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,GV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=Mtr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import jtr from"node:fs/promises";import{parse as Btr}from"@swc/core";var iat=t(async s=>{let o=new Set;try{let f=await jtr.readFile(s,"utf-8");(await Btr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var sat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var KAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var aat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var XAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var ZAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var mlt=B_(Qce(),1),hlt=B_(nle(),1);var ile=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new mlt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,hlt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let J=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[J][V][ye];x={details:{property:J,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let J=y.instancePath.split("/"),V=J[J.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var lI=ile.instance;lI.addSchema(XAe,"route-configuration.schema.json");lI.addSchema(aat,"policy-configuration.schema.json");lI.addSchema(KAe,"policies.schema.json");lI.addSchema(ZAe,"open-api-route-configuration.schema.json");lI.addSchema(sat,"fragments.schema.json");var lNr=lI.compile(XAe),glt=lI.compile(ZAe),dIe=lI.compile(KAe);var sle=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=dIe(o),this.results}};var ale=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=glt(o),this.results}};import ulr from"node:path";var mIe=/\$import\((.*)\)/,CH=/\$env\((.*?)\)/g;var zk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},llr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),YP=t((s,o)=>{if(!s)return!1;let f=llr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||qP(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ole=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):GAe(o)?o.children.forEach(f=>{this.visitor(f)}):qP(o)&&this.visitor(o.value)}},ylt=t(s=>{let o=new RegExp(CH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(CH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),vlt=t((s,o,f)=>d=>{if(hO(d)&&typeof d.value=="string"&&d.parent&&GAe(d.parent)){if(!s.some(P=>YP(d.parent,P))){CH.test(d.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=ylt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let J={type:Wo.Raw,parent:P,value:x.value};P.children[F]=J}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!qP(d)||!hO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>YP(d,x))){CH.test(d.value.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=ylt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var kH="config/routes.json",flr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],_lr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],blt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],plr="handler/{}/options/{}/rewritePattern",dlr="handler/{}/options/{}/baseUrl",cle=class extends ole{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,plr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,dlr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!qP(o)||!hO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!_lr.some(F=>YP(o,F))&&!blt.some(F=>YP(o,F))){if(mIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new zk("An $import() statement is not expected at this location.",kH,o.location,f))}return}let d=mIe.exec(f);if(blt.some(F=>YP(o,F))&&!d)return;if(!d){this.errors.push(new zk("Invalid $import() statement",kH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=ulr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=vlt(flr,this.errors,kH)};function Slt(s){return`(request, context) => {
575
+ `),exitCode:x},"Untar process logs")}}t(NZt,"untarFile");async function IZt(s){if(await uAe(s))return await GN.rm(s,{recursive:!0})}t(IZt,"deleteFolder");var ru=fAe;var klt=B_(zst(),1);var $st=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-configuration-loader-v2","ai-gateway-dlp","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var WV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},str=/[$_\p{ID_Start}]/u,atr=/[$_\u200C\u200D\p{ID_Continue}]/u,VAe=".*";function otr(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(otr,"Re");function qst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let J=s.substr(F,1);if(F===d+1&&str.test(J)||F!==d+1&&atr.test(J)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",J=d+1,V=!1;if(s[J]==="?"){x(`Pattern cannot start with "?" at ${J}`);continue}for(;J<s.length;){if(!otr(s[J],!1)){x(`Invalid character '${s[J]}' at ${J}.`),V=!0;break}if(s[J]==="\\"){F+=s[J++]+s[J++];continue}if(s[J]===")"){if(P--,P===0){J++;break}}else if(s[J]==="("&&(P++,s[J+1]!=="?")){x(`Capturing groups are not allowed at ${J}`),V=!0;break}F+=s[J++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=J;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(qst,"v");function Vst(s,o={}){let f=qst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${pT(o.delimiter)}]+?`,y=[],x=0,P=0,F="",J=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new WV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new WV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=VAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===VAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),J.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);J.add(Ci),y.push(new WV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Vst,"D");function pT(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pT,"S");function Jst(s){return s&&s.ignoreCase?"ui":"u"}t(Jst,"X");function ctr(s,o,f){return Hst(Vst(s,f),o,f)}t(ctr,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Hst(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=pT(F.value):d+=`(?:${pT(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let J=`[^${pT(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=J:F.type===0&&(V=VAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${pT(F.prefix)}(${V})${pT(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${pT(F.prefix)}`,d+=`((?:${V})(?:`,d+=pT(F.suffix),d+=pT(F.prefix),d+=`(?:${V}))*)${pT(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${pT(f.endsWith)}]|$`,x=`[${pT(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Jst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Jst(f))}t(Hst,"F");var ZN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},ltr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},utr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ftr(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(ftr,"J");function Gst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(Gst,"Q");function _tr(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t(_tr,"Ee");function Yst(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t(Yst,"W");var Kst=["ftp","file","http","https","ws","wss"];function Xst(s){if(!s)return!0;for(let o of Kst)if(s.test(o))return!0;return!1}t(Xst,"N");function ptr(s,o){if(s=Gst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(ptr,"te");function dtr(s,o){if(s=Gst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(dtr,"re");function mtr(s,o){return o||s===""?s:Yst(s)?eat(s):Qst(s)}t(mtr,"ne");function htr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(htr,"se");function gtr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(gtr,"ie");function ytr(s,o,f){if(f||s==="")return s;if(o&&!Kst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(ytr,"ae");function vtr(s,o,f){return Zst(o)===s&&(s=""),f||s===""?s:tat(s)}t(vtr,"oe");function btr(s,o){return s=_tr(s,":"),o||s===""?s:HAe(s)}t(btr,"ce");function Zst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Zst,"_");function HAe(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t(HAe,"y");function Str(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Str,"le");function Ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Ttr,"fe");function Qst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Qst,"z");function eat(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(eat,"j");function tat(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(tat,"K");function xtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(xtr,"he");function Etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(Etr,"ue");function Ctr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(Ctr,"de");function ktr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(ktr,"pe");var wtr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=qst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,ZN),s.encodePart=HAe;let o=ctr(this.#w(),void 0,s);this.#p=Xst(o)}},qAe=["protocol","username","password","hostname","port","pathname","search","hash"],XN="*";function Wst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Wst,"ge");function JP(s,o){return o?JV(s):s}t(JP,"b");function $V(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=JP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=JP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=JP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=JP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=JP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=JP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=JP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=JP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=btr(o.protocol,f)),typeof o.username=="string"&&(s.username=gtr(o.username,f)),typeof o.password=="string"&&(s.password=htr(o.password,f)),typeof o.hostname=="string"&&(s.hostname=mtr(o.hostname,f)),typeof o.port=="string"&&(s.port=vtr(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!ftr(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=JP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=ytr(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=dtr(o.search,f)),typeof o.hash=="string"&&(s.hash=ptr(o.hash,f)),s}t($V,"w");function JV(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t(JV,"C");function Dtr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Dtr,"Oe");function Ptr(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${Dtr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=JV(F.value);continue}x+=`{${JV(F.value)}}${Y9(F.modifier)}`;continue}let J=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&J&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=JV(F.prefix),J&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?J||(x+=`(${d})`):F.type===0&&(!J&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&J&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=JV(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(Ptr,"ke");var rat=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new wtr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:XN,protocol:XN,username:XN,password:XN,hostname:XN,port:XN,search:XN,hash:XN};this.#e=$V(x,s,!0),Zst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of qAe){if(!(P in this.#e))continue;let F={},J=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,ZN),F.encodePart=HAe;break;case"username":Object.assign(F,ZN),F.encodePart=Str;break;case"password":Object.assign(F,ZN),F.encodePart=Ttr;break;case"hostname":Object.assign(F,ltr),Yst(J)?F.encodePart=eat:F.encodePart=Qst;break;case"port":Object.assign(F,ZN),F.encodePart=tat;break;case"pathname":Xst(this.#r.protocol)?(Object.assign(F,utr,y),F.encodePart=xtr):(Object.assign(F,ZN,y),F.encodePart=Etr);break;case"search":Object.assign(F,ZN,y),F.encodePart=Ctr;break;case"hash":Object.assign(F,ZN,y),F.encodePart=ktr;break}try{this.#s[P]=Vst(J,F),this.#r[P]=Hst(this.#s[P],this.#t[P],F),this.#n[P]=Ptr(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return!1}let d;for(d of qAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of qAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,J]of this.#t[y].entries())if(typeof J=="string"||typeof J=="number"){let V=x[F+1];P[J]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,J)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<J[V])return-1;if(F[V]!==J[V])return 1}return 0},"o"),y=new WV(3,"","","","",3),x=new WV(0,"","","","",3),P=t((F,J)=>{let V=0;for(;V<Math.min(F.length,J.length);++V){let ye=d(F[V],J[V]);if(ye)return ye}return F.length===J.length?0:d(F[V]??y,J[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=rat);import{AssertionError as Atr}from"node:assert";function WP(s,o){if(s===!1)throw new Atr({message:o})}t(WP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function qP(s){return s.type===Wo.Property}t(qP,"isAstProperty");function GAe(s){return s.type===Wo.Array}t(GAe,"isAstArray");function hO(s){return s.type===Wo.Literal}t(hO,"isAstLiteral");function QN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(QN,"assertAstObject");import{findNodeAtLocation as Ntr,getNodeValue as Itr,printParseErrorCode as Otr,visit as Ftr}from"jsonc-parser";var Ltr={DEFAULT:{allowTrailingComma:!1}};function qV(s,o=[],f=Ltr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(J){d.type==="property"&&(d.length=J-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(J){return d.children?.push(J),J}t(x,"onValue"),Ftr(s,{onObjectBegin:t((J,V,ye)=>{d=x({type:"object",offset:J,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((J,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:J,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((J,V)=>{y(J+V),d.length=J+V-d.offset,d=d.parent,y(J+V)},"onObjectEnd"),onArrayBegin:t((J,V,ye,fe)=>{d=x({type:"array",offset:J,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((J,V)=>{d.length=J+V-d.offset,d=d.parent,y(J+V)},"onArrayEnd"),onLiteralValue:t((J,V,ye,fe,ae)=>{x({type:Rtr(J),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:J}),y(V+ye)},"onLiteralValue"),onSeparator:t((J,V)=>{d.type==="property"&&(J===":"?d.colonOffset=V:J===","&&y(V))},"onSeparator"),onError:t((J,V,ye,fe,ae)=>{o.push({error:J,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(qV,"parse");function Rtr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(Rtr,"getNodeType");function YAe(s,o){return Ntr(s,o)}t(YAe,"findNodeAtLocation");function VV(s){return Itr(s)}t(VV,"getNodeValue");function nat(s){return Otr(s)}t(nat,"printParseErrorCode");var HV=class{static{t(this,"AstAdapter")}parse(o){let d=qV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){WP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var Mtr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,GV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=Mtr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import jtr from"node:fs/promises";import{parse as Btr}from"@swc/core";var iat=t(async s=>{let o=new Set;try{let f=await jtr.readFile(s,"utf-8");(await Btr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var sat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var KAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var aat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var XAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var ZAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var mlt=B_(Qce(),1),hlt=B_(nle(),1);var ile=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new mlt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,hlt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let J=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[J][V][ye];x={details:{property:J,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let J=y.instancePath.split("/"),V=J[J.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var lI=ile.instance;lI.addSchema(XAe,"route-configuration.schema.json");lI.addSchema(aat,"policy-configuration.schema.json");lI.addSchema(KAe,"policies.schema.json");lI.addSchema(ZAe,"open-api-route-configuration.schema.json");lI.addSchema(sat,"fragments.schema.json");var lNr=lI.compile(XAe),glt=lI.compile(ZAe),dIe=lI.compile(KAe);var sle=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=dIe(o),this.results}};var ale=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=glt(o),this.results}};import ulr from"node:path";var mIe=/\$import\((.*)\)/,CH=/\$env\((.*?)\)/g;var zk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},llr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),YP=t((s,o)=>{if(!s)return!1;let f=llr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||qP(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ole=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):GAe(o)?o.children.forEach(f=>{this.visitor(f)}):qP(o)&&this.visitor(o.value)}},ylt=t(s=>{let o=new RegExp(CH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(CH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),vlt=t((s,o,f)=>d=>{if(hO(d)&&typeof d.value=="string"&&d.parent&&GAe(d.parent)){if(!s.some(P=>YP(d.parent,P))){CH.test(d.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=ylt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let J={type:Wo.Raw,parent:P,value:x.value};P.children[F]=J}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!qP(d)||!hO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>YP(d,x))){CH.test(d.value.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=ylt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var kH="config/routes.json",flr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],_lr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],blt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],plr="handler/{}/options/{}/rewritePattern",dlr="handler/{}/options/{}/baseUrl",cle=class extends ole{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,plr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,dlr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!qP(o)||!hO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!_lr.some(F=>YP(o,F))&&!blt.some(F=>YP(o,F))){if(mIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new zk("An $import() statement is not expected at this location.",kH,o.location,f))}return}let d=mIe.exec(f);if(blt.some(F=>YP(o,F))&&!d)return;if(!d){this.errors.push(new zk("Invalid $import() statement",kH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=ulr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=vlt(flr,this.errors,kH)};function Slt(s){return`(request, context) => {
576
576
  const { params, url, query, method, headers } = request;
577
577
  const { host, hostname, origin, pathname, port, search } = new URL(url);
578
578
  const e = encodeURIComponent;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "7.1.10",
3
+ "version": "7.2.1",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/graphql",
3
3
  "type": "module",
4
- "version": "7.1.10",
4
+ "version": "7.2.1",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -2,7 +2,7 @@
2
2
  "name": "@zuplo/openapi-tools",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "7.1.10",
5
+ "version": "7.2.1",
6
6
  "description": "Tooling for OpenAPI files",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/otel",
3
3
  "type": "module",
4
- "version": "7.1.10",
4
+ "version": "7.2.1",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {