Μετάβαση στο περιεχόμενο

rateLimit

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

rateLimit(options): PipelineBehaviorTuple<RateLimitBehavior, RateLimitBehaviorOptions>

Defined in: packages/pipeline-rate-limit/src/helpers/rate-limit.intent.ts:37

Returns a rate-limit behavior entry for pipeline.wrap() or createPipeline({ globalBehaviors }).

RateLimitIntentOptions

A key factory and rate-limit options, or inheritModuleKey: true when the behavior’s constructor defaults supply the key factory. The inheritance marker is not forwarded to the behavior and does not validate module configuration.

PipelineBehaviorTuple<RateLimitBehavior, RateLimitBehaviorOptions>

The behavior class and options tuple. Use createPartitionedRateLimitKeyFactory for tenant/caller-specific limits.

export const placeOrder = pipeline.wrap(
{ name: 'placeOrder', kind: 'command' },
rateLimit({ keyFactory: perUserKey, points: 1 }),
)(orders.place);
// The key factory comes from the RateLimitBehavior constructor defaults.
const entry = rateLimit({ inheritModuleKey: true, points: 2 });