lunibee 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 (61) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +225 -225
  3. package/dist/builders/attachment.d.ts +8 -0
  4. package/dist/builders/commands.d.ts +122 -65
  5. package/dist/builders/components.d.ts +10 -31
  6. package/dist/builders/embed.d.ts +66 -33
  7. package/dist/builders/index.js +97 -131
  8. package/dist/builders/index.js.map +8 -8
  9. package/dist/collection/cache.d.ts +13 -6
  10. package/dist/collection/index.d.ts +90 -17
  11. package/dist/collection/index.js +442 -266
  12. package/dist/collection/index.js.map +4 -4
  13. package/dist/core/index.d.ts +8 -0
  14. package/dist/core/index.js +607 -352
  15. package/dist/core/index.js.map +47 -47
  16. package/dist/core/permissions.d.ts +7 -3
  17. package/dist/formatters/index.js +9 -5
  18. package/dist/formatters/index.js.map +3 -3
  19. package/dist/handlers/index.js +5 -10
  20. package/dist/handlers/index.js.map +3 -3
  21. package/dist/index.js +769 -587
  22. package/dist/index.js.map +65 -65
  23. package/dist/managers/base.d.ts +22 -14
  24. package/dist/managers/index.d.ts +2 -1
  25. package/dist/managers/index.js +445 -276
  26. package/dist/managers/index.js.map +26 -26
  27. package/dist/managers/message.d.ts +7 -3
  28. package/dist/rest/errors.d.ts +14 -7
  29. package/dist/rest/index.d.ts +24 -12
  30. package/dist/rest/index.js +54 -17
  31. package/dist/rest/index.js.map +14 -14
  32. package/dist/rest/redis.d.ts +1 -1
  33. package/dist/rest/route.d.ts +8 -4
  34. package/dist/rest/routes.d.ts +102 -48
  35. package/dist/rest/transport.d.ts +10 -5
  36. package/dist/rest/webhook.d.ts +9 -5
  37. package/dist/sharding/bus.d.ts +34 -17
  38. package/dist/sharding/index.d.ts +34 -17
  39. package/dist/sharding/index.js +64 -32
  40. package/dist/sharding/index.js.map +17 -17
  41. package/dist/structures/base.d.ts +19 -10
  42. package/dist/structures/channels.d.ts +28 -14
  43. package/dist/structures/index.js +9 -59
  44. package/dist/structures/index.js.map +19 -18
  45. package/dist/structures/interactions.d.ts +96 -48
  46. package/dist/structures/resources.d.ts +88 -44
  47. package/dist/types/gateway.d.ts +1 -1
  48. package/dist/types/index.js +20 -22
  49. package/dist/types/index.js.map +4 -4
  50. package/dist/utils/index.js.map +2 -2
  51. package/dist/voice/index.d.ts +12 -4
  52. package/dist/voice/index.js +14 -18
  53. package/dist/voice/index.js.map +3 -3
  54. package/dist/ws/decoder.d.ts +6 -2
  55. package/dist/ws/index.d.ts +25 -13
  56. package/dist/ws/index.js +63 -31
  57. package/dist/ws/index.js.map +14 -14
  58. package/dist/ws/protocol.d.ts +10 -2
  59. package/dist/ws/session.d.ts +14 -4
  60. package/dist/ws/state.d.ts +22 -11
  61. package/package.json +15 -14
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
3
  "sources": ["../../packages/collection/src/cache.ts", "../../packages/collection/src/index.ts"],
4
4
  "sourcesContent": [
5
- "import { Collection } from \"./index.js\";\n\n/** Cache policy for bounded resource storage. */\nexport interface CacheOptions {\n /** Maximum number of entries retained. */\n maxSize?: number;\n /** Time-to-live in milliseconds. Omit to disable expiration. */\n ttl?: number;\n /** Sweep interval in milliseconds. */\n sweepInterval?: number;\n}\n\ntype Entry<V> = { value: V; expiresAt: number };\n\n/** Bounded cache with TTL expiration and explicit invalidation support. */\nexport class Cache<K, V> {\n readonly #entries = new Collection<K, Entry<V>>();\n readonly #maxSize: number;\n readonly #ttl: number;\n #timer?: ReturnType<typeof setInterval>;\n\n /** Creates a cache using the supplied retention policy. */\n public constructor(options: CacheOptions = {}) {\n this.#maxSize = options.maxSize ?? Infinity;\n this.#ttl = options.ttl ?? 0;\n if (\n (!Number.isInteger(this.#maxSize) && this.#maxSize !== Infinity) ||\n this.#maxSize < 1\n )\n throw new RangeError(\"Cache maxSize must be a positive integer.\");\n if (!Number.isFinite(this.#ttl) || this.#ttl < 0)\n throw new RangeError(\n \"Cache ttl must be a non-negative finite number.\",\n );\n if (this.#ttl > 0) {\n const interval =\n options.sweepInterval ?? Math.min(this.#ttl, 60_000);\n if (!Number.isFinite(interval) || interval < 1)\n throw new RangeError(\"Cache sweepInterval must be positive.\");\n this.#timer = setInterval(() => this.sweep(), interval);\n // A sweeper is housekeeping, not work: keeping it referenced makes\n // a TTL cache hold the process open until dispose() is called.\n (this.#timer as { unref?: () => void }).unref?.();\n }\n }\n\n /** Number of currently live entries. */\n public get size(): number {\n this.#sweepExpired();\n return this.#entries.size;\n }\n /** Reads a live entry. */\n public get(key: K): V | undefined {\n const entry = this.#entries.get(key);\n if (!entry) return undefined;\n if (entry.expiresAt > 0 && entry.expiresAt <= Date.now()) {\n this.#entries.delete(key);\n return undefined;\n }\n // LRU Promotion: move to end of insertion order\n this.#entries.delete(key);\n this.#entries.set(key, entry);\n return entry.value;\n }\n /** Returns whether a live entry exists. */\n public has(key: K): boolean {\n const entry = this.#entries.get(key);\n if (!entry) return false;\n if (entry.expiresAt > 0 && entry.expiresAt <= Date.now()) {\n this.#entries.delete(key);\n return false;\n }\n return true;\n }\n /** Stores an entry and evicts the oldest entries when the bound is exceeded. */\n public set(key: K, value: V): this {\n const expiresAt = this.#ttl > 0 ? Date.now() + this.#ttl : 0;\n this.#entries.delete(key);\n this.#entries.set(key, { value, expiresAt });\n // Skip eviction entirely for unbounded caches (maxSize === Infinity).\n if (this.#maxSize !== Infinity) {\n while (this.#entries.size > this.#maxSize) {\n const oldest = this.#entries.firstKey();\n if (oldest !== undefined) this.#entries.delete(oldest);\n else break;\n }\n }\n return this;\n }\n /** Invalidates one key. */\n public delete(key: K): boolean {\n return this.#entries.delete(key);\n }\n /** Invalidates every cached resource. */\n public clear(): void {\n this.#entries.clear();\n }\n /** Invalidates every entry matching a predicate. */\n public invalidate(predicate: (value: V, key: K) => boolean): number {\n return this.#entries.sweep((entry, key) => predicate(entry.value, key));\n }\n /** Removes expired entries and returns the number removed. */\n public sweep(): number {\n return this.#entries.sweep((entry) => this.#expired(entry));\n }\n /** Stops the background sweeper and releases its timer. */\n public dispose(): void {\n if (this.#timer) clearInterval(this.#timer);\n this.#timer = undefined;\n }\n /** Returns live cached values. */\n public values(): V[] {\n this.#sweepExpired();\n return this.#entries.map((entry) => entry.value);\n }\n /** Returns live cached entries. */\n public entries(): [K, V][] {\n this.#sweepExpired();\n return this.#entries.map((entry, key) => [key, entry.value]);\n }\n #expired(entry: Entry<V>): boolean {\n return entry.expiresAt > 0 && entry.expiresAt <= Date.now();\n }\n #sweepExpired(): void {\n if (this.#ttl > 0) this.sweep();\n }\n}\n",
6
- "type RecencyNode<K> = {\n key: K;\n older?: RecencyNode<K>;\n newer?: RecencyNode<K>;\n};\n\n/**\n * Keys in recency order with O(1) touch, promote, delete and oldest. A Set\n * cannot do this: repeatedly removing its first key leaves tombstones that\n * every new iterator scans past.\n */\nclass RecencyList<K> {\n readonly #nodes = new Map<K, RecencyNode<K>>();\n #oldest?: RecencyNode<K>;\n #newest?: RecencyNode<K>;\n\n public get size(): number {\n return this.#nodes.size;\n }\n\n public oldest(): K | undefined {\n return this.#oldest?.key;\n }\n\n /** Adds the key as newest, or moves it there. */\n public touch(key: K): void {\n const node = this.#nodes.get(key);\n if (node) return this.#moveNewest(node);\n const created: RecencyNode<K> = { key, older: this.#newest };\n if (this.#newest) this.#newest.newer = created;\n else this.#oldest = created;\n this.#newest = created;\n this.#nodes.set(key, created);\n }\n\n /** Moves an existing key to newest; ignores unknown keys. */\n public promote(key: K): void {\n const node = this.#nodes.get(key);\n if (node) this.#moveNewest(node);\n }\n\n public delete(key: K): boolean {\n const node = this.#nodes.get(key);\n if (!node) return false;\n this.#unlink(node);\n this.#nodes.delete(key);\n return true;\n }\n\n public clear(): void {\n this.#nodes.clear();\n this.#oldest = this.#newest = undefined;\n }\n\n #unlink(node: RecencyNode<K>): void {\n if (node.older) node.older.newer = node.newer;\n else this.#oldest = node.newer;\n if (node.newer) node.newer.older = node.older;\n else this.#newest = node.older;\n node.older = node.newer = undefined;\n }\n\n #moveNewest(node: RecencyNode<K>): void {\n if (node === this.#newest) return;\n this.#unlink(node);\n node.older = this.#newest;\n if (this.#newest) this.#newest.newer = node;\n else this.#oldest = node;\n this.#newest = node;\n }\n}\n\n/** Retention policy for a {@link Collection}. */\nexport interface CollectionOptions<K = unknown, V = unknown> {\n /** Default sliding TTL in ms for `set()`. Omit for no expiry. */\n ttl?: number;\n /** Maximum entries stored with `set()`; least-recently-used are evicted past it. `setWithoutTTL()` entries are never counted or evicted. */\n maxSize?: number;\n /** Called after an entry is removed automatically, with why. Exceptions are swallowed. */\n onEvict?: (key: K, value: V, reason: EvictionReason) => void;\n}\n\n/** Why an entry was removed automatically. */\nexport type EvictionReason = \"expired\" | \"evicted\";\n\n/** Cumulative counters from {@link Collection.stats}. */\nexport interface CollectionStats {\n /** `get`/`peek` calls that found a value. */ hits: number;\n /** `get`/`peek` calls that found nothing. */ misses: number;\n /** Entries removed because their TTL lapsed. */ expired: number;\n /** Entries removed to stay within `maxSize`. */ evicted: number;\n}\n\ntype Expiry = { deadline: number; window: number; filed: number };\n\nfunction assertTTL(ttl: number | undefined): void {\n if (ttl !== undefined && (!Number.isFinite(ttl) || ttl <= 0))\n throw new RangeError(\"TTL must be a positive number, or omitted.\");\n}\n\n/**\n * A keyed collection for Lunibee resource and application state.\n *\n * - `set(key, value, ttl?)` is TTL/LRU-aware: with a TTL (the default from\n * options, or per call) the entry expires after that window of inactivity,\n * and with `maxSize` it counts toward the cap.\n * - `setWithoutTTL(key, value)` never expires: no deadline, no heap record,\n * no timer, and exempt from `maxSize` eviction. Resource managers store\n * Discord state this way, so it leaves only through an explicit delete.\n *\n * Without options, a Collection behaves like a plain Map.\n */\nexport class Collection<K, V> extends Map<K, V> {\n readonly #ttl?: number;\n readonly #maxSize?: number;\n /** Stored loosely typed so the callback does not make Collection invariant in K and V. */\n readonly #onEvict?: (\n key: unknown,\n value: unknown,\n reason: EvictionReason,\n ) => void;\n /** Deadlines of TTL entries only. */\n readonly #expiry = new Map<K, Expiry>();\n /** `set()` keys in recency order (oldest first), tracked only when `maxSize` is set; `setWithoutTTL()` keys are never here. */\n readonly #lru = new RecencyList<K>();\n readonly #stats: CollectionStats = {\n hits: 0,\n misses: 0,\n expired: 0,\n evicted: 0,\n };\n /** Min-heap of filed deadlines; stale records are dropped lazily. */\n readonly #heap: { key: K; deadline: number }[] = [];\n #timer?: ReturnType<typeof setTimeout>;\n #armedFor = Infinity;\n\n /**\n * @param entries Initial entries, stored with `set()`.\n * @param options TTL and size policy.\n * @throws {RangeError} On a non-positive TTL or non-integer `maxSize`.\n */\n public constructor(\n entries?: Iterable<readonly [K, V]> | null,\n options: CollectionOptions<K, V> = {},\n ) {\n super();\n assertTTL(options.ttl);\n if (\n options.maxSize !== undefined &&\n (!Number.isInteger(options.maxSize) || options.maxSize <= 0)\n )\n throw new RangeError(\"maxSize must be a positive integer.\");\n this.#ttl = options.ttl;\n this.#maxSize = options.maxSize;\n this.#onEvict = options.onEvict as\n | ((key: unknown, value: unknown, reason: EvictionReason) => void)\n | undefined;\n if (entries) for (const [key, value] of entries) this.set(key, value);\n }\n\n /**\n * Stores an entry with the default TTL (or `ttl`), marks it most recently\n * used, and enforces `maxSize`. Turns a `setWithoutTTL()` entry back into\n * a TTL/LRU entry.\n */\n public override set(key: K, value: V, ttl?: number): this {\n assertTTL(ttl);\n const window = ttl ?? this.#ttl;\n if (this.#maxSize !== undefined) {\n this.#lru.touch(key);\n }\n super.set(key, value);\n if (window !== undefined) this.#schedule(key, window);\n else if (this.#expiry.size > 0) this.#expiry.delete(key);\n this.#enforceCap();\n return this;\n }\n\n /**\n * Stores an entry that never expires: no deadline, heap record, timer or\n * LRU eviction. It leaves only through `delete`, `sweep`, `clear`, or a\n * later `set()`.\n */\n public setWithoutTTL(key: K, value: V): this {\n if (this.#expiry.size > 0) this.#expiry.delete(key);\n if (this.#lru.size > 0) this.#lru.delete(key);\n super.set(key, value);\n return this;\n }\n\n /** Reads a value; restarts a TTL entry's window and promotes it. */\n public override get(key: K): V | undefined {\n if (this.#expireIfDue(key)) {\n this.#stats.misses++;\n return undefined;\n }\n const value = super.get(key);\n if (value === undefined && !super.has(key)) {\n this.#stats.misses++;\n return undefined;\n }\n this.#stats.hits++;\n const expiry = this.#expiry.get(key);\n if (expiry) expiry.deadline = Date.now() + expiry.window;\n this.#lru.promote(key);\n return value;\n }\n\n /** Reads a value without restarting its TTL or promoting it. */\n public peek(key: K): V | undefined {\n if (!this.#expireIfDue(key) && super.has(key)) {\n this.#stats.hits++;\n return super.get(key);\n }\n this.#stats.misses++;\n return undefined;\n }\n\n /** Cumulative hit, miss, expiry and eviction counters (a copy). */\n public get stats(): CollectionStats {\n return { ...this.#stats };\n }\n\n public override has(key: K): boolean {\n return !this.#expireIfDue(key) && super.has(key);\n }\n\n public override delete(key: K): boolean {\n if (this.#expireIfDue(key)) return false;\n this.#expiry.delete(key);\n this.#lru.delete(key);\n return super.delete(key);\n }\n\n public override clear(): void {\n super.clear();\n this.#expiry.clear();\n this.#lru.clear();\n this.#heap.length = 0;\n if (this.#timer) clearTimeout(this.#timer);\n this.#timer = undefined;\n this.#armedFor = Infinity;\n }\n\n public override get size(): number {\n this.purge();\n return super.size;\n }\n\n public override entries(): MapIterator<[K, V]> {\n this.purge();\n return super.entries();\n }\n\n public override keys(): MapIterator<K> {\n this.purge();\n return super.keys();\n }\n\n public override values(): MapIterator<V> {\n this.purge();\n return super.values();\n }\n\n public override [Symbol.iterator](): MapIterator<[K, V]> {\n return this.entries();\n }\n\n public override forEach(\n callback: (value: V, key: K, map: Map<K, V>) => void,\n thisArg?: unknown,\n ): void {\n this.purge();\n super.forEach(callback, thisArg);\n }\n\n /** Milliseconds until a key lapses, or undefined if absent or never expiring. */\n public ttlRemaining(key: K): number | undefined {\n if (this.#expireIfDue(key)) return undefined;\n const expiry = this.#expiry.get(key);\n return expiry && Math.max(0, expiry.deadline - Date.now());\n }\n\n /** Drops every lapsed TTL entry now. @returns How many were dropped. */\n public purge(): number {\n if (this.#expiry.size === 0) return 0;\n const now = Date.now();\n let removed = 0;\n const dropped: [K, V][] = [];\n while (this.#nextDeadline() <= now) {\n const due = this.#heapPop()!;\n dropped.push([due.key, super.get(due.key)!]);\n this.#remove(due.key);\n removed++;\n }\n this.#stats.expired += removed;\n this.#rearm();\n for (const [key, value] of dropped) this.#notify(key, value, \"expired\");\n return removed;\n }\n\n #expireIfDue(key: K): boolean {\n const expiry = this.#expiry.get(key);\n if (!expiry || expiry.deadline > Date.now()) return false;\n const value = super.get(key)!;\n this.#remove(key);\n this.#stats.expired++;\n this.#notify(key, value, \"expired\");\n return true;\n }\n\n #remove(key: K): void {\n this.#expiry.delete(key);\n this.#lru.delete(key);\n super.delete(key);\n }\n\n #notify(key: K, value: V, reason: EvictionReason): void {\n if (!this.#onEvict) return;\n try {\n this.#onEvict(key, value, reason);\n } catch {\n // A throwing callback must not leave the collection inconsistent.\n }\n }\n\n /** Evicts least-recently-used `set()` entries past `maxSize`; O(1) per eviction. */\n #enforceCap(): void {\n if (this.#maxSize === undefined) return;\n while (this.#lru.size > this.#maxSize) {\n const oldest = this.#lru.oldest()!;\n const value = super.get(oldest)!;\n this.#remove(oldest);\n this.#stats.evicted++;\n this.#notify(oldest, value, \"evicted\");\n }\n }\n\n /**\n * Gives an entry a deadline. Extending one writes a number; the stale\n * heap record re-files itself when it surfaces. Only a deadline that\n * moves earlier (or a new one) is pushed.\n */\n #schedule(key: K, window: number): void {\n const deadline = Date.now() + window;\n const expiry = this.#expiry.get(key);\n if (expiry) {\n expiry.deadline = deadline;\n expiry.window = window;\n if (deadline >= expiry.filed) return;\n expiry.filed = deadline;\n } else this.#expiry.set(key, { deadline, window, filed: deadline });\n this.#heapPush({ key, deadline });\n if (this.#heap.length > 2 * this.#expiry.size + 8) this.#compact();\n this.#rearm();\n }\n\n #nextDeadline(): number {\n for (;;) {\n const top = this.#heap[0];\n if (top === undefined) return Infinity;\n const expiry = this.#expiry.get(top.key);\n if (!expiry || expiry.filed !== top.deadline) {\n this.#heapPop();\n continue;\n }\n if (expiry.deadline === top.deadline) return top.deadline;\n // Extended since it was filed: re-file for its current deadline.\n this.#heapPop();\n expiry.filed = expiry.deadline;\n this.#heapPush({ key: top.key, deadline: expiry.deadline });\n }\n }\n\n #compact(): void {\n const live = this.#heap.filter(\n (record) => this.#expiry.get(record.key)?.filed === record.deadline,\n );\n this.#heap.length = 0;\n for (const record of live) this.#heapPush(record);\n }\n\n #rearm(): void {\n const deadline = this.#nextDeadline();\n if (this.#timer !== undefined && deadline >= this.#armedFor) return;\n if (this.#timer) clearTimeout(this.#timer);\n this.#timer = undefined;\n this.#armedFor = deadline;\n if (deadline === Infinity) return;\n this.#timer = setTimeout(\n () => {\n this.#timer = undefined;\n this.#armedFor = Infinity;\n this.purge();\n },\n Math.max(0, deadline - Date.now()),\n );\n // Pending expiry is housekeeping, not a reason to keep the process alive.\n (this.#timer as { unref?: () => void }).unref?.();\n }\n\n #heapPush(record: { key: K; deadline: number }): void {\n const heap = this.#heap;\n heap.push(record);\n let i = heap.length - 1;\n while (i > 0) {\n const parent = (i - 1) >> 1;\n if (heap[parent]!.deadline <= heap[i]!.deadline) break;\n [heap[parent], heap[i]] = [heap[i]!, heap[parent]!];\n i = parent;\n }\n }\n\n #heapPop(): { key: K; deadline: number } | undefined {\n const heap = this.#heap;\n const top = heap[0];\n const last = heap.pop();\n if (top === undefined || heap.length === 0) return top;\n heap[0] = last!;\n for (let i = 0; ;) {\n const left = 2 * i + 1;\n const right = left + 1;\n let smallest = i;\n if (\n left < heap.length &&\n heap[left]!.deadline < heap[smallest]!.deadline\n )\n smallest = left;\n if (\n right < heap.length &&\n heap[right]!.deadline < heap[smallest]!.deadline\n )\n smallest = right;\n if (smallest === i) break;\n [heap[smallest], heap[i]] = [heap[i]!, heap[smallest]!];\n i = smallest;\n }\n return top;\n }\n\n /** Returns the first stored value. */\n public first(): V | undefined {\n for (const value of this.values()) return value;\n return undefined;\n }\n /** Returns the first stored key. */\n public firstKey(): K | undefined {\n for (const key of this.keys()) return key;\n return undefined;\n }\n /** Returns the last stored value. */\n public last(): V | undefined {\n let value: V | undefined;\n for (const item of this.values()) value = item;\n return value;\n }\n /** Returns the last stored key. */\n public lastKey(): K | undefined {\n let key: K | undefined;\n for (const item of this.keys()) key = item;\n return key;\n }\n /** Finds the first value matching a predicate. */\n public find(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): V | undefined {\n for (const [key, value] of this) {\n if (predicate(value, key, this)) return value;\n }\n return undefined;\n }\n /** Returns all values matching a predicate. */\n public filter(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): Collection<K, V> {\n const result = new Collection<K, V>();\n for (const [key, value] of this) {\n if (predicate(value, key, this)) result.set(key, value);\n }\n return result;\n }\n /** Transforms every stored value into an array. */\n public map<T>(transform: (value: V, key: K, collection: this) => T): T[] {\n const result: T[] = [];\n for (const [key, value] of this) {\n result.push(transform(value, key, this));\n }\n return result;\n }\n /** Returns whether at least one stored value satisfies a predicate. */\n public some(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): boolean {\n for (const [key, value] of this) {\n if (predicate(value, key, this)) return true;\n }\n return false;\n }\n /** Returns whether every stored value satisfies a predicate. */\n public every(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): boolean {\n for (const [key, value] of this) {\n if (!predicate(value, key, this)) return false;\n }\n return true;\n }\n /** Runs a callback for each stored value. */\n public each(\n callback: (value: V, key: K, collection: this) => unknown,\n ): this {\n for (const [key, value] of this) {\n callback(value, key, this);\n }\n return this;\n }\n /** Returns an array containing all stored values. */\n public array(): V[] {\n return [...this.values()];\n }\n /** Returns an array containing all stored keys. */\n public keyArray(): K[] {\n return [...this.keys()];\n }\n /** Returns a plain array of entries. */\n public entriesArray(): [K, V][] {\n return [...this.entries()];\n }\n /** Returns a new collection with the same entries. */\n public clone(): Collection<K, V> {\n const copy = new Collection<K, V>();\n for (const [key, value] of this) copy.set(key, value);\n return copy;\n }\n /** Returns whether all supplied keys are present. */\n public hasAll(...keys: K[]): boolean {\n for (let i = 0; i < keys.length; i++) {\n if (!this.has(keys[i]!)) return false;\n }\n return true;\n }\n /** Returns whether at least one supplied key is present. */\n public hasAny(...keys: K[]): boolean {\n for (let i = 0; i < keys.length; i++) {\n if (this.has(keys[i]!)) return true;\n }\n return false;\n }\n /** Returns the first key whose value matches a predicate. */\n public findKey(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): K | undefined {\n for (const [key, value] of this) {\n if (predicate(value, key, this)) return key;\n }\n return undefined;\n }\n /** Returns whether a predicate matches at least one entry. */\n public someEntry(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): boolean {\n return this.some(predicate);\n }\n /** Removes every entry matching a predicate and returns the number removed. */\n public sweep(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): number {\n let removed = 0;\n for (const [key, value] of this) {\n if (predicate(value, key, this) && this.delete(key)) removed++;\n }\n return removed;\n }\n /** Returns the collection's first matching entry as a tuple. */\n public firstEntry(): [K, V] | undefined {\n for (const [key, value] of this) return [key, value];\n return undefined;\n }\n /** Returns the collection's last matching entry as a tuple. */\n public lastEntry(): [K, V] | undefined {\n let entry: [K, V] | undefined;\n for (const item of this) entry = [item[0], item[1]];\n return entry;\n }\n /** Returns a new Collection containing elements from both collections. */\n public union(other: Collection<K, V>): Collection<K, V> {\n const result = this.clone();\n for (const [key, value] of other) result.set(key, value);\n return result;\n }\n /** Returns a new Collection containing only elements present in both collections. */\n public intersection(other: Collection<K, V>): Collection<K, V> {\n const result = new Collection<K, V>();\n for (const [key, value] of this) {\n if (other.has(key)) result.set(key, value);\n }\n return result;\n }\n /** Returns a new Collection containing elements present in this collection but not the other. */\n public difference(other: Collection<K, V>): Collection<K, V> {\n const result = new Collection<K, V>();\n for (const [key, value] of this) {\n if (!other.has(key)) result.set(key, value);\n }\n return result;\n }\n /** Splits the collection into two collections based on a predicate.\n * @returns `[passing, failing]` — entries satisfying the predicate, then those that don't.\n */\n public partition(\n predicate: (value: V, key: K, collection: this) => boolean,\n ): [Collection<K, V>, Collection<K, V>] {\n const pass = new Collection<K, V>();\n const fail = new Collection<K, V>();\n for (const [key, value] of this) {\n if (predicate(value, key, this)) pass.set(key, value);\n else fail.set(key, value);\n }\n return [pass, fail];\n }\n /** Calls `fn` with this collection and returns the collection unchanged.\n * Useful for inserting debug side-effects in a chain without breaking the flow.\n */\n public tap(fn: (collection: this) => unknown): this {\n fn(this);\n return this;\n }\n /** Maps every entry to an array of items and flattens the results. */\n public flatMap<T>(\n transform: (value: V, key: K, collection: this) => T[],\n ): T[] {\n const result: T[] = [];\n for (const [key, value] of this) {\n for (const item of transform(value, key, this)) result.push(item);\n }\n return result;\n }\n /** Reduces the collection to a single value. */\n public reduce<T>(\n fn: (accumulator: T, value: V, key: K, collection: this) => T,\n initialValue: T,\n ): T {\n let acc = initialValue;\n for (const [key, value] of this) acc = fn(acc, value, key, this);\n return acc;\n }\n /** Returns a new Collection with entries sorted by comparator (non-mutating).\n * Defaults to insertion order if no comparator is provided.\n */\n public sorted(\n comparator?: (a: V, b: V, aKey: K, bKey: K) => number,\n ): Collection<K, V> {\n // Decorate with the original insertion index and use it as a tiebreaker so\n // equal elements keep their insertion order (a stable sort independent of\n // the engine's Array.prototype.sort stability guarantees).\n const decorated = [...this.entries()].map((entry, index) => ({\n entry,\n index,\n }));\n if (comparator)\n decorated.sort((x, y) => {\n const comparison = comparator(\n x.entry[1],\n y.entry[1],\n x.entry[0],\n y.entry[0],\n );\n return comparison !== 0 ? comparison : x.index - y.index;\n });\n const result = new Collection<K, V>();\n for (const { entry } of decorated) result.set(entry[0], entry[1]);\n return result;\n }\n /** Returns a random value from the collection, or `undefined` if empty.\n * Uses `Math.random()` (fast, non-cryptographic) — do not use for security-sensitive\n * selection such as tokens or secrets. */\n public random(): V | undefined {\n const arr = [...this.values()];\n if (!arr.length) return undefined;\n return arr[Math.floor(Math.random() * arr.length)];\n }\n /** Returns a random key from the collection, or `undefined` if empty.\n * Uses `Math.random()` (fast, non-cryptographic) — do not use for security-sensitive\n * selection such as tokens or secrets. */\n public randomKey(): K | undefined {\n const arr = [...this.keys()];\n if (!arr.length) return undefined;\n return arr[Math.floor(Math.random() * arr.length)];\n }\n /** Returns the value at a given insertion-order index (supports negative indices). */\n public at(index: number): V | undefined {\n const arr = [...this.values()];\n const i = index < 0 ? arr.length + index : index;\n return arr[i];\n }\n /** Returns the key at a given insertion-order index (supports negative indices). */\n public keyAt(index: number): K | undefined {\n const arr = [...this.keys()];\n const i = index < 0 ? arr.length + index : index;\n return arr[i];\n }\n /** Serializes the collection to a plain `[key, value]` array. */\n public toJSON(): [K, V][] {\n return [...this.entries()];\n }\n}\n\nexport { Cache } from \"./cache.js\";\nexport type { CacheOptions } from \"./cache.js\";\n"
5
+ "import { Collection } from \"./index.js\";\r\n\r\n/** Cache policy for bounded resource storage. */\r\nexport interface CacheOptions {\r\n /** Maximum number of entries retained. */\r\n maxSize?: number;\r\n /** Time-to-live in milliseconds. Omit to disable expiration. */\r\n ttl?: number;\r\n /**\r\n * Accepted for compatibility and still validated. Expired entries are now\r\n * dropped at their deadline, so no periodic sweep is needed.\r\n */\r\n sweepInterval?: number;\r\n}\r\n\r\n/**\r\n * Bounded cache with a fixed TTL, least-recently-used eviction and explicit\r\n * invalidation. A thin policy layer over {@link Collection}: reads promote an\r\n * entry but do not extend its TTL.\r\n */\r\nexport class Cache<K, V> {\r\n readonly #entries: Collection<K, V>;\r\n\r\n /** Creates a cache using the supplied retention policy. */\r\n public constructor(options: CacheOptions = {}) {\r\n const maxSize = options.maxSize ?? Infinity;\r\n const ttl = options.ttl ?? 0;\r\n if ((!Number.isInteger(maxSize) && maxSize !== Infinity) || maxSize < 1)\r\n throw new RangeError(\"Cache maxSize must be a positive integer.\");\r\n if (!Number.isFinite(ttl) || ttl < 0)\r\n throw new RangeError(\r\n \"Cache ttl must be a non-negative finite number.\",\r\n );\r\n if (ttl > 0) {\r\n const interval = options.sweepInterval ?? Math.min(ttl, 60_000);\r\n if (!Number.isFinite(interval) || interval < 1)\r\n throw new RangeError(\"Cache sweepInterval must be positive.\");\r\n }\r\n this.#entries = new Collection<K, V>(null, {\r\n ttl: ttl > 0 ? ttl : undefined,\r\n maxSize: maxSize === Infinity ? undefined : maxSize,\r\n slide: false,\r\n });\r\n }\r\n\r\n /** Number of currently live entries. */\r\n public get size(): number {\r\n return this.#entries.size;\r\n }\r\n /** Reads a live entry and marks it most recently used. */\r\n public get(key: K): V | undefined {\r\n return this.#entries.get(key);\r\n }\r\n /** Returns whether a live entry exists. */\r\n public has(key: K): boolean {\r\n return this.#entries.has(key);\r\n }\r\n /** Stores an entry and evicts the least recently used ones when the bound is exceeded. */\r\n public set(key: K, value: V): this {\r\n this.#entries.set(key, value);\r\n return this;\r\n }\r\n /** Invalidates one key. */\r\n public delete(key: K): boolean {\r\n return this.#entries.delete(key);\r\n }\r\n /** Invalidates every cached resource. */\r\n public clear(): void {\r\n this.#entries.clear();\r\n }\r\n /** Invalidates every entry matching a predicate. */\r\n public invalidate(predicate: (value: V, key: K) => boolean): number {\r\n return this.#entries.sweep(predicate);\r\n }\r\n /** Removes expired entries now and returns the number removed. */\r\n public sweep(): number {\r\n return this.#entries.purge();\r\n }\r\n /** Kept for compatibility: there is no background sweeper to stop. */\r\n public dispose(): void {}\r\n /** Returns live cached values. */\r\n public values(): V[] {\r\n return [...this.#entries.values()];\r\n }\r\n /** Returns live cached entries. */\r\n public entries(): [K, V][] {\r\n return [...this.#entries.entries()];\r\n }\r\n}\r\n",
6
+ "/** Retention policy for a {@link Collection}. */\r\nexport interface CollectionOptions<K = unknown, V = unknown> {\r\n /** Default sliding TTL in ms for `set()`. Omit for no expiry. */\r\n ttl?: number;\r\n /** Maximum entries stored with `set()`; least-recently-used are evicted past it. `setWithoutTTL()` entries are never counted or evicted. */\r\n maxSize?: number;\r\n /** Whether a read restarts a TTL entry's window. Default `true`; with `false` an entry lapses a fixed time after it was set, and reads only mark it recently used. */\r\n slide?: boolean;\r\n /** Called after an entry is removed automatically, with why. Exceptions are swallowed. */\r\n onEvict?: (key: K, value: V, reason: EvictionReason) => void;\r\n}\r\n\r\n/** Why an entry was removed automatically. */\r\nexport type EvictionReason = \"expired\" | \"evicted\";\r\n\r\n/** Cumulative counters from {@link Collection.stats}. */\r\nexport interface CollectionStats {\r\n /** `get`/`peek` calls that found a value. */\r\n hits: number;\r\n /** `get`/`peek` calls that found nothing. */\r\n misses: number;\r\n /** Entries removed because their TTL lapsed. */\r\n expired: number;\r\n /** Entries removed to stay within `maxSize`. */\r\n evicted: number;\r\n}\r\n\r\n/**\r\n * Everything the policy knows about one key: its place in the recency list\r\n * and its TTL. One record serves the policy map, the recency list and the\r\n * expiry heap, so a write touches one extra hash entry and allocates once.\r\n */\r\ntype Entry<K, V> = {\r\n key: K;\r\n /** A copy of the stored value, so a read needs one lookup instead of two. */\r\n value: V;\r\n /** Neighbours in recency order; meaningful while `inLru`. */\r\n older: Entry<K, V> | undefined;\r\n newer: Entry<K, V> | undefined;\r\n inLru: boolean;\r\n /** TTL window in ms; 0 when the entry does not expire (and is not in the heap). */\r\n window: number;\r\n /** The current deadline; a read moves it later without touching the heap. */\r\n deadline: number;\r\n /** The deadline the heap ordered this record by. */\r\n filed: number;\r\n};\r\n\r\n/**\r\n * Everything a retention policy needs. A Collection without `ttl` or\r\n * `maxSize` never creates one, so plain collections cost no more than a Map.\r\n */\r\ntype Policy<K, V> = {\r\n /** Keys with a TTL or a recency position; `setWithoutTTL()` keys are absent. */\r\n entries: Map<K, Entry<K, V>>;\r\n /** Oldest and newest entries of the recency list; only `maxSize` collections use it. */\r\n oldest: Entry<K, V> | undefined;\r\n newest: Entry<K, V> | undefined;\r\n lruSize: number;\r\n /** Min-heap by `filed`. A record that is no longer its key's map value is stale and dropped lazily. */\r\n heap: Entry<K, V>[];\r\n timer?: ReturnType<typeof setTimeout>;\r\n armedFor: number;\r\n /** The options, kept here so a plain collection carries none of them. */\r\n ttl: number | undefined;\r\n maxSize: number | undefined;\r\n slide: boolean;\r\n /** Stored loosely typed so the callback does not make Collection invariant in K and V. */\r\n onEvict:\r\n | ((key: unknown, value: unknown, reason: EvictionReason) => void)\r\n | undefined;\r\n expired: number;\r\n evicted: number;\r\n};\r\n\r\nfunction newPolicy<K, V>(options: CollectionOptions<K, V> = {}): Policy<K, V> {\r\n return {\r\n ttl: options.ttl,\r\n maxSize: options.maxSize,\r\n slide: options.slide ?? true,\r\n onEvict: options.onEvict as Policy<K, V>[\"onEvict\"],\r\n expired: 0,\r\n evicted: 0,\r\n entries: new Map(),\r\n oldest: undefined,\r\n newest: undefined,\r\n lruSize: 0,\r\n heap: [],\r\n armedFor: Infinity,\r\n };\r\n}\r\n\r\n/**\r\n * Reads a value that `has()` just confirmed, without touching a Lunibee\r\n * collection's TTL, recency or hit counters.\r\n */\r\nfunction peekOf<K, V>(\r\n collection: ReadonlyCollection<K, V>,\r\n key: K,\r\n): V | undefined {\r\n return collection instanceof Map\r\n ? (Map.prototype.get.call(collection, key) as V | undefined)\r\n : collection.get(key);\r\n}\r\n\r\n/** What `merge()` does with one entry: keep it with `value`, or drop it. */\r\nexport type Keep<V> = { keep: true; value: V } | { keep: false };\r\n\r\n/**\r\n * A `Collection` seen read-only: every method that does not change it. Pass it\r\n * where you only read, so a function cannot add to or remove from the cache.\r\n */\r\nexport type ReadonlyCollection<K, V> = Omit<\r\n Collection<K, V>,\r\n | \"set\"\r\n | \"setWithoutTTL\"\r\n | \"delete\"\r\n | \"clear\"\r\n | \"ensure\"\r\n | \"forEach\"\r\n | \"get\"\r\n | \"sweep\"\r\n | \"purge\"\r\n> &\r\n ReadonlyMap<K, V>;\r\n\r\nconst mapGet = Map.prototype.get as (\r\n this: Map<unknown, unknown>,\r\n key: unknown,\r\n) => unknown;\r\nconst mapHas = Map.prototype.has as (\r\n this: Map<unknown, unknown>,\r\n key: unknown,\r\n) => boolean;\r\n\r\n/** Picks `amount` different items at random (a partial Fisher-Yates shuffle of `items`). */\r\nfunction sample<T>(items: T[], amount: number): T[] {\r\n if (!Number.isInteger(amount) || amount < 0)\r\n throw new RangeError(\"amount must be a non-negative integer.\");\r\n const count = Math.min(amount, items.length);\r\n for (let i = 0; i < count; i++) {\r\n const j = i + Math.floor(Math.random() * (items.length - i));\r\n [items[i], items[j]] = [items[j]!, items[i]!];\r\n }\r\n items.length = count;\r\n return items;\r\n}\r\n\r\nfunction assertTTL(ttl: number | undefined): void {\r\n if (ttl !== undefined && (!Number.isFinite(ttl) || ttl <= 0))\r\n throw new RangeError(\"TTL must be a positive number, or omitted.\");\r\n}\r\n\r\n/**\r\n * A keyed collection for Lunibee resource and application state.\r\n *\r\n * - `set(key, value, ttl?)` is TTL/LRU-aware: with a TTL (the default from\r\n * options, or per call) the entry expires after that window of inactivity,\r\n * and with `maxSize` it counts toward the cap.\r\n * - `setWithoutTTL(key, value)` never expires: no deadline, no heap record,\r\n * no timer, and exempt from `maxSize` eviction. Resource managers store\r\n * Discord state this way, so it leaves only through an explicit delete.\r\n *\r\n * Without options, a Collection behaves like a plain Map.\r\n */\r\nexport class Collection<K, V> extends Map<K, V> {\r\n /** Created with any option, or by the first `set()` with its own TTL. */\r\n #policy?: Policy<K, V>;\r\n #hits = 0;\r\n #misses = 0;\r\n\r\n /**\r\n * @param entries Initial entries, stored with `set()`.\r\n * @param options TTL and size policy.\r\n * @throws {RangeError} On a non-positive TTL or non-integer `maxSize`.\r\n */\r\n public constructor(\r\n entries?: Iterable<readonly [K, V]> | null,\r\n options: CollectionOptions<K, V> = {},\r\n ) {\r\n super();\r\n assertTTL(options.ttl);\r\n if (\r\n options.maxSize !== undefined &&\r\n (!Number.isInteger(options.maxSize) || options.maxSize <= 0)\r\n )\r\n throw new RangeError(\"maxSize must be a positive integer.\");\r\n if (\r\n options.ttl !== undefined ||\r\n options.maxSize !== undefined ||\r\n options.slide !== undefined ||\r\n options.onEvict !== undefined\r\n )\r\n this.#policy = newPolicy(options);\r\n if (entries) for (const [key, value] of entries) this.set(key, value);\r\n }\r\n\r\n /**\r\n * Stores an entry with the default TTL (or `ttl`), marks it most recently\r\n * used, and enforces `maxSize`. Turns a `setWithoutTTL()` entry back into\r\n * a TTL/LRU entry.\r\n */\r\n public override set(key: K, value: V, ttl?: number): this {\r\n if (ttl === undefined && this.#policy === undefined)\r\n return super.set(key, value);\r\n assertTTL(ttl);\r\n const window = ttl ?? this.#policy?.ttl;\r\n if (window !== undefined) this.#policy ??= newPolicy();\r\n if (!this.#policy) return super.set(key, value);\r\n // A key that was not stored before has no policy entry.\r\n const before = super.size;\r\n super.set(key, value);\r\n this.#track(key, value, window, super.size !== before);\r\n this.#enforceCap();\r\n return this;\r\n }\r\n\r\n /**\r\n * Stores an entry that never expires: no deadline, heap record, timer or\r\n * LRU eviction. It leaves only through `delete`, `sweep`, `clear`, or a\r\n * later `set()`.\r\n */\r\n public setWithoutTTL(key: K, value: V): this {\r\n if (this.#policy) this.#forget(key);\r\n super.set(key, value);\r\n return this;\r\n }\r\n\r\n /** Reads a value; restarts a TTL entry's window and promotes it. */\r\n public override get(key: K): V | undefined {\r\n const policy = this.#policy;\r\n const entry = policy?.entries.get(key);\r\n if (entry === undefined) {\r\n const value = mapGet.call(this, key) as V | undefined;\r\n if (value !== undefined || mapHas.call(this, key)) {\r\n this.#hits++;\r\n return value;\r\n }\r\n this.#misses++;\r\n return undefined;\r\n }\r\n const timed = entry.window !== 0;\r\n const now = timed ? Date.now() : 0;\r\n if (timed && entry.deadline <= now) {\r\n this.#expire(entry);\r\n this.#misses++;\r\n return undefined;\r\n }\r\n this.#hits++;\r\n if (timed && policy!.slide) entry.deadline = now + entry.window;\r\n if (entry.inLru) this.#promote(policy!, entry);\r\n return entry.value;\r\n }\r\n\r\n /**\r\n * Returns the value for `key`, or stores and returns what `factory`\r\n * makes. Reading counts as a `get()` (restarts the TTL, marks it recently\r\n * used); creating stores with `set()`, so `ttl` applies.\r\n * @param factory Called with the key and this collection only when the key is missing; if it throws, nothing is stored.\r\n * @param ttl TTL in ms for a created entry; defaults to the collection's.\r\n */\r\n public ensure(\r\n key: K,\r\n factory: (key: K, collection: this) => V,\r\n ttl?: number,\r\n ): V {\r\n const existing = this.get(key);\r\n if (existing !== undefined || super.has(key)) return existing as V;\r\n const created = factory(key, this);\r\n this.set(key, created, ttl);\r\n return created;\r\n }\r\n\r\n /** Reads a value without restarting its TTL or promoting it. */\r\n public peek(key: K): V | undefined {\r\n if (!this.#expireIfDue(key) && super.has(key)) {\r\n this.#hits++;\r\n return super.get(key);\r\n }\r\n this.#misses++;\r\n return undefined;\r\n }\r\n\r\n /** Cumulative hit, miss, expiry and eviction counters (a copy). */\r\n public get stats(): CollectionStats {\r\n return {\r\n hits: this.#hits,\r\n misses: this.#misses,\r\n expired: this.#policy?.expired ?? 0,\r\n evicted: this.#policy?.evicted ?? 0,\r\n };\r\n }\r\n\r\n public override has(key: K): boolean {\r\n return !this.#expireIfDue(key) && super.has(key);\r\n }\r\n\r\n public override delete(key: K): boolean {\r\n if (this.#expireIfDue(key)) return false;\r\n if (this.#policy) this.#forget(key);\r\n return super.delete(key);\r\n }\r\n\r\n public override clear(): void {\r\n super.clear();\r\n const policy = this.#policy;\r\n if (!policy) return;\r\n policy.entries.clear();\r\n policy.oldest = policy.newest = undefined;\r\n policy.lruSize = 0;\r\n policy.heap.length = 0;\r\n if (policy.timer) clearTimeout(policy.timer);\r\n policy.timer = undefined;\r\n policy.armedFor = Infinity;\r\n }\r\n\r\n public override get size(): number {\r\n this.purge();\r\n return super.size;\r\n }\r\n\r\n public override entries(): MapIterator<[K, V]> {\r\n this.purge();\r\n return super.entries();\r\n }\r\n\r\n public override keys(): MapIterator<K> {\r\n this.purge();\r\n return super.keys();\r\n }\r\n\r\n public override values(): MapIterator<V> {\r\n this.purge();\r\n return super.values();\r\n }\r\n\r\n public override [Symbol.iterator](): MapIterator<[K, V]> {\r\n return this.entries();\r\n }\r\n\r\n public override forEach(\r\n callback: (value: V, key: K, map: Map<K, V>) => void,\r\n thisArg?: unknown,\r\n ): void {\r\n this.purge();\r\n super.forEach(callback, thisArg);\r\n }\r\n\r\n /** Milliseconds until a key lapses, or undefined if absent or never expiring. */\r\n public ttlRemaining(key: K): number | undefined {\r\n if (this.#expireIfDue(key)) return undefined;\r\n const entry = this.#policy?.entries.get(key);\r\n return entry && entry.window !== 0\r\n ? Math.max(0, entry.deadline - Date.now())\r\n : undefined;\r\n }\r\n\r\n /** Drops every lapsed TTL entry now. @returns How many were dropped. */\r\n public purge(): number {\r\n if (!this.#policy || this.#policy.heap.length === 0) return 0;\r\n const now = Date.now();\r\n let removed = 0;\r\n const dropped: [K, V][] = [];\r\n while (this.#nextDeadline() <= now) {\r\n const due = this.#heapPop()!;\r\n dropped.push([due.key, super.get(due.key)!]);\r\n this.#remove(due.key);\r\n removed++;\r\n }\r\n this.#policy!.expired += removed;\r\n this.#rearm();\r\n for (const [key, value] of dropped) this.#notify(key, value, \"expired\");\r\n return removed;\r\n }\r\n\r\n /** Drops `key` if its TTL has lapsed. @returns Whether it did. */\r\n #expireIfDue(key: K): boolean {\r\n const entry = this.#policy?.entries.get(key);\r\n if (!entry || entry.window === 0 || entry.deadline > Date.now())\r\n return false;\r\n this.#expire(entry);\r\n return true;\r\n }\r\n\r\n #expire(entry: Entry<K, V>): void {\r\n const value = super.get(entry.key)!;\r\n this.#remove(entry.key);\r\n this.#policy!.expired++;\r\n this.#notify(entry.key, value, \"expired\");\r\n }\r\n\r\n #remove(key: K): void {\r\n this.#forget(key);\r\n super.delete(key);\r\n }\r\n\r\n /** Drops a key's policy entry (recency position and TTL); its heap record goes stale. */\r\n #forget(key: K): void {\r\n const policy = this.#policy!;\r\n const entry = policy.entries.get(key);\r\n if (!entry) return;\r\n if (entry.inLru) this.#unlink(policy, entry);\r\n policy.entries.delete(key);\r\n }\r\n\r\n /**\r\n * Brings the key's policy entry in line with a `set()`: marks it newest\r\n * when `maxSize` is set, and gives it a deadline when `window` is defined.\r\n * Only a new entry, or a deadline that moves earlier, gets a heap record;\r\n * a later one is a number write and the record re-files itself when it\r\n * surfaces.\r\n */\r\n #track(key: K, value: V, window: number | undefined, isNew: boolean): void {\r\n const policy = this.#policy!;\r\n const lru = policy.maxSize !== undefined;\r\n let entry = isNew ? undefined : policy.entries.get(key);\r\n if (entry) entry.value = value;\r\n if (window === undefined) {\r\n if (entry && entry.window !== 0) {\r\n // It had a TTL and now has none.\r\n if (lru) entry = this.#replace(policy, entry, 0, 0);\r\n else {\r\n this.#forget(key);\r\n return;\r\n }\r\n }\r\n if (!entry && lru) {\r\n entry = this.#create(key, value, 0, 0);\r\n policy.entries.set(key, entry);\r\n }\r\n if (entry) this.#promote(policy, entry);\r\n return;\r\n }\r\n const deadline = Date.now() + window;\r\n if (entry && entry.window !== 0) {\r\n entry.deadline = deadline;\r\n entry.window = window;\r\n if (deadline < entry.filed)\r\n // The heap cannot move a record up, and this one is in it: file a fresh one.\r\n entry = this.#replace(policy, entry, window, deadline);\r\n else {\r\n if (entry.inLru) this.#promote(policy, entry);\r\n return;\r\n }\r\n } else if (entry) {\r\n entry.window = window;\r\n entry.deadline = entry.filed = deadline;\r\n } else {\r\n entry = this.#create(key, value, window, deadline);\r\n policy.entries.set(key, entry);\r\n }\r\n if (lru) this.#promote(policy, entry);\r\n this.#heapPush(entry);\r\n if (policy.heap.length > 2 * policy.entries.size + 8) this.#compact();\r\n // A timer already armed for an earlier deadline stays correct.\r\n if (policy.timer === undefined || deadline < policy.armedFor)\r\n this.#rearm();\r\n }\r\n\r\n #create(key: K, value: V, window: number, deadline: number): Entry<K, V> {\r\n return {\r\n key,\r\n value,\r\n older: undefined,\r\n newer: undefined,\r\n inLru: false,\r\n window,\r\n deadline,\r\n filed: deadline,\r\n };\r\n }\r\n\r\n /** Swaps in a fresh record for `old` (which goes stale), keeping its recency position. */\r\n #replace(\r\n policy: Policy<K, V>,\r\n old: Entry<K, V>,\r\n window: number,\r\n deadline: number,\r\n ): Entry<K, V> {\r\n const entry: Entry<K, V> = {\r\n ...old,\r\n window,\r\n deadline,\r\n filed: deadline,\r\n };\r\n if (old.inLru) {\r\n if (old.older) old.older.newer = entry;\r\n else policy.oldest = entry;\r\n if (old.newer) old.newer.older = entry;\r\n else policy.newest = entry;\r\n }\r\n policy.entries.set(old.key, entry);\r\n return entry;\r\n }\r\n\r\n /** Makes an entry the newest in recency order, linking it first if needed. */\r\n #promote(policy: Policy<K, V>, entry: Entry<K, V>): void {\r\n if (entry === policy.newest) return;\r\n if (entry.inLru) this.#unlink(policy, entry, true);\r\n else {\r\n entry.inLru = true;\r\n policy.lruSize++;\r\n }\r\n entry.older = policy.newest;\r\n entry.newer = undefined;\r\n if (policy.newest) policy.newest.newer = entry;\r\n else policy.oldest = entry;\r\n policy.newest = entry;\r\n }\r\n\r\n /** Takes an entry out of the recency list; `keepCount` is for a move within it. */\r\n #unlink(policy: Policy<K, V>, entry: Entry<K, V>, keepCount = false): void {\r\n if (entry.older) entry.older.newer = entry.newer;\r\n else policy.oldest = entry.newer;\r\n if (entry.newer) entry.newer.older = entry.older;\r\n else policy.newest = entry.older;\r\n entry.older = entry.newer = undefined;\r\n if (!keepCount) {\r\n entry.inLru = false;\r\n policy.lruSize--;\r\n }\r\n }\r\n\r\n /**\r\n * An empty collection of the species this one derives, so `filter()` and\r\n * friends on a subclass return the subclass. It is built without\r\n * arguments and carries no `ttl` or `maxSize`.\r\n */\r\n #derived(): this {\r\n const Species =\r\n (\r\n this.constructor as {\r\n [Symbol.species]?: new () => Collection<K, V>;\r\n }\r\n )[Symbol.species] ?? Collection;\r\n return new Species() as this;\r\n }\r\n\r\n #notify(key: K, value: V, reason: EvictionReason): void {\r\n const onEvict = this.#policy?.onEvict;\r\n if (!onEvict) return;\r\n try {\r\n onEvict(key, value, reason);\r\n } catch {\r\n // A throwing callback must not leave the collection inconsistent.\r\n }\r\n }\r\n\r\n /** Evicts least-recently-used `set()` entries past `maxSize`; O(1) per eviction. */\r\n #enforceCap(): void {\r\n const policy = this.#policy!;\r\n const max = policy.maxSize;\r\n if (max === undefined) return;\r\n // Lapsed entries must not push live ones out.\r\n if (\r\n policy.lruSize > max &&\r\n policy.heap.length > 0 &&\r\n policy.heap[0]!.filed <= Date.now()\r\n )\r\n this.purge();\r\n while (policy.lruSize > max) {\r\n const oldest = policy.oldest!;\r\n const value = policy.onEvict ? super.get(oldest.key) : undefined;\r\n this.#unlink(policy, oldest);\r\n policy.entries.delete(oldest.key);\r\n super.delete(oldest.key);\r\n policy.evicted++;\r\n this.#notify(oldest.key, value as V, \"evicted\");\r\n }\r\n }\r\n\r\n #nextDeadline(): number {\r\n const policy = this.#policy!;\r\n for (;;) {\r\n const top = policy.heap[0];\r\n if (top === undefined) return Infinity;\r\n if (policy.entries.get(top.key) !== top) {\r\n this.#heapPop();\r\n continue;\r\n }\r\n if (top.deadline === top.filed) return top.filed;\r\n // Extended since it was filed: re-file for its current deadline.\r\n this.#heapPop();\r\n top.filed = top.deadline;\r\n this.#heapPush(top);\r\n }\r\n }\r\n\r\n #compact(): void {\r\n const policy = this.#policy!;\r\n const live = policy.heap.filter(\r\n (entry) => policy.entries.get(entry.key) === entry,\r\n );\r\n policy.heap.length = 0;\r\n for (const entry of live) this.#heapPush(entry);\r\n }\r\n\r\n #rearm(): void {\r\n const p = this.#policy!;\r\n const deadline = this.#nextDeadline();\r\n if (p.timer !== undefined && deadline >= p.armedFor) return;\r\n if (p.timer) clearTimeout(p.timer);\r\n p.timer = undefined;\r\n p.armedFor = deadline;\r\n if (deadline === Infinity) return;\r\n p.timer = setTimeout(\r\n () => {\r\n p.timer = undefined;\r\n p.armedFor = Infinity;\r\n this.purge();\r\n },\r\n Math.max(0, deadline - Date.now()),\r\n );\r\n // Pending expiry is housekeeping, not a reason to keep the process alive.\r\n (p.timer as { unref?: () => void }).unref?.();\r\n }\r\n\r\n #heapPush(entry: Entry<K, V>): void {\r\n const heap = this.#policy!.heap;\r\n let i = heap.length;\r\n heap.push(entry);\r\n while (i > 0) {\r\n const parent = (i - 1) >> 1;\r\n const above = heap[parent]!;\r\n if (above.filed <= entry.filed) break;\r\n heap[i] = above;\r\n i = parent;\r\n }\r\n heap[i] = entry;\r\n }\r\n\r\n #heapPop(): Entry<K, V> | undefined {\r\n const heap = this.#policy!.heap;\r\n const top = heap[0];\r\n const last = heap.pop();\r\n if (top === undefined || heap.length === 0) return top;\r\n let i = 0;\r\n for (;;) {\r\n let child = 2 * i + 1;\r\n if (child >= heap.length) break;\r\n if (\r\n child + 1 < heap.length &&\r\n heap[child + 1]!.filed < heap[child]!.filed\r\n )\r\n child++;\r\n if (heap[child]!.filed >= last!.filed) break;\r\n heap[i] = heap[child]!;\r\n i = child;\r\n }\r\n heap[i] = last!;\r\n return top;\r\n }\r\n\r\n /** Returns the first stored value. */\r\n public first(): V | undefined {\r\n for (const value of this.values()) return value;\r\n return undefined;\r\n }\r\n /** Returns the first stored key. */\r\n public firstKey(): K | undefined {\r\n for (const key of this.keys()) return key;\r\n return undefined;\r\n }\r\n /** Returns the last stored value. */\r\n public last(): V | undefined {\r\n let value: V | undefined;\r\n for (const item of this.values()) value = item;\r\n return value;\r\n }\r\n /** Returns the last stored key. */\r\n public lastKey(): K | undefined {\r\n let key: K | undefined;\r\n for (const item of this.keys()) key = item;\r\n return key;\r\n }\r\n /** Finds the first value matching a predicate. */\r\n public find(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): V | undefined {\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this)) return value;\r\n }\r\n return undefined;\r\n }\r\n /** Finds the last value (in insertion order) matching a predicate. */\r\n public findLast(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): V | undefined {\r\n const entries = [...this];\r\n for (let i = entries.length - 1; i >= 0; i--) {\r\n const [key, value] = entries[i]!;\r\n if (predicate(value, key, this)) return value;\r\n }\r\n return undefined;\r\n }\r\n /** Finds the key of the last entry (in insertion order) matching a predicate. */\r\n public findLastKey(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): K | undefined {\r\n const entries = [...this];\r\n for (let i = entries.length - 1; i >= 0; i--) {\r\n const [key, value] = entries[i]!;\r\n if (predicate(value, key, this)) return key;\r\n }\r\n return undefined;\r\n }\r\n /** Returns all values matching a predicate. */\r\n public filter(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): this {\r\n const result = this.#derived();\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this)) result.set(key, value);\r\n }\r\n return result;\r\n }\r\n /** Transforms every stored value into an array. */\r\n public map<T>(transform: (value: V, key: K, collection: this) => T): T[] {\r\n const result: T[] = [];\r\n for (const [key, value] of this) {\r\n result.push(transform(value, key, this));\r\n }\r\n return result;\r\n }\r\n /** Returns whether at least one stored value satisfies a predicate. */\r\n public some(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): boolean {\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this)) return true;\r\n }\r\n return false;\r\n }\r\n /** Returns whether every stored value satisfies a predicate. */\r\n public every(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): boolean {\r\n for (const [key, value] of this) {\r\n if (!predicate(value, key, this)) return false;\r\n }\r\n return true;\r\n }\r\n /** Runs a callback for each stored value. */\r\n public each(\r\n callback: (value: V, key: K, collection: this) => unknown,\r\n ): this {\r\n for (const [key, value] of this) {\r\n callback(value, key, this);\r\n }\r\n return this;\r\n }\r\n /** Returns an array containing all stored values. */\r\n public array(): V[] {\r\n return [...this.values()];\r\n }\r\n /** Returns an array containing all stored keys. */\r\n public keyArray(): K[] {\r\n return [...this.keys()];\r\n }\r\n /** Returns a plain array of entries. */\r\n public entriesArray(): [K, V][] {\r\n return [...this.entries()];\r\n }\r\n /** Returns a new collection with the same entries. */\r\n public clone(): this {\r\n const copy = this.#derived();\r\n for (const [key, value] of this) copy.set(key, value);\r\n return copy;\r\n }\r\n /** Returns whether all supplied keys are present. */\r\n public hasAll(...keys: K[]): boolean {\r\n for (let i = 0; i < keys.length; i++) {\r\n if (!this.has(keys[i]!)) return false;\r\n }\r\n return true;\r\n }\r\n /** Returns whether at least one supplied key is present. */\r\n public hasAny(...keys: K[]): boolean {\r\n for (let i = 0; i < keys.length; i++) {\r\n if (this.has(keys[i]!)) return true;\r\n }\r\n return false;\r\n }\r\n /** Returns the first key whose value matches a predicate. */\r\n public findKey(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): K | undefined {\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this)) return key;\r\n }\r\n return undefined;\r\n }\r\n /** Returns whether a predicate matches at least one entry. */\r\n public someEntry(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): boolean {\r\n return this.some(predicate);\r\n }\r\n /** Removes every entry matching a predicate and returns the number removed. */\r\n public sweep(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): number {\r\n let removed = 0;\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this) && this.delete(key)) removed++;\r\n }\r\n return removed;\r\n }\r\n /** Returns the collection's first matching entry as a tuple. */\r\n public firstEntry(): [K, V] | undefined {\r\n for (const [key, value] of this) return [key, value];\r\n return undefined;\r\n }\r\n /** Returns the collection's last matching entry as a tuple. */\r\n public lastEntry(): [K, V] | undefined {\r\n let entry: [K, V] | undefined;\r\n for (const item of this) entry = [item[0], item[1]];\r\n return entry;\r\n }\r\n /** Returns a new Collection containing elements from both collections. */\r\n public union(other: ReadonlyCollection<K, V>): this {\r\n const result = this.clone();\r\n for (const [key, value] of other) result.set(key, value);\r\n return result;\r\n }\r\n /** Returns a new Collection containing only elements present in both collections. */\r\n public intersection(other: ReadonlyCollection<K, V>): this {\r\n const result = this.#derived();\r\n for (const [key, value] of this) {\r\n if (other.has(key)) result.set(key, value);\r\n }\r\n return result;\r\n }\r\n /** Returns a new Collection containing elements present in this collection but not the other. */\r\n public difference(other: ReadonlyCollection<K, V>): this {\r\n const result = this.#derived();\r\n for (const [key, value] of this) {\r\n if (!other.has(key)) result.set(key, value);\r\n }\r\n return result;\r\n }\r\n /** Splits the collection into two collections based on a predicate.\r\n * @returns `[passing, failing]` — entries satisfying the predicate, then those that don't.\r\n */\r\n public partition(\r\n predicate: (value: V, key: K, collection: this) => boolean,\r\n ): [this, this] {\r\n const pass = this.#derived();\r\n const fail = this.#derived();\r\n for (const [key, value] of this) {\r\n if (predicate(value, key, this)) pass.set(key, value);\r\n else fail.set(key, value);\r\n }\r\n return [pass, fail];\r\n }\r\n /** Returns the entries of both collections that are in only one of them. */\r\n public symmetricDifference(other: ReadonlyCollection<K, V>): this {\r\n const result = this.#derived();\r\n for (const [key, value] of this)\r\n if (!other.has(key)) result.set(key, value);\r\n for (const [key, value] of other)\r\n if (!this.has(key)) result.set(key, value);\r\n return result;\r\n }\r\n /** Returns a new Collection with this one's entries followed by each of `collections`'; a later collection wins a shared key. */\r\n public concat(...collections: ReadonlyCollection<K, V>[]): this {\r\n const result = this.clone();\r\n for (const collection of collections)\r\n for (const [key, value] of collection) result.set(key, value);\r\n return result;\r\n }\r\n /**\r\n * Combines this collection with `other`, deciding per key what to keep.\r\n * @param whenInSelf Called for a key only in this collection.\r\n * @param whenInOther Called for a key only in `other`.\r\n * @param whenInBoth Called for a key in both.\r\n * @returns A new collection of the entries the callbacks kept, in this collection's order, then `other`'s new keys.\r\n */\r\n public merge<T, R>(\r\n other: ReadonlyCollection<K, T>,\r\n whenInSelf: (value: V, key: K) => Keep<R>,\r\n whenInOther: (valueOther: T, key: K) => Keep<R>,\r\n whenInBoth: (value: V, valueOther: T, key: K) => Keep<R>,\r\n ): Collection<K, R> {\r\n const result = this.#derived() as unknown as Collection<K, R>;\r\n const decide = (key: K, kept: Keep<R>): void => {\r\n if (kept.keep) result.set(key, kept.value);\r\n };\r\n for (const [key, value] of this) {\r\n decide(\r\n key,\r\n other.has(key)\r\n ? whenInBoth(value, peekOf(other, key) as T, key)\r\n : whenInSelf(value, key),\r\n );\r\n }\r\n for (const [key, value] of other)\r\n if (!this.has(key)) decide(key, whenInOther(value, key));\r\n return result;\r\n }\r\n /** Returns whether `other` holds the same keys with `===` equal values. Neither side's TTL or recency is touched. */\r\n public equals(other: ReadonlyCollection<K, V> | null | undefined): boolean {\r\n if (!other) return false;\r\n if (other === (this as unknown)) return true;\r\n if (this.size !== other.size) return false;\r\n for (const [key, value] of this) {\r\n if (!other.has(key)) return false;\r\n if (value !== peekOf(other, key)) return false;\r\n }\r\n return true;\r\n }\r\n /** Returns a new collection with the same keys and each value passed through `transform`. */\r\n public mapValues<T>(\r\n transform: (value: V, key: K, collection: this) => T,\r\n ): Collection<K, T> {\r\n const result = this.#derived() as unknown as Collection<K, T>;\r\n for (const [key, value] of this)\r\n result.set(key, transform(value, key, this));\r\n return result;\r\n }\r\n /** Returns a new collection with the entries in reverse order. */\r\n public toReversed(): this {\r\n const result = this.#derived();\r\n const entries = [...this];\r\n for (let i = entries.length - 1; i >= 0; i--)\r\n result.set(entries[i]![0], entries[i]![1]);\r\n return result;\r\n }\r\n /** Same as {@link sorted}, under the name the standard `Array` uses. */\r\n public toSorted(\r\n comparator?: (a: V, b: V, aKey: K, bKey: K) => number,\r\n ): this {\r\n return this.sorted(comparator);\r\n }\r\n /**\r\n * Groups `items` by the key `keySelector` returns for each.\r\n * @param keySelector Called with each item and its index.\r\n * @returns A new collection from each key to its items, in input order.\r\n */\r\n public static override groupBy<K, V>(\r\n items: Iterable<V>,\r\n keySelector: (item: V, index: number) => K,\r\n ): Collection<K, V[]> {\r\n const groups = new Collection<K, V[]>();\r\n let index = 0;\r\n for (const item of items)\r\n groups.ensure(keySelector(item, index++), () => []).push(item);\r\n return groups;\r\n }\r\n /**\r\n * Builds a collection from `entries`, merging values that share a key.\r\n * @param combine Called with the value stored so far, the new one and the key; its result is stored.\r\n */\r\n public static combineEntries<K, V>(\r\n entries: Iterable<readonly [K, V]>,\r\n combine: (firstValue: V, secondValue: V, key: K) => V,\r\n ): Collection<K, V> {\r\n const result = new Collection<K, V>();\r\n for (const [key, value] of entries)\r\n result.set(\r\n key,\r\n result.has(key) ? combine(result.get(key)!, value, key) : value,\r\n );\r\n return result;\r\n }\r\n /** Calls `fn` with this collection and returns the collection unchanged.\r\n * Useful for inserting debug side-effects in a chain without breaking the flow.\r\n */\r\n public tap(fn: (collection: this) => unknown): this {\r\n fn(this);\r\n return this;\r\n }\r\n /** Maps every entry to an array of items and flattens the results. */\r\n public flatMap<T>(\r\n transform: (value: V, key: K, collection: this) => T[],\r\n ): T[] {\r\n const result: T[] = [];\r\n for (const [key, value] of this) {\r\n for (const item of transform(value, key, this)) result.push(item);\r\n }\r\n return result;\r\n }\r\n /** Reduces the collection to a single value. */\r\n public reduce<T>(\r\n fn: (accumulator: T, value: V, key: K, collection: this) => T,\r\n initialValue: T,\r\n ): T {\r\n let acc = initialValue;\r\n for (const [key, value] of this) acc = fn(acc, value, key, this);\r\n return acc;\r\n }\r\n /** Like {@link reduce}, but from the last entry to the first. */\r\n public reduceRight<T>(\r\n fn: (accumulator: T, value: V, key: K, collection: this) => T,\r\n initialValue: T,\r\n ): T {\r\n const entries = [...this];\r\n let acc = initialValue;\r\n for (let i = entries.length - 1; i >= 0; i--)\r\n acc = fn(acc, entries[i]![1], entries[i]![0], this);\r\n return acc;\r\n }\r\n /** Returns a new Collection with entries sorted by comparator (non-mutating).\r\n * Defaults to insertion order if no comparator is provided.\r\n */\r\n public sorted(comparator?: (a: V, b: V, aKey: K, bKey: K) => number): this {\r\n // Decorate with the original insertion index and use it as a tiebreaker so\r\n // equal elements keep their insertion order (a stable sort independent of\r\n // the engine's Array.prototype.sort stability guarantees).\r\n const decorated = [...this.entries()].map((entry, index) => ({\r\n entry,\r\n index,\r\n }));\r\n if (comparator)\r\n decorated.sort((x, y) => {\r\n const comparison = comparator(\r\n x.entry[1],\r\n y.entry[1],\r\n x.entry[0],\r\n y.entry[0],\r\n );\r\n return comparison !== 0 ? comparison : x.index - y.index;\r\n });\r\n const result = this.#derived();\r\n for (const { entry } of decorated) result.set(entry[0], entry[1]);\r\n return result;\r\n }\r\n /**\r\n * Returns a random value, or `undefined` if empty. With `amount`, returns\r\n * that many different values (all of them, shuffled, when `amount` is at\r\n * least the size).\r\n * Uses `Math.random()` (fast, non-cryptographic): do not use it for\r\n * security-sensitive selection such as tokens or secrets.\r\n * @param amount How many values to pick.\r\n * @throws {RangeError} If `amount` is not a non-negative integer.\r\n */\r\n public random(): V | undefined;\r\n public random(amount: number): V[];\r\n public random(amount?: number): V | V[] | undefined {\r\n if (amount !== undefined) return sample([...this.values()], amount);\r\n const size = this.size;\r\n if (size === 0) return undefined;\r\n let index = Math.floor(Math.random() * size);\r\n for (const value of this.values()) if (index-- === 0) return value;\r\n return undefined;\r\n }\r\n /**\r\n * Returns a random key, or `undefined` if empty. With `amount`, returns\r\n * that many different keys. Same randomness and errors as {@link random}.\r\n * @param amount How many keys to pick.\r\n */\r\n public randomKey(): K | undefined;\r\n public randomKey(amount: number): K[];\r\n public randomKey(amount?: number): K | K[] | undefined {\r\n if (amount !== undefined) return sample([...this.keys()], amount);\r\n const size = this.size;\r\n if (size === 0) return undefined;\r\n let index = Math.floor(Math.random() * size);\r\n for (const key of this.keys()) if (index-- === 0) return key;\r\n return undefined;\r\n }\r\n /** Returns the value at a given insertion-order index (supports negative indices). */\r\n public at(index: number): V | undefined {\r\n const arr = [...this.values()];\r\n const i = index < 0 ? arr.length + index : index;\r\n return arr[i];\r\n }\r\n /** Returns the key at a given insertion-order index (supports negative indices). */\r\n public keyAt(index: number): K | undefined {\r\n const arr = [...this.keys()];\r\n const i = index < 0 ? arr.length + index : index;\r\n return arr[i];\r\n }\r\n /** Serializes the collection to a plain `[key, value]` array. */\r\n public toJSON(): [K, V][] {\r\n return [...this.entries()];\r\n }\r\n}\r\n\r\nexport { Cache } from \"./cache.js\";\r\nexport type { CacheOptions } from \"./cache.js\";\r\n"
7
7
  ],
8
- "mappings": ";;AAeO,MAAM,MAAY;AAAA,EACZ,WAAW,IAAI;AAAA,EACf;AAAA,EACA;AAAA,EACT;AAAA,EAGO,WAAW,CAAC,UAAwB,CAAC,GAAG;AAAA,IAC3C,KAAK,WAAW,QAAQ,WAAW;AAAA,IACnC,KAAK,OAAO,QAAQ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I;AAAA,IAC3C,WAAW,SAAS,KAAK,OAAO;AAAA,MAAG,IAAI,YAAY;AAAA,QAAG,OAAO;AAAA,IAC7D;AAAA;AAAA,EASG,SAAS,CAAC,QAAsC;AAAA,IACnD,IAAI,WAAW;AAAA,MAAW,OAAO,OAAO,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,MAAM;AAAA,IAChE,MAAM,OAAO,KAAK;AAAA,IAClB,IAAI,SAAS;AAAA,MAAG;AAAA,IAChB,IAAI,QAAQ,KAAK,MAAM,KAAK,OAAO,IAAI,IAAI;AAAA,IAC3C,WAAW,OAAO,KAAK,KAAK;AAAA,MAAG,IAAI,YAAY;AAAA,QAAG,OAAO;AAAA,IACzD;AAAA;AAAA,EAGG,EAAE,CAAC,OAA8B;AAAA,IACpC,MAAM,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC;AAAA,IAC7B,MAAM,IAAI,QAAQ,IAAI,IAAI,SAAS,QAAQ;AAAA,IAC3C,OAAO,IAAI;AAAA;AAAA,EAGR,KAAK,CAAC,OAA8B;AAAA,IACvC,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC;AAAA,IAC3B,MAAM,IAAI,QAAQ,IAAI,IAAI,SAAS,QAAQ;AAAA,IAC3C,OAAO,IAAI;AAAA;AAAA,EAGR,MAAM,GAAa;AAAA,IACtB,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC;AAAA;AAEjC;",
9
+ "debugId": "72EF4AA34379CD3464756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -20,6 +20,8 @@ declare class EventEmitter<Events extends {
20
20
  [K in keyof Events]: unknown[];
21
21
  }> {
22
22
  #private;
23
+ /** Removes secrets from text this emitter prints; the client removes its token. */
24
+ protected readonly redactSecrets: (text: string) => string;
23
25
  on<K extends keyof Events>(event: K, listener: Listener<Events[K]>): this;
24
26
  once<K extends keyof Events>(event: K, listener: Listener<Events[K]>): this;
25
27
  off<K extends keyof Events>(event: K, listener: Listener<Events[K]>): this;
@@ -52,6 +54,8 @@ export declare class Client extends EventEmitter<ClientEvents> implements Intera
52
54
  * The bot token this client is authenticated with, or `null` once the
53
55
  * client has been destroyed. Mirrors `Client#token` in Discord.js.
54
56
  */
57
+ /** Replaces the bot token in text Lunibee prints (listener warnings). */
58
+ protected readonly redactSecrets: (text: string) => string;
55
59
  get token(): string | null;
56
60
  get uptime(): number | null;
57
61
  get ping(): number;
@@ -82,6 +86,10 @@ export declare class Client extends EventEmitter<ClientEvents> implements Intera
82
86
  permissionsFor(memberId: string, guildOrChannelId: string): PermissionSet | null;
83
87
  /** Fetches Discord's default soundboard sounds. */
84
88
  fetchDefaultSoundboardSounds(): Promise<APISoundboardSound[]>;
89
+ /**
90
+ * Connects to the Gateway. Resolves with the token used, like discord.js;
91
+ * do not log the return value.
92
+ */
85
93
  login(token?: string): Promise<string>;
86
94
  /**
87
95
  * Destroys the client, permanently closing the Gateway connection.