Skip to content

feat(typed-nocodb-api): extend LIST query schema and fix URLSearchParams serialization#292

Open
stephansama wants to merge 1 commit into
mainfrom
stephansama/ste-77-fix-query-parameters-in-nocodb-package
Open

feat(typed-nocodb-api): extend LIST query schema and fix URLSearchParams serialization#292
stephansama wants to merge 1 commit into
mainfrom
stephansama/ste-77-fix-query-parameters-in-nocodb-package

Conversation

@stephansama

Copy link
Copy Markdown
Owner

Summary

Closes STE-77.

  • Extend the LIST querySchema to expose where, viewId, limit, offset, shuffle, and nestedFields so callers can drive the full set of nocodb v3 records-endpoint parameters.
  • Switch query serialization to an explicit string[][] pair construction with a small toQueryString helper. Arrays now comma-join into a single param (fields=a,b,c) and object-valued params like nestedFields expand into bracketed keys (nestedFields[Author]=name,email) instead of being coerced to [object Object].
  • Coerce sort to nocodb's -field / field prefix-dash format instead of JSON-stringifying it.

Test plan

  • pnpm exec vitest --run core/typed-nocodb-api — existing LIST/COUNT/CREATE/DELETE/UPDATE tests plus a new fetch-mock test that asserts the generated URL contains every new query parameter.
  • pnpm --filter @stephansama/typed-nocodb-api lint
  • pnpm --filter @stephansama/typed-nocodb-api build:snapshot — API snapshot refreshed.

@changeset-bot

changeset-bot Bot commented May 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5fd3576

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
packages Ready Ready Preview, Comment May 18, 2026 2:48am

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@stephansama has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c0198e07-d350-4144-b6e0-075e7ea62a3f

📥 Commits

Reviewing files that changed from the base of the PR and between 9a84b42 and 5fd3576.

📒 Files selected for processing (3)
  • core/typed-nocodb-api/__snapshots__/tsnapi/index.snapshot.d.ts
  • core/typed-nocodb-api/src/index.ts
  • core/typed-nocodb-api/test/index.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stephansama/ste-77-fix-query-parameters-in-nocodb-package

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 and usage tips.

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
core/typed-nocodb-api/src/index.ts 92.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@pkg-pr-new

pkg-pr-new Bot commented May 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@stephansama/ai-commit-msg

pnpm add https://pkg.pr.new/@stephansama/ai-commit-msg@292

@stephansama/alfred-kaomoji

pnpm add https://pkg.pr.new/@stephansama/alfred-kaomoji@292

@stephansama/astro-iconify-svgmap

pnpm add https://pkg.pr.new/@stephansama/astro-iconify-svgmap@292

@stephansama/auto-readme

pnpm add https://pkg.pr.new/@stephansama/auto-readme@292

@stephansama/catppuccin-jsonresume-theme

pnpm add https://pkg.pr.new/@stephansama/catppuccin-jsonresume-theme@292

@stephansama/catppuccin-opml

pnpm add https://pkg.pr.new/@stephansama/catppuccin-opml@292

@stephansama/catppuccin-rss

pnpm add https://pkg.pr.new/@stephansama/catppuccin-rss@292

@stephansama/catppuccin-typedoc

pnpm add https://pkg.pr.new/@stephansama/catppuccin-typedoc@292

@stephansama/catppuccin-xsl

pnpm add https://pkg.pr.new/@stephansama/catppuccin-xsl@292

@stephansama/eslint-config

pnpm add https://pkg.pr.new/@stephansama/eslint-config@292

create-stephansama-example

pnpm add https://pkg.pr.new/create-stephansama-example@292

@stephansama/find-makefile-targets

pnpm add https://pkg.pr.new/@stephansama/find-makefile-targets@292

@stephansama/github-env

pnpm add https://pkg.pr.new/@stephansama/github-env@292

@stephansama/multipublish

pnpm add https://pkg.pr.new/@stephansama/multipublish@292

@stephansama/pnpm-hooks

pnpm add https://pkg.pr.new/@stephansama/pnpm-hooks@292

@stephansama/prettier-plugin-handlebars

pnpm add https://pkg.pr.new/@stephansama/prettier-plugin-handlebars@292

@stephansama/remark-asciinema

pnpm add https://pkg.pr.new/@stephansama/remark-asciinema@292

@stephansama/single-file

pnpm add https://pkg.pr.new/@stephansama/single-file@292

@stephansama/svelte-social-share-links

pnpm add https://pkg.pr.new/@stephansama/svelte-social-share-links@292

@stephansama/typed-env

pnpm add https://pkg.pr.new/@stephansama/typed-env@292

@stephansama/typed-events

pnpm add https://pkg.pr.new/@stephansama/typed-events@292

@stephansama/typed-nocodb-api

pnpm add https://pkg.pr.new/@stephansama/typed-nocodb-api@292

@stephansama/typed-templates

pnpm add https://pkg.pr.new/@stephansama/typed-templates@292

@stephansama/types-github-action-env

pnpm add https://pkg.pr.new/@stephansama/types-github-action-env@292

@stephansama/types-lhci

pnpm add https://pkg.pr.new/@stephansama/types-lhci@292

commit: 5fd3576

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request expands the LIST action in the typed-nocodb-api by adding support for several optional query parameters, including limit, offset, shuffle, nestedFields, viewId, and where. It introduces a toQueryString utility to handle NocoDB-specific serialization requirements, such as bracketed keys for nested objects and comma-separated arrays. Additionally, the sort parameter transformation was updated to use the standard string format (e.g., -field for descending). A review comment suggests refining the URL construction to avoid a trailing question mark when no query parameters are provided.

if ("query" in props && "querySchema" in current) {
const parsed = current.querySchema.parse(props.query);
parameters = "?" + new URLSearchParams(parsed).toString();
parameters = "?" + toQueryString(parsed);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If toQueryString returns an empty string (which happens when all optional query parameters are omitted), the resulting parameters string will be just "?". This leads to a trailing question mark in the final URL (e.g., .../records?). While most servers handle this gracefully, it is cleaner to omit the prefix entirely if there are no parameters to serialize.

				const qs = toQueryString(parsed);
				parameters = qs ? "?" + qs : "";

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