diff --git a/packages/ast/pnpm-lock.yaml b/packages/ast/pnpm-lock.yaml index 254693b6c2eac7c9458b69368554546ac2b80d78..1fad9ffbb2e049b627c0c7918eab5cad29ff476d 100644 --- a/packages/ast/pnpm-lock.yaml +++ b/packages/ast/pnpm-lock.yaml @@ -2,7 +2,7 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/constants': workspace:^0.5.1 + '@jsonql/constants': workspace:^0.5.10 '@types/node': ^17.0.23 '@typescript-eslint/eslint-plugin': ^5.17.0 '@typescript-eslint/parser': ^5.17.0 diff --git a/packages/config-validator/pnpm-lock.yaml b/packages/config-validator/pnpm-lock.yaml index 605a9bd41a71224b656787b7ffa5941b4eb81909..39e02372a8b94a4a78b8f023beeed7cddfef4fa5 100644 --- a/packages/config-validator/pnpm-lock.yaml +++ b/packages/config-validator/pnpm-lock.yaml @@ -2,10 +2,10 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/constants': workspace:^0.5.9 + '@jsonql/constants': workspace:^0.5.10 '@jsonql/errors': workspace:^0.6.0 - '@jsonql/utils': workspace:^0.3.3 - '@jsonql/validator-core': workspace:^0.1.0 + '@jsonql/utils': workspace:^0.4.0 + '@jsonql/validator-core': workspace:^0.1.2 '@types/node': ^17.0.23 '@typescript-eslint/eslint-plugin': ^5.17.0 '@typescript-eslint/parser': ^5.17.0 diff --git a/packages/contract/pnpm-lock.yaml b/packages/contract/pnpm-lock.yaml index 7ce6db4de504e6245f343a6b519e29cdf8d58438..aaafbf3f99a6c4a3d31d17265d4145ac21f446a0 100644 --- a/packages/contract/pnpm-lock.yaml +++ b/packages/contract/pnpm-lock.yaml @@ -2,9 +2,9 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/constants': workspace:^0.5.1 - '@jsonql/errors': workspace:^0.5.1 - '@jsonql/utils': workspace:^0.3.0 + '@jsonql/constants': workspace:^0.5.10 + '@jsonql/errors': workspace:^0.6.0 + '@jsonql/utils': workspace:^0.4.0 '@swc/cli': ^0.1.57 '@swc/core': ^1.2.165 '@types/node': ^17.0.23 diff --git a/packages/errors/pnpm-lock.yaml b/packages/errors/pnpm-lock.yaml index d23a595c9937bfbdd606d2e918315cdbc1aa51a6..8685cc65db9c82eae49a02b6b51962d1e793a00a 100644 --- a/packages/errors/pnpm-lock.yaml +++ b/packages/errors/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: 5.3 specifiers: - '@jsonql/constants': workspace:^0.2.0 + '@jsonql/constants': workspace:^0.5.10 '@types/koa': ^2.13.4 '@types/koa-bodyparser': ^4.3.7 koa: ^2.13.4 diff --git a/packages/utils/pnpm-lock.yaml b/packages/utils/pnpm-lock.yaml index 7c930f8aa3958f5e6f3d5ec3ae908ef03947da1e..3d98c97158f67b57444848590d42e931c41cc6b8 100644 --- a/packages/utils/pnpm-lock.yaml +++ b/packages/utils/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/constants': workspace:^0.4.0 - '@jsonql/errors': workspace:^0.5.0 + '@jsonql/constants': workspace:^0.5.10 + '@jsonql/errors': workspace:^0.6.0 '@types/koa': ^2.13.4 '@types/lodash-es': ^4.17.6 '@types/node': ^17.0.23 diff --git a/packages/validator-core/pnpm-lock.yaml b/packages/validator-core/pnpm-lock.yaml index d74e5f28c54f98fee712c216f7523be2e1101887..0521151c6a588bc73917ba65f31dda98bfd06d90 100644 --- a/packages/validator-core/pnpm-lock.yaml +++ b/packages/validator-core/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/constants': workspace:^0.5.9 - '@jsonql/utils': workspace:^0.3.3 + '@jsonql/constants': workspace:^0.5.10 + '@jsonql/utils': workspace:^0.4.0 '@types/node': ^17.0.23 '@typescript-eslint/eslint-plugin': ^5.17.0 '@typescript-eslint/parser': ^5.17.0 diff --git a/packages/validator/pnpm-lock.yaml b/packages/validator/pnpm-lock.yaml index 790853f4f78631402b4708ee765ac92fb6d13e6f..fd1c8505df400e530205f76d34ccd65463517a0a 100644 --- a/packages/validator/pnpm-lock.yaml +++ b/packages/validator/pnpm-lock.yaml @@ -2,11 +2,11 @@ lockfileVersion: 5.3 specifiers: '@ava/typescript': ^3.0.1 - '@jsonql/ast': workspace:^0.4.1 - '@jsonql/constants': workspace:^0.5.9 + '@jsonql/ast': workspace:^0.5.0 + '@jsonql/constants': workspace:^0.5.10 '@jsonql/errors': workspace:^0.6.0 - '@jsonql/utils': workspace:^0.3.3 - '@jsonql/validator-core': workspace:^0.1.1 + '@jsonql/utils': workspace:^0.4.0 + '@jsonql/validator-core': workspace:^0.1.2 '@types/node': ^17.0.23 '@typescript-eslint/eslint-plugin': ^5.17.0 '@typescript-eslint/parser': ^5.17.0 diff --git a/packages/validator/src/class/fn.ts b/packages/validator/src/class/fn.ts index 934a1f6a5064ad12a0ac24f7ea158a7aca705985..98ed1529c0f617e4c9b3c00c74bd221ec151c71b 100644 --- a/packages/validator/src/class/fn.ts +++ b/packages/validator/src/class/fn.ts @@ -53,29 +53,6 @@ export function createAutomaticRules( }) } -/* create a generic wrapper method to manage the error */ -async function validateFnWrapper( - fn: JsonqlValidateFn, - args: Array, - name?: string, - errDetail?: Array -) { - - return Reflect.apply(fn, null, args) - .then((result: boolean) => { - - console.log(name, args, errDetail) - - if (!result) { - throw new JsonqlValidationError(name, errDetail) - } - return result - }) - .catch(err => { - console.log('ERROR?', err) - }) -} - /** when this get put in the execution queue we also provide the index (argument position) @@ -113,6 +90,27 @@ function getValidateRules(ast: any): JsonqlValidateFn { throw new Error(`Unable to determine type from ast map to create validator!`) } +/* create a generic wrapper method to manage the error */ +async function validateFnWrapper( + fn: JsonqlValidateFn, + args: Array, + name?: string, + errDetail?: Array +) { + + return Reflect.apply(fn, null, args) + .then((result: boolean) => { + if (!result) { + console.log(name, args, errDetail) + throw new JsonqlValidationError(name, errDetail) + } + return result + }) + .catch(err => { + console.log('ERROR?', err) + }) +} + /** extract the default value if there is none */ export function getOptionalValue(arg: any, param: any) { if (arg !== undefined) { diff --git a/packages/validator/tests/class-units.test.ts b/packages/validator/tests/class-units.test.ts index 3d419072c74568be0b1fb37fef2665c5d88f09e0..e2c353447d7af4fdab8d9b7cee4d90edbe22e61e 100644 --- a/packages/validator/tests/class-units.test.ts +++ b/packages/validator/tests/class-units.test.ts @@ -76,8 +76,8 @@ test.only(`It should able validate`, async t => { return validator.validate(values) .then(result => { - console.log('result') - showDeep(result) + //console.log('result') + //showDeep(result) }) .catch(err => { console.log('err')