@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.
Files changed (157) hide show
  1. package/cjs/query/delete-query.js +0 -2
  2. package/cjs/query/insert-query.js +0 -2
  3. package/cjs/query/query.js +0 -1
  4. package/cjs/query/returning-query.js +0 -1
  5. package/cjs/query/select-query.js +0 -10
  6. package/cjs/query/update-query.js +0 -3
  7. package/cjs/serialize-context.js +12 -22
  8. package/cjs/sql-objects/base-field.js +4 -4
  9. package/cjs/sql-objects/case-statement.js +0 -4
  10. package/cjs/sql-objects/coalesce-statement.js +0 -2
  11. package/cjs/sql-objects/count-statement.js +0 -1
  12. package/cjs/sql-objects/expression.js +0 -3
  13. package/cjs/sql-objects/field-expression.js +0 -1
  14. package/cjs/sql-objects/join-statement.js +1 -3
  15. package/cjs/sql-objects/lower-statement.js +0 -2
  16. package/cjs/sql-objects/max-statement.js +0 -2
  17. package/cjs/sql-objects/min-statement.js +0 -2
  18. package/cjs/sql-objects/operators/comp-operator.js +0 -4
  19. package/cjs/sql-objects/operators/logical-operator.js +1 -1
  20. package/cjs/sql-objects/operators/op-and.js +4 -1
  21. package/cjs/sql-objects/operators/op-between.js +2 -2
  22. package/cjs/sql-objects/operators/op-eq.js +2 -2
  23. package/cjs/sql-objects/operators/op-exists.js +2 -2
  24. package/cjs/sql-objects/operators/op-gt.js +2 -2
  25. package/cjs/sql-objects/operators/op-gte.js +2 -2
  26. package/cjs/sql-objects/operators/op-ilike.js +5 -2
  27. package/cjs/sql-objects/operators/op-in.js +2 -2
  28. package/cjs/sql-objects/operators/op-is-not.js +2 -2
  29. package/cjs/sql-objects/operators/op-is.js +2 -2
  30. package/cjs/sql-objects/operators/op-like.js +2 -2
  31. package/cjs/sql-objects/operators/op-lt.js +2 -2
  32. package/cjs/sql-objects/operators/op-lte.js +2 -2
  33. package/cjs/sql-objects/operators/op-ne.js +2 -2
  34. package/cjs/sql-objects/operators/op-not-between.js +5 -2
  35. package/cjs/sql-objects/operators/op-not-exists.js +5 -2
  36. package/cjs/sql-objects/operators/op-not-ilike.js +5 -2
  37. package/cjs/sql-objects/operators/op-not-in.js +5 -2
  38. package/cjs/sql-objects/operators/op-not-like.js +5 -2
  39. package/cjs/sql-objects/operators/op-not.js +1 -2
  40. package/cjs/sql-objects/operators/op-or.js +4 -1
  41. package/cjs/sql-objects/order-column.js +0 -1
  42. package/cjs/sql-objects/param-expression.js +0 -3
  43. package/cjs/sql-objects/raw-statement.js +0 -1
  44. package/cjs/sql-objects/returning-column.js +0 -1
  45. package/cjs/sql-objects/sequence-getter-statement.js +0 -3
  46. package/cjs/sql-objects/string-agg-statement.js +0 -4
  47. package/cjs/sql-objects/table-name.js +0 -3
  48. package/cjs/sql-objects/upper-statement.js +0 -2
  49. package/esm/query/delete-query.js +0 -2
  50. package/esm/query/insert-query.js +0 -2
  51. package/esm/query/query.js +0 -1
  52. package/esm/query/returning-query.js +0 -1
  53. package/esm/query/select-query.js +0 -10
  54. package/esm/query/update-query.js +0 -3
  55. package/esm/serialize-context.js +12 -22
  56. package/esm/sql-objects/base-field.js +4 -4
  57. package/esm/sql-objects/case-statement.js +0 -4
  58. package/esm/sql-objects/coalesce-statement.js +0 -2
  59. package/esm/sql-objects/count-statement.js +0 -1
  60. package/esm/sql-objects/expression.js +0 -3
  61. package/esm/sql-objects/field-expression.js +0 -1
  62. package/esm/sql-objects/join-statement.js +1 -3
  63. package/esm/sql-objects/lower-statement.js +0 -2
  64. package/esm/sql-objects/max-statement.js +0 -2
  65. package/esm/sql-objects/min-statement.js +0 -2
  66. package/esm/sql-objects/operators/comp-operator.js +0 -4
  67. package/esm/sql-objects/operators/logical-operator.js +1 -1
  68. package/esm/sql-objects/operators/op-and.js +4 -1
  69. package/esm/sql-objects/operators/op-between.js +2 -2
  70. package/esm/sql-objects/operators/op-eq.js +2 -2
  71. package/esm/sql-objects/operators/op-exists.js +2 -2
  72. package/esm/sql-objects/operators/op-gt.js +2 -2
  73. package/esm/sql-objects/operators/op-gte.js +2 -2
  74. package/esm/sql-objects/operators/op-ilike.js +5 -2
  75. package/esm/sql-objects/operators/op-in.js +2 -2
  76. package/esm/sql-objects/operators/op-is-not.js +2 -2
  77. package/esm/sql-objects/operators/op-is.js +2 -2
  78. package/esm/sql-objects/operators/op-like.js +2 -2
  79. package/esm/sql-objects/operators/op-lt.js +2 -2
  80. package/esm/sql-objects/operators/op-lte.js +2 -2
  81. package/esm/sql-objects/operators/op-ne.js +2 -2
  82. package/esm/sql-objects/operators/op-not-between.js +5 -2
  83. package/esm/sql-objects/operators/op-not-exists.js +5 -2
  84. package/esm/sql-objects/operators/op-not-ilike.js +5 -2
  85. package/esm/sql-objects/operators/op-not-in.js +5 -2
  86. package/esm/sql-objects/operators/op-not-like.js +5 -2
  87. package/esm/sql-objects/operators/op-not.js +1 -2
  88. package/esm/sql-objects/operators/op-or.js +4 -1
  89. package/esm/sql-objects/order-column.js +0 -1
  90. package/esm/sql-objects/param-expression.js +0 -3
  91. package/esm/sql-objects/raw-statement.js +0 -1
  92. package/esm/sql-objects/returning-column.js +0 -1
  93. package/esm/sql-objects/sequence-getter-statement.js +0 -3
  94. package/esm/sql-objects/string-agg-statement.js +0 -4
  95. package/esm/sql-objects/table-name.js +0 -3
  96. package/esm/sql-objects/upper-statement.js +0 -2
  97. package/package.json +7 -13
  98. package/esm/classes.ns.d.ts +0 -38
  99. package/esm/enums.d.ts +0 -94
  100. package/esm/extensions.d.ts +0 -4
  101. package/esm/helpers.d.ts +0 -4
  102. package/esm/index.d.ts +0 -20
  103. package/esm/op.initializers.d.ts +0 -89
  104. package/esm/query/delete-query.d.ts +0 -24
  105. package/esm/query/insert-query.d.ts +0 -23
  106. package/esm/query/query.d.ts +0 -15
  107. package/esm/query/returning-query.d.ts +0 -14
  108. package/esm/query/select-query.d.ts +0 -90
  109. package/esm/query/update-query.d.ts +0 -29
  110. package/esm/serializable.d.ts +0 -9
  111. package/esm/serialize-context.d.ts +0 -47
  112. package/esm/sql-objects/base-field.d.ts +0 -7
  113. package/esm/sql-objects/case-statement.d.ts +0 -42
  114. package/esm/sql-objects/coalesce-statement.d.ts +0 -22
  115. package/esm/sql-objects/count-statement.d.ts +0 -20
  116. package/esm/sql-objects/expression.d.ts +0 -7
  117. package/esm/sql-objects/field-expression.d.ts +0 -14
  118. package/esm/sql-objects/group-column.d.ts +0 -8
  119. package/esm/sql-objects/join-statement.d.ts +0 -17
  120. package/esm/sql-objects/lower-statement.d.ts +0 -22
  121. package/esm/sql-objects/max-statement.d.ts +0 -22
  122. package/esm/sql-objects/min-statement.d.ts +0 -22
  123. package/esm/sql-objects/operator.d.ts +0 -5
  124. package/esm/sql-objects/operators/comp-operator.d.ts +0 -16
  125. package/esm/sql-objects/operators/logical-operator.d.ts +0 -16
  126. package/esm/sql-objects/operators/op-and.d.ts +0 -5
  127. package/esm/sql-objects/operators/op-between.d.ts +0 -11
  128. package/esm/sql-objects/operators/op-eq.d.ts +0 -8
  129. package/esm/sql-objects/operators/op-exists.d.ts +0 -11
  130. package/esm/sql-objects/operators/op-gt.d.ts +0 -8
  131. package/esm/sql-objects/operators/op-gte.d.ts +0 -8
  132. package/esm/sql-objects/operators/op-ilike.d.ts +0 -6
  133. package/esm/sql-objects/operators/op-in.d.ts +0 -9
  134. package/esm/sql-objects/operators/op-is-not.d.ts +0 -8
  135. package/esm/sql-objects/operators/op-is.d.ts +0 -8
  136. package/esm/sql-objects/operators/op-like.d.ts +0 -10
  137. package/esm/sql-objects/operators/op-lt.d.ts +0 -8
  138. package/esm/sql-objects/operators/op-lte.d.ts +0 -8
  139. package/esm/sql-objects/operators/op-ne.d.ts +0 -8
  140. package/esm/sql-objects/operators/op-not-between.d.ts +0 -6
  141. package/esm/sql-objects/operators/op-not-exists.d.ts +0 -6
  142. package/esm/sql-objects/operators/op-not-ilike.d.ts +0 -6
  143. package/esm/sql-objects/operators/op-not-in.d.ts +0 -6
  144. package/esm/sql-objects/operators/op-not-like.d.ts +0 -6
  145. package/esm/sql-objects/operators/op-not.d.ts +0 -11
  146. package/esm/sql-objects/operators/op-or.d.ts +0 -5
  147. package/esm/sql-objects/order-column.d.ts +0 -9
  148. package/esm/sql-objects/param-expression.d.ts +0 -23
  149. package/esm/sql-objects/raw-statement.d.ts +0 -9
  150. package/esm/sql-objects/returning-column.d.ts +0 -9
  151. package/esm/sql-objects/sequence-getter-statement.d.ts +0 -24
  152. package/esm/sql-objects/string-agg-statement.d.ts +0 -31
  153. package/esm/sql-objects/table-name.d.ts +0 -11
  154. package/esm/sql-objects/upper-statement.d.ts +0 -22
  155. package/esm/sqlobject.initializers.d.ts +0 -55
  156. package/esm/typeguards.d.ts +0 -36
  157. package/esm/types.d.ts +0 -33
@@ -4,7 +4,6 @@ import merge from 'putil-merge';
4
4
  import { Serializable } from '../serializable.js';
5
5
  import { SerializeContext } from '../serialize-context.js';
6
6
  export class Query extends Serializable {
7
- _params;
8
7
  constructor() {
9
8
  super();
10
9
  EventEmitter.call(this);
@@ -3,7 +3,6 @@ import { printArray } from '../helpers.js';
3
3
  import { ReturningColumn } from '../sql-objects/returning-column.js';
4
4
  import { Query } from './query.js';
5
5
  export class ReturningQuery extends Query {
6
- _returningColumns;
7
6
  /**
8
7
  *
9
8
  */
@@ -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)))
@@ -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
  }
@@ -1,7 +1,7 @@
1
1
  import { Expression } from './expression.js';
2
2
  export class BaseField extends Expression {
3
- _field = '';
4
- _schema;
5
- _table;
6
- _descending;
3
+ constructor() {
4
+ super(...arguments);
5
+ this._field = '';
6
+ }
7
7
  }
@@ -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 = [];
@@ -1,8 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class CoalesceStatement extends Serializable {
4
- _expressions;
5
- _alias;
6
4
  constructor(...expressions) {
7
5
  super();
8
6
  this._expressions = expressions;
@@ -1,7 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class CountStatement extends Serializable {
4
- _alias;
5
4
  get _type() {
6
5
  return SerializationType.COUNT_STATEMENT;
7
6
  }
@@ -1,6 +1,3 @@
1
1
  import { Serializable } from '../serializable.js';
2
2
  export class Expression extends Serializable {
3
- _dataType;
4
- _isArray;
5
- _isDataSet;
6
3
  }
@@ -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'))
@@ -1,8 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class LowerStatement extends Serializable {
4
- _expression;
5
- _alias;
6
4
  constructor(expression) {
7
5
  super();
8
6
  this._expression = expression;
@@ -1,8 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class MaxStatement extends Serializable {
4
- _expression;
5
- _alias;
6
4
  constructor(expression) {
7
5
  super();
8
6
  this._expression = expression;
@@ -1,8 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class MinStatement extends Serializable {
4
- _expression;
5
- _alias;
6
4
  constructor(expression) {
7
5
  super();
8
6
  this._expression = expression;
@@ -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
- _operatorType = OperatorType.and;
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
- _operatorType = OperatorType.iLike;
5
- _symbol = 'ilike';
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
- _operatorType = OperatorType.notBetween;
5
- _symbol = 'not between';
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
- _operatorType = OperatorType.notExists;
5
- _symbol = 'not exists';
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
- _operatorType = OperatorType.notILike;
5
- _symbol = 'not ilike';
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
- _operatorType = OperatorType.notIn;
5
- _symbol = 'not in';
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
- _operatorType = OperatorType.notLike;
5
- _symbol = 'not like';
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
- _operatorType = OperatorType.or;
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);
@@ -1,9 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class ParamExpression extends Serializable {
4
- _name;
5
- _dataType;
6
- _isArray;
7
4
  constructor(arg) {
8
5
  super();
9
6
  if (typeof arg === 'object') {
@@ -1,7 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class RawStatement extends Serializable {
4
- _text;
5
4
  constructor(str) {
6
5
  super();
7
6
  this._text = str;
@@ -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+)?$/);
@@ -1,8 +1,6 @@
1
1
  import { SerializationType } from '../enums.js';
2
2
  import { Serializable } from '../serializable.js';
3
3
  export class UpperStatement extends Serializable {
4
- _expression;
5
- _alias;
6
4
  constructor(expression) {
7
5
  super();
8
6
  this._expression = expression;
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.9.1",
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.10.3",
40
+ "putil-merge": "^3.12.1",
37
41
  "putil-varhelpers": "^1.6.5"
38
42
  },
39
43
  "devDependencies": {
40
- "@types/debug": "^4.1.8"
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",