@ensnode/ensnode-sdk 1.14.0 → 1.15.1
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 +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +173 -26
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +21 -1
- package/dist/internal.d.ts +21 -1
- package/dist/internal.js +173 -26
- package/dist/internal.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -3475,6 +3475,27 @@ declare class SWRCache<ValueType> {
|
|
|
3475
3475
|
* has never successfully returned.
|
|
3476
3476
|
*/
|
|
3477
3477
|
read(): Promise<ValueType | Error>;
|
|
3478
|
+
/**
|
|
3479
|
+
* Synchronously returns the most recently cached result without triggering revalidation.
|
|
3480
|
+
*
|
|
3481
|
+
* Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
|
|
3482
|
+
* returns whatever value is already in memory. Use this when you need a best-effort
|
|
3483
|
+
* snapshot of the cached value and can tolerate stale data.
|
|
3484
|
+
*
|
|
3485
|
+
* @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
|
|
3486
|
+
* @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
|
|
3487
|
+
* and `proactivelyInitialize` was not set to `true`).
|
|
3488
|
+
*
|
|
3489
|
+
* @example
|
|
3490
|
+
* ```ts
|
|
3491
|
+
* // Ensure cache is initialized first
|
|
3492
|
+
* await cache.read();
|
|
3493
|
+
*
|
|
3494
|
+
* // Later, peek synchronously without triggering revalidation
|
|
3495
|
+
* const result = cache.peek();
|
|
3496
|
+
* ```
|
|
3497
|
+
*/
|
|
3498
|
+
peek(): ValueType | Error;
|
|
3478
3499
|
/**
|
|
3479
3500
|
* Destroys the background revalidation interval, if exists.
|
|
3480
3501
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -3475,6 +3475,27 @@ declare class SWRCache<ValueType> {
|
|
|
3475
3475
|
* has never successfully returned.
|
|
3476
3476
|
*/
|
|
3477
3477
|
read(): Promise<ValueType | Error>;
|
|
3478
|
+
/**
|
|
3479
|
+
* Synchronously returns the most recently cached result without triggering revalidation.
|
|
3480
|
+
*
|
|
3481
|
+
* Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
|
|
3482
|
+
* returns whatever value is already in memory. Use this when you need a best-effort
|
|
3483
|
+
* snapshot of the cached value and can tolerate stale data.
|
|
3484
|
+
*
|
|
3485
|
+
* @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
|
|
3486
|
+
* @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
|
|
3487
|
+
* and `proactivelyInitialize` was not set to `true`).
|
|
3488
|
+
*
|
|
3489
|
+
* @example
|
|
3490
|
+
* ```ts
|
|
3491
|
+
* // Ensure cache is initialized first
|
|
3492
|
+
* await cache.read();
|
|
3493
|
+
*
|
|
3494
|
+
* // Later, peek synchronously without triggering revalidation
|
|
3495
|
+
* const result = cache.peek();
|
|
3496
|
+
* ```
|
|
3497
|
+
*/
|
|
3498
|
+
peek(): ValueType | Error;
|
|
3478
3499
|
/**
|
|
3479
3500
|
* Destroys the background revalidation interval, if exists.
|
|
3480
3501
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4440,6 +4440,30 @@ var SWRCache = class {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
return this.cache.result;
|
|
4442
4442
|
}
|
|
4443
|
+
/**
|
|
4444
|
+
* Synchronously returns the most recently cached result without triggering revalidation.
|
|
4445
|
+
*
|
|
4446
|
+
* Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
|
|
4447
|
+
* returns whatever value is already in memory. Use this when you need a best-effort
|
|
4448
|
+
* snapshot of the cached value and can tolerate stale data.
|
|
4449
|
+
*
|
|
4450
|
+
* @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
|
|
4451
|
+
* @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
|
|
4452
|
+
* and `proactivelyInitialize` was not set to `true`).
|
|
4453
|
+
*
|
|
4454
|
+
* @example
|
|
4455
|
+
* ```ts
|
|
4456
|
+
* // Ensure cache is initialized first
|
|
4457
|
+
* await cache.read();
|
|
4458
|
+
*
|
|
4459
|
+
* // Later, peek synchronously without triggering revalidation
|
|
4460
|
+
* const result = cache.peek();
|
|
4461
|
+
* ```
|
|
4462
|
+
*/
|
|
4463
|
+
peek() {
|
|
4464
|
+
if (!this.cache) throw new Error("Cache is not initialized yet");
|
|
4465
|
+
return this.cache.result;
|
|
4466
|
+
}
|
|
4443
4467
|
/**
|
|
4444
4468
|
* Destroys the background revalidation interval, if exists.
|
|
4445
4469
|
*/
|