mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Make @ditto/ratelimiter a separate package
This commit is contained in:
parent
eec380665c
commit
b73e475326
9 changed files with 16 additions and 3 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
"./packages/db",
|
"./packages/db",
|
||||||
"./packages/ditto",
|
"./packages/ditto",
|
||||||
"./packages/metrics",
|
"./packages/metrics",
|
||||||
|
"./packages/ratelimiter",
|
||||||
"./packages/translators"
|
"./packages/translators"
|
||||||
],
|
],
|
||||||
"tasks": {
|
"tasks": {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { RateLimitError } from './RateLimitError.ts';
|
import { RateLimitError } from './RateLimitError.ts';
|
||||||
import { RateLimiter, RateLimiterClient } from './types.ts';
|
|
||||||
|
import type { RateLimiter, RateLimiterClient } from './types.ts';
|
||||||
|
|
||||||
interface MemoryRateLimiterOpts {
|
interface MemoryRateLimiterOpts {
|
||||||
limit: number;
|
limit: number;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { RateLimiter, RateLimiterClient } from './types.ts';
|
import type { RateLimiter, RateLimiterClient } from './types.ts';
|
||||||
|
|
||||||
export class MultiRateLimiter {
|
export class MultiRateLimiter {
|
||||||
constructor(private limiters: RateLimiter[]) {}
|
constructor(private limiters: RateLimiter[]) {}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { RateLimiter, RateLimiterClient } from './types.ts';
|
import type { RateLimiter, RateLimiterClient } from './types.ts';
|
||||||
|
|
||||||
export class RateLimitError extends Error {
|
export class RateLimitError extends Error {
|
||||||
constructor(
|
constructor(
|
||||||
6
packages/ratelimiter/deno.json
Normal file
6
packages/ratelimiter/deno.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "@ditto/ratelimiter",
|
||||||
|
"exports": {
|
||||||
|
".": "./mod.ts"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
packages/ratelimiter/mod.ts
Normal file
5
packages/ratelimiter/mod.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
export { MemoryRateLimiter } from './MemoryRateLimiter.ts';
|
||||||
|
export { MultiRateLimiter } from './MultiRateLimiter.ts';
|
||||||
|
export { RateLimitError } from './RateLimitError.ts';
|
||||||
|
|
||||||
|
export type { RateLimiter, RateLimiterClient } from './types.ts';
|
||||||
Loading…
Add table
Reference in a new issue