objection
Advanced tools
Comparing version 2.2.15 to 3.0.0-alpha.1
@@ -19,8 +19,10 @@ 'use strict'; | ||
self.ajvOptions = Object.assign({ errorDataPath: 'property' }, conf.options, { | ||
self.ajvOptions = Object.assign({}, conf.options, { | ||
allErrors: true, | ||
}); | ||
const Ajv = getAjv(); | ||
// Create a normal Ajv instance. | ||
self.ajv = new getAjv()( | ||
self.ajv = new Ajv( | ||
Object.assign( | ||
@@ -36,3 +38,3 @@ { | ||
// to validate `patch` objects (objects that have a subset of properties). | ||
self.ajvNoDefaults = new getAjv()( | ||
self.ajvNoDefaults = new Ajv( | ||
Object.assign({}, self.ajvOptions, { | ||
@@ -156,4 +158,2 @@ useDefaults: false, | ||
for (const error of errors) { | ||
const dataPath = `${options.dataPath || ''}${error.dataPath}`; | ||
// If additionalProperties = false, relations can pop up as additionalProperty | ||
@@ -169,7 +169,14 @@ // errors. Skip those. | ||
// Unknown properties are reported in `['propertyName']` notation, | ||
// so replace those with dot-notation, see: | ||
// https://github.com/epoberezkin/ajv/issues/671 | ||
const key = dataPath.replace(/\['([^' ]*)'\]/g, '.$1').substring(1); | ||
let path = error.instancePath.replace(/\//g, '.'); | ||
if (error.params) { | ||
if (error.params.missingProperty) { | ||
path += `.${error.params.missingProperty}`; | ||
} else if (error.params.additionalProperty) { | ||
path += `.${error.params.additionalProperty}`; | ||
} | ||
} | ||
const key = `${options.dataPath || ''}${path}`.substring(1); | ||
// More than one error can occur for the same key in Ajv, merge them in the array: | ||
@@ -176,0 +183,0 @@ const array = errorHash[key] || (errorHash[key] = []); |
@@ -160,5 +160,6 @@ 'use strict'; | ||
whereJsonbRefOnLeftJsonbValOrRefOnRight: whereJsonbRefOnLeftJsonbValOrRefOnRight, | ||
whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams: whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams, | ||
whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams: | ||
whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams, | ||
whereJsonFieldRightStringArrayOnLeftQuery: whereJsonFieldRightStringArrayOnLeftQuery, | ||
whereJsonFieldQuery: whereJsonFieldQuery, | ||
}; |
@@ -116,8 +116,6 @@ 'use strict'; | ||
convertedJson[ | ||
parsed.column | ||
] = knex.raw(`jsonb_set(??, '${jsonRefs}', ${valuePlaceholder}, true)`, [ | ||
convertedJson[parsed.column] || parsed.column, | ||
val, | ||
]); | ||
convertedJson[parsed.column] = knex.raw( | ||
`jsonb_set(??, '${jsonRefs}', ${valuePlaceholder}, true)`, | ||
[convertedJson[parsed.column] || parsed.column, val] | ||
); | ||
@@ -124,0 +122,0 @@ delete model[key]; |
@@ -9,3 +9,4 @@ 'use strict'; | ||
const AllSelector = () => true; | ||
const SelectSelector = /^(select|columns|column|distinct|count|countDistinct|min|max|sum|sumDistinct|avg|avgDistinct)$/; | ||
const SelectSelector = | ||
/^(select|columns|column|distinct|count|countDistinct|min|max|sum|sumDistinct|avg|avgDistinct)$/; | ||
const WhereSelector = /^(where|orWhere|andWhere|find\w+)/; | ||
@@ -12,0 +13,0 @@ const OnSelector = /^(on|orOn|andOn)/; |
{ | ||
"name": "objection", | ||
"version": "2.2.15", | ||
"version": "3.0.0-alpha.1", | ||
"description": "An SQL-friendly ORM for Node.js", | ||
@@ -44,3 +44,3 @@ "main": "lib/objection.js", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=12.0.0" | ||
}, | ||
@@ -65,30 +65,28 @@ "keywords": [ | ||
"dependencies": { | ||
"ajv": "^6.12.6", | ||
"ajv": "^8.6.2", | ||
"db-errors": "^0.2.3" | ||
}, | ||
"peerDependencies": { | ||
"knex": "<0.95.0" | ||
"knex": ">=0.95.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.13", | ||
"chai": "^4.2.0", | ||
"@types/node": "^16.3.2", | ||
"chai": "^4.3.4", | ||
"chai-subset": "^1.6.0", | ||
"coveralls": "^3.1.0", | ||
"coveralls": "^3.1.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.15.0", | ||
"eslint-plugin-prettier": "^3.2.0", | ||
"eslint": "^7.30.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"expect.js": "^0.3.1", | ||
"fs-extra": "^9.0.1", | ||
"glob": "^7.1.6", | ||
"husky": "^4.3.6", | ||
"knex": "0.21.15", | ||
"lint-staged": "^10.5.3", | ||
"mocha": "^8.2.1", | ||
"fs-extra": "^10.0.0", | ||
"glob": "^7.1.7", | ||
"knex": "0.95.7", | ||
"mocha": "^9.0.2", | ||
"mysql": "^2.18.1", | ||
"nyc": "^15.1.0", | ||
"pg": "^8.5.1", | ||
"prettier": "2.2.1", | ||
"sqlite3": "^5.0.0", | ||
"typescript": "^4.1.3", | ||
"vuepress": "1.7.1" | ||
"pg": "^8.6.0", | ||
"prettier": "2.3.2", | ||
"sqlite3": "^5.0.2", | ||
"typescript": "^4.3.5", | ||
"vuepress": "1.8.2" | ||
}, | ||
@@ -108,19 +106,3 @@ "nyc": { | ||
"report-dir": "./testCoverage" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"prettier --write", | ||
"eslint --fix", | ||
"git add" | ||
], | ||
"*.{yml,ts}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
} | ||
} |
@@ -17,3 +17,3 @@ /// <reference types="node" /> | ||
import * as dbErrors from 'db-errors'; | ||
import * as Knex from 'knex'; | ||
import { Knex } from 'knex'; | ||
@@ -758,3 +758,3 @@ // Export the entire Objection namespace. | ||
separator?: string; | ||
aliases?: {[key: string]: string}; | ||
aliases?: { [key: string]: string }; | ||
joinOperation?: string; | ||
@@ -761,0 +761,0 @@ maxBatchSize?: number; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19
20131
649157
2
+ Addedajv@8.17.1(transitive)
+ Addedcolorette@2.0.19(transitive)
+ Addedcommander@10.0.1(transitive)
+ Addeddebug@4.3.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedfast-uri@3.0.2(transitive)
+ Addedget-package-type@0.1.0(transitive)
+ Addedgetopts@2.3.0(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedknex@3.1.0(transitive)
+ Addedpg-connection-string@2.6.2(transitive)
+ Addedrechoir@0.8.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedresolve-from@5.0.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-each@1.0.1(transitive)
- Removedarray-slice@1.1.0(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedatob@2.1.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcolorette@1.2.1(transitive)
- Removedcommander@6.2.1(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removeddebug@2.6.94.3.1(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removeddetect-file@1.0.0(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedexpand-tilde@2.0.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfindup-sync@3.0.0(transitive)
- Removedfined@1.2.0(transitive)
- Removedflagged-respawn@1.0.1(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfor-own@1.0.0(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedget-value@2.0.6(transitive)
- Removedgetopts@2.2.5(transitive)
- Removedglobal-modules@1.0.0(transitive)
- Removedglobal-prefix@1.0.2(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhomedir-polyfill@1.0.3(transitive)
- Removedini@1.3.8(transitive)
- Removedis-absolute@1.0.0(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-relative@1.0.0(transitive)
- Removedis-unc-path@1.0.0(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedknex@0.21.21(transitive)
- Removedliftoff@3.1.0(transitive)
- Removedmake-iterator@1.0.1(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.defaults@1.1.0(transitive)
- Removedobject.map@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedparse-filepath@1.0.2(transitive)
- Removedparse-passwd@1.0.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-root@0.1.1(transitive)
- Removedpath-root-regex@0.1.2(transitive)
- Removedpg-connection-string@2.4.0(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedrechoir@0.6.2(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve-dir@1.0.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedunc-path-regex@0.1.2(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)
- Removedv8flags@3.2.0(transitive)
- Removedwhich@1.3.1(transitive)
Updatedajv@^8.6.2