@nxtedition/nxt-undici 6.2.25 → 6.2.26

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.
@@ -2,7 +2,7 @@ import { DatabaseSync } from 'node:sqlite'
2
2
  import assert from 'node:assert'
3
3
  import { parseRangeHeader, getFastNow } from './utils.js'
4
4
 
5
- const VERSION = 6
5
+ const VERSION = 7
6
6
 
7
7
  /**
8
8
  * @typedef {import('undici-types/cache-interceptor.d.ts').default.CacheStore} CacheStore
@@ -50,11 +50,6 @@ export class SqliteCacheStore {
50
50
  */
51
51
  #deleteExpiredValuesTime = getFastNow()
52
52
 
53
- /**
54
- * @type {import('node:sqlite').StatementSync}
55
- */
56
- #deleteByUrlQuery
57
-
58
53
  /**
59
54
  * @param {import('undici-types/cache-interceptor.d.ts').default.SqliteCacheStoreOpts & { maxEntryCount?: number} | undefined} opts
60
55
  */
@@ -80,10 +75,8 @@ export class SqliteCacheStore {
80
75
  staleAt INTEGER NOT NULL
81
76
  );
82
77
 
83
- CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_url ON cacheInterceptorV${VERSION}(url);
84
- CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_method ON cacheInterceptorV${VERSION}(method);
85
- CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteAt ON cacheInterceptorV${VERSION}(deleteAt);
86
- CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_start ON cacheInterceptorV${VERSION}(start);
78
+ CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_getValuesQuery ON cacheInterceptorV${VERSION}(url, method, start, deleteAt);
79
+ CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteExpiredValuesQuery ON cacheInterceptorV${VERSION}(deleteAt);
87
80
  `)
88
81
 
89
82
  this.#getValuesQuery = this.#db.prepare(`
@@ -127,10 +120,6 @@ export class SqliteCacheStore {
127
120
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
128
121
  `)
129
122
 
130
- this.#deleteByUrlQuery = this.#db.prepare(
131
- `DELETE FROM cacheInterceptorV${VERSION} WHERE url = ?`,
132
- )
133
-
134
123
  this.#deleteExpiredValuesQuery = this.#db.prepare(
135
124
  `DELETE FROM cacheInterceptorV${VERSION} WHERE deleteAt <= ?`,
136
125
  )
@@ -188,17 +177,6 @@ export class SqliteCacheStore {
188
177
  )
189
178
  }
190
179
 
191
- /**
192
- * @param {import('undici-types/cache-interceptor.d.ts').default.CacheKey} key
193
- */
194
- delete(key) {
195
- if (typeof key !== 'object') {
196
- throw new TypeError(`expected key to be object, got ${typeof key}`)
197
- }
198
-
199
- this.#deleteByUrlQuery.run(makeValueUrl(key))
200
- }
201
-
202
180
  /**
203
181
  * @param {import('undici-types/cache-interceptor.d.ts').default.CacheKey} key
204
182
  * @param {boolean} [canBeExpired=false]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.2.25",
3
+ "version": "6.2.26",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",