Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@eluce2
Copy link
Collaborator

@eluce2 eluce2 commented Dec 19, 2025

Note

  • Auth handling (fmdapi/fmodata): Standardizes env var resolution/validation for server, db, and both auth methods (apiKey, username/password) across getEnvValues, createDataApiClient, and client generation; updates type guards and schema building to always check relevant vars.
  • Client generation: buildLayoutClient now adds guards for auth.apiKey, auth.username, and auth.password as applicable; adapter selection simplified (Otto for apiKey, Fetch for username/password).
  • OData typegen: Preserves and applies existing import aliases when regenerating field builders; merges required imports while keeping aliases; supports alias-aware missing import additions.
  • Config/types: envNames.auth schema unified to include optional apiKey, username, password simultaneously; sample config updated.
  • Tests: Add cases ensuring OttoAdapter when apiKey is provided and FetchAdapter for username/password; snapshot updated to import z from zod.
  • Web UI: Data grid UX improvements in MetadataFieldsDialog and MetadataTablesEditor (sticky headers, scroll areas, bulk include/exclude); minor copy tweak in ConnectionWarning; new data-grid/sticky-header.tsx demo.
  • Chore: Lockfile updates for transitive Next/fumadocs variants.

Written by Cursor Bugbot for commit a5a36be. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Dec 19, 2025

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

Project Deployment Review Updated (UTC)
proofkit-docs Ready Ready Preview Jan 5, 2026 5:14pm

@eluce2 eluce2 marked this pull request as ready for review December 19, 2025 21:06
This was referenced Dec 19, 2025
Copy link
Collaborator Author

eluce2 commented Dec 19, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 19, 2025

Open in StackBlitz

@proofkit/better-auth

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/better-auth@81

@proofkit/cli

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/cli@81

create-proofkit

pnpm add https://pkg.pr.new/proofgeist/proofkit/create-proofkit@81

@proofkit/fmdapi

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/fmdapi@81

@proofkit/fmodata

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/fmodata@81

@proofkit/typegen

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/typegen@81

@proofkit/webviewer

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/webviewer@81

commit: 6f5e5f6

"username" in envNames.auth
) {
addTypeGuardStatements(sourceFile, {
envVarName: envNames.auth?.username ?? defaultEnvNames.username,
Copy link

Choose a reason for hiding this comment

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

Bug: Generated code requires all auth env vars unnecessarily

The type guard generation now adds throw statements for apiKey, username, AND password environment variables whenever envNames.auth is an object. Previously, it only added guards for the specific auth method being used. Now, if a user configures only API key authentication, the generated client will throw errors for missing FM_USERNAME and FM_PASSWORD env vars that aren't actually needed, making the generated code unusable.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Dec 20, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@eluce2 eluce2 force-pushed the fix_username/password_auth branch from d180094 to 6f5e5f6 Compare December 20, 2025 13:50
This was referenced Dec 20, 2025
@eluce2 eluce2 mentioned this pull request Jan 5, 2026
Copy link
Collaborator Author

eluce2 commented Jan 5, 2026

Merge activity

  • Jan 5, 5:09 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 5, 5:13 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jan 5, 5:13 PM UTC: @eluce2 merged this pull request with Graphite.

@eluce2 eluce2 changed the base branch from 12-13-typegen_web_ui to graphite-base/81 January 5, 2026 17:10
@eluce2 eluce2 changed the base branch from graphite-base/81 to main January 5, 2026 17:11
@eluce2 eluce2 force-pushed the fix_username/password_auth branch from 6f5e5f6 to a5a36be Compare January 5, 2026 17:12
@eluce2 eluce2 merged commit a363709 into main Jan 5, 2026
5 of 6 checks passed
envVarName: envNames.server ?? defaultEnvNames.server,
});
if (typeof envNames.auth === "object" && "apiKey" in envNames.auth) {
if (typeof envNames.auth === "object") {
Copy link

Choose a reason for hiding this comment

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

Wrong adapter selected due to property existence check

The condition "apiKey" in envNames.auth checks for property existence, not truthiness. With the changes in typegen.ts, the envNames.auth object now always includes apiKey as a property (even when set to undefined for username/password auth). Since "apiKey" in { apiKey: undefined, username: "X" } returns true, the OttoAdapter branch is incorrectly selected for username/password authentication. The generated code would reference process.env.undefined, completely breaking username/password auth. The check needs to verify the value is truthy (e.g., envNames.auth.apiKey) rather than just checking property existence.

Additional Locations (1)

Fix in Cursor Fix in Web

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