Retrieves the stored rate limiter data without a transaction. Useful for read-only operations or standalone state checks. Returns null if the rate limiter hasn't been initialized.
Readable execution context for the operation
Unique identifier for the rate limiter
The stored rate limiter data if found, otherwise null
Removes a rate limiter entry from the database. Called when explicitly resetting a rate limiter or cleaning up expired entries. Safe to call even if the rate limiter doesn't exist.
Readable execution context for the operation
Unique identifier for the rate limiter to remove
Executes rate limiter operations within a database transaction.
Provides an IRateLimiterStorageAdapterTransaction
object for atomic find/upsert operations.
All database operations within the transaction function should succeed or fail atomically. If the transaction function throws, the transaction should be rolled back.
Readable execution context for the operation
Callback function receiving transaction object, should return a Promise
The value returned by the fn callback
Storage adapter contract for persisting rate limiter state in databases. Abstracts database operations for rate limiters with CRUD-based storage. Simplifies implementation for SQL databases and ORMs (TypeORM, MikroORM, etc.).
Adapters implementing this contract serialize the policy's TMetrics type for storage and deserialize it when loading, handling the conversion to/from TType.
IMPORT_PATH:
"@daiso-tech/core/rate-limiter/contracts"