@orpc/ratelimit 2.0.0-beta.11 → 2.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,6 +50,7 @@ You can read the documentation [here](https://orpc.dev).
50
50
  - [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
51
51
  - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
52
52
  - [@orpc/bun](https://www.npmjs.com/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
53
+ - [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).
53
54
 
54
55
  **Observability**
55
56
 
@@ -1,14 +1,6 @@
1
1
  import { R as RateLimiter, a as RateLimitOptions, b as RateLimitResult } from '../shared/ratelimit.BtcMexUf.mjs';
2
2
 
3
3
  interface MemoryRateLimiterOptions {
4
- /**
5
- * Enable this if you don't want to reject a request immediately
6
- * and prefer to wait until it can be retried.
7
- */
8
- blockingUntilReady?: {
9
- enabled: boolean;
10
- timeout: number;
11
- };
12
4
  /**
13
5
  * Maximum number of requests allowed within the window.
14
6
  */
@@ -17,6 +9,23 @@ interface MemoryRateLimiterOptions {
17
9
  * The duration of the fixed window in milliseconds.
18
10
  */
19
11
  window: number;
12
+ /**
13
+ * Block until the request may pass or timeout is reached.
14
+ *
15
+ * @default { enabled: false }
16
+ */
17
+ blockingUntilReady?: {
18
+ /**
19
+ * Block until the request may pass or timeout is reached.
20
+ *
21
+ * @default false
22
+ */
23
+ enabled: boolean;
24
+ /**
25
+ * milliseconds
26
+ */
27
+ timeout: number;
28
+ };
20
29
  }
21
30
  declare class MemoryRateLimiter implements RateLimiter {
22
31
  private readonly maxRequests;
@@ -1,14 +1,6 @@
1
1
  import { R as RateLimiter, a as RateLimitOptions, b as RateLimitResult } from '../shared/ratelimit.BtcMexUf.js';
2
2
 
3
3
  interface MemoryRateLimiterOptions {
4
- /**
5
- * Enable this if you don't want to reject a request immediately
6
- * and prefer to wait until it can be retried.
7
- */
8
- blockingUntilReady?: {
9
- enabled: boolean;
10
- timeout: number;
11
- };
12
4
  /**
13
5
  * Maximum number of requests allowed within the window.
14
6
  */
@@ -17,6 +9,23 @@ interface MemoryRateLimiterOptions {
17
9
  * The duration of the fixed window in milliseconds.
18
10
  */
19
11
  window: number;
12
+ /**
13
+ * Block until the request may pass or timeout is reached.
14
+ *
15
+ * @default { enabled: false }
16
+ */
17
+ blockingUntilReady?: {
18
+ /**
19
+ * Block until the request may pass or timeout is reached.
20
+ *
21
+ * @default false
22
+ */
23
+ enabled: boolean;
24
+ /**
25
+ * milliseconds
26
+ */
27
+ timeout: number;
28
+ };
20
29
  }
21
30
  declare class MemoryRateLimiter implements RateLimiter {
22
31
  private readonly maxRequests;
@@ -4,6 +4,8 @@ import { R as RateLimiter, a as RateLimitOptions, b as RateLimitResult } from '.
4
4
  interface RedisRateLimiterOptions {
5
5
  /**
6
6
  * The prefix to use for Redis keys.
7
+ *
8
+ * @default ''
7
9
  */
8
10
  prefix?: string;
9
11
  /**
@@ -16,9 +18,19 @@ interface RedisRateLimiterOptions {
16
18
  window: number;
17
19
  /**
18
20
  * Block until the request may pass or timeout is reached.
21
+ *
22
+ * @default { enabled: false }
19
23
  */
20
24
  blockingUntilReady?: {
25
+ /**
26
+ * Block until the request may pass or timeout is reached.
27
+ *
28
+ * @default false
29
+ */
21
30
  enabled: boolean;
31
+ /**
32
+ * milliseconds
33
+ */
22
34
  timeout: number;
23
35
  };
24
36
  }
@@ -4,6 +4,8 @@ import { R as RateLimiter, a as RateLimitOptions, b as RateLimitResult } from '.
4
4
  interface RedisRateLimiterOptions {
5
5
  /**
6
6
  * The prefix to use for Redis keys.
7
+ *
8
+ * @default ''
7
9
  */
8
10
  prefix?: string;
9
11
  /**
@@ -16,9 +18,19 @@ interface RedisRateLimiterOptions {
16
18
  window: number;
17
19
  /**
18
20
  * Block until the request may pass or timeout is reached.
21
+ *
22
+ * @default { enabled: false }
19
23
  */
20
24
  blockingUntilReady?: {
25
+ /**
26
+ * Block until the request may pass or timeout is reached.
27
+ *
28
+ * @default false
29
+ */
21
30
  enabled: boolean;
31
+ /**
32
+ * milliseconds
33
+ */
22
34
  timeout: number;
23
35
  };
24
36
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/ratelimit",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.11",
4
+ "version": "2.0.0-beta.12",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.dev",
7
7
  "repository": {
@@ -54,8 +54,8 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@standardserver/core": "^0.0.25",
57
- "@orpc/server": "2.0.0-beta.11",
58
- "@orpc/shared": "2.0.0-beta.11"
57
+ "@orpc/server": "2.0.0-beta.12",
58
+ "@orpc/shared": "2.0.0-beta.12"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@upstash/ratelimit": "^2.0.8",