@hocuspocus/provider 3.1.2 → 3.1.4
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/dist/hocuspocus-provider.cjs +111 -92
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +111 -92
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/packages/common/src/auth.d.ts +2 -2
- package/dist/packages/common/src/index.d.ts +4 -4
- package/dist/packages/extension-database/src/Database.d.ts +1 -1
- package/dist/packages/extension-database/src/index.d.ts +1 -1
- package/dist/packages/extension-logger/src/Logger.d.ts +1 -1
- package/dist/packages/extension-logger/src/index.d.ts +1 -1
- package/dist/packages/extension-redis/src/index.d.ts +1 -1
- package/dist/packages/extension-sqlite/src/SQLite.d.ts +3 -3
- package/dist/packages/extension-sqlite/src/index.d.ts +1 -1
- package/dist/packages/extension-throttle/src/index.d.ts +1 -1
- package/dist/packages/extension-webhook/src/index.d.ts +3 -3
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +10 -10
- package/dist/packages/provider/src/IncomingMessage.d.ts +3 -3
- package/dist/packages/provider/src/MessageReceiver.d.ts +2 -2
- package/dist/packages/provider/src/OutgoingMessage.d.ts +2 -2
- package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +3 -3
- package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +4 -4
- package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +4 -4
- package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +4 -4
- package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +3 -3
- package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +4 -4
- package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +4 -4
- package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +3 -3
- package/dist/packages/provider/src/index.d.ts +3 -3
- package/dist/packages/provider/src/types.d.ts +14 -14
- package/dist/packages/server/src/ClientConnection.d.ts +17 -17
- package/dist/packages/server/src/Connection.d.ts +6 -6
- package/dist/packages/server/src/DirectConnection.d.ts +3 -3
- package/dist/packages/server/src/Document.d.ts +4 -4
- package/dist/packages/server/src/Hocuspocus.d.ts +8 -8
- package/dist/packages/server/src/IncomingMessage.d.ts +3 -3
- package/dist/packages/server/src/MessageReceiver.d.ts +3 -3
- package/dist/packages/server/src/OutgoingMessage.d.ts +3 -3
- package/dist/packages/server/src/Server.d.ts +5 -5
- package/dist/packages/server/src/index.d.ts +9 -9
- package/dist/packages/server/src/types.d.ts +7 -7
- package/dist/packages/server/src/util/getParameters.d.ts +5 -5
- package/dist/packages/transformer/src/Prosemirror.d.ts +3 -3
- package/dist/packages/transformer/src/Tiptap.d.ts +3 -3
- package/dist/packages/transformer/src/index.d.ts +3 -3
- package/dist/packages/transformer/src/types.d.ts +1 -1
- package/dist/playground/frontend/app/SocketContext1.d.ts +2 -0
- package/dist/playground/frontend/app/SocketContext2.d.ts +2 -0
- package/package.json +40 -40
- package/src/EventEmitter.ts +32 -32
- package/src/HocuspocusProvider.ts +566 -498
- package/src/IncomingMessage.ts +47 -50
- package/src/MessageReceiver.ts +135 -132
- package/src/OutgoingMessage.ts +18 -14
- package/src/OutgoingMessages/AuthenticationMessage.ts +18 -16
- package/src/OutgoingMessages/AwarenessMessage.ts +38 -32
- package/src/OutgoingMessages/CloseMessage.ts +11 -11
- package/src/OutgoingMessages/QueryAwarenessMessage.ts +11 -12
- package/src/OutgoingMessages/StatelessMessage.ts +12 -12
- package/src/OutgoingMessages/SyncStepOneMessage.ts +18 -16
- package/src/OutgoingMessages/SyncStepTwoMessage.ts +18 -16
- package/src/OutgoingMessages/UpdateMessage.ts +13 -13
- package/src/index.ts +3 -3
- package/src/types.ts +69 -69
- package/dist/playground/frontend/app/SocketContext.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"name": "@hocuspocus/provider",
|
|
3
|
+
"version": "3.1.4",
|
|
4
|
+
"description": "hocuspocus provider",
|
|
5
|
+
"homepage": "https://hocuspocus.dev",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"hocuspocus",
|
|
8
|
+
"websocket",
|
|
9
|
+
"provider",
|
|
10
|
+
"yjs"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/hocuspocus-provider.cjs",
|
|
15
|
+
"module": "dist/hocuspocus-provider.esm.js",
|
|
16
|
+
"types": "dist/packages/provider/src/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"source": {
|
|
19
|
+
"import": "./src/index.ts"
|
|
20
|
+
},
|
|
21
|
+
"default": {
|
|
22
|
+
"import": "./dist/hocuspocus-provider.esm.js",
|
|
23
|
+
"require": "./dist/hocuspocus-provider.cjs",
|
|
24
|
+
"types": "./dist/packages/provider/src/index.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"src",
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@hocuspocus/common": "^3.1.4",
|
|
33
|
+
"@lifeomic/attempt": "^3.0.2",
|
|
34
|
+
"lib0": "^0.2.87",
|
|
35
|
+
"ws": "^8.17.1"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"y-protocols": "^1.0.6",
|
|
39
|
+
"yjs": "^13.6.8"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "cd788b6a315f608ef531524409abdce1e6790726"
|
|
42
42
|
}
|
package/src/EventEmitter.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
export default class EventEmitter {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
3
|
+
public callbacks: { [key: string]: Function[] } = {};
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
6
|
+
public on(event: string, fn: Function): this {
|
|
7
|
+
if (!this.callbacks[event]) {
|
|
8
|
+
this.callbacks[event] = [];
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
this.callbacks[event].push(fn);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
protected emit(event: string, ...args: any): this {
|
|
17
|
+
const callbacks = this.callbacks[event];
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (callbacks) {
|
|
20
|
+
callbacks.forEach((callback) => callback.apply(this, args));
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
27
|
+
public off(event: string, fn?: Function): this {
|
|
28
|
+
const callbacks = this.callbacks[event];
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
if (callbacks) {
|
|
31
|
+
if (fn) {
|
|
32
|
+
this.callbacks[event] = callbacks.filter((callback) => callback !== fn);
|
|
33
|
+
} else {
|
|
34
|
+
delete this.callbacks[event];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
removeAllListeners(): void {
|
|
42
|
+
this.callbacks = {};
|
|
43
|
+
}
|
|
44
44
|
}
|