taon-type-sql 21.0.2 → 21.0.4

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 (78) hide show
  1. package/browser/fesm2022/taon-type-sql.mjs.map +1 -1
  2. package/browser/package.json +1 -1
  3. package/browser/types/taon-type-sql.d.ts +254 -0
  4. package/lib/build-info._auto-generated_.d.ts +1 -1
  5. package/lib/build-info._auto-generated_.js +1 -1
  6. package/package.json +1 -1
  7. package/tmp-environment.json +5 -9
  8. package/websql/fesm2022/taon-type-sql.mjs.map +1 -1
  9. package/websql/package.json +1 -1
  10. package/websql/types/taon-type-sql.d.ts +254 -0
  11. package/browser/index.d.ts +0 -6
  12. package/browser/lib/builder/column/basic-column.d.ts +0 -9
  13. package/browser/lib/builder/column/boolean-column.d.ts +0 -10
  14. package/browser/lib/builder/column/comparable-column.d.ts +0 -19
  15. package/browser/lib/builder/column/date-column.d.ts +0 -10
  16. package/browser/lib/builder/column/number-column.d.ts +0 -11
  17. package/browser/lib/builder/column/query-column.d.ts +0 -19
  18. package/browser/lib/builder/column/string-column.d.ts +0 -18
  19. package/browser/lib/builder/column/value-column.d.ts +0 -16
  20. package/browser/lib/builder/condition/query-column-condition.d.ts +0 -14
  21. package/browser/lib/builder/condition/query-condition-chain.d.ts +0 -18
  22. package/browser/lib/builder/condition/query-condition.d.ts +0 -8
  23. package/browser/lib/builder/condition/query-join-condition.d.ts +0 -13
  24. package/browser/lib/builder/helpers/generics-helper.d.ts +0 -3
  25. package/browser/lib/builder/helpers/internal-types.d.ts +0 -16
  26. package/browser/lib/builder/join/joined-tables-chain.d.ts +0 -12
  27. package/browser/lib/builder/join/joined-tables.d.ts +0 -13
  28. package/browser/lib/builder/other/query-ordering.d.ts +0 -11
  29. package/browser/lib/builder/query/select-query.d.ts +0 -30
  30. package/browser/lib/builder/query/table-condition-query.d.ts +0 -17
  31. package/browser/lib/builder/query/table-query.d.ts +0 -24
  32. package/browser/lib/builder/query-source.d.ts +0 -15
  33. package/browser/lib/builder/query-table.d.ts +0 -16
  34. package/browser/lib/client/mysql.d.ts +0 -6
  35. package/browser/lib/client/query-processor.d.ts +0 -11
  36. package/browser/lib/converter/param-converter.d.ts +0 -3
  37. package/browser/lib/converter/parameterized-converter.d.ts +0 -6
  38. package/browser/lib/converter/query-converter.d.ts +0 -3
  39. package/browser/lib/converter/result-converter.d.ts +0 -3
  40. package/browser/lib/converter/sql-converter.d.ts +0 -3
  41. package/browser/lib/converter/type-converter.d.ts +0 -5
  42. package/browser/lib/converter/types.d.ts +0 -6
  43. package/browser/lib/index.d.ts +0 -26
  44. package/browser/public-api.d.ts +0 -2
  45. package/websql/index.d.ts +0 -6
  46. package/websql/lib/builder/column/basic-column.d.ts +0 -9
  47. package/websql/lib/builder/column/boolean-column.d.ts +0 -10
  48. package/websql/lib/builder/column/comparable-column.d.ts +0 -19
  49. package/websql/lib/builder/column/date-column.d.ts +0 -10
  50. package/websql/lib/builder/column/number-column.d.ts +0 -11
  51. package/websql/lib/builder/column/query-column.d.ts +0 -19
  52. package/websql/lib/builder/column/string-column.d.ts +0 -18
  53. package/websql/lib/builder/column/value-column.d.ts +0 -16
  54. package/websql/lib/builder/condition/query-column-condition.d.ts +0 -14
  55. package/websql/lib/builder/condition/query-condition-chain.d.ts +0 -18
  56. package/websql/lib/builder/condition/query-condition.d.ts +0 -8
  57. package/websql/lib/builder/condition/query-join-condition.d.ts +0 -13
  58. package/websql/lib/builder/helpers/generics-helper.d.ts +0 -3
  59. package/websql/lib/builder/helpers/internal-types.d.ts +0 -16
  60. package/websql/lib/builder/join/joined-tables-chain.d.ts +0 -12
  61. package/websql/lib/builder/join/joined-tables.d.ts +0 -13
  62. package/websql/lib/builder/other/query-ordering.d.ts +0 -11
  63. package/websql/lib/builder/query/select-query.d.ts +0 -30
  64. package/websql/lib/builder/query/table-condition-query.d.ts +0 -17
  65. package/websql/lib/builder/query/table-query.d.ts +0 -24
  66. package/websql/lib/builder/query-source.d.ts +0 -15
  67. package/websql/lib/builder/query-table.d.ts +0 -16
  68. package/websql/lib/client/mysql.d.ts +0 -6
  69. package/websql/lib/client/query-processor.d.ts +0 -11
  70. package/websql/lib/converter/param-converter.d.ts +0 -3
  71. package/websql/lib/converter/parameterized-converter.d.ts +0 -6
  72. package/websql/lib/converter/query-converter.d.ts +0 -3
  73. package/websql/lib/converter/result-converter.d.ts +0 -3
  74. package/websql/lib/converter/sql-converter.d.ts +0 -3
  75. package/websql/lib/converter/type-converter.d.ts +0 -5
  76. package/websql/lib/converter/types.d.ts +0 -6
  77. package/websql/lib/index.d.ts +0 -26
  78. package/websql/public-api.d.ts +0 -2
@@ -0,0 +1,254 @@
1
+ // @ts-nocheck
2
+ declare class GenericsHelper<T> {
3
+ }
4
+
5
+ type QueryAction = 'select' | 'insert' | 'update' | 'delete';
6
+ type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
7
+ interface ColumnModifier {
8
+ name: ColumnModifierType;
9
+ params?: any;
10
+ }
11
+ type ColumnName = string | {
12
+ name: string;
13
+ alias: string;
14
+ };
15
+ type ConditionChainType = 'or' | 'and';
16
+ type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between' | 'like' | 'not-like' | 'is-null' | 'is-not-null';
17
+ type JoinType = 'inner' | 'left' | 'right' | 'full';
18
+ type QueryProcessor = (query: any) => Promise<any>;
19
+
20
+ declare class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
21
+ protected _$type: GenericsHelper<Table>;
22
+ protected _sibling: QueryCondition<any>;
23
+ protected _child: QueryCondition<any>;
24
+ protected _chainType: ConditionChainType;
25
+ protected _parenthesis: boolean;
26
+ protected _negation: boolean;
27
+ constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType);
28
+ $(): this;
29
+ not(): this;
30
+ and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
31
+ or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
32
+ }
33
+
34
+ declare abstract class QueryCondition<Table extends QueryTable<any, any>> {
35
+ abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
36
+ abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
37
+ }
38
+
39
+ declare class QueryColumnCondition<Table extends QueryTable<any, any>, T> extends QueryCondition<Table> {
40
+ protected _column: QueryColumn<Table, T>;
41
+ protected _type: ConditionType;
42
+ protected _values: T[];
43
+ constructor(column: QueryColumn<Table, T>, type: ConditionType, ...values: T[]);
44
+ and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
45
+ or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
46
+ }
47
+
48
+ declare class QueryOrdering<Table extends QueryTable<any, any>> {
49
+ protected _column: QueryColumn<Table, any>;
50
+ protected _direction: 'ASC' | 'DESC';
51
+ protected _nullsPosition: 'FIRST' | 'LAST';
52
+ constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC');
53
+ nullsFirst(): this;
54
+ nullsLast(): this;
55
+ }
56
+
57
+ declare abstract class ValueColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
58
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
59
+ asc(): QueryOrdering<Table>;
60
+ desc(): QueryOrdering<Table>;
61
+ eq<Table2 extends QueryTable<any, any>>(value: QueryColumn<Table2, T>): QueryJoinCondition<Table, Table2, T>;
62
+ eq(value: T): QueryColumnCondition<Table, T>;
63
+ ne(value: T): QueryColumnCondition<Table, T>;
64
+ }
65
+
66
+ declare abstract class ComparableColumn<Table extends QueryTable<any, any>, T> extends ValueColumn<Table, T> {
67
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
68
+ lt(value: T): QueryColumnCondition<Table, T>;
69
+ gt(value: T): QueryColumnCondition<Table, T>;
70
+ lte(value: T): QueryColumnCondition<Table, T>;
71
+ gte(value: T): QueryColumnCondition<Table, T>;
72
+ in(values: T[]): QueryColumnCondition<Table, T>;
73
+ notIn(values: T[]): QueryColumnCondition<Table, T>;
74
+ between(value1: T, value2: T): QueryColumnCondition<Table, T>;
75
+ notBetween(value1: T, value2: T): QueryColumnCondition<Table, T>;
76
+ min(): this;
77
+ max(): this;
78
+ }
79
+
80
+ declare class NumberColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, number> {
81
+ protected _type: string;
82
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
83
+ count(): NumberColumn<Table>;
84
+ sum(): NumberColumn<Table>;
85
+ avg(): NumberColumn<Table>;
86
+ }
87
+
88
+ declare abstract class QueryColumn<Table extends QueryTable<any, any>, T> {
89
+ protected _table: Table;
90
+ protected _name: ColumnName;
91
+ protected _modifiers: ColumnModifier[];
92
+ protected _$type: GenericsHelper<T>;
93
+ protected _type: string;
94
+ constructor(_table: Table, _name: ColumnName, _modifiers?: ColumnModifier[]);
95
+ abstract count(): NumberColumn<Table>;
96
+ as(alias: string): this;
97
+ isNull(): QueryColumnCondition<Table, T>;
98
+ isNotNull(): QueryColumnCondition<Table, T>;
99
+ }
100
+
101
+ declare class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
102
+ protected _column: QueryColumn<Table1, T>;
103
+ protected _type: string;
104
+ protected _otherColumn: QueryColumn<Table2, T>;
105
+ constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>);
106
+ and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
107
+ or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
108
+ }
109
+
110
+ declare class JoinedTables<Tables extends QueryTable<any, any>> {
111
+ protected _condition: QueryJoinCondition<Tables, Tables, any>;
112
+ protected _parent: JoinedTablesChain<Tables>;
113
+ constructor(_condition: QueryJoinCondition<Tables, Tables, any>, _parent: JoinedTablesChain<Tables>);
114
+ innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
115
+ leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
116
+ rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
117
+ fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
118
+ }
119
+
120
+ declare class JoinedTablesChain<Tables extends QueryTable<any, any>> {
121
+ protected _table: QueryTable<any, any>;
122
+ protected _modifier: JoinType;
123
+ protected _parent: JoinedTables<Tables> | QueryTable<any, any>;
124
+ constructor(_table: QueryTable<any, any>, _modifier: JoinType, _parent: JoinedTables<Tables> | QueryTable<any, any>);
125
+ on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables>;
126
+ }
127
+
128
+ declare abstract class QueryTable<Entity, Id> {
129
+ protected _$name: string;
130
+ constructor(_$name: string);
131
+ protected _$type: GenericsHelper<Entity>;
132
+ protected _$idType: GenericsHelper<Id>;
133
+ $all: BasicColumn<this, Entity>;
134
+ innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
135
+ leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
136
+ rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
137
+ fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
138
+ }
139
+
140
+ declare class BasicColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
141
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
142
+ count(): NumberColumn<Table>;
143
+ }
144
+
145
+ declare class BooleanColumn<Table extends QueryTable<any, any>> extends ValueColumn<Table, boolean> {
146
+ protected _type: string;
147
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
148
+ count(): NumberColumn<Table>;
149
+ }
150
+
151
+ declare class DateColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, Date> {
152
+ protected _type: string;
153
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
154
+ count(): NumberColumn<Table>;
155
+ }
156
+
157
+ declare class StringColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, string> {
158
+ protected _type: string;
159
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
160
+ count(): NumberColumn<Table>;
161
+ lower(): this;
162
+ upper(): this;
163
+ contains(value: string): QueryColumnCondition<Table, string>;
164
+ startsWith(value: string): QueryColumnCondition<Table, string>;
165
+ endsWith(value: string): QueryColumnCondition<Table, string>;
166
+ like(value: string): QueryColumnCondition<Table, string>;
167
+ notLike(value: string): QueryColumnCondition<Table, string>;
168
+ }
169
+
170
+ declare class SelectQuery<Entity, Table extends QueryTable<Entity, any>> {
171
+ protected _queryProcessor: QueryProcessor;
172
+ protected _tables: Table[];
173
+ constructor(_queryProcessor: QueryProcessor, _tables: Table[]);
174
+ protected _distinct: boolean;
175
+ protected _offset: number;
176
+ protected _limit: number;
177
+ protected _conditions: QueryCondition<Table>[];
178
+ protected _groupBy: QueryColumn<Table, any>[];
179
+ protected _having: QueryCondition<Table>[];
180
+ protected _orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[];
181
+ protected _columns: QueryColumn<Table, any>[];
182
+ protected _action: QueryAction;
183
+ offset(offset: number): this;
184
+ limit(limit: number): this;
185
+ distinct(): this;
186
+ where(...conditions: QueryCondition<Table>[]): this;
187
+ groupBy(...columns: QueryColumn<Table, any>[]): this;
188
+ having(...conditions: QueryCondition<Table>[]): this;
189
+ orderBy(...orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[]): this;
190
+ select(): Promise<Entity[]>;
191
+ select<T>(column: QueryColumn<Table, T>): Promise<T[]>;
192
+ select(...columns: QueryColumn<Table, any>[]): Promise<any[]>;
193
+ }
194
+
195
+ declare class TableConditionQuery<Entity, Table extends QueryTable<Entity, any>> {
196
+ protected _queryProcessor: QueryProcessor;
197
+ protected _table: Table;
198
+ protected _conditions: QueryCondition<Table>[];
199
+ constructor(_queryProcessor: QueryProcessor, _table: Table, _conditions: QueryCondition<Table>[]);
200
+ protected _columns: QueryColumn<Table, any>[];
201
+ protected _action: QueryAction;
202
+ protected _entity: Entity | Partial<Entity>;
203
+ update(entity: Partial<Entity>): Promise<number>;
204
+ delete(): Promise<number>;
205
+ count(): Promise<number>;
206
+ }
207
+
208
+ declare class TableQuery<Entity, Id, Table extends QueryTable<Entity, Id>> {
209
+ protected _queryProcessor: QueryProcessor;
210
+ protected _table: Table;
211
+ constructor(_queryProcessor: QueryProcessor, _table: Table);
212
+ protected _entity: Entity | Entity[] | Partial<Entity>;
213
+ protected _action: QueryAction;
214
+ protected _columns: QueryColumn<Table, any>[];
215
+ where(...conditions: QueryCondition<Table>[]): TableConditionQuery<Entity, Table>;
216
+ insert(entity: Entity): Promise<any>;
217
+ insert(entities: Entity[]): Promise<void>;
218
+ deleteAll(): Promise<number>;
219
+ updateAll(entity: Partial<Entity>): Promise<number>;
220
+ countAll(): Promise<number>;
221
+ delete(id: Id): Promise<boolean>;
222
+ update(id: Id, entity: Partial<Entity>): Promise<boolean>;
223
+ get(id: Id): Promise<Entity | undefined>;
224
+ _whereId(id: Id): TableConditionQuery<Entity, Table>;
225
+ }
226
+
227
+ declare class QuerySource {
228
+ protected _queryProcessor: QueryProcessor;
229
+ constructor(_queryProcessor: QueryProcessor);
230
+ from<Entity, Table1 extends QueryTable<Entity, any>>(table1: Table1 & QueryTable<Entity, any>): SelectQuery<Entity, Table1>;
231
+ from<Tables extends QueryTable<any, any>>(tables: JoinedTables<Tables>): SelectQuery<any, Tables>;
232
+ from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>>(table1: Table1, table2: Table2): SelectQuery<any, Table1 | Table2>;
233
+ from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, Table3 extends QueryTable<any, any>>(table1: Table1, table2: Table2, table3: Table3): SelectQuery<any, Table1 | Table2 | Table3>;
234
+ table<Entity, Id, Table extends QueryTable<Entity, Id>>(table: Table & QueryTable<Entity, Id>): TableQuery<Entity, Id, Table>;
235
+ }
236
+
237
+ interface QueryProcessorOptions {
238
+ lineBreaks?: boolean;
239
+ parameterized?: boolean;
240
+ logging?: boolean;
241
+ logger?: (sql: string, params?: any[]) => void;
242
+ identifierQuote?: string;
243
+ }
244
+
245
+ declare class MySqlQuerySource extends QuerySource {
246
+ constructor(client: any, options?: QueryProcessorOptions);
247
+ }
248
+
249
+ type PropsEntitySQL<IEntityType> = {
250
+ [prop in keyof Required<IEntityType>]: any;
251
+ };
252
+
253
+ export { BasicColumn, BooleanColumn, ComparableColumn, DateColumn, JoinedTables, JoinedTablesChain, MySqlQuerySource, NumberColumn, QueryColumn, QueryColumnCondition, QueryCondition, QueryConditionChain, QueryJoinCondition, QueryOrdering, QuerySource, QueryTable, SelectQuery, StringColumn, TableConditionQuery, TableQuery, ValueColumn };
254
+ export type { PropsEntitySQL, QueryProcessorOptions };
@@ -1,6 +0,0 @@
1
- // @ts-nocheck
2
- /**
3
- * Generated bundle index. Do not edit.
4
- */
5
- /// <amd-module name="taon-type-sql" />
6
- export * from './public-api';
@@ -1,9 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import QueryColumn from "./query-column";
4
- import NumberColumn from "./number-column";
5
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
- export default class BasicColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
7
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
8
- count(): NumberColumn<Table>;
9
- }
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import NumberColumn from "./number-column";
4
- import ValueColumn from "./value-column";
5
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
- export default class BooleanColumn<Table extends QueryTable<any, any>> extends ValueColumn<Table, boolean> {
7
- protected _type: string;
8
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
9
- count(): NumberColumn<Table>;
10
- }
@@ -1,19 +0,0 @@
1
- // @ts-nocheck
2
- import QueryColumnCondition from "../condition/query-column-condition";
3
- import QueryTable from "../query-table";
4
- import ValueColumn from "./value-column";
5
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
- declare abstract class ComparableColumn<Table extends QueryTable<any, any>, T> extends ValueColumn<Table, T> {
7
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
8
- lt(value: T): QueryColumnCondition<Table, T>;
9
- gt(value: T): QueryColumnCondition<Table, T>;
10
- lte(value: T): QueryColumnCondition<Table, T>;
11
- gte(value: T): QueryColumnCondition<Table, T>;
12
- in(values: T[]): QueryColumnCondition<Table, T>;
13
- notIn(values: T[]): QueryColumnCondition<Table, T>;
14
- between(value1: T, value2: T): QueryColumnCondition<Table, T>;
15
- notBetween(value1: T, value2: T): QueryColumnCondition<Table, T>;
16
- min(): this;
17
- max(): this;
18
- }
19
- export default ComparableColumn;
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import ComparableColumn from "./comparable-column";
4
- import NumberColumn from "./number-column";
5
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
- export default class DateColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, Date> {
7
- protected _type: string;
8
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
9
- count(): NumberColumn<Table>;
10
- }
@@ -1,11 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import ComparableColumn from "./comparable-column";
4
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
5
- export default class NumberColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, number> {
6
- protected _type: string;
7
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
8
- count(): NumberColumn<Table>;
9
- sum(): NumberColumn<Table>;
10
- avg(): NumberColumn<Table>;
11
- }
@@ -1,19 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import NumberColumn from "./number-column";
4
- import GenericsHelper from "../helpers/generics-helper";
5
- import QueryColumnCondition from "../condition/query-column-condition";
6
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
7
- declare abstract class QueryColumn<Table extends QueryTable<any, any>, T> {
8
- protected _table: Table;
9
- protected _name: ColumnName;
10
- protected _modifiers: ColumnModifier[];
11
- protected _$type: GenericsHelper<T>;
12
- protected _type: string;
13
- constructor(_table: Table, _name: ColumnName, _modifiers?: ColumnModifier[]);
14
- abstract count(): NumberColumn<Table>;
15
- as(alias: string): this;
16
- isNull(): QueryColumnCondition<Table, T>;
17
- isNotNull(): QueryColumnCondition<Table, T>;
18
- }
19
- export default QueryColumn;
@@ -1,18 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import ComparableColumn from "./comparable-column";
4
- import NumberColumn from "./number-column";
5
- import QueryColumnCondition from "../condition/query-column-condition";
6
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
7
- export default class StringColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, string> {
8
- protected _type: string;
9
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
10
- count(): NumberColumn<Table>;
11
- lower(): this;
12
- upper(): this;
13
- contains(value: string): QueryColumnCondition<Table, string>;
14
- startsWith(value: string): QueryColumnCondition<Table, string>;
15
- endsWith(value: string): QueryColumnCondition<Table, string>;
16
- like(value: string): QueryColumnCondition<Table, string>;
17
- notLike(value: string): QueryColumnCondition<Table, string>;
18
- }
@@ -1,16 +0,0 @@
1
- // @ts-nocheck
2
- import QueryColumnCondition from "../condition/query-column-condition";
3
- import QueryOrdering from "../other/query-ordering";
4
- import QueryTable from "../query-table";
5
- import QueryColumn from "./query-column";
6
- import QueryJoinCondition from "../condition/query-join-condition";
7
- import { ColumnModifier, ColumnName } from "../helpers/internal-types";
8
- declare abstract class ValueColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
9
- constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
10
- asc(): QueryOrdering<Table>;
11
- desc(): QueryOrdering<Table>;
12
- eq<Table2 extends QueryTable<any, any>>(value: QueryColumn<Table2, T>): QueryJoinCondition<Table, Table2, T>;
13
- eq(value: T): QueryColumnCondition<Table, T>;
14
- ne(value: T): QueryColumnCondition<Table, T>;
15
- }
16
- export default ValueColumn;
@@ -1,14 +0,0 @@
1
- // @ts-nocheck
2
- import QueryColumn from "../column/query-column";
3
- import QueryTable from "../query-table";
4
- import QueryCondition from "./query-condition";
5
- import QueryConditionChain from "./query-condition-chain";
6
- import { ConditionType } from "../helpers/internal-types";
7
- export default class QueryColumnCondition<Table extends QueryTable<any, any>, T> extends QueryCondition<Table> {
8
- protected _column: QueryColumn<Table, T>;
9
- protected _type: ConditionType;
10
- protected _values: T[];
11
- constructor(column: QueryColumn<Table, T>, type: ConditionType, ...values: T[]);
12
- and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
13
- or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
14
- }
@@ -1,18 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import QueryCondition from "./query-condition";
4
- import GenericsHelper from "../helpers/generics-helper";
5
- import { ConditionChainType } from "../helpers/internal-types";
6
- export default class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
7
- protected _$type: GenericsHelper<Table>;
8
- protected _sibling: QueryCondition<any>;
9
- protected _child: QueryCondition<any>;
10
- protected _chainType: ConditionChainType;
11
- protected _parenthesis: boolean;
12
- protected _negation: boolean;
13
- constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType);
14
- $(): this;
15
- not(): this;
16
- and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
17
- or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
18
- }
@@ -1,8 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import QueryConditionChain from "./query-condition-chain";
4
- declare abstract class QueryCondition<Table extends QueryTable<any, any>> {
5
- abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
6
- abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
7
- }
8
- export default QueryCondition;
@@ -1,13 +0,0 @@
1
- // @ts-nocheck
2
- import QueryColumn from "../column/query-column";
3
- import QueryTable from "../query-table";
4
- import QueryCondition from "./query-condition";
5
- import QueryConditionChain from "./query-condition-chain";
6
- export default class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
7
- protected _column: QueryColumn<Table1, T>;
8
- protected _type: string;
9
- protected _otherColumn: QueryColumn<Table2, T>;
10
- constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>);
11
- and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
12
- or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
13
- }
@@ -1,3 +0,0 @@
1
- // @ts-nocheck
2
- export default class GenericsHelper<T> {
3
- }
@@ -1,16 +0,0 @@
1
- // @ts-nocheck
2
- export type QueryAction = 'select' | 'insert' | 'update' | 'delete';
3
- export type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
4
- export interface ColumnModifier {
5
- name: ColumnModifierType;
6
- params?: any;
7
- }
8
- export type ColumnName = string | {
9
- name: string;
10
- alias: string;
11
- };
12
- export type ColumnType = 'boolean' | 'number' | 'string' | 'date';
13
- export type ConditionChainType = 'or' | 'and';
14
- export type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between' | 'like' | 'not-like' | 'is-null' | 'is-not-null';
15
- export type JoinType = 'inner' | 'left' | 'right' | 'full';
16
- export type QueryProcessor = (query: any) => Promise<any>;
@@ -1,12 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import QueryJoinCondition from "../condition/query-join-condition";
4
- import JoinedTables from "./joined-tables";
5
- import { JoinType } from "../helpers/internal-types";
6
- export default class JoinedTablesChain<Tables extends QueryTable<any, any>> {
7
- protected _table: QueryTable<any, any>;
8
- protected _modifier: JoinType;
9
- protected _parent: JoinedTables<Tables> | QueryTable<any, any>;
10
- constructor(_table: QueryTable<any, any>, _modifier: JoinType, _parent: JoinedTables<Tables> | QueryTable<any, any>);
11
- on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables>;
12
- }
@@ -1,13 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import JoinedTablesChain from "./joined-tables-chain";
4
- import QueryJoinCondition from "../condition/query-join-condition";
5
- export default class JoinedTables<Tables extends QueryTable<any, any>> {
6
- protected _condition: QueryJoinCondition<Tables, Tables, any>;
7
- protected _parent: JoinedTablesChain<Tables>;
8
- constructor(_condition: QueryJoinCondition<Tables, Tables, any>, _parent: JoinedTablesChain<Tables>);
9
- innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
10
- leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
11
- rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
12
- fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
13
- }
@@ -1,11 +0,0 @@
1
- // @ts-nocheck
2
- import QueryColumn from "../column/query-column";
3
- import QueryTable from "../query-table";
4
- export default class QueryOrdering<Table extends QueryTable<any, any>> {
5
- protected _column: QueryColumn<Table, any>;
6
- protected _direction: 'ASC' | 'DESC';
7
- protected _nullsPosition: 'FIRST' | 'LAST';
8
- constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC');
9
- nullsFirst(): this;
10
- nullsLast(): this;
11
- }
@@ -1,30 +0,0 @@
1
- // @ts-nocheck
2
- import QueryCondition from "../condition/query-condition";
3
- import QueryOrdering from "../other/query-ordering";
4
- import QueryTable from "../query-table";
5
- import QueryColumn from "../column/query-column";
6
- import { QueryProcessor, QueryAction } from "../helpers/internal-types";
7
- export default class SelectQuery<Entity, Table extends QueryTable<Entity, any>> {
8
- protected _queryProcessor: QueryProcessor;
9
- protected _tables: Table[];
10
- constructor(_queryProcessor: QueryProcessor, _tables: Table[]);
11
- protected _distinct: boolean;
12
- protected _offset: number;
13
- protected _limit: number;
14
- protected _conditions: QueryCondition<Table>[];
15
- protected _groupBy: QueryColumn<Table, any>[];
16
- protected _having: QueryCondition<Table>[];
17
- protected _orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[];
18
- protected _columns: QueryColumn<Table, any>[];
19
- protected _action: QueryAction;
20
- offset(offset: number): this;
21
- limit(limit: number): this;
22
- distinct(): this;
23
- where(...conditions: QueryCondition<Table>[]): this;
24
- groupBy(...columns: QueryColumn<Table, any>[]): this;
25
- having(...conditions: QueryCondition<Table>[]): this;
26
- orderBy(...orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[]): this;
27
- select(): Promise<Entity[]>;
28
- select<T>(column: QueryColumn<Table, T>): Promise<T[]>;
29
- select(...columns: QueryColumn<Table, any>[]): Promise<any[]>;
30
- }
@@ -1,17 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import QueryCondition from "../condition/query-condition";
4
- import QueryColumn from "../column/query-column";
5
- import { QueryProcessor, QueryAction } from "../helpers/internal-types";
6
- export default class TableConditionQuery<Entity, Table extends QueryTable<Entity, any>> {
7
- protected _queryProcessor: QueryProcessor;
8
- protected _table: Table;
9
- protected _conditions: QueryCondition<Table>[];
10
- constructor(_queryProcessor: QueryProcessor, _table: Table, _conditions: QueryCondition<Table>[]);
11
- protected _columns: QueryColumn<Table, any>[];
12
- protected _action: QueryAction;
13
- protected _entity: Entity | Partial<Entity>;
14
- update(entity: Partial<Entity>): Promise<number>;
15
- delete(): Promise<number>;
16
- count(): Promise<number>;
17
- }
@@ -1,24 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from "../query-table";
3
- import TableConditionQuery from "./table-condition-query";
4
- import QueryCondition from "../condition/query-condition";
5
- import QueryColumn from "../column/query-column";
6
- import { QueryProcessor, QueryAction } from "../helpers/internal-types";
7
- export default class TableQuery<Entity, Id, Table extends QueryTable<Entity, Id>> {
8
- protected _queryProcessor: QueryProcessor;
9
- protected _table: Table;
10
- constructor(_queryProcessor: QueryProcessor, _table: Table);
11
- protected _entity: Entity | Entity[] | Partial<Entity>;
12
- protected _action: QueryAction;
13
- protected _columns: QueryColumn<Table, any>[];
14
- where(...conditions: QueryCondition<Table>[]): TableConditionQuery<Entity, Table>;
15
- insert(entity: Entity): Promise<any>;
16
- insert(entities: Entity[]): Promise<void>;
17
- deleteAll(): Promise<number>;
18
- updateAll(entity: Partial<Entity>): Promise<number>;
19
- countAll(): Promise<number>;
20
- delete(id: Id): Promise<boolean>;
21
- update(id: Id, entity: Partial<Entity>): Promise<boolean>;
22
- get(id: Id): Promise<Entity | undefined>;
23
- _whereId(id: Id): TableConditionQuery<Entity, Table>;
24
- }
@@ -1,15 +0,0 @@
1
- // @ts-nocheck
2
- import QueryTable from './query-table';
3
- import SelectQuery from './query/select-query';
4
- import { QueryProcessor } from "./helpers/internal-types";
5
- import JoinedTables from "./join/joined-tables";
6
- import TableQuery from "./query/table-query";
7
- export default class QuerySource {
8
- protected _queryProcessor: QueryProcessor;
9
- constructor(_queryProcessor: QueryProcessor);
10
- from<Entity, Table1 extends QueryTable<Entity, any>>(table1: Table1 & QueryTable<Entity, any>): SelectQuery<Entity, Table1>;
11
- from<Tables extends QueryTable<any, any>>(tables: JoinedTables<Tables>): SelectQuery<any, Tables>;
12
- from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>>(table1: Table1, table2: Table2): SelectQuery<any, Table1 | Table2>;
13
- from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, Table3 extends QueryTable<any, any>>(table1: Table1, table2: Table2, table3: Table3): SelectQuery<any, Table1 | Table2 | Table3>;
14
- table<Entity, Id, Table extends QueryTable<Entity, Id>>(table: Table & QueryTable<Entity, Id>): TableQuery<Entity, Id, Table>;
15
- }
@@ -1,16 +0,0 @@
1
- // @ts-nocheck
2
- import BasicColumn from "./column/basic-column";
3
- import GenericsHelper from "./helpers/generics-helper";
4
- import JoinedTablesChain from "./join/joined-tables-chain";
5
- declare abstract class QueryTable<Entity, Id> {
6
- protected _$name: string;
7
- constructor(_$name: string);
8
- protected _$type: GenericsHelper<Entity>;
9
- protected _$idType: GenericsHelper<Id>;
10
- $all: BasicColumn<this, Entity>;
11
- innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
12
- leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
13
- rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
14
- fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
15
- }
16
- export default QueryTable;
@@ -1,6 +0,0 @@
1
- // @ts-nocheck
2
- import QuerySource from "../builder/query-source";
3
- import { QueryProcessorOptions } from "./query-processor";
4
- export default class MySqlQuerySource extends QuerySource {
5
- constructor(client: any, options?: QueryProcessorOptions);
6
- }
@@ -1,11 +0,0 @@
1
- // @ts-nocheck
2
- import { QueryEngine } from '../converter/types';
3
- import { QueryProcessor } from '../builder/helpers/internal-types';
4
- export interface QueryProcessorOptions {
5
- lineBreaks?: boolean;
6
- parameterized?: boolean;
7
- logging?: boolean;
8
- logger?: (sql: string, params?: any[]) => void;
9
- identifierQuote?: string;
10
- }
11
- export declare function createQueryProcessor(client: any, _options?: QueryProcessorOptions, engine?: QueryEngine): QueryProcessor;