Skip to content

fix(web): align QueryResult types with ladybugdb WASM API (#311)#455

Closed
ShunsukeHayashi wants to merge 1 commit into
abhigyanpatwari:mainfrom
Miyabi-G-K:fix/lbug-getall-311
Closed

fix(web): align QueryResult types with ladybugdb WASM API (#311)#455
ShunsukeHayashi wants to merge 1 commit into
abhigyanpatwari:mainfrom
Miyabi-G-K:fix/lbug-getall-311

Conversation

@ShunsukeHayashi

Copy link
Copy Markdown
Contributor

Summary

The @ladybugdb/wasm-core module replaced .getAll() with .getAllRows() and .getAllObjects(). The runtime adapter (lbug-adapter.ts) already handles this with a fallback chain, but the TypeScript type definition was outdated.

Closes #311

Changes

lbug-wasm.d.ts

  export interface QueryResult {
-   getAll(): Promise<any[]>;
+   /** @deprecated Use getAllRows() or getAllObjects() instead */
+   getAll?(): Promise<any[]>;
+   getAllRows?(): Promise<any[]>;
+   getAllObjects?(): Promise<any[]>;
    hasNext(): Promise<boolean>;
    getNext(): Promise<any>;
  }

All three methods are optional because the adapter's fallback chain handles any combination:

result.getAll?.() ?? result.getAllObjects?.() ?? result.getAllRows?.()

Type Check

npx tsc --noEmit -p tsconfig.app.json  # No errors

Addresses #311

… (#311)

lbug-wasm.d.ts:
- Add getAllRows() and getAllObjects() to QueryResult interface
- Mark getAll() as deprecated and optional
- Matches the runtime fallback chain already in lbug-adapter.ts:
  result.getAll?.() ?? result.getAllObjects?.() ?? result.getAllRows?.()

The adapter already handles both old and new APIs gracefully.
This fix ensures TypeScript types match the actual WASM module exports.

Closes #311
@vercel

vercel Bot commented Mar 22, 2026

Copy link
Copy Markdown

@ShunsukeHayashi is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

CI Report

All checks passed5372095

Pipeline

Stage Status Ubuntu Windows macOS
Typecheck success
Tests success

Tests

Metric Value
Total 3671
Passed 3649
Skipped 20
Files 1052
Duration 2m 1s

✅ All 3649 tests passed across 1052 files

20 test(s) skipped
  • withTestLbugDB(lock-retry) > withLbugDb retry behaviour > propagates non-BUSY errors immediately without retrying
  • withTestLbugDB(lock-retry) > withLbugDb retry behaviour > throws after max retry attempts
  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature
  • Python match/case as-pattern type binding > resolves u.save() to User#save via match/case as-pattern binding
  • Python match/case as-pattern type binding > does NOT resolve u.save() to Repo#save (negative disambiguation)
  • Swift constructor-inferred type resolution > detects User and Repo classes, both with save methods
  • Swift constructor-inferred type resolution > resolves user.save() to Models/User.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > resolves repo.save() to Models/Repo.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > emits exactly 2 save() CALLS edges (one per receiver type)
  • Swift self resolution > detects User and Repo classes, each with a save function
  • Swift self resolution > resolves self.save() inside User.process to User.save, not Repo.save
  • Swift parent resolution > detects BaseModel and User classes plus Serializable protocol
  • Swift parent resolution > emits EXTENDS edge: User → BaseModel
  • Swift parent resolution > emits IMPLEMENTS edge: User → Serializable (protocol conformance)
  • Swift cross-file User.init() inference > resolves user.save() via User.init(name:) inference
  • Swift cross-file User.init() inference > resolves user.greet() via User.init(name:) inference
  • Swift return type inference > detects User class and getUser function
  • Swift return type inference > detects save function on User (Swift class methods are Function nodes)
  • Swift return type inference > resolves user.save() to User#save via return type of getUser() -> User
  • Swift return-type inference via function return type > resolves user.save() to User#save via return type of getUser()
  • Swift return-type inference via function return type > user.save() does NOT resolve to Repo#save
  • Swift return-type inference via function return type > resolves repo.save() to Repo#save via return type of getRepo()

Coverage

Metric Coverage Covered Base (main) Delta
Statements 68.79% 9093/13217 68.79%
Branches 59.94% 6165/10285 59.94%
Functions 71.27% 804/1128 71.27%
Lines 71.05% 8107/11410 71.05%

📋 Full run · Coverage from Ubuntu · Generated by CI

Broomstiq added a commit to Broomstiq/GitNexus that referenced this pull request Mar 24, 2026
…tion

The WASM backend getAllRows() returns Array<Array> (tuples), not named
objects. buildGraph() already handled this for nodes (row.id ?? row[0])
but not for relationships, causing all edges to serialize as
undefined_undefined_undefined -- deduplicated to 1 edge on the client.

Also aligns web QueryResult types with the current @ladybugdb/wasm-core
API per upstream PR abhigyanpatwari#455.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@magyargergo

Copy link
Copy Markdown
Collaborator

⚠️ Upcoming Prettier formatting — rebase instructions

PR #563 adds Prettier as the code formatter for the repo. When it merges, the bulk format commit will touch ~350 files (style-only: whitespace, quotes, trailing commas). Your branch will likely conflict.

After #563 merges, rebase your branch:

git fetch origin
git checkout <your-branch>
git rebase origin/main

# Conflicts will be formatting-only — accept your version:
git checkout --theirs .
git add .
git rebase --continue

# Then re-format your branch to match the new style:
npx prettier --write .
git add -A
git commit -m "style: apply prettier formatting"
git push --force-with-lease

New setup step: Run npm install at the repo root (not just in gitnexus/) to get prettier + activate the pre-commit hook. The hook auto-formats staged files on every commit going forward.

@magyargergo magyargergo closed this Apr 6, 2026
@magyargergo

Copy link
Copy Markdown
Collaborator

We don't use ladybug wasm anymore in the latest GitNexus version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error using AI in the browser . result.getAll is not a function error

2 participants