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

async-call-rpc

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-call-rpc - npm Package Compare versions

Comparing version 6.1.1 to 6.1.2

30

out/base.js

@@ -350,7 +350,7 @@ /// <reference types="./base.d.ts" />

function batch(asyncCallInstance) {
let queue = [];
return [
new Proxy({ __proto__: null } , {
get(cache, p) {
if (isString(p) && cache[p]) return cache[p]
const queue = [];
const getTrap = new Proxy(
{},
{
get(_, p) {
// @ts-ignore

@@ -364,11 +364,21 @@ const f = (...args) => asyncCallInstance[AsyncCallBatch](queue, p, ...args);

f[AsyncCallNotify][AsyncCallNotify] = f[AsyncCallNotify];
isString(p) && Object.defineProperty(cache, p, { value: f, configurable: true });
isString(p) && Object.defineProperty(methodContainer, p, { value: f, configurable: true });
return f
},
},
);
const methodContainer = { __proto__: getTrap };
return [
new Proxy(methodContainer, {
getPrototypeOf: () => null,
setPrototypeOf: (_, value) => value === null,
}),
(r = queue.r) => r && r[0](),
(error = new Error('Aborted'), r = queue.r) => {
r && r[1](error);
queue = [];
() => {
queue.length && queue.r[0]();
queue.length = 0;
},
(error = new Error('Aborted')) => {
queue.length && queue.r[1](error);
queue.length = 0;
},
]

@@ -375,0 +385,0 @@ }

/// <reference types="./base.min.d.ts" />
((r,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).AsyncCall={})})(this,(function(r){"use strict";class e extends Error{constructor(r,e,t,n){super(e),this.name=r,this.code=t,this.stack=n}}const t={},n={},o=[{},{},t,n];function s(r,e){const t=o.indexOf(r);return e.message+=`Error ${t}: https://github.com/Jack-Works/async-call-rpc/wiki/Errors#`+t,e}const a={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},i="DOMException:",c=r=>(r+"").replace(/^.+\n.+\n/,""),l=()=>{try{return DOMException}catch(r){}},u=r=>"string"==typeof r,f=r=>"boolean"==typeof r,d=r=>"function"==typeof r,p=r=>"object"==typeof r&&null!==r,y="Error",m=void 0,h=Array.isArray,g=()=>"() => replay()",E="2.0",b=(r,e,t,n)=>{r===m&&(r=null),Number.isNaN(e=Math.floor(e))&&(e=-1);const o={jsonrpc:E,id:r,error:{code:e,message:t,data:n}};return v(o.error,"data"),o},k=(r,e,t)=>{const{id:n}=r,{code:o,message:s,data:a}=t(e,r);return b(n,o,s,a)},w=(r="",e=-1)=>t=>{let n=P("",(()=>t.message)),o=P(y,((r=t.constructor)=>d(r)&&r.name));const s=l();return s&&t instanceof s&&(o=i+t.name),(u(t)||"number"==typeof t||f(t)||"bigint"==typeof t)&&(o=y,n=t+""),{code:e,message:n,data:r?{stack:r,type:o}:{type:o}}},$=r=>{if(!p(r))return!1;if(!S(r,"jsonrpc"))return!1;if(r.jsonrpc!==E)return!1;if(S(r,"params")){const e=r.params;if(!h(e)&&!p(e))return!1}return!0},S=(r,e)=>e in r,P=(r,e)=>{try{const t=e();return t===m?r:t+""}catch(e){return r}},v=(r,e)=>{r[e]===m&&delete r[e]},_={serialization:r=>r,deserialization:r=>r},x="AsyncCall/",j=Symbol.for(x+"ignored"),O=Symbol.for(x+"notify"),z=Symbol.for(x+"batch"),M=(r,e)=>r[e][O],N=()=>Math.random().toString(36).slice(2),R=r=>void 0===r||r;r.AsyncCall=(r,o)=>{let P=!0,x=m,M=m;const A=async()=>{try{x=await r}catch(r){M=r,er("AsyncCall failed to start",r)}finally{P=!1}},{serializer:C=_,key:T="rpc",strict:W=!0,log:I=!0,parameterStructures:J="by-position",preferLocalImplementation:q=!1,idGenerator:D=N,mapError:F,logger:L,channel:U,thenable:G}=o;r instanceof Promise?A():(x=r,P=!1);const[B,H]=(r=>{if(!f(r)){const{methodNotFound:e,unknownMessage:t}=r;return[e,t]}return[r,r]})(W),[K,Q,V,X,Y,Z]=(r=>{if("all"===r)return[!0,!0,!0,!0,!0,!0];if(!f(r)){const{beCalled:e,localError:t,remoteError:n,type:o,requestReplay:s,sendLocalStack:a}=r;return[R(e),R(t),R(n),"basic"!==o,s,a]}return r?[!0,!0,!0,!0]:[]})(I),{log:rr,error:er=rr,debug:tr=rr,groupCollapsed:nr=rr,groupEnd:or=rr,warn:sr=rr}=L||console,ar=new Map,ir=async r=>{let e;try{if(e=await ur(r),$(e))return await yr(e);if(h(e)&&e.every($)&&0!==e.length)return Promise.all(e.map(yr));if(H){let r=e.id;return r===m&&(r=null),(r=>b(r,-32600,"Invalid Request"))(r)}return m}catch(r){return Q&&er(r,e,void 0),((r,e)=>{const t=k({},r,e),n=t.error;return n.code=-32700,n.message="Parse error",t})(r,F||w(r&&r.stack))}},cr=async r=>{if(r){if(h(r)){const e=r.filter((r=>r&&S(r,"id")));if(0===e.length)return;return lr(e)}return lr(r)}},lr=r=>C.serialization(r),ur=r=>C.deserialization(r);var fr;if(S(fr=U,"setup")&&d(fr.setup)&&U.setup((r=>ir(r).then(cr)),(r=>{const e=ur(r);return!!$(e)||(r=>Promise.resolve(r))(e).then($)})),(r=>S(r,"send")&&d(r.send))(U)){const r=U;r.on&&r.on((e=>ir(e).then(cr).then((e=>e&&r.send(e)))))}function dr(r,e,t){return p(r)&&S(r,"stack")&&(r.stack=e.split("\n").reduce(((r,e)=>r.replace(e+"\n","")),""+r.stack)),Q&&er(r),k(t,r,F||w(Z?r.stack:m))}async function pr(r,e=!1){e&&(r=[...r]);const t=await lr(r);return U.send(t)}const yr=async r=>{if(S(r,"method")){const e=(async r=>{if(P)await A();else if(M)return dr(M,"",r);let e="";try{const{params:t,method:n,id:o,remoteStack:s}=r,a=n.startsWith("rpc.")?Symbol.for(n):n,i=x&&x[a];if(!d(i))return B?b(o,-32601,"Method not found"):void(Q&&tr("Missing method",a,r));const l=h(t)?t:[t];e=c(Error().stack);const u=new Promise((r=>r(i.apply(x,l))));if(K)if(X){const r=[`${T}.%c${n}%c(${l.map((()=>"%o")).join(", ")}%c)\n%o %c@${o}`,"color: #d2c057","",...l,"",u,"color: gray; font-style: italic;"];if(Y){const e=()=>{debugger;return i.apply(x,l)};e.toString=g,r.push(e)}s?(nr(...r),rr(s),or()):rr(...r)}else rr(`${T}.${n}(${""+[...l]}) @${o}`);if(await u===j)return;return((r,e)=>{const t={jsonrpc:E,id:r,result:e};return v(t,"id"),t})(o,await u)}catch(t){return dr(t,e,r)}})(r);if(S(r,"id"))return e;try{await e}catch(r){}return m}return(async r=>{let t="",n="",o=0,s=y;if(S(r,"error")){const e=r.error;t=e.message,o=e.code;const a=e.data;n=p(a)&&S(a,"stack")&&u(a.stack)?a.stack:"<remote stack not available>",s=p(a)&&S(a,"type")&&u(a.type)?a.type:y,V&&(X?er(`${s}: ${t}(${o}) %c@${r.id}\n%c${n}`,"color: gray",""):er(`${s}: ${t}(${o}) @${r.id}\n${n}`))}if(null===r.id||r.id===m)return;const{f:[c,f]=[null,null],stack:d=""}=ar.get(r.id)||{};c&&f&&(ar.delete(r.id),S(r,"error")?f(((r,t,n,o)=>{try{const s=l();if(r.startsWith(i)&&s)return new s(t,r.slice(13));if(r in a){const e=new a[r](t);return e.stack=o,e.code=n,e}return new e(r,t,n,o)}catch(e){return Error(`E${n} ${r}: ${t}\n${o}`)}})(s,t,o,n+"\n аt AsyncCall (rpc) \n"+d)):c(r.result))})(r)},mr=(r,e,n,o=!1)=>new Promise(((a,i)=>{let l=m;if(r===z&&(l=e.shift(),r=e.shift()),"symbol"==typeof r){const e=Symbol.keyFor(r)||r.description;if(e){if(!e.startsWith("rpc."))throw new TypeError("Not start with rpc.");r=e}}else if(r.startsWith("rpc."))throw s(t,new TypeError);if(q&&!P&&u(r)){const t=x&&x[r];if(d(t))return a(t(...e))}const f=D();n=c(n);const y="by-name"===J&&1===e.length&&p(e[0])?e[0]:e,h=((r,e,t,n)=>{const o={jsonrpc:E,id:r,method:e,params:t,remoteStack:n};return v(o,"id"),((r,e)=>{r[e]||delete r[e]})(o,"remoteStack"),o})(o?m:f,r,y,Z?n:m);if(l?(l.push(h),l.r||(l.r=[()=>pr(l,!0),r=>((r,e)=>{for(const t of r)if(S(t,"id")){const r=ar.get(t.id);r&&r.f[1](e)}})(l,r)])):pr(h).catch(i),o)return a();ar.set(f,{f:[a,i],stack:n})})),hr={__proto__:new Proxy({},{get(r,e){const t={[e]:(...r)=>mr(e,r,Error().stack)}[e],n={[e]:(...r)=>mr(e,r,Error().stack,!0)}[e];return t[O]=n[O]=n,u(e)&&Object.defineProperty(hr,e,{value:t,configurable:!0}),t}})};return!1===G?hr.then=m:G===m&&Object.defineProperty(hr,"then",{configurable:!0,get(){sr(s(n,new TypeError("RPC used as Promise: ")))}}),new Proxy(hr,{getPrototypeOf:()=>null,setPrototypeOf:(r,e)=>null===e})},r.JSONSerialization=(r=[m,m],e,t="null")=>({serialization(n){if(t&&p(n)&&S(n,"result")&&n.result===m){const r={...n};r.result=null,"keep"===t&&(r.undef=!0),n=r}return JSON.stringify(n,r[0],e)},deserialization(e){const t=JSON.parse(e,r[1]);return p(t)&&S(t,"result")&&null===t.result&&S(t,"undef")&&!0===t.undef&&(t.result=m,delete t.undef),t}}),r.NoSerialization=_,r.batch=r=>{let e=[];return[new Proxy({__proto__:null},{get(t,n){if(u(n)&&t[n])return t[n];const o=(...t)=>r[z](e,n,...t);return(o[O]=(...t)=>r[z][O](e,n,...t))[O]=o[O],u(n)&&Object.defineProperty(t,n,{value:o,configurable:!0}),o}}),(r=e.r)=>r&&r[0](),(r=Error("Aborted"),t=e.r)=>{t&&t[1](r),e=[]}]},r.notify=r=>d(r)?r[O]:new Proxy(r,{get:M}),Object.defineProperty(r,"__esModule",{value:!0})}));
((r,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).AsyncCall={})})(this,(function(r){"use strict";class e extends Error{constructor(r,e,t,n){super(e),this.name=r,this.code=t,this.stack=n}}const t={},n={},o=[{},{},t,n];function s(r,e){const t=o.indexOf(r);return e.message+=`Error ${t}: https://github.com/Jack-Works/async-call-rpc/wiki/Errors#`+t,e}const a={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},i="DOMException:",c=r=>(r+"").replace(/^.+\n.+\n/,""),l=()=>{try{return DOMException}catch(r){}},u=r=>"string"==typeof r,f=r=>"boolean"==typeof r,d=r=>"function"==typeof r,p=r=>"object"==typeof r&&null!==r,y="Error",h=void 0,g=Array.isArray,m=()=>"() => replay()",E="2.0",b=(r,e,t,n)=>{r===h&&(r=null),Number.isNaN(e=Math.floor(e))&&(e=-1);const o={jsonrpc:E,id:r,error:{code:e,message:t,data:n}};return v(o.error,"data"),o},k=(r,e,t)=>{const{id:n}=r,{code:o,message:s,data:a}=t(e,r);return b(n,o,s,a)},w=(r="",e=-1)=>t=>{let n=S("",(()=>t.message)),o=S(y,((r=t.constructor)=>d(r)&&r.name));const s=l();return s&&t instanceof s&&(o=i+t.name),(u(t)||"number"==typeof t||f(t)||"bigint"==typeof t)&&(o=y,n=t+""),{code:e,message:n,data:r?{stack:r,type:o}:{type:o}}},$=r=>{if(!p(r))return!1;if(!P(r,"jsonrpc"))return!1;if(r.jsonrpc!==E)return!1;if(P(r,"params")){const e=r.params;if(!g(e)&&!p(e))return!1}return!0},P=(r,e)=>e in r,S=(r,e)=>{try{const t=e();return t===h?r:t+""}catch(e){return r}},v=(r,e)=>{r[e]===h&&delete r[e]},x={serialization:r=>r,deserialization:r=>r},O="AsyncCall/",_=Symbol.for(O+"ignored"),j=Symbol.for(O+"notify"),z=Symbol.for(O+"batch"),M=(r,e)=>r[e][j],N=()=>Math.random().toString(36).slice(2),R=r=>void 0===r||r;r.AsyncCall=(r,o)=>{let S=!0,O=h,M=h;const A=async()=>{try{O=await r}catch(r){M=r,er("AsyncCall failed to start",r)}finally{S=!1}},{serializer:C=x,key:T="rpc",strict:W=!0,log:I=!0,parameterStructures:J="by-position",preferLocalImplementation:q=!1,idGenerator:D=N,mapError:F,logger:L,channel:U,thenable:G}=o;r instanceof Promise?A():(O=r,S=!1);const[B,H]=(r=>{if(!f(r)){const{methodNotFound:e,unknownMessage:t}=r;return[e,t]}return[r,r]})(W),[K,Q,V,X,Y,Z]=(r=>{if("all"===r)return[!0,!0,!0,!0,!0,!0];if(!f(r)){const{beCalled:e,localError:t,remoteError:n,type:o,requestReplay:s,sendLocalStack:a}=r;return[R(e),R(t),R(n),"basic"!==o,s,a]}return r?[!0,!0,!0,!0]:[]})(I),{log:rr,error:er=rr,debug:tr=rr,groupCollapsed:nr=rr,groupEnd:or=rr,warn:sr=rr}=L||console,ar=new Map,ir=async r=>{let e;try{if(e=await ur(r),$(e))return await yr(e);if(g(e)&&e.every($)&&0!==e.length)return Promise.all(e.map(yr));if(H){let r=e.id;return r===h&&(r=null),(r=>b(r,-32600,"Invalid Request"))(r)}return h}catch(r){return Q&&er(r,e,void 0),((r,e)=>{const t=k({},r,e),n=t.error;return n.code=-32700,n.message="Parse error",t})(r,F||w(r&&r.stack))}},cr=async r=>{if(r){if(g(r)){const e=r.filter((r=>r&&P(r,"id")));if(0===e.length)return;return lr(e)}return lr(r)}},lr=r=>C.serialization(r),ur=r=>C.deserialization(r);var fr;if(P(fr=U,"setup")&&d(fr.setup)&&U.setup((r=>ir(r).then(cr)),(r=>{const e=ur(r);return!!$(e)||(r=>Promise.resolve(r))(e).then($)})),(r=>P(r,"send")&&d(r.send))(U)){const r=U;r.on&&r.on((e=>ir(e).then(cr).then((e=>e&&r.send(e)))))}function dr(r,e,t){return p(r)&&P(r,"stack")&&(r.stack=e.split("\n").reduce(((r,e)=>r.replace(e+"\n","")),""+r.stack)),Q&&er(r),k(t,r,F||w(Z?r.stack:h))}async function pr(r,e=!1){e&&(r=[...r]);const t=await lr(r);return U.send(t)}const yr=async r=>{if(P(r,"method")){const e=(async r=>{if(S)await A();else if(M)return dr(M,"",r);let e="";try{const{params:t,method:n,id:o,remoteStack:s}=r,a=n.startsWith("rpc.")?Symbol.for(n):n,i=O&&O[a];if(!d(i))return B?b(o,-32601,"Method not found"):void(Q&&tr("Missing method",a,r));const l=g(t)?t:[t];e=c(Error().stack);const u=new Promise((r=>r(i.apply(O,l))));if(K)if(X){const r=[`${T}.%c${n}%c(${l.map((()=>"%o")).join(", ")}%c)\n%o %c@${o}`,"color: #d2c057","",...l,"",u,"color: gray; font-style: italic;"];if(Y){const e=()=>{debugger;return i.apply(O,l)};e.toString=m,r.push(e)}s?(nr(...r),rr(s),or()):rr(...r)}else rr(`${T}.${n}(${""+[...l]}) @${o}`);if(await u===_)return;return((r,e)=>{const t={jsonrpc:E,id:r,result:e};return v(t,"id"),t})(o,await u)}catch(t){return dr(t,e,r)}})(r);if(P(r,"id"))return e;try{await e}catch(r){}return h}return(async r=>{let t="",n="",o=0,s=y;if(P(r,"error")){const e=r.error;t=e.message,o=e.code;const a=e.data;n=p(a)&&P(a,"stack")&&u(a.stack)?a.stack:"<remote stack not available>",s=p(a)&&P(a,"type")&&u(a.type)?a.type:y,V&&(X?er(`${s}: ${t}(${o}) %c@${r.id}\n%c${n}`,"color: gray",""):er(`${s}: ${t}(${o}) @${r.id}\n${n}`))}if(null===r.id||r.id===h)return;const{f:[c,f]=[null,null],stack:d=""}=ar.get(r.id)||{};c&&f&&(ar.delete(r.id),P(r,"error")?f(((r,t,n,o)=>{try{const s=l();if(r.startsWith(i)&&s)return new s(t,r.slice(13));if(r in a){const e=new a[r](t);return e.stack=o,e.code=n,e}return new e(r,t,n,o)}catch(e){return Error(`E${n} ${r}: ${t}\n${o}`)}})(s,t,o,n+"\n аt AsyncCall (rpc) \n"+d)):c(r.result))})(r)},hr=(r,e,n,o=!1)=>new Promise(((a,i)=>{let l=h;if(r===z&&(l=e.shift(),r=e.shift()),"symbol"==typeof r){const e=Symbol.keyFor(r)||r.description;if(e){if(!e.startsWith("rpc."))throw new TypeError("Not start with rpc.");r=e}}else if(r.startsWith("rpc."))throw s(t,new TypeError);if(q&&!S&&u(r)){const t=O&&O[r];if(d(t))return a(t(...e))}const f=D();n=c(n);const y="by-name"===J&&1===e.length&&p(e[0])?e[0]:e,g=((r,e,t,n)=>{const o={jsonrpc:E,id:r,method:e,params:t,remoteStack:n};return v(o,"id"),((r,e)=>{r[e]||delete r[e]})(o,"remoteStack"),o})(o?h:f,r,y,Z?n:h);if(l?(l.push(g),l.r||(l.r=[()=>pr(l,!0),r=>((r,e)=>{for(const t of r)if(P(t,"id")){const r=ar.get(t.id);r&&r.f[1](e)}})(l,r)])):pr(g).catch(i),o)return a();ar.set(f,{f:[a,i],stack:n})})),gr={__proto__:new Proxy({},{get(r,e){const t={[e]:(...r)=>hr(e,r,Error().stack)}[e],n={[e]:(...r)=>hr(e,r,Error().stack,!0)}[e];return t[j]=n[j]=n,u(e)&&Object.defineProperty(gr,e,{value:t,configurable:!0}),t}})};return!1===G?gr.then=h:G===h&&Object.defineProperty(gr,"then",{configurable:!0,get(){sr(s(n,new TypeError("RPC used as Promise: ")))}}),new Proxy(gr,{getPrototypeOf:()=>null,setPrototypeOf:(r,e)=>null===e})},r.JSONSerialization=(r=[h,h],e,t="null")=>({serialization(n){if(t&&p(n)&&P(n,"result")&&n.result===h){const r={...n};r.result=null,"keep"===t&&(r.undef=!0),n=r}return JSON.stringify(n,r[0],e)},deserialization(e){const t=JSON.parse(e,r[1]);return p(t)&&P(t,"result")&&null===t.result&&P(t,"undef")&&!0===t.undef&&(t.result=h,delete t.undef),t}}),r.NoSerialization=x,r.batch=r=>{const e=[],t={__proto__:new Proxy({},{get(n,o){const s=(...t)=>r[z](e,o,...t);return(s[j]=(...t)=>r[z][j](e,o,...t))[j]=s[j],u(o)&&Object.defineProperty(t,o,{value:s,configurable:!0}),s}})};return[new Proxy(t,{getPrototypeOf:()=>null,setPrototypeOf:(r,e)=>null===e}),()=>{e.length&&e.r[0](),e.length=0},(r=Error("Aborted"))=>{e.length&&e.r[1](r),e.length=0}]},r.notify=r=>d(r)?r[j]:new Proxy(r,{get:M}),Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=base.min.js.map

@@ -351,7 +351,7 @@ /// <reference types="./full.d.ts" />

function batch(asyncCallInstance) {
let queue = [];
return [
new Proxy({ __proto__: null } , {
get(cache, p) {
if (isString(p) && cache[p]) return cache[p]
const queue = [];
const getTrap = new Proxy(
{},
{
get(_, p) {
// @ts-ignore

@@ -365,11 +365,21 @@ const f = (...args) => asyncCallInstance[AsyncCallBatch](queue, p, ...args);

f[AsyncCallNotify][AsyncCallNotify] = f[AsyncCallNotify];
isString(p) && Object.defineProperty(cache, p, { value: f, configurable: true });
isString(p) && Object.defineProperty(methodContainer, p, { value: f, configurable: true });
return f
},
},
);
const methodContainer = { __proto__: getTrap };
return [
new Proxy(methodContainer, {
getPrototypeOf: () => null,
setPrototypeOf: (_, value) => value === null,
}),
(r = queue.r) => r && r[0](),
(error = new Error('Aborted'), r = queue.r) => {
r && r[1](error);
queue = [];
() => {
queue.length && queue.r[0]();
queue.length = 0;
},
(error = new Error('Aborted')) => {
queue.length && queue.r[1](error);
queue.length = 0;
},
]

@@ -376,0 +386,0 @@ }

/// <reference types="./full.min.d.ts" />
((r,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).AsyncCall={})})(this,(function(r){"use strict";class t extends Error{constructor(r,t,e,n){super(t),this.name=r,this.code=e,this.stack=n}}const e={},n={},o={},s={},i=[e,n,o,s];function a(r,t){const e=i.indexOf(r);return t.message+=`Error ${e}: https://github.com/Jack-Works/async-call-rpc/wiki/Errors#`+e,t}const c={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},l="DOMException:",u=r=>(r+"").replace(/^.+\n.+\n/,""),f=()=>{try{return DOMException}catch(r){}},y=r=>"string"==typeof r,p=r=>"boolean"==typeof r,d=r=>"function"==typeof r,h=r=>"object"==typeof r&&null!==r,m="Error",g=void 0,w=Object.setPrototypeOf,b=Array.isArray,E=()=>"() => replay()",k="2.0",_=(r,t,e,n)=>{r===g&&(r=null),Number.isNaN(t=Math.floor(t))&&(t=-1);const o={jsonrpc:k,id:r,error:{code:t,message:e,data:n}};return v(o.error,"data"),o},P=(r,t,e)=>{const{id:n}=r,{code:o,message:s,data:i}=e(t,r);return _(n,o,s,i)},$=(r="",t=-1)=>e=>{let n=x("",(()=>e.message)),o=x(m,((r=e.constructor)=>d(r)&&r.name));const s=f();return s&&e instanceof s&&(o=l+e.name),(y(e)||"number"==typeof e||p(e)||"bigint"==typeof e)&&(o=m,n=e+""),{code:t,message:n,data:r?{stack:r,type:o}:{type:o}}},S=r=>{if(!h(r))return!1;if(!O(r,"jsonrpc"))return!1;if(r.jsonrpc!==k)return!1;if(O(r,"params")){const t=r.params;if(!b(t)&&!h(t))return!1}return!0},O=(r,t)=>t in r,x=(r,t)=>{try{const e=t();return e===g?r:e+""}catch(t){return r}},v=(r,t)=>{r[t]===g&&delete r[t]},j={serialization:r=>r,deserialization:r=>r},M="AsyncCall/",z=Symbol.for(M+"ignored"),A=Symbol.for(M+"notify"),C=Symbol.for(M+"batch"),N=(r,t)=>r[t][A],R=()=>Math.random().toString(36).slice(2),T=r=>void 0===r||r,I=r=>{if(!p(r)){const{methodNotFound:t,unknownMessage:e}=r;return[t,e]}return[r,r]};function W(r,e){let n=!0,i=g,w=g;const x=async()=>{try{i=await r}catch(r){w=r,er("AsyncCall failed to start",r)}finally{n=!1}},{serializer:M=j,key:N="rpc",strict:W=!0,log:J=!0,parameterStructures:G="by-position",preferLocalImplementation:q=!1,idGenerator:D=R,mapError:F,logger:L,channel:U,thenable:B}=e;r instanceof Promise?x():(i=r,n=!1);const[H,K]=I(W),[Q,V,X,Y,Z,rr]=(r=>{if("all"===r)return[!0,!0,!0,!0,!0,!0];if(!p(r)){const{beCalled:t,localError:e,remoteError:n,type:o,requestReplay:s,sendLocalStack:i}=r;return[T(t),T(e),T(n),"basic"!==o,s,i]}return r?[!0,!0,!0,!0]:[]})(J),{log:tr,error:er=tr,debug:nr=tr,groupCollapsed:or=tr,groupEnd:sr=tr,warn:ir=tr}=L||console,ar=new Map,cr=async r=>{let t;try{if(t=await fr(r),S(t))return await hr(t);if(b(t)&&t.every(S)&&0!==t.length)return Promise.all(t.map(hr));if(K){let r=t.id;return r===g&&(r=null),(r=>_(r,-32600,"Invalid Request"))(r)}return g}catch(r){return V&&er(r,t,void 0),((r,t)=>{const e=P({},r,t),n=e.error;return n.code=-32700,n.message="Parse error",e})(r,F||$(r&&r.stack))}},lr=async r=>{if(r){if(b(r)){const t=r.filter((r=>r&&O(r,"id")));if(0===t.length)return;return ur(t)}return ur(r)}},ur=r=>M.serialization(r),fr=r=>M.deserialization(r);var yr;if(O(yr=U,"setup")&&d(yr.setup)&&U.setup((r=>cr(r).then(lr)),(r=>{const t=fr(r);return!!S(t)||(r=>Promise.resolve(r))(t).then(S)})),(r=>O(r,"send")&&d(r.send))(U)){const r=U;r.on&&r.on((t=>cr(t).then(lr).then((t=>t&&r.send(t)))))}function pr(r,t,e){return h(r)&&O(r,"stack")&&(r.stack=t.split("\n").reduce(((r,t)=>r.replace(t+"\n","")),""+r.stack)),V&&er(r),P(e,r,F||$(rr?r.stack:g))}async function dr(r,t=!1){t&&(r=[...r]);const e=await ur(r);return U.send(e)}const hr=async r=>{if(O(r,"method")){const t=(async r=>{if(n)await x();else if(w)return pr(w,"",r);let t="";try{const{params:e,method:n,id:o,remoteStack:s}=r,a=n.startsWith("rpc.")?Symbol.for(n):n,c=i&&i[a];if(!d(c))return H?_(o,-32601,"Method not found"):void(V&&nr("Missing method",a,r));const l=b(e)?e:[e];t=u(Error().stack);const f=new Promise((r=>r(c.apply(i,l))));if(Q)if(Y){const r=[`${N}.%c${n}%c(${l.map((()=>"%o")).join(", ")}%c)\n%o %c@${o}`,"color: #d2c057","",...l,"",f,"color: gray; font-style: italic;"];if(Z){const t=()=>{debugger;return c.apply(i,l)};t.toString=E,r.push(t)}s?(or(...r),tr(s),sr()):tr(...r)}else tr(`${N}.${n}(${""+[...l]}) @${o}`);if(await f===z)return;return((r,t)=>{const e={jsonrpc:k,id:r,result:t};return v(e,"id"),e})(o,await f)}catch(e){return pr(e,t,r)}})(r);if(O(r,"id"))return t;try{await t}catch(r){}return g}return(async r=>{let e="",n="",o=0,s=m;if(O(r,"error")){const t=r.error;e=t.message,o=t.code;const i=t.data;n=h(i)&&O(i,"stack")&&y(i.stack)?i.stack:"<remote stack not available>",s=h(i)&&O(i,"type")&&y(i.type)?i.type:m,X&&(Y?er(`${s}: ${e}(${o}) %c@${r.id}\n%c${n}`,"color: gray",""):er(`${s}: ${e}(${o}) @${r.id}\n${n}`))}if(null===r.id||r.id===g)return;const{f:[i,a]=[null,null],stack:u=""}=ar.get(r.id)||{};i&&a&&(ar.delete(r.id),O(r,"error")?a(((r,e,n,o)=>{try{const s=f();if(r.startsWith(l)&&s)return new s(e,r.slice(13));if(r in c){const t=new c[r](e);return t.stack=o,t.code=n,t}return new t(r,e,n,o)}catch(t){return Error(`E${n} ${r}: ${e}\n${o}`)}})(s,e,o,n+"\n аt AsyncCall (rpc) \n"+u)):i(r.result))})(r)},mr=(r,t,e,s=!1)=>new Promise(((c,l)=>{let f=g;if(r===C&&(f=t.shift(),r=t.shift()),"symbol"==typeof r){const t=Symbol.keyFor(r)||r.description;if(t){if(!t.startsWith("rpc."))throw new TypeError("Not start with rpc.");r=t}}else if(r.startsWith("rpc."))throw a(o,new TypeError);if(q&&!n&&y(r)){const e=i&&i[r];if(d(e))return c(e(...t))}const p=D();e=u(e);const m="by-name"===G&&1===t.length&&h(t[0])?t[0]:t,w=((r,t,e,n)=>{const o={jsonrpc:k,id:r,method:t,params:e,remoteStack:n};return v(o,"id"),((r,t)=>{r[t]||delete r[t]})(o,"remoteStack"),o})(s?g:p,r,m,rr?e:g);if(f?(f.push(w),f.r||(f.r=[()=>dr(f,!0),r=>((r,t)=>{for(const e of r)if(O(e,"id")){const r=ar.get(e.id);r&&r.f[1](t)}})(f,r)])):dr(w).catch(l),s)return c();ar.set(p,{f:[c,l],stack:e})})),gr={__proto__:new Proxy({},{get(r,t){const e={[t]:(...r)=>mr(t,r,Error().stack)}[t],n={[t]:(...r)=>mr(t,r,Error().stack,!0)}[t];return e[A]=n[A]=n,y(t)&&Object.defineProperty(gr,t,{value:e,configurable:!0}),e}})};return!1===B?gr.then=g:B===g&&Object.defineProperty(gr,"then",{configurable:!0,get(){ir(a(s,new TypeError("RPC used as Promise: ")))}}),new Proxy(gr,{getPrototypeOf:()=>null,setPrototypeOf:(r,t)=>null===t})}const J="rpc.async-iterator.",G=Symbol.for(J+"start"),q=Symbol.for(J+"next"),D=Symbol.for(J+"return"),F=Symbol.for(J+"throw");class L{__init(){this.d=!1}__init2(){this.c=async r=>(await H(r,(()=>this.d=!0)),r)}constructor(r,t){this.r=r,this.i=t,L.prototype.__init.call(this),L.prototype.__init2.call(this)}async return(r){return this.d?K(!0,r):this.c(this.r[D](await this.i,r))}async next(r){return this.d?K(!0):this.c(this.r[q](await this.i,r))}async throw(r){if(!this.d)return this.c(this.r[F](await this.i,r));throw r}}const U=async function*(){};w(L,U.constructor.prototype);const B=Object.getPrototypeOf(U());w(L.prototype,B);const H=async(r,t)=>{try{const e=await r;e&&e.done&&t()}catch(r){}},K=(r,t)=>({done:r,value:t});r.AsyncCall=W,r.AsyncGeneratorCall=(r,t)=>{const o=new Map,[s]=I(null==(i=t.strict)||i);var i;const{idGenerator:c=R}=t,l=(r,t)=>{const n=o.get(r);if(!n){if(s)throw a(e,Error(`Iterator ${r}, `));return z}const i=t(n);return H(i,(()=>o.delete(r))),i},u=W({async[G](t,e){const n=(await r)[t];if(!d(n)){if(s)throw new TypeError(t+" is not a function");return z}const i=n(...e),a=c();return o.set(a,i),a},[q]:(r,t)=>l(r,(r=>r.next(t))),[D]:(r,t)=>l(r,(r=>d(r.return)&&r.return(t))),[F]:(r,t)=>l(r,(r=>d(r.throw)&&r.throw(t)))},t),f={__proto__:new Proxy({},{get(r,t){if(!y(t))throw a(n,new TypeError(""));const e={[t]:(...r)=>{const e=u[G](t,r);return new L(u,e)}}[t];return Object.defineProperty(f,t,{value:e,configurable:!0}),e}})};return new Proxy(f,{getPrototypeOf:()=>null,setPrototypeOf:(r,t)=>null===t})},r.JSONSerialization=(r=[g,g],t,e="null")=>({serialization(n){if(e&&h(n)&&O(n,"result")&&n.result===g){const r={...n};r.result=null,"keep"===e&&(r.undef=!0),n=r}return JSON.stringify(n,r[0],t)},deserialization(t){const e=JSON.parse(t,r[1]);return h(e)&&O(e,"result")&&null===e.result&&O(e,"undef")&&!0===e.undef&&(e.result=g,delete e.undef),e}}),r.NoSerialization=j,r.batch=r=>{let t=[];return[new Proxy({__proto__:null},{get(e,n){if(y(n)&&e[n])return e[n];const o=(...e)=>r[C](t,n,...e);return(o[A]=(...e)=>r[C][A](t,n,...e))[A]=o[A],y(n)&&Object.defineProperty(e,n,{value:o,configurable:!0}),o}}),(r=t.r)=>r&&r[0](),(r=Error("Aborted"),e=t.r)=>{e&&e[1](r),t=[]}]},r.notify=r=>d(r)?r[A]:new Proxy(r,{get:N}),Object.defineProperty(r,"__esModule",{value:!0})}));
((r,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).AsyncCall={})})(this,(function(r){"use strict";class t extends Error{constructor(r,t,e,n){super(t),this.name=r,this.code=e,this.stack=n}}const e={},n={},o={},s={},i=[e,n,o,s];function a(r,t){const e=i.indexOf(r);return t.message+=`Error ${e}: https://github.com/Jack-Works/async-call-rpc/wiki/Errors#`+e,t}const c={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},l="DOMException:",u=r=>(r+"").replace(/^.+\n.+\n/,""),f=()=>{try{return DOMException}catch(r){}},y=r=>"string"==typeof r,p=r=>"boolean"==typeof r,d=r=>"function"==typeof r,h=r=>"object"==typeof r&&null!==r,g="Error",m=void 0,w=Object.setPrototypeOf,b=Array.isArray,E=()=>"() => replay()",k="2.0",P=(r,t,e,n)=>{r===m&&(r=null),Number.isNaN(t=Math.floor(t))&&(t=-1);const o={jsonrpc:k,id:r,error:{code:t,message:e,data:n}};return v(o.error,"data"),o},_=(r,t,e)=>{const{id:n}=r,{code:o,message:s,data:i}=e(t,r);return P(n,o,s,i)},$=(r="",t=-1)=>e=>{let n=x("",(()=>e.message)),o=x(g,((r=e.constructor)=>d(r)&&r.name));const s=f();return s&&e instanceof s&&(o=l+e.name),(y(e)||"number"==typeof e||p(e)||"bigint"==typeof e)&&(o=g,n=e+""),{code:t,message:n,data:r?{stack:r,type:o}:{type:o}}},S=r=>{if(!h(r))return!1;if(!O(r,"jsonrpc"))return!1;if(r.jsonrpc!==k)return!1;if(O(r,"params")){const t=r.params;if(!b(t)&&!h(t))return!1}return!0},O=(r,t)=>t in r,x=(r,t)=>{try{const e=t();return e===m?r:e+""}catch(t){return r}},v=(r,t)=>{r[t]===m&&delete r[t]},j={serialization:r=>r,deserialization:r=>r},M="AsyncCall/",z=Symbol.for(M+"ignored"),A=Symbol.for(M+"notify"),C=Symbol.for(M+"batch"),N=(r,t)=>r[t][A],R=()=>Math.random().toString(36).slice(2),T=r=>void 0===r||r,I=r=>{if(!p(r)){const{methodNotFound:t,unknownMessage:e}=r;return[t,e]}return[r,r]};function W(r,e){let n=!0,i=m,w=m;const x=async()=>{try{i=await r}catch(r){w=r,er("AsyncCall failed to start",r)}finally{n=!1}},{serializer:M=j,key:N="rpc",strict:W=!0,log:J=!0,parameterStructures:G="by-position",preferLocalImplementation:q=!1,idGenerator:D=R,mapError:F,logger:L,channel:U,thenable:B}=e;r instanceof Promise?x():(i=r,n=!1);const[H,K]=I(W),[Q,V,X,Y,Z,rr]=(r=>{if("all"===r)return[!0,!0,!0,!0,!0,!0];if(!p(r)){const{beCalled:t,localError:e,remoteError:n,type:o,requestReplay:s,sendLocalStack:i}=r;return[T(t),T(e),T(n),"basic"!==o,s,i]}return r?[!0,!0,!0,!0]:[]})(J),{log:tr,error:er=tr,debug:nr=tr,groupCollapsed:or=tr,groupEnd:sr=tr,warn:ir=tr}=L||console,ar=new Map,cr=async r=>{let t;try{if(t=await fr(r),S(t))return await hr(t);if(b(t)&&t.every(S)&&0!==t.length)return Promise.all(t.map(hr));if(K){let r=t.id;return r===m&&(r=null),(r=>P(r,-32600,"Invalid Request"))(r)}return m}catch(r){return V&&er(r,t,void 0),((r,t)=>{const e=_({},r,t),n=e.error;return n.code=-32700,n.message="Parse error",e})(r,F||$(r&&r.stack))}},lr=async r=>{if(r){if(b(r)){const t=r.filter((r=>r&&O(r,"id")));if(0===t.length)return;return ur(t)}return ur(r)}},ur=r=>M.serialization(r),fr=r=>M.deserialization(r);var yr;if(O(yr=U,"setup")&&d(yr.setup)&&U.setup((r=>cr(r).then(lr)),(r=>{const t=fr(r);return!!S(t)||(r=>Promise.resolve(r))(t).then(S)})),(r=>O(r,"send")&&d(r.send))(U)){const r=U;r.on&&r.on((t=>cr(t).then(lr).then((t=>t&&r.send(t)))))}function pr(r,t,e){return h(r)&&O(r,"stack")&&(r.stack=t.split("\n").reduce(((r,t)=>r.replace(t+"\n","")),""+r.stack)),V&&er(r),_(e,r,F||$(rr?r.stack:m))}async function dr(r,t=!1){t&&(r=[...r]);const e=await ur(r);return U.send(e)}const hr=async r=>{if(O(r,"method")){const t=(async r=>{if(n)await x();else if(w)return pr(w,"",r);let t="";try{const{params:e,method:n,id:o,remoteStack:s}=r,a=n.startsWith("rpc.")?Symbol.for(n):n,c=i&&i[a];if(!d(c))return H?P(o,-32601,"Method not found"):void(V&&nr("Missing method",a,r));const l=b(e)?e:[e];t=u(Error().stack);const f=new Promise((r=>r(c.apply(i,l))));if(Q)if(Y){const r=[`${N}.%c${n}%c(${l.map((()=>"%o")).join(", ")}%c)\n%o %c@${o}`,"color: #d2c057","",...l,"",f,"color: gray; font-style: italic;"];if(Z){const t=()=>{debugger;return c.apply(i,l)};t.toString=E,r.push(t)}s?(or(...r),tr(s),sr()):tr(...r)}else tr(`${N}.${n}(${""+[...l]}) @${o}`);if(await f===z)return;return((r,t)=>{const e={jsonrpc:k,id:r,result:t};return v(e,"id"),e})(o,await f)}catch(e){return pr(e,t,r)}})(r);if(O(r,"id"))return t;try{await t}catch(r){}return m}return(async r=>{let e="",n="",o=0,s=g;if(O(r,"error")){const t=r.error;e=t.message,o=t.code;const i=t.data;n=h(i)&&O(i,"stack")&&y(i.stack)?i.stack:"<remote stack not available>",s=h(i)&&O(i,"type")&&y(i.type)?i.type:g,X&&(Y?er(`${s}: ${e}(${o}) %c@${r.id}\n%c${n}`,"color: gray",""):er(`${s}: ${e}(${o}) @${r.id}\n${n}`))}if(null===r.id||r.id===m)return;const{f:[i,a]=[null,null],stack:u=""}=ar.get(r.id)||{};i&&a&&(ar.delete(r.id),O(r,"error")?a(((r,e,n,o)=>{try{const s=f();if(r.startsWith(l)&&s)return new s(e,r.slice(13));if(r in c){const t=new c[r](e);return t.stack=o,t.code=n,t}return new t(r,e,n,o)}catch(t){return Error(`E${n} ${r}: ${e}\n${o}`)}})(s,e,o,n+"\n аt AsyncCall (rpc) \n"+u)):i(r.result))})(r)},gr=(r,t,e,s=!1)=>new Promise(((c,l)=>{let f=m;if(r===C&&(f=t.shift(),r=t.shift()),"symbol"==typeof r){const t=Symbol.keyFor(r)||r.description;if(t){if(!t.startsWith("rpc."))throw new TypeError("Not start with rpc.");r=t}}else if(r.startsWith("rpc."))throw a(o,new TypeError);if(q&&!n&&y(r)){const e=i&&i[r];if(d(e))return c(e(...t))}const p=D();e=u(e);const g="by-name"===G&&1===t.length&&h(t[0])?t[0]:t,w=((r,t,e,n)=>{const o={jsonrpc:k,id:r,method:t,params:e,remoteStack:n};return v(o,"id"),((r,t)=>{r[t]||delete r[t]})(o,"remoteStack"),o})(s?m:p,r,g,rr?e:m);if(f?(f.push(w),f.r||(f.r=[()=>dr(f,!0),r=>((r,t)=>{for(const e of r)if(O(e,"id")){const r=ar.get(e.id);r&&r.f[1](t)}})(f,r)])):dr(w).catch(l),s)return c();ar.set(p,{f:[c,l],stack:e})})),mr={__proto__:new Proxy({},{get(r,t){const e={[t]:(...r)=>gr(t,r,Error().stack)}[t],n={[t]:(...r)=>gr(t,r,Error().stack,!0)}[t];return e[A]=n[A]=n,y(t)&&Object.defineProperty(mr,t,{value:e,configurable:!0}),e}})};return!1===B?mr.then=m:B===m&&Object.defineProperty(mr,"then",{configurable:!0,get(){ir(a(s,new TypeError("RPC used as Promise: ")))}}),new Proxy(mr,{getPrototypeOf:()=>null,setPrototypeOf:(r,t)=>null===t})}const J="rpc.async-iterator.",G=Symbol.for(J+"start"),q=Symbol.for(J+"next"),D=Symbol.for(J+"return"),F=Symbol.for(J+"throw");class L{__init(){this.d=!1}__init2(){this.c=async r=>(await H(r,(()=>this.d=!0)),r)}constructor(r,t){this.r=r,this.i=t,L.prototype.__init.call(this),L.prototype.__init2.call(this)}async return(r){return this.d?K(!0,r):this.c(this.r[D](await this.i,r))}async next(r){return this.d?K(!0):this.c(this.r[q](await this.i,r))}async throw(r){if(!this.d)return this.c(this.r[F](await this.i,r));throw r}}const U=async function*(){};w(L,U.constructor.prototype);const B=Object.getPrototypeOf(U());w(L.prototype,B);const H=async(r,t)=>{try{const e=await r;e&&e.done&&t()}catch(r){}},K=(r,t)=>({done:r,value:t});r.AsyncCall=W,r.AsyncGeneratorCall=(r,t)=>{const o=new Map,[s]=I(null==(i=t.strict)||i);var i;const{idGenerator:c=R}=t,l=(r,t)=>{const n=o.get(r);if(!n){if(s)throw a(e,Error(`Iterator ${r}, `));return z}const i=t(n);return H(i,(()=>o.delete(r))),i},u=W({async[G](t,e){const n=(await r)[t];if(!d(n)){if(s)throw new TypeError(t+" is not a function");return z}const i=n(...e),a=c();return o.set(a,i),a},[q]:(r,t)=>l(r,(r=>r.next(t))),[D]:(r,t)=>l(r,(r=>d(r.return)&&r.return(t))),[F]:(r,t)=>l(r,(r=>d(r.throw)&&r.throw(t)))},t),f={__proto__:new Proxy({},{get(r,t){if(!y(t))throw a(n,new TypeError(""));const e={[t]:(...r)=>{const e=u[G](t,r);return new L(u,e)}}[t];return Object.defineProperty(f,t,{value:e,configurable:!0}),e}})};return new Proxy(f,{getPrototypeOf:()=>null,setPrototypeOf:(r,t)=>null===t})},r.JSONSerialization=(r=[m,m],t,e="null")=>({serialization(n){if(e&&h(n)&&O(n,"result")&&n.result===m){const r={...n};r.result=null,"keep"===e&&(r.undef=!0),n=r}return JSON.stringify(n,r[0],t)},deserialization(t){const e=JSON.parse(t,r[1]);return h(e)&&O(e,"result")&&null===e.result&&O(e,"undef")&&!0===e.undef&&(e.result=m,delete e.undef),e}}),r.NoSerialization=j,r.batch=r=>{const t=[],e={__proto__:new Proxy({},{get(n,o){const s=(...e)=>r[C](t,o,...e);return(s[A]=(...e)=>r[C][A](t,o,...e))[A]=s[A],y(o)&&Object.defineProperty(e,o,{value:s,configurable:!0}),s}})};return[new Proxy(e,{getPrototypeOf:()=>null,setPrototypeOf:(r,t)=>null===t}),()=>{t.length&&t.r[0](),t.length=0},(r=Error("Aborted"))=>{t.length&&t.r[1](r),t.length=0}]},r.notify=r=>d(r)?r[A]:new Proxy(r,{get:N}),Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=full.min.js.map
{
"name": "async-call-rpc",
"packageManager": "pnpm@7.6.0",
"version": "6.1.1",
"version": "6.1.2",
"description": "A lightweight JSON RPC server & client",

@@ -6,0 +6,0 @@ "main": "out/base.js",

@@ -23,7 +23,7 @@ import { isString } from '../utils/constants'

export function batch<T extends object>(asyncCallInstance: T): [T, () => void, (error?: unknown) => void] {
let queue: BatchQueue = [] as any
return [
new Proxy({ __proto__: null } as any, {
get(cache, p) {
if (isString(p) && cache[p]) return cache[p]
const queue: BatchQueue = []
const getTrap = new Proxy(
{},
{
get(_, p) {
// @ts-ignore

@@ -37,13 +37,26 @@ const f = (...args: any) => asyncCallInstance[AsyncCallBatch](queue, p, ...args)

f[AsyncCallNotify][AsyncCallNotify] = f[AsyncCallNotify]
isString(p) && Object.defineProperty(cache, p, { value: f, configurable: true })
isString(p) && Object.defineProperty(methodContainer, p, { value: f, configurable: true })
return f
},
},
)
const methodContainer = { __proto__: getTrap } as any
return [
new Proxy(methodContainer, {
getPrototypeOf: () => null,
setPrototypeOf: (_, value) => value === null,
}),
(r = queue.r) => r && r[0](),
(error = new Error('Aborted'), r = queue.r) => {
r && r[1](error)
queue = []
() => {
queue.length && queue.r![0]()
queue.length = 0
},
(error = new Error('Aborted')) => {
queue.length && queue.r![1](error)
queue.length = 0
},
]
}
export type BatchQueue = Request[] & { r?: [() => void, (error?: unknown) => void] }
export type BatchQueue = Request[] & {
/** Request handler */
r?: [emit: () => void, reject: (error?: unknown) => void]
}

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

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

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

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