layercache 3.1.0 → 3.1.1

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
@@ -19,7 +19,7 @@
19
19
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-green" alt="license"></a>
20
20
  <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-first-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a>
21
21
  <img src="https://img.shields.io/badge/Node.js-%E2%89%A5_20-339933?logo=nodedotjs&logoColor=white" alt="Node.js >= 20">
22
- <img src="https://img.shields.io/badge/tests-598_passing-brightgreen" alt="tests">
22
+ <img src="https://img.shields.io/badge/tests-601_passing-brightgreen" alt="tests">
23
23
  <a href="https://coveralls.io/github/flyingsquirrel0419/layercache?branch=main"><img src="https://coveralls.io/repos/github/flyingsquirrel0419/layercache/badge.svg?branch=main&t=20260517" alt="Coveralls"></a>
24
24
  </p>
25
25
 
package/dist/index.cjs CHANGED
@@ -2275,8 +2275,13 @@ var FetchRateLimiter = class {
2275
2275
  queue.push({
2276
2276
  bucketKey,
2277
2277
  options: normalized,
2278
- task,
2279
- resolve: resolve2,
2278
+ run: async () => {
2279
+ try {
2280
+ resolve2(await task());
2281
+ } catch (error) {
2282
+ reject(error);
2283
+ }
2284
+ },
2280
2285
  reject
2281
2286
  });
2282
2287
  this.queuesByBucket.set(bucketKey, queue);
@@ -2401,7 +2406,7 @@ var FetchRateLimiter = class {
2401
2406
  if (next.options.intervalMs && next.options.maxPerInterval) {
2402
2407
  bucket.startedAt.push(Date.now());
2403
2408
  }
2404
- void next.task().then(next.resolve, next.reject).finally(() => {
2409
+ void next.run().finally(() => {
2405
2410
  bucket.active -= 1;
2406
2411
  if ((this.queuesByBucket.get(next.bucketKey)?.length ?? 0) > 0) {
2407
2412
  this.pendingBuckets.add(next.bucketKey);
package/dist/index.js CHANGED
@@ -1885,8 +1885,13 @@ var FetchRateLimiter = class {
1885
1885
  queue.push({
1886
1886
  bucketKey,
1887
1887
  options: normalized,
1888
- task,
1889
- resolve: resolve2,
1888
+ run: async () => {
1889
+ try {
1890
+ resolve2(await task());
1891
+ } catch (error) {
1892
+ reject(error);
1893
+ }
1894
+ },
1890
1895
  reject
1891
1896
  });
1892
1897
  this.queuesByBucket.set(bucketKey, queue);
@@ -2011,7 +2016,7 @@ var FetchRateLimiter = class {
2011
2016
  if (next.options.intervalMs && next.options.maxPerInterval) {
2012
2017
  bucket.startedAt.push(Date.now());
2013
2018
  }
2014
- void next.task().then(next.resolve, next.reject).finally(() => {
2019
+ void next.run().finally(() => {
2015
2020
  bucket.active -= 1;
2016
2021
  if ((this.queuesByBucket.get(next.bucketKey)?.length ?? 0) > 0) {
2017
2022
  this.pendingBuckets.add(next.bucketKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layercache",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Production-ready multi-layer caching for Node.js. Stack memory + Redis + disk behind one API with stampede prevention, tag invalidation, stale serving, and full observability.",
5
5
  "keywords": [
6
6
  "cache",
@@ -97,8 +97,11 @@
97
97
  "ioredis": "^5.6.1",
98
98
  "ioredis-mock": "^8.13.0",
99
99
  "tsup": "^8.5.0",
100
- "tsx": "^4.19.3",
100
+ "tsx": "^4.22.4",
101
101
  "typescript": "^5.8.3",
102
102
  "vitest": "^4.1.2"
103
+ },
104
+ "overrides": {
105
+ "esbuild": "0.28.1"
103
106
  }
104
107
  }