@ensnode/ensnode-sdk 0.0.0-next-20260521165711 → 0.0.0-next-20260521211251

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4711,6 +4711,30 @@ var SWRCache = class {
4711
4711
  }
4712
4712
  return this.cache.result;
4713
4713
  }
4714
+ /**
4715
+ * Synchronously returns the most recently cached result without triggering revalidation.
4716
+ *
4717
+ * Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
4718
+ * returns whatever value is already in memory. Use this when you need a best-effort
4719
+ * snapshot of the cached value and can tolerate stale data.
4720
+ *
4721
+ * @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
4722
+ * @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
4723
+ * and `proactivelyInitialize` was not set to `true`).
4724
+ *
4725
+ * @example
4726
+ * ```ts
4727
+ * // Ensure cache is initialized first
4728
+ * await cache.read();
4729
+ *
4730
+ * // Later, peek synchronously without triggering revalidation
4731
+ * const result = cache.peek();
4732
+ * ```
4733
+ */
4734
+ peek() {
4735
+ if (!this.cache) throw new Error("Cache is not initialized yet");
4736
+ return this.cache.result;
4737
+ }
4714
4738
  /**
4715
4739
  * Destroys the background revalidation interval, if exists.
4716
4740
  */