Skip to content

Conversation

@eluce2
Copy link
Collaborator

@eluce2 eluce2 commented Aug 8, 2025

betterauth raw odata

Update @proofkit/better-auth to version 0.2.3, add logging enhancements, and improve date handling in queries. Introduce new metadata fetching functionality and adjust OData fetch configuration. Update pnpm workspace settings and lockfile for better dependency management.

Summary by CodeRabbit

  • New Features

    • Introduced a fetch-based interface for OData operations with improved validation, error handling, and flexible authentication (username/password or API key).
    • Added debug logging and configurable logging verbosity for better insight into requests and internal states.
    • Added utility for validating URLs and improved date handling in filter queries.
  • Improvements

    • Enhanced migration support with updated field type mappings and more robust metadata handling.
    • Refined configuration schema to use server URLs and support advanced authentication methods.
  • Bug Fixes

    • Fixed date parsing in OData filter queries for more accurate query results.
  • Tests

    • Expanded and updated tests to cover new fetch-based operations, date handling, and migration flows.
  • Chores

    • Updated dependencies and workspace configuration for better package management and development workflow.

eluce2 added 2 commits August 4, 2025 13:26
…ts, and improve date handling in queries. Introduce new metadata fetching functionality and adjust OData fetch configuration. Update pnpm workspace settings and lockfile for better dependency management.
@vercel
Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
proofkit-docs ❌ Failed (Inspect) Aug 8, 2025 2:00am

@eluce2 eluce2 marked this pull request as ready for review August 8, 2025 02:00
Copy link
Collaborator Author

eluce2 commented Aug 8, 2025

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

@eluce2 eluce2 merged commit c0ba701 into main Aug 8, 2025
1 of 2 checks passed
});
});

it.only("should properly filter by dates", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The test is using it.only() which will cause only this test to run while skipping all others in the test suite. This is typically used during development for focusing on a specific test, but should be changed to regular it() before merging to ensure the entire test suite runs properly.

Suggested change
it.only("should properly filter by dates", async () => {
it("should properly filter by dates", async () => {

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The pull request is closed.

Walkthrough

This update refactors the @proofkit/better-auth package to replace its class-based OData client with a fetch-based interface, updating authentication handling, logging, and error management. Related migration, adapter, and CLI logic were reworked to use the new interface. Tests and configuration files were updated to align with these changes, and new tests were added.

Changes

Cohort / File(s) Change Summary
Changelog and Versioning
packages/better-auth/CHANGELOG.md, packages/better-auth/package.json
Updated changelog for versions 0.2.0-beta.0 to 0.2.3. Bumped package version to 0.2.3. Added new dependencies (@better-fetch/fetch, @better-fetch/logger, neverthrow), moved fm-odata-client to devDependencies.
OData Client Refactor
packages/better-auth/src/odata/index.ts
Replaced FmOdata class with a functional fetch-based client (createFmOdataFetch). Updated configuration, authentication, error handling, and logging. Removed type guards and class-based exports. Added URL validation and logging plugin.
Adapter Refactor
packages/better-auth/src/adapter.ts
Refactored adapter to use the new fetch-based OData interface. Updated configuration schema, authentication handling, date parsing, and error handling. Added debug logging and updated method implementations to use HTTP requests.
Migration Refactor
packages/better-auth/src/migrate.ts
Rewrote migration logic to use the fetch-based client. Introduced getMetadata, updated type mappings (string to varchar), and revised migration plan and execution functions to use HTTP POST requests for schema changes.
CLI Refactor
packages/better-auth/src/cli/index.ts
Updated CLI to use the fetch-based OData client. Adjusted imports and function signatures for migration planning and execution to accept fetch client instead of database instance.
Adapter Tests Update
packages/better-auth/tests/adapter.test.ts
Updated tests to use the new fetch-based client. Changed database reset logic to use HTTP DELETE with filters. Updated adapter initialization and added a focused test for date filtering.
Migration Tests Addition
packages/better-auth/tests/migrate.test.ts
Added new test suite for migration and metadata retrieval using the fetch-based client. Includes CRUD operations on test tables via HTTP requests.
parseWhere & URL Validation Tests
packages/better-auth/tests/parseWhere.test.ts
Extended parseWhere tests for enhanced date handling. Added tests for the validateUrl utility to verify URL validation behavior.
Workspace Configuration
pnpm-workspace.yaml
Removed quotes from package globs and added an overrides section for local linking of @proofkit/better-auth.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Adapter
    participant FetchClient as OData Fetch Client
    participant FileMakerServer

    CLI->>Adapter: Initialize with config
    Adapter->>FetchClient: createFmOdataFetch(config)
    Adapter->>FetchClient: Perform OData operation (e.g., create, findMany)
    FetchClient->>FileMakerServer: HTTP request (with auth)
    FileMakerServer-->>FetchClient: HTTP response (data or error)
    FetchClient-->>Adapter: Result (success or error)
    Adapter-->>CLI: Operation outcome
Loading
sequenceDiagram
    participant CLI
    participant Migrate
    participant FetchClient as OData Fetch Client
    participant FileMakerServer

    CLI->>Migrate: planMigration(fetch, schema, dbName)
    Migrate->>FetchClient: getMetadata(databaseName)
    FetchClient->>FileMakerServer: GET /$metadata
    FileMakerServer-->>FetchClient: Metadata XML/JSON
    FetchClient-->>Migrate: Metadata
    Migrate-->>CLI: Migration plan

    CLI->>Migrate: executeMigration(fetch, plan)
    Migrate->>FetchClient: POST/DELETE requests for schema changes
    FetchClient->>FileMakerServer: HTTP requests
    FileMakerServer-->>FetchClient: Responses
    FetchClient-->>Migrate: Operation results
    Migrate-->>CLI: Migration outcome
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • chriscors

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 092d809 and eb78373.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • packages/better-auth/CHANGELOG.md (1 hunks)
  • packages/better-auth/package.json (2 hunks)
  • packages/better-auth/src/adapter.ts (5 hunks)
  • packages/better-auth/src/cli/index.ts (4 hunks)
  • packages/better-auth/src/migrate.ts (7 hunks)
  • packages/better-auth/src/odata/index.ts (1 hunks)
  • packages/better-auth/tests/adapter.test.ts (4 hunks)
  • packages/better-auth/tests/migrate.test.ts (1 hunks)
  • packages/better-auth/tests/parseWhere.test.ts (3 hunks)
  • pnpm-workspace.yaml (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 08-04-betterauth_raw_odata

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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