@hakodb/client 0.7.0 → 0.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hakodb/client",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "High-level HakoDB JavaScript/TypeScript client for Node.js and Bun",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,6 +33,6 @@
33
33
  "typescript": "^7.0.2"
34
34
  },
35
35
  "scripts": {
36
- "test": "tsc --noEmit -p tsconfig.json"
36
+ "test": "tsc --noEmit -p tsconfig.json && python3 scripts/check_ffi_parity.py"
37
37
  }
38
38
  }
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env python3
2
+ """Check that every C ABI query/sync symbol is either bound or allowlisted.
3
+
4
+ Generic guard: it reads the generated header and the SDK binding source, so
5
+ it does not depend on a particular deployment, machine or consumer.
6
+ """
7
+ import os
8
+ import re
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ ROOT = Path(__file__).resolve().parents[1]
13
+ HEADER = Path(os.environ.get("HAKODB_HEADER", ROOT / "native" / "hakodb.h"))
14
+ BINDINGS = Path(os.environ.get("HAKODB_BINDINGS", ROOT / "src" / "native.ts"))
15
+
16
+ # Symbols intentionally not exposed by the high-level SDK.
17
+ # - Unix-only socket transport (declarations exist on every target by design).
18
+ # - Superseded graph path variants; the *_v4 / *_v3 successors are bound.
19
+ ALLOW_UNBOUND = {
20
+ "hk_socket_sync_dial",
21
+ "hk_socket_sync_free",
22
+ "hk_socket_sync_new",
23
+ "hk_socket_sync_serve",
24
+ "hk_socket_sync_status",
25
+ "hk_engine_find_paths_v2",
26
+ "hk_engine_find_paths_v3",
27
+ "hk_engine_find_simple_paths",
28
+ "hk_engine_find_simple_paths_v2",
29
+ }
30
+
31
+
32
+ def header_functions(path: Path) -> set[str]:
33
+ text = path.read_text(encoding="utf-8", errors="replace")
34
+ return set(re.findall(r"\b(hk_[a-z0-9_]+)\s*\(", text))
35
+
36
+
37
+ def bound_symbols(path: Path) -> set[str]:
38
+ text = path.read_text(encoding="utf-8")
39
+ found = set(re.findall(r"\b(hk_[a-z0-9_]+)\b", text))
40
+ # Partial identifier from a source comment, not a function.
41
+ return found - {"hk_socket_sync_"}
42
+
43
+
44
+ def main() -> int:
45
+ if not HEADER.exists() or not BINDINGS.exists():
46
+ print(f"missing input: header={HEADER} bindings={BINDINGS}", file=sys.stderr)
47
+ return 2
48
+ header = header_functions(HEADER)
49
+ bound = bound_symbols(BINDINGS)
50
+ missing = sorted(header - bound - ALLOW_UNBOUND)
51
+ stale = sorted(bound - header)
52
+ print(f"header functions: {len(header)}, bound symbols: {len(bound)}")
53
+ if missing:
54
+ print("unbound and not allowlisted:", ", ".join(missing), file=sys.stderr)
55
+ if stale:
56
+ print("bound symbols absent from header:", ", ".join(stale), file=sys.stderr)
57
+ if missing or stale:
58
+ return 1
59
+ print("FFI binding parity: OK")
60
+ return 0
61
+
62
+
63
+ if __name__ == "__main__":
64
+ raise SystemExit(main())
package/src/client.ts CHANGED
@@ -1520,6 +1520,7 @@ return this;
1520
1520
  /**
1521
1521
  * Alias for `get({ mode: 'json' })`: JSON emitted from pinned bytes,
1522
1522
  * same shape as `get()`. Projections keep the projected executor's shape.
1523
+ * @deprecated Prefer `get({ mode: 'json' })` so the materialization lane is explicit.
1523
1524
  */
1524
1525
  async getJson(): Promise<HakoDocData[]> {
1525
1526
  return this.get({ mode: 'json' });
package/src/native.ts CHANGED
@@ -114,11 +114,13 @@ export interface NativeBindings {
114
114
  queryLimit(query: Handle, limit: number): number;
115
115
  queryOffset(query: Handle, offset: number): number;
116
116
  querySelectField(query: Handle, field: string): number;
117
+ /** @deprecated Use queryExecuteEx(engine, query, null). */
117
118
  queryExecute(engine: Handle, query: Handle): string | null;
118
119
  /** Canonical executor: pass null for no cancel, or an HK_Cancel* handle. */
119
120
  queryExecuteEx(engine: Handle, query: Handle, cancel: Handle | null): string | null;
120
121
  /** #250: reset a handle in place for reuse (no alloc/free). */
121
122
  queryReset(query: Handle, collection: string): number;
123
+ /** @deprecated Use queryExecuteEx(engine, query, cancel). */
122
124
  queryExecuteWithCancel(engine: Handle, query: Handle, cancel: Handle): string | null;
123
125
  cancelNew(): Handle;
124
126
  cancel(cancel: Handle): void;