@crvouga/sqlite-mem 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/COMPATIBILITY-AUDIT.md +199 -0
  2. package/COMPATIBILITY.md +93 -0
  3. package/LICENSE +21 -0
  4. package/README.md +171 -0
  5. package/compat/coverage.json +21896 -0
  6. package/compat/fts-oracle-surface.json +198 -0
  7. package/compat/gate-report.json +424 -0
  8. package/compat/requirements.json +20929 -0
  9. package/dist/api/database.d.ts +26 -0
  10. package/dist/api/database.d.ts.map +1 -0
  11. package/dist/api/statement.d.ts +27 -0
  12. package/dist/api/statement.d.ts.map +1 -0
  13. package/dist/ast/nodes.d.ts +451 -0
  14. package/dist/ast/nodes.d.ts.map +1 -0
  15. package/dist/constraints/check.d.ts +12 -0
  16. package/dist/constraints/check.d.ts.map +1 -0
  17. package/dist/errors/index.d.ts +12 -0
  18. package/dist/errors/index.d.ts.map +1 -0
  19. package/dist/executor/attach.d.ts +6 -0
  20. package/dist/executor/attach.d.ts.map +1 -0
  21. package/dist/executor/ddl.d.ts +11 -0
  22. package/dist/executor/ddl.d.ts.map +1 -0
  23. package/dist/executor/dml.d.ts +7 -0
  24. package/dist/executor/dml.d.ts.map +1 -0
  25. package/dist/executor/env.d.ts +62 -0
  26. package/dist/executor/env.d.ts.map +1 -0
  27. package/dist/executor/execute.d.ts +5 -0
  28. package/dist/executor/execute.d.ts.map +1 -0
  29. package/dist/executor/pragma.d.ts +5 -0
  30. package/dist/executor/pragma.d.ts.map +1 -0
  31. package/dist/executor/result.d.ts +18 -0
  32. package/dist/executor/result.d.ts.map +1 -0
  33. package/dist/executor/select.d.ts +7 -0
  34. package/dist/executor/select.d.ts.map +1 -0
  35. package/dist/executor/simple-select.d.ts +10 -0
  36. package/dist/executor/simple-select.d.ts.map +1 -0
  37. package/dist/executor/triggers.d.ts +12 -0
  38. package/dist/executor/triggers.d.ts.map +1 -0
  39. package/dist/executor/vtable.d.ts +13 -0
  40. package/dist/executor/vtable.d.ts.map +1 -0
  41. package/dist/expressions/context.d.ts +28 -0
  42. package/dist/expressions/context.d.ts.map +1 -0
  43. package/dist/expressions/eval.d.ts +5 -0
  44. package/dist/expressions/eval.d.ts.map +1 -0
  45. package/dist/expressions/index.d.ts +4 -0
  46. package/dist/expressions/index.d.ts.map +1 -0
  47. package/dist/expressions/like.d.ts +5 -0
  48. package/dist/expressions/like.d.ts.map +1 -0
  49. package/dist/functions/aggregate.d.ts +9 -0
  50. package/dist/functions/aggregate.d.ts.map +1 -0
  51. package/dist/functions/datetime.d.ts +3 -0
  52. package/dist/functions/datetime.d.ts.map +1 -0
  53. package/dist/functions/extensions.d.ts +8 -0
  54. package/dist/functions/extensions.d.ts.map +1 -0
  55. package/dist/functions/index.d.ts +9 -0
  56. package/dist/functions/index.d.ts.map +1 -0
  57. package/dist/functions/json.d.ts +7 -0
  58. package/dist/functions/json.d.ts.map +1 -0
  59. package/dist/functions/math.d.ts +3 -0
  60. package/dist/functions/math.d.ts.map +1 -0
  61. package/dist/functions/registry.d.ts +38 -0
  62. package/dist/functions/registry.d.ts.map +1 -0
  63. package/dist/functions/scalar.d.ts +10 -0
  64. package/dist/functions/scalar.d.ts.map +1 -0
  65. package/dist/functions/table-valued.d.ts +9 -0
  66. package/dist/functions/table-valued.d.ts.map +1 -0
  67. package/dist/functions/window.d.ts +24 -0
  68. package/dist/functions/window.d.ts.map +1 -0
  69. package/dist/index.d.ts +12 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +12204 -0
  72. package/dist/index.js.map +7 -0
  73. package/dist/indexes/index.d.ts +16 -0
  74. package/dist/indexes/index.d.ts.map +1 -0
  75. package/dist/json/index.d.ts +8 -0
  76. package/dist/json/index.d.ts.map +1 -0
  77. package/dist/json/jsonb.d.ts +43 -0
  78. package/dist/json/jsonb.d.ts.map +1 -0
  79. package/dist/json/ops.d.ts +19 -0
  80. package/dist/json/ops.d.ts.map +1 -0
  81. package/dist/json/parse.d.ts +14 -0
  82. package/dist/json/parse.d.ts.map +1 -0
  83. package/dist/json/path.d.ts +27 -0
  84. package/dist/json/path.d.ts.map +1 -0
  85. package/dist/json/stringify.d.ts +5 -0
  86. package/dist/json/stringify.d.ts.map +1 -0
  87. package/dist/json/tvf.d.ts +14 -0
  88. package/dist/json/tvf.d.ts.map +1 -0
  89. package/dist/json/types.d.ts +30 -0
  90. package/dist/json/types.d.ts.map +1 -0
  91. package/dist/lexer/tokenize.d.ts +17 -0
  92. package/dist/lexer/tokenize.d.ts.map +1 -0
  93. package/dist/parser/index.d.ts +5 -0
  94. package/dist/parser/index.d.ts.map +1 -0
  95. package/dist/parser/parser.d.ts +104 -0
  96. package/dist/parser/parser.d.ts.map +1 -0
  97. package/dist/planner/access.d.ts +43 -0
  98. package/dist/planner/access.d.ts.map +1 -0
  99. package/dist/planner/index.d.ts +4 -0
  100. package/dist/planner/index.d.ts.map +1 -0
  101. package/dist/runtime/clock.d.ts +6 -0
  102. package/dist/runtime/clock.d.ts.map +1 -0
  103. package/dist/runtime/index.d.ts +4 -0
  104. package/dist/runtime/index.d.ts.map +1 -0
  105. package/dist/runtime/options.d.ts +19 -0
  106. package/dist/runtime/options.d.ts.map +1 -0
  107. package/dist/runtime/prng.d.ts +20 -0
  108. package/dist/runtime/prng.d.ts.map +1 -0
  109. package/dist/schema/catalog.d.ts +15 -0
  110. package/dist/schema/catalog.d.ts.map +1 -0
  111. package/dist/serialization/codec.d.ts +12 -0
  112. package/dist/serialization/codec.d.ts.map +1 -0
  113. package/dist/serialization/index.d.ts +2 -0
  114. package/dist/serialization/index.d.ts.map +1 -0
  115. package/dist/storage/database-state.d.ts +86 -0
  116. package/dist/storage/database-state.d.ts.map +1 -0
  117. package/dist/storage/index.d.ts +7 -0
  118. package/dist/storage/index.d.ts.map +1 -0
  119. package/dist/storage/row.d.ts +11 -0
  120. package/dist/storage/row.d.ts.map +1 -0
  121. package/dist/storage/table.d.ts +90 -0
  122. package/dist/storage/table.d.ts.map +1 -0
  123. package/dist/transactions/manager.d.ts +20 -0
  124. package/dist/transactions/manager.d.ts.map +1 -0
  125. package/dist/types/collation.d.ts +5 -0
  126. package/dist/types/collation.d.ts.map +1 -0
  127. package/dist/types/value.d.ts +52 -0
  128. package/dist/types/value.d.ts.map +1 -0
  129. package/dist/vtable/fts/options.d.ts +35 -0
  130. package/dist/vtable/fts/options.d.ts.map +1 -0
  131. package/dist/vtable/fts/porter.d.ts +3 -0
  132. package/dist/vtable/fts/porter.d.ts.map +1 -0
  133. package/dist/vtable/fts/query.d.ts +40 -0
  134. package/dist/vtable/fts/query.d.ts.map +1 -0
  135. package/dist/vtable/fts/table.d.ts +80 -0
  136. package/dist/vtable/fts/table.d.ts.map +1 -0
  137. package/dist/vtable/fts/tokenize.d.ts +21 -0
  138. package/dist/vtable/fts/tokenize.d.ts.map +1 -0
  139. package/dist/vtable/fts5.d.ts +2 -0
  140. package/dist/vtable/fts5.d.ts.map +1 -0
  141. package/dist/vtable/index.d.ts +3 -0
  142. package/dist/vtable/index.d.ts.map +1 -0
  143. package/dist/vtable/modules.d.ts +66 -0
  144. package/dist/vtable/modules.d.ts.map +1 -0
  145. package/package.json +107 -0
@@ -0,0 +1,62 @@
1
+ import type { SelectStmt } from "../ast/nodes.ts";
2
+ import type { EvalContext } from "../expressions/context.ts";
3
+ import { type FunctionRegistry } from "../functions/registry.ts";
4
+ import type { DatabaseState } from "../storage/database-state.ts";
5
+ import type { Rowid } from "../storage/row.ts";
6
+ import type { TransactionManager } from "../transactions/manager.ts";
7
+ import type { SqlValue } from "../types/value.ts";
8
+ import { type Affinity } from "../types/value.ts";
9
+ import type { ResultSet } from "./result.ts";
10
+ export interface Cell {
11
+ table: string | null;
12
+ tableLower?: string | null;
13
+ name: string;
14
+ nameLower?: string;
15
+ value: SqlValue;
16
+ affinity?: Affinity;
17
+ collate?: string | null;
18
+ /** Right-hand duplicate of a column merged by JOIN ... USING. */
19
+ hiddenByUsing?: boolean;
20
+ }
21
+ export declare function makeCell(table: string | null, name: string, value: SqlValue, extra?: Omit<Partial<Cell>, "table" | "name" | "value" | "tableLower" | "nameLower">): Cell;
22
+ export interface ScopeRow {
23
+ cells: Cell[];
24
+ rowid?: Rowid;
25
+ /** Output name of the rowid pseudo-column (INTEGER PRIMARY KEY alias when present). */
26
+ rowidName?: string;
27
+ sourceTable?: string;
28
+ /** Set when WHERE MATCH succeeds for this row. */
29
+ ftsMatch?: import("../vtable/fts5.ts").FtsMatchCursor | null;
30
+ }
31
+ export type SelectRunner = (stmt: SelectStmt, env: ExecutionEnv, parent?: EvalContext) => ResultSet;
32
+ export interface ExecutionHooks {
33
+ now?: () => Date;
34
+ random?: () => bigint;
35
+ /** Raw xorshift64* output for `randomblob`. */
36
+ randomU64?: () => bigint;
37
+ }
38
+ export declare class ExecutionEnv {
39
+ readonly state: DatabaseState;
40
+ readonly transactions: TransactionManager;
41
+ readonly functions: FunctionRegistry;
42
+ readonly positional: SqlValue[];
43
+ readonly named: Map<string, SqlValue>;
44
+ readonly ctes: Map<string, ResultSet>;
45
+ readonly hooks: ExecutionHooks;
46
+ selectRunner?: SelectRunner;
47
+ /** Nesting depth while executing trigger programs. */
48
+ triggerDepth: number;
49
+ /** OLD/NEW column scope for the active trigger program. */
50
+ triggerScope: ScopeRow | null;
51
+ /** Cap SELECT output rows (used by Statement.get). */
52
+ maxRows: number;
53
+ includeNamedRows: boolean;
54
+ includeValues: boolean;
55
+ constructor(state: DatabaseState, transactions: TransactionManager, params?: readonly unknown[], functions?: FunctionRegistry, hooks?: ExecutionHooks);
56
+ reset(params: readonly unknown[]): void;
57
+ getBoundParameter(name: string | number): SqlValue;
58
+ setNamed(name: string, value: unknown): void;
59
+ createEvalContext(row?: ScopeRow | null, parent?: EvalContext): EvalContext;
60
+ }
61
+ export declare function toSqlValue(value: unknown): SqlValue;
62
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","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AE,SAAS,OAAO,EAAE,GAAG,IAAI;IAYvC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ;IAclD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAI5C,iBAAiB,CAAC,GAAG,GAAE,QAAQ,GAAG,IAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW;CAiHlF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAUnD"}
@@ -0,0 +1,5 @@
1
+ import type { Statement } from "../ast/nodes.ts";
2
+ import type { ExecutionEnv } from "./env.ts";
3
+ import { type ResultSet } from "./result.ts";
4
+ export declare function executeStatement(stmt: Statement, env: ExecutionEnv): ResultSet;
5
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/executor/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAYjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAe,KAAK,SAAS,EAAkB,MAAM,aAAa,CAAC;AAK1E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,CAyE9E"}
@@ -0,0 +1,5 @@
1
+ import type { Expr } from "../ast/nodes.ts";
2
+ import type { ExecutionEnv } from "./env.ts";
3
+ import { type ResultSet } from "./result.ts";
4
+ export declare function executePragma(name: string, expr: Expr | null, env: ExecutionEnv): ResultSet;
5
+ //# sourceMappingURL=pragma.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pragma.d.ts","sourceRoot":"","sources":["../../src/executor/pragma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAe,KAAK,SAAS,EAAkB,MAAM,aAAa,CAAC;AAE1E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,CAwB3F"}
@@ -0,0 +1,18 @@
1
+ import { type SqlValue } from "../types/value.ts";
2
+ export interface ResultSet {
3
+ columns: string[];
4
+ rows: Record<string, SqlValue>[];
5
+ /** Positional rows preserve duplicate result-column names for internal use. */
6
+ values?: SqlValue[][];
7
+ changes: number;
8
+ lastInsertRowid: number | bigint;
9
+ }
10
+ export declare function emptyResult(changes?: number, lastInsertRowid?: number | bigint): ResultSet;
11
+ /** Export engine values to the public JS surface (SqlReal → number, SqlJsonText → string). */
12
+ export declare function exportSqlValue(value: SqlValue): SqlValue;
13
+ export declare function valuesToResult(columns: string[], values: SqlValue[][], changes?: number, lastInsertRowid?: number | bigint, options?: {
14
+ named?: boolean;
15
+ keepValues?: boolean;
16
+ }): ResultSet;
17
+ export declare function resultValues(result: ResultSet): SqlValue[][];
18
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/executor/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;IACjC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,OAAO,SAAI,EAAE,eAAe,GAAE,MAAM,GAAG,MAAU,GAAG,SAAS,CAExF;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAIxD;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,QAAQ,EAAE,EAAE,EACpB,OAAO,SAAI,EACX,eAAe,GAAE,MAAM,GAAG,MAAU,EACpC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAClD,SAAS,CAkBX;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,EAAE,EAAE,CAK5D"}
@@ -0,0 +1,7 @@
1
+ import type { FromItem, SelectStmt } from "../ast/nodes.ts";
2
+ import type { EvalContext } from "../expressions/context.ts";
3
+ import type { ExecutionEnv, ScopeRow } from "./env.ts";
4
+ import { type ResultSet } from "./result.ts";
5
+ export declare function executeSelect(stmt: SelectStmt, env: ExecutionEnv, parent?: EvalContext): ResultSet;
6
+ export declare function scanFrom(item: FromItem, env: ExecutionEnv, parent?: EvalContext): ScopeRow[];
7
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/executor/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,QAAQ,EAGR,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAoB7D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,aAAa,CAAC;AAY3E,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CA+DlG;AAyJD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,QAAQ,EAAE,CAwP5F"}
@@ -0,0 +1,10 @@
1
+ import type { SelectStmt } from "../ast/nodes.ts";
2
+ import type { ExecutionEnv } from "./env.ts";
3
+ import { type ResultSet } from "./result.ts";
4
+ /**
5
+ * Tight path for `SELECT cols FROM table WHERE col = ?` (no join/group/order).
6
+ * Skips ScopeRow / evalExpr and honors maxRows during the scan.
7
+ */
8
+ export declare function tryExecuteSimpleSelect(stmt: SelectStmt, env: ExecutionEnv): ResultSet | null;
9
+ export declare function tryExecuteSimpleJoin(stmt: SelectStmt, env: ExecutionEnv): ResultSet | null;
10
+ //# sourceMappingURL=simple-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-select.d.ts","sourceRoot":"","sources":["../../src/executor/simple-select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,aAAa,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAiG5F;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CA0E1F"}
@@ -0,0 +1,12 @@
1
+ import type { CreateTriggerStmt, DropTriggerStmt } from "../ast/nodes.ts";
2
+ import type { Row } from "../storage/row.ts";
3
+ import type { Table } from "../storage/table.ts";
4
+ import { type SqlValue } from "../types/value.ts";
5
+ import type { ExecutionEnv } from "./env.ts";
6
+ import { type ResultSet } from "./result.ts";
7
+ export declare function executeCreateTrigger(stmt: CreateTriggerStmt, env: ExecutionEnv): ResultSet;
8
+ export declare function executeDropTrigger(stmt: DropTriggerStmt, env: ExecutionEnv): ResultSet;
9
+ export declare function fireInsertTriggers(timing: "BEFORE" | "AFTER" | "INSTEAD", table: Table, values: Map<string, SqlValue>, oldRow: Row | null, env: ExecutionEnv): "ok" | "ignore";
10
+ export declare function fireUpdateTriggers(timing: "BEFORE" | "AFTER", table: Table, oldRow: Row, newValues: Map<string, SqlValue>, updatedColumns: Set<string>, env: ExecutionEnv): "ok" | "ignore";
11
+ export declare function fireDeleteTriggers(timing: "BEFORE" | "AFTER", table: Table, oldRow: Row, env: ExecutionEnv): "ok" | "ignore";
12
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/executor/triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAa,MAAM,iBAAiB,CAAC;AAKrF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAI1D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,CAiC1F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,CAGtF;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,EACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC7B,MAAM,EAAE,GAAG,GAAG,IAAI,EAClB,GAAG,EAAE,YAAY,GAChB,IAAI,GAAG,QAAQ,CAEjB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAC1B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAChC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,EAC3B,GAAG,EAAE,YAAY,GAChB,IAAI,GAAG,QAAQ,CAEjB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAC1B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,GAAG,EACX,GAAG,EAAE,YAAY,GAChB,IAAI,GAAG,QAAQ,CAEjB"}
@@ -0,0 +1,13 @@
1
+ import type { CreateVirtualTableStmt } from "../ast/nodes.ts";
2
+ import type { SqlValue } from "../types/value.ts";
3
+ import type { Fts5VirtualTable } from "../vtable/fts5.ts";
4
+ import type { ExecutionEnv } from "./env.ts";
5
+ import { type ResultSet } from "./result.ts";
6
+ export declare function executeCreateVirtualTable(stmt: CreateVirtualTableStmt, env: ExecutionEnv): ResultSet;
7
+ export declare function executeFtsInsert(table: Fts5VirtualTable, columnNames: string[], sourceRows: SqlValue[][], env: ExecutionEnv): {
8
+ changes: number;
9
+ lastInsertRowid: number | bigint;
10
+ };
11
+ export declare function executeFtsUpdate(table: Fts5VirtualTable, updates: Map<string, SqlValue>, rowids: Iterable<number | bigint>): number;
12
+ export declare function executeFtsDelete(table: Fts5VirtualTable, rowids: Iterable<number | bigint>): number;
13
+ //# sourceMappingURL=vtable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vtable.d.ts","sourceRoot":"","sources":["../../src/executor/vtable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,EAAE,YAAY,GAAG,SAAS,CAIpG;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,UAAU,EAAE,QAAQ,EAAE,EAAE,EACxB,GAAG,EAAE,YAAY,GAChB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAgCvD;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAChC,MAAM,CAOR;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAOnG"}
@@ -0,0 +1,28 @@
1
+ import type { SelectStmt } from "../ast/nodes.ts";
2
+ import type { FunctionContext, FunctionRegistry } from "../functions/registry.ts";
3
+ import type { SqlValue, StorageClass } from "../types/value.ts";
4
+ import type { FtsMatchCursor } from "../vtable/fts5.ts";
5
+ export interface EvalContext {
6
+ resolveColumn(table: string | null, name: string): SqlValue;
7
+ resolveStorageClass?(table: string | null, name: string): StorageClass;
8
+ /** Declared column collation when available (for inheritance). */
9
+ resolveCollation?(table: string | null, name: string): string | null;
10
+ getParameter(name: string | number): SqlValue;
11
+ /** Execute a scalar, IN, or EXISTS subquery. */
12
+ executeSelect?(select: SelectStmt): {
13
+ columns: string[];
14
+ rows: SqlValue[][];
15
+ };
16
+ /** Evaluate FTS MATCH against the current row when available. */
17
+ matchFts?(table: string | null, column: string, query: string): boolean;
18
+ /** Active FTS MATCH cursor for auxiliary functions (bm25/highlight/snippet). */
19
+ ftsMatch?: FtsMatchCursor | null;
20
+ /** Context used to resolve correlated column references. */
21
+ /** When set, RAISE() is allowed in expression evaluation. */
22
+ raise?: (action: "IGNORE" | "ABORT" | "FAIL" | "ROLLBACK", message?: string) => never;
23
+ parent?: EvalContext;
24
+ /** Optional per-database function registry and database hooks. */
25
+ functions?: FunctionRegistry;
26
+ functionContext?: FunctionContext;
27
+ }
28
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/expressions/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5D,mBAAmB,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IACvE,kEAAkE;IAClE,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC9C,gDAAgD;IAChD,aAAa,CAAC,CAAC,MAAM,EAAE,UAAU,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAA;KAAE,CAAC;IAC9E,iEAAiE;IACjE,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxE,gFAAgF;IAChF,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,4DAA4D;IAC5D,6DAA6D;IAC7D,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;IACtF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
@@ -0,0 +1,5 @@
1
+ import type { Expr } from "../ast/nodes.ts";
2
+ import { type SqlValue } from "../types/value.ts";
3
+ import type { EvalContext } from "./context.ts";
4
+ export declare function evalExpr(expr: Expr, ctx: EvalContext): SqlValue;
5
+ //# sourceMappingURL=eval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/expressions/eval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,IAAI,EAAc,MAAM,iBAAiB,CAAC;AAMlE,OAAO,EAML,KAAK,QAAQ,EAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA+VhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,GAAG,QAAQ,CAkI/D"}
@@ -0,0 +1,4 @@
1
+ export type { EvalContext } from "./context.ts";
2
+ export { evalExpr } from "./eval.ts";
3
+ export { globMatch, likeMatch } from "./like.ts";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expressions/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** SQLite LIKE matching. ASCII letters are case-insensitive. */
2
+ export declare function likeMatch(text: string, pattern: string, escape?: string | null): boolean;
3
+ /** SQLite GLOB matching. GLOB is case-sensitive and uses Unix wildcards. */
4
+ export declare function globMatch(text: string, pattern: string): boolean;
5
+ //# sourceMappingURL=like.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"like.d.ts","sourceRoot":"","sources":["../../src/expressions/like.ts"],"names":[],"mappings":"AAaA,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAqB9F;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CA2BhE"}
@@ -0,0 +1,9 @@
1
+ import { type SqlValue } from "../types/value.ts";
2
+ export interface AggregateAccumulator {
3
+ step(args: SqlValue[]): void;
4
+ finalize(): SqlValue;
5
+ }
6
+ export type AggregateFactory = () => AggregateAccumulator;
7
+ export declare const aggregateFunctions: Readonly<Record<string, AggregateFactory>>;
8
+ export declare function createAggregate(name: string): AggregateAccumulator | undefined;
9
+ //# sourceMappingURL=aggregate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/functions/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,QAAQ,EAAc,MAAM,mBAAmB,CAAC;AAE1F,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC7B,QAAQ,IAAI,QAAQ,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,oBAAoB,CAAC;AA8D1D,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CASzE,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE9E"}
@@ -0,0 +1,3 @@
1
+ import type { ScalarFunction } from "./registry.ts";
2
+ export declare const dateTimeFunctions: Readonly<Record<string, ScalarFunction>>;
3
+ //# sourceMappingURL=datetime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../src/functions/datetime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,eAAe,CAAC;AA0IrE,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA2DtE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ScalarFunction } from "./registry.ts";
2
+ /**
3
+ * FTS auxiliary functions. When used with a MATCH cursor they compute real
4
+ * values; without MATCH they mirror SQLite's empty-cursor defaults.
5
+ */
6
+ export declare const ftsAuxFunctions: Readonly<Record<string, ScalarFunction>>;
7
+ export declare const rtreeAuxFunctions: Readonly<Record<string, ScalarFunction>>;
8
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/functions/extensions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,eAAe,CAAC;AAqCrE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAmDpE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CActE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { type AggregateAccumulator, type AggregateFactory, aggregateFunctions, createAggregate, } from "./aggregate.ts";
2
+ export { dateTimeFunctions } from "./datetime.ts";
3
+ export { jsonAggregateFunctions, jsonArrow, jsonScalarFunctions } from "./json.ts";
4
+ export { mathFunctions } from "./math.ts";
5
+ export { defaultFunctionRegistry, type FunctionContext, FunctionRegistry, isAggregateName, lookupAggregate, lookupScalar, type ScalarFunction, } from "./registry.ts";
6
+ export { castSqlValue, getScalarFunctions, invokeScalar } from "./scalar.ts";
7
+ export { evaluateTableFunction, listTableValuedFunctions, } from "./table-valued.ts";
8
+ export { denseRank, firstValue, lag, lastValue, lead, nthValue, type PartitionRow, rank, rowNumber, windowFunctions, } from "./window.ts";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,KAAK,eAAe,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,UAAU,EACV,GAAG,EACH,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,KAAK,YAAY,EACjB,IAAI,EACJ,SAAS,EACT,eAAe,GAChB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type SqlValue } from "../types/value.ts";
2
+ import type { AggregateFactory } from "./aggregate.ts";
3
+ import type { ScalarFunction } from "./registry.ts";
4
+ export declare function jsonArrow(left: SqlValue, right: SqlValue, mode: "->" | "->>"): SqlValue;
5
+ export declare const jsonScalarFunctions: Readonly<Record<string, ScalarFunction>>;
6
+ export declare const jsonAggregateFunctions: Readonly<Record<string, AggregateFactory>>;
7
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/functions/json.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAgC,KAAK,QAAQ,EAAyB,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAwDpD,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,QAAQ,CAavF;AAED,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAoNxE,CAAC;AA8BF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAK7E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ScalarFunction } from "./registry.ts";
2
+ export declare const mathFunctions: Readonly<Record<string, ScalarFunction>>;
3
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/functions/math.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,eAAe,CAAC;AAyErE,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAoIlE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { SqlValue } from "../types/value.ts";
2
+ import { type AggregateAccumulator, type AggregateFactory } from "./aggregate.ts";
3
+ export interface FunctionContext {
4
+ changes?: () => number;
5
+ totalChanges?: () => number;
6
+ lastInsertRowid?: () => number | bigint;
7
+ /** Injectable clock — defaults to a fixed instant on Database. */
8
+ now?: () => Date;
9
+ /** Injectable SQLite `random()` source — defaults to a seeded PRNG on Database. */
10
+ random?: () => bigint;
11
+ /** Raw unsigned 64-bit PRNG draws for `randomblob`. */
12
+ randomU64?: () => bigint;
13
+ /** Active FTS MATCH cursor when evaluating projections with MATCH in WHERE. */
14
+ ftsMatch?: import("../vtable/fts5.ts").FtsMatchCursor | null;
15
+ /** Current rowid for FTS aux defaults when MATCH is absent. */
16
+ ftsRowid?: import("../storage/row.ts").Rowid;
17
+ /** Source FTS table name for the current scan row. */
18
+ ftsSourceTable?: string;
19
+ /** Resolve FTS table by name for aux functions. */
20
+ getFtsTable?: (name: string) => import("../vtable/fts5.ts").Fts5VirtualTable | null;
21
+ }
22
+ export type ScalarFunction = (args: SqlValue[], context: FunctionContext) => SqlValue;
23
+ export declare class FunctionRegistry {
24
+ private readonly scalars;
25
+ private readonly aggregates;
26
+ constructor();
27
+ registerScalar(name: string, fn: ScalarFunction): void;
28
+ registerAggregate(name: string, factory: AggregateFactory): void;
29
+ lookupScalar(name: string): ScalarFunction | undefined;
30
+ lookupAggregate(name: string): AggregateFactory | undefined;
31
+ createAggregate(name: string): AggregateAccumulator | undefined;
32
+ isAggregateName(name: string): boolean;
33
+ }
34
+ export declare const defaultFunctionRegistry: FunctionRegistry;
35
+ export declare function lookupScalar(name: string): ScalarFunction | undefined;
36
+ export declare function lookupAggregate(name: string): AggregateFactory | undefined;
37
+ export declare function isAggregateName(name: string): boolean;
38
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/functions/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,gBAAgB,EAAsB,MAAM,gBAAgB,CAAC;AAOtG,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC;IACxC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IACtB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,mBAAmB,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7D,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,mBAAmB,EAAE,KAAK,CAAC;IAC7C,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,mBAAmB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACrF;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,eAAe,KAAK,QAAQ,CAAC;AAEtF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuC;;IAalE,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,IAAI;IAItD,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAIhE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAItD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI3D,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAI/D,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,eAAO,MAAM,uBAAuB,kBAAyB,CAAC;AAE9D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAErE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE1E;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD"}
@@ -0,0 +1,10 @@
1
+ import { type SqlValue, storageClassOf } from "../types/value.ts";
2
+ import type { FunctionContext, ScalarFunction } from "./registry.ts";
3
+ /** Match bun:sqlite / SQLite 3.51.0 for drop-in parity. */
4
+ export declare const SQLITE_MEM_VERSION = "3.51.0";
5
+ export declare const SQLITE_MEM_SOURCE_ID = "2025-06-12 13:14:41 f0ca7bba1c5e232e5d279fad6338121ab55af0c8c68c84cdfb18ba5114dcaapl";
6
+ export declare function castSqlValue(value: SqlValue, typeName: string): SqlValue;
7
+ export declare function getScalarFunctions(): Readonly<Record<string, ScalarFunction>>;
8
+ export declare function invokeScalar(name: string, args: SqlValue[], context?: FunctionContext): SqlValue;
9
+ export { storageClassOf };
10
+ //# sourceMappingURL=scalar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../../src/functions/scalar.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,QAAQ,EACb,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAErE,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,oBAAoB,yFACuD,CAAC;AAsBzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAUxE;AAkfD,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAE7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAIpG;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Expr } from "../ast/nodes.ts";
2
+ import type { ExecutionEnv, ScopeRow } from "../executor/env.ts";
3
+ export interface TableValuedResult {
4
+ columns: string[];
5
+ rows: ScopeRow[];
6
+ }
7
+ export declare function evaluateTableFunction(name: string, args: Expr[], alias: string | null, env: ExecutionEnv, scope?: ScopeRow | null, parent?: import("../expressions/context.ts").EvalContext): TableValuedResult;
8
+ export declare function listTableValuedFunctions(): string[];
9
+ //# sourceMappingURL=table-valued.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-valued.d.ts","sourceRoot":"","sources":["../../src/functions/table-valued.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAKjE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB;AA4ED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EAAE,EACZ,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,GAAG,EAAE,YAAY,EACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,EACvB,MAAM,CAAC,EAAE,OAAO,2BAA2B,EAAE,WAAW,GACvD,iBAAiB,CAKnB;AAED,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAEnD"}
@@ -0,0 +1,24 @@
1
+ import { type SqlValue } from "../types/value.ts";
2
+ export type PartitionRow = SqlValue[];
3
+ export declare function rowNumber(_partition: PartitionRow[], index: number): number;
4
+ export declare function rank(partition: PartitionRow[], index: number, orderKeys?: PartitionRow[]): number;
5
+ export declare function denseRank(partition: PartitionRow[], index: number, orderKeys?: PartitionRow[]): number;
6
+ export declare function lag(partition: PartitionRow[], index: number, valueIndex?: number, offset?: number, defaultValue?: SqlValue): SqlValue;
7
+ export declare function lead(partition: PartitionRow[], index: number, valueIndex?: number, offset?: number, defaultValue?: SqlValue): SqlValue;
8
+ export declare function firstValue(partition: PartitionRow[], valueIndex?: number, frameStart?: number): SqlValue;
9
+ export declare function lastValue(partition: PartitionRow[], valueIndex?: number, frameEnd?: number): SqlValue;
10
+ export declare function nthValue(partition: PartitionRow[], n: number, valueIndex?: number, frameStart?: number): SqlValue;
11
+ export declare const windowFunctions: {
12
+ readonly row_number: typeof rowNumber;
13
+ readonly rank: typeof rank;
14
+ readonly dense_rank: typeof denseRank;
15
+ readonly lag: typeof lag;
16
+ readonly lead: typeof lead;
17
+ readonly first_value: typeof firstValue;
18
+ readonly last_value: typeof lastValue;
19
+ readonly nth_value: typeof nthValue;
20
+ readonly ntile: () => number;
21
+ readonly cume_dist: () => number;
22
+ readonly percent_rank: () => number;
23
+ };
24
+ //# sourceMappingURL=window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/functions/window.ts"],"names":[],"mappings":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+ export { SqliteError } from "./errors/index.ts";
4
+ export type { ResultSet } from "./executor/result.ts";
5
+ export { evalExpr } from "./expressions/eval.ts";
6
+ export { globMatch, likeMatch } from "./expressions/like.ts";
7
+ export { tokenize } from "./lexer/tokenize.ts";
8
+ export { parse } from "./parser/index.ts";
9
+ export { type Clock, DEFAULT_DATABASE_SEED, DEFAULT_NOW, deriveSeed, fixedClock, Prng, resolveClock, } from "./runtime/index.ts";
10
+ export { type DecodedSnapshot, decodeDatabaseState, encodeDatabaseState, type SnapshotRuntime, } from "./serialization/index.ts";
11
+ export { type Affinity, affinityFromTypeName, applyAffinity, asSqlReal, canonicalizeNumber, cloneSqlValue, coerceToNumber, compareSql, isSqlReal, isTruthySql, SqlReal, type SqlValue, type StorageClass, sqlValueEquals, storageClassOf, toInteger, typeofSql, utf8Decode, utf8Encode, } from "./types/value.ts";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACL,KAAK,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,UAAU,EACV,IAAI,EACJ,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,eAAe,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,QAAQ,EACb,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,UAAU,EACV,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,cAAc,EACd,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,kBAAkB,CAAC"}