sumak 0.0.4 → 0.0.6

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 (121) hide show
  1. package/README.md +409 -5
  2. package/dist/ast/expression.d.mts +26 -0
  3. package/dist/ast/expression.mjs +140 -0
  4. package/dist/ast/nodes.d.mts +309 -0
  5. package/dist/ast/nodes.mjs +59 -0
  6. package/dist/ast/transformer.d.mts +10 -0
  7. package/dist/ast/transformer.mjs +140 -0
  8. package/dist/ast/typed-expression.d.mts +37 -0
  9. package/dist/ast/typed-expression.mjs +77 -0
  10. package/dist/ast/visitor.d.mts +13 -0
  11. package/dist/ast/visitor.mjs +11 -0
  12. package/dist/builder/delete.d.mts +20 -0
  13. package/dist/builder/delete.mjs +113 -0
  14. package/dist/builder/eb.d.mts +312 -0
  15. package/dist/builder/eb.mjs +641 -0
  16. package/dist/builder/expression.d.mts +5 -0
  17. package/dist/builder/expression.mjs +10 -0
  18. package/dist/builder/insert.d.mts +40 -0
  19. package/dist/builder/insert.mjs +146 -0
  20. package/dist/builder/merge.d.mts +20 -0
  21. package/dist/builder/merge.mjs +100 -0
  22. package/dist/builder/raw.d.mts +2 -0
  23. package/dist/builder/raw.mjs +4 -0
  24. package/dist/builder/select.d.mts +41 -0
  25. package/dist/builder/select.mjs +280 -0
  26. package/dist/builder/typed-delete.d.mts +49 -0
  27. package/dist/builder/typed-delete.mjs +89 -0
  28. package/dist/builder/typed-insert.d.mts +86 -0
  29. package/dist/builder/typed-insert.mjs +159 -0
  30. package/dist/builder/typed-merge.d.mts +31 -0
  31. package/dist/builder/typed-merge.mjs +93 -0
  32. package/dist/builder/typed-select.d.mts +164 -0
  33. package/dist/builder/typed-select.mjs +309 -0
  34. package/dist/builder/typed-update.d.mts +59 -0
  35. package/dist/builder/typed-update.mjs +110 -0
  36. package/dist/builder/update.d.mts +20 -0
  37. package/dist/builder/update.mjs +121 -0
  38. package/dist/dialect/mssql.d.mts +2 -0
  39. package/dist/dialect/mssql.mjs +9 -0
  40. package/dist/dialect/mysql.d.mts +2 -0
  41. package/dist/dialect/mysql.mjs +9 -0
  42. package/dist/dialect/pg.d.mts +2 -0
  43. package/dist/dialect/pg.mjs +9 -0
  44. package/dist/dialect/sqlite.d.mts +2 -0
  45. package/dist/dialect/sqlite.mjs +9 -0
  46. package/dist/dialect/types.d.mts +6 -0
  47. package/dist/dialect/types.mjs +1 -0
  48. package/dist/errors.d.mts +12 -0
  49. package/dist/errors.mjs +24 -0
  50. package/dist/index.d.mts +50 -806
  51. package/dist/index.mjs +48 -3
  52. package/dist/mssql.d.mts +2 -2
  53. package/dist/mssql.mjs +2 -1
  54. package/dist/mysql.d.mts +2 -2
  55. package/dist/mysql.mjs +2 -1
  56. package/dist/pg.d.mts +2 -2
  57. package/dist/pg.mjs +2 -1
  58. package/dist/plugin/camel-case.d.mts +11 -0
  59. package/dist/plugin/camel-case.mjs +16 -0
  60. package/dist/plugin/hooks.d.mts +72 -0
  61. package/dist/plugin/hooks.mjs +49 -0
  62. package/dist/plugin/plugin-manager.d.mts +17 -0
  63. package/dist/plugin/plugin-manager.mjs +37 -0
  64. package/dist/plugin/soft-delete.d.mts +27 -0
  65. package/dist/plugin/soft-delete.mjs +52 -0
  66. package/dist/plugin/types.d.mts +19 -0
  67. package/dist/plugin/types.mjs +1 -0
  68. package/dist/plugin/with-schema.d.mts +21 -0
  69. package/dist/plugin/with-schema.mjs +53 -0
  70. package/dist/printer/base.d.mts +49 -0
  71. package/dist/printer/base.mjs +472 -0
  72. package/dist/printer/document.d.mts +45 -0
  73. package/dist/printer/document.mjs +153 -0
  74. package/dist/printer/formatter.d.mts +5 -0
  75. package/dist/printer/formatter.mjs +134 -0
  76. package/dist/printer/mssql.d.mts +10 -0
  77. package/dist/printer/mssql.mjs +161 -0
  78. package/dist/printer/mysql.d.mts +8 -0
  79. package/dist/printer/mysql.mjs +41 -0
  80. package/dist/printer/pg.d.mts +6 -0
  81. package/dist/printer/pg.mjs +9 -0
  82. package/dist/printer/sqlite.d.mts +8 -0
  83. package/dist/printer/sqlite.mjs +29 -0
  84. package/dist/printer/types.d.mts +11 -0
  85. package/dist/printer/types.mjs +1 -0
  86. package/dist/schema/column.d.mts +52 -0
  87. package/dist/schema/column.mjs +120 -0
  88. package/dist/schema/index.d.mts +6 -0
  89. package/dist/schema/index.mjs +4 -0
  90. package/dist/schema/table.d.mts +37 -0
  91. package/dist/schema/table.mjs +7 -0
  92. package/dist/schema/type-utils.d.mts +46 -0
  93. package/dist/schema/type-utils.mjs +1 -0
  94. package/dist/schema/types.d.mts +64 -0
  95. package/dist/schema/types.mjs +1 -0
  96. package/dist/schema.d.mts +2 -2
  97. package/dist/schema.mjs +1 -1
  98. package/dist/sqlite.d.mts +2 -2
  99. package/dist/sqlite.mjs +2 -1
  100. package/dist/sumak.d.mts +110 -0
  101. package/dist/sumak.mjs +141 -0
  102. package/dist/types.d.mts +14 -0
  103. package/dist/types.mjs +1 -0
  104. package/dist/utils/identifier.d.mts +3 -0
  105. package/dist/utils/identifier.mjs +14 -0
  106. package/dist/utils/param.d.mts +2 -0
  107. package/dist/utils/param.mjs +8 -0
  108. package/package.json +1 -1
  109. package/dist/_chunks/base.mjs +0 -1
  110. package/dist/_chunks/errors.mjs +0 -1
  111. package/dist/_chunks/index.d.mts +0 -136
  112. package/dist/_chunks/mssql.d.mts +0 -11
  113. package/dist/_chunks/mssql.mjs +0 -1
  114. package/dist/_chunks/mysql.d.mts +0 -9
  115. package/dist/_chunks/mysql.mjs +0 -1
  116. package/dist/_chunks/pg.d.mts +0 -7
  117. package/dist/_chunks/pg.mjs +0 -1
  118. package/dist/_chunks/schema.mjs +0 -1
  119. package/dist/_chunks/sqlite.d.mts +0 -9
  120. package/dist/_chunks/sqlite.mjs +0 -1
  121. package/dist/_chunks/types.d.mts +0 -338
@@ -0,0 +1,113 @@
1
+ import { createDeleteNode } from "../ast/nodes.mjs";
2
+ export class DeleteBuilder {
3
+ node;
4
+ constructor(node) {
5
+ this.node = node ?? createDeleteNode({
6
+ type: "table_ref",
7
+ name: ""
8
+ });
9
+ }
10
+ from(table) {
11
+ const ref = typeof table === "string" ? {
12
+ type: "table_ref",
13
+ name: table
14
+ } : table;
15
+ return new DeleteBuilder({
16
+ ...this.node,
17
+ table: ref
18
+ });
19
+ }
20
+ where(expr) {
21
+ if (this.node.where) {
22
+ return new DeleteBuilder({
23
+ ...this.node,
24
+ where: {
25
+ type: "binary_op",
26
+ op: "AND",
27
+ left: this.node.where,
28
+ right: expr
29
+ }
30
+ });
31
+ }
32
+ return new DeleteBuilder({
33
+ ...this.node,
34
+ where: expr
35
+ });
36
+ }
37
+
38
+ using(table) {
39
+ const ref = typeof table === "string" ? {
40
+ type: "table_ref",
41
+ name: table
42
+ } : table;
43
+ return new DeleteBuilder({
44
+ ...this.node,
45
+ using: ref
46
+ });
47
+ }
48
+
49
+ join(type, table, on) {
50
+ const tableRef = typeof table === "string" ? {
51
+ type: "table_ref",
52
+ name: table
53
+ } : table;
54
+ const join = {
55
+ type: "join",
56
+ joinType: type,
57
+ table: tableRef,
58
+ on
59
+ };
60
+ return new DeleteBuilder({
61
+ ...this.node,
62
+ joins: [...this.node.joins, join]
63
+ });
64
+ }
65
+ innerJoin(table, on) {
66
+ return this.join("INNER", table, on);
67
+ }
68
+ leftJoin(table, on) {
69
+ return this.join("LEFT", table, on);
70
+ }
71
+ orderBy(expr, direction = "ASC") {
72
+ const node = {
73
+ expr: typeof expr === "string" ? {
74
+ type: "column_ref",
75
+ column: expr
76
+ } : expr,
77
+ direction
78
+ };
79
+ return new DeleteBuilder({
80
+ ...this.node,
81
+ orderBy: [...this.node.orderBy ?? [], node]
82
+ });
83
+ }
84
+ limit(n) {
85
+ return new DeleteBuilder({
86
+ ...this.node,
87
+ limit: n
88
+ });
89
+ }
90
+ returning(...exprs) {
91
+ return new DeleteBuilder({
92
+ ...this.node,
93
+ returning: [...this.node.returning, ...exprs]
94
+ });
95
+ }
96
+ with(name, query, recursive = false) {
97
+ const cte = {
98
+ name,
99
+ query,
100
+ recursive
101
+ };
102
+ return new DeleteBuilder({
103
+ ...this.node,
104
+ ctes: [...this.node.ctes, cte]
105
+ });
106
+ }
107
+ build() {
108
+ return { ...this.node };
109
+ }
110
+ }
111
+ export function deleteFrom(table) {
112
+ return new DeleteBuilder().from(table);
113
+ }
@@ -0,0 +1,312 @@
1
+ import type { FrameBound, FullTextSearchMode, SelectNode } from "../ast/nodes.mjs";
2
+ import type { Expression } from "../ast/typed-expression.mjs";
3
+ import type { SelectType } from "../schema/types.mjs";
4
+ /**
5
+ * A typed column reference that exposes comparison methods.
6
+ *
7
+ * ```ts
8
+ * // users.id.eq(42) → ("id" = $1) with param [42]
9
+ * // users.name.like("%ali%") → ("name" LIKE '%ali%')
10
+ * ```
11
+ */
12
+ export declare class Col<T> {
13
+ readonly _type: T;
14
+ constructor(column: string, table?: string);
15
+ /** = */
16
+ eq(value: T): Expression<boolean>;
17
+ /** != */
18
+ neq(value: T): Expression<boolean>;
19
+ /** > */
20
+ gt(value: T): Expression<boolean>;
21
+ /** >= */
22
+ gte(value: T): Expression<boolean>;
23
+ /** < */
24
+ lt(value: T): Expression<boolean>;
25
+ /** <= */
26
+ lte(value: T): Expression<boolean>;
27
+ /** LIKE (string columns only) */
28
+ like(this: Col<string>, pattern: string): Expression<boolean>;
29
+ /** NOT LIKE */
30
+ notLike(this: Col<string>, pattern: string): Expression<boolean>;
31
+ /** ILIKE — case-insensitive LIKE (PG) */
32
+ ilike(this: Col<string>, pattern: string): Expression<boolean>;
33
+ /** NOT ILIKE (PG) */
34
+ notIlike(this: Col<string>, pattern: string): Expression<boolean>;
35
+ /** IN (value1, value2, ...) */
36
+ in(values: T[]): Expression<boolean>;
37
+ /** NOT IN */
38
+ notIn(values: T[]): Expression<boolean>;
39
+ /** IS NULL */
40
+ isNull(): Expression<boolean>;
41
+ /** IS NOT NULL */
42
+ isNotNull(): Expression<boolean>;
43
+ /** BETWEEN low AND high */
44
+ between(low: T, high: T): Expression<boolean>;
45
+ /** NOT BETWEEN low AND high */
46
+ notBetween(low: T, high: T): Expression<boolean>;
47
+ /** BETWEEN SYMMETRIC low AND high (PG) — order-independent range check */
48
+ betweenSymmetric(low: T, high: T): Expression<boolean>;
49
+ /** IN (SELECT ...) — subquery */
50
+ inSubquery(query: SelectNode): Expression<boolean>;
51
+ /** NOT IN (SELECT ...) — subquery */
52
+ notInSubquery(query: SelectNode): Expression<boolean>;
53
+ /** = with Expression value */
54
+ eqExpr(value: Expression<T>): Expression<boolean>;
55
+ /** != with Expression value */
56
+ neqExpr(value: Expression<T>): Expression<boolean>;
57
+ /** > with Expression value */
58
+ gtExpr(value: Expression<T>): Expression<boolean>;
59
+ /** >= with Expression value */
60
+ gteExpr(value: Expression<T>): Expression<boolean>;
61
+ /** < with Expression value */
62
+ ltExpr(value: Expression<T>): Expression<boolean>;
63
+ /** <= with Expression value */
64
+ lteExpr(value: Expression<T>): Expression<boolean>;
65
+ /** IS DISTINCT FROM — null-safe inequality */
66
+ isDistinctFrom(value: T): Expression<boolean>;
67
+ /** IS NOT DISTINCT FROM — null-safe equality */
68
+ isNotDistinctFrom(value: T): Expression<boolean>;
69
+ /** Compare with another column: col1.eqCol(col2) */
70
+ eqCol(other: Col<T>): Expression<boolean>;
71
+ /** != another column */
72
+ neqCol(other: Col<T>): Expression<boolean>;
73
+ /** > another column */
74
+ gtCol(other: Col<T>): Expression<boolean>;
75
+ /** < another column */
76
+ ltCol(other: Col<T>): Expression<boolean>;
77
+ /** >= another column */
78
+ gteCol(other: Col<T>): Expression<boolean>;
79
+ /** <= another column */
80
+ lteCol(other: Col<T>): Expression<boolean>;
81
+ /** As raw Expression<T> for advanced use */
82
+ toExpr(): Expression<T>;
83
+ }
84
+ export declare function resetParams(): void;
85
+ /**
86
+ * Create typed column proxies for a table's columns.
87
+ *
88
+ * Type: { id: Col<number>, name: Col<string>, ... }
89
+ */
90
+ export type ColumnProxies<
91
+ DB,
92
+ TB extends keyof DB
93
+ > = { [K in keyof DB[TB] & string] : Col<SelectType<DB[TB][K]>> };
94
+ /**
95
+ * Create column proxy objects for use in where/on callbacks.
96
+ */
97
+ export declare function createColumnProxies<
98
+ DB,
99
+ TB extends keyof DB
100
+ >(_table: TB & string): ColumnProxies<DB, TB>;
101
+ /**
102
+ * Expression builder callback type.
103
+ *
104
+ * ```ts
105
+ * .where(({ id, name }) => id.eq(42))
106
+ * ```
107
+ */
108
+ export type WhereCallback<
109
+ DB,
110
+ TB extends keyof DB
111
+ > = (cols: ColumnProxies<DB, TB>) => Expression<boolean>;
112
+ /** AND expressions — variadic: and(a, b) or and(a, b, c, ...) */
113
+ export declare function and(...exprs: Expression<boolean>[]): Expression<boolean>;
114
+ /** OR expressions — variadic: or(a, b) or or(a, b, c, ...) */
115
+ export declare function or(...exprs: Expression<boolean>[]): Expression<boolean>;
116
+ /** Raw literal value as expression */
117
+ export declare function val<T extends string | number | boolean | null>(value: T): Expression<T>;
118
+ /**
119
+ * Raw SQL expression — escape hatch for arbitrary SQL in expressions.
120
+ *
121
+ * ```ts
122
+ * .where(() => rawExpr("age > 18"))
123
+ * .selectExpr(rawExpr<number>("EXTRACT(YEAR FROM created_at)"), "year")
124
+ * ```
125
+ */
126
+ export declare function rawExpr<T = unknown>(sql: string, params?: unknown[]): Expression<T>;
127
+ /** SQL function call */
128
+ export declare function sqlFn(name: string, ...args: Expression<any>[]): Expression<any>;
129
+ /** COUNT(*) */
130
+ export declare function count(): Expression<number>;
131
+ /** COUNT(DISTINCT expr) */
132
+ export declare function countDistinct(expr: Expression<any>): Expression<number>;
133
+ /** SUM(expr) */
134
+ export declare function sum(expr: Expression<number>): Expression<number>;
135
+ /** SUM(DISTINCT expr) */
136
+ export declare function sumDistinct(expr: Expression<number>): Expression<number>;
137
+ /** AVG(expr) */
138
+ export declare function avg(expr: Expression<number>): Expression<number>;
139
+ /** AVG(DISTINCT expr) */
140
+ export declare function avgDistinct(expr: Expression<number>): Expression<number>;
141
+ /** MIN(expr) */
142
+ export declare function min<T>(expr: Expression<T>): Expression<T>;
143
+ /** MAX(expr) */
144
+ export declare function max<T>(expr: Expression<T>): Expression<T>;
145
+ /** COALESCE(a, b, c, ...) — returns first non-null value */
146
+ export declare function coalesce<T>(...args: Expression<T | null>[]): Expression<T>;
147
+ /** NOT expr */
148
+ export declare function not(expr: Expression<boolean>): Expression<boolean>;
149
+ /** Add: a + b */
150
+ export declare function add(a: Expression<number>, b: Expression<number>): Expression<number>;
151
+ /** Subtract: a - b */
152
+ export declare function sub(a: Expression<number>, b: Expression<number>): Expression<number>;
153
+ /** Multiply: a * b */
154
+ export declare function mul(a: Expression<number>, b: Expression<number>): Expression<number>;
155
+ /** Divide: a / b */
156
+ export declare function div(a: Expression<number>, b: Expression<number>): Expression<number>;
157
+ /** Modulo: a % b */
158
+ export declare function mod(a: Expression<number>, b: Expression<number>): Expression<number>;
159
+ /** Unary minus: -expr */
160
+ export declare function neg(expr: Expression<number>): Expression<number>;
161
+ /** EXISTS (subquery) */
162
+ export declare function exists(query: SelectNode): Expression<boolean>;
163
+ /** NOT EXISTS (subquery) */
164
+ export declare function notExists(query: SelectNode): Expression<boolean>;
165
+ /** CAST(expr AS type) */
166
+ export declare function cast<T>(expr: Expression<any>, dataType: string): Expression<T>;
167
+ /**
168
+ * JSON access operator: expr->path, expr->>path, etc.
169
+ *
170
+ * ```ts
171
+ * jsonRef(cols.data, "name", "->>") // data->>'name'
172
+ * ```
173
+ */
174
+ export declare function jsonRef<T = unknown>(expr: Expression<any>, path: string, operator?: "->" | "->>" | "#>" | "#>>"): Expression<T>;
175
+ /**
176
+ * Full-text search expression.
177
+ *
178
+ * Dialect-aware: PG uses tsvector/tsquery, MySQL uses MATCH/AGAINST,
179
+ * SQLite uses FTS5 MATCH, MSSQL uses CONTAINS/FREETEXT.
180
+ *
181
+ * ```ts
182
+ * // PostgreSQL: to_tsvector("name") @@ to_tsquery($1)
183
+ * .where(() => textSearch([cols.name], val("alice")))
184
+ *
185
+ * // MySQL: MATCH(`name`) AGAINST(? IN BOOLEAN MODE)
186
+ * .where(() => textSearch([cols.name], val("alice"), { mode: "boolean" }))
187
+ * ```
188
+ */
189
+ export declare function textSearch(columns: Expression<any>[], query: Expression<any>, options?: {
190
+ mode?: FullTextSearchMode;
191
+ language?: string;
192
+ }): Expression<boolean>;
193
+ /**
194
+ * CASE expression builder.
195
+ *
196
+ * ```ts
197
+ * case_()
198
+ * .when(cols.status.eq("active"), val(1))
199
+ * .when(cols.status.eq("inactive"), val(0))
200
+ * .else_(val(-1))
201
+ * .end()
202
+ * ```
203
+ */
204
+ export declare function case_(operand?: Expression<any>): CaseBuilder<never>;
205
+ export declare class CaseBuilder<T> {
206
+ when<R>(condition: Expression<boolean>, result: Expression<R>): CaseBuilder<T | R>;
207
+ else_<R>(result: Expression<R>): CaseBuilder<T | R>;
208
+ end(): Expression<T>;
209
+ }
210
+ /**
211
+ * Window function builder.
212
+ *
213
+ * ```ts
214
+ * over(count(), w => w.partitionBy("dept").orderBy("salary", "DESC"))
215
+ * over(sqlFn("ROW_NUMBER"), w => w.partitionBy("dept").orderBy("id"))
216
+ * ```
217
+ */
218
+ export declare function over<T>(fn: Expression<T>, build: (w: WindowBuilder) => WindowBuilder): Expression<T>;
219
+ export declare class WindowBuilder {
220
+ partitionBy(...columns: string[]): WindowBuilder;
221
+ orderBy(column: string, direction?: "ASC" | "DESC"): WindowBuilder;
222
+ rows(start: FrameBound, end?: FrameBound): WindowBuilder;
223
+ range(start: FrameBound, end?: FrameBound): WindowBuilder;
224
+ groups(start: FrameBound, end?: FrameBound): WindowBuilder;
225
+ }
226
+ /** ROW_NUMBER() — must be used with over() */
227
+ export declare function rowNumber(): Expression<number>;
228
+ /** RANK() — must be used with over() */
229
+ export declare function rank(): Expression<number>;
230
+ /** DENSE_RANK() — must be used with over() */
231
+ export declare function denseRank(): Expression<number>;
232
+ /** LAG(expr, offset?, default?) */
233
+ export declare function lag<T>(expr: Expression<T>, offset?: number, defaultValue?: Expression<T>): Expression<T>;
234
+ /** LEAD(expr, offset?, default?) */
235
+ export declare function lead<T>(expr: Expression<T>, offset?: number, defaultValue?: Expression<T>): Expression<T>;
236
+ /** NTILE(n) */
237
+ export declare function ntile(n: number): Expression<number>;
238
+ /** UPPER(expr) */
239
+ export declare function upper(expr: Expression<string>): Expression<string>;
240
+ /** LOWER(expr) */
241
+ export declare function lower(expr: Expression<string>): Expression<string>;
242
+ /** CONCAT(a, b, ...) */
243
+ export declare function concat(...args: Expression<string>[]): Expression<string>;
244
+ /** SUBSTRING(expr, start, length?) */
245
+ export declare function substring(expr: Expression<string>, start: number, length?: number): Expression<string>;
246
+ /** TRIM(expr) */
247
+ export declare function trim(expr: Expression<string>): Expression<string>;
248
+ /** LENGTH(expr) / CHAR_LENGTH(expr) */
249
+ export declare function length(expr: Expression<string>): Expression<number>;
250
+ /** NOW() */
251
+ export declare function now(): Expression<Date>;
252
+ /** CURRENT_TIMESTAMP */
253
+ export declare function currentTimestamp(): Expression<Date>;
254
+ /** NULLIF(a, b) */
255
+ export declare function nullif<T>(a: Expression<T>, b: Expression<T>): Expression<T | null>;
256
+ /** GREATEST(a, b, ...) */
257
+ export declare function greatest<T>(...args: Expression<T>[]): Expression<T>;
258
+ /** LEAST(a, b, ...) */
259
+ export declare function least<T>(...args: Expression<T>[]): Expression<T>;
260
+ /** ABS(expr) */
261
+ export declare function abs(expr: Expression<number>): Expression<number>;
262
+ /** ROUND(expr, precision?) */
263
+ export declare function round(expr: Expression<number>, precision?: number): Expression<number>;
264
+ /** CEIL(expr) */
265
+ export declare function ceil(expr: Expression<number>): Expression<number>;
266
+ /** JSON_AGG(expr) — aggregate rows into JSON array (PG) */
267
+ export declare function jsonAgg<T>(expr: Expression<T>): Expression<T[]>;
268
+ /** TO_JSON(expr) — convert value to JSON (PG) */
269
+ export declare function toJson<T>(expr: Expression<T>): Expression<unknown>;
270
+ /** JSON_BUILD_OBJECT(key, value, ...) — build JSON object (PG) */
271
+ export declare function jsonBuildObject(...pairs: [string, Expression<any>][]): Expression<Record<string, unknown>>;
272
+ /** @> (array contains) */
273
+ export declare function arrayContains(arr: Expression<any>, values: Expression<any>): Expression<boolean>;
274
+ /** <@ (array contained by) */
275
+ export declare function arrayContainedBy(arr: Expression<any>, values: Expression<any>): Expression<boolean>;
276
+ /** && (array overlaps) */
277
+ export declare function arrayOverlaps(arr: Expression<any>, values: Expression<any>): Expression<boolean>;
278
+ /** FLOOR(expr) */
279
+ export declare function floor(expr: Expression<number>): Expression<number>;
280
+ /** STRING_AGG(expr, delimiter) — aggregate strings with separator */
281
+ export declare function stringAgg(expr: Expression<string>, delimiter: string, orderBy?: {
282
+ expr: Expression<any>;
283
+ direction?: "ASC" | "DESC";
284
+ }[]): Expression<string>;
285
+ /** ARRAY_AGG(expr) — aggregate values into array */
286
+ export declare function arrayAgg<T>(expr: Expression<T>, orderBy?: {
287
+ expr: Expression<any>;
288
+ direction?: "ASC" | "DESC";
289
+ }[]): Expression<T[]>;
290
+ /** Attach ORDER BY to an existing aggregate expression. */
291
+ export declare function aggOrderBy<T>(agg: Expression<T>, orderBy: {
292
+ expr: Expression<any>;
293
+ direction?: "ASC" | "DESC";
294
+ }[]): Expression<T>;
295
+ /**
296
+ * Row-value tuple for comparisons.
297
+ *
298
+ * ```ts
299
+ * // (a, b) = (1, 2)
300
+ * tuple(cols.a.toExpr(), cols.b.toExpr())
301
+ * ```
302
+ */
303
+ export declare function tuple(...exprs: Expression<any>[]): Expression<any>;
304
+ /**
305
+ * Attach FILTER (WHERE ...) to an aggregate expression.
306
+ *
307
+ * ```ts
308
+ * filter(count(), ({ active }) => active.eq(true))
309
+ * // COUNT(*) FILTER (WHERE "active" = $1)
310
+ * ```
311
+ */
312
+ export declare function filter<T>(agg: Expression<T>, condition: Expression<boolean>): Expression<T>;