@hocuspocus/extension-database 2.15.2 → 3.0.4-rc.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 (51) hide show
  1. package/dist/hocuspocus-database.cjs +3 -6
  2. package/dist/hocuspocus-database.cjs.map +1 -1
  3. package/dist/hocuspocus-database.esm.js.map +1 -1
  4. package/dist/packages/extension-database/src/Database.d.ts +1 -1
  5. package/dist/packages/extension-logger/src/Logger.d.ts +1 -1
  6. package/dist/packages/extension-redis/src/Redis.d.ts +4 -3
  7. package/dist/packages/extension-sqlite/src/SQLite.d.ts +2 -1
  8. package/dist/packages/extension-throttle/src/index.d.ts +2 -2
  9. package/dist/packages/extension-webhook/src/index.d.ts +3 -3
  10. package/dist/packages/provider/src/HocuspocusProvider.d.ts +12 -45
  11. package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +5 -9
  12. package/dist/packages/provider/src/IncomingMessage.d.ts +3 -3
  13. package/dist/packages/provider/src/MessageReceiver.d.ts +2 -4
  14. package/dist/packages/provider/src/MessageSender.d.ts +2 -2
  15. package/dist/packages/provider/src/OutgoingMessage.d.ts +2 -2
  16. package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +2 -1
  17. package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +2 -1
  18. package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +2 -1
  19. package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +2 -1
  20. package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +2 -1
  21. package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +2 -1
  22. package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +2 -1
  23. package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +2 -1
  24. package/dist/packages/provider/src/index.d.ts +0 -2
  25. package/dist/packages/provider/src/types.d.ts +12 -12
  26. package/dist/packages/server/src/ClientConnection.d.ts +19 -10
  27. package/dist/packages/server/src/Connection.d.ts +7 -23
  28. package/dist/packages/server/src/DirectConnection.d.ts +2 -2
  29. package/dist/packages/server/src/Document.d.ts +3 -7
  30. package/dist/packages/server/src/Hocuspocus.d.ts +7 -36
  31. package/dist/packages/server/src/IncomingMessage.d.ts +3 -3
  32. package/dist/packages/server/src/MessageReceiver.d.ts +4 -6
  33. package/dist/packages/server/src/OutgoingMessage.d.ts +4 -3
  34. package/dist/packages/server/src/Server.d.ts +23 -3
  35. package/dist/packages/server/src/index.d.ts +1 -1
  36. package/dist/packages/server/src/types.d.ts +15 -29
  37. package/dist/packages/server/src/util/getParameters.d.ts +1 -1
  38. package/dist/packages/transformer/src/Prosemirror.d.ts +1 -1
  39. package/dist/packages/transformer/src/Tiptap.d.ts +3 -3
  40. package/dist/packages/transformer/src/types.d.ts +1 -1
  41. package/dist/tests/utils/newHocuspocus.d.ts +2 -2
  42. package/dist/tests/utils/newHocuspocusProvider.d.ts +2 -2
  43. package/dist/tests/utils/newHocuspocusProviderWebsocket.d.ts +4 -3
  44. package/dist/tests/utils/retryableAssertion.d.ts +1 -1
  45. package/package.json +2 -2
  46. package/src/Database.ts +1 -1
  47. package/dist/packages/provider/src/TiptapCollabProvider.d.ts +0 -161
  48. package/dist/packages/provider/src/TiptapCollabProviderWebsocket.d.ts +0 -19
  49. package/dist/packages/server/src/Debugger.d.ts +0 -14
  50. package/dist/tests/server/getMessageLogs.d.ts +0 -1
  51. package/dist/tests/server/requiresAuthentication.d.ts +0 -1
@@ -1,11 +1,8 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var Y = require('yjs');
6
4
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
5
+ function _interopNamespaceDefault(e) {
9
6
  var n = Object.create(null);
10
7
  if (e) {
11
8
  Object.keys(e).forEach(function (k) {
@@ -18,11 +15,11 @@ function _interopNamespace(e) {
18
15
  }
19
16
  });
20
17
  }
21
- n["default"] = e;
18
+ n.default = e;
22
19
  return Object.freeze(n);
23
20
  }
24
21
 
25
- var Y__namespace = /*#__PURE__*/_interopNamespace(Y);
22
+ var Y__namespace = /*#__PURE__*/_interopNamespaceDefault(Y);
26
23
 
27
24
  class Database {
28
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-database.cjs","sources":["../src/Database.ts"],"sourcesContent":["import {\n Extension,\n onChangePayload,\n onLoadDocumentPayload,\n storePayload,\n fetchPayload,\n} from '@hocuspocus/server'\nimport * as Y from 'yjs'\n\nexport interface DatabaseConfiguration {\n /**\n * Pass a Promise to retrieve updates from your database. The Promise should resolve to\n * an array of items with Y.js-compatible binary data.\n */\n fetch: (data: fetchPayload) => Promise<Uint8Array | null>,\n /**\n * Pass a function to store updates in your database.\n */\n store: (data: storePayload) => Promise<void>,\n}\n\nexport class Database implements Extension {\n /**\n * Default configuration\n */\n configuration: DatabaseConfiguration = {\n fetch: async () => null,\n store: async () => {},\n }\n\n /**\n * Constructor\n */\n constructor(configuration: Partial<DatabaseConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n /**\n * Get stored data from the database.\n */\n async onLoadDocument(data: onLoadDocumentPayload): Promise<any> {\n const update = await this.configuration.fetch(data)\n\n if (update) {\n Y.applyUpdate(data.document, update)\n }\n }\n\n /**\n * Store new updates in the database.\n */\n async onStoreDocument(data: onChangePayload) {\n await this.configuration.store({\n ...data,\n state: Buffer.from(\n Y.encodeStateAsUpdate(data.document),\n ),\n })\n }\n}\n"],"names":["Y"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;MAqBa,QAAQ,CAAA;AASnB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA6C,EAAA;AAXzD;;AAEG;AACH,QAAA,IAAA,CAAA,aAAa,GAA0B;AACrC,YAAA,KAAK,EAAE,YAAY,IAAI;AACvB,YAAA,KAAK,EAAE,eAAc;SACtB,CAAA;QAMC,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB,CAAA;KACF;AAED;;AAEG;IACH,MAAM,cAAc,CAAC,IAA2B,EAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAEnD,QAAA,IAAI,MAAM,EAAE;YACVA,YAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACrC,SAAA;KACF;AAED;;AAEG;IACH,MAAM,eAAe,CAAC,IAAqB,EAAA;AACzC,QAAA,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC7B,YAAA,GAAG,IAAI;AACP,YAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAChBA,YAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACrC;AACF,SAAA,CAAC,CAAA;KACH;AACF;;;;"}
1
+ {"version":3,"file":"hocuspocus-database.cjs","sources":["../src/Database.ts"],"sourcesContent":["import type {\n Extension,\n onChangePayload,\n onLoadDocumentPayload,\n storePayload,\n fetchPayload,\n} from '@hocuspocus/server'\nimport * as Y from 'yjs'\n\nexport interface DatabaseConfiguration {\n /**\n * Pass a Promise to retrieve updates from your database. The Promise should resolve to\n * an array of items with Y.js-compatible binary data.\n */\n fetch: (data: fetchPayload) => Promise<Uint8Array | null>,\n /**\n * Pass a function to store updates in your database.\n */\n store: (data: storePayload) => Promise<void>,\n}\n\nexport class Database implements Extension {\n /**\n * Default configuration\n */\n configuration: DatabaseConfiguration = {\n fetch: async () => null,\n store: async () => {},\n }\n\n /**\n * Constructor\n */\n constructor(configuration: Partial<DatabaseConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n /**\n * Get stored data from the database.\n */\n async onLoadDocument(data: onLoadDocumentPayload): Promise<any> {\n const update = await this.configuration.fetch(data)\n\n if (update) {\n Y.applyUpdate(data.document, update)\n }\n }\n\n /**\n * Store new updates in the database.\n */\n async onStoreDocument(data: onChangePayload) {\n await this.configuration.store({\n ...data,\n state: Buffer.from(\n Y.encodeStateAsUpdate(data.document),\n ),\n })\n }\n}\n"],"names":["Y"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAqBa,QAAQ,CAAA;AASnB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA6C,EAAA;AAXzD;;AAEG;AACH,QAAA,IAAA,CAAA,aAAa,GAA0B;AACrC,YAAA,KAAK,EAAE,YAAY,IAAI;AACvB,YAAA,KAAK,EAAE,eAAc;SACtB;QAMC,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB;;AAGH;;AAEG;IACH,MAAM,cAAc,CAAC,IAA2B,EAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;AAEnD,QAAA,IAAI,MAAM,EAAE;YACVA,YAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;AACrC;;AAGH;;AAEG;IACH,MAAM,eAAe,CAAC,IAAqB,EAAA;AACzC,QAAA,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC7B,YAAA,GAAG,IAAI;AACP,YAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAChBA,YAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACrC;AACF,SAAA,CAAC;;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-database.esm.js","sources":["../src/Database.ts"],"sourcesContent":["import {\n Extension,\n onChangePayload,\n onLoadDocumentPayload,\n storePayload,\n fetchPayload,\n} from '@hocuspocus/server'\nimport * as Y from 'yjs'\n\nexport interface DatabaseConfiguration {\n /**\n * Pass a Promise to retrieve updates from your database. The Promise should resolve to\n * an array of items with Y.js-compatible binary data.\n */\n fetch: (data: fetchPayload) => Promise<Uint8Array | null>,\n /**\n * Pass a function to store updates in your database.\n */\n store: (data: storePayload) => Promise<void>,\n}\n\nexport class Database implements Extension {\n /**\n * Default configuration\n */\n configuration: DatabaseConfiguration = {\n fetch: async () => null,\n store: async () => {},\n }\n\n /**\n * Constructor\n */\n constructor(configuration: Partial<DatabaseConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n /**\n * Get stored data from the database.\n */\n async onLoadDocument(data: onLoadDocumentPayload): Promise<any> {\n const update = await this.configuration.fetch(data)\n\n if (update) {\n Y.applyUpdate(data.document, update)\n }\n }\n\n /**\n * Store new updates in the database.\n */\n async onStoreDocument(data: onChangePayload) {\n await this.configuration.store({\n ...data,\n state: Buffer.from(\n Y.encodeStateAsUpdate(data.document),\n ),\n })\n }\n}\n"],"names":[],"mappings":";;MAqBa,QAAQ,CAAA;AASnB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA6C,EAAA;AAXzD;;AAEG;AACH,QAAA,IAAA,CAAA,aAAa,GAA0B;AACrC,YAAA,KAAK,EAAE,YAAY,IAAI;AACvB,YAAA,KAAK,EAAE,eAAc;SACtB,CAAA;QAMC,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB,CAAA;KACF;AAED;;AAEG;IACH,MAAM,cAAc,CAAC,IAA2B,EAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAEnD,QAAA,IAAI,MAAM,EAAE;YACV,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACrC,SAAA;KACF;AAED;;AAEG;IACH,MAAM,eAAe,CAAC,IAAqB,EAAA;AACzC,QAAA,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC7B,YAAA,GAAG,IAAI;AACP,YAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACrC;AACF,SAAA,CAAC,CAAA;KACH;AACF;;;;"}
1
+ {"version":3,"file":"hocuspocus-database.esm.js","sources":["../src/Database.ts"],"sourcesContent":["import type {\n Extension,\n onChangePayload,\n onLoadDocumentPayload,\n storePayload,\n fetchPayload,\n} from '@hocuspocus/server'\nimport * as Y from 'yjs'\n\nexport interface DatabaseConfiguration {\n /**\n * Pass a Promise to retrieve updates from your database. The Promise should resolve to\n * an array of items with Y.js-compatible binary data.\n */\n fetch: (data: fetchPayload) => Promise<Uint8Array | null>,\n /**\n * Pass a function to store updates in your database.\n */\n store: (data: storePayload) => Promise<void>,\n}\n\nexport class Database implements Extension {\n /**\n * Default configuration\n */\n configuration: DatabaseConfiguration = {\n fetch: async () => null,\n store: async () => {},\n }\n\n /**\n * Constructor\n */\n constructor(configuration: Partial<DatabaseConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n /**\n * Get stored data from the database.\n */\n async onLoadDocument(data: onLoadDocumentPayload): Promise<any> {\n const update = await this.configuration.fetch(data)\n\n if (update) {\n Y.applyUpdate(data.document, update)\n }\n }\n\n /**\n * Store new updates in the database.\n */\n async onStoreDocument(data: onChangePayload) {\n await this.configuration.store({\n ...data,\n state: Buffer.from(\n Y.encodeStateAsUpdate(data.document),\n ),\n })\n }\n}\n"],"names":[],"mappings":";;MAqBa,QAAQ,CAAA;AASnB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA6C,EAAA;AAXzD;;AAEG;AACH,QAAA,IAAA,CAAA,aAAa,GAA0B;AACrC,YAAA,KAAK,EAAE,YAAY,IAAI;AACvB,YAAA,KAAK,EAAE,eAAc;SACtB;QAMC,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB;;AAGH;;AAEG;IACH,MAAM,cAAc,CAAC,IAA2B,EAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;AAEnD,QAAA,IAAI,MAAM,EAAE;YACV,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;AACrC;;AAGH;;AAEG;IACH,MAAM,eAAe,CAAC,IAAqB,EAAA;AACzC,QAAA,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC7B,YAAA,GAAG,IAAI;AACP,YAAA,KAAK,EAAE,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACrC;AACF,SAAA,CAAC;;AAEL;;;;"}
@@ -1,4 +1,4 @@
1
- import { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
1
+ import type { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
2
2
  export interface DatabaseConfiguration {
3
3
  /**
4
4
  * Pass a Promise to retrieve updates from your database. The Promise should resolve to
@@ -1,4 +1,4 @@
1
- import { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from '@hocuspocus/server';
1
+ import type { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from '@hocuspocus/server';
2
2
  export interface LoggerConfiguration {
3
3
  /**
4
4
  * Prepend all logging message with a string.
@@ -1,7 +1,9 @@
1
1
  /// <reference types="node" />
2
- import RedisClient, { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
2
+ /// <reference types="node" />
3
+ import type { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
4
+ import RedisClient from 'ioredis';
3
5
  import Redlock from 'redlock';
4
- import { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
6
+ import type { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, onConfigurePayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
5
7
  export type RedisInstance = RedisClient.Cluster | RedisClient.Redis;
6
8
  export interface Configuration {
7
9
  /**
@@ -63,7 +65,6 @@ export declare class Redis implements Extension {
63
65
  instance: Hocuspocus;
64
66
  redlock: Redlock;
65
67
  locks: Map<string, Redlock.Lock>;
66
- logger: Debugger;
67
68
  messagePrefix: Buffer;
68
69
  /**
69
70
  * When we have a high frequency of updates to a document we don't need tons of setTimeouts
@@ -1,4 +1,5 @@
1
- import { Database, DatabaseConfiguration } from '@hocuspocus/extension-database';
1
+ import type { DatabaseConfiguration } from '@hocuspocus/extension-database';
2
+ import { Database } from '@hocuspocus/extension-database';
2
3
  import sqlite3 from 'sqlite3';
3
4
  export declare const schema = "CREATE TABLE IF NOT EXISTS \"documents\" (\n \"name\" varchar(255) NOT NULL,\n \"data\" blob NOT NULL,\n UNIQUE(name)\n)";
4
5
  export declare const selectQuery = "\n SELECT data FROM \"documents\" WHERE name = $name ORDER BY rowid DESC\n";
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Extension, onConnectPayload } from '@hocuspocus/server';
2
+ import type { Extension, onConnectPayload } from '@hocuspocus/server';
3
3
  export interface ThrottleConfiguration {
4
4
  throttle: number | null | false;
5
5
  consideredSeconds: number;
@@ -10,7 +10,7 @@ export declare class Throttle implements Extension {
10
10
  configuration: ThrottleConfiguration;
11
11
  connectionsByIp: Map<string, Array<number>>;
12
12
  bannedIps: Map<string, number>;
13
- cleanupInterval?: NodeJS.Timer;
13
+ cleanupInterval?: NodeJS.Timeout;
14
14
  /**
15
15
  * Constructor
16
16
  */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { Extension, onChangePayload, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from '@hocuspocus/server';
3
- import { Doc } from 'yjs';
4
- import { Transformer } from '@hocuspocus/transformer';
2
+ import type { Extension, onChangePayload, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from '@hocuspocus/server';
3
+ import type { Doc } from 'yjs';
4
+ import type { Transformer } from '@hocuspocus/transformer';
5
5
  export declare enum Events {
6
6
  onChange = "change",
7
7
  onConnect = "connect",
@@ -1,10 +1,10 @@
1
- import * as mutex from 'lib0/mutex';
2
- import type { CloseEvent, Event, MessageEvent } from 'ws';
1
+ import type { Event, MessageEvent } from 'ws';
3
2
  import { Awareness } from 'y-protocols/awareness';
4
3
  import * as Y from 'yjs';
5
4
  import EventEmitter from './EventEmitter.js';
6
- import { CompleteHocuspocusProviderWebsocketConfiguration, HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.js';
7
- import { ConstructableOutgoingMessage, WebSocketStatus, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters } from './types.js';
5
+ import type { CompleteHocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket.js';
6
+ import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.js';
7
+ import type { ConstructableOutgoingMessage, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onSyncedParameters } from './types.js';
8
8
  export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name'>> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> | Required<Pick<CompleteHocuspocusProviderConfiguration, 'websocketProvider'>>);
9
9
  export interface CompleteHocuspocusProviderConfiguration {
10
10
  /**
@@ -15,10 +15,6 @@ export interface CompleteHocuspocusProviderConfiguration {
15
15
  * The actual Y.js document
16
16
  */
17
17
  document: Y.Doc;
18
- /**
19
- * Pass false to disable broadcasting between browser tabs.
20
- */
21
- broadcast: boolean;
22
18
  /**
23
19
  * An Awareness instance to keep the presence state of all clients.
24
20
  *
@@ -32,12 +28,6 @@ export interface CompleteHocuspocusProviderConfiguration {
32
28
  * A token that’s sent to the backend for authentication purposes.
33
29
  */
34
30
  token: string | (() => string) | (() => Promise<string>) | null;
35
- /**
36
- * URL parameters that should be added.
37
- */
38
- parameters: {
39
- [key: string]: any;
40
- };
41
31
  /**
42
32
  * Hocuspocus websocket provider
43
33
  */
@@ -52,7 +42,6 @@ export interface CompleteHocuspocusProviderConfiguration {
52
42
  onConnect: () => void;
53
43
  onMessage: (data: onMessageParameters) => void;
54
44
  onOutgoingMessage: (data: onOutgoingMessageParameters) => void;
55
- onStatus: (data: onStatusParameters) => void;
56
45
  onSynced: (data: onSyncedParameters) => void;
57
46
  onDisconnect: (data: onDisconnectParameters) => void;
58
47
  onClose: (data: onCloseParameters) => void;
@@ -60,47 +49,29 @@ export interface CompleteHocuspocusProviderConfiguration {
60
49
  onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
61
50
  onAwarenessChange: (data: onAwarenessChangeParameters) => void;
62
51
  onStateless: (data: onStatelessParameters) => void;
63
- /**
64
- * Don’t output any warnings.
65
- */
66
- quiet: boolean;
67
- /**
68
- * Pass `false` to start the connection manually.
69
- */
70
- connect: boolean;
71
- /**
72
- * Pass `false` to close the connection manually.
73
- */
74
- preserveConnection: boolean;
75
52
  }
76
53
  export declare class AwarenessError extends Error {
77
54
  code: number;
78
55
  }
79
56
  export declare class HocuspocusProvider extends EventEmitter {
80
57
  configuration: CompleteHocuspocusProviderConfiguration;
81
- subscribedToBroadcastChannel: boolean;
82
58
  isSynced: boolean;
83
59
  unsyncedChanges: number;
84
- status: WebSocketStatus;
85
60
  isAuthenticated: boolean;
86
61
  authorizedScope: string | undefined;
87
- mux: mutex.mutex;
62
+ manageSocket: boolean;
63
+ private isAttached;
88
64
  intervals: any;
89
- isConnected: boolean;
90
65
  constructor(configuration: HocuspocusProviderConfiguration);
91
66
  boundDocumentUpdateHandler: (update: Uint8Array, origin: any) => void;
92
67
  boundAwarenessUpdateHandler: ({ added, updated, removed }: any, origin: any) => void;
93
- boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;
94
68
  boundPageHide: () => void;
95
69
  boundOnOpen: (event: Event) => Promise<void>;
96
- boundOnClose: (event: CloseEvent) => void;
97
- boundOnStatus: ({ status }: onStatusParameters) => void;
70
+ boundOnClose: () => void;
98
71
  forwardConnect: (e: any) => this;
99
- forwardOpen: (e: any) => this;
100
72
  forwardClose: (e: any) => this;
101
73
  forwardDisconnect: (e: any) => this;
102
74
  forwardDestroy: (e: any) => this;
103
- onStatus({ status }: onStatusParameters): void;
104
75
  setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
105
76
  get document(): Y.Doc;
106
77
  get awareness(): Awareness | null;
@@ -123,22 +94,18 @@ export declare class HocuspocusProvider extends EventEmitter {
123
94
  get synced(): boolean;
124
95
  set synced(state: boolean);
125
96
  receiveStateless(payload: string): void;
126
- get isAuthenticationRequired(): boolean;
127
- connect(): Promise<any>;
97
+ connect(): Promise<void>;
128
98
  disconnect(): void;
129
99
  onOpen(event: Event): Promise<void>;
130
100
  getToken(): Promise<string | null>;
131
101
  startSync(): void;
132
- send(message: ConstructableOutgoingMessage, args: any, broadcast?: boolean): void;
102
+ send(message: ConstructableOutgoingMessage, args: any): void;
133
103
  onMessage(event: MessageEvent): void;
134
- onClose(event: CloseEvent): void;
104
+ onClose(): void;
135
105
  destroy(): void;
106
+ detach(): void;
107
+ attach(): void;
136
108
  permissionDeniedHandler(reason: string): void;
137
109
  authenticatedHandler(scope: string): void;
138
- get broadcastChannel(): string;
139
- broadcastChannelSubscriber(data: ArrayBuffer): void;
140
- subscribeToBroadcastChannel(): void;
141
- disconnectBroadcastChannel(): void;
142
- broadcast(Message: ConstructableOutgoingMessage, args?: any): void;
143
110
  setAwarenessField(key: string, value: any): void;
144
111
  }
@@ -1,8 +1,8 @@
1
- import type { MessageEvent } from 'ws';
2
- import { Event } from 'ws';
1
+ import type { MessageEvent, Event } from 'ws';
3
2
  import EventEmitter from './EventEmitter.js';
4
- import { HocuspocusProvider } from './HocuspocusProvider.js';
5
- import { WebSocketStatus, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.js';
3
+ import type { HocuspocusProvider } from './HocuspocusProvider.js';
4
+ import type { onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.js';
5
+ import { WebSocketStatus } from './types.js';
6
6
  export type HocusPocusWebSocket = WebSocket & {
7
7
  identifier: string;
8
8
  };
@@ -72,10 +72,6 @@ export interface CompleteHocuspocusProviderWebsocketConfiguration {
72
72
  onDestroy: () => void;
73
73
  onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
74
74
  onAwarenessChange: (data: onAwarenessChangeParameters) => void;
75
- /**
76
- * Don’t output any warnings.
77
- */
78
- quiet: boolean;
79
75
  /**
80
76
  * Map of attached providers keyed by documentName.
81
77
  */
@@ -102,7 +98,7 @@ export declare class HocuspocusProviderWebsocket extends EventEmitter {
102
98
  receivedOnStatusPayload?: onStatusParameters | undefined;
103
99
  onOpen(event: Event): Promise<void>;
104
100
  onStatus(data: onStatusParameters): Promise<void>;
105
- attach(provider: HocuspocusProvider): Promise<any> | undefined;
101
+ attach(provider: HocuspocusProvider): void;
106
102
  detach(provider: HocuspocusProvider): void;
107
103
  setConfiguration(configuration?: Partial<HocuspocusProviderWebsocketConfiguration>): void;
108
104
  cancelWebsocketRetry?: () => void;
@@ -1,6 +1,6 @@
1
- import { Decoder } from 'lib0/decoding';
2
- import { Encoder } from 'lib0/encoding';
3
- import { MessageType } from './types.js';
1
+ import type { Decoder } from 'lib0/decoding';
2
+ import type { Encoder } from 'lib0/encoding';
3
+ import type { MessageType } from './types.js';
4
4
  export declare class IncomingMessage {
5
5
  data: any;
6
6
  encoder: Encoder;
@@ -1,10 +1,8 @@
1
- import { HocuspocusProvider } from './HocuspocusProvider.js';
2
- import { IncomingMessage } from './IncomingMessage.js';
1
+ import type { HocuspocusProvider } from './HocuspocusProvider.js';
2
+ import type { IncomingMessage } from './IncomingMessage.js';
3
3
  export declare class MessageReceiver {
4
4
  message: IncomingMessage;
5
- broadcasted: boolean;
6
5
  constructor(message: IncomingMessage);
7
- setBroadcasted(value: boolean): this;
8
6
  apply(provider: HocuspocusProvider, emitSynced: boolean): void;
9
7
  private applySyncMessage;
10
8
  applySyncStatusMessage(provider: HocuspocusProvider, applied: boolean): void;
@@ -1,5 +1,5 @@
1
- import { Encoder } from 'lib0/encoding';
2
- import { ConstructableOutgoingMessage } from './types.js';
1
+ import type { Encoder } from 'lib0/encoding';
2
+ import type { ConstructableOutgoingMessage } from './types.js';
3
3
  export declare class MessageSender {
4
4
  encoder: Encoder;
5
5
  message: any;
@@ -1,5 +1,5 @@
1
- import { Encoder } from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.js';
1
+ import type { Encoder } from 'lib0/encoding';
2
+ import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.js';
3
3
  export declare class OutgoingMessage implements OutgoingMessageInterface {
4
4
  encoder: Encoder;
5
5
  type?: MessageType;
@@ -1,4 +1,5 @@
1
- import { MessageType, OutgoingMessageArguments } from '../types.js';
1
+ import type { OutgoingMessageArguments } from '../types.js';
2
+ import { MessageType } from '../types.js';
2
3
  import { OutgoingMessage } from '../OutgoingMessage.js';
3
4
  export declare class AuthenticationMessage extends OutgoingMessage {
4
5
  type: MessageType;
@@ -1,5 +1,6 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments } from '../types.js';
2
+ import type { OutgoingMessageArguments } from '../types.js';
3
+ import { MessageType } from '../types.js';
3
4
  import { OutgoingMessage } from '../OutgoingMessage.js';
4
5
  export declare class AwarenessMessage extends OutgoingMessage {
5
6
  type: MessageType;
@@ -1,5 +1,6 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments } from '../types.js';
2
+ import type { OutgoingMessageArguments } from '../types.js';
3
+ import { MessageType } from '../types.js';
3
4
  import { OutgoingMessage } from '../OutgoingMessage.js';
4
5
  export declare class CloseMessage extends OutgoingMessage {
5
6
  type: MessageType;
@@ -1,5 +1,6 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments } from '../types.js';
2
+ import type { OutgoingMessageArguments } from '../types.js';
3
+ import { MessageType } from '../types.js';
3
4
  import { OutgoingMessage } from '../OutgoingMessage.js';
4
5
  export declare class QueryAwarenessMessage extends OutgoingMessage {
5
6
  type: MessageType;
@@ -1,4 +1,5 @@
1
- import { MessageType, OutgoingMessageArguments } from '../types.js';
1
+ import type { OutgoingMessageArguments } from '../types.js';
2
+ import { MessageType } from '../types.js';
2
3
  import { OutgoingMessage } from '../OutgoingMessage.js';
3
4
  export declare class StatelessMessage extends OutgoingMessage {
4
5
  type: MessageType;
@@ -1,5 +1,6 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments } from '../types.js';
2
+ import type { OutgoingMessageArguments } from '../types.js';
3
+ import { MessageType } from '../types.js';
3
4
  import { OutgoingMessage } from '../OutgoingMessage.js';
4
5
  export declare class SyncStepOneMessage extends OutgoingMessage {
5
6
  type: MessageType;
@@ -1,5 +1,6 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import { MessageType, OutgoingMessageArguments } from '../types.js';
2
+ import type { OutgoingMessageArguments } from '../types.js';
3
+ import { MessageType } from '../types.js';
3
4
  import { OutgoingMessage } from '../OutgoingMessage.js';
4
5
  export declare class SyncStepTwoMessage extends OutgoingMessage {
5
6
  type: MessageType;
@@ -1,4 +1,5 @@
1
- import { MessageType, OutgoingMessageArguments } from '../types.js';
1
+ import type { OutgoingMessageArguments } from '../types.js';
2
+ import { MessageType } from '../types.js';
2
3
  import { OutgoingMessage } from '../OutgoingMessage.js';
3
4
  export declare class UpdateMessage extends OutgoingMessage {
4
5
  type: MessageType;
@@ -1,5 +1,3 @@
1
1
  export * from './HocuspocusProvider.js';
2
- export * from './TiptapCollabProvider.js';
3
- export * from './TiptapCollabProviderWebsocket.js';
4
2
  export * from './HocuspocusProviderWebsocket.js';
5
3
  export * from './types.js';
@@ -1,16 +1,16 @@
1
- import { Encoder } from 'lib0/encoding';
1
+ import type { Encoder } from 'lib0/encoding';
2
2
  import type { Event, MessageEvent } from 'ws';
3
- import { Awareness } from 'y-protocols/awareness';
4
- import * as Y from 'yjs';
5
- import { CloseEvent } from '@hocuspocus/common';
6
- import { IncomingMessage } from './IncomingMessage.js';
7
- import { OutgoingMessage } from './OutgoingMessage.js';
8
- import { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage.js';
9
- import { AwarenessMessage } from './OutgoingMessages/AwarenessMessage.js';
10
- import { QueryAwarenessMessage } from './OutgoingMessages/QueryAwarenessMessage.js';
11
- import { SyncStepOneMessage } from './OutgoingMessages/SyncStepOneMessage.js';
12
- import { SyncStepTwoMessage } from './OutgoingMessages/SyncStepTwoMessage.js';
13
- import { UpdateMessage } from './OutgoingMessages/UpdateMessage.js';
3
+ import type { Awareness } from 'y-protocols/awareness';
4
+ import type * as Y from 'yjs';
5
+ import type { CloseEvent } from '@hocuspocus/common';
6
+ import type { IncomingMessage } from './IncomingMessage.js';
7
+ import type { OutgoingMessage } from './OutgoingMessage.js';
8
+ import type { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage.js';
9
+ import type { AwarenessMessage } from './OutgoingMessages/AwarenessMessage.js';
10
+ import type { QueryAwarenessMessage } from './OutgoingMessages/QueryAwarenessMessage.js';
11
+ import type { SyncStepOneMessage } from './OutgoingMessages/SyncStepOneMessage.js';
12
+ import type { SyncStepTwoMessage } from './OutgoingMessages/SyncStepTwoMessage.js';
13
+ import type { UpdateMessage } from './OutgoingMessages/UpdateMessage.js';
14
14
  export declare enum MessageType {
15
15
  Sync = 0,
16
16
  Awareness = 1,
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
- import { IncomingMessage } from 'http';
3
- import WebSocket from 'ws';
4
- import { Debugger } from './Debugger.js';
5
- import Document from './Document.js';
6
- import { Hocuspocus } from './Hocuspocus.js';
7
- import { onDisconnectPayload } from './types.js';
2
+ /// <reference types="node" />
3
+ import type { IncomingMessage } from 'http';
4
+ import { type CloseEvent } from '@hocuspocus/common';
5
+ import type WebSocket from 'ws';
6
+ import type Document from './Document.js';
7
+ import type { Hocuspocus } from './Hocuspocus.js';
8
+ import type { onDisconnectPayload } from './types.js';
8
9
  /**
9
10
  * The `ClientConnection` class is responsible for handling an incoming WebSocket
10
11
  *
@@ -16,7 +17,6 @@ export declare class ClientConnection {
16
17
  private readonly request;
17
18
  private readonly documentProvider;
18
19
  private readonly hooks;
19
- private readonly debuggerTool;
20
20
  private readonly opts;
21
21
  private readonly defaultContext;
22
22
  private readonly documentConnections;
@@ -24,8 +24,10 @@ export declare class ClientConnection {
24
24
  private readonly documentConnectionsEstablished;
25
25
  private readonly hookPayloads;
26
26
  private readonly callbacks;
27
- private readonly closeIdleConnectionTimeout;
28
27
  private readonly socketId;
28
+ timeout: number;
29
+ pingInterval: NodeJS.Timeout;
30
+ pongReceived: boolean;
29
31
  /**
30
32
  * The `ClientConnection` class receives incoming WebSocket connections,
31
33
  * runs all hooks:
@@ -38,10 +40,17 @@ export declare class ClientConnection {
38
40
  */
39
41
  constructor(websocket: WebSocket, request: IncomingMessage, documentProvider: {
40
42
  createDocument: Hocuspocus['createDocument'];
41
- }, hooks: Hocuspocus['hooks'], debuggerTool: Debugger, opts: {
42
- requiresAuthentication: boolean;
43
+ }, hooks: Hocuspocus['hooks'], opts: {
43
44
  timeout: number;
44
45
  }, defaultContext?: any);
46
+ private handleWebsocketClose;
47
+ close(event?: CloseEvent): void;
48
+ handlePong: () => void;
49
+ /**
50
+ * Check if pong was received and close the connection otherwise
51
+ * @private
52
+ */
53
+ private check;
45
54
  /**
46
55
  * Set a callback that will be triggered when the connection is closed
47
56
  */
@@ -1,32 +1,21 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IncomingMessage as HTTPIncomingMessage } from 'http';
4
- import AsyncLock from 'async-lock';
5
- import WebSocket from 'ws';
6
- import { CloseEvent } from '@hocuspocus/common';
7
- import Document from './Document.js';
8
- import { Debugger } from './Debugger.js';
9
- import { onStatelessPayload } from './types.js';
2
+ import type { IncomingMessage as HTTPIncomingMessage } from 'http';
3
+ import type WebSocket from 'ws';
4
+ import { type CloseEvent } from '@hocuspocus/common';
5
+ import type Document from './Document.js';
6
+ import type { onStatelessPayload } from './types.js';
10
7
  export declare class Connection {
11
8
  webSocket: WebSocket;
12
9
  context: any;
13
10
  document: Document;
14
- pingInterval: NodeJS.Timeout;
15
- pongReceived: boolean;
16
11
  request: HTTPIncomingMessage;
17
- timeout: number;
18
12
  callbacks: any;
19
13
  socketId: string;
20
- lock: AsyncLock;
21
- readOnly: Boolean;
22
- logger: Debugger;
14
+ readOnly: boolean;
23
15
  /**
24
16
  * Constructor.
25
17
  */
26
- constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, timeout: number, socketId: string, context: any, readOnly: boolean | undefined, logger: Debugger);
27
- boundClose: (event?: CloseEvent) => void;
28
- boundHandlePong: () => void;
29
- handlePong(): void;
18
+ constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, socketId: string, context: any, readOnly?: boolean);
30
19
  /**
31
20
  * Set a callback that will be triggered when the connection is closed
32
21
  */
@@ -51,11 +40,6 @@ export declare class Connection {
51
40
  * Graceful wrapper around the WebSocket close method.
52
41
  */
53
42
  close(event?: CloseEvent): void;
54
- /**
55
- * Check if pong was received and close the connection otherwise
56
- * @private
57
- */
58
- private check;
59
43
  /**
60
44
  * Send the current document awareness to the client, if any
61
45
  * @private
@@ -1,4 +1,4 @@
1
- import Document from './Document.js';
1
+ import type Document from './Document.js';
2
2
  import type { Hocuspocus } from './Hocuspocus.js';
3
3
  import type { DirectConnection as DirectConnectionInterface } from './types.js';
4
4
  export declare class DirectConnection implements DirectConnectionInterface {
@@ -9,6 +9,6 @@ export declare class DirectConnection implements DirectConnectionInterface {
9
9
  * Constructor.
10
10
  */
11
11
  constructor(document: Document, instance: Hocuspocus, context?: any);
12
- transact(transaction: (document: Document) => void, transactionOrigin?: any): Promise<void>;
12
+ transact(transaction: (document: Document) => void): Promise<void>;
13
13
  disconnect(): Promise<void>;
14
14
  }
@@ -1,9 +1,7 @@
1
- import WebSocket from 'ws';
1
+ import type WebSocket from 'ws';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
3
  import { Doc } from 'yjs';
4
- import { mutex } from 'lib0/mutex.js';
5
- import Connection from './Connection.js';
6
- import { Debugger } from './Debugger.js';
4
+ import type Connection from './Connection.js';
7
5
  export declare class Document extends Doc {
8
6
  awareness: Awareness;
9
7
  callbacks: {
@@ -16,14 +14,12 @@ export declare class Document extends Doc {
16
14
  }>;
17
15
  directConnectionsCount: number;
18
16
  name: string;
19
- mux: mutex;
20
- logger?: Debugger;
21
17
  isLoading: boolean;
22
18
  isDestroyed: boolean;
23
19
  /**
24
20
  * Constructor.
25
21
  */
26
- constructor(name: string, logger?: Debugger, yDocOptions?: {});
22
+ constructor(name: string, yDocOptions?: object);
27
23
  /**
28
24
  * Check if the Document (XMLFragment or Map) is empty
29
25
  */
@@ -1,15 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { IncomingMessage } from 'http';
3
- import WebSocket, { AddressInfo } from 'ws';
4
- import { Server as HocuspocusServer } from './Server.js';
5
- import { Debugger } from './Debugger.js';
2
+ import type { IncomingMessage } from 'http';
3
+ import type WebSocket from 'ws';
4
+ import type { Server } from './Server.js';
6
5
  import { DirectConnection } from './DirectConnection.js';
7
6
  import Document from './Document.js';
8
- import { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onListenPayload, onStoreDocumentPayload } from './types.js';
7
+ import type { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onStoreDocumentPayload } from './types.js';
9
8
  export declare const defaultConfiguration: {
10
9
  name: null;
11
- port: number;
12
- address: string;
13
10
  timeout: number;
14
11
  debounce: number;
15
12
  maxDebounce: number;
@@ -19,17 +16,12 @@ export declare const defaultConfiguration: {
19
16
  gcFilter: () => boolean;
20
17
  };
21
18
  unloadImmediately: boolean;
22
- stopOnSignals: boolean;
23
19
  };
24
- /**
25
- * Hocuspocus Server
26
- */
27
20
  export declare class Hocuspocus {
28
21
  configuration: Configuration;
29
22
  loadingDocuments: Map<string, Promise<Document>>;
30
23
  documents: Map<string, Document>;
31
- server?: HocuspocusServer;
32
- debugger: Debugger;
24
+ server?: Server;
33
25
  debouncer: {
34
26
  debounce: (id: string, func: Function, debounce: number, maxDebounce: number) => any;
35
27
  isDebounced: (id: string) => boolean;
@@ -37,19 +29,9 @@ export declare class Hocuspocus {
37
29
  };
38
30
  constructor(configuration?: Partial<Configuration>);
39
31
  /**
40
- * Configure the server
32
+ * Configure Hocuspocus
41
33
  */
42
34
  configure(configuration: Partial<Configuration>): Hocuspocus;
43
- get requiresAuthentication(): boolean;
44
- /**
45
- * Start the server
46
- */
47
- listen(portOrCallback?: number | ((data: onListenPayload) => Promise<any>) | null, callback?: any, websocketOptions?: WebSocket.ServerOptions): Promise<Hocuspocus>;
48
- get address(): AddressInfo;
49
- get URL(): string;
50
- get webSocketURL(): string;
51
- get httpURL(): string;
52
- private showStartScreen;
53
35
  /**
54
36
  * Get the total number of active documents
55
37
  */
@@ -62,10 +44,6 @@ export declare class Hocuspocus {
62
44
  * Force close one or more connections
63
45
  */
64
46
  closeConnections(documentName?: string): void;
65
- /**
66
- * Destroy the server
67
- */
68
- destroy(): Promise<any>;
69
47
  /**
70
48
  * The `handleConnection` method receives incoming WebSocket connections,
71
49
  * runs all hooks:
@@ -88,7 +66,7 @@ export declare class Hocuspocus {
88
66
  * Create a new document by the given request
89
67
  */
90
68
  createDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
91
- loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
69
+ loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>;
92
70
  storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): any;
93
71
  /**
94
72
  * Run the given hook on all configured extensions.
@@ -96,12 +74,5 @@ export declare class Hocuspocus {
96
74
  */
97
75
  hooks<T extends HookName>(name: T, payload: HookPayloadByName[T], callback?: Function | null): Promise<any>;
98
76
  unloadDocument(document: Document): Promise<any>;
99
- enableDebugging(): void;
100
- enableMessageLogging(): void;
101
- disableLogging(): void;
102
- disableDebugging(): void;
103
- flushMessageLogs(): this;
104
- getMessageLogs(): any[];
105
77
  openDirectConnection(documentName: string, context?: any): Promise<DirectConnection>;
106
78
  }
107
- export declare const Server: Hocuspocus;
@@ -1,6 +1,6 @@
1
- import { Decoder } from 'lib0/decoding';
2
- import { Encoder } from 'lib0/encoding';
3
- import { MessageType } from './types.js';
1
+ import type { Decoder } from 'lib0/decoding';
2
+ import type { Encoder } from 'lib0/encoding';
3
+ import type { MessageType } from './types.js';
4
4
  export declare class IncomingMessage {
5
5
  /**
6
6
  * Access to the received message.
@@ -1,12 +1,10 @@
1
- import Connection from './Connection.js';
2
- import { Debugger } from './Debugger.js';
3
- import Document from './Document.js';
4
- import { IncomingMessage } from './IncomingMessage.js';
1
+ import type Connection from './Connection.js';
2
+ import type Document from './Document.js';
3
+ import type { IncomingMessage } from './IncomingMessage.js';
5
4
  export declare class MessageReceiver {
6
5
  message: IncomingMessage;
7
- logger: Debugger;
8
6
  defaultTransactionOrigin?: string;
9
- constructor(message: IncomingMessage, logger: Debugger, defaultTransactionOrigin?: string);
7
+ constructor(message: IncomingMessage, defaultTransactionOrigin?: string);
10
8
  apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
11
9
  readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 1 | 2;
12
10
  applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
@@ -1,6 +1,6 @@
1
- import { Encoder } from 'lib0/encoding';
2
- import { Awareness } from 'y-protocols/awareness';
3
- import Document from './Document.js';
1
+ import type { Encoder } from 'lib0/encoding';
2
+ import type { Awareness } from 'y-protocols/awareness';
3
+ import type Document from './Document.js';
4
4
  export declare class OutgoingMessage {
5
5
  encoder: Encoder;
6
6
  type?: number;
@@ -17,5 +17,6 @@ export declare class OutgoingMessage {
17
17
  writeStateless(payload: string): OutgoingMessage;
18
18
  writeBroadcastStateless(payload: string): OutgoingMessage;
19
19
  writeSyncStatus(updateSaved: boolean): OutgoingMessage;
20
+ writeCloseMessage(reason: string): OutgoingMessage;
20
21
  toUint8Array(): Uint8Array;
21
22
  }
@@ -1,13 +1,33 @@
1
1
  /// <reference types="node" />
2
- import { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
3
- import { ServerOptions, WebSocketServer } from 'ws';
2
+ import type { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
3
+ import { WebSocketServer } from 'ws';
4
+ import type { AddressInfo, ServerOptions } from 'ws';
4
5
  import { Hocuspocus } from './Hocuspocus.js';
6
+ import type { Configuration } from './types';
7
+ export interface ServerConfiguration extends Configuration {
8
+ port?: number;
9
+ address?: string;
10
+ stopOnSignals?: boolean;
11
+ }
12
+ export declare const defaultServerConfiguration: {
13
+ port: number;
14
+ address: string;
15
+ stopOnSignals: boolean;
16
+ };
5
17
  export declare class Server {
6
18
  httpServer: HTTPServer;
7
19
  webSocketServer: WebSocketServer;
8
20
  hocuspocus: Hocuspocus;
9
- constructor(hocuspocus: Hocuspocus, websocketOptions?: ServerOptions);
21
+ configuration: ServerConfiguration;
22
+ constructor(configuration?: Partial<ServerConfiguration>, websocketOptions?: ServerOptions);
10
23
  setupWebsocketConnection: () => void;
11
24
  setupHttpUpgrade: () => void;
12
25
  requestHandler: (request: IncomingMessage, response: ServerResponse) => Promise<void>;
26
+ listen(port?: number, callback?: any): Promise<Hocuspocus>;
27
+ get address(): AddressInfo;
28
+ destroy(): Promise<any>;
29
+ get URL(): string;
30
+ get webSocketURL(): string;
31
+ get httpURL(): string;
32
+ private showStartScreen;
13
33
  }
@@ -1,9 +1,9 @@
1
1
  export * from './Connection.js';
2
- export * from './Debugger.js';
3
2
  export * from './Document.js';
4
3
  export * from './Hocuspocus.js';
5
4
  export * from './IncomingMessage.js';
6
5
  export * from './MessageReceiver.js';
7
6
  export * from './OutgoingMessage.js';
7
+ export * from './Server.js';
8
8
  export * from './types.js';
9
9
  export * from './util/debounce.js';
@@ -1,12 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
- import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
5
- import { URLSearchParams } from 'url';
6
- import { Awareness } from 'y-protocols/awareness';
7
- import Connection from './Connection.js';
8
- import Document from './Document.js';
9
- import { Hocuspocus } from './Hocuspocus.js';
4
+ /// <reference types="node" />
5
+ import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
6
+ import type { URLSearchParams } from 'url';
7
+ import type { Awareness } from 'y-protocols/awareness';
8
+ import type Connection from './Connection.js';
9
+ import type Document from './Document.js';
10
+ import type { Hocuspocus } from './Hocuspocus.js';
10
11
  export declare enum MessageType {
11
12
  Unknown = -1,
12
13
  Sync = 0,
@@ -26,7 +27,6 @@ export interface AwarenessUpdate {
26
27
  }
27
28
  export interface ConnectionConfiguration {
28
29
  readOnly: boolean;
29
- requiresAuthentication: boolean;
30
30
  isAuthenticated: boolean;
31
31
  }
32
32
  export interface Extension {
@@ -87,14 +87,6 @@ export interface Configuration extends Extension {
87
87
  * A list of hocuspocus extensions.
88
88
  */
89
89
  extensions: Array<Extension>;
90
- /**
91
- * The port which the server listens on.
92
- */
93
- port?: number;
94
- /**
95
- * The address which the server listens on.
96
- */
97
- address?: string;
98
90
  /**
99
91
  * Defines in which interval the server sends a ping, and closes the connection when no pong is sent back.
100
92
  */
@@ -120,12 +112,6 @@ export interface Configuration extends Extension {
120
112
  * your onStoreDocument is rate-limited.
121
113
  */
122
114
  unloadImmediately: boolean;
123
- /**
124
- * the server will gracefully stop if SIGINT, SIGQUIT or SIGTERM is received.
125
- *
126
- * Set this to false if you don't want that.
127
- */
128
- stopOnSignals: boolean;
129
115
  /**
130
116
  * options to pass to the ydoc document
131
117
  */
@@ -149,7 +135,7 @@ export interface onAuthenticatePayload {
149
135
  request: IncomingMessage;
150
136
  socketId: string;
151
137
  token: string;
152
- connection: ConnectionConfiguration;
138
+ connectionConfig: ConnectionConfiguration;
153
139
  }
154
140
  export interface onCreateDocumentPayload {
155
141
  context: any;
@@ -158,7 +144,7 @@ export interface onCreateDocumentPayload {
158
144
  requestHeaders: IncomingHttpHeaders;
159
145
  requestParameters: URLSearchParams;
160
146
  socketId: string;
161
- connection: ConnectionConfiguration;
147
+ connectionConfig: ConnectionConfiguration;
162
148
  }
163
149
  export interface onConnectPayload {
164
150
  context: any;
@@ -168,7 +154,7 @@ export interface onConnectPayload {
168
154
  requestHeaders: IncomingHttpHeaders;
169
155
  requestParameters: URLSearchParams;
170
156
  socketId: string;
171
- connection: ConnectionConfiguration;
157
+ connectionConfig: ConnectionConfiguration;
172
158
  }
173
159
  export interface connectedPayload {
174
160
  context: any;
@@ -178,8 +164,8 @@ export interface connectedPayload {
178
164
  requestHeaders: IncomingHttpHeaders;
179
165
  requestParameters: URLSearchParams;
180
166
  socketId: string;
181
- connection: ConnectionConfiguration;
182
- connectionInstance: Connection;
167
+ connectionConfig: ConnectionConfiguration;
168
+ connection: Connection;
183
169
  }
184
170
  export interface onLoadDocumentPayload {
185
171
  context: any;
@@ -189,7 +175,7 @@ export interface onLoadDocumentPayload {
189
175
  requestHeaders: IncomingHttpHeaders;
190
176
  requestParameters: URLSearchParams;
191
177
  socketId: string;
192
- connection: ConnectionConfiguration;
178
+ connectionConfig: ConnectionConfiguration;
193
179
  }
194
180
  export interface afterLoadDocumentPayload {
195
181
  context: any;
@@ -199,7 +185,7 @@ export interface afterLoadDocumentPayload {
199
185
  requestHeaders: IncomingHttpHeaders;
200
186
  requestParameters: URLSearchParams;
201
187
  socketId: string;
202
- connection: ConnectionConfiguration;
188
+ connectionConfig: ConnectionConfiguration;
203
189
  }
204
190
  export interface onChangePayload {
205
191
  clientsCount: number;
@@ -269,7 +255,7 @@ export interface fetchPayload {
269
255
  requestHeaders: IncomingHttpHeaders;
270
256
  requestParameters: URLSearchParams;
271
257
  socketId: string;
272
- connection: ConnectionConfiguration;
258
+ connectionConfig: ConnectionConfiguration;
273
259
  }
274
260
  export interface storePayload extends onStoreDocumentPayload {
275
261
  state: Buffer;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { IncomingMessage } from 'http';
3
+ import type { IncomingMessage } from 'http';
4
4
  import { URLSearchParams } from 'url';
5
5
  /**
6
6
  * Get parameters by the given request
@@ -1,6 +1,6 @@
1
1
  import { Doc } from 'yjs';
2
2
  import { Schema } from '@tiptap/pm/model';
3
- import { Transformer } from './types.js';
3
+ import type { Transformer } from './types.js';
4
4
  declare class Prosemirror implements Transformer {
5
5
  defaultSchema: Schema;
6
6
  schema(schema: Schema): Prosemirror;
@@ -1,6 +1,6 @@
1
- import { Doc } from 'yjs';
2
- import { Extensions } from '@tiptap/core';
3
- import { Transformer } from './types.js';
1
+ import type { Doc } from 'yjs';
2
+ import type { Extensions } from '@tiptap/core';
3
+ import type { Transformer } from './types.js';
4
4
  export declare class Tiptap implements Transformer {
5
5
  defaultExtensions: Extensions;
6
6
  extensions(extensions: Extensions): Tiptap;
@@ -1,4 +1,4 @@
1
- import { Doc } from 'yjs';
1
+ import type { Doc } from 'yjs';
2
2
  export interface Transformer {
3
3
  fromYdoc: (document: Doc, fieldName?: string | Array<string>) => any;
4
4
  toYdoc: (document: any, fieldName: string) => Doc;
@@ -1,2 +1,2 @@
1
- import { Hocuspocus, Configuration } from '@hocuspocus/server';
2
- export declare const newHocuspocus: (options?: Partial<Configuration>) => Promise<Hocuspocus>;
1
+ import type { ServerConfiguration } from '@hocuspocus/server';
2
+ export declare const newHocuspocus: (options?: Partial<ServerConfiguration>) => Promise<import("@hocuspocus/server").Hocuspocus>;
@@ -1,3 +1,3 @@
1
- import { HocuspocusProvider, HocuspocusProviderConfiguration, HocuspocusProviderWebsocket, HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
2
- import { Hocuspocus } from '@hocuspocus/server';
1
+ import { HocuspocusProvider, type HocuspocusProviderConfiguration, type HocuspocusProviderWebsocket, type HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
2
+ import type { Hocuspocus } from '@hocuspocus/server';
3
3
  export declare const newHocuspocusProvider: (server: Hocuspocus, options?: Partial<HocuspocusProviderConfiguration>, websocketOptions?: Partial<HocuspocusProviderWebsocketConfiguration>, websocketProvider?: HocuspocusProviderWebsocket) => HocuspocusProvider;
@@ -1,3 +1,4 @@
1
- import { HocuspocusProviderWebsocket, HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
2
- import { Hocuspocus } from '@hocuspocus/server';
3
- export declare const newHocuspocusProviderWebsocket: (server: Hocuspocus, options?: Partial<Omit<HocuspocusProviderWebsocketConfiguration, 'url'>>) => HocuspocusProviderWebsocket;
1
+ import type { HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
2
+ import { HocuspocusProviderWebsocket } from '@hocuspocus/provider';
3
+ import type { Hocuspocus } from '@hocuspocus/server';
4
+ export declare const newHocuspocusProviderWebsocket: (hocuspocus: Hocuspocus, options?: Partial<Omit<HocuspocusProviderWebsocketConfiguration, 'url'>>) => HocuspocusProviderWebsocket;
@@ -1,2 +1,2 @@
1
- import { ExecutionContext } from 'ava';
1
+ import type { ExecutionContext } from 'ava';
2
2
  export declare const retryableAssertion: (t: ExecutionContext, recoverableTry: (tt: ExecutionContext) => void) => Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-database",
3
3
  "description": "a generic Hocuspocus persistence driver for the database",
4
- "version": "2.15.2",
4
+ "version": "3.0.4-rc.0",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
7
7
  "hocuspocus",
@@ -27,7 +27,7 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@hocuspocus/server": "^2.15.2"
30
+ "@hocuspocus/server": "^3.0.4-rc.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "yjs": "^13.6.8"
package/src/Database.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  Extension,
3
3
  onChangePayload,
4
4
  onLoadDocumentPayload,
@@ -1,161 +0,0 @@
1
- import type { AbstractType, YArrayEvent } from 'yjs';
2
- import * as Y from 'yjs';
3
- import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider.js';
4
- import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js';
5
- import { type DeleteCommentOptions, type DeleteThreadOptions, type GetThreadsOptions, type TCollabComment, type TCollabThread, type THistoryVersion } from './types.js';
6
- export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & Pick<AdditionalTiptapCollabProviderConfiguration, 'user'> & {
7
- /**
8
- * Pass `true` if you want to delete a thread when the first comment is deleted.
9
- */
10
- deleteThreadOnFirstCommentDelete?: boolean;
11
- };
12
- export interface AdditionalTiptapCollabProviderConfiguration {
13
- /**
14
- * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
15
- */
16
- appId?: string;
17
- /**
18
- * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
19
- */
20
- baseUrl?: string;
21
- websocketProvider?: TiptapCollabProviderWebsocket;
22
- user?: string;
23
- }
24
- export declare class TiptapCollabProvider extends HocuspocusProvider {
25
- tiptapCollabConfigurationPrefix: string;
26
- userData?: Y.PermanentUserData;
27
- constructor(configuration: TiptapCollabProviderConfiguration);
28
- /**
29
- * note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan.
30
- */
31
- createVersion(name?: string): void;
32
- /**
33
- * note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan.
34
- */
35
- revertToVersion(targetVersion: number): void;
36
- /**
37
- * note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan.
38
- *
39
- * The server will reply with a stateless message (THistoryVersionPreviewEvent)
40
- */
41
- previewVersion(targetVersion: number): void;
42
- /**
43
- * note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan.
44
- */
45
- getVersions(): THistoryVersion[];
46
- watchVersions(callback: Parameters<AbstractType<YArrayEvent<THistoryVersion>>['observe']>[0]): void;
47
- unwatchVersions(callback: Parameters<AbstractType<YArrayEvent<THistoryVersion>>['unobserve']>[0]): void;
48
- isAutoVersioning(): boolean;
49
- enableAutoVersioning(): 1;
50
- disableAutoVersioning(): 0;
51
- /**
52
- * Returns all users in the document as Y.Map objects
53
- * @returns An array of Y.Map objects
54
- */
55
- private getYThreads;
56
- /**
57
- * Finds all threads in the document and returns them as JSON objects
58
- * @options Options to control the output of the threads (e.g. include deleted threads)
59
- * @returns An array of threads as JSON objects
60
- */
61
- getThreads<Data, CommentData>(options?: GetThreadsOptions): TCollabThread<Data, CommentData>[];
62
- /**
63
- * Find the index of a thread by its id
64
- * @param id The thread id
65
- * @returns The index of the thread or null if not found
66
- */
67
- private getThreadIndex;
68
- /**
69
- * Gets a single thread by its id
70
- * @param id The thread id
71
- * @returns The thread as a JSON object or null if not found
72
- */
73
- getThread<Data, CommentData>(id: string): TCollabThread<Data, CommentData> | null;
74
- /**
75
- * Gets a single thread by its id as a Y.Map object
76
- * @param id The thread id
77
- * @returns The thread as a Y.Map object or null if not found
78
- */
79
- private getYThread;
80
- /**
81
- * Create a new thread
82
- * @param data The thread data
83
- * @returns The created thread
84
- */
85
- createThread(data: Omit<TCollabThread, 'id' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'comments' | 'deletedComments'>): TCollabThread;
86
- /**
87
- * Update a specific thread
88
- * @param id The thread id
89
- * @param data New data for the thread
90
- * @returns The updated thread or null if the thread is not found
91
- */
92
- updateThread(id: TCollabThread['id'], data: Partial<Pick<TCollabThread, 'data'> & {
93
- resolvedAt: TCollabThread['resolvedAt'] | null;
94
- }>): TCollabThread;
95
- /**
96
- * Handle the deletion of a thread. By default, the thread and it's comments are not deleted, but marked as deleted
97
- * via the `deletedAt` property. Forceful deletion can be enabled by setting the `force` option to `true`.
98
- *
99
- * If you only want to delete the comments of a thread, you can set the `deleteComments` option to `true`.
100
- * @param id The thread id
101
- * @param options A set of options that control how the thread is deleted
102
- * @returns The deleted thread or null if the thread is not found
103
- */
104
- deleteThread(id: TCollabThread['id'], options?: DeleteThreadOptions): TCollabThread | null | undefined;
105
- /**
106
- * Tries to restore a deleted thread
107
- * @param id The thread id
108
- * @returns The restored thread or null if the thread is not found
109
- */
110
- restoreThread(id: TCollabThread['id']): TCollabThread | null;
111
- /**
112
- * Returns comments from a thread, either deleted or not
113
- * @param threadId The thread id
114
- * @param includeDeleted If you want to include deleted comments, defaults to `false`
115
- * @returns The comments or null if the thread is not found
116
- */
117
- getThreadComments(threadId: TCollabThread['id'], includeDeleted?: boolean): TCollabComment[] | null;
118
- /**
119
- * Get a single comment from a specific thread
120
- * @param threadId The thread id
121
- * @param commentId The comment id
122
- * @param includeDeleted If you want to include deleted comments in the search
123
- * @returns The comment or null if not found
124
- */
125
- getThreadComment(threadId: TCollabThread['id'], commentId: TCollabComment['id'], includeDeleted?: boolean): TCollabComment | null;
126
- /**
127
- * Adds a comment to a thread
128
- * @param threadId The thread id
129
- * @param data The comment data
130
- * @returns The updated thread or null if the thread is not found
131
- * @example addComment('123', { content: 'Hello world', data: { author: 'Maria Doe' } })
132
- */
133
- addComment(threadId: TCollabThread['id'], data: Omit<TCollabComment, 'id' | 'updatedAt' | 'createdAt'>): TCollabThread;
134
- /**
135
- * Update a comment in a thread
136
- * @param threadId The thread id
137
- * @param commentId The comment id
138
- * @param data The new comment data
139
- * @returns The updated thread or null if the thread or comment is not found
140
- * @example updateComment('123', { content: 'The new content', data: { attachments: ['file1.jpg'] }})
141
- */
142
- updateComment(threadId: TCollabThread['id'], commentId: TCollabComment['id'], data: Partial<Pick<TCollabComment, 'data' | 'content'>>): TCollabThread;
143
- /**
144
- * Deletes a comment from a thread
145
- * @param threadId The thread id
146
- * @param commentId The comment id
147
- * @param options A set of options that control how the comment is deleted
148
- * @returns The updated thread or null if the thread or comment is not found
149
- */
150
- deleteComment(threadId: TCollabThread['id'], commentId: TCollabComment['id'], options?: DeleteCommentOptions): TCollabThread | null | undefined;
151
- /**
152
- * Start watching threads for changes
153
- * @param callback The callback function to be called when a thread changes
154
- */
155
- watchThreads(callback: () => void): void;
156
- /**
157
- * Stop watching threads for changes
158
- * @param callback The callback function to be removed
159
- */
160
- unwatchThreads(callback: () => void): void;
161
- }
@@ -1,19 +0,0 @@
1
- import { CompleteHocuspocusProviderWebsocketConfiguration, HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.js';
2
- export type TiptapCollabProviderWebsocketConfiguration = Partial<CompleteHocuspocusProviderWebsocketConfiguration> & AdditionalTiptapCollabProviderWebsocketConfiguration;
3
- export interface AdditionalTiptapCollabProviderWebsocketConfiguration {
4
- /**
5
- * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
6
- */
7
- appId?: string;
8
- /**
9
- * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
10
- */
11
- baseUrl?: string;
12
- /**
13
- * Only fill this if you are using Tiptap Collab HA.
14
- */
15
- shardKey?: string;
16
- }
17
- export declare class TiptapCollabProviderWebsocket extends HocuspocusProviderWebsocket {
18
- constructor(configuration: TiptapCollabProviderWebsocketConfiguration);
19
- }
@@ -1,14 +0,0 @@
1
- export declare class Debugger {
2
- logs: any[];
3
- listen: boolean;
4
- output: boolean;
5
- enable(): void;
6
- disable(): void;
7
- verbose(): void;
8
- quiet(): void;
9
- log(message: any): this;
10
- flush(): this;
11
- get(): {
12
- logs: any[];
13
- };
14
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};