configure | configure(key: string, policy: RateLimitPolicy): Promise<void> | Promise<void> | Registers or updates the policy for `key`. Re-configuring an existing key resets its state. |
consume | consume(key: string, tokens: any): Promise<void> | Promise<void> | Attempts to consume `tokens` units from the bucket. Resolves on success; rejects with
when the bucket is exhausted.
For undeclared keys, this method resolves immediately without consuming anything
(fail-open behaviour — intentional to avoid silent failures when a policy is missing). |
canExecute | canExecute(key: string): Signal<boolean> | Signal<boolean> | Reactive signal indicating whether a single unit can be consumed from `key` right now.
For undeclared keys, returns `signal(true)`. |
remaining | remaining(key: string): Signal<number> | Signal<number> | Reactive signal holding the remaining capacity for `key`.
For undeclared keys, returns `signal(Infinity)`. |
reset | reset(key: string): Promise<void> | Promise<void> | Resets the counter for `key` to its maximum. No-op for undeclared keys. |