poe-code 4.0.56 → 4.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "4.0.56",
3
+ "version": "4.0.57",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,10 +4,13 @@ export async function resolveData(bundledData, config, deps, options) {
4
4
  if (!Number.isFinite(config.freshTtl) || config.freshTtl < 0) {
5
5
  throw new Error("freshTtl must be a finite non-negative number");
6
6
  }
7
+ if (!Number.isFinite(config.staleTtl) || config.staleTtl < 0) {
8
+ throw new Error("staleTtl must be a finite non-negative number");
9
+ }
7
10
  const { forceRefresh, offline, preferOffline } = options ?? {};
8
11
  if (!forceRefresh) {
9
12
  const memoryCached = deps.memoryCache.get(config.cacheName);
10
- if (memoryCached) {
13
+ if (memoryCached && Date.now() - memoryCached.timestamp <= config.staleTtl) {
11
14
  const isStale = Date.now() - memoryCached.timestamp > config.freshTtl;
12
15
  if (isStale && deps.revalidator && !offline && !preferOffline) {
13
16
  deps.revalidator.trigger(config.cacheName, async () => {