@hakodb/client 0.7.3 → 0.7.4

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.3",
3
+ "version": "0.7.4",
4
4
  "description": "High-level HakoDB JavaScript/TypeScript client for Node.js and Bun",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,20 +41,48 @@ def bound_symbols(path: Path) -> set[str]:
41
41
  return found - {"hk_socket_sync_"}
42
42
 
43
43
 
44
+ def backend_sections(text: str):
45
+ bun = text[text.index("async function createBunBindings"):text.index("async function createNodeBindings")]
46
+ node = text[text.index("async function createNodeBindings"):text.index("export async function loadNativeBindings")]
47
+ return bun, node
48
+
49
+
50
+ def backend_missing(text: str) -> dict:
51
+ bun, node = backend_sections(text)
52
+ bun_declared = set(re.findall(r"\b(hk_[a-z0-9_]+):\s*\{", bun))
53
+ bun_used = set(re.findall(r"symbols\.(hk_[a-z0-9_]+)", bun))
54
+ node_declared = set(re.findall(r"\b(hk_[a-z0-9_]+):\s*lib\.func", node))
55
+ node_declared |= set(re.findall(r"lib\.func\('[^']*\b(hk_[a-z0-9_]+)\(", node))
56
+ node_used = set(re.findall(r"\bfn\.(hk_[a-z0-9_]+)", node))
57
+ return {
58
+ "bun": sorted(bun_used - bun_declared),
59
+ "node": sorted(node_used - node_declared),
60
+ }
61
+
62
+
44
63
  def main() -> int:
45
64
  if not HEADER.exists() or not BINDINGS.exists():
46
65
  print(f"missing input: header={HEADER} bindings={BINDINGS}", file=sys.stderr)
47
66
  return 2
67
+ text = BINDINGS.read_text(encoding="utf-8")
48
68
  header = header_functions(HEADER)
49
69
  bound = bound_symbols(BINDINGS)
50
70
  missing = sorted(header - bound - ALLOW_UNBOUND)
51
71
  stale = sorted(bound - header)
72
+ backend = backend_missing(text)
52
73
  print(f"header functions: {len(header)}, bound symbols: {len(bound)}")
74
+ failed = False
53
75
  if missing:
54
76
  print("unbound and not allowlisted:", ", ".join(missing), file=sys.stderr)
77
+ failed = True
55
78
  if stale:
56
79
  print("bound symbols absent from header:", ", ".join(stale), file=sys.stderr)
57
- if missing or stale:
80
+ failed = True
81
+ for name, symbols in backend.items():
82
+ if symbols:
83
+ print(f"{name} wrappers using undeclared symbols:", ", ".join(symbols), file=sys.stderr)
84
+ failed = True
85
+ if failed:
58
86
  return 1
59
87
  print("FFI binding parity: OK")
60
88
  return 0
package/src/native.ts CHANGED
@@ -617,6 +617,7 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
617
617
  hk_cursor_walk_view: { args: [FFIType.ptr, FFIType.ptr, FFIType.function, FFIType.ptr], returns: FFIType.i64 },
618
618
  hk_rawdoc_bytes: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
619
619
  hk_rawdoc_id: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
620
+ hk_view_free: { args: [FFIType.ptr], returns: FFIType.void },
620
621
  hk_view_get: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
621
622
  hk_view_get_int: { args: [FFIType.ptr, FFIType.cstring, FFIType.ptr], returns: FFIType.bool },
622
623
  hk_view_get_float: { args: [FFIType.ptr, FFIType.cstring, FFIType.ptr], returns: FFIType.bool },
@@ -625,6 +626,8 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
625
626
  hk_view_has_field: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.bool },
626
627
  hk_view_get_str: { args: [FFIType.ptr, FFIType.cstring, FFIType.ptr], returns: FFIType.ptr },
627
628
  hk_view_get_bytes: { args: [FFIType.ptr, FFIType.cstring, FFIType.ptr], returns: FFIType.ptr },
629
+ hk_view_to_doc: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.ptr },
630
+ hk_engine_list_collections: { args: [FFIType.ptr], returns: FFIType.ptr },
628
631
  hk_engine_get_json: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
629
632
  hk_query_execute_json: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
630
633
  hk_cursor_walk_json: { args: [FFIType.ptr, FFIType.ptr, FFIType.function, FFIType.ptr], returns: FFIType.i64 },