diff --git a/packages/jwt/README.md b/packages/jwt/README.md index 90feea87c030d01ad83e19c0169765cb814548fe..03a3f15700b96b68243afcc890ee029565a1875c 100644 --- a/packages/jwt/README.md +++ b/packages/jwt/README.md @@ -2,10 +2,8 @@ > A jwt based authentication system for jsonql, including http and socket (socket.io and ws) -This library provide several methods that will be use in different jsonql javascript frameworks. +This library provide several JWT authenticatioin methods used in several different jsonql modules. -**We have taken out the `socket.io-client` and `ws` out of the dependencies since v1.2.4; -if you need them then you have to install this modules separately** ## Installation @@ -15,7 +13,9 @@ $ npm i jsonql-jwt ### Node command line utility -If you install this globally, you can use the command line utility +When you install this globally, you can use the command line utility. +You don't usually need to do this manually, this is build into each module +that require to generate the keys (i.e. [jsonql-koa](https://npmjs.com/package/jsonql-koa)) ```sh $ jsonql-jwt rsa-pem diff --git a/packages/jwt/package.json b/packages/jwt/package.json index 45afdc57d7bfaa39ca1cb039583b2e05a88897bc..1f8c438d13d2bc519468afd1561c4b6dada180a0 100644 --- a/packages/jwt/package.json +++ b/packages/jwt/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-jwt", - "version": "1.3.7", + "version": "1.3.8", "description": "jwt authentication helpers library for jsonql browser / node", "main": "main.js", "module": "index.js", @@ -39,9 +39,9 @@ "dependencies": { "colors": "^1.4.0", "fs-extra": "^8.1.0", - "jsonql-constants": "^1.8.13", + "jsonql-constants": "^1.8.14", "jsonql-errors": "^1.1.10", - "jsonql-params-validator": "^1.5.0", + "jsonql-params-validator": "^1.5.1", "jsonql-utils": "^0.9.2", "jsonwebtoken": "^8.5.1", "jwt-decode": "^2.2.0", diff --git a/packages/koa/keys/privateKey.pem b/packages/koa/keys/privateKey.pem deleted file mode 100644 index 4311a1a7b47594c012437746490270f779743117..0000000000000000000000000000000000000000 --- a/packages/koa/keys/privateKey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXwIBAAKBgQDdK8VoWw6l26rxfL8KDr3DTgV6mom554/GBIeT/Jj+oPdE1Fby -oN9n+P2MVtNtnJCCQAV7c2czBPs7Yt7ywZ4FPlhrw59+CvLx8vZLrbO3hPbd8gGx -oKbHBbzqt4vgsYwAQD4BXGya7MDzGUM1QNImt7upOjfY4Bevy+psNEDc2wIDAQAB -AoGBAKktHBlQ3Yl81+tUMoUs9XZ5LbO0lfj/6XfcayCFrTnIQpwBmGiLKZhMWxWI -LL3BbsBS3F6rzZq3Cr1ISaWC+K05fPe3Oc5JRsvy36wc1WuQCxmSYhpEaweOBRMt -CVGfDw5Mo9wGVc+cJavE+oIGZ8jaEGi9kZUslajyR90p/ORxAkEA/ARLl0weW8Hs -SXYOdPivzRt1jfAlVSLbdD4C/1KyAxAj5aI0zWBca4Rabg5rcpXzyMngm1TVC80U -dvNnEKdzXwJBAOCqqxMz+um4HoszF4qnrxF3aO9SAHMoQ86hVB1FzYTmxKZsFBUh -emrH8FZxgyeQGzAZjPwFgx5a5kyDpt6l5AUCQQDYwRz+yTJHOzhuSoLOqmISKC7o -YIbLfcqAZSGQ1mBS8Bvf0q5Vgi6bLt/UTsStbjmaFb//+Wuv1bhnQpv/n/ZDAkEA -ibWzNQsYkqgr+LDxjijoc3FZHdCKvAuDPKXAtEy0A/GbulLnIGir68XwOFxNwzNe -puYSd+w9CZ84KNBNuY2/rQJBAM0wr46cMhJFbmPJefTRqyPRfhfCMAdf3M4lVYmR -nqokNI6K+j8QApuVmUS+MCLDN+9lxb8Crj0R8GIa+YjSDWc= ------END RSA PRIVATE KEY----- diff --git a/packages/koa/keys/publicKey.pem b/packages/koa/keys/publicKey.pem deleted file mode 100644 index d0d8a6a44bd20bd4fd77a652e41a4aa931da5f2e..0000000000000000000000000000000000000000 --- a/packages/koa/keys/publicKey.pem +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdK8VoWw6l26rxfL8KDr3DTgV6 -mom554/GBIeT/Jj+oPdE1FbyoN9n+P2MVtNtnJCCQAV7c2czBPs7Yt7ywZ4FPlhr -w59+CvLx8vZLrbO3hPbd8gGxoKbHBbzqt4vgsYwAQD4BXGya7MDzGUM1QNImt7up -OjfY4Bevy+psNEDc2wIDAQAB ------END PUBLIC KEY----- diff --git a/packages/koa/package.json b/packages/koa/package.json index ce750c511236a861fb8230305ce0d136f6440c11..baaed4fb0ae839290e08ee5824c075430f66decc 100644 --- a/packages/koa/package.json +++ b/packages/koa/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-koa", - "version": "1.5.2", + "version": "1.5.3", "description": "jsonql Koa middleware", "main": "main.js", "module": "index.js", @@ -74,14 +74,14 @@ "debug": "^4.1.1", "esm": "^3.2.25", "fs-extra": "^8.1.0", - "jsonql-constants": "^1.8.13", + "jsonql-constants": "^1.8.14", "jsonql-contract": "^1.8.5", "jsonql-errors": "^1.1.10", - "jsonql-jwt": "^1.3.7", + "jsonql-jwt": "^1.3.8", "jsonql-node-client": "^1.2.6", - "jsonql-params-validator": "^1.5.1", - "jsonql-resolver": "^1.0.2", - "jsonql-utils": "^0.9.2", + "jsonql-params-validator": "^1.5.2", + "jsonql-resolver": "^1.0.5", + "jsonql-utils": "^0.9.3", "jsonql-web-console": "^0.4.5", "koa-compose": "^4.1.0", "lodash": "^4.17.15" diff --git a/packages/koa/src/utils/helpers.js b/packages/koa/src/utils/helpers.js index 2c5d865030e884dad62566587f05217835754f19..fe300bcb67afed704a845b6956ed8d3a2cb7f201 100644 --- a/packages/koa/src/utils/helpers.js +++ b/packages/koa/src/utils/helpers.js @@ -1,80 +1,11 @@ // this was move back from jsonql-utils // because this is all koa specific there is no reason to put into a global module // koa specific methods -import { - CONTENT_TYPE, - SUCCESS_STATUS, - FORBIDDEN_STATUS -} from 'jsonql-constants' +import { FORBIDDEN_STATUS } from 'jsonql-constants' // fix the default is not export by module error import * as jsonqlErrors from 'jsonql-errors' - -import { - getDocLen, - headerParser, - getPathToFn, - getCallMethod, - packResult, - packError, - dasherize -} from 'jsonql-utils' - -/** - * Handle the output - * @param {object} opts configuration - * @return {function} with ctx and body as params - */ -export const handleOutput = function(opts) { - return function(ctx, body) { - ctx.size = getDocLen(body) - ctx.type = opts.contentType; - ctx.status = SUCCESS_STATUS; - ctx.body = body; - } -} - -/** - * @TODO this was never use anywhere, remove later - * handle HTML output for the web console - * @param {object} ctx koa context - * @param {string} body output content - * @return {void} - */ -export const handleHtmlOutput = function(ctx, body) { - ctx.size = getDocLen(body) - ctx.type = 'text/html'; - ctx.status = SUCCESS_STATUS; - ctx.body = body + ''; // just make sure its string output -} - -/** - * use the ctx to generate error output - * V1.1.0 we render this as a normal output with status 200 - * then on the client side will check against the result object for error - * @param {object} ctx context - * @param {number} code 404 / 500 etc - * @param {object} e actual error - * @param {string} message if there is one - * @param {string} name custom error class name - */ -export const ctxErrorHandler = function(ctx, code, e, message = '') { - const render = handleOutput({contentType: CONTENT_TYPE}) - // debug('[ctxErrorHandler]', code, e, message) - let name; - if (typeof code === 'string') { - name = code; - code = jsonqlErrors[name] ? jsonqlErrors[name].statusCode : -1; - } else { - // debug(`[ctxErrorHandler] using getErrorByStatus`) - name = jsonqlErrors.getErrorByStatus(code) - } - // debug(`[ctxErrorHandler.name]`, name) - // preserve the message - if (!message && e && e.message) { - message = e.message; - } - return render(ctx, packError(e, name, code, message)) -} +import { getDocLen } from 'jsonql-utils' +import { handleOutput, ctxErrorHandler } from 'jsonql-resolver' /** * Just a wrapper to be clearer what error is it @@ -83,6 +14,12 @@ export const ctxErrorHandler = function(ctx, code, e, message = '') { * @param {object} e error * @return {undefined} nothing */ -export const forbiddenHandler = (ctx, e) => ( +const forbiddenHandler = (ctx, e) => ( ctxErrorHandler(ctx, FORBIDDEN_STATUS, e, 'JsonqlForbiddenError') ) + +export { + handleOutput, + ctxErrorHandler, + forbiddenHandler +} diff --git a/packages/resolver/index.js b/packages/resolver/index.js index 6c1add105dcd9f280ee00fd186b2a3eeaa729845..b1260fe19b63377114eb7af455aea7089c9871a7 100644 --- a/packages/resolver/index.js +++ b/packages/resolver/index.js @@ -20,6 +20,11 @@ const { validateClientConfig, clientsGenerator } = require('./src/client') +// 1.0.5 re-export this two method to share with jsonql-koa +const { + handleOutput, + ctxErrorHandler +} = require('./src/utils') // @TODO use the same for the jsonql-ws-server as well module.exports = { @@ -33,8 +38,8 @@ module.exports = { // for node clients injectNodeClient, validateClientConfig, - clientsGenerator - // create an alias for integration in Koa middleware - // remove in 0.9.8 - // resolveMethod: resolverRenderHandler + clientsGenerator, + + handleOutput, + ctxErrorHandler } diff --git a/packages/resolver/package.json b/packages/resolver/package.json index ad3d68b8fdecda874ff3760430ea9fa2f0cf7fdd..f52112c379605771d425e08b3d909d8f12ad387f 100644 --- a/packages/resolver/package.json +++ b/packages/resolver/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-resolver", - "version": "1.0.2", + "version": "1.0.5", "description": "This is NOT for general use, please do not install it directly. This module is part of the jsonql tools supporting modules.", "main": "index.js", "files": [ @@ -28,18 +28,18 @@ }, "dependencies": { "debug": "^4.1.1", - "jsonql-constants": "^1.8.13", + "jsonql-constants": "^1.8.14", "jsonql-errors": "^1.1.10", - "jsonql-jwt": "^1.3.7", + "jsonql-jwt": "^1.3.8", "jsonql-node-client": "^1.2.6", - "jsonql-params-validator": "^1.5.1", - "jsonql-utils": "^0.9.2", + "jsonql-params-validator": "^1.5.2", + "jsonql-utils": "^0.9.3", "lodash.merge": "^4.6.2" }, "devDependencies": { "ava": "^2.4.0", - "jsonql-contract": "^1.8.4", - "jsonql-koa": "^1.5.0", + "jsonql-contract": "^1.8.5", + "jsonql-koa": "^1.5.2", "server-io-core": "^1.2.0" }, "ava": { diff --git a/packages/resolver/src/handle-auth-methods.js b/packages/resolver/src/handle-auth-methods.js index 363ed101f68ce88e685633c83907f7540b23f5b2..00a71f220562b4adcc6d82134319fb018c14a3be 100644 --- a/packages/resolver/src/handle-auth-methods.js +++ b/packages/resolver/src/handle-auth-methods.js @@ -5,7 +5,8 @@ const { AUTH_TYPE, LOGOUT_NAME, ISSUER_NAME, - QUERY_ARG_NAME + QUERY_ARG_NAME, + UNAUTHORIZED_STATUS } = require('jsonql-constants') const { JsonqlResolverNotFoundError, @@ -17,7 +18,7 @@ const { } = require('jsonql-errors') const { packResult } = require('jsonql-utils') -const { getDebug, ctxErrorHandler, handleOutput, UNAUTHORIZED_STATUS } = require('./utils') +const { getDebug, ctxErrorHandler, handleOutput } = require('./utils') const { searchResolvers } = require('./search-resolvers') const { validateAndCall } = require('./validate-and-call') diff --git a/packages/resolver/src/utils.js b/packages/resolver/src/utils.js index 6f31bf94729884f8424a108d9b8ad29313ce096d..eca827de6b3047020789a18eb9ded1cfee598341 100644 --- a/packages/resolver/src/utils.js +++ b/packages/resolver/src/utils.js @@ -4,8 +4,6 @@ const MODULE_NAME = 'jsonql-resolver' const { getDocLen, packError } = require('jsonql-utils') const { CONTENT_TYPE, SUCCESS_STATUS } = require('jsonql-constants') const jsonqlErrors = require('jsonql-errors') -// @TODO port this back to jsonql-constants later -const UNAUTHORIZED_STATUS = 401; /** * return the debug method @@ -64,7 +62,6 @@ const ctxErrorHandler = function(ctx, code, e, message = '') { } module.exports = { - UNAUTHORIZED_STATUS, getDebug, handleOutput, ctxErrorHandler diff --git a/packages/resolver/tests/fixtures/contract/es/contract.json b/packages/resolver/tests/fixtures/contract/es/contract.json index 9e95e5c499591fb324ed17492997fc0c01723f7c..6e24ed4fda876784021939290af43374e6ac3f82 100644 --- a/packages/resolver/tests/fixtures/contract/es/contract.json +++ b/packages/resolver/tests/fixtures/contract/es/contract.json @@ -43,6 +43,6 @@ } }, "auth": {}, - "timestamp": 1575881837, + "timestamp": 1575969838, "sourceType": "module" } diff --git a/packages/utils/browser.js b/packages/utils/browser.js index 6938f8b01a90d3729ca6a61dcfaef9a6275ff687..777e63a2eca6c77204746cf224c2963eb501484e 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 Jr(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=Rr.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;)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.preConfigCheck=function(t,r){for(var e=[],n=arguments.length-2;n-- >0;)e[n]=arguments[n+2];var o=Reflect.apply(X,null,e.concat((function(t){return qr(t,Kr,te())})));return function(e){return void 0===e&&(e={}),o(e,t,r)}},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="[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 Jr(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=Rr.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;)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.preConfigCheck=function(t,r){for(var e=[],n=arguments.length-2;n-- >0;)e[n]=arguments[n+2];var o=Reflect.apply(X,null,e.concat((function(t){return qr(t,Kr,te())})));return function(e){return void 0===e&&(e={}),o(e,t,r)}},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})})); //# sourceMappingURL=browser.js.map diff --git a/packages/utils/main.js b/packages/utils/main.js index 5a217274465df210ba3e309abf76510822abdf85..626d7b27a68af8ba911b3de1866ca3dd5f5e407c 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];var o=Reflect.apply(chainFns,null,r.concat((function(e){return injectToFn(e,CHECKED_KEY,timestamp())})));return function(r){return void 0===r&&(r={}),o(r,e,t)}}var VERSION="0.9.2",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;so?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];var o=Reflect.apply(chainFns,null,r.concat((function(e){return injectToFn(e,CHECKED_KEY,timestamp())})));return function(r){return void 0===r&&(r={}),o(r,e,t)}}var VERSION="0.9.3",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;sn?0:n+r),(t=t>n?n:t)<0&&(t+=n),n=r>t?0:t-r>>>0,r>>>=0;for(var o=Array(n);++a=a?e:baseSlice(e,r,t)}function baseFindIndex(e,r,t,a){for(var n=e.length,o=t+(a?1:-1);a?o--:++o-1;);return t}function charsStartIndex(e,r){for(var t=-1,a=e.length;++t-1;);return t}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,r,t){if((e=toString(e))&&(t||void 0===r))return e.replace(reTrim,"");if(!e||!(r=baseToString(r)))return e;var a=stringToArray(e),n=stringToArray(r);return castSlice(a,charsStartIndex(a,n),charsEndIndex(a,n)+1).join("")}var isNotEmpty=function(e){return!!isArray(e)||null!=e&&""!==trim(e)},numberTag="[object Number]";function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==numberTag}function isNaN(e){return isNumber(e)&&e!=+e}var stringTag="[object String]";function isString(e){return"string"==typeof e||!isArray(e)&&isObjectLike(e)&&baseGetTag(e)==stringTag}var checkIsNumber=function(e){return!isString(e)&&!isNaN(parseFloat(e))},checkIsString=function(e){return""!==trim(e)&&isString(e)},checkIsBoolean=function(e){return null!=e&&"boolean"==typeof e},checkIsAny=function(e,r){return void 0===r&&(r=!0),void 0!==e&&""!==e&&""!==trim(e)&&(!1===r||!0===r&&null!==e)},DATA_KEY="data",ERROR_KEY="error",DEFAULT_TYPE="any",KEY_WORD="continue",TYPE_KEY="type",OPTIONAL_KEY="optional",ENUM_KEY="enumv",ARGS_KEY="args",CHECKER_KEY="checker",ALIAS_KEY="alias",OR_SEPERATOR="|",STRING_TYPE="string",BOOLEAN_TYPE="boolean",ARRAY_TYPE="array",OBJECT_TYPE="object",NUMBER_TYPE="number",ARRAY_TYPE_LFT="array.<",ARRAY_TYPE_RGT=">",NO_STATUS_CODE=-1,ARGS_NOT_ARRAY_ERR="args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)",PARAMS_NOT_ARRAY_ERR="params is not an array! Did something gone wrong when you generate the contract.json?",EXCEPTION_CASE_ERR="Could not understand your arguments and parameter structure!",DEFAULT_TYPE$1=DEFAULT_TYPE,ARRAY_TYPE_LFT$1=ARRAY_TYPE_LFT,ARRAY_TYPE_RGT$1=ARRAY_TYPE_RGT,TYPE_KEY$1=TYPE_KEY,OPTIONAL_KEY$1=OPTIONAL_KEY,ENUM_KEY$1=ENUM_KEY,ARGS_KEY$1=ARGS_KEY,CHECKER_KEY$1=CHECKER_KEY,ALIAS_KEY$1=ALIAS_KEY,ARRAY_TYPE$1=ARRAY_TYPE,OBJECT_TYPE$1=OBJECT_TYPE,STRING_TYPE$1=STRING_TYPE,BOOLEAN_TYPE$1=BOOLEAN_TYPE,NUMBER_TYPE$1=NUMBER_TYPE,KEY_WORD$1=KEY_WORD,OR_SEPERATOR$1=OR_SEPERATOR,combineFn=function(e){switch(e){case NUMBER_TYPE$1:return checkIsNumber;case STRING_TYPE$1:return checkIsString;case BOOLEAN_TYPE$1:return checkIsBoolean;default:return checkIsAny}},checkIsArray=function(e,r){return void 0===r&&(r=""),!!isArray(e)&&(""===r||""===trim(r)||!(e.filter((function(e){return!combineFn(r)(e)})).length>0))},isArrayLike=function(e){if(e.indexOf(ARRAY_TYPE_LFT$1)>-1&&e.indexOf(ARRAY_TYPE_RGT$1)>-1){var r=e.replace(ARRAY_TYPE_LFT$1,"").replace(ARRAY_TYPE_RGT$1,"");return r.indexOf(OR_SEPERATOR$1)?r.split(OR_SEPERATOR$1):[r]}return!1},arrayTypeHandler=function(e,r){var t=e.arg;return r.length>1?!t.filter((function(e){return!(r.length>r.filter((function(r){return!combineFn(r)(e)})).length)})).length:r.length>r.filter((function(e){return!checkIsArray(t,e)})).length};function overArg(e,r){return function(t){return e(r(t))}}var getPrototype=overArg(Object.getPrototypeOf,Object),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 r=getPrototype(e);if(null===r)return!0;var t=hasOwnProperty$1.call(r,"constructor")&&r.constructor;return"function"==typeof t&&t instanceof t&&funcToString.call(t)==objectCtorString}function arrayFilter(e,r){for(var t=-1,a=null==e?0:e.length,n=0,o=[];++t-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag$1="[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(r){return e(r)}}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]=typedArrayTags[mapTag]=typedArrayTags[numberTag$1]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag$1]=typedArrayTags[weakMapTag]=!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,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var e=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function arrayLikeKeys(e,r){var t=isArray(e),a=!t&&isArguments(e),n=!t&&!a&&isBuffer(e),o=!t&&!a&&!n&&isTypedArray(e),i=t||a||n||o,s=i?baseTimes(e.length,String):[],c=s.length;for(var u in e)!r&&!hasOwnProperty$3.call(e,u)||i&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||isIndex(u,c))||s.push(u);return s}var objectProto$5=Object.prototype;function isPrototype(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||objectProto$5)}var nativeKeys=overArg(Object.keys,Object),objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys(e);var r=[];for(var t in Object(e))hasOwnProperty$4.call(e,t)&&"constructor"!=t&&r.push(t);return r}function isObject(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag$1||r==genTag||r==asyncTag||r==proxyTag}function isArrayLike$1(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function keys(e){return isArrayLike$1(e)?arrayLikeKeys(e):baseKeys(e)}function baseForOwn(e,r){return e&&baseFor(e,r,keys)}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,a=assocIndexOf(t,e);return a<0?(++this.size,t.push([e,r])):t[a][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++rs))return!1;var u=o.get(e);if(u&&o.get(r))return u==r;var l=-1,f=!0,y=t&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(o.set(e,r),o.set(r,e);++lr.type.filter((function(e){var r;return void 0===t||(!1!==(r=isArrayLike(e))?!arrayTypeHandler({arg:t},r):!combineFn(e)(t))})).length)})).length}return!1},objectTypeHandler=function(e){var r=e.arg,t=e.param,a=[r];return Array.isArray(t.keys)&&t.keys.length&&a.push(t.keys),Reflect.apply(checkIsObject,null,a)},JsonqlEnumError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(r,t),r}(Error),JsonqlTypeError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(r,t),r}(Error),JsonqlCheckerError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(r,t),r}(Error),JsonqlError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0},statusCode:{configurable:!0}};return t.name.get=function(){return"JsonqlError"},t.statusCode.get=function(){return NO_STATUS_CODE},Object.defineProperties(r,t),r}(Error),optionalHandler=function(e){var r=e.arg,t=e.param;return!!isNotEmpty(r)&&!(t.type.length>t.type.filter((function(r){return validateHandler(r,e)})).length)},validateHandler=function(e,r){var t;switch(!0){case e===OBJECT_TYPE$1:return!objectTypeHandler(r);case e===ARRAY_TYPE$1:return!checkIsArray(r.arg);case!1!==(t=isArrayLike(e)):return!arrayTypeHandler(r,t);default:return!combineFn(e)(r.arg)}},getOptionalValue=function(e,r){return void 0!==e?e:!0===r.optional&&void 0!==r.defaultvalue?r.defaultvalue:null},normalizeArgs=function(e,r){if(!checkIsArray(r))throw new JsonqlError(PARAMS_NOT_ARRAY_ERR);if(0===r.length)return[];if(!checkIsArray(e))throw new JsonqlError(ARGS_NOT_ARRAY_ERR);switch(!0){case e.length==r.length:return e.map((function(e,t){return{arg:e,index:t,param:r[t]}}));case!0===r[0].variable:var t=r[0].type;return e.map((function(e,a){return{arg:e,index:a,param:r[a]||{type:t,name:"_"}}}));case e.lengthr.length:var a=r.length,n=[DEFAULT_TYPE$1];return e.map((function(e,t){var o=t>=a||!!r[t].optional,i=r[t]||{type:n,name:"_"+t};return{arg:o?getOptionalValue(e,i):e,index:t,param:i,optional:o}}));default:throw new JsonqlError(EXCEPTION_CASE_ERR,{args:e,params:r})}},processReturn=function(e){return e.map((function(e){return e.arg}))},validateSync=function(e,r,t){var a;void 0===t&&(t=!1);var n=normalizeArgs(e,r),o=n.filter((function(e){return!0===e.optional||!0===e.param.optional?optionalHandler(e):!(e.param.type.length>e.param.type.filter((function(r){return validateHandler(r,e)})).length)}));return t?((a={})[ERROR_KEY]=o,a[DATA_KEY]=processReturn(n),a):o},validateAsync=function(e,r,t){return void 0===t&&(t=!1),new Promise((function(a,n){var o=validateSync(e,r,t);return t?o[ERROR_KEY].length?n(o[ERROR_KEY]):a(o[DATA_KEY]):o.length?n(o):a([])}))},defineProperty=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function baseAssignValue(e,r,t){"__proto__"==r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}function assignMergeValue(e,r,t){(void 0===t||eq(e[r],t))&&(void 0!==t||r in e)||baseAssignValue(e,r,t)}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,Buffer$1=moduleExports$2?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(e,r){if(r)return e.slice();var t=e.length,a=allocUnsafe?allocUnsafe(t):new e.constructor(t);return e.copy(a),a}function cloneArrayBuffer(e){var r=new e.constructor(e.byteLength);return new Uint8Array(r).set(new Uint8Array(e)),r}function cloneTypedArray(e,r){var t=r?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function copyArray(e,r){var t=-1,a=e.length;for(r||(r=Array(a));++t0){if(++r>=HOT_COUNT)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var setToString=shortOut(baseSetToString);function baseRest(e,r){return setToString(overRest(e,r,identity),e+"")}function isIterateeCall(e,r,t){if(!isObject(t))return!1;var a=typeof r;return!!("number"==a?isArrayLike$1(t)&&isIndex(r,t.length):"string"==a&&r in t)&&eq(t[r],e)}function createAssigner(e){return baseRest((function(r,t){var a=-1,n=t.length,o=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=e.length>3&&"function"==typeof o?(n--,o):void 0,i&&isIterateeCall(t[0],t[1],i)&&(o=n<3?void 0:o,n=1),r=Object(r);++an?0:n+r),(t=t>n?n:t)<0&&(t+=n),n=r>t?0:t-r>>>0,r>>>=0;for(var o=Array(n);++a=a?e:baseSlice(e,r,t)}function baseFindIndex(e,r,t,a){for(var n=e.length,o=t+(a?1:-1);a?o--:++o-1;);return t}function charsStartIndex(e,r){for(var t=-1,a=e.length;++t-1;);return t}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,r,t){if((e=toString(e))&&(t||void 0===r))return e.replace(reTrim,"");if(!e||!(r=baseToString(r)))return e;var a=stringToArray(e),n=stringToArray(r);return castSlice(a,charsStartIndex(a,n),charsEndIndex(a,n)+1).join("")}var isNotEmpty=function(e){return!!isArray(e)||null!=e&&""!==trim(e)},numberTag="[object Number]";function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==numberTag}function isNaN(e){return isNumber(e)&&e!=+e}var stringTag="[object String]";function isString(e){return"string"==typeof e||!isArray(e)&&isObjectLike(e)&&baseGetTag(e)==stringTag}var checkIsNumber=function(e){return!isString(e)&&!isNaN(parseFloat(e))},checkIsString=function(e){return""!==trim(e)&&isString(e)},checkIsBoolean=function(e){return null!=e&&"boolean"==typeof e},checkIsAny=function(e,r){return void 0===r&&(r=!0),void 0!==e&&""!==e&&""!==trim(e)&&(!1===r||!0===r&&null!==e)},DATA_KEY="data",ERROR_KEY="error",DEFAULT_TYPE="any",KEY_WORD="continue",TYPE_KEY="type",OPTIONAL_KEY="optional",ENUM_KEY="enumv",ARGS_KEY="args",CHECKER_KEY="checker",ALIAS_KEY="alias",OR_SEPERATOR="|",STRING_TYPE="string",BOOLEAN_TYPE="boolean",ARRAY_TYPE="array",OBJECT_TYPE="object",NUMBER_TYPE="number",ARRAY_TYPE_LFT="array.<",ARRAY_TYPE_RGT=">",NO_STATUS_CODE=-1,ARGS_NOT_ARRAY_ERR="args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)",PARAMS_NOT_ARRAY_ERR="params is not an array! Did something gone wrong when you generate the contract.json?",EXCEPTION_CASE_ERR="Could not understand your arguments and parameter structure!",DEFAULT_TYPE$1=DEFAULT_TYPE,ARRAY_TYPE_LFT$1=ARRAY_TYPE_LFT,ARRAY_TYPE_RGT$1=ARRAY_TYPE_RGT,TYPE_KEY$1=TYPE_KEY,OPTIONAL_KEY$1=OPTIONAL_KEY,ENUM_KEY$1=ENUM_KEY,ARGS_KEY$1=ARGS_KEY,CHECKER_KEY$1=CHECKER_KEY,ALIAS_KEY$1=ALIAS_KEY,ARRAY_TYPE$1=ARRAY_TYPE,OBJECT_TYPE$1=OBJECT_TYPE,STRING_TYPE$1=STRING_TYPE,BOOLEAN_TYPE$1=BOOLEAN_TYPE,NUMBER_TYPE$1=NUMBER_TYPE,KEY_WORD$1=KEY_WORD,OR_SEPERATOR$1=OR_SEPERATOR,combineFn=function(e){switch(e){case NUMBER_TYPE$1:return checkIsNumber;case STRING_TYPE$1:return checkIsString;case BOOLEAN_TYPE$1:return checkIsBoolean;default:return checkIsAny}},checkIsArray=function(e,r){return void 0===r&&(r=""),!!isArray(e)&&(""===r||""===trim(r)||!(e.filter((function(e){return!combineFn(r)(e)})).length>0))},isArrayLike=function(e){if(e.indexOf(ARRAY_TYPE_LFT$1)>-1&&e.indexOf(ARRAY_TYPE_RGT$1)>-1){var r=e.replace(ARRAY_TYPE_LFT$1,"").replace(ARRAY_TYPE_RGT$1,"");return r.indexOf(OR_SEPERATOR$1)?r.split(OR_SEPERATOR$1):[r]}return!1},arrayTypeHandler=function(e,r){var t=e.arg;return r.length>1?!t.filter((function(e){return!(r.length>r.filter((function(r){return!combineFn(r)(e)})).length)})).length:r.length>r.filter((function(e){return!checkIsArray(t,e)})).length};function overArg(e,r){return function(t){return e(r(t))}}var getPrototype=overArg(Object.getPrototypeOf,Object),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 r=getPrototype(e);if(null===r)return!0;var t=hasOwnProperty$1.call(r,"constructor")&&r.constructor;return"function"==typeof t&&t instanceof t&&funcToString.call(t)==objectCtorString}function arrayFilter(e,r){for(var t=-1,a=null==e?0:e.length,n=0,o=[];++t-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}var argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag$1="[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(r){return e(r)}}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]=typedArrayTags[mapTag]=typedArrayTags[numberTag$1]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag$1]=typedArrayTags[weakMapTag]=!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,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var e=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function arrayLikeKeys(e,r){var t=isArray(e),a=!t&&isArguments(e),n=!t&&!a&&isBuffer(e),o=!t&&!a&&!n&&isTypedArray(e),i=t||a||n||o,s=i?baseTimes(e.length,String):[],c=s.length;for(var u in e)!r&&!hasOwnProperty$3.call(e,u)||i&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||isIndex(u,c))||s.push(u);return s}var objectProto$5=Object.prototype;function isPrototype(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||objectProto$5)}var nativeKeys=overArg(Object.keys,Object),objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys(e);var r=[];for(var t in Object(e))hasOwnProperty$4.call(e,t)&&"constructor"!=t&&r.push(t);return r}function isObject(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag$1||r==genTag||r==asyncTag||r==proxyTag}function isArrayLike$1(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function keys(e){return isArrayLike$1(e)?arrayLikeKeys(e):baseKeys(e)}function baseForOwn(e,r){return e&&baseFor(e,r,keys)}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,a=assocIndexOf(t,e);return a<0?(++this.size,t.push([e,r])):t[a][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++rs))return!1;var u=o.get(e);if(u&&o.get(r))return u==r;var l=-1,f=!0,y=t&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(o.set(e,r),o.set(r,e);++lr.type.filter((function(e){var r;return void 0===t||(!1!==(r=isArrayLike(e))?!arrayTypeHandler({arg:t},r):!combineFn(e)(t))})).length)})).length}return!1},objectTypeHandler=function(e){var r=e.arg,t=e.param,a=[r];return Array.isArray(t.keys)&&t.keys.length&&a.push(t.keys),Reflect.apply(checkIsObject,null,a)},JsonqlEnumError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(r,t),r}(Error),JsonqlTypeError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(r,t),r}(Error),JsonqlCheckerError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(r,t),r}(Error),JsonqlError=function(e){function r(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];e.apply(this,t),this.message=t[0],this.detail=t[1],this.className=r.name,e.captureStackTrace&&e.captureStackTrace(this,r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var t={name:{configurable:!0},statusCode:{configurable:!0}};return t.name.get=function(){return"JsonqlError"},t.statusCode.get=function(){return NO_STATUS_CODE},Object.defineProperties(r,t),r}(Error),optionalHandler=function(e){var r=e.arg,t=e.param;return!!isNotEmpty(r)&&!(t.type.length>t.type.filter((function(r){return validateHandler(r,e)})).length)},validateHandler=function(e,r){var t;switch(!0){case e===OBJECT_TYPE$1:return!objectTypeHandler(r);case e===ARRAY_TYPE$1:return!checkIsArray(r.arg);case!1!==(t=isArrayLike(e)):return!arrayTypeHandler(r,t);default:return!combineFn(e)(r.arg)}},getOptionalValue=function(e,r){return void 0!==e?e:!0===r.optional&&void 0!==r.defaultvalue?r.defaultvalue:null},normalizeArgs=function(e,r){if(!checkIsArray(r))throw new JsonqlError(PARAMS_NOT_ARRAY_ERR);if(0===r.length)return[];if(!checkIsArray(e))throw new JsonqlError(ARGS_NOT_ARRAY_ERR);switch(!0){case e.length==r.length:return e.map((function(e,t){return{arg:e,index:t,param:r[t]}}));case!0===r[0].variable:var t=r[0].type;return e.map((function(e,a){return{arg:e,index:a,param:r[a]||{type:t,name:"_"}}}));case e.lengthr.length:var a=r.length,n=[DEFAULT_TYPE$1];return e.map((function(e,t){var o=t>=a||!!r[t].optional,i=r[t]||{type:n,name:"_"+t};return{arg:o?getOptionalValue(e,i):e,index:t,param:i,optional:o}}));default:throw new JsonqlError(EXCEPTION_CASE_ERR,{args:e,params:r})}},processReturn=function(e){return e.map((function(e){return e.arg}))},validateSync=function(e,r,t){var a;void 0===t&&(t=!1);var n=normalizeArgs(e,r),o=n.filter((function(e){return!0===e.optional||!0===e.param.optional?optionalHandler(e):!(e.param.type.length>e.param.type.filter((function(r){return validateHandler(r,e)})).length)}));return t?((a={})[ERROR_KEY]=o,a[DATA_KEY]=processReturn(n),a):o},validateAsync=function(e,r,t){return void 0===t&&(t=!1),new Promise((function(a,n){var o=validateSync(e,r,t);return t?o[ERROR_KEY].length?n(o[ERROR_KEY]):a(o[DATA_KEY]):o.length?n(o):a([])}))},defineProperty=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function baseAssignValue(e,r,t){"__proto__"==r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t}function assignMergeValue(e,r,t){(void 0===t||eq(e[r],t))&&(void 0!==t||r in e)||baseAssignValue(e,r,t)}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,Buffer$1=moduleExports$2?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(e,r){if(r)return e.slice();var t=e.length,a=allocUnsafe?allocUnsafe(t):new e.constructor(t);return e.copy(a),a}function cloneArrayBuffer(e){var r=new e.constructor(e.byteLength);return new Uint8Array(r).set(new Uint8Array(e)),r}function cloneTypedArray(e,r){var t=r?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function copyArray(e,r){var t=-1,a=e.length;for(r||(r=Array(a));++t0){if(++r>=HOT_COUNT)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}var setToString=shortOut(baseSetToString);function baseRest(e,r){return setToString(overRest(e,r,identity),e+"")}function isIterateeCall(e,r,t){if(!isObject(t))return!1;var a=typeof r;return!!("number"==a?isArrayLike$1(t)&&isIndex(r,t.length):"string"==a&&r in t)&&eq(t[r],e)}function createAssigner(e){return baseRest((function(r,t){var a=-1,n=t.length,o=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=e.length>3&&"function"==typeof o?(n--,o):void 0,i&&isIterateeCall(t[0],t[1],i)&&(o=n<3?void 0:o,n=1),r=Object(r);++a=e?t:function(t,r,n){var e=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(n=n>o?o:n)<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var u=Array(o);++e-1;);return n}(e,o),function(t,r){for(var n=t.length;n--&&P(r,t[n],0)>-1;);return n}(e,o)+1).join("")}var L=function(t){return!!a(t)||null!=t&&""!==I(t)},q="[object Number]";function U(t){return function(t){return"number"==typeof t||b(t)&&d(t)==q}(t)&&t!=+t}var J="[object String]";function W(t){return"string"==typeof t||!a(t)&&b(t)&&d(t)==J}var G=function(t){return!W(t)&&!U(parseFloat(t))},H=function(t){return""!==I(t)&&W(t)},K=function(t){return null!=t&&"boolean"==typeof t},Q=function(t,r){return void 0===r&&(r=!0),void 0!==t&&""!==t&&""!==I(t)&&(!1===r||!0===r&&null!==t)},Y="type",X="optional",Z="enumv",tt="args",rt="checker",nt="alias",et=Y,ot=X,ut=Z,it=tt,at=rt,ct=nt,ft="continue",lt=function(t){switch(t){case"number":return G;case"string":return H;case"boolean":return K;default:return Q}},st=function(t,r){return void 0===r&&(r=""),!!a(t)&&(""===r||""===I(r)||!(t.filter((function(t){return!lt(r)(t)})).length>0))},pt=function(t){if(t.indexOf("array.<")>-1&&t.indexOf(">")>-1){var r=t.replace("array.<","").replace(">","");return r.indexOf("|")?r.split("|"):[r]}return!1},vt=function(t,r){var n=t.arg;return r.length>1?!n.filter((function(t){return!(r.length>r.filter((function(r){return!lt(r)(t)})).length)})).length:r.length>r.filter((function(t){return!st(n,t)})).length};function ht(t,r){return function(n){return t(r(n))}}var yt=ht(Object.getPrototypeOf,Object),dt="[object Object]",bt=Function.prototype,gt=Object.prototype,_t=bt.toString,jt=gt.hasOwnProperty,mt=_t.call(Object);function wt(t){if(!b(t)||d(t)!=dt)return!1;var r=yt(t);if(null===r)return!0;var n=jt.call(r,"constructor")&&r.constructor;return"function"==typeof n&&n instanceof n&&_t.call(n)==mt}var Ot,At=function(t,r,n){for(var e=-1,o=Object(t),u=n(t),i=u.length;i--;){var a=u[Ot?i:++e];if(!1===r(o[a],a,o))break}return t};var St="[object Arguments]";function Pt(t){return b(t)&&d(t)==St}var kt=Object.prototype,Et=kt.hasOwnProperty,zt=kt.propertyIsEnumerable,xt=Pt(function(){return arguments}())?Pt:function(t){return b(t)&&Et.call(t,"callee")&&!zt.call(t,"callee")};var Tt="object"==typeof t&&t&&!t.nodeType&&t,Ct=Tt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ct&&Ct.exports===Tt?o.Buffer:void 0,Mt=(Ft?Ft.isBuffer:void 0)||function(){return!1},Nt=9007199254740991,$t=/^(?:0|[1-9]\d*)$/;function Dt(t,r){var n=typeof t;return!!(r=null==r?Nt:r)&&("number"==n||"symbol"!=n&&$t.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=Rt}var 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 It,Lt="object"==typeof t&&t&&!t.nodeType&&t,qt=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Ut=qt&&qt.exports===Lt&&n.process,Jt=function(){try{var t=qt&&qt.require&&qt.require("util").types;return t||Ut&&Ut.binding&&Ut.binding("util")}catch(t){}}(),Wt=Jt&&Jt.isTypedArray,Gt=Wt?(It=Wt,function(t){return It(t)}):function(t){return b(t)&&Bt(t.length)&&!!Vt[d(t)]},Ht=Object.prototype.hasOwnProperty;function Kt(t,r){var n=a(t),e=!n&&xt(t),o=!n&&!e&&Mt(t),u=!n&&!e&&!o&&Gt(t),i=n||e||o||u,c=i?function(t,r){for(var n=-1,e=Array(t);++n-1},pr.prototype.set=function(t,r){var n=this.__data__,e=lr(n,t);return e<0?(++this.size,n.push([t,r])):n[e][1]=r,this};var vr,hr=o["__core-js_shared__"],yr=(vr=/[^.]+$/.exec(hr&&hr.keys&&hr.keys.IE_PROTO||""))?"Symbol(src)_1."+vr:"";var dr=Function.prototype.toString;function br(t){if(null!=t){try{return dr.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var gr=/^\[object .+?Constructor\]$/,_r=Function.prototype,jr=Object.prototype,mr=_r.toString,wr=jr.hasOwnProperty,Or=RegExp("^"+mr.call(wr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ar(t){return!(!tr(t)||function(t){return!!yr&&yr in t}(t))&&(ur(t)?Or:gr).test(br(t))}function Sr(t,r){var n=function(t,r){return null==t?void 0:t[r]}(t,r);return Ar(n)?n:void 0}var Pr=Sr(o,"Map"),kr=Sr(Object,"create");var Er="__lodash_hash_undefined__",zr=Object.prototype.hasOwnProperty;var xr=Object.prototype.hasOwnProperty;var Tr="__lodash_hash_undefined__";function Cr(t){var r=-1,n=null==t?0:t.length;for(this.clear();++ra))return!1;var f=u.get(t);if(f&&u.get(r))return f==r;var l=-1,s=!0,p=n&Ir?new Rr:void 0;for(u.set(t,r),u.set(r,t);++lr.type.filter((function(t){var r;return void 0===n||(!1!==(r=pt(t))?!vt({arg:n},r):!lt(t)(n))})).length)})).length}return!1},ce=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(r,n),r}(Error),fe=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(r,n),r}(Error),le=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(r,n),r}(Error),se=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0},statusCode:{configurable:!0}};return n.name.get=function(){return"JsonqlError"},n.statusCode.get=function(){return-1},Object.defineProperties(r,n),r}(Error),pe=function(t,r){var n,e,o,u,i;switch(!0){case"object"===t:return o=(e=r).arg,u=e.param,i=[o],Array.isArray(u.keys)&&u.keys.length&&i.push(u.keys),!Reflect.apply(ae,null,i);case"array"===t:return!st(r.arg);case!1!==(n=pt(t)):return!vt(r,n);default:return!lt(t)(r.arg)}},ve=function(t,r){return void 0!==t?t:!0===r.optional&&void 0!==r.defaultvalue?r.defaultvalue:null},he=function(t,r){if(!st(r))throw new se("params is not an array! Did something gone wrong when you generate the contract.json?");if(0===r.length)return[];if(!st(t))throw new se("args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)");switch(!0){case t.length==r.length:return t.map((function(t,n){return{arg:t,index:n,param:r[n]}}));case!0===r[0].variable:var n=r[0].type;return t.map((function(t,e){return{arg:t,index:e,param:r[e]||{type:n,name:"_"}}}));case t.lengthr.length:var e=r.length,o=["any"];return t.map((function(t,n){var u=n>=e||!!r[n].optional,i=r[n]||{type:o,name:"_"+n};return{arg:u?ve(t,i):t,index:n,param:i,optional:u}}));default:throw new se("Could not understand your arguments and parameter structure!",{args:t,params:r})}},ye=function(t,r,n){var e;void 0===n&&(n=!1);var o=he(t,r),u=o.filter((function(t){return!0===t.optional||!0===t.param.optional?function(t){var r=t.arg,n=t.param;return!!L(r)&&!(n.type.length>n.type.filter((function(r){return pe(r,t)})).length)}(t):!(t.param.type.length>t.param.type.filter((function(r){return pe(r,t)})).length)}));return n?((e={}).error=u,e.data=o.map((function(t){return t.arg})),e):u},de=function(){try{var t=Sr(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function be(t,r,n){"__proto__"==r&&de?de(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}function ge(t,r,n){(void 0===n||fr(t[r],n))&&(void 0!==n||r in t)||be(t,r,n)}var _e="object"==typeof t&&t&&!t.nodeType&&t,je=_e&&"object"==typeof module&&module&&!module.nodeType&&module,me=je&&je.exports===_e?o.Buffer:void 0,we=me?me.allocUnsafe:void 0;function Oe(t,r){var n,e,o=r?(n=t.buffer,e=new n.constructor(n.byteLength),new qr(e).set(new qr(n)),e):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var Ae=Object.create,Se=function(){function t(){}return function(r){if(!tr(r))return{};if(Ae)return Ae(r);t.prototype=r;var n=new t;return t.prototype=void 0,n}}();function Pe(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]}var ke=Object.prototype.hasOwnProperty;function Ee(t,r,n){var e=t[r];ke.call(t,r)&&fr(e,n)&&(void 0!==n||r in t)||be(t,r,n)}var ze=Object.prototype.hasOwnProperty;function xe(t){if(!tr(t))return function(t){var r=[];if(null!=t)for(var n in Object(t))r.push(n);return r}(t);var r=Yt(t),n=[];for(var e in t)("constructor"!=e||!r&&ze.call(t,e))&&n.push(e);return n}function Te(t){return ir(t)?Kt(t,!0):xe(t)}function Ce(t){return function(t,r,n,e){var o=!n;n||(n={});for(var u=-1,i=r.length;++u0){if(++r>=Re)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(De);function Le(t,r){return Ie(function(t,r,n){return r=$e(void 0===r?t.length-1:r,0),function(){for(var e=arguments,o=-1,u=$e(e.length-r,0),i=Array(u);++o1?r[e-1]:void 0,u=e>2?r[2]:void 0;for(o=qe.length>3&&"function"==typeof o?(e--,o):void 0,u&&function(t,r,n){if(!tr(n))return!1;var e=typeof r;return!!("number"==e?ir(n)&&Dt(r,n.length):"string"==e&&r in n)&&fr(n[r],t)}(r[0],r[1],u)&&(o=e<3?void 0:o,e=1),t=Object(t);++n=e?t:function(t,r,n){var e=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(n=n>o?o:n)<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var u=Array(o);++e-1;);return n}(e,o),function(t,r){for(var n=t.length;n--&&P(r,t[n],0)>-1;);return n}(e,o)+1).join("")}var L=function(t){return!!a(t)||null!=t&&""!==I(t)},q="[object Number]";function U(t){return function(t){return"number"==typeof t||b(t)&&d(t)==q}(t)&&t!=+t}var J="[object String]";function W(t){return"string"==typeof t||!a(t)&&b(t)&&d(t)==J}var G=function(t){return!W(t)&&!U(parseFloat(t))},H=function(t){return""!==I(t)&&W(t)},K=function(t){return null!=t&&"boolean"==typeof t},Q=function(t,r){return void 0===r&&(r=!0),void 0!==t&&""!==t&&""!==I(t)&&(!1===r||!0===r&&null!==t)},Y="type",X="optional",Z="enumv",tt="args",rt="checker",nt="alias",et=Y,ot=X,ut=Z,it=tt,at=rt,ct=nt,ft="continue",lt=function(t){switch(t){case"number":return G;case"string":return H;case"boolean":return K;default:return Q}},st=function(t,r){return void 0===r&&(r=""),!!a(t)&&(""===r||""===I(r)||!(t.filter((function(t){return!lt(r)(t)})).length>0))},pt=function(t){if(t.indexOf("array.<")>-1&&t.indexOf(">")>-1){var r=t.replace("array.<","").replace(">","");return r.indexOf("|")?r.split("|"):[r]}return!1},vt=function(t,r){var n=t.arg;return r.length>1?!n.filter((function(t){return!(r.length>r.filter((function(r){return!lt(r)(t)})).length)})).length:r.length>r.filter((function(t){return!st(n,t)})).length};function ht(t,r){return function(n){return t(r(n))}}var yt=ht(Object.getPrototypeOf,Object),dt="[object Object]",bt=Function.prototype,gt=Object.prototype,_t=bt.toString,jt=gt.hasOwnProperty,mt=_t.call(Object);function wt(t){if(!b(t)||d(t)!=dt)return!1;var r=yt(t);if(null===r)return!0;var n=jt.call(r,"constructor")&&r.constructor;return"function"==typeof n&&n instanceof n&&_t.call(n)==mt}var Ot,At=function(t,r,n){for(var e=-1,o=Object(t),u=n(t),i=u.length;i--;){var a=u[Ot?i:++e];if(!1===r(o[a],a,o))break}return t};var St="[object Arguments]";function Pt(t){return b(t)&&d(t)==St}var kt=Object.prototype,Et=kt.hasOwnProperty,zt=kt.propertyIsEnumerable,xt=Pt(function(){return arguments}())?Pt:function(t){return b(t)&&Et.call(t,"callee")&&!zt.call(t,"callee")};var Tt="object"==typeof t&&t&&!t.nodeType&&t,Ct=Tt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ct&&Ct.exports===Tt?o.Buffer:void 0,Mt=(Ft?Ft.isBuffer:void 0)||function(){return!1},Nt=9007199254740991,$t=/^(?:0|[1-9]\d*)$/;function Dt(t,r){var n=typeof t;return!!(r=null==r?Nt:r)&&("number"==n||"symbol"!=n&&$t.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=Rt}var 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 It,Lt="object"==typeof t&&t&&!t.nodeType&&t,qt=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Ut=qt&&qt.exports===Lt&&n.process,Jt=function(){try{var t=qt&&qt.require&&qt.require("util").types;return t||Ut&&Ut.binding&&Ut.binding("util")}catch(t){}}(),Wt=Jt&&Jt.isTypedArray,Gt=Wt?(It=Wt,function(t){return It(t)}):function(t){return b(t)&&Bt(t.length)&&!!Vt[d(t)]},Ht=Object.prototype.hasOwnProperty;function Kt(t,r){var n=a(t),e=!n&&xt(t),o=!n&&!e&&Mt(t),u=!n&&!e&&!o&&Gt(t),i=n||e||o||u,c=i?function(t,r){for(var n=-1,e=Array(t);++n-1},pr.prototype.set=function(t,r){var n=this.__data__,e=lr(n,t);return e<0?(++this.size,n.push([t,r])):n[e][1]=r,this};var vr,hr=o["__core-js_shared__"],yr=(vr=/[^.]+$/.exec(hr&&hr.keys&&hr.keys.IE_PROTO||""))?"Symbol(src)_1."+vr:"";var dr=Function.prototype.toString;function br(t){if(null!=t){try{return dr.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var gr=/^\[object .+?Constructor\]$/,_r=Function.prototype,jr=Object.prototype,mr=_r.toString,wr=jr.hasOwnProperty,Or=RegExp("^"+mr.call(wr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ar(t){return!(!tr(t)||function(t){return!!yr&&yr in t}(t))&&(ur(t)?Or:gr).test(br(t))}function Sr(t,r){var n=function(t,r){return null==t?void 0:t[r]}(t,r);return Ar(n)?n:void 0}var Pr=Sr(o,"Map"),kr=Sr(Object,"create");var Er="__lodash_hash_undefined__",zr=Object.prototype.hasOwnProperty;var xr=Object.prototype.hasOwnProperty;var Tr="__lodash_hash_undefined__";function Cr(t){var r=-1,n=null==t?0:t.length;for(this.clear();++ra))return!1;var f=u.get(t);if(f&&u.get(r))return f==r;var l=-1,s=!0,p=n&Ir?new Rr:void 0;for(u.set(t,r),u.set(r,t);++lr.type.filter((function(t){var r;return void 0===n||(!1!==(r=pt(t))?!vt({arg:n},r):!lt(t)(n))})).length)})).length}return!1},ce=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(r,n),r}(Error),fe=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(r,n),r}(Error),le=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0}};return n.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(r,n),r}(Error),se=function(t){function r(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];t.apply(this,n),this.message=n[0],this.detail=n[1],this.className=r.name,t.captureStackTrace&&t.captureStackTrace(this,r)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={name:{configurable:!0},statusCode:{configurable:!0}};return n.name.get=function(){return"JsonqlError"},n.statusCode.get=function(){return-1},Object.defineProperties(r,n),r}(Error),pe=function(t,r){var n,e,o,u,i;switch(!0){case"object"===t:return o=(e=r).arg,u=e.param,i=[o],Array.isArray(u.keys)&&u.keys.length&&i.push(u.keys),!Reflect.apply(ae,null,i);case"array"===t:return!st(r.arg);case!1!==(n=pt(t)):return!vt(r,n);default:return!lt(t)(r.arg)}},ve=function(t,r){return void 0!==t?t:!0===r.optional&&void 0!==r.defaultvalue?r.defaultvalue:null},he=function(t,r){if(!st(r))throw new se("params is not an array! Did something gone wrong when you generate the contract.json?");if(0===r.length)return[];if(!st(t))throw new se("args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)");switch(!0){case t.length==r.length:return t.map((function(t,n){return{arg:t,index:n,param:r[n]}}));case!0===r[0].variable:var n=r[0].type;return t.map((function(t,e){return{arg:t,index:e,param:r[e]||{type:n,name:"_"}}}));case t.lengthr.length:var e=r.length,o=["any"];return t.map((function(t,n){var u=n>=e||!!r[n].optional,i=r[n]||{type:o,name:"_"+n};return{arg:u?ve(t,i):t,index:n,param:i,optional:u}}));default:throw new se("Could not understand your arguments and parameter structure!",{args:t,params:r})}},ye=function(t,r,n){var e;void 0===n&&(n=!1);var o=he(t,r),u=o.filter((function(t){return!0===t.optional||!0===t.param.optional?function(t){var r=t.arg,n=t.param;return!!L(r)&&!(n.type.length>n.type.filter((function(r){return pe(r,t)})).length)}(t):!(t.param.type.length>t.param.type.filter((function(r){return pe(r,t)})).length)}));return n?((e={}).error=u,e.data=o.map((function(t){return t.arg})),e):u},de=function(){try{var t=Sr(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function be(t,r,n){"__proto__"==r&&de?de(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}function ge(t,r,n){(void 0===n||fr(t[r],n))&&(void 0!==n||r in t)||be(t,r,n)}var _e="object"==typeof t&&t&&!t.nodeType&&t,je=_e&&"object"==typeof module&&module&&!module.nodeType&&module,me=je&&je.exports===_e?o.Buffer:void 0,we=me?me.allocUnsafe:void 0;function Oe(t,r){var n,e,o=r?(n=t.buffer,e=new n.constructor(n.byteLength),new qr(e).set(new qr(n)),e):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var Ae=Object.create,Se=function(){function t(){}return function(r){if(!tr(r))return{};if(Ae)return Ae(r);t.prototype=r;var n=new t;return t.prototype=void 0,n}}();function Pe(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]}var ke=Object.prototype.hasOwnProperty;function Ee(t,r,n){var e=t[r];ke.call(t,r)&&fr(e,n)&&(void 0!==n||r in t)||be(t,r,n)}var ze=Object.prototype.hasOwnProperty;function xe(t){if(!tr(t))return function(t){var r=[];if(null!=t)for(var n in Object(t))r.push(n);return r}(t);var r=Yt(t),n=[];for(var e in t)("constructor"!=e||!r&&ze.call(t,e))&&n.push(e);return n}function Te(t){return ir(t)?Kt(t,!0):xe(t)}function Ce(t){return function(t,r,n,e){var o=!n;n||(n={});for(var u=-1,i=r.length;++u0){if(++r>=Re)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(De);function Le(t,r){return Ie(function(t,r,n){return r=$e(void 0===r?t.length-1:r,0),function(){for(var e=arguments,o=-1,u=$e(e.length-r,0),i=Array(u);++o1?r[e-1]:void 0,u=e>2?r[2]:void 0;for(o=qe.length>3&&"function"==typeof o?(e--,o):void 0,u&&function(t,r,n){if(!tr(n))return!1;var e=typeof r;return!!("number"==e?ir(n)&&Dt(r,n.length):"string"==e&&r in n)&&fr(n[r],t)}(r[0],r[1],u)&&(o=e<3?void 0:o,e=1),t=Object(t);++n { const JSONQL_PARAMS_VALIDATOR_INFO = '__PLACEHOLDER__'; /** - * We recreate the method here to avoid the circlar import - * @param {object} config user supply configuration - * @param {object} appProps mutation options - * @param {object} [constantProps={}] optional: immutation options - * @return {object} all checked configuration + * construct the actual end user method, rename with prefix get since 1.5.2 + * @param {function} validateSync validation method + * @return {function} for performaning the actual valdiation */ -const checkConfigAsync = function(validateSync) { +const getCheckConfigAsync = function(validateSync) { + /** + * We recreate the method here to avoid the circlar import + * @param {object} config user supply configuration + * @param {object} appProps mutation options + * @param {object} [constantProps={}] optional: immutation options + * @return {object} all checked configuration + */ return function(config, appProps, constantProps= {}) { return checkOptionsAsync(config, appProps, constantProps, validateSync) } } -// copy of above but it's sync -const checkConfig = function(validateSync) { +/** + * copy of above but it's sync, rename with prefix get since 1.5.2 + * @param {function} validateSync validation method + * @return {function} for performaning the actual valdiation + */ +const getCheckConfig = function(validateSync) { return function(config, appProps, constantProps = {}) { return checkOptionsSync(config, appProps, constantProps, validateSync) } @@ -59,7 +68,7 @@ const checkConfig = function(validateSync) { export { createConfig, constructConfigFn, - checkConfigAsync, - checkConfig, + getCheckConfigAsync, + getCheckConfig, JSONQL_PARAMS_VALIDATOR_INFO } diff --git a/packages/ws-server-core/index.js b/packages/ws-server-core/index.js index 59fa1793784d8d6e180a8c585b4cd1c41f397c87..64fc07024710f594c49268870a3906a19a8a4757 100644 --- a/packages/ws-server-core/index.js +++ b/packages/ws-server-core/index.js @@ -24,7 +24,7 @@ function jsonqlWsServerCore(wsCreateServer, wsSetup) { return Reflect.apply(wsSetup, null, [opts, nspObj]) }) .catch(err => { - console.error('Init jsonql WebSocket server error', err) + console.error('Init jsonql Web Socket server error', err) throw new JsonqlError('jsonqlWsServer', err) }) } diff --git a/packages/ws-server-core/package.json b/packages/ws-server-core/package.json index 7e88ed5ba13f18408fdbf18f15a64e9e13b45a3c..90ed7f5038c18082ce9917080d747ceb49276a99 100644 --- a/packages/ws-server-core/package.json +++ b/packages/ws-server-core/package.json @@ -31,18 +31,17 @@ "debug": "^4.1.1", "esm": "^3.2.25", "fs-extra": "^8.1.0", - "jsonql-constants": "^1.8.13", + "jsonql-constants": "^1.8.14", "jsonql-errors": "^1.1.10", - "jsonql-jwt": "^1.3.7", - "jsonql-params-validator": "^1.5.1", - "jsonql-resolver": "^1.0.2", - "jsonql-utils": "^0.9.2", - "lodash": "^4.17.15", - "ws": "^7.2.0" + "jsonql-jwt": "^1.3.8", + "jsonql-params-validator": "^1.5.2", + "jsonql-resolver": "^1.0.4", + "jsonql-utils": "^0.9.3", + "lodash": "^4.17.15" }, "devDependencies": { "ava": "^2.4.0", - "jsonql-contract": "^1.8.4", + "jsonql-contract": "^1.8.5", "open": "^7.0.0" }, "ava": {