@hocuspocus/provider 1.0.0-alpha.27 → 1.0.0-alpha.31

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 (99) hide show
  1. package/dist/hocuspocus-provider.cjs +126 -351
  2. package/dist/hocuspocus-provider.cjs.map +1 -1
  3. package/dist/hocuspocus-provider.esm.js +123 -347
  4. package/dist/hocuspocus-provider.esm.js.map +1 -1
  5. package/dist/packages/common/src/CloseEvents.d.ts +23 -0
  6. package/dist/packages/common/src/awarenessStatesToArray.d.ts +3 -0
  7. package/dist/packages/common/src/index.d.ts +2 -0
  8. package/dist/packages/extension-database/src/Database.d.ts +32 -0
  9. package/dist/packages/extension-database/src/index.d.ts +1 -0
  10. package/dist/packages/extension-logger/src/Logger.d.ts +5 -0
  11. package/dist/packages/extension-sqlite/src/SQLite.d.ts +26 -0
  12. package/dist/packages/extension-sqlite/src/index.d.ts +1 -0
  13. package/dist/packages/extension-throttle/src/index.d.ts +6 -2
  14. package/dist/packages/extension-webhook/src/index.d.ts +2 -3
  15. package/dist/packages/provider/src/EventEmitter.d.ts +1 -1
  16. package/dist/packages/provider/src/HocuspocusCloudProvider.d.ts +4 -3
  17. package/dist/packages/provider/src/HocuspocusProvider.d.ts +17 -9
  18. package/dist/packages/provider/src/index.d.ts +0 -1
  19. package/dist/packages/provider/src/types.d.ts +10 -0
  20. package/dist/packages/server/src/Connection.d.ts +5 -5
  21. package/dist/packages/server/src/Debugger.d.ts +1 -2
  22. package/dist/packages/server/src/Document.d.ts +8 -5
  23. package/dist/packages/server/src/Hocuspocus.d.ts +32 -14
  24. package/dist/packages/server/src/MessageReceiver.d.ts +8 -5
  25. package/dist/packages/server/src/OutgoingMessage.d.ts +1 -0
  26. package/dist/packages/server/src/index.d.ts +7 -0
  27. package/dist/packages/server/src/types.d.ts +92 -23
  28. package/dist/{demos/backend/src/express.d.ts → playground/backend/src/default.d.ts} +0 -0
  29. package/dist/{demos/backend/src/koa.d.ts → playground/backend/src/express.d.ts} +0 -0
  30. package/dist/{demos/backend/src/load-document.d.ts → playground/backend/src/koa.d.ts} +0 -0
  31. package/dist/{demos/backend/src/minimal.d.ts → playground/backend/src/load-document.d.ts} +0 -0
  32. package/dist/{demos → playground}/backend/src/monitor.d.ts +0 -0
  33. package/dist/{demos → playground}/backend/src/redis.d.ts +0 -0
  34. package/dist/{demos → playground}/backend/src/slow.d.ts +0 -0
  35. package/dist/{demos → playground}/backend/src/webhook.d.ts +0 -0
  36. package/dist/tests/extension-logger/onListen.d.ts +1 -0
  37. package/dist/tests/extension-redis/onLoadDocument.d.ts +1 -0
  38. package/dist/tests/extension-redis/onSynced.d.ts +1 -0
  39. package/dist/tests/extension-redis-rewrite/closeConnections.d.ts +1 -0
  40. package/dist/tests/extension-redis-rewrite/getConnectionCount.d.ts +1 -0
  41. package/dist/tests/extension-redis-rewrite/getDocumentsCount.d.ts +1 -0
  42. package/dist/tests/extension-redis-rewrite/onAwarenessChange.d.ts +1 -0
  43. package/dist/tests/extension-redis-rewrite/onChange.d.ts +1 -0
  44. package/dist/tests/extension-redis-rewrite/onStoreDocument.d.ts +1 -0
  45. package/dist/tests/extension-rocksdb/onLoadDocument.d.ts +1 -0
  46. package/dist/tests/extension-throttle/configuration.d.ts +1 -0
  47. package/dist/tests/provider/configuration.d.ts +1 -0
  48. package/dist/tests/provider/observeDeep.d.ts +1 -0
  49. package/dist/tests/provider/onAuthenticated.d.ts +1 -0
  50. package/dist/tests/provider/onAuthenticationFailed.d.ts +1 -0
  51. package/dist/tests/provider/onAwarenessChange.d.ts +1 -0
  52. package/dist/tests/provider/onAwarenessUpdate.d.ts +1 -0
  53. package/dist/tests/provider/onClose.d.ts +1 -0
  54. package/dist/tests/provider/onConnect.d.ts +1 -0
  55. package/dist/tests/provider/onDisconnect.d.ts +1 -0
  56. package/dist/tests/provider/onMessage.d.ts +1 -0
  57. package/dist/tests/provider/onOpen.d.ts +1 -0
  58. package/dist/tests/provider/onSynced.d.ts +1 -0
  59. package/dist/tests/server/address.d.ts +1 -0
  60. package/dist/tests/server/afterStoreDocument.d.ts +1 -0
  61. package/dist/tests/server/closeConnections.d.ts +1 -0
  62. package/dist/tests/server/getConnectionsCount.d.ts +1 -0
  63. package/dist/tests/server/getDocumentName.d.ts +1 -0
  64. package/dist/tests/server/getDocumentsCount.d.ts +1 -0
  65. package/dist/tests/server/getMessageLogs.d.ts +1 -0
  66. package/dist/tests/server/listen.d.ts +1 -0
  67. package/dist/tests/server/onAuthenticate.d.ts +1 -0
  68. package/dist/tests/server/onAwarenessUpdate.d.ts +1 -0
  69. package/dist/tests/server/onChange.d.ts +1 -0
  70. package/dist/tests/server/onConfigure.d.ts +1 -0
  71. package/dist/tests/server/onConnect.d.ts +1 -0
  72. package/dist/tests/server/onDestroy.d.ts +1 -0
  73. package/dist/tests/server/onDisconnect.d.ts +1 -0
  74. package/dist/tests/server/onListen.d.ts +1 -0
  75. package/dist/tests/server/onLoadDocument.d.ts +1 -0
  76. package/dist/tests/server/onRequest.d.ts +1 -0
  77. package/dist/tests/server/onStoreDocument.d.ts +1 -0
  78. package/dist/tests/server/onUpgrade.d.ts +1 -0
  79. package/dist/tests/server/requiresAuthentication.d.ts +1 -0
  80. package/dist/tests/transformer/TiptapTransformer.d.ts +1 -0
  81. package/dist/tests/utils/createDirectory.d.ts +1 -0
  82. package/dist/tests/utils/flushRedis.d.ts +1 -0
  83. package/dist/tests/utils/index.d.ts +7 -0
  84. package/dist/tests/utils/newHocuspocus.d.ts +2 -0
  85. package/dist/tests/utils/newHocuspocusProvider.d.ts +3 -0
  86. package/dist/tests/utils/redisConnectionSettings.d.ts +4 -0
  87. package/dist/tests/utils/removeDirectory.d.ts +1 -0
  88. package/dist/tests/utils/sleep.d.ts +1 -0
  89. package/package.json +6 -5
  90. package/src/EventEmitter.ts +1 -1
  91. package/src/HocuspocusCloudProvider.ts +18 -10
  92. package/src/HocuspocusProvider.ts +100 -69
  93. package/src/index.ts +0 -1
  94. package/src/types.ts +10 -0
  95. package/dist/packages/provider/src/utils/awarenessStatesToArray.d.ts +0 -4
  96. package/dist/packages/provider/src/utils/index.d.ts +0 -1
  97. package/dist/packages/server/src/CloseEvents.d.ts +0 -4
  98. package/src/utils/awarenessStatesToArray.ts +0 -8
  99. package/src/utils/index.ts +0 -1
@@ -4,8 +4,9 @@ import * as time from 'lib0/time'
4
4
  import { Awareness, removeAwarenessStates } from 'y-protocols/awareness'
5
5
  import * as mutex from 'lib0/mutex'
6
6
  import * as url from 'lib0/url'
7
- import { Event, CloseEvent, MessageEvent } from 'ws'
7
+ import type { Event, CloseEvent, MessageEvent } from 'ws'
8
8
  import { retry } from '@lifeomic/attempt'
9
+ import { awarenessStatesToArray, Forbidden, Unauthorized } from '@hocuspocus/common'
9
10
  import EventEmitter from './EventEmitter'
10
11
  import { IncomingMessage } from './IncomingMessage'
11
12
  import { MessageReceiver } from './MessageReceiver'
@@ -17,8 +18,8 @@ import { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage'
17
18
  import { AwarenessMessage } from './OutgoingMessages/AwarenessMessage'
18
19
  import { UpdateMessage } from './OutgoingMessages/UpdateMessage'
19
20
  import { OutgoingMessage } from './OutgoingMessage'
20
- import awarenessStatesToArray from './utils/awarenessStatesToArray'
21
21
  import { ConstructableOutgoingMessage } from './types'
22
+ import { onAwarenessChangeParameters, onAwarenessUpdateParameters } from '.'
22
23
 
23
24
  export enum WebSocketStatus {
24
25
  Connecting = 'connecting',
@@ -26,15 +27,19 @@ export enum WebSocketStatus {
26
27
  Disconnected = 'disconnected',
27
28
  }
28
29
 
29
- export interface HocuspocusProviderOptions {
30
+ export type HocuspocusProviderConfiguration =
31
+ Required<Pick<CompleteHocuspocusProviderConfiguration, 'url' | 'name'>>
32
+ & Partial<CompleteHocuspocusProviderConfiguration>
33
+
34
+ export interface CompleteHocuspocusProviderConfiguration {
30
35
  /**
31
36
  * URL of your @hocuspocus/server instance
32
37
  */
33
- url: string,
34
- /**
35
- * The identifier/name of your document
36
- */
37
- name: string,
38
+ url: string,
39
+ /**
40
+ * The identifier/name of your document
41
+ */
42
+ name: string,
38
43
  /**
39
44
  * The actual Y.js document
40
45
  */
@@ -110,23 +115,27 @@ export interface HocuspocusProviderOptions {
110
115
  onMessage: (event: MessageEvent) => void,
111
116
  onOutgoingMessage: (message: OutgoingMessage) => void,
112
117
  onStatus: (status: any) => void,
113
- onSynced: () => void,
118
+ onSynced: ({ state }: { state: boolean }) => void,
114
119
  onDisconnect: (event: CloseEvent) => void,
115
120
  onClose: (event: CloseEvent) => void,
116
121
  onDestroy: () => void,
117
- onAwarenessUpdate: (states: any) => void,
118
- onAwarenessChange: (states: any) => void,
122
+ onAwarenessUpdate: ({ states }: onAwarenessUpdateParameters) => void,
123
+ onAwarenessChange: ({ states }: onAwarenessChangeParameters) => void,
124
+ /**
125
+ * Don’t output any warnings.
126
+ */
127
+ quiet: boolean,
119
128
  }
120
129
 
121
130
  export class HocuspocusProvider extends EventEmitter {
122
- public options: HocuspocusProviderOptions = {
131
+ public configuration: CompleteHocuspocusProviderConfiguration = {
132
+ name: '',
133
+ url: '',
123
134
  // @ts-ignore
124
135
  document: undefined,
125
136
  // @ts-ignore
126
137
  awareness: undefined,
127
138
  WebSocketPolyfill: undefined,
128
- url: '',
129
- name: '',
130
139
  token: null,
131
140
  parameters: {},
132
141
  connect: true,
@@ -163,6 +172,7 @@ export class HocuspocusProvider extends EventEmitter {
163
172
  onDestroy: () => null,
164
173
  onAwarenessUpdate: () => null,
165
174
  onAwarenessChange: () => null,
175
+ quiet: false,
166
176
  }
167
177
 
168
178
  subscribedToBroadcastChannel = false
@@ -191,27 +201,27 @@ export class HocuspocusProvider extends EventEmitter {
191
201
  reject: (reason?: any) => void
192
202
  } | null = null
193
203
 
194
- constructor(options: Partial<HocuspocusProviderOptions> = {}) {
204
+ constructor(configuration: HocuspocusProviderConfiguration) {
195
205
  super()
196
- this.setOptions(options)
197
-
198
- this.options.document = options.document ? options.document : new Y.Doc()
199
- this.options.awareness = options.awareness ? options.awareness : new Awareness(this.document)
200
- this.options.WebSocketPolyfill = options.WebSocketPolyfill ? options.WebSocketPolyfill : WebSocket
201
-
202
- this.on('open', this.options.onOpen)
203
- this.on('authenticated', this.options.onAuthenticated)
204
- this.on('authenticationFailed', this.options.onAuthenticationFailed)
205
- this.on('connect', this.options.onConnect)
206
- this.on('message', this.options.onMessage)
207
- this.on('outgoingMessage', this.options.onOutgoingMessage)
208
- this.on('synced', this.options.onSynced)
209
- this.on('status', this.options.onStatus)
210
- this.on('disconnect', this.options.onDisconnect)
211
- this.on('close', this.options.onClose)
212
- this.on('destroy', this.options.onDestroy)
213
- this.on('awarenessUpdate', this.options.onAwarenessUpdate)
214
- this.on('awarenessChange', this.options.onAwarenessChange)
206
+ this.setConfiguration(configuration)
207
+
208
+ this.configuration.document = configuration.document ? configuration.document : new Y.Doc()
209
+ this.configuration.awareness = configuration.awareness ? configuration.awareness : new Awareness(this.document)
210
+ this.configuration.WebSocketPolyfill = configuration.WebSocketPolyfill ? configuration.WebSocketPolyfill : WebSocket
211
+
212
+ this.on('open', this.configuration.onOpen)
213
+ this.on('authenticated', this.configuration.onAuthenticated)
214
+ this.on('authenticationFailed', this.configuration.onAuthenticationFailed)
215
+ this.on('connect', this.configuration.onConnect)
216
+ this.on('message', this.configuration.onMessage)
217
+ this.on('outgoingMessage', this.configuration.onOutgoingMessage)
218
+ this.on('synced', this.configuration.onSynced)
219
+ this.on('status', this.configuration.onStatus)
220
+ this.on('disconnect', this.configuration.onDisconnect)
221
+ this.on('close', this.configuration.onClose)
222
+ this.on('destroy', this.configuration.onDestroy)
223
+ this.on('awarenessUpdate', this.configuration.onAwarenessUpdate)
224
+ this.on('awarenessChange', this.configuration.onAwarenessChange)
215
225
 
216
226
  this.awareness.on('update', () => {
217
227
  this.emit('awarenessUpdate', { states: awarenessStatesToArray(this.awareness.getStates()) })
@@ -223,22 +233,22 @@ export class HocuspocusProvider extends EventEmitter {
223
233
 
224
234
  this.document.on('update', this.documentUpdateHandler.bind(this))
225
235
  this.awareness.on('update', this.awarenessUpdateHandler.bind(this))
226
- this.registerBeforeUnloadEventListener()
236
+ this.registerEventListeners()
227
237
 
228
238
  this.intervals.connectionChecker = setInterval(
229
239
  this.checkConnection.bind(this),
230
- this.options.messageReconnectTimeout / 10,
240
+ this.configuration.messageReconnectTimeout / 10,
231
241
  )
232
242
 
233
- if (this.options.forceSyncInterval) {
243
+ if (this.configuration.forceSyncInterval) {
234
244
  this.intervals.forceSync = setInterval(
235
245
  this.forceSync.bind(this),
236
- this.options.forceSyncInterval,
246
+ this.configuration.forceSyncInterval,
237
247
  )
238
248
  }
239
249
 
240
- if (typeof options.connect !== 'undefined') {
241
- this.shouldConnect = options.connect
250
+ if (typeof configuration.connect !== 'undefined') {
251
+ this.shouldConnect = configuration.connect
242
252
  }
243
253
 
244
254
  if (!this.shouldConnect) {
@@ -248,8 +258,8 @@ export class HocuspocusProvider extends EventEmitter {
248
258
  this.connect()
249
259
  }
250
260
 
251
- public setOptions(options: Partial<HocuspocusProviderOptions> = {}): void {
252
- this.options = { ...this.options, ...options }
261
+ public setConfiguration(configuration: Partial<HocuspocusProviderConfiguration> = {}): void {
262
+ this.configuration = { ...this.configuration, ...configuration }
253
263
  }
254
264
 
255
265
  async connect() {
@@ -262,14 +272,14 @@ export class HocuspocusProvider extends EventEmitter {
262
272
 
263
273
  try {
264
274
  await retry(this.createWebSocketConnection.bind(this), {
265
- delay: this.options.delay,
266
- initialDelay: this.options.initialDelay,
267
- factor: this.options.factor,
268
- maxAttempts: this.options.maxAttempts,
269
- minDelay: this.options.minDelay,
270
- maxDelay: this.options.maxDelay,
271
- jitter: this.options.jitter,
272
- timeout: this.options.timeout,
275
+ delay: this.configuration.delay,
276
+ initialDelay: this.configuration.initialDelay,
277
+ factor: this.configuration.factor,
278
+ maxAttempts: this.configuration.maxAttempts,
279
+ minDelay: this.configuration.minDelay,
280
+ maxDelay: this.configuration.maxDelay,
281
+ jitter: this.configuration.jitter,
282
+ timeout: this.configuration.timeout,
273
283
  beforeAttempt: context => {
274
284
  if (!this.shouldConnect) {
275
285
  context.abort()
@@ -288,7 +298,7 @@ export class HocuspocusProvider extends EventEmitter {
288
298
  createWebSocketConnection() {
289
299
  return new Promise((resolve, reject) => {
290
300
  // Init the WebSocket connection
291
- const ws = new this.options.WebSocketPolyfill(this.url)
301
+ const ws = new this.configuration.WebSocketPolyfill(this.url)
292
302
  ws.binaryType = 'arraybuffer'
293
303
  ws.onmessage = this.onMessage.bind(this)
294
304
  ws.onclose = this.onClose.bind(this)
@@ -322,11 +332,11 @@ export class HocuspocusProvider extends EventEmitter {
322
332
  }
323
333
 
324
334
  get document() {
325
- return this.options.document
335
+ return this.configuration.document
326
336
  }
327
337
 
328
338
  get awareness() {
329
- return this.options.awareness
339
+ return this.configuration.awareness
330
340
  }
331
341
 
332
342
  checkConnection() {
@@ -341,7 +351,7 @@ export class HocuspocusProvider extends EventEmitter {
341
351
  }
342
352
 
343
353
  // Don’t close the connection when a message was received recently
344
- if (this.options.messageReconnectTimeout >= time.getUnixTime() - this.lastMessageReceived) {
354
+ if (this.configuration.messageReconnectTimeout >= time.getUnixTime() - this.lastMessageReceived) {
345
355
  return
346
356
  }
347
357
 
@@ -358,11 +368,12 @@ export class HocuspocusProvider extends EventEmitter {
358
368
  this.send(SyncStepOneMessage, { document: this.document })
359
369
  }
360
370
 
361
- registerBeforeUnloadEventListener() {
371
+ registerEventListeners() {
362
372
  if (typeof window === 'undefined') {
363
373
  return
364
374
  }
365
375
 
376
+ window.addEventListener('online', this.connect.bind(this))
366
377
  window.addEventListener('beforeunload', () => {
367
378
  removeAwarenessStates(this.awareness, [this.document.clientID], 'window unload')
368
379
  })
@@ -400,17 +411,17 @@ export class HocuspocusProvider extends EventEmitter {
400
411
 
401
412
  // Ensure that the URL always ends with /
402
413
  get serverUrl() {
403
- while (this.options.url[this.options.url.length - 1] === '/') {
404
- return this.options.url.slice(0, this.options.url.length - 1)
414
+ while (this.configuration.url[this.configuration.url.length - 1] === '/') {
415
+ return this.configuration.url.slice(0, this.configuration.url.length - 1)
405
416
  }
406
417
 
407
- return this.options.url
418
+ return this.configuration.url
408
419
  }
409
420
 
410
421
  get url() {
411
- const encodedParams = url.encodeQueryParams(this.options.parameters)
422
+ const encodedParams = url.encodeQueryParams(this.configuration.parameters)
412
423
 
413
- return `${this.serverUrl}/${this.options.name}${encodedParams.length === 0 ? '' : `?${encodedParams}`}`
424
+ return `${this.serverUrl}/${this.configuration.name}${encodedParams.length === 0 ? '' : `?${encodedParams}`}`
414
425
  }
415
426
 
416
427
  get synced(): boolean {
@@ -428,7 +439,7 @@ export class HocuspocusProvider extends EventEmitter {
428
439
  }
429
440
 
430
441
  get isAuthenticationRequired(): boolean {
431
- return !!this.options.token && !this.isAuthenticated
442
+ return !!this.configuration.token && !this.isAuthenticated
432
443
  }
433
444
 
434
445
  disconnect() {
@@ -455,12 +466,12 @@ export class HocuspocusProvider extends EventEmitter {
455
466
  }
456
467
 
457
468
  async getToken() {
458
- if (typeof this.options.token === 'function') {
459
- const token = await this.options.token()
469
+ if (typeof this.configuration.token === 'function') {
470
+ const token = await this.configuration.token()
460
471
  return token
461
472
  }
462
473
 
463
- return this.options.token
474
+ return this.configuration.token
464
475
  }
465
476
 
466
477
  async webSocketConnectionEstablished() {
@@ -534,15 +545,29 @@ export class HocuspocusProvider extends EventEmitter {
534
545
  this.emit('disconnect', { event })
535
546
  }
536
547
 
548
+ if (event.code === Unauthorized.code) {
549
+ if (!this.configuration.quiet) {
550
+ console.warn('[HocuspocusProvider] An authentication token is required, but you didn’t send one. Try adding a `token` to your HocuspocusProvider configuration. Won’t try again.')
551
+ }
552
+
553
+ this.shouldConnect = false
554
+ }
555
+
556
+ if (event.code === Forbidden.code) {
557
+ if (!this.configuration.quiet) {
558
+ console.warn('[HocuspocusProvider] The provided authentication token isn’t allowed to connect to this server. Will try again.')
559
+ }
560
+ }
561
+
537
562
  if (this.connectionAttempt) {
538
- // Okay, that connection attempt failed
563
+ // That connection attempt failed.
539
564
  this.rejectConnectionAttempt()
540
565
  } else if (this.shouldConnect) {
541
- // The connection was closed by the server, so let’s just try again.
566
+ // The connection was closed by the server. Let’s just try again.
542
567
  this.connect()
543
568
  }
544
569
 
545
- // If we’ll reconnect anyway, we’re done for now.
570
+ // If we’ll reconnect, we’re done for now.
546
571
  if (this.shouldConnect) {
547
572
  return
548
573
  }
@@ -580,10 +605,16 @@ export class HocuspocusProvider extends EventEmitter {
580
605
  this.document.off('update', this.documentUpdateHandler)
581
606
 
582
607
  this.removeAllListeners()
608
+
609
+ if (typeof window === 'undefined') {
610
+ return
611
+ }
612
+
613
+ window.removeEventListener('online', this.connect.bind(this))
583
614
  }
584
615
 
585
616
  get broadcastChannel() {
586
- return `${this.serverUrl}/${this.options.name}`
617
+ return `${this.serverUrl}/${this.configuration.name}`
587
618
  }
588
619
 
589
620
  broadcastChannelSubscriber(data: ArrayBuffer) {
@@ -624,7 +655,7 @@ export class HocuspocusProvider extends EventEmitter {
624
655
  }
625
656
 
626
657
  broadcast(Message: ConstructableOutgoingMessage, args?: any) {
627
- if (!this.options.broadcast) {
658
+ if (!this.configuration.broadcast) {
628
659
  return
629
660
  }
630
661
 
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './HocuspocusProvider'
2
2
  export * from './HocuspocusCloudProvider'
3
3
  export * from './types'
4
- export * from './utils'
package/src/types.ts CHANGED
@@ -41,3 +41,13 @@ export type ConstructableOutgoingMessage =
41
41
  Constructable<SyncStepOneMessage> |
42
42
  Constructable<SyncStepTwoMessage> |
43
43
  Constructable<UpdateMessage>
44
+
45
+ export type onAwarenessUpdateParameters = {
46
+ states: StatesArray
47
+ }
48
+
49
+ export type onAwarenessChangeParameters = {
50
+ states: StatesArray
51
+ }
52
+
53
+ export type StatesArray = { clientId: number, [key: string | number]: any }[]
@@ -1,4 +0,0 @@
1
- declare const _default: (states: Map<number, Record<string, any>>) => {
2
- clientId: number;
3
- }[];
4
- export default _default;
@@ -1 +0,0 @@
1
- export { default as awarenessStatesToArray } from './awarenessStatesToArray';
@@ -1,4 +0,0 @@
1
- import { CloseEvent } from './types';
2
- export declare const Forbidden: CloseEvent;
3
- export declare const ResetConnection: CloseEvent;
4
- export declare const CloseEvents: CloseEvent[];
@@ -1,8 +0,0 @@
1
- export default (states: Map<number, Record<string, any>>) => {
2
- return Array.from(states.entries()).map(([key, value]) => {
3
- return {
4
- clientId: key,
5
- ...value,
6
- }
7
- })
8
- }
@@ -1 +0,0 @@
1
- export { default as awarenessStatesToArray } from './awarenessStatesToArray'