Skip to content
PACKAGES

createTokenBucketRateLimitTransitionInput()

Create and strictly normalize one token-bucket-v1 evaluator input.

import { createTokenBucketRateLimitTransitionInput } from "@graphrefly/ts/rate-limit";
function createTokenBucketRateLimitTransitionInput(
request: unknown,
policy: unknown,
state: unknown,
observedAtMs: unknown,
): TokenBucketRateLimitTransitionInput
ParameterTypeDescription
requestunknownComplete strict request to evaluate.
policyunknownExact scoped token-bucket policy.
stateunknownExact scoped state, or null only when the host atomically confirms that no exact scoped state exists and authorizes this evaluation to perform first initialization.
observedAtMsunknownExternally supplied authoritative Unix epoch milliseconds.

The immutable normalized token-bucket evaluator input.

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

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