@minnowdb/core 0.6.9 → 0.7.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/dist/date-value.d.ts +5 -0
- package/dist/date-value.js +41 -0
- package/dist/engine/database.js +913 -54
- package/dist/engine/optimizer.js +446 -18
- package/dist/engine/point-read.d.ts +4 -2
- package/dist/engine/point-read.js +16 -6
- package/dist/engine/query.d.ts +39 -0
- package/dist/engine/query.js +811 -203
- package/dist/engine/sql-domains.d.ts +7 -1
- package/dist/engine/sql-domains.js +38 -1
- package/dist/engine/sql-functions.d.ts +11 -0
- package/dist/engine/sql-functions.js +1186 -0
- package/dist/engine/sql-semantics.d.ts +25 -4
- package/dist/engine/sql-semantics.js +134 -1
- package/dist/engine/vector.d.ts +7 -1
- package/dist/engine/vector.js +718 -124
- package/dist/plan/model.d.ts +3 -1
- package/dist/storage/types.js +44 -18
- package/package.json +1 -1
- package/postgres-feature-profile.json +15 -5
- package/sql-feature-matrix.json +252 -2
package/dist/engine/query.d.ts
CHANGED
|
@@ -40,6 +40,14 @@ export declare function isScalarFunctionName(name: AggregateName | ScalarFunctio
|
|
|
40
40
|
* SUBSTR count characters, not UTF-16 units, matching SQLite and PostgreSQL.
|
|
41
41
|
*/
|
|
42
42
|
export declare function scalarFunctionValue(name: Exclude<ScalarFunctionName, "COALESCE">, values: readonly unknown[]): unknown;
|
|
43
|
+
export type ScalarFunctionEvaluator = (values: readonly unknown[]) => unknown;
|
|
44
|
+
/**
|
|
45
|
+
* The evaluator for one function name, resolved once. A call site that keeps the evaluator
|
|
46
|
+
* skips the name dispatch on every row; the registry functions and the hottest built-ins get
|
|
47
|
+
* a closure of their own, everything else a closure over the general dispatch.
|
|
48
|
+
*/
|
|
49
|
+
export declare function scalarFunctionEvaluator(name: Exclude<ScalarFunctionName, "COALESCE">): ScalarFunctionEvaluator;
|
|
50
|
+
export declare function dateTruncValue(unit: unknown, value: unknown): Date | null;
|
|
43
51
|
/** The output column type of one window: rankings and most aggregates count, MIN/MAX carry. */
|
|
44
52
|
export declare function windowOutputType(window: WindowSpec, innerSchema: readonly SqlColumnSchema[]): SqlColumnType;
|
|
45
53
|
/** Logical domain carried or produced by a window result, when its physical type is not enough. */
|
|
@@ -56,6 +64,14 @@ interface CompileQueryOptions {
|
|
|
56
64
|
/** Set false to skip deterministic plan rewrites, for example to snapshot the raw plan. */
|
|
57
65
|
readonly optimize?: boolean;
|
|
58
66
|
}
|
|
67
|
+
/** One RETURNING item beyond a plain column: its statement text, output name, and the column it names when it is one. */
|
|
68
|
+
export interface ReturningItem {
|
|
69
|
+
sql: string;
|
|
70
|
+
alias: string;
|
|
71
|
+
expression: Expression;
|
|
72
|
+
/** The target column the item names, when it is a bare column reference. */
|
|
73
|
+
column?: string;
|
|
74
|
+
}
|
|
59
75
|
export declare function compileQuery(sql: string, options?: CompileQueryOptions): CompiledQuery;
|
|
60
76
|
/**
|
|
61
77
|
* One WHEN clause of a MERGE (F312). Branches are tried in order for each source row, and the
|
|
@@ -135,6 +151,11 @@ export type CompiledStatement = {
|
|
|
135
151
|
column: string;
|
|
136
152
|
/** The full PostgreSQL conflict target; `column` remains the scalar fast-path name. */
|
|
137
153
|
columns?: string[];
|
|
154
|
+
/**
|
|
155
|
+
* `ON CONFLICT DO NOTHING` with no target: the statement names no columns, and the
|
|
156
|
+
* table's unique key is resolved at execution, where the catalog is known.
|
|
157
|
+
*/
|
|
158
|
+
anyTarget?: true;
|
|
138
159
|
action: "nothing" | "replace" | "update";
|
|
139
160
|
/** Expressions evaluated against the stored target row and the proposed EXCLUDED row. */
|
|
140
161
|
assignments?: Array<{
|
|
@@ -145,10 +166,14 @@ export type CompiledStatement = {
|
|
|
145
166
|
where?: Expression;
|
|
146
167
|
};
|
|
147
168
|
returning?: string[] | "*";
|
|
169
|
+
/** RETURNING items that are not plain columns, evaluated over the affected rows. */
|
|
170
|
+
returningItems?: ReturningItem[];
|
|
148
171
|
parameterCount?: number;
|
|
149
172
|
} | {
|
|
150
173
|
kind: "update";
|
|
151
174
|
table: string;
|
|
175
|
+
/** `UPDATE t AS u`: the name the assignments, predicates, and RETURNING may qualify by. */
|
|
176
|
+
alias?: string;
|
|
152
177
|
assignments: Array<{
|
|
153
178
|
column: string;
|
|
154
179
|
expression: Expression;
|
|
@@ -159,16 +184,21 @@ export type CompiledStatement = {
|
|
|
159
184
|
right: Expression;
|
|
160
185
|
}>;
|
|
161
186
|
returning?: string[] | "*";
|
|
187
|
+
/** RETURNING items that are not plain columns, evaluated over the affected rows. */
|
|
188
|
+
returningItems?: ReturningItem[];
|
|
162
189
|
parameterCount?: number;
|
|
163
190
|
} | {
|
|
164
191
|
kind: "delete";
|
|
165
192
|
table: string;
|
|
193
|
+
alias?: string;
|
|
166
194
|
predicates: Array<{
|
|
167
195
|
left: Expression;
|
|
168
196
|
operator: PredicateOperator;
|
|
169
197
|
right: Expression;
|
|
170
198
|
}>;
|
|
171
199
|
returning?: string[] | "*";
|
|
200
|
+
/** RETURNING items that are not plain columns, evaluated over the affected rows. */
|
|
201
|
+
returningItems?: ReturningItem[];
|
|
172
202
|
parameterCount?: number;
|
|
173
203
|
} | {
|
|
174
204
|
kind: "create-table";
|
|
@@ -535,6 +565,8 @@ export declare function orderOutputName(expression: Expression, select: readonly
|
|
|
535
565
|
interface ListMembership {
|
|
536
566
|
set: ReadonlySet<unknown>;
|
|
537
567
|
hasNull: boolean;
|
|
568
|
+
/** Whether any member is text, which a typed left value may read in its own type. */
|
|
569
|
+
hasText: boolean;
|
|
538
570
|
}
|
|
539
571
|
/**
|
|
540
572
|
* IN lists produced by subquery materialization can hold many thousands of literals, and
|
|
@@ -668,6 +700,13 @@ export declare function projectResultColumns(result: QueryResult, aliases: reado
|
|
|
668
700
|
export declare function derivedTableSource(derived: CompiledQuery, alias: string, nextSequence: () => number): TableSource;
|
|
669
701
|
/** The parser's LIMIT range contract, shared with the typed builder. */
|
|
670
702
|
export declare function validateLimit(limit: number): number;
|
|
703
|
+
/**
|
|
704
|
+
* Reads datetime text the way the TIMESTAMP literal does — a zoneless `2026-01-02 03:04:05` is
|
|
705
|
+
* UTC, never the host's zone — and falls back to the JavaScript parser for other spellings.
|
|
706
|
+
* `new Date("2026-01-02 03:04:05")` alone would read the same text in local time, so a CAST
|
|
707
|
+
* would answer differently on two machines.
|
|
708
|
+
*/
|
|
709
|
+
export declare function datetimeText(text: string): Date;
|
|
671
710
|
/** The parser's OFFSET range contract, shared with the typed builder. */
|
|
672
711
|
export declare function validateOffset(offset: number): number;
|
|
673
712
|
/**
|