Skip to content

Add webviewer batching#292

Closed
eluce2 wants to merge 2 commits into
mainfrom
fm26
Closed

Add webviewer batching#292
eluce2 wants to merge 2 commits into
mainfrom
fm26

Conversation

@eluce2

@eluce2 eluce2 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary:

  • add opt-in WebViewerAdapter request batching
  • add adapter listAll/findAll hooks for script-side pagination
  • document FileMaker script envelopes

Test:

  • pnpm run ci

Summary by CodeRabbit

  • New Features
    • Added opt-in request batching for WebViewer integrations to reduce repeated round trips.
    • Added listAll and findAll support for more efficient bulk pagination.
  • Bug Fixes
    • Improved pagination/request normalization and handling of empty and bulk error responses for more consistent results.
  • Documentation
    • Expanded WebViewer + Data API usage guidance with batching and server-side pagination examples.
  • Chores
    • Updated release notes and published minor version bumps for @proofkit/webviewer and @proofkit/fmdapi.

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
proofkit-docs Ready Ready Preview, Comment Jun 24, 2026 2:06pm

Request Review

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7670bd5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@proofkit/webviewer Minor
@proofkit/fmdapi Minor
@proofkit/typegen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@proofkit/better-auth

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/better-auth@292

@proofkit/fmdapi

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/fmdapi@292

@proofkit/fmodata

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/fmodata@292

@proofkit/typegen

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/typegen@292

@proofkit/webviewer

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/webviewer@292

commit: 7670bd5

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b4015d0d-f708-4996-8ddc-d483c7e89fec

📥 Commits

Reviewing files that changed from the base of the PR and between c5ad855 and 7670bd5.

📒 Files selected for processing (4)
  • packages/fmdapi/src/client.ts
  • packages/fmdapi/tests/client-methods.test.ts
  • packages/webviewer/src/adapter.ts
  • packages/webviewer/tests/adapter.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/webviewer/tests/adapter.test.ts
  • packages/fmdapi/tests/client-methods.test.ts
  • packages/fmdapi/src/client.ts
  • packages/webviewer/src/adapter.ts

📝 Walkthrough

Walkthrough

Adds adapter-level listAll/findAll support in fmdapi, and opt-in batching plus readAll/findAll script actions in WebViewerAdapter. The docs, tests, and release note are updated to match the new request flows.

Changes

WebViewerAdapter batching and adapter-level pagination hooks

Layer / File(s) Summary
Adapter contracts and client dispatch
packages/fmdapi/src/adapters/core.ts, packages/fmdapi/src/client.ts
Adapter gains optional listAll/findAll. The client imports the related option types, extracts bulk adapter methods, normalizes list/find inputs, and prefers adapter bulk methods before falling back to pagination loops.
WebViewerAdapter batching and script actions
packages/webviewer/src/adapter.ts
Adds batching configuration and request-body normalization, routes requests through queued or immediate execution, implements batch flushing and per-response matching, and adds public listAll/findAll methods.
Tests, docs, and release note
packages/fmdapi/tests/client-methods.test.ts, packages/webviewer/tests/adapter.test.ts, apps/docs/content/docs/webviewer/fmdapi.mdx, .changeset/quick-bats-queue.md
Updates client and adapter tests for bulk methods, batching, partial failures, and size handling; adds usage documentation; updates the changeset note.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: opt-in WebViewer batching.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fm26

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/fmdapi/src/client.ts`:
- Around line 170-194: Normalize the sort input in `find` the same way `list`
does: in `packages/fmdapi/src/client.ts` within the `find`/`findAll`
request-building logic, detect when `params.sort` is a single object and wrap it
into an array before returning `params`. Keep the existing handling for `query`,
`offset`, and `dateformats`, and make sure the returned `FindOptions["data"]`
always receives `sort` in the array form expected by the downstream API.

In `@packages/webviewer/src/adapter.ts`:
- Around line 71-73: `maxSize` is only clamped with `Math.max`, so `NaN` or
other non-finite inputs can still flow through and break the drain loop in the
batch handling path. Update the batch-options normalization in `adapter.ts` so
the logic that computes `batch.maxSize` validates the value before clamping,
falling back to `DEFAULT_BATCH_MAX_SIZE` for `NaN`, `Infinity`, and similar
invalid inputs; apply the same fix to the other `maxSize` assignment in the
file’s second batch helper as well.

In `@packages/webviewer/tests/adapter.test.ts`:
- Line 1: The test is importing adapter types through a deep build-output path,
which bypasses the package export map. Update the import in adapter.test.ts to
use the exported subpath from `@proofkit/fmdapi/adapters/core` instead of the
dist/esm path, keeping the same FindOptions, ListOptions, and UpdateOptions type
references.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 33f5ba46-84b0-4369-b420-2c4329ee9fa5

📥 Commits

Reviewing files that changed from the base of the PR and between 319b026 and c5ad855.

📒 Files selected for processing (7)
  • .changeset/quick-bats-queue.md
  • apps/docs/content/docs/webviewer/fmdapi.mdx
  • packages/fmdapi/src/adapters/core.ts
  • packages/fmdapi/src/client.ts
  • packages/fmdapi/tests/client-methods.test.ts
  • packages/webviewer/src/adapter.ts
  • packages/webviewer/tests/adapter.test.ts

Comment thread packages/fmdapi/src/client.ts
Comment thread packages/webviewer/src/adapter.ts
Comment thread packages/webviewer/tests/adapter.test.ts Outdated
@eluce2

eluce2 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #293 on codex/webviewer-batching so fm26 can stay focused on docs.

@eluce2 eluce2 closed this Jun 24, 2026
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.

1 participant