Skip to content

Stephansama/ste 75 fix nocodb api fetch return type#203

Merged
stephansama merged 2 commits intomainfrom
stephansama/ste-75-fix-nocodb-api-fetch-return-type
Feb 10, 2026
Merged

Stephansama/ste 75 fix nocodb api fetch return type#203
stephansama merged 2 commits intomainfrom
stephansama/ste-75-fix-nocodb-api-fetch-return-type

Conversation

@stephansama
Copy link
Copy Markdown
Owner

Checklist

  • Latest changes from main have been merged
  • Conflicts have been resolved
  • The branch is pointing to main
  • Eslint hasn't reported any issues.
  • All unit tests pass

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 10, 2026

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

Project Deployment Actions Updated (UTC)
packages Ready Ready Preview, Comment Feb 10, 2026 9:49pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: 013e04c

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

This PR includes changesets to release 1 package
Name Type
@stephansama/typed-nocodb-api Minor

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

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @stephansama, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the type definitions within the typed-nocodb-api package, specifically addressing the return type of the fetch method. By inlining type definitions and adding explicit type assertions, it enhances type safety and ensures that API responses are correctly typed, improving the overall developer experience when interacting with the NocoDB API.

Highlights

  • Type Definition Refinement: The FetchOptions type alias was removed, and its definition was inlined directly into the fetch method signature for improved clarity and type inference.
  • Return Type Assertion: An explicit type assertion was added to the fetch method's return value, ensuring that the parsed JSON correctly matches the expected z.output<API[A]["responseSchema"]> type.
  • Example Updates: The callApi examples in both the README.md and example/index.js were updated to correctly reflect the async nature of the fetch call and return its result.
  • Changelog Entry: A changeset file was added, indicating a minor version bump for @stephansama/typed-nocodb-api due to the updated return types.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • @stephansama/typed-nocodb-api
    • updated return types
Activity
  • The author has completed the checklist, confirming that latest changes from main have been merged, conflicts resolved, branch pointing to main, no Eslint issues, and all unit tests pass.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 10, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Updated return types to improve type safety and API consistency
    • Converted API fetch methods to async/await pattern for improved control flow
    • Enhanced type validation with generic-based action types for more precise API call handling
    • Streamlined parameter typing for better developer experience

Walkthrough

The pull request updates the typed-nocodb-api package by converting the callApi function to async and refactoring the fetch method to use generic types (A extends ACTION) instead of a centralized FetchOptions type. The response handling is adjusted with explicit type casting to address typing issues with return values.

Changes

Cohort / File(s) Summary
Version Bump
.changeset/two-showers-melt.md
Adds a changeset entry for a minor version bump with description "updated return types".
Async Conversion
core/typed-nocodb-api/README.md, core/typed-nocodb-api/example/index.js
Converts callApi from a synchronous to asynchronous function, adding await to the API fetch call and returning the result.
Type System Refactoring
core/typed-nocodb-api/src/index.ts
Removes the public FetchOptions type alias and refactors the fetch method to use a generic type parameter (A extends ACTION). Props are now typed inline based on the API schema, and response parsing now includes explicit type casting to z.output<API[A]["responseSchema"]>.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Return types fixed with generic grace,
Async functions find their place,
Types now flow where they belong,
No more type mismatches, strong! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title 'Stephansama/ste 75 fix nocodb api fetch return type' clearly summarizes the main change of fixing the NocoDB API fetch return type, which aligns with the primary objective.
Description check ✅ Passed The pull request description matches the required template structure with all checklist items included, though it lacks specific implementation details about the changes made.
Linked Issues check ✅ Passed The changes directly address STE-75 by modifying the fetch method signature and return type handling to correctly type the return value using generics and schema validation.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the NocoDB API fetch return types; the README, example, and type definitions are all modified in service of the stated objective.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stephansama/ste-75-fix-nocodb-api-fetch-return-type

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

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 correctly fixes the return type of the api.fetch method, which is a significant improvement for the library's type safety and overall developer experience. The implementation refactors the fetch method to be a generic function, which allows for stricter type checking of both the input arguments based on the action and the return value. The necessary updates to the example code in the README and example file are also included. The changes are well-implemented and look good.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 10, 2026

More templates

@stephansama/ai-commit-msg

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

@stephansama/alfred-kaomoji

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

@stephansama/astro-iconify-svgmap

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

@stephansama/auto-readme

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

@stephansama/catppuccin-opml

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

@stephansama/catppuccin-rss

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

@stephansama/catppuccin-typedoc

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

@stephansama/catppuccin-xsl

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

create-stephansama-example

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

@stephansama/find-makefile-targets

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

@stephansama/github-env

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

@stephansama/multipublish

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

@stephansama/prettier-plugin-handlebars

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

@stephansama/remark-asciinema

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

@stephansama/svelte-social-share-links

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

@stephansama/typed-events

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

@stephansama/typed-nocodb-api

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

@stephansama/typed-templates

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

commit: 013e04c

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@stephansama stephansama merged commit 4cec24f into main Feb 10, 2026
10 of 11 checks passed
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@core/typed-nocodb-api/src/index.ts`:
- Around line 106-107: The closure is mutating `_token` via the side-effect
assignment `_token ??= props.token`, which causes the first non-nullish token to
be cached and subsequent per-call `props.token` to be ignored; change the logic
in the function that computes `token` (the line currently using `_token ??=
props.token`) to avoid mutating `_token` — e.g., compute a local `token` from
`props.token` or `_token` without assignment, or make explicit caching behavior
with a clear API if intended; update references to `_token`, `props.token`, and
the `token` variable accordingly so each call respects the `props.token` passed
in unless deliberate caching is documented.

Comment on lines 106 to 107
const token = (_token ??= props.token);
if (!token) throw new Error("no token provided");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Side-effect assignment of _token on every call.

_token ??= props.token silently persists the first non-nullish props.token into the closure for all future calls. If a caller passes a different props.token later, it will be ignored once _token is set. This is pre-existing behavior, but worth noting: with the new public return type making fetch more prominent, consumers may be surprised that per-call tokens are silently dropped after the first.

🤖 Prompt for AI Agents
In `@core/typed-nocodb-api/src/index.ts` around lines 106 - 107, The closure is
mutating `_token` via the side-effect assignment `_token ??= props.token`, which
causes the first non-nullish token to be cached and subsequent per-call
`props.token` to be ignored; change the logic in the function that computes
`token` (the line currently using `_token ??= props.token`) to avoid mutating
`_token` — e.g., compute a local `token` from `props.token` or `_token` without
assignment, or make explicit caching behavior with a clear API if intended;
update references to `_token`, `props.token`, and the `token` variable
accordingly so each call respects the `props.token` passed in unless deliberate
caching is documented.

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