From c04ad79922409468be80b5cdab5c569acb293963 Mon Sep 17 00:00:00 2001 From: joelchu Date: Wed, 4 Mar 2020 10:12:55 +0800 Subject: [PATCH 1/4] add koa-router dev deps for another test later --- packages/koa/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/koa/package.json b/packages/koa/package.json index 026a8a48..7e473d07 100644 --- a/packages/koa/package.json +++ b/packages/koa/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-koa", - "version": "1.6.2", + "version": "1.6.3", "description": "jsonql Koa middleware", "main": "main.js", "module": "index.js", @@ -84,7 +84,7 @@ "jsonql-jwt": "^1.3.8", "jsonql-node-client": "^1.3.0", "jsonql-params-validator": "^1.5.2", - "jsonql-resolver": "^1.0.9", + "jsonql-resolver": "^1.1.0", "jsonql-utils": "^0.9.7", "jsonql-web-console": "^0.4.5", "koa-compose": "^4.1.0", @@ -92,10 +92,11 @@ }, "devDependencies": { "ava": "^3.5.0", - "jsonql-ws-server": "^1.5.3", + "jsonql-ws-server": "^1.6.0", "jwt-decode": "^2.2.0", "koa": "^2.11.0", "koa-bodyparser": "^4.2.1", + "koa-router": "^8.0.8", "nb-split-tasks": "^0.6.0", "nyc": "^15.0.0", "request": "^2.88.2", -- Gitee From 564bd8725e6c937a7a3a75637fdaff5c169a5664 Mon Sep 17 00:00:00 2001 From: joelchu Date: Wed, 4 Mar 2020 10:25:30 +0800 Subject: [PATCH 2/4] get rip of the config related methods from main export --- packages/utils/browser.js | 2 +- packages/utils/index.js | 6 ---- packages/utils/main.js | 2 +- packages/utils/main.js.map | 2 +- packages/utils/module.js | 5 +-- packages/utils/package.json | 34 ++++++++++--------- packages/utils/src/node-middleware.js | 21 ++++++------ .../utils/src/{ => old}/pre-config-check.js | 6 ++-- packages/ws-server-core/package.json | 2 +- 9 files changed, 37 insertions(+), 43 deletions(-) rename packages/utils/src/{ => old}/pre-config-check.js (93%) diff --git a/packages/utils/browser.js b/packages/utils/browser.js index 09c19290..6be14f06 100644 --- a/packages/utils/browser.js +++ b/packages/utils/browser.js @@ -1,2 +1,2 @@ -!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).jsonqlUtils={})}(this,(function(t){"use strict";var r=Array.isArray,e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n="object"==typeof e&&e&&e.Object===Object&&e,o="object"==typeof self&&self&&self.Object===Object&&self,u=n||o||Function("return this")(),i=u.Symbol,a=Object.prototype,c=a.hasOwnProperty,f=a.toString,s=i?i.toStringTag:void 0;var l=Object.prototype.toString;var p="[object Null]",v="[object Undefined]",d=i?i.toStringTag:void 0;function y(t){return null==t?void 0===t?v:p:d&&d in Object(t)?function(t){var r=c.call(t,s),e=t[s];try{t[s]=void 0;var n=!0}catch(t){}var o=f.call(t);return n&&(r?t[s]=e:delete t[s]),o}(t):function(t){return l.call(t)}(t)}var h,g,b=(h=Object.getPrototypeOf,g=Object,function(t){return h(g(t))});function _(t){return null!=t&&"object"==typeof t}var j="[object Object]",m=Function.prototype,O=Object.prototype,w=m.toString,P=O.hasOwnProperty,S=w.call(Object);function A(t){if(!_(t)||y(t)!=j)return!1;var r=b(t);if(null===r)return!0;var e=P.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&w.call(e)==S}var N="[object Symbol]";var k=1/0,z=i?i.prototype:void 0,F=z?z.toString:void 0;function E(t){if("string"==typeof t)return t;if(r(t))return function(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e=n?t:function(t,r,e){var n=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(e=e>o?o:e)<0&&(e+=o),o=r>e?0:e-r>>>0,r>>>=0;for(var u=Array(o);++n-1;);return e}(o,u),function(t,r){for(var e=t.length;e--&&C(r,t[e],0)>-1;);return e}(o,u)+1).join("")}var K=function(t,r){return!!t.filter((function(t){return t===r})).length},W=function(t){return r(t)?t:[t]},Z=function(t,r){try{var e=Object.keys(t);return K(e,r)}catch(t){return!1}},X=function(t){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return r.reduce((function(t,r){return Reflect.apply(r,null,W(t))}),Reflect.apply(t,null,e))}};function Y(t,r){return t===r||t!=t&&r!=r}function tt(t,r){for(var e=t.length;e--;)if(Y(t[e][0],r))return e;return-1}var rt=Array.prototype.splice;function et(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},et.prototype.set=function(t,r){var e=this.__data__,n=tt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};var ot="[object AsyncFunction]",ut="[object Function]",it="[object GeneratorFunction]",at="[object Proxy]";function ct(t){if(!nt(t))return!1;var r=y(t);return r==ut||r==it||r==ot||r==at}var ft,st=u["__core-js_shared__"],lt=(ft=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||""))?"Symbol(src)_1."+ft:"";var pt=Function.prototype.toString;var vt=/^\[object .+?Constructor\]$/,dt=Function.prototype,yt=Object.prototype,ht=dt.toString,gt=yt.hasOwnProperty,bt=RegExp("^"+ht.call(gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _t(t){return!(!nt(t)||function(t){return!!lt&< in t}(t))&&(ct(t)?bt:vt).test(function(t){if(null!=t){try{return pt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function jt(t,r){var e=function(t,r){return null==t?void 0:t[r]}(t,r);return _t(e)?e:void 0}var mt=jt(u,"Map"),Ot=jt(Object,"create");var wt="__lodash_hash_undefined__",Pt=Object.prototype.hasOwnProperty;var St=Object.prototype.hasOwnProperty;var At="__lodash_hash_undefined__";function Nt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=Yt}function rr(t){return null!=t&&tr(t.length)&&!ct(t)}var er="object"==typeof t&&t&&!t.nodeType&&t,nr=er&&"object"==typeof module&&module&&!module.nodeType&&module,or=nr&&nr.exports===er?u.Buffer:void 0,ur=(or?or.isBuffer:void 0)||function(){return!1},ir={};ir["[object Float32Array]"]=ir["[object Float64Array]"]=ir["[object Int8Array]"]=ir["[object Int16Array]"]=ir["[object Int32Array]"]=ir["[object Uint8Array]"]=ir["[object Uint8ClampedArray]"]=ir["[object Uint16Array]"]=ir["[object Uint32Array]"]=!0,ir["[object Arguments]"]=ir["[object Array]"]=ir["[object ArrayBuffer]"]=ir["[object Boolean]"]=ir["[object DataView]"]=ir["[object Date]"]=ir["[object Error]"]=ir["[object Function]"]=ir["[object Map]"]=ir["[object Number]"]=ir["[object Object]"]=ir["[object RegExp]"]=ir["[object Set]"]=ir["[object String]"]=ir["[object WeakMap]"]=!1;var ar="object"==typeof t&&t&&!t.nodeType&&t,cr=ar&&"object"==typeof module&&module&&!module.nodeType&&module,fr=cr&&cr.exports===ar&&n.process,sr=function(){try{var t=cr&&cr.require&&cr.require("util").types;return t||fr&&fr.binding&&fr.binding("util")}catch(t){}}(),lr=sr&&sr.isTypedArray,pr=lr?function(t){return function(r){return t(r)}}(lr):function(t){return _(t)&&tr(t.length)&&!!ir[y(t)]};function vr(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]}var dr=Object.prototype.hasOwnProperty;function yr(t,r,e){var n=t[r];dr.call(t,r)&&Y(n,e)&&(void 0!==e||r in t)||Tt(t,r,e)}var hr=9007199254740991,gr=/^(?:0|[1-9]\d*)$/;function br(t,r){var e=typeof t;return!!(r=null==r?hr:r)&&("number"==e||"symbol"!=e&&gr.test(t))&&t>-1&&t%1==0&&t0){if(++r>=Er)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(Fr);function Rr(t,r){return Cr(function(t,r,e){return r=zr(void 0===r?t.length-1:r,0),function(){for(var n=arguments,o=-1,u=zr(n.length-r,0),i=Array(u);++o1?r[n-1]:void 0,u=n>2?r[2]:void 0;for(o=Jr.length>3&&"function"==typeof o?(n--,o):void 0,u&&function(t,r,e){if(!nt(e))return!1;var n=typeof r;return!!("number"==n?rr(e)&&br(r,e.length):"string"==n&&r in e)&&Y(e[r],t)}(r[0],r[1],u)&&(o=n<3?void 0:o,n=1),t=Object(t);++e0;)e[n]=arguments[n+2];e.push((function(t){return qr(t,Kr,te())}));var o=Reflect.apply(X,null,e);return function(e){return void 0===e&&(e={}),o(e,t,r)}}t.VERSION="0.9.7",t.cacheBurst=ee,t.cacheBurstUrl=function(t){return re(t,ee())},t.chainFns=X,t.chainProcessPromises=function(t){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return r.reduce((function(t,r){return t.then((function(t){return r(t)}))}),Reflect.apply(t,null,e))}},t.chainPromises=function(t,r){return void 0===r&&(r=!1),t.reduce((function(t,e){return t.then((function(t){return e.then((function(e){return!1===r?t.concat([e]):Mr(t,e)}))}))}),Promise.resolve(!1===r?[]:A(r)?r:{}))},t.createEvt=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t.join("_")},t.createMutation=se,t.createMutationStr=function(t,r,e,n){return void 0===e&&(e={}),void 0===n&&(n=!1),JSON.stringify(se(t,r,e,n))},t.createQuery=fe,t.createQueryStr=function(t,r,e){return void 0===r&&(r=[]),void 0===e&&(e=!1),JSON.stringify(fe(t,r,e))},t.dasherize=function(t){return L(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},t.extractArgsFromPayload=function(t,r){switch(r){case Br:return t[Gr];case $r:return[t[Ir],t[Qr]];default:throw new Xr("Unknown "+r+" to extract argument from!")}},t.extractParamsFromContract=function(t,r,e){try{var n=t[r][e];if(!n)throw new Wr(e,r);return n}catch(t){throw new Wr(e,t)}},t.extractSocketPart=Yr,t.formatPayload=ie,t.getCallMethod=function(t){switch(!0){case t===Lr[0]:return Br;case t===Lr[1]:return $r;default:return!1}},t.getConfigValue=function(t,r){return r&&A(r)&&t in r?r[t]:void 0},t.getMutationFromArgs=ve,t.getMutationFromPayload=function(t){var r=pe(t,ve);if(!1!==r)return r;throw new Zr("[getMutationArgs] Payload is malformed!",t)},t.getNameFromPayload=ae,t.getNamespaceInOrder=function(t,r){var e=[];for(var n in t)n===r?e[1]=n:e[0]=n;return e},t.getQueryFromArgs=le,t.getQueryFromPayload=function(t){var r=pe(t,le);if(!1!==r)return r;throw new Zr("[getQueryArgs] Payload is malformed!",t)},t.groupByNamespace=function(t,r){void 0===r&&(r=!1);var e=Yr(t);if(!1===e){if(r)return t;throw new Xr("socket not found in contract!")}var n,o={},u=0;for(var i in e){var a=e[i],c=a.namespace;c&&(o[c]||(++u,o[c]={}),o[c][i]=a,n||a.public&&(n=c))}return{size:u,nspSet:o,publicNamespace:n}},t.inArray=K,t.injectToFn=qr,t.isContract=function(t){return!!function(t){return A(t)&&(Z(t,Br)||Z(t,$r)||Z(t,Dr))}(t)&&t},t.isFunc=function(t){if("function"==typeof t)return!0;console.error("Expect to be Function type! Got "+typeof t)},t.isJsonqlErrorObj=de,t.isNotEmpty=function(t){return void 0!==t&&!1!==t&&null!==t&&""!==L(t)},t.isObjectHasKey=Z,t.logger=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];try{window&&window.DEBUG&&Reflect.apply(console.log,console,t)}catch(t){}},t.objDefineProps=function(t,r,e,n){return void 0===n&&(n=null),void 0===Object.getOwnPropertyDescriptor(t,r)&&Object.defineProperty(t,r,{set:e,get:null===n?function(){return null}:n}),t},t.objHasProp=Ur,t.packError=function(t,r,e,n){var o;void 0===r&&(r="JsonqlError"),void 0===e&&(e=0),void 0===n&&(n="");var u={detail:t,className:r,statusCode:e,message:n};return JSON.stringify(((o={}).error=de(t)||u,o[Hr]=te(),o))},t.packResult=function(t,e){void 0===e&&(e=!1);var n={};return n.data=t,e&&r(e)&&(e.push(te()),n[Hr]=e),JSON.stringify(n)},t.postConfigCheck=function(t,r){for(var e=[],n=arguments.length-2;n-- >0;)e[n]=arguments[n+2];return function(n){var o;if(void 0===n&&(n={}),Ur(n,Kr)){var u=1;return n[ye]&&(u=++n[ye],delete n[ye]),Promise.resolve(Object.assign(((o={})[ye]=u,o),n,r))}var i=Reflect.apply(he,null,[t,r].concat(e));return Promise.resolve(i(n))}},t.preConfigCheck=he,t.resultHandler=function(t){return Z(t,"data")&&!Z(t,"error")?t.data:t},t.timestamp=te,t.toArray=W,t.toJson=function(t){return"string"==typeof t?function(t){try{return JSON.parse(t)}catch(r){return t}}(t):JSON.parse(JSON.stringify(t))},t.toPayload=ue,t.urlParams=re,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).jsonqlUtils={})}(this,(function(t){"use strict";var r=Array.isArray,e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n="object"==typeof e&&e&&e.Object===Object&&e,o="object"==typeof self&&self&&self.Object===Object&&self,u=n||o||Function("return this")(),i=u.Symbol,a=Object.prototype,c=a.hasOwnProperty,f=a.toString,s=i?i.toStringTag:void 0;var l=Object.prototype.toString;var p=i?i.toStringTag:void 0;function v(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?function(t){var r=c.call(t,s),e=t[s];try{t[s]=void 0;var n=!0}catch(t){}var o=f.call(t);return n&&(r?t[s]=e:delete t[s]),o}(t):function(t){return l.call(t)}(t)}var d,y,h=(d=Object.getPrototypeOf,y=Object,function(t){return d(y(t))});function g(t){return null!=t&&"object"==typeof t}var b=Function.prototype,_=Object.prototype,j=b.toString,m=_.hasOwnProperty,O=j.call(Object);function w(t){if(!g(t)||"[object Object]"!=v(t))return!1;var r=h(t);if(null===r)return!0;var e=m.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&j.call(e)==O}var S=i?i.prototype:void 0,P=S?S.toString:void 0;function A(t){if("string"==typeof t)return t;if(r(t))return function(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e=n?t:function(t,r,e){var n=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(e=e>o?o:e)<0&&(e+=o),o=r>e?0:e-r>>>0,r>>>=0;for(var u=Array(o);++n-1;);return e}(o,u),function(t,r){for(var e=t.length;e--&&z(r,t[e],0)>-1;);return e}(o,u)+1).join("")}var Q=function(t,r){return!!t.filter((function(t){return t===r})).length},V=function(t){return r(t)?t:[t]},G=function(t,r){try{var e=Object.keys(t);return Q(e,r)}catch(t){return!1}};function H(t,r){return t===r||t!=t&&r!=r}function L(t,r){for(var e=t.length;e--;)if(H(t[e][0],r))return e;return-1}var K=Array.prototype.splice;function W(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},W.prototype.set=function(t,r){var e=this.__data__,n=L(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};function X(t){if(!Z(t))return!1;var r=v(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}var Y,tt=u["__core-js_shared__"],rt=(Y=/[^.]+$/.exec(tt&&tt.keys&&tt.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"";var et=Function.prototype.toString;var nt=/^\[object .+?Constructor\]$/,ot=Function.prototype,ut=Object.prototype,it=ot.toString,at=ut.hasOwnProperty,ct=RegExp("^"+it.call(at).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ft(t){return!(!Z(t)||function(t){return!!rt&&rt in t}(t))&&(X(t)?ct:nt).test(function(t){if(null!=t){try{return et.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t,r){var e=function(t,r){return null==t?void 0:t[r]}(t,r);return ft(e)?e:void 0}var lt=st(u,"Map"),pt=st(Object,"create");var vt=Object.prototype.hasOwnProperty;var dt=Object.prototype.hasOwnProperty;function yt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=9007199254740991}function Bt(t){return null!=t&&qt(t.length)&&!X(t)}var $t="object"==typeof t&&t&&!t.nodeType&&t,Dt=$t&&"object"==typeof module&&module&&!module.nodeType&&module,It=Dt&&Dt.exports===$t?u.Buffer:void 0,Qt=(It?It.isBuffer:void 0)||function(){return!1},Vt={};Vt["[object Float32Array]"]=Vt["[object Float64Array]"]=Vt["[object Int8Array]"]=Vt["[object Int16Array]"]=Vt["[object Int32Array]"]=Vt["[object Uint8Array]"]=Vt["[object Uint8ClampedArray]"]=Vt["[object Uint16Array]"]=Vt["[object Uint32Array]"]=!0,Vt["[object Arguments]"]=Vt["[object Array]"]=Vt["[object ArrayBuffer]"]=Vt["[object Boolean]"]=Vt["[object DataView]"]=Vt["[object Date]"]=Vt["[object Error]"]=Vt["[object Function]"]=Vt["[object Map]"]=Vt["[object Number]"]=Vt["[object Object]"]=Vt["[object RegExp]"]=Vt["[object Set]"]=Vt["[object String]"]=Vt["[object WeakMap]"]=!1;var Gt="object"==typeof t&&t&&!t.nodeType&&t,Ht=Gt&&"object"==typeof module&&module&&!module.nodeType&&module,Lt=Ht&&Ht.exports===Gt&&n.process,Kt=function(){try{var t=Ht&&Ht.require&&Ht.require("util").types;return t||Lt&&Lt.binding&&Lt.binding("util")}catch(t){}}(),Wt=Kt&&Kt.isTypedArray,Zt=Wt?function(t){return function(r){return t(r)}}(Wt):function(t){return g(t)&&qt(t.length)&&!!Vt[v(t)]};function Xt(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]}var Yt=Object.prototype.hasOwnProperty;function tr(t,r,e){var n=t[r];Yt.call(t,r)&&H(n,e)&&(void 0!==e||r in t)||jt(t,r,e)}var rr=/^(?:0|[1-9]\d*)$/;function er(t,r){var e=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==e||"symbol"!=e&&rr.test(t))&&t>-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(dr);function gr(t,r){return hr(function(t,r,e){return r=vr(void 0===r?t.length-1:r,0),function(){for(var n=arguments,o=-1,u=vr(n.length-r,0),i=Array(u);++o1?r[n-1]:void 0,u=n>2?r[2]:void 0;for(o=br.length>3&&"function"==typeof o?(n--,o):void 0,u&&function(t,r,e){if(!Z(e))return!1;var n=typeof r;return!!("number"==n?Bt(e)&&er(r,e.length):"string"==n&&r in e)&&H(e[r],t)}(r[0],r[1],u)&&(o=n<3?void 0:o,n=1),t=Object(t);++e0;)r[e]=arguments[e+1];return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return r.reduce((function(t,r){return Reflect.apply(r,null,V(t))}),Reflect.apply(t,null,e))}},t.chainProcessPromises=function(t){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return r.reduce((function(t,r){return t.then((function(t){return r(t)}))}),Reflect.apply(t,null,e))}},t.chainPromises=function(t,r){return void 0===r&&(r=!1),t.reduce((function(t,e){return t.then((function(t){return e.then((function(e){return!1===r?t.concat([e]):_r(t,e)}))}))}),Promise.resolve(!1===r?[]:w(r)?r:{}))},t.createEvt=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t.join("_")},t.createMutation=Cr,t.createMutationStr=function(t,r,e,n){return void 0===e&&(e={}),void 0===n&&(n=!1),JSON.stringify(Cr(t,r,e,n))},t.createQuery=Jr,t.createQueryStr=function(t,r,e){return void 0===r&&(r=[]),void 0===e&&(e=!1),JSON.stringify(Jr(t,r,e))},t.dasherize=function(t){return I(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},t.extractArgsFromPayload=function(t,r){switch(r){case"query":return t.args;case"mutation":return[t.payload,t.condition];default:throw new Sr("Unknown "+r+" to extract argument from!")}},t.extractParamsFromContract=function(t,r,e){try{var n=t[r][e];if(!n)throw new Or(e,r);return n}catch(t){throw new Or(e,t)}},t.extractSocketPart=Pr,t.formatPayload=Er,t.getCallMethod=function(t){switch(!0){case t===mr[0]:return"query";case t===mr[1]:return"mutation";default:return!1}},t.getConfigValue=function(t,r){return r&&w(r)&&t in r?r[t]:void 0},t.getMutationFromArgs=Ur,t.getMutationFromPayload=function(t){var r=Rr(t,Ur);if(!1!==r)return r;throw new wr("[getMutationArgs] Payload is malformed!",t)},t.getNameFromPayload=kr,t.getNamespaceInOrder=function(t,r){var e=[];for(var n in t)n===r?e[1]=n:e[0]=n;return e},t.getQueryFromArgs=Mr,t.getQueryFromPayload=function(t){var r=Rr(t,Mr);if(!1!==r)return r;throw new wr("[getQueryArgs] Payload is malformed!",t)},t.groupByNamespace=function(t,r){void 0===r&&(r=!1);var e=Pr(t);if(!1===e){if(r)return t;throw new Sr("socket not found in contract!")}var n,o={},u=0;for(var i in e){var a=e[i],c=a.namespace;c&&(o[c]||(++u,o[c]={}),o[c][i]=a,n||a.public&&(n=c))}return{size:u,nspSet:o,publicNamespace:n}},t.inArray=Q,t.injectToFn=function(t,r,e,n){void 0===n&&(n=!1);var o=jr(t,r);return!1===n&&void 0!==o||Object.defineProperty(t,r,{value:e,writable:n}),t},t.isContract=function(t){return!!function(t){return w(t)&&(G(t,"query")||G(t,"mutation")||G(t,"socket"))}(t)&&t},t.isFunc=function(t){if("function"==typeof t)return!0;console.error("Expect to be Function type! Got "+typeof t)},t.isJsonqlErrorObj=qr,t.isNotEmpty=function(t){return void 0!==t&&!1!==t&&null!==t&&""!==I(t)},t.isObjectHasKey=G,t.logger=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];try{window&&window.DEBUG&&Reflect.apply(console.log,console,t)}catch(t){}},t.objDefineProps=function(t,r,e,n){return void 0===n&&(n=null),void 0===Object.getOwnPropertyDescriptor(t,r)&&Object.defineProperty(t,r,{set:e,get:null===n?function(){return null}:n}),t},t.objHasProp=jr,t.packError=function(t,r,e,n){var o;void 0===r&&(r="JsonqlError"),void 0===e&&(e=0),void 0===n&&(n="");var u={detail:t,className:r,statusCode:e,message:n};return JSON.stringify(((o={}).error=qr(t)||u,o.TS=Ar(),o))},t.packResult=function(t,e){void 0===e&&(e=!1);var n={};return n.data=t,e&&r(e)&&(e.push(Ar()),n.TS=e),JSON.stringify(n)},t.resultHandler=function(t){return G(t,"data")&&!G(t,"error")?t.data:t},t.timestamp=Ar,t.toArray=V,t.toJson=function(t){return"string"==typeof t?function(t){try{return JSON.parse(t)}catch(r){return t}}(t):JSON.parse(JSON.stringify(t))},t.toPayload=Fr,t.urlParams=Nr,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=browser.js.map diff --git a/packages/utils/index.js b/packages/utils/index.js index 2395826e..b2c63d55 100644 --- a/packages/utils/index.js +++ b/packages/utils/index.js @@ -49,9 +49,6 @@ import { resultHandler, isJsonqlErrorObj, - preConfigCheck, - postConfigCheck, - VERSION } from './module' import { buff } from './src/jwt' @@ -140,8 +137,5 @@ export { objDefineProps, objHasProp, - preConfigCheck, - postConfigCheck, - VERSION } diff --git a/packages/utils/main.js b/packages/utils/main.js index b8891c6b..b1b94dd6 100644 --- a/packages/utils/main.js +++ b/packages/utils/main.js @@ -1,2 +1,2 @@ -"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var fs=_interopDefault(require("fs")),path=require("path"),isArray=Array.isArray,global$1="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},freeGlobal="object"==typeof global$1&&global$1&&global$1.Object===Object&&global$1,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol=root.Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol?Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag),r=e[symToStringTag];try{e[symToStringTag]=void 0;var n=!0}catch(e){}var o=nativeObjectToString.call(e);return n&&(t?e[symToStringTag]=r:delete e[symToStringTag]),o}var objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=Symbol?Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?getRawTag(e):objectToString(e)}function overArg(e,t){return function(r){return e(t(r))}}var getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(e){return null!=e&&"object"==typeof e}var objectTag="[object Object]",funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$1=objectProto$2.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=objectTag)return!1;var t=getPrototype(e);if(null===t)return!0;var r=hasOwnProperty$1.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&funcToString.call(r)==objectCtorString}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++ro?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n=n?e:baseSlice(e,t,r)}function baseFindIndex(e,t,r,n){for(var o=e.length,a=r+(n?1:-1);n?a--:++a-1;);return r}function charsStartIndex(e,t){for(var r=-1,n=e.length;++r-1;);return r}function asciiToArray(e){return e.split("")}var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsVarRange="\\ufe0e\\ufe0f",rsZWJ="\\u200d",reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+"]");function hasUnicode(e){return reHasUnicode.test(e)}var rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsVarRange$1="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange$1+"]",rsCombo="["+rsComboRange$1+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange$1+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ$1="\\u200d",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange$1+"]?",rsOptJoin="(?:"+rsZWJ$1+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");function unicodeToArray(e){return e.match(reUnicode)||[]}function stringToArray(e){return hasUnicode(e)?unicodeToArray(e):asciiToArray(e)}function toString(e){return null==e?"":baseToString(e)}var reTrim=/^\s+|\s+$/g;function trim(e,t,r){if((e=toString(e))&&(r||void 0===t))return e.replace(reTrim,"");if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e),o=stringToArray(t);return castSlice(n,charsStartIndex(n,o),charsEndIndex(n,o)+1).join("")}var inArray=function(e,t){return!!e.filter((function(e){return e===t})).length},toArray=function(e){return isArray(e)?e:[e]},parse=function(e){try{return JSON.parse(e)}catch(t){return e}},isObjectHasKey=function(e,t){try{var r=Object.keys(e);return inArray(r,t)}catch(e){return!1}},createEvt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return e.join("_")},getConfigValue=function(e,t){return t&&isPlainObject(t)&&e in t?t[e]:void 0},toJson=function(e){return"string"==typeof e?parse(e):JSON.parse(JSON.stringify(e))},isNotEmpty=function(e){return void 0!==e&&!1!==e&&null!==e&&""!==trim(e)},chainFns=function(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return t.reduce((function(e,t){return Reflect.apply(t,null,toArray(e))}),Reflect.apply(e,null,r))}};function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function stubFalse(){return!1}var freeExports$1="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,Buffer$1=moduleExports$1?root.Buffer:void 0,nativeIsBuffer=Buffer$1?Buffer$1.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag$1="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag$1]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var freeExports$2="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,freeProcess=moduleExports$2&&freeGlobal.process,nodeUtil=function(){try{var e=freeModule$2&&freeModule$2.require&&freeModule$2.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;function safeGet(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var objectProto$8=Object.prototype,hasOwnProperty$6=objectProto$8.hasOwnProperty;function assignValue(e,t,r){var n=e[t];hasOwnProperty$6.call(e,t)&&eq(n,r)&&(void 0!==r||t in e)||baseAssignValue(e,t,r)}function copyObject(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a-1&&e%1==0&&e0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var setToString=shortOut(baseSetToString);function baseRest(e,t){return setToString(overRest(e,t,identity),e+"")}function isIterateeCall(e,t,r){if(!isObject(r))return!1;var n=typeof t;return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function createAssigner(e){return baseRest((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,i=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,i&&isIterateeCall(r[0],r[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++n0;)r[n]=arguments[n+2];r.push((function(e){return injectToFn(e,CHECKED_KEY,timestamp())}));var o=Reflect.apply(chainFns,null,r);return function(r){return void 0===r&&(r={}),o(r,e,t)}}function postConfigCheck(e,t){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return function(n){var o;if(void 0===n&&(n={}),objHasProp(n,CHECKED_KEY)){var a=1;return n[PASSED_KEY]&&(a=++n[PASSED_KEY],delete n[PASSED_KEY]),Promise.resolve(Object.assign(((o={})[PASSED_KEY]=a,o),n,t))}var i=Reflect.apply(preConfigCheck,null,[e,t].concat(r));return Promise.resolve(i(n))}}var VERSION="0.9.7",lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1;function init(){inited=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,i=new Arr(3*s/4-a),n=a>0?s-4:s;var u=0;for(t=0,r=0;t>16&255,i[u++]=o>>8&255,i[u++]=255&o;return 2===a?(o=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4,i[u++]=255&o):1===a&&(o=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2,i[u++]=o>>8&255,i[u++]=255&o),i}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[63&e]}function encodeChunk(e,t,r){for(var n,o=[],a=t;as?s:i+16383));return 1===n?(t=e[r-1],o+=lookup[t>>2],o+=lookup[t<<4&63],o+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],o+=lookup[t>>10],o+=lookup[t>>4&63],o+=lookup[t<<2&63],o+="="),a.push(o),a.join("")}function read(e,t,r,n,o){var a,i,s=8*o-n-1,u=(1<>1,c=-7,l=r?o-1:0,h=r?-1:1,p=e[t+l];for(l+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+l],l+=h,c-=8);for(i=a&(1<<-c)-1,a>>=-c,c+=n;c>0;i=256*i+e[t+l],l+=h,c-=8);if(0===a)a=1-f;else{if(a===u)return i?NaN:1/0*(p?-1:1);i+=Math.pow(2,n),a-=f}return(p?-1:1)*i*Math.pow(2,a-n)}function write(e,t,r,n,o,a){var i,s,u,f=8*a-o-1,c=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,g=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,i=c):(i=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-i))<1&&(i--,u*=2),(t+=i+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(i++,u/=2),i+l>=c?(s=0,i=c):i+l>=1?(s=(t*u-1)*Math.pow(2,o),i+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,o),i=0));o>=8;e[r+p]=255&s,p+=g,s/=256,o-=8);for(i=i<0;e[r+p]=255&i,p+=g,i/=256,f-=8);e[r+p-g]|=128*y}var toString$1={}.toString,isArray$1=Array.isArray||function(e){return"[object Array]"==toString$1.call(e)},INSPECT_MAX_BYTES=50;function kMaxLength(){return Buffer$2.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|e}function internalIsBuffer(e){return!(null==e||!e._isBuffer)}function byteLength(e,t){if(internalIsBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function swap(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function bidirectionalIndexOf(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=Buffer$2.from(t,n)),internalIsBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,n,o);if("number"==typeof t)return t&=255,Buffer$2.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,n,o){var a,i=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i=2,s/=2,u/=2,r/=2}function f(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){var c=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){for(var l=!0,h=0;ho&&(n=o):n=o;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var i=0;i239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(a=e[o+1]))&&(u=(31&f)<<6|63&a)>127&&(c=u);break;case 3:a=e[o+1],i=e[o+2],128==(192&a)&&128==(192&i)&&(u=(15&f)<<12|(63&a)<<6|63&i)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[o+1],i=e[o+2],s=e[o+3],128==(192&a)&&128==(192&i)&&128==(192&s)&&(u=(15&f)<<18|(63&a)<<12|(63&i)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return decodeCodePointsArray(n)}Buffer$2.TYPED_ARRAY_SUPPORT=void 0===global$1.TYPED_ARRAY_SUPPORT||global$1.TYPED_ARRAY_SUPPORT,Buffer$2.poolSize=8192,Buffer$2._augment=function(e){return e.__proto__=Buffer$2.prototype,e},Buffer$2.from=function(e,t,r){return from(null,e,t,r)},Buffer$2.TYPED_ARRAY_SUPPORT&&(Buffer$2.prototype.__proto__=Uint8Array.prototype,Buffer$2.__proto__=Uint8Array),Buffer$2.alloc=function(e,t,r){return alloc(null,e,t,r)},Buffer$2.allocUnsafe=function(e){return allocUnsafe$1(null,e)},Buffer$2.allocUnsafeSlow=function(e){return allocUnsafe$1(null,e)},Buffer$2.isBuffer=isBuffer$1,Buffer$2.compare=function(e,t){if(!internalIsBuffer(e)||!internalIsBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,a=Math.min(r,n);o0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},Buffer$2.prototype.compare=function(e,t,r,n,o){if(!internalIsBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),s=Math.min(a,i),u=this.slice(n,o),f=e.slice(t,r),c=0;co)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":return asciiWrite(this,e,t,r);case"latin1":case"binary":return latin1Write(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Buffer$2.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var o="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,n,o,a){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function objectWriteUInt16(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,a=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function objectWriteUInt32(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,a=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function checkIEEE754(e,t,r,n,o,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,n,o){return o||checkIEEE754(e,t,r,4),write(e,t,r,n,23,4),r+4}function writeDouble(e,t,r,n,o){return o||checkIEEE754(e,t,r,8),write(e,t,r,n,52,8),r+8}Buffer$2.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)n+=this[e+--t]*o;return n},Buffer$2.prototype.readUInt8=function(e,t){return t||checkOffset(e,1,this.length),this[e]},Buffer$2.prototype.readUInt16LE=function(e,t){return t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer$2.prototype.readUInt16BE=function(e,t){return t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer$2.prototype.readUInt32LE=function(e,t){return t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer$2.prototype.readUInt32BE=function(e,t){return t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer$2.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||checkOffset(e,t,this.length);for(var n=this[e],o=1,a=0;++a=(o*=128)&&(n-=Math.pow(2,8*t)),n},Buffer$2.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||checkOffset(e,t,this.length);for(var n=t,o=1,a=this[e+--n];n>0&&(o*=256);)a+=this[e+--n]*o;return a>=(o*=128)&&(a-=Math.pow(2,8*t)),a},Buffer$2.prototype.readInt8=function(e,t){return t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer$2.prototype.readInt16LE=function(e,t){t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer$2.prototype.readInt16BE=function(e,t){t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer$2.prototype.readInt32LE=function(e,t){return t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer$2.prototype.readInt32BE=function(e,t){return t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer$2.prototype.readFloatLE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!0,23,4)},Buffer$2.prototype.readFloatBE=function(e,t){return t||checkOffset(e,4,this.length),read(this,e,!1,23,4)},Buffer$2.prototype.readDoubleLE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!0,52,8)},Buffer$2.prototype.readDoubleBE=function(e,t){return t||checkOffset(e,8,this.length),read(this,e,!1,52,8)},Buffer$2.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+r},Buffer$2.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,1,255,0),Buffer$2.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Buffer$2.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,2,65535,0),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$2.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,2,65535,0),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$2.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,4,4294967295,0),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):objectWriteUInt32(this,e,t,!0),t+4},Buffer$2.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,4,4294967295,0),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$2.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);checkInt(this,e,t,r,o-1,-o)}var a=0,i=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+r},Buffer$2.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);checkInt(this,e,t,r,o-1,-o)}var a=r-1,i=1,s=0;for(this[t+a]=255&e;--a>=0&&(i*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/i>>0)-s&255;return t+r},Buffer$2.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,1,127,-128),Buffer$2.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer$2.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,2,32767,-32768),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):objectWriteUInt16(this,e,t,!0),t+2},Buffer$2.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,2,32767,-32768),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):objectWriteUInt16(this,e,t,!1),t+2},Buffer$2.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,4,2147483647,-2147483648),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):objectWriteUInt32(this,e,t,!0),t+4},Buffer$2.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Buffer$2.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):objectWriteUInt32(this,e,t,!1),t+4},Buffer$2.prototype.writeFloatLE=function(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer$2.prototype.writeFloatBE=function(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer$2.prototype.writeDoubleLE=function(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer$2.prototype.writeDoubleBE=function(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer$2.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else if(a<1e3||!Buffer$2.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&a.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function asciiToBytes(e){for(var t=[],r=0;r>8,o=r%256,a.push(o),a.push(n);return a}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function isnan(e){return e!=e}function isBuffer$1(e){return null!=e&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&isFastBuffer(e.slice(0,0))}function buff(e,t){return void 0===t&&(t=BASE64_FORMAT),isBuffer$1(e)?e:new Buffer$2.from(e,t)}var replaceErrors=function(e,t){if(t instanceof Error){var r={};return Object.getOwnPropertyNames(t).forEach((function(e){r[e]=t[e]})),r}return t},printError=function(e){return JSON.stringify(e,replaceErrors)};function findFromContract(e,t,r){return!!(r[e]&&r[e][t]&&r[e][t].file&&fs.existsSync(r[e][t].file))&&r[e][t].file}var DOT=".",getDocLen=function(e){return Buffer$2.byteLength(e,"utf8")},headerParser=function(e,t){try{var r=e.headers.accept.split(",");return t?r.filter((function(e){return e===t})):r}catch(e){return[]}},isHeaderPresent=function(e,t){return!!headerParser(e,t).length},getPathToFn=function(e,t,r){var n=r.resolverDir,o=dasherize(e),a=[];r.contract&&r.contract[t]&&r.contract[t].path&&a.push(r.contract[t].path),a.push(path.join(n,t,o,[INDEX_KEY,EXT].join(DOT))),a.push(path.join(n,t,[o,EXT].join(DOT)));for(var i=a.length,s=0;s=n?t:function(t,r,e){var n=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(e=e>o?o:e)<0&&(e+=o),o=r>e?0:e-r>>>0,r>>>=0;for(var i=Array(o);++n-1;);return e}(o,i),function(t,r){for(var e=t.length;e--&&U(r,t[e],0)>-1;);return e}(o,i)+1).join("")}var Q=function(t,r){return!!t.filter((function(t){return t===r})).length},V=function(t){return n(t)?t:[t]},H=function(t,r){try{var e=Object.keys(t);return Q(e,r)}catch(t){return!1}};function G(t,r){return t===r||t!=t&&r!=r}function Z(t,r){for(var e=t.length;e--;)if(G(t[e][0],r))return e;return-1}var K=Array.prototype.splice;function W(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},W.prototype.set=function(t,r){var e=this.__data__,n=Z(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};function tt(t){if(!X(t))return!1;var r=y(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}var rt,et=a["__core-js_shared__"],nt=(rt=/[^.]+$/.exec(et&&et.keys&&et.keys.IE_PROTO||""))?"Symbol(src)_1."+rt:"";var ot=Function.prototype.toString;var it=/^\[object .+?Constructor\]$/,ut=Function.prototype,at=Object.prototype,ft=ut.toString,st=at.hasOwnProperty,ct=RegExp("^"+ft.call(st).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ht(t){return!(!X(t)||function(t){return!!nt&&nt in t}(t))&&(tt(t)?ct:it).test(function(t){if(null!=t){try{return ot.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function pt(t,r){var e=function(t,r){return null==t?void 0:t[r]}(t,r);return ht(e)?e:void 0}var lt=pt(a,"Map"),gt=pt(Object,"create");var yt=Object.prototype.hasOwnProperty;var vt=Object.prototype.hasOwnProperty;function dt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=9007199254740991}function Ft(t){return null!=t&&zt(t.length)&&!tt(t)}var qt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Jt=qt&&"object"==typeof module&&module&&!module.nodeType&&module,$t=Jt&&Jt.exports===qt?a.Buffer:void 0,Qt=($t?$t.isBuffer:void 0)||function(){return!1},Vt={};Vt["[object Float32Array]"]=Vt["[object Float64Array]"]=Vt["[object Int8Array]"]=Vt["[object Int16Array]"]=Vt["[object Int32Array]"]=Vt["[object Uint8Array]"]=Vt["[object Uint8ClampedArray]"]=Vt["[object Uint16Array]"]=Vt["[object Uint32Array]"]=!0,Vt["[object Arguments]"]=Vt["[object Array]"]=Vt["[object ArrayBuffer]"]=Vt["[object Boolean]"]=Vt["[object DataView]"]=Vt["[object Date]"]=Vt["[object Error]"]=Vt["[object Function]"]=Vt["[object Map]"]=Vt["[object Number]"]=Vt["[object Object]"]=Vt["[object RegExp]"]=Vt["[object Set]"]=Vt["[object String]"]=Vt["[object WeakMap]"]=!1;var Ht="object"==typeof exports&&exports&&!exports.nodeType&&exports,Gt=Ht&&"object"==typeof module&&module&&!module.nodeType&&module,Zt=Gt&&Gt.exports===Ht&&i.process,Kt=function(){try{var t=Gt&&Gt.require&&Gt.require("util").types;return t||Zt&&Zt.binding&&Zt.binding("util")}catch(t){}}(),Wt=Kt&&Kt.isTypedArray,Xt=Wt?function(t){return function(r){return t(r)}}(Wt):function(t){return w(t)&&zt(t.length)&&!!Vt[y(t)]};function tr(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]}var rr=Object.prototype.hasOwnProperty;function er(t,r,e){var n=t[r];rr.call(t,r)&&G(n,e)&&(void 0!==e||r in t)||At(t,r,e)}var nr=/^(?:0|[1-9]\d*)$/;function or(t,r){var e=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==e||"symbol"!=e&&nr.test(t))&&t>-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(vr);function wr(t,r){return br(function(t,r,e){return r=yr(void 0===r?t.length-1:r,0),function(){for(var n=arguments,o=-1,i=yr(n.length-r,0),u=Array(i);++o1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=_r.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!X(e))return!1;var n=typeof r;return!!("number"==n?Ft(e)&&or(r,e.length):"string"==n&&r in e)&&G(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++e>18&63]+$r[o>>12&63]+$r[o>>6&63]+$r[63&o]);return i.join("")}function Kr(t){var r;Hr||Gr();for(var e=t.length,n=e%3,o="",i=[],u=0,a=e-n;ua?a:u+16383));return 1===n?(r=t[e-1],o+=$r[r>>2],o+=$r[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=$r[r>>10],o+=$r[r>>4&63],o+=$r[r<<2&63],o+="="),i.push(o),i.join("")}function Wr(t,r,e,n,o){var i,u,a=8*o-n-1,f=(1<>1,c=-7,h=e?o-1:0,p=e?-1:1,l=t[r+h];for(h+=p,i=l&(1<<-c)-1,l>>=-c,c+=a;c>0;i=256*i+t[r+h],h+=p,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[r+h],h+=p,c-=8);if(0===i)i=1-s;else{if(i===f)return u?NaN:1/0*(l?-1:1);u+=Math.pow(2,n),i-=s}return(l?-1:1)*u*Math.pow(2,i-n)}function Xr(t,r,e,n,o,i){var u,a,f,s=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,g=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=c):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),(r+=u+h>=1?p/f:p*Math.pow(2,1-h))*f>=2&&(u++,f/=2),u+h>=c?(a=0,u=c):u+h>=1?(a=(r*f-1)*Math.pow(2,o),u+=h):(a=r*Math.pow(2,h-1)*Math.pow(2,o),u=0));o>=8;t[e+l]=255&a,l+=g,a/=256,o-=8);for(u=u<0;t[e+l]=255&u,l+=g,u/=256,s-=8);t[e+l-g]|=128*y}var te={}.toString,re=Array.isArray||function(t){return"[object Array]"==te.call(t)};function ee(){return oe.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ne(t,r){if(ee()=ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ee().toString(16)+" bytes");return 0|t}function ce(t){return!(null==t||!t._isBuffer)}function he(t,r){if(ce(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Me(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return De(t).length;default:if(n)return Me(t).length;r=(""+r).toLowerCase(),n=!0}}function pe(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Oe(this,r,e);case"utf8":case"utf-8":return Ee(this,r,e);case"ascii":return je(this,r,e);case"latin1":case"binary":return Pe(this,r,e);case"base64":return Ae(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function le(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function ge(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=oe.from(r,n)),ce(r))return 0===r.length?-1:ye(t,r,e,n,o);if("number"==typeof r)return r&=255,oe.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):ye(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function ye(t,r,e,n,o){var i,u=1,a=t.length,f=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,a/=2,f/=2,e/=2}function s(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var c=-1;for(i=e;ia&&(e=a-f),i=e;i>=0;i--){for(var h=!0,p=0;po&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function Ae(t,r,e){return 0===r&&e===t.length?Kr(t):Kr(t.slice(r,e))}function Ee(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o239?4:s>223?3:s>191?2:1;if(o+h<=e)switch(h){case 1:s<128&&(c=s);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&s)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&s)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(f=(15&s)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&f<1114112&&(c=f)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},oe.prototype.compare=function(t,r,e,n,o){if(!ce(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(i,u),f=this.slice(n,o),s=t.slice(r,e),c=0;co)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return ve(this,t,r,e);case"utf8":case"utf-8":return de(this,t,r,e);case"ascii":return be(this,t,r,e);case"latin1":case"binary":return we(this,t,r,e);case"base64":return _e(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},oe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function je(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;on)&&(e=n);for(var o="",i=r;ie)throw new RangeError("Trying to access beyond buffer length")}function Se(t,r,e,n,o,i){if(!ce(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function Te(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o>>8*(n?o:1-o)}function Ue(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o>>8*(n?o:3-o)&255}function Be(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Ie(t,r,e,n,o){return o||Be(t,0,e,4),Xr(t,r,e,n,23,4),e+4}function Ce(t,r,e,n,o){return o||Be(t,0,e,8),Xr(t,r,e,n,52,8),e+8}oe.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r0&&(o*=256);)n+=this[t+--r]*o;return n},oe.prototype.readUInt8=function(t,r){return r||Re(t,1,this.length),this[t]},oe.prototype.readUInt16LE=function(t,r){return r||Re(t,2,this.length),this[t]|this[t+1]<<8},oe.prototype.readUInt16BE=function(t,r){return r||Re(t,2,this.length),this[t]<<8|this[t+1]},oe.prototype.readUInt32LE=function(t,r){return r||Re(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},oe.prototype.readUInt32BE=function(t,r){return r||Re(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},oe.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||Re(t,r,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*r)),n},oe.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||Re(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},oe.prototype.readInt8=function(t,r){return r||Re(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},oe.prototype.readInt16LE=function(t,r){r||Re(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},oe.prototype.readInt16BE=function(t,r){r||Re(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},oe.prototype.readInt32LE=function(t,r){return r||Re(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},oe.prototype.readInt32BE=function(t,r){return r||Re(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},oe.prototype.readFloatLE=function(t,r){return r||Re(t,4,this.length),Wr(this,t,!0,23,4)},oe.prototype.readFloatBE=function(t,r){return r||Re(t,4,this.length),Wr(this,t,!1,23,4)},oe.prototype.readDoubleLE=function(t,r){return r||Re(t,8,this.length),Wr(this,t,!0,52,8)},oe.prototype.readDoubleBE=function(t,r){return r||Re(t,8,this.length),Wr(this,t,!1,52,8)},oe.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||Se(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+e},oe.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,1,255,0),oe.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},oe.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,2,65535,0),oe.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Te(this,t,r,!0),r+2},oe.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,2,65535,0),oe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Te(this,t,r,!1),r+2},oe.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,4,4294967295,0),oe.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):Ue(this,t,r,!0),r+4},oe.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,4,4294967295,0),oe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Ue(this,t,r,!1),r+4},oe.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);Se(this,t,r,e,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i>0)-a&255;return r+e},oe.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);Se(this,t,r,e,o-1,-o)}var i=e-1,u=1,a=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},oe.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,1,127,-128),oe.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},oe.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,2,32767,-32768),oe.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):Te(this,t,r,!0),r+2},oe.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,2,32767,-32768),oe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):Te(this,t,r,!1),r+2},oe.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,4,2147483647,-2147483648),oe.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Ue(this,t,r,!0),r+4},oe.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||Se(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),oe.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):Ue(this,t,r,!1),r+4},oe.prototype.writeFloatLE=function(t,r,e){return Ie(this,t,r,!0,e)},oe.prototype.writeFloatBE=function(t,r,e){return Ie(this,t,r,!1,e)},oe.prototype.writeDoubleLE=function(t,r,e){return Ce(this,t,r,!0,e)},oe.prototype.writeDoubleBE=function(t,r,e){return Ce(this,t,r,!1,e)},oe.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r=0;--o)t[o+r]=this[o+e];else if(i<1e3||!oe.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function De(t){return function(t){var r,e,n,o,i,u;Hr||Gr();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[a-2]?2:"="===t[a-1]?1:0,u=new Vr(3*a/4-i),n=i>0?a-4:a;var f=0;for(r=0,e=0;r>16&255,u[f++]=o>>8&255,u[f++]=255&o;return 2===i?(o=Qr[t.charCodeAt(r)]<<2|Qr[t.charCodeAt(r+1)]>>4,u[f++]=255&o):1===i&&(o=Qr[t.charCodeAt(r)]<<10|Qr[t.charCodeAt(r+1)]<<4|Qr[t.charCodeAt(r+2)]>>2,u[f++]=o>>8&255,u[f++]=255&o),u}(function(t){if((t=function(t){if(t.trim)return t.trim();return t.replace(/^\s+|\s+$/g,"")}(t).replace(Ne,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ke(t,r,e,n){for(var o=0;o=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function Le(t){return null!=t&&(!!t._isBuffer||ze(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ze(t.slice(0,0))}(t))}function ze(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Fe=function(t,r){if(r instanceof Error){var e={};return Object.getOwnPropertyNames(r).forEach((function(t){e[t]=r[t]})),e}return r};var qe=function(t,r){try{var e=t.headers.accept.split(",");return r?e.filter((function(t){return t===r})):e}catch(t){return[]}},Je=function(t,r){return!!qe(t,r).length},$e=function(t,r){return t.path===r.jsonqlPath};exports.VERSION="1.0.0",exports.buff=function(t,r){return void 0===r&&(r="base64"),Le(t)?t:new oe.from(t,r)},exports.cacheBurst=Ir,exports.cacheBurstUrl=function(t){return Br(t,Ir())},exports.chainFns=function(t){for(var r=[],e=arguments.length-1;e-- >0;)r[e]=arguments[e+1];return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return r.reduce((function(t,r){return Reflect.apply(r,null,V(t))}),Reflect.apply(t,null,e))}},exports.chainPromises=function(t,r){return void 0===r&&(r=!1),t.reduce((function(t,e){return t.then((function(t){return e.then((function(e){return!1===r?t.concat([e]):mr(t,e)}))}))}),Promise.resolve(!1===r?[]:P(r)?r:{}))},exports.createEvt=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t.join("_")},exports.createMutation=Lr,exports.createMutationStr=function(t,r,e,n){return void 0===e&&(e={}),void 0===n&&(n=!1),JSON.stringify(Lr(t,r,e,n))},exports.createQuery=kr,exports.createQueryStr=function(t,r,e){return void 0===r&&(r=[]),void 0===e&&(e=!1),JSON.stringify(kr(t,r,e))},exports.dasherize=Ur,exports.extractArgsFromPayload=function(t,r){switch(r){case"query":return t.args;case"mutation":return[t.payload,t.condition];default:throw new Rr("Unknown "+r+" to extract argument from!")}},exports.extractParamsFromContract=function(t,r,e){try{var n=t[r][e];if(!n)throw new Or(e,r);return n}catch(t){throw new Or(e,t)}},exports.extractSocketPart=Sr,exports.findFromContract=function(t,e,n){return!!(n[t]&&n[t][e]&&n[t][e].file&&r.existsSync(n[t][e].file))&&n[t][e].file},exports.formatPayload=Yr,exports.getCallMethod=function(t){switch(!0){case t===jr[0]:return"query";case t===jr[1]:return"mutation";default:return!1}},exports.getConfigValue=function(t,r){return r&&P(r)&&t in r?r[t]:void 0},exports.getDocLen=function(t){return oe.byteLength(t,"utf8")},exports.getMutationFromArgs=qr,exports.getMutationFromPayload=function(t){var r=Fr(t,qr);if(!1!==r)return r;throw new xr("[getMutationArgs] Payload is malformed!",t)},exports.getNameFromPayload=Mr,exports.getNamespaceInOrder=function(t,r){var e=[];for(var n in t)n===r?e[1]=n:e[0]=n;return e},exports.getPathToFn=function(t,n,o){var i=o.resolverDir,u=Ur(t),a=[];o.contract&&o.contract[n]&&o.contract[n].path&&a.push(o.contract[n].path),a.push(e.join(i,n,u,[Pr,Er].join("."))),a.push(e.join(i,n,[u,Er].join(".")));for(var f=a.length,s=0;s", + "author": "Joel Chu ", "license": "ISC", "engine": { "node": ">=8" @@ -47,10 +47,12 @@ }, "ava": { "files": [ - "tests/*.test.js", - "!tests/fixtures/*.*", - "!tests/browser/*.*", - "!tests/qunit/*.*" + "tests/*.test.js" + ], + "ignoredByWatcher": [ + "tests/fixtures/*.*", + "tests/browser/*.*", + "tests/qunit/*.*" ], "require": [ "esm" @@ -60,7 +62,7 @@ "failFast": true, "failWithoutAssertions": false, "tap": false, - "compileEnhancements": false + "verbose": true }, "dependencies": { "jsonql-constants": "^1.8.14", @@ -68,24 +70,24 @@ "lodash-es": "^4.17.15" }, "devDependencies": { - "ava": "^2.4.0", + "ava": "^3.5.0", "debug": "^4.1.1", "esm": "^3.2.25", "fs-extra": "^8.1.0", "jsonql-params-validator": "^1.5.2", - "rollup": "^1.27.9", + "rollup": "^1.32.0", "rollup-plugin-alias": "^2.2.0", "rollup-plugin-analyzer": "^3.2.2", "rollup-plugin-async": "^1.2.0", "rollup-plugin-buble": "^0.19.8", "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-commonjs": "^10.1.0", - "rollup-plugin-copy": "^3.1.0", + "rollup-plugin-copy": "^3.3.0", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-replace": "^2.2.0", "rollup-plugin-serve": "^1.0.1", - "rollup-plugin-terser": "^5.1.2" + "rollup-plugin-terser": "^5.2.0" } } diff --git a/packages/utils/src/node-middleware.js b/packages/utils/src/node-middleware.js index f57230c1..8c08d65f 100644 --- a/packages/utils/src/node-middleware.js +++ b/packages/utils/src/node-middleware.js @@ -1,9 +1,7 @@ // this is a collection of middleware methods // should be good to use in Koa or Express // const { trim } = require('lodash-es') -import { join } from 'path' -import fs from 'fs' -import { +/* QUERY_NAME, MUTATION_NAME, API_REQUEST_METHODS, @@ -13,13 +11,16 @@ import { QUERY_ARG_NAME, DATA_KEY, ERROR_KEY, - INDEX_KEY, - EXT -} from 'jsonql-constants' -const DOT = '.' -import { isObjectHasKey } from './generic' -import { timestamp } from './timestamp' +*/ +// import { isObjectHasKey } from './generic' +// import { timestamp } from './timestamp' +import { join } from 'path' +import fs from 'fs' +import { INDEX_KEY, EXT } from 'jsonql-constants' import { dasherize } from './dasherize' + +const DOT = '.' + /** * Get document (string) byte length for use in header * @param {string} doc to calculate @@ -79,5 +80,5 @@ export const getPathToFn = function(name, type, opts) { return paths[i] } } - return false; + return false } diff --git a/packages/utils/src/pre-config-check.js b/packages/utils/src/old/pre-config-check.js similarity index 93% rename from packages/utils/src/pre-config-check.js rename to packages/utils/src/old/pre-config-check.js index 7bfb77dd..02d17f03 100644 --- a/packages/utils/src/pre-config-check.js +++ b/packages/utils/src/old/pre-config-check.js @@ -3,9 +3,9 @@ // basically this is just a wrapper method to load everything together // and then add the CHECKED_KEY to it import { CHECKED_KEY } from 'jsonql-constants' -import { chainFns } from './chain-fns' -import { timestamp } from './timestamp' -import { injectToFn, objHasProp } from './obj-define-props' +import { chainFns } from '../chain-fns' +import { timestamp } from '../timestamp' +import { injectToFn, objHasProp } from '../obj-define-props' // throw away later const PASSED_KEY = '__passed__' diff --git a/packages/ws-server-core/package.json b/packages/ws-server-core/package.json index 9ca73e86..f1e48537 100644 --- a/packages/ws-server-core/package.json +++ b/packages/ws-server-core/package.json @@ -30,7 +30,7 @@ "jsonql-errors": "^1.1.10", "jsonql-jwt": "^1.3.8", "jsonql-params-validator": "^1.5.2", - "jsonql-resolver": "^1.0.9", + "jsonql-resolver": "^1.1.0", "jsonql-utils": "^0.9.7", "lodash": "^4.17.15" }, -- Gitee From 37701c62266f62f27f4871adca3362b25d5c9f35 Mon Sep 17 00:00:00 2001 From: joelchu Date: Wed, 4 Mar 2020 10:28:08 +0800 Subject: [PATCH 3/4] get rip of some of the config test --- packages/utils/tests/chain-fn.test.js | 6 +++-- packages/utils/tests/config.test.js | 39 --------------------------- 2 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 packages/utils/tests/config.test.js diff --git a/packages/utils/tests/chain-fn.test.js b/packages/utils/tests/chain-fn.test.js index f0d1b62f..96985bab 100644 --- a/packages/utils/tests/chain-fn.test.js +++ b/packages/utils/tests/chain-fn.test.js @@ -3,11 +3,13 @@ const test = require('ava') const { chainFns } = require('../src/chain-fns') const { chainPromises, chainProcessPromises } = require('../src/chain-promises') -const { preConfigCheck } = require('../src/pre-config-check') const { createConfig, checkConfig } = require('jsonql-params-validator') const { CHECKED_KEY, BOOLEAN_TYPE, NUMBER_TYPE } = require('jsonql-constants') -const { JsonqlTypeError } = require('jsonql-errors') +// will get rip of in the future release +const { preConfigCheck } = require('../src/old/pre-config-check') + +// const { JsonqlTypeError } = require('jsonql-errors') const debug = require('debug')('jsonql-utils:test:chain-fn') diff --git a/packages/utils/tests/config.test.js b/packages/utils/tests/config.test.js deleted file mode 100644 index 0bb0f8bc..00000000 --- a/packages/utils/tests/config.test.js +++ /dev/null @@ -1,39 +0,0 @@ -// just testing the pre and post config check -const test = require('ava') -const { CHECKED_KEY } = require('jsonql-constants') -const { preConfigCheck, postConfigCheck, objHasProp } = require('../main') -const debug = require('debug')('jsonql-utils:test:config') - -test.before(t => { - const fn = preConfigCheck({a: 1, d: 4}, {b: 2}, (a, b, c) => { - return Object.assign({c: 3}, a, b, c) - }) - - t.context.opts = fn({x: 100}) -}) - - -test('It should able to test if the config already pass a check via the postConfigCheck', async t => { - - const key = objHasProp(t.context.opts, CHECKED_KEY) - - debug(t.context.opts) - - t.truthy(key) - - const fn1 = postConfigCheck({d: 1000}, {cont: 'should be here'}, () => {}) - - const result = await fn1(t.context.opts) - - t.is(result.d, 4) - t.truthy(result.cont) - - t.is(result.__passed__, 1, 'we should able to see if the previous config been checked or not') -/* - const fn2 = postConfigCheck({d: 2000}, {cont: 'Now I changed'}, () => {}) - - const result2 = await fn2(result) - - t.is(result2.__passed__, 2) -*/ -}) -- Gitee From a3246ee9e9b0b78041e2101459df876dae0e9df1 Mon Sep 17 00:00:00 2001 From: joelchu Date: Wed, 4 Mar 2020 10:28:48 +0800 Subject: [PATCH 4/4] test passed and jsonql-utils to 1.0.0 --- packages/utils/tests/fn.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/tests/fn.test.js b/packages/utils/tests/fn.test.js index e6ae3719..576d8e9f 100644 --- a/packages/utils/tests/fn.test.js +++ b/packages/utils/tests/fn.test.js @@ -2,7 +2,7 @@ const test = require('ava') const utilFns = require('../main') const { merge } = require('lodash-es') -const { preConfigCheck, postConfigCheck } = require('../src/pre-config-check') +const { preConfigCheck, postConfigCheck } = require('../src/old/pre-config-check') const { CHECKED_KEY } = require('jsonql-constants') const debug = require('debug')('jsonql-utils:test:fn') -- Gitee