throttlers
Version:
[](https://www.npmjs.com/package/throttlers) [](https://github.com/havelessbemore/throttlers/graphs/commit-activity) [
{"version":3,"sources":["../../src/index.ts","../../src/strategyThrottler.ts","../../src/strategies/fixedWindowStrategy.ts","../../src/strategies/leakyBucketStrategy.ts","../../src/strategies/linearStrategy.ts","../../src/strategies/slidingWindowStrategy.ts","../../src/strategies/tokenBucketStrategy.ts"],"sourcesContent":["export { TimeoutError } from \"wait-utils\";\n\nexport {\n type FixedWindowConfig,\n FixedWindowStrategy,\n FixedWindowThrottler,\n} from \"./strategies/fixedWindowStrategy\";\n\nexport {\n type LeakyBucketConfig,\n LeakyBucketStrategy,\n LeakyBucketThrottler,\n} from \"./strategies/leakyBucketStrategy\";\n\nexport {\n type LinearConfig,\n LinearStrategy,\n LinearThrottler,\n} from \"./strategies/linearStrategy\";\n\nexport {\n type SlidingWindowConfig,\n SlidingWindowStrategy,\n SlidingWindowThrottler,\n} from \"./strategies/slidingWindowStrategy\";\n\nexport {\n type TokenBucketConfig,\n TokenBucketStrategy,\n TokenBucketThrottler,\n} from \"./strategies/tokenBucketStrategy\";\n\nexport {\n StrategyThrottler,\n type StrategyThrottlerConfig,\n} from \"./strategyThrottler\";\n\nexport type { AcquireOptions, Throttler } from \"./types/throttler\";\n\nexport type {\n TryAcquireFailure,\n TryAcquireResult,\n TryAcquireSuccess,\n ThrottlerStrategy,\n} from \"./types/throttlerStrategy\";\n","import { poll } from \"wait-utils\";\n\nimport type { AcquireOptions, Throttler } from \"./types/throttler\";\nimport type { ThrottlerStrategy } from \"./types/throttlerStrategy\";\n\nexport interface StrategyThrottlerConfig {\n strategy: ThrottlerStrategy;\n}\n\nexport class StrategyThrottler implements Throttler {\n readonly strategy: ThrottlerStrategy;\n\n constructor({ strategy }: StrategyThrottlerConfig) {\n this.strategy = strategy;\n }\n\n tryAcquire(): boolean {\n return this.strategy.tryAcquire().success;\n }\n\n acquire({ signal, timeout }: AcquireOptions = {}): Promise<void> {\n return poll(\n (ctx) => {\n const { retryAfterMs, success } = this.strategy.tryAcquire();\n ctx.delay = retryAfterMs;\n ctx.stop = success;\n },\n {\n delay: 0,\n signal,\n timeout,\n },\n );\n }\n}\n","import { StrategyThrottler } from \"../strategyThrottler\";\nimport type {\n ThrottlerStrategy,\n TryAcquireResult,\n} from \"../types/throttlerStrategy\";\n\n/**\n * Configuration options for creating a {@link FixedWindowStrategy}.\n *\n * @example\n * // 5 requests per second\n * {\n * duration: 1000, // milliseconds\n * limit: 5\n * }\n */\nexport interface FixedWindowConfig {\n /**\n * The size of the window in milliseconds.\n */\n duration: number;\n\n /**\n * The number of requests allowed per window.\n *\n * Requests above this limit will be delayed.\n */\n limit: number;\n}\n\n/**\n * A throttler that uses the fixed window algorithm.\n *\n * This throttler counts the number of requests within\n * each fixed-duration window. Once the limit is reached,\n * additional requests are delayed until future windows.\n *\n * Note: This approach can cause bursts of traffic at\n * window boundaries.\n */\nexport class FixedWindowStrategy implements ThrottlerStrategy {\n /**\n * The size of the window in milliseconds.\n */\n readonly duration: number;\n\n /**\n * The number of requests allowed per window.\n */\n readonly limit: number;\n\n /**\n * Timestamp marking the end of the current window.\n */\n private windowEnd: number;\n\n /**\n * Number of accepted requests in the current window.\n */\n private count: number;\n\n constructor({ duration, limit }: FixedWindowConfig) {\n if (duration < 0) {\n throw new RangeError(\"Invalid duration\");\n }\n if (limit < 1) {\n throw new RangeError(\"Invalid limit\");\n }\n\n this.count = 0;\n this.duration = duration;\n this.limit = limit;\n this.windowEnd = 0;\n }\n\n /**\n * Attempts to acquire permission to proceed with a request.\n *\n * If the current window has capacity, returns <= 0.\n *\n * Otherwise, returns the number of milliseconds to wait\n * before the caller should retry.\n */\n tryAcquire(): TryAcquireResult {\n const now = performance.now();\n\n if (now >= this.windowEnd) {\n this.windowEnd = now + this.duration;\n this.count = 0;\n }\n\n if (this.count + 1 > this.limit) {\n return { success: false, retryAfterMs: this.windowEnd - now };\n }\n\n ++this.count;\n return { success: true };\n }\n}\n\nexport class FixedWindowThrottler extends StrategyThrottler {\n constructor(config: FixedWindowConfig) {\n super({ strategy: new FixedWindowStrategy(config) });\n }\n}\n","import { StrategyThrottler } from \"../strategyThrottler\";\nimport type {\n ThrottlerStrategy,\n TryAcquireResult,\n} from \"../types/throttlerStrategy\";\n\n/**\n * Configuration options for creating a {@link LeakyBucketStrategy}.\n *\n * @example\n * // Allow bursts of up to 10 requests, with a drain of 5 per second\n * {\n * capacity: 10,\n * leakRate: 5\n * }\n */\nexport interface LeakyBucketConfig {\n /**\n * Maximum number of tokens the bucket can hold.\n *\n * This defines the burst capacity. Requests beyond this\n * limit are throttled until enough leakage has occurred.\n */\n capacity: number;\n\n /**\n * Rate at which tokens leak per second.\n *\n * A higher rate allows faster throughput.\n */\n leakRate: number;\n}\n\n/**\n * A throttler that uses the leaky bucket algorithm.\n *\n * Tokens are added to a \"bucket\" which drains at a steady rate\n * defined by `leakRate`. If the bucket overflows (`capacity` exceeded),\n * further requests are throttled until enough leakage has occurred.\n *\n * This method smooths bursts over time, providing a steady output rate.\n */\nexport class LeakyBucketStrategy implements ThrottlerStrategy {\n /**\n * Maximum capacity of the bucket.\n */\n readonly capacity: number;\n /**\n * Timestamp of the last leakage calculation.\n */\n private leakedAt: number;\n\n /**\n * Rate at which tokens are leaked, per second.\n */\n readonly leakRate: number;\n\n /**\n * Current number of tokens in the bucket.\n */\n private tokens: number;\n\n constructor({ capacity, leakRate }: LeakyBucketConfig) {\n if (capacity < 1) {\n throw new RangeError(\"Invalid capacity\");\n }\n if (leakRate <= 0) {\n throw new RangeError(\"Invalid leak rate\");\n }\n this.capacity = capacity;\n this.leakedAt = performance.now();\n this.leakRate = leakRate;\n this.tokens = 0;\n }\n\n /**\n * Attempts to acquire permission to proceed with a request.\n *\n * First, the number of leaked tokens since the last check\n * is calculated and the bucket's level is updated accordingly.\n *\n * If the bucket has capacity, the request is accepted.\n *\n * Otherwise, returns the timestamp of when enough leakage\n * will occur to allow the request.\n */\n tryAcquire(): TryAcquireResult {\n const now = performance.now();\n\n // Calculate tokens leaked since the last check\n const elapsed = (now - this.leakedAt) / 1000;\n const leaked = elapsed * this.leakRate;\n this.tokens = Math.max(0, this.tokens - leaked);\n this.leakedAt = now;\n\n // If full, calculate how long until capacity\n if (this.tokens > this.capacity - 1) {\n const delta = this.tokens - this.capacity + 1;\n const duration = (1000 * delta) / this.leakRate;\n return { success: false, retryAfterMs: Math.max(1, duration) };\n }\n\n // Accept the request\n ++this.tokens;\n return { success: true };\n }\n}\n\nexport class LeakyBucketThrottler extends StrategyThrottler {\n constructor(config: LeakyBucketConfig) {\n super({ strategy: new LeakyBucketStrategy(config) });\n }\n}\n","import { StrategyThrottler } from \"../strategyThrottler\";\nimport type {\n ThrottlerStrategy,\n TryAcquireResult,\n} from \"../types/throttlerStrategy\";\n\n/**\n * Configuration options for creating a {@link LinearStrategy}.\n *\n * @example\n * // Allow one request every 500 milliseconds\n * {\n * duration: 500\n * }\n */\nexport interface LinearConfig {\n /**\n * The minimum duration between requests, in milliseconds.\n */\n duration: number;\n}\n\n/**\n * A throttler that enforces a fixed delay between requests.\n *\n * This throttler ensures that each request occurs at least\n * `duration` milliseconds after the previous one, providing\n * consistent pacing without bursts.\n */\nexport class LinearStrategy implements ThrottlerStrategy {\n /**\n * The minimum duration between requests, in milliseconds.\n */\n readonly duration: number;\n\n /**\n * Timestamp of when the next request is allowed.\n */\n private slot: number;\n\n constructor({ duration }: LinearConfig) {\n if (duration < 0) {\n throw new RangeError(\"Duration must be non-negative\");\n }\n this.duration = duration;\n this.slot = 0;\n }\n\n /**\n * Attempts to acquire permission to proceed with the operation.\n *\n * Allows the request if the current time is past `slot`.\n *\n * Otherwise, returns the timestamp when the next\n * request is allowed to indicate how long the caller\n * should wait before retrying.\n */\n tryAcquire(): TryAcquireResult {\n const now = performance.now();\n\n if (now < this.slot) {\n return { success: false, retryAfterMs: this.slot - now };\n }\n\n this.slot = now + this.duration;\n return { success: true };\n }\n}\n\nexport class LinearThrottler extends StrategyThrottler {\n constructor(config: LinearConfig) {\n super({ strategy: new LinearStrategy(config) });\n }\n}\n","import { StrategyThrottler } from \"../strategyThrottler\";\nimport type {\n ThrottlerStrategy,\n TryAcquireResult,\n} from \"../types/throttlerStrategy\";\n\n/**\n * Configuration options for creating a {@link SlidingWindowStrategy}.\n *\n * @example\n * // 5 requests per second\n * {\n * duration: 1000, // milliseconds\n * limit: 5\n * }\n */\nexport interface SlidingWindowConfig {\n /**\n * The size of the window in milliseconds.\n */\n duration: number;\n\n /**\n * The number of requests allowed per window.\n *\n * Requests above this limit will be delayed.\n */\n limit: number;\n}\n\n/**\n * A throttler that uses the sliding window algorithm.\n *\n * This throttler spreads requests across a moving time window,\n * tracking the timestamps of accepted requests and ensuring\n * no more than a fixed number occur within any given interval.\n */\nexport class SlidingWindowStrategy implements ThrottlerStrategy {\n /**\n * The size of the window in milliseconds.\n */\n readonly duration: number;\n\n /**\n * Points to the oldest slot in the current window.\n */\n private index: number;\n\n /**\n * The number of requests allowed per window.\n */\n readonly limit: number;\n\n /**\n * Timestamps of the last `limit` accepted requests.\n *\n * These are used to determine if a new request falls\n * within the allowed window, and to delay if necessary.\n */\n private slots: number[];\n\n constructor({ duration, limit }: SlidingWindowConfig) {\n if (duration < 0) {\n throw new RangeError(\"Invalid duration\");\n }\n if (!Number.isInteger(limit) || limit < 1) {\n throw new RangeError(\"Invalid limit\");\n }\n this.duration = duration;\n this.index = 0;\n this.limit = limit;\n this.slots = new Array(limit).fill(0);\n }\n\n /**\n * Attempts to acquire permission to proceed with a request.\n *\n * If the number of requests within the sliding window is\n * below the limit, the request is accepted and its expiration\n * timestamp (i.e. when it falls out of the window) is\n * recorded in the current slot.\n *\n * If the limit has been reached, the expiration time of the\n * oldest request is returned to indicate how long the caller\n * should wait before retrying.\n */\n tryAcquire(): TryAcquireResult {\n const now = performance.now();\n\n if (now < this.slots[this.index]) {\n return { success: false, retryAfterMs: this.slots[this.index] - now };\n }\n\n this.slots[this.index] = now + this.duration;\n this.index = (this.index + 1) % this.limit;\n return { success: true };\n }\n}\n\nexport class SlidingWindowThrottler extends StrategyThrottler {\n constructor(config: SlidingWindowConfig) {\n super({ strategy: new SlidingWindowStrategy(config) });\n }\n}\n","import { StrategyThrottler } from \"../strategyThrottler\";\nimport type {\n ThrottlerStrategy,\n TryAcquireResult,\n} from \"../types/throttlerStrategy\";\n\n/**\n * Configuration options for creating a {@link TokenBucketStrategy}.\n *\n * @example\n *\n * // Allow bursts of up to 10 requests, refilling at 5 per second\n * {\n * capacity: 10,\n * refillRate: 5\n * }\n */\nexport interface TokenBucketConfig {\n /**\n * Maximum number of tokens the bucket can hold.\n *\n * This defines the burst capacity. Requests beyond this\n * limit are throttled until enough refill has occurred.\n */\n capacity: number;\n\n /**\n * Rate at which tokens refill per second.\n *\n * A higher rate allows faster throughput.\n */\n refillRate: number;\n}\n\n/**\n * A throttler that uses the token bucket algorithm.\n *\n * Allows requests to be made at a steady rate, while\n * still supporting occasional bursts.\n *\n * Each request consumes one token. Tokens are added\n * continuously over time based on the configured refill rate.\n */\nexport class TokenBucketStrategy implements ThrottlerStrategy {\n /**\n * Maximum number of tokens in the bucket.\n */\n readonly capacity: number;\n\n /**\n * Timestamp of the last refill calculation.\n */\n private refilledAt: number;\n\n /**\n * Rate at which tokens are added, per second.\n */\n readonly refillRate: number;\n\n /**\n * Current number of tokens in the bucket.\n */\n private tokens: number;\n\n constructor({ capacity, refillRate }: TokenBucketConfig) {\n if (capacity < 1) {\n throw new RangeError(\"Invalid capacity\");\n }\n if (refillRate <= 0) {\n throw new RangeError(\"Invalid refill rate\");\n }\n this.capacity = capacity;\n this.refilledAt = performance.now();\n this.refillRate = refillRate;\n this.tokens = capacity;\n }\n\n /**\n * Attempts to acquire permission to proceed with a request.\n *\n * First, the number of refilled tokens since the last check\n * is calculated and the bucket's level is updated accordingly.\n *\n * If at least one token is available, the request is accepted.\n *\n * Otherwise, returns the timestamp when a token will become\n * available to allow the request.\n */\n tryAcquire(): TryAcquireResult {\n const now = performance.now();\n\n // Calculate tokens refilled since the last check\n const elapsed = (now - this.refilledAt) / 1000;\n const added = elapsed * this.refillRate;\n this.tokens = Math.min(this.capacity, this.tokens + added);\n this.refilledAt = now;\n\n // If empty, calculate how long for the next token\n if (this.tokens < 1) {\n const delta = 1 - this.tokens;\n const duration = (1000 * delta) / this.refillRate;\n return { success: false, retryAfterMs: Math.max(1, duration) };\n }\n\n // Accept the request\n --this.tokens;\n return { success: true };\n }\n}\n\nexport class TokenBucketThrottler extends StrategyThrottler {\n constructor(config: TokenBucketConfig) {\n super({ strategy: new TokenBucketStrategy(config) });\n }\n}\n"],"mappings":";ijBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,yBAAAC,EAAA,wBAAAC,EAAA,yBAAAC,EAAA,mBAAAC,EAAA,oBAAAC,EAAA,0BAAAC,EAAA,2BAAAC,EAAA,sBAAAC,EAAA,wDAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAb,GAAA,IAAAc,EAA6B,sBCA7B,IAAAC,EAAqB,sBASd,IAAMC,EAAN,KAA6C,CAGlD,YAAY,CAAE,SAAAC,CAAS,EAA4B,CAFnDC,EAAA,KAAS,YAGP,KAAK,SAAWD,CAClB,CAEA,YAAsB,CACpB,OAAO,KAAK,SAAS,WAAW,EAAE,OACpC,CAEA,QAAQ,CAAE,OAAAE,EAAQ,QAAAC,CAAQ,EAAoB,CAAC,EAAkB,CAC/D,SAAO,QACJC,GAAQ,CACP,GAAM,CAAE,aAAAC,EAAc,QAAAC,CAAQ,EAAI,KAAK,SAAS,WAAW,EAC3DF,EAAI,MAAQC,EACZD,EAAI,KAAOE,CACb,EACA,CACE,MAAO,EACP,OAAAJ,EACA,QAAAC,CACF,CACF,CACF,CACF,ECMO,IAAMI,EAAN,KAAuD,CAqB5D,YAAY,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAAsB,CAjBpDC,EAAA,KAAS,YAKTA,EAAA,KAAS,SAKTA,EAAA,KAAQ,aAKRA,EAAA,K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aAAc,KAAK,MAAM,KAAK,KAAK,EAAIA,CAAI,GAGtE,KAAK,MAAM,KAAK,KAAK,EAAIA,EAAM,KAAK,SACpC,KAAK,OAAS,KAAK,MAAQ,GAAK,KAAK,MAC9B,CAAE,QAAS,EAAK,EACzB,CACF,EAEaC,EAAN,cAAqCC,CAAkB,CAC5D,YAAYC,EAA6B,CACvC,MAAM,CAAE,SAAU,IAAIP,EAAsBO,CAAM,CAAE,CAAC,CACvD,CACF,EC5DO,IAAMC,EAAN,KAAuD,CAqB5D,YAAY,CAAE,SAAAC,EAAU,WAAAC,CAAW,EAAsB,CAjBzDC,EAAA,KAAS,YAKTA,EAAA,KAAQ,cAKRA,EAAA,KAAS,cAKTA,EAAA,KAAQ,UAGN,GAAIF,EAAW,EACb,MAAM,IAAI,WAAW,kBAAkB,EAEzC,GAAIC,GAAc,EAChB,MAAM,IAAI,WAAW,qBAAqB,EAE5C,KAAK,SAAWD,EAChB,KAAK,WAAa,YAAY,IAAI,EAClC,KAAK,WAAaC,EAClB,KAAK,OAASD,CAChB,CAaA,YAA+B,CAC7B,IAAMG,EAAM,YAAY,IAAI,EAItBC,GADWD,EAAM,KAAK,YAAc,IAClB,KAAK,WAK7B,GAJA,KAAK,OAAS,KAAK,IAAI,KAAK,SAAU,KAAK,OAASC,CAAK,EACzD,KAAK,WAAaD,EAGd,KAAK,OAAS,EAAG,CAEnB,IAAME,EAAY,KADJ,EAAI,KAAK,QACW,KAAK,WACvC,MAAO,CAAE,QAAS,GAAO,aAAc,KAAK,IAAI,EAAGA,CAAQ,CAAE,CAC/D,CAGA,QAAE,KAAK,OACA,CAAE,QAAS,EAAK,CACzB,CACF,EAEaC,EAAN,cAAmCC,CAAkB,CAC1D,YAAYC,EAA2B,CACrC,MAAM,CAAE,SAAU,IAAIT,EAAoBS,CAAM,CAAE,CAAC,CACrD,CACF","names":["index_exports","__export","FixedWindowStrategy","FixedWindowThrottler","LeakyBucketStrategy","LeakyBucketThrottler","LinearStrategy","LinearThrottler","SlidingWindowStrategy","SlidingWindowThrottler","StrategyThrottler","TokenBucketStrategy","TokenBucketThrottler","__toCommonJS","import_wait_utils","import_wait_utils","StrategyThrottler","strategy","__publicField","signal","timeout","ctx","retryAfterMs","success","FixedWindowStrategy","duration","limit","__publicField","now","FixedWindowThrottler","StrategyThrottler","config","LeakyBucketStrategy","capacity","leakRate","__publicField","now","leaked","duration","LeakyBucketThrottler","StrategyThrottler","config","LinearStrategy","duration","__publicField","now","LinearThrottler","StrategyThrottler","config","SlidingWindowStrategy","duration","limit","__publicField","now","SlidingWindowThrottler","StrategyThrottler","config","TokenBucketStrategy","capacity","refillRate","__publicField","now","added","duration","TokenBucketThrottler","StrategyThrottler","config"]}