@hookflo/tern 2.0.2-experimental.0 → 2.0.3-experimental.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 +50 -0
- package/package.json +30 -5
package/README.md
CHANGED
|
@@ -496,3 +496,53 @@ MIT License - see [LICENSE](./LICENSE) for details.
|
|
|
496
496
|
- [Framework Summary](./FRAMEWORK_SUMMARY.md)
|
|
497
497
|
- [Architecture Guide](./ARCHITECTURE.md)
|
|
498
498
|
- [Issues](https://github.com/Hookflo/tern/issues)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
## Troubleshooting
|
|
502
|
+
|
|
503
|
+
### `Module not found: Can't resolve "@hookflo/tern/nextjs"`
|
|
504
|
+
|
|
505
|
+
If this happens in a Next.js project, it usually means one of these:
|
|
506
|
+
|
|
507
|
+
1. You installed an older published package version that does not include subpath exports yet.
|
|
508
|
+
2. Lockfile still points to an old tarball/version.
|
|
509
|
+
3. `node_modules` cache is stale after upgrading.
|
|
510
|
+
|
|
511
|
+
Fix steps:
|
|
512
|
+
|
|
513
|
+
```bash
|
|
514
|
+
# in your Next.js app
|
|
515
|
+
npm i @hookflo/tern@latest
|
|
516
|
+
rm -rf node_modules package-lock.json .next
|
|
517
|
+
npm i
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Then verify resolution:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
node -e "console.log(require.resolve('@hookflo/tern/nextjs'))"
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
If you are testing this repo locally before publish:
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# inside /workspace/tern
|
|
530
|
+
npm run build
|
|
531
|
+
npm pack
|
|
532
|
+
|
|
533
|
+
# inside your other project
|
|
534
|
+
npm i /path/to/hookflo-tern-<version>.tgz
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Minimal Next.js App Router usage:
|
|
538
|
+
|
|
539
|
+
```ts
|
|
540
|
+
import { createWebhookHandler } from '@hookflo/tern/nextjs';
|
|
541
|
+
|
|
542
|
+
export const POST = createWebhookHandler({
|
|
543
|
+
platform: 'stripe',
|
|
544
|
+
secret: process.env.STRIPE_WEBHOOK_SECRET!,
|
|
545
|
+
handler: async (payload) => ({ received: true, event: payload.event ?? payload.type }),
|
|
546
|
+
});
|
|
547
|
+
```
|
|
548
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hookflo/tern",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-experimental.0",
|
|
4
4
|
"description": "A robust, scalable webhook verification framework supporting multiple platforms and signature algorithms",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -73,20 +73,45 @@
|
|
|
73
73
|
},
|
|
74
74
|
"exports": {
|
|
75
75
|
".": {
|
|
76
|
+
"types": "./dist/index.d.ts",
|
|
76
77
|
"require": "./dist/index.js",
|
|
77
|
-
"
|
|
78
|
+
"import": "./dist/index.js",
|
|
79
|
+
"default": "./dist/index.js"
|
|
78
80
|
},
|
|
79
81
|
"./express": {
|
|
82
|
+
"types": "./dist/express.d.ts",
|
|
80
83
|
"require": "./dist/express.js",
|
|
81
|
-
"
|
|
84
|
+
"import": "./dist/express.js",
|
|
85
|
+
"default": "./dist/express.js"
|
|
82
86
|
},
|
|
83
87
|
"./nextjs": {
|
|
88
|
+
"types": "./dist/nextjs.d.ts",
|
|
84
89
|
"require": "./dist/nextjs.js",
|
|
85
|
-
"
|
|
90
|
+
"import": "./dist/nextjs.js",
|
|
91
|
+
"default": "./dist/nextjs.js"
|
|
86
92
|
},
|
|
87
93
|
"./cloudflare": {
|
|
94
|
+
"types": "./dist/cloudflare.d.ts",
|
|
88
95
|
"require": "./dist/cloudflare.js",
|
|
89
|
-
"
|
|
96
|
+
"import": "./dist/cloudflare.js",
|
|
97
|
+
"default": "./dist/cloudflare.js"
|
|
98
|
+
},
|
|
99
|
+
"./package.json": "./package.json"
|
|
100
|
+
},
|
|
101
|
+
"typesVersions": {
|
|
102
|
+
"*": {
|
|
103
|
+
"express": [
|
|
104
|
+
"dist/express.d.ts"
|
|
105
|
+
],
|
|
106
|
+
"nextjs": [
|
|
107
|
+
"dist/nextjs.d.ts"
|
|
108
|
+
],
|
|
109
|
+
"cloudflare": [
|
|
110
|
+
"dist/cloudflare.d.ts"
|
|
111
|
+
],
|
|
112
|
+
"*": [
|
|
113
|
+
"dist/index.d.ts"
|
|
114
|
+
]
|
|
90
115
|
}
|
|
91
116
|
}
|
|
92
117
|
}
|