@mongodb-js/compass-web 0.33.0 → 0.34.0

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 (35) hide show
  1. package/dist/128.9e3ffe7449cca93fbcb4.mjs +2 -0
  2. package/dist/174.9b919a5407fdc3851924.mjs +23 -0
  3. package/dist/221.73c874bae77f258d1063.mjs +2 -0
  4. package/dist/400.ee421ec0c79f2e659fa8.mjs +378 -0
  5. package/dist/455.e6b707cae57e3018c29e.mjs +1 -0
  6. package/dist/48.9ca2dbc319085729bea6.mjs +1 -0
  7. package/dist/753.c784df67afeae6565839.mjs +2 -0
  8. package/dist/772.2baa874c0109bdb1a2cb.mjs +2 -0
  9. package/dist/800.dcb5412b380b659e88ac.mjs +2 -0
  10. package/dist/915.2a425bc2ab5dfa3e6a60.mjs +2 -0
  11. package/dist/assets-manifest.json +11 -11
  12. package/dist/compass-web.d.ts +2 -1
  13. package/dist/compass-web.mjs +20 -20
  14. package/dist/{index-bde52cb3.4e8bced0562abda72f91.mjs → index-bde52cb3.8627a1873c0630586210.mjs} +1 -1
  15. package/package.json +27 -26
  16. package/dist/118.e053f5cd27a6e79a2160.mjs +0 -2
  17. package/dist/230.e76b85a956b5ff0706c2.mjs +0 -2
  18. package/dist/441.5fc410ee58ba58d47fe4.mjs +0 -1
  19. package/dist/48.be0392778da3c0562c52.mjs +0 -1
  20. package/dist/498.daea3dd5edc53dc0e66a.mjs +0 -2
  21. package/dist/544.d44513cb6f77c37e5b28.mjs +0 -2
  22. package/dist/575.e6ea1ed27328d76d52dd.mjs +0 -378
  23. package/dist/699.7f14395b39c971cc925a.mjs +0 -2
  24. package/dist/73.8077b03a81cbf9ba8573.mjs +0 -2
  25. package/dist/745.mjs +0 -1
  26. package/dist/917.5b479086294f58103ccc.mjs +0 -23
  27. package/dist/922.mjs +0 -1
  28. /package/dist/{544.d44513cb6f77c37e5b28.mjs.LICENSE.txt → 128.9e3ffe7449cca93fbcb4.mjs.LICENSE.txt} +0 -0
  29. /package/dist/{917.5b479086294f58103ccc.mjs.LICENSE.txt → 174.9b919a5407fdc3851924.mjs.LICENSE.txt} +0 -0
  30. /package/dist/{118.e053f5cd27a6e79a2160.mjs.LICENSE.txt → 221.73c874bae77f258d1063.mjs.LICENSE.txt} +0 -0
  31. /package/dist/{575.e6ea1ed27328d76d52dd.mjs.LICENSE.txt → 400.ee421ec0c79f2e659fa8.mjs.LICENSE.txt} +0 -0
  32. /package/dist/{498.daea3dd5edc53dc0e66a.mjs.LICENSE.txt → 753.c784df67afeae6565839.mjs.LICENSE.txt} +0 -0
  33. /package/dist/{73.8077b03a81cbf9ba8573.mjs.LICENSE.txt → 772.2baa874c0109bdb1a2cb.mjs.LICENSE.txt} +0 -0
  34. /package/dist/{699.7f14395b39c971cc925a.mjs.LICENSE.txt → 800.dcb5412b380b659e88ac.mjs.LICENSE.txt} +0 -0
  35. /package/dist/{230.e76b85a956b5ff0706c2.mjs.LICENSE.txt → 915.2a425bc2ab5dfa3e6a60.mjs.LICENSE.txt} +0 -0
package/dist/922.mjs DELETED
@@ -1 +0,0 @@
1
- export const __webpack_esm_id__=922;export const __webpack_esm_ids__=[922];export const __webpack_esm_modules__={10922:(e,t,s)=>{s.d(t,{StreamableHTTPServerTransport:()=>k});var r=s(72176),n=s(93874),o=s(27348),a=s(67787).Buffer,i=s(9606).URL,c=class extends Error{constructor(e,t){super(e,t),this.name="RequestError"}},d=global.Request,l=class extends d{constructor(e,t){"object"==typeof e&&p in e&&(e=e[p]()),void 0!==t?.body?.getReader&&(t.duplex??="half"),super(e,t)}},h=Symbol("wrapBodyStream"),p=Symbol("getRequestCache"),u=Symbol("requestCache"),f=Symbol("incomingKey"),m=Symbol("urlKey"),y=Symbol("headersKey"),S=Symbol("abortControllerKey"),g=Symbol("getAbortController"),w={get method(){return this[f].method||"GET"},get url(){return this[m]},get headers(){return this[y]||=(e=>{const t=[],s=e.rawHeaders;for(let e=0;e<s.length;e+=2){const{[e]:r,[e+1]:n}=s;58!==r.charCodeAt(0)&&t.push([r,n])}return new Headers(t)})(this[f])},[g](){return this[p](),this[S]},[p](){return this[S]||=new AbortController,this[u]||=((e,t,s,r,o)=>{const i={method:e,headers:s,signal:o.signal};if("TRACE"===e){i.method="GET";const e=new l(t,i);return Object.defineProperty(e,"method",{get:()=>"TRACE"}),e}if("GET"!==e&&"HEAD"!==e)if("rawBody"in r&&r.rawBody instanceof a)i.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[h]){let e;i.body=new ReadableStream({async pull(t){try{e||=n.Readable.toWeb(r).getReader();const{done:s,value:o}=await e.read();s?t.close():t.enqueue(o)}catch(e){t.error(e)}}})}else i.body=n.Readable.toWeb(r);return new l(t,i)})(this.method,this[m],this.headers,this[f],this[S])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach((e=>{Object.defineProperty(w,e,{get(){return this[p]()[e]}})})),["arrayBuffer","blob","clone","formData","json","text"].forEach((e=>{Object.defineProperty(w,e,{value:function(){return this[p]()[e]()}})})),Object.setPrototypeOf(w,l.prototype);var v=Symbol("responseCache"),_=Symbol("getResponseCache"),b=Symbol("cache"),R=global.Response,E=class e{#e;#t;[_](){return delete this[b],this[v]||=new R(this.#e,this.#t)}constructor(t,s){let r;if(this.#e=t,s instanceof e){const e=s[v];if(e)return this.#t=e,void this[_]();this.#t=s.#t,r=new Headers(s.#t.headers)}else this.#t=s;("string"==typeof t||void 0!==t?.getReader||t instanceof Blob||t instanceof Uint8Array)&&(r||=s?.headers||{"content-type":"text/plain; charset=UTF-8"},this[b]=[s?.status||200,t,r])}get headers(){const e=this[b];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2])),e[2]):this[_]().headers}get status(){return this[b]?.[0]??this[_]().status}get ok(){const e=this.status;return e>=200&&e<300}};async function T(e){return Promise.race([e,Promise.resolve().then((()=>Promise.resolve(void 0)))])}function I(e,t,s){const r=t=>{e.cancel(t).catch((()=>{}))};return t.on("close",r),t.on("error",r),(s??e.read()).then(a,n),e.closed.finally((()=>{t.off("close",r),t.off("error",r)}));function n(e){e&&t.destroy(e)}function o(){e.read().then(a,n)}function a({done:s,value:r}){try{if(s)t.end();else{if(t.write(r))return e.read().then(a,n);t.once("drain",o)}}catch(e){n(e)}}}["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach((e=>{Object.defineProperty(E.prototype,e,{get(){return this[_]()[e]}})})),["arrayBuffer","blob","clone","formData","json","text"].forEach((e=>{Object.defineProperty(E.prototype,e,{value:function(){return this[_]()[e]()}})})),Object.setPrototypeOf(E,R),Object.setPrototypeOf(E.prototype,R.prototype);var q=e=>{const t={};e instanceof Headers||(e=new Headers(e??void 0));const s=[];for(const[r,n]of e)"set-cookie"===r?s.push(n):t[r]=n;return s.length>0&&(t["set-cookie"]=s),t["content-type"]??="text/plain; charset=UTF-8",t},C=global.fetch;void 0===global.crypto&&(global.crypto=o),global.fetch=(e,t)=>(t={compress:!1,...t},C(e,t));var M=Symbol("outgoingEnded"),P=e=>new Response(null,{status:e instanceof Error&&("TimeoutError"===e.name||"TimeoutError"===e.constructor.name)?504:500}),J=(e,t)=>{const s=e instanceof Error?e:new Error("unknown error",{cause:e});"ERR_STREAM_PREMATURE_CLOSE"===s.code?console.info("The user aborted a request."):(console.error(e),t.headersSent||t.writeHead(500,{"Content-Type":"text/plain"}),t.end(`Error: ${s.message}`),t.destroy(s))},O=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},H=async(e,t)=>{let[s,r,n]=e[b];n instanceof Headers&&(n=q(n)),"string"==typeof r?n["Content-Length"]=a.byteLength(r):r instanceof Uint8Array?n["Content-Length"]=r.byteLength:r instanceof Blob&&(n["Content-Length"]=r.size),t.writeHead(s,n),"string"==typeof r||r instanceof Uint8Array?t.end(r):r instanceof Blob?t.end(new Uint8Array(await r.arrayBuffer())):(O(t),await(function(e,t){if(e.locked)throw new TypeError("ReadableStream is locked.");if(!t.destroyed)return I(e.getReader(),t)}(r,t)?.catch((e=>J(e,t))))),t[M]?.()},j=(e,t={})=>{const s=t.autoCleanupIncoming??!0;return!1!==t.overrideGlobalObjects&&global.Request!==l&&(Object.defineProperty(global,"Request",{value:l}),Object.defineProperty(global,"Response",{value:E})),async(n,o)=>{let a,d;try{d=((e,t)=>{const s=Object.create(w);s[f]=e;const n=e.url||"";if("/"!==n[0]&&(n.startsWith("http://")||n.startsWith("https://"))){if(e instanceof r.Http2ServerRequest)throw new c("Absolute URL for :path is not allowed in HTTP/2");try{const e=new i(n);s[m]=e.href}catch(e){throw new c("Invalid absolute URL",{cause:e})}return s}const o=(e instanceof r.Http2ServerRequest?e.authority:e.headers.host)||t;if(!o)throw new c("Missing host header");let a;if(e instanceof r.Http2ServerRequest){if(a=e.scheme,"http"!==a&&"https"!==a)throw new c("Unsupported scheme")}else a=e.socket&&e.socket.encrypted?"https":"http";const d=new i(`${a}://${o}${n}`);if(d.hostname.length!==o.length&&d.hostname!==o.replace(/:\d+$/,""))throw new c("Invalid host header");return s[m]=d.href,s})(n,t.hostname);let l=!s||"GET"===n.method||"HEAD"===n.method;if(l||(n[h]=!0,n.on("end",(()=>{l=!0})),n instanceof r.Http2ServerRequest&&(o[M]=()=>{l||setTimeout((()=>{l||setTimeout((()=>{n.destroy(),o.destroy()}))}))})),o.on("close",(()=>{d[S]&&(n.errored?d[S].abort(n.errored.toString()):o.writableFinished||d[S].abort("Client connection prematurely closed.")),l||setTimeout((()=>{l||setTimeout((()=>{n.destroy()}))}))})),a=e(d,{incoming:n,outgoing:o}),b in a)return H(a,o)}catch(e){if(a)return J(e,o);if(t.errorHandler){if(a=await t.errorHandler(d?e:(e=>e instanceof c?e:new c(e.message,{cause:e}))(e)),!a)return}else a=d?P(e):new Response(null,{status:400})}try{return await(async(e,t,s={})=>{if((e=>"function"==typeof e.then)(e))if(s.errorHandler)try{e=await e}catch(t){const r=await s.errorHandler(t);if(!r)return;e=r}else e=await e.catch(P);if(b in e)return H(e,t);const r=q(e.headers);if(e.body){const s=e.body.getReader(),n=[];let o,a=!1;if("chunked"!==r["transfer-encoding"]){let e=2;for(let t=0;t<e;t++){o||=s.read();const r=await T(o).catch((e=>{console.error(e),a=!0}));if(!r){if(1===t){await new Promise((e=>setTimeout(e))),e=3;continue}break}if(o=void 0,r.value&&n.push(r.value),r.done){a=!0;break}}a&&!("content-length"in r)&&(r["content-length"]=n.reduce(((e,t)=>e+t.length),0))}t.writeHead(e.status,r),n.forEach((e=>{t.write(e)})),a?t.end():(0===n.length&&O(t),await I(s,t,o))}else r["x-hono-already-sent"]||(t.writeHead(e.status,r),t.end());t[M]?.()})(a,o,t)}catch(e){return J(e,o)}}},x=s(30160);class A{constructor(e={}){this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,t,s,r){const n={code:t,message:s};return void 0!==r?.data&&(n.data=r.data),new Response(JSON.stringify({jsonrpc:"2.0",error:n,id:null}),{status:e,headers:{"Content-Type":"application/json",...r?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){const t=e.headers.get("host");if(!t||!this._allowedHosts.includes(t)){const e=`Invalid Host header: ${t}`;return this.onerror?.(new Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){const t=e.headers.get("origin");if(t&&!this._allowedOrigins.includes(t)){const e=`Invalid Origin header: ${t}`;return this.onerror?.(new Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}}}async handleRequest(e,t){const s=this.validateRequestHeaders(e);if(s)return s;switch(e.method){case"POST":return this.handlePostRequest(e,t);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,t,s,r){if(!this._eventStore)return;if(r<"2025-11-25")return;const n=await this._eventStore.storeEvent(s,{});let o=`id: ${n}\ndata: \n\n`;void 0!==this._retryInterval&&(o=`id: ${n}\nretry: ${this._retryInterval}\ndata: \n\n`),e.enqueue(t.encode(o))}async handleGetRequest(e){const t=e.headers.get("accept");if(!t?.includes("text/event-stream"))return this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept text/event-stream");const s=this.validateSession(e);if(s)return s;const r=this.validateProtocolVersion(e);if(r)return r;if(this._eventStore){const t=e.headers.get("last-event-id");if(t)return this.replayEvents(t)}if(void 0!==this._streamMapping.get(this._standaloneSseStreamId))return this.createJsonErrorResponse(409,-32e3,"Conflict: Only one SSE stream is allowed per session");const n=new TextEncoder;let o;const a=new ReadableStream({start:e=>{o=e},cancel:()=>{this._streamMapping.delete(this._standaloneSseStreamId)}}),i={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};return void 0!==this.sessionId&&(i["mcp-session-id"]=this.sessionId),this._streamMapping.set(this._standaloneSseStreamId,{controller:o,encoder:n,cleanup:()=>{this._streamMapping.delete(this._standaloneSseStreamId);try{o.close()}catch{}}}),new Response(a,{headers:i})}async replayEvents(e){if(!this._eventStore)return this.createJsonErrorResponse(400,-32e3,"Event store not configured");try{let t;if(this._eventStore.getStreamIdForEventId){if(t=await this._eventStore.getStreamIdForEventId(e),!t)return this.createJsonErrorResponse(400,-32e3,"Invalid event ID format");if(void 0!==this._streamMapping.get(t))return this.createJsonErrorResponse(409,-32e3,"Conflict: Stream already has an active connection")}const s={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};void 0!==this.sessionId&&(s["mcp-session-id"]=this.sessionId);const r=new TextEncoder;let n;const o=new ReadableStream({start:e=>{n=e},cancel:()=>{}}),a=await this._eventStore.replayEventsAfter(e,{send:async(e,t)=>{if(!this.writeSSEEvent(n,r,t,e)){this.onerror?.(new Error("Failed replay events"));try{n.close()}catch{}}}});return this._streamMapping.set(a,{controller:n,encoder:r,cleanup:()=>{this._streamMapping.delete(a);try{n.close()}catch{}}}),new Response(o,{headers:s})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(500,-32e3,"Error replaying events")}}writeSSEEvent(e,t,s,r){try{let n="event: message\n";return r&&(n+=`id: ${r}\n`),n+=`data: ${JSON.stringify(s)}\n\n`,e.enqueue(t.encode(n)),!0}catch{return!1}}handleUnsupportedRequest(){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,t){try{const s=e.headers.get("accept");if(!s?.includes("application/json")||!s.includes("text/event-stream"))return this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");const r=e.headers.get("content-type");if(!r||!r.includes("application/json"))return this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");const n={headers:Object.fromEntries(e.headers.entries())};let o,a;if(void 0!==t?.parsedBody)o=t.parsedBody;else try{o=await e.json()}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}try{a=Array.isArray(o)?o.map((e=>x.OR.parse(e))):[x.OR.parse(o)]}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}const i=a.some(x.eK);if(i){if(this._initialized&&void 0!==this.sessionId)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!i){const t=this.validateSession(e);if(t)return t;const s=this.validateProtocolVersion(e);if(s)return s}if(!a.some(x.vo)){for(const e of a)this.onmessage?.(e,{authInfo:t?.authInfo,requestInfo:n});return new Response(null,{status:202})}const c=crypto.randomUUID(),d=a.find((e=>(0,x.eK)(e))),l=d?d.params.protocolVersion:e.headers.get("mcp-protocol-version")??x.PC;if(this._enableJsonResponse)return new Promise((e=>{this._streamMapping.set(c,{resolveJson:e,cleanup:()=>{this._streamMapping.delete(c)}});for(const e of a)(0,x.vo)(e)&&this._requestToStreamMapping.set(e.id,c);for(const e of a)this.onmessage?.(e,{authInfo:t?.authInfo,requestInfo:n})}));const h=new TextEncoder;let p;const u=new ReadableStream({start:e=>{p=e},cancel:()=>{this._streamMapping.delete(c)}}),f={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};void 0!==this.sessionId&&(f["mcp-session-id"]=this.sessionId);for(const e of a)(0,x.vo)(e)&&(this._streamMapping.set(c,{controller:p,encoder:h,cleanup:()=>{this._streamMapping.delete(c);try{p.close()}catch{}}}),this._requestToStreamMapping.set(e.id,c));await this.writePrimingEvent(p,h,c,l);for(const e of a){let s,r;(0,x.vo)(e)&&this._eventStore&&l>="2025-11-25"&&(s=()=>{this.closeSSEStream(e.id)},r=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(e,{authInfo:t?.authInfo,requestInfo:n,closeSSEStream:s,closeStandaloneSSEStream:r})}return new Response(u,{status:200,headers:f})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(e)})}}async handleDeleteRequest(e){const t=this.validateSession(e);if(t)return t;return this.validateProtocolVersion(e)||(await Promise.resolve(this._onsessionclosed?.(this.sessionId)),await this.close(),new Response(null,{status:200}))}validateSession(e){if(void 0===this.sessionIdGenerator)return;if(!this._initialized)return this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");const t=e.headers.get("mcp-session-id");return t?t!==this.sessionId?this.createJsonErrorResponse(404,-32001,"Session not found"):void 0:this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required")}validateProtocolVersion(e){const t=e.headers.get("mcp-protocol-version");if(null!==t&&!x.Iu.includes(t))return this.createJsonErrorResponse(400,-32e3,`Bad Request: Unsupported protocol version: ${t} (supported versions: ${x.Iu.join(", ")})`)}async close(){this._streamMapping.forEach((({cleanup:e})=>{e()})),this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}closeSSEStream(e){const t=this._requestToStreamMapping.get(e);if(!t)return;const s=this._streamMapping.get(t);s&&s.cleanup()}closeStandaloneSSEStream(){const e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let s=t?.relatedRequestId;if(((0,x.ig)(e)||(0,x.LW)(e))&&(s=e.id),void 0===s){if((0,x.ig)(e)||(0,x.LW)(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let t;this._eventStore&&(t=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));const s=this._streamMapping.get(this._standaloneSseStreamId);if(void 0===s)return;return void(s.controller&&s.encoder&&this.writeSSEEvent(s.controller,s.encoder,e,t))}const r=this._requestToStreamMapping.get(s);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);const n=this._streamMapping.get(r);if(!this._enableJsonResponse&&n?.controller&&n?.encoder){let t;this._eventStore&&(t=await this._eventStore.storeEvent(r,e)),this.writeSSEEvent(n.controller,n.encoder,e,t)}if((0,x.ig)(e)||(0,x.LW)(e)){this._requestResponseMap.set(s,e);const t=Array.from(this._requestToStreamMapping.entries()).filter((([e,t])=>t===r)).map((([e])=>e));if(t.every((e=>this._requestResponseMap.has(e)))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse&&n.resolveJson){const e={"Content-Type":"application/json"};void 0!==this.sessionId&&(e["mcp-session-id"]=this.sessionId);const s=t.map((e=>this._requestResponseMap.get(e)));1===s.length?n.resolveJson(new Response(JSON.stringify(s[0]),{status:200,headers:e})):n.resolveJson(new Response(JSON.stringify(s),{status:200,headers:e}))}else n.cleanup();for(const e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e)}}}}class k{constructor(e={}){this._requestContext=new WeakMap,this._webStandardTransport=new A(e),this._requestListener=j((async e=>{const t=this._requestContext.get(e);return this._webStandardTransport.handleRequest(e,{authInfo:t?.authInfo,parsedBody:t?.parsedBody})}))}get sessionId(){return this._webStandardTransport.sessionId}set onclose(e){this._webStandardTransport.onclose=e}get onclose(){return this._webStandardTransport.onclose}set onerror(e){this._webStandardTransport.onerror=e}get onerror(){return this._webStandardTransport.onerror}set onmessage(e){this._webStandardTransport.onmessage=e}get onmessage(){return this._webStandardTransport.onmessage}async start(){return this._webStandardTransport.start()}async close(){return this._webStandardTransport.close()}async send(e,t){return this._webStandardTransport.send(e,t)}async handleRequest(e,t,s){const r=e.auth,n=j((async e=>this._webStandardTransport.handleRequest(e,{authInfo:r,parsedBody:s})));await n(e,t)}closeSSEStream(e){this._webStandardTransport.closeSSEStream(e)}closeStandaloneSSEStream(){this._webStandardTransport.closeStandaloneSSEStream()}}},72176:()=>{}};