@websolutespa/bom-next 4.0.0-next.10 → 4.0.0-next.11
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/CHANGELOG.md +21 -0
- package/README.md +114 -89
- package/dist/cache-handler/redis.d.ts +80 -0
- package/dist/cache-handler/redis.d.ts.map +1 -0
- package/dist/cache-handler/redis.js +164 -0
- package/dist/cache-handler/redis.js.map +1 -0
- package/dist/cache-handlers/default.d.ts +26 -0
- package/dist/cache-handlers/default.d.ts.map +1 -0
- package/dist/cache-handlers/default.js +172 -0
- package/dist/cache-handlers/default.js.map +1 -0
- package/dist/client/client.js +5 -5
- package/dist/client/client.js.map +1 -1
- package/dist/client/extra.js.map +1 -1
- package/dist/client/label.js.map +1 -1
- package/dist/client/layout.js.map +1 -1
- package/dist/client/local.collection.js.map +1 -1
- package/dist/client/metadata.js.map +1 -1
- package/dist/client/page.d.ts.map +1 -1
- package/dist/client/page.js.map +1 -1
- package/dist/client/useApi.js.map +1 -1
- package/dist/client/useCollectionApi.js.map +1 -1
- package/dist/client/useExtra.js.map +1 -1
- package/dist/client/useHttp.js.map +1 -1
- package/dist/client/useLabel.js.map +1 -1
- package/dist/client/useLayout.js.map +1 -1
- package/dist/client/useLink.js.map +1 -1
- package/dist/client/useMetaData.js.map +1 -1
- package/dist/client/usePage.d.ts.map +1 -1
- package/dist/client/usePage.js.map +1 -1
- package/dist/client/useUser.js.map +1 -1
- package/dist/client/user.js.map +1 -1
- package/dist/config/with-bom.d.ts +28 -0
- package/dist/config/with-bom.d.ts.map +1 -0
- package/dist/config/with-bom.js +64 -0
- package/dist/config/with-bom.js.map +1 -0
- package/dist/exports/cache-handlers-default.d.ts +2 -0
- package/dist/exports/cache-handlers-default.js +2 -0
- package/dist/exports/cache-handlers-isr.d.ts +2 -0
- package/dist/exports/cache-handlers-isr.js +2 -0
- package/dist/exports/config.d.ts +3 -0
- package/dist/exports/config.js +3 -0
- package/dist/exports/server.d.ts +11 -1
- package/dist/exports/server.js +10 -1
- package/dist/instrumentation/client.js.map +1 -1
- package/dist/instrumentation/sentry/capture.requestError.js.map +1 -1
- package/dist/instrumentation/sentry/capture.routerTransitionStart.js.map +1 -1
- package/dist/instrumentation/sentry/config.client.js.map +1 -1
- package/dist/instrumentation/sentry/config.edge.js.map +1 -1
- package/dist/instrumentation/sentry/config.server.js.map +1 -1
- package/dist/instrumentation/server.d.ts.map +1 -1
- package/dist/instrumentation/server.js +4 -0
- package/dist/instrumentation/server.js.map +1 -1
- package/dist/lib/breadcrumb.js.map +1 -1
- package/dist/lib/const.js.map +1 -1
- package/dist/lib/debug.js.map +1 -1
- package/dist/lib/http.js.map +1 -1
- package/dist/lib/label.js.map +1 -1
- package/dist/lib/layout.defaults.js.map +1 -1
- package/dist/lib/link.js.map +1 -1
- package/dist/lib/page-metadata.js.map +1 -1
- package/dist/lib/pagination.js.map +1 -1
- package/dist/lib/route.d.ts +5 -0
- package/dist/lib/route.d.ts.map +1 -1
- package/dist/lib/route.js +6 -1
- package/dist/lib/route.js.map +1 -1
- package/dist/lib/store.js.map +1 -1
- package/dist/lib/ttl-cache.js.map +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/proxy/protected-route.js.map +1 -1
- package/dist/proxy/proxy.js.map +1 -1
- package/dist/proxy/route-auto-detection.js.map +1 -1
- package/dist/proxy/route-proxy.js.map +1 -1
- package/dist/server/cache/cached-types.d.ts +22 -0
- package/dist/server/cache/cached-types.d.ts.map +1 -0
- package/dist/server/cache/cached-types.js +34 -0
- package/dist/server/cache/cached-types.js.map +1 -0
- package/dist/server/cache/cached.d.ts +17 -0
- package/dist/server/cache/cached.d.ts.map +1 -0
- package/dist/server/cache/cached.js +21 -0
- package/dist/server/cache/cached.js.map +1 -0
- package/dist/server/cache/defaults.js +46 -0
- package/dist/server/cache/defaults.js.map +1 -0
- package/dist/server/cache/executor.d.ts +54 -0
- package/dist/server/cache/executor.d.ts.map +1 -0
- package/dist/server/cache/executor.js +84 -0
- package/dist/server/cache/executor.js.map +1 -0
- package/dist/server/cache/handler.d.ts +16 -0
- package/dist/server/cache/handler.d.ts.map +1 -0
- package/dist/server/cache/handler.js +103 -0
- package/dist/server/cache/handler.js.map +1 -0
- package/dist/server/cache/index.d.ts +10 -0
- package/dist/server/cache/inspector/filesystem.js +147 -0
- package/dist/server/cache/inspector/filesystem.js.map +1 -0
- package/dist/server/cache/inspector/index.d.ts +11 -0
- package/dist/server/cache/inspector/index.d.ts.map +1 -0
- package/dist/server/cache/inspector/index.js +20 -0
- package/dist/server/cache/inspector/index.js.map +1 -0
- package/dist/server/cache/inspector/redis.js +145 -0
- package/dist/server/cache/inspector/redis.js.map +1 -0
- package/dist/server/cache/inspector/route-cache-key.js +23 -0
- package/dist/server/cache/inspector/route-cache-key.js.map +1 -0
- package/dist/server/cache/inspector/types.d.ts +36 -0
- package/dist/server/cache/inspector/types.d.ts.map +1 -0
- package/dist/server/cache/inspector/types.js +10 -0
- package/dist/server/cache/inspector/types.js.map +1 -0
- package/dist/server/cache/local-executor.d.ts +28 -0
- package/dist/server/cache/local-executor.d.ts.map +1 -0
- package/dist/server/cache/local-executor.js +42 -0
- package/dist/server/cache/local-executor.js.map +1 -0
- package/dist/server/cache/mode/classic.d.ts +16 -0
- package/dist/server/cache/mode/classic.d.ts.map +1 -0
- package/dist/server/cache/mode/classic.js +49 -0
- package/dist/server/cache/mode/classic.js.map +1 -0
- package/dist/server/cache/mode/components.d.ts +13 -0
- package/dist/server/cache/mode/components.d.ts.map +1 -0
- package/dist/server/cache/mode/components.js +51 -0
- package/dist/server/cache/mode/components.js.map +1 -0
- package/dist/server/cache/profiles.d.ts +44 -0
- package/dist/server/cache/profiles.d.ts.map +1 -0
- package/dist/server/cache/profiles.js +36 -0
- package/dist/server/cache/profiles.js.map +1 -0
- package/dist/server/cache/registry.d.ts +33 -0
- package/dist/server/cache/registry.d.ts.map +1 -0
- package/dist/server/cache/registry.js +42 -0
- package/dist/server/cache/registry.js.map +1 -0
- package/dist/server/cache/tag-page.d.ts +11 -0
- package/dist/server/cache/tag-page.d.ts.map +1 -0
- package/dist/server/cache/tag-page.js +24 -0
- package/dist/server/cache/tag-page.js.map +1 -0
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/context.js +75 -7
- package/dist/server/context.js.map +1 -1
- package/dist/server/handlers/auth.handler.js.map +1 -1
- package/dist/server/handlers/captions.handler.js.map +1 -1
- package/dist/server/handlers/collection.handler.js.map +1 -1
- package/dist/server/handlers/error-response.js.map +1 -1
- package/dist/server/handlers/index.handler.js.map +1 -1
- package/dist/server/handlers/preview.handler.js.map +1 -1
- package/dist/server/handlers/registry.handler.js.map +1 -1
- package/dist/server/handlers/revalidate.handler.js.map +1 -1
- package/dist/server/handlers/route.handler.js.map +1 -1
- package/dist/server/handlers/sitemap.handler.js.map +1 -1
- package/dist/server/handlers/static-params.handler.d.ts.map +1 -1
- package/dist/server/handlers/static-params.handler.js +7 -2
- package/dist/server/handlers/static-params.handler.js.map +1 -1
- package/dist/server/handlers/vars.handler.js.map +1 -1
- package/dist/server/helpers.js.map +1 -1
- package/dist/server/json-ld.js.map +1 -1
- package/dist/server/layout.js.map +1 -1
- package/dist/server/lazy.js.map +1 -1
- package/dist/server/local-api.js.map +1 -1
- package/dist/server/metadata.js.map +1 -1
- package/dist/server/mixer.js.map +1 -1
- package/dist/server/page.js.map +1 -1
- package/dist/server/utils.js.map +1 -1
- package/dist/server/utmz.js.map +1 -1
- package/package.json +84 -4
- package/src/cache-handler/redis.test.ts +153 -0
- package/src/cache-handler/redis.ts +282 -0
- package/src/cache-handlers/default.test.ts +125 -0
- package/src/cache-handlers/default.ts +246 -0
- package/src/client/client.tsx +20 -20
- package/src/client/extra.tsx +17 -17
- package/src/client/label.tsx +20 -20
- package/src/client/layout.tsx +18 -18
- package/src/client/local.collection.ts +72 -72
- package/src/client/metadata.tsx +187 -187
- package/src/client/page.tsx +18 -18
- package/src/client/useApi.test.tsx +212 -212
- package/src/client/useApi.ts +115 -115
- package/src/client/useCollectionApi.test.tsx +213 -213
- package/src/client/useCollectionApi.ts +135 -135
- package/src/client/useExtra.tsx +12 -12
- package/src/client/useHttp.ts +78 -78
- package/src/client/useLabel.test.tsx +82 -82
- package/src/client/useLabel.tsx +12 -12
- package/src/client/useLayout.tsx +13 -13
- package/src/client/useLink.tsx +16 -16
- package/src/client/useMetaData.tsx +12 -12
- package/src/client/usePage.tsx +12 -12
- package/src/client/useUser.tsx +12 -12
- package/src/client/user.test.tsx +63 -63
- package/src/client/user.tsx +72 -72
- package/src/config/with-bom.test.ts +61 -0
- package/src/config/with-bom.ts +68 -0
- package/src/exports/cache-handlers-default.ts +3 -0
- package/src/exports/cache-handlers-isr.ts +3 -0
- package/src/exports/client.ts +19 -19
- package/src/exports/config.ts +3 -0
- package/src/exports/instrumentation.ts +1 -1
- package/src/exports/proxy.ts +4 -4
- package/src/exports/server.ts +22 -21
- package/src/global.d.ts +6 -6
- package/src/index.ts +16 -16
- package/src/instrumentation/client.ts +18 -18
- package/src/instrumentation/sentry/capture.requestError.ts +9 -9
- package/src/instrumentation/sentry/capture.routerTransitionStart.ts +7 -7
- package/src/instrumentation/sentry/config.client.ts +9 -9
- package/src/instrumentation/sentry/config.edge.ts +9 -9
- package/src/instrumentation/sentry/config.server.ts +9 -9
- package/src/instrumentation/server.ts +33 -28
- package/src/instrumentation/types.ts +11 -11
- package/src/lib/breadcrumb.ts +25 -25
- package/src/lib/const.ts +18 -18
- package/src/lib/debug.ts +11 -11
- package/src/lib/http.test.ts +25 -25
- package/src/lib/http.ts +127 -127
- package/src/lib/label.ts +47 -47
- package/src/lib/layout.defaults.ts +167 -167
- package/src/lib/link.ts +19 -19
- package/src/lib/meta-data.ts +60 -60
- package/src/lib/open-graph.ts +165 -165
- package/src/lib/page-metadata.test.ts +160 -160
- package/src/lib/page-metadata.ts +277 -277
- package/src/lib/pagination.ts +80 -80
- package/src/lib/route.test.ts +62 -62
- package/src/lib/route.ts +117 -111
- package/src/lib/store.ts +63 -63
- package/src/lib/structured-data.ts +24 -24
- package/src/lib/ttl-cache.ts +72 -72
- package/src/lib/twitter-card.ts +49 -49
- package/src/lib/utils.ts +44 -44
- package/src/mock.ts +292 -292
- package/src/proxy/protected-route.test.ts +75 -75
- package/src/proxy/protected-route.ts +68 -68
- package/src/proxy/proxy.test.ts +51 -51
- package/src/proxy/proxy.ts +81 -81
- package/src/proxy/route-auto-detection.test.ts +55 -55
- package/src/proxy/route-auto-detection.ts +222 -222
- package/src/proxy/route-proxy.test.ts +104 -104
- package/src/proxy/route-proxy.ts +291 -291
- package/src/server/cache/cached-types.ts +73 -0
- package/src/server/cache/cached.test.ts +115 -0
- package/src/server/cache/cached.ts +22 -0
- package/src/server/cache/defaults.ts +46 -0
- package/src/server/cache/executor.test.ts +134 -0
- package/src/server/cache/executor.ts +141 -0
- package/src/server/cache/handler.test.ts +122 -0
- package/src/server/cache/handler.ts +126 -0
- package/src/server/cache/index.ts +39 -0
- package/src/server/cache/inspector/filesystem.test.ts +142 -0
- package/src/server/cache/inspector/filesystem.ts +214 -0
- package/src/server/cache/inspector/index.ts +19 -0
- package/src/server/cache/inspector/redis.test.ts +97 -0
- package/src/server/cache/inspector/redis.ts +177 -0
- package/src/server/cache/inspector/route-cache-key.test.ts +31 -0
- package/src/server/cache/inspector/route-cache-key.ts +40 -0
- package/src/server/cache/inspector/types.ts +49 -0
- package/src/server/cache/local-executor.ts +39 -0
- package/src/server/cache/mode/classic.ts +59 -0
- package/src/server/cache/mode/components.test.ts +53 -0
- package/src/server/cache/mode/components.ts +64 -0
- package/src/server/cache/profiles.ts +41 -0
- package/src/server/cache/registry.test.ts +66 -0
- package/src/server/cache/registry.ts +82 -0
- package/src/server/cache/route-parity.test.ts +33 -0
- package/src/server/cache/tag-page.ts +23 -0
- package/src/server/context.cache.test.ts +79 -0
- package/src/server/context.test.ts +645 -645
- package/src/server/context.ts +488 -375
- package/src/server/context.type-test.ts +112 -112
- package/src/server/handlers/auth.handler.ts +32 -32
- package/src/server/handlers/captions.handler.ts +36 -36
- package/src/server/handlers/collection.handler.test.ts +63 -63
- package/src/server/handlers/collection.handler.ts +221 -221
- package/src/server/handlers/error-response.ts +50 -50
- package/src/server/handlers/index.handler.ts +153 -153
- package/src/server/handlers/preview.handler.ts +63 -63
- package/src/server/handlers/registry.handler.test.ts +171 -171
- package/src/server/handlers/registry.handler.ts +514 -514
- package/src/server/handlers/revalidate.handler.ts +148 -148
- package/src/server/handlers/route.handler.test.ts +50 -50
- package/src/server/handlers/route.handler.ts +188 -188
- package/src/server/handlers/sitemap.handler.ts +432 -432
- package/src/server/handlers/static-params.cache.test.ts +81 -0
- package/src/server/handlers/static-params.handler.ts +123 -108
- package/src/server/handlers/vars.handler.ts +174 -174
- package/src/server/helpers.ts +97 -97
- package/src/server/json-ld.tsx +65 -65
- package/src/server/layout.ts +148 -148
- package/src/server/lazy.ts +41 -41
- package/src/server/local-api.ts +67 -67
- package/src/server/metadata.ts +79 -79
- package/src/server/mixer-payload.ts +115 -115
- package/src/server/mixer-payload.type-test.ts +27 -27
- package/src/server/mixer.ts +496 -496
- package/src/server/page.ts +148 -148
- package/src/server/request-data.test.ts +34 -34
- package/src/server/utils.ts +23 -23
- package/src/server/utmz.ts +11 -11
- package/src/types.ts +363 -363
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @websolutespa/bom-next
|
|
2
2
|
|
|
3
|
+
## 4.0.0-next.11
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 67f9535: Site side of the Next.js cache panel, named cached functions, and support for both caching models (classic ISR and Cache Components).
|
|
8
|
+
|
|
9
|
+
- **Page tags.** `createPageContext` and `createLayoutContext` tag every rendered page from its route: market, locale, collection, document, route, category ancestors and the layout collections. Decorators that list other documents call `tagPage([collectionTag('…')])`.
|
|
10
|
+
- **Cache endpoint.** `getCacheHandler()` (`/api/-cache`, Bearer `MIXER_SECRET`) reports the cached pages, functions and process caches of the instance (file system, Redis, or none on Vercel) and applies cache actions. `revalidate` maps to `revalidateTag(tag, 'max')`, `invalidate` to `revalidateTag(tag, { expire: 0 })`; actions can also revalidate paths, clear process caches and warm pages after the response. `registerIntrumentation()` registers it in process for the Bowl admin, so sites need no change.
|
|
11
|
+
- **Next.js 16.4 route cache.** The inspector reads both `.next/server/app` and the runtime route cache (`.next/server/route-cache/<kind>/<sha256(source route)>/$/<path>`).
|
|
12
|
+
- **Cached functions.** `bomCached(name, fn, { life, tags, resultTags })` caches a data function by name, with a BOM lifetime and tags, and `documentTags(collection, result)` builds document tags from Payload results. Lifetimes are named profiles (`bomProfiles`: `bom-layout`, `bom-page`, `bom-listing`, `bom-static`).
|
|
13
|
+
- **`withBom(nextConfig)`** (`@websolutespa/bom-next/config`) picks the implementation:
|
|
14
|
+
- Classic ISR: `unstable_cache`.
|
|
15
|
+
- `cacheComponents: true`: `'use cache'`, `cacheLife` and `cacheTag`, the BOM `cacheLife` profiles, the BOM `cacheHandlers.default`, and cached page and layout reads in `createPageContext`.
|
|
16
|
+
- Under Cache Components, `getStaticParams` returns at least one real route per template and fails clearly when a template has no published page.
|
|
17
|
+
- With `REDIS_URL` at build time, it sets the shared Redis cache handler.
|
|
18
|
+
- **Redis handlers.**
|
|
19
|
+
- `@websolutespa/bom-next/cache-handlers/isr` honours the second argument of `revalidateTag` (stale-while-revalidate versus expire now) and writes meta keys the panel lists.
|
|
20
|
+
- `@websolutespa/bom-next/cache-handlers/default` (`'use cache'`) shares the same tag keys, in memory or in Redis.
|
|
21
|
+
- **Fix.** `resolveRoute` handles a populated page document (it produced `[object Object]`).
|
|
22
|
+
- **Optional peer:** `redis`.
|
|
23
|
+
|
|
3
24
|
## 4.0.0-next.10
|
|
4
25
|
|
|
5
26
|
## 4.0.0-next.9
|
package/README.md
CHANGED
|
@@ -1,89 +1,114 @@
|
|
|
1
|
-
# @websolutespa/bom-next
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/js/%40websolutespa%2Fbom-next)
|
|
4
|
-
|
|
5
|
-
[](https://shields.io/)
|
|
6
|
-
|
|
7
|
-
Next module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
##### _this library is for internal usage and not production ready_
|
|
12
|
-
|
|
13
|
-
## Page context
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { createPageContext, getMetadata } from '@websolutespa/bom-next/server';
|
|
17
|
-
|
|
18
|
-
export const generateMetadata = getMetadata('post_detail', config);
|
|
19
|
-
|
|
20
|
-
const { page, layout, label, link } = await createPageContext(market, locale, 'post_detail', id, {
|
|
21
|
-
config,
|
|
22
|
-
depth: 2, // default DEFAULT_PAGE_DEPTH
|
|
23
|
-
select: { title: true, abstract: true, media: true, components: true },
|
|
24
|
-
populate: { media: { url: true, alt: true, width: true, height: true, type: true } },
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const { layout } = await createLayoutContext(market, locale, { config }); // depth: DEFAULT_LAYOUT_DEPTH (1)
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
| option | default | |
|
|
31
|
-
| ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
-
| `depth` | `2` | `0` ids only, `1` direct relations/uploads (including those inside blocks), `2` relations of relations |
|
|
33
|
-
| `select` | – | Payload select; envelope fields (`id`, `slug`, `title`, `category`, `markets`, `meta`, `template`) are always read |
|
|
34
|
-
| `populate` | – | per-collection select for populated documents |
|
|
35
|
-
| `draft` | `'auto'` | `true` / `false`, or `'auto'` to read Next `draftMode()` |
|
|
36
|
-
| `layout` | `{ depth: 1 }` | layout options, or `false` to skip the layout |
|
|
37
|
-
|
|
38
|
-
Page and layout reads are memoized per request, so `getMetadata` and the page component share them when called with the same options.
|
|
39
|
-
To bind `config` once: `export const { createPageContext, createLayoutContext, getMetadata } = createContextHelpers({ config, defaults: { depth: 2 } });`
|
|
40
|
-
|
|
41
|
-
## Metadata
|
|
42
|
-
|
|
43
|
-
`getPageMetadata` (and `getMetadata`, its `config`-first form) returns a `generateMetadata` function that renders on the server: plain-text title and description, canonical (keeping `?pagination[page]=N` after the first page), `alternates.languages` with one `locale-COUNTRY` entry per market country plus `x-default`, robots, keywords, Open Graph and Twitter.
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { getPageMetadata, JsonLd, buildPageStructuredData } from '@websolutespa/bom-next/server';
|
|
47
|
-
|
|
48
|
-
export const generateMetadata = getPageMetadata('post_detail', {
|
|
49
|
-
config,
|
|
50
|
-
metadata: {
|
|
51
|
-
brand: { name: 'Example', logo: '/logo.png', twitterName: '@example' },
|
|
52
|
-
extend: (metadata, { page }) => ({ ...metadata, title: `${metadata.title} | Example` }),
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// JSON-LD in the page component
|
|
57
|
-
<JsonLd data={buildPageStructuredData(page, layout, { brand: { name: 'Example' } })} />
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`buildPageMetadata(page, layout, options)` is the same builder for custom routes. URLs are resolved against `NEXT_PUBLIC_URL` unless `baseUrl` is passed. Robots come from `meta.robots`, or `meta.robot` (the `@payloadcms/plugin-seo` field).
|
|
61
|
-
|
|
62
|
-
The client `MetaDataProvider` only computes values for `useMetaData`; the `next/head` based `Meta`, `OpenGraph` and `StructuredData` components of the mixer packages render nothing in the App Router.
|
|
63
|
-
|
|
64
|
-
`layout.homeHref` is the root page href for the current market and locale; prefer it to `layout.topLevelHrefs.<slug>`, which is keyed by collection slug or template.
|
|
65
|
-
|
|
66
|
-
## Routing proxy
|
|
67
|
-
|
|
68
|
-
`createRouteProxy` resolves each request through `/api/-route` and caches the result per instance: found routes for `BOM_ROUTE_CACHE_TTL` seconds (default `30`, `0` disables), misses and redirects for at most 10 seconds. Draft requests and server errors are never cached. CMS redirects send the browser to the target returned by the resolver.
|
|
69
|
-
|
|
70
|
-
`routeAutoDetection` redirects `/` straight from the `detectedRoute` cookie when present; otherwise it detects the market (GeoIP, 2 s timeout, cached per IP for one hour) and the locale.
|
|
71
|
-
|
|
72
|
-
The server context (`getContext`) reads routes from the Bowl route store and caches the rest per market, locale and user for `MEMORY_CACHE_DURATION` seconds (default 300). Any route store change, local or from another instance through Redis, clears it. Draft contexts are never cached.
|
|
73
|
-
|
|
74
|
-
##
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
# @websolutespa/bom-next
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40websolutespa%2Fbom-next)
|
|
4
|
+
|
|
5
|
+
[](https://shields.io/)
|
|
6
|
+
|
|
7
|
+
Next module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
##### _this library is for internal usage and not production ready_
|
|
12
|
+
|
|
13
|
+
## Page context
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createPageContext, getMetadata } from '@websolutespa/bom-next/server';
|
|
17
|
+
|
|
18
|
+
export const generateMetadata = getMetadata('post_detail', config);
|
|
19
|
+
|
|
20
|
+
const { page, layout, label, link } = await createPageContext(market, locale, 'post_detail', id, {
|
|
21
|
+
config,
|
|
22
|
+
depth: 2, // default DEFAULT_PAGE_DEPTH
|
|
23
|
+
select: { title: true, abstract: true, media: true, components: true },
|
|
24
|
+
populate: { media: { url: true, alt: true, width: true, height: true, type: true } },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const { layout } = await createLayoutContext(market, locale, { config }); // depth: DEFAULT_LAYOUT_DEPTH (1)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| option | default | |
|
|
31
|
+
| ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
+
| `depth` | `2` | `0` ids only, `1` direct relations/uploads (including those inside blocks), `2` relations of relations |
|
|
33
|
+
| `select` | – | Payload select; envelope fields (`id`, `slug`, `title`, `category`, `markets`, `meta`, `template`) are always read |
|
|
34
|
+
| `populate` | – | per-collection select for populated documents |
|
|
35
|
+
| `draft` | `'auto'` | `true` / `false`, or `'auto'` to read Next `draftMode()` |
|
|
36
|
+
| `layout` | `{ depth: 1 }` | layout options, or `false` to skip the layout |
|
|
37
|
+
|
|
38
|
+
Page and layout reads are memoized per request, so `getMetadata` and the page component share them when called with the same options.
|
|
39
|
+
To bind `config` once: `export const { createPageContext, createLayoutContext, getMetadata } = createContextHelpers({ config, defaults: { depth: 2 } });`
|
|
40
|
+
|
|
41
|
+
## Metadata
|
|
42
|
+
|
|
43
|
+
`getPageMetadata` (and `getMetadata`, its `config`-first form) returns a `generateMetadata` function that renders on the server: plain-text title and description, canonical (keeping `?pagination[page]=N` after the first page), `alternates.languages` with one `locale-COUNTRY` entry per market country plus `x-default`, robots, keywords, Open Graph and Twitter.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { getPageMetadata, JsonLd, buildPageStructuredData } from '@websolutespa/bom-next/server';
|
|
47
|
+
|
|
48
|
+
export const generateMetadata = getPageMetadata('post_detail', {
|
|
49
|
+
config,
|
|
50
|
+
metadata: {
|
|
51
|
+
brand: { name: 'Example', logo: '/logo.png', twitterName: '@example' },
|
|
52
|
+
extend: (metadata, { page }) => ({ ...metadata, title: `${metadata.title} | Example` }),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// JSON-LD in the page component
|
|
57
|
+
<JsonLd data={buildPageStructuredData(page, layout, { brand: { name: 'Example' } })} />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`buildPageMetadata(page, layout, options)` is the same builder for custom routes. URLs are resolved against `NEXT_PUBLIC_URL` unless `baseUrl` is passed. Robots come from `meta.robots`, or `meta.robot` (the `@payloadcms/plugin-seo` field).
|
|
61
|
+
|
|
62
|
+
The client `MetaDataProvider` only computes values for `useMetaData`; the `next/head` based `Meta`, `OpenGraph` and `StructuredData` components of the mixer packages render nothing in the App Router.
|
|
63
|
+
|
|
64
|
+
`layout.homeHref` is the root page href for the current market and locale; prefer it to `layout.topLevelHrefs.<slug>`, which is keyed by collection slug or template.
|
|
65
|
+
|
|
66
|
+
## Routing proxy
|
|
67
|
+
|
|
68
|
+
`createRouteProxy` resolves each request through `/api/-route` and caches the result per instance: found routes for `BOM_ROUTE_CACHE_TTL` seconds (default `30`, `0` disables), misses and redirects for at most 10 seconds. Draft requests and server errors are never cached. CMS redirects send the browser to the target returned by the resolver.
|
|
69
|
+
|
|
70
|
+
`routeAutoDetection` redirects `/` straight from the `detectedRoute` cookie when present; otherwise it detects the market (GeoIP, 2 s timeout, cached per IP for one hour) and the locale.
|
|
71
|
+
|
|
72
|
+
The server context (`getContext`) reads routes from the Bowl route store and caches the rest per market, locale and user for `MEMORY_CACHE_DURATION` seconds (default 300). Any route store change, local or from another instance through Redis, clears it. Draft contexts are never cached.
|
|
73
|
+
|
|
74
|
+
## Cache
|
|
75
|
+
|
|
76
|
+
Pages are tagged from their route by `createPageContext` and `createLayoutContext`, and invalidated by the Bowl change hooks and the Bowl cache panel (`/admin/cache`). The site exposes its side of the panel with one route:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
// src/app/api/-cache/route.ts
|
|
80
|
+
import { getCacheHandler } from '@websolutespa/bom-next/server';
|
|
81
|
+
|
|
82
|
+
export const { GET, POST } = getCacheHandler();
|
|
83
|
+
export const dynamic = 'force-dynamic';
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- `tagPage(tags)` adds tags to the page being rendered, for example a decorator that lists another collection: `tagPage([collectionTag('post_detail')])`.
|
|
87
|
+
- `bomCached(name, fn, { life, tags, resultTags })` caches a data function by name. `life` is a BOM profile (`bom-layout`, `bom-page`, `bom-listing`, `bom-static`, see `bomProfiles`) or an inline profile. `documentTags(collection, result)` tags a result by its documents. Every entry carries `bom:fn:<name>`, so the panel lists and revalidates it.
|
|
88
|
+
- `withBom(nextConfig)` (`@websolutespa/bom-next/config`) wires the caching model:
|
|
89
|
+
- **Classic ISR** (default): `bomCached` uses `unstable_cache`, templates keep `generateStaticParams` and `export const revalidate`.
|
|
90
|
+
- **`cacheComponents: true`**: `bomCached` and `tagPage` use `'use cache'`, `cacheLife` and `cacheTag`; the BOM profiles are registered as `cacheLife` profiles, `cacheHandlers.default` is the BOM `'use cache'` handler, and `createPageContext` reads public pages and layouts through cached functions. Templates must drop `export const revalidate`. `getStaticParams` returns at least one route per template (Cache Components refuses an empty list), so every template needs one published page at build time.
|
|
91
|
+
- **`REDIS_URL` at build time**: `cacheHandler` is the shared Redis handler (`@websolutespa/bom-next/cache-handlers/isr`), which applies `revalidateTag(tag, 'max')` as stale-while-revalidate across instances; `'use cache'` entries share its tag keys.
|
|
92
|
+
- `registerIntrumentation()` registers the in-process cache executor; Bowl uses `/api/-cache` (Bearer `MIXER_SECRET`) when it runs in another process.
|
|
93
|
+
|
|
94
|
+
The cache panel reads the file-system cache (`.next/server/app` and the Next.js 16.4 runtime route cache under `.next/server/route-cache`), the Redis handlers' meta keys, or nothing on Vercel. `next dev` has no ISR cache: check the panel after `next build && next start`.
|
|
95
|
+
|
|
96
|
+
## Environment
|
|
97
|
+
|
|
98
|
+
Per-request diagnostics (proxy, local API calls, context cache) are logged in development only (`NODE_ENV` unset or `development`).
|
|
99
|
+
|
|
100
|
+
| Variable | Default | |
|
|
101
|
+
| ----------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
102
|
+
| `BOM_ROUTE_CACHE_TTL` | `30` | proxy route cache lifetime in seconds, `0` disables it |
|
|
103
|
+
| `MEMORY_CACHE_DURATION` | `300` | server context cache lifetime in seconds |
|
|
104
|
+
| `BOM_USE_CACHE_MAX_BYTES` | `67108864` | memory limit of the in-process `'use cache'` handler (Cache Components without Redis) |
|
|
105
|
+
| `MIXER_SECRET` | – | Bearer token of `/api/-revalidate` and `/api/-cache` |
|
|
106
|
+
| `REDIS_URL`, `REDIS_PREFIX` | – | shared Redis cache handlers (set at build time for `withBom`) and key prefix |
|
|
107
|
+
| `UI_REGISTRY_SOURCE_DIR` | `packages/ui/src` | registry source directory |
|
|
108
|
+
| `UI_REGISTRY_COMPONENTS_JSON` | nearest `components.json` | shadcn config whose aliases (e.g. `@/ui/lib/utils`) are mapped to registry imports |
|
|
109
|
+
| `UI_REGISTRY_SOURCE_ALIAS` | – | extra import prefix pointing at the registry source, e.g. `@/ui/` |
|
|
110
|
+
| `UI_REGISTRY_SKIP_UNRESOLVED` | – | `1` hides registry items that import app code; otherwise they are listed with `meta.unresolvedImports` |
|
|
111
|
+
|
|
112
|
+
## User
|
|
113
|
+
|
|
114
|
+
`UserProvider` reads `/api/auth/me` once per page load, shared by every mount and client navigation. Pass `initialUser` (a user or `null`) when the server already knows it to skip the request; `setUser` and `invalidateUser()` keep the cached value current after login or logout.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/cache-handler/redis.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Next.js incremental cache handler (ISR pages, route handlers, `fetch` and `unstable_cache` entries) backed by
|
|
4
|
+
* Redis, shared by every instance of a site. Set it in `next.config` with `withBom()`, or directly:
|
|
5
|
+
* `cacheHandler: require.resolve('@websolutespa/bom-next/cache-handlers/isr')`, `cacheMaxMemorySize: 0`.
|
|
6
|
+
*
|
|
7
|
+
* - Entries: `${REDIS_PREFIX}:next:<key>`, written as `{ lastModified, tags, revalidate, value }` (in this
|
|
8
|
+
* order: the cache panel reads the head of the value without parsing the page).
|
|
9
|
+
* - Meta: `${REDIS_PREFIX}:next-meta:<key>`, a small JSON per entry that the cache panel lists with SCAN.
|
|
10
|
+
* - Tags: `${REDIS_PREFIX}:next-tag:<tag>` is when the tag expired (the next request waits for a fresh render),
|
|
11
|
+
* `${REDIS_PREFIX}:next-tag-stale:<tag>` when it went stale (served once more, regenerated in the background).
|
|
12
|
+
* `revalidateTag(tag, 'max')` sets the stale time; `revalidateTag(tag, { expire: 0 })`, `updateTag` and
|
|
13
|
+
* `revalidatePath` set the expiry. Next.js only applies stale tags of its own file-system cache, so this handler
|
|
14
|
+
* reports a stale entry by moving its `lastModified` back past its revalidate time.
|
|
15
|
+
* - Redis down: reads miss and writes are dropped, so pages still render (uncached) instead of failing.
|
|
16
|
+
*/
|
|
17
|
+
/** The subset of a `redis` client this handler uses (injectable for tests). */
|
|
18
|
+
type RedisLike = {
|
|
19
|
+
isReady: boolean;
|
|
20
|
+
get(key: string): Promise<string | null>;
|
|
21
|
+
mGet(keys: string[]): Promise<(string | null)[]>;
|
|
22
|
+
set(key: string, value: string, options?: {
|
|
23
|
+
EX?: number;
|
|
24
|
+
}): Promise<unknown>;
|
|
25
|
+
mSet(entries: [string, string][]): Promise<unknown>;
|
|
26
|
+
del(key: string | string[]): Promise<unknown>;
|
|
27
|
+
};
|
|
28
|
+
type CacheHandlerContext = {
|
|
29
|
+
tags?: string[];
|
|
30
|
+
softTags?: string[];
|
|
31
|
+
revalidate?: number | false;
|
|
32
|
+
cacheControl?: {
|
|
33
|
+
revalidate?: number | false;
|
|
34
|
+
expire?: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/** Serializes a cache entry, keeping Buffers and Maps (RSC payloads, segment data). */
|
|
38
|
+
declare function encode(entry: unknown): string;
|
|
39
|
+
/** Restores a cache entry written by {@link encode}. */
|
|
40
|
+
declare function decode<T = unknown>(raw: string): T;
|
|
41
|
+
/** The fields of a Next.js cache value this handler reads; the rest is stored as it is. */
|
|
42
|
+
type CacheValue = {
|
|
43
|
+
kind?: string;
|
|
44
|
+
status?: number;
|
|
45
|
+
revalidate?: number | false;
|
|
46
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
47
|
+
};
|
|
48
|
+
/** Explicit tags of a value: the context tags plus the `x-next-cache-tags` header of pages and route handlers. */
|
|
49
|
+
/** A connecting client used only while ready: awaiting `connect()` would hang every request while Redis is down. */
|
|
50
|
+
declare function getRedisClient(): Promise<RedisLike | undefined>;
|
|
51
|
+
/** Builds the handler class around a client getter, so tests can inject one. */
|
|
52
|
+
declare function createRedisCacheHandler(getClient?: () => Promise<RedisLike | undefined>, prefix?: string): {
|
|
53
|
+
new (_ctx?: unknown): {
|
|
54
|
+
get(key: string, ctx?: CacheHandlerContext): Promise<{
|
|
55
|
+
lastModified: number;
|
|
56
|
+
value: CacheValue;
|
|
57
|
+
} | null>;
|
|
58
|
+
set(key: string, data: CacheValue | null, ctx?: CacheHandlerContext): Promise<void>;
|
|
59
|
+
revalidateTag(tags: string | string[], durations?: {
|
|
60
|
+
expire?: number;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
resetRequestCache(): void;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
declare const _default: {
|
|
66
|
+
new (_ctx?: unknown): {
|
|
67
|
+
get(key: string, ctx?: CacheHandlerContext): Promise<{
|
|
68
|
+
lastModified: number;
|
|
69
|
+
value: CacheValue;
|
|
70
|
+
} | null>;
|
|
71
|
+
set(key: string, data: CacheValue | null, ctx?: CacheHandlerContext): Promise<void>;
|
|
72
|
+
revalidateTag(tags: string | string[], durations?: {
|
|
73
|
+
expire?: number;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
resetRequestCache(): void;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { RedisLike, _default, createRedisCacheHandler, decode, encode, getRedisClient };
|
|
80
|
+
//# sourceMappingURL=redis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.d.ts","names":[],"sources":["../../src/cache-handler/redis.ts"],"mappings":";;AAiBA;;;;;;;;;;;;;;;KAAY,SAAA;EACV,OAAA;EACA,GAAA,CAAI,GAAA,WAAc,OAAA;EAClB,IAAA,CAAK,IAAA,aAAiB,OAAA;EACtB,GAAA,CAAI,GAAA,UAAa,KAAA,UAAe,OAAA;IAAY,EAAA;EAAA,IAAgB,OAAA;EAC5D,IAAA,CAAK,OAAA,uBAA8B,OAAA;EACnC,GAAA,CAAI,GAAA,sBAAyB,OAAA;AAAA;AAAA,KAGnB,mBAAA;EACV,IAAA;EACA,QAAA;EACA,UAAA;EACA,YAAA;IAAiB,UAAA;IAA6B,MAAA;EAAA;AAAA;;iBA0ChC,MAAA,CAAO,KAAA;;iBAKP,MAAA,aAAA,CAAoB,GAAA,WAAc,CAAA;;KAK7C,UAAA;EACH,IAAA;EACA,MAAA;EACA,UAAA;EACA,OAAA,GAAU,MAAA;AAAA;;;iBA0CU,cAAA,CAAA,GAAkB,OAAA,CAAQ,SAAA;AAjD/C;AAAA,iBAmFe,uBAAA,CACd,SAAA,SAAiB,OAAA,CAAQ,SAAA,eACzB,MAAA;EAAA;qBAMuB,GAAA,GAAQ,mBAAA,GAAmB,OAAA;;;;qBA2C3B,IAAA,EAAQ,UAAA,SAAiB,GAAA,GAAQ,mBAAA,GAAmB,OAAA;2CAuC9B,SAAA;MAAgB,MAAA;IAAA,IAAiB,OAAA;;;;cA2B/E,QAAA;EAAA;qBA7GwB,GAAA,GAAQ,mBAAA,GAAmB,OAAA;;;;qBA2C3B,IAAA,EAAQ,UAAA,SAAiB,GAAA,GAAQ,mBAAA,GAAmB,OAAA;2CAuC9B,SAAA;MAAgB,MAAA;IAAA,IAAiB,OAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
//#region src/cache-handler/redis.ts
|
|
2
|
+
const tagsHeader = "x-next-cache-tags";
|
|
3
|
+
function redisPrefix(env = process.env) {
|
|
4
|
+
return env.REDIS_PREFIX ? `${env.REDIS_PREFIX}:` : "";
|
|
5
|
+
}
|
|
6
|
+
const keys = (prefix) => ({
|
|
7
|
+
entry: `${prefix}next:`,
|
|
8
|
+
meta: `${prefix}next-meta:`,
|
|
9
|
+
expired: `${prefix}next-tag:`,
|
|
10
|
+
stale: `${prefix}next-tag-stale:`
|
|
11
|
+
});
|
|
12
|
+
function replacer(_key, value) {
|
|
13
|
+
if (value instanceof Map) return {
|
|
14
|
+
__t: "map",
|
|
15
|
+
d: Array.from(value.entries())
|
|
16
|
+
};
|
|
17
|
+
if (value && typeof value === "object" && value.type === "Buffer" && Array.isArray(value.data)) return {
|
|
18
|
+
__t: "buf",
|
|
19
|
+
d: Buffer.from(value.data).toString("base64")
|
|
20
|
+
};
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function reviver(_key, value) {
|
|
24
|
+
if (value && typeof value === "object" && value.__t === "map") return new Map(value.d);
|
|
25
|
+
if (value && typeof value === "object" && value.__t === "buf") return Buffer.from(value.d, "base64");
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
/** Serializes a cache entry, keeping Buffers and Maps (RSC payloads, segment data). */
|
|
29
|
+
function encode(entry) {
|
|
30
|
+
return JSON.stringify(entry, replacer);
|
|
31
|
+
}
|
|
32
|
+
/** Restores a cache entry written by {@link encode}. */
|
|
33
|
+
function decode(raw) {
|
|
34
|
+
return JSON.parse(raw, reviver);
|
|
35
|
+
}
|
|
36
|
+
/** Explicit tags of a value: the context tags plus the `x-next-cache-tags` header of pages and route handlers. */
|
|
37
|
+
function entryTags(value, ctx) {
|
|
38
|
+
const tags = new Set(ctx?.tags ?? []);
|
|
39
|
+
const header = value?.headers?.[tagsHeader];
|
|
40
|
+
if (typeof header === "string") header.split(",").filter(Boolean).forEach((tag) => tags.add(tag));
|
|
41
|
+
return Array.from(tags);
|
|
42
|
+
}
|
|
43
|
+
function revalidateOf(value, ctx) {
|
|
44
|
+
const revalidate = ctx?.cacheControl?.revalidate ?? ctx?.revalidate ?? value?.revalidate;
|
|
45
|
+
return typeof revalidate === "number" || revalidate === false ? revalidate : null;
|
|
46
|
+
}
|
|
47
|
+
let sharedClient;
|
|
48
|
+
/** A connecting client used only while ready: awaiting `connect()` would hang every request while Redis is down. */
|
|
49
|
+
async function getRedisClient() {
|
|
50
|
+
if (!process.env.REDIS_URL) return;
|
|
51
|
+
if (!sharedClient) {
|
|
52
|
+
const { createClient } = await import("redis");
|
|
53
|
+
const client = createClient({
|
|
54
|
+
url: process.env.REDIS_URL,
|
|
55
|
+
disableOfflineQueue: true,
|
|
56
|
+
socket: {
|
|
57
|
+
connectTimeout: 2e3,
|
|
58
|
+
reconnectStrategy: (retries) => Math.min(retries * 200, 5e3)
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
sharedClient = client;
|
|
62
|
+
let logged = false;
|
|
63
|
+
client.on("error", (error) => {
|
|
64
|
+
if (!logged) {
|
|
65
|
+
console.warn("[cache-handler] redis unavailable, serving uncached:", error.message);
|
|
66
|
+
logged = true;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
client.on("ready", () => {
|
|
70
|
+
logged = false;
|
|
71
|
+
});
|
|
72
|
+
client.connect().catch(() => {});
|
|
73
|
+
}
|
|
74
|
+
return sharedClient.isReady ? sharedClient : void 0;
|
|
75
|
+
}
|
|
76
|
+
/** Builds the handler class around a client getter, so tests can inject one. */
|
|
77
|
+
function createRedisCacheHandler(getClient = getRedisClient, prefix = redisPrefix()) {
|
|
78
|
+
const k = keys(prefix);
|
|
79
|
+
return class RedisCacheHandler {
|
|
80
|
+
constructor(_ctx) {}
|
|
81
|
+
async get(key, ctx) {
|
|
82
|
+
const client = await getClient();
|
|
83
|
+
if (!client?.isReady) return null;
|
|
84
|
+
try {
|
|
85
|
+
const raw = await client.get(k.entry + key);
|
|
86
|
+
if (!raw) return null;
|
|
87
|
+
const entry = decode(raw);
|
|
88
|
+
const tags = [...new Set([
|
|
89
|
+
...entry.tags ?? [],
|
|
90
|
+
...ctx?.tags ?? [],
|
|
91
|
+
...ctx?.softTags ?? []
|
|
92
|
+
])];
|
|
93
|
+
if (!tags.length) return {
|
|
94
|
+
lastModified: entry.lastModified,
|
|
95
|
+
value: entry.value
|
|
96
|
+
};
|
|
97
|
+
const [expired, stale] = await Promise.all([client.mGet(tags.map((tag) => k.expired + tag)), client.mGet(tags.map((tag) => k.stale + tag))]);
|
|
98
|
+
const now = Date.now();
|
|
99
|
+
if (expired.some((at) => at && Number(at) > entry.lastModified && Number(at) <= now)) return null;
|
|
100
|
+
if (stale.some((at) => at && Number(at) > entry.lastModified)) {
|
|
101
|
+
if (typeof entry.revalidate !== "number") return null;
|
|
102
|
+
return {
|
|
103
|
+
lastModified: Math.min(entry.lastModified, now - entry.revalidate * 1e3 - 1),
|
|
104
|
+
value: entry.value
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
lastModified: entry.lastModified,
|
|
109
|
+
value: entry.value
|
|
110
|
+
};
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async set(key, data, ctx) {
|
|
116
|
+
const client = await getClient();
|
|
117
|
+
if (!client?.isReady) return;
|
|
118
|
+
try {
|
|
119
|
+
if (data == null) {
|
|
120
|
+
await client.del([k.entry + key, k.meta + key]);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const entry = {
|
|
124
|
+
lastModified: Date.now(),
|
|
125
|
+
tags: entryTags(data, ctx),
|
|
126
|
+
revalidate: revalidateOf(data, ctx),
|
|
127
|
+
value: data
|
|
128
|
+
};
|
|
129
|
+
const raw = encode(entry);
|
|
130
|
+
const expire = ctx?.cacheControl?.expire;
|
|
131
|
+
const ttl = typeof expire === "number" && Number.isFinite(expire) && expire > 0 ? { EX: Math.ceil(expire) } : void 0;
|
|
132
|
+
const meta = {
|
|
133
|
+
lastModified: entry.lastModified,
|
|
134
|
+
tags: entry.tags,
|
|
135
|
+
revalidate: entry.revalidate,
|
|
136
|
+
kind: data.kind ?? null,
|
|
137
|
+
status: typeof data.status === "number" ? data.status : null,
|
|
138
|
+
size: Buffer.byteLength(raw)
|
|
139
|
+
};
|
|
140
|
+
await Promise.all([client.set(k.entry + key, raw, ttl), client.set(k.meta + key, JSON.stringify(meta), ttl)]);
|
|
141
|
+
} catch {}
|
|
142
|
+
}
|
|
143
|
+
async revalidateTag(tags, durations) {
|
|
144
|
+
const list = (Array.isArray(tags) ? tags : [tags]).filter(Boolean);
|
|
145
|
+
const client = await getClient();
|
|
146
|
+
if (!client?.isReady || !list.length) return;
|
|
147
|
+
const now = Date.now();
|
|
148
|
+
const writes = [];
|
|
149
|
+
for (const tag of list) if (durations) {
|
|
150
|
+
writes.push([k.stale + tag, String(now)]);
|
|
151
|
+
if (durations.expire !== void 0) writes.push([k.expired + tag, String(now + durations.expire * 1e3)]);
|
|
152
|
+
} else writes.push([k.expired + tag, String(now)]);
|
|
153
|
+
try {
|
|
154
|
+
await client.mSet(writes);
|
|
155
|
+
} catch {}
|
|
156
|
+
}
|
|
157
|
+
resetRequestCache() {}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
var redis_default = createRedisCacheHandler();
|
|
161
|
+
//#endregion
|
|
162
|
+
export { createRedisCacheHandler, decode, redis_default as default, encode, getRedisClient, keys, redisPrefix };
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=redis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.js","names":[],"sources":["../../src/cache-handler/redis.ts"],"sourcesContent":["/**\n * Next.js incremental cache handler (ISR pages, route handlers, `fetch` and `unstable_cache` entries) backed by\n * Redis, shared by every instance of a site. Set it in `next.config` with `withBom()`, or directly:\n * `cacheHandler: require.resolve('@websolutespa/bom-next/cache-handlers/isr')`, `cacheMaxMemorySize: 0`.\n *\n * - Entries: `${REDIS_PREFIX}:next:<key>`, written as `{ lastModified, tags, revalidate, value }` (in this\n * order: the cache panel reads the head of the value without parsing the page).\n * - Meta: `${REDIS_PREFIX}:next-meta:<key>`, a small JSON per entry that the cache panel lists with SCAN.\n * - Tags: `${REDIS_PREFIX}:next-tag:<tag>` is when the tag expired (the next request waits for a fresh render),\n * `${REDIS_PREFIX}:next-tag-stale:<tag>` when it went stale (served once more, regenerated in the background).\n * `revalidateTag(tag, 'max')` sets the stale time; `revalidateTag(tag, { expire: 0 })`, `updateTag` and\n * `revalidatePath` set the expiry. Next.js only applies stale tags of its own file-system cache, so this handler\n * reports a stale entry by moving its `lastModified` back past its revalidate time.\n * - Redis down: reads miss and writes are dropped, so pages still render (uncached) instead of failing.\n */\n\n/** The subset of a `redis` client this handler uses (injectable for tests). */\nexport type RedisLike = {\n isReady: boolean;\n get(key: string): Promise<string | null>;\n mGet(keys: string[]): Promise<(string | null)[]>;\n set(key: string, value: string, options?: { EX?: number }): Promise<unknown>;\n mSet(entries: [string, string][]): Promise<unknown>;\n del(key: string | string[]): Promise<unknown>;\n};\n\nexport type CacheHandlerContext = {\n tags?: string[];\n softTags?: string[];\n revalidate?: number | false;\n cacheControl?: { revalidate?: number | false; expire?: number };\n};\n\nexport const tagsHeader = 'x-next-cache-tags';\n\nexport function redisPrefix(env: NodeJS.ProcessEnv = process.env): string {\n return env.REDIS_PREFIX ? `${env.REDIS_PREFIX}:` : '';\n}\n\nexport const keys = (prefix: string) => ({\n entry: `${prefix}next:`,\n meta: `${prefix}next-meta:`,\n expired: `${prefix}next-tag:`,\n stale: `${prefix}next-tag-stale:`,\n});\n\nfunction replacer(_key: string, value: unknown) {\n if (value instanceof Map) {\n return { __t: 'map', d: Array.from(value.entries()) };\n }\n if (\n value &&\n typeof value === 'object' &&\n (value as { type?: string }).type === 'Buffer' &&\n Array.isArray((value as { data?: unknown }).data)\n ) {\n return { __t: 'buf', d: Buffer.from((value as { data: number[] }).data).toString('base64') };\n }\n return value;\n}\n\nfunction reviver(_key: string, value: unknown) {\n if (value && typeof value === 'object' && (value as { __t?: string }).__t === 'map') {\n return new Map((value as { d: [unknown, unknown][] }).d);\n }\n if (value && typeof value === 'object' && (value as { __t?: string }).__t === 'buf') {\n return Buffer.from((value as { d: string }).d, 'base64');\n }\n return value;\n}\n\n/** Serializes a cache entry, keeping Buffers and Maps (RSC payloads, segment data). */\nexport function encode(entry: unknown): string {\n return JSON.stringify(entry, replacer);\n}\n\n/** Restores a cache entry written by {@link encode}. */\nexport function decode<T = unknown>(raw: string): T {\n return JSON.parse(raw, reviver) as T;\n}\n\n/** The fields of a Next.js cache value this handler reads; the rest is stored as it is. */\ntype CacheValue = {\n kind?: string;\n status?: number;\n revalidate?: number | false;\n headers?: Record<string, string | string[] | undefined>;\n};\n\ntype StoredEntry = {\n lastModified: number;\n tags: string[];\n revalidate: number | false | null;\n value: CacheValue;\n};\n\n/** Explicit tags of a value: the context tags plus the `x-next-cache-tags` header of pages and route handlers. */\nexport function entryTags(\n value: CacheValue | null | undefined,\n ctx: CacheHandlerContext | undefined\n): string[] {\n const tags = new Set(ctx?.tags ?? []);\n const header = value?.headers?.[tagsHeader];\n if (typeof header === 'string') {\n header\n .split(',')\n .filter(Boolean)\n .forEach((tag) => tags.add(tag));\n }\n return Array.from(tags);\n}\n\nfunction revalidateOf(\n value: CacheValue,\n ctx: CacheHandlerContext | undefined\n): number | false | null {\n const revalidate = ctx?.cacheControl?.revalidate ?? ctx?.revalidate ?? value?.revalidate;\n return typeof revalidate === 'number' || revalidate === false ? revalidate : null;\n}\n\ntype ConnectingClient = RedisLike & {\n on(event: 'error' | 'ready', listener: (error: Error) => void): unknown;\n connect(): Promise<unknown>;\n};\n\nlet sharedClient: ConnectingClient | undefined;\n\n/** A connecting client used only while ready: awaiting `connect()` would hang every request while Redis is down. */\nexport async function getRedisClient(): Promise<RedisLike | undefined> {\n if (!process.env.REDIS_URL) {\n return undefined;\n }\n if (!sharedClient) {\n const { createClient } = await import('redis');\n const client = createClient({\n url: process.env.REDIS_URL,\n // fail fast while disconnected instead of queueing commands behind a dead socket\n disableOfflineQueue: true,\n socket: {\n connectTimeout: 2000,\n reconnectStrategy: (retries: number) => Math.min(retries * 200, 5000),\n },\n }) as unknown as ConnectingClient;\n sharedClient = client;\n let logged = false;\n client.on('error', (error: Error) => {\n if (!logged) {\n console.warn('[cache-handler] redis unavailable, serving uncached:', error.message);\n logged = true;\n }\n });\n client.on('ready', () => {\n logged = false;\n });\n client.connect().catch(() => {\n /* reported by the error listener, retried by reconnectStrategy */\n });\n }\n return sharedClient.isReady ? sharedClient : undefined;\n}\n\n/** Builds the handler class around a client getter, so tests can inject one. */\nexport function createRedisCacheHandler(\n getClient: () => Promise<RedisLike | undefined> = getRedisClient,\n prefix = redisPrefix()\n) {\n const k = keys(prefix);\n return class RedisCacheHandler {\n constructor(_ctx?: unknown) {}\n\n async get(key: string, ctx?: CacheHandlerContext) {\n const client = await getClient();\n if (!client?.isReady) {\n return null;\n }\n try {\n const raw = await client.get(k.entry + key);\n if (!raw) {\n return null;\n }\n const entry = decode<StoredEntry>(raw);\n const tags = [\n ...new Set([...(entry.tags ?? []), ...(ctx?.tags ?? []), ...(ctx?.softTags ?? [])]),\n ];\n if (!tags.length) {\n return { lastModified: entry.lastModified, value: entry.value };\n }\n const [expired, stale] = await Promise.all([\n client.mGet(tags.map((tag) => k.expired + tag)),\n client.mGet(tags.map((tag) => k.stale + tag)),\n ]);\n const now = Date.now();\n // an expiry set after this entry was written, and already reached, is a miss: blocking regeneration\n if (expired.some((at) => at && Number(at) > entry.lastModified && Number(at) <= now)) {\n return null;\n }\n if (stale.some((at) => at && Number(at) > entry.lastModified)) {\n if (typeof entry.revalidate !== 'number') {\n // never revalidated by time: a stale entry can only be regenerated by a miss\n return null;\n }\n // serve once more and regenerate in the background: Next.js sees an entry past its revalidate time\n return {\n lastModified: Math.min(entry.lastModified, now - entry.revalidate * 1000 - 1),\n value: entry.value,\n };\n }\n return { lastModified: entry.lastModified, value: entry.value };\n } catch {\n return null;\n }\n }\n\n async set(key: string, data: CacheValue | null, ctx?: CacheHandlerContext) {\n const client = await getClient();\n if (!client?.isReady) {\n return;\n }\n try {\n if (data == null) {\n await client.del([k.entry + key, k.meta + key]);\n return;\n }\n const entry: StoredEntry = {\n lastModified: Date.now(),\n tags: entryTags(data, ctx),\n revalidate: revalidateOf(data, ctx),\n value: data,\n };\n const raw = encode(entry);\n const expire = ctx?.cacheControl?.expire;\n const ttl =\n typeof expire === 'number' && Number.isFinite(expire) && expire > 0\n ? { EX: Math.ceil(expire) }\n : undefined;\n const meta = {\n lastModified: entry.lastModified,\n tags: entry.tags,\n revalidate: entry.revalidate,\n kind: data.kind ?? null,\n status: typeof data.status === 'number' ? data.status : null,\n size: Buffer.byteLength(raw),\n };\n await Promise.all([\n client.set(k.entry + key, raw, ttl),\n client.set(k.meta + key, JSON.stringify(meta), ttl),\n ]);\n } catch {\n // a failed write only costs a regeneration on the next request\n }\n }\n\n async revalidateTag(tags: string | string[], durations?: { expire?: number }) {\n const list = (Array.isArray(tags) ? tags : [tags]).filter(Boolean);\n const client = await getClient();\n if (!client?.isReady || !list.length) {\n return;\n }\n const now = Date.now();\n const writes: [string, string][] = [];\n for (const tag of list) {\n if (durations) {\n writes.push([k.stale + tag, String(now)]);\n if (durations.expire !== undefined) {\n writes.push([k.expired + tag, String(now + durations.expire * 1000)]);\n }\n } else {\n writes.push([k.expired + tag, String(now)]);\n }\n }\n try {\n await client.mSet(writes);\n } catch {\n // the entries expire on their own\n }\n }\n\n resetRequestCache() {}\n };\n}\n\nexport default createRedisCacheHandler();\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RedisLike } from "../cache-handler/redis.js";
|
|
2
|
+
import { CacheHandler } from "next/cache";
|
|
3
|
+
|
|
4
|
+
//#region src/cache-handlers/default.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* `cacheHandlers.default` for `'use cache'` (Cache Components), set by `withBom()`. In memory per process by
|
|
7
|
+
* default (bounded, least recently used out first); shared in Redis when `REDIS_URL` is set. Tag state uses the
|
|
8
|
+
* same keys as the ISR handler (`next-tag:` expired, `next-tag-stale:` stale), so one `revalidateTag` reaches
|
|
9
|
+
* pages and cached functions on every instance. It also keeps a small index of what it stores, which the cache
|
|
10
|
+
* panel lists (`listUseCacheEntries`).
|
|
11
|
+
*/
|
|
12
|
+
type UseCacheMeta = {
|
|
13
|
+
key: string;
|
|
14
|
+
tags: string[];
|
|
15
|
+
timestamp: number;
|
|
16
|
+
revalidate: number;
|
|
17
|
+
expire: number;
|
|
18
|
+
size: number;
|
|
19
|
+
};
|
|
20
|
+
/** Entries of this process (memory mode) for the cache panel. */
|
|
21
|
+
declare function listUseCacheEntries(): UseCacheMeta[];
|
|
22
|
+
declare function createUseCacheHandler(getClient?: () => Promise<RedisLike | undefined>, prefix?: string, useRedis?: boolean): CacheHandler;
|
|
23
|
+
declare const _default: CacheHandler;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { _default, createUseCacheHandler, listUseCacheEntries };
|
|
26
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","names":[],"sources":["../../src/cache-handlers/default.ts"],"mappings":";;;;;;AAUA;;;;;KAAY,YAAA;EACV,GAAA;EACA,IAAA;EACA,SAAA;EACA,UAAA;EACA,MAAA;EACA,IAAA;AAAA;AAmEF;AAAA,iBAvBgB,mBAAA,CAAA,GAAuB,YAAA;AAAA,iBAuBvB,qBAAA,CACd,SAAA,SAAiB,OAAA,CAAQ,SAAA,eACzB,MAAA,WACA,QAAA,aACC,YAAA;AAAA,cA4JF,QAAA"}
|