@towa-digital/storyblok-nuxt-cv 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -74,7 +74,7 @@ export default defineNuxtConfig({
74
74
  storage: 'storyblok-cv', // nitro storage mount name
75
75
  statusRoute: '/api/storyblok-cv', // GET current cv; false to disable
76
76
  webhook: true, // built-in route /api/storyblok-cv-webhook; string = custom route; false = use refreshStoryblokCv() yourself
77
- ttl: false, // e.g. 60_000 — background refresh when the stored cv is older (serverless/multi-instance)
77
+ ttl: false, // seconds, e.g. 60 — background refresh when the stored cv is older (serverless/multi-instance)
78
78
  onStartup: true, // populate the store once at boot
79
79
  },
80
80
  })
@@ -87,7 +87,7 @@ export default defineNuxtConfig({
87
87
  | Single Node process (DO app platform, plain node-server) | default (memory) | webhook (default setup) |
88
88
  | PM2 **cluster** on one host (`instances: 'max'`) | mount `fs` driver (shared disk) | webhook |
89
89
  | Multi-node / containers | mount Redis | webhook |
90
- | Cloudflare / Vercel Edge / Netlify (isolates) | default | **`ttl` (e.g. 60_000)** — a webhook can't reach every isolate |
90
+ | Cloudflare / Vercel Edge / Netlify (isolates) | default | **`ttl` (seconds, e.g. `60`)** — a webhook can't reach every isolate |
91
91
 
92
92
  ```ts
93
93
  // PM2 cluster example — the memory default is per worker, the webhook would
package/dist/module.d.mts CHANGED
@@ -37,10 +37,11 @@ interface ModuleOptions {
37
37
  */
38
38
  webhook?: boolean | string;
39
39
  /**
40
- * Max age (ms) of the stored `cv` before a page render triggers a background
41
- * refresh. Required on serverless/edge targets (Cloudflare, Vercel, Netlify)
42
- * and multi-instance setups without shared storage, where a webhook cannot
43
- * reach every isolate. `false` disables (webhook/startup only).
40
+ * Max age of the stored `cv`, **in seconds**, before a page render triggers a
41
+ * background refresh (e.g. `60` = one minute). Required on serverless/edge
42
+ * targets (Cloudflare, Vercel, Netlify) and multi-instance setups without
43
+ * shared storage, where a webhook cannot reach every isolate. `false`
44
+ * disables (webhook/startup only).
44
45
  */
45
46
  ttl?: number | false;
46
47
  /** Populate the `cv` store once at boot (fire-and-forget). */
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.10.0"
6
6
  },
7
- "version": "0.2.0",
7
+ "version": "0.3.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -44,7 +44,9 @@ const module$1 = defineNuxtModule({
44
44
  token: token ?? "",
45
45
  endpoint: options.endpoint || API_ENDPOINTS[options.region] || API_ENDPOINTS.eu,
46
46
  storage: options.storage,
47
- ttl: options.ttl === false ? 0 : options.ttl ?? 0,
47
+ // Option is in seconds (nicer DX); convert to ms for the runtime, which
48
+ // compares against `Date.now()`.
49
+ ttl: options.ttl === false ? 0 : (options.ttl ?? 0) * 1e3,
48
50
  onStartup: options.onStartup !== false,
49
51
  webhookSecret: ""
50
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@towa-digital/storyblok-nuxt-cv",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Keeps Storyblok published content fresh on long-running Nuxt servers by bridging the live cache version (cv) to the render client — no redeploy after publish.",
5
5
  "repository": "github:towa-digital/storyblok-nuxt-cv",
6
6
  "author": {