@c9up/echo 0.2.3 → 0.2.4

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 (108) hide show
  1. package/dist/CacheManager.d.ts +2 -0
  2. package/dist/CacheManager.d.ts.map +1 -1
  3. package/dist/CacheManager.js +92 -32
  4. package/dist/CacheManager.js.map +1 -1
  5. package/dist/EchoProvider.d.ts.map +1 -1
  6. package/dist/EchoProvider.js +32 -3
  7. package/dist/EchoProvider.js.map +1 -1
  8. package/dist/StoreManager.d.ts +28 -9
  9. package/dist/StoreManager.d.ts.map +1 -1
  10. package/dist/StoreManager.js +42 -18
  11. package/dist/StoreManager.js.map +1 -1
  12. package/dist/bytes.d.ts +13 -0
  13. package/dist/bytes.d.ts.map +1 -0
  14. package/dist/bytes.js +35 -0
  15. package/dist/bytes.js.map +1 -0
  16. package/dist/claim.d.ts +15 -0
  17. package/dist/claim.d.ts.map +1 -0
  18. package/dist/claim.js +10 -0
  19. package/dist/claim.js.map +1 -0
  20. package/dist/configure.d.ts +1 -0
  21. package/dist/configure.d.ts.map +1 -1
  22. package/dist/configure.js +3 -0
  23. package/dist/configure.js.map +1 -1
  24. package/dist/console/cacheClear.d.ts +13 -0
  25. package/dist/console/cacheClear.d.ts.map +1 -0
  26. package/dist/console/cacheClear.js +69 -0
  27. package/dist/console/cacheClear.js.map +1 -0
  28. package/dist/console/cacheDelete.d.ts +11 -0
  29. package/dist/console/cacheDelete.d.ts.map +1 -0
  30. package/dist/console/cacheDelete.js +42 -0
  31. package/dist/console/cacheDelete.js.map +1 -0
  32. package/dist/console/cachePrune.d.ts +9 -0
  33. package/dist/console/cachePrune.d.ts.map +1 -0
  34. package/dist/console/cachePrune.js +35 -0
  35. package/dist/console/cachePrune.js.map +1 -0
  36. package/dist/console/contract.d.ts +64 -0
  37. package/dist/console/contract.d.ts.map +1 -0
  38. package/dist/console/contract.js +32 -0
  39. package/dist/console/contract.js.map +1 -0
  40. package/dist/console/index.d.ts +25 -0
  41. package/dist/console/index.d.ts.map +1 -0
  42. package/dist/console/index.js +38 -0
  43. package/dist/console/index.js.map +1 -0
  44. package/dist/console/store.d.ts +14 -0
  45. package/dist/console/store.d.ts.map +1 -0
  46. package/dist/console/store.js +35 -0
  47. package/dist/console/store.js.map +1 -0
  48. package/dist/drivers/MemoryDriver.d.ts +36 -1
  49. package/dist/drivers/MemoryDriver.d.ts.map +1 -1
  50. package/dist/drivers/MemoryDriver.js +157 -62
  51. package/dist/drivers/MemoryDriver.js.map +1 -1
  52. package/dist/drivers/RedisDriver.d.ts +13 -8
  53. package/dist/drivers/RedisDriver.d.ts.map +1 -1
  54. package/dist/drivers/RedisDriver.js +171 -94
  55. package/dist/drivers/RedisDriver.js.map +1 -1
  56. package/dist/drivers/TieredDriver.d.ts +42 -0
  57. package/dist/drivers/TieredDriver.d.ts.map +1 -1
  58. package/dist/drivers/TieredDriver.js +114 -9
  59. package/dist/drivers/TieredDriver.js.map +1 -1
  60. package/dist/duration.d.ts +13 -3
  61. package/dist/duration.d.ts.map +1 -1
  62. package/dist/duration.js +22 -7
  63. package/dist/duration.js.map +1 -1
  64. package/dist/errors.d.ts +60 -2
  65. package/dist/errors.d.ts.map +1 -1
  66. package/dist/errors.js +81 -6
  67. package/dist/errors.js.map +1 -1
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +3 -3
  71. package/dist/index.js.map +1 -1
  72. package/dist/quasar.d.ts +1 -1
  73. package/dist/quasar.d.ts.map +1 -1
  74. package/dist/quasar.js +27 -6
  75. package/dist/quasar.js.map +1 -1
  76. package/dist/services/main.d.ts +1 -1
  77. package/dist/services/main.d.ts.map +1 -1
  78. package/dist/services/main.js +22 -5
  79. package/dist/services/main.js.map +1 -1
  80. package/dist/types.d.ts +12 -1
  81. package/dist/types.d.ts.map +1 -1
  82. package/dist/vendor/quasarConnection.d.ts +26 -3
  83. package/dist/vendor/quasarConnection.d.ts.map +1 -1
  84. package/dist/vendor/quasarConnection.js +44 -23
  85. package/dist/vendor/quasarConnection.js.map +1 -1
  86. package/package.json +5 -1
  87. package/src/CacheManager.ts +117 -41
  88. package/src/EchoProvider.ts +45 -4
  89. package/src/StoreManager.ts +86 -31
  90. package/src/bytes.ts +38 -0
  91. package/src/claim.ts +22 -0
  92. package/src/configure.ts +4 -0
  93. package/src/console/cacheClear.ts +96 -0
  94. package/src/console/cacheDelete.ts +65 -0
  95. package/src/console/cachePrune.ts +57 -0
  96. package/src/console/contract.ts +93 -0
  97. package/src/console/index.ts +61 -0
  98. package/src/console/store.ts +47 -0
  99. package/src/drivers/MemoryDriver.ts +205 -60
  100. package/src/drivers/RedisDriver.ts +205 -101
  101. package/src/drivers/TieredDriver.ts +169 -9
  102. package/src/duration.ts +28 -7
  103. package/src/errors.ts +103 -6
  104. package/src/index.ts +17 -3
  105. package/src/quasar.ts +44 -8
  106. package/src/services/main.ts +26 -8
  107. package/src/types.ts +13 -2
  108. package/src/vendor/quasarConnection.ts +84 -22
@@ -7,6 +7,31 @@
7
7
  * invalidations so peer instances drop their (now stale) L1 copies — the L2 is
8
8
  * shared, so only L1 needs cross-instance invalidation.
9
9
  */
10
+ import { resolveTtlSeconds } from "../duration.js";
11
+ import { EchoError, L2CacheError } from "../errors.js";
12
+ /**
13
+ * Whether a received frame is an invalidation message, field by field.
14
+ *
15
+ * A bus hands over whatever arrived on the channel. Trusted as is, a string
16
+ * `keys` was iterated character by character, any unknown `type` read as a
17
+ * delete, and a missing `keys` threw inside the handler.
18
+ */
19
+ export function isBusMessage(value) {
20
+ if (typeof value !== "object" || value === null)
21
+ return false;
22
+ const type = Reflect.get(value, "type");
23
+ const keys = Reflect.get(value, "keys");
24
+ const optional = (name) => {
25
+ const field = Reflect.get(value, name);
26
+ return field === undefined || typeof field === "string";
27
+ };
28
+ return ((type === "delete" || type === "clear") &&
29
+ Array.isArray(keys) &&
30
+ keys.every((key) => typeof key === "string") &&
31
+ optional("prefix") &&
32
+ optional("senderId") &&
33
+ optional("store"));
34
+ }
10
35
  function isTaggable(driver) {
11
36
  const candidate = driver;
12
37
  return (typeof candidate.setWithTags === "function" &&
@@ -57,15 +82,34 @@ export class TieredDriver {
57
82
  #busHandler;
58
83
  /** This tier, as a bus sender. */
59
84
  #id = crypto.randomUUID();
85
+ #store;
86
+ #suppressL2Errors;
87
+ /** How long the breaker stays open after an L2 failure; `0` for no breaker. */
88
+ #breakerMs;
89
+ /** Until when (epoch ms) the L2 is skipped. */
90
+ #breakerUntil = 0;
91
+ /** Whether the last L2 call failed — so an outage is reported once, not per call. */
92
+ #l2Failing = false;
60
93
  constructor(options) {
61
94
  this.#l1 = options.l1;
62
95
  this.#l2 = options.l2;
63
96
  this.#bus = options.bus;
97
+ this.#suppressL2Errors = options.suppressL2Errors ?? true;
98
+ this.#breakerMs =
99
+ Math.max(0, resolveTtlSeconds(options.l2CircuitBreakerDuration, 0)) *
100
+ 1000;
101
+ this.#store = options.store;
64
102
  this.#onPeerMessage = (message) => {
103
+ // Checked here and not only in the transport: a custom bus hands
104
+ // over whatever it received.
105
+ if (!isBusMessage(message))
106
+ return;
65
107
  // Our own invalidation, come back round the bus. Acting on it would
66
108
  // undo the write that sent it.
67
109
  if (message.senderId === this.#id)
68
110
  return;
111
+ if (this.#store !== undefined && message.store !== this.#store)
112
+ return;
69
113
  // Peer invalidation: only the local L1 needs clearing (L2 is shared).
70
114
  if (message.type === "clear") {
71
115
  this.#invalidate("flush", () => this.#l1.flush(message.prefix));
@@ -130,11 +174,58 @@ export class TieredDriver {
130
174
  process.stderr.write(`[echo] tiered L1 invalidation of '${what}' failed; the local copy may be stale until it expires: ${error instanceof Error ? error.message : String(error)}\n`);
131
175
  });
132
176
  }
177
+ /**
178
+ * Run a read or write against L2, the way upstream's remote cache does:
179
+ * skipped while the breaker is open, and on failure either answered by
180
+ * `fallback` (suppressed) or raised as an {@link L2CacheError}.
181
+ */
182
+ async #onL2(operation, run, fallback) {
183
+ if (Date.now() < this.#breakerUntil)
184
+ return { ok: false, value: fallback };
185
+ try {
186
+ const value = await run();
187
+ this.#l2Failing = false;
188
+ return { ok: true, value };
189
+ }
190
+ catch (error) {
191
+ this.#l2Failed(operation, error);
192
+ if (this.#suppressL2Errors)
193
+ return { ok: false, value: fallback };
194
+ throw new L2CacheError(operation, error);
195
+ }
196
+ }
197
+ /** Open the breaker, and report the outage when it starts. */
198
+ #l2Failed(operation, error) {
199
+ if (this.#breakerMs > 0)
200
+ this.#breakerUntil = Date.now() + this.#breakerMs;
201
+ if (this.#l2Failing)
202
+ return;
203
+ this.#l2Failing = true;
204
+ process.stderr.write(`[echo] tiered L2 ${operation} failed; serving from L1 until it answers again: ${error instanceof Error ? error.message : String(error)}\n`);
205
+ }
206
+ /**
207
+ * Run an invalidation against L2. Never suppressed and never skipped by
208
+ * the breaker: a removal that did not reach the shared tier leaves the
209
+ * value there for every other instance. NAMED DEVIATION — upstream
210
+ * suppresses these too; reporting them is the safer side.
211
+ */
212
+ async #invalidateL2(operation, run) {
213
+ try {
214
+ const value = await run();
215
+ this.#l2Failing = false;
216
+ return { ok: true, value };
217
+ }
218
+ catch (error) {
219
+ this.#l2Failed(operation, error);
220
+ return { ok: false, error: new L2CacheError(operation, error) };
221
+ }
222
+ }
133
223
  async getEntry(key) {
134
224
  const l1 = await readEntry(this.#l1, key);
135
225
  if (l1 && !l1.stale)
136
226
  return l1;
137
- const l2 = await readEntry(this.#l2, key);
227
+ // A failed L2 read is a miss: the stale L1 copy, if any, still serves.
228
+ const { value: l2 } = await this.#onL2("read", () => readEntry(this.#l2, key), null);
138
229
  if (l2 && !l2.stale) {
139
230
  // Promote a fresh L2 hit into L1 — preserving the remaining logical TTL
140
231
  // so L1 cannot outlive L2 (a promotion with no TTL left an immortal L1
@@ -144,7 +235,10 @@ export class TieredDriver {
144
235
  // immortal L1 copy; skip promotion rather than cache it forever.
145
236
  return l2;
146
237
  }
147
- const opts = {};
238
+ // With its tags: a copy promoted without them was invisible to
239
+ // deleteByTag on this very instance, which skips its own bus
240
+ // message — so a revoked entry kept being served from here.
241
+ const opts = l2.tags ? { tags: l2.tags } : {};
148
242
  if (l2.expiresAt > 0) {
149
243
  const remainingSeconds = (l2.expiresAt - Date.now()) / 1000;
150
244
  // Raced past expiry between the stale check and now — don't promote
@@ -174,16 +268,20 @@ export class TieredDriver {
174
268
  }
175
269
  async setEntry(key, value, options) {
176
270
  const l1 = await settle(() => writeEntry(this.#l1, key, value, options));
177
- const l2 = await settle(() => writeEntry(this.#l2, key, value, options));
271
+ const l2 = await settle(() => this.#onL2("write", async () => {
272
+ await writeEntry(this.#l2, key, value, options);
273
+ return true;
274
+ }, false));
178
275
  // Peers are told only when the shared write landed. Telling them to drop
179
276
  // their L1 for a value that never reached L2 sends every one of them to a
180
277
  // tier that does not have it. Upstream gates the same publish on the same
181
278
  // thing (`if (this.l2 && l2Success || !this.l2)`).
182
- if (l2.ok) {
279
+ if (l2.ok && l2.value.ok) {
183
280
  await this.#bus?.publish({
184
281
  type: "delete",
185
282
  keys: [key],
186
283
  senderId: this.#id,
284
+ store: this.#store,
187
285
  });
188
286
  }
189
287
  if (!l1.ok)
@@ -193,12 +291,13 @@ export class TieredDriver {
193
291
  }
194
292
  async delete(key) {
195
293
  const l1 = await settle(() => this.#l1.delete(key));
196
- const l2 = await settle(() => this.#l2.delete(key));
294
+ const l2 = await this.#invalidateL2("delete", () => this.#l2.delete(key));
197
295
  if (l2.ok) {
198
296
  await this.#bus?.publish({
199
297
  type: "delete",
200
298
  keys: [key],
201
299
  senderId: this.#id,
300
+ store: this.#store,
202
301
  });
203
302
  }
204
303
  if (!l1.ok)
@@ -209,7 +308,7 @@ export class TieredDriver {
209
308
  }
210
309
  async flush(prefix) {
211
310
  const l1 = await settle(() => this.#l1.flush(prefix));
212
- const l2 = await settle(() => this.#l2.flush(prefix));
311
+ const l2 = await this.#invalidateL2("flush", () => this.#l2.flush(prefix));
213
312
  if (l2.ok) {
214
313
  // The prefix travels: a peer that flushed its WHOLE L1 on a
215
314
  // namespaced clear would throw away every other tenant's entries
@@ -219,6 +318,7 @@ export class TieredDriver {
219
318
  keys: [],
220
319
  prefix,
221
320
  senderId: this.#id,
321
+ store: this.#store,
222
322
  });
223
323
  }
224
324
  if (!l1.ok)
@@ -236,14 +336,19 @@ export class TieredDriver {
236
336
  const l1 = this.#l1;
237
337
  const l2 = this.#l2;
238
338
  if (!isTaggable(l1) || !isTaggable(l2)) {
239
- throw new Error("Echo: TieredDriver.deleteByTag requires both tiers to be taggable");
339
+ throw new EchoError("E_ECHO_NOT_TAGGABLE", "Echo: TieredDriver.deleteByTag requires both tiers to be taggable");
240
340
  }
241
341
  const local = await settle(() => l1.deleteByTag(tags));
242
- const shared = await settle(() => l2.deleteByTag(tags));
342
+ const shared = await this.#invalidateL2("deleteByTag", () => l2.deleteByTag(tags));
243
343
  // Peers can't map tags → keys locally; broadcast a clear so their L1 drops
244
344
  // any tagged copies (conservative but correct).
245
345
  if (shared.ok) {
246
- await this.#bus?.publish({ type: "clear", keys: [], senderId: this.#id });
346
+ await this.#bus?.publish({
347
+ type: "clear",
348
+ keys: [],
349
+ senderId: this.#id,
350
+ store: this.#store,
351
+ });
247
352
  }
248
353
  if (!local.ok)
249
354
  throw local.error;
@@ -1 +1 @@
1
- {"version":3,"file":"TieredDriver.js","sourceRoot":"","sources":["../../src/drivers/TieredDriver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6EH,SAAS,UAAU,CAAC,MAAmB;IACtC,MAAM,SAAS,GAA4B,MAAM,CAAC;IAClD,OAAO,CACN,OAAO,SAAS,CAAC,WAAW,KAAK,UAAU;QAC3C,CAAC,OAAO,SAAS,CAAC,WAAW,KAAK,UAAU;YAC3C,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU,CAAC,CAC3C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CACvB,MAAmB,EACnB,GAAW;IAEX,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,MAAM,CAAC,QAA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AC,CAAC;QAC7D,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,EAAE,CAAC,EAAE;YAAE,MAAM,EAAE,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,EAAE,CAAC,EAAE;YAAE,MAAM,EAAE,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,GAAG,CAAC,KAAK,CAAC;IAC9B,CAAC;CACD"}
@@ -24,9 +24,19 @@ export declare function parseDuration(value: string): number;
24
24
  /**
25
25
  * Resolve a {@link Duration} to a TTL in **seconds**.
26
26
  *
27
- * @returns the TTL in seconds; `0` means "never expires" (either an explicit
28
- * `null`, or a non-positive value, matching echo's driver convention where
29
- * `ttlSeconds <= 0` is treated as immortal).
27
+ * @returns the TTL in seconds. `0` means "never expires" — an explicit
28
+ * `null`, a `0` or `Infinity`. A NEGATIVE result is kept negative: a TTL in
29
+ * the past means already expired, and the writers drop the entry rather
30
+ * than store it. It used to map to `0`, so a TTL computed from data — a
31
+ * token that had already expired — cached its value forever.
32
+ * @throws {InvalidDurationError} for NaN, which means nothing at all.
30
33
  */
31
34
  export declare function resolveTtlSeconds(ttl: Duration | undefined, defaultSeconds: number): number;
35
+ /**
36
+ * The driver-level reading of a TTL in seconds: `undefined`, `0` and
37
+ * `Infinity` never expire, a negative one has already expired, NaN is
38
+ * refused. Shared by the manager and the drivers, so a driver called directly
39
+ * cannot turn a NaN into an entry that never expires either.
40
+ */
41
+ export declare function checkTtlSeconds(seconds: number): number;
32
42
  //# sourceMappingURL=duration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAiC9C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAanD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,QAAQ,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACpB,MAAM,CAKR"}
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAmC9C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAenD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,QAAQ,GAAG,SAAS,EACzB,cAAc,EAAE,MAAM,GACpB,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOvD"}
package/dist/duration.js CHANGED
@@ -37,6 +37,7 @@ const UNIT_SECONDS = {
37
37
  week: 604_800,
38
38
  weeks: 604_800,
39
39
  };
40
+ import { InvalidDurationError } from "./errors.js";
40
41
  const DURATION_RE = /^\s*(-?\d+(?:\.\d+)?)\s*([a-z]+)?\s*$/i;
41
42
  /**
42
43
  * Parse a human duration string (`'5m'`, `'300s'`, `'500ms'`) into seconds.
@@ -45,7 +46,7 @@ const DURATION_RE = /^\s*(-?\d+(?:\.\d+)?)\s*([a-z]+)?\s*$/i;
45
46
  export function parseDuration(value) {
46
47
  const match = DURATION_RE.exec(value);
47
48
  if (!match) {
48
- throw new TypeError(`Echo: invalid duration string "${value}"`);
49
+ throw new InvalidDurationError(`Echo: invalid duration string "${value}"`);
49
50
  }
50
51
  const amount = Number(match[1]);
51
52
  const unit = match[2]?.toLowerCase();
@@ -53,23 +54,37 @@ export function parseDuration(value) {
53
54
  return amount;
54
55
  const factor = UNIT_SECONDS[unit];
55
56
  if (factor === undefined) {
56
- throw new TypeError(`Echo: unknown duration unit "${unit}" in "${value}"`);
57
+ throw new InvalidDurationError(`Echo: unknown duration unit "${unit}" in "${value}"`);
57
58
  }
58
59
  return amount * factor;
59
60
  }
60
61
  /**
61
62
  * Resolve a {@link Duration} to a TTL in **seconds**.
62
63
  *
63
- * @returns the TTL in seconds; `0` means "never expires" (either an explicit
64
- * `null`, or a non-positive value, matching echo's driver convention where
65
- * `ttlSeconds <= 0` is treated as immortal).
64
+ * @returns the TTL in seconds. `0` means "never expires" — an explicit
65
+ * `null`, a `0` or `Infinity`. A NEGATIVE result is kept negative: a TTL in
66
+ * the past means already expired, and the writers drop the entry rather
67
+ * than store it. It used to map to `0`, so a TTL computed from data — a
68
+ * token that had already expired — cached its value forever.
69
+ * @throws {InvalidDurationError} for NaN, which means nothing at all.
66
70
  */
67
71
  export function resolveTtlSeconds(ttl, defaultSeconds) {
68
72
  if (ttl === null)
69
73
  return 0;
70
74
  if (ttl === undefined)
71
75
  return defaultSeconds;
72
- const seconds = typeof ttl === "number" ? ttl : parseDuration(ttl);
73
- return seconds > 0 ? seconds : 0;
76
+ return checkTtlSeconds(typeof ttl === "number" ? ttl : parseDuration(ttl));
77
+ }
78
+ /**
79
+ * The driver-level reading of a TTL in seconds: `undefined`, `0` and
80
+ * `Infinity` never expire, a negative one has already expired, NaN is
81
+ * refused. Shared by the manager and the drivers, so a driver called directly
82
+ * cannot turn a NaN into an entry that never expires either.
83
+ */
84
+ export function checkTtlSeconds(seconds) {
85
+ if (Number.isNaN(seconds)) {
86
+ throw new InvalidDurationError("Echo: a TTL of NaN is not a duration — pass a number of seconds, a string like '5m', or null for no expiry");
87
+ }
88
+ return seconds === Number.POSITIVE_INFINITY ? 0 : seconds;
74
89
  }
75
90
  //# sourceMappingURL=duration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"duration.js","sourceRoot":"","sources":["../src/duration.ts"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AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,oBAAoB,CAC7B,4GAA4G,CAC5G,CAAC;IACH,CAAC;IACD,OAAO,OAAO,KAAK,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -1,15 +1,52 @@
1
1
  /**
2
2
  * Echo cache errors — bentocache parity (`errors.ts`).
3
+ *
4
+ * Every error carries a `code`. Upstream's are kept verbatim
5
+ * (`E_FACTORY_ERROR`, `E_FACTORY_HARD_TIMEOUT`, `E_UNDEFINED_VALUE`,
6
+ * `E_L2_CACHE_ERROR`): code written against a cache module already catches on
7
+ * them. Failures echo invents carry the `E_ECHO_` namespace.
3
8
  */
9
+ /**
10
+ * Base class for the errors echo raises with a code of its own, so a caller
11
+ * can match on `error.code`.
12
+ */
13
+ export declare class EchoError extends Error {
14
+ readonly code: string;
15
+ constructor(code: string, message: string, options?: ErrorOptions);
16
+ }
17
+ /**
18
+ * Raised for a duration that cannot mean anything: NaN, or a string the
19
+ * parser does not read. A `TypeError`, as the parser's refusals always were.
20
+ */
21
+ export declare class InvalidDurationError extends TypeError {
22
+ readonly code = "E_ECHO_INVALID_DURATION";
23
+ constructor(message: string);
24
+ }
25
+ /**
26
+ * Raised when a caller waited `lockTimeout` on another caller's factory for
27
+ * the same key, had no stale value to fall back on, and gave up.
28
+ */
29
+ export declare class LockTimeoutError extends EchoError {
30
+ /** The cache key whose lock was not obtained. */
31
+ readonly key: string;
32
+ constructor(key: string, timeoutMs: number);
33
+ }
34
+ /**
35
+ * Raised when a tiered store's L2 fails and the failure is not suppressed
36
+ * (upstream `E_L2_CACHE_ERROR`, kept verbatim). `cause` is the L2's error.
37
+ */
38
+ export declare class L2CacheError extends EchoError {
39
+ constructor(operation: string, cause: unknown);
40
+ }
4
41
  /** Raised when a factory exceeds its configured `hardTimeout`. */
5
- export declare class TimeoutError extends Error {
42
+ export declare class TimeoutError extends EchoError {
6
43
  constructor(key: string, timeoutMs: number);
7
44
  }
8
45
  /**
9
46
  * Wraps an error thrown by a `getOrSet` factory. Passed to `onFactoryError`
10
47
  * so callers can observe both foreground and background factory failures.
11
48
  */
12
- export declare class FactoryError extends Error {
49
+ export declare class FactoryError extends EchoError {
13
50
  /** The cache key the factory was computing. */
14
51
  readonly key: string;
15
52
  /** The original error thrown by the factory. */
@@ -18,4 +55,25 @@ export declare class FactoryError extends Error {
18
55
  readonly isBackground: boolean;
19
56
  constructor(key: string, cause: unknown, isBackground: boolean);
20
57
  }
58
+ /**
59
+ * Raised for a `null` or `undefined` value — upstream's `E_UNDEFINED_VALUE`.
60
+ * A `TypeError`, as this refusal always was. Echo refuses `null` as well: a
61
+ * null cache write is almost always a bug.
62
+ */
63
+ export declare class UndefinedValueError extends TypeError {
64
+ readonly code = "E_UNDEFINED_VALUE";
65
+ constructor();
66
+ }
67
+ /** Raised for an argument a method cannot work with. A `TypeError`. */
68
+ export declare class InvalidArgumentError extends TypeError {
69
+ readonly code = "E_ECHO_INVALID_ARGUMENT";
70
+ constructor(message: string);
71
+ }
72
+ /** Upstream's `errors` map, by code. */
73
+ export declare const errors: {
74
+ E_FACTORY_ERROR: typeof FactoryError;
75
+ E_FACTORY_HARD_TIMEOUT: typeof TimeoutError;
76
+ E_UNDEFINED_VALUE: typeof UndefinedValueError;
77
+ E_L2_CACHE_ERROR: typeof L2CacheError;
78
+ };
21
79
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kEAAkE;AAClE,qBAAa,YAAa,SAAQ,KAAK;gBAC1B,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAI1C;AAED;;;GAGG;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OAAO,CAAC;gBAEnB,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO;CAO9D;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IACjD,QAAQ,CAAC,IAAI,uBAAuB;;CAMpC;AAED,uEAAuE;AACvE,qBAAa,oBAAqB,SAAQ,SAAS;IAClD,QAAQ,CAAC,IAAI,6BAA6B;gBAE9B,OAAO,EAAE,MAAM;CAI3B;AAED,wCAAwC;AACxC,eAAO,MAAM,MAAM;;;;;CAKlB,CAAC"}
package/dist/errors.js CHANGED
@@ -1,18 +1,67 @@
1
1
  /**
2
2
  * Echo cache errors — bentocache parity (`errors.ts`).
3
+ *
4
+ * Every error carries a `code`. Upstream's are kept verbatim
5
+ * (`E_FACTORY_ERROR`, `E_FACTORY_HARD_TIMEOUT`, `E_UNDEFINED_VALUE`,
6
+ * `E_L2_CACHE_ERROR`): code written against a cache module already catches on
7
+ * them. Failures echo invents carry the `E_ECHO_` namespace.
3
8
  */
9
+ /**
10
+ * Base class for the errors echo raises with a code of its own, so a caller
11
+ * can match on `error.code`.
12
+ */
13
+ export class EchoError extends Error {
14
+ code;
15
+ constructor(code, message, options) {
16
+ super(message, options);
17
+ this.name = new.target.name;
18
+ this.code = code;
19
+ }
20
+ }
21
+ /**
22
+ * Raised for a duration that cannot mean anything: NaN, or a string the
23
+ * parser does not read. A `TypeError`, as the parser's refusals always were.
24
+ */
25
+ export class InvalidDurationError extends TypeError {
26
+ code = "E_ECHO_INVALID_DURATION";
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = "InvalidDurationError";
30
+ }
31
+ }
32
+ /**
33
+ * Raised when a caller waited `lockTimeout` on another caller's factory for
34
+ * the same key, had no stale value to fall back on, and gave up.
35
+ */
36
+ export class LockTimeoutError extends EchoError {
37
+ /** The cache key whose lock was not obtained. */
38
+ key;
39
+ constructor(key, timeoutMs) {
40
+ super("E_ECHO_LOCK_TIMEOUT", `Echo: waited ${timeoutMs}ms for another caller's factory for "${key}" and gave up`);
41
+ this.key = key;
42
+ }
43
+ }
44
+ /**
45
+ * Raised when a tiered store's L2 fails and the failure is not suppressed
46
+ * (upstream `E_L2_CACHE_ERROR`, kept verbatim). `cause` is the L2's error.
47
+ */
48
+ export class L2CacheError extends EchoError {
49
+ constructor(operation, cause) {
50
+ const reason = cause instanceof Error ? cause.message : String(cause);
51
+ super("E_L2_CACHE_ERROR", `Echo: the L2 cache failed during ${operation}: ${reason}`, { cause });
52
+ }
53
+ }
4
54
  /** Raised when a factory exceeds its configured `hardTimeout`. */
5
- export class TimeoutError extends Error {
55
+ export class TimeoutError extends EchoError {
6
56
  constructor(key, timeoutMs) {
7
- super(`Echo: factory for "${key}" timed out after ${timeoutMs}ms`);
8
- this.name = "TimeoutError";
57
+ super("E_FACTORY_HARD_TIMEOUT", `Echo: factory for "${key}" timed out after ${timeoutMs}ms`);
9
58
  }
10
59
  }
11
60
  /**
12
61
  * Wraps an error thrown by a `getOrSet` factory. Passed to `onFactoryError`
13
62
  * so callers can observe both foreground and background factory failures.
14
63
  */
15
- export class FactoryError extends Error {
64
+ export class FactoryError extends EchoError {
16
65
  /** The cache key the factory was computing. */
17
66
  key;
18
67
  /** The original error thrown by the factory. */
@@ -21,11 +70,37 @@ export class FactoryError extends Error {
21
70
  isBackground;
22
71
  constructor(key, cause, isBackground) {
23
72
  const reason = cause instanceof Error ? cause.message : String(cause);
24
- super(`Echo: factory for "${key}" failed: ${reason}`);
25
- this.name = "FactoryError";
73
+ super("E_FACTORY_ERROR", `Echo: factory for "${key}" failed: ${reason}`);
26
74
  this.key = key;
27
75
  this.cause = cause;
28
76
  this.isBackground = isBackground;
29
77
  }
30
78
  }
79
+ /**
80
+ * Raised for a `null` or `undefined` value — upstream's `E_UNDEFINED_VALUE`.
81
+ * A `TypeError`, as this refusal always was. Echo refuses `null` as well: a
82
+ * null cache write is almost always a bug.
83
+ */
84
+ export class UndefinedValueError extends TypeError {
85
+ code = "E_UNDEFINED_VALUE";
86
+ constructor() {
87
+ super("Echo: caching null/undefined values is not supported");
88
+ this.name = "UndefinedValueError";
89
+ }
90
+ }
91
+ /** Raised for an argument a method cannot work with. A `TypeError`. */
92
+ export class InvalidArgumentError extends TypeError {
93
+ code = "E_ECHO_INVALID_ARGUMENT";
94
+ constructor(message) {
95
+ super(message);
96
+ this.name = "InvalidArgumentError";
97
+ }
98
+ }
99
+ /** Upstream's `errors` map, by code. */
100
+ export const errors = {
101
+ E_FACTORY_ERROR: FactoryError,
102
+ E_FACTORY_HARD_TIMEOUT: TimeoutError,
103
+ E_UNDEFINED_VALUE: UndefinedValueError,
104
+ E_L2_CACHE_ERROR: L2CacheError,
105
+ };
31
106
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kEAAkE;AAClE,MAAM,OAAO,YAAa,SAAQ,KAAK;IACtC,YAAY,GAAW,EAAE,SAAiB;QACzC,KAAK,CAAC,sBAAsB,GAAG,qBAAqB,SAAS,IAAI,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC5B,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACtC,+CAA+C;IACtC,GAAG,CAAS;IACrB,gDAAgD;IAC9B,KAAK,CAAU;IACjC,sFAAsF;IAC7E,YAAY,CAAU;IAE/B,YAAY,GAAW,EAAE,KAAc,EAAE,YAAqB;QAC7D,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,KAAK,CAAC,sBAAsB,GAAG,aAAa,MAAM,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;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,YAAY;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,YAAY;CAC9B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,16 +11,16 @@
11
11
  import "./augmentations.js";
12
12
  export type { CacheConfig, CacheDriver } from "./CacheManager.js";
13
13
  export { CacheManager } from "./CacheManager.js";
14
- export { MemoryDriver } from "./drivers/MemoryDriver.js";
14
+ export { MemoryDriver, type MemoryDriverOptions, } from "./drivers/MemoryDriver.js";
15
15
  export type { RedisClient } from "./drivers/RedisDriver.js";
16
16
  export { RedisDriver } from "./drivers/RedisDriver.js";
17
17
  export type { BusMessage, CacheBus, TieredDriverOptions, } from "./drivers/TieredDriver.js";
18
- export { TieredDriver } from "./drivers/TieredDriver.js";
18
+ export { isBusMessage, TieredDriver } from "./drivers/TieredDriver.js";
19
19
  export type { Duration } from "./duration.js";
20
20
  export { parseDuration, resolveTtlSeconds } from "./duration.js";
21
21
  export type { EchoProviderConfig } from "./EchoProvider.js";
22
- export { FactoryError, TimeoutError } from "./errors.js";
23
- export { CacheStoreManager, type DriverFactory, drivers, type MultiStoreConfig, Store, type StoreConfig, store, } from "./StoreManager.js";
22
+ export { EchoError, errors, FactoryError, InvalidArgumentError, InvalidDurationError, L2CacheError, LockTimeoutError, TimeoutError, UndefinedValueError, } from "./errors.js";
23
+ export { CacheStoreManager, type DriverContext, type DriverFactory, drivers, type MultiStoreConfig, Store, type StoreConfig, store, } from "./StoreManager.js";
24
24
  export type { CacheEmitter, CacheEntry, CacheEventMap, DefaultValue, DeleteByTagOptions, DeleteManyOptions, DeleteOptions, ExpireOptions, Factory, GetOptions, GetOrSetForeverOptions, GetOrSetOptions, HasOptions, SetOptions, TaggableDriver, } from "./types.js";
25
25
  import type { EchoProviderConfig } from "./EchoProvider.js";
26
26
  import type { MultiStoreConfig } from "./StoreManager.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;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AAY,CAAC;AAEpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,kBAAkB,GAAG,gBAAgB,EAC3E,MAAM,EAAE,CAAC,GACP,CAAC,CAEH"}
package/dist/index.js CHANGED
@@ -10,11 +10,11 @@
10
10
  */
11
11
  import "./augmentations.js";
12
12
  export { CacheManager } from "./CacheManager.js";
13
- export { MemoryDriver } from "./drivers/MemoryDriver.js";
13
+ export { MemoryDriver, } from "./drivers/MemoryDriver.js";
14
14
  export { RedisDriver } from "./drivers/RedisDriver.js";
15
- export { TieredDriver } from "./drivers/TieredDriver.js";
15
+ export { isBusMessage, TieredDriver } from "./drivers/TieredDriver.js";
16
16
  export { parseDuration, resolveTtlSeconds } from "./duration.js";
17
- export { FactoryError, TimeoutError } from "./errors.js";
17
+ export { EchoError, errors, FactoryError, InvalidArgumentError, InvalidDurationError, L2CacheError, LockTimeoutError, TimeoutError, UndefinedValueError, } from "./errors.js";
18
18
  export { CacheStoreManager, drivers, Store, store, } from "./StoreManager.js";
19
19
  /**
20
20
  * Author-time config helper for `config/cache.ts` — AdonisJS cache `defineConfig`
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACN,iBAAiB,EAEjB,OAAO,EAEP,KAAK,EAEL,KAAK,GACL,MAAM,mBAAmB,CAAC;AAsB3B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC3B,MAAS;IAET,OAAO,MAAM,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACN,YAAY,GAEZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,iBAAiB,EAGjB,OAAO,EAEP,KAAK,EAEL,KAAK,GACL,MAAM,mBAAmB,CAAC;AAsB3B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC3B,MAAS;IAET,OAAO,MAAM,CAAC;AACf,CAAC"}
package/dist/quasar.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * below is echo's alone and stays here.
12
12
  */
13
13
  import type { RedisClient } from "./drivers/RedisDriver.js";
14
- import type { CacheBus } from "./drivers/TieredDriver.js";
14
+ import { type CacheBus } from "./drivers/TieredDriver.js";
15
15
  /**
16
16
  * A resolver for `drivers.redis({ connection })` — quasar is loaded on the
17
17
  * first cache command, not at config time.