graphql-sse
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -160,3 +160,3 @@ "use strict"; | ||
const token = await res.text(); | ||
headers['x-graphql-stream-token'] = token; | ||
headers['x-graphql-event-stream-token'] = token; | ||
const connected = await connect({ | ||
@@ -163,0 +163,0 @@ signal: connCtrl.signal, |
@@ -77,3 +77,3 @@ /** | ||
* | ||
* @default 'req.headers["x-graphql-stream-token"] || req.url.searchParams["token"] || generateRandomUUID()' // https://gist.github.com/jed/982883 | ||
* @default 'req.headers["x-graphql-event-stream-token"] || req.url.searchParams["token"] || generateRandomUUID()' // https://gist.github.com/jed/982883 | ||
*/ | ||
@@ -80,0 +80,0 @@ authenticate?: (req: IncomingMessage, res: ServerResponse) => Promise<string | undefined | void> | string | undefined | void; |
@@ -29,3 +29,4 @@ "use strict"; | ||
var _a; | ||
const headerToken = req.headers['x-graphql-stream-token']; | ||
const headerToken = req.headers['x-graphql-event-stream-token'] || | ||
req.headers['x-graphql-stream-token']; // @deprecated >v1.0.0 | ||
if (headerToken) | ||
@@ -32,0 +33,0 @@ return Array.isArray(headerToken) ? headerToken.join('') : headerToken; |
{ | ||
"name": "graphql-sse", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,3 +5,3 @@ # GraphQL over Server-Sent Events Protocol | ||
Living in a connected world, real-time needs are great. Especially in the world's most connected "world", the internet. When talking about real-time, there are two main players in the game: [WebSockets](https://datatracker.ietf.org/doc/html/rfc6455) and [Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html). | ||
We live in a connected world where real-time needs are ever-growing. Especially in the world's most connected "world", the internet. When talking about real-time, there are two main players in the game: [WebSockets](https://datatracker.ietf.org/doc/html/rfc6455) and [Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html). | ||
@@ -70,3 +70,3 @@ Using Server-Sent Events (abbr. SSE) for your next real-time driven endeavour sounds appealing because of many reasons spanning from simplicity to acceptance. However, you're soon to find out that SSE suffers from a limitation to the maximum number of open connections when dealing with HTTP/1 powered servers (more details below). | ||
- A header value `X-GraphQL-Stream-Token` | ||
- A header value `X-GraphQL-Event-Stream-Token` | ||
- A search parameter `token` | ||
@@ -73,0 +73,0 @@ |
@@ -576,7 +576,7 @@ <div align="center"> | ||
authenticate: async (req, res) => { | ||
let token = req.headers['x-graphql-stream-token']; | ||
let token = req.headers['x-graphql-event-stream-token']; | ||
if (token) { | ||
// When the client is working in a "single connection mode" | ||
// all subsequent requests for operations will have the | ||
// stream token set in the `X-GraphQL-Stream-Token` header. | ||
// stream token set in the `X-GraphQL-Event-Stream-Token` header. | ||
// | ||
@@ -611,3 +611,3 @@ // It is considered safe to accept the header token always | ||
// "distinct connections mode" requests an event-stream with a POST | ||
// method. These two checks, together with the lack of `X-GraphQL-Stream-Token` | ||
// method. These two checks, together with the lack of `X-GraphQL-Event-Stream-Token` | ||
// header, are sufficient for accurate detection. | ||
@@ -619,3 +619,3 @@ return ''; // return token; is OK too | ||
// need a unique stream token which will be provided alongside the | ||
// incoming event stream request inside the `X-GraphQL-Stream-Token` header. | ||
// incoming event stream request inside the `X-GraphQL-Event-Stream-Token` header. | ||
// | ||
@@ -622,0 +622,0 @@ // Read more: https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md#single-connection-mode |
@@ -343,3 +343,3 @@ (function (global, factory) { | ||
const token = await res.text(); | ||
headers['x-graphql-stream-token'] = token; | ||
headers['x-graphql-event-stream-token'] = token; | ||
const connected = await connect({ | ||
@@ -346,0 +346,0 @@ signal: connCtrl.signal, |
@@ -15,2 +15,2 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).graphqlSse={})}(this,(function(t){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(t){return this instanceof n?(this.v=t,this):new n(t)}function r(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,a=r.apply(t,e||[]),i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(t){a[t]&&(o[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(r=a[t](e)).value instanceof n?Promise.resolve(r.value.v).then(l,u):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function l(t){c("next",t)}function u(t){c("throw",t)}function f(t,e){t(e),i.shift(),i.length&&c(i[0][0],i[0][1])}}function o(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=e(t),n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n);function o(e){n[e]=t[e]&&function(n){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(n=t[e](n)).done,n.value)}))}}}function a(t){if("next"!==(t=t)&&"complete"!==t)throw new Error(`Invalid stream event "${t}"`);return t}function i(t,e){if(e)try{e=JSON.parse(e)}catch(t){throw new Error("Invalid stream data")}if("next"===t&&!e)throw new Error('Stream data must be an object for "next" events');return e||null}var s;!function(t){t[t.NewLine=10]="NewLine",t[t.CchunkiageReturn=13]="CchunkiageReturn",t[t.Space=32]="Space",t[t.Colon=58]="Colon"}(s||(s={}));class c extends Error{constructor(t){let e,n;c.isResponse(t)?(n=t,e="Server responded with "+t.status+": "+t.statusText):e=t instanceof Error?t.message:String(t),super(e),this.name=this.constructor.name,this.response=n}static isResponse(t){return"object"==typeof(e=t)&&null!==e&&"status"in t&&"statusText"in t;var e}}async function l(t){const{signal:e,url:l,headers:u,body:f,fetchFn:d}=t,h={},w={};let y;try{y=await d(l,{signal:e,method:f?"POST":"GET",headers:Object.assign(Object.assign({},u),{accept:"text/event-stream"}),body:f})}catch(t){throw new c(t)}if(!y.ok)throw new c(y);if(!y.body)throw new Error("Missing response body");let b=null,p=null;return(async()=>{var t,e,c;try{const f=function(){let t,e,n,r=!1,o={event:"",data:""},c=[];const l=new TextDecoder;return function(u){if(void 0===t)t=u,e=0,n=-1;else{const e=new Uint8Array(t.length+u.length);e.set(t),e.set(u,t.length),t=e}const f=t.length;let d=0;for(;e<f;){r&&(t[e]===s.NewLine&&(d=++e),r=!1);let u=-1;for(;e<f&&-1===u;++e)switch(t[e]){case s.Colon:-1===n&&(n=e-d);break;case s.CchunkiageReturn:r=!0;case s.NewLine:u=e}if(-1===u)break;if(d===u){if(o.event||o.data){if(!o.event)throw new Error("Missing message event");const t=a(o.event),e=i(t,o.data);c.push({event:t,data:e}),o={event:"",data:""}}}else if(n>0){const e=t.subarray(d,u),r=l.decode(e.subarray(0,n)),a=n+(e[n+1]===s.Space?2:1),i=l.decode(e.subarray(a));switch(r){case"event":o.event=i;break;case"data":o.data=o.data?o.data+"\n"+i:i}}d=e,n=-1}if(d===f){t=void 0;const e=[...c];return c=[],e}0!==d&&(t=t.subarray(d),e-=d)}}();try{for(var l,u=o(function(t){if("function"==typeof Object(t)[Symbol.asyncIterator])return(t=t)[Symbol.asyncIterator]();return function(){return r(this,arguments,(function*(){const e=(t=t).getReader();for(;;){const{value:t,done:r}=yield n(e.read());if(r)return yield n(t);yield yield n(t)}}))}()}(y.body));!(l=await u.next()).done;){const t=l.value;if("string"==typeof t)throw new Error(`Unexpected string chunk "${t}"`);const e=f(t);if(e)for(const t of e){const e=t.data&&"id"in t.data?t.data.id:"";switch(e in w||(w[e]=[]),t.event){case"next":e?w[e].push(t.data.payload):w[e].push(t.data);break;case"complete":w[e].push("complete");break;default:throw new Error(`Unexpected message event "${t.event}"`)}null===(c=h[e])||void 0===c||c.proceed()}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=u.return)&&await e.call(u)}finally{if(t)throw t.error}}}catch(t){b=t,p&&p(t)}finally{Object.values(h).forEach((({proceed:t})=>t()))}})(),{url:l,headers:u,waitForThrow:()=>new Promise(((t,e)=>{if(b)return e(b);p=e})),getResults(t){var e;return r(this,arguments,(function*(){const{signal:r,operationId:o=""}=null!=t?t:{};try{for(;;){for(;null===(e=w[o])||void 0===e?void 0:e.length;){const t=w[o].shift();if("complete"===t)return yield n(void 0);yield yield n(t)}if(b)throw b;if(null==r?void 0:r.aborted)throw new Error("Getting results aborted by the client");yield n(new Promise((t=>{const e=()=>{null==r||r.removeEventListener("abort",e),delete h[o],t()};null==r||r.addEventListener("abort",e),h[o]={proceed:e}})))}}finally{delete w[o]}}))}}}t.NetworkError=c,t.createClient=function(t){const{singleConnection:e=!1,lazy:n=!0,onNonLazyError:r=console.error,generateID:a=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},retryAttempts:i=5,retry:s=async function(t){let e=1e3;for(let n=0;n<t;n++)e*=2;await new Promise((t=>setTimeout(t,e+Math.floor(2700*Math.random()+300))))}}=t,u=t.fetchFn||fetch,f=t.abortControllerImpl||AbortController,d=(()=>{let t=!1;const e=[];return{get disposed(){return t},onDispose:n=>t?(setTimeout((()=>n()),0),()=>{}):(e.push(n),()=>{e.splice(e.indexOf(n),1)}),dispose(){if(!t){t=!0;for(const t of[...e])t()}}}})();let h,w,y=0,b=null,p=0;async function v(){try{if(d.disposed)throw new Error("Client has been disposed");return await(null!=w?w:w=(async()=>{var e;if(b){if(await s(p),h.signal.aborted)throw new Error("Connection aborted by the client");p++}h=new f;const n=d.onDispose((()=>h.abort()));h.signal.addEventListener("abort",(()=>{n(),w=void 0}));const r="function"==typeof t.url?await t.url():t.url;if(h.signal.aborted)throw new Error("Connection aborted by the client");const o="function"==typeof t.headers?await t.headers():null!==(e=t.headers)&&void 0!==e?e:{};if(h.signal.aborted)throw new Error("Connection aborted by the client");let a;try{a=await u(r,{signal:h.signal,method:"PUT",headers:o})}catch(t){throw new c(t)}if(201!==a.status)throw new c(a);const i=await a.text();o["x-graphql-stream-token"]=i;const y=await l({signal:h.signal,headers:o,url:r,fetchFn:u});return b=null,p=0,y.waitForThrow().catch((()=>w=void 0)),y})())}catch(t){throw w=void 0,t}}return e&&!n&&(async()=>{for(y++;;)try{const{waitForThrow:t}=await v();await t()}catch(t){if(d.disposed)return;if(!(t instanceof c))return null==r?void 0:r(t);if(!i||p>=i)return null==r?void 0:r(t);b=t}})(),{subscribe(n,r){if(!e){const e=new f,a=d.onDispose((()=>{a(),e.abort()}));return(async()=>{var a,f,d;let h=null,w=0;for(;;)try{if(h){if(await s(w),e.signal.aborted)throw new Error("Connection aborted by the client");w++}const i="function"==typeof t.url?await t.url():t.url;if(e.signal.aborted)throw new Error("Connection aborted by the client");const c="function"==typeof t.headers?await t.headers():null!==(d=t.headers)&&void 0!==d?d:{};if(e.signal.aborted)throw new Error("Connection aborted by the client");const{getResults:p}=await l({signal:e.signal,headers:c,url:i,body:JSON.stringify(n),fetchFn:u});h=null,w=0;try{for(var y,b=(a=void 0,o(p()));!(y=await b.next()).done;){const t=y.value;r.next(t)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(f=b.return)&&await f.call(b)}finally{if(a)throw a.error}}return e.abort()}catch(t){if(e.signal.aborted)return;if(!(t instanceof c))throw t;if(!i||w>=i)throw t;h=t}})().catch((t=>r.error(t))).then((()=>r.complete())),()=>e.abort()}y++;const w=new f,g=d.onDispose((()=>{g(),w.abort()}));return(async()=>{var t,e;const s=a();n=Object.assign(Object.assign({},n),{extensions:Object.assign(Object.assign({},n.extensions),{operationId:s})});let l=null;for(;;){l=null;try{const{url:a,headers:i,getResults:b}=await v();let p;try{p=await u(a,{signal:w.signal,method:"POST",headers:i,body:JSON.stringify(n)})}catch(t){throw new c(t)}if(202!==p.status)throw new c(p);l=async()=>{let t;try{const e=new f,n=d.onDispose((()=>{n(),e.abort()}));t=await u(a+"?operationId="+s,{signal:e.signal,method:"DELETE",headers:i})}catch(t){throw new c(t)}if(200!==t.status)throw new c(t)};try{for(var g,x=(t=void 0,o(b({signal:w.signal,operationId:s})));!(g=await x.next()).done;){const t=g.value;r.next(t)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(e=x.return)&&await e.call(x)}finally{if(t)throw t.error}}return l=null,w.abort()}catch(t){if(w.signal.aborted)return await(null==l?void 0:l());if(!(t instanceof c))throw t;if(!i||p>=i)throw t;b=t}finally{w.signal.aborted&&0==--y&&h.abort()}}})().catch((t=>r.error(t))).then((()=>r.complete())),()=>w.abort()},dispose(){d.dispose()}}},t.parseStreamData=i,t.validateStreamEvent=a,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */function e(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(t){return this instanceof n?(this.v=t,this):new n(t)}function r(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,a=r.apply(t,e||[]),i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(t){a[t]&&(o[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(r=a[t](e)).value instanceof n?Promise.resolve(r.value.v).then(l,u):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function l(t){c("next",t)}function u(t){c("throw",t)}function f(t,e){t(e),i.shift(),i.length&&c(i[0][0],i[0][1])}}function o(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=e(t),n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n);function o(e){n[e]=t[e]&&function(n){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(n=t[e](n)).done,n.value)}))}}}function a(t){if("next"!==(t=t)&&"complete"!==t)throw new Error(`Invalid stream event "${t}"`);return t}function i(t,e){if(e)try{e=JSON.parse(e)}catch(t){throw new Error("Invalid stream data")}if("next"===t&&!e)throw new Error('Stream data must be an object for "next" events');return e||null}var s;!function(t){t[t.NewLine=10]="NewLine",t[t.CchunkiageReturn=13]="CchunkiageReturn",t[t.Space=32]="Space",t[t.Colon=58]="Colon"}(s||(s={}));class c extends Error{constructor(t){let e,n;c.isResponse(t)?(n=t,e="Server responded with "+t.status+": "+t.statusText):e=t instanceof Error?t.message:String(t),super(e),this.name=this.constructor.name,this.response=n}static isResponse(t){return"object"==typeof(e=t)&&null!==e&&"status"in t&&"statusText"in t;var e}}async function l(t){const{signal:e,url:l,headers:u,body:f,fetchFn:d}=t,h={},w={};let y;try{y=await d(l,{signal:e,method:f?"POST":"GET",headers:Object.assign(Object.assign({},u),{accept:"text/event-stream"}),body:f})}catch(t){throw new c(t)}if(!y.ok)throw new c(y);if(!y.body)throw new Error("Missing response body");let b=null,p=null;return(async()=>{var t,e,c;try{const f=function(){let t,e,n,r=!1,o={event:"",data:""},c=[];const l=new TextDecoder;return function(u){if(void 0===t)t=u,e=0,n=-1;else{const e=new Uint8Array(t.length+u.length);e.set(t),e.set(u,t.length),t=e}const f=t.length;let d=0;for(;e<f;){r&&(t[e]===s.NewLine&&(d=++e),r=!1);let u=-1;for(;e<f&&-1===u;++e)switch(t[e]){case s.Colon:-1===n&&(n=e-d);break;case s.CchunkiageReturn:r=!0;case s.NewLine:u=e}if(-1===u)break;if(d===u){if(o.event||o.data){if(!o.event)throw new Error("Missing message event");const t=a(o.event),e=i(t,o.data);c.push({event:t,data:e}),o={event:"",data:""}}}else if(n>0){const e=t.subarray(d,u),r=l.decode(e.subarray(0,n)),a=n+(e[n+1]===s.Space?2:1),i=l.decode(e.subarray(a));switch(r){case"event":o.event=i;break;case"data":o.data=o.data?o.data+"\n"+i:i}}d=e,n=-1}if(d===f){t=void 0;const e=[...c];return c=[],e}0!==d&&(t=t.subarray(d),e-=d)}}();try{for(var l,u=o(function(t){if("function"==typeof Object(t)[Symbol.asyncIterator])return(t=t)[Symbol.asyncIterator]();return function(){return r(this,arguments,(function*(){const e=(t=t).getReader();for(;;){const{value:t,done:r}=yield n(e.read());if(r)return yield n(t);yield yield n(t)}}))}()}(y.body));!(l=await u.next()).done;){const t=l.value;if("string"==typeof t)throw new Error(`Unexpected string chunk "${t}"`);const e=f(t);if(e)for(const t of e){const e=t.data&&"id"in t.data?t.data.id:"";switch(e in w||(w[e]=[]),t.event){case"next":e?w[e].push(t.data.payload):w[e].push(t.data);break;case"complete":w[e].push("complete");break;default:throw new Error(`Unexpected message event "${t.event}"`)}null===(c=h[e])||void 0===c||c.proceed()}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=u.return)&&await e.call(u)}finally{if(t)throw t.error}}}catch(t){b=t,p&&p(t)}finally{Object.values(h).forEach((({proceed:t})=>t()))}})(),{url:l,headers:u,waitForThrow:()=>new Promise(((t,e)=>{if(b)return e(b);p=e})),getResults(t){var e;return r(this,arguments,(function*(){const{signal:r,operationId:o=""}=null!=t?t:{};try{for(;;){for(;null===(e=w[o])||void 0===e?void 0:e.length;){const t=w[o].shift();if("complete"===t)return yield n(void 0);yield yield n(t)}if(b)throw b;if(null==r?void 0:r.aborted)throw new Error("Getting results aborted by the client");yield n(new Promise((t=>{const e=()=>{null==r||r.removeEventListener("abort",e),delete h[o],t()};null==r||r.addEventListener("abort",e),h[o]={proceed:e}})))}}finally{delete w[o]}}))}}}t.NetworkError=c,t.createClient=function(t){const{singleConnection:e=!1,lazy:n=!0,onNonLazyError:r=console.error,generateID:a=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},retryAttempts:i=5,retry:s=async function(t){let e=1e3;for(let n=0;n<t;n++)e*=2;await new Promise((t=>setTimeout(t,e+Math.floor(2700*Math.random()+300))))}}=t,u=t.fetchFn||fetch,f=t.abortControllerImpl||AbortController,d=(()=>{let t=!1;const e=[];return{get disposed(){return t},onDispose:n=>t?(setTimeout((()=>n()),0),()=>{}):(e.push(n),()=>{e.splice(e.indexOf(n),1)}),dispose(){if(!t){t=!0;for(const t of[...e])t()}}}})();let h,w,y=0,b=null,p=0;async function v(){try{if(d.disposed)throw new Error("Client has been disposed");return await(null!=w?w:w=(async()=>{var e;if(b){if(await s(p),h.signal.aborted)throw new Error("Connection aborted by the client");p++}h=new f;const n=d.onDispose((()=>h.abort()));h.signal.addEventListener("abort",(()=>{n(),w=void 0}));const r="function"==typeof t.url?await t.url():t.url;if(h.signal.aborted)throw new Error("Connection aborted by the client");const o="function"==typeof t.headers?await t.headers():null!==(e=t.headers)&&void 0!==e?e:{};if(h.signal.aborted)throw new Error("Connection aborted by the client");let a;try{a=await u(r,{signal:h.signal,method:"PUT",headers:o})}catch(t){throw new c(t)}if(201!==a.status)throw new c(a);const i=await a.text();o["x-graphql-event-stream-token"]=i;const y=await l({signal:h.signal,headers:o,url:r,fetchFn:u});return b=null,p=0,y.waitForThrow().catch((()=>w=void 0)),y})())}catch(t){throw w=void 0,t}}return e&&!n&&(async()=>{for(y++;;)try{const{waitForThrow:t}=await v();await t()}catch(t){if(d.disposed)return;if(!(t instanceof c))return null==r?void 0:r(t);if(!i||p>=i)return null==r?void 0:r(t);b=t}})(),{subscribe(n,r){if(!e){const e=new f,a=d.onDispose((()=>{a(),e.abort()}));return(async()=>{var a,f,d;let h=null,w=0;for(;;)try{if(h){if(await s(w),e.signal.aborted)throw new Error("Connection aborted by the client");w++}const i="function"==typeof t.url?await t.url():t.url;if(e.signal.aborted)throw new Error("Connection aborted by the client");const c="function"==typeof t.headers?await t.headers():null!==(d=t.headers)&&void 0!==d?d:{};if(e.signal.aborted)throw new Error("Connection aborted by the client");const{getResults:p}=await l({signal:e.signal,headers:c,url:i,body:JSON.stringify(n),fetchFn:u});h=null,w=0;try{for(var y,b=(a=void 0,o(p()));!(y=await b.next()).done;){const t=y.value;r.next(t)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(f=b.return)&&await f.call(b)}finally{if(a)throw a.error}}return e.abort()}catch(t){if(e.signal.aborted)return;if(!(t instanceof c))throw t;if(!i||w>=i)throw t;h=t}})().catch((t=>r.error(t))).then((()=>r.complete())),()=>e.abort()}y++;const w=new f,g=d.onDispose((()=>{g(),w.abort()}));return(async()=>{var t,e;const s=a();n=Object.assign(Object.assign({},n),{extensions:Object.assign(Object.assign({},n.extensions),{operationId:s})});let l=null;for(;;){l=null;try{const{url:a,headers:i,getResults:b}=await v();let p;try{p=await u(a,{signal:w.signal,method:"POST",headers:i,body:JSON.stringify(n)})}catch(t){throw new c(t)}if(202!==p.status)throw new c(p);l=async()=>{let t;try{const e=new f,n=d.onDispose((()=>{n(),e.abort()}));t=await u(a+"?operationId="+s,{signal:e.signal,method:"DELETE",headers:i})}catch(t){throw new c(t)}if(200!==t.status)throw new c(t)};try{for(var g,x=(t=void 0,o(b({signal:w.signal,operationId:s})));!(g=await x.next()).done;){const t=g.value;r.next(t)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(e=x.return)&&await e.call(x)}finally{if(t)throw t.error}}return l=null,w.abort()}catch(t){if(w.signal.aborted)return await(null==l?void 0:l());if(!(t instanceof c))throw t;if(!i||p>=i)throw t;b=t}finally{w.signal.aborted&&0==--y&&h.abort()}}})().catch((t=>r.error(t))).then((()=>r.complete())),()=>w.abort()},dispose(){d.dispose()}}},t.parseStreamData=i,t.validateStreamEvent=a,Object.defineProperty(t,"__esModule",{value:!0})})); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
203173
3589
5