@hajewski/latticedb 0.16.0 → 0.18.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/README.md CHANGED
@@ -8,7 +8,7 @@ TypeScript/Node.js bindings for [LatticeDB](https://github.com/jeffhajewski/latt
8
8
  npm install @hajewski/latticedb
9
9
  ```
10
10
 
11
- Published package tarballs are expected to bundle the native shared library for supported platforms.
11
+ Published package tarballs bundle the native shared library for Linux (x64, arm64), macOS (x64, arm64) and Windows (x64, arm64).
12
12
 
13
13
  If you are working from a source checkout, stage the native library into the package with:
14
14
 
@@ -30,6 +30,10 @@ zig build install --prefix /tmp/lattice-install
30
30
  export LATTICE_PREFIX=/tmp/lattice-install
31
31
  ```
32
32
 
33
+ `LATTICE_PREFIX` is searched under `<prefix>/lib`. On Windows, where `zig build install`
34
+ puts `lattice.dll` in `<prefix>/bin` and only the import library in `<prefix>/lib`,
35
+ `<prefix>/bin` is searched first, then `<prefix>/lib`.
36
+
33
37
  Alternatively, discovery can use `pkg-config`:
34
38
 
35
39
  ```bash
@@ -136,13 +140,60 @@ const db = new Database(path: string, options?: DatabaseOptions);
136
140
  interface DatabaseOptions {
137
141
  create?: boolean; // Create if not exists (default: false)
138
142
  readOnly?: boolean; // Open read-only (default: false)
139
- cacheSizeMb?: number; // Cache size in MB (default: 100)
140
- enableVectors?: boolean; // Preferred vector config flag
143
+ cacheSizeMb?: number; // Cache size in MB; unset: LATTICE_BUFFER_POOL_MB, else 100
144
+ enableWal?: boolean; // log commits so they survive a crash (default: true)
145
+ enableAdjacencyCache?: boolean; // Accepted; no effect on queries (default: false)
146
+ enableVectors?: boolean; // Create a vector index if the file has none
141
147
  enableVector?: boolean; // Deprecated compatibility alias
142
- vectorDimensions?: number; // Vector dimensions (default: 128)
148
+ vectorDimensions?: number; // Vector dimensions (default: 128; 0 = the file's)
149
+ lock?: boolean; // Take a file lock (default: true)
150
+ syncMode?: 'full' | 'normal'; // Unset: LATTICE_SYNC_MODE, else 'full'
151
+ fullFsync?: boolean; // macOS F_FULLFSYNC; unset: LATTICE_FULL_FSYNC, else off
152
+ vectorMetric?: 'cosine' | 'euclidean' | 'dot_product'; // For a new index (default: cosine)
153
+ vectorM?: number; // HNSW connections per node, 2..32 (default: 16)
154
+ vectorEfConstruction?: number; // HNSW build candidate list, 1..4096 (default: 200)
155
+ changefeedRetention?: ChangefeedRetention; // 'all', 'off', 'last:N', 'age:7d' (default: the file's)
143
156
  }
144
157
  ```
145
158
 
159
+ A database file records its vector index: dimensions, metric, `vectorM` and
160
+ `vectorEfConstruction`. A database that has an index opens with it whether or
161
+ not `enableVectors` is set, so reopening needs no vector options at all. Any
162
+ vector option you do pass (and `vectorDimensions` when `enableVectors` is set)
163
+ must match the file, or `open()` throws a `LatticeError` with code -18
164
+ (`ConfigMismatch`). The metric decides search distances, smallest first: cosine
165
+ distance (vectors stored at unit length), L2 distance, or the negative dot
166
+ product (vectors stored as given).
167
+
168
+ `syncMode: 'normal'` returns from a commit once the operating system has it: the
169
+ commit survives the process being killed, but a power cut or OS crash can lose
170
+ the most recent commits. The default, `'full'`, syncs the log on every commit.
171
+
172
+ A `syncMode` or `fullFsync` you pass wins over the `LATTICE_SYNC_MODE` and
173
+ `LATTICE_FULL_FSYNC` environment variables, which apply only when the option is
174
+ left unset.
175
+
176
+ `enableWal: false` logs nothing. Transactions, rollback, streams and the
177
+ changefeed work as with the log, but a commit reaches the file at the next
178
+ flush (`close()`, or when half the page cache holds changes) rather than when it
179
+ returns.
180
+
181
+ `changefeedRetention` sets how much of the changefeed the file keeps (see
182
+ [Durable Streams and Changefeeds](#durable-streams-and-changefeeds)).
183
+
184
+ `syncMode`, `fullFsync`, the three vector index options and
185
+ `changefeedRetention` need a native library with `lattice_open_v5`; against an
186
+ older one, setting any of them throws with code -14 (`Unsupported`). `deserialize()` takes the same options and passes
187
+ them through `lattice_deserialize_v5`, which needs the same newer library.
188
+
189
+ `readOnly: true` on a database that was not closed cleanly recovers it in
190
+ memory: the handle sees every committed transaction and nothing is written to
191
+ the files. A recovery that needs more than 64 MB plus four times the size of the
192
+ log and journal throws with code -10 (`Full`); open the database read-write once
193
+ to recover it on disk.
194
+
195
+ Node IDs, edge IDs and stream sequence numbers are `bigint`.
196
+
146
197
  #### Methods
147
198
 
148
199
  - `await db.open()` - Open the database connection
@@ -150,18 +201,33 @@ interface DatabaseOptions {
150
201
  - `await db.read(fn)` - Execute a read-only transaction
151
202
  - `await db.write(fn)` - Execute a read-write transaction
152
203
  - `await db.query(cypher, params?)` - Execute a Cypher query
204
+ - `await db.getNodesByLabel(label)` - IDs of every node with a label
153
205
  - `await db.vectorSearch(vector, options?)` - k-NN vector search
154
- - `await db.ftsSearch(query, options?)` - Full-text search
155
- - `await db.ftsSearchFuzzy(query, options?)` - Fuzzy full-text search
156
- - `await db.createNodePropertyIndex(label, property)` / `dropNodePropertyIndex(...)` - Manage explicit node equality indexes
157
- - `await db.createEdgePropertyIndex(edgeType, property)` / `dropEdgePropertyIndex(...)` - Manage explicit edge equality indexes
158
- - `await db.readStream(stream, options?)` - Read durable stream records by cursor
206
+ - `await db.createNodeFtsIndex(label, property)` / `dropNodeFtsIndex(...)` / `hasNodeFtsIndex(...)` - Manage full-text indexes on node properties
207
+ - `await db.createEdgeFtsIndex(edgeType, property)` / `dropEdgeFtsIndex(...)` / `hasEdgeFtsIndex(...)` - Manage full-text indexes on edge properties. A node index and a relationship index cannot share a name and property: the second is rejected as already existing
208
+ - `await db.ftsSearch(label, property, query, options?)` - Full-text search over one declared index
209
+ - `await db.ftsSearchFuzzy(label, property, query, options?)` - Fuzzy full-text search
210
+ - `await db.createNodePropertyIndex(label, property)` / `dropNodePropertyIndex(...)` - Manage explicit node property indexes
211
+ - `await db.createEdgePropertyIndex(edgeType, property)` / `dropEdgePropertyIndex(...)` - Manage explicit edge property indexes
212
+ - `await db.readStream(stream, options?)` - Read durable stream records by cursor. With `timeoutMs > 0` the wait runs on a worker thread, so the event loop keeps running and a commit from the same process can end the wait
159
213
  - `await db.getStreamOffset(stream, consumer)` - Read a committed consumer offset
160
- - `await db.changes(options?)` - Read the built-in graph changefeed
214
+ - `await db.changes(options?)` - Read the built-in graph changefeed. Rejects with `LatticeChangesTrimmedError` when retention has dropped the events after `afterSequence`, and with code -14 (`Unsupported`) when the policy is `'off'`
215
+ - `await db.changefeedStatus()` - The changefeed's policy and range: `{ retention, oldestSequence, lastSequence }`, `oldestSequence` null when it holds no events
216
+ - `await db.trimChangefeed()` - Apply the retention policy in full now; resolves to the number of events dropped
217
+ - `await db.checkpoint(mode = 'truncate')` - Fold the log into the database file now; resolves to `CheckpointStats` (see [Checkpoints](#checkpoints))
218
+ - `await db.setAutoCheckpoint(maxWalFrames, minIntervalMs = 0)` - Set when commits checkpoint from now on; `0` frames switches automatic checkpoints off
161
219
  - `await db.cacheClear()` - Clear the query cache
162
220
  - `await db.cacheStats()` - Get cache hit/miss statistics
163
221
  - `db.isOpen()` - Check if database is open
164
222
  - `db.getPath()` - Get database file path
223
+ - `db.serialize()` - Return the whole database as a `Uint8Array`
224
+
225
+ `deserialize(bytes, options?, copy = true)` opens a database from bytes produced by `serialize()`.
226
+ Its options mean what they mean to `new Database()`, apart from `create` and
227
+ `readOnly`, which it ignores. Bytes that hold a vector index open with the
228
+ configuration they record, and any vector option you pass must match it (code
229
+ -18, `ConfigMismatch`); `enableVectors` with the vector options creates and
230
+ configures an index in bytes that have none.
165
231
 
166
232
  ### Transaction
167
233
 
@@ -169,9 +235,14 @@ interface DatabaseOptions {
169
235
 
170
236
  - `await txn.getNode(nodeId)` - Get a node by ID, returns `Node` or `null`
171
237
  - `await txn.nodeExists(nodeId)` - Check if a node exists
172
- - `await txn.getProperty(nodeId, key)` - Get a property value
238
+ - `await txn.getProperty(nodeId, key)` - Get a property value, or `null` when the node does not have it
239
+ - `await txn.getVector(nodeId, key = "embedding")` - The node's vector as a `Float32Array`, or `null` if it has none. Rejects with code -4 (`NotFound`) if the node does not exist. Under the cosine metric, the default, a committed vector reads back normalised to unit length (`[3, 4]` reads back as `[0.6, 0.8]`); an uncommitted one reads back as written.
173
240
  - `await txn.getOutgoingEdges(nodeId)` - Get outgoing edges from a node
174
241
  - `await txn.getIncomingEdges(nodeId)` - Get incoming edges to a node
242
+ - `await txn.getOutgoingEdgesByType(nodeId, edgeType, ...)` / `getIncomingEdgesByType(...)` - Edges of one type
243
+ - `await txn.getNodesByLabel(label)` - IDs of every node with a label, as this transaction sees them
244
+ - `await txn.query(cypher, params?)` - Run Cypher inside this transaction
245
+ - `await txn.vectorSearch(...)` / `ftsSearch(...)` / `ftsSearchFuzzy(...)` - Searches inside this transaction
175
246
  - `await txn.findNodesByLabelProperty(label, property, value, limit?)` - Indexed node equality lookup
176
247
  - `await txn.findEdgesByTypeProperty(edgeType, property, value, limit?)` - Indexed edge equality lookup
177
248
  - `txn.isReadOnly()` / `txn.isActive()` - Transaction state
@@ -179,21 +250,22 @@ interface DatabaseOptions {
179
250
  #### Write Operations
180
251
 
181
252
  - `await txn.createNode({ labels, properties })` - Create a node
182
- - `await txn.deleteNode(nodeId)` - Delete a node
183
- - `await txn.setProperty(nodeId, key, value)` - Set a property
184
- - `await txn.setVector(nodeId, key, vector)` - Set a vector embedding
253
+ - `await txn.deleteNode(nodeId, { detach })` - Delete a node. A node that still has relationships is refused with code -17 (`HasRelationships`) and nothing is deleted, as Cypher's `DELETE` does; `{ detach: true }` deletes its relationships with it, as `DETACH DELETE` does. Deleting a node that does not exist does nothing.
254
+ - `await txn.setProperty(nodeId, key, value)` - Set a property. If a full-text index is declared for one of the node's labels and this property, the index is kept current.
255
+ - `await txn.setVector(nodeId, key, vector)` - Set the node's vector embedding. A node has one vector, which Cypher reads as `n.embedding`; `key` must be `"embedding"` (or `""`), and any other key is rejected with an unsupported-operation error. A vector with NaN or infinite components is rejected as an invalid argument.
256
+ - `await txn.removeVector(nodeId, key = "embedding")` - Remove the node's vector. The node keeps its labels and properties, and vector search no longer returns it. Removing a vector the node does not have does nothing. Rejects with code -4 (`NotFound`) if the node does not exist.
185
257
  - `await txn.batchInsertVectors(label, vectors)` - Insert vector-bearing nodes in one call
186
258
  - `await txn.batchInsert(label, vectors)` - Deprecated compatibility alias for `batchInsertVectors`
187
- - `await db.createNodeFtsIndex(label, property)` - Declare a full-text index; writing that property keeps it current
188
259
  - `await txn.createEdge(sourceId, targetId, edgeType, options?)` - Create an edge
189
260
  - `await txn.deleteEdge(sourceId, targetId, edgeType)` - Delete an edge
190
261
  - `await txn.setEdgeProperty(edgeId, key, value)` - Set an edge property by stable edge ID
191
262
  - `await txn.getEdgeProperty(edgeId, key)` - Get an edge property by stable edge ID
192
263
  - `await txn.removeEdgeProperty(edgeId, key)` - Remove an edge property by stable edge ID
193
264
  - `txn.publishStream(stream, payload, kind?)` - Publish a durable stream record
265
+ - `txn.publishStreamGetSequence(stream, payload, kind?)` - Publish and return the record's sequence (`bigint`)
194
266
  - `txn.setStreamOffset(stream, consumer, sequence)` - Commit a durable consumer offset
195
267
  - `txn.trimStream(stream, throughSequence)` - Delete stream records through a sequence
196
- - `txn.commit()` / `txn.rollback()` - Commit or rollback
268
+ - `txn.commit()` / `txn.rollback()` - Commit or rollback. A commit that throws with code -7 (`TxnAborted`) has ended the transaction, and `rollback()` afterwards does nothing; after any other failure it stays open for `rollback()`
197
269
 
198
270
  ### Bulk Vector Insertion
199
271
 
@@ -222,9 +294,10 @@ await db.close();
222
294
 
223
295
  ### Property Indexes
224
296
 
225
- Property equality indexes are explicit and durable. Create them outside an
226
- active write transaction; lookup fails instead of silently scanning when the
227
- requested index does not exist.
297
+ Property indexes are explicit and durable. Create them outside an active write
298
+ transaction; lookup fails instead of silently scanning when the requested index
299
+ does not exist. The lookup methods find equal values; Cypher also reads the
300
+ indexes for ranges, `STARTS WITH` and `ORDER BY ... LIMIT`.
228
301
 
229
302
  ```typescript
230
303
  await db.createNodePropertyIndex("Person", "email");
@@ -287,16 +360,16 @@ Connect to Ollama, OpenAI, or compatible APIs:
287
360
  ```typescript
288
361
  import { EmbeddingClient, EmbeddingApiFormat } from "@hajewski/latticedb/embedding";
289
362
 
290
- // Ollama (default)
363
+ // Ollama (default). The endpoint is the full URL the client POSTs to.
291
364
  const client = new EmbeddingClient({
292
- endpoint: "http://localhost:11434",
365
+ endpoint: "http://localhost:11434/api/embeddings",
293
366
  });
294
367
  const vec = client.embed("hello world");
295
368
  client.close();
296
369
 
297
370
  // OpenAI-compatible API
298
371
  const openaiClient = new EmbeddingClient({
299
- endpoint: "https://api.openai.com/v1",
372
+ endpoint: "https://api.openai.com/v1/embeddings",
300
373
  model: "text-embedding-3-small",
301
374
  apiFormat: EmbeddingApiFormat.OpenAI,
302
375
  apiKey: "sk-...",
@@ -363,6 +436,43 @@ console.log(
363
436
  await db.cacheClear();
364
437
  ```
365
438
 
439
+ ### Checkpoints
440
+
441
+ A commit is durable once it is in the log (the `-wal` file beside the database).
442
+ A checkpoint writes the pages the log's commits changed into the database file
443
+ and can then empty the log. By default a commit runs one once the log holds 1000
444
+ frames (one frame per page, 4096 bytes); the `LATTICE_AUTO_CHECKPOINT_FRAMES`
445
+ environment variable sets another default (`0` for none), and
446
+ `setAutoCheckpoint` wins over it. Closing a database always folds the log into
447
+ the file.
448
+
449
+ ```typescript
450
+ import type { CheckpointStats } from '@hajewski/latticedb';
451
+
452
+ await db.setAutoCheckpoint(0); // commits never checkpoint; the log grows
453
+ // ... a burst of commits ...
454
+ const stats: CheckpointStats = await db.checkpoint('truncate');
455
+ console.log(stats.pagesFlushed, stats.durationNs, stats.checkpointLsn, stats.walTruncated);
456
+
457
+ await db.setAutoCheckpoint(4000, 1000); // every 4000 frames, at most once a second
458
+ ```
459
+
460
+ Modes (`CheckpointMode`): `'passive'` writes the changed pages unless one is in
461
+ use (then it writes nothing and reports 0 pages) and leaves the log in place;
462
+ `'full'` writes every changed page and leaves the log in place; `'truncate'` (the
463
+ default) does what `'full'` does and then empties the log, the only mode that
464
+ bounds its size. Any other mode throws a `TypeError`, and a negative or
465
+ fractional argument to `setAutoCheckpoint` a `RangeError`. `durationNs` and
466
+ `checkpointLsn` are `bigint`. `checkpoint` rejects with code -9 (`ReadOnly`) on a
467
+ read-only database and -8 (`LockTimeout`) if a transaction already has records
468
+ in the log; `setAutoCheckpoint` has no effect on a read-only database. Against a
469
+ native library without `lattice_checkpoint`, both reject with code -14
470
+ (`Unsupported`).
471
+
472
+ The interval is a trade-off. A larger one means fewer checkpoints, each a longer
473
+ pause for the commit that runs it, a longer `-wal` file and more to replay after
474
+ a crash. A smaller one means shorter pauses, more often.
475
+
366
476
  ### Durable Streams and Changefeeds
367
477
 
368
478
  Streams are durable named event logs stored inside the database file. Records are
@@ -394,16 +504,26 @@ await db.write(async (txn) => {
394
504
  graph events such as `node.insert`, `node.property_set`, `edge.delete`, and
395
505
  `edge.property_remove`, with payloads represented as normal TypeScript values.
396
506
 
507
+ A transaction's events describe its net effect (a property set several times
508
+ is one event, from its value before the transaction to its last value) and
509
+ come in an order that can be replayed as it comes: the edges it deletes, then
510
+ the nodes that exist after it, then the edges that exist after it, then the
511
+ nodes it deletes, each group by ascending id. So an edge is created after both
512
+ its nodes and deleted before either. See the
513
+ [changefeed guide](https://docs.latticedb.org/guides/changefeed) for the details
514
+ and for retention policies.
515
+
397
516
  ## Supported Property Types
398
517
 
399
518
  - `null` - Null value
400
519
  - `boolean` - Boolean
401
520
  - `number` - Integer or float
521
+ - `bigint` - 64-bit integer
402
522
  - `string` - UTF-8 string
403
523
  - `Uint8Array` - Binary data
404
524
  - `Float32Array` - Vector embeddings
405
-
406
- Nested arrays/objects are not currently exposed by the public bindings/C API.
525
+ - Arrays of any of these values, nested to any depth
526
+ - Plain objects with string keys, whose values are any of these, nested to any depth
407
527
 
408
528
  ## Error Handling
409
529
 
@@ -426,6 +546,43 @@ try {
426
546
  }
427
547
  ```
428
548
 
549
+ Errors from the native library are `LatticeError`s whose `code` is the C error
550
+ code; `LatticeErrorCode` (exported from the package root, with `QueryErrorStage`
551
+ for `LatticeQueryError.stage`; both are plain enums, readable at run time) names
552
+ them. For example -4 (not found, also from `createEdge` when either end does not
553
+ exist), -16 (another process holds the file), -17 (a plain `deleteNode` of a node
554
+ with relationships), -18 (open options that contradict the file's vector
555
+ index), -19 (`NeedsNewerWriter`: a writable open of a file that a newer
556
+ release has marked as not writable by this one; it still opens with
557
+ `readOnly: true`) and -11 (`VersionMismatch`: a file in a format too new for
558
+ this release to read at all, read-only or not).
559
+
560
+ A failed Cypher query throws a `LatticeQueryError`, a `LatticeError` that also
561
+ says where the query failed:
562
+
563
+ ```typescript
564
+ import { Database, LatticeQueryError } from "@hajewski/latticedb";
565
+
566
+ try {
567
+ await db.query("RETURN 1/0");
568
+ } catch (e) {
569
+ if (e instanceof LatticeQueryError) {
570
+ console.log(e.message); // Division by zero: 1 / 0
571
+ console.log(e.code); // -1
572
+ console.log(e.stage); // 4 (execution)
573
+ console.log(e.diagnosticCode); // DivisionByZero
574
+ console.log(e.location); // { line: 1, column: 9, length: 1 }
575
+ }
576
+ }
577
+ ```
578
+
579
+ `stage` is a `QueryErrorStage`: 1 parse, 2 semantic, 3 plan, 4 execution. Parse
580
+ and semantic failures have code -6 and execution failures -1, except that a
581
+ `DELETE` of a node with relationships has code -17 and a relationship created
582
+ to a node deleted earlier in the query -4, as `deleteNode` and `createEdge`
583
+ report them. A storage failure under a query has code -2 and an allocation
584
+ failure -13.
585
+
429
586
  ## Electron
430
587
 
431
588
  These bindings run in Electron's **main process** (or a utility process). They
@@ -483,8 +640,10 @@ let the loader find it under `process.resourcesPath`:
483
640
  }
484
641
  ```
485
642
 
486
- Pick the source directory for the platform you are building; Linux bundles carry
487
- a libc suffix (`linux-x64-gnu`, `linux-x64-musl`). The loader also accepts
643
+ Pick the source directory for the platform you are building. The published package
644
+ uses `lib/linux-x64` and `lib/linux-arm64` for Linux (glibc builds only); a package
645
+ staged locally with `npm run bundle:native` may carry a libc suffix instead
646
+ (`linux-x64-gnu`). The loader also accepts
488
647
  `resources/lib/<platform>-<arch>/`, `resources/<platform>-<arch>/`, and the
489
648
  library sitting next to the executable (electron-builder `extraFiles`).
490
649
 
@@ -506,8 +665,8 @@ and the `asarUnpack` glob to add.
506
665
 
507
666
  ### Windows
508
667
 
509
- Both Windows architectures are supported. Published package tarballs are
510
- expected to bundle `lib/win32-x64/lattice.dll` and `lib/win32-arm64/lattice.dll`,
668
+ Windows x64 is built and tested in CI; Windows ARM64 is built but not run.
669
+ Published package tarballs bundle `lib/win32-x64/lattice.dll` and `lib/win32-arm64/lattice.dll`,
511
670
  and koffi ships matching prebuilt `win32_x64` and `win32_arm64` binaries, so
512
671
  nothing has to be compiled at install time.
513
672
 
@@ -548,7 +707,7 @@ npm test
548
707
 
549
708
  ## Requirements
550
709
 
551
- - Node.js 18+, or Electron 23+ (main process, Node 18 — see [Electron](#electron))
710
+ - Node.js 18+, or Electron's main process (see [Electron](#electron); the loader's asar handling is tested without running Electron, and no Electron version is tested)
552
711
  - The native LatticeDB library (`liblattice.dylib` / `liblattice.so` /
553
712
  `lattice.dll`)
554
713
 
@@ -2,7 +2,8 @@
2
2
  * Database class for Lattice TypeScript bindings.
3
3
  */
4
4
  import { Transaction } from './transaction';
5
- import { QueryResult, VectorSearchResult, PropertyValue, VectorSearchOptions, FtsSearchOptions, StreamRecord } from './types';
5
+ import { QueryResult, VectorSearchResult, PropertyValue, VectorSearchOptions, FtsSearchOptions, StreamRecord, CheckpointStats } from './types';
6
+ import { SyncMode, VectorMetric, ChangefeedRetention, ChangefeedStatus, CheckpointMode } from './ffi';
6
7
  /**
7
8
  * Options for opening a database.
8
9
  */
@@ -11,17 +12,29 @@ export interface DatabaseOptions {
11
12
  create?: boolean;
12
13
  /** Open in read-only mode */
13
14
  readOnly?: boolean;
14
- /** Cache size in megabytes */
15
+ /**
16
+ * Cache size in megabytes. Unset, the LATTICE_BUFFER_POOL_MB environment
17
+ * variable decides if it is set, else 100; a size given here wins over it.
18
+ */
15
19
  cacheSizeMb?: number;
16
- /** Enable WAL-backed transactions (default: true) */
20
+ /** Log every commit so it survives a crash (default: true). Transactions work either way. */
17
21
  enableWal?: boolean;
18
- /** Enable in-memory graph adjacency cache */
22
+ /**
23
+ * Accepted for compatibility. Queries and the other methods here read edges
24
+ * from storage either way, so it does not change their speed or results.
25
+ */
19
26
  enableAdjacencyCache?: boolean;
20
- /** Enable vector storage and indexing */
27
+ /**
28
+ * Create a vector index if the database has none. A database that already
29
+ * has one opens with it whatever this says.
30
+ */
21
31
  enableVectors?: boolean;
22
- /** @deprecated Use enableVectors instead. Earliest removal is v0.6.0. */
32
+ /** @deprecated Use enableVectors instead. */
23
33
  enableVector?: boolean;
24
- /** Vector dimensions (default: 128) */
34
+ /**
35
+ * Vector dimensions when enableVectors is set (default: 128). It must match
36
+ * the index the file records, if it has one; 0 takes the file's.
37
+ */
25
38
  vectorDimensions?: number;
26
39
  /**
27
40
  * Take a lock on the file so two processes cannot tread on each other
@@ -31,6 +44,40 @@ export interface DatabaseOptions {
31
44
  * make concurrent access safe.
32
45
  */
33
46
  lock?: boolean;
47
+ /**
48
+ * When a commit waits for the disk. `'full'` syncs the log on every commit,
49
+ * so a commit that has returned survives a power cut. `'normal'` hands the
50
+ * commit to the operating system and returns: it survives the process being
51
+ * killed, but a power cut or OS crash can lose the most recent commits.
52
+ * Unset uses the LATTICE_SYNC_MODE environment variable, else full.
53
+ */
54
+ syncMode?: SyncMode;
55
+ /**
56
+ * On macOS, whether syncs ask the drive to flush its cache (F_FULLFSYNC).
57
+ * No effect elsewhere. Unset uses LATTICE_FULL_FSYNC, else off.
58
+ */
59
+ fullFsync?: boolean;
60
+ /**
61
+ * How a new vector index measures distance: `'cosine'` (1 - cos, vectors
62
+ * stored at unit length), `'euclidean'` (L2 distance) or `'dot_product'`
63
+ * (negative dot product). Unset means the file's, or cosine.
64
+ */
65
+ vectorMetric?: VectorMetric;
66
+ /** HNSW connections per node for a new index, 2..32. Unset: the file's, or 16. */
67
+ vectorM?: number;
68
+ /** HNSW build candidate list size for a new index, 1..4096. Unset: the file's, or 200. */
69
+ vectorEfConstruction?: number;
70
+ /**
71
+ * How much of the changefeed (see {@link Database.changes}) to keep:
72
+ * `'all'`, `'off'`, `'last:<events>'` or `'age:<duration>'` such as
73
+ * `'age:7d'`. The file records its policy. Unset keeps the file's, which is
74
+ * `'all'` unless something set another (for a new database, the
75
+ * LATTICE_CHANGEFEED_RETENTION environment variable). A value set here
76
+ * replaces the file's policy when the database is opened for writing; a
77
+ * read-only open never changes it. Retention drops the oldest events at
78
+ * checkpoints; {@link Database.trimChangefeed} applies it at once.
79
+ */
80
+ changefeedRetention?: ChangefeedRetention;
34
81
  }
35
82
  /**
36
83
  * Lattice database connection.
@@ -122,11 +169,29 @@ export declare class Database {
122
169
  timeoutMs?: number;
123
170
  }): Promise<StreamRecord[]>;
124
171
  getStreamOffset(stream: string, consumer: string): Promise<bigint | null>;
172
+ /**
173
+ * Read graph changefeed records from `__lattice_changes`: up to `limit`
174
+ * records with a sequence greater than `afterSequence`, oldest first.
175
+ * `afterSequence: 0n` reads from the oldest event held.
176
+ *
177
+ * Throws {@link LatticeChangesTrimmedError} when retention or a trim has
178
+ * dropped the events after `afterSequence` (the reader has missed changes),
179
+ * and a `LatticeError` with code `Unsupported` when the policy is `'off'`.
180
+ */
125
181
  changes(options?: {
126
182
  afterSequence?: bigint;
127
183
  limit?: number;
128
184
  timeoutMs?: number;
129
185
  }): Promise<StreamRecord[]>;
186
+ /** The changefeed's retention policy and the events it holds. */
187
+ changefeedStatus(): Promise<ChangefeedStatus>;
188
+ /**
189
+ * Apply the changefeed's retention policy in full now (checkpoints apply it
190
+ * a bounded number of events at a time) and make that durable. Returns the
191
+ * number of events dropped. Throws a `LatticeError` with code `LockTimeout`
192
+ * while a write transaction is open.
193
+ */
194
+ trimChangefeed(): Promise<bigint>;
130
195
  /**
131
196
  * Search for similar vectors.
132
197
  *
@@ -197,6 +262,48 @@ export declare class Database {
197
262
  nodeId: bigint;
198
263
  score: number;
199
264
  }>>;
265
+ /**
266
+ * Fold the log (the -wal file) into the database file now.
267
+ *
268
+ * A commit is durable once it is in the log; a checkpoint writes the pages
269
+ * the log's commits changed into the database file and can then empty the
270
+ * log. `'passive'` writes the changed pages unless one is in use, in which
271
+ * case it writes nothing and reports 0 pages, and leaves the log in place.
272
+ * `'full'` writes every changed page and leaves the log in place.
273
+ * `'truncate'` (the default, and what automatic checkpoints do) does what
274
+ * `'full'` does and then empties the log; it is the only mode that bounds the
275
+ * log's size.
276
+ *
277
+ * @param mode - `'passive'`, `'full'` or `'truncate'`; anything else throws a
278
+ * TypeError before the library is called
279
+ * @returns What the checkpoint did
280
+ * @throws LatticeError with code -9 (`ReadOnly`) on a read-only database,
281
+ * -8 (`LockTimeout`) if a transaction already has records in the log, -2
282
+ * (`IoError`) if writing failed (the log still holds every commit), and -14
283
+ * (`Unsupported`) if the native library has no `lattice_checkpoint`
284
+ */
285
+ checkpoint(mode?: CheckpointMode): Promise<CheckpointStats>;
286
+ /**
287
+ * Set when commits checkpoint from now on.
288
+ *
289
+ * A commit runs a `'truncate'` checkpoint once the log holds `maxWalFrames`
290
+ * frames (one frame is one page, usually 4096 bytes), and no sooner than
291
+ * `minIntervalMs` after the last automatic one. `maxWalFrames = 0` switches
292
+ * automatic checkpoints off: the log grows until {@link Database.checkpoint}
293
+ * runs, though closing still folds it into the file. Without this call the
294
+ * default is 1000 frames, or the LATTICE_AUTO_CHECKPOINT_FRAMES environment
295
+ * variable (0 for none); this call wins over the variable. It has no effect on
296
+ * a read-only database.
297
+ *
298
+ * A larger interval means fewer checkpoints, each a longer pause for the
299
+ * commit that runs it, a longer log on disk and more to replay after a crash.
300
+ * A smaller one means shorter pauses, more often.
301
+ *
302
+ * @throws RangeError if either argument is not a non-negative safe integer;
303
+ * LatticeError with code -14 (`Unsupported`) if the native library has no
304
+ * `lattice_set_auto_checkpoint`
305
+ */
306
+ setAutoCheckpoint(maxWalFrames: number, minIntervalMs?: number): Promise<void>;
200
307
  /**
201
308
  * Clear the query cache.
202
309
  *
@@ -239,6 +346,16 @@ export declare class Database {
239
346
  * await s3.send(new PutObjectCommand({ Bucket, Key, Body: db.serialize(), IfMatch: etag }));
240
347
  * ```
241
348
  *
349
+ * The options mean what they mean to {@link Database}, apart from `create` and
350
+ * `readOnly`, which are ignored. Bytes that hold a vector index open with the
351
+ * configuration they record, and any vector option that is set must match it
352
+ * (code -18, `ConfigMismatch`, otherwise); `enableVectors` creates an index,
353
+ * configured by the vector options, in bytes that have none. `syncMode`,
354
+ * `fullFsync`, `vectorMetric`, `vectorM`, `vectorEfConstruction` and
355
+ * `changefeedRetention` (which sets the policy as an open does) need a
356
+ * native library with `lattice_deserialize_v5`; against an older one, setting
357
+ * any of them throws with code -14 (`Unsupported`).
358
+ *
242
359
  * The bytes are copied, so the caller may discard them as soon as this returns.
243
360
  * Changes made afterwards do not travel back to them.
244
361
  *
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAC;AASjB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yCAAyC;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;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