Skip to content
PACKAGES

evaluateTokenBucketRateLimitTransition()

Evaluate one D650 token-bucket-v1 transition with integer rational refill.

See {@link evaluateFixedWindowRateLimitTransition} for the mandatory receipt-first durable host ordering. No IEEE floating-point token accumulation is used; saturation discards excess credit and remainder, and a valid denial still advances the returned refill state.

import { evaluateTokenBucketRateLimitTransition } from "@graphrefly/ts/rate-limit";
function evaluateTokenBucketRateLimitTransition(value: unknown): TokenBucketRateLimitTransition
ParameterTypeDescription
valueunknownStrict token-bucket request, policy, state, and supplied observation input.

One immutable ready transition with integer-rational nextState.

import { evaluateTokenBucketRateLimitTransition } from "@graphrefly/ts/rate-limit";

packages/ts/src/rate-limit/keyed-rate-limit-algorithms.ts