objection 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)
2
+
1
3
  [![Tests](https://github.com/Vincit/objection.js/actions/workflows/test.yml/badge.svg)](https://github.com/Vincit/objection.js)
2
4
  [![Join the chat at https://gitter.im/Vincit/objection.js](https://badges.gitter.im/Vincit/objection.js.svg)](https://gitter.im/Vincit/objection.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
5
 
@@ -7,7 +9,7 @@ Objection.js is an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping
7
9
 
8
10
  Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call it **a relational query builder**. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.
9
11
 
10
- Objection.js is built on an SQL query builder called [knex](http://knexjs.org). All databases supported by knex are supported by objection.js. **SQLite3**, **Postgres** and **MySQL** are [thoroughly tested](https://travis-ci.org/Vincit/objection.js).
12
+ Objection.js is built on an SQL query builder called [knex](http://knexjs.org). All databases supported by knex are supported by objection.js. **SQLite3**, **Postgres** and **MySQL** are [thoroughly tested](https://github.com/Vincit/objection.js/actions).
11
13
 
12
14
  What objection.js gives you:
13
15
 
package/lib/objection.js CHANGED
@@ -1,6 +1,14 @@
1
1
  'use strict';
2
2
 
3
- const { wrapError, ...DbErrorClasses } = require('db-errors');
3
+ const {
4
+ DBError,
5
+ UniqueViolationError,
6
+ NotNullViolationError,
7
+ ForeignKeyViolationError,
8
+ ConstraintViolationError,
9
+ CheckViolationError,
10
+ DataError,
11
+ } = require('db-errors');
4
12
  const { Model: NativeModel } = require('./model/Model');
5
13
  const { QueryBuilder: NativeQueryBuilder } = require('./queryBuilder/QueryBuilder');
6
14
  const { QueryBuilderBase } = require('./queryBuilder/QueryBuilderBase');
@@ -88,5 +96,11 @@ module.exports = {
88
96
  knexSnakeCaseMappers,
89
97
  knexIdentifierMapping,
90
98
 
91
- ...DbErrorClasses,
99
+ DBError,
100
+ UniqueViolationError,
101
+ NotNullViolationError,
102
+ ForeignKeyViolationError,
103
+ ConstraintViolationError,
104
+ CheckViolationError,
105
+ DataError,
92
106
  };
@@ -135,6 +135,7 @@ function isDigit(char) {
135
135
  // If no separators are found, `mapper` is called for the entire string.
136
136
  function mapLastPart(mapper, separator) {
137
137
  return (str) => {
138
+ if (!str) return str;
138
139
  const idx = str.lastIndexOf(separator);
139
140
  const mapped = mapper(str.slice(idx + separator.length));
140
141
  return str.slice(0, idx + separator.length) + mapped;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "objection",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "An SQL-friendly ORM for Node.js",
5
5
  "main": "lib/objection.js",
6
6
  "license": "MIT",
@@ -132,7 +132,8 @@ declare namespace Objection {
132
132
  | boolean[]
133
133
  | Date[]
134
134
  | null
135
- | Buffer;
135
+ | Buffer
136
+ | Buffer[];
136
137
 
137
138
  type Expression<T> = T | Raw | ReferenceBuilder | ValueBuilder | AnyQueryBuilder;
138
139
 
@@ -1008,7 +1009,7 @@ declare namespace Objection {
1008
1009
  timeout: TimeoutMethod<this>;
1009
1010
  columnInfo: ColumnInfoMethod<this>;
1010
1011
 
1011
- toKnexQuery<T = ModelObject<M>>(): Knex.QueryBuilder<T, T[]>;
1012
+ toKnexQuery<T extends {} = ModelObject<M>>(): Knex.QueryBuilder<T, T[]>;
1012
1013
  clone(): this;
1013
1014
 
1014
1015
  page(page: number, pageSize: number): PageQueryBuilder<this>;