UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

33 lines 1.06 kB
/** * @module RateLimiter */ import {} from "../../../../execution-context/contracts/_module.js"; import {} from "../../../../rate-limiter/contracts/_module.js"; import { TimeSpan } from "../../../../time-span/implementations/time-span.js"; /** * The `NoOpRateLimiterAdapter` will do nothing and is used for easily mocking {@link IRateLimiterFactory | `IRateLimiterFactory`} for testing. * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/no-op-rate-limiter-adapter"` * @group Adapters */ export class NoOpRateLimiterAdapter { getState(_context, _key) { return Promise.resolve({ success: true, attempt: 1, resetTime: TimeSpan.fromMilliseconds(1), }); } updateState(_context, _key, limit) { return Promise.resolve({ success: true, attempt: 1, limit, resetTime: TimeSpan.fromMilliseconds(1), }); } reset(_context, _key) { return Promise.resolve(); } } //# sourceMappingURL=no-op-rate-limiter-adapter.js.map