@loradb/lora-node 0.8.5 → 0.10.1
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 +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/native.js +5 -1
- package/dist/native.js.map +1 -1
- package/package.json +15 -12
- package/ts/native.d.ts +1 -1
- package/ts/native.js +6 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ and batches fsyncs for write-heavy workloads. Call `await db.sync()` when you
|
|
|
98
98
|
need an immediate durability boundary before copying the portable `.loradb`
|
|
99
99
|
archive while the database is still open.
|
|
100
100
|
|
|
101
|
-
Node also has
|
|
101
|
+
Node also has a container-backed convenience overload:
|
|
102
102
|
|
|
103
103
|
```ts
|
|
104
104
|
import { createDatabase } from "@loradb/lora-node";
|
|
@@ -257,7 +257,7 @@ See `ts/types.ts` (`LoraErrorCode`) for the full list.
|
|
|
257
257
|
path would require extending the value serializer.
|
|
258
258
|
- **Cancellation.** The napi `Task` abstraction does not support
|
|
259
259
|
cancellation once dispatched; a runaway query runs to completion.
|
|
260
|
-
- **WAL surface.** Node persistence exposes
|
|
260
|
+
- **WAL surface.** Node persistence exposes container-backed initialization,
|
|
261
261
|
`syncMode: "groupSync"`, and `db.sync()`. Checkpoint, truncate,
|
|
262
262
|
and status controls are not exposed yet.
|
|
263
263
|
- **Archive ownership.** One archive can only be open by one writer process at a
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* shapes defined in the shared TS contract (`crates/bindings/shared-ts/types.ts`).
|
|
9
9
|
*
|
|
10
10
|
* **Initialization is async-only.** The canonical entry point is
|
|
11
|
-
* `createDatabase(...)`, optionally with
|
|
11
|
+
* `createDatabase(...)`, optionally with container-backed persistence. There is no
|
|
12
12
|
* synchronous constructor. See the docs at
|
|
13
13
|
* https://loradb.com/docs/getting-started/node for the full rationale.
|
|
14
14
|
*/
|
|
@@ -79,7 +79,7 @@ export type NodeSnapshotSaveTarget = string | URL | NodeSnapshotSaveOptions | Sn
|
|
|
79
79
|
export interface CreateDatabaseOptions {
|
|
80
80
|
databaseDir?: string;
|
|
81
81
|
/**
|
|
82
|
-
* Durability mode for
|
|
82
|
+
* Durability mode for container-backed databases.
|
|
83
83
|
*
|
|
84
84
|
* - `groupSync` writes WAL bytes before `execute()` resolves and batches
|
|
85
85
|
* fsyncs on a short background cadence. This is the default.
|
|
@@ -186,7 +186,7 @@ declare class DatabaseImpl {
|
|
|
186
186
|
*/
|
|
187
187
|
transaction<T extends Record<string, LoraValue> = Record<string, LoraValue>>(statements: TransactionStatement[], mode?: TransactionMode): Promise<Array<QueryResult<T>>>;
|
|
188
188
|
/**
|
|
189
|
-
* Force pending WAL bytes and
|
|
189
|
+
* Force pending WAL bytes and container updates to disk.
|
|
190
190
|
*
|
|
191
191
|
* The default `groupSync` mode writes WAL bytes before `execute()` resolves
|
|
192
192
|
* and batches fsyncs for speed; call `sync()` when you need an immediate
|
|
@@ -203,7 +203,7 @@ declare class DatabaseImpl {
|
|
|
203
203
|
/**
|
|
204
204
|
* Release the native database handle. Idempotent.
|
|
205
205
|
*
|
|
206
|
-
* Call this when
|
|
206
|
+
* Call this when a container-backed database needs to be reopened in the same
|
|
207
207
|
* process. New operations after disposal reject with `database is closed`.
|
|
208
208
|
*/
|
|
209
209
|
dispose(): void;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* shapes defined in the shared TS contract (`crates/bindings/shared-ts/types.ts`).
|
|
10
10
|
*
|
|
11
11
|
* **Initialization is async-only.** The canonical entry point is
|
|
12
|
-
* `createDatabase(...)`, optionally with
|
|
12
|
+
* `createDatabase(...)`, optionally with container-backed persistence. There is no
|
|
13
13
|
* synchronous constructor. See the docs at
|
|
14
14
|
* https://loradb.com/docs/getting-started/node for the full rationale.
|
|
15
15
|
*/
|
|
@@ -339,7 +339,7 @@ class DatabaseImpl {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
|
-
* Force pending WAL bytes and
|
|
342
|
+
* Force pending WAL bytes and container updates to disk.
|
|
343
343
|
*
|
|
344
344
|
* The default `groupSync` mode writes WAL bytes before `execute()` resolves
|
|
345
345
|
* and batches fsyncs for speed; call `sync()` when you need an immediate
|
|
@@ -384,7 +384,7 @@ class DatabaseImpl {
|
|
|
384
384
|
/**
|
|
385
385
|
* Release the native database handle. Idempotent.
|
|
386
386
|
*
|
|
387
|
-
* Call this when
|
|
387
|
+
* Call this when a container-backed database needs to be reopened in the same
|
|
388
388
|
* process. New operations after disposal reject with `database is closed`.
|
|
389
389
|
*/
|
|
390
390
|
dispose() {
|
package/dist/native.js
CHANGED
|
@@ -12,8 +12,12 @@
|
|
|
12
12
|
// subpackage named `@loradb/lora-node-<triple>`; local dev builds drop the
|
|
13
13
|
// `.node` at the crate root. We try both.
|
|
14
14
|
"use strict";
|
|
15
|
+
// Intentional CJS module: the file uses `require()` to dynamically
|
|
16
|
+
// resolve `.node` binaries based on platform/arch, which is a CJS-only
|
|
17
|
+
// pattern. ESM `import` can't load `.node` addons by path at runtime.
|
|
18
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
15
19
|
const { platform, arch } = process;
|
|
16
|
-
const { existsSync
|
|
20
|
+
const { existsSync } = require("node:fs");
|
|
17
21
|
const { join } = require("node:path");
|
|
18
22
|
const { execSync } = require("node:child_process");
|
|
19
23
|
function isMuslLibc() {
|
package/dist/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../ts/native.js"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,mDAAmD;AACnD,gDAAgD;AAChD,iDAAiD;AACjD,iDAAiD;AACjD,gEAAgE;AAChE,8CAA8C;AAC9C,EAAE;AACF,qEAAqE;AACrE,2EAA2E;AAC3E,0CAA0C;AAE1C,YAAY,CAAC;AAEb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I,CAAC;YACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;gBAAE,MAAM,GAAG,CAAC;YACtD,iDAAiD;QACnD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,yCAAyC,QAAQ,IAAI,IAAI,IAAI;QAC3D,gBAAgB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QAC9C,cAAc,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QAC5C,oEAAoE,CACvE,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loradb/lora-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Node.js / TypeScript bindings for the Lora in-memory graph database",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
|
+
"packageManager": "yarn@4.5.1",
|
|
6
7
|
"author": "LoraDB, Inc.",
|
|
7
8
|
"homepage": "https://github.com/lora-db/lora#readme",
|
|
8
9
|
"repository": {
|
|
@@ -65,35 +66,37 @@
|
|
|
65
66
|
},
|
|
66
67
|
"scripts": {
|
|
67
68
|
"sync:types": "node -e \"const fs=require('fs'); for (const f of ['types.ts','decode.ts']) fs.copyFileSync('../shared-ts/' + f, 'ts/' + f);\"",
|
|
68
|
-
"verify:types": "node -e \"const fs=require('fs'); for (const f of ['types.ts','decode.ts']) { const a=fs.readFileSync('../shared-ts/' + f,'utf8'); const b=fs.readFileSync('ts/' + f,'utf8'); if (a!==b) { console.error('ts/' + f + ' is out of sync with shared-ts/' + f + ' — run
|
|
69
|
-
"prebuild": "
|
|
70
|
-
"pretypecheck": "
|
|
71
|
-
"pretest": "
|
|
69
|
+
"verify:types": "node -e \"const fs=require('fs'); for (const f of ['types.ts','decode.ts']) { const a=fs.readFileSync('../shared-ts/' + f,'utf8'); const b=fs.readFileSync('ts/' + f,'utf8'); if (a!==b) { console.error('ts/' + f + ' is out of sync with shared-ts/' + f + ' — run yarn run sync:types'); process.exit(1);} } \"",
|
|
70
|
+
"prebuild": "yarn run sync:types",
|
|
71
|
+
"pretypecheck": "yarn run sync:types",
|
|
72
|
+
"pretest": "yarn run sync:types",
|
|
72
73
|
"build:native": "napi build --platform --release --js false",
|
|
73
74
|
"build:native:debug": "napi build --platform --js false",
|
|
74
75
|
"build:ts": "tsc -p tsconfig.json",
|
|
75
|
-
"build": "
|
|
76
|
+
"build": "yarn run build:native && yarn run build:ts",
|
|
76
77
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
77
78
|
"test": "vitest run",
|
|
78
79
|
"test:watch": "vitest",
|
|
80
|
+
"lint": "eslint ts test",
|
|
79
81
|
"bench": "node bench/run.mjs",
|
|
80
82
|
"artifacts": "napi artifacts",
|
|
81
83
|
"create-npm-dirs": "napi create-npm-dir -t .",
|
|
82
84
|
"copy-license": "node -e \"const fs=require('fs'); try { fs.copyFileSync('../../../LICENSE','LICENSE'); } catch (e) { if (e.code !== 'ENOENT') throw e; }\"",
|
|
83
|
-
"prepack": "
|
|
85
|
+
"prepack": "yarn run sync:types && yarn run copy-license && yarn run build",
|
|
84
86
|
"pack:dry": "npm pack --dry-run"
|
|
85
87
|
},
|
|
86
88
|
"devDependencies": {
|
|
87
89
|
"@napi-rs/cli": "^2.18.4",
|
|
88
90
|
"@types/node": "^22.7.4",
|
|
91
|
+
"eslint": "^9.15.0",
|
|
89
92
|
"typescript": "^5.6.2",
|
|
90
93
|
"vitest": "^2.1.1"
|
|
91
94
|
},
|
|
92
95
|
"optionalDependencies": {
|
|
93
|
-
"@loradb/lora-node-linux-x64-gnu": "0.
|
|
94
|
-
"@loradb/lora-node-linux-arm64-gnu": "0.
|
|
95
|
-
"@loradb/lora-node-darwin-x64": "0.
|
|
96
|
-
"@loradb/lora-node-darwin-arm64": "0.
|
|
97
|
-
"@loradb/lora-node-win32-x64-msvc": "0.
|
|
96
|
+
"@loradb/lora-node-linux-x64-gnu": "0.10.1",
|
|
97
|
+
"@loradb/lora-node-linux-arm64-gnu": "0.10.1",
|
|
98
|
+
"@loradb/lora-node-darwin-x64": "0.10.1",
|
|
99
|
+
"@loradb/lora-node-darwin-arm64": "0.10.1",
|
|
100
|
+
"@loradb/lora-node-win32-x64-msvc": "0.10.1"
|
|
98
101
|
}
|
|
99
102
|
}
|
package/ts/native.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare class Database {
|
|
|
62
62
|
statements: Array<{ query: string; params?: Record<string, unknown> | null }>,
|
|
63
63
|
mode?: "read_write" | "read_only" | "readwrite" | "readonly" | "rw" | "ro" | null,
|
|
64
64
|
): Promise<Buffer[]>;
|
|
65
|
-
/** Force pending WAL bytes and the portable
|
|
65
|
+
/** Force pending WAL bytes and the portable container mirror to disk. */
|
|
66
66
|
sync(): Promise<void>;
|
|
67
67
|
clear(): Promise<void>;
|
|
68
68
|
nodeCount(): number;
|
package/ts/native.js
CHANGED
|
@@ -14,8 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
|
+
// Intentional CJS module: the file uses `require()` to dynamically
|
|
18
|
+
// resolve `.node` binaries based on platform/arch, which is a CJS-only
|
|
19
|
+
// pattern. ESM `import` can't load `.node` addons by path at runtime.
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
21
|
+
|
|
17
22
|
const { platform, arch } = process;
|
|
18
|
-
const { existsSync
|
|
23
|
+
const { existsSync } = require("node:fs");
|
|
19
24
|
const { join } = require("node:path");
|
|
20
25
|
const { execSync } = require("node:child_process");
|
|
21
26
|
|