@sqb/builder 4.9.0 → 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 (158) hide show
  1. package/cjs/enums.js +4 -4
  2. package/cjs/query/delete-query.js +0 -2
  3. package/cjs/query/insert-query.js +0 -2
  4. package/cjs/query/query.js +0 -1
  5. package/cjs/query/returning-query.js +0 -1
  6. package/cjs/query/select-query.js +0 -10
  7. package/cjs/query/update-query.js +0 -3
  8. package/cjs/serialize-context.js +12 -22
  9. package/cjs/sql-objects/base-field.js +4 -4
  10. package/cjs/sql-objects/case-statement.js +0 -4
  11. package/cjs/sql-objects/coalesce-statement.js +0 -2
  12. package/cjs/sql-objects/count-statement.js +0 -1
  13. package/cjs/sql-objects/expression.js +0 -3
  14. package/cjs/sql-objects/field-expression.js +0 -1
  15. package/cjs/sql-objects/join-statement.js +1 -3
  16. package/cjs/sql-objects/lower-statement.js +0 -2
  17. package/cjs/sql-objects/max-statement.js +0 -2
  18. package/cjs/sql-objects/min-statement.js +0 -2
  19. package/cjs/sql-objects/operators/comp-operator.js +0 -4
  20. package/cjs/sql-objects/operators/logical-operator.js +1 -1
  21. package/cjs/sql-objects/operators/op-and.js +4 -1
  22. package/cjs/sql-objects/operators/op-between.js +2 -2
  23. package/cjs/sql-objects/operators/op-eq.js +2 -2
  24. package/cjs/sql-objects/operators/op-exists.js +2 -2
  25. package/cjs/sql-objects/operators/op-gt.js +2 -2
  26. package/cjs/sql-objects/operators/op-gte.js +2 -2
  27. package/cjs/sql-objects/operators/op-ilike.js +5 -2
  28. package/cjs/sql-objects/operators/op-in.js +2 -2
  29. package/cjs/sql-objects/operators/op-is-not.js +2 -2
  30. package/cjs/sql-objects/operators/op-is.js +2 -2
  31. package/cjs/sql-objects/operators/op-like.js +2 -2
  32. package/cjs/sql-objects/operators/op-lt.js +2 -2
  33. package/cjs/sql-objects/operators/op-lte.js +2 -2
  34. package/cjs/sql-objects/operators/op-ne.js +2 -2
  35. package/cjs/sql-objects/operators/op-not-between.js +5 -2
  36. package/cjs/sql-objects/operators/op-not-exists.js +5 -2
  37. package/cjs/sql-objects/operators/op-not-ilike.js +5 -2
  38. package/cjs/sql-objects/operators/op-not-in.js +5 -2
  39. package/cjs/sql-objects/operators/op-not-like.js +5 -2
  40. package/cjs/sql-objects/operators/op-not.js +1 -2
  41. package/cjs/sql-objects/operators/op-or.js +4 -1
  42. package/cjs/sql-objects/order-column.js +0 -1
  43. package/cjs/sql-objects/param-expression.js +0 -3
  44. package/cjs/sql-objects/raw-statement.js +0 -1
  45. package/cjs/sql-objects/returning-column.js +0 -1
  46. package/cjs/sql-objects/sequence-getter-statement.js +0 -3
  47. package/cjs/sql-objects/string-agg-statement.js +0 -4
  48. package/cjs/sql-objects/table-name.js +0 -3
  49. package/cjs/sql-objects/upper-statement.js +0 -2
  50. package/esm/query/delete-query.js +0 -2
  51. package/esm/query/insert-query.js +0 -2
  52. package/esm/query/query.js +0 -1
  53. package/esm/query/returning-query.js +0 -1
  54. package/esm/query/select-query.js +0 -10
  55. package/esm/query/update-query.js +0 -3
  56. package/esm/serialize-context.js +12 -22
  57. package/esm/sql-objects/base-field.js +4 -4
  58. package/esm/sql-objects/case-statement.js +0 -4
  59. package/esm/sql-objects/coalesce-statement.js +0 -2
  60. package/esm/sql-objects/count-statement.js +0 -1
  61. package/esm/sql-objects/expression.js +0 -3
  62. package/esm/sql-objects/field-expression.js +0 -1
  63. package/esm/sql-objects/join-statement.js +1 -3
  64. package/esm/sql-objects/lower-statement.js +0 -2
  65. package/esm/sql-objects/max-statement.js +0 -2
  66. package/esm/sql-objects/min-statement.js +0 -2
  67. package/esm/sql-objects/operators/comp-operator.js +0 -4
  68. package/esm/sql-objects/operators/logical-operator.js +1 -1
  69. package/esm/sql-objects/operators/op-and.js +4 -1
  70. package/esm/sql-objects/operators/op-between.js +2 -2
  71. package/esm/sql-objects/operators/op-eq.js +2 -2
  72. package/esm/sql-objects/operators/op-exists.js +2 -2
  73. package/esm/sql-objects/operators/op-gt.js +2 -2
  74. package/esm/sql-objects/operators/op-gte.js +2 -2
  75. package/esm/sql-objects/operators/op-ilike.js +5 -2
  76. package/esm/sql-objects/operators/op-in.js +2 -2
  77. package/esm/sql-objects/operators/op-is-not.js +2 -2
  78. package/esm/sql-objects/operators/op-is.js +2 -2
  79. package/esm/sql-objects/operators/op-like.js +2 -2
  80. package/esm/sql-objects/operators/op-lt.js +2 -2
  81. package/esm/sql-objects/operators/op-lte.js +2 -2
  82. package/esm/sql-objects/operators/op-ne.js +2 -2
  83. package/esm/sql-objects/operators/op-not-between.js +5 -2
  84. package/esm/sql-objects/operators/op-not-exists.js +5 -2
  85. package/esm/sql-objects/operators/op-not-ilike.js +5 -2
  86. package/esm/sql-objects/operators/op-not-in.js +5 -2
  87. package/esm/sql-objects/operators/op-not-like.js +5 -2
  88. package/esm/sql-objects/operators/op-not.js +1 -2
  89. package/esm/sql-objects/operators/op-or.js +4 -1
  90. package/esm/sql-objects/order-column.js +0 -1
  91. package/esm/sql-objects/param-expression.js +0 -3
  92. package/esm/sql-objects/raw-statement.js +0 -1
  93. package/esm/sql-objects/returning-column.js +0 -1
  94. package/esm/sql-objects/sequence-getter-statement.js +0 -3
  95. package/esm/sql-objects/string-agg-statement.js +0 -4
  96. package/esm/sql-objects/table-name.js +0 -3
  97. package/esm/sql-objects/upper-statement.js +0 -2
  98. package/package.json +7 -13
  99. package/esm/classes.ns.d.ts +0 -38
  100. package/esm/enums.d.ts +0 -94
  101. package/esm/extensions.d.ts +0 -4
  102. package/esm/helpers.d.ts +0 -4
  103. package/esm/index.d.ts +0 -20
  104. package/esm/op.initializers.d.ts +0 -89
  105. package/esm/query/delete-query.d.ts +0 -24
  106. package/esm/query/insert-query.d.ts +0 -23
  107. package/esm/query/query.d.ts +0 -15
  108. package/esm/query/returning-query.d.ts +0 -14
  109. package/esm/query/select-query.d.ts +0 -90
  110. package/esm/query/update-query.d.ts +0 -29
  111. package/esm/serializable.d.ts +0 -9
  112. package/esm/serialize-context.d.ts +0 -47
  113. package/esm/sql-objects/base-field.d.ts +0 -7
  114. package/esm/sql-objects/case-statement.d.ts +0 -42
  115. package/esm/sql-objects/coalesce-statement.d.ts +0 -22
  116. package/esm/sql-objects/count-statement.d.ts +0 -20
  117. package/esm/sql-objects/expression.d.ts +0 -7
  118. package/esm/sql-objects/field-expression.d.ts +0 -14
  119. package/esm/sql-objects/group-column.d.ts +0 -8
  120. package/esm/sql-objects/join-statement.d.ts +0 -17
  121. package/esm/sql-objects/lower-statement.d.ts +0 -22
  122. package/esm/sql-objects/max-statement.d.ts +0 -22
  123. package/esm/sql-objects/min-statement.d.ts +0 -22
  124. package/esm/sql-objects/operator.d.ts +0 -5
  125. package/esm/sql-objects/operators/comp-operator.d.ts +0 -16
  126. package/esm/sql-objects/operators/logical-operator.d.ts +0 -16
  127. package/esm/sql-objects/operators/op-and.d.ts +0 -5
  128. package/esm/sql-objects/operators/op-between.d.ts +0 -11
  129. package/esm/sql-objects/operators/op-eq.d.ts +0 -8
  130. package/esm/sql-objects/operators/op-exists.d.ts +0 -11
  131. package/esm/sql-objects/operators/op-gt.d.ts +0 -8
  132. package/esm/sql-objects/operators/op-gte.d.ts +0 -8
  133. package/esm/sql-objects/operators/op-ilike.d.ts +0 -6
  134. package/esm/sql-objects/operators/op-in.d.ts +0 -9
  135. package/esm/sql-objects/operators/op-is-not.d.ts +0 -8
  136. package/esm/sql-objects/operators/op-is.d.ts +0 -8
  137. package/esm/sql-objects/operators/op-like.d.ts +0 -10
  138. package/esm/sql-objects/operators/op-lt.d.ts +0 -8
  139. package/esm/sql-objects/operators/op-lte.d.ts +0 -8
  140. package/esm/sql-objects/operators/op-ne.d.ts +0 -8
  141. package/esm/sql-objects/operators/op-not-between.d.ts +0 -6
  142. package/esm/sql-objects/operators/op-not-exists.d.ts +0 -6
  143. package/esm/sql-objects/operators/op-not-ilike.d.ts +0 -6
  144. package/esm/sql-objects/operators/op-not-in.d.ts +0 -6
  145. package/esm/sql-objects/operators/op-not-like.d.ts +0 -6
  146. package/esm/sql-objects/operators/op-not.d.ts +0 -11
  147. package/esm/sql-objects/operators/op-or.d.ts +0 -5
  148. package/esm/sql-objects/order-column.d.ts +0 -9
  149. package/esm/sql-objects/param-expression.d.ts +0 -23
  150. package/esm/sql-objects/raw-statement.d.ts +0 -9
  151. package/esm/sql-objects/returning-column.d.ts +0 -9
  152. package/esm/sql-objects/sequence-getter-statement.d.ts +0 -24
  153. package/esm/sql-objects/string-agg-statement.d.ts +0 -31
  154. package/esm/sql-objects/table-name.d.ts +0 -11
  155. package/esm/sql-objects/upper-statement.d.ts +0 -22
  156. package/esm/sqlobject.initializers.d.ts +0 -55
  157. package/esm/typeguards.d.ts +0 -36
  158. package/esm/types.d.ts +0 -33
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.0",
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.7"
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",
@@ -1,38 +0,0 @@
1
- export * from './query/query.js';
2
- export * from './query/returning-query.js';
3
- export * from './query/select-query.js';
4
- export * from './query/insert-query.js';
5
- export * from './query/update-query.js';
6
- export * from './query/delete-query.js';
7
- export * from './sql-objects/field-expression.js';
8
- export * from './sql-objects/table-name.js';
9
- export * from './sql-objects/order-column.js';
10
- export * from './sql-objects/group-column.js';
11
- export * from './sql-objects/base-field.js';
12
- export * from './sql-objects/operator.js';
13
- export * from './sql-objects/case-statement.js';
14
- export * from './sql-objects/join-statement.js';
15
- export * from './sql-objects/raw-statement.js';
16
- export * from './sql-objects/count-statement.js';
17
- export * from './sql-objects/operators/logical-operator.js';
18
- export * from './sql-objects/operators/op-and.js';
19
- export * from './sql-objects/operators/op-not-exists.js';
20
- export * from './sql-objects/operators/op-exists.js';
21
- export * from './sql-objects/operators/op-not-ilike.js';
22
- export * from './sql-objects/operators/op-not-like.js';
23
- export * from './sql-objects/operators/op-not-in.js';
24
- export * from './sql-objects/operators/op-not-between.js';
25
- export * from './sql-objects/operators/op-ne.js';
26
- export * from './sql-objects/operators/op-ilike.js';
27
- export * from './sql-objects/operators/op-like.js';
28
- export * from './sql-objects/operators/op-is-not.js';
29
- export * from './sql-objects/operators/op-is.js';
30
- export * from './sql-objects/operators/op-in.js';
31
- export * from './sql-objects/operators/op-between.js';
32
- export * from './sql-objects/operators/op-lte.js';
33
- export * from './sql-objects/operators/op-lt.js';
34
- export * from './sql-objects/operators/op-gte.js';
35
- export * from './sql-objects/operators/op-gt.js';
36
- export * from './sql-objects/operators/op-eq.js';
37
- export * from './sql-objects/operators/op-or.js';
38
- export * from './sql-objects/operators/comp-operator.js';
package/esm/enums.d.ts DELETED
@@ -1,94 +0,0 @@
1
- export declare enum JoinType {
2
- INNER = "inner",
3
- LEFT = "left",
4
- LEFT_OUTER = "left outer",
5
- RIGHT = "right",
6
- RIGHT_OUTER = "right outer",
7
- OUTER = "outer",
8
- FULL_OUTER = "full outer",
9
- CROSS = "cross"
10
- }
11
- export declare enum SerializationType {
12
- SELECT_QUERY = "select_query",
13
- SELECT_QUERY_COLUMNS = "select_query.columns",
14
- SELECT_QUERY_FROM = "select_query.from",
15
- SELECT_QUERY_JOIN = "select_query.join",
16
- SELECT_QUERY_GROUPBY = "select_query.groupby",
17
- SELECT_QUERY_ORDERBY = "select_query.orderby",
18
- INSERT_QUERY = "insert_query",
19
- INSERT_QUERY_COLUMNS = "insert_query.columns",
20
- INSERT_QUERY_VALUES = "insert_query.values",
21
- UPDATE_QUERY = "update_query",
22
- UPDATE_QUERY_VALUES = "update_query.values",
23
- DELETE_QUERY = "delete_query",
24
- FIELD_NAME = "field_name",
25
- GROUP_COLUMN = "group_column",
26
- ORDER_COLUMN = "order_column",
27
- RETURNING_COLUMN = "returning_column",
28
- TABLE_NAME = "table_name",
29
- JOIN = "join",
30
- JOIN_CONDITIONS = "join_conditions",
31
- RAW = "raw",
32
- CASE_STATEMENT = "case_expression",
33
- COALESCE_STATEMENT = "coalesce_expression",
34
- LOWER_STATEMENT = "lower_expression",
35
- UPPER_STATEMENT = "upper_expression",
36
- MAX_STATEMENT = "max_expression",
37
- MIN_STATEMENT = "min_expression",
38
- SEQUENCE_GETTER_STATEMENT = "sequence_getter_statement",
39
- STRINGAGG_STATEMENT = "StringAGG_expression",
40
- COUNT_STATEMENT = "count_expression",
41
- CONDITIONS_BLOCK = "conditions_block",
42
- COMPARISON_EXPRESSION = "comparison_expression",
43
- LOGICAL_EXPRESSION = "logical_expression",
44
- NEGATIVE_EXPRESSION = "negative_expression",
45
- RETURNING_BLOCK = "returning_block",
46
- DATE_VALUE = "date_value",
47
- STRING_VALUE = "string_value",
48
- BOOLEAN_VALUE = "boolean_value",
49
- NUMBER_VALUE = "number_value",
50
- EXTERNAL_PARAMETER = "external_parameter",
51
- ARRAY = "array"
52
- }
53
- export declare enum OperatorType {
54
- and = "and",
55
- or = "or",
56
- eq = "eq",
57
- ne = "ne",
58
- gt = "gt",
59
- gte = "gte",
60
- lt = "lt",
61
- lte = "lte",
62
- between = "between",
63
- notBetween = "notBetween",
64
- in = "in",
65
- notIn = "notIn",
66
- like = "like",
67
- notLike = "notLike",
68
- iLike = "iLike",
69
- notILike = "notILike",
70
- is = "is",
71
- isNot = "isNot",
72
- exists = "exists",
73
- notExists = "notExists",
74
- not = "not"
75
- }
76
- export declare enum DataType {
77
- BOOL = "BOOL",
78
- CHAR = "CHAR",
79
- VARCHAR = "VARCHAR",
80
- SMALLINT = "SMALLINT",
81
- INTEGER = "INTEGER",
82
- BIGINT = "BIGINT",
83
- FLOAT = "FLOAT",
84
- DOUBLE = "DOUBLE",
85
- NUMBER = "NUMBER",
86
- DATE = "DATE",
87
- TIMESTAMP = "TIMESTAMP",
88
- TIMESTAMPTZ = "TIMESTAMPTZ",
89
- TIME = "TIME",
90
- BINARY = "BINARY",
91
- TEXT = "TEXT",
92
- GUID = "GUID",
93
- JSON = "JSON"
94
- }
@@ -1,4 +0,0 @@
1
- import { SerializerExtension } from './types.js';
2
- export declare let serializers: SerializerExtension[];
3
- export declare function registerSerializer(...extension: SerializerExtension[]): void;
4
- export declare function unRegisterSerializer(...extension: SerializerExtension[]): void;
package/esm/helpers.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Prints array with line feeding
3
- */
4
- export declare function printArray(arr: string[], sep?: string, lfLen?: number): string;
package/esm/index.d.ts DELETED
@@ -1,20 +0,0 @@
1
- export { registerSerializer, unRegisterSerializer } from './extensions.js';
2
- export * from './helpers.js';
3
- export * from './serializable.js';
4
- export * from './serialize-context.js';
5
- export * from './query/query.js';
6
- export * from './query/select-query.js';
7
- export * from './query/insert-query.js';
8
- export * from './query/update-query.js';
9
- export * from './query/delete-query.js';
10
- export * from './sql-objects/operator.js';
11
- export * from './sql-objects/operators/logical-operator.js';
12
- export * from './sql-objects/operators/comp-operator.js';
13
- export * from './sql-objects/join-statement.js';
14
- export * from './types.js';
15
- export * from './enums.js';
16
- export * from './sqlobject.initializers.js';
17
- export * from './op.initializers.js';
18
- export * from './typeguards.js';
19
- export { op } from './op.initializers.js';
20
- export * as classes from './classes.ns.js';
@@ -1,89 +0,0 @@
1
- import { SelectQuery } from './query/select-query.js';
2
- import { Serializable } from './serializable.js';
3
- import { Operator } from './sql-objects/operator.js';
4
- import { OpAnd } from './sql-objects/operators/op-and.js';
5
- import { OpEq } from './sql-objects/operators/op-eq.js';
6
- import { OpExists } from './sql-objects/operators/op-exists.js';
7
- import { OpGt } from './sql-objects/operators/op-gt.js';
8
- import { OpGte } from './sql-objects/operators/op-gte.js';
9
- import { OpILike } from './sql-objects/operators/op-ilike.js';
10
- import { OpIn } from './sql-objects/operators/op-in.js';
11
- import { OpIs } from './sql-objects/operators/op-is.js';
12
- import { OpIsNot } from './sql-objects/operators/op-is-not.js';
13
- import { OpLike } from './sql-objects/operators/op-like.js';
14
- import { OpLt } from './sql-objects/operators/op-lt.js';
15
- import { OpLte } from './sql-objects/operators/op-lte.js';
16
- import { OpNe } from './sql-objects/operators/op-ne.js';
17
- import { OpNot } from './sql-objects/operators/op-not.js';
18
- import { OpNotExists } from './sql-objects/operators/op-not-exists.js';
19
- import { OpNotILike } from './sql-objects/operators/op-not-ilike.js';
20
- import { OpNotIn } from './sql-objects/operators/op-not-in.js';
21
- import { OpNotLike } from './sql-objects/operators/op-not-like.js';
22
- import { OpOr } from './sql-objects/operators/op-or.js';
23
- import { RawStatement } from './sql-objects/raw-statement.js';
24
- declare function And(...args: (Operator | RawStatement)[]): OpAnd;
25
- declare function Or(...args: (Operator | RawStatement)[]): OpOr;
26
- declare function Eq(expression: string | Serializable, value: any): OpEq;
27
- declare function Ne(expression: string | Serializable, value: any): OpNe;
28
- declare function Gt(expression: string | Serializable, value: any): OpGt;
29
- declare function Gte(expression: string | Serializable, value: any): OpGte;
30
- declare function Lt(expression: string | Serializable, value: any): OpLt;
31
- declare function Lte(expression: string | Serializable, value: any): OpLte;
32
- declare function Between(expression: string | Serializable, values: any[]): any;
33
- declare function Between(expression: string | Serializable, value1: any, value2: any): any;
34
- declare function NotBetween(expression: string | Serializable, values: any[]): any;
35
- declare function NotBetween(expression: string | Serializable, value1: any, value2: any): any;
36
- declare function In(expression: string | Serializable, value: any): OpIn;
37
- declare function NotIn(expression: string | Serializable, value: any): OpNotIn;
38
- declare function Like(expression: string | Serializable, value: any): OpLike;
39
- declare function NotLike(expression: string | Serializable, value: any): OpNotLike;
40
- declare function Ilike(expression: string | Serializable, value: any): OpILike;
41
- declare function NotILike(expression: string | Serializable, value: any): OpNotILike;
42
- declare function Is(expression: string | Serializable, value: any): OpIs;
43
- declare function IsNot(expression: string | Serializable, value: any): OpIsNot;
44
- declare function Exists(expression: SelectQuery): OpExists;
45
- declare function NotExists(expression: SelectQuery): OpNotExists;
46
- declare function Not(expression: Serializable): OpNot;
47
- declare const op: {
48
- and: typeof And;
49
- or: typeof Or;
50
- eq: typeof Eq;
51
- '=': typeof Eq;
52
- ne: typeof Ne;
53
- '!=': typeof Ne;
54
- gt: typeof Gt;
55
- '>': typeof Gt;
56
- gte: typeof Gte;
57
- '>=': typeof Gte;
58
- lt: typeof Lt;
59
- '<': typeof Lt;
60
- lte: typeof Lte;
61
- '<=': typeof Lte;
62
- between: typeof Between;
63
- btw: typeof Between;
64
- notBetween: typeof NotBetween;
65
- nbtw: typeof NotBetween;
66
- '!between': typeof NotBetween;
67
- '!btw': typeof NotBetween;
68
- in: typeof In;
69
- notIn: typeof NotIn;
70
- nin: typeof NotIn;
71
- '!in': typeof NotIn;
72
- like: typeof Like;
73
- not: typeof Not;
74
- notLike: typeof NotLike;
75
- nlike: typeof NotLike;
76
- '!like': typeof NotLike;
77
- ilike: typeof Ilike;
78
- notILike: typeof NotILike;
79
- nilike: typeof NotILike;
80
- '!ilike': typeof NotILike;
81
- is: typeof Is;
82
- isNot: typeof IsNot;
83
- '!is': typeof IsNot;
84
- exists: typeof Exists;
85
- notExists: typeof NotExists;
86
- '!exists': typeof NotExists;
87
- };
88
- export { op };
89
- export { And, Or, Eq, Eq as Equal, Ne, Ne as NotEqual, Gt, Gt as GreaterThan, Gte, Gte as GreaterAnEqualTo, Lt, Lt as LowerThan, Lte, Lte as LowerAndEqualTo, Between, NotBetween, In, NotIn, NotIn as Nin, Like, NotLike, NotLike as NLike, Ilike, NotILike, NotILike as Nilike, Is, IsNot, Exists, NotExists, Not };
@@ -1,24 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { SerializeContext } from '../serialize-context.js';
3
- import { LogicalOperator } from '../sql-objects/operators/logical-operator.js';
4
- import { RawStatement } from '../sql-objects/raw-statement.js';
5
- import { TableName } from '../sql-objects/table-name.js';
6
- import { Query } from './query.js';
7
- export declare class DeleteQuery extends Query {
8
- _table: TableName | RawStatement;
9
- _where?: LogicalOperator;
10
- constructor(tableName: string | RawStatement);
11
- get _type(): SerializationType;
12
- /**
13
- * Defines "where" part of query
14
- */
15
- where(...operator: any[]): this;
16
- /**
17
- * Performs serialization
18
- */
19
- _serialize(ctx: SerializeContext): string;
20
- /**
21
- *
22
- */
23
- _serializeWhere(ctx: SerializeContext): string;
24
- }
@@ -1,23 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { SerializeContext } from '../serialize-context.js';
3
- import type { RawStatement } from '../sql-objects/raw-statement.js';
4
- import { TableName } from '../sql-objects/table-name.js';
5
- import { ReturningQuery } from './returning-query.js';
6
- export declare class InsertQuery extends ReturningQuery {
7
- _table: TableName | RawStatement;
8
- _input: any;
9
- constructor(tableName: string | RawStatement, input: any);
10
- get _type(): SerializationType;
11
- /**
12
- * Performs serialization
13
- */
14
- _serialize(ctx: SerializeContext): string;
15
- /**
16
- *
17
- */
18
- protected __serializeColumns(ctx: SerializeContext): string;
19
- /**
20
- *
21
- */
22
- protected __serializeValues(ctx: SerializeContext): string;
23
- }
@@ -1,15 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import { Serializable } from '../serializable.js';
4
- import { GenerateOptions, GenerateResult } from '../types.js';
5
- export declare interface Query extends EventEmitter {
6
- }
7
- export declare abstract class Query extends Serializable {
8
- protected _params?: Record<string, any>;
9
- constructor();
10
- /**
11
- * Generates Sql script
12
- */
13
- generate(options?: GenerateOptions): GenerateResult;
14
- values(obj: any): this;
15
- }
@@ -1,14 +0,0 @@
1
- import { SerializeContext } from '../serialize-context.js';
2
- import { ReturningColumn } from '../sql-objects/returning-column.js';
3
- import { Query } from './query.js';
4
- export declare abstract class ReturningQuery extends Query {
5
- _returningColumns?: ReturningColumn[];
6
- /**
7
- *
8
- */
9
- returning(...columns: string[]): this;
10
- /**
11
- *
12
- */
13
- protected __serializeReturning(ctx: SerializeContext): string;
14
- }
@@ -1,90 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { Serializable } from '../serializable.js';
3
- import { SerializeContext } from '../serialize-context.js';
4
- import { GroupColumn } from '../sql-objects/group-column.js';
5
- import { JoinStatement } from '../sql-objects/join-statement.js';
6
- import { LogicalOperator } from '../sql-objects/operators/logical-operator.js';
7
- import { OrderColumn } from '../sql-objects/order-column.js';
8
- import { RawStatement } from '../sql-objects/raw-statement.js';
9
- import { Query } from './query.js';
10
- export declare class SelectQuery extends Query {
11
- _tables?: Serializable[];
12
- _columns?: Serializable[];
13
- _joins?: JoinStatement[];
14
- _where?: LogicalOperator;
15
- _groupBy?: (GroupColumn | Serializable)[];
16
- _orderBy?: (OrderColumn | Serializable)[];
17
- _limit?: number;
18
- _offset?: number;
19
- _alias?: string;
20
- _distinct?: boolean;
21
- constructor(...column: (string | string[] | Serializable)[]);
22
- get _type(): SerializationType;
23
- /**
24
- * Adds columns to query.
25
- */
26
- addColumn(...column: (string | string[] | Serializable)[]): this;
27
- /**
28
- * Defines "from" part of query.
29
- */
30
- from(...table: (string | RawStatement | SelectQuery)[]): this;
31
- /**
32
- * Adds "join" statements to query
33
- */
34
- join(...join: JoinStatement[]): this;
35
- /**
36
- * Defines "where" part of query
37
- */
38
- where(...condition: (Serializable | Object)[]): this;
39
- /**
40
- * Defines "where" part of query
41
- */
42
- groupBy(...field: (string | Serializable)[]): this;
43
- /**
44
- * Defines "order by" part of query.
45
- */
46
- orderBy(...field: (string | Serializable)[]): this;
47
- /**
48
- * Sets alias for sub-select queries
49
- */
50
- as(alias: any): this;
51
- /**
52
- * Sets limit for query
53
- */
54
- limit(limit: number): this;
55
- /**
56
- * Sets offset for query
57
- */
58
- offset(offset: number): this;
59
- /**
60
- * Enables distinct mode
61
- */
62
- distinct(): this;
63
- onFetch(listener: (...args: any[]) => void): this;
64
- onceFetch(listener: (...args: any[]) => void): this;
65
- /**
66
- * Performs serialization
67
- */
68
- _serialize(ctx: SerializeContext): string;
69
- /**
70
- *
71
- */
72
- protected __serializeSelectColumns(ctx: SerializeContext): string;
73
- /**
74
- *
75
- */
76
- protected __serializeFrom(ctx: SerializeContext): string;
77
- /**
78
- *
79
- */
80
- protected __serializeJoins(ctx: SerializeContext): string;
81
- /**
82
- *
83
- */
84
- protected __serializeWhere(ctx: SerializeContext): string;
85
- /**
86
- *
87
- */
88
- protected __serializeGroupColumns(ctx: SerializeContext): string;
89
- protected __serializeOrderColumns(ctx: SerializeContext): string;
90
- }
@@ -1,29 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { SerializeContext } from '../serialize-context.js';
3
- import { LogicalOperator } from '../sql-objects/operators/logical-operator.js';
4
- import { RawStatement } from '../sql-objects/raw-statement.js';
5
- import { TableName } from '../sql-objects/table-name.js';
6
- import { ReturningQuery } from './returning-query.js';
7
- export declare class UpdateQuery extends ReturningQuery {
8
- _table: TableName | RawStatement;
9
- _input: any;
10
- _where?: LogicalOperator;
11
- constructor(tableName: string | RawStatement, input: any);
12
- get _type(): SerializationType;
13
- /**
14
- * Defines "where" part of query
15
- */
16
- where(...operator: any[]): this;
17
- /**
18
- * Performs serialization
19
- */
20
- _serialize(ctx: SerializeContext): string;
21
- /**
22
- *
23
- */
24
- protected __serializeValues(ctx: SerializeContext): string;
25
- /**
26
- *
27
- */
28
- protected __serializeWhere(ctx: SerializeContext): string;
29
- }
@@ -1,9 +0,0 @@
1
- import type { SerializationType } from './enums.js';
2
- import type { SerializeContext } from './serialize-context.js';
3
- export declare abstract class Serializable {
4
- abstract _type: SerializationType;
5
- /**
6
- * Performs serialization
7
- */
8
- abstract _serialize(ctx: SerializeContext): string;
9
- }
@@ -1,47 +0,0 @@
1
- import { DefaultSerializeFunction, GenerateOptions, ParamOptions } from './types.js';
2
- export declare class SerializeContext implements GenerateOptions {
3
- readonly reservedWords: string[];
4
- dialect?: string;
5
- prettyPrint?: boolean;
6
- params?: Record<string, any>;
7
- dialectVersion?: string;
8
- strictParams?: boolean;
9
- serializeHooks?: Function[];
10
- paramOptions?: Record<string, ParamOptions> | ParamOptions[];
11
- preparedParams?: Record<string, any> | any[];
12
- returningFields?: {
13
- field: string;
14
- alias?: string;
15
- }[];
16
- strictParamGenId?: number;
17
- constructor(opts?: GenerateOptions);
18
- /**
19
- * Performs a fallback mechanism, tries hook functions, extensions than default function to serialize
20
- */
21
- serialize(type: string, o: any, fallback: DefaultSerializeFunction): string;
22
- /**
23
- * Serializes object
24
- */
25
- anyToSQL(v: any): string;
26
- /**
27
- *
28
- */
29
- stringToSQL(val: string): string;
30
- /**
31
- *
32
- */
33
- booleanToSQL(val: any): string;
34
- /**
35
- *
36
- */
37
- numberToSQL(val: any): string;
38
- /**
39
- *
40
- */
41
- dateToSQL(date: Date): string;
42
- /**
43
- * Check if a string value is a reserved word
44
- */
45
- isReservedWord(s: string | undefined | null): boolean;
46
- escapeReserved(s: string | undefined | null): string;
47
- }
@@ -1,7 +0,0 @@
1
- import { Expression } from './expression.js';
2
- export declare abstract class BaseField extends Expression {
3
- _field: string;
4
- _schema?: string;
5
- _table?: string;
6
- _descending?: boolean;
7
- }
@@ -1,42 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { Serializable } from '../serializable.js';
3
- import { SerializeContext } from '../serialize-context.js';
4
- import { Operator } from './operator.js';
5
- import { LogicalOperator } from './operators/logical-operator.js';
6
- import { RawStatement } from './raw-statement.js';
7
- export declare class CaseStatement extends Serializable {
8
- _expressions: {
9
- condition: Serializable;
10
- value: any;
11
- }[];
12
- _elseValue: any;
13
- _condition?: LogicalOperator;
14
- _alias?: string;
15
- constructor();
16
- get _type(): SerializationType;
17
- /**
18
- * Defines "when" part of Case expression.
19
- */
20
- when(...condition: (Operator | RawStatement)[]): this;
21
- /**
22
- * Defines "then" part of Case expression.
23
- */
24
- then(value: any): this;
25
- /**
26
- * Defines "else" part of Case expression.
27
- */
28
- else(value: any): this;
29
- /**
30
- * Sets alias to case expression.
31
- */
32
- as(alias: string): this;
33
- /**
34
- * Performs serialization
35
- *
36
- * @param {Object} ctx
37
- * @return {string}
38
- * @override
39
- */
40
- _serialize(ctx: SerializeContext): string;
41
- protected __defaultSerialize(ctx: SerializeContext, o: any): string;
42
- }
@@ -1,22 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { Serializable } from '../serializable.js';
3
- import { SerializeContext } from '../serialize-context.js';
4
- export declare class CoalesceStatement extends Serializable {
5
- _expressions: any[];
6
- _alias?: string;
7
- constructor(...expressions: any[]);
8
- get _type(): SerializationType;
9
- /**
10
- * Sets alias to case expression.
11
- */
12
- as(alias: string): this;
13
- /**
14
- * Performs serialization
15
- *
16
- * @param {Object} ctx
17
- * @return {string}
18
- * @override
19
- */
20
- _serialize(ctx: SerializeContext): string;
21
- protected __defaultSerialize(ctx: SerializeContext, o: any): string;
22
- }
@@ -1,20 +0,0 @@
1
- import { SerializationType } from '../enums.js';
2
- import { Serializable } from '../serializable.js';
3
- import { SerializeContext } from '../serialize-context.js';
4
- export declare class CountStatement extends Serializable {
5
- _alias?: string;
6
- get _type(): SerializationType;
7
- /**
8
- * Sets alias to case expression.
9
- */
10
- as(alias: string): this;
11
- /**
12
- * Performs serialization
13
- *
14
- * @param {Object} ctx
15
- * @return {string}
16
- * @override
17
- */
18
- _serialize(ctx: SerializeContext): string;
19
- protected __defaultSerialize(ctx: SerializeContext, o: any): string;
20
- }
@@ -1,7 +0,0 @@
1
- import { DataType } from '../enums.js';
2
- import { Serializable } from '../serializable.js';
3
- export declare abstract class Expression extends Serializable {
4
- _dataType?: DataType;
5
- _isArray?: boolean;
6
- _isDataSet?: boolean;
7
- }