@praxium/sdk 0.3.52 → 0.3.56
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 +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,19 +122,23 @@ try {
|
|
|
122
122
|
|
|
123
123
|
For websites using Next.js [ISR (Incremental Static Regeneration)](https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration), the SDK provides a webhook handler for on-demand cache revalidation. When an admin updates data (team, FAQ, opening hours), the platform sends an HMAC-signed webhook to your revalidation endpoint. The handler verifies the signature and calls `revalidatePath()` for the affected pages.
|
|
124
124
|
|
|
125
|
+
The `pathMap` is fully customizable — you define which pages to revalidate for each entity based on your website's routing structure:
|
|
126
|
+
|
|
125
127
|
```typescript
|
|
126
128
|
// app/api/revalidate/route.ts
|
|
127
129
|
import { createRevalidationHandler } from '@praxium/sdk/revalidation'
|
|
128
130
|
|
|
129
131
|
export const POST = createRevalidationHandler({
|
|
130
132
|
secret: process.env.PRAXIUM_REVALIDATION_SECRET!,
|
|
133
|
+
// Map platform entities to YOUR website's page paths.
|
|
134
|
+
// These are specific to your project's routing structure —
|
|
135
|
+
// adjust the paths to match your pages.
|
|
131
136
|
pathMap: {
|
|
132
|
-
// entity → locale-prefixed paths to revalidate
|
|
133
137
|
'team': ['/nl/team', '/en/team'],
|
|
134
138
|
'rates': ['/nl/tarieven', '/en/rates'],
|
|
135
139
|
'faq': ['/nl/faq', '/en/faq'],
|
|
136
|
-
'opening-hours': ['/nl', '/en'],
|
|
137
|
-
'all': ['/nl', '/en'],
|
|
140
|
+
'opening-hours': ['/nl', '/en'], // homepage shows opening hours
|
|
141
|
+
'all': ['/nl', '/en'], // full-site revalidation
|
|
138
142
|
},
|
|
139
143
|
})
|
|
140
144
|
```
|
|
@@ -143,7 +147,7 @@ export const POST = createRevalidationHandler({
|
|
|
143
147
|
|
|
144
148
|
The handler includes HMAC-SHA256 signature verification, timestamp-based replay protection (5-minute window), and timing-safe comparison. Requires `next` as a peer dependency.
|
|
145
149
|
|
|
146
|
-
##
|
|
150
|
+
## Contributing
|
|
147
151
|
|
|
148
152
|
```bash
|
|
149
153
|
npm run generate # Regenerate client from OpenAPI spec
|