@sqb/builder 4.9.1 → 4.10.0
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/cjs/query/delete-query.js +0 -2
- package/cjs/query/insert-query.js +0 -2
- package/cjs/query/query.js +0 -1
- package/cjs/query/returning-query.js +0 -1
- package/cjs/query/select-query.js +0 -10
- package/cjs/query/update-query.js +0 -3
- package/cjs/serialize-context.js +12 -22
- package/cjs/sql-objects/base-field.js +4 -4
- package/cjs/sql-objects/case-statement.js +0 -4
- package/cjs/sql-objects/coalesce-statement.js +0 -2
- package/cjs/sql-objects/count-statement.js +0 -1
- package/cjs/sql-objects/expression.js +0 -3
- package/cjs/sql-objects/field-expression.js +0 -1
- package/cjs/sql-objects/join-statement.js +1 -3
- package/cjs/sql-objects/lower-statement.js +0 -2
- package/cjs/sql-objects/max-statement.js +0 -2
- package/cjs/sql-objects/min-statement.js +0 -2
- package/cjs/sql-objects/operators/comp-operator.js +0 -4
- package/cjs/sql-objects/operators/logical-operator.js +1 -1
- package/cjs/sql-objects/operators/op-and.js +4 -1
- package/cjs/sql-objects/operators/op-between.js +2 -2
- package/cjs/sql-objects/operators/op-eq.js +2 -2
- package/cjs/sql-objects/operators/op-exists.js +2 -2
- package/cjs/sql-objects/operators/op-gt.js +2 -2
- package/cjs/sql-objects/operators/op-gte.js +2 -2
- package/cjs/sql-objects/operators/op-ilike.js +5 -2
- package/cjs/sql-objects/operators/op-in.js +2 -2
- package/cjs/sql-objects/operators/op-is-not.js +2 -2
- package/cjs/sql-objects/operators/op-is.js +2 -2
- package/cjs/sql-objects/operators/op-like.js +2 -2
- package/cjs/sql-objects/operators/op-lt.js +2 -2
- package/cjs/sql-objects/operators/op-lte.js +2 -2
- package/cjs/sql-objects/operators/op-ne.js +2 -2
- package/cjs/sql-objects/operators/op-not-between.js +5 -2
- package/cjs/sql-objects/operators/op-not-exists.js +5 -2
- package/cjs/sql-objects/operators/op-not-ilike.js +5 -2
- package/cjs/sql-objects/operators/op-not-in.js +5 -2
- package/cjs/sql-objects/operators/op-not-like.js +5 -2
- package/cjs/sql-objects/operators/op-not.js +1 -2
- package/cjs/sql-objects/operators/op-or.js +4 -1
- package/cjs/sql-objects/order-column.js +0 -1
- package/cjs/sql-objects/param-expression.js +0 -3
- package/cjs/sql-objects/raw-statement.js +0 -1
- package/cjs/sql-objects/returning-column.js +0 -1
- package/cjs/sql-objects/sequence-getter-statement.js +0 -3
- package/cjs/sql-objects/string-agg-statement.js +0 -4
- package/cjs/sql-objects/table-name.js +0 -3
- package/cjs/sql-objects/upper-statement.js +0 -2
- package/esm/query/delete-query.js +0 -2
- package/esm/query/insert-query.js +0 -2
- package/esm/query/query.js +0 -1
- package/esm/query/returning-query.js +0 -1
- package/esm/query/select-query.js +0 -10
- package/esm/query/update-query.js +0 -3
- package/esm/serialize-context.js +12 -22
- package/esm/sql-objects/base-field.js +4 -4
- package/esm/sql-objects/case-statement.js +0 -4
- package/esm/sql-objects/coalesce-statement.js +0 -2
- package/esm/sql-objects/count-statement.js +0 -1
- package/esm/sql-objects/expression.js +0 -3
- package/esm/sql-objects/field-expression.js +0 -1
- package/esm/sql-objects/join-statement.js +1 -3
- package/esm/sql-objects/lower-statement.js +0 -2
- package/esm/sql-objects/max-statement.js +0 -2
- package/esm/sql-objects/min-statement.js +0 -2
- package/esm/sql-objects/operators/comp-operator.js +0 -4
- package/esm/sql-objects/operators/logical-operator.js +1 -1
- package/esm/sql-objects/operators/op-and.js +4 -1
- package/esm/sql-objects/operators/op-between.js +2 -2
- package/esm/sql-objects/operators/op-eq.js +2 -2
- package/esm/sql-objects/operators/op-exists.js +2 -2
- package/esm/sql-objects/operators/op-gt.js +2 -2
- package/esm/sql-objects/operators/op-gte.js +2 -2
- package/esm/sql-objects/operators/op-ilike.js +5 -2
- package/esm/sql-objects/operators/op-in.js +2 -2
- package/esm/sql-objects/operators/op-is-not.js +2 -2
- package/esm/sql-objects/operators/op-is.js +2 -2
- package/esm/sql-objects/operators/op-like.js +2 -2
- package/esm/sql-objects/operators/op-lt.js +2 -2
- package/esm/sql-objects/operators/op-lte.js +2 -2
- package/esm/sql-objects/operators/op-ne.js +2 -2
- package/esm/sql-objects/operators/op-not-between.js +5 -2
- package/esm/sql-objects/operators/op-not-exists.js +5 -2
- package/esm/sql-objects/operators/op-not-ilike.js +5 -2
- package/esm/sql-objects/operators/op-not-in.js +5 -2
- package/esm/sql-objects/operators/op-not-like.js +5 -2
- package/esm/sql-objects/operators/op-not.js +1 -2
- package/esm/sql-objects/operators/op-or.js +4 -1
- package/esm/sql-objects/order-column.js +0 -1
- package/esm/sql-objects/param-expression.js +0 -3
- package/esm/sql-objects/raw-statement.js +0 -1
- package/esm/sql-objects/returning-column.js +0 -1
- package/esm/sql-objects/sequence-getter-statement.js +0 -3
- package/esm/sql-objects/string-agg-statement.js +0 -4
- package/esm/sql-objects/table-name.js +0 -3
- package/esm/sql-objects/upper-statement.js +0 -2
- package/package.json +7 -13
- package/esm/classes.ns.d.ts +0 -38
- package/esm/enums.d.ts +0 -94
- package/esm/extensions.d.ts +0 -4
- package/esm/helpers.d.ts +0 -4
- package/esm/index.d.ts +0 -20
- package/esm/op.initializers.d.ts +0 -89
- package/esm/query/delete-query.d.ts +0 -24
- package/esm/query/insert-query.d.ts +0 -23
- package/esm/query/query.d.ts +0 -15
- package/esm/query/returning-query.d.ts +0 -14
- package/esm/query/select-query.d.ts +0 -90
- package/esm/query/update-query.d.ts +0 -29
- package/esm/serializable.d.ts +0 -9
- package/esm/serialize-context.d.ts +0 -47
- package/esm/sql-objects/base-field.d.ts +0 -7
- package/esm/sql-objects/case-statement.d.ts +0 -42
- package/esm/sql-objects/coalesce-statement.d.ts +0 -22
- package/esm/sql-objects/count-statement.d.ts +0 -20
- package/esm/sql-objects/expression.d.ts +0 -7
- package/esm/sql-objects/field-expression.d.ts +0 -14
- package/esm/sql-objects/group-column.d.ts +0 -8
- package/esm/sql-objects/join-statement.d.ts +0 -17
- package/esm/sql-objects/lower-statement.d.ts +0 -22
- package/esm/sql-objects/max-statement.d.ts +0 -22
- package/esm/sql-objects/min-statement.d.ts +0 -22
- package/esm/sql-objects/operator.d.ts +0 -5
- package/esm/sql-objects/operators/comp-operator.d.ts +0 -16
- package/esm/sql-objects/operators/logical-operator.d.ts +0 -16
- package/esm/sql-objects/operators/op-and.d.ts +0 -5
- package/esm/sql-objects/operators/op-between.d.ts +0 -11
- package/esm/sql-objects/operators/op-eq.d.ts +0 -8
- package/esm/sql-objects/operators/op-exists.d.ts +0 -11
- package/esm/sql-objects/operators/op-gt.d.ts +0 -8
- package/esm/sql-objects/operators/op-gte.d.ts +0 -8
- package/esm/sql-objects/operators/op-ilike.d.ts +0 -6
- package/esm/sql-objects/operators/op-in.d.ts +0 -9
- package/esm/sql-objects/operators/op-is-not.d.ts +0 -8
- package/esm/sql-objects/operators/op-is.d.ts +0 -8
- package/esm/sql-objects/operators/op-like.d.ts +0 -10
- package/esm/sql-objects/operators/op-lt.d.ts +0 -8
- package/esm/sql-objects/operators/op-lte.d.ts +0 -8
- package/esm/sql-objects/operators/op-ne.d.ts +0 -8
- package/esm/sql-objects/operators/op-not-between.d.ts +0 -6
- package/esm/sql-objects/operators/op-not-exists.d.ts +0 -6
- package/esm/sql-objects/operators/op-not-ilike.d.ts +0 -6
- package/esm/sql-objects/operators/op-not-in.d.ts +0 -6
- package/esm/sql-objects/operators/op-not-like.d.ts +0 -6
- package/esm/sql-objects/operators/op-not.d.ts +0 -11
- package/esm/sql-objects/operators/op-or.d.ts +0 -5
- package/esm/sql-objects/order-column.d.ts +0 -9
- package/esm/sql-objects/param-expression.d.ts +0 -23
- package/esm/sql-objects/raw-statement.d.ts +0 -9
- package/esm/sql-objects/returning-column.d.ts +0 -9
- package/esm/sql-objects/sequence-getter-statement.d.ts +0 -24
- package/esm/sql-objects/string-agg-statement.d.ts +0 -31
- package/esm/sql-objects/table-name.d.ts +0 -11
- package/esm/sql-objects/upper-statement.d.ts +0 -22
- package/esm/sqlobject.initializers.d.ts +0 -55
- package/esm/typeguards.d.ts +0 -36
- package/esm/types.d.ts +0 -33
package/esm/query/query.js
CHANGED
|
@@ -9,16 +9,6 @@ import { TableName } from '../sql-objects/table-name.js';
|
|
|
9
9
|
import { isJoinStatement, isSerializable } from '../typeguards.js';
|
|
10
10
|
import { Query } from './query.js';
|
|
11
11
|
export class SelectQuery extends Query {
|
|
12
|
-
_tables;
|
|
13
|
-
_columns;
|
|
14
|
-
_joins;
|
|
15
|
-
_where;
|
|
16
|
-
_groupBy;
|
|
17
|
-
_orderBy;
|
|
18
|
-
_limit;
|
|
19
|
-
_offset;
|
|
20
|
-
_alias;
|
|
21
|
-
_distinct;
|
|
22
12
|
constructor(...column) {
|
|
23
13
|
super();
|
|
24
14
|
if (column.length)
|
|
@@ -5,9 +5,6 @@ import { TableName } from '../sql-objects/table-name.js';
|
|
|
5
5
|
import { isRawStatement } from '../typeguards.js';
|
|
6
6
|
import { ReturningQuery } from './returning-query.js';
|
|
7
7
|
export class UpdateQuery extends ReturningQuery {
|
|
8
|
-
_table;
|
|
9
|
-
_input;
|
|
10
|
-
_where;
|
|
11
8
|
constructor(tableName, input) {
|
|
12
9
|
super();
|
|
13
10
|
if (!tableName || !(typeof tableName === 'string' || isRawStatement(tableName)))
|
package/esm/serialize-context.js
CHANGED
|
@@ -3,29 +3,19 @@ import { serializers } from './extensions.js';
|
|
|
3
3
|
import { Serializable } from './serializable.js';
|
|
4
4
|
import { isLogicalOperator, isQuery, isSerializable } from './typeguards.js';
|
|
5
5
|
export class SerializeContext {
|
|
6
|
-
reservedWords = [
|
|
7
|
-
'schema', 'table', 'field', 'index', 'foreign', 'key',
|
|
8
|
-
'select', 'insert', 'update', 'delete', 'with', 'merge',
|
|
9
|
-
'join', 'inner', 'outer', 'left', 'right', 'full',
|
|
10
|
-
'from', 'where', 'order', 'by', 'group', 'having',
|
|
11
|
-
'acs', 'ascending', 'dsc', 'descending', 'distinct',
|
|
12
|
-
'and', 'or', 'not', 'between', 'null', 'like', 'ilike',
|
|
13
|
-
'count', 'sum', 'average', 'avg', 'cascade', 'authorization',
|
|
14
|
-
'create', 'add', 'drop', 'alter', 'index', 'private', 'sequence',
|
|
15
|
-
'default', 'constraint', 'references', 'primary', 'foreign',
|
|
16
|
-
'user', 'password'
|
|
17
|
-
];
|
|
18
|
-
dialect;
|
|
19
|
-
prettyPrint;
|
|
20
|
-
params;
|
|
21
|
-
dialectVersion;
|
|
22
|
-
strictParams;
|
|
23
|
-
serializeHooks;
|
|
24
|
-
paramOptions;
|
|
25
|
-
preparedParams;
|
|
26
|
-
returningFields;
|
|
27
|
-
strictParamGenId;
|
|
28
6
|
constructor(opts) {
|
|
7
|
+
this.reservedWords = [
|
|
8
|
+
'schema', 'table', 'field', 'index', 'foreign', 'key',
|
|
9
|
+
'select', 'insert', 'update', 'delete', 'with', 'merge',
|
|
10
|
+
'join', 'inner', 'outer', 'left', 'right', 'full',
|
|
11
|
+
'from', 'where', 'order', 'by', 'group', 'having',
|
|
12
|
+
'acs', 'ascending', 'dsc', 'descending', 'distinct',
|
|
13
|
+
'and', 'or', 'not', 'between', 'null', 'like', 'ilike',
|
|
14
|
+
'count', 'sum', 'average', 'avg', 'cascade', 'authorization',
|
|
15
|
+
'create', 'add', 'drop', 'alter', 'index', 'private', 'sequence',
|
|
16
|
+
'default', 'constraint', 'references', 'primary', 'foreign',
|
|
17
|
+
'user', 'password'
|
|
18
|
+
];
|
|
29
19
|
if (opts)
|
|
30
20
|
Object.assign(this, opts);
|
|
31
21
|
}
|
|
@@ -2,10 +2,6 @@ import { SerializationType } from '../enums.js';
|
|
|
2
2
|
import { Serializable } from '../serializable.js';
|
|
3
3
|
import { OpAnd } from './operators/op-and.js';
|
|
4
4
|
export class CaseStatement extends Serializable {
|
|
5
|
-
_expressions;
|
|
6
|
-
_elseValue;
|
|
7
|
-
_condition;
|
|
8
|
-
_alias;
|
|
9
5
|
constructor() {
|
|
10
6
|
super();
|
|
11
7
|
this._expressions = [];
|
|
@@ -2,7 +2,6 @@ import { SerializationType } from '../enums.js';
|
|
|
2
2
|
import { BaseField } from './base-field.js';
|
|
3
3
|
const TABLE_COLUMN_PATTERN = /^((?:[a-zA-Z_][\w$_]*\.){0,2}) *([0-9a-zA-Z_][\w$_]*|\*) *(?:as)? *([a-zA-Z_][\w$_]*)?$/;
|
|
4
4
|
export class FieldExpression extends BaseField {
|
|
5
|
-
_alias;
|
|
6
5
|
constructor(arg0, arg1, arg2) {
|
|
7
6
|
super();
|
|
8
7
|
let expression;
|
|
@@ -4,11 +4,9 @@ import { isRawStatement, isSelectQuery, isTableName } from '../typeguards.js';
|
|
|
4
4
|
import { OpAnd } from './operators/op-and.js';
|
|
5
5
|
import { TableName } from './table-name.js';
|
|
6
6
|
export class JoinStatement extends Serializable {
|
|
7
|
-
_joinType;
|
|
8
|
-
_table;
|
|
9
|
-
_conditions = new OpAnd();
|
|
10
7
|
constructor(joinType, table) {
|
|
11
8
|
super();
|
|
9
|
+
this._conditions = new OpAnd();
|
|
12
10
|
// noinspection SuspiciousTypeOfGuard
|
|
13
11
|
if (!(isSelectQuery(table) || isRawStatement(table) || isTableName(table) ||
|
|
14
12
|
typeof table === 'string'))
|
|
@@ -6,10 +6,6 @@ import { Operator } from '../operator.js';
|
|
|
6
6
|
import { ParamExpression } from '../param-expression.js';
|
|
7
7
|
const EXPRESSION_PATTERN = /^([\w\\.$]+)(\[])?/;
|
|
8
8
|
export class CompOperator extends Operator {
|
|
9
|
-
_left;
|
|
10
|
-
_right;
|
|
11
|
-
_symbol;
|
|
12
|
-
_isArray;
|
|
13
9
|
constructor(left, right) {
|
|
14
10
|
super();
|
|
15
11
|
if (typeof left === 'string') {
|
|
@@ -7,9 +7,9 @@ export const WrapOps = {};
|
|
|
7
7
|
// noinspection RegExpUnnecessaryNonCapturingGroup
|
|
8
8
|
const COMPARE_LEFT_PATTERN = /^([\w\\.$]+(?:\[])?) *(.*)$/;
|
|
9
9
|
export class LogicalOperator extends Operator {
|
|
10
|
-
_items = [];
|
|
11
10
|
constructor(...expressions) {
|
|
12
11
|
super();
|
|
12
|
+
this._items = [];
|
|
13
13
|
this.add(...expressions);
|
|
14
14
|
}
|
|
15
15
|
get _type() {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { LogicalOperator } from './logical-operator.js';
|
|
3
3
|
export class OpAnd extends LogicalOperator {
|
|
4
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.and;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpBetween extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.between;
|
|
5
|
-
_symbol = 'between';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.between;
|
|
7
|
+
this._symbol = 'between';
|
|
8
8
|
if (right && right[1] == null)
|
|
9
9
|
right[1] = right[0];
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpEq extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.eq;
|
|
5
|
-
_symbol = '=';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.eq;
|
|
7
|
+
this._symbol = '=';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -2,10 +2,10 @@ import { OperatorType } from '../../enums.js';
|
|
|
2
2
|
import { isSelectQuery } from '../../typeguards.js';
|
|
3
3
|
import { CompOperator } from './comp-operator.js';
|
|
4
4
|
export class OpExists extends CompOperator {
|
|
5
|
-
_operatorType = OperatorType.exists;
|
|
6
|
-
_symbol = 'exists';
|
|
7
5
|
constructor(query) {
|
|
8
6
|
super(query);
|
|
7
|
+
this._operatorType = OperatorType.exists;
|
|
8
|
+
this._symbol = 'exists';
|
|
9
9
|
if (!(typeof query === 'object' && isSelectQuery(query)))
|
|
10
10
|
throw new TypeError('You must provide a SelectQuery in `exists()`');
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpGt extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.gt;
|
|
5
|
-
_symbol = '>';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.gt;
|
|
7
|
+
this._symbol = '>';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpGte extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.gte;
|
|
5
|
-
_symbol = '>=';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.gte;
|
|
7
|
+
this._symbol = '>=';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpLike } from './op-like.js';
|
|
3
3
|
export class OpILike extends OpLike {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.iLike;
|
|
7
|
+
this._symbol = 'ilike';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -2,10 +2,10 @@ import { OperatorType } from '../../enums.js';
|
|
|
2
2
|
import { isSerializable } from '../../typeguards.js';
|
|
3
3
|
import { CompOperator } from './comp-operator.js';
|
|
4
4
|
export class OpIn extends CompOperator {
|
|
5
|
-
_operatorType = OperatorType.in;
|
|
6
|
-
_symbol = 'in';
|
|
7
5
|
constructor(left, right) {
|
|
8
6
|
super(left, Array.isArray(right) || isSerializable(right) ? right : [right]);
|
|
7
|
+
this._operatorType = OperatorType.in;
|
|
8
|
+
this._symbol = 'in';
|
|
9
9
|
}
|
|
10
10
|
_serialize(ctx) {
|
|
11
11
|
if (Array.isArray(this._right) && !this._right.length)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpIsNot extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.isNot;
|
|
5
|
-
_symbol = 'is not';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.isNot;
|
|
7
|
+
this._symbol = 'is not';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpIs extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.is;
|
|
5
|
-
_symbol = 'is';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.is;
|
|
7
|
+
this._symbol = 'is';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpLike extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.like;
|
|
5
|
-
_symbol = 'like';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.like;
|
|
7
|
+
this._symbol = 'like';
|
|
8
8
|
}
|
|
9
9
|
__serialize(ctx, o) {
|
|
10
10
|
if (!o.right.expression)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpLt extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.lt;
|
|
5
|
-
_symbol = '<';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.lt;
|
|
7
|
+
this._symbol = '<';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpLte extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.lte;
|
|
5
|
-
_symbol = '<=';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.lte;
|
|
7
|
+
this._symbol = '<=';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { CompOperator } from './comp-operator.js';
|
|
3
3
|
export class OpNe extends CompOperator {
|
|
4
|
-
_operatorType = OperatorType.ne;
|
|
5
|
-
_symbol = '!=';
|
|
6
4
|
constructor(left, right) {
|
|
7
5
|
super(left, right);
|
|
6
|
+
this._operatorType = OperatorType.ne;
|
|
7
|
+
this._symbol = '!=';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpBetween } from './op-between.js';
|
|
3
3
|
export class OpNotBetween extends OpBetween {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.notBetween;
|
|
7
|
+
this._symbol = 'not between';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpExists } from './op-exists.js';
|
|
3
3
|
export class OpNotExists extends OpExists {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.notExists;
|
|
7
|
+
this._symbol = 'not exists';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpILike } from './op-ilike.js';
|
|
3
3
|
export class OpNotILike extends OpILike {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.notILike;
|
|
7
|
+
this._symbol = 'not ilike';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpIn } from './op-in.js';
|
|
3
3
|
export class OpNotIn extends OpIn {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.notIn;
|
|
7
|
+
this._symbol = 'not in';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { OpLike } from './op-like.js';
|
|
3
3
|
export class OpNotLike extends OpLike {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.notLike;
|
|
7
|
+
this._symbol = 'not like';
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { OperatorType, SerializationType } from '../../enums.js';
|
|
2
2
|
import { Operator } from '../operator.js';
|
|
3
3
|
export class OpNot extends Operator {
|
|
4
|
-
_operatorType = OperatorType.not;
|
|
5
|
-
_expression;
|
|
6
4
|
constructor(expression) {
|
|
7
5
|
super();
|
|
6
|
+
this._operatorType = OperatorType.not;
|
|
8
7
|
this._expression = expression;
|
|
9
8
|
}
|
|
10
9
|
get _type() {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
2
|
import { LogicalOperator } from './logical-operator.js';
|
|
3
3
|
export class OpOr extends LogicalOperator {
|
|
4
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._operatorType = OperatorType.or;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
@@ -2,7 +2,6 @@ import { SerializationType } from '../enums.js';
|
|
|
2
2
|
import { BaseField } from './base-field.js';
|
|
3
3
|
const ORDER_COLUMN_PATTERN = /^([-+])?((?:[a-zA-Z_][\w$]*\.){0,2})([a-zA-Z_][\w$]*|\*) *(asc|dsc|desc|ascending|descending)?$/i;
|
|
4
4
|
export class OrderColumn extends BaseField {
|
|
5
|
-
_descending;
|
|
6
5
|
constructor(value) {
|
|
7
6
|
super();
|
|
8
7
|
const m = value.match(ORDER_COLUMN_PATTERN);
|
|
@@ -2,7 +2,6 @@ import { SerializationType } from '../enums.js';
|
|
|
2
2
|
import { BaseField } from './base-field.js';
|
|
3
3
|
const RETURNING_COLUMN_PATTERN = /^([a-zA-Z_]\w*) *(?:as)? *(\w+)?$/;
|
|
4
4
|
export class ReturningColumn extends BaseField {
|
|
5
|
-
_alias;
|
|
6
5
|
constructor(field) {
|
|
7
6
|
super();
|
|
8
7
|
const m = field.match(RETURNING_COLUMN_PATTERN);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SerializationType } from '../enums.js';
|
|
2
2
|
import { Serializable } from '../serializable.js';
|
|
3
3
|
export class SequenceGetterStatement extends Serializable {
|
|
4
|
-
_expression;
|
|
5
|
-
_next;
|
|
6
|
-
_alias;
|
|
7
4
|
constructor(expression, next) {
|
|
8
5
|
super();
|
|
9
6
|
this._expression = expression;
|
|
@@ -4,10 +4,6 @@ import { Serializable } from '../serializable.js';
|
|
|
4
4
|
import { FieldExpression } from './field-expression.js';
|
|
5
5
|
import { OrderColumn } from './order-column.js';
|
|
6
6
|
export class StringAGGStatement extends Serializable {
|
|
7
|
-
_field;
|
|
8
|
-
_delimiter;
|
|
9
|
-
_orderBy;
|
|
10
|
-
_alias;
|
|
11
7
|
constructor(field, delimiter) {
|
|
12
8
|
super();
|
|
13
9
|
this._field = typeof field === 'string' ? new FieldExpression(field) : field;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SerializationType } from '../enums.js';
|
|
2
2
|
import { Serializable } from '../serializable.js';
|
|
3
3
|
export class TableName extends Serializable {
|
|
4
|
-
schema;
|
|
5
|
-
table;
|
|
6
|
-
alias;
|
|
7
4
|
constructor(tableName) {
|
|
8
5
|
super();
|
|
9
6
|
const m = tableName.match(/^(?:([a-zA-Z][\w$]*)\.)? *([a-zA-Z][\w$]*) *(?:as)? *(\w+)?$/);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/builder",
|
|
3
3
|
"description": "Extensible multi-dialect SQL query builder written with TypeScript",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.10.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"private": false,
|
|
7
7
|
"contributors": [
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"url": "https://github.com/sqbjs/sqb.git",
|
|
15
15
|
"directory": "packages/builder"
|
|
16
16
|
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"module": "./esm/index.js",
|
|
19
|
+
"main": "./cjs/index.js",
|
|
20
|
+
"types": "./types/index.d.ts",
|
|
17
21
|
"scripts": {
|
|
18
22
|
"compile": "tsc",
|
|
19
23
|
"prebuild": "npm run lint && npm run clean",
|
|
@@ -33,21 +37,11 @@
|
|
|
33
37
|
"debug": "^4.3.4",
|
|
34
38
|
"putil-flattentext": "^2.1.1",
|
|
35
39
|
"putil-isplainobject": "^1.1.5",
|
|
36
|
-
"putil-merge": "^3.
|
|
40
|
+
"putil-merge": "^3.12.1",
|
|
37
41
|
"putil-varhelpers": "^1.6.5"
|
|
38
42
|
},
|
|
39
43
|
"devDependencies": {
|
|
40
|
-
"@types/debug": "^4.1.
|
|
41
|
-
},
|
|
42
|
-
"type": "module",
|
|
43
|
-
"types": "esm/index.d.ts",
|
|
44
|
-
"exports": {
|
|
45
|
-
".": {
|
|
46
|
-
"require": "./cjs/index.js",
|
|
47
|
-
"default": "./esm/index.js"
|
|
48
|
-
},
|
|
49
|
-
"./cjs": "./cjs/index.js",
|
|
50
|
-
"./esm": "./esm/index.js"
|
|
44
|
+
"@types/debug": "^4.1.12"
|
|
51
45
|
},
|
|
52
46
|
"engines": {
|
|
53
47
|
"node": ">=16.0",
|