@hocuspocus/extension-webhook 3.0.4-rc.0 → 3.0.7-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 (49) hide show
  1. package/dist/hocuspocus-webhook.cjs.map +1 -1
  2. package/dist/hocuspocus-webhook.esm.js.map +1 -1
  3. package/dist/packages/common/src/auth.d.ts +1 -1
  4. package/dist/packages/common/src/index.d.ts +4 -4
  5. package/dist/packages/extension-database/src/index.d.ts +1 -1
  6. package/dist/packages/extension-logger/src/index.d.ts +1 -1
  7. package/dist/packages/extension-redis/src/Redis.d.ts +0 -2
  8. package/dist/packages/extension-redis/src/index.d.ts +1 -1
  9. package/dist/packages/extension-sqlite/src/index.d.ts +1 -1
  10. package/dist/packages/extension-throttle/src/index.d.ts +0 -1
  11. package/dist/packages/extension-webhook/src/index.d.ts +0 -1
  12. package/dist/packages/provider/src/HocuspocusProvider.d.ts +9 -7
  13. package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +4 -6
  14. package/dist/packages/provider/src/IncomingMessage.d.ts +2 -2
  15. package/dist/packages/provider/src/MessageReceiver.d.ts +2 -2
  16. package/dist/packages/provider/src/MessageSender.d.ts +2 -2
  17. package/dist/packages/provider/src/OutgoingMessage.d.ts +2 -2
  18. package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +3 -3
  19. package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +3 -3
  20. package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +3 -3
  21. package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +3 -3
  22. package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +3 -3
  23. package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +3 -3
  24. package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +3 -3
  25. package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +3 -3
  26. package/dist/packages/provider/src/index.d.ts +3 -3
  27. package/dist/packages/provider/src/types.d.ts +14 -108
  28. package/dist/packages/server/src/ClientConnection.d.ts +3 -5
  29. package/dist/packages/server/src/Connection.d.ts +13 -5
  30. package/dist/packages/server/src/DirectConnection.d.ts +3 -3
  31. package/dist/packages/server/src/Document.d.ts +1 -1
  32. package/dist/packages/server/src/Hocuspocus.d.ts +4 -5
  33. package/dist/packages/server/src/IncomingMessage.d.ts +4 -3
  34. package/dist/packages/server/src/MessageReceiver.d.ts +5 -5
  35. package/dist/packages/server/src/OutgoingMessage.d.ts +1 -1
  36. package/dist/packages/server/src/Server.d.ts +1 -2
  37. package/dist/packages/server/src/index.d.ts +9 -9
  38. package/dist/packages/server/src/types.d.ts +28 -9
  39. package/dist/packages/server/src/util/getParameters.d.ts +0 -2
  40. package/dist/packages/transformer/src/Prosemirror.d.ts +1 -1
  41. package/dist/packages/transformer/src/Tiptap.d.ts +1 -1
  42. package/dist/packages/transformer/src/index.d.ts +3 -3
  43. package/dist/playground/frontend/app/SocketContext.d.ts +2 -0
  44. package/dist/playground/frontend/next.config.d.ts +3 -0
  45. package/dist/tests/utils/index.d.ts +9 -9
  46. package/dist/tests/utils/newHocuspocusProviderWebsocket.d.ts +1 -1
  47. package/package.json +5 -5
  48. package/dist/playground/frontend/vite.config.d.ts +0 -2
  49. /package/dist/{playground/frontend/src/main.d.ts → tests/server/beforeSync.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-webhook.cjs","sources":["../src/index.ts"],"sourcesContent":["import { createHmac } from 'crypto'\nimport type {\n Extension,\n onChangePayload,\n onConnectPayload,\n onLoadDocumentPayload,\n onDisconnectPayload,\n} from '@hocuspocus/server'\nimport type { Doc } from 'yjs'\nimport type { Transformer } from '@hocuspocus/transformer'\nimport { TiptapTransformer } from '@hocuspocus/transformer'\nimport axios from 'axios'\nimport { Forbidden } from '@hocuspocus/common'\n\nexport enum Events {\n onChange = 'change',\n onConnect = 'connect',\n onCreate = 'create',\n onDisconnect = 'disconnect',\n}\n\nexport interface Configuration {\n debounce: number | false | null,\n debounceMaxWait: number,\n secret: string,\n transformer: Transformer | {\n toYdoc: (document: any) => Doc,\n fromYdoc: (document: Doc) => any,\n },\n url: string,\n events: Array<Events>,\n}\n\nexport class Webhook implements Extension {\n\n configuration: Configuration = {\n debounce: 2000,\n debounceMaxWait: 10000,\n secret: '',\n transformer: TiptapTransformer,\n url: '',\n events: [\n Events.onChange,\n ],\n }\n\n debounced: Map<string, { timeout: NodeJS.Timeout, start: number }> = new Map()\n\n /**\n * Constructor\n */\n constructor(configuration?: Partial<Configuration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n\n if (!this.configuration.url) {\n throw new Error('url is required!')\n }\n }\n\n /**\n * Create a signature for the response body\n */\n createSignature(body: string): string {\n const hmac = createHmac('sha256', this.configuration.secret)\n\n return `sha256=${hmac.update(body).digest('hex')}`\n }\n\n /**\n * debounce the given function, using the given identifier\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n debounce(id: string, func: Function) {\n const old = this.debounced.get(id)\n const start = old?.start || Date.now()\n\n const run = () => {\n this.debounced.delete(id)\n func()\n }\n\n if (old?.timeout) clearTimeout(old.timeout)\n if (Date.now() - start >= this.configuration.debounceMaxWait) return run()\n\n this.debounced.set(id, {\n start,\n timeout: setTimeout(run, <number> this.configuration.debounce),\n })\n }\n\n /**\n * Send a request to the given url containing the given data\n */\n async sendRequest(event: Events, payload: any) {\n const json = JSON.stringify({ event, payload })\n\n return axios.post(\n this.configuration.url,\n json,\n { headers: { 'X-Hocuspocus-Signature-256': this.createSignature(json), 'Content-Type': 'application/json' } },\n )\n }\n\n /**\n * onChange hook\n */\n async onChange(data: onChangePayload) {\n if (!this.configuration.events.includes(Events.onChange)) {\n return\n }\n\n const save = async () => {\n try {\n await this.sendRequest(Events.onChange, {\n document: this.configuration.transformer.fromYdoc(data.document),\n documentName: data.documentName,\n context: data.context,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n if (!this.configuration.debounce) {\n return save()\n }\n\n this.debounce(data.documentName, save)\n }\n\n /**\n * onLoadDocument hook\n */\n async onLoadDocument(data: onLoadDocumentPayload) {\n if (!this.configuration.events.includes(Events.onCreate)) {\n return\n }\n\n try {\n const response = await this.sendRequest(Events.onCreate, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n\n if (response.status !== 200 || !response.data) return\n\n const document = typeof response.data === 'string'\n ? JSON.parse(response.data)\n : response.data\n\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const fieldName in document) {\n if (data.document.isEmpty(fieldName)) {\n data.document.merge(\n this.configuration.transformer.toYdoc(document[fieldName], fieldName),\n )\n }\n }\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n /**\n * onConnect hook\n */\n async onConnect(data: onConnectPayload) {\n if (!this.configuration.events.includes(Events.onConnect)) {\n return\n }\n\n try {\n const response = await this.sendRequest(Events.onConnect, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n\n return typeof response.data === 'string' && response.data.length > 0\n ? JSON.parse(response.data)\n : response.data\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n throw Forbidden\n }\n }\n\n async onDisconnect(data: onDisconnectPayload) {\n if (!this.configuration.events.includes(Events.onDisconnect)) {\n return\n }\n\n try {\n await this.sendRequest(Events.onDisconnect, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n context: data.context,\n })\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n}\n"],"names":["Events","TiptapTransformer","createHmac","Forbidden"],"mappings":";;;;;;;AAcYA;AAAZ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O,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA,CAAE,CAAC;AACxD,YAAA,MAAMG,gBAAS;AAChB;;IAGH,MAAM,YAAY,CAAC,IAAyB,EAAA;AAC1C,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAACH,cAAM,CAAC,YAAY,CAAC,EAAE;YAC5D;AACD;QAED,IAAI;AACF,YAAA,MAAM,IAAI,CAAC,WAAW,CAACA,cAAM,CAAC,YAAY,EAAE;gBAC1C,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;gBACvE,OAAO,EAAE,IAAI,CAAC,OAAO;AACtB,aAAA,CAAC;AACH;AAAC,QAAA,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA,CAAE,CAAC;AACzD;;AAGJ;;;;"}
1
+ {"version":3,"file":"hocuspocus-webhook.cjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":["Events","TiptapTransformer","createHmac","Forbidden"],"mappings":";;;;;;;AAcYA;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,MAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,MAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EALWA,cAAM,KAANA,cAAM,GAKjB,EAAA,CAAA,CAAA;MAcY,OAAO,CAAA;AAelB;;AAEG;AACH,IAAA,WAAA,CAAY,aAAsC,EAAA;AAhBlD,QAAA,IAAA,CAAA,aAAa,GAAkB;AAC7B,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,eAAe,EA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ACvE,OAAO,EAAE,IAAI,CAAC,OAAO;AACtB,aAAA,CAAC;;QACF,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA,CAAE,CAAC;;;AAI7D;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-webhook.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { createHmac } from 'crypto'\nimport type {\n Extension,\n onChangePayload,\n onConnectPayload,\n onLoadDocumentPayload,\n onDisconnectPayload,\n} from '@hocuspocus/server'\nimport type { Doc } from 'yjs'\nimport type { Transformer } from '@hocuspocus/transformer'\nimport { TiptapTransformer } from '@hocuspocus/transformer'\nimport axios from 'axios'\nimport { Forbidden } from '@hocuspocus/common'\n\nexport enum Events {\n onChange = 'change',\n onConnect = 'connect',\n onCreate = 'create',\n onDisconnect = 'disconnect',\n}\n\nexport interface Configuration {\n debounce: number | false | null,\n debounceMaxWait: number,\n secret: string,\n transformer: Transformer | {\n toYdoc: (document: any) => Doc,\n fromYdoc: (document: Doc) => any,\n },\n url: string,\n events: Array<Events>,\n}\n\nexport class Webhook implements Extension {\n\n configuration: Configuration = {\n debounce: 2000,\n debounceMaxWait: 10000,\n secret: '',\n transformer: TiptapTransformer,\n url: '',\n events: [\n Events.onChange,\n ],\n }\n\n debounced: Map<string, { timeout: NodeJS.Timeout, start: number }> = new Map()\n\n /**\n * Constructor\n */\n constructor(configuration?: Partial<Configuration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n\n if (!this.configuration.url) {\n throw new Error('url is required!')\n }\n }\n\n /**\n * Create a signature for the response body\n */\n createSignature(body: string): string {\n const hmac = createHmac('sha256', this.configuration.secret)\n\n return `sha256=${hmac.update(body).digest('hex')}`\n }\n\n /**\n * debounce the given function, using the given identifier\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n debounce(id: string, func: Function) {\n const old = this.debounced.get(id)\n const start = old?.start || Date.now()\n\n const run = () => {\n this.debounced.delete(id)\n func()\n }\n\n if (old?.timeout) clearTimeout(old.timeout)\n if (Date.now() - start >= this.configuration.debounceMaxWait) return run()\n\n this.debounced.set(id, {\n start,\n timeout: setTimeout(run, <number> this.configuration.debounce),\n })\n }\n\n /**\n * Send a request to the given url containing the given data\n */\n async sendRequest(event: Events, payload: any) {\n const json = JSON.stringify({ event, payload })\n\n return axios.post(\n this.configuration.url,\n json,\n { headers: { 'X-Hocuspocus-Signature-256': this.createSignature(json), 'Content-Type': 'application/json' } },\n )\n }\n\n /**\n * onChange hook\n */\n async onChange(data: onChangePayload) {\n if (!this.configuration.events.includes(Events.onChange)) {\n return\n }\n\n const save = async () => {\n try {\n await this.sendRequest(Events.onChange, {\n document: this.configuration.transformer.fromYdoc(data.document),\n documentName: data.documentName,\n context: data.context,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n if (!this.configuration.debounce) {\n return save()\n }\n\n this.debounce(data.documentName, save)\n }\n\n /**\n * onLoadDocument hook\n */\n async onLoadDocument(data: onLoadDocumentPayload) {\n if (!this.configuration.events.includes(Events.onCreate)) {\n return\n }\n\n try {\n const response = await this.sendRequest(Events.onCreate, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n\n if (response.status !== 200 || !response.data) return\n\n const document = typeof response.data === 'string'\n ? JSON.parse(response.data)\n : response.data\n\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const fieldName in document) {\n if (data.document.isEmpty(fieldName)) {\n data.document.merge(\n this.configuration.transformer.toYdoc(document[fieldName], fieldName),\n )\n }\n }\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n /**\n * onConnect hook\n */\n async onConnect(data: onConnectPayload) {\n if (!this.configuration.events.includes(Events.onConnect)) {\n return\n }\n\n try {\n const response = await this.sendRequest(Events.onConnect, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n })\n\n return typeof response.data === 'string' && response.data.length > 0\n ? JSON.parse(response.data)\n : response.data\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n throw Forbidden\n }\n }\n\n async onDisconnect(data: onDisconnectPayload) {\n if (!this.configuration.events.includes(Events.onDisconnect)) {\n return\n }\n\n try {\n await this.sendRequest(Events.onDisconnect, {\n documentName: data.documentName,\n requestHeaders: data.requestHeaders,\n requestParameters: Object.fromEntries(data.requestParameters.entries()),\n context: data.context,\n })\n } catch (e) {\n console.error(`Caught error in extension-webhook: ${e}`)\n }\n }\n\n}\n"],"names":[],"mappings":";;;;;IAcY;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,MAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,MAAA,CAAA,UAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,MAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EALW,MAAM,KAAN,MAAM,GAKjB,EAAA,CAAA,CAAA;MAcY,OAAO,CAAA;AAelB;;AAEG;AACH,IAAA,WAAA,CAAY,aAAsC,EAAA;AAhBlD,QAAA,IAAA,CAAA,aAAa,GAAkB;AAC7B,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,eAAe,EAAE,KAAK;AACtB,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,WAAW,EAAE,iBAAiB;AAC9B,YAAA,GAAG,EAAE,EAAE;AACP,YAAA,MAAM,EAAE;AACN,gBAAA,MAAM,CAAC,QAAQ;AAChB,aAAA;SACF;AAED,QAAA,IAAA,CAAA,SAAS,GAA4D,IAAI,GAAG,EAAE;QAM5E,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB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YAAA,MAAM,SAAS;;;IAInB,MAAM,YAAY,CAAC,IAAyB,EAAA;AAC1C,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC5D;;AAGF,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE;gBAC1C,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;gBACvE,OAAO,EAAE,IAAI,CAAC,OAAO;AACtB,aAAA,CAAC;;QACF,OAAO,CAAC,EAAE;AACV,YAAA,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA,CAAE,CAAC;;;AAI7D;;;;"}
@@ -2,5 +2,5 @@ import * as encoding from 'lib0/encoding';
2
2
  import * as decoding from 'lib0/decoding';
3
3
  export declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
4
4
  export declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
5
- export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: 'readonly' | 'read-write') => void;
5
+ export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: "readonly" | "read-write") => void;
6
6
  export declare const readAuthMessage: (decoder: decoding.Decoder, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
@@ -1,4 +1,4 @@
1
- export * from './auth.js';
2
- export * from './CloseEvents.js';
3
- export * from './awarenessStatesToArray.js';
4
- export * from './types.js';
1
+ export * from './auth.ts';
2
+ export * from './CloseEvents.ts';
3
+ export * from './awarenessStatesToArray.ts';
4
+ export * from './types.ts';
@@ -1 +1 @@
1
- export * from './Database.js';
1
+ export * from './Database.ts';
@@ -1 +1 @@
1
- export * from './Logger.js';
1
+ export * from './Logger.ts';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
4
2
  import RedisClient from 'ioredis';
5
3
  import Redlock from 'redlock';
@@ -1 +1 @@
1
- export * from './Redis.js';
1
+ export * from './Redis.ts';
@@ -1 +1 @@
1
- export * from './SQLite.js';
1
+ export * from './SQLite.ts';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Extension, onConnectPayload } from '@hocuspocus/server';
3
2
  export interface ThrottleConfiguration {
4
3
  throttle: number | null | false;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Extension, onChangePayload, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from '@hocuspocus/server';
3
2
  import type { Doc } from 'yjs';
4
3
  import type { Transformer } from '@hocuspocus/transformer';
@@ -1,10 +1,10 @@
1
1
  import type { Event, MessageEvent } from 'ws';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
3
  import * as Y from 'yjs';
4
- import EventEmitter from './EventEmitter.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';
4
+ import EventEmitter from './EventEmitter.ts';
5
+ import type { CompleteHocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket.ts';
6
+ import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.ts';
7
+ import type { ConstructableOutgoingMessage, onAuthenticatedParameters, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onSyncedParameters, onUnsyncedChangesParameters } from './types.ts';
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
  /**
@@ -36,7 +36,7 @@ export interface CompleteHocuspocusProviderConfiguration {
36
36
  * Force syncing the document in the defined interval.
37
37
  */
38
38
  forceSyncInterval: false | number;
39
- onAuthenticated: () => void;
39
+ onAuthenticated: (data: onAuthenticatedParameters) => void;
40
40
  onAuthenticationFailed: (data: onAuthenticationFailedParameters) => void;
41
41
  onOpen: (data: onOpenParameters) => void;
42
42
  onConnect: () => void;
@@ -49,6 +49,7 @@ export interface CompleteHocuspocusProviderConfiguration {
49
49
  onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
50
50
  onAwarenessChange: (data: onAwarenessChangeParameters) => void;
51
51
  onStateless: (data: onStatelessParameters) => void;
52
+ onUnsyncedChanges: (data: onUnsyncedChangesParameters) => void;
52
53
  }
53
54
  export declare class AwarenessError extends Error {
54
55
  code: number;
@@ -60,7 +61,7 @@ export declare class HocuspocusProvider extends EventEmitter {
60
61
  isAuthenticated: boolean;
61
62
  authorizedScope: string | undefined;
62
63
  manageSocket: boolean;
63
- private isAttached;
64
+ private _isAttached;
64
65
  intervals: any;
65
66
  constructor(configuration: HocuspocusProviderConfiguration);
66
67
  boundDocumentUpdateHandler: (update: Uint8Array, origin: any) => void;
@@ -74,6 +75,7 @@ export declare class HocuspocusProvider extends EventEmitter {
74
75
  forwardDestroy: (e: any) => this;
75
76
  setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
76
77
  get document(): Y.Doc;
78
+ get isAttached(): boolean;
77
79
  get awareness(): Awareness | null;
78
80
  get hasUnsyncedChanges(): boolean;
79
81
  private resetUnsyncedChanges;
@@ -94,7 +96,7 @@ export declare class HocuspocusProvider extends EventEmitter {
94
96
  get synced(): boolean;
95
97
  set synced(state: boolean);
96
98
  receiveStateless(payload: string): void;
97
- connect(): Promise<void>;
99
+ connect(): Promise<unknown>;
98
100
  disconnect(): void;
99
101
  onOpen(event: Event): Promise<void>;
100
102
  getToken(): Promise<string | null>;
@@ -1,8 +1,8 @@
1
1
  import type { MessageEvent, Event } from 'ws';
2
- import EventEmitter from './EventEmitter.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';
2
+ import EventEmitter from './EventEmitter.ts';
3
+ import type { HocuspocusProvider } from './HocuspocusProvider.ts';
4
+ import type { onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.ts';
5
+ import { WebSocketStatus } from './types.ts';
6
6
  export type HocusPocusWebSocket = WebSocket & {
7
7
  identifier: string;
8
8
  };
@@ -95,9 +95,7 @@ export declare class HocuspocusProviderWebsocket extends EventEmitter {
95
95
  } | null;
96
96
  constructor(configuration: HocuspocusProviderWebsocketConfiguration);
97
97
  receivedOnOpenPayload?: Event | undefined;
98
- receivedOnStatusPayload?: onStatusParameters | undefined;
99
98
  onOpen(event: Event): Promise<void>;
100
- onStatus(data: onStatusParameters): Promise<void>;
101
99
  attach(provider: HocuspocusProvider): void;
102
100
  detach(provider: HocuspocusProvider): void;
103
101
  setConfiguration(configuration?: Partial<HocuspocusProviderWebsocketConfiguration>): void;
@@ -1,6 +1,6 @@
1
1
  import type { Decoder } from 'lib0/decoding';
2
2
  import type { Encoder } from 'lib0/encoding';
3
- import type { MessageType } from './types.js';
3
+ import type { MessageType } from './types.ts';
4
4
  export declare class IncomingMessage {
5
5
  data: any;
6
6
  encoder: Encoder;
@@ -9,7 +9,7 @@ export declare class IncomingMessage {
9
9
  peekVarString(): string;
10
10
  readVarUint(): MessageType;
11
11
  readVarString(): string;
12
- readVarUint8Array(): Uint8Array;
12
+ readVarUint8Array(): Uint8Array<ArrayBufferLike>;
13
13
  writeVarUint(type: MessageType): void;
14
14
  writeVarString(string: string): void;
15
15
  writeVarUint8Array(data: Uint8Array): void;
@@ -1,5 +1,5 @@
1
- import type { HocuspocusProvider } from './HocuspocusProvider.js';
2
- import type { IncomingMessage } from './IncomingMessage.js';
1
+ import type { HocuspocusProvider } from './HocuspocusProvider.ts';
2
+ import type { IncomingMessage } from './IncomingMessage.ts';
3
3
  export declare class MessageReceiver {
4
4
  message: IncomingMessage;
5
5
  constructor(message: IncomingMessage);
@@ -1,10 +1,10 @@
1
1
  import type { Encoder } from 'lib0/encoding';
2
- import type { ConstructableOutgoingMessage } from './types.js';
2
+ import type { ConstructableOutgoingMessage } from './types.ts';
3
3
  export declare class MessageSender {
4
4
  encoder: Encoder;
5
5
  message: any;
6
6
  constructor(Message: ConstructableOutgoingMessage, args?: any);
7
- create(): Uint8Array;
7
+ create(): Uint8Array<ArrayBufferLike>;
8
8
  send(webSocket: any): void;
9
9
  broadcast(channel: string): void;
10
10
  }
@@ -1,9 +1,9 @@
1
1
  import type { Encoder } from 'lib0/encoding';
2
- import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.js';
2
+ import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.ts';
3
3
  export declare class OutgoingMessage implements OutgoingMessageInterface {
4
4
  encoder: Encoder;
5
5
  type?: MessageType;
6
6
  constructor();
7
7
  get(args: Partial<OutgoingMessageArguments>): Encoder | undefined;
8
- toUint8Array(): Uint8Array;
8
+ toUint8Array(): Uint8Array<ArrayBufferLike>;
9
9
  }
@@ -1,6 +1,6 @@
1
- import type { OutgoingMessageArguments } from '../types.js';
2
- import { MessageType } from '../types.js';
3
- import { OutgoingMessage } from '../OutgoingMessage.js';
1
+ import type { OutgoingMessageArguments } from '../types.ts';
2
+ import { MessageType } from '../types.ts';
3
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
4
4
  export declare class AuthenticationMessage extends OutgoingMessage {
5
5
  type: MessageType;
6
6
  description: string;
@@ -1,7 +1,7 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.js';
3
- import { MessageType } from '../types.js';
4
- import { OutgoingMessage } from '../OutgoingMessage.js';
2
+ import type { OutgoingMessageArguments } from '../types.ts';
3
+ import { MessageType } from '../types.ts';
4
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
5
5
  export declare class AwarenessMessage extends OutgoingMessage {
6
6
  type: MessageType;
7
7
  description: string;
@@ -1,7 +1,7 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.js';
3
- import { MessageType } from '../types.js';
4
- import { OutgoingMessage } from '../OutgoingMessage.js';
2
+ import type { OutgoingMessageArguments } from '../types.ts';
3
+ import { MessageType } from '../types.ts';
4
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
5
5
  export declare class CloseMessage extends OutgoingMessage {
6
6
  type: MessageType;
7
7
  description: string;
@@ -1,7 +1,7 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.js';
3
- import { MessageType } from '../types.js';
4
- import { OutgoingMessage } from '../OutgoingMessage.js';
2
+ import type { OutgoingMessageArguments } from '../types.ts';
3
+ import { MessageType } from '../types.ts';
4
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
5
5
  export declare class QueryAwarenessMessage extends OutgoingMessage {
6
6
  type: MessageType;
7
7
  description: string;
@@ -1,6 +1,6 @@
1
- import type { OutgoingMessageArguments } from '../types.js';
2
- import { MessageType } from '../types.js';
3
- import { OutgoingMessage } from '../OutgoingMessage.js';
1
+ import type { OutgoingMessageArguments } from '../types.ts';
2
+ import { MessageType } from '../types.ts';
3
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
4
4
  export declare class StatelessMessage extends OutgoingMessage {
5
5
  type: MessageType;
6
6
  description: string;
@@ -1,7 +1,7 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.js';
3
- import { MessageType } from '../types.js';
4
- import { OutgoingMessage } from '../OutgoingMessage.js';
2
+ import type { OutgoingMessageArguments } from '../types.ts';
3
+ import { MessageType } from '../types.ts';
4
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
5
5
  export declare class SyncStepOneMessage extends OutgoingMessage {
6
6
  type: MessageType;
7
7
  description: string;
@@ -1,7 +1,7 @@
1
1
  import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.js';
3
- import { MessageType } from '../types.js';
4
- import { OutgoingMessage } from '../OutgoingMessage.js';
2
+ import type { OutgoingMessageArguments } from '../types.ts';
3
+ import { MessageType } from '../types.ts';
4
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
5
5
  export declare class SyncStepTwoMessage extends OutgoingMessage {
6
6
  type: MessageType;
7
7
  description: string;
@@ -1,6 +1,6 @@
1
- import type { OutgoingMessageArguments } from '../types.js';
2
- import { MessageType } from '../types.js';
3
- import { OutgoingMessage } from '../OutgoingMessage.js';
1
+ import type { OutgoingMessageArguments } from '../types.ts';
2
+ import { MessageType } from '../types.ts';
3
+ import { OutgoingMessage } from '../OutgoingMessage.ts';
4
4
  export declare class UpdateMessage extends OutgoingMessage {
5
5
  type: MessageType;
6
6
  description: string;
@@ -1,3 +1,3 @@
1
- export * from './HocuspocusProvider.js';
2
- export * from './HocuspocusProviderWebsocket.js';
3
- export * from './types.js';
1
+ export * from './HocuspocusProvider.ts';
2
+ export * from './HocuspocusProviderWebsocket.ts';
3
+ export * from './types.ts';
@@ -3,14 +3,14 @@ import type { Event, MessageEvent } from 'ws';
3
3
  import type { Awareness } from 'y-protocols/awareness';
4
4
  import type * as Y from 'yjs';
5
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';
6
+ import type { IncomingMessage } from './IncomingMessage.ts';
7
+ import type { OutgoingMessage } from './OutgoingMessage.ts';
8
+ import type { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage.ts';
9
+ import type { AwarenessMessage } from './OutgoingMessages/AwarenessMessage.ts';
10
+ import type { QueryAwarenessMessage } from './OutgoingMessages/QueryAwarenessMessage.ts';
11
+ import type { SyncStepOneMessage } from './OutgoingMessages/SyncStepOneMessage.ts';
12
+ import type { SyncStepTwoMessage } from './OutgoingMessages/SyncStepTwoMessage.ts';
13
+ import type { UpdateMessage } from './OutgoingMessages/UpdateMessage.ts';
14
14
  export declare enum MessageType {
15
15
  Sync = 0,
16
16
  Awareness = 1,
@@ -49,6 +49,9 @@ export type ConstructableOutgoingMessage = Constructable<AuthenticationMessage>
49
49
  export type onAuthenticationFailedParameters = {
50
50
  reason: string;
51
51
  };
52
+ export type onAuthenticatedParameters = {
53
+ scope: 'read-write' | 'readonly';
54
+ };
52
55
  export type onOpenParameters = {
53
56
  event: Event;
54
57
  };
@@ -65,6 +68,9 @@ export type onStatusParameters = {
65
68
  export type onSyncedParameters = {
66
69
  state: boolean;
67
70
  };
71
+ export type onUnsyncedChangesParameters = {
72
+ number: number;
73
+ };
68
74
  export type onDisconnectParameters = {
69
75
  event: CloseEvent;
70
76
  };
@@ -84,103 +90,3 @@ export type StatesArray = {
84
90
  clientId: number;
85
91
  [key: string | number]: any;
86
92
  }[];
87
- export type TCollabThread<Data = any, CommentData = any> = {
88
- id: string;
89
- createdAt: number;
90
- updatedAt: number;
91
- deletedAt: number | null;
92
- resolvedAt?: string;
93
- comments: TCollabComment<CommentData>[];
94
- deletedComments: TCollabComment<CommentData>[];
95
- data: Data;
96
- };
97
- export type TCollabComment<Data = any> = {
98
- id: string;
99
- createdAt: string;
100
- updatedAt: string;
101
- deletedAt?: string;
102
- data: Data;
103
- content: any;
104
- };
105
- export type THistoryVersion = {
106
- name?: string;
107
- version: number;
108
- date: number;
109
- };
110
- export type THistoryConfiguration = {
111
- autoVersioning: boolean;
112
- currentVersion: number;
113
- stateCaptured: number;
114
- };
115
- export type THistoryAction = THistoryDocumentRevertAction | THistoryVersionCreateAction | THistoryVersionPreviewAction;
116
- export type THistoryDocumentRevertAction = {
117
- action: 'document.revert';
118
- /**
119
- * if changes haven't been persisted to a version yet, we'll create one with the specified name,
120
- * expect when `false` is passed.
121
- */
122
- currentVersionName?: string | false;
123
- /**
124
- * Name of the version that is created after the revert. Pass `false` to avoid generating a new version.
125
- */
126
- newVersionName?: string | false;
127
- };
128
- export type THistoryVersionCreateAction = {
129
- action: 'version.create';
130
- name?: string;
131
- };
132
- export type THistoryVersionPreviewAction = {
133
- action: 'version.preview';
134
- version: number;
135
- };
136
- export type THistoryEvent = THistoryVersionPreviewEvent | THistoryVersionCreatedEvent | THistoryDocumentRevertedEvent;
137
- export type THistoryVersionCreatedEvent = {
138
- event: 'version.created';
139
- version: number;
140
- };
141
- export type THistoryVersionPreviewEvent = {
142
- event: 'version.preview';
143
- version: number;
144
- ydoc: string;
145
- };
146
- export type THistoryDocumentRevertedEvent = {
147
- event: 'document.reverted';
148
- version: number;
149
- };
150
- export type DeleteCommentOptions = {
151
- /**
152
- * If `true`, the thread will also be deleted if the deleted comment was the first comment in the thread.
153
- */
154
- deleteThread?: boolean;
155
- /**
156
- * If `true`, will remove the content of the deleted comment
157
- */
158
- deleteContent?: boolean;
159
- };
160
- export type DeleteThreadOptions = {
161
- /**
162
- * If `true`, will remove the comments on the thread,
163
- * otherwise will only mark the thread as deleted
164
- * and keep the comments
165
- * @default false
166
- */
167
- deleteComments?: boolean;
168
- /**
169
- * If `true`, will forcefully remove the thread and all comments,
170
- * otherwise will only mark the thread as deleted
171
- * and keep the comments
172
- * @default false
173
- */
174
- force?: boolean;
175
- };
176
- /**
177
- * The type of thread
178
- */
179
- export type ThreadType = 'archived' | 'unarchived';
180
- export type GetThreadsOptions = {
181
- /**
182
- * The types of threads to get
183
- * @default ['unarchived']
184
- */
185
- types?: Array<ThreadType>;
186
- };
@@ -1,11 +1,9 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type { IncomingMessage } from 'http';
4
2
  import { type CloseEvent } from '@hocuspocus/common';
5
3
  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';
4
+ import type Document from './Document.ts';
5
+ import type { Hocuspocus } from './Hocuspocus.ts';
6
+ import type { onDisconnectPayload } from './types.ts';
9
7
  /**
10
8
  * The `ClientConnection` class is responsible for handling an incoming WebSocket
11
9
  *
@@ -1,15 +1,19 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage as HTTPIncomingMessage } from 'http';
3
- import type WebSocket from 'ws';
4
2
  import { type CloseEvent } from '@hocuspocus/common';
5
- import type Document from './Document.js';
6
- import type { onStatelessPayload } from './types.js';
3
+ import type WebSocket from 'ws';
4
+ import type Document from './Document.ts';
5
+ import type { beforeSyncPayload, onStatelessPayload } from './types.ts';
7
6
  export declare class Connection {
8
7
  webSocket: WebSocket;
9
8
  context: any;
10
9
  document: Document;
11
10
  request: HTTPIncomingMessage;
12
- callbacks: any;
11
+ callbacks: {
12
+ onClose: ((document: Document, event?: CloseEvent) => void)[];
13
+ beforeHandleMessage: (connection: Connection, update: Uint8Array) => Promise<void>;
14
+ beforeSync: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<void>;
15
+ statelessCallback: (payload: onStatelessPayload) => Promise<void>;
16
+ };
13
17
  socketId: string;
14
18
  readOnly: boolean;
15
19
  /**
@@ -28,6 +32,10 @@ export declare class Connection {
28
32
  * Set a callback that will be triggered before an message is handled
29
33
  */
30
34
  beforeHandleMessage(callback: (connection: Connection, update: Uint8Array) => Promise<any>): Connection;
35
+ /**
36
+ * Set a callback that will be triggered before a sync message is handled
37
+ */
38
+ beforeSync(callback: (connection: Connection, payload: Pick<beforeSyncPayload, 'type' | 'payload'>) => Promise<any>): Connection;
31
39
  /**
32
40
  * Send the given message
33
41
  */
@@ -1,6 +1,6 @@
1
- import type Document from './Document.js';
2
- import type { Hocuspocus } from './Hocuspocus.js';
3
- import type { DirectConnection as DirectConnectionInterface } from './types.js';
1
+ import type Document from './Document.ts';
2
+ import type { Hocuspocus } from './Hocuspocus.ts';
3
+ import type { DirectConnection as DirectConnectionInterface } from './types.ts';
4
4
  export declare class DirectConnection implements DirectConnectionInterface {
5
5
  document: Document | null;
6
6
  instance: Hocuspocus;
@@ -1,7 +1,7 @@
1
1
  import type WebSocket from 'ws';
2
2
  import { Awareness } from 'y-protocols/awareness';
3
3
  import { Doc } from 'yjs';
4
- import type Connection from './Connection.js';
4
+ import type Connection from './Connection.ts';
5
5
  export declare class Document extends Doc {
6
6
  awareness: Awareness;
7
7
  callbacks: {
@@ -1,10 +1,9 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage } from 'http';
3
2
  import type WebSocket from 'ws';
4
- import type { Server } from './Server.js';
5
- import { DirectConnection } from './DirectConnection.js';
6
- import Document from './Document.js';
7
- import type { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onStoreDocumentPayload } from './types.js';
3
+ import { DirectConnection } from './DirectConnection.ts';
4
+ import Document from './Document.ts';
5
+ import type { Server } from './Server.ts';
6
+ import type { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onStoreDocumentPayload } from './types.ts';
8
7
  export declare const defaultConfiguration: {
9
8
  name: null;
10
9
  timeout: number;
@@ -1,6 +1,6 @@
1
1
  import type { Decoder } from 'lib0/decoding';
2
2
  import type { Encoder } from 'lib0/encoding';
3
- import type { MessageType } from './types.js';
3
+ import type { MessageType } from './types.ts';
4
4
  export declare class IncomingMessage {
5
5
  /**
6
6
  * Access to the received message.
@@ -14,10 +14,11 @@ export declare class IncomingMessage {
14
14
  private encoderInternal?;
15
15
  constructor(input: any);
16
16
  get encoder(): Encoder;
17
- readVarUint8Array(): Uint8Array;
17
+ readVarUint8Array(): Uint8Array<ArrayBufferLike>;
18
+ peekVarUint8Array(): Uint8Array<ArrayBufferLike>;
18
19
  readVarUint(): number;
19
20
  readVarString(): string;
20
- toUint8Array(): Uint8Array;
21
+ toUint8Array(): Uint8Array<ArrayBufferLike>;
21
22
  writeVarUint(type: MessageType): void;
22
23
  writeVarString(string: string): void;
23
24
  get length(): number;
@@ -1,11 +1,11 @@
1
- import type Connection from './Connection.js';
2
- import type Document from './Document.js';
3
- import type { IncomingMessage } from './IncomingMessage.js';
1
+ import type Connection from './Connection.ts';
2
+ import type Document from './Document.ts';
3
+ import type { IncomingMessage } from './IncomingMessage.ts';
4
4
  export declare class MessageReceiver {
5
5
  message: IncomingMessage;
6
6
  defaultTransactionOrigin?: string;
7
7
  constructor(message: IncomingMessage, defaultTransactionOrigin?: string);
8
- apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
9
- readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 1 | 2;
8
+ apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): Promise<void>;
9
+ readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): Promise<0 | 1 | 2>;
10
10
  applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
11
11
  }
@@ -1,6 +1,6 @@
1
1
  import type { Encoder } from 'lib0/encoding';
2
2
  import type { Awareness } from 'y-protocols/awareness';
3
- import type Document from './Document.js';
3
+ import type Document from './Document.ts';
4
4
  export declare class OutgoingMessage {
5
5
  encoder: Encoder;
6
6
  type?: number;
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
3
2
  import { WebSocketServer } from 'ws';
4
3
  import type { AddressInfo, ServerOptions } from 'ws';
5
- import { Hocuspocus } from './Hocuspocus.js';
4
+ import { Hocuspocus } from './Hocuspocus.ts';
6
5
  import type { Configuration } from './types';
7
6
  export interface ServerConfiguration extends Configuration {
8
7
  port?: number;
@@ -1,9 +1,9 @@
1
- export * from './Connection.js';
2
- export * from './Document.js';
3
- export * from './Hocuspocus.js';
4
- export * from './IncomingMessage.js';
5
- export * from './MessageReceiver.js';
6
- export * from './OutgoingMessage.js';
7
- export * from './Server.js';
8
- export * from './types.js';
9
- export * from './util/debounce.js';
1
+ export * from './Connection.ts';
2
+ export * from './Document.ts';
3
+ export * from './Hocuspocus.ts';
4
+ export * from './IncomingMessage.ts';
5
+ export * from './MessageReceiver.ts';
6
+ export * from './OutgoingMessage.ts';
7
+ export * from './Server.ts';
8
+ export * from './types.ts';
9
+ export * from './util/debounce.ts';
@@ -1,20 +1,16 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
1
  import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
6
2
  import type { URLSearchParams } from 'url';
7
3
  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';
4
+ import type Connection from './Connection.ts';
5
+ import type Document from './Document.ts';
6
+ import type { Hocuspocus } from './Hocuspocus.ts';
11
7
  export declare enum MessageType {
12
8
  Unknown = -1,
13
9
  Sync = 0,
14
10
  Awareness = 1,
15
11
  Auth = 2,
16
12
  QueryAwareness = 3,
17
- SyncReply = 4,
13
+ SyncReply = 4,// same as Sync, but won't trigger another 'SyncStep1'
18
14
  Stateless = 5,
19
15
  BroadcastStateless = 6,
20
16
  CLOSE = 7,
@@ -42,6 +38,7 @@ export interface Extension {
42
38
  onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
43
39
  afterLoadDocument?(data: afterLoadDocumentPayload): Promise<any>;
44
40
  beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>;
41
+ beforeSync?(data: beforeSyncPayload): Promise<any>;
45
42
  beforeBroadcastStateless?(data: beforeBroadcastStatelessPayload): Promise<any>;
46
43
  onStateless?(payload: onStatelessPayload): Promise<any>;
47
44
  onChange?(data: onChangePayload): Promise<any>;
@@ -54,7 +51,7 @@ export interface Extension {
54
51
  afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>;
55
52
  onDestroy?(data: onDestroyPayload): Promise<any>;
56
53
  }
57
- export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'beforeUnloadDocument' | 'afterUnloadDocument' | 'onDestroy';
54
+ export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'beforeSync' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'beforeUnloadDocument' | 'afterUnloadDocument' | 'onDestroy';
58
55
  export type HookPayloadByName = {
59
56
  onConfigure: onConfigurePayload;
60
57
  onListen: onListenPayload;
@@ -67,6 +64,7 @@ export type HookPayloadByName = {
67
64
  afterLoadDocument: afterLoadDocumentPayload;
68
65
  beforeHandleMessage: beforeHandleMessagePayload;
69
66
  beforeBroadcastStateless: beforeBroadcastStatelessPayload;
67
+ beforeSync: beforeSyncPayload;
70
68
  onStateless: onStatelessPayload;
71
69
  onChange: onChangePayload;
72
70
  onStoreDocument: onStoreDocumentPayload;
@@ -211,6 +209,27 @@ export interface beforeHandleMessagePayload {
211
209
  socketId: string;
212
210
  connection: Connection;
213
211
  }
212
+ export interface beforeSyncPayload {
213
+ clientsCount: number;
214
+ context: any;
215
+ document: Document;
216
+ documentName: string;
217
+ connection: Connection;
218
+ /**
219
+ * The y-protocols/sync message type
220
+ * @example
221
+ * 0: SyncStep1
222
+ * 1: SyncStep2
223
+ * 2: YjsUpdate
224
+ *
225
+ * @see https://github.com/yjs/y-protocols/blob/master/sync.js#L13-L40
226
+ */
227
+ type: number;
228
+ /**
229
+ * The payload of the y-sync message.
230
+ */
231
+ payload: Uint8Array;
232
+ }
214
233
  export interface beforeBroadcastStatelessPayload {
215
234
  document: Document;
216
235
  documentName: string;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type { IncomingMessage } from 'http';
4
2
  import { URLSearchParams } from 'url';
5
3
  /**
@@ -1,6 +1,6 @@
1
1
  import { Doc } from 'yjs';
2
2
  import { Schema } from '@tiptap/pm/model';
3
- import type { Transformer } from './types.js';
3
+ import type { Transformer } from './types.ts';
4
4
  declare class Prosemirror implements Transformer {
5
5
  defaultSchema: Schema;
6
6
  schema(schema: Schema): Prosemirror;
@@ -1,6 +1,6 @@
1
1
  import type { Doc } from 'yjs';
2
2
  import type { Extensions } from '@tiptap/core';
3
- import type { Transformer } from './types.js';
3
+ import type { Transformer } from './types.ts';
4
4
  export declare class Tiptap implements Transformer {
5
5
  defaultExtensions: Extensions;
6
6
  extensions(extensions: Extensions): Tiptap;
@@ -1,3 +1,3 @@
1
- export * from './Prosemirror.js';
2
- export * from './Tiptap.js';
3
- export * from './types.js';
1
+ export * from './Prosemirror.ts';
2
+ export * from './Tiptap.ts';
3
+ export * from './types.ts';
@@ -0,0 +1,2 @@
1
+ import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
2
+ export declare const SocketContext: import("react").Context<HocuspocusProviderWebsocket | null>;
@@ -0,0 +1,3 @@
1
+ import type { NextConfig } from "next";
2
+ declare const nextConfig: NextConfig;
3
+ export default nextConfig;
@@ -1,9 +1,9 @@
1
- export * from './createDirectory.js';
2
- export * from './flushRedis.js';
3
- export * from './newHocuspocus.js';
4
- export * from './newHocuspocusProvider.js';
5
- export * from './newHocuspocusProviderWebsocket.js';
6
- export * from './randomInteger.js';
7
- export * from './redisConnectionSettings.js';
8
- export * from './removeDirectory.js';
9
- export * from './sleep.js';
1
+ export * from './createDirectory.ts';
2
+ export * from './flushRedis.ts';
3
+ export * from './newHocuspocus.ts';
4
+ export * from './newHocuspocusProvider.ts';
5
+ export * from './newHocuspocusProviderWebsocket.ts';
6
+ export * from './randomInteger.ts';
7
+ export * from './redisConnectionSettings.ts';
8
+ export * from './removeDirectory.ts';
9
+ export * from './sleep.ts';
@@ -1,4 +1,4 @@
1
1
  import type { HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
2
2
  import { HocuspocusProviderWebsocket } from '@hocuspocus/provider';
3
3
  import type { Hocuspocus } from '@hocuspocus/server';
4
- export declare const newHocuspocusProviderWebsocket: (hocuspocus: Hocuspocus, options?: Partial<Omit<HocuspocusProviderWebsocketConfiguration, 'url'>>) => HocuspocusProviderWebsocket;
4
+ export declare const newHocuspocusProviderWebsocket: (hocuspocus: Hocuspocus, options?: Partial<Omit<HocuspocusProviderWebsocketConfiguration, "url">>) => HocuspocusProviderWebsocket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-webhook",
3
- "version": "3.0.4-rc.0",
3
+ "version": "3.0.7-rc.0",
4
4
  "description": "hocuspocus webhook extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  "types": "dist/packages/extension-webhook/src/index.d.ts",
18
18
  "exports": {
19
19
  "source": {
20
- "import": "./src"
20
+ "import": "./src/index.ts"
21
21
  },
22
22
  "default": {
23
23
  "import": "./dist/hocuspocus-webhook.esm.js",
@@ -30,9 +30,9 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@hocuspocus/common": "^3.0.4-rc.0",
34
- "@hocuspocus/server": "^3.0.4-rc.0",
35
- "@hocuspocus/transformer": "^3.0.4-rc.0",
33
+ "@hocuspocus/common": "^3.0.7-rc.0",
34
+ "@hocuspocus/server": "^3.0.7-rc.0",
35
+ "@hocuspocus/transformer": "^3.0.7-rc.0",
36
36
  "axios": "^1.6.2"
37
37
  },
38
38
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;