@hocuspocus/extension-webhook 4.0.0-rc.7 → 4.0.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 +35 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,11 +4,41 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@hocuspocus/extension-webhook)
|
|
5
5
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Send HTTP webhooks for [Hocuspocus](https://github.com/ueberdosis/hocuspocus) document lifecycle events – for example when a document is connected to, changed, or stored. Lets you integrate the collaboration backend with your own services without writing a custom extension.
|
|
7
|
+
Send HTTP webhooks for [Hocuspocus](https://github.com/ueberdosis/hocuspocus) document lifecycle events — document changes, connects, disconnects, and creation. Lets you integrate the collaboration backend with your own services (search indexing, audit logs, downstream data pipelines) without writing a custom extension.
|
|
9
8
|
|
|
10
|
-
##
|
|
11
|
-
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @hocuspocus/extension-webhook
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { Server } from "@hocuspocus/server"
|
|
19
|
+
import { Webhook, Events } from "@hocuspocus/extension-webhook"
|
|
20
|
+
|
|
21
|
+
const server = new Server({
|
|
22
|
+
extensions: [
|
|
23
|
+
new Webhook({
|
|
24
|
+
url: "https://example.com/hocuspocus-webhook",
|
|
25
|
+
secret: "your-signing-secret",
|
|
26
|
+
events: [Events.onChange, Events.onConnect, Events.onDisconnect, Events.onCreate],
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
server.listen()
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Requests are signed with HMAC-SHA256 using your `secret`, sent in the `X-Hocuspocus-Signature-256` header so the receiver can verify authenticity.
|
|
35
|
+
|
|
36
|
+
`onChange` events are debounced (default `2000ms`, max wait `10000ms`) to avoid a request per keystroke — tune with the `debounce` and `debounceMaxWait` options.
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Payload shapes, signature verification, and debounce tuning: [tiptap.dev/docs/hocuspocus/server/extensions/webhook](https://tiptap.dev/docs/hocuspocus/server/extensions/webhook).
|
|
12
41
|
|
|
13
42
|
## License
|
|
14
|
-
|
|
43
|
+
|
|
44
|
+
MIT — see [LICENSE.md](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-webhook",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "hocuspocus webhook extension",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hocuspocus/common": "^4.0.0
|
|
34
|
-
"@hocuspocus/server": "^4.0.0
|
|
35
|
-
"@hocuspocus/transformer": "^4.0.0
|
|
33
|
+
"@hocuspocus/common": "^4.0.0",
|
|
34
|
+
"@hocuspocus/server": "^4.0.0",
|
|
35
|
+
"@hocuspocus/transformer": "^4.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"yjs": "^13.6.8"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1c1b34800f702a06e1ce236e8a175c82876bff42",
|
|
41
41
|
"repository": {
|
|
42
42
|
"url": "https://github.com/ueberdosis/hocuspocus"
|
|
43
43
|
},
|