@zuplo/cli 7.2.3 → 7.2.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "7.2.3",
3
+ "version": "7.2.4",
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.2.3",
4
+ "version": "7.2.4",
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.2.3",
5
+ "version": "7.2.4",
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.2.3",
4
+ "version": "7.2.4",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -405,5 +405,5 @@ Signature verification is impossible without access to the original signed mater
405
405
  `);let b=new I("!xml"),T=b,O="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let L=new P(this.options.processEntities);for(let k=0;k<f.length;k++)if(f[k]==="<")if(f[k+1]==="/"){let Z=on(f,">",k,"Closing Tag is not closed."),U=f.substring(k+2,Z).trim();if(this.options.removeNSPrefix){let Ie=U.indexOf(":");Ie!==-1&&(U=U.substr(Ie+1))}U=Tn(this.options.transformTagName,U,"",this.options).tagName,T&&(O=this.saveTextToParentTag(O,T,this.matcher));let ge=this.matcher.getCurrentTag();if(U&&this.options.unpairedTags.indexOf(U)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${U}>`);ge&&this.options.unpairedTags.indexOf(ge)!==-1&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,T=this.tagsNodeStack.pop(),O="",k=Z}else if(f[k+1]==="?"){let Z=mn(f,k,!1,"?>");if(!Z)throw new Error("Pi Tag is not closed.");if(O=this.saveTextToParentTag(O,T,this.matcher),!(this.options.ignoreDeclaration&&Z.tagName==="?xml"||this.options.ignorePiTags)){let U=new I(Z.tagName);U.add(this.options.textNodeName,""),Z.tagName!==Z.tagExp&&Z.attrExpPresent&&(U[":@"]=this.buildAttributesMap(Z.tagExp,this.matcher,Z.tagName)),this.addChild(T,U,this.matcher,k)}k=Z.closeIndex+1}else if(f.substr(k+1,3)==="!--"){let Z=on(f,"-->",k+4,"Comment is not closed.");if(this.options.commentPropName){let U=f.substring(k+4,Z-2);O=this.saveTextToParentTag(O,T,this.matcher),T.add(this.options.commentPropName,[{[this.options.textNodeName]:U}])}k=Z}else if(f.substr(k+1,2)==="!D"){let Z=L.readDocType(f,k);this.docTypeEntities=Z.entities,k=Z.i}else if(f.substr(k+1,2)==="!["){let Z=on(f,"]]>",k,"CDATA is not closed.")-2,U=f.substring(k+9,Z);O=this.saveTextToParentTag(O,T,this.matcher);let ge=this.parseTextData(U,T.tagname,this.matcher,!0,!1,!0,!0);ge==null&&(ge=""),this.options.cdataPropName?T.add(this.options.cdataPropName,[{[this.options.textNodeName]:U}]):T.add(this.options.textNodeName,ge),k=Z+2}else{let Z=mn(f,k,this.options.removeNSPrefix);if(!Z){let Vt=f.substring(Math.max(0,k-50),Math.min(f.length,k+50));throw new Error(`readTagExp returned undefined at position ${k}. Context: "${Vt}"`)}let U=Z.tagName,ge=Z.rawTagName,Ie=Z.tagExp,ze=Z.attrExpPresent,bt=Z.closeIndex;if({tagName:U,tagExp:Ie}=Tn(this.options.transformTagName,U,Ie,this.options),this.options.strictReservedNames&&(U===this.options.commentPropName||U===this.options.cdataPropName||U===this.options.textNodeName||U===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${U}`);T&&O&&T.tagname!=="!xml"&&(O=this.saveTextToParentTag(O,T,this.matcher,!1));let en=T;en&&this.options.unpairedTags.indexOf(en.tagname)!==-1&&(T=this.tagsNodeStack.pop(),this.matcher.pop());let gr=!1;Ie.length>0&&Ie.lastIndexOf("/")===Ie.length-1&&(gr=!0,U[U.length-1]==="/"?(U=U.substr(0,U.length-1),Ie=U):Ie=Ie.substr(0,Ie.length-1),ze=U!==Ie);let St=null,fn={},yr;yr=ke(ge),U!==b.tagname&&this.matcher.push(U,{},yr),U!==Ie&&ze&&(St=this.buildAttributesMap(Ie,this.matcher,U),St&&(fn=xe(St,this.options))),U!==b.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));let sn=k;if(this.isCurrentNodeStopNode){let Vt="";if(gr)k=Z.closeIndex;else if(this.options.unpairedTags.indexOf(U)!==-1)k=Z.closeIndex;else{let Sr=this.readStopNodeData(f,ge,bt+1);if(!Sr)throw new Error(`Unexpected end of ${ge}`);k=Sr.i,Vt=Sr.tagContent}let br=new I(U);St&&(br[":@"]=St),br.add(this.options.textNodeName,Vt),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(T,br,this.matcher,sn)}else{if(gr){({tagName:U,tagExp:Ie}=Tn(this.options.transformTagName,U,Ie,this.options));let Vt=new I(U);St&&(Vt[":@"]=St),this.addChild(T,Vt,this.matcher,sn),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(this.options.unpairedTags.indexOf(U)!==-1){let Vt=new I(U);St&&(Vt[":@"]=St),this.addChild(T,Vt,this.matcher,sn),this.matcher.pop(),this.isCurrentNodeStopNode=!1,k=Z.closeIndex;continue}else{let Vt=new I(U);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(T),St&&(Vt[":@"]=St),this.addChild(T,Vt,this.matcher,sn),T=Vt}O="",k=bt}}else O+=f[k];return b.child},"parseXml");function de(f,b,T,O){this.options.captureMetaData||(O=void 0);let L=this.options.jPath?T.toString():T,k=this.options.updateTag(b.tagname,L,b[":@"]);k===!1||(typeof k=="string"&&(b.tagname=k),f.addChild(b,O))}i(de,"addChild"),n(de,"addChild");function pe(f,b,T){let O=this.options.processEntities;if(!O||!O.enabled)return f;if(O.allowedTags){let L=this.options.jPath?T.toString():T;if(!(Array.isArray(O.allowedTags)?O.allowedTags.includes(b):O.allowedTags(b,L)))return f}if(O.tagFilter){let L=this.options.jPath?T.toString():T;if(!O.tagFilter(b,L))return f}for(let L of Object.keys(this.docTypeEntities)){let k=this.docTypeEntities[L],Y=f.match(k.regx);if(Y){if(this.entityExpansionCount+=Y.length,O.maxTotalExpansions&&this.entityExpansionCount>O.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${O.maxTotalExpansions}`);let Z=f.length;if(f=f.replace(k.regx,k.val),O.maxExpandedLength&&(this.currentExpandedLength+=f.length-Z,this.currentExpandedLength>O.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${O.maxExpandedLength}`)}}for(let L of Object.keys(this.lastEntities)){let k=this.lastEntities[L],Y=f.match(k.regex);if(Y&&(this.entityExpansionCount+=Y.length,O.maxTotalExpansions&&this.entityExpansionCount>O.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${O.maxTotalExpansions}`);f=f.replace(k.regex,k.val)}if(f.indexOf("&")===-1)return f;if(this.options.htmlEntities)for(let L of Object.keys(this.htmlEntities)){let k=this.htmlEntities[L],Y=f.match(k.regex);if(Y&&(this.entityExpansionCount+=Y.length,O.maxTotalExpansions&&this.entityExpansionCount>O.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${O.maxTotalExpansions}`);f=f.replace(k.regex,k.val)}return f=f.replace(this.ampEntity.regex,this.ampEntity.val),f}i(pe,"replaceEntitiesValue"),n(pe,"replaceEntitiesValue");function De(f,b,T,O){return f&&(O===void 0&&(O=b.child.length===0),f=this.parseTextData(f,b.tagname,T,!1,b[":@"]?Object.keys(b[":@"]).length!==0:!1,O),f!==void 0&&f!==""&&b.add(this.options.textNodeName,f),f=""),f}i(De,"saveTextToParentTag"),n(De,"saveTextToParentTag");function qe(f,b){if(!f||f.length===0)return!1;for(let T=0;T<f.length;T++)if(b.matches(f[T]))return!0;return!1}i(qe,"isItStopNode"),n(qe,"isItStopNode");function q(f,b,T=">"){let O,L="";for(let k=b;k<f.length;k++){let Y=f[k];if(O)Y===O&&(O="");else if(Y==='"'||Y==="'")O=Y;else if(Y===T[0])if(T[1]){if(f[k+1]===T[1])return{data:L,index:k}}else return{data:L,index:k};else Y===" "&&(Y=" ");L+=Y}}i(q,"tagExpWithClosingIndex"),n(q,"tagExpWithClosingIndex");function on(f,b,T,O){let L=f.indexOf(b,T);if(L===-1)throw new Error(O);return L+b.length-1}i(on,"findClosingIndex"),n(on,"findClosingIndex");function mn(f,b,T,O=">"){let L=q(f,b+1,O);if(!L)return;let k=L.data,Y=L.index,Z=k.search(/\s/),U=k,ge=!0;Z!==-1&&(U=k.substring(0,Z),k=k.substring(Z+1).trimStart());let Ie=U;if(T){let ze=U.indexOf(":");ze!==-1&&(U=U.substr(ze+1),ge=U!==L.data.substr(ze+1))}return{tagName:U,tagExp:k,closeIndex:Y,attrExpPresent:ge,rawTagName:Ie}}i(mn,"readTagExp"),n(mn,"readTagExp");function ro(f,b,T){let O=T,L=1;for(;T<f.length;T++)if(f[T]==="<")if(f[T+1]==="/"){let k=on(f,">",T,`${b} is not closed`);if(f.substring(T+2,k).trim()===b&&(L--,L===0))return{tagContent:f.substring(O,T),i:k};T=k}else if(f[T+1]==="?")T=on(f,"?>",T+1,"StopNode is not closed.");else if(f.substr(T+1,3)==="!--")T=on(f,"-->",T+3,"StopNode is not closed.");else if(f.substr(T+1,2)==="![")T=on(f,"]]>",T,"StopNode is not closed.")-2;else{let k=mn(f,T,">");k&&((k&&k.tagName)===b&&k.tagExp[k.tagExp.length-1]!=="/"&&L++,T=k.closeIndex)}}i(ro,"readStopNodeData"),n(ro,"readStopNodeData");function zn(f,b,T){if(b&&typeof f=="string"){let O=f.trim();return O==="true"?!0:O==="false"?!1:ht(f,T)}else return l(f)?f:""}i(zn,"parseValue"),n(zn,"parseValue");function Po(f,b,T){let O=Number.parseInt(f,b);return O>=0&&O<=1114111?String.fromCodePoint(O):T+f+";"}i(Po,"fromCodePoint"),n(Po,"fromCodePoint");function Tn(f,b,T,O){if(f){let L=f(b);T===b&&(T=L),b=L}return b=Ao(b,O),{tagName:b,tagExp:T}}i(Tn,"transformTagName"),n(Tn,"transformTagName");function Ao(f,b){if(p.includes(f))throw new Error(`[SECURITY] Invalid name: "${f}" is a reserved JavaScript keyword that could cause prototype pollution`);return d.includes(f)?b.onDangerousProperty(f):f}i(Ao,"sanitizeName"),n(Ao,"sanitizeName");var rn=I.getMetaDataSymbol();function Eo(f,b){if(!f||typeof f!="object")return{};if(!b)return f;let T={};for(let O in f)if(O.startsWith(b)){let L=O.substring(b.length);T[L]=f[O]}else T[O]=f[O];return T}i(Eo,"stripAttributePrefix"),n(Eo,"stripAttributePrefix");function ko(f,b,T){return Jn(f,b,T)}i(ko,"prettify"),n(ko,"prettify");function Jn(f,b,T){let O,L={};for(let k=0;k<f.length;k++){let Y=f[k],Z=ur(Y);if(Z!==void 0&&Z!==b.textNodeName){let U=Eo(Y[":@"]||{},b.attributeNamePrefix);T.push(Z,U)}if(Z===b.textNodeName)O===void 0?O=Y[Z]:O+=""+Y[Z];else{if(Z===void 0)continue;if(Y[Z]){let U=Jn(Y[Z],b,T),ge=io(U,b);if(Y[":@"]?Oo(U,Y[":@"],T,b):Object.keys(U).length===1&&U[b.textNodeName]!==void 0&&!b.alwaysCreateTextNode?U=U[b.textNodeName]:Object.keys(U).length===0&&(b.alwaysCreateTextNode?U[b.textNodeName]="":U=""),Y[rn]!==void 0&&typeof U=="object"&&U!==null&&(U[rn]=Y[rn]),L[Z]!==void 0&&Object.prototype.hasOwnProperty.call(L,Z))Array.isArray(L[Z])||(L[Z]=[L[Z]]),L[Z].push(U);else{let Ie=b.jPath?T.toString():T;b.isArray(Z,Ie,ge)?L[Z]=[U]:L[Z]=U}Z!==void 0&&Z!==b.textNodeName&&T.pop()}}}return typeof O=="string"?O.length>0&&(L[b.textNodeName]=O):O!==void 0&&(L[b.textNodeName]=O),L}i(Jn,"compress"),n(Jn,"compress");function ur(f){let b=Object.keys(f);for(let T=0;T<b.length;T++){let O=b[T];if(O!==":@")return O}}i(ur,"propName"),n(ur,"propName");function Oo(f,b,T,O){if(b){let L=Object.keys(b),k=L.length;for(let Y=0;Y<k;Y++){let Z=L[Y],U=Z.startsWith(O.attributeNamePrefix)?Z.substring(O.attributeNamePrefix.length):Z,ge=O.jPath?T.toString()+"."+U:T;O.isArray(Z,ge,!0,!0)?f[Z]=[b[Z]]:f[Z]=b[Z]}}}i(Oo,"assignAttributes"),n(Oo,"assignAttributes");function io(f,b){let{textNodeName:T}=b,O=Object.keys(f).length;return!!(O===0||O===1&&(f[T]||typeof f[T]=="boolean"||f[T]===0))}i(io,"isLeafTag"),n(io,"isLeafTag");var lr={allowBooleanAttributes:!1,unpairedTags:[]};function _o(f,b){b=Object.assign({},lr,b);let T=[],O=!1,L=!1;f[0]==="\uFEFF"&&(f=f.substr(1));for(let k=0;k<f.length;k++)if(f[k]==="<"&&f[k+1]==="?"){if(k+=2,k=Ut(f,k),k.err)return k}else if(f[k]==="<"){let Y=k;if(k++,f[k]==="!"){k=xo(f,k);continue}else{let Z=!1;f[k]==="/"&&(Z=!0,k++);let U="";for(;k<f.length&&f[k]!==">"&&f[k]!==" "&&f[k]!==" "&&f[k]!==`
406
406
  `&&f[k]!=="\r";k++)U+=f[k];if(U=U.trim(),U[U.length-1]==="/"&&(U=U.substring(0,U.length-1),k--),!Jr(U)){let ze;return U.trim().length===0?ze="Invalid space after '<'.":ze="Tag '"+U+"' is an invalid name.",mt("InvalidTag",ze,Mt(f,k))}let ge=pr(f,k);if(ge===!1)return mt("InvalidAttr","Attributes for '"+U+"' have open quote.",Mt(f,k));let Ie=ge.value;if(k=ge.index,Ie[Ie.length-1]==="/"){let ze=k-Ie.length;Ie=Ie.substring(0,Ie.length-1);let bt=Mo(Ie,b);if(bt===!0)O=!0;else return mt(bt.err.code,bt.err.msg,Mt(f,ze+bt.err.line))}else if(Z)if(ge.tagClosed){if(Ie.trim().length>0)return mt("InvalidTag","Closing tag '"+U+"' can't have attributes or invalid starting.",Mt(f,Y));if(T.length===0)return mt("InvalidTag","Closing tag '"+U+"' has not been opened.",Mt(f,Y));{let ze=T.pop();if(U!==ze.tagName){let bt=Mt(f,ze.tagStartPos);return mt("InvalidTag","Expected closing tag '"+ze.tagName+"' (opened in line "+bt.line+", col "+bt.col+") instead of closing tag '"+U+"'.",Mt(f,Y))}T.length==0&&(L=!0)}}else return mt("InvalidTag","Closing tag '"+U+"' doesn't have proper closing.",Mt(f,k));else{let ze=Mo(Ie,b);if(ze!==!0)return mt(ze.err.code,ze.err.msg,Mt(f,k-Ie.length+ze.err.line));if(L===!0)return mt("InvalidXml","Multiple possible root nodes found.",Mt(f,k));b.unpairedTags.indexOf(U)!==-1||T.push({tagName:U,tagStartPos:Y}),O=!0}for(k++;k<f.length;k++)if(f[k]==="<")if(f[k+1]==="!"){k++,k=xo(f,k);continue}else if(f[k+1]==="?"){if(k=Ut(f,++k),k.err)return k}else break;else if(f[k]==="&"){let ze=hr(f,k);if(ze==-1)return mt("InvalidChar","char '&' is not expected.",Mt(f,k));k=ze}else if(L===!0&&!so(f[k]))return mt("InvalidXml","Extra text at the end",Mt(f,k));f[k]==="<"&&k--}}else{if(so(f[k]))continue;return mt("InvalidChar","char '"+f[k]+"' is not expected.",Mt(f,k))}if(O){if(T.length==1)return mt("InvalidTag","Unclosed tag '"+T[0].tagName+"'.",Mt(f,T[0].tagStartPos));if(T.length>0)return mt("InvalidXml","Invalid '"+JSON.stringify(T.map(k=>k.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return mt("InvalidXml","Start tag expected.",1);return!0}i(_o,"validate"),n(_o,"validate");function so(f){return f===" "||f===" "||f===`
407
407
  `||f==="\r"}i(so,"isWhiteSpace"),n(so,"isWhiteSpace");function Ut(f,b){let T=b;for(;b<f.length;b++)if(f[b]=="?"||f[b]==" "){let O=f.substr(T,b-T);if(b>5&&O==="xml")return mt("InvalidXml","XML declaration allowed only at the start of the document.",Mt(f,b));if(f[b]=="?"&&f[b+1]==">"){b++;break}else continue}return b}i(Ut,"readPI"),n(Ut,"readPI");function xo(f,b){if(f.length>b+5&&f[b+1]==="-"&&f[b+2]==="-"){for(b+=3;b<f.length;b++)if(f[b]==="-"&&f[b+1]==="-"&&f[b+2]===">"){b+=2;break}}else if(f.length>b+8&&f[b+1]==="D"&&f[b+2]==="O"&&f[b+3]==="C"&&f[b+4]==="T"&&f[b+5]==="Y"&&f[b+6]==="P"&&f[b+7]==="E"){let T=1;for(b+=8;b<f.length;b++)if(f[b]==="<")T++;else if(f[b]===">"&&(T--,T===0))break}else if(f.length>b+9&&f[b+1]==="["&&f[b+2]==="C"&&f[b+3]==="D"&&f[b+4]==="A"&&f[b+5]==="T"&&f[b+6]==="A"&&f[b+7]==="["){for(b+=8;b<f.length;b++)if(f[b]==="]"&&f[b+1]==="]"&&f[b+2]===">"){b+=2;break}}return b}i(xo,"readCommentAndCDATA"),n(xo,"readCommentAndCDATA");var Ji='"',dr="'";function pr(f,b){let T="",O="",L=!1;for(;b<f.length;b++){if(f[b]===Ji||f[b]===dr)O===""?O=f[b]:O!==f[b]||(O="");else if(f[b]===">"&&O===""){L=!0;break}T+=f[b]}return O!==""?!1:{value:T,index:b,tagClosed:L}}i(pr,"readAttributeStr"),n(pr,"readAttributeStr");var Vr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Mo(f,b){let T=c(f,Vr),O={};for(let L=0;L<T.length;L++){if(T[L][1].length===0)return mt("InvalidAttr","Attribute '"+T[L][2]+"' has no space in starting.",hn(T[L]));if(T[L][3]!==void 0&&T[L][4]===void 0)return mt("InvalidAttr","Attribute '"+T[L][2]+"' is without value.",hn(T[L]));if(T[L][3]===void 0&&!b.allowBooleanAttributes)return mt("InvalidAttr","boolean attribute '"+T[L][2]+"' is not allowed.",hn(T[L]));let k=T[L][2];if(!fr(k))return mt("InvalidAttr","Attribute '"+k+"' is an invalid name.",hn(T[L]));if(!Object.prototype.hasOwnProperty.call(O,k))O[k]=1;else return mt("InvalidAttr","Attribute '"+k+"' is repeated.",hn(T[L]))}return!0}i(Mo,"validateAttributeString"),n(Mo,"validateAttributeString");function mr(f,b){let T=/\d/;for(f[b]==="x"&&(b++,T=/[\da-fA-F]/);b<f.length;b++){if(f[b]===";")return b;if(!f[b].match(T))break}return-1}i(mr,"validateNumberAmpersand"),n(mr,"validateNumberAmpersand");function hr(f,b){if(b++,f[b]===";")return-1;if(f[b]==="#")return b++,mr(f,b);let T=0;for(;b<f.length;b++,T++)if(!(f[b].match(/\w/)&&T<20)){if(f[b]===";")break;return-1}return b}i(hr,"validateAmpersand"),n(hr,"validateAmpersand");function mt(f,b,T){return{err:{code:f,msg:b,line:T.line||T,col:T.col}}}i(mt,"getErrorObject"),n(mt,"getErrorObject");function fr(f){return u(f)}i(fr,"validateAttrName"),n(fr,"validateAttrName");function Jr(f){return u(f)}i(Jr,"validateTagName"),n(Jr,"validateTagName");function Mt(f,b){let T=f.substring(0,b).split(/\r?\n/);return{line:T.length,col:T[T.length-1].length+1}}i(Mt,"getLineNumberForPosition"),n(Mt,"getLineNumberForPosition");function hn(f){return f.startIndex+f[1].length}i(hn,"getPositionFromMatch"),n(hn,"getPositionFromMatch");var Wr=class{static{i(this,"XMLParser")}static{n(this,"XMLParser")}constructor(f){this.externalEntities={},this.options=S(f)}parse(f,b){if(typeof f!="string"&&f.toString)f=f.toString();else if(typeof f!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(b){b===!0&&(b={});let L=_o(f,b);if(L!==!0)throw Error(`${L.err.msg}:${L.err.line}:${L.err.col}`)}let T=new je(this.options);T.addExternalEntities(this.externalEntities);let O=T.parseXml(f);return this.options.preserveOrder||O===void 0?O:ko(O,this.options,T.matcher)}addEntity(f,b){if(b.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(f.indexOf("&")!==-1||f.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(b==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[f]=b}static getMetaDataSymbol(){return I.getMetaDataSymbol()}};return new Wr(t)},"getXmlParser");var UR=class extends No{static{i(this,"XmlToJsonOutboundPolicy")}static policyType="xml-to-json";parser;parseOnStatusCodes;constructor(e,n){super(e,n),Be(this.options,this.policyName).optional("removeNSPrefix","boolean").optional("ignoreProcessingInstructions","boolean").optional("ignoreDeclarations","boolean").optional("ignoreAttributes","boolean").optional("stopNodes","array").optional("attributeNamePrefix","string").optional("textNodeName","string").optional("trimValues","boolean"),this.parseOnStatusCodes=e.parseOnStatusCodes?po(e.parseOnStatusCodes):void 0,this.parser=A0({removeNSPrefix:e?.removeNSPrefix??!0,ignorePiTags:e?.ignoreProcessingInstructions??!0,ignoreDeclaration:e?.ignoreDeclarations??!0,ignoreAttributes:e?.ignoreAttributes??!0,stopNodes:e?.stopNodes??[],attributeNamePrefix:e?.attributeNamePrefix??"@_",textNodeName:e?.textNodeName??"#text",trimValues:e?.trimValues??!0,processEntities:{enabled:!0,maxTotalExpansions:1/0,maxEntityCount:1e3}})}async handler(e,n,o){if(this.parseOnStatusCodes&&!this.parseOnStatusCodes.includes(e.status))return e;let r;try{let c=await e.text();r=this.parser.parse(c)}catch(c){let u=`XmlToJsonOutboundPolicy - Error parsing XML contents in policy '${this.policyName}'.`;throw o.log.error(u,c),new j(u)}let s=new Headers(e.headers);return s.set("content-type","application/json"),new Response(JSON.stringify(r),{status:e.status,statusText:e.statusText,headers:s})}};var jR=class{static{i(this,"ServiceProviderImpl")}services=new Map;addService(e,n){if(this.services.get(e))throw new Ve(`A service with the name ${e} already exists -- you cannot have duplicate services`);this.services.set(e,n)}getService(e){return this.services.get(e)}};var HR=class{static{i(this,"ApiKeyConsumerClient")}bucketId;cacheDurationSeconds;cacheNamePromise;constructor(e){this.bucketId=e?.bucketId,this.cacheDurationSeconds=e?.cacheDurationSeconds??60}getCacheName(e){return this.cacheNamePromise||(this.cacheNamePromise=Qe("zuplo-get-consumer",{bucketId:e})),this.cacheNamePromise}async get(e){ce("utility.get-consumer");let n=di(),o=this.bucketId??ot.ZUPLO_SERVICE_BUCKET_ID;if(!o)throw new v("ApiKeyConsumerClient - no bucketId provided and no default bucket is configured for this environment. Pass `bucketId` explicitly (find it in the Zuplo portal under Settings > API Key Buckets).");if(!o.startsWith("bckt_"))throw new v(`ApiKeyConsumerClient - bucketId "${o}" is not a valid bucket id. Bucket ids start with "bckt_" (e.g. "bckt_2HaK3odRyJle6NJSu8mzNKBC30BYxllxL"); a bucket name (e.g. "zprj-...-working-copy") is not accepted here. Find the bucket id in the Zuplo portal under Settings > API Key Buckets.`);if(!e||e.trim()==="")throw new v("ApiKeyConsumerClient.get - consumerId is required and cannot be empty");let r=await this.getCacheName(o),s=new et(r,n);if(this.cacheDurationSeconds>0){let l=await s.get(e);if(l)return l}let a=`/v2/key-auth/${encodeURIComponent(o)}/consumers/${encodeURIComponent(e)}`,c=await _h(a),u={id:c.id,name:c.name,createdOn:c.createdOn,updatedOn:c.updatedOn};return c.description!==void 0&&(u.description=c.description),c.metadata!==void 0&&(u.metadata=c.metadata),this.cacheDurationSeconds>0&&s.put(e,u,this.cacheDurationSeconds),u}};var E0=10,k0=3e4,Sl=class{static{i(this,"BackgroundLoader")}#e=new Map;#t;#o;#n;#r;#i={};constructor(e,n){if(typeof n=="number"){let o=n;this.#o=o*1e3,this.#r=k0,this.#n=E0}else{let o=n;this.#o=o.ttlSeconds*1e3,this.#r=o.loaderTimeoutSeconds?o.loaderTimeoutSeconds*1e3:k0,this.#n=E0}this.#t=e}#s(e){return e.expiry<=new Date}#a(e){let n=this.#i[e];return!(n===void 0||n===0)}#u(e){let n=this.#e.get(e);if(n&&!this.#s(n))return n.data}async get(e){let n=this.#u(e);if(n)return this.#l(e),n;if(this.#a(e))try{await kB(()=>this.#u(e)!==void 0||!this.#a(e),this.#r+this.#n+1,this.#n);let o=this.#u(e);if(o)return o}catch{}return this.#c(e)}#l(e){if(!this.#a(e)){let n=this.#c(e);kr().waitUntil(n)}}async#c(e){try{this.#i[e]===void 0&&(this.#i[e]=0),this.#i[e]++;let n=await Promise.race([this.#t(e),scheduler.wait(this.#r)]);if(n===void 0)throw new v(`BackgroundLoader: Loader timed out after ${this.#r} ms.`);return this.#e.set(e,{data:n,expiry:new Date(Date.now()+this.#o)}),n}finally{this.#i[e]--}}};async function kB(t,e,n){let o=Date.now();for(;!t();){let r=Date.now()-o;if(r>e)throw new v(`BackgroundLoader: Timeout waiting for an on-going loader after ${r} ms.`);await scheduler.wait(n)}}i(kB,"waitUntilTrue");import{SpanStatusCode as _0,trace as OB}from"@opentelemetry/api";var O0,x0=i(()=>(O0??=OB.getTracer("pipeline"),O0),"tracer"),M0=i(async(t,e,n)=>{let o=at.instance.routeData.policies,r=ps([t],o);if(r.length===0)throw new j(`Invalid 'invokeInboundPolicy call' - no policy '${t}' found.`);let s=r[0];return await x0().startActiveSpan(`policy:${s.policyName}`,async c=>{try{ds(c,s);let u=await s.handler(e,n);if(u instanceof Request||u instanceof He||u instanceof Response)return u instanceof Response||u instanceof He?u:new He(u);{let l=new v(`Invalid state - invalid handler on policy '${s.policyName}' invoked via 'invokeInboundPolicy' on route '${n.route.path}'. The result of an inbound policy must be a Response or Request.`);throw c.setStatus({code:_0.ERROR}),c.recordException(l),l}}finally{c.end()}})},"invokeInboundPolicy"),L0=i(async(t,e,n,o)=>{let r=at.instance.routeData.policies,s=tc([t],r);if(s.length===0)throw new j(`Invalid 'invokeOutboundPolicy call' - no policy '${t}' found.`);let a=s[0];return await x0().startActiveSpan(`policy:${a.policyName}`,async u=>{try{ds(u,a);let l=await a.handler(e,n,o);if(l instanceof Response)return l;{let d=new v(`Invalid state - invalid handler on policy '${a.policyName}' invoked via 'invokeOutboundPolicy' on route '${o.route.path}. The result of an outbound policy must be a Response.`);throw u.setStatus({code:_0.ERROR}),u.recordException(d),d}}finally{u.end()}})},"invokeOutboundPolicy");var _B="127.0.0.1";function N0(t){let e=x.instance,n=t.get(e.trustedIpHeader)?.trim();return n||(e.isLocalDevelopment?_B:void 0)}i(N0,"resolveClientIp");function xB(t){let e={};if(!t)return e;try{let n=t.split(","),o={};return n.forEach(r=>{let[s,a]=r.split("=");s&&a&&(o[s.trim()]=a.trim())}),o.asnum&&(e[ud]=o.asnum),o.zip&&(e[ld]=o.zip.split("+")[0]),o.dma&&(e[dd]=o.dma),o.region_code&&(e[pd]=o.region_code),o.timezone&&(e[md]=o.timezone),o.city&&(e[rd]=o.city),o.continent&&(e[id]=o.continent),o.country_code&&(e[sd]=o.country_code),o.long&&(e[ad]=o.long),o.lat&&(e[cd]=o.lat),e}catch{return{}}}i(xB,"parseEdgeScapeHeader");function q0(t,e){let n=xB(e);for(let[o,r]of Object.entries(n))t.has(o)||t.set(o,r)}i(q0,"setZpHeadersFromAkamaiEdgeScapeHeader");var op=class{static{i(this,"HeaderIncomingRequestProperties")}#e;constructor(e){this.#e=e;let n=e.get(Sw);if(n){let o=new Headers(e);q0(o,n),this.#e=o}}get ip(){return N0(this.#e)}get asn(){try{let e=this.#e.get(ud);if(typeof e=="string")return parseInt(e,10)}catch{}}get asOrganization(){return this.#e.get(hw)??void 0}get city(){return this.#e.get(WR)??this.#e.get(rd)??void 0}get continent(){return this.#e.get(KR)??this.#e.get(id)??void 0}get country(){return this.#e.get(YR)??this.#e.get(sd)??void 0}get latitude(){return this.#e.get(XR)??this.#e.get(cd)??void 0}get longitude(){return this.#e.get(QR)??this.#e.get(ad)??void 0}get colo(){return this.#e.get(fw)??void 0}get postalCode(){return this.#e.get(ow)??this.#e.get(ld)??void 0}get metroCode(){return this.#e.get(nw)??this.#e.get(dd)??void 0}get region(){return this.#e.get(ew)??this.#e.get(gw)??void 0}get regionCode(){return this.#e.get(tw)??this.#e.get(pd)??void 0}get timezone(){return this.#e.get(rw)??this.#e.get(md)??void 0}get httpProtocol(){return this.#e.get(yw)??void 0}get clientCert(){return this.#e.get(sw)??void 0}get clientMtlsVerificationStatus(){return this.#e.get(aw)??void 0}get clientMtlsVerificationReason(){return this.#e.get(cw)??void 0}get clientCertFingerprintSha256(){return this.#e.get(uw)??void 0}get clientCertNotBefore(){return this.#e.get(lw)??void 0}get clientCertNotAfter(){return this.#e.get(dw)??void 0}get clientCertIssuerDn(){return this.#e.get(pw)??void 0}get clientCertSubjectDn(){return this.#e.get(mw)??void 0}toJSON(){return{ip:this.ip,asn:this.asn,asOrganization:this.asOrganization,city:this.city,continent:this.continent,country:this.country,latitude:this.latitude,longitude:this.longitude,colo:this.colo,postalCode:this.postalCode,metroCode:this.metroCode,region:this.region,regionCode:this.regionCode,timezone:this.timezone,httpProtocol:this.httpProtocol,clientCert:this.clientCert,clientMtlsVerificationStatus:this.clientMtlsVerificationStatus,clientMtlsVerificationReason:this.clientMtlsVerificationReason,clientCertFingerprintSha256:this.clientCertFingerprintSha256,clientCertNotBefore:this.clientCertNotBefore,clientCertNotAfter:this.clientCertNotAfter,clientCertIssuerDn:this.clientCertIssuerDn,clientCertSubjectDn:this.clientCertSubjectDn}}};function pa(t){return{contextId:t.contextId,incomingRequestProperties:t.incomingRequestProperties,requestId:t.requestId,route:t.route,custom:t.custom,parentContext:t.parentContext,analyticsContext:t.analyticsContext}}i(pa,"createRewriteContext");var Qa=class extends Event{static{i(this,"ResponseSendingEvent")}constructor(e,n){super("responseSending"),this.request=e,this.mutableResponse=n}request;mutableResponse},Xa=class extends Event{static{i(this,"ResponseSentEvent")}constructor(e,n){super("responseSent"),this.request=e,this.response=n}request;response},vt=class t{static{i(this,"ZuploContextExtensions")}static#e=new WeakMap;static initialize(e,n){if(!t.#e.has(e)){let o=new t(n);return t.#e.set(e,o),o}throw new Error(`ZuploContextExtensions already initialized for context with requestId '${e.requestId}'`)}static getContextExtensions(e){let n=t.#e.get(e);if(!n)throw new j(`Invalid state, could not get ZuploContext extensions for context with requestId '${e.requestId}'`);return n}latestRequest;auditLogEventId="";#t;#o;#n;constructor(e){this.latestRequest=e,this.#t=[],this.#o=[],this.#n=[]}addResponseSendingHook(e){this.#o.push(e)}addResponseSendingFinalHook(e){this.#t.push(e)}addHandlerResponseHook(e){this.#n.push(e)}onResponseSendingFinal=i(async(e,n,o)=>{for(let r of this.#t)await r(e,n,o)},"onResponseSendingFinal");onResponseSending=i(async(e,n,o)=>{let r=e,s=x.instance.build.COMPATIBILITY_FLAGS.chainResponseSendingHooks;for(let a of this.#o)r=await a(s?r:e,n,o);return r},"onResponseSending");onHandlerResponse=i(async(e,n,o)=>{for(let r of this.#n)await r(e,n,o)},"onHandlerResponse")},rp=class extends EventTarget{static{i(this,"SystemZuploContext")}constructor({logger:e,route:n,requestId:o,event:r,custom:s,incomingRequestProperties:a,parentContext:c}){super(),this.log=Object.freeze(e),this.route=n,this.requestId=o,this.custom=s,this.incomingRequestProperties=a,this.parentContext=c,this.#e=r,this.invokeInboundPolicy=(u,l)=>M0(u,l,this),this.contextId=crypto.randomUUID(),this.invokeOutboundPolicy=(u,l,d)=>L0(u,l,d,this),this.invokeRoute=async(u,l)=>{let d=u;typeof u=="string"&&u.startsWith("/")&&(d=new URL(u,"http://localhost"));let p=new He(d,l);return at.instance.handleRequest(p,this,{parentContext:this})},this.waitUntil=u=>{this.#e.waitUntil(u)},this.addResponseSendingHook=u=>{vt.getContextExtensions(this).addResponseSendingHook(u)},this.addResponseSendingFinalHook=u=>{vt.getContextExtensions(this).addResponseSendingFinalHook(u)},this.analyticsContext=new Iw(o),Object.freeze(this)}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;invokeInboundPolicy;invokeOutboundPolicy;invokeRoute;waitUntil;addResponseSendingHook;addResponseSendingFinalHook;addEventListener(e,n,o){ce("context.addEventListener");let r=i(s=>{try{typeof n=="function"?n(s):n.handleEvent(s)}catch(a){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),a}},"wrapped");super.addEventListener(e,r,o)}removeEventListener(e,n,o){ce("context.removeEventListener"),super.removeEventListener(e,n,o)}};export{os as a,co as b,Lt as c,K0 as d,Y0 as e,kh as f,Pt as g,Lo as h,Q0 as i,ni as j,ce as k,_h as l,Mh as m,En as n,Cr as o,Ba as p,oi as q,D as r,Nt as s,ri as t,Nh as u,qh as v,Rd as w,Ge as x,Rn as y,Ir as z,me as A,No as B,Fh as C,Jh as D,vM as E,as as F,Qa as G,Xa as H,Ef as I,gt as J,oI as K,rI as L,aq as M,lI as N,Gf as O,gq as P,hi as Q,yc as R,fi as S,Es as T,Vo as U,Jo as V,Mr as W,gi as X,Bo as Y,Et as Z,kp as _,ks as $,Os as aa,Sc as ba,Rc as ca,_s as da,Xt as ea,Lr as fa,kt as ga,un as ha,tn as ia,xs as ja,Ot as ka,Wo as la,Ms as ma,Ls as na,yi as oa,bi as pa,Si as qa,Op as ra,Ns as sa,wc as ta,qs as ua,Cc as va,Ko as wa,fo as xa,Yn as ya,_p as za,xp as Aa,vc as Ba,Ic as Ca,$s as Da,Ds as Ea,Tc as Fa,Pc as Ga,Ac as Ha,Ec as Ia,zs as Ja,kc as Ka,Oc as La,Us as Ma,_c as Na,Yo as Oa,Qo as Pa,js as Qa,Hs as Ra,Fs as Sa,Xo as Ta,go as Ua,Gs as Va,xc as Wa,Mc as Xa,Lc as Ya,Nc as Za,qc as _a,Ri as $a,$c as ab,Dc as bb,zc as cb,Uc as db,jc as eb,Hc as fb,Fc as gb,Gc as hb,Zs as ib,Zc as jb,Bc as kb,Vc as lb,Jc as mb,Wc as nb,Kc as ob,Yc as pb,Qc as qb,Xc as rb,eu as sb,tu as tb,nu as ub,ou as vb,ru as wb,wi as xb,Ci as yb,vi as zb,iu as Ab,su as Bb,au as Cb,Ii as Db,cu as Eb,uu as Fb,lu as Gb,du as Hb,pu as Ib,Bs as Jb,mu as Kb,hu as Lb,Vs as Mb,Mp as Nb,fu as Ob,gu as Pb,yu as Qb,Vf as Rb,er as Sb,bu as Tb,Su as Ub,Ru as Vb,wu as Wb,Cu as Xb,vu as Yb,Iu as Zb,Tu as _b,Pu as $b,xr as ac,Au as bc,Eu as cc,ku as dc,Ou as ec,_u as fc,Js as gc,Ti as hc,Pi as ic,Ws as jc,Ks as kc,Ys as lc,xu as mc,Qs as nc,Xs as oc,Mu as pc,Lu as qc,ea as rc,Ai as sc,Nu as tc,qu as uc,$u as vc,Du as wc,zu as xc,Uu as yc,ju as zc,Hu as Ac,Fu as Bc,Gu as Cc,Zu as Dc,Bu as Ec,Vu as Fc,Ju as Gc,Wu as Hc,Lp as Ic,Ku as Jc,tr as Kc,Np as Lc,Yu as Mc,qp as Nc,$p as Oc,Dp as Pc,zp as Qc,Up as Rc,jp as Sc,Hp as Tc,Fp as Uc,Gp as Vc,Zp as Wc,Bp as Xc,Vp as Yc,Jp as Zc,Wp as _c,Kp as $c,Yp as ad,Qu as bd,Xu as cd,Qp as dd,Xp as ed,em as fd,tm as gd,el as hd,tl as id,nm as jd,om as kd,rm as ld,YT as md,QT as nd,XT as od,eP as pd,tP as qd,nP as rd,xg as sd,qz as td,Mg as ud,Ng as vd,$g as wd,Ug as xd,Hg as yd,Gg as zd,Bg as Ad,Jg as Bd,Yg as Cd,ey as Dd,oy as Ed,sy as Fd,cy as Gd,uy as Hd,fl as Id,gl as Jd,yl as Kd,hy as Ld,Rl as Md,yy as Nd,by as Od,yU as Pd,Sy as Qd,Ry as Rd,SP as Sd,RP as Td,CP as Ud,Ay as Vd,Ey as Wd,iA as Xd,ub as Yd,hb as Zd,gb as _d,wA as $d,IA as ae,TA as be,jA as ce,HA as de,FA as ee,GA as fe,WA as ge,KA as he,Ab as ie,XA as je,jm as ke,w1 as le,Eb as me,dn as ne,cE as oe,Mb as pe,Lb as qe,dE as re,$b as se,mE as te,CE as ue,vE as ve,IE as we,TE as xe,PE as ye,AE as ze,ME as Ae,qE as Be,Bb as Ce,zE as De,UE as Ee,jE as Fe,HE as Ge,FE as He,GE as Ie,ZE as Je,KE as Ke,ek as Le,tk as Me,Qm as Ne,kH as Oe,ik as Pe,ak as Qe,oS as Re,yk as Se,Zr as Te,Ea as Ue,lt as Ve,It as We,wo as Xe,tRe as Ye,ql as Ze,iRe as _e,sRe as $e,qn as af,uRe as bf,lRe as cf,dRe as df,pRe as ef,$l as ff,mRe as gf,Hi as hf,bRe as if,nh as jf,Fi as kf,Oa as lf,aS as mf,ORe as nf,cS as of,uS as pf,lS as qf,dS as rf,pS as sf,mS as tf,hS as uf,fS as vf,gS as wf,yS as xf,bS as yf,OCe as zf,Bn as Af,$n as Bf,$t as Cf,uO as Df,FF as Ef,GF as Ff,SS as Gf,WCe as Hf,KCe as If,YCe as Jf,vO as Kf,IO as Lf,Sve as Mf,Rve as Nf,RS as Of,zl as Pf,ch as Qf,wve as Rf,AO as Sf,Tve as Tf,Ul as Uf,lG as Vf,dG as Wf,CS as Xf,Lve as Yf,_O as Zf,xO as _f,Dve as $f,zve as ag,Uve as bg,jve as cg,MO as dg,LO as eg,qO as fg,Co as gg,cr as hg,hG as ig,fG as jg,Wve as kg,Kve as lg,Yve as mg,Qve as ng,vo as og,SG as pg,lIe as qg,zO as rg,RIe as sg,PS as tg,wG as ug,kG as vg,_G as wg,HO as xg,NIe as yg,qIe as zg,$Ie as Ag,BO as Bg,jIe as Cg,HIe as Dg,FIe as Eg,xS as Fg,ph as Gg,MS as Hg,WO as Ig,QIe as Jg,XIe as Kg,eTe as Lg,tTe as Mg,Z_ as Ng,Vn as Og,WS as Pg,MTe as Qg,B_ as Rg,LTe as Sg,XS as Tg,eR as Ug,Y_ as Vg,fZ as Wg,nx as Xg,sR as Yg,px as Zg,cR as _g,wx as $g,uR as ah,dR as bh,vx as ch,Ix as dh,Tx as eh,hR as fh,gR as gh,xx as hh,Mx as ih,Lx as jh,Nx as kh,qx as lh,Dx as mh,SR as nh,qZ as oh,Fx as ph,vR as qh,Wx as rh,Kx as sh,Yx as th,WZ as uh,Qx as vh,Xx as wh,e0 as xh,t0 as yh,n0 as zh,AR as Ah,r0 as Bh,i0 as Ch,ER as Dh,kR as Eh,c0 as Fh,l0 as Gh,d0 as Hh,xR as Ih,m0 as Jh,S0 as Kh,$R as Lh,DR as Mh,R0 as Nh,P0 as Oh,UR as Ph,jR as Qh,HR as Rh,Sl as Sh};
408
- /*! For license information please see chunk-TPXAFGLU.js.LEGAL.txt */
409
- //# sourceMappingURL=chunk-TPXAFGLU.js.map
408
+ /*! For license information please see chunk-WH7LSEQF.js.LEGAL.txt */
409
+ //# sourceMappingURL=chunk-WH7LSEQF.js.map