Skip to content
PACKAGES

createSlidingWindowRateLimitTransitionInput()

Create and strictly normalize one sliding-window-v1 evaluator input.

import { createSlidingWindowRateLimitTransitionInput } from "@graphrefly/ts/rate-limit";
function createSlidingWindowRateLimitTransitionInput(
request: unknown,
policy: unknown,
state: unknown,
observedAtMs: unknown,
): SlidingWindowRateLimitTransitionInput
ParameterTypeDescription
requestunknownComplete strict request to evaluate.
policyunknownExact scoped sliding-window 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 sliding-window evaluator input.

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

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