Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-sse

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-sse - npm Package Compare versions

Comparing version 2.1.4 to 2.2.0

5

lib/client.d.ts

@@ -181,2 +181,7 @@ /**

/**
* Subscribes and iterates over emitted results from an SSE connection
* through the returned async iterator.
*/
iterate<Data = Record<string, unknown>, Extensions = unknown>(request: RequestParams): AsyncIterableIterator<ExecutionResult<Data, Extensions>>;
/**
* Dispose of the client, destroy connections and clean up resources.

@@ -183,0 +188,0 @@ */

@@ -395,2 +395,61 @@ "use strict";

},
iterate(request) {
const pending = [];
const deferred = {
done: false,
error: null,
resolve: () => {
// noop
},
};
const dispose = this.subscribe(request, {
next(val) {
pending.push(val);
deferred.resolve();
},
error(err) {
deferred.done = true;
deferred.error = err;
deferred.resolve();
},
complete() {
deferred.done = true;
deferred.resolve();
},
});
const iterator = (async function* iterator() {
for (;;) {
if (!pending.length) {
// only wait if there are no pending messages available
await new Promise((resolve) => (deferred.resolve = resolve));
}
// first flush
while (pending.length) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
yield pending.shift();
}
// then error
if (deferred.error) {
throw deferred.error;
}
// or complete
if (deferred.done) {
return;
}
}
})();
iterator.throw = async (err) => {
if (!deferred.done) {
deferred.done = true;
deferred.error = err;
deferred.resolve();
}
return { done: true, value: undefined };
};
iterator.return = async () => {
dispose();
return { done: true, value: undefined };
};
return iterator;
},
dispose() {

@@ -397,0 +456,0 @@ client.dispose();

12

package.json
{
"name": "graphql-sse",
"version": "2.1.4",
"version": "2.2.0",
"description": "Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client",

@@ -113,3 +113,3 @@ "keywords": [

"@semantic-release/git": "^10.0.1",
"@types/eslint": "^8.40.1",
"@types/eslint": "^8.40.2",
"@types/eventsource": "^1.1.11",

@@ -119,6 +119,6 @@ "@types/express": "^4.17.17",

"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"babel-jest": "^29.5.0",
"eslint": "^8.42.0",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",

@@ -128,3 +128,3 @@ "express": "^4.18.2",

"glob": "^10.2.7",
"graphql": "^16.6.0",
"graphql": "^16.7.0",
"jest": "^29.5.0",

@@ -131,0 +131,0 @@ "prettier": "^2.8.8",

@@ -587,2 +587,61 @@ (function (global, factory) {

},
iterate(request) {
const pending = [];
const deferred = {
done: false,
error: null,
resolve: () => {
// noop
},
};
const dispose = this.subscribe(request, {
next(val) {
pending.push(val);
deferred.resolve();
},
error(err) {
deferred.done = true;
deferred.error = err;
deferred.resolve();
},
complete() {
deferred.done = true;
deferred.resolve();
},
});
const iterator = (async function* iterator() {
for (;;) {
if (!pending.length) {
// only wait if there are no pending messages available
await new Promise((resolve) => (deferred.resolve = resolve));
}
// first flush
while (pending.length) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
yield pending.shift();
}
// then error
if (deferred.error) {
throw deferred.error;
}
// or complete
if (deferred.done) {
return;
}
}
})();
iterator.throw = async (err) => {
if (!deferred.done) {
deferred.done = true;
deferred.error = err;
deferred.resolve();
}
return { done: true, value: undefined };
};
iterator.return = async () => {
dispose();
return { done: true, value: undefined };
};
return iterator;
},
dispose() {

@@ -589,0 +648,0 @@ client.dispose();

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).graphqlSse={})}(this,(function(e){"use strict";function t(e){return"object"==typeof e&&null!==e}const r="x-graphql-event-stream-token";function n(e){if("next"!==e&&"complete"!==e)throw new Error(`Invalid stream event "${e}"`);return e}function o(e,t){if(t)try{t=JSON.parse(t)}catch{throw new Error("Invalid stream data")}if("next"===e&&!t)throw new Error('Stream data must be an object for "next" events');return t||null}var a;!function(e){e[e.NewLine=10]="NewLine",e[e.CchunkiageReturn=13]="CchunkiageReturn",e[e.Space=32]="Space",e[e.Colon=58]="Colon"}(a||(a={}));class i extends Error{constructor(e){let r,n;var o;t(o=e)&&"boolean"==typeof o.ok&&"number"==typeof o.status&&"string"==typeof o.statusText?(n=e,r="Server responded with "+e.status+": "+e.statusText):r=e instanceof Error?e.message:String(e),super(r),this.name=this.constructor.name,this.response=n}}async function s(e){const{signal:t,url:r,credentials:s,headers:c,body:l,referrer:f,referrerPolicy:d,fetchFn:u,onMessage:h}=e,w={},y={};let b;try{b=await u(r,{signal:t,method:l?"POST":"GET",credentials:s,referrer:f,referrerPolicy:d,headers:{...c,accept:"text/event-stream"},body:l})}catch(e){throw new i(e)}if(!b.ok)throw new i(b);if(!b.body)throw new Error("Missing response body");let p,g=null;return(async()=>{var e;try{const t=function(){let e,t,r,i=!1,s={event:"",data:""},c=[];const l=new TextDecoder;return function(f){if(void 0===e)e=f,t=0,r=-1;else{const t=new Uint8Array(e.length+f.length);t.set(e),t.set(f,e.length),e=t}const d=e.length;let u=0;for(;t<d;){i&&(e[t]===a.NewLine&&(u=++t),i=!1);let f=-1;for(;t<d&&-1===f;++t)switch(e[t]){case a.Colon:-1===r&&(r=t-u);break;case a.CchunkiageReturn:i=!0;case a.NewLine:f=t}if(-1===f)break;if(u===f){if(s.event||s.data){if(!s.event)throw new Error("Missing message event");const e=n(s.event),t=o(e,s.data);c.push({event:e,data:t}),s={event:"",data:""}}}else if(r>0){const t=e.subarray(u,f),n=l.decode(t.subarray(0,r)),o=r+(t[r+1]===a.Space?2:1),i=l.decode(t.subarray(o));switch(n){case"event":s.event=i;break;case"data":s.data=s.data?s.data+"\n"+i:i}}u=t,r=-1}if(u===d){e=void 0;const t=[...c];return c=[],t}0!==u&&(e=e.subarray(u),t-=u)}}();for await(const r of function(e){if("function"==typeof Object(e)[Symbol.asyncIterator])return e[Symbol.asyncIterator]();return async function*(){const t=e.getReader();let r;do{r=await t.read(),void 0!==r.value&&(yield r.value)}while(!r.done)}()}(b.body)){if("string"==typeof r)throw g=new Error(`Unexpected string chunk "${r}"`);let n;try{n=t(r)}catch(e){throw g=e}if(n)for(const t of n){try{null==h||h(t)}catch(e){throw g=e}const r=t.data&&"id"in t.data?t.data.id:"";switch(r in y||(y[r]=[]),t.event){case"next":r?y[r].push(t.data.payload):y[r].push(t.data);break;case"complete":y[r].push("complete");break;default:throw g=new Error(`Unexpected message event "${t.event}"`)}null===(e=w[r])||void 0===e||e.proceed()}}if(Object.keys(w).length)throw new Error("Connection closed while having active streams")}catch(e){g=!g&&Object.keys(w).length?new i(e):e,null==p||p(g)}finally{Object.values(w).forEach((({proceed:e})=>e()))}})(),{url:r,headers:c,waitForThrow:()=>new Promise(((e,t)=>{if(g)return t(g);p=t})),async*getResults(e){var t;const{signal:r,operationId:n=""}=null!=e?e:{};try{for(;;){for(;null===(t=y[n])||void 0===t?void 0:t.length;){const e=y[n].shift();if("complete"===e)return;yield e}if(g)throw g;if(null==r?void 0:r.aborted)throw new Error("Getting results aborted by the client");await new Promise((e=>{const t=()=>{null==r||r.removeEventListener("abort",t),delete w[n],e()};null==r||r.addEventListener("abort",t),w[n]={proceed:t}}))}}finally{delete y[n]}}}}e.NetworkError=i,e.TOKEN_HEADER_KEY=r,e.TOKEN_QUERY_KEY="token",e.createClient=function(e){const{singleConnection:t=!1,lazy:n=!0,lazyCloseTimeout:o=0,onNonLazyError:a=console.error,generateID:c=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},retryAttempts:l=5,retry:f=async function(e){let t=1e3;for(let r=0;r<e;r++)t*=2;await new Promise((e=>setTimeout(e,t+Math.floor(2700*Math.random()+300))))},credentials:d="same-origin",referrer:u,referrerPolicy:h,onMessage:w}=e,y=e.fetchFn||fetch,b=e.abortControllerImpl||AbortController,p=(()=>{let e=!1;const t=[];return{get disposed(){return e},onDispose:r=>e?(setTimeout((()=>r()),0),()=>{}):(t.push(r),()=>{t.splice(t.indexOf(r),1)}),dispose(){if(!e){e=!0;for(const e of[...t])e()}}}})();let g,v,x=0,m=null,E=0;async function S(){try{if(p.disposed)throw new Error("Client has been disposed");return await(null!=v?v:v=(async()=>{var t;if(m){if(await f(E),g.signal.aborted)throw new Error("Connection aborted by the client");E++}g=new b;const n=p.onDispose((()=>g.abort()));g.signal.addEventListener("abort",(()=>{n(),v=void 0}));const o="function"==typeof e.url?await e.url():e.url;if(g.signal.aborted)throw new Error("Connection aborted by the client");const a="function"==typeof e.headers?await e.headers():null!==(t=e.headers)&&void 0!==t?t:{};if(g.signal.aborted)throw new Error("Connection aborted by the client");let c;try{c=await y(o,{signal:g.signal,method:"PUT",credentials:d,referrer:u,referrerPolicy:h,headers:a})}catch(e){throw new i(e)}if(201!==c.status)throw new i(c);const l=await c.text();a[r]=l;const x=await s({signal:g.signal,headers:a,credentials:d,referrer:u,referrerPolicy:h,url:o,fetchFn:y,onMessage:w});return x.waitForThrow().catch((()=>v=void 0)),x})())}catch(e){throw v=void 0,e}}return t&&!n&&(async()=>{for(x++;;)try{const{waitForThrow:e}=await S();await e()}catch(e){if(p.disposed)return;if(!(e instanceof i))return null==a?void 0:a(e);if(v=void 0,!l||E>=l)return null==a?void 0:a(e);m=e}})(),{subscribe(r,a){if(!t){const t=new b,n=p.onDispose((()=>{n(),t.abort()}));return(async()=>{var n;let o=null,c=0;for(;;)try{if(o){if(await f(c),t.signal.aborted)throw new Error("Connection aborted by the client");c++}const i="function"==typeof e.url?await e.url():e.url;if(t.signal.aborted)throw new Error("Connection aborted by the client");const l="function"==typeof e.headers?await e.headers():null!==(n=e.headers)&&void 0!==n?n:{};if(t.signal.aborted)throw new Error("Connection aborted by the client");const{getResults:b}=await s({signal:t.signal,headers:{...l,"content-type":"application/json; charset=utf-8"},credentials:d,referrer:u,referrerPolicy:h,url:i,body:JSON.stringify(r),fetchFn:y,onMessage:w});for await(const e of b())o=null,c=0,a.next(e);return t.abort()}catch(e){if(t.signal.aborted)return;if(!(e instanceof i))throw e;if(!l||c>=l)throw e;o=e}})().then((()=>a.complete())).catch((e=>a.error(e))),()=>t.abort()}x++;const C=new b,T=p.onDispose((()=>{T(),C.abort()}));return(async()=>{const e=c();r={...r,extensions:{...r.extensions,operationId:e}};let t=null;for(;;){t=null;try{const{url:n,headers:o,getResults:s}=await S();let c;try{c=await y(n,{signal:C.signal,method:"POST",credentials:d,referrer:u,referrerPolicy:h,headers:{...o,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(r)})}catch(e){throw new i(e)}if(202!==c.status)throw new i(c);t=async()=>{let t;try{const r=new b,a=p.onDispose((()=>{a(),r.abort()}));t=await y(n+"?operationId="+e,{signal:r.signal,method:"DELETE",credentials:d,referrer:u,referrerPolicy:h,headers:o})}catch(e){throw new i(e)}if(200!==t.status)throw new i(t)};for await(const t of s({signal:C.signal,operationId:e}))m=null,E=0,a.next(t);return t=null,C.abort()}catch(e){if(C.signal.aborted)return await(null==t?void 0:t());if(!(e instanceof i))throw C.abort(),e;if(n&&(v=void 0),!l||E>=l)throw C.abort(),e;m=e}finally{C.signal.aborted&&0==--x&&(isFinite(o)&&o>0?setTimeout((()=>{x||g.abort()}),o):g.abort())}}})().then((()=>a.complete())).catch((e=>a.error(e))),()=>C.abort()},dispose(){p.dispose()}}},e.isAsyncGenerator=function(e){return t(e)&&"function"==typeof Object(e)[Symbol.asyncIterator]&&"function"==typeof e.return&&"function"==typeof e.throw&&"function"==typeof e.next},e.isAsyncIterable=function(e){return"function"==typeof Object(e)[Symbol.asyncIterator]},e.parseStreamData=o,e.print=function(e){let t=`event: ${e.event}`;return e.data&&(t+=`\ndata: ${JSON.stringify(e.data)}`),t+="\n\n",t},e.validateStreamEvent=n}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).graphqlSse={})}(this,(function(e){"use strict";function t(e){return"object"==typeof e&&null!==e}const r="x-graphql-event-stream-token";function n(e){if("next"!==e&&"complete"!==e)throw new Error(`Invalid stream event "${e}"`);return e}function o(e,t){if(t)try{t=JSON.parse(t)}catch{throw new Error("Invalid stream data")}if("next"===e&&!t)throw new Error('Stream data must be an object for "next" events');return t||null}var a;!function(e){e[e.NewLine=10]="NewLine",e[e.CchunkiageReturn=13]="CchunkiageReturn",e[e.Space=32]="Space",e[e.Colon=58]="Colon"}(a||(a={}));class i extends Error{constructor(e){let r,n;var o;t(o=e)&&"boolean"==typeof o.ok&&"number"==typeof o.status&&"string"==typeof o.statusText?(n=e,r="Server responded with "+e.status+": "+e.statusText):r=e instanceof Error?e.message:String(e),super(r),this.name=this.constructor.name,this.response=n}}async function s(e){const{signal:t,url:r,credentials:s,headers:c,body:l,referrer:f,referrerPolicy:d,fetchFn:u,onMessage:h}=e,w={},y={};let b;try{b=await u(r,{signal:t,method:l?"POST":"GET",credentials:s,referrer:f,referrerPolicy:d,headers:{...c,accept:"text/event-stream"},body:l})}catch(e){throw new i(e)}if(!b.ok)throw new i(b);if(!b.body)throw new Error("Missing response body");let p,g=null;return(async()=>{var e;try{const t=function(){let e,t,r,i=!1,s={event:"",data:""},c=[];const l=new TextDecoder;return function(f){if(void 0===e)e=f,t=0,r=-1;else{const t=new Uint8Array(e.length+f.length);t.set(e),t.set(f,e.length),e=t}const d=e.length;let u=0;for(;t<d;){i&&(e[t]===a.NewLine&&(u=++t),i=!1);let f=-1;for(;t<d&&-1===f;++t)switch(e[t]){case a.Colon:-1===r&&(r=t-u);break;case a.CchunkiageReturn:i=!0;case a.NewLine:f=t}if(-1===f)break;if(u===f){if(s.event||s.data){if(!s.event)throw new Error("Missing message event");const e=n(s.event),t=o(e,s.data);c.push({event:e,data:t}),s={event:"",data:""}}}else if(r>0){const t=e.subarray(u,f),n=l.decode(t.subarray(0,r)),o=r+(t[r+1]===a.Space?2:1),i=l.decode(t.subarray(o));switch(n){case"event":s.event=i;break;case"data":s.data=s.data?s.data+"\n"+i:i}}u=t,r=-1}if(u===d){e=void 0;const t=[...c];return c=[],t}0!==u&&(e=e.subarray(u),t-=u)}}();for await(const r of function(e){if("function"==typeof Object(e)[Symbol.asyncIterator])return e[Symbol.asyncIterator]();return async function*(){const t=e.getReader();let r;do{r=await t.read(),void 0!==r.value&&(yield r.value)}while(!r.done)}()}(b.body)){if("string"==typeof r)throw g=new Error(`Unexpected string chunk "${r}"`);let n;try{n=t(r)}catch(e){throw g=e}if(n)for(const t of n){try{null==h||h(t)}catch(e){throw g=e}const r=t.data&&"id"in t.data?t.data.id:"";switch(r in y||(y[r]=[]),t.event){case"next":r?y[r].push(t.data.payload):y[r].push(t.data);break;case"complete":y[r].push("complete");break;default:throw g=new Error(`Unexpected message event "${t.event}"`)}null===(e=w[r])||void 0===e||e.proceed()}}if(Object.keys(w).length)throw new Error("Connection closed while having active streams")}catch(e){g=!g&&Object.keys(w).length?new i(e):e,null==p||p(g)}finally{Object.values(w).forEach((({proceed:e})=>e()))}})(),{url:r,headers:c,waitForThrow:()=>new Promise(((e,t)=>{if(g)return t(g);p=t})),async*getResults(e){var t;const{signal:r,operationId:n=""}=null!=e?e:{};try{for(;;){for(;null===(t=y[n])||void 0===t?void 0:t.length;){const e=y[n].shift();if("complete"===e)return;yield e}if(g)throw g;if(null==r?void 0:r.aborted)throw new Error("Getting results aborted by the client");await new Promise((e=>{const t=()=>{null==r||r.removeEventListener("abort",t),delete w[n],e()};null==r||r.addEventListener("abort",t),w[n]={proceed:t}}))}}finally{delete y[n]}}}}e.NetworkError=i,e.TOKEN_HEADER_KEY=r,e.TOKEN_QUERY_KEY="token",e.createClient=function(e){const{singleConnection:t=!1,lazy:n=!0,lazyCloseTimeout:o=0,onNonLazyError:a=console.error,generateID:c=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},retryAttempts:l=5,retry:f=async function(e){let t=1e3;for(let r=0;r<e;r++)t*=2;await new Promise((e=>setTimeout(e,t+Math.floor(2700*Math.random()+300))))},credentials:d="same-origin",referrer:u,referrerPolicy:h,onMessage:w}=e,y=e.fetchFn||fetch,b=e.abortControllerImpl||AbortController,p=(()=>{let e=!1;const t=[];return{get disposed(){return e},onDispose:r=>e?(setTimeout((()=>r()),0),()=>{}):(t.push(r),()=>{t.splice(t.indexOf(r),1)}),dispose(){if(!e){e=!0;for(const e of[...t])e()}}}})();let g,v,x=0,m=null,E=0;async function S(){try{if(p.disposed)throw new Error("Client has been disposed");return await(null!=v?v:v=(async()=>{var t;if(m){if(await f(E),g.signal.aborted)throw new Error("Connection aborted by the client");E++}g=new b;const n=p.onDispose((()=>g.abort()));g.signal.addEventListener("abort",(()=>{n(),v=void 0}));const o="function"==typeof e.url?await e.url():e.url;if(g.signal.aborted)throw new Error("Connection aborted by the client");const a="function"==typeof e.headers?await e.headers():null!==(t=e.headers)&&void 0!==t?t:{};if(g.signal.aborted)throw new Error("Connection aborted by the client");let c;try{c=await y(o,{signal:g.signal,method:"PUT",credentials:d,referrer:u,referrerPolicy:h,headers:a})}catch(e){throw new i(e)}if(201!==c.status)throw new i(c);const l=await c.text();a[r]=l;const x=await s({signal:g.signal,headers:a,credentials:d,referrer:u,referrerPolicy:h,url:o,fetchFn:y,onMessage:w});return x.waitForThrow().catch((()=>v=void 0)),x})())}catch(e){throw v=void 0,e}}return t&&!n&&(async()=>{for(x++;;)try{const{waitForThrow:e}=await S();await e()}catch(e){if(p.disposed)return;if(!(e instanceof i))return null==a?void 0:a(e);if(v=void 0,!l||E>=l)return null==a?void 0:a(e);m=e}})(),{subscribe(r,a){if(!t){const t=new b,n=p.onDispose((()=>{n(),t.abort()}));return(async()=>{var n;let o=null,c=0;for(;;)try{if(o){if(await f(c),t.signal.aborted)throw new Error("Connection aborted by the client");c++}const i="function"==typeof e.url?await e.url():e.url;if(t.signal.aborted)throw new Error("Connection aborted by the client");const l="function"==typeof e.headers?await e.headers():null!==(n=e.headers)&&void 0!==n?n:{};if(t.signal.aborted)throw new Error("Connection aborted by the client");const{getResults:b}=await s({signal:t.signal,headers:{...l,"content-type":"application/json; charset=utf-8"},credentials:d,referrer:u,referrerPolicy:h,url:i,body:JSON.stringify(r),fetchFn:y,onMessage:w});for await(const e of b())o=null,c=0,a.next(e);return t.abort()}catch(e){if(t.signal.aborted)return;if(!(e instanceof i))throw e;if(!l||c>=l)throw e;o=e}})().then((()=>a.complete())).catch((e=>a.error(e))),()=>t.abort()}x++;const C=new b,T=p.onDispose((()=>{T(),C.abort()}));return(async()=>{const e=c();r={...r,extensions:{...r.extensions,operationId:e}};let t=null;for(;;){t=null;try{const{url:n,headers:o,getResults:s}=await S();let c;try{c=await y(n,{signal:C.signal,method:"POST",credentials:d,referrer:u,referrerPolicy:h,headers:{...o,"content-type":"application/json; charset=utf-8"},body:JSON.stringify(r)})}catch(e){throw new i(e)}if(202!==c.status)throw new i(c);t=async()=>{let t;try{const r=new b,a=p.onDispose((()=>{a(),r.abort()}));t=await y(n+"?operationId="+e,{signal:r.signal,method:"DELETE",credentials:d,referrer:u,referrerPolicy:h,headers:o})}catch(e){throw new i(e)}if(200!==t.status)throw new i(t)};for await(const t of s({signal:C.signal,operationId:e}))m=null,E=0,a.next(t);return t=null,C.abort()}catch(e){if(C.signal.aborted)return await(null==t?void 0:t());if(!(e instanceof i))throw C.abort(),e;if(n&&(v=void 0),!l||E>=l)throw C.abort(),e;m=e}finally{C.signal.aborted&&0==--x&&(isFinite(o)&&o>0?setTimeout((()=>{x||g.abort()}),o):g.abort())}}})().then((()=>a.complete())).catch((e=>a.error(e))),()=>C.abort()},iterate(e){const t=[],r={done:!1,error:null,resolve:()=>{}},n=this.subscribe(e,{next(e){t.push(e),r.resolve()},error(e){r.done=!0,r.error=e,r.resolve()},complete(){r.done=!0,r.resolve()}}),o=async function*(){for(;;){for(t.length||await new Promise((e=>r.resolve=e));t.length;)yield t.shift();if(r.error)throw r.error;if(r.done)return}}();return o.throw=async e=>(r.done||(r.done=!0,r.error=e,r.resolve()),{done:!0,value:void 0}),o.return=async()=>(n(),{done:!0,value:void 0}),o},dispose(){p.dispose()}}},e.isAsyncGenerator=function(e){return t(e)&&"function"==typeof Object(e)[Symbol.asyncIterator]&&"function"==typeof e.return&&"function"==typeof e.throw&&"function"==typeof e.next},e.isAsyncIterable=function(e){return"function"==typeof Object(e)[Symbol.asyncIterator]},e.parseStreamData=o,e.print=function(e){let t=`event: ${e.event}`;return e.data&&(t+=`\ndata: ${JSON.stringify(e.data)}`),t+="\n\n",t},e.validateStreamEvent=n}));

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc