nedb-engine 2.2.14 → 2.2.22

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/nedbd-v2.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ // nedbd-v2 — thin platform shim that locates and spawns the right
3
+ // pre-built native binary for the current platform/arch.
4
+ //
5
+ // The actual native binaries are shipped alongside this file in the
6
+ // npm package root (same directory as package.json). Naming convention
7
+ // matches the .node files produced by napi-rs:
8
+ //
9
+ // Linux x64 -> nedbd-v2-linux-x64
10
+ // Windows x64 -> nedbd-v2-win-x64.exe
11
+ // macOS arm64 -> nedbd-v2-darwin-arm64
12
+ // macOS x64 -> nedbd-v2-darwin-x64
13
+ //
14
+ // We pass through stdin/stdout/stderr and exit with the child's exit code so
15
+ // `npx nedbd-v2 …` is indistinguishable from invoking the binary directly.
16
+
17
+ "use strict";
18
+
19
+ const { spawn } = require("child_process");
20
+ const path = require("path");
21
+ const fs = require("fs");
22
+
23
+ function resolveBinaryName() {
24
+ const platform = process.platform; // 'linux' | 'darwin' | 'win32' | ...
25
+ const arch = process.arch; // 'x64' | 'arm64' | ...
26
+
27
+ if (platform === "linux" && arch === "x64") {
28
+ return "nedbd-v2-linux-x64";
29
+ }
30
+ if (platform === "win32" && arch === "x64") {
31
+ return "nedbd-v2-win-x64.exe";
32
+ }
33
+ if (platform === "darwin" && arch === "arm64") {
34
+ return "nedbd-v2-darwin-arm64";
35
+ }
36
+ if (platform === "darwin" && arch === "x64") {
37
+ return "nedbd-v2-darwin-x64";
38
+ }
39
+ return null;
40
+ }
41
+
42
+ function main() {
43
+ const name = resolveBinaryName();
44
+ if (!name) {
45
+ process.stderr.write(
46
+ `nedbd-v2: unsupported platform/arch: ${process.platform}/${process.arch}\n` +
47
+ `Supported: linux-x64, win32-x64, darwin-arm64, darwin-x64\n`
48
+ );
49
+ process.exit(1);
50
+ }
51
+
52
+ const binPath = path.join(__dirname, name);
53
+ if (!fs.existsSync(binPath)) {
54
+ process.stderr.write(
55
+ `nedbd-v2: binary not found for this platform: ${binPath}\n` +
56
+ `The nedb-engine npm package may be missing the prebuilt binary for ` +
57
+ `${process.platform}/${process.arch}.\n`
58
+ );
59
+ process.exit(1);
60
+ }
61
+
62
+ // Ensure executable bit on POSIX (npm sometimes strips it from tarballs).
63
+ if (process.platform !== "win32") {
64
+ try {
65
+ fs.chmodSync(binPath, 0o755);
66
+ } catch (_err) {
67
+ // best-effort; ignore — spawn will surface a clearer error if needed.
68
+ }
69
+ }
70
+
71
+ const child = spawn(binPath, process.argv.slice(2), {
72
+ stdio: "inherit",
73
+ windowsHide: false,
74
+ });
75
+
76
+ child.on("error", (err) => {
77
+ process.stderr.write(`nedbd-v2: failed to spawn ${binPath}: ${err.message}\n`);
78
+ process.exit(1);
79
+ });
80
+
81
+ child.on("exit", (code, signal) => {
82
+ if (signal) {
83
+ // Re-raise the signal so shells see the correct termination cause.
84
+ process.kill(process.pid, signal);
85
+ return;
86
+ }
87
+ process.exit(code === null ? 1 : code);
88
+ });
89
+ }
90
+
91
+ main();
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "nedb-engine",
3
- "version": "2.2.14",
3
+ "version": "2.2.22",
4
4
  "description": "NEDB — 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
  "types": "index.d.ts",
7
+ "bin": {
8
+ "nedbd-v2": "./nedbd-v2.js",
9
+ "nedbdv2": "./nedbd-v2.js"
10
+ },
7
11
  "files": [
8
12
  "index.js",
9
13
  "index.d.ts",
14
+ "nedbd-v2.js",
10
15
  "*.node",
16
+ "nedbd-v2*",
11
17
  "README.md",
12
18
  "LICENSE"
13
19
  ],