nedb-engine 8.8.9 → 9.0.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/index.d.ts +64 -64
- package/index.js +84 -84
- package/nedb.linux-arm64-gnu.node +0 -0
- package/nedb.linux-arm64-musl.node +0 -0
- package/nedb.linux-x64-gnu.node +0 -0
- package/nedb.linux-x64-musl.node +0 -0
- package/nedb.win32-x64-msvc.node +0 -0
- package/nedbd-v2-darwin-arm64 +0 -0
- package/nedbd-v2-darwin-x64 +0 -0
- package/nedbd-v2-linux-arm64 +0 -0
- package/nedbd-v2-linux-arm64-musl +0 -0
- package/nedbd-v2-linux-x64 +0 -0
- package/nedbd-v2-linux-x64-musl +0 -0
- package/nedbd-v2-win-x64.exe +0 -0
- package/nesql-linux-arm64 +0 -0
- package/nesql-linux-arm64-musl +0 -0
- package/nesql-linux-x64 +0 -0
- package/nesql-linux-x64-musl +0 -0
- package/nesql-win-x64.exe +0 -0
- package/nesql.js +50 -5
- package/package.json +1 -1
- package/nedb.darwin-arm64.node +0 -0
- package/nedb.darwin-x64.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
// nedb-engine — public type surface.
|
|
2
|
-
//
|
|
3
|
-
// Runtime behavior (durable-mode auto-flush-on-exit) is added by the wrapper in
|
|
4
|
-
// index.js; the type surface is exactly the generated native binding's.
|
|
5
|
-
export * from './native';
|
|
6
|
-
|
|
7
|
-
// ── wrap adapter family (wrap/*.js) ─────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
/** Options accepted by every wrap_* constructor. */
|
|
10
|
-
export interface WrapOptions {
|
|
11
|
-
/** Logical database name (default "default"). */
|
|
12
|
-
dbName?: string;
|
|
13
|
-
/** HTTP nedbd server (v1 AOF, `--dag` v2, `--dag-v3` v3). Overrides embedded DAG. */
|
|
14
|
-
nedbdUrl?: string;
|
|
15
|
-
/** Bearer token for nedbd (NEDBD_TOKEN on the server). */
|
|
16
|
-
nedbdToken?: string;
|
|
17
|
-
/** Durable DAG store directory (embedded mode). */
|
|
18
|
-
dagPath?: string;
|
|
19
|
-
/** 64-hex TMK → AES-256-GCM at-rest encryption (embedded DAG mode). */
|
|
20
|
-
dagTmk?: string;
|
|
21
|
-
/** Explicit NedbCore class (testing / custom builds). */
|
|
22
|
-
native?: unknown;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** The `.nedb` attribute — full NEDB layer-2 API. */
|
|
26
|
-
export interface NedbSurface {
|
|
27
|
-
register(pattern: string, collection: string, opts?: {
|
|
28
|
-
idExtractor?: (key: string) => string;
|
|
29
|
-
valueParser?: (raw: unknown) => Record<string, unknown>;
|
|
30
|
-
valueType?: 'string' | 'hash' | 'json';
|
|
31
|
-
}): NedbSurface;
|
|
32
|
-
backfill(opts?: { pattern?: string; collection?: string; batchSize?: number }): number;
|
|
33
|
-
shadowWrites: boolean;
|
|
34
|
-
readonly engineKind: 'dag-embedded' | 'nedbd-http' | 'aof-embedded';
|
|
35
|
-
|
|
36
|
-
put(coll: string, id: string, doc: Record<string, unknown>): Record<string, unknown>;
|
|
37
|
-
get(coll: string, id: string, asOf?: number): Record<string, unknown> | null;
|
|
38
|
-
query(nql: string): Array<Record<string, unknown>>;
|
|
39
|
-
createIndex(coll: string, field: string, kind?: string): void;
|
|
40
|
-
delete(coll: string, id: string): void;
|
|
41
|
-
link(frm: string, rel: string, to: string): void;
|
|
42
|
-
unlink(frm: string, rel: string, to: string): void;
|
|
43
|
-
neighbors(frm: string, rel: string, asOf?: number): string[];
|
|
44
|
-
inbound(to: string, rel: string, asOf?: number): string[];
|
|
45
|
-
verify(): boolean;
|
|
46
|
-
readonly head: string;
|
|
47
|
-
readonly seq: number;
|
|
48
|
-
checkpoint(): string;
|
|
49
|
-
/** DAG-native: latest node (null on non-DAG backends). */
|
|
50
|
-
tip(): Record<string, unknown> | null;
|
|
51
|
-
/** DAG-native: changefeed page, after_seq exclusive. */
|
|
52
|
-
since(afterSeq: number | bigint, limit?: number): {
|
|
53
|
-
nodes: Array<Record<string, unknown>>; from_seq: number; to_seq: number;
|
|
54
|
-
head_seq: number; has_more: boolean;
|
|
55
|
-
};
|
|
56
|
-
/** DAG-native: replication readiness. */
|
|
57
|
-
scanStatus(): { scan_complete: boolean; tip_seq: number; indexed_count: number; [k: string]: unknown };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export declare function wrapRedis<T extends object = object>(client: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
61
|
-
export declare function wrapSqlite<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
62
|
-
export declare function wrapMysql<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
63
|
-
export declare function wrapPg<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
64
|
-
export declare function wrapMongo<T extends object = object>(client: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
1
|
+
// nedb-engine — public type surface.
|
|
2
|
+
//
|
|
3
|
+
// Runtime behavior (durable-mode auto-flush-on-exit) is added by the wrapper in
|
|
4
|
+
// index.js; the type surface is exactly the generated native binding's.
|
|
5
|
+
export * from './native';
|
|
6
|
+
|
|
7
|
+
// ── wrap adapter family (wrap/*.js) ─────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/** Options accepted by every wrap_* constructor. */
|
|
10
|
+
export interface WrapOptions {
|
|
11
|
+
/** Logical database name (default "default"). */
|
|
12
|
+
dbName?: string;
|
|
13
|
+
/** HTTP nedbd server (v1 AOF, `--dag` v2, `--dag-v3` v3). Overrides embedded DAG. */
|
|
14
|
+
nedbdUrl?: string;
|
|
15
|
+
/** Bearer token for nedbd (NEDBD_TOKEN on the server). */
|
|
16
|
+
nedbdToken?: string;
|
|
17
|
+
/** Durable DAG store directory (embedded mode). */
|
|
18
|
+
dagPath?: string;
|
|
19
|
+
/** 64-hex TMK → AES-256-GCM at-rest encryption (embedded DAG mode). */
|
|
20
|
+
dagTmk?: string;
|
|
21
|
+
/** Explicit NedbCore class (testing / custom builds). */
|
|
22
|
+
native?: unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The `.nedb` attribute — full NEDB layer-2 API. */
|
|
26
|
+
export interface NedbSurface {
|
|
27
|
+
register(pattern: string, collection: string, opts?: {
|
|
28
|
+
idExtractor?: (key: string) => string;
|
|
29
|
+
valueParser?: (raw: unknown) => Record<string, unknown>;
|
|
30
|
+
valueType?: 'string' | 'hash' | 'json';
|
|
31
|
+
}): NedbSurface;
|
|
32
|
+
backfill(opts?: { pattern?: string; collection?: string; batchSize?: number }): number;
|
|
33
|
+
shadowWrites: boolean;
|
|
34
|
+
readonly engineKind: 'dag-embedded' | 'nedbd-http' | 'aof-embedded';
|
|
35
|
+
|
|
36
|
+
put(coll: string, id: string, doc: Record<string, unknown>): Record<string, unknown>;
|
|
37
|
+
get(coll: string, id: string, asOf?: number): Record<string, unknown> | null;
|
|
38
|
+
query(nql: string): Array<Record<string, unknown>>;
|
|
39
|
+
createIndex(coll: string, field: string, kind?: string): void;
|
|
40
|
+
delete(coll: string, id: string): void;
|
|
41
|
+
link(frm: string, rel: string, to: string): void;
|
|
42
|
+
unlink(frm: string, rel: string, to: string): void;
|
|
43
|
+
neighbors(frm: string, rel: string, asOf?: number): string[];
|
|
44
|
+
inbound(to: string, rel: string, asOf?: number): string[];
|
|
45
|
+
verify(): boolean;
|
|
46
|
+
readonly head: string;
|
|
47
|
+
readonly seq: number;
|
|
48
|
+
checkpoint(): string;
|
|
49
|
+
/** DAG-native: latest node (null on non-DAG backends). */
|
|
50
|
+
tip(): Record<string, unknown> | null;
|
|
51
|
+
/** DAG-native: changefeed page, after_seq exclusive. */
|
|
52
|
+
since(afterSeq: number | bigint, limit?: number): {
|
|
53
|
+
nodes: Array<Record<string, unknown>>; from_seq: number; to_seq: number;
|
|
54
|
+
head_seq: number; has_more: boolean;
|
|
55
|
+
};
|
|
56
|
+
/** DAG-native: replication readiness. */
|
|
57
|
+
scanStatus(): { scan_complete: boolean; tip_seq: number; indexed_count: number; [k: string]: unknown };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare function wrapRedis<T extends object = object>(client: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
61
|
+
export declare function wrapSqlite<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
62
|
+
export declare function wrapMysql<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
63
|
+
export declare function wrapPg<T extends object = object>(conn: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
|
64
|
+
export declare function wrapMongo<T extends object = object>(client: T, opts?: WrapOptions): T & { nedb: NedbSurface };
|
package/index.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: 2026 INTERCHAINED LLC
|
|
2
|
-
// SPDX-License-Identifier: BUSL-1.1
|
|
3
|
-
// NEDB · © 2026 INTERCHAINED LLC × Eth-Interchained × Vex (Claude Opus 5)
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
// nedb-engine — durable-mode auto-flush-on-exit wrapper.
|
|
7
|
-
//
|
|
8
|
-
// The native addon (generated napi binding in ./native.js) exposes `NedbCore`.
|
|
9
|
-
// A durable `NedbCore.open(path)` buffers writes in the engine's id-index WAL and
|
|
10
|
-
// only makes them durable on `flush()`; a hard exit (Ctrl+C, `SIGTERM` from an
|
|
11
|
-
// orchestrator, `pm2 stop`) that never runs an explicit flush would lose writes
|
|
12
|
-
// staged since the last flush.
|
|
13
|
-
//
|
|
14
|
-
// We close that gap the libuv-cooperative way — `process.on('SIGINT'|'SIGTERM'
|
|
15
|
-
// |'exit', () => db.flush())` — NOT a C-level signal handler inside the addon,
|
|
16
|
-
// which would clobber libuv's own signal machinery. In-memory databases
|
|
17
|
-
// (`new NedbCore()`) are never armed; there is nothing to flush.
|
|
18
|
-
//
|
|
19
|
-
// Escape hatch: set NEDB_NO_EXIT_FLUSH=1 to leave signal handling entirely to
|
|
20
|
-
// the host app (it can still call `db.flush()` itself).
|
|
21
|
-
//
|
|
22
|
-
// © INTERCHAINED LLC × Vex (Interchained AI fleet: GLM · Claude · Opus · Fable · GPT-6)
|
|
23
|
-
const native = require('./native.js');
|
|
24
|
-
|
|
25
|
-
const Native = native.NedbCore;
|
|
26
|
-
|
|
27
|
-
// The napi class defines `open` as a NON-writable, NON-configurable static, so the
|
|
28
|
-
// 2.5.x wrapper's `NedbCore.open = …` threw ("Cannot assign to read only property")
|
|
29
|
-
// — and CI's `napi build` was overwriting this file with the generated loader
|
|
30
|
-
// anyway, so the published package never carried the wrapper at all. Both fixed
|
|
31
|
-
// in 2.8.5: wrap by SUBCLASS (an own static on the subclass shadows the parent's),
|
|
32
|
-
// build with `--js native.js` so this file survives, and gate the publish on
|
|
33
|
-
// `NedbCore.__exitFlushWrapped` (see test/durability.test.mjs).
|
|
34
|
-
let NedbCore = Native;
|
|
35
|
-
if (Native && typeof Native.open === 'function' && !Native.__exitFlushWrapped) {
|
|
36
|
-
// Durable handles opened in this process. Strong refs: a durable DB is meant to
|
|
37
|
-
// live for the process, and we must be able to flush it on the way out.
|
|
38
|
-
const live = new Set();
|
|
39
|
-
let armed = false;
|
|
40
|
-
|
|
41
|
-
const flushAll = () => {
|
|
42
|
-
for (const db of live) {
|
|
43
|
-
try {
|
|
44
|
-
db.flush();
|
|
45
|
-
} catch (_) {
|
|
46
|
-
// Best-effort on shutdown — never throw out of an exit handler.
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const arm = () => {
|
|
52
|
-
if (armed || process.env.NEDB_NO_EXIT_FLUSH) return;
|
|
53
|
-
armed = true;
|
|
54
|
-
// 'exit' fires on normal termination; handlers must be synchronous, and
|
|
55
|
-
// db.flush() is a synchronous native call — so this is safe and sufficient
|
|
56
|
-
// for clean exits and uncaught-exception exits.
|
|
57
|
-
process.on('exit', flushAll);
|
|
58
|
-
// Registering a SIGINT/SIGTERM listener SUPPRESSES Node's default
|
|
59
|
-
// termination, so once we listen we own the exit: flush, then terminate with
|
|
60
|
-
// the conventional 128+signum status.
|
|
61
|
-
const onSignal = (signum) => () => {
|
|
62
|
-
flushAll();
|
|
63
|
-
process.exit(128 + signum);
|
|
64
|
-
};
|
|
65
|
-
process.on('SIGINT', onSignal(2));
|
|
66
|
-
process.on('SIGTERM', onSignal(15));
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
NedbCore = class NedbCore extends Native {
|
|
70
|
-
static open(path) {
|
|
71
|
-
const db = Native.open(path);
|
|
72
|
-
live.add(db);
|
|
73
|
-
arm();
|
|
74
|
-
return db;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
// Mark so a re-require (or a wrapped re-export) never double-wraps.
|
|
78
|
-
Object.defineProperty(NedbCore, '__exitFlushWrapped', { value: true, enumerable: false });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
module.exports = { ...native, NedbCore };
|
|
82
|
-
// Explicit named re-export so ESM `import { NedbCore } from 'nedb-engine'` (used
|
|
83
|
-
// by the test suite) resolves the class through cjs-module-lexer.
|
|
84
|
-
module.exports.NedbCore = NedbCore;
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 INTERCHAINED LLC
|
|
2
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
3
|
+
// NEDB · © 2026 INTERCHAINED LLC × Eth-Interchained × Vex (Claude Opus 5)
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
// nedb-engine — durable-mode auto-flush-on-exit wrapper.
|
|
7
|
+
//
|
|
8
|
+
// The native addon (generated napi binding in ./native.js) exposes `NedbCore`.
|
|
9
|
+
// A durable `NedbCore.open(path)` buffers writes in the engine's id-index WAL and
|
|
10
|
+
// only makes them durable on `flush()`; a hard exit (Ctrl+C, `SIGTERM` from an
|
|
11
|
+
// orchestrator, `pm2 stop`) that never runs an explicit flush would lose writes
|
|
12
|
+
// staged since the last flush.
|
|
13
|
+
//
|
|
14
|
+
// We close that gap the libuv-cooperative way — `process.on('SIGINT'|'SIGTERM'
|
|
15
|
+
// |'exit', () => db.flush())` — NOT a C-level signal handler inside the addon,
|
|
16
|
+
// which would clobber libuv's own signal machinery. In-memory databases
|
|
17
|
+
// (`new NedbCore()`) are never armed; there is nothing to flush.
|
|
18
|
+
//
|
|
19
|
+
// Escape hatch: set NEDB_NO_EXIT_FLUSH=1 to leave signal handling entirely to
|
|
20
|
+
// the host app (it can still call `db.flush()` itself).
|
|
21
|
+
//
|
|
22
|
+
// © INTERCHAINED LLC × Vex (Interchained AI fleet: GLM · Claude · Opus · Fable · GPT-6)
|
|
23
|
+
const native = require('./native.js');
|
|
24
|
+
|
|
25
|
+
const Native = native.NedbCore;
|
|
26
|
+
|
|
27
|
+
// The napi class defines `open` as a NON-writable, NON-configurable static, so the
|
|
28
|
+
// 2.5.x wrapper's `NedbCore.open = …` threw ("Cannot assign to read only property")
|
|
29
|
+
// — and CI's `napi build` was overwriting this file with the generated loader
|
|
30
|
+
// anyway, so the published package never carried the wrapper at all. Both fixed
|
|
31
|
+
// in 2.8.5: wrap by SUBCLASS (an own static on the subclass shadows the parent's),
|
|
32
|
+
// build with `--js native.js` so this file survives, and gate the publish on
|
|
33
|
+
// `NedbCore.__exitFlushWrapped` (see test/durability.test.mjs).
|
|
34
|
+
let NedbCore = Native;
|
|
35
|
+
if (Native && typeof Native.open === 'function' && !Native.__exitFlushWrapped) {
|
|
36
|
+
// Durable handles opened in this process. Strong refs: a durable DB is meant to
|
|
37
|
+
// live for the process, and we must be able to flush it on the way out.
|
|
38
|
+
const live = new Set();
|
|
39
|
+
let armed = false;
|
|
40
|
+
|
|
41
|
+
const flushAll = () => {
|
|
42
|
+
for (const db of live) {
|
|
43
|
+
try {
|
|
44
|
+
db.flush();
|
|
45
|
+
} catch (_) {
|
|
46
|
+
// Best-effort on shutdown — never throw out of an exit handler.
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const arm = () => {
|
|
52
|
+
if (armed || process.env.NEDB_NO_EXIT_FLUSH) return;
|
|
53
|
+
armed = true;
|
|
54
|
+
// 'exit' fires on normal termination; handlers must be synchronous, and
|
|
55
|
+
// db.flush() is a synchronous native call — so this is safe and sufficient
|
|
56
|
+
// for clean exits and uncaught-exception exits.
|
|
57
|
+
process.on('exit', flushAll);
|
|
58
|
+
// Registering a SIGINT/SIGTERM listener SUPPRESSES Node's default
|
|
59
|
+
// termination, so once we listen we own the exit: flush, then terminate with
|
|
60
|
+
// the conventional 128+signum status.
|
|
61
|
+
const onSignal = (signum) => () => {
|
|
62
|
+
flushAll();
|
|
63
|
+
process.exit(128 + signum);
|
|
64
|
+
};
|
|
65
|
+
process.on('SIGINT', onSignal(2));
|
|
66
|
+
process.on('SIGTERM', onSignal(15));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
NedbCore = class NedbCore extends Native {
|
|
70
|
+
static open(path) {
|
|
71
|
+
const db = Native.open(path);
|
|
72
|
+
live.add(db);
|
|
73
|
+
arm();
|
|
74
|
+
return db;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
// Mark so a re-require (or a wrapped re-export) never double-wraps.
|
|
78
|
+
Object.defineProperty(NedbCore, '__exitFlushWrapped', { value: true, enumerable: false });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = { ...native, NedbCore };
|
|
82
|
+
// Explicit named re-export so ESM `import { NedbCore } from 'nedb-engine'` (used
|
|
83
|
+
// by the test suite) resolves the class through cjs-module-lexer.
|
|
84
|
+
module.exports.NedbCore = NedbCore;
|
|
Binary file
|
|
Binary file
|
package/nedb.linux-x64-gnu.node
CHANGED
|
Binary file
|
package/nedb.linux-x64-musl.node
CHANGED
|
Binary file
|
package/nedb.win32-x64-msvc.node
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-arm64
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-x64
CHANGED
|
Binary file
|
package/nedbd-v2-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
package/nedbd-v2-linux-x64
CHANGED
|
Binary file
|
package/nedbd-v2-linux-x64-musl
CHANGED
|
Binary file
|
package/nedbd-v2-win-x64.exe
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/nesql-linux-x64
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/nesql.js
CHANGED
|
@@ -33,15 +33,52 @@ const { spawn } = require("child_process");
|
|
|
33
33
|
const path = require("path");
|
|
34
34
|
const fs = require("fs");
|
|
35
35
|
|
|
36
|
+
// Keyed platform-arch, with the Linux legs split by libc.
|
|
37
|
+
//
|
|
38
|
+
// This table promised four platforms while the published package carried a
|
|
39
|
+
// binary for NONE of them (v8.0.0 through v9.0.0): the build that arch-named
|
|
40
|
+
// these files ran in a job that never uploaded them. The table was not the
|
|
41
|
+
// bug, but it was the thing that made the bug speak -- so it now covers every
|
|
42
|
+
// binary the release actually builds, rather than a subset chosen by hand.
|
|
36
43
|
const SUPPORTED = {
|
|
37
44
|
"linux-x64": "nesql-linux-x64",
|
|
45
|
+
"linux-arm64": "nesql-linux-arm64",
|
|
46
|
+
"linux-x64-musl": "nesql-linux-x64-musl",
|
|
47
|
+
"linux-arm64-musl": "nesql-linux-arm64-musl",
|
|
38
48
|
"win32-x64": "nesql-win-x64.exe",
|
|
39
49
|
"darwin-arm64": "nesql-darwin-arm64",
|
|
40
50
|
"darwin-x64": "nesql-darwin-x64",
|
|
41
51
|
};
|
|
42
52
|
|
|
53
|
+
// musl and glibc binaries are not interchangeable, and the failure when they
|
|
54
|
+
// are swapped is a loader error that names neither libc. Node reports the
|
|
55
|
+
// runtime glibc version in its process report; on musl the field is simply
|
|
56
|
+
// absent. That is the same probe napi-rs uses to pick an addon, so a musl
|
|
57
|
+
// Alpine container resolves the musl CLI for the same reason it resolves the
|
|
58
|
+
// musl addon.
|
|
59
|
+
function libcSuffix() {
|
|
60
|
+
if (process.platform !== "linux") return "";
|
|
61
|
+
try {
|
|
62
|
+
const rep = typeof process.report?.getReport === "function"
|
|
63
|
+
? process.report.getReport()
|
|
64
|
+
: null;
|
|
65
|
+
if (rep && rep.header && !rep.header.glibcVersionRuntime) return "-musl";
|
|
66
|
+
} catch (err) {
|
|
67
|
+
// Named, not swallowed: if the probe itself breaks we fall through to the
|
|
68
|
+
// glibc name, and the reader needs to know that is a GUESS rather than a
|
|
69
|
+
// detection, because the resulting error will be a confusing loader
|
|
70
|
+
// failure rather than a clean "unsupported platform".
|
|
71
|
+
process.stderr.write(
|
|
72
|
+
`nesql: could not probe libc (${err.message}); assuming glibc. ` +
|
|
73
|
+
`If this is Alpine/musl and the next error is a loader failure, that ` +
|
|
74
|
+
`is why.\n`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
|
|
43
80
|
function main() {
|
|
44
|
-
const key = `${process.platform}-${process.arch}`;
|
|
81
|
+
const key = `${process.platform}-${process.arch}${libcSuffix()}`;
|
|
45
82
|
const name = SUPPORTED[key];
|
|
46
83
|
|
|
47
84
|
if (!name) {
|
|
@@ -55,13 +92,21 @@ function main() {
|
|
|
55
92
|
|
|
56
93
|
const binPath = path.join(__dirname, name);
|
|
57
94
|
if (!fs.existsSync(binPath)) {
|
|
95
|
+
// The remedy list used to lead with `npm install --force nedb-engine`,
|
|
96
|
+
// which cannot work and wasted the reader's time: through v9.0.0 no
|
|
97
|
+
// published version contained a nesql binary for ANY platform, so
|
|
98
|
+
// reinstalling fetched the same incomplete tarball. Do not suggest a
|
|
99
|
+
// reinstall as a fix for a packaging gap -- name the gap.
|
|
58
100
|
process.stderr.write(
|
|
59
|
-
`nesql: the prebuilt binary is missing
|
|
101
|
+
`nesql: the prebuilt binary is missing from this package.\n` +
|
|
60
102
|
` expected: ${binPath}\n` +
|
|
61
103
|
` platform: ${key}\n\n` +
|
|
62
|
-
`This
|
|
63
|
-
`
|
|
64
|
-
`
|
|
104
|
+
`This is a packaging gap, not a corrupt install -- reinstalling will\n` +
|
|
105
|
+
`fetch the same tarball. Working alternatives right now:\n\n` +
|
|
106
|
+
` pip install nedb-engine && nesql --help # the wheel ships the CLI\n` +
|
|
107
|
+
` cargo install nesql # builds from source\n\n` +
|
|
108
|
+
`Please report it with the two lines above:\n` +
|
|
109
|
+
` https://github.com/Eth-Interchained/nedb/issues\n`
|
|
65
110
|
);
|
|
66
111
|
process.exit(5);
|
|
67
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nedb-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "NEDB \u2014 hash-chained, time-traveling, bi-temporal embedded database with Rust native core. SQL, Redis, MongoDB adapters. Causal Write Provenance. RESP2 wire protocol.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
package/nedb.darwin-arm64.node
DELETED
|
Binary file
|
package/nedb.darwin-x64.node
DELETED
|
Binary file
|