taon-type-sql 21.0.47 → 21.0.49

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 (180) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/package.json +1 -1
  3. package/browser-prod/fesm2022/taon-type-sql-browser-prod.mjs.map +1 -1
  4. package/browser-prod/package.json +1 -1
  5. package/lib/build-info._auto-generated_.d.ts +1 -1
  6. package/lib/build-info._auto-generated_.js +1 -1
  7. package/lib/package.json +1 -1
  8. package/lib-esm/app/routing/+admin-users/index.d.ts +1 -0
  9. package/lib-esm/app/routing/+admin-users/index.js +2 -0
  10. package/lib-esm/app/routing/+admin-users/index.js.map +1 -0
  11. package/lib-esm/app/shared/user/index.d.ts +0 -0
  12. package/lib-esm/app/shared/user/index.js +6 -0
  13. package/lib-esm/app/shared/user/index.js.map +1 -0
  14. package/lib-esm/app/shared/user/user.controller.d.ts +0 -0
  15. package/lib-esm/app/shared/user/user.controller.js +76 -0
  16. package/lib-esm/app/shared/user/user.controller.js.map +1 -0
  17. package/lib-esm/app/shared/user/user.d.ts +0 -0
  18. package/lib-esm/app/shared/user/user.helpers.d.ts +1 -0
  19. package/lib-esm/app/shared/user/user.helpers.js +2 -0
  20. package/lib-esm/app/shared/user/user.helpers.js.map +1 -0
  21. package/lib-esm/app/shared/user/user.js +53 -0
  22. package/lib-esm/app/shared/user/user.js.map +1 -0
  23. package/lib-esm/app/shared/user/user.models.d.ts +0 -0
  24. package/lib-esm/app/shared/user/user.models.js +25 -0
  25. package/lib-esm/app/shared/user/user.models.js.map +1 -0
  26. package/lib-esm/app.d.ts +0 -0
  27. package/lib-esm/app.electron.d.ts +0 -0
  28. package/lib-esm/app.electron.js +82 -0
  29. package/lib-esm/app.electron.js.map +1 -0
  30. package/lib-esm/app.hosts.d.ts +3 -0
  31. package/lib-esm/app.hosts.js +48 -0
  32. package/lib-esm/app.hosts.js.map +1 -0
  33. package/lib-esm/app.js +102 -0
  34. package/lib-esm/app.js.map +1 -0
  35. package/lib-esm/app.vscode.d.ts +0 -0
  36. package/lib-esm/app.vscode.js +47 -0
  37. package/lib-esm/app.vscode.js.map +1 -0
  38. package/lib-esm/index.d.ts +1 -0
  39. package/lib-esm/index.js +4 -0
  40. package/lib-esm/index.js.map +1 -0
  41. package/lib-esm/lib/build-info._auto-generated_.d.ts +24 -0
  42. package/lib-esm/lib/build-info._auto-generated_.js +27 -0
  43. package/lib-esm/lib/build-info._auto-generated_.js.map +1 -0
  44. package/lib-esm/lib/builder/column/basic-column.d.ts +8 -0
  45. package/lib-esm/lib/builder/column/basic-column.js +12 -0
  46. package/lib-esm/lib/builder/column/basic-column.js.map +1 -0
  47. package/lib-esm/lib/builder/column/boolean-column.d.ts +9 -0
  48. package/lib-esm/lib/builder/column/boolean-column.js +12 -0
  49. package/lib-esm/lib/builder/column/boolean-column.js.map +1 -0
  50. package/lib-esm/lib/builder/column/comparable-column.d.ts +18 -0
  51. package/lib-esm/lib/builder/column/comparable-column.js +40 -0
  52. package/lib-esm/lib/builder/column/comparable-column.js.map +1 -0
  53. package/lib-esm/lib/builder/column/date-column.d.ts +9 -0
  54. package/lib-esm/lib/builder/column/date-column.js +12 -0
  55. package/lib-esm/lib/builder/column/date-column.js.map +1 -0
  56. package/lib-esm/lib/builder/column/number-column.d.ts +10 -0
  57. package/lib-esm/lib/builder/column/number-column.js +17 -0
  58. package/lib-esm/lib/builder/column/number-column.js.map +1 -0
  59. package/lib-esm/lib/builder/column/query-column.d.ts +18 -0
  60. package/lib-esm/lib/builder/column/query-column.js +24 -0
  61. package/lib-esm/lib/builder/column/query-column.js.map +1 -0
  62. package/lib-esm/lib/builder/column/string-column.d.ts +17 -0
  63. package/lib-esm/lib/builder/column/string-column.js +34 -0
  64. package/lib-esm/lib/builder/column/string-column.js.map +1 -0
  65. package/lib-esm/lib/builder/column/value-column.d.ts +15 -0
  66. package/lib-esm/lib/builder/column/value-column.js +28 -0
  67. package/lib-esm/lib/builder/column/value-column.js.map +1 -0
  68. package/lib-esm/lib/builder/condition/query-column-condition.d.ts +13 -0
  69. package/lib-esm/lib/builder/condition/query-column-condition.js +20 -0
  70. package/lib-esm/lib/builder/condition/query-column-condition.js.map +1 -0
  71. package/lib-esm/lib/builder/condition/query-condition-chain.d.ts +17 -0
  72. package/lib-esm/lib/builder/condition/query-condition-chain.js +31 -0
  73. package/lib-esm/lib/builder/condition/query-condition-chain.js.map +1 -0
  74. package/lib-esm/lib/builder/condition/query-condition.d.ts +7 -0
  75. package/lib-esm/lib/builder/condition/query-condition.js +5 -0
  76. package/lib-esm/lib/builder/condition/query-condition.js.map +1 -0
  77. package/lib-esm/lib/builder/condition/query-join-condition.d.ts +12 -0
  78. package/lib-esm/lib/builder/condition/query-join-condition.js +20 -0
  79. package/lib-esm/lib/builder/condition/query-join-condition.js.map +1 -0
  80. package/lib-esm/lib/builder/helpers/generics-helper.d.ts +2 -0
  81. package/lib-esm/lib/builder/helpers/generics-helper.js +4 -0
  82. package/lib-esm/lib/builder/helpers/generics-helper.js.map +1 -0
  83. package/lib-esm/lib/builder/helpers/internal-types.d.ts +15 -0
  84. package/lib-esm/lib/builder/helpers/internal-types.js +3 -0
  85. package/lib-esm/lib/builder/helpers/internal-types.js.map +1 -0
  86. package/lib-esm/lib/builder/join/joined-tables-chain.d.ts +11 -0
  87. package/lib-esm/lib/builder/join/joined-tables-chain.js +15 -0
  88. package/lib-esm/lib/builder/join/joined-tables-chain.js.map +1 -0
  89. package/lib-esm/lib/builder/join/joined-tables.d.ts +12 -0
  90. package/lib-esm/lib/builder/join/joined-tables.js +22 -0
  91. package/lib-esm/lib/builder/join/joined-tables.js.map +1 -0
  92. package/lib-esm/lib/builder/other/query-ordering.d.ts +10 -0
  93. package/lib-esm/lib/builder/other/query-ordering.js +18 -0
  94. package/lib-esm/lib/builder/other/query-ordering.js.map +1 -0
  95. package/lib-esm/lib/builder/query/select-query.d.ts +29 -0
  96. package/lib-esm/lib/builder/query/select-query.js +51 -0
  97. package/lib-esm/lib/builder/query/select-query.js.map +1 -0
  98. package/lib-esm/lib/builder/query/table-condition-query.d.ts +16 -0
  99. package/lib-esm/lib/builder/query/table-condition-query.js +28 -0
  100. package/lib-esm/lib/builder/query/table-condition-query.js.map +1 -0
  101. package/lib-esm/lib/builder/query/table-query.d.ts +23 -0
  102. package/lib-esm/lib/builder/query/table-query.js +57 -0
  103. package/lib-esm/lib/builder/query/table-query.js.map +1 -0
  104. package/lib-esm/lib/builder/query-source.d.ts +14 -0
  105. package/lib-esm/lib/builder/query-source.js +19 -0
  106. package/lib-esm/lib/builder/query-source.js.map +1 -0
  107. package/lib-esm/lib/builder/query-table.d.ts +15 -0
  108. package/lib-esm/lib/builder/query-table.js +26 -0
  109. package/lib-esm/lib/builder/query-table.js.map +1 -0
  110. package/lib-esm/lib/client/mysql.d.ts +5 -0
  111. package/lib-esm/lib/client/mysql.js +8 -0
  112. package/lib-esm/lib/client/mysql.js.map +1 -0
  113. package/lib-esm/lib/client/pg.d.ts +5 -0
  114. package/lib-esm/lib/client/pg.js +8 -0
  115. package/lib-esm/lib/client/pg.js.map +1 -0
  116. package/lib-esm/lib/client/query-processor.d.ts +10 -0
  117. package/lib-esm/lib/client/query-processor.js +70 -0
  118. package/lib-esm/lib/client/query-processor.js.map +1 -0
  119. package/lib-esm/lib/converter/param-converter.d.ts +2 -0
  120. package/lib-esm/lib/converter/param-converter.js +27 -0
  121. package/lib-esm/lib/converter/param-converter.js.map +1 -0
  122. package/lib-esm/lib/converter/parameterized-converter.d.ts +5 -0
  123. package/lib-esm/lib/converter/parameterized-converter.js +15 -0
  124. package/lib-esm/lib/converter/parameterized-converter.js.map +1 -0
  125. package/lib-esm/lib/converter/query-converter.d.ts +2 -0
  126. package/lib-esm/lib/converter/query-converter.js +281 -0
  127. package/lib-esm/lib/converter/query-converter.js.map +1 -0
  128. package/lib-esm/lib/converter/result-converter.d.ts +2 -0
  129. package/lib-esm/lib/converter/result-converter.js +86 -0
  130. package/lib-esm/lib/converter/result-converter.js.map +1 -0
  131. package/lib-esm/lib/converter/sql-converter.d.ts +2 -0
  132. package/lib-esm/lib/converter/sql-converter.js +6 -0
  133. package/lib-esm/lib/converter/sql-converter.js.map +1 -0
  134. package/lib-esm/lib/converter/type-converter.d.ts +4 -0
  135. package/lib-esm/lib/converter/type-converter.js +37 -0
  136. package/lib-esm/lib/converter/type-converter.js.map +1 -0
  137. package/lib-esm/lib/converter/types.d.ts +5 -0
  138. package/lib-esm/lib/converter/types.js +2 -0
  139. package/lib-esm/lib/converter/types.js.map +1 -0
  140. package/lib-esm/lib/env/env.angular-node-app.d.ts +66 -0
  141. package/lib-esm/lib/env/env.angular-node-app.js +135 -0
  142. package/lib-esm/lib/env/env.angular-node-app.js.map +1 -0
  143. package/lib-esm/lib/env/env.docs-webapp.d.ts +66 -0
  144. package/lib-esm/lib/env/env.docs-webapp.js +135 -0
  145. package/lib-esm/lib/env/env.docs-webapp.js.map +1 -0
  146. package/lib-esm/lib/env/env.electron-app.d.ts +66 -0
  147. package/lib-esm/lib/env/env.electron-app.js +135 -0
  148. package/lib-esm/lib/env/env.electron-app.js.map +1 -0
  149. package/lib-esm/lib/env/env.mobile-app.d.ts +66 -0
  150. package/lib-esm/lib/env/env.mobile-app.js +135 -0
  151. package/lib-esm/lib/env/env.mobile-app.js.map +1 -0
  152. package/lib-esm/lib/env/env.npm-lib-and-cli-tool.d.ts +66 -0
  153. package/lib-esm/lib/env/env.npm-lib-and-cli-tool.js +135 -0
  154. package/lib-esm/lib/env/env.npm-lib-and-cli-tool.js.map +1 -0
  155. package/lib-esm/lib/env/env.vscode-plugin.d.ts +66 -0
  156. package/lib-esm/lib/env/env.vscode-plugin.js +135 -0
  157. package/lib-esm/lib/env/env.vscode-plugin.js.map +1 -0
  158. package/lib-esm/lib/env/index.d.ts +6 -0
  159. package/lib-esm/lib/env/index.js +7 -0
  160. package/lib-esm/lib/env/index.js.map +1 -0
  161. package/lib-esm/lib/index._auto-generated_.d.ts +0 -0
  162. package/lib-esm/lib/index._auto-generated_.js +6 -0
  163. package/lib-esm/lib/index._auto-generated_.js.map +1 -0
  164. package/lib-esm/lib/index.d.ts +25 -0
  165. package/lib-esm/lib/index.js +24 -0
  166. package/lib-esm/lib/index.js.map +1 -0
  167. package/lib-esm/lib/migrations/index.d.ts +1 -0
  168. package/lib-esm/lib/migrations/index.js +3 -0
  169. package/lib-esm/lib/migrations/index.js.map +1 -0
  170. package/lib-esm/lib/migrations/migrations_index._auto-generated_.d.ts +0 -0
  171. package/lib-esm/lib/migrations/migrations_index._auto-generated_.js +4 -0
  172. package/lib-esm/lib/migrations/migrations_index._auto-generated_.js.map +1 -0
  173. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  174. package/lib-prod/build-info._auto-generated_.js +1 -1
  175. package/lib-prod/package.json +1 -1
  176. package/package.json +1 -1
  177. package/src.js +4 -20
  178. package/websql/package.json +1 -1
  179. package/websql-prod/fesm2022/taon-type-sql-websql-prod.mjs.map +1 -1
  180. package/websql-prod/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ import ComparableColumn from "./comparable-column";
2
+ export default class NumberColumn extends ComparableColumn {
3
+ _type = 'number';
4
+ constructor(table, name, modifiers = []) {
5
+ super(table, name, modifiers);
6
+ }
7
+ count() {
8
+ return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
9
+ }
10
+ sum() {
11
+ return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'sum' }));
12
+ }
13
+ avg() {
14
+ return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'avg' }));
15
+ }
16
+ }
17
+ //# sourceMappingURL=number-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-column.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAInD,MAAM,CAAC,OAAO,OAAO,YAAiD,SAAQ,gBAA+B;IAE/F,KAAK,GAAG,QAAQ,CAAC;IAE3B,YAAY,KAAY,EAAE,IAAgB,EAAE,YAA8B,EAAE;QACxE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,KAAK;QACD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,GAAG;QACC,OAAO,IAAI,YAAY,CAAQ,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,GAAG;QACC,OAAO,IAAI,YAAY,CAAQ,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;CACJ"}
@@ -0,0 +1,18 @@
1
+ import QueryTable from "../query-table";
2
+ import NumberColumn from "./number-column";
3
+ import GenericsHelper from "../helpers/generics-helper";
4
+ import QueryColumnCondition from "../condition/query-column-condition";
5
+ import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
+ declare abstract class QueryColumn<Table extends QueryTable<any, any>, T> {
7
+ protected _table: Table;
8
+ protected _name: ColumnName;
9
+ protected _modifiers: ColumnModifier[];
10
+ protected _$type: GenericsHelper<T>;
11
+ protected _type: string;
12
+ constructor(_table: Table, _name: ColumnName, _modifiers?: ColumnModifier[]);
13
+ abstract count(): NumberColumn<Table>;
14
+ as(alias: string): this;
15
+ isNull(): QueryColumnCondition<Table, T>;
16
+ isNotNull(): QueryColumnCondition<Table, T>;
17
+ }
18
+ export default QueryColumn;
@@ -0,0 +1,24 @@
1
+ import QueryColumnCondition from "../condition/query-column-condition";
2
+ class QueryColumn {
3
+ _table;
4
+ _name;
5
+ _modifiers;
6
+ _$type;
7
+ _type;
8
+ constructor(_table, _name, _modifiers = []) {
9
+ this._table = _table;
10
+ this._name = _name;
11
+ this._modifiers = _modifiers;
12
+ }
13
+ as(alias) {
14
+ return new this.constructor(this._table, this._name, this._modifiers.concat({ name: 'as', params: alias }));
15
+ }
16
+ isNull() {
17
+ return new QueryColumnCondition(this, 'is-null');
18
+ }
19
+ isNotNull() {
20
+ return new QueryColumnCondition(this, 'is-not-null');
21
+ }
22
+ }
23
+ export default QueryColumn;
24
+ //# sourceMappingURL=query-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-column.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AAIvE,MAAe,WAAW;IAMR;IACA;IACA;IANJ,MAAM,CAAoB;IAC1B,KAAK,CAAS;IAExB,YACc,MAAa,EACb,KAAiB,EACjB,aAA+B,EAAE;QAFjC,WAAM,GAAN,MAAM,CAAO;QACb,UAAK,GAAL,KAAK,CAAY;QACjB,eAAU,GAAV,UAAU,CAAuB;IAC5C,CAAC;IAIJ,EAAE,CAAC,KAAa;QACZ,OAAO,IAAU,IAAI,CAAC,WAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACvH,CAAC;IAED,MAAM;QACF,OAAO,IAAI,oBAAoB,CAAW,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED,SAAS;QACL,OAAO,IAAI,oBAAoB,CAAW,IAAI,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC;CACJ;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,17 @@
1
+ import QueryTable from "../query-table";
2
+ import ComparableColumn from "./comparable-column";
3
+ import NumberColumn from "./number-column";
4
+ import QueryColumnCondition from "../condition/query-column-condition";
5
+ import { ColumnModifier, ColumnName } from "../helpers/internal-types";
6
+ export default class StringColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, string> {
7
+ protected _type: string;
8
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
9
+ count(): NumberColumn<Table>;
10
+ lower(): this;
11
+ upper(): this;
12
+ contains(value: string): QueryColumnCondition<Table, string>;
13
+ startsWith(value: string): QueryColumnCondition<Table, string>;
14
+ endsWith(value: string): QueryColumnCondition<Table, string>;
15
+ like(value: string): QueryColumnCondition<Table, string>;
16
+ notLike(value: string): QueryColumnCondition<Table, string>;
17
+ }
@@ -0,0 +1,34 @@
1
+ import ComparableColumn from "./comparable-column";
2
+ import NumberColumn from "./number-column";
3
+ import QueryColumnCondition from "../condition/query-column-condition";
4
+ export default class StringColumn extends ComparableColumn {
5
+ _type = 'string';
6
+ constructor(table, name, modifiers = []) {
7
+ super(table, name, modifiers);
8
+ }
9
+ count() {
10
+ return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
11
+ }
12
+ lower() {
13
+ return new this.constructor(this._table, this._name, this._modifiers.concat({ name: 'lower' }));
14
+ }
15
+ upper() {
16
+ return new this.constructor(this._table, this._name, this._modifiers.concat({ name: 'upper' }));
17
+ }
18
+ contains(value) {
19
+ return this.like('%' + value + '%');
20
+ }
21
+ startsWith(value) {
22
+ return this.like(value + '%');
23
+ }
24
+ endsWith(value) {
25
+ return this.like('%' + value);
26
+ }
27
+ like(value) {
28
+ return new QueryColumnCondition(this, 'like', value);
29
+ }
30
+ notLike(value) {
31
+ return new QueryColumnCondition(this, 'not-like', value);
32
+ }
33
+ }
34
+ //# sourceMappingURL=string-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-column.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AAIvE,MAAM,CAAC,OAAO,OAAO,YAAiD,SAAQ,gBAA+B;IAE/F,KAAK,GAAG,QAAQ,CAAC;IAE3B,YAAY,KAAY,EAAE,IAAgB,EAAE,YAA8B,EAAE;QACxE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,KAAK;QACD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,KAAK;QACD,OAAO,IAAU,IAAI,CAAC,WAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC3G,CAAC;IAED,KAAK;QACD,OAAO,IAAU,IAAI,CAAC,WAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC3G,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,KAAa;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,KAAa;QACd,OAAO,IAAI,oBAAoB,CAAgB,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,CAAC,KAAa;QACjB,OAAO,IAAI,oBAAoB,CAAgB,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ import QueryColumnCondition from "../condition/query-column-condition";
2
+ import QueryOrdering from "../other/query-ordering";
3
+ import QueryTable from "../query-table";
4
+ import QueryColumn from "./query-column";
5
+ import QueryJoinCondition from "../condition/query-join-condition";
6
+ import { ColumnModifier, ColumnName } from "../helpers/internal-types";
7
+ declare abstract class ValueColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
8
+ constructor(table: Table, name: ColumnName, modifiers?: ColumnModifier[]);
9
+ asc(): QueryOrdering<Table>;
10
+ desc(): QueryOrdering<Table>;
11
+ eq<Table2 extends QueryTable<any, any>>(value: QueryColumn<Table2, T>): QueryJoinCondition<Table, Table2, T>;
12
+ eq(value: T): QueryColumnCondition<Table, T>;
13
+ ne(value: T): QueryColumnCondition<Table, T>;
14
+ }
15
+ export default ValueColumn;
@@ -0,0 +1,28 @@
1
+ import QueryColumnCondition from "../condition/query-column-condition";
2
+ import QueryOrdering from "../other/query-ordering";
3
+ import QueryColumn from "./query-column";
4
+ import QueryJoinCondition from "../condition/query-join-condition";
5
+ class ValueColumn extends QueryColumn {
6
+ constructor(table, name, modifiers = []) {
7
+ super(table, name, modifiers);
8
+ }
9
+ asc() {
10
+ return new QueryOrdering(this, 'ASC');
11
+ }
12
+ desc() {
13
+ return new QueryOrdering(this, 'DESC');
14
+ }
15
+ eq(value) {
16
+ if (value instanceof QueryColumn) {
17
+ return new QueryJoinCondition(this, 'eq', value);
18
+ }
19
+ else {
20
+ return new QueryColumnCondition(this, 'eq', value);
21
+ }
22
+ }
23
+ ne(value) {
24
+ return new QueryColumnCondition(this, 'ne', value);
25
+ }
26
+ }
27
+ export default ValueColumn;
28
+ //# sourceMappingURL=value-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-column.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AACvE,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AAInE,MAAe,WAAmD,SAAQ,WAAqB;IAE3F,YAAY,KAAY,EAAE,IAAgB,EAAE,YAA8B,EAAE;QACxE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,GAAG;QACC,OAAO,IAAI,aAAa,CAAQ,IAAI,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,IAAI;QACA,OAAO,IAAI,aAAa,CAAQ,IAAI,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAID,EAAE,CAAsC,KAAU;QAC9C,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YAC/B,OAAO,IAAI,kBAAkB,CAAmB,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,oBAAoB,CAAW,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IAED,EAAE,CAAC,KAAQ;QACP,OAAO,IAAI,oBAAoB,CAAW,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;CACJ;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,13 @@
1
+ import QueryColumn from "../column/query-column";
2
+ import QueryTable from "../query-table";
3
+ import QueryCondition from "./query-condition";
4
+ import QueryConditionChain from "./query-condition-chain";
5
+ import { ConditionType } from "../helpers/internal-types";
6
+ export default class QueryColumnCondition<Table extends QueryTable<any, any>, T> extends QueryCondition<Table> {
7
+ protected _column: QueryColumn<Table, T>;
8
+ protected _type: ConditionType;
9
+ protected _values: T[];
10
+ constructor(column: QueryColumn<Table, T>, type: ConditionType, ...values: T[]);
11
+ and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
12
+ or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
13
+ }
@@ -0,0 +1,20 @@
1
+ import QueryCondition from "./query-condition";
2
+ import QueryConditionChain from "./query-condition-chain";
3
+ export default class QueryColumnCondition extends QueryCondition {
4
+ _column;
5
+ _type;
6
+ _values;
7
+ constructor(column, type, ...values) {
8
+ super();
9
+ this._column = column;
10
+ this._type = type;
11
+ this._values = values;
12
+ }
13
+ and(condition) {
14
+ return new QueryConditionChain(this, condition, 'and');
15
+ }
16
+ or(condition) {
17
+ return new QueryConditionChain(this, condition, 'or');
18
+ }
19
+ }
20
+ //# sourceMappingURL=query-column-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-column-condition.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAI1D,MAAM,CAAC,OAAO,OAAO,oBAA4D,SAAQ,cAAqB;IAEhG,OAAO,CAAwB;IAC/B,KAAK,CAAgB;IACrB,OAAO,CAAM;IAEvB,YAAY,MAA6B,EAAE,IAAmB,EAAE,GAAG,MAAW;QAC1E,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,GAAG,CAAsC,SAAiC;QACtE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;IAED,EAAE,CAAsC,SAAiC;QACrE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;CACJ"}
@@ -0,0 +1,17 @@
1
+ import QueryTable from "../query-table";
2
+ import QueryCondition from "./query-condition";
3
+ import GenericsHelper from "../helpers/generics-helper";
4
+ import { ConditionChainType } from "../helpers/internal-types";
5
+ export default class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
6
+ protected _$type: GenericsHelper<Table>;
7
+ protected _sibling: QueryCondition<any>;
8
+ protected _child: QueryCondition<any>;
9
+ protected _chainType: ConditionChainType;
10
+ protected _parenthesis: boolean;
11
+ protected _negation: boolean;
12
+ constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType);
13
+ $(): this;
14
+ not(): this;
15
+ and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
16
+ or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
17
+ }
@@ -0,0 +1,31 @@
1
+ import QueryCondition from "./query-condition";
2
+ export default class QueryConditionChain extends QueryCondition {
3
+ _$type;
4
+ _sibling;
5
+ _child;
6
+ _chainType;
7
+ _parenthesis = false;
8
+ _negation = false;
9
+ constructor(sibling, child, chainType) {
10
+ super();
11
+ this._sibling = sibling;
12
+ this._child = child;
13
+ this._chainType = chainType;
14
+ }
15
+ // TODO how to call this
16
+ $() {
17
+ this._parenthesis = true;
18
+ return this;
19
+ }
20
+ not() {
21
+ this._negation = true;
22
+ return this;
23
+ }
24
+ and(condition) {
25
+ return new QueryConditionChain(this, condition, 'and');
26
+ }
27
+ or(condition) {
28
+ return new QueryConditionChain(this, condition, 'or');
29
+ }
30
+ }
31
+ //# sourceMappingURL=query-condition-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-condition-chain.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAK/C,MAAM,CAAC,OAAO,OAAO,mBAAwD,SAAQ,cAAqB;IAE5F,MAAM,CAAwB;IAE9B,QAAQ,CAAsB;IAC9B,MAAM,CAAsB;IAC5B,UAAU,CAAqB;IAC/B,YAAY,GAAG,KAAK,CAAC;IACrB,SAAS,GAAG,KAAK,CAAC;IAE5B,YAAY,OAA4B,EAAE,KAA0B,EAAE,SAA6B;QAC/F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,wBAAwB;IACxB,CAAC;QACG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG;QACC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG,CAAsC,SAAiC;QACtE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;IAED,EAAE,CAAsC,SAAiC;QACrE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import QueryTable from "../query-table";
2
+ import QueryConditionChain from "./query-condition-chain";
3
+ declare abstract class QueryCondition<Table extends QueryTable<any, any>> {
4
+ abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
5
+ abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
6
+ }
7
+ export default QueryCondition;
@@ -0,0 +1,5 @@
1
+ // TODO I had to copy-paste the method implementations to every child class to avoid circular dependencies
2
+ class QueryCondition {
3
+ }
4
+ export default QueryCondition;
5
+ //# sourceMappingURL=query-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-condition.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAGA,0GAA0G;AAE1G,MAAe,cAAc;CAK5B;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import QueryColumn from "../column/query-column";
2
+ import QueryTable from "../query-table";
3
+ import QueryCondition from "./query-condition";
4
+ import QueryConditionChain from "./query-condition-chain";
5
+ export default class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
6
+ protected _column: QueryColumn<Table1, T>;
7
+ protected _type: string;
8
+ protected _otherColumn: QueryColumn<Table2, T>;
9
+ constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>);
10
+ and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
11
+ or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
12
+ }
@@ -0,0 +1,20 @@
1
+ import QueryCondition from "./query-condition";
2
+ import QueryConditionChain from "./query-condition-chain";
3
+ export default class QueryJoinCondition extends QueryCondition {
4
+ _column;
5
+ _type;
6
+ _otherColumn;
7
+ constructor(column, type, otherColumn) {
8
+ super();
9
+ this._column = column;
10
+ this._type = type;
11
+ this._otherColumn = otherColumn;
12
+ }
13
+ and(condition) {
14
+ return new QueryConditionChain(this, condition, 'and');
15
+ }
16
+ or(condition) {
17
+ return new QueryConditionChain(this, condition, 'or');
18
+ }
19
+ }
20
+ //# sourceMappingURL=query-join-condition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-join-condition.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAG1D,MAAM,CAAC,OAAO,OAAO,kBAAgG,SAAQ,cAA+B;IAE9I,OAAO,CAAyB;IAChC,KAAK,CAAS;IACd,YAAY,CAAyB;IAE/C,YAAY,MAA8B,EAAE,IAAY,EAAE,WAAmC;QACzF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,GAAG,CAAsC,SAAiC;QACtE,OAAO,IAAI,mBAAmB,CAA2B,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACrF,CAAC;IAED,EAAE,CAAsC,SAAiC;QACrE,OAAO,IAAI,mBAAmB,CAA2B,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACpF,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export default class GenericsHelper<T> {
2
+ }
@@ -0,0 +1,4 @@
1
+ // TODO In TS generic parameters not used in the class are not enforced, so I have to add dummy fields that use them. Replace with nominal typing
2
+ export default class GenericsHelper {
3
+ }
4
+ //# sourceMappingURL=generics-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generics-helper.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,iJAAiJ;AACjJ,MAAM,CAAC,OAAO,OAAO,cAAc;CAAM"}
@@ -0,0 +1,15 @@
1
+ export type QueryAction = 'select' | 'insert' | 'update' | 'delete';
2
+ export type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
3
+ export interface ColumnModifier {
4
+ name: ColumnModifierType;
5
+ params?: any;
6
+ }
7
+ export type ColumnName = string | {
8
+ name: string;
9
+ alias: string;
10
+ };
11
+ export type ColumnType = 'boolean' | 'number' | 'string' | 'date';
12
+ export type ConditionChainType = 'or' | 'and';
13
+ export type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between' | 'like' | 'not-like' | 'is-null' | 'is-not-null';
14
+ export type JoinType = 'inner' | 'left' | 'right' | 'full';
15
+ export type QueryProcessor = (query: any) => Promise<any>;
@@ -0,0 +1,3 @@
1
+ // query:
2
+ export {};
3
+ //# sourceMappingURL=internal-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-types.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,SAAS"}
@@ -0,0 +1,11 @@
1
+ import QueryTable from "../query-table";
2
+ import QueryJoinCondition from "../condition/query-join-condition";
3
+ import JoinedTables from "./joined-tables";
4
+ import { JoinType } from "../helpers/internal-types";
5
+ export default class JoinedTablesChain<Tables extends QueryTable<any, any>> {
6
+ protected _table: QueryTable<any, any>;
7
+ protected _modifier: JoinType;
8
+ protected _parent: JoinedTables<Tables> | QueryTable<any, any>;
9
+ constructor(_table: QueryTable<any, any>, _modifier: JoinType, _parent: JoinedTables<Tables> | QueryTable<any, any>);
10
+ on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables>;
11
+ }
@@ -0,0 +1,15 @@
1
+ import JoinedTables from "./joined-tables";
2
+ export default class JoinedTablesChain {
3
+ _table;
4
+ _modifier;
5
+ _parent;
6
+ constructor(_table, _modifier, _parent) {
7
+ this._table = _table;
8
+ this._modifier = _modifier;
9
+ this._parent = _parent;
10
+ }
11
+ on(condition) {
12
+ return new JoinedTables(condition, this);
13
+ }
14
+ }
15
+ //# sourceMappingURL=joined-tables-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joined-tables-chain.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAEA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,iBAAiB;IAGpB;IACA;IACA;IAHd,YACc,MAA4B,EAC5B,SAAmB,EACnB,OAAoD;QAFpD,WAAM,GAAN,MAAM,CAAsB;QAC5B,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAA6C;IAC/D,CAAC;IAEJ,EAAE,CAAC,SAAkD;QACjD,OAAO,IAAI,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ import QueryTable from "../query-table";
2
+ import JoinedTablesChain from "./joined-tables-chain";
3
+ import QueryJoinCondition from "../condition/query-join-condition";
4
+ export default class JoinedTables<Tables extends QueryTable<any, any>> {
5
+ protected _condition: QueryJoinCondition<Tables, Tables, any>;
6
+ protected _parent: JoinedTablesChain<Tables>;
7
+ constructor(_condition: QueryJoinCondition<Tables, Tables, any>, _parent: JoinedTablesChain<Tables>);
8
+ innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
9
+ leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
10
+ rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
11
+ fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
12
+ }
@@ -0,0 +1,22 @@
1
+ import JoinedTablesChain from "./joined-tables-chain";
2
+ export default class JoinedTables {
3
+ _condition;
4
+ _parent;
5
+ constructor(_condition, _parent) {
6
+ this._condition = _condition;
7
+ this._parent = _parent;
8
+ }
9
+ innerJoin(table) {
10
+ return new JoinedTablesChain(table, 'inner', this);
11
+ }
12
+ leftJoin(table) {
13
+ return new JoinedTablesChain(table, 'left', this);
14
+ }
15
+ rightJoin(table) {
16
+ return new JoinedTablesChain(table, 'right', this);
17
+ }
18
+ fullJoin(table) {
19
+ return new JoinedTablesChain(table, 'full', this);
20
+ }
21
+ }
22
+ //# sourceMappingURL=joined-tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joined-tables.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AAItD,MAAM,CAAC,OAAO,OAAO,YAAY;IAGf;IACA;IAFd,YACc,UAAmD,EACnD,OAAkC;QADlC,eAAU,GAAV,UAAU,CAAyC;QACnD,YAAO,GAAP,OAAO,CAA2B;IAC7C,CAAC;IAEJ,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACJ"}
@@ -0,0 +1,10 @@
1
+ import QueryColumn from "../column/query-column";
2
+ import QueryTable from "../query-table";
3
+ export default class QueryOrdering<Table extends QueryTable<any, any>> {
4
+ protected _column: QueryColumn<Table, any>;
5
+ protected _direction: 'ASC' | 'DESC';
6
+ protected _nullsPosition: 'FIRST' | 'LAST';
7
+ constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC');
8
+ nullsFirst(): this;
9
+ nullsLast(): this;
10
+ }
@@ -0,0 +1,18 @@
1
+ export default class QueryOrdering {
2
+ _column;
3
+ _direction;
4
+ _nullsPosition;
5
+ constructor(column, direction) {
6
+ this._column = column;
7
+ this._direction = direction;
8
+ }
9
+ nullsFirst() {
10
+ this._nullsPosition = 'FIRST';
11
+ return this;
12
+ }
13
+ nullsLast() {
14
+ this._nullsPosition = 'LAST';
15
+ return this;
16
+ }
17
+ }
18
+ //# sourceMappingURL=query-ordering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-ordering.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,aAAa;IAEpB,OAAO,CAA0B;IACjC,UAAU,CAAiB;IAC3B,cAAc,CAAmB;IAE3C,YAAY,MAA+B,EAAE,SAAyB;QAClE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,UAAU;QACN,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS;QACL,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ"}
@@ -0,0 +1,29 @@
1
+ import QueryCondition from "../condition/query-condition";
2
+ import QueryOrdering from "../other/query-ordering";
3
+ import QueryTable from "../query-table";
4
+ import QueryColumn from "../column/query-column";
5
+ import { QueryProcessor, QueryAction } from "../helpers/internal-types";
6
+ export default class SelectQuery<Entity, Table extends QueryTable<Entity, any>> {
7
+ protected _queryProcessor: QueryProcessor;
8
+ protected _tables: Table[];
9
+ constructor(_queryProcessor: QueryProcessor, _tables: Table[]);
10
+ protected _distinct: boolean;
11
+ protected _offset: number;
12
+ protected _limit: number;
13
+ protected _conditions: QueryCondition<Table>[];
14
+ protected _groupBy: QueryColumn<Table, any>[];
15
+ protected _having: QueryCondition<Table>[];
16
+ protected _orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[];
17
+ protected _columns: QueryColumn<Table, any>[];
18
+ protected _action: QueryAction;
19
+ offset(offset: number): this;
20
+ limit(limit: number): this;
21
+ distinct(): this;
22
+ where(...conditions: QueryCondition<Table>[]): this;
23
+ groupBy(...columns: QueryColumn<Table, any>[]): this;
24
+ having(...conditions: QueryCondition<Table>[]): this;
25
+ orderBy(...orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[]): this;
26
+ select(): Promise<Entity[]>;
27
+ select<T>(column: QueryColumn<Table, T>): Promise<T[]>;
28
+ select(...columns: QueryColumn<Table, any>[]): Promise<any[]>;
29
+ }
@@ -0,0 +1,51 @@
1
+ export default class SelectQuery {
2
+ _queryProcessor;
3
+ _tables;
4
+ constructor(_queryProcessor, _tables) {
5
+ this._queryProcessor = _queryProcessor;
6
+ this._tables = _tables;
7
+ }
8
+ _distinct = false;
9
+ _offset;
10
+ _limit;
11
+ _conditions = [];
12
+ _groupBy = [];
13
+ _having = [];
14
+ _orderings = [];
15
+ _columns = [];
16
+ _action;
17
+ offset(offset) {
18
+ this._offset = offset;
19
+ return this;
20
+ }
21
+ limit(limit) {
22
+ this._limit = limit;
23
+ return this;
24
+ }
25
+ distinct() {
26
+ this._distinct = true;
27
+ return this;
28
+ }
29
+ where(...conditions) {
30
+ this._conditions = conditions;
31
+ return this;
32
+ }
33
+ groupBy(...columns) {
34
+ this._groupBy = columns;
35
+ return this;
36
+ }
37
+ having(...conditions) {
38
+ this._having = conditions;
39
+ return this;
40
+ }
41
+ orderBy(...orderings) {
42
+ this._orderings = orderings;
43
+ return this;
44
+ }
45
+ select(...columns) {
46
+ this._columns = columns;
47
+ this._action = 'select';
48
+ return this._queryProcessor(this);
49
+ }
50
+ }
51
+ //# sourceMappingURL=select-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-query.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,OAAO,WAAW;IAGd;IACA;IAFd,YACc,eAA+B,EAC/B,OAAgB;QADhB,oBAAe,GAAf,eAAe,CAAgB;QAC/B,YAAO,GAAP,OAAO,CAAS;IAC3B,CAAC;IAEM,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,WAAW,GAA4B,EAAE,CAAC;IAC1C,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,GAA4B,EAAE,CAAC;IACtC,UAAU,GAAuD,EAAE,CAAC;IACpE,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,CAAc;IAE/B,MAAM,CAAC,MAAc;QACjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,KAAa;QACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,GAAG,UAAmC;QACxC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,GAAG,OAAkC;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,GAAG,UAAmC;QACzC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,GAAG,SAA6D;QACpE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAKD,MAAM,CAAC,GAAG,OAAkC;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACJ"}
@@ -0,0 +1,16 @@
1
+ import QueryTable from "../query-table";
2
+ import QueryCondition from "../condition/query-condition";
3
+ import QueryColumn from "../column/query-column";
4
+ import { QueryProcessor, QueryAction } from "../helpers/internal-types";
5
+ export default class TableConditionQuery<Entity, Table extends QueryTable<Entity, any>> {
6
+ protected _queryProcessor: QueryProcessor;
7
+ protected _table: Table;
8
+ protected _conditions: QueryCondition<Table>[];
9
+ constructor(_queryProcessor: QueryProcessor, _table: Table, _conditions: QueryCondition<Table>[]);
10
+ protected _columns: QueryColumn<Table, any>[];
11
+ protected _action: QueryAction;
12
+ protected _entity: Entity | Partial<Entity>;
13
+ update(entity: Partial<Entity>): Promise<number>;
14
+ delete(): Promise<number>;
15
+ count(): Promise<number>;
16
+ }
@@ -0,0 +1,28 @@
1
+ export default class TableConditionQuery {
2
+ _queryProcessor;
3
+ _table;
4
+ _conditions;
5
+ constructor(_queryProcessor, _table, _conditions) {
6
+ this._queryProcessor = _queryProcessor;
7
+ this._table = _table;
8
+ this._conditions = _conditions;
9
+ }
10
+ _columns = [];
11
+ _action;
12
+ _entity;
13
+ update(entity) {
14
+ this._entity = entity;
15
+ this._action = 'update';
16
+ return this._queryProcessor(this);
17
+ }
18
+ delete() {
19
+ this._action = 'delete';
20
+ return this._queryProcessor(this);
21
+ }
22
+ count() {
23
+ this._columns = [this._table.$all.count()];
24
+ this._action = 'select';
25
+ return this._queryProcessor(this).then((rows) => rows[0]);
26
+ }
27
+ }
28
+ //# sourceMappingURL=table-condition-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-condition-query.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,mBAAmB;IAGtB;IACA;IACA;IAHd,YACc,eAA+B,EAC/B,MAAa,EACb,WAAoC;QAFpC,oBAAe,GAAf,eAAe,CAAgB;QAC/B,WAAM,GAAN,MAAM,CAAO;QACb,gBAAW,GAAX,WAAW,CAAyB;IAC/C,CAAC;IAEM,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,CAAc;IACrB,OAAO,CAA2B;IAE5C,MAAM,CAAC,MAAuB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,MAAM;QACF,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ"}