@kedem/okdb 2.7.0 → 3.0.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/CHANGELOG.md CHANGED
@@ -4,11 +4,64 @@ All notable changes to `@kedem/okdb` are documented here. Format loosely follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.0.0/); versions follow [SemVer](https://semver.org/).
5
5
  Dates are release dates.
6
6
 
7
+ ## [3.0.0] - 2026-10-18
8
+
9
+ okdb 3 is a Rust core with the same JavaScript API. The storage format is unchanged: a store written by 2.x opens
10
+ as-is, with no migration and no index rebuild. Read [UPGRADING-v3](rs/UPGRADING-v3.md) before upgrading: stop
11
+ every 2.x process before okdb 3 opens a store, and never run 2.x and 3.x writers on one store at the same time.
12
+
13
+ ### Changed (read before upgrading)
14
+
15
+ - **Native only, bundled, Linux x64 glibc only.** `@kedem/okdb` ships the Rust core inside the package
16
+ (`native/linux-x64-gnu/okdb-node.linux-x64-gnu.node`, no separate platform package); the 2.x JavaScript implementation
17
+ is no longer included and there is no JS fallback. npm refuses other platforms (`"os": ["linux"], "cpu": ["x64"]`,
18
+ `EBADPLATFORM`); on any other host, or when the addon fails to load, `require` throws `NATIVE_UNAVAILABLE` naming the
19
+ platform. `OKDB_NATIVE_BINARY` overrides the bundled addon. Runtime dependencies are only `msgpackr` and `sift`.
20
+ - **The `okdb` command is native** (a small launcher that runs the CLI inside the addon; no Node needed).
21
+ - **Coded errors** replace several free-text errors (`INVALID_KEY`, `INVALID_TYPE_NAME`, `INVALID_ARGUMENT`,
22
+ `INVALID_OPTIONS`, …): see UPGRADING-v3.
23
+ - **Opening retries transient storage errors** for about 2.4 s and never quarantines an environment for them;
24
+ if one outlasts the retries, `open()` fails (restart the process). Corruption still quarantines the tenant env.
25
+ - **Plugins:** 2.x JS plugins work through the Node binding; `start()` runs after the whole open, and `okdb.api`
26
+ / `okdb.admin` are not available. See [PLUGINS-v3](rs/PLUGINS-v3.md).
27
+
28
+ ### Added
29
+
30
+ - **A stable C bridge** (`okdb_bridge.h`, ABI 1.2) exported by the addon: open or attach to a live instance,
31
+ dispatch / batch / submit from any thread, read-only `read` from any thread, host callbacks (events, embedders,
32
+ chunk strategies), log routing. Lets native programs use okdb without compiling it in.
33
+ - **Thread-safe reads** in the core (a read-only handle used by the bridge's `read`).
34
+
35
+ ### Measured against 2.x (same machine; recorded once at release)
36
+
37
+ - Real applications: the brain test suite runs in 655 s (2.x 788 s); okcode cold indexing uses 4.5 s CPU
38
+ (2.x 8.6 s), 3.2 s wall (2.x 14.4 s), 311 MB peak memory (2.x 490 MB); its test suite runs in 110 s (238 s).
39
+ A 346 MB production store opened and checked with 0 mismatches across 548 checks; full-text search was ~10×
40
+ faster.
41
+ - Reads (200k docs): `get` 3.4 µs (2.x 3.3), `getRange` 382 ms (370), `byIndex` 590 ms (559), `getChanges`
42
+ 322 ms (449), filtered query 355 ms (396), `getKeys` 32 ms (51), `getMany` of 100 keys 317 µs (380).
43
+ - Index builds: adding 6 indexes to a live production store took 6 s and wrote 1 GB (2.x: 909 s and 38.8 GB,
44
+ unfinished).
45
+ - Responsiveness: the longest event-loop stall while full-text indexing is ~150 ms (2.x 3.1 s); an idle process
46
+ wakes about once every 5 s for okdb's bus listener.
47
+ - Install size: about 29 MB (2.x about 110 MB with its native dependencies).
48
+ - Known gaps: a cold-built full-text index file is 1.3–2.5× the 2.x size; very long scans keep ~30 MB more
49
+ JavaScript heap.
50
+
51
+ ### Fixed (also known issues in 2.7.0)
52
+
53
+ - Opening a store no longer drops a concurrent commit from another process, and a peer closing a store no
54
+ longer breaks its locks for other processes (`EINVAL` on every write).
55
+ - `queue.samplePayloads()` returns data; views recover from a crash during a `$ref` section and from a halted
56
+ restart.
57
+ - Writes with `origin: ""` are checked like local writes; `VIEW_TYPE_NOT_REGISTERED` over HTTP is a 404.
58
+
7
59
  ## [2.7.0] - unreleased
8
60
 
9
61
  The last Node.js release line: okdb 3 is a Rust core that forks from this version. 2.7.0 fixes every bug
10
- found while porting, so a 2.7 process and an okdb 3 process can share a store and behave the same. The
11
- storage format is unchanged: no migrations, stores open as-is.
62
+ found while porting, so a store written by 2.7 opens in okdb 3 and behaves the same. The storage format is
63
+ unchanged: no migrations, stores open as-is. Upgrade by stopping every 2.x process, then opening the store
64
+ with okdb 3; do not run 2.x and 3.x writers on one store at the same time (see Known issue below).
12
65
 
13
66
  ### Changed (read before upgrading)
14
67
 
@@ -31,6 +84,27 @@ storage format is unchanged: no migrations, stores open as-is.
31
84
  Restart a process that reports `ENV_SWAPPED_UNDER`.
32
85
  - **Exports carry document versions** (`ver` on data lines). The importer already reads it.
33
86
 
87
+ ### Known issue
88
+
89
+ - **Opening a store can drop one concurrent write from another process.** The LMDB binding 2.x uses
90
+ (lmdb-js) resets a shared transaction counter whenever a process opens an environment. If another process
91
+ commits at that moment, that commit can be silently lost, even though it was acknowledged. The window is
92
+ narrow (we could not reproduce it in 140 loaded test runs, but it was observed once), and it applies to
93
+ stores shared by several 2.x processes, and to stores shared by 2.x and okdb 3 processes. 2.7.0 does not
94
+ change this. **To avoid it:** open every process's environments before write traffic starts, and upgrade
95
+ to okdb 3, whose storage layer does not have this bug. When upgrading, stop every 2.x process before an
96
+ okdb 3 process opens the store, and never run 2.x and 3.x writers on one store at the same time.
97
+
98
+ - **An environment can fail with `EINVAL` (Invalid argument) on every write after a peer closes it.** When a
99
+ process closes an environment while another process is opening it, lmdb-js can destroy the shared locks
100
+ the opener then uses; every write transaction in that process fails until all processes close the
101
+ environment. Restarting the affected processes recovers. Rare (it needs an open and a close to overlap).
102
+ Fixed in okdb 3.0, whose storage layer keeps those locks intact.
103
+ - **`queue.samplePayloads(type)` always returns `[]`.** Fixed in okdb 3.0.
104
+ - **A view whose `$ref` section crashed mid-scan stays `partially-ready`.** Restarting a halted view after a
105
+ reopen can also count an update to an existing key as a new key and miss grouped and `$ref` rows. Rebuild
106
+ the view (`views.rebuild(name)`) to recover. Fixed in okdb 3.0, which rebuilds such views on open.
107
+
34
108
  ### Fixed
35
109
 
36
110
  - **Full-text search lost postings** when a document lost a term and regained it before the next
@@ -39,8 +113,13 @@ storage format is unchanged: no migrations, stores open as-is.
39
113
  writes that a peer process skipped while the build ran.
40
114
  - **Sync:** a replica that was sent a remove for a key it never had wedged for good (`… does not exist`);
41
115
  it is now recorded as a no-op. A control pull no longer rewinds a newer data cursor, and an
42
- acknowledgement that lands during a GC sweep queues another sweep instead of being dropped.
116
+ acknowledgement that lands during a GC sweep queues another sweep instead of being dropped. A poke
117
+ that arrives while a pull from that peer is already running now triggers one more pull instead of
118
+ being dropped, so the last write of a burst no longer waits for the next unrelated event. Closing an
119
+ instance while a sync pull was running could crash the process; `close()` now waits for the pull
120
+ (up to a few seconds) before closing the environments.
43
121
  - **Queue `max_concurrency` never limited anything** (the running-job count scanned an empty range).
122
+ - **The queue worker could crash** when a peer's compaction closed its env while it was waiting for work.
44
123
  - **An index registered by one process was not maintained by processes already running** on the same
45
124
  store; writes now pick up the new index (they retry with `INDEX_SET_CHANGED` internally), and the build
46
125
  no longer overwrites a document written during its scan.
package/bin/okdb ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';const _0x43ed0a=_0x534d;(function(_0x386ae9,_0x58d115){const _0x100047=_0x534d,_0x55f4b7=_0x386ae9();while(!![]){try{const _0x35076d=-parseInt(_0x100047(0x9d))/0x1*(parseInt(_0x100047(0xc1))/0x2)+-parseInt(_0x100047(0xb7))/0x3+-parseInt(_0x100047(0xcb))/0x4*(-parseInt(_0x100047(0xa9))/0x5)+parseInt(_0x100047(0xc6))/0x6*(parseInt(_0x100047(0xae))/0x7)+parseInt(_0x100047(0x9f))/0x8+parseInt(_0x100047(0xc8))/0x9*(-parseInt(_0x100047(0xbe))/0xa)+parseInt(_0x100047(0xb1))/0xb;if(_0x35076d===_0x58d115)break;else _0x55f4b7['push'](_0x55f4b7['shift']());}catch(_0x1fc31b){_0x55f4b7['push'](_0x55f4b7['shift']());}}}(_0xb8f6,0xa45ed));const path=require('node:path'),fs=require(_0x43ed0a(0xbc)),root=path[_0x43ed0a(0xa6)](__dirname,'..'),which=process[_0x43ed0a(0xb5)][0x2]==='--okdb-which';function die(_0x1f4b66){const _0x35c563=_0x43ed0a;console[_0x35c563(0xc4)](_0x35c563(0xc3)+_0x1f4b66+_0x35c563(0xaf)+_0x35c563(0xbf)),process['exit'](0x1);}function _0x534d(_0x488a1a,_0x251dbc){_0x488a1a=_0x488a1a-0x99;const _0xb8f67a=_0xb8f6();let _0x534de9=_0xb8f67a[_0x488a1a];return _0x534de9;}function resolveLauncher(){const _0xe050ed=_0x43ed0a;if(process.env.OKDB_SHIM_ACTIVE==='1')return{'reason':_0xe050ed(0xac)};let _0x5d3e53;try{_0x5d3e53=require(path[_0xe050ed(0xbd)](root,_0xe050ed(0xbb)));}catch(_0x419089){return{'reason':_0x419089[_0xe050ed(0x9c)]};}const _0x592b05=_0x5d3e53[_0xe050ed(0xa5)](_0xe050ed(0xa1));if(!_0x592b05['path'])return{'reason':_0x592b05[_0xe050ed(0xaa)]};try{if(fs[_0xe050ed(0xc5)](_0x592b05[_0xe050ed(0xa2)])===fs['realpathSync'](__filename))return{'reason':_0x592b05[_0xe050ed(0xa2)]+_0xe050ed(0xb6)};if(fs[_0xe050ed(0xba)](_0x592b05[_0xe050ed(0xa2)])['subarray'](0x0,0x2)[_0xe050ed(0x9b)]()==='#!')return{'reason':_0x592b05[_0xe050ed(0xa2)]+_0xe050ed(0xb3)};}catch(_0x3c513c){return{'reason':_0x3c513c[_0xe050ed(0x9c)]};}const _0x42b638=_0x5d3e53[_0xe050ed(0xa5)](_0xe050ed(0xca));return{'loc':_0x592b05,'addon':_0x42b638[_0xe050ed(0xa2)]};}const {loc,addon,reason}=resolveLauncher();if(!loc)die(reason);which&&(console[_0x43ed0a(0xc2)]('native\x20'+loc[_0x43ed0a(0xa2)]+'\x20('+loc[_0x43ed0a(0xa4)]+',\x20'+loc[_0x43ed0a(0x99)]+')'+(addon?_0x43ed0a(0xab)+addon:'')),process[_0x43ed0a(0x9e)](0x0));function _0xb8f6(){const _0x2d751b=['reason','\x20addon\x20','nested\x20shim\x20(OKDB_SHIM_ACTIVE)','spawn','238rlvsdM','.\x20okdb\x203.x\x20bundles\x20the\x20CLI\x20under\x20native/<platform>/okdb\x20(3.0:\x20Linux\x20x64\x20glibc\x20','OKDB_BRIDGE_LIB','12936946sTZMAu','public','\x20is\x20a\x20script,\x20not\x20a\x20native\x20binary','kill','argv','\x20resolves\x20to\x20the\x20shim\x20itself','3911496LrzBxX','OKDB_ADMIN_PUBLIC_DIR','SIGHUP','readFileSync','native-loader.js','node:fs','join','10KrKtMf','only);\x20reinstall\x20@kedem/okdb,\x20or\x20set\x20OKDB_NATIVE_CLI\x20to\x20the\x20launcher\x20binary.','slice','8yPHkuN','log','okdb:\x20no\x20native\x20CLI\x20launcher:\x20','error','realpathSync','215802ihsUim','SIGQUIT','3117951viJaya','SIGTERM','addon','62324uZTUTY','source','inherit','toString','message','304457uWQtyO','exit','7768040CQiZIP','pid','launcher','path','SIGINT','key','locate','resolve','cannot\x20run\x20','node:child_process','55MedrJv'];_0xb8f6=function(){return _0x2d751b;};return _0xb8f6();}const env={...process.env,'OKDB_SHIM_ACTIVE':'1'};if(addon&&!env['OKDB_BRIDGE_LIB'])env[_0x43ed0a(0xb0)]=addon;for(const [k,rel]of[[_0x43ed0a(0xb8),_0x43ed0a(0xb2)],['OKDB_DOCS_DIR','docs']]){const p=path['join'](root,rel);if(!env[k]&&fs['existsSync'](p))env[k]=p;}const SIGS=[_0x43ed0a(0xa3),_0x43ed0a(0xc9),_0x43ed0a(0xb9),_0x43ed0a(0xc7)],child=require(_0x43ed0a(0xa8))[_0x43ed0a(0xad)](loc[_0x43ed0a(0xa2)],process['argv'][_0x43ed0a(0xc0)](0x2),{'stdio':_0x43ed0a(0x9a),'env':env}),relay=_0x593b5e=>()=>{try{child['kill'](_0x593b5e);}catch{}};for(const sig of SIGS)process['on'](sig,relay(sig));child['on'](_0x43ed0a(0xc4),_0x3ac40d=>die(_0x43ed0a(0xa7)+loc[_0x43ed0a(0xa2)]+':\x20'+_0x3ac40d['message'])),child['on'](_0x43ed0a(0x9e),(_0x17eb18,_0x20e873)=>{const _0x48d588=_0x43ed0a;if(_0x20e873){for(const _0x363ca2 of SIGS)process['removeAllListeners'](_0x363ca2);process[_0x48d588(0xb4)](process[_0x48d588(0xa0)],_0x20e873),setTimeout(()=>process[_0x48d588(0x9e)](0x80),0x64);}else process[_0x48d588(0x9e)](_0x17eb18??0x0);});
package/index.js ADDED
@@ -0,0 +1 @@
1
+ 'use strict';const _0xc49158=_0x299a;(function(_0xe289e1,_0x577bf9){const _0x495766=_0x299a,_0xf456b1=_0xe289e1();while(!![]){try{const _0x5e10e0=parseInt(_0x495766(0xa5))/0x1+-parseInt(_0x495766(0xa4))/0x2+-parseInt(_0x495766(0x86))/0x3+-parseInt(_0x495766(0x8f))/0x4*(-parseInt(_0x495766(0x92))/0x5)+parseInt(_0x495766(0x84))/0x6+-parseInt(_0x495766(0x87))/0x7+-parseInt(_0x495766(0x9b))/0x8*(-parseInt(_0x495766(0x9e))/0x9);if(_0x5e10e0===_0x577bf9)break;else _0xf456b1['push'](_0xf456b1['shift']());}catch(_0xf0e741){_0xf456b1['push'](_0xf456b1['shift']());}}}(_0x1ceb,0xa840b));const loader=require('./native-loader.js'),p=loader[_0xc49158(0x9d)]();if(!p['ok']){const e=new Error(p['unsupported']?_0xc49158(0x97)+p['reason']+_0xc49158(0xa1)+_0xc49158(0xa7):_0xc49158(0x97)+p[_0xc49158(0x88)]+_0xc49158(0x8d)+_0xc49158(0x9a));e[_0xc49158(0x95)]=_0xc49158(0x94);if(p['error'])e[_0xc49158(0x8e)]=p[_0xc49158(0xa0)];throw e;}function _0x299a(_0x3b1a32,_0x341803){_0x3b1a32=_0x3b1a32-0x7f;const _0x1ceb2a=_0x1ceb();let _0x299a3b=_0x1ceb2a[_0x3b1a32];return _0x299a3b;}if(process.env.OKDB_NATIVE_DEBUG)process[_0xc49158(0x98)][_0xc49158(0x82)](_0xc49158(0x81)+p[_0xc49158(0xa2)]+'\x20('+p['source']+')\x20'+p[_0xc49158(0x90)]+'\x0a');{const path=require(_0xc49158(0x8b)),fs=require(_0xc49158(0x83));for(const [k,rel]of[[_0xc49158(0x89),_0xc49158(0x9c)],[_0xc49158(0x96),_0xc49158(0xa6)]]){const d=path[_0xc49158(0xa3)](__dirname,rel);if(!process.env[k]&&fs[_0xc49158(0x93)](d))process.env[k]=d;}}function _0x1ceb(){const _0x5ef682=['stderr','./okdb-native.js','native/),\x20or\x20set\x20OKDB_NATIVE_BINARY\x20to\x20an\x20okdb-node\x20.node\x20file.','729152jLSTWK','public','probe','72ElQFOB','prototype','error','.\x20okdb\x203.x\x20has\x20no\x20JavaScript\x20fallback:\x20run\x20it\x20on\x20Linux\x20x64\x20','key','join','2056834yUcRcc','627240WSJlST','docs','(glibc),\x20or\x20stay\x20on\x20okdb\x202.x\x20on\x20this\x20platform.\x20OKDB_NATIVE_BINARY=<okdb-node\x20.node>\x20loads\x20a\x20build\x20you\x20made\x20yourself.','native','implementation','[okdb]\x20native\x20core:\x20','write','node:fs','4969764ybhurH','call','1226532FtETlt','4627504meFBsA','reason','OKDB_ADMIN_PUBLIC_DIR','nativeBinaryPath','node:path','hasOwnProperty','.\x20Reinstall\x20@kedem/okdb\x20(the\x20addon\x20ships\x20inside\x20the\x20package\x20under\x20','cause','18548IfzUmK','path','defineProperty','650SgTsBS','existsSync','NATIVE_UNAVAILABLE','code','OKDB_DOCS_DIR','okdb:\x20the\x20native\x20core\x20is\x20unavailable\x20—\x20'];_0x1ceb=function(){return _0x5ef682;};return _0x1ceb();}const OKDB=require(_0xc49158(0x99));module['exports']=OKDB,Object[_0xc49158(0x91)](OKDB,_0xc49158(0x80),{'value':_0xc49158(0x7f),'enumerable':![],'configurable':!![]});if(!Object[_0xc49158(0x9f)][_0xc49158(0x8c)][_0xc49158(0x85)](OKDB,_0xc49158(0x8a)))Object[_0xc49158(0x91)](OKDB,'nativeBinaryPath',{'value':p[_0xc49158(0x90)],'enumerable':![],'configurable':!![]});
Binary file
@@ -0,0 +1,20 @@
1
+ export type PlatformKey = 'linux-x64-gnu' | 'linux-arm64-gnu' | 'linux-x64-musl' | 'linux-arm64-musl';
2
+ export interface Located { path: string | null; key: PlatformKey | null; source?: 'env' | 'bundled' | 'package'; reason?: string; unsupported?: boolean }
3
+ export type Probe =
4
+ | { ok: true; mod: unknown; path: string; key: PlatformKey | null; source?: string; bindingVersion: string | null }
5
+ | { ok: false; reason: string; unsupported?: boolean; error?: Error };
6
+ export function platformKey(): PlatformKey | null;
7
+ export function packageName(key: PlatformKey): string;
8
+ /** "linux/x64/glibc", "darwin/arm64" */
9
+ export function describeHost(): string;
10
+ /** the platform keys bundled under native/ in this package (3.0: ['linux-x64-gnu']) */
11
+ export function bundledKeys(): PlatformKey[];
12
+ /** the stable bundled path: <pkg>/native/<key>/okdb-node.<key>.node (addon) or <pkg>/native/<key>/okdb (launcher) */
13
+ export function bundledPath(key: PlatformKey, kind: 'addon' | 'launcher' | 'cli'): string;
14
+ export function loadedPath(): string | null;
15
+ export const BUNDLED_DIR: 'native';
16
+ export function locate(kind: 'addon' | 'launcher' | 'cli'): Located;
17
+ export function probe(): Probe;
18
+ export function load(): unknown;
19
+ export function isMusl(): boolean;
20
+ export const KEYS: PlatformKey[];
@@ -0,0 +1 @@
1
+ 'use strict';const _0x4c4a16=_0x16a7;(function(_0x232305,_0xebbbff){const _0x13f677=_0x16a7,_0x490507=_0x232305();while(!![]){try{const _0x59429f=parseInt(_0x13f677(0x107))/0x1*(-parseInt(_0x13f677(0x108))/0x2)+-parseInt(_0x13f677(0x11b))/0x3*(-parseInt(_0x13f677(0x10d))/0x4)+parseInt(_0x13f677(0x132))/0x5*(parseInt(_0x13f677(0xf8))/0x6)+-parseInt(_0x13f677(0x130))/0x7*(-parseInt(_0x13f677(0xfd))/0x8)+parseInt(_0x13f677(0xee))/0x9+-parseInt(_0x13f677(0x119))/0xa*(-parseInt(_0x13f677(0x115))/0xb)+-parseInt(_0x13f677(0xfc))/0xc*(parseInt(_0x13f677(0x103))/0xd);if(_0x59429f===_0xebbbff)break;else _0x490507['push'](_0x490507['shift']());}catch(_0x1f8197){_0x490507['push'](_0x490507['shift']());}}}(_0x5834,0xde79e));const fs=require('node:fs'),path=require(_0x4c4a16(0x12a)),SCOPE=_0x4c4a16(0x117),PREFIX=_0x4c4a16(0xef),BUNDLED_DIR='native',KEYS=['linux-x64-gnu',_0x4c4a16(0x126),_0x4c4a16(0xf9),_0x4c4a16(0x120)];function isMusl(){const _0xa02c6c=_0x4c4a16;try{const _0x2510d0=process[_0xa02c6c(0x131)]&&process[_0xa02c6c(0x131)]['getReport']&&process[_0xa02c6c(0x131)][_0xa02c6c(0xf3)]();if(_0x2510d0&&_0x2510d0['header'])return!_0x2510d0[_0xa02c6c(0xfe)][_0xa02c6c(0x125)];}catch{}try{return fs[_0xa02c6c(0x124)](_0xa02c6c(0x12c),_0xa02c6c(0x111))['includes']('musl');}catch{}try{return require('node:child_process')[_0xa02c6c(0xfb)]('ldd\x20--version\x202>&1\x20||\x20true',{'encoding':'utf8'})['includes'](_0xa02c6c(0xf1));}catch{return![];}}function host(){const _0x41d4e9=_0x4c4a16,_0x4bdfd1=process.env.OKDB_NATIVE_PLATFORM;if(_0x4bdfd1){const [_0x5baba2,_0x515041,_0x58f2c0]=_0x4bdfd1[_0x41d4e9(0x12e)]('-');return{'platform':_0x5baba2,'arch':_0x515041,'libc':_0x5baba2===_0x41d4e9(0xf5)?_0x58f2c0===_0x41d4e9(0xf1)?'musl':_0x41d4e9(0x109):null};}const _0xd76484=process[_0x41d4e9(0x11c)];return{'platform':_0xd76484,'arch':process[_0x41d4e9(0x100)],'libc':_0xd76484===_0x41d4e9(0xf5)?isMusl()?_0x41d4e9(0xf1):_0x41d4e9(0x109):null};}function describeHost(){const _0x5c6d9f=_0x4c4a16,_0x52d5cf=host();return[_0x52d5cf['platform'],_0x52d5cf[_0x5c6d9f(0x100)],_0x52d5cf[_0x5c6d9f(0x122)]][_0x5c6d9f(0x101)](Boolean)[_0x5c6d9f(0x102)]('/');}function platformKey(){const _0x10da71=_0x4c4a16,_0x17092f=host();if(_0x17092f[_0x10da71(0x11c)]!==_0x10da71(0xf5))return null;const _0x32bb59=_0x17092f[_0x10da71(0x100)]===_0x10da71(0x114)?_0x10da71(0x114):_0x17092f['arch']==='arm64'?_0x10da71(0x135):null;if(!_0x32bb59)return null;return _0x10da71(0x10b)+_0x32bb59+'-'+(_0x17092f[_0x10da71(0x122)]===_0x10da71(0xf1)?_0x10da71(0xf1):'gnu');}function _0x5834(){const _0x3da756=['env','mod','message','okdb','12547647WsmDHD','native','this\x20package\x20has\x20no\x20','musl','cli','getReport','package','linux','realpathSync','\x20(a\x20build\x20without\x20the\x20','5336382MbiTJA','linux-x64-musl','bin','execSync','12JNQZWH','32kRcqeH','header','\x20failed:\x20','arch','filter','join','43463797GngzMN','\x20(a\x20build\x20without\x20it)','error','launcher','1lhhIFv','1822666cbAaGv','glibc','okdb-node.','linux-','function','19284kACKnl','replace','path','length','utf8','resolve','OKDB_NATIVE_BINARY','x64','7799BdeENn','\x20(this\x20package\x20bundles:\x20','@okdb','\x20points\x20to\x20a\x20missing\x20file:\x20','1510ukAyVX','code','1059cZcjga','platform','bindingVersion','unsupported','reason','linux-arm64-musl','existsSync','libc','readdirSync','readFileSync','glibcVersionRuntime','linux-arm64-gnu','includes',':\x20okdb\x203.0\x20ships\x20Linux\x20x64\x20(glibc)\x20only','addon','node:path','loading\x20','/usr/bin/ldd','key','split','source','1878646Lmwary','report','5OkPvoU','dirname','.node','arm64'];_0x5834=function(){return _0x3da756;};return _0x5834();}function packageName(_0x1325e0){return SCOPE+'/'+PREFIX+'-'+_0x1325e0;}function bundledKeys(){const _0x3304e3=_0x4c4a16;try{return fs[_0x3304e3(0x123)](path[_0x3304e3(0x102)](__dirname,BUNDLED_DIR))['filter'](_0x2065b9=>fs[_0x3304e3(0x121)](path['join'](__dirname,BUNDLED_DIR,_0x2065b9,_0x3304e3(0x10a)+_0x2065b9+_0x3304e3(0x134))))['sort']();}catch{return[];}}function _0x16a7(_0x50455b,_0x5588fb){_0x50455b=_0x50455b-0xec;const _0x583483=_0x5834();let _0x16a77=_0x583483[_0x50455b];return _0x16a77;}function bundledPath(_0x4469ff,_0x342992){const _0x10b23c=_0x4c4a16;if(_0x342992===_0x10b23c(0xf2))_0x342992=_0x10b23c(0x106);return path[_0x10b23c(0x102)](__dirname,BUNDLED_DIR,_0x4469ff,_0x342992==='addon'?_0x10b23c(0x10a)+_0x4469ff+'.node':_0x10b23c(0xed));}function fromPackage(_0x4c01f4,_0x550790){const _0x36574a=_0x4c4a16;let _0x44eae5;try{_0x44eae5=require['resolve'](packageName(_0x4c01f4)+'/package.json',{'paths':[__dirname]});}catch{return null;}const _0x23fe93=path[_0x36574a(0x102)](path[_0x36574a(0x133)](_0x44eae5),_0x550790);return fs[_0x36574a(0x121)](_0x23fe93)?{'path':_0x23fe93}:{'installed':!![]};}function unsupported(){const _0x5a7265=_0x4c4a16,_0x2f29ef=bundledKeys();return'no\x20native\x20build\x20for\x20'+describeHost()+_0x5a7265(0x128)+(_0x5a7265(0x116)+(_0x2f29ef[_0x5a7265(0x110)]?_0x2f29ef[_0x5a7265(0x102)](',\x20'):'nothing')+')');}function locate(_0x1d8696){const _0x5dfd6a=_0x4c4a16;if(_0x1d8696===_0x5dfd6a(0xf2))_0x1d8696=_0x5dfd6a(0x106);const _0x288d6f=platformKey(),_0x30de41=_0x1d8696===_0x5dfd6a(0x129)?process.env.OKDB_NATIVE_BINARY:process.env.OKDB_NATIVE_CLI;if(_0x30de41)return fs[_0x5dfd6a(0x121)](_0x30de41)?{'path':_0x30de41,'key':_0x288d6f,'source':_0x5dfd6a(0x136)}:{'path':null,'key':_0x288d6f,'reason':(_0x1d8696==='addon'?_0x5dfd6a(0x113):'OKDB_NATIVE_CLI')+_0x5dfd6a(0x118)+_0x30de41};if(!_0x288d6f)return{'path':null,'key':_0x288d6f,'unsupported':!![],'reason':unsupported()};const _0x271133=bundledPath(_0x288d6f,_0x1d8696);if(fs[_0x5dfd6a(0x121)](_0x271133))return{'path':_0x271133,'key':_0x288d6f,'source':'bundled'};const _0x456e0f=_0x1d8696===_0x5dfd6a(0x129)?_0x5dfd6a(0x10a)+_0x288d6f+_0x5dfd6a(0x134):path[_0x5dfd6a(0x102)](_0x5dfd6a(0xfa),_0x5dfd6a(0xed)),_0x547218=fromPackage(_0x288d6f,_0x456e0f);if(_0x547218&&_0x547218[_0x5dfd6a(0x10f)])return{'path':_0x547218[_0x5dfd6a(0x10f)],'key':_0x288d6f,'source':_0x5dfd6a(0xf4)};if(_0x547218)return{'path':null,'key':_0x288d6f,'reason':packageName(_0x288d6f)+'\x20is\x20installed\x20but\x20has\x20no\x20'+_0x456e0f[_0x5dfd6a(0x10e)](/\\/g,'/')+_0x5dfd6a(0x104)};if(bundledKeys()[_0x5dfd6a(0x127)](_0x288d6f))return{'path':null,'key':_0x288d6f,'reason':_0x5dfd6a(0xf0)+path['relative'](__dirname,_0x271133)['replace'](/\\/g,'/')+_0x5dfd6a(0xf7)+_0x1d8696+')'};return{'path':null,'key':_0x288d6f,'unsupported':!![],'reason':unsupported()};}let cached=null;function probe(){const _0x42cc38=_0x4c4a16;if(cached)return cached;const _0x2cec2b=locate(_0x42cc38(0x129));if(!_0x2cec2b[_0x42cc38(0x10f)])return cached={'ok':![],'reason':_0x2cec2b[_0x42cc38(0x11f)],'unsupported':!!_0x2cec2b[_0x42cc38(0x11e)]};try{const _0x220698=require(_0x2cec2b[_0x42cc38(0x10f)]),_0x298274=typeof _0x220698[_0x42cc38(0x11d)]===_0x42cc38(0x10c)?_0x220698['bindingVersion']():null;return cached={'ok':!![],'mod':_0x220698,'path':_0x2cec2b['path'],'key':_0x2cec2b[_0x42cc38(0x12d)],'source':_0x2cec2b[_0x42cc38(0x12f)],'bindingVersion':_0x298274};}catch(_0x3c933e){return cached={'ok':![],'reason':_0x42cc38(0x12b)+_0x2cec2b[_0x42cc38(0x10f)]+_0x42cc38(0xff)+(_0x3c933e&&_0x3c933e[_0x42cc38(0xec)]),'error':_0x3c933e};}}function load(){const _0x5dc41b=_0x4c4a16,_0xab20cf=probe();if(_0xab20cf['ok'])return _0xab20cf[_0x5dc41b(0x137)];const _0x1d0934=new Error('okdb:\x20native\x20core\x20unavailable\x20—\x20'+_0xab20cf['reason']);_0x1d0934[_0x5dc41b(0x11a)]='NATIVE_BINARY_MISSING';if(_0xab20cf[_0x5dc41b(0x105)])_0x1d0934['cause']=_0xab20cf[_0x5dc41b(0x105)];throw _0x1d0934;}function loadedPath(){const _0x3ea434=_0x4c4a16;if(!cached||!cached['ok'])return null;try{return fs[_0x3ea434(0xf6)](cached[_0x3ea434(0x10f)]);}catch{return path[_0x3ea434(0x112)](cached[_0x3ea434(0x10f)]);}}module['exports']={'load':load,'loadedPath':loadedPath,'probe':probe,'locate':locate,'platformKey':platformKey,'describeHost':describeHost,'bundledKeys':bundledKeys,'bundledPath':bundledPath,'packageName':packageName,'isMusl':isMusl,'KEYS':KEYS,'BUNDLED_DIR':BUNDLED_DIR};