@leejpsd/nextjs-cache-handler 0.4.1 → 1.0.0

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.
@@ -1,4 +1,4 @@
1
- import { e as MetricEventType } from '../types-C1vJ_sED.cjs';
1
+ import { e as MetricEventType } from '../types-YbDAllyp.cjs';
2
2
 
3
3
  /**
4
4
  * Process-local metric counters with an optional emit hook.
@@ -1,4 +1,4 @@
1
- import { e as MetricEventType } from '../types-C1vJ_sED.js';
1
+ import { e as MetricEventType } from '../types-YbDAllyp.js';
2
2
 
3
3
  /**
4
4
  * Process-local metric counters with an optional emit hook.
@@ -1,4 +1,4 @@
1
- import { M as MetricEmitter } from '../types-C1vJ_sED.cjs';
1
+ import { M as MetricEmitter } from '../types-YbDAllyp.cjs';
2
2
 
3
3
  /**
4
4
  * Built-in OpenTelemetry metric emitter.
@@ -1,4 +1,4 @@
1
- import { M as MetricEmitter } from '../types-C1vJ_sED.js';
1
+ import { M as MetricEmitter } from '../types-YbDAllyp.js';
2
2
 
3
3
  /**
4
4
  * Built-in OpenTelemetry metric emitter.
@@ -1,4 +1,4 @@
1
- import { b as RedisClientFactory, a as RedisClientConfig, L as Logger } from '../types-C1vJ_sED.cjs';
1
+ import { b as RedisClientFactory, a as RedisClientConfig, L as Logger } from '../types-YbDAllyp.cjs';
2
2
 
3
3
  /**
4
4
  * Build-output cache seeding.
@@ -1,4 +1,4 @@
1
- import { b as RedisClientFactory, a as RedisClientConfig, L as Logger } from '../types-C1vJ_sED.js';
1
+ import { b as RedisClientFactory, a as RedisClientConfig, L as Logger } from '../types-YbDAllyp.js';
2
2
 
3
3
  /**
4
4
  * Build-output cache seeding.
@@ -1,5 +1,5 @@
1
1
  import { Cluster, Redis } from 'ioredis';
2
- import { R as RedisClientLike, a as RedisClientConfig } from '../../types-C1vJ_sED.cjs';
2
+ import { R as RedisClientLike, a as RedisClientConfig } from '../../types-YbDAllyp.cjs';
3
3
 
4
4
  /**
5
5
  * Adapter for `ioredis` (and `ioredis.Cluster`).
@@ -1,5 +1,5 @@
1
1
  import { Cluster, Redis } from 'ioredis';
2
- import { R as RedisClientLike, a as RedisClientConfig } from '../../types-C1vJ_sED.js';
2
+ import { R as RedisClientLike, a as RedisClientConfig } from '../../types-YbDAllyp.js';
3
3
 
4
4
  /**
5
5
  * Adapter for `ioredis` (and `ioredis.Cluster`).
@@ -1,5 +1,5 @@
1
1
  import { RedisClientType } from 'redis';
2
- import { R as RedisClientLike, a as RedisClientConfig } from '../../types-C1vJ_sED.cjs';
2
+ import { R as RedisClientLike, a as RedisClientConfig } from '../../types-YbDAllyp.cjs';
3
3
 
4
4
  /**
5
5
  * Adapter for `redis@5` (the official `node-redis` client).
@@ -1,5 +1,5 @@
1
1
  import { RedisClientType } from 'redis';
2
- import { R as RedisClientLike, a as RedisClientConfig } from '../../types-C1vJ_sED.js';
2
+ import { R as RedisClientLike, a as RedisClientConfig } from '../../types-YbDAllyp.js';
3
3
 
4
4
  /**
5
5
  * Adapter for `redis@5` (the official `node-redis` client).
@@ -105,7 +105,7 @@ type FallbackStrategy = "auto" | "always" | "never";
105
105
  * Optional — when not provided, only the process-local counters in
106
106
  * `src/shared/metrics.ts` are updated.
107
107
  */
108
- type MetricEventType = "cache.hit" | "cache.miss" | "cache.get.deduped" | "cache.stale" | "cache.stale.refresh.leader" | "cache.stale.refresh.follower" | "cache.set" | "cache.set.failed" | "tag.invalidate.soft" | "tag.invalidate.hard" | "tag.expiration.read" | "redis.connect.failed" | "redis.timeout" | "fallback.activated" | "build_phase.skip";
108
+ type MetricEventType = "cache.hit" | "cache.miss" | "cache.get.deduped" | "cache.stale" | "cache.stale.refresh.leader" | "cache.stale.refresh.follower" | "cache.set" | "cache.set.failed" | "cache.set.skipped" | "tag.invalidate.soft" | "tag.invalidate.hard" | "tag.expiration.read" | "redis.connect.failed" | "redis.timeout" | "fallback.activated" | "build_phase.skip";
109
109
  interface MetricEvent {
110
110
  type: MetricEventType;
111
111
  /** Operation latency in milliseconds, when measurable. */
@@ -188,6 +188,12 @@ interface CacheHandlerOptions {
188
188
  *
189
189
  * Default: `true`. Set to `false` to revert to "expire on revalidate" behavior.
190
190
  */
191
+ /**
192
+ * Governs TIME-based staleness only (serve-stale within revalidate..expire).
193
+ * Since 0.4.2 tag invalidation ignores this option: soft (profile-based)
194
+ * invalidations always serve-while-revalidating and hard ones always miss —
195
+ * that split is the upstream contract, not a handler feature.
196
+ */
191
197
  staleWhileRevalidate?: boolean;
192
198
  /**
193
199
  * Push-based cross-instance tag propagation (plural handler only).
@@ -105,7 +105,7 @@ type FallbackStrategy = "auto" | "always" | "never";
105
105
  * Optional — when not provided, only the process-local counters in
106
106
  * `src/shared/metrics.ts` are updated.
107
107
  */
108
- type MetricEventType = "cache.hit" | "cache.miss" | "cache.get.deduped" | "cache.stale" | "cache.stale.refresh.leader" | "cache.stale.refresh.follower" | "cache.set" | "cache.set.failed" | "tag.invalidate.soft" | "tag.invalidate.hard" | "tag.expiration.read" | "redis.connect.failed" | "redis.timeout" | "fallback.activated" | "build_phase.skip";
108
+ type MetricEventType = "cache.hit" | "cache.miss" | "cache.get.deduped" | "cache.stale" | "cache.stale.refresh.leader" | "cache.stale.refresh.follower" | "cache.set" | "cache.set.failed" | "cache.set.skipped" | "tag.invalidate.soft" | "tag.invalidate.hard" | "tag.expiration.read" | "redis.connect.failed" | "redis.timeout" | "fallback.activated" | "build_phase.skip";
109
109
  interface MetricEvent {
110
110
  type: MetricEventType;
111
111
  /** Operation latency in milliseconds, when measurable. */
@@ -188,6 +188,12 @@ interface CacheHandlerOptions {
188
188
  *
189
189
  * Default: `true`. Set to `false` to revert to "expire on revalidate" behavior.
190
190
  */
191
+ /**
192
+ * Governs TIME-based staleness only (serve-stale within revalidate..expire).
193
+ * Since 0.4.2 tag invalidation ignores this option: soft (profile-based)
194
+ * invalidations always serve-while-revalidating and hard ones always miss —
195
+ * that split is the upstream contract, not a handler feature.
196
+ */
191
197
  staleWhileRevalidate?: boolean;
192
198
  /**
193
199
  * Push-based cross-instance tag propagation (plural handler only).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leejpsd/nextjs-cache-handler",
3
- "version": "0.4.1",
3
+ "version": "1.0.0",
4
4
  "description": "Redis cache handler for Next.js 15/16 — the only one shipping both cacheHandler (ISR) and cacheHandlers ('use cache') with built-in compression, Redis Sentinel, and OpenTelemetry. Production-validated on multi-instance AWS: reconnect backoff, cross-instance tag invalidation, zero-downtime Redis failover.",
5
5
  "keywords": [
6
6
  "next",
@@ -178,13 +178,14 @@
178
178
  "prepublishOnly": "npm run verify && npm run publint && npm run attw",
179
179
  "test:cluster": "vitest run --config vitest.cluster.config.ts",
180
180
  "test:cluster:up": "scripts/cluster-test-env.sh up",
181
- "test:cluster:down": "scripts/cluster-test-env.sh down"
181
+ "test:cluster:down": "scripts/cluster-test-env.sh down",
182
+ "og": "node tools/generate-og.mjs"
182
183
  },
183
184
  "peerDependencies": {
184
- "next": ">=15.0.0 <17",
185
- "redis": ">=5.0.0",
185
+ "@opentelemetry/api": ">=1.0.0",
186
186
  "ioredis": ">=5.0.0",
187
- "@opentelemetry/api": ">=1.0.0"
187
+ "next": ">=15.0.0 <17",
188
+ "redis": ">=5.0.0"
188
189
  },
189
190
  "peerDependenciesMeta": {
190
191
  "redis": {
@@ -208,6 +209,7 @@
208
209
  "eslint": "^9.18.0",
209
210
  "ioredis": "^5.4.0",
210
211
  "next": "^16.1.5",
212
+ "playwright": "^1.60.0",
211
213
  "prettier": "^3.4.0",
212
214
  "publint": "^0.3.0",
213
215
  "redis": "^5.0.0",