diff --git a/packages/@jsonql/client/package.json b/packages/@jsonql/client/package.json index b904479e4b69d63e7980b160e7eac0a196746fab..c0e106416a8815a7e3c2c91ed77dd8817b96b6a2 100644 --- a/packages/@jsonql/client/package.json +++ b/packages/@jsonql/client/package.json @@ -43,7 +43,7 @@ }, "license": "MIT", "dependencies": { - "jsonql-client": "^1.4.4" + "jsonql-client": "^1.4.5" }, "optionalDependencies": { "@jsonql/ws": "^0.8.3" diff --git a/packages/@jsonql/client/tests/basic.test.js b/packages/@jsonql/client/tests/basic.test.js index fd1451036561ebd2bdfeeb31af019c9d4fb24a70..338c29171d14a924df9164f71ee0ff01dd54beb8 100644 --- a/packages/@jsonql/client/tests/basic.test.js +++ b/packages/@jsonql/client/tests/basic.test.js @@ -10,7 +10,8 @@ const { objHasProp } = require('jsonql-utils') test(`Just checking the export options`, t => { const result = jsonqlWsClient.default({ - serverType: 'ws' + serverType: 'ws', + hostname: 'what the fuck?' }) debug(result) diff --git a/packages/@jsonql/client/ws.js b/packages/@jsonql/client/ws.js index 936f25f684135b5dcbdf2cfc5232f6305f184573..725a09eaafe888b6337e760df453ba66198bb9b7 100644 --- a/packages/@jsonql/client/ws.js +++ b/packages/@jsonql/client/ws.js @@ -3,11 +3,13 @@ import { jsonqlClient } from 'jsonql-client/module' import { getPreConfigCheck } from 'jsonql-client/opt' import jsonqlWsClient from '@jsonql/ws' -import { defaultOptions, constProps } from '@jsonql/ws/opt' +import { CHECKED_KEY } from 'jsonql-constants' +import { + defaultOptions as wsDefaultOptions, + constProps as wsConstProps +} from '@jsonql/ws/opt' import debug from 'debug' - -const debugFn = debug('jsonql-client:ws') - +const debugFn = debug('jsonql-client:test:ws') // debugFn(jsonqlWsClient) /** @@ -17,8 +19,11 @@ const debugFn = debug('jsonql-client:ws') */ export default function createJsonqlHttpWsClient(config = {}) { // @NOTE it return a function to accept the config - const fn = getPreConfigCheck(defaultOptions, constProps) + const fn = getPreConfigCheck(wsDefaultOptions, wsConstProps) + const opts = fn(config) + debugFn(opts[CHECKED_KEY]) + return opts; } diff --git a/packages/errors/dist/jsonql-errors.cjs.js b/packages/errors/dist/jsonql-errors.cjs.js index 6d528598e7455b7ad8ad28eb211baee5c7e702af..35b1ac3009528f51a711d3a10b2c420988e8eca7 100644 --- a/packages/errors/dist/jsonql-errors.cjs.js +++ b/packages/errors/dist/jsonql-errors.cjs.js @@ -1,2 +1,2 @@ -!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).jsonqlErrors={})}(this,(function(r){"use strict";var t=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 406},e.name.get=function(){return"Jsonql406Error"},Object.defineProperties(t,e),t}(Error),e=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"Jsonql500Error"},Object.defineProperties(t,e),t}(Error),o=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlAuthorisationError"},Object.defineProperties(t,e),t}(Error),n=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlContractAuthError"},Object.defineProperties(t,e),t}(Error),a=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"JsonqlResolverAppError"},Object.defineProperties(t,e),t}(Error),s=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 404},e.name.get=function(){return"JsonqlResolverNotFoundError"},Object.defineProperties(t,e),t}(Error),c=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(t,e),t}(Error),i=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(t,e),t}(Error),u=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(t,e),t}(Error),p=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlValidationError"},Object.defineProperties(t,e),t}(Error),l="No message",f=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return-1},Object.defineProperties(t,e),t}(Error),h=function(r){function t(e,o){r.call(this,o),this.statusCode=e,this.className=t.name}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlServerError"},Object.defineProperties(t,e),t}(Error),m=Object.freeze({__proto__:null,Jsonql406Error:t,Jsonql500Error:e,JsonqlAuthorisationError:o,JsonqlContractAuthError:n,JsonqlResolverAppError:a,JsonqlResolverNotFoundError:s,JsonqlEnumError:c,JsonqlTypeError:i,JsonqlCheckerError:u,JsonqlValidationError:p,JsonqlError:f,JsonqlServerError:h}),g=f,E=function(r,t){return!!Object.keys(r).filter((function(r){return t===r})).length};var d="unknown";function y(r,t){var e=function(r,t){return r.filter((function(r){return t instanceof r})).map((function(r){return r.name}))}(r,t);return e.length?e[0]:d}r.JSONQL_ERRORS_INFO="version: 1.1.6 module: umd",r.Jsonql406Error=t,r.Jsonql500Error=e,r.JsonqlAuthorisationError=o,r.JsonqlCheckerError=u,r.JsonqlContractAuthError=n,r.JsonqlEnumError=c,r.JsonqlError=f,r.JsonqlResolverAppError=a,r.JsonqlResolverNotFoundError=s,r.JsonqlServerError=h,r.JsonqlTypeError=i,r.JsonqlValidationError=p,r.UNKNOWN_ERROR=d,r.clientErrorsHandler=function(r){if(E(r,"error")){var t=r.error,e=t.className,o=t.name,n=e||o,a=t.message||l,s=t.detail||t;if(n&&m[n])throw new m[e](a,s);throw new g(a,s)}return r},r.finalCatch=function(r){if(Array.isArray(r))throw new p("",r);var m=r.message||l,g=r.detail||r;switch(!0){case r instanceof t:throw new t(m,g);case r instanceof e:throw new e(m,g);case r instanceof o:throw new o(m,g);case r instanceof n:throw new n(m,g);case r instanceof a:throw new a(m,g);case r instanceof s:throw new s(m,g);case r instanceof c:throw new c(m,g);case r instanceof i:throw new i(m,g);case r instanceof u:throw new u(m,g);case r instanceof p:throw new p(m,g);case r instanceof h:throw new h(m,g);default:throw new f(m,g)}},r.getErrorByStatus=function(r,t){switch(void 0===t&&(t=!1),r){case 401:return t?"JsonqlContractAuthError":"JsonqlAuthorisationError";case 403:return"JsonqlForbiddenError";case 404:return"JsonqlResolverNotFoundError";case 406:return"Jsonql406Error";case 500:return"Jsonql500Error";default:return"JsonqlError"}},r.getErrorNameByInstance=y,r.getErrorNameByInstanceWithDefault=function(r,t){var e=y(r,t);return e===d?"JsonqlError":e},Object.defineProperty(r,"__esModule",{value:!0})})); +!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).jsonqlErrors={})}(this,(function(r){"use strict";var t=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 406},e.name.get=function(){return"Jsonql406Error"},Object.defineProperties(t,e),t}(Error),e=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"Jsonql500Error"},Object.defineProperties(t,e),t}(Error),o=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlAuthorisationError"},Object.defineProperties(t,e),t}(Error),n=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlContractAuthError"},Object.defineProperties(t,e),t}(Error),a=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"JsonqlResolverAppError"},Object.defineProperties(t,e),t}(Error),s=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 404},e.name.get=function(){return"JsonqlResolverNotFoundError"},Object.defineProperties(t,e),t}(Error),c=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(t,e),t}(Error),i=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(t,e),t}(Error),u=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(t,e),t}(Error),p=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlValidationError"},Object.defineProperties(t,e),t}(Error),l="No message",f=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return-1},Object.defineProperties(t,e),t}(Error),h=function(r){function t(e,o){r.call(this,o),this.statusCode=e,this.className=t.name}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlServerError"},Object.defineProperties(t,e),t}(Error),m=Object.freeze({__proto__:null,Jsonql406Error:t,Jsonql500Error:e,JsonqlAuthorisationError:o,JsonqlContractAuthError:n,JsonqlResolverAppError:a,JsonqlResolverNotFoundError:s,JsonqlEnumError:c,JsonqlTypeError:i,JsonqlCheckerError:u,JsonqlValidationError:p,JsonqlError:f,JsonqlServerError:h}),g=f,E=function(r,t){return!!Object.keys(r).filter((function(r){return t===r})).length};var d="unknown";function y(r,t){var e=function(r,t){return r.filter((function(r){return t instanceof r})).map((function(r){return r.name}))}(r,t);return e.length?e[0]:d}r.JSONQL_ERRORS_INFO="version: 1.1.7 module: umd",r.Jsonql406Error=t,r.Jsonql500Error=e,r.JsonqlAuthorisationError=o,r.JsonqlCheckerError=u,r.JsonqlContractAuthError=n,r.JsonqlEnumError=c,r.JsonqlError=f,r.JsonqlResolverAppError=a,r.JsonqlResolverNotFoundError=s,r.JsonqlServerError=h,r.JsonqlTypeError=i,r.JsonqlValidationError=p,r.UNKNOWN_ERROR=d,r.clientErrorsHandler=function(r){if(E(r,"error")){var t=r.error,e=t.className,o=t.name,n=e||o,a=t.message||l,s=t.detail||t;if(n&&m[n])throw new m[e](a,s);throw new g(a,s)}return r},r.finalCatch=function(r){if(Array.isArray(r))throw new p("",r);var m=r.message||l,g=r.detail||r;switch(!0){case r instanceof t:throw new t(m,g);case r instanceof e:throw new e(m,g);case r instanceof o:throw new o(m,g);case r instanceof n:throw new n(m,g);case r instanceof a:throw new a(m,g);case r instanceof s:throw new s(m,g);case r instanceof c:throw new c(m,g);case r instanceof i:throw new i(m,g);case r instanceof u:throw new u(m,g);case r instanceof p:throw new p(m,g);case r instanceof h:throw new h(m,g);default:throw new f(m,g)}},r.getErrorByStatus=function(r,t){switch(void 0===t&&(t=!1),r){case 401:return t?"JsonqlContractAuthError":"JsonqlAuthorisationError";case 403:return"JsonqlForbiddenError";case 404:return"JsonqlResolverNotFoundError";case 406:return"Jsonql406Error";case 500:return"Jsonql500Error";default:return"JsonqlError"}},r.getErrorNameByInstance=y,r.getErrorNameByInstanceWithDefault=function(r,t){var e=y(r,t);return e===d?"JsonqlError":e},Object.defineProperty(r,"__esModule",{value:!0})})); //# sourceMappingURL=jsonql-errors.cjs.js.map diff --git a/packages/errors/dist/jsonql-errors.umd.js b/packages/errors/dist/jsonql-errors.umd.js index 78a17b8e5f2c09c2cf2b0e63ec3293386ef42c69..8407c8988c0ba6a73ffbc8e0b4260ec2c84fee35 100644 --- a/packages/errors/dist/jsonql-errors.umd.js +++ b/packages/errors/dist/jsonql-errors.umd.js @@ -1,2 +1,2 @@ -!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).jsonqlErrors={})}(this,(function(r){"use strict";var t=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 406},e.name.get=function(){return"Jsonql406Error"},Object.defineProperties(t,e),t}(Error),e=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"Jsonql500Error"},Object.defineProperties(t,e),t}(Error),o=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlAuthorisationError"},Object.defineProperties(t,e),t}(Error),n=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlContractAuthError"},Object.defineProperties(t,e),t}(Error),a=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"JsonqlResolverAppError"},Object.defineProperties(t,e),t}(Error),s=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 404},e.name.get=function(){return"JsonqlResolverNotFoundError"},Object.defineProperties(t,e),t}(Error),c=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(t,e),t}(Error),i=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(t,e),t}(Error),u=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(t,e),t}(Error),p=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlValidationError"},Object.defineProperties(t,e),t}(Error),l="No message",f=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return-1},Object.defineProperties(t,e),t}(Error),h=function(r){function t(e,o){r.call(this,o),this.statusCode=e,this.className=t.name}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlServerError"},Object.defineProperties(t,e),t}(Error),m=Object.freeze({__proto__:null,Jsonql406Error:t,Jsonql500Error:e,JsonqlAuthorisationError:o,JsonqlContractAuthError:n,JsonqlResolverAppError:a,JsonqlResolverNotFoundError:s,JsonqlEnumError:c,JsonqlTypeError:i,JsonqlCheckerError:u,JsonqlValidationError:p,JsonqlError:f,JsonqlServerError:h}),g=f,E=function(r,t){return!!Object.keys(r).filter((function(r){return t===r})).length};var d="unknown";function y(r,t){var e=function(r,t){return r.filter((function(r){return t instanceof r})).map((function(r){return r.name}))}(r,t);return e.length?e[0]:d}r.JSONQL_ERRORS_INFO="version: 1.1.6 module: umd",r.Jsonql406Error=t,r.Jsonql500Error=e,r.JsonqlAuthorisationError=o,r.JsonqlCheckerError=u,r.JsonqlContractAuthError=n,r.JsonqlEnumError=c,r.JsonqlError=f,r.JsonqlResolverAppError=a,r.JsonqlResolverNotFoundError=s,r.JsonqlServerError=h,r.JsonqlTypeError=i,r.JsonqlValidationError=p,r.UNKNOWN_ERROR=d,r.clientErrorsHandler=function(r){if(E(r,"error")){var t=r.error,e=t.className,o=t.name,n=e||o,a=t.message||l,s=t.detail||t;if(n&&m[n])throw new m[e](a,s);throw new g(a,s)}return r},r.finalCatch=function(r){if(Array.isArray(r))throw new p("",r);var m=r.message||l,g=r.detail||r;switch(!0){case r instanceof t:throw new t(m,g);case r instanceof e:throw new e(m,g);case r instanceof o:throw new o(m,g);case r instanceof n:throw new n(m,g);case r instanceof a:throw new a(m,g);case r instanceof s:throw new s(m,g);case r instanceof c:throw new c(m,g);case r instanceof i:throw new i(m,g);case r instanceof u:throw new u(m,g);case r instanceof p:throw new p(m,g);case r instanceof h:throw new h(m,g);default:throw new f(m,g)}},r.getErrorByStatus=function(r,t){switch(void 0===t&&(t=!1),r){case 401:return t?"JsonqlContractAuthError":"JsonqlAuthorisationError";case 403:return"JsonqlForbiddenError";case 404:return"JsonqlResolverNotFoundError";case 406:return"Jsonql406Error";case 500:return"Jsonql500Error";default:return"JsonqlError"}},r.getErrorNameByInstance=y,r.getErrorNameByInstanceWithDefault=function(r,t){var e=y(r,t);return e===d?"JsonqlError":e},Object.defineProperty(r,"__esModule",{value:!0})})); +!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).jsonqlErrors={})}(this,(function(r){"use strict";var t=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 406},e.name.get=function(){return"Jsonql406Error"},Object.defineProperties(t,e),t}(Error),e=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"Jsonql500Error"},Object.defineProperties(t,e),t}(Error),o=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlAuthorisationError"},Object.defineProperties(t,e),t}(Error),n=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 401},e.name.get=function(){return"JsonqlContractAuthError"},Object.defineProperties(t,e),t}(Error),a=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 500},e.name.get=function(){return"JsonqlResolverAppError"},Object.defineProperties(t,e),t}(Error),s=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={statusCode:{configurable:!0},name:{configurable:!0}};return e.statusCode.get=function(){return 404},e.name.get=function(){return"JsonqlResolverNotFoundError"},Object.defineProperties(t,e),t}(Error),c=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(t,e),t}(Error),i=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(t,e),t}(Error),u=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(t,e),t}(Error),p=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlValidationError"},Object.defineProperties(t,e),t}(Error),l="No message",f=function(r){function t(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];r.apply(this,e),this.message=e[0],this.detail=e[1],this.className=t.name,r.captureStackTrace&&r.captureStackTrace(this,t)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return-1},Object.defineProperties(t,e),t}(Error),h=function(r){function t(e,o){r.call(this,o),this.statusCode=e,this.className=t.name}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlServerError"},Object.defineProperties(t,e),t}(Error),m=Object.freeze({__proto__:null,Jsonql406Error:t,Jsonql500Error:e,JsonqlAuthorisationError:o,JsonqlContractAuthError:n,JsonqlResolverAppError:a,JsonqlResolverNotFoundError:s,JsonqlEnumError:c,JsonqlTypeError:i,JsonqlCheckerError:u,JsonqlValidationError:p,JsonqlError:f,JsonqlServerError:h}),g=f,E=function(r,t){return!!Object.keys(r).filter((function(r){return t===r})).length};var d="unknown";function y(r,t){var e=function(r,t){return r.filter((function(r){return t instanceof r})).map((function(r){return r.name}))}(r,t);return e.length?e[0]:d}r.JSONQL_ERRORS_INFO="version: 1.1.7 module: umd",r.Jsonql406Error=t,r.Jsonql500Error=e,r.JsonqlAuthorisationError=o,r.JsonqlCheckerError=u,r.JsonqlContractAuthError=n,r.JsonqlEnumError=c,r.JsonqlError=f,r.JsonqlResolverAppError=a,r.JsonqlResolverNotFoundError=s,r.JsonqlServerError=h,r.JsonqlTypeError=i,r.JsonqlValidationError=p,r.UNKNOWN_ERROR=d,r.clientErrorsHandler=function(r){if(E(r,"error")){var t=r.error,e=t.className,o=t.name,n=e||o,a=t.message||l,s=t.detail||t;if(n&&m[n])throw new m[e](a,s);throw new g(a,s)}return r},r.finalCatch=function(r){if(Array.isArray(r))throw new p("",r);var m=r.message||l,g=r.detail||r;switch(!0){case r instanceof t:throw new t(m,g);case r instanceof e:throw new e(m,g);case r instanceof o:throw new o(m,g);case r instanceof n:throw new n(m,g);case r instanceof a:throw new a(m,g);case r instanceof s:throw new s(m,g);case r instanceof c:throw new c(m,g);case r instanceof i:throw new i(m,g);case r instanceof u:throw new u(m,g);case r instanceof p:throw new p(m,g);case r instanceof h:throw new h(m,g);default:throw new f(m,g)}},r.getErrorByStatus=function(r,t){switch(void 0===t&&(t=!1),r){case 401:return t?"JsonqlContractAuthError":"JsonqlAuthorisationError";case 403:return"JsonqlForbiddenError";case 404:return"JsonqlResolverNotFoundError";case 406:return"Jsonql406Error";case 500:return"Jsonql500Error";default:return"JsonqlError"}},r.getErrorNameByInstance=y,r.getErrorNameByInstanceWithDefault=function(r,t){var e=y(r,t);return e===d?"JsonqlError":e},Object.defineProperty(r,"__esModule",{value:!0})})); //# sourceMappingURL=jsonql-errors.umd.js.map diff --git a/packages/errors/package.json b/packages/errors/package.json index 50d0332f776fe4ae1a100d41acf672f715011526..c3d78b4ba79022606fbf6bdeaf1ded460bd91128 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-errors", - "version": "1.1.6", + "version": "1.1.7", "description": "Jsonql js error classes use across the projects", "main": "dist/jsonql-errors.cjs.js", "module": "index.js", @@ -33,7 +33,7 @@ "fs-extra": "^8.1.0", "koa": "^2.11.0", "koa-bodyparser": "^4.2.1", - "rollup": "^1.26.5", + "rollup": "^1.27.6", "rollup-plugin-alias": "^2.2.0", "rollup-plugin-async": "^1.2.0", "rollup-plugin-buble": "^0.19.8", @@ -76,6 +76,6 @@ "author": "Joel Chu ", "license": "ISC", "dependencies": { - "jsonql-constants": "^1.8.10" + "jsonql-constants": "^1.8.12" } } diff --git a/packages/errors/src/406-error.js b/packages/errors/src/406-error.js index 113cca5e0034b0e46ee1e1d5b28dc98d10726b92..baf3700194ebe95da1e719c08d9bd6568b5fe7e9 100644 --- a/packages/errors/src/406-error.js +++ b/packages/errors/src/406-error.js @@ -7,15 +7,15 @@ */ export default class Jsonql406Error extends Error { constructor(...args) { - super(...args); - this.message = args[0]; - this.detail = args[1]; + super(...args) + this.message = args[0] + this.detail = args[1] // We can't access the static name from an instance // but we can do it like this this.className = Jsonql406Error.name; if (Error.captureStackTrace) { - Error.captureStackTrace(this, Jsonql406Error); + Error.captureStackTrace(this, Jsonql406Error) } } diff --git a/packages/errors/src/500-error.js b/packages/errors/src/500-error.js index 0b1a91726aeb84529cf7d230bd1e99afac5ba1af..58cf79515334e7dbcf088fb531d881ec0eedcb91 100644 --- a/packages/errors/src/500-error.js +++ b/packages/errors/src/500-error.js @@ -6,15 +6,15 @@ */ export default class Jsonql500Error extends Error { constructor(...args) { - super(...args); + super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = Jsonql500Error.name; if (Error.captureStackTrace) { - Error.captureStackTrace(this, Jsonql500Error); + Error.captureStackTrace(this, Jsonql500Error) } } diff --git a/packages/errors/src/authorisation-error.js b/packages/errors/src/authorisation-error.js index cac20c75c2d62ec1ce9c5266d0908025b7f011a6..2ffc9adf5e50dba6f26639f9b43ad8d09d479ce8 100644 --- a/packages/errors/src/authorisation-error.js +++ b/packages/errors/src/authorisation-error.js @@ -7,14 +7,14 @@ */ export default class JsonqlAuthorisationError extends Error { constructor(...args) { - super(...args); - this.message = args[0]; - this.detail = args[1]; + super(...args) + this.message = args[0] + this.detail = args[1] this.className = JsonqlAuthorisationError.name; if (Error.captureStackTrace) { - Error.captureStackTrace(this, JsonqlAuthorisationError); + Error.captureStackTrace(this, JsonqlAuthorisationError) } } diff --git a/packages/errors/src/checker-error.js b/packages/errors/src/checker-error.js index c62f87f09a2fdad546c7b555bcf5729511aa4a96..f4e45f9f88899a7e1259ce30ed160de0ff2930a9 100644 --- a/packages/errors/src/checker-error.js +++ b/packages/errors/src/checker-error.js @@ -2,14 +2,14 @@ // if that failed then we throw this error export default class JsonqlCheckerError extends Error { constructor(...args) { - super(...args); - this.message = args[0]; - this.detail = args[1]; + super(...args) + this.message = args[0] + this.detail = args[1] this.className = JsonqlCheckerError.name; if (Error.captureStackTrace) { - Error.captureStackTrace(this, JsonqlCheckerError); + Error.captureStackTrace(this, JsonqlCheckerError) } } diff --git a/packages/errors/src/contract-auth-error.js b/packages/errors/src/contract-auth-error.js index ae1b8d53ec57fb65834dfd23efa3ae9a52282ad2..ad60b4b58dcc10abafafdab775ca294175ecb40d 100644 --- a/packages/errors/src/contract-auth-error.js +++ b/packages/errors/src/contract-auth-error.js @@ -7,9 +7,9 @@ */ export default class JsonqlContractAuthError extends Error { constructor(...args) { - super(...args); - this.message = args[0]; - this.detail = args[1]; + super(...args) + this.message = args[0] + this.detail = args[1] this.className = JsonqlContractAuthError.name; diff --git a/packages/errors/src/enum-error.js b/packages/errors/src/enum-error.js index 4c210c55d4d73b4b53cdd3201ef59abe5f158455..607e6f25331eacb77d4eb3a63dbb0ffe2ac0e767 100644 --- a/packages/errors/src/enum-error.js +++ b/packages/errors/src/enum-error.js @@ -1,10 +1,10 @@ // this get throw from within the checkOptions when run through the enum failed export default class JsonqlEnumError extends Error { constructor(...args) { - super(...args); - - this.message = args[0]; - this.detail = args[1]; + super(...args) + + this.message = args[0] + this.detail = args[1] this.className = JsonqlEnumError.name; diff --git a/packages/errors/src/error.js b/packages/errors/src/error.js index f557828140a1e4e0a734566e9878f83c3738cf5a..11d6c12c13059c3c838835e980d8059b0cb9045b 100644 --- a/packages/errors/src/error.js +++ b/packages/errors/src/error.js @@ -10,8 +10,8 @@ export default class JsonqlError extends Error { constructor(...args) { super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = JsonqlError.name; diff --git a/packages/errors/src/forbidden-error.js b/packages/errors/src/forbidden-error.js index ae8638287d040ccd95c00d879cf684d49e53ec5b..fbbf94f44c92fc9f62457d7b79a3e1c895e9a615 100644 --- a/packages/errors/src/forbidden-error.js +++ b/packages/errors/src/forbidden-error.js @@ -8,9 +8,9 @@ */ export default class JsonqlForbiddenError extends Error { constructor(...args) { - super(...args); - this.message = args[0]; - this.detail = args[1]; + super(...args) + this.message = args[0] + this.detail = args[1] this.className = JsonqlForbiddenError.name; diff --git a/packages/errors/src/general.js b/packages/errors/src/general.js index ea41e5cc118ee5b6dfc77c7d221ccd9ddaaa062d..c24cefecd73cd9240bb9d8493e47da3725803d25 100644 --- a/packages/errors/src/general.js +++ b/packages/errors/src/general.js @@ -4,7 +4,7 @@ export default class GeneralError extends Error { constructor(...args) { - super(...args); + super(...args) this.message = args[0] this.detail = args[1] diff --git a/packages/errors/src/resolver-app-error.js b/packages/errors/src/resolver-app-error.js index 4980063837bcaa8a64c03ffa39243f229cb95be4..78eec15157b576411e542391d0c79ea673eb5d0d 100644 --- a/packages/errors/src/resolver-app-error.js +++ b/packages/errors/src/resolver-app-error.js @@ -7,10 +7,10 @@ */ export default class JsonqlResolverAppError extends Error { constructor(...args) { - super(...args); + super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = JsonqlResolverAppError.name; diff --git a/packages/errors/src/resolver-not-found-error.js b/packages/errors/src/resolver-not-found-error.js index 68d7c2480db3f33c26ed987a005485f87aadb707..9acbc9cc955a57d8f4c27028eb36aebd39421d34 100644 --- a/packages/errors/src/resolver-not-found-error.js +++ b/packages/errors/src/resolver-not-found-error.js @@ -6,10 +6,10 @@ */ export default class JsonqlResolverNotFoundError extends Error { constructor(...args) { - super(...args); + super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = JsonqlResolverNotFoundError.name; diff --git a/packages/errors/src/server-error.js b/packages/errors/src/server-error.js index e0ea8bb587c121ac5c7b39ff9012d322ca6aadc6..b30566ad8f5cbfc0f14111cfa6ce05c11d6b79ce 100644 --- a/packages/errors/src/server-error.js +++ b/packages/errors/src/server-error.js @@ -5,7 +5,7 @@ export default class JsonqlServerError extends Error { constructor(statusCode, message) { - super(message); + super(message) this.statusCode = statusCode; this.className = JsonqlServerError.name; } diff --git a/packages/errors/src/type-error.js b/packages/errors/src/type-error.js index 1ea5a8d376bdc2439278401b29ef8671434c49e6..82b1b86ced8bf87e128d197da901a12752ee66ef 100644 --- a/packages/errors/src/type-error.js +++ b/packages/errors/src/type-error.js @@ -1,10 +1,10 @@ // this will throw from inside the checkOptions export default class JsonqlTypeError extends Error { constructor(...args) { - super(...args); + super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = JsonqlTypeError.name; diff --git a/packages/errors/src/validation-error.js b/packages/errors/src/validation-error.js index 968763f7cc9df072b057b38a0ba063d02a009f79..2f2aab6fce6470b8eb82c9506468fe240c37a960 100644 --- a/packages/errors/src/validation-error.js +++ b/packages/errors/src/validation-error.js @@ -2,15 +2,15 @@ // when validaton failed export default class JsonqlValidationError extends Error { constructor(...args) { - super(...args); + super(...args) - this.message = args[0]; - this.detail = args[1]; + this.message = args[0] + this.detail = args[1] this.className = JsonqlValidationError.name; if (Error.captureStackTrace) { - Error.captureStackTrace(this, JsonqlValidationError); + Error.captureStackTrace(this, JsonqlValidationError) } } diff --git a/packages/koa/package.json b/packages/koa/package.json index 02e82256f5985c038029b3fdb6a4d167f9faf054..2c00e418547d07484cf2ff80c00b2960e2a509b8 100644 --- a/packages/koa/package.json +++ b/packages/koa/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-koa", - "version": "1.4.19", + "version": "1.4.20", "description": "jsonql Koa middleware", "main": "main.js", "module": "index.js", @@ -76,19 +76,19 @@ "fs-extra": "^8.1.0", "jsonql-constants": "^1.8.12", "jsonql-contract": "^1.8.4", - "jsonql-errors": "^1.1.6", + "jsonql-errors": "^1.1.7", "jsonql-jwt": "^1.3.4", "jsonql-node-client": "^1.2.4", - "jsonql-params-validator": "^1.4.11", + "jsonql-params-validator": "^1.4.13", "jsonql-resolver": "^0.9.9", - "jsonql-utils": "^0.8.8", - "jsonql-web-console": "^0.4.3", + "jsonql-utils": "^0.8.10", + "jsonql-web-console": "^0.4.4", "koa-compose": "^4.1.0", "lodash": "^4.17.15" }, "devDependencies": { "ava": "^2.4.0", - "jsonql-ws-server": "^1.4.4", + "jsonql-ws-server": "^1.4.5", "jwt-decode": "^2.2.0", "koa": "^2.11.0", "koa-bodyparser": "^4.2.1", diff --git a/packages/validator/dist/jsonql-params-validator.cjs.js b/packages/validator/dist/jsonql-params-validator.cjs.js index ce08bd471030204bec17535c97fd7e7e4334734d..84da55d1cbf4ab1bc63a18ffaf11658c8dcf68ed 100644 --- a/packages/validator/dist/jsonql-params-validator.cjs.js +++ b/packages/validator/dist/jsonql-params-validator.cjs.js @@ -1,2 +1,2 @@ -"use strict";function isNull(e){return null===e}Object.defineProperty(exports,"__esModule",{value:!0});var 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;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,a=Array(n);++t>>0,r>>>=0;for(var o=Array(a);++n=HOT_COUNT)return arguments[0]}else n=0;return t.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 n=typeof r;return!!("number"==n?isArrayLike(t)&&isIndex(r,t.length):"string"==n&&r in t)&&eq(t[r],e)}function createAssigner(s){return baseRest(function(e,r){var t=-1,n=r.length,a=1",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)||!(0t.filter(function(e){return!combineFn(e)(r)}).length)}).length:t.length>t.filter(function(e){return!checkIsArray(r,e)}).length},checkIsObject=function(r,e){if(void 0===e&&(e=null),isPlainObject(r)){if(!e)return!0;if(checkIsArray(e))return!e.filter(function(e){var t=r[e.name];return!(e.type.length>e.type.filter(function(e){var r;return!!isUndefined(t)||(!1!==(r=isArrayLike$1(e))?!arrayTypeHandler({arg:t},r):!combineFn(e)(t))}).length)}).length}return!1},objectTypeHandler=function(e){var r=e.arg,t=e.param,n=[r];return Array.isArray(t.keys)&&t.keys.length&&n.push(t.keys),checkIsObject.apply(null,n)},isBrowser=function(){try{if(window||document)return!0}catch(e){}return!1},isNode=function(){try{if(!isBrowser()&&global$1)return!0}catch(e){}return!1};function whereAmI(){return isBrowser()?"browser":isNode()?"node":"unknown"}var JsonqlBaseError=function(t){function e(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).where=function(){return whereAmI()},e}(Error),JsonqlEnumError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(n,e),n}(Error),JsonqlTypeError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(n,e),n}(Error),JsonqlCheckerError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(n,e),n}(Error),JsonqlError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,Error.captureStackTrace&&Error.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return NO_STATUS_CODE},Object.defineProperties(n,e),n}(JsonqlBaseError);function log(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{window&&window.console&&Reflect.apply(console.log,console,e)}catch(e){}}var optionalHandler=function(r){var e=r.arg,t=r.param;return!!notEmpty(e)&&!(t.type.length>t.type.filter(function(e){return validateHandler(e,r)}).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$1(e)):return!arrayTypeHandler(r,t);default:return!combineFn(e)(r.arg)}},getOptionalValue=function(e,r){return isUndefined(e)?!0!==r.optional||isUndefined(r.defaultvalue)?null:r.defaultvalue:e},normalizeArgs=function(t,a){if(!checkIsArray(a))throw new JsonqlError(PARAMS_NOT_ARRAY_ERR);if(0===a.length)return[];if(!checkIsArray(t))throw new JsonqlError(ARGS_NOT_ARRAY_ERR);switch(!0){case t.length==a.length:return log(1),t.map(function(e,r){return{arg:e,index:r,param:a[r]}});case!0===a[0].variable:log(2);var n=a[0].type;return t.map(function(e,r){return{arg:e,index:r,param:a[r]||{type:n,name:"_"}}});case t.lengtha.length:log(4);var o=a.length,i=[DEFAULT_TYPE$1];return t.map(function(e,r){var t=o<=r||!!a[r].optional,n=a[r]||{type:i,name:"_"+r};return{arg:t?getOptionalValue(e,n):e,index:r,param:n,optional:t}});default:throw log(5),new JsonqlError(EXCEPTION_CASE_ERR,{args:t,params:a})}},processReturn=function(e){return e.map(function(e){return e.arg})},validateSync=function(e,r,t){var n;void 0===t&&(t=!1);var a=normalizeArgs(e,r),o=a.filter(function(r){return!0===r.optional||!0===r.param.optional?optionalHandler(r):!(r.param.type.length>r.param.type.filter(function(e){return validateHandler(e,r)}).length)});return t?((n={})[ERROR_KEY]=o,n[DATA_KEY]=processReturn(a),n):o},validateAsync=function(n,a,o){return void 0===o&&(o=!1),new Promise(function(e,r){var t=validateSync(n,a,o);return o?t[ERROR_KEY].length?r(t[ERROR_KEY]):e(t[DATA_KEY]):t.length?r(t):e([])})},isInArray=function(e,r){return!!e.filter(function(e){return e===r}).length},isObjectHasKey=function(e,r){var t=Object.keys(e);return isInArray(t,r)},isEmpty=function(e){return!notEmpty(e)};function mapAliasConfigKeys(e,r){var t=omitBy(r,function(e,r){return!e[ALIAS_KEY$1]});return isEqual(t,{})?e:mapKeys(e,function(e,r){return findKey(t,function(e){return e.alias===r})||r})}function preservePristineValues(e,r){var t=mapAliasConfigKeys(e,r);return{pristineValues:mapValues(omitBy(r,function(e,r){return isObjectHasKey(t,r)}),function(e){return e.args}),checkAgainstAppProps:omitBy(r,function(e,r){return!isObjectHasKey(t,r)}),config:t}}function processConfigAction(a,e){return mapValues(e,function(e,r){var t,n;return isUndefined(a[r])||!0===e[OPTIONAL_KEY$1]&&isEmpty(a[r])?merge({},e,((t={})[KEY_WORD$1]=!0,t)):((n={})[ARGS_KEY$1]=a[r],n[TYPE_KEY$1]=e[TYPE_KEY$1],n[OPTIONAL_KEY$1]=e[OPTIONAL_KEY$1]||!1,n[ENUM_KEY$1]=e[ENUM_KEY$1]||!1,n[CHECKER_KEY$1]=e[CHECKER_KEY$1]||!1,n)})}function prepareArgsForValidation(e,r){var t=preservePristineValues(e,r),n=t.config,a=t.pristineValues;return[processConfigAction(n,t.checkAgainstAppProps),a]}var toArray=function(e){return checkIsArray(e)?e:[e]},inArray=function(e,r){return!!e.filter(function(e){return e===r}).length};function validateHandler$1(e,r){var t,n=[[e[ARGS_KEY$1]],[(t={},t[TYPE_KEY$1]=toArray(e[TYPE_KEY$1]),t[OPTIONAL_KEY$1]=e[OPTIONAL_KEY$1],t)]];return Reflect.apply(r,null,n)}var enumHandler=function(e,r){return!checkIsArray(r)||inArray(r,e)},checkerHandler=function(e,r){try{return!!isFunction(r)&&r.apply(null,[e])}catch(e){return!1}};function runValidationAction(n){return function(e,r){if(e[KEY_WORD$1])return e[ARGS_KEY$1];var t=validateHandler$1(e,n);if(t.length)throw log("runValidationAction",r,e),new JsonqlTypeError(r,t);if(!1!==e[ENUM_KEY$1]&&!enumHandler(e[ARGS_KEY$1],e[ENUM_KEY$1]))throw log(ENUM_KEY$1,e[ENUM_KEY$1]),new JsonqlEnumError(r);if(!1!==e[CHECKER_KEY$1]&&!checkerHandler(e[ARGS_KEY$1],e[CHECKER_KEY$1]))throw log(CHECKER_KEY$1,e[CHECKER_KEY$1]),new JsonqlCheckerError(r);return e[ARGS_KEY$1]}}function runValidation(e,r){var t=e[0],n=e[1],a=mapValues(t,runValidationAction(r));return merge(a,n)}var configToArgs=function(e,r){return Promise.resolve(prepareArgsForValidation(e,r))};function checkOptionsAsync(e,r,t,n){return void 0===e&&(e={}),configToArgs(e,r).then(function(e){return runValidation(e,n)}).then(function(e){return merge({},e,t)})}function checkOptionsSync(e,r,t,n){return void 0===e&&(e={}),merge(runValidation(prepareArgsForValidation(e,r),n),t)}function constructConfigFn(e,r,t,n,a,o){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===o&&(o=!1);var i={};return i[ARGS_KEY]=e,i[TYPE_KEY]=r,!0===t&&(i[OPTIONAL_KEY]=!0),checkIsArray(n)&&(i[ENUM_KEY]=n),isFunction(a)&&(i[CHECKER_KEY]=a),isString(o)&&(i[ALIAS_KEY]=o),i}var createConfig=function(e,r,t){void 0===t&&(t={});var n=t[OPTIONAL_KEY],a=t[ENUM_KEY],o=t[CHECKER_KEY],i=t[ALIAS_KEY];return constructConfigFn.apply(null,[e,r,n,a,o,i])},JSONQL_PARAMS_VALIDATOR_INFO="version: 1.4.11 module: cjs",checkConfigAsync=function(n){return function(e,r,t){return void 0===t&&(t={}),checkOptionsAsync(e,r,t,n)}},checkConfig=function(n){return function(e,r,t){return void 0===t&&(t={}),checkOptionsSync(e,r,t,n)}},isObject$1=checkIsObject,isAny=checkIsAny,isString$1=checkIsString,isBoolean$1=checkIsBoolean,isNumber$1=checkIsNumber,isArray$1=checkIsArray,isNotEmpty=notEmpty,normalizeArgs$1=normalizeArgs,validateSync$1=validateSync,validateAsync$1=validateAsync,JSONQL_PARAMS_VALIDATOR_INFO$1=JSONQL_PARAMS_VALIDATOR_INFO,createConfig$1=createConfig,constructConfig=constructConfigFn,checkConfigAsync$1=checkConfigAsync(validateSync),checkConfig$1=checkConfig(validateSync),inArray$1=isInArray,isObjectHasKey$1=isObjectHasKey;exports.JSONQL_PARAMS_VALIDATOR_INFO=JSONQL_PARAMS_VALIDATOR_INFO$1,exports.checkConfig=checkConfig$1,exports.checkConfigAsync=checkConfigAsync$1,exports.constructConfig=constructConfig,exports.createConfig=createConfig$1,exports.inArray=inArray$1,exports.isAny=isAny,exports.isArray=isArray$1,exports.isBoolean=isBoolean$1,exports.isObjectHasKey=isObjectHasKey$1,exports.isNotEmpty=isNotEmpty,exports.isNumber=isNumber$1,exports.isObject=isObject$1,exports.isString=isString$1,exports.normalizeArgs=normalizeArgs$1,exports.validateAsync=validateAsync$1,exports.validateSync=validateSync$1; +"use strict";function isNull(e){return null===e}Object.defineProperty(exports,"__esModule",{value:!0});var 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;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,a=Array(n);++t>>0,r>>>=0;for(var o=Array(a);++n=HOT_COUNT)return arguments[0]}else n=0;return t.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 n=typeof r;return!!("number"==n?isArrayLike(t)&&isIndex(r,t.length):"string"==n&&r in t)&&eq(t[r],e)}function createAssigner(s){return baseRest(function(e,r){var t=-1,n=r.length,a=1",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)||!(0t.filter(function(e){return!combineFn(e)(r)}).length)}).length:t.length>t.filter(function(e){return!checkIsArray(r,e)}).length},checkIsObject=function(r,e){if(void 0===e&&(e=null),isPlainObject(r)){if(!e)return!0;if(checkIsArray(e))return!e.filter(function(e){var t=r[e.name];return!(e.type.length>e.type.filter(function(e){var r;return!!isUndefined(t)||(!1!==(r=isArrayLike$1(e))?!arrayTypeHandler({arg:t},r):!combineFn(e)(t))}).length)}).length}return!1},objectTypeHandler=function(e){var r=e.arg,t=e.param,n=[r];return Array.isArray(t.keys)&&t.keys.length&&n.push(t.keys),checkIsObject.apply(null,n)},JsonqlEnumError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(n,e),n}(Error),JsonqlTypeError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(n,e),n}(Error),JsonqlCheckerError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0}};return e.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(n,e),n}(Error),JsonqlError=function(t){function n(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];t.apply(this,e),this.message=e[0],this.detail=e[1],this.className=n.name,t.captureStackTrace&&t.captureStackTrace(this,n)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var e={name:{configurable:!0},statusCode:{configurable:!0}};return e.name.get=function(){return"JsonqlError"},e.statusCode.get=function(){return NO_STATUS_CODE},Object.defineProperties(n,e),n}(Error);function log(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];try{window&&window.console&&Reflect.apply(console.log,console,e)}catch(e){}}var optionalHandler=function(r){var e=r.arg,t=r.param;return!!notEmpty(e)&&!(t.type.length>t.type.filter(function(e){return validateHandler(e,r)}).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$1(e)):return!arrayTypeHandler(r,t);default:return!combineFn(e)(r.arg)}},getOptionalValue=function(e,r){return isUndefined(e)?!0!==r.optional||isUndefined(r.defaultvalue)?null:r.defaultvalue:e},normalizeArgs=function(t,a){if(!checkIsArray(a))throw new JsonqlError(PARAMS_NOT_ARRAY_ERR);if(0===a.length)return[];if(!checkIsArray(t))throw new JsonqlError(ARGS_NOT_ARRAY_ERR);switch(!0){case t.length==a.length:return log(1),t.map(function(e,r){return{arg:e,index:r,param:a[r]}});case!0===a[0].variable:log(2);var n=a[0].type;return t.map(function(e,r){return{arg:e,index:r,param:a[r]||{type:n,name:"_"}}});case t.lengtha.length:log(4);var o=a.length,i=[DEFAULT_TYPE$1];return t.map(function(e,r){var t=o<=r||!!a[r].optional,n=a[r]||{type:i,name:"_"+r};return{arg:t?getOptionalValue(e,n):e,index:r,param:n,optional:t}});default:throw log(5),new JsonqlError(EXCEPTION_CASE_ERR,{args:t,params:a})}},processReturn=function(e){return e.map(function(e){return e.arg})},validateSync=function(e,r,t){var n;void 0===t&&(t=!1);var a=normalizeArgs(e,r),o=a.filter(function(r){return!0===r.optional||!0===r.param.optional?optionalHandler(r):!(r.param.type.length>r.param.type.filter(function(e){return validateHandler(e,r)}).length)});return t?((n={})[ERROR_KEY]=o,n[DATA_KEY]=processReturn(a),n):o},validateAsync=function(n,a,o){return void 0===o&&(o=!1),new Promise(function(e,r){var t=validateSync(n,a,o);return o?t[ERROR_KEY].length?r(t[ERROR_KEY]):e(t[DATA_KEY]):t.length?r(t):e([])})},isInArray=function(e,r){return!!e.filter(function(e){return e===r}).length},isObjectHasKey=function(e,r){var t=Object.keys(e);return isInArray(t,r)},isEmpty=function(e){return!notEmpty(e)};function mapAliasConfigKeys(e,r){var t=omitBy(r,function(e,r){return!e[ALIAS_KEY$1]});return isEqual(t,{})?e:mapKeys(e,function(e,r){return findKey(t,function(e){return e.alias===r})||r})}function preservePristineValues(e,r){var t=mapAliasConfigKeys(e,r);return{pristineValues:mapValues(omitBy(r,function(e,r){return isObjectHasKey(t,r)}),function(e){return e.args}),checkAgainstAppProps:omitBy(r,function(e,r){return!isObjectHasKey(t,r)}),config:t}}function processConfigAction(a,e){return mapValues(e,function(e,r){var t,n;return isUndefined(a[r])||!0===e[OPTIONAL_KEY$1]&&isEmpty(a[r])?merge({},e,((t={})[KEY_WORD$1]=!0,t)):((n={})[ARGS_KEY$1]=a[r],n[TYPE_KEY$1]=e[TYPE_KEY$1],n[OPTIONAL_KEY$1]=e[OPTIONAL_KEY$1]||!1,n[ENUM_KEY$1]=e[ENUM_KEY$1]||!1,n[CHECKER_KEY$1]=e[CHECKER_KEY$1]||!1,n)})}function prepareArgsForValidation(e,r){var t=preservePristineValues(e,r),n=t.config,a=t.pristineValues;return[processConfigAction(n,t.checkAgainstAppProps),a]}var toArray=function(e){return checkIsArray(e)?e:[e]},inArray=function(e,r){return!!e.filter(function(e){return e===r}).length};function validateHandler$1(e,r){var t,n=[[e[ARGS_KEY$1]],[(t={},t[TYPE_KEY$1]=toArray(e[TYPE_KEY$1]),t[OPTIONAL_KEY$1]=e[OPTIONAL_KEY$1],t)]];return Reflect.apply(r,null,n)}var enumHandler=function(e,r){return!checkIsArray(r)||inArray(r,e)},checkerHandler=function(e,r){try{return!!isFunction(r)&&r.apply(null,[e])}catch(e){return!1}};function runValidationAction(n){return function(e,r){if(e[KEY_WORD$1])return e[ARGS_KEY$1];var t=validateHandler$1(e,n);if(t.length)throw log("runValidationAction",r,e),new JsonqlTypeError(r,t);if(!1!==e[ENUM_KEY$1]&&!enumHandler(e[ARGS_KEY$1],e[ENUM_KEY$1]))throw log(ENUM_KEY$1,e[ENUM_KEY$1]),new JsonqlEnumError(r);if(!1!==e[CHECKER_KEY$1]&&!checkerHandler(e[ARGS_KEY$1],e[CHECKER_KEY$1]))throw log(CHECKER_KEY$1,e[CHECKER_KEY$1]),new JsonqlCheckerError(r);return e[ARGS_KEY$1]}}function runValidation(e,r){var t=e[0],n=e[1],a=mapValues(t,runValidationAction(r));return merge(a,n)}var configToArgs=function(e,r){return Promise.resolve(prepareArgsForValidation(e,r))};function checkOptionsAsync(e,r,t,n){return void 0===e&&(e={}),configToArgs(e,r).then(function(e){return runValidation(e,n)}).then(function(e){return merge({},e,t)})}function checkOptionsSync(e,r,t,n){return void 0===e&&(e={}),merge(runValidation(prepareArgsForValidation(e,r),n),t)}function constructConfig(e,r,t,n,a,o){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===o&&(o=!1);var i={};return i[ARGS_KEY]=e,i[TYPE_KEY]=r,!0===t&&(i[OPTIONAL_KEY]=!0),checkIsArray(n)&&(i[ENUM_KEY]=n),isFunction(a)&&(i[CHECKER_KEY]=a),isString(o)&&(i[ALIAS_KEY]=o),i}var createConfig=function(e,r,t){void 0===t&&(t={});var n=t[OPTIONAL_KEY],a=t[ENUM_KEY],o=t[CHECKER_KEY],i=t[ALIAS_KEY];return constructConfig.apply(null,[e,r,n,a,o,i])},JSONQL_PARAMS_VALIDATOR_INFO="version: 1.4.13 module: cjs",checkConfigAsync=function(n){return function(e,r,t){return void 0===t&&(t={}),checkOptionsAsync(e,r,t,n)}},checkConfig=function(n){return function(e,r,t){return void 0===t&&(t={}),checkOptionsSync(e,r,t,n)}},isObject$1=checkIsObject,isAny=checkIsAny,isString$1=checkIsString,isBoolean$1=checkIsBoolean,isNumber$1=checkIsNumber,isArray$1=checkIsArray,isNotEmpty=notEmpty,normalizeArgs$1=normalizeArgs,validateSync$1=validateSync,validateAsync$1=validateAsync,JSONQL_PARAMS_VALIDATOR_INFO$1=JSONQL_PARAMS_VALIDATOR_INFO,createConfig$1=createConfig,constructConfig$1=constructConfig,checkConfigAsync$1=checkConfigAsync(validateSync),checkConfig$1=checkConfig(validateSync),inArray$1=isInArray,isObjectHasKey$1=isObjectHasKey;exports.JSONQL_PARAMS_VALIDATOR_INFO=JSONQL_PARAMS_VALIDATOR_INFO$1,exports.checkConfig=checkConfig$1,exports.checkConfigAsync=checkConfigAsync$1,exports.constructConfig=constructConfig$1,exports.createConfig=createConfig$1,exports.inArray=inArray$1,exports.isAny=isAny,exports.isArray=isArray$1,exports.isBoolean=isBoolean$1,exports.isNotEmpty=isNotEmpty,exports.isNumber=isNumber$1,exports.isObject=isObject$1,exports.isObjectHasKey=isObjectHasKey$1,exports.isString=isString$1,exports.normalizeArgs=normalizeArgs$1,exports.validateAsync=validateAsync$1,exports.validateSync=validateSync$1; //# sourceMappingURL=jsonql-params-validator.cjs.js.map diff --git a/packages/validator/dist/jsonql-params-validator.umd.js b/packages/validator/dist/jsonql-params-validator.umd.js index 782746b6437b5718cfd27197a18937cf8becb80b..7b48d23ff1ae4e2f8edac9904b9647ffbc31caf0 100644 --- a/packages/validator/dist/jsonql-params-validator.umd.js +++ b/packages/validator/dist/jsonql-params-validator.umd.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).jsonqlParamsValidator={})}(this,function(t){"use strict";var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n="object"==typeof r&&r&&r.Object===Object&&r,e="object"==typeof self&&self&&self.Object===Object&&self,o=n||e||Function("return this")(),u=o.Symbol;function i(t,r){for(var n=-1,e=null==t?0:t.length,o=Array(e);++n>>0,r>>>=0;for(var u=Array(o);++e")){var r=t.replace(Ve,"").replace(">","");return r.indexOf("|")?r.split("|"):[r]}return!1}function Fe(t,n){var r=t.arg;return 1n.filter(function(t){return!xe(t)(r)}).length)}).length:n.length>n.filter(function(t){return!Te(r,t)}).length}function Ne(r,t){if(void 0===t&&(t=null),et(r)){if(!t)return!0;if(Te(t))return!t.filter(function(t){var n=r[t.name];return!(t.type.length>t.type.filter(function(t){var r;return!!U(n)||(!1!==(r=Ce(t))?!Fe({arg:n},r):!xe(t)(n))}).length)}).length}return!1}function $e(){try{if(window||document)return!0}catch(t){}return!1}var Be="error",Me="optional",Re="enumv",De="checker",Ie="alias",Ve="array.<",Le="type",qe=Me,Ue=Re,Je="args",We=De,Ge=Ie,Ke="continue";function Qe(){return $e()?"browser":function(){try{if(!$e()&&r)return!0}catch(t){}return!1}()?"node":"unknown"}var Ye=function(n){function t(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t)}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).where=function(){return Qe()},t}(Error),He=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(e,t),e}(Error),Xe=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(e,t),e}(Error),Ze=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(e,t),e}(Error),to=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,Error.captureStackTrace&&Error.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0},statusCode:{configurable:!0}};return t.name.get=function(){return"JsonqlError"},t.statusCode.get=function(){return-1},Object.defineProperties(e,t),e}(Ye);function ro(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];try{window&&window.console&&Reflect.apply(console.log,console,t)}catch(t){}}function no(t,r){return U(t)?!0!==r.optional||U(r.defaultvalue)?null:r.defaultvalue:t}function eo(n,o){if(!Te(o))throw new to("params is not an array! Did something gone wrong when you generate the contract.json?");if(0===o.length)return[];if(!Te(n))throw new to("args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)");switch(!0){case n.length==o.length:return ro(1),n.map(function(t,r){return{arg:t,index:r,param:o[r]}});case!0===o[0].variable:ro(2);var e=o[0].type;return n.map(function(t,r){return{arg:t,index:r,param:o[r]||{type:e,name:"_"}}});case n.lengtho.length:ro(4);var u=o.length,i=["any"];return n.map(function(t,r){var n=u<=r||!!o[r].optional,e=o[r]||{type:i,name:"_"+r};return{arg:n?no(t,e):t,index:r,param:e,optional:n}});default:throw ro(5),new to("Could not understand your arguments and parameter structure!",{args:n,params:o})}}function oo(t,r,n){var e;void 0===n&&(n=!1);var o=eo(t,r),u=o.filter(function(r){return!0===r.optional||!0===r.param.optional?function(r){var t=r.arg,n=r.param;return!!Se(t)&&!(n.type.length>n.type.filter(function(t){return io(t,r)}).length)}(r):!(r.param.type.length>r.param.type.filter(function(t){return io(t,r)}).length)});return n?((e={})[Be]=u,e.data=function(t){return t.map(function(t){return t.arg})}(o),e):u}function uo(t,r){return!!t.filter(function(t){return t===r}).length}var io=function(t,r){var n;switch(!0){case"object"===t:return!function(t){var r=t.arg,n=t.param,e=[r];return Array.isArray(n.keys)&&n.keys.length&&e.push(n.keys),Ne.apply(null,e)}(r);case"array"===t:return!Te(r.arg);case!1!==(n=Ce(t)):return!Fe(r,n);default:return!xe(t)(r.arg)}},ao=function(t,r){var n=Object.keys(t);return uo(n,r)},co=function(t){return!Se(t)};function fo(t,r){var n=Ae(r,function(t,r){return!t[Ge]});return function(t,r){return yn(t,r)}(n,{})?t:function(t,e){var o={};return e=Ln(e),Lt(t,function(t,r,n){Un(o,e(t,r,n),t)}),o}(t,function(t,r){return function(t,r){return function(t,e,r){var o;return r(t,function(t,r,n){if(e(t,r,n))return o=r,!1}),o}(t,Ln(r),Lt)}(n,function(t){return t.alias===r})||r})}function lo(t,r){var n=function(t,r){var n=fo(t,r);return{pristineValues:_e(Ae(r,function(t,r){return ao(n,r)}),function(t){return t.args}),checkAgainstAppProps:Ae(r,function(t,r){return!ao(n,r)}),config:n}}(t,r),e=n.config,o=n.pristineValues;return[function(o,t){return _e(t,function(t,r){var n,e;return U(o[r])||!0===t[qe]&&co(o[r])?be({},t,((n={})[Ke]=!0,n)):((e={})[Je]=o[r],e[Le]=t[Le],e[qe]=t[qe]||!1,e[Ue]=t[Ue]||!1,e[We]=t[We]||!1,e)})}(e,n.checkAgainstAppProps),o]}var so=function(t){return Te(t)?t:[t]};var po=function(t,r){return!Te(r)||function(t,r){return!!t.filter(function(t){return t===r}).length}(r,t)},vo=function(t,r){try{return!!Dt(r)&&r.apply(null,[t])}catch(t){return!1}};function ho(e){return function(t,r){if(t[Ke])return t[Je];var n=function(t,r){var n,e=[[t[Je]],[(n={},n[Le]=so(t[Le]),n[qe]=t[qe],n)]];return Reflect.apply(r,null,e)}(t,e);if(n.length)throw ro("runValidationAction",r,t),new Xe(r,n);if(!1!==t[Ue]&&!po(t[Je],t[Ue]))throw ro(Ue,t[Ue]),new He(r);if(!1!==t[We]&&!vo(t[Je],t[We]))throw ro(We,t[We]),new Ze(r);return t[Je]}}function yo(t,r){var n=t[0],e=t[1],o=_e(n,ho(r));return be(o,e)}function go(t,r,n,e){return void 0===t&&(t={}),function(t,r){return Promise.resolve(lo(t,r))}(t,r).then(function(t){return yo(t,e)}).then(function(t){return be({},t,n)})}function bo(t,r,n,e,o,u){void 0===n&&(n=!1),void 0===e&&(e=!1),void 0===o&&(o=!1),void 0===u&&(u=!1);var i={};return i.args=t,i.type=r,!0===n&&(i[Me]=!0),Te(e)&&(i[Re]=e),Dt(o)&&(i[De]=o),K(u)&&(i[Ie]=u),i}function _o(e,o,u){return void 0===u&&(u=!1),new Promise(function(t,r){var n=oo(e,o,u);return u?n[Be].length?r(n[Be]):t(n.data):n.length?r(n):t([])})}function jo(t,r,n){void 0===n&&(n={});var e=n[Me],o=n[Re],u=n[De],i=n[Ie];return bo.apply(null,[t,r,e,o,u,i])}var mo,wo,Oo=Ne,Ao=ze,So=ke,Po=Ee,ko=Pe,Eo=Te,zo=Se,xo=eo,To=oo,Co=bo,Fo=(mo=oo,function(t,r,n){return void 0===n&&(n={}),go(t,r,n,mo)}),No=(wo=oo,function(t,r,n){return void 0===n&&(n={}),function(t,r,n,e){return void 0===t&&(t={}),be(yo(lo(t,r),e),n)}(t,r,n,wo)}),$o=uo,Bo=ao;t.JSONQL_PARAMS_VALIDATOR_INFO="version: 1.4.11 module: umd",t.checkConfig=No,t.checkConfigAsync=Fo,t.constructConfig=Co,t.createConfig=jo,t.inArray=$o,t.isAny=Ao,t.isArray=Eo,t.isBoolean=Po,t.isObjectHasKey=Bo,t.isNotEmpty=zo,t.isNumber=ko,t.isObject=Oo,t.isString=So,t.normalizeArgs=xo,t.validateAsync=_o,t.validateSync=To,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).jsonqlParamsValidator={})}(this,function(t){"use strict";var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n="object"==typeof r&&r&&r.Object===Object&&r,e="object"==typeof self&&self&&self.Object===Object&&self,o=n||e||Function("return this")(),u=o.Symbol;function i(t,r){for(var n=-1,e=null==t?0:t.length,o=Array(e);++n>>0,r>>>=0;for(var u=Array(o);++e")){var r=t.replace(Ve,"").replace(">","");return r.indexOf("|")?r.split("|"):[r]}return!1}function Fe(t,n){var r=t.arg;return 1n.filter(function(t){return!xe(t)(r)}).length)}).length:n.length>n.filter(function(t){return!Te(r,t)}).length}function Ne(r,t){if(void 0===t&&(t=null),et(r)){if(!t)return!0;if(Te(t))return!t.filter(function(t){var n=r[t.name];return!(t.type.length>t.type.filter(function(t){var r;return!!U(n)||(!1!==(r=Ce(t))?!Fe({arg:n},r):!xe(t)(n))}).length)}).length}return!1}var $e="error",Be="optional",Me="enumv",Re="checker",De="alias",Ve="array.<",Ie="type",Le=Be,qe=Me,Ue="args",Je=Re,We=De,Ge="continue",He=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlEnumError"},Object.defineProperties(e,t),e}(Error),Ke=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlTypeError"},Object.defineProperties(e,t),e}(Error),Qe=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0}};return t.name.get=function(){return"JsonqlCheckerError"},Object.defineProperties(e,t),e}(Error),Ye=function(n){function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];n.apply(this,t),this.message=t[0],this.detail=t[1],this.className=e.name,n.captureStackTrace&&n.captureStackTrace(this,e)}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={name:{configurable:!0},statusCode:{configurable:!0}};return t.name.get=function(){return"JsonqlError"},t.statusCode.get=function(){return-1},Object.defineProperties(e,t),e}(Error);function Xe(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];try{window&&window.console&&Reflect.apply(console.log,console,t)}catch(t){}}function Ze(t,r){return U(t)?!0!==r.optional||U(r.defaultvalue)?null:r.defaultvalue:t}function to(n,o){if(!Te(o))throw new Ye("params is not an array! Did something gone wrong when you generate the contract.json?");if(0===o.length)return[];if(!Te(n))throw new Ye("args is not an array! You might want to do: ES6 Array.from(arguments) or ES5 Array.prototype.slice.call(arguments)");switch(!0){case n.length==o.length:return Xe(1),n.map(function(t,r){return{arg:t,index:r,param:o[r]}});case!0===o[0].variable:Xe(2);var e=o[0].type;return n.map(function(t,r){return{arg:t,index:r,param:o[r]||{type:e,name:"_"}}});case n.lengtho.length:Xe(4);var u=o.length,i=["any"];return n.map(function(t,r){var n=u<=r||!!o[r].optional,e=o[r]||{type:i,name:"_"+r};return{arg:n?Ze(t,e):t,index:r,param:e,optional:n}});default:throw Xe(5),new Ye("Could not understand your arguments and parameter structure!",{args:n,params:o})}}function ro(t,r,n){var e;void 0===n&&(n=!1);var o=to(t,r),u=o.filter(function(r){return!0===r.optional||!0===r.param.optional?function(r){var t=r.arg,n=r.param;return!!Se(t)&&!(n.type.length>n.type.filter(function(t){return eo(t,r)}).length)}(r):!(r.param.type.length>r.param.type.filter(function(t){return eo(t,r)}).length)});return n?((e={})[$e]=u,e.data=function(t){return t.map(function(t){return t.arg})}(o),e):u}function no(t,r){return!!t.filter(function(t){return t===r}).length}var eo=function(t,r){var n;switch(!0){case"object"===t:return!function(t){var r=t.arg,n=t.param,e=[r];return Array.isArray(n.keys)&&n.keys.length&&e.push(n.keys),Ne.apply(null,e)}(r);case"array"===t:return!Te(r.arg);case!1!==(n=Ce(t)):return!Fe(r,n);default:return!xe(t)(r.arg)}},oo=function(t,r){var n=Object.keys(t);return no(n,r)},uo=function(t){return!Se(t)};function io(t,r){var n=Ae(r,function(t,r){return!t[We]});return function(t,r){return yn(t,r)}(n,{})?t:function(t,e){var o={};return e=Ln(e),Lt(t,function(t,r,n){Un(o,e(t,r,n),t)}),o}(t,function(t,r){return function(t,r){return function(t,e,r){var o;return r(t,function(t,r,n){if(e(t,r,n))return o=r,!1}),o}(t,Ln(r),Lt)}(n,function(t){return t.alias===r})||r})}function ao(t,r){var n=function(t,r){var n=io(t,r);return{pristineValues:_e(Ae(r,function(t,r){return oo(n,r)}),function(t){return t.args}),checkAgainstAppProps:Ae(r,function(t,r){return!oo(n,r)}),config:n}}(t,r),e=n.config,o=n.pristineValues;return[function(o,t){return _e(t,function(t,r){var n,e;return U(o[r])||!0===t[Le]&&uo(o[r])?be({},t,((n={})[Ge]=!0,n)):((e={})[Ue]=o[r],e[Ie]=t[Ie],e[Le]=t[Le]||!1,e[qe]=t[qe]||!1,e[Je]=t[Je]||!1,e)})}(e,n.checkAgainstAppProps),o]}var co=function(t){return Te(t)?t:[t]};var fo=function(t,r){return!Te(r)||function(t,r){return!!t.filter(function(t){return t===r}).length}(r,t)},lo=function(t,r){try{return!!Dt(r)&&r.apply(null,[t])}catch(t){return!1}};function so(e){return function(t,r){if(t[Ge])return t[Ue];var n=function(t,r){var n,e=[[t[Ue]],[(n={},n[Ie]=co(t[Ie]),n[Le]=t[Le],n)]];return Reflect.apply(r,null,e)}(t,e);if(n.length)throw Xe("runValidationAction",r,t),new Ke(r,n);if(!1!==t[qe]&&!fo(t[Ue],t[qe]))throw Xe(qe,t[qe]),new He(r);if(!1!==t[Je]&&!lo(t[Ue],t[Je]))throw Xe(Je,t[Je]),new Qe(r);return t[Ue]}}function po(t,r){var n=t[0],e=t[1],o=_e(n,so(r));return be(o,e)}function vo(t,r,n,e){return void 0===t&&(t={}),function(t,r){return Promise.resolve(ao(t,r))}(t,r).then(function(t){return po(t,e)}).then(function(t){return be({},t,n)})}function ho(t,r,n,e,o,u){void 0===n&&(n=!1),void 0===e&&(e=!1),void 0===o&&(o=!1),void 0===u&&(u=!1);var i={};return i.args=t,i.type=r,!0===n&&(i[Be]=!0),Te(e)&&(i[Me]=e),Dt(o)&&(i[Re]=o),H(u)&&(i[De]=u),i}function yo(e,o,u){return void 0===u&&(u=!1),new Promise(function(t,r){var n=ro(e,o,u);return u?n[$e].length?r(n[$e]):t(n.data):n.length?r(n):t([])})}function go(t,r,n){void 0===n&&(n={});var e=n[Be],o=n[Me],u=n[Re],i=n[De];return ho.apply(null,[t,r,e,o,u,i])}var bo,_o,jo=Ne,mo=ze,wo=ke,Oo=Ee,Ao=Pe,So=Te,Po=Se,ko=to,Eo=ro,zo=ho,xo=(bo=ro,function(t,r,n){return void 0===n&&(n={}),vo(t,r,n,bo)}),To=(_o=ro,function(t,r,n){return void 0===n&&(n={}),function(t,r,n,e){return void 0===t&&(t={}),be(po(ao(t,r),e),n)}(t,r,n,_o)}),Co=no,Fo=oo;t.JSONQL_PARAMS_VALIDATOR_INFO="version: 1.4.13 module: umd",t.checkConfig=To,t.checkConfigAsync=xo,t.constructConfig=zo,t.createConfig=go,t.inArray=Co,t.isAny=mo,t.isArray=So,t.isBoolean=Oo,t.isNotEmpty=Po,t.isNumber=Ao,t.isObject=jo,t.isObjectHasKey=Fo,t.isString=wo,t.normalizeArgs=ko,t.validateAsync=yo,t.validateSync=Eo,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=jsonql-params-validator.umd.js.map diff --git a/packages/validator/package.json b/packages/validator/package.json index 3b128d67e186e46c226cdb4e71135ffebe21d972..44ea602154ae740408603a981f6789827bf9333d 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-params-validator", - "version": "1.4.11", + "version": "1.4.13", "description": "JSONQL parameters validator written in ES6+ to use with the client / server", "module": "index.js", "browser": "dist/jsonql-params-validator.umd.js", @@ -37,8 +37,8 @@ "jsonql" ], "dependencies": { - "jsonql-constants": "^1.8.3", - "jsonql-errors": "^1.1.3", + "jsonql-constants": "^1.8.12", + "jsonql-errors": "^1.1.7", "lodash-es": "^4.17.15" }, "devDependencies": { @@ -46,8 +46,8 @@ "debug": "^4.1.1", "esm": "^3.2.25", "fs-extra": "^8.1.0", - "rollup": "^1.21.4", - "rollup-plugin-alias": "^2.0.0", + "rollup": "^1.27.6", + "rollup-plugin-alias": "^2.2.0", "rollup-plugin-async": "^1.2.0", "rollup-plugin-buble": "^0.19.8", "rollup-plugin-bundle-size": "^1.0.3", @@ -93,6 +93,6 @@ "engine": { "node": ">=8" }, - "author": "Joel Chu ", + "author": "Joel Chu ", "license": "MIT" } diff --git a/packages/web-console/package.json b/packages/web-console/package.json index c9b24503aa4822d571877a1522d141328a14a42a..9f2c55402a14fffa72904fc9de77e998b2fa7070 100644 --- a/packages/web-console/package.json +++ b/packages/web-console/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-web-console", - "version": "0.4.3", + "version": "0.4.4", "main": "koa/index.js", "scripts": { "serve": "vue-cli-service serve", @@ -19,26 +19,26 @@ "dependencies": { "debug": "^4.1.1", "fs-extra": "^8.1.0", - "jsonql-constants": "^1.7.9", + "jsonql-constants": "^1.8.12", "lodash": "^4.17.15" }, "devDependencies": { - "@vue/cli-plugin-babel": "^3.10.0", - "@vue/cli-plugin-eslint": "^3.10.0", - "@vue/cli-service": "^3.10.0", - "babel-eslint": "^10.0.2", - "bulma": "^0.7.5", - "core-js": "^3.2.1", - "eslint": "^6.1.0", - "eslint-plugin-vue": "^5.2.3", - "jsonql-client": "^1.3.1", - "jsonql-koa": "^1.3.5", - "jsonql-ws-client": "^1.0.0-beta.1", + "@vue/cli-plugin-babel": "^4.1.1", + "@vue/cli-plugin-eslint": "^4.1.1", + "@vue/cli-service": "^4.1.1", + "babel-eslint": "^10.0.3", + "bulma": "^0.8.0", + "core-js": "^3.4.5", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^6.0.1", + "jsonql-client": "^1.4.5", + "jsonql-koa": "^1.4.19", + "jsonql-ws-client": "^1.3.4", "server-io-core": "^1.2.0", "vue": "^2.6.10", "vue-async-computed": "^3.7.0", "vue-template-compiler": "^2.6.10", - "vuex": "^3.1.1" + "vuex": "^3.1.2" }, "homepage": "jsonql.org", "repository": { @@ -72,5 +72,6 @@ "jsonql", "jsonql-koa", "node" - ] + ], + "author": "Joel Chu " }