@hocuspocus/provider 4.0.0-rc.2 → 4.0.0-rc.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 +3 -2
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +3 -2
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/HocuspocusProvider.ts +18 -18
- package/src/MessageReceiver.ts +3 -2
- package/src/version.ts +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/provider",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.4",
|
|
4
4
|
"description": "hocuspocus provider",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@hocuspocus/common": "^4.0.0-rc.
|
|
32
|
+
"@hocuspocus/common": "^4.0.0-rc.4",
|
|
33
33
|
"@lifeomic/attempt": "^3.0.2",
|
|
34
34
|
"lib0": "^0.2.87",
|
|
35
35
|
"ws": "^8.17.1"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"y-protocols": "^1.0.6",
|
|
39
39
|
"yjs": "^13.6.8"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "7e50dc8532dbb1bd1465a63721faeb170b99f196",
|
|
42
42
|
"repository": {
|
|
43
43
|
"url": "https://github.com/ueberdosis/hocuspocus"
|
|
44
44
|
},
|
|
@@ -12,22 +12,22 @@ import { AwarenessMessage } from "./OutgoingMessages/AwarenessMessage.ts";
|
|
|
12
12
|
import { StatelessMessage } from "./OutgoingMessages/StatelessMessage.ts";
|
|
13
13
|
import { SyncStepOneMessage } from "./OutgoingMessages/SyncStepOneMessage.ts";
|
|
14
14
|
import { UpdateMessage } from "./OutgoingMessages/UpdateMessage.ts";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
import type {
|
|
16
|
+
AuthorizedScope,
|
|
17
|
+
ConstructableOutgoingMessage,
|
|
18
|
+
onAuthenticatedParameters,
|
|
19
|
+
onAuthenticationFailedParameters,
|
|
20
|
+
onAwarenessChangeParameters,
|
|
21
|
+
onAwarenessUpdateParameters,
|
|
22
|
+
onCloseParameters,
|
|
23
|
+
onDisconnectParameters,
|
|
24
|
+
onMessageParameters,
|
|
25
|
+
onOpenParameters,
|
|
26
|
+
onOutgoingMessageParameters,
|
|
27
|
+
onStatelessParameters,
|
|
28
|
+
onStatusParameters,
|
|
29
|
+
onSyncedParameters,
|
|
30
|
+
onUnsyncedChangesParameters,
|
|
31
31
|
} from "./types.ts";
|
|
32
32
|
|
|
33
33
|
export type HocuspocusProviderConfiguration = Required<
|
|
@@ -118,9 +118,9 @@ export class AwarenessError extends Error {
|
|
|
118
118
|
export class HocuspocusProvider extends EventEmitter {
|
|
119
119
|
public configuration: CompleteHocuspocusProviderConfiguration = {
|
|
120
120
|
name: "",
|
|
121
|
-
// @ts-
|
|
121
|
+
// @ts-expect-error
|
|
122
122
|
document: undefined,
|
|
123
|
-
// @ts-
|
|
123
|
+
// @ts-expect-error
|
|
124
124
|
awareness: undefined,
|
|
125
125
|
token: null,
|
|
126
126
|
sessionAwareness: false,
|
package/src/MessageReceiver.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class MessageReceiver {
|
|
|
48
48
|
);
|
|
49
49
|
break;
|
|
50
50
|
|
|
51
|
-
case MessageType.CLOSE:
|
|
51
|
+
case MessageType.CLOSE: {
|
|
52
52
|
// eslint-disable-next-line no-case-declarations
|
|
53
53
|
const event: CloseEvent = {
|
|
54
54
|
code: 1000,
|
|
@@ -58,6 +58,7 @@ export class MessageReceiver {
|
|
|
58
58
|
provider.configuration.onClose({ event });
|
|
59
59
|
provider.forwardClose({ event });
|
|
60
60
|
break;
|
|
61
|
+
}
|
|
61
62
|
|
|
62
63
|
default:
|
|
63
64
|
console.error(`Can’t apply message of unknown type: ${type}`);
|
|
@@ -66,7 +67,7 @@ export class MessageReceiver {
|
|
|
66
67
|
// Reply
|
|
67
68
|
if (message.length() > emptyMessageLength + 1) {
|
|
68
69
|
// length of documentName (considered in emptyMessageLength plus length of yjs sync type, set in applySyncMessage)
|
|
69
|
-
// @ts-
|
|
70
|
+
// @ts-expect-error
|
|
70
71
|
provider.send(OutgoingMessage, { encoder: message.encoder });
|
|
71
72
|
}
|
|
72
73
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export const version: string =
|
|
2
|
+
// @ts-expect-error - __HOCUSPOCUS_VERSION__ is replaced at build time by rolldown
|
|
3
|
+
typeof __HOCUSPOCUS_VERSION__ !== "undefined"
|
|
4
|
+
? // @ts-expect-error - __HOCUSPOCUS_VERSION__ is replaced at build time by rolldown
|
|
5
|
+
__HOCUSPOCUS_VERSION__
|
|
6
|
+
: "unknown";
|