@crvouga/sqlite-mem 0.1.0 → 0.2.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.
- package/AGENTS.md +156 -0
- package/COMPATIBILITY-AUDIT.md +7 -9
- package/COMPATIBILITY.md +4 -3
- package/README.md +152 -14
- package/compat/coverage.json +797 -512
- package/compat/requirements.json +1 -1
- package/dist/api/database.d.ts +90 -12
- package/dist/api/statement.d.ts +74 -17
- package/dist/ast/nodes.d.ts +11 -2
- package/dist/constraints/check.d.ts +5 -6
- package/dist/errors/index.d.ts +25 -1
- package/dist/executor/attach.d.ts +3 -4
- package/dist/executor/ddl.d.ts +3 -4
- package/dist/executor/dml.d.ts +4 -4
- package/dist/executor/env.d.ts +9 -11
- package/dist/executor/execute.d.ts +3 -4
- package/dist/executor/pragma.d.ts +3 -4
- package/dist/executor/result.d.ts +9 -5
- package/dist/executor/select.d.ts +4 -5
- package/dist/executor/simple-select.d.ts +3 -4
- package/dist/executor/triggers.d.ts +6 -7
- package/dist/executor/vtable.d.ts +5 -6
- package/dist/expressions/context.d.ts +5 -5
- package/dist/expressions/equals.d.ts +3 -0
- package/dist/expressions/eval.d.ts +9 -4
- package/dist/expressions/index.d.ts +3 -4
- package/dist/expressions/like.d.ts +13 -3
- package/dist/functions/aggregate.d.ts +1 -2
- package/dist/functions/datetime.d.ts +1 -2
- package/dist/functions/extensions.d.ts +1 -2
- package/dist/functions/index.d.ts +8 -9
- package/dist/functions/json.d.ts +3 -4
- package/dist/functions/math.d.ts +1 -2
- package/dist/functions/registry.d.ts +5 -6
- package/dist/functions/scalar.d.ts +2 -3
- package/dist/functions/table-valued.d.ts +3 -4
- package/dist/functions/window.d.ts +1 -2
- package/dist/index.d.ts +33 -12
- package/dist/index.js +900 -120
- package/dist/index.js.map +4 -4
- package/dist/indexes/index.d.ts +17 -4
- package/dist/json/index.d.ts +7 -8
- package/dist/json/jsonb.d.ts +1 -2
- package/dist/json/ops.d.ts +8 -3
- package/dist/json/parse.d.ts +2 -3
- package/dist/json/path.d.ts +1 -2
- package/dist/json/stringify.d.ts +1 -2
- package/dist/json/tvf.d.ts +1 -2
- package/dist/json/types.d.ts +0 -1
- package/dist/lexer/tokenize.d.ts +7 -1
- package/dist/parser/index.d.ts +11 -5
- package/dist/parser/parser.d.ts +3 -3
- package/dist/planner/access.d.ts +13 -6
- package/dist/planner/index.d.ts +1 -2
- package/dist/runtime/clock.d.ts +8 -2
- package/dist/runtime/index.d.ts +3 -4
- package/dist/runtime/options.d.ts +5 -4
- package/dist/runtime/prng.d.ts +12 -1
- package/dist/schema/catalog.d.ts +2 -3
- package/dist/serialization/codec.d.ts +17 -2
- package/dist/serialization/index.d.ts +1 -2
- package/dist/storage/database-state.d.ts +16 -8
- package/dist/storage/index.d.ts +6 -7
- package/dist/storage/row.d.ts +1 -2
- package/dist/storage/table.d.ts +8 -4
- package/dist/transactions/manager.d.ts +2 -3
- package/dist/types/collation.d.ts +1 -2
- package/dist/types/strict.d.ts +6 -0
- package/dist/types/value.d.ts +30 -2
- package/dist/vtable/fts/options.d.ts +0 -1
- package/dist/vtable/fts/porter.d.ts +0 -1
- package/dist/vtable/fts/query.d.ts +0 -1
- package/dist/vtable/fts/table.d.ts +5 -6
- package/dist/vtable/fts/tokenize.d.ts +1 -2
- package/dist/vtable/fts5.d.ts +1 -2
- package/dist/vtable/index.d.ts +2 -3
- package/dist/vtable/modules.d.ts +2 -3
- package/package.json +14 -7
- package/compat/gate-report.json +0 -424
- package/dist/api/database.d.ts.map +0 -1
- package/dist/api/statement.d.ts.map +0 -1
- package/dist/ast/nodes.d.ts.map +0 -1
- package/dist/constraints/check.d.ts.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/executor/attach.d.ts.map +0 -1
- package/dist/executor/ddl.d.ts.map +0 -1
- package/dist/executor/dml.d.ts.map +0 -1
- package/dist/executor/env.d.ts.map +0 -1
- package/dist/executor/execute.d.ts.map +0 -1
- package/dist/executor/pragma.d.ts.map +0 -1
- package/dist/executor/result.d.ts.map +0 -1
- package/dist/executor/select.d.ts.map +0 -1
- package/dist/executor/simple-select.d.ts.map +0 -1
- package/dist/executor/triggers.d.ts.map +0 -1
- package/dist/executor/vtable.d.ts.map +0 -1
- package/dist/expressions/context.d.ts.map +0 -1
- package/dist/expressions/eval.d.ts.map +0 -1
- package/dist/expressions/index.d.ts.map +0 -1
- package/dist/expressions/like.d.ts.map +0 -1
- package/dist/functions/aggregate.d.ts.map +0 -1
- package/dist/functions/datetime.d.ts.map +0 -1
- package/dist/functions/extensions.d.ts.map +0 -1
- package/dist/functions/index.d.ts.map +0 -1
- package/dist/functions/json.d.ts.map +0 -1
- package/dist/functions/math.d.ts.map +0 -1
- package/dist/functions/registry.d.ts.map +0 -1
- package/dist/functions/scalar.d.ts.map +0 -1
- package/dist/functions/table-valued.d.ts.map +0 -1
- package/dist/functions/window.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/indexes/index.d.ts.map +0 -1
- package/dist/json/index.d.ts.map +0 -1
- package/dist/json/jsonb.d.ts.map +0 -1
- package/dist/json/ops.d.ts.map +0 -1
- package/dist/json/parse.d.ts.map +0 -1
- package/dist/json/path.d.ts.map +0 -1
- package/dist/json/stringify.d.ts.map +0 -1
- package/dist/json/tvf.d.ts.map +0 -1
- package/dist/json/types.d.ts.map +0 -1
- package/dist/lexer/tokenize.d.ts.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/parser.d.ts.map +0 -1
- package/dist/planner/access.d.ts.map +0 -1
- package/dist/planner/index.d.ts.map +0 -1
- package/dist/runtime/clock.d.ts.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/options.d.ts.map +0 -1
- package/dist/runtime/prng.d.ts.map +0 -1
- package/dist/schema/catalog.d.ts.map +0 -1
- package/dist/serialization/codec.d.ts.map +0 -1
- package/dist/serialization/index.d.ts.map +0 -1
- package/dist/storage/database-state.d.ts.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/row.d.ts.map +0 -1
- package/dist/storage/table.d.ts.map +0 -1
- package/dist/transactions/manager.d.ts.map +0 -1
- package/dist/types/collation.d.ts.map +0 -1
- package/dist/types/value.d.ts.map +0 -1
- package/dist/vtable/fts/options.d.ts.map +0 -1
- package/dist/vtable/fts/porter.d.ts.map +0 -1
- package/dist/vtable/fts/query.d.ts.map +0 -1
- package/dist/vtable/fts/table.d.ts.map +0 -1
- package/dist/vtable/fts/tokenize.d.ts.map +0 -1
- package/dist/vtable/fts5.d.ts.map +0 -1
- package/dist/vtable/index.d.ts.map +0 -1
- package/dist/vtable/modules.d.ts.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { type AggregateAccumulator, type AggregateFactory, aggregateFunctions, createAggregate, } from "./aggregate.
|
|
2
|
-
export { dateTimeFunctions } from "./datetime.
|
|
3
|
-
export { jsonAggregateFunctions, jsonArrow, jsonScalarFunctions } from "./json.
|
|
4
|
-
export { mathFunctions } from "./math.
|
|
5
|
-
export { defaultFunctionRegistry, type FunctionContext, FunctionRegistry, isAggregateName, lookupAggregate, lookupScalar, type ScalarFunction, } from "./registry.
|
|
6
|
-
export { castSqlValue, getScalarFunctions, invokeScalar } from "./scalar.
|
|
7
|
-
export { evaluateTableFunction, listTableValuedFunctions, } from "./table-valued.
|
|
8
|
-
export { denseRank, firstValue, lag, lastValue, lead, nthValue, type PartitionRow, rank, rowNumber, windowFunctions, } from "./window.
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { type AggregateAccumulator, type AggregateFactory, aggregateFunctions, createAggregate, } from "./aggregate.js";
|
|
2
|
+
export { dateTimeFunctions } from "./datetime.js";
|
|
3
|
+
export { jsonAggregateFunctions, jsonArrow, jsonScalarFunctions } from "./json.js";
|
|
4
|
+
export { mathFunctions } from "./math.js";
|
|
5
|
+
export { defaultFunctionRegistry, type FunctionContext, FunctionRegistry, isAggregateName, lookupAggregate, lookupScalar, type ScalarFunction, } from "./registry.js";
|
|
6
|
+
export { castSqlValue, getScalarFunctions, invokeScalar } from "./scalar.js";
|
|
7
|
+
export { evaluateTableFunction, listTableValuedFunctions, } from "./table-valued.js";
|
|
8
|
+
export { denseRank, firstValue, lag, lastValue, lead, nthValue, type PartitionRow, rank, rowNumber, windowFunctions, } from "./window.js";
|
package/dist/functions/json.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type SqlValue } from "../types/value.
|
|
2
|
-
import type { AggregateFactory } from "./aggregate.
|
|
3
|
-
import type { ScalarFunction } from "./registry.
|
|
1
|
+
import { type SqlValue } from "../types/value.js";
|
|
2
|
+
import type { AggregateFactory } from "./aggregate.js";
|
|
3
|
+
import type { ScalarFunction } from "./registry.js";
|
|
4
4
|
export declare function jsonArrow(left: SqlValue, right: SqlValue, mode: "->" | "->>"): SqlValue;
|
|
5
5
|
export declare const jsonScalarFunctions: Readonly<Record<string, ScalarFunction>>;
|
|
6
6
|
export declare const jsonAggregateFunctions: Readonly<Record<string, AggregateFactory>>;
|
|
7
|
-
//# sourceMappingURL=json.d.ts.map
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SqlValue } from "../types/value.
|
|
2
|
-
import { type AggregateAccumulator, type AggregateFactory } from "./aggregate.
|
|
1
|
+
import type { SqlValue } from "../types/value.js";
|
|
2
|
+
import { type AggregateAccumulator, type AggregateFactory } from "./aggregate.js";
|
|
3
3
|
export interface FunctionContext {
|
|
4
4
|
changes?: () => number;
|
|
5
5
|
totalChanges?: () => number;
|
|
@@ -11,13 +11,13 @@ export interface FunctionContext {
|
|
|
11
11
|
/** Raw unsigned 64-bit PRNG draws for `randomblob`. */
|
|
12
12
|
randomU64?: () => bigint;
|
|
13
13
|
/** Active FTS MATCH cursor when evaluating projections with MATCH in WHERE. */
|
|
14
|
-
ftsMatch?: import("../vtable/fts5.
|
|
14
|
+
ftsMatch?: import("../vtable/fts5.js").FtsMatchCursor | null;
|
|
15
15
|
/** Current rowid for FTS aux defaults when MATCH is absent. */
|
|
16
|
-
ftsRowid?: import("../storage/row.
|
|
16
|
+
ftsRowid?: import("../storage/row.js").Rowid;
|
|
17
17
|
/** Source FTS table name for the current scan row. */
|
|
18
18
|
ftsSourceTable?: string;
|
|
19
19
|
/** Resolve FTS table by name for aux functions. */
|
|
20
|
-
getFtsTable?: (name: string) => import("../vtable/fts5.
|
|
20
|
+
getFtsTable?: (name: string) => import("../vtable/fts5.js").Fts5VirtualTable | null;
|
|
21
21
|
}
|
|
22
22
|
export type ScalarFunction = (args: SqlValue[], context: FunctionContext) => SqlValue;
|
|
23
23
|
export declare class FunctionRegistry {
|
|
@@ -35,4 +35,3 @@ export declare const defaultFunctionRegistry: FunctionRegistry;
|
|
|
35
35
|
export declare function lookupScalar(name: string): ScalarFunction | undefined;
|
|
36
36
|
export declare function lookupAggregate(name: string): AggregateFactory | undefined;
|
|
37
37
|
export declare function isAggregateName(name: string): boolean;
|
|
38
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type SqlValue, storageClassOf } from "../types/value.
|
|
2
|
-
import type { FunctionContext, ScalarFunction } from "./registry.
|
|
1
|
+
import { type SqlValue, storageClassOf } from "../types/value.js";
|
|
2
|
+
import type { FunctionContext, ScalarFunction } from "./registry.js";
|
|
3
3
|
/** Match bun:sqlite / SQLite 3.51.0 for drop-in parity. */
|
|
4
4
|
export declare const SQLITE_MEM_VERSION = "3.51.0";
|
|
5
5
|
export declare const SQLITE_MEM_SOURCE_ID = "2025-06-12 13:14:41 f0ca7bba1c5e232e5d279fad6338121ab55af0c8c68c84cdfb18ba5114dcaapl";
|
|
@@ -7,4 +7,3 @@ export declare function castSqlValue(value: SqlValue, typeName: string): SqlValu
|
|
|
7
7
|
export declare function getScalarFunctions(): Readonly<Record<string, ScalarFunction>>;
|
|
8
8
|
export declare function invokeScalar(name: string, args: SqlValue[], context?: FunctionContext): SqlValue;
|
|
9
9
|
export { storageClassOf };
|
|
10
|
-
//# sourceMappingURL=scalar.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Expr } from "../ast/nodes.
|
|
2
|
-
import type { ExecutionEnv, ScopeRow } from "../executor/env.
|
|
1
|
+
import type { Expr } from "../ast/nodes.js";
|
|
2
|
+
import type { ExecutionEnv, ScopeRow } from "../executor/env.js";
|
|
3
3
|
export interface TableValuedResult {
|
|
4
4
|
columns: string[];
|
|
5
5
|
rows: ScopeRow[];
|
|
6
6
|
}
|
|
7
|
-
export declare function evaluateTableFunction(name: string, args: Expr[], alias: string | null, env: ExecutionEnv, scope?: ScopeRow | null, parent?: import("../expressions/context.
|
|
7
|
+
export declare function evaluateTableFunction(name: string, args: Expr[], alias: string | null, env: ExecutionEnv, scope?: ScopeRow | null, parent?: import("../expressions/context.js").EvalContext): TableValuedResult;
|
|
8
8
|
export declare function listTableValuedFunctions(): string[];
|
|
9
|
-
//# sourceMappingURL=table-valued.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SqlValue } from "../types/value.
|
|
1
|
+
import { type SqlValue } from "../types/value.js";
|
|
2
2
|
export type PartitionRow = SqlValue[];
|
|
3
3
|
export declare function rowNumber(_partition: PartitionRow[], index: number): number;
|
|
4
4
|
export declare function rank(partition: PartitionRow[], index: number, orderKeys?: PartitionRow[]): number;
|
|
@@ -21,4 +21,3 @@ export declare const windowFunctions: {
|
|
|
21
21
|
readonly cume_dist: () => number;
|
|
22
22
|
readonly percent_rank: () => number;
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=window.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Pure TypeScript in-memory SQLite. Import {@link Database} to get started.
|
|
4
|
+
*
|
|
5
|
+
* Deterministic by default (`random()` seed `1`, `'now'` = `2000-01-01T00:00:00.000Z`).
|
|
6
|
+
* Zero WASM, native bindings, or filesystem.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { Database } from "@crvouga/sqlite-mem";
|
|
11
|
+
*
|
|
12
|
+
* const db = new Database();
|
|
13
|
+
* db.exec("CREATE TABLE t (id INTEGER PRIMARY KEY, name TEXT)");
|
|
14
|
+
* db.exec("INSERT INTO t (name) VALUES (?)", ["Ada"]);
|
|
15
|
+
* const rows = db.query<{ id: number; name: string }>("SELECT * FROM t");
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export * from "./api/database.js";
|
|
21
|
+
export { Statement, type RunResult } from "./api/statement.js";
|
|
22
|
+
export type { Expr } from "./ast/nodes.js";
|
|
23
|
+
export { SqliteError, type ErrorCategory } from "./errors/index.js";
|
|
24
|
+
export type { ResultSet } from "./executor/result.js";
|
|
25
|
+
export type { EvalContext } from "./expressions/context.js";
|
|
26
|
+
export { evalExpr } from "./expressions/eval.js";
|
|
27
|
+
export { globMatch, likeMatch } from "./expressions/like.js";
|
|
28
|
+
export { tokenize, type Token, type TokenKind } from "./lexer/tokenize.js";
|
|
29
|
+
export { parse, type ParsedStatement } from "./parser/index.js";
|
|
30
|
+
export { type Clock, DEFAULT_DATABASE_SEED, DEFAULT_NOW, deriveSeed, fixedClock, Prng, resolveClock, } from "./runtime/index.js";
|
|
31
|
+
export { type DecodedSnapshot, decodeDatabaseState, encodeDatabaseState, type SnapshotRuntime, } from "./serialization/index.js";
|
|
32
|
+
export type { DatabaseState } from "./storage/database-state.js";
|
|
33
|
+
export { type Affinity, affinityFromTypeName, applyAffinity, asSqlJsonText, asSqlReal, type BindValue, canonicalizeNumber, cloneSqlValue, coerceToNumber, compareSql, isSqlJsonText, isSqlReal, isTruthySql, type QueryRow, type QueryValue, SqlJsonText, SqlReal, type SqlValue, type StorageClass, sqlValueEquals, storageClassOf, toInteger, typeofSql, utf8Decode, utf8Encode, } from "./types/value.js";
|