@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 +2 -2
- package/dist/module.d.mts +5 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -1
- package/package.json +1 -1
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.
|
|
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.
|
|
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
|
|
41
|
-
* refresh. Required on serverless/edge
|
|
42
|
-
* and multi-instance setups without
|
|
43
|
-
* reach every isolate. `false`
|
|
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
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
|
-
|
|
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.
|
|
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": {
|