@hocuspocus/provider 4.0.0-rc.6 → 4.0.0-rc.7
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 +61 -1167
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +24 -1131
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/index.d.ts +10 -162
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,125 +1,10 @@
|
|
|
1
|
+
import { Awareness } from "y-protocols/awareness";
|
|
1
2
|
import * as Y from "yjs";
|
|
3
|
+
import * as lib0_encoding0 from "lib0/encoding";
|
|
4
|
+
import { Encoder } from "lib0/encoding";
|
|
2
5
|
import { CloseEvent } from "@hocuspocus/common";
|
|
6
|
+
import { Decoder } from "lib0/decoding";
|
|
3
7
|
|
|
4
|
-
//#region node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/observable.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Handles named events.
|
|
7
|
-
*
|
|
8
|
-
* @deprecated
|
|
9
|
-
* @template N
|
|
10
|
-
*/
|
|
11
|
-
declare class Observable<N> {
|
|
12
|
-
/**
|
|
13
|
-
* Some desc.
|
|
14
|
-
* @type {Map<N, any>}
|
|
15
|
-
*/
|
|
16
|
-
_observers: Map<N, any>;
|
|
17
|
-
/**
|
|
18
|
-
* @param {N} name
|
|
19
|
-
* @param {function} f
|
|
20
|
-
*/
|
|
21
|
-
on(name: N, f: Function): void;
|
|
22
|
-
/**
|
|
23
|
-
* @param {N} name
|
|
24
|
-
* @param {function} f
|
|
25
|
-
*/
|
|
26
|
-
once(name: N, f: Function): void;
|
|
27
|
-
/**
|
|
28
|
-
* @param {N} name
|
|
29
|
-
* @param {function} f
|
|
30
|
-
*/
|
|
31
|
-
off(name: N, f: Function): void;
|
|
32
|
-
/**
|
|
33
|
-
* Emit a named event. All registered event listeners that listen to the
|
|
34
|
-
* specified name will receive the event.
|
|
35
|
-
*
|
|
36
|
-
* @todo This should catch exceptions
|
|
37
|
-
*
|
|
38
|
-
* @param {N} name The event name.
|
|
39
|
-
* @param {Array<any>} args The arguments that are applied to the event listener.
|
|
40
|
-
*/
|
|
41
|
-
emit(name: N, args: Array<any>): void;
|
|
42
|
-
destroy(): void;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.29/node_modules/y-protocols/awareness.d.ts
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {Object} MetaClientState
|
|
48
|
-
* @property {number} MetaClientState.clock
|
|
49
|
-
* @property {number} MetaClientState.lastUpdated unix timestamp
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
* The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information
|
|
53
|
-
* (cursor, username, status, ..). Each client can update its own local state and listen to state changes of
|
|
54
|
-
* remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline.
|
|
55
|
-
*
|
|
56
|
-
* Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override
|
|
57
|
-
* its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is
|
|
58
|
-
* applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that
|
|
59
|
-
* a remote client is offline, it may propagate a message with
|
|
60
|
-
* `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a
|
|
61
|
-
* message is received, and the known clock of that client equals the received clock, it will override the state with `null`.
|
|
62
|
-
*
|
|
63
|
-
* Before a client disconnects, it should propagate a `null` state with an updated clock.
|
|
64
|
-
*
|
|
65
|
-
* Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state.
|
|
66
|
-
*
|
|
67
|
-
* @extends {Observable<string>}
|
|
68
|
-
*/
|
|
69
|
-
declare class Awareness extends Observable<string> {
|
|
70
|
-
/**
|
|
71
|
-
* @param {Y.Doc} doc
|
|
72
|
-
*/
|
|
73
|
-
constructor(doc: Y.Doc);
|
|
74
|
-
doc: Y.Doc;
|
|
75
|
-
/**
|
|
76
|
-
* @type {number}
|
|
77
|
-
*/
|
|
78
|
-
clientID: number;
|
|
79
|
-
/**
|
|
80
|
-
* Maps from client id to client state
|
|
81
|
-
* @type {Map<number, Object<string, any>>}
|
|
82
|
-
*/
|
|
83
|
-
states: Map<number, {
|
|
84
|
-
[x: string]: any;
|
|
85
|
-
}>;
|
|
86
|
-
/**
|
|
87
|
-
* @type {Map<number, MetaClientState>}
|
|
88
|
-
*/
|
|
89
|
-
meta: Map<number, MetaClientState>;
|
|
90
|
-
_checkInterval: any;
|
|
91
|
-
/**
|
|
92
|
-
* @return {Object<string,any>|null}
|
|
93
|
-
*/
|
|
94
|
-
getLocalState(): {
|
|
95
|
-
[x: string]: any;
|
|
96
|
-
} | null;
|
|
97
|
-
/**
|
|
98
|
-
* @param {Object<string,any>|null} state
|
|
99
|
-
*/
|
|
100
|
-
setLocalState(state: {
|
|
101
|
-
[x: string]: any;
|
|
102
|
-
} | null): void;
|
|
103
|
-
/**
|
|
104
|
-
* @param {string} field
|
|
105
|
-
* @param {any} value
|
|
106
|
-
*/
|
|
107
|
-
setLocalStateField(field: string, value: any): void;
|
|
108
|
-
/**
|
|
109
|
-
* @return {Map<number,Object<string,any>>}
|
|
110
|
-
*/
|
|
111
|
-
getStates(): Map<number, {
|
|
112
|
-
[x: string]: any;
|
|
113
|
-
}>;
|
|
114
|
-
}
|
|
115
|
-
type MetaClientState = {
|
|
116
|
-
clock: number;
|
|
117
|
-
/**
|
|
118
|
-
* unix timestamp
|
|
119
|
-
*/
|
|
120
|
-
lastUpdated: number;
|
|
121
|
-
};
|
|
122
|
-
//#endregion
|
|
123
8
|
//#region packages/provider/src/EventEmitter.d.ts
|
|
124
9
|
declare class EventEmitter {
|
|
125
10
|
callbacks: {
|
|
@@ -131,43 +16,6 @@ declare class EventEmitter {
|
|
|
131
16
|
removeAllListeners(): void;
|
|
132
17
|
}
|
|
133
18
|
//#endregion
|
|
134
|
-
//#region node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/encoding.d.ts
|
|
135
|
-
/**
|
|
136
|
-
* A BinaryEncoder handles the encoding to an Uint8Array.
|
|
137
|
-
*/
|
|
138
|
-
declare class Encoder {
|
|
139
|
-
cpos: number;
|
|
140
|
-
cbuf: Uint8Array<ArrayBuffer>;
|
|
141
|
-
/**
|
|
142
|
-
* @type {Array<Uint8Array>}
|
|
143
|
-
*/
|
|
144
|
-
bufs: Array<Uint8Array>;
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/decoding.d.ts
|
|
148
|
-
/**
|
|
149
|
-
* A Decoder handles the decoding of an Uint8Array.
|
|
150
|
-
* @template {ArrayBufferLike} [Buf=ArrayBufferLike]
|
|
151
|
-
*/
|
|
152
|
-
declare class Decoder<Buf extends ArrayBufferLike = ArrayBufferLike> {
|
|
153
|
-
/**
|
|
154
|
-
* @param {Uint8Array<Buf>} uint8Array Binary data to decode
|
|
155
|
-
*/
|
|
156
|
-
constructor(uint8Array: Uint8Array<Buf>);
|
|
157
|
-
/**
|
|
158
|
-
* Decoding target.
|
|
159
|
-
*
|
|
160
|
-
* @type {Uint8Array<Buf>}
|
|
161
|
-
*/
|
|
162
|
-
arr: Uint8Array<Buf>;
|
|
163
|
-
/**
|
|
164
|
-
* Current decoding position.
|
|
165
|
-
*
|
|
166
|
-
* @type {number}
|
|
167
|
-
*/
|
|
168
|
-
pos: number;
|
|
169
|
-
}
|
|
170
|
-
//#endregion
|
|
171
19
|
//#region packages/provider/src/IncomingMessage.d.ts
|
|
172
20
|
declare class IncomingMessage {
|
|
173
21
|
data: any;
|
|
@@ -197,42 +45,42 @@ declare class OutgoingMessage implements OutgoingMessageInterface {
|
|
|
197
45
|
declare class AuthenticationMessage extends OutgoingMessage {
|
|
198
46
|
type: MessageType;
|
|
199
47
|
description: string;
|
|
200
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
48
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
201
49
|
}
|
|
202
50
|
//#endregion
|
|
203
51
|
//#region packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts
|
|
204
52
|
declare class AwarenessMessage extends OutgoingMessage {
|
|
205
53
|
type: MessageType;
|
|
206
54
|
description: string;
|
|
207
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
55
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
208
56
|
}
|
|
209
57
|
//#endregion
|
|
210
58
|
//#region packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts
|
|
211
59
|
declare class QueryAwarenessMessage extends OutgoingMessage {
|
|
212
60
|
type: MessageType;
|
|
213
61
|
description: string;
|
|
214
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
62
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
215
63
|
}
|
|
216
64
|
//#endregion
|
|
217
65
|
//#region packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts
|
|
218
66
|
declare class SyncStepOneMessage extends OutgoingMessage {
|
|
219
67
|
type: MessageType;
|
|
220
68
|
description: string;
|
|
221
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
69
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
222
70
|
}
|
|
223
71
|
//#endregion
|
|
224
72
|
//#region packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts
|
|
225
73
|
declare class SyncStepTwoMessage extends OutgoingMessage {
|
|
226
74
|
type: MessageType;
|
|
227
75
|
description: string;
|
|
228
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
76
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
229
77
|
}
|
|
230
78
|
//#endregion
|
|
231
79
|
//#region packages/provider/src/OutgoingMessages/UpdateMessage.d.ts
|
|
232
80
|
declare class UpdateMessage extends OutgoingMessage {
|
|
233
81
|
type: MessageType;
|
|
234
82
|
description: string;
|
|
235
|
-
get(args: Partial<OutgoingMessageArguments>): Encoder;
|
|
83
|
+
get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
|
|
236
84
|
}
|
|
237
85
|
//#endregion
|
|
238
86
|
//#region packages/provider/src/types.d.ts
|
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.7",
|
|
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.7",
|
|
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": "d214278ee34bd1d776054cdc2a2227e3f05449d7",
|
|
42
42
|
"repository": {
|
|
43
43
|
"url": "https://github.com/ueberdosis/hocuspocus"
|
|
44
44
|
},
|