RateLimitBehaviorOptions
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:36
Per-handler (and constructor-default) options for RateLimitBehavior.
Example
Section titled “Example”Tenant + caller scoped limit
const perUser = createPartitionedRateLimitKeyFactory( (ctx) => ctx.items.get('userId') as string | undefined,);
class CreateOrderHandler { @pipeline.wrap({ kind: 'command' }, [RateLimitBehavior, { keyFactory: perUser, points: 1, }]) async handle(command: CreateOrderCommand) {}}Properties
Section titled “Properties”failOpen?
Section titled “failOpen?”
optionalfailOpen?:boolean
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:67
When the backing store itself errors (e.g. Redis is unreachable — distinct
from a normal limit hit), allow the request through (true, default) or
reject it (false). Fail-open favors availability; fail-closed favors
strict protection.
keyFactory?
Section titled “keyFactory?”
optionalkeyFactory?:RateLimitKeyFactory
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:53
Builds the bucket key. Required whenever the behavior executes; there is
no implicit shared bucket. Prefer createPartitionedRateLimitKeyFactory
for tenant/caller-aware limits.
keyPrefix?
Section titled “keyPrefix?”
optionalkeyPrefix?:string
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:55
Optional prefix prepended to the key as "<prefix>:<key>".
limiter?
Section titled “limiter?”
optionallimiter?:RateLimiterLike
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:60
Per-handler limiter override — use a stricter/looser limiter for specific handlers without changing the global one. Defaults to the injected limiter.
points?
Section titled “points?”
optionalpoints?:number|RateLimitCostFactory
Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limit-options.interface.ts:47
Points this request costs: a non-negative safe integer, or a
RateLimitCostFactory computing it per request. 0 charges
nothing: the limiter is not called and no key is built. Default 1.
Example
Section titled “Example”One point per imported row
points: (ctx) => (ctx.request as ImportUsersCommand).rows.length