Skip to content

feat: replace custom duration utils with qte library#90

Merged
adelrodriguez merged 1 commit intomainfrom
02-18-feat_replace_custom_duration_utils_with_qte_library
Feb 19, 2026
Merged

feat: replace custom duration utils with qte library#90
adelrodriguez merged 1 commit intomainfrom
02-18-feat_replace_custom_duration_utils_with_qte_library

Conversation

@adelrodriguez
Copy link
Collaborator

@adelrodriguez adelrodriguez commented Feb 19, 2026

Greptile Summary

This PR replaces custom duration utilities with the qte library, a specialized TypeScript package for time expressions. The custom implementation in packages/utils/src/duration.ts (251 lines) has been removed along with its comprehensive test suite and session constants.

Key Changes:

  • Removed milliseconds() and seconds() functions from @init/utils/duration in favor of ms() and seconds() from qte
  • Changed type from DurationInput to TimeExpression across the codebase
  • Replaced hardcoded session constants (SESSION_EXPIRES_IN, SESSION_UPDATE_AGE) with inline duration strings (seconds("30d"), seconds("15d"))
  • Added qte@0.1.0 as a dependency to 4 packages (api, backend, email, kv)
  • Removed @init/error dependency from @init/kv package (no longer needed without custom duration utilities)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The refactoring is comprehensive and consistent across all usages. The migration from custom duration utilities to the qte library is straightforward with equivalent API surface. All imports have been updated correctly, and there are no remaining references to the old implementation.
  • No files require special attention

Important Files Changed

Filename Overview
packages/utils/src/duration.ts Removed custom duration utilities in favor of qte library
apps/api/src/shared/auth.ts Migrated from constants to inline seconds("30d") and seconds("15d") calls using qte
apps/api/src/shared/middleware.ts Changed type from DurationInput to TimeExpression and function from milliseconds() to ms()
packages/backend/src/functions/shared/auth/options.ts Migrated session config to use qte seconds() function with inline duration strings
packages/email/src/client.ts Updated type from DurationInput to TimeExpression and function from milliseconds() to ms()
packages/kv/src/client.ts Migrated to qte library, changed type to TimeExpression and uses seconds() function

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Custom Duration Utils] -->|Removed| B[qte Library v0.1.0]
    B --> C[Auth Session Config]
    B --> D[Rate Limiting]
    B --> E[KV Client TTL]
    B --> F[Email Scheduling]
    
    C -->|seconds 30d| C1[apps/api auth.ts]
    C -->|seconds 15d| C2[packages/backend auth options]
    
    D -->|ms interval| D1[apps/api middleware.ts]
    
    E -->|seconds ttl| E1[packages/kv client.ts]
    
    F -->|ms sendAt| F1[packages/email client.ts]
    
    style A fill:#ff6b6b
    style B fill:#51cf66
Loading

Last reviewed commit: 847fb84

@adelrodriguez adelrodriguez marked this pull request as ready for review February 19, 2026 02:52
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 02-18-feat_replace_custom_duration_utils_with_qte_library

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
Collaborator Author

adelrodriguez commented Feb 19, 2026

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

Comments