@upstash/ratelimit 2.0.1 → 2.0.3

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
@@ -76,7 +76,7 @@ For more information on getting started, you can refer to [our documentation](ht
76
76
 
77
77
  ## Documentation
78
78
 
79
- See [the documentation](https://upstash.com/docs/oss/sdks/ts/ratelimit/overview) for more information details about this package.
79
+ See [the documentation](https://upstash.com/docs/redis/sdks/ratelimit-ts/overview) for more information details about this package.
80
80
 
81
81
  ## Contributing
82
82
 
package/dist/index.d.mts CHANGED
@@ -20,12 +20,6 @@ interface EphemeralCache {
20
20
  type RegionContext = {
21
21
  redis: Redis;
22
22
  cache?: EphemeralCache;
23
- scriptHashes: {
24
- limitHash?: string;
25
- getRemainingHash?: string;
26
- resetHash?: string;
27
- };
28
- cacheScripts: boolean;
29
23
  };
30
24
  type MultiRegionContext = {
31
25
  regionContexts: Omit<RegionContext[], "cache">;
@@ -570,8 +564,12 @@ type RegionRatelimitConfig = {
570
564
  */
571
565
  analytics?: boolean;
572
566
  /**
573
- * If enabled, lua scripts will be sent to Redis with SCRIPT LOAD durint the first request.
574
- * In the subsequent requests, hash of the script will be used to invoke it
567
+ * @deprecated Has no affect since v2.0.3. Instead, hash values of scripts are
568
+ * hardcoded in the sdk and it attempts to run the script using EVALSHA (with the hash).
569
+ * If it fails, runs script load.
570
+ *
571
+ * Previously, if enabled, lua scripts were sent to Redis with SCRIPT LOAD durint the first request.
572
+ * In the subsequent requests, hash of the script would be used to invoke the scripts
575
573
  *
576
574
  * @default true
577
575
  */
@@ -769,4 +767,4 @@ declare namespace ipDenyList {
769
767
  };
770
768
  }
771
769
 
772
- export { Algorithm, Analytics, AnalyticsConfig, ipDenyList as IpDenyList, MultiRegionRatelimit, MultiRegionRatelimitConfig, RegionRatelimit as Ratelimit, RegionRatelimitConfig as RatelimitConfig };
770
+ export { Algorithm, Analytics, AnalyticsConfig, Duration, ipDenyList as IpDenyList, MultiRegionRatelimit, MultiRegionRatelimitConfig, RegionRatelimit as Ratelimit, RegionRatelimitConfig as RatelimitConfig };
package/dist/index.d.ts CHANGED
@@ -20,12 +20,6 @@ interface EphemeralCache {
20
20
  type RegionContext = {
21
21
  redis: Redis;
22
22
  cache?: EphemeralCache;
23
- scriptHashes: {
24
- limitHash?: string;
25
- getRemainingHash?: string;
26
- resetHash?: string;
27
- };
28
- cacheScripts: boolean;
29
23
  };
30
24
  type MultiRegionContext = {
31
25
  regionContexts: Omit<RegionContext[], "cache">;
@@ -570,8 +564,12 @@ type RegionRatelimitConfig = {
570
564
  */
571
565
  analytics?: boolean;
572
566
  /**
573
- * If enabled, lua scripts will be sent to Redis with SCRIPT LOAD durint the first request.
574
- * In the subsequent requests, hash of the script will be used to invoke it
567
+ * @deprecated Has no affect since v2.0.3. Instead, hash values of scripts are
568
+ * hardcoded in the sdk and it attempts to run the script using EVALSHA (with the hash).
569
+ * If it fails, runs script load.
570
+ *
571
+ * Previously, if enabled, lua scripts were sent to Redis with SCRIPT LOAD durint the first request.
572
+ * In the subsequent requests, hash of the script would be used to invoke the scripts
575
573
  *
576
574
  * @default true
577
575
  */
@@ -769,4 +767,4 @@ declare namespace ipDenyList {
769
767
  };
770
768
  }
771
769
 
772
- export { Algorithm, Analytics, AnalyticsConfig, ipDenyList as IpDenyList, MultiRegionRatelimit, MultiRegionRatelimitConfig, RegionRatelimit as Ratelimit, RegionRatelimitConfig as RatelimitConfig };
770
+ export { Algorithm, Analytics, AnalyticsConfig, Duration, ipDenyList as IpDenyList, MultiRegionRatelimit, MultiRegionRatelimitConfig, RegionRatelimit as Ratelimit, RegionRatelimitConfig as RatelimitConfig };