@minnowdb/core 0.7.2 → 0.7.7
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/engine/client.d.ts +2 -2
- package/dist/engine/client.js +7 -2
- package/dist/engine/database.d.ts +11 -1
- package/dist/engine/database.js +642 -175
- package/dist/engine/optimizer.js +48 -26
- package/dist/engine/query.d.ts +98 -0
- package/dist/engine/query.js +1452 -165
- package/dist/engine/sql-domains.d.ts +11 -0
- package/dist/engine/sql-domains.js +56 -0
- package/dist/engine/sql-functions.js +129 -3
- package/dist/engine/sql-json.d.ts +2 -0
- package/dist/engine/sql-json.js +4 -0
- package/dist/engine/sql-semantics.d.ts +9 -1
- package/dist/engine/sql-semantics.js +19 -3
- package/dist/engine/vector.js +29 -13
- package/dist/engine/worker-server.js +4 -1
- package/dist/plan/model.d.ts +14 -2
- package/dist/storage/indexeddb.js +13 -8
- package/dist/storage/memory.d.ts +2 -1
- package/dist/storage/memory.js +29 -4
- package/dist/storage/toolkit/record-core.js +11 -6
- package/dist/storage/types.d.ts +11 -0
- package/dist/testing/sqllogictest.js +3 -1
- package/package.json +1 -1
- package/postgres-feature-profile.json +9 -4
- package/sql-feature-matrix.json +541 -4
package/dist/engine/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CompactionJobRecord, type GarbageCollectionJobRecord, type StorageIntegrityMode, type StorageIntegrityReport, type StorageStats, type InterruptedSnapshotImport, type InterruptedSnapshotImportAbortResult } from "../storage/types.js";
|
|
2
2
|
import { type BatchRow, type InsertBatchInput } from "./batch.js";
|
|
3
3
|
import type { Catalog } from "./catalog.js";
|
|
4
|
-
import type { BatchValue, BufferPoolStats, StagedWriteResult, BufferedFlushResult, BufferedWriterOptions, CancelCompactionJobResult, CollectGarbageOptions, CollectGarbageStepOptions, CompactTableOptions, CompactTableResult, CompactTableStepOptions, CompactionJobProgress, CreateTableInput, DatabaseRow, MigrateOptions, DeleteBatchInput, DeleteBatchResult, ExecuteOptions, ExecuteResult, GarbageCollectionProgress, GarbageCollectionResult, MaintenanceStatus, InsertBatchResult, QueryOptions, QueryExecutionStats, QueryCursorOptions, QuerySpillCleanupOptions, QuerySpillCleanupResult, ReadTableOptions, RunStatementOptions, SnapshotExportOptions, SnapshotImportOptions, TableDefinition, UpdateBatchInput, UpdateBatchResult, UpsertBatchResult, UpsertOptions, VisibleSegmentPage, VisibleSegmentPageOptions } from "./database.js";
|
|
4
|
+
import type { BatchValue, BufferPoolStats, StagedWriteResult, StagedUpsertResult, BufferedFlushResult, BufferedWriterOptions, CancelCompactionJobResult, CollectGarbageOptions, CollectGarbageStepOptions, CompactTableOptions, CompactTableResult, CompactTableStepOptions, CompactionJobProgress, CreateTableInput, DatabaseRow, MigrateOptions, DeleteBatchInput, DeleteBatchResult, ExecuteOptions, ExecuteResult, GarbageCollectionProgress, GarbageCollectionResult, MaintenanceStatus, InsertBatchResult, QueryOptions, QueryExecutionStats, QueryCursorOptions, QuerySpillCleanupOptions, QuerySpillCleanupResult, ReadTableOptions, RunStatementOptions, SnapshotExportOptions, SnapshotImportOptions, TableDefinition, UpdateBatchInput, UpdateBatchResult, UpsertBatchResult, UpsertOptions, VisibleSegmentPage, VisibleSegmentPageOptions } from "./database.js";
|
|
5
5
|
import type { LiveQueryInput, LiveQueryInvalidation, LiveQueryObserveOptions, LiveQueryStats, LiveQuerySubscribeOptions } from "./live.js";
|
|
6
6
|
import type { CompiledQuery, CompiledStatement, QueryResult, QueryValue } from "./query.js";
|
|
7
7
|
import type { AnyTable, SchemaDefinition } from "./schema.js";
|
|
@@ -210,7 +210,7 @@ export interface ClientWriteSession {
|
|
|
210
210
|
query(sql: string, options?: QueryOptions): Promise<QueryResult>;
|
|
211
211
|
execute(sql: string, params?: readonly QueryValue[]): Promise<ExecuteResult>;
|
|
212
212
|
insertBatch(tableName: string, input: InsertBatchInput): Promise<StagedWriteResult>;
|
|
213
|
-
upsertBatch(tableName: string, input: InsertBatchInput): Promise<
|
|
213
|
+
upsertBatch(tableName: string, input: InsertBatchInput, options?: UpsertOptions): Promise<StagedUpsertResult>;
|
|
214
214
|
updateBatch(tableName: string, input: UpdateBatchInput): Promise<StagedWriteResult>;
|
|
215
215
|
deleteBatch(tableName: string, input: DeleteBatchInput): Promise<StagedWriteResult>;
|
|
216
216
|
}
|
package/dist/engine/client.js
CHANGED
|
@@ -290,7 +290,12 @@ class MinnowDatabaseClient {
|
|
|
290
290
|
}
|
|
291
291
|
async write(action) {
|
|
292
292
|
const opened = await this.#call("writeOpen", []);
|
|
293
|
-
const stage = (op, tableName, input) => this._invoke(opened.handleId, "stage", [
|
|
293
|
+
const stage = (op, tableName, input, options) => this._invoke(opened.handleId, "stage", [
|
|
294
|
+
op,
|
|
295
|
+
tableName,
|
|
296
|
+
input,
|
|
297
|
+
options
|
|
298
|
+
]);
|
|
294
299
|
const session = {
|
|
295
300
|
query: async (sql, options = {}) => {
|
|
296
301
|
const { signal, onStats, ...wireOptions } = options;
|
|
@@ -298,7 +303,7 @@ class MinnowDatabaseClient {
|
|
|
298
303
|
},
|
|
299
304
|
execute: (sql, params) => this._invoke(opened.handleId, "execute", params === void 0 ? [sql] : [sql, params]),
|
|
300
305
|
insertBatch: (tableName, input) => stage("insertBatch", tableName, input),
|
|
301
|
-
upsertBatch: (tableName, input) => stage("upsertBatch", tableName, input),
|
|
306
|
+
upsertBatch: (tableName, input, options) => stage("upsertBatch", tableName, input, options),
|
|
302
307
|
updateBatch: (tableName, input) => stage("updateBatch", tableName, input),
|
|
303
308
|
deleteBatch: (tableName, input) => stage("deleteBatch", tableName, input)
|
|
304
309
|
};
|
|
@@ -174,6 +174,10 @@ export interface StagedWriteResult {
|
|
|
174
174
|
/** Values filled by defaults or auto-increment while the rows were staged. */
|
|
175
175
|
generatedColumns?: Record<string, QueryValue[]>;
|
|
176
176
|
}
|
|
177
|
+
export interface StagedUpsertResult extends StagedWriteResult {
|
|
178
|
+
/** Input rows rejected by `conflictWhere`; always 0 without it. */
|
|
179
|
+
skippedRowCount: number;
|
|
180
|
+
}
|
|
177
181
|
/**
|
|
178
182
|
* The scope handed to `write()`: every mutation stages into one transaction and publishes
|
|
179
183
|
* as one commit — all of it or none of it, in every tab. Reads observe the pre-scope snapshot
|
|
@@ -194,7 +198,7 @@ export interface WriteSession {
|
|
|
194
198
|
/** Runs a SELECT, INSERT, UPDATE, or DELETE inside this write scope. */
|
|
195
199
|
execute(sql: string, params?: readonly QueryValue[]): Promise<ExecuteResult>;
|
|
196
200
|
insertBatch(tableName: string, input: InsertBatchInput): Promise<StagedWriteResult>;
|
|
197
|
-
upsertBatch(tableName: string, input: InsertBatchInput): Promise<
|
|
201
|
+
upsertBatch(tableName: string, input: InsertBatchInput, options?: UpsertOptions): Promise<StagedUpsertResult>;
|
|
198
202
|
updateBatch(tableName: string, input: UpdateBatchInput): Promise<StagedWriteResult>;
|
|
199
203
|
deleteBatch(tableName: string, input: DeleteBatchInput): Promise<StagedWriteResult>;
|
|
200
204
|
}
|
|
@@ -587,6 +591,12 @@ export type ExecuteResult = {
|
|
|
587
591
|
kind: "drop-view";
|
|
588
592
|
view: string;
|
|
589
593
|
dropped: boolean;
|
|
594
|
+
}
|
|
595
|
+
/** A session setting statement (`SET`, `RESET`), accepted and ignored. */
|
|
596
|
+
| {
|
|
597
|
+
kind: "set";
|
|
598
|
+
action: "set" | "reset";
|
|
599
|
+
name: string;
|
|
590
600
|
} | {
|
|
591
601
|
kind: "create-trigger";
|
|
592
602
|
table: string;
|