@chainfuse/helpers 3.4.1 → 3.4.2

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.
Files changed (2) hide show
  1. package/dist/db.mjs +7 -2
  2. package/package.json +4 -4
package/dist/db.mjs CHANGED
@@ -85,7 +85,10 @@ export class SQLCache extends DrizzleCache {
85
85
  * @returns A `Request` object representing the cache key, constructed with a URL based on the tag or key and the database configuration.
86
86
  */
87
87
  getCacheKey(tagOrKey, init) {
88
- return new Request(new URL(('tag' in tagOrKey ? ['tag', tagOrKey.tag] : ['key', tagOrKey.key]).join('/'), `https://${this.dbName}.${this.dbType}`), init);
88
+ const headers = new Headers(init?.headers);
89
+ if (!headers.get('Date'))
90
+ headers.set('Date', new Date().toUTCString());
91
+ return new Request(new URL(('tag' in tagOrKey ? ['tag', tagOrKey.tag] : ['key', tagOrKey.key]).join('/'), `https://${this.dbName}.${this.dbType}`), { ...init, headers });
89
92
  }
90
93
  /**
91
94
  * This function accepts query and parameters that cached into key param, allowing you to retrieve response values for this query from the cache.
@@ -113,7 +116,9 @@ export class SQLCache extends DrizzleCache {
113
116
  }
114
117
  }
115
118
  else {
116
- console.error('SQLCache.get', 'response does not have a Date header, cannot check against ttlCutoff date');
119
+ console.debug('SQLCache.get', 'cache purged', { responseDate });
120
+ await this.cache.then((cache) => cache.delete(cacheKey));
121
+ return undefined;
117
122
  }
118
123
  }
119
124
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/helpers",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/helpers#readme",
@@ -76,18 +76,18 @@
76
76
  },
77
77
  "prettier": "@demosjarco/prettier-config",
78
78
  "dependencies": {
79
- "@chainfuse/types": "^2.10.22",
79
+ "@chainfuse/types": "^2.10.23",
80
80
  "@discordjs/rest": "^2.5.0",
81
81
  "chalk": "^5.4.1",
82
82
  "cloudflare": "^4.3.0",
83
83
  "drizzle-orm": "^0.44.2",
84
84
  "strip-ansi": "^7.1.0",
85
85
  "uuid": "^11.1.0",
86
- "zod": "^3.25.57"
86
+ "zod": "^3.25.61"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@cloudflare/workers-types": "^4.20250610.0",
90
90
  "@types/node": "^22.15.31"
91
91
  },
92
- "gitHead": "a36878f122942e7c2495a6b11a240fa7089bed4b"
92
+ "gitHead": "7574d27072dcf52a7769fecce0b6551a007234c0"
93
93
  }