Skip to content

feat(wasm-sdk): composite document queries on the JS surface - #4605

Open
QuantumExplorer wants to merge 1 commit into
feat/composite-document-queries-sdkfrom
feat/composite-document-queries-wasm
Open

feat(wasm-sdk): composite document queries on the JS surface#4605
QuantumExplorer wants to merge 1 commit into
feat/composite-document-queries-sdkfrom
feat/composite-document-queries-wasm

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Replaces #4601, which GitHub closed as merged when a mistaken force-push briefly collapsed the stack's branches onto one commit. Same branch, same content, same base.

Issue being fixed or feature implemented

Last platform PR of the composite document query series (Yappr feed: one merged proof per feed page instead of 15 to 19 round trips). Stack:

  1. feat: merge a limited path query below a key another branch already owns grovedb#850 (recursive graft for colliding limited branches)
  2. chore: bump grovedb to 2d95c567 (#850 merged: limited branches graft below a shared key) #4597 (grovedb pin)
  3. feat(drive): composite document queries: a page plus derived sub-queries under one merged proof #4598 (rs-drive core: shapes, execution, merged proof, verifier)
  4. feat(dapi): composite document queries on the getDocuments V1 wire #4603 (wire: proto sub_queries, drive-abci dispatch)
  5. feat(sdk): composite document queries, the client stack #4604 (client stack: dash-platform-queries, proof verifier, rs-sdk)
  6. this PR (wasm-sdk + js-evo-sdk surface, e2e spec)

What was done?

  • wasm-sdk: getCompositeDocuments(query) and getCompositeDocumentsWithProofInfo(query), mirroring the chained surface. The query object is the page (dataContractId, documentType, where, orderBy, a required limit) plus subQueries, each with an optional dataContractId (defaults to the page's), documentType, kind: 'documents' | 'counts', fixed where / orderBy, an optional per-value limit, and an optional bind: { source?: 'page' | index, sourceProperty, field }. Sub-query contracts are fetched through the same contract cache as the page's. The result is { pageDocuments, subResults }, each sub-result a discriminated union: { kind: 'documents', documents } or { kind: 'counts', counts: Map<base58 id, bigint> }. TypeScript declarations ride the usual custom section. parse_order_clause becomes crate-visible next to parse_where_clause.
  • js-evo-sdk: sdk.documents.composite(query) and sdk.documents.compositeWithProof(query), plus a README section with the feed-page example and the four sub-query shapes.
  • platform-test-suite: a composite case in the IndexOnlyDocument spec, right after the chained one: the dash posts page, one like count per post from the countable [hashtag, postId] index, and the viewer's own likes through the byLiker terminal (value-bounded, no limit).

Usage:

const page = await sdk.documents.composite({
  dataContractId: YAPPR,
  documentType: 'post',
  where: [['hashtag', '==', 'dash']],
  limit: 20,
  subQueries: [
    { documentType: 'like', kind: 'counts', where: [['hashtag', '==', 'dash']], bind: { sourceProperty: '$id', field: 'postId' } },
    { documentType: 'post', bind: { sourceProperty: 'quotedPostId', field: '$id' } },
    { dataContractId: DASHPAY, documentType: 'profile', bind: { sourceProperty: '$ownerId', field: '$ownerId' } },
  ],
});

How Has This Been Tested?

Breaking Changes

None. New methods only.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

- wasm-sdk: `getCompositeDocuments` and
  `getCompositeDocumentsWithProofInfo`. The query is the page plus
  `subQueries` (optional contract, document type, `documents` or
  `counts`, fixed clauses, per-value limit, and a `bind` naming the
  page or an earlier documents sub-query); the result is the page and
  one discriminated sub-result per sub-query, counts keyed by the
  bound value's base58 identifier. Sub-query contracts go through the
  same cache as the page's.
- js-evo-sdk: `documents.composite` / `documents.compositeWithProof`
  and a README section with the feed-page example.
- platform-test-suite: a composite case next to the chained one (page,
  like counts from the countable index, the viewer's likes through the
  byLiker terminal).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@thepastaclaw

thepastaclaw commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — 56 ahead in queue (commit c80c6c7)
Queue position: 57/59 · 3 reviews active
ETA: start ~08:40 UTC · complete ~09:35 UTC (median 54m across 30 recent reviews; 3 slots)
Queued 1d 6h ago · Last checked: 2026-09-06 16:10 UTC

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 0b6dd692-20c1-4a6b-8fbd-c44c695ba1e4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants