@zuplo/runtime 6.34.8 → 6.34.10
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.
- package/out/esm/index.js +1 -1
- package/out/types/index.d.ts +1 -1
- package/package.json +1 -1
package/out/esm/index.js
CHANGED
|
@@ -83,5 +83,5 @@ Signature verification is impossible without access to the original signed mater
|
|
|
83
83
|
`&&b[T]!=="\r";T++)_+=b[T];if(_=_.trim(),_[_.length-1]==="/"&&(_=_.substring(0,_.length-1),T--),!J(_)){let $;return _.trim().length===0?$="Invalid space after '<'.":$="Tag '"+_+"' is an invalid name.",M("InvalidTag",$,X(b,T))}let D=q(b,T);if(D===!1)return M("InvalidAttr","Attributes for '"+_+"' have open quote.",X(b,T));let ee=D.value;if(T=D.index,ee[ee.length-1]==="/"){let $=T-ee.length;ee=ee.substring(0,ee.length-1);let U=j(ee,O);if(U===!0)me=!0;else return M(U.err.code,U.err.msg,X(b,$+U.err.line))}else if(B)if(D.tagClosed){if(ee.trim().length>0)return M("InvalidTag","Closing tag '"+_+"' can't have attributes or invalid starting.",X(b,L));{let $=G.pop();if(_!==$.tagName){let U=X(b,$.tagStartPos);return M("InvalidTag","Expected closing tag '"+$.tagName+"' (opened in line "+U.line+", col "+U.col+") instead of closing tag '"+_+"'.",X(b,L))}G.length==0&&(P=!0)}}else return M("InvalidTag","Closing tag '"+_+"' doesn't have proper closing.",X(b,T));else{let $=j(ee,O);if($!==!0)return M($.err.code,$.err.msg,X(b,T-ee.length+$.err.line));if(P===!0)return M("InvalidXml","Multiple possible root nodes found.",X(b,T));O.unpairedTags.indexOf(_)!==-1||G.push({tagName:_,tagStartPos:L}),me=!0}for(T++;T<b.length;T++)if(b[T]==="<")if(b[T+1]==="!"){T++,T=z(b,T);continue}else if(b[T+1]==="?"){if(T=F(b,++T),T.err)return T}else break;else if(b[T]==="&"){let $=I(b,T);if($==-1)return M("InvalidChar","char '&' is not expected.",X(b,T));T=$}else if(P===!0&&!S(b[T]))return M("InvalidXml","Extra text at the end",X(b,T));b[T]==="<"&&T--}}else{if(S(b[T]))continue;return M("InvalidChar","char '"+b[T]+"' is not expected.",X(b,T))}if(me){if(G.length==1)return M("InvalidTag","Unclosed tag '"+G[0].tagName+"'.",X(b,G[0].tagStartPos));if(G.length>0)return M("InvalidXml","Invalid '"+JSON.stringify(G.map(T=>T.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return M("InvalidXml","Start tag expected.",1);return!0};function S(b){return b===" "||b===" "||b===`
|
|
84
84
|
`||b==="\r"}i(S,"isWhiteSpace"),o(S,"isWhiteSpace");function F(b,O){let G=O;for(;O<b.length;O++)if(b[O]=="?"||b[O]==" "){let me=b.substr(G,O-G);if(O>5&&me==="xml")return M("InvalidXml","XML declaration allowed only at the start of the document.",X(b,O));if(b[O]=="?"&&b[O+1]==">"){O++;break}else continue}return O}i(F,"readPI"),o(F,"readPI");function z(b,O){if(b.length>O+5&&b[O+1]==="-"&&b[O+2]==="-"){for(O+=3;O<b.length;O++)if(b[O]==="-"&&b[O+1]==="-"&&b[O+2]===">"){O+=2;break}}else if(b.length>O+8&&b[O+1]==="D"&&b[O+2]==="O"&&b[O+3]==="C"&&b[O+4]==="T"&&b[O+5]==="Y"&&b[O+6]==="P"&&b[O+7]==="E"){let G=1;for(O+=8;O<b.length;O++)if(b[O]==="<")G++;else if(b[O]===">"&&(G--,G===0))break}else if(b.length>O+9&&b[O+1]==="["&&b[O+2]==="C"&&b[O+3]==="D"&&b[O+4]==="A"&&b[O+5]==="T"&&b[O+6]==="A"&&b[O+7]==="["){for(O+=8;O<b.length;O++)if(b[O]==="]"&&b[O+1]==="]"&&b[O+2]===">"){O+=2;break}}return O}i(z,"readCommentAndCDATA"),o(z,"readCommentAndCDATA");var H='"',C="'";function q(b,O){let G="",me="",P=!1;for(;O<b.length;O++){if(b[O]===H||b[O]===C)me===""?me=b[O]:me!==b[O]||(me="");else if(b[O]===">"&&me===""){P=!0;break}G+=b[O]}return me!==""?!1:{value:G,index:O,tagClosed:P}}i(q,"readAttributeStr"),o(q,"readAttributeStr");var V=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function j(b,O){let G=A.getAllMatches(b,V),me={};for(let P=0;P<G.length;P++){if(G[P][1].length===0)return M("InvalidAttr","Attribute '"+G[P][2]+"' has no space in starting.",Ce(G[P]));if(G[P][3]!==void 0&&G[P][4]===void 0)return M("InvalidAttr","Attribute '"+G[P][2]+"' is without value.",Ce(G[P]));if(G[P][3]===void 0&&!O.allowBooleanAttributes)return M("InvalidAttr","boolean attribute '"+G[P][2]+"' is not allowed.",Ce(G[P]));let T=G[P][2];if(!le(T))return M("InvalidAttr","Attribute '"+T+"' is an invalid name.",Ce(G[P]));if(!me.hasOwnProperty(T))me[T]=1;else return M("InvalidAttr","Attribute '"+T+"' is repeated.",Ce(G[P]))}return!0}i(j,"validateAttributeString"),o(j,"validateAttributeString");function x(b,O){let G=/\d/;for(b[O]==="x"&&(O++,G=/[\da-fA-F]/);O<b.length;O++){if(b[O]===";")return O;if(!b[O].match(G))break}return-1}i(x,"validateNumberAmpersand"),o(x,"validateNumberAmpersand");function I(b,O){if(O++,b[O]===";")return-1;if(b[O]==="#")return O++,x(b,O);let G=0;for(;O<b.length;O++,G++)if(!(b[O].match(/\w/)&&G<20)){if(b[O]===";")break;return-1}return O}i(I,"validateAmpersand"),o(I,"validateAmpersand");function M(b,O,G){return{err:{code:b,msg:O,line:G.line||G,col:G.col}}}i(M,"getErrorObject"),o(M,"getErrorObject");function le(b){return A.isName(b)}i(le,"validateAttrName"),o(le,"validateAttrName");function J(b){return A.isName(b)}i(J,"validateTagName"),o(J,"validateTagName");function X(b,O){let G=b.substring(0,O).split(/\r?\n/);return{line:G.length,col:G[G.length-1].length+1}}i(X,"getLineNumberForPosition"),o(X,"getLineNumberForPosition");function Ce(b){return b.startIndex+b[1].length}i(Ce,"getPositionFromMatch"),o(Ce,"getPositionFromMatch")}}),y=r({"node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(R,A){var{buildOptions:N}=s(),S=d(),{prettify:F}=p(),z=h(),H=class{static{i(this,"XMLParser")}static{o(this,"XMLParser")}constructor(C){this.externalEntities={},this.options=N(C)}parse(C,q){if(typeof C!="string")if(C.toString)C=C.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(q){q===!0&&(q={});let x=z.validate(C,q);if(x!==!0)throw Error(`${x.err.msg}:${x.err.line}:${x.err.col}`)}let V=new S(this.options);V.addExternalEntities(this.externalEntities);let j=V.parseXml(C);return this.options.preserveOrder||j===void 0?j:F(j,this.options)}addEntity(C,q){if(q.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(C.indexOf("&")!==-1||C.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(q==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[C]=q}};A.exports=H}});let v=y();return new v(n)},"getXmlParser");var bi=class extends We{static{i(this,"XmlToJsonOutboundPolicy")}parser;parseOnStatusCodes;constructor(e,t){super(e,t),g("policy.outbound.xml-to-json"),W(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?Ge(e.parseOnStatusCodes):void 0,this.parser=ou({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})}async handler(e,t,o){if(this.parseOnStatusCodes&&!this.parseOnStatusCodes.includes(e.status))return e;let r;try{let u=await e.text();r=this.parser.parse(u)}catch(u){let c=`XmlToJsonOutboundPolicy - Error parsing XML contents in policy '${this.policyName}'.`;throw o.log.error(c,u),new k(c)}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 wi=class{static{i(this,"ServiceProviderImpl")}services=new Map;addService(e,t){if(this.services.get(e))throw new K(`A service with the name ${e} already exists -- you cannot have duplicate services`);this.services.set(e,t)}getService(e){return this.services.get(e)}};var nn=class{static{i(this,"BackgroundDispatcher")}#e;constructor(e,t){if(!t||t.msDelay===void 0)throw new m("BackgroundDispatcher: options.msDelay is required");this.#e=new Y(t.name??"",t.msDelay,e)}enqueue=i(e=>{this.#e.enqueue(e),Je().waitUntil(this.#e.waitUntilFlushed())},"enqueue")};var ru=10,iu=3e4,Ri=class{static{i(this,"BackgroundLoader")}#e=new Map;#t;#n;#o;#r;#i={};constructor(e,t){if(typeof t=="number"){let o=t;this.#n=o*1e3,this.#r=iu,this.#o=ru}else{let o=t;this.#n=o.ttlSeconds*1e3,this.#r=o.loaderTimeoutSeconds?o.loaderTimeoutSeconds*1e3:iu,this.#o=ru}this.#t=e}#s(e){return e.expiry<=new Date}#a(e){let t=this.#i[e];return!(t===void 0||t===0)}#u(e){let t=this.#e.get(e);if(t&&!this.#s(t))return t.data}async get(e){let t=this.#u(e);if(t)return this.#l(e),t;if(this.#a(e))try{await Kd(()=>this.#u(e)!==void 0||!this.#a,this.#r+this.#o+1,this.#o);let o=this.#u(e);if(o)return o}catch{}return this.#c(e)}#l(e){if(!this.#a(e)){let t=this.#c(e);Je().waitUntil(t)}}async#c(e){try{this.#i[e]===void 0&&(this.#i[e]=0),this.#i[e]++;let t=await Promise.race([this.#t(e),scheduler.wait(this.#r)]);if(t===void 0)throw new m(`BackgroundLoader: Loader timed out after ${this.#r} ms.`);return this.#e.set(e,{data:t,expiry:new Date(Date.now()+this.#n)}),t}finally{this.#i[e]--}}};async function Kd(n,e,t){let o=Date.now();for(;!n();){let r=Date.now()-o;if(r>e)throw new m(`BackgroundLoader: Timeout waiting for an on-going loader after ${r} ms.`);await scheduler.wait(t)}}i(Kd,"waitUntilTrue");var Pi,_t=class{static{i(this,"RequestLoggerCore")}constructor(e,t){let r=(e.batchPeriodSeconds??.01)*1e3;this.#n=new nn(this.#t,{msDelay:r}),this.#e=e,this.initialize(t)}initialize(e){e.addRequestHook((t,o)=>{Pi=o;let r=Date.now();return o.addResponseSendingFinalHook(async s=>{let a={deploymentName:f.instance.deploymentName??"",instanceId:f.instance.instanceId,systemUserAgent:f.instance.systemUserAgent,requestStartTime:new Date(r),durationMs:Date.now()-r},u=await this.#e.generateLogEntry(s,t,o,a);this.#n.enqueue(u)}),t})}#e;#t=i(async e=>{if(e.length!==0)try{await this.#e.dispatchFunction(e)}catch(t){Qd(t,this.#e.name)}},"#dispatch");#n};function Qd(n,e){if(!Pi){let o=Je(),r=te({level:"error",messages:[`RequestLoggerCore '${e}': No context available to log user errors`]});o.waitUntil(r);return}let t;n instanceof Error?t={message:n.message,status:-1,details:n.stack??""}:t=n,Pi.log.error(`RequestLoggerCore '${e}': Error dispatching log entries.`,t)}i(Qd,"logError");var su="plugin.azure-blob-request-logger",Yd=i(()=>`${new Date().toISOString().replace(/[:-]/g,"-").replace("T","-").split(".")[0]}-${f.instance.instanceId}.csv`,"defaultGenerateBlobName"),au,Ei=class extends Ie{static{i(this,"AzureBlobPlugin")}constructor(e){super(),this.#e=e,g(su)}async initialize(e){new _t({name:su,generateLogEntry:this.#e.generateLogEntry,batchPeriodSeconds:this.#e.batchPeriodSeconds,dispatchFunction:this.#t},e)}#e;#t=i(async e=>{if(e.length===0)return;let t=Xd(e[0]),o=tp(e,t),s=(this.#e.generateBlobName??Yd)(e);await np(o,this.#e,s)},"#dispatch")};function Xd(n){return Object.keys(n)}i(Xd,"getHeaders");function ep(n){if(n==null)return"";let e=String(n);return(e.includes('"')||e.includes(",")||e.includes(`
|
|
85
85
|
`)||e.includes("\r"))&&(e=e.replace(/"/g,'""'),e=`"${e}"`),e}i(ep,"escapeCsvValue");function tp(n,e){let t=[];t.push(e.join(","));for(let o of n){let r=[];for(let s of e){let a=o[s];r.push(ep(a))}t.push(r.join(","))}return t.join(`
|
|
86
|
-
`)}i(tp,"generateCsvContent");async function np(n,e,t){let{sasUrl:o}=e,r
|
|
86
|
+
`)}i(tp,"generateCsvContent");async function np(n,e,t){let{sasUrl:o}=e,r=o.split("?"),s=`${r[0]}/${t}?${r[1]}`;try{let a=await Z.fetch(s,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:n});a.ok||(Ii({message:a.statusText,status:a.status,details:await a.text()}),Ii({message:a.statusText,status:a.status,details:await a.text()}))}catch(a){Ii(a)}}i(np,"uploadToAzureBlobStorage");function Ii(n){if(!au){let t=Je(),o=te({level:"error",messages:["AzureBlobCsvPlugin: No context available to log user errors"]});t.waitUntil(o);return}let e;n instanceof Error?e={message:n.message,status:-1,details:n.stack??""}:e=n,au.log.error("AzureBlobCsvPlugin: Error uploading to Azure Blob Storage",e)}i(Ii,"logError");var op="plugin.request-logger",xi=class extends Ie{static{i(this,"RequestLoggerPlugin")}constructor(e){super(),this.#e=e,g(op)}async initialize(e){new _t(this.#e,e)}#e};async function rp(n,e={}){g("utility.zuplo-api-services");let{method:t="GET",data:o}=e,r=new URL(n,f.instance.zuploEdgeApiUrl),s=new Headers(e.headers);_e(s),s.set("Content-Type","application/json");let a={method:t,headers:s};o&&(a.body=JSON.stringify(o));let u=await Z.fetch(r,a),c;try{if(!u.ok)throw c=await u.clone().json(),new Error(`Error ${u.status}: ${JSON.stringify(c)||"Request failed"}`);if(u.status===204)return;c=await u.clone().json()}catch(l){throw new Error(l.message)}return c}i(rp,"apiServices");var Ti=["sha-1","sha-256","sha-384","sha-512"],jn=class{static{i(this,"BaseCryptoBeta")}};var vi=class extends jn{static{i(this,"WorkerCryptoBeta")}async digest(e,t){if(g("runtime.crypto-beta"),!Ti.includes(e.toLowerCase()))throw new k(`Algorithm ${e} is not supported. Try using ${Ti.join(", ")}`);let o=new TextEncoder().encode(t),r=await crypto.subtle.digest(e,o);return Array.from(new Uint8Array(r)).map(u=>u.toString(16).padStart(2,"0")).join("")}};export{Er as AWSLoggingPlugin,Rl as AmberfloMeteringInboundPolicy,Hr as AmberfloMeteringPolicy,El as ApiAuthKeyInboundPolicy,$r as ApiKeyInboundPolicy,Fr as AsertoAuthZInboundPolicy,kr as AuditLogDataStaxProvider,Lr as AuditLogPlugin,Ol as Auth0JwtInboundPolicy,Zc as AwsLambdaHandlerExtensions,Gr as AxiomaticsAuthZInboundPolicy,Ei as AzureBlobPlugin,nn as BackgroundDispatcher,Ri as BackgroundLoader,Sl as BasicAuthInboundPolicy,Ba as BasicRateLimitInboundPolicy,Y as BatchDispatch,Jr as BrownoutInboundPolicy,Hl as CachingInboundPolicy,$l as ChangeMethodInboundPolicy,Fl as ClearHeadersInboundPolicy,jl as ClearHeadersOutboundPolicy,zl as ClerkJwtInboundPolicy,Bl as CognitoJwtInboundPolicy,ti as ComplexRateLimitInboundPolicy,ed as CompositeInboundPolicy,td as CompositeOutboundPolicy,m as ConfigurationError,Oo as ContentTypes,re as ContextData,vi as CryptoBeta,nd as CurityPhantomTokenInboundPolicy,tr as DataDogLoggingPlugin,vr as DataDogMetricsPlugin,gr as DynaTraceLoggingPlugin,Sr as DynatraceMetricsPlugin,rd as FirebaseJwtInboundPolicy,id as FormDataToJsonInboundPolicy,sd as GeoFilterInboundPolicy,Ko as GoogleCloudLoggingPlugin,ir as Handler,E as HttpProblems,gn as HttpStatusCode,ce as InboundPolicy,ad as JWTScopeValidationInboundPolicy,hr as LokiLoggingPlugin,ht as LookupResult,ie as MemoryZoneReadThroughCache,ud as MockApiInboundPolicy,fd as MoesifInboundPolicy,ii as MonetizationInboundPolicy,si as OktaFGAAuthZInboundPolicy,yd as OktaJwtInboundPolicy,ai as OpenFGAAuthZInboundPolicy,we as OpenIdJwtInboundPolicy,We as OutboundPolicy,nt as ProblemResponseFormatter,wd as PropelAuthJwtInboundPolicy,li as QuotaInboundPolicy,Ba as RateLimitInboundPolicy,Td as ReadmeMetricsInboundPolicy,vd as RemoveHeadersInboundPolicy,Cd as RemoveHeadersOutboundPolicy,Od as RemoveQueryParamsInboundPolicy,Sd as ReplaceStringOutboundPolicy,xi as RequestLoggerPlugin,Ad as RequestSizeLimitInboundPolicy,Xa as RequestValidationInboundPolicy,Ld as RequireOriginInboundPolicy,Zt as ResponseSendingEvent,Ht as ResponseSentEvent,k as RuntimeError,un as SYSTEM_LOGGER,kd as SchemaBasedRequestValidation,He as SemanticAttributes,wi as ServiceProviderImpl,_d as SetBodyInboundPolicy,Nd as SetHeadersInboundPolicy,Dd as SetHeadersOutboundPolicy,Md as SetQueryParamsInboundPolicy,Ud as SetStatusOutboundPolicy,Zd as SleepInboundPolicy,ya as StripeMonetizationPlugin,Yt as StripeWebhookVerificationInboundPolicy,wr as SumoLogicLoggingPlugin,Hd as SupabaseJwtInboundPolicy,Ue as SystemRouteName,Ut as TelemetryPlugin,$d as UpstreamAzureAdServiceAuthInboundPolicy,jd as UpstreamFirebaseAdminAuthInboundPolicy,Gd as UpstreamFirebaseUserAuthInboundPolicy,fi as UpstreamGcpFederatedAuthInboundPolicy,Vd as UpstreamGcpJwtInboundPolicy,Wd as UpstreamGcpServiceAuthInboundPolicy,Pr as VMWareLogInsightLoggingPlugin,Jd as ValidateJsonSchemaInbound,bi as XmlToJsonOutboundPolicy,Nt as ZoneCache,ne as ZuploRequest,tn as ZuploServices,rp as apiServices,Hc as awsLambdaHandler,Re as environment,Gn as getIdForParameterSchema,du as getIdForRefSchema,Vn as getIdForRequestBodySchema,lu as getRawOperationDataIdentifierName,ko as httpStatuses,Wc as openApiSpecHandler,Kc as redirectHandler,pu as sanitizedIdentifierName,So as serialize,pd as setMoesifContext,g as trackFeature,Xc as urlForwardHandler,tl as urlRewriteHandler,nl as webSocketHandler,ol as webSocketPipelineHandler,Qc as zuploServiceProxy};
|
|
87
87
|
/*! For license information please see index.js.LEGAL.txt */
|
package/out/types/index.d.ts
CHANGED