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

@dappworks/urpc

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dappworks/urpc - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

14

dist/index.d.ts

@@ -36,3 +36,3 @@ // Generated by dts-bundle-generator v9.5.1

set?: R extends () => infer U ? (value: ReturnType<T>) => U : never;
formConfig?: FormConfigType<ReturnType<T>>;
uiConfig?: FormConfigType<ReturnType<T>>;
}

@@ -54,3 +54,3 @@ export type URPC_Entity = URPC_Function<any, any> | URPC_Variable<any, any>;

value?: undefined;
formConfig?: undefined;
uiConfig?: undefined;
} | {

@@ -60,3 +60,3 @@ type: "var" | undefined;

value: any;
formConfig: FormConfigType<any> | undefined;
uiConfig: FormConfigType<any> | undefined;
input?: undefined;

@@ -68,3 +68,3 @@ } | {

value?: undefined;
formConfig?: undefined;
uiConfig?: undefined;
})[];

@@ -114,3 +114,3 @@ loadVars(): {

value?: undefined;
formConfig?: undefined;
uiConfig?: undefined;
} | {

@@ -120,3 +120,3 @@ type: "var" | undefined;

value: any;
formConfig: FormConfigType<any> | undefined;
uiConfig: FormConfigType<any> | undefined;
input?: undefined;

@@ -128,3 +128,3 @@ } | {

value?: undefined;
formConfig?: undefined;
uiConfig?: undefined;
})[]>;

@@ -131,0 +131,0 @@ loadVars(): Promise<{

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

var YR=Object.create;var{defineProperty:d,getPrototypeOf:wR,getOwnPropertyNames:qR}=Object;var KR=Object.prototype.hasOwnProperty;var p=(R,U,P)=>{P=R!=null?YR(wR(R)):{};const T=U||!R||!R.__esModule?d(P,"default",{value:R,enumerable:!0}):P;for(let _ of qR(R))if(!KR.call(T,_))d(T,_,{get:()=>R[_],enumerable:!0});return T};var g=(R,U)=>()=>(U||R((U={exports:{}}).exports,U),U.exports);var t=g((wP,l)=>{var nR=function(R,U){return R==null?void 0:R[U]},IR=function(R){var U=!1;if(R!=null&&typeof R.toString!="function")try{U=!!(R+"")}catch(P){}return U},$=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},kR=function(){this.__data__=Y?Y(null):{}},bR=function(R){return this.has(R)&&delete this.__data__[R]},hR=function(R){var U=this.__data__;if(Y){var P=U[R];return P===h?void 0:P}return E.call(U,R)?U[R]:void 0},yR=function(R){var U=this.__data__;return Y?U[R]!==void 0:E.call(U,R)},cR=function(R,U){var P=this.__data__;return P[R]=Y&&U===void 0?h:U,this},X=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},oR=function(){this.__data__=[]},rR=function(R){var U=this.__data__,P=A(U,R);if(P<0)return!1;var T=U.length-1;if(P==T)U.pop();else jR.call(U,P,1);return!0},sR=function(R){var U=this.__data__,P=A(U,R);return P<0?void 0:U[P][1]},vR=function(R){return A(this.__data__,R)>-1},uR=function(R,U){var P=this.__data__,T=A(P,R);if(T<0)P.push([R,U]);else P[T][1]=U;return this},B=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},lR=function(){this.__data__={hash:new $,map:new(iR||X),string:new $}},tR=function(R){return f(this,R).delete(R)},aR=function(R){return f(this,R).get(R)},eR=function(R){return f(this,R).has(R)},RU=function(R,U){return f(this,R).set(R,U),this},UU=function(R,U,P){var T=R[U];if(!(E.call(R,U)&&v(T,P))||P===void 0&&!(U in R))R[U]=P},A=function(R,U){var P=R.length;while(P--)if(v(R[P][0],U))return P;return-1},PU=function(R){if(!G(R)||QU(R))return!1;var U=VU(R)||IR(R)?gR:DR;return U.test(XU(R))},TU=function(R,U,P,T){if(!G(R))return R;U=$U(U,R)?[U]:ZU(U);var _=-1,Z=U.length,F=Z-1,W=R;while(W!=null&&++_<Z){var q=WU(U[_]),K=P;if(_!=F){var z=W[q];if(K=T?T(z,q,W):void 0,K===void 0)K=G(z)?z:FU(U[_+1])?[]:{}}UU(W,q,K),W=W[q]}return R},_U=function(R){if(typeof R=="string")return R;if(D(R))return b?b.call(R):"";var U=R+"";return U=="0"&&1/R==-y?"-0":U},ZU=function(R){return u(R)?R:JU(R)},f=function(R,U){var P=R.__data__;return BU(U)?P[typeof U=="string"?"string":"hash"]:P.map},s=function(R,U){var P=nR(R,U);return PU(P)?P:void 0},FU=function(R,U){return U=U==null?ER:U,!!U&&(typeof R=="number"||HR.test(R))&&(R>-1&&R%1==0&&R<U)},$U=function(R,U){if(u(R))return!1;var P=typeof R;if(P=="number"||P=="symbol"||P=="boolean"||R==null||D(R))return!0;return SR.test(R)||!OR.test(R)||U!=null&&R in Object(U)},BU=function(R){var U=typeof R;return U=="string"||U=="number"||U=="symbol"||U=="boolean"?R!=="__proto__":R===null},QU=function(R){return!!j&&j in R},WU=function(R){if(typeof R=="string"||D(R))return R;var U=R+"";return U=="0"&&1/R==-y?"-0":U},XU=function(R){if(R!=null){try{return o.call(R)}catch(U){}try{return R+""}catch(U){}}return""},M=function(R,U){if(typeof R!="function"||U&&typeof U!="function")throw new TypeError(GR);var P=function(){var T=arguments,_=U?U.apply(this,T):T[0],Z=P.cache;if(Z.has(_))return Z.get(_);var F=R.apply(this,T);return P.cache=Z.set(_,F),F};return P.cache=new(M.Cache||B),P},v=function(R,U){return R===U||R!==R&&U!==U},VU=function(R){var U=G(R)?r.call(R):"";return U==AR||U==fR},G=function(R){var U=typeof R;return!!R&&(U=="object"||U=="function")},YU=function(R){return!!R&&typeof R=="object"},D=function(R){return typeof R=="symbol"||YU(R)&&r.call(R)==LR},wU=function(R){return R==null?"":_U(R)},qU=function(R,U,P){return R==null?R:TU(R,U,P)},GR="Expected a function",h="__lodash_hash_undefined__",y=Infinity,ER=9007199254740991,AR="[object Function]",fR="[object GeneratorFunction]",LR="[object Symbol]",OR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SR=/^\w*$/,zR=/^\./,NR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,CR=/[\\^$.*+?()[\]{}|]/g,MR=/\\(\\)?/g,DR=/^\[object .+?Constructor\]$/,HR=/^(?:0|[1-9]\d*)$/,mR=typeof global=="object"&&global&&global.Object===Object&&global,xR=typeof self=="object"&&self&&self.Object===Object&&self,C=mR||xR||Function("return this")(),dR=Array.prototype,pR=Function.prototype,c=Object.prototype,N=C["__core-js_shared__"],j=function(){var R=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""}(),o=pR.toString,E=c.hasOwnProperty,r=c.toString,gR=RegExp("^"+o.call(E).replace(CR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),i=C.Symbol,jR=dR.splice,iR=s(C,"Map"),Y=s(Object,"create"),k=i?i.prototype:void 0,b=k?k.toString:void 0;$.prototype.clear=kR;$.prototype.delete=bR;$.prototype.get=hR;$.prototype.has=yR;$.prototype.set=cR;X.prototype.clear=oR;X.prototype.delete=rR;X.prototype.get=sR;X.prototype.has=vR;X.prototype.set=uR;B.prototype.clear=lR;B.prototype.delete=tR;B.prototype.get=aR;B.prototype.has=eR;B.prototype.set=RU;var JU=M(function(R){R=wU(R);var U=[];if(zR.test(R))U.push("");return R.replace(NR,function(P,T,_,Z){U.push(_?Z.replace(MR,"$1"):T||P)}),U});M.Cache=B;var u=Array.isArray;l.exports=qU});var XR=g((EP,WR)=>{var mU=function(R,U){return R==null?void 0:R[U]},xU=function(R){var U=!1;if(R!=null&&typeof R.toString!="function")try{U=!!(R+"")}catch(P){}return U},Q=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},jU=function(){this.__data__=w?w(null):{}},iU=function(R){return this.has(R)&&delete this.__data__[R]},kU=function(R){var U=this.__data__;if(w){var P=U[R];return P===TR?void 0:P}return x.call(U,R)?U[R]:void 0},bU=function(R){var U=this.__data__;return w?U[R]!==void 0:x.call(U,R)},hU=function(R,U){var P=this.__data__;return P[R]=w&&U===void 0?TR:U,this},V=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},yU=function(){this.__data__=[]},cU=function(R){var U=this.__data__,P=O(U,R);if(P<0)return!1;var T=U.length-1;if(P==T)U.pop();else pU.call(U,P,1);return!0},oU=function(R){var U=this.__data__,P=O(U,R);return P<0?void 0:U[P][1]},rU=function(R){return O(this.__data__,R)>-1},sU=function(R,U){var P=this.__data__,T=O(P,R);if(T<0)P.push([R,U]);else P[T][1]=U;return this},J=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},vU=function(){this.__data__={hash:new Q,map:new(gU||V),string:new Q}},uU=function(R){return S(this,R).delete(R)},lU=function(R){return S(this,R).get(R)},tU=function(R){return S(this,R).has(R)},aU=function(R,U){return S(this,R).set(R,U),this},O=function(R,U){var P=R.length;while(P--)if(QP(R[P][0],U))return P;return-1},eU=function(R,U){U=TP(U,R)?[U]:PP(U);var P=0,T=U.length;while(R!=null&&P<T)R=R[$P(U[P++])];return P&&P==T?R:void 0},RP=function(R){if(!JR(R)||ZP(R))return!1;var U=JP(R)||xU(R)?dU:MU;return U.test(BP(R))},UP=function(R){if(typeof R=="string")return R;if(I(R))return PR?PR.call(R):"";var U=R+"";return U=="0"&&1/R==-_R?"-0":U},PP=function(R){return QR(R)?R:FP(R)},S=function(R,U){var P=R.__data__;return _P(U)?P[typeof U=="string"?"string":"hash"]:P.map},BR=function(R,U){var P=mU(R,U);return RP(P)?P:void 0},TP=function(R,U){if(QR(R))return!1;var P=typeof R;if(P=="number"||P=="symbol"||P=="boolean"||R==null||I(R))return!0;return OU.test(R)||!LU.test(R)||U!=null&&R in Object(U)},_P=function(R){var U=typeof R;return U=="string"||U=="number"||U=="symbol"||U=="boolean"?R!=="__proto__":R===null},ZP=function(R){return!!e&&e in R},$P=function(R){if(typeof R=="string"||I(R))return R;var U=R+"";return U=="0"&&1/R==-_R?"-0":U},BP=function(R){if(R!=null){try{return FR.call(R)}catch(U){}try{return R+""}catch(U){}}return""},n=function(R,U){if(typeof R!="function"||U&&typeof U!="function")throw new TypeError(GU);var P=function(){var T=arguments,_=U?U.apply(this,T):T[0],Z=P.cache;if(Z.has(_))return Z.get(_);var F=R.apply(this,T);return P.cache=Z.set(_,F),F};return P.cache=new(n.Cache||J),P},QP=function(R,U){return R===U||R!==R&&U!==U},JP=function(R){var U=JR(R)?$R.call(R):"";return U==EU||U==AU},JR=function(R){var U=typeof R;return!!R&&(U=="object"||U=="function")},WP=function(R){return!!R&&typeof R=="object"},I=function(R){return typeof R=="symbol"||WP(R)&&$R.call(R)==fU},XP=function(R){return R==null?"":UP(R)},VP=function(R,U,P){var T=R==null?void 0:eU(R,U);return T===void 0?P:T},GU="Expected a function",TR="__lodash_hash_undefined__",_R=Infinity,EU="[object Function]",AU="[object GeneratorFunction]",fU="[object Symbol]",LU=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OU=/^\w*$/,SU=/^\./,zU=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,NU=/[\\^$.*+?()[\]{}|]/g,CU=/\\(\\)?/g,MU=/^\[object .+?Constructor\]$/,DU=typeof global=="object"&&global&&global.Object===Object&&global,HU=typeof self=="object"&&self&&self.Object===Object&&self,m=DU||HU||Function("return this")(),nU=Array.prototype,IU=Function.prototype,ZR=Object.prototype,H=m["__core-js_shared__"],e=function(){var R=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""}(),FR=IU.toString,x=ZR.hasOwnProperty,$R=ZR.toString,dU=RegExp("^"+FR.call(x).replace(NU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),RR=m.Symbol,pU=nU.splice,gU=BR(m,"Map"),w=BR(Object,"create"),UR=RR?RR.prototype:void 0,PR=UR?UR.toString:void 0;Q.prototype.clear=jU;Q.prototype.delete=iU;Q.prototype.get=kU;Q.prototype.has=bU;Q.prototype.set=hU;V.prototype.clear=yU;V.prototype.delete=cU;V.prototype.get=oU;V.prototype.has=rU;V.prototype.set=sU;J.prototype.clear=vU;J.prototype.delete=uU;J.prototype.get=lU;J.prototype.has=tU;J.prototype.set=aU;var FP=n(function(R){R=XP(R);var U=[];if(SU.test(R))U.push("");return R.replace(zU,function(P,T,_,Z){U.push(_?Z.replace(CU,"$1"):T||P)}),U});n.Cache=J;var QR=Array.isArray;WR.exports=VP});var a=p(t(),1),L={isNamespace:(R)=>R&&!R.type,flattenSchema(R,U){return Object.entries(R).reduce((P,[T,_])=>{if(L.isNamespace(_))P={...P,...L.flattenSchema(_,T)};else{const Z=U?`${U}.${T}`:T;Object.assign(_,{name:Z}),P[Z]=_}return P},{})},wrapSchema(R){return Object.values(R).reduce((U,P)=>{return a.default(U,P.path,P),U},{})}};class KU{schemas;falttenSchema;static Var(R){return{...R,type:"var"}}static Func(R){return{...R,type:"func"}}constructor(R={}){Object.assign(this,R),this.falttenSchema=L.flattenSchema(this.schemas)}loadFull(){return Object.entries(this.falttenSchema).map(([R,U])=>{if(U.type=="func"){const{type:P,input:T,name:_}=U;return{type:P,name:_,input:T}}if(U.type=="var"){const{type:P,get:T,name:_,formConfig:Z}=U;return{type:P,name:_,value:T(),formConfig:Z}}return{type:"unknown",name:R}})}loadVars(){return Object.entries(this.falttenSchema).filter(([R,U])=>U.type=="var").map(([R,U])=>{const{get:P,name:T}=U;return{name:T,value:P()}})}}var VR=p(XR(),1),AP=(R)=>{return{schema:{async loadFull(){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"schema.loadFull"})}).then((U)=>U.json())},async loadVars(){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"schema.loadVars"})}).then((U)=>U.json())}},func:{async call(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"func.call",params:U})}).then((P)=>P.json())}},var:{async set(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"var.set",params:U})}).then((P)=>P.json())},async patch(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"var.patch",params:U})}).then((P)=>P.json())}}}},fP=({urpc:R})=>{const U={urpc:R,handle({name:P,params:T}){const _=VR.default(U,P);if(!_)throw new Error("invalid name");return _(T)},schema:{async loadFull(){return R.loadFull()},async loadVars(){return R.loadVars()}},func:{async call(P){const T=R.falttenSchema[P.method];if(!T)throw new Error("invalid func name");return T.func({input:P.input})}},var:{async set(P){const T=R.falttenSchema[P.name];if(!T)throw new Error("invalid var name");if(!T.set)throw new Error("variable can't be set");return T.set(P.value)},async patch(P){throw new Error("TBD")}}};return U};export{L as utils,AP as createSimpleHttpClient,fP as createServerClient,KU as URPC};
var YR=Object.create;var{defineProperty:d,getPrototypeOf:wR,getOwnPropertyNames:qR}=Object;var KR=Object.prototype.hasOwnProperty;var p=(R,U,P)=>{P=R!=null?YR(wR(R)):{};const T=U||!R||!R.__esModule?d(P,"default",{value:R,enumerable:!0}):P;for(let _ of qR(R))if(!KR.call(T,_))d(T,_,{get:()=>R[_],enumerable:!0});return T};var g=(R,U)=>()=>(U||R((U={exports:{}}).exports,U),U.exports);var t=g((wP,l)=>{var nR=function(R,U){return R==null?void 0:R[U]},IR=function(R){var U=!1;if(R!=null&&typeof R.toString!="function")try{U=!!(R+"")}catch(P){}return U},$=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},kR=function(){this.__data__=Y?Y(null):{}},bR=function(R){return this.has(R)&&delete this.__data__[R]},hR=function(R){var U=this.__data__;if(Y){var P=U[R];return P===h?void 0:P}return E.call(U,R)?U[R]:void 0},yR=function(R){var U=this.__data__;return Y?U[R]!==void 0:E.call(U,R)},cR=function(R,U){var P=this.__data__;return P[R]=Y&&U===void 0?h:U,this},X=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},oR=function(){this.__data__=[]},rR=function(R){var U=this.__data__,P=A(U,R);if(P<0)return!1;var T=U.length-1;if(P==T)U.pop();else jR.call(U,P,1);return!0},sR=function(R){var U=this.__data__,P=A(U,R);return P<0?void 0:U[P][1]},vR=function(R){return A(this.__data__,R)>-1},uR=function(R,U){var P=this.__data__,T=A(P,R);if(T<0)P.push([R,U]);else P[T][1]=U;return this},B=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},lR=function(){this.__data__={hash:new $,map:new(iR||X),string:new $}},tR=function(R){return L(this,R).delete(R)},aR=function(R){return L(this,R).get(R)},eR=function(R){return L(this,R).has(R)},RU=function(R,U){return L(this,R).set(R,U),this},UU=function(R,U,P){var T=R[U];if(!(E.call(R,U)&&v(T,P))||P===void 0&&!(U in R))R[U]=P},A=function(R,U){var P=R.length;while(P--)if(v(R[P][0],U))return P;return-1},PU=function(R){if(!G(R)||QU(R))return!1;var U=VU(R)||IR(R)?gR:DR;return U.test(XU(R))},TU=function(R,U,P,T){if(!G(R))return R;U=$U(U,R)?[U]:ZU(U);var _=-1,Z=U.length,F=Z-1,W=R;while(W!=null&&++_<Z){var q=WU(U[_]),K=P;if(_!=F){var z=W[q];if(K=T?T(z,q,W):void 0,K===void 0)K=G(z)?z:FU(U[_+1])?[]:{}}UU(W,q,K),W=W[q]}return R},_U=function(R){if(typeof R=="string")return R;if(D(R))return b?b.call(R):"";var U=R+"";return U=="0"&&1/R==-y?"-0":U},ZU=function(R){return u(R)?R:JU(R)},L=function(R,U){var P=R.__data__;return BU(U)?P[typeof U=="string"?"string":"hash"]:P.map},s=function(R,U){var P=nR(R,U);return PU(P)?P:void 0},FU=function(R,U){return U=U==null?ER:U,!!U&&(typeof R=="number"||HR.test(R))&&(R>-1&&R%1==0&&R<U)},$U=function(R,U){if(u(R))return!1;var P=typeof R;if(P=="number"||P=="symbol"||P=="boolean"||R==null||D(R))return!0;return SR.test(R)||!OR.test(R)||U!=null&&R in Object(U)},BU=function(R){var U=typeof R;return U=="string"||U=="number"||U=="symbol"||U=="boolean"?R!=="__proto__":R===null},QU=function(R){return!!j&&j in R},WU=function(R){if(typeof R=="string"||D(R))return R;var U=R+"";return U=="0"&&1/R==-y?"-0":U},XU=function(R){if(R!=null){try{return o.call(R)}catch(U){}try{return R+""}catch(U){}}return""},M=function(R,U){if(typeof R!="function"||U&&typeof U!="function")throw new TypeError(GR);var P=function(){var T=arguments,_=U?U.apply(this,T):T[0],Z=P.cache;if(Z.has(_))return Z.get(_);var F=R.apply(this,T);return P.cache=Z.set(_,F),F};return P.cache=new(M.Cache||B),P},v=function(R,U){return R===U||R!==R&&U!==U},VU=function(R){var U=G(R)?r.call(R):"";return U==AR||U==LR},G=function(R){var U=typeof R;return!!R&&(U=="object"||U=="function")},YU=function(R){return!!R&&typeof R=="object"},D=function(R){return typeof R=="symbol"||YU(R)&&r.call(R)==fR},wU=function(R){return R==null?"":_U(R)},qU=function(R,U,P){return R==null?R:TU(R,U,P)},GR="Expected a function",h="__lodash_hash_undefined__",y=Infinity,ER=9007199254740991,AR="[object Function]",LR="[object GeneratorFunction]",fR="[object Symbol]",OR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SR=/^\w*$/,zR=/^\./,NR=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,CR=/[\\^$.*+?()[\]{}|]/g,MR=/\\(\\)?/g,DR=/^\[object .+?Constructor\]$/,HR=/^(?:0|[1-9]\d*)$/,xR=typeof global=="object"&&global&&global.Object===Object&&global,mR=typeof self=="object"&&self&&self.Object===Object&&self,C=xR||mR||Function("return this")(),dR=Array.prototype,pR=Function.prototype,c=Object.prototype,N=C["__core-js_shared__"],j=function(){var R=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""}(),o=pR.toString,E=c.hasOwnProperty,r=c.toString,gR=RegExp("^"+o.call(E).replace(CR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),i=C.Symbol,jR=dR.splice,iR=s(C,"Map"),Y=s(Object,"create"),k=i?i.prototype:void 0,b=k?k.toString:void 0;$.prototype.clear=kR;$.prototype.delete=bR;$.prototype.get=hR;$.prototype.has=yR;$.prototype.set=cR;X.prototype.clear=oR;X.prototype.delete=rR;X.prototype.get=sR;X.prototype.has=vR;X.prototype.set=uR;B.prototype.clear=lR;B.prototype.delete=tR;B.prototype.get=aR;B.prototype.has=eR;B.prototype.set=RU;var JU=M(function(R){R=wU(R);var U=[];if(zR.test(R))U.push("");return R.replace(NR,function(P,T,_,Z){U.push(_?Z.replace(MR,"$1"):T||P)}),U});M.Cache=B;var u=Array.isArray;l.exports=qU});var XR=g((EP,WR)=>{var xU=function(R,U){return R==null?void 0:R[U]},mU=function(R){var U=!1;if(R!=null&&typeof R.toString!="function")try{U=!!(R+"")}catch(P){}return U},Q=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},jU=function(){this.__data__=w?w(null):{}},iU=function(R){return this.has(R)&&delete this.__data__[R]},kU=function(R){var U=this.__data__;if(w){var P=U[R];return P===TR?void 0:P}return m.call(U,R)?U[R]:void 0},bU=function(R){var U=this.__data__;return w?U[R]!==void 0:m.call(U,R)},hU=function(R,U){var P=this.__data__;return P[R]=w&&U===void 0?TR:U,this},V=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},yU=function(){this.__data__=[]},cU=function(R){var U=this.__data__,P=O(U,R);if(P<0)return!1;var T=U.length-1;if(P==T)U.pop();else pU.call(U,P,1);return!0},oU=function(R){var U=this.__data__,P=O(U,R);return P<0?void 0:U[P][1]},rU=function(R){return O(this.__data__,R)>-1},sU=function(R,U){var P=this.__data__,T=O(P,R);if(T<0)P.push([R,U]);else P[T][1]=U;return this},J=function(R){var U=-1,P=R?R.length:0;this.clear();while(++U<P){var T=R[U];this.set(T[0],T[1])}},vU=function(){this.__data__={hash:new Q,map:new(gU||V),string:new Q}},uU=function(R){return S(this,R).delete(R)},lU=function(R){return S(this,R).get(R)},tU=function(R){return S(this,R).has(R)},aU=function(R,U){return S(this,R).set(R,U),this},O=function(R,U){var P=R.length;while(P--)if(QP(R[P][0],U))return P;return-1},eU=function(R,U){U=TP(U,R)?[U]:PP(U);var P=0,T=U.length;while(R!=null&&P<T)R=R[$P(U[P++])];return P&&P==T?R:void 0},RP=function(R){if(!JR(R)||ZP(R))return!1;var U=JP(R)||mU(R)?dU:MU;return U.test(BP(R))},UP=function(R){if(typeof R=="string")return R;if(I(R))return PR?PR.call(R):"";var U=R+"";return U=="0"&&1/R==-_R?"-0":U},PP=function(R){return QR(R)?R:FP(R)},S=function(R,U){var P=R.__data__;return _P(U)?P[typeof U=="string"?"string":"hash"]:P.map},BR=function(R,U){var P=xU(R,U);return RP(P)?P:void 0},TP=function(R,U){if(QR(R))return!1;var P=typeof R;if(P=="number"||P=="symbol"||P=="boolean"||R==null||I(R))return!0;return OU.test(R)||!fU.test(R)||U!=null&&R in Object(U)},_P=function(R){var U=typeof R;return U=="string"||U=="number"||U=="symbol"||U=="boolean"?R!=="__proto__":R===null},ZP=function(R){return!!e&&e in R},$P=function(R){if(typeof R=="string"||I(R))return R;var U=R+"";return U=="0"&&1/R==-_R?"-0":U},BP=function(R){if(R!=null){try{return FR.call(R)}catch(U){}try{return R+""}catch(U){}}return""},n=function(R,U){if(typeof R!="function"||U&&typeof U!="function")throw new TypeError(GU);var P=function(){var T=arguments,_=U?U.apply(this,T):T[0],Z=P.cache;if(Z.has(_))return Z.get(_);var F=R.apply(this,T);return P.cache=Z.set(_,F),F};return P.cache=new(n.Cache||J),P},QP=function(R,U){return R===U||R!==R&&U!==U},JP=function(R){var U=JR(R)?$R.call(R):"";return U==EU||U==AU},JR=function(R){var U=typeof R;return!!R&&(U=="object"||U=="function")},WP=function(R){return!!R&&typeof R=="object"},I=function(R){return typeof R=="symbol"||WP(R)&&$R.call(R)==LU},XP=function(R){return R==null?"":UP(R)},VP=function(R,U,P){var T=R==null?void 0:eU(R,U);return T===void 0?P:T},GU="Expected a function",TR="__lodash_hash_undefined__",_R=Infinity,EU="[object Function]",AU="[object GeneratorFunction]",LU="[object Symbol]",fU=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OU=/^\w*$/,SU=/^\./,zU=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,NU=/[\\^$.*+?()[\]{}|]/g,CU=/\\(\\)?/g,MU=/^\[object .+?Constructor\]$/,DU=typeof global=="object"&&global&&global.Object===Object&&global,HU=typeof self=="object"&&self&&self.Object===Object&&self,x=DU||HU||Function("return this")(),nU=Array.prototype,IU=Function.prototype,ZR=Object.prototype,H=x["__core-js_shared__"],e=function(){var R=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""}(),FR=IU.toString,m=ZR.hasOwnProperty,$R=ZR.toString,dU=RegExp("^"+FR.call(m).replace(NU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),RR=x.Symbol,pU=nU.splice,gU=BR(x,"Map"),w=BR(Object,"create"),UR=RR?RR.prototype:void 0,PR=UR?UR.toString:void 0;Q.prototype.clear=jU;Q.prototype.delete=iU;Q.prototype.get=kU;Q.prototype.has=bU;Q.prototype.set=hU;V.prototype.clear=yU;V.prototype.delete=cU;V.prototype.get=oU;V.prototype.has=rU;V.prototype.set=sU;J.prototype.clear=vU;J.prototype.delete=uU;J.prototype.get=lU;J.prototype.has=tU;J.prototype.set=aU;var FP=n(function(R){R=XP(R);var U=[];if(SU.test(R))U.push("");return R.replace(zU,function(P,T,_,Z){U.push(_?Z.replace(CU,"$1"):T||P)}),U});n.Cache=J;var QR=Array.isArray;WR.exports=VP});var a=p(t(),1),f={isNamespace:(R)=>R&&!R.type,flattenSchema(R,U){return Object.entries(R).reduce((P,[T,_])=>{if(f.isNamespace(_))P={...P,...f.flattenSchema(_,T)};else{const Z=U?`${U}.${T}`:T;Object.assign(_,{name:Z}),P[Z]=_}return P},{})},wrapSchema(R){return Object.values(R).reduce((U,P)=>{return a.default(U,P.path,P),U},{})}};class KU{schemas;falttenSchema;static Var(R){return{...R,type:"var"}}static Func(R){return{...R,type:"func"}}constructor(R={}){Object.assign(this,R),this.falttenSchema=f.flattenSchema(this.schemas)}loadFull(){return Object.entries(this.falttenSchema).map(([R,U])=>{if(U.type=="func"){const{type:P,input:T,name:_}=U;return{type:P,name:_,input:T}}if(U.type=="var"){const{type:P,get:T,name:_,uiConfig:Z}=U;return{type:P,name:_,value:T(),uiConfig:Z}}return{type:"unknown",name:R}})}loadVars(){return Object.entries(this.falttenSchema).filter(([R,U])=>U.type=="var").map(([R,U])=>{const{get:P,name:T}=U;return{name:T,value:P()}})}}var VR=p(XR(),1),AP=(R)=>{return{schema:{async loadFull(){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"schema.loadFull"})}).then((U)=>U.json())},async loadVars(){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"schema.loadVars"})}).then((U)=>U.json())}},func:{async call(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"func.call",params:U})}).then((P)=>P.json())}},var:{async set(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"var.set",params:U})}).then((P)=>P.json())},async patch(U){return fetch(`${R.url}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"var.patch",params:U})}).then((P)=>P.json())}}}},LP=({urpc:R})=>{const U={urpc:R,handle({name:P,params:T}){const _=VR.default(U,P);if(!_)throw new Error("invalid name");return _(T)},schema:{async loadFull(){return R.loadFull()},async loadVars(){return R.loadVars()}},func:{async call(P){const T=R.falttenSchema[P.method];if(!T)throw new Error("invalid func name");return T.func({input:P.input})}},var:{async set(P){const T=R.falttenSchema[P.name];if(!T)throw new Error("invalid var name");if(!T.set)throw new Error("variable can't be set");return T.set(P.value)},async patch(P){throw new Error("TBD")}}};return U};export{f as utils,AP as createSimpleHttpClient,LP as createServerClient,KU as URPC};
{
"name": "@dappworks/urpc",
"version": "0.0.7",
"version": "0.0.8",
"module": "index.ts",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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