@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.
Files changed (2) hide show
  1. package/README.md +35 -5
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -4,11 +4,41 @@
4
4
  [![License](https://img.shields.io/npm/l/@hocuspocus/extension-webhook.svg)](https://www.npmjs.com/package/@hocuspocus/extension-webhook)
5
5
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
6
 
7
- ## Introduction
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
- ## Official Documentation
11
- Documentation can be found in the [GitHub repository](https://github.com/ueberdosis/hocuspocus).
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
- Hocuspocus is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
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-rc.7",
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-rc.7",
34
- "@hocuspocus/server": "^4.0.0-rc.7",
35
- "@hocuspocus/transformer": "^4.0.0-rc.7"
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": "d214278ee34bd1d776054cdc2a2227e3f05449d7",
40
+ "gitHead": "1c1b34800f702a06e1ce236e8a175c82876bff42",
41
41
  "repository": {
42
42
  "url": "https://github.com/ueberdosis/hocuspocus"
43
43
  },