Skip to content

chore: format all files with prettier - #58

Merged
thedevyashsaini merged 1 commit into
mainfrom
feat/format-all
May 26, 2026
Merged

chore: format all files with prettier#58
thedevyashsaini merged 1 commit into
mainfrom
feat/format-all

Conversation

@thedevyashsaini

@thedevyashsaini thedevyashsaini commented May 26, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Documentation
    • Updated integration guides for checkout, billing, subscriptions, and webhooks with standardized formatting and improved code examples across multiple frameworks and languages.

@thedevyashsaini
thedevyashsaini merged commit de66c64 into main May 26, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: baa2173b-62dd-40fb-b618-224915b689ba

📥 Commits

Reviewing files that changed from the base of the PR and between 41a1b0c and 608a917.

⛔ Files ignored due to path filters (5)
  • src/gen/auth/v1/auth.ts is excluded by !**/gen/**
  • src/gen/data/v1/data.ts is excluded by !**/gen/**
  • src/gen/event/v1/event.ts is excluded by !**/gen/**
  • src/gen/payment/v1/payment.ts is excluded by !**/gen/**
  • src/gen/query/v1/query.ts is excluded by !**/gen/**
📒 Files selected for processing (45)
  • .agents/skills/checkout-integration/SKILL.md
  • .agents/skills/credit-based-billing/SKILL.md
  • .agents/skills/dodo-best-practices/SKILL.md
  • .agents/skills/subscription-integration/SKILL.md
  • .agents/skills/usage-based-billing/SKILL.md
  • .agents/skills/webhook-integration/SKILL.md
  • .fallowrc.json
  • AGENTS.md
  • src/config/identifiers.ts
  • src/errors/apikey.ts
  • src/errors/event.ts
  • src/errors/payment.ts
  • src/errors/storage.ts
  • src/interceptors/auth.ts
  • src/interceptors/logging.ts
  • src/routes/gRPC/auth/createAPIKey.ts
  • src/routes/gRPC/events/streamEvents.ts
  • src/routes/gRPC/query/queryEvents.ts
  • src/routes/http/api/expressions.ts
  • src/routes/http/api/registerApiRoutes.ts
  • src/routes/http/api/tags.ts
  • src/schedulers/onboarding.ts
  • src/server.ts
  • src/servers/fastifyServer.ts
  • src/storage/adapter/clickhouse/ClickHouseAdapter.ts
  • src/storage/adapter/clickhouse/utils.ts
  • src/storage/adapter/common/queryEventsBase.ts
  • src/storage/adapter/postgres/handlers/addAiTokenUsage.ts
  • src/storage/adapter/postgres/handlers/queryEvents.ts
  • src/storage/adapter/postgres/postgres.ts
  • src/storage/db/postgres/helpers/apiKeys.ts
  • src/storage/db/postgres/helpers/expressions.ts
  • src/storage/db/postgres/helpers/metadata.ts
  • src/storage/db/postgres/helpers/users.ts
  • src/utils/apiKeyCache.ts
  • src/utils/authenticateHttpApiKey.ts
  • src/utils/formatZodError.ts
  • src/utils/generateInitialAPIKey.ts
  • src/utils/hashAPIKey.ts
  • src/utils/keyFormat.ts
  • src/utils/parseExpr.ts
  • src/zod/apikey.ts
  • src/zod/data.ts
  • src/zod/internals.ts
  • src/zod/query.ts

📝 Walkthrough

Walkthrough

This PR is a comprehensive refresh combining new API key hashing infrastructure, enhanced data persistence, and extensive standardization of Dodo Payments integration documentation across multiple skill guides with consistent code examples and formatting patterns.

Changes

API Key Hashing & Authentication

Layer / File(s) Summary
API Key Hashing Implementation
src/utils/hashAPIKey.ts
New hashAPIKey(apiKey: string): string function using SHA-256 HMAC with process.env.HMAC_SECRET, plus private getSecret() helper ensuring required environment configuration.
Authentication Interceptor & Route Updates
src/interceptors/auth.ts, src/routes/gRPC/auth/createAPIKey.ts, src/utils/authenticateHttpApiKey.ts, src/utils/keyFormat.ts, src/storage/db/postgres/helpers/users.ts
Multi-line import and error-handling reformatting in auth interceptor, API key creation route, and HTTP authentication utilities to support hashing infrastructure.

Data Persistence & Storage Improvements

Layer / File(s) Summary
User Insertion Error Handling
src/storage/db/postgres/helpers/users.ts
ensureUserExists now gracefully handles duplicate key constraint violations with early return, while preserving rethrow behavior for other database errors.

Integration Guides & Documentation

Layer / File(s) Summary
Webhook Integration Guide Update
.agents/skills/webhook-integration/SKILL.md
Expanded "Quick Setup" flow, reformatted webhook event reference into separate titled tables (payment, subscription, credit, other), rewrote Next.js/Express/Python/Go implementation examples with explicit error handling and timestamp validation.
Checkout Integration Guide Update
.agents/skills/checkout-integration/SKILL.md
Standardized checkout examples across hosted checkout, Next.js overlay, and Express.js with consistent double-quoted strings and reformatted payloads; added explicit HTTP error response in Go handler for creation failures.
Credit-Based Billing Guide Update
.agents/skills/credit-based-billing/SKILL.md
Refreshed credit concepts tables, updated TypeScript examples to batched event arrays with consistent quoting, rewrote webhook handler with Prisma upsert patterns (composite keys), updated API reference tables and Next.js integration routes.
Subscription Integration Guide Update
.agents/skills/subscription-integration/SKILL.md
Reworked subscription handler examples with explicit status/period/amount/interval fields, updated webhook event table, reformatted checkout and trial examples with consistent quoting, expanded usage-based and credit-lifecycle sections.
Usage-Based Billing Guide Update
.agents/skills/usage-based-billing/SKILL.md
Updated Quick Start and implementation examples to multi-line event arrays with double-quoted strings, refreshed Next.js API route and hook examples, reformatted hybrid/credit-based billing snippets.
Best Practices Guide Update
.agents/skills/dodo-best-practices/SKILL.md
Standardized SDK installation/initialization examples, webhook verification helpers (HMAC/timing-safe comparison), and integration patterns across JavaScript/TypeScript/Go/Express with consistent quoting.

Codebase Formatting & Maintenance

Layer / File(s) Summary
Import Statement Standardization
src/routes/http/api/expressions.ts, src/routes/http/api/tags.ts, src/routes/http/api/registerApiRoutes.ts, src/schedulers/onboarding.ts, src/server.ts
Multi-line import reformatting to improve readability across API routes, schedulers, and server initialization.
Function Signature & Method Declaration Formatting
src/interceptors/logging.ts, src/routes/gRPC/events/streamEvents.ts, src/routes/gRPC/query/queryEvents.ts, src/servers/fastifyServer.ts, src/storage/adapter/clickhouse/*.ts, src/storage/adapter/postgres/*.ts
Multi-line conversion of method signatures, handler parameters, and function declarations throughout storage adapters and route handlers.
Zod Schema & Type Declaration Formatting
src/zod/apikey.ts, src/zod/data.ts, src/zod/internals.ts, src/zod/query.ts, src/config/identifiers.ts
Single-line ↔ multi-line conversion of Zod schema definitions and TypeScript type aliases for consistent readability.
Error Handling & Message Formatting
src/errors/apikey.ts, src/errors/event.ts, src/errors/payment.ts, src/errors/storage.ts, src/storage/db/postgres/helpers/apiKeys.ts, src/storage/db/postgres/helpers/expressions.ts, src/storage/db/postgres/helpers/metadata.ts, src/utils/parseExpr.ts, src/utils/formatZodError.ts
Reformatting of error construction calls, validation messages, and exception handling across error factory files.
Logging, Caching & Utility Functions
src/schedulers/onboarding.ts, src/server.ts, src/utils/apiKeyCache.ts, src/utils/authenticateHttpApiKey.ts, src/utils/generateInitialAPIKey.ts
Multi-line reformatting of logger calls, cache validation, and utility function implementations; added console.log to generateInitialApiKeyData() on module load.
Configuration & Manifest Files
.fallowrc.json, AGENTS.md
Updated type-checking command to bunx tsgo and minor formatting adjustments.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

  • ScrawnDotDev/Scrawn#36: Touches the same src/zod/data.ts filterGroupSchema construction with createFilterGroupSchema(...) reformatting.
  • ScrawnDotDev/Scrawn#52: Refactors streaming error handling in src/routes/gRPC/events/streamEvents.ts that this PR only reformats.
  • ScrawnDotDev/Scrawn#55: Introduces onboarding scheduler refactor with node-cron whose logger calls this PR reformats in src/schedulers/onboarding.ts.

Poem

🐰 A rabbit hops through docs so bright,
HMAC hashes dance in the light,
Webhooks aligned, examples polished clean,
The finest Dodo guide you've ever seen!
With multi-line grace and quotes so true,
This refresh makes integration new.

✨ 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 feat/format-all

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

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