@hocuspocus/extension-logger 3.0.4-rc.0 → 3.0.6-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 (50) hide show
  1. package/dist/hocuspocus-logger.cjs.map +1 -1
  2. package/dist/hocuspocus-logger.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 +4 -4
  13. package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +4 -4
  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 +8 -8
  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 +3 -3
  48. package/src/index.ts +1 -1
  49. package/dist/playground/frontend/vite.config.d.ts +0 -2
  50. /package/dist/{playground/frontend/src/main.d.ts → tests/server/beforeSync.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-logger.cjs","sources":["../src/Logger.ts"],"sourcesContent":["import type {\n Extension,\n onChangePayload,\n onConfigurePayload,\n onConnectPayload,\n onLoadDocumentPayload,\n onDestroyPayload,\n onDisconnectPayload,\n onRequestPayload,\n onUpgradePayload,\n} from '@hocuspocus/server'\n\nexport interface LoggerConfiguration {\n /**\n * Prepend all logging message with a string.\n *\n * @deprecated\n */\n prefix: null | string,\n /**\n * Whether to log something for the `onLoadDocument` hook.\n */\n onLoadDocument: boolean,\n /**\n * Whether to log something for the `onChange` hook.\n */\n onChange: boolean,\n /**\n * Whether to log something for the `onStoreDocument` hook.\n */\n onStoreDocument: boolean,\n /**\n * Whether to log something for the `onConnect` hook.\n */\n onConnect: boolean,\n /**\n * Whether to log something for the `onDisconnect` hook.\n */\n onDisconnect: boolean,\n /**\n * Whether to log something for the `onUpgrade` hook.\n */\n onUpgrade: boolean,\n /**\n * Whether to log something for the `onRequest` hook.\n */\n onRequest: boolean,\n /**\n * Whether to log something for the `onDestroy` hook.\n */\n onDestroy: boolean,\n /**\n * Whether to log something for the `onConfigure` hook.\n */\n onConfigure: boolean,\n /**\n * A log function, if none is provided output will go to console\n */\n log: (...args: any[]) => void,\n}\n\nexport class Logger implements Extension {\n name: string | null = null\n\n configuration: LoggerConfiguration = {\n prefix: null,\n onLoadDocument: true,\n onChange: true,\n onStoreDocument: true,\n onConnect: true,\n onDisconnect: true,\n onUpgrade: true,\n onRequest: true,\n onDestroy: true,\n onConfigure: true,\n log: console.log, // eslint-disable-line\n }\n\n /**\n * Constructor\n */\n constructor(configuration?: Partial<LoggerConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n async onConfigure(data: onConfigurePayload) {\n this.name = data.instance.configuration.name\n\n if (!this.configuration.onConfigure) {\n return\n }\n\n if (this.configuration.prefix) {\n console.warn('[hocuspocus warn] The Logger \\'prefix\\' is deprecated. Pass a \\'name\\' to the Hocuspocus configuration instead.')\n }\n }\n\n async onLoadDocument(data: onLoadDocumentPayload) {\n if (this.configuration.onLoadDocument) {\n this.log(`Loaded document \"${data.documentName}\".`)\n }\n }\n\n async onChange(data: onChangePayload) {\n if (this.configuration.onChange) {\n this.log(`Document \"${data.documentName}\" changed.`)\n }\n }\n\n async onStoreDocument(data: onDisconnectPayload) {\n if (this.configuration.onStoreDocument) {\n this.log(`Store \"${data.documentName}\".`)\n }\n }\n\n async onConnect(data: onConnectPayload) {\n if (this.configuration.onConnect) {\n this.log(`New connection to \"${data.documentName}\".`)\n }\n }\n\n async onDisconnect(data: onDisconnectPayload) {\n if (this.configuration.onDisconnect) {\n this.log(`Connection to \"${data.documentName}\" closed.`)\n }\n }\n\n async onUpgrade(data: onUpgradePayload) {\n if (this.configuration.onUpgrade) {\n this.log('Upgrading connection …')\n }\n }\n\n async onRequest(data: onRequestPayload) {\n if (this.configuration.onRequest) {\n this.log(`Incoming HTTP Request to ${data.request.url}`)\n }\n }\n\n async onDestroy(data: onDestroyPayload) {\n if (this.configuration.onDestroy) {\n this.log('Shut down.')\n }\n }\n\n private log(message: string) {\n const date = (new Date()).toISOString()\n let meta = `${date}`\n\n if (this.name) {\n meta = `${this.name} ${meta}`\n }\n\n message = `[${meta}] ${message}`\n\n this.configuration.log(message)\n }\n}\n"],"names":[],"mappings":";;MA6Da,MAAM,CAAA;AAiBjB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA4C,EAAA;QAnBxD,IAAI,CAAA,IAAA,GAAkB,IAAI;AAE1B,QAAA,IAAA,CAAA,aAAa,GAAwB;AACnC,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,cAAc,EAAE,IAAI;AACpB,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,eAAe,EAAE,IAAI;AACrB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB;QAMC,IAAI,CAAC,aAAa,GAAG;YACnB,GAAG,IAAI,CAAC,aAAa;AACrB,YAAA,GAAG,aAAa;SACjB;;IAGH,MAAM,WAAW,CAAC,IAAwB,EAAA;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI;AAE5C,QAAA,IAAI,CAAC,IAAI,CAAC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figurePayload,\n onConnectPayload,\n onLoadDocumentPayload,\n onDestroyPayload,\n onDisconnectPayload,\n onRequestPayload,\n onUpgradePayload,\n} from '@hocuspocus/server'\n\nexport interface LoggerConfiguration {\n /**\n * Prepend all logging message with a string.\n *\n * @deprecated\n */\n prefix: null | string,\n /**\n * Whether to log something for the `onLoadDocument` hook.\n */\n onLoadDocument: boolean,\n /**\n * Whether to log something for the `onChange` hook.\n */\n onChange: boolean,\n /**\n * Whether to log something for the `onStoreDocument` hook.\n */\n onStoreDocument: boolean,\n /**\n * Whether to log something for the `onConnect` hook.\n */\n onConnect: boolean,\n /**\n * Whether to log something for the `onDisconnect` hook.\n */\n onDisconnect: boolean,\n /**\n * Whether to log something for the `onUpgrade` hook.\n */\n onUpgrade: boolean,\n /**\n * Whether to log something for the `onRequest` hook.\n */\n onRequest: boolean,\n /**\n * Whether to log something for the `onDestroy` hook.\n */\n onDestroy: boolean,\n /**\n * Whether to log something for the `onConfigure` hook.\n */\n onConfigure: boolean,\n /**\n * A log function, if none is provided output will go to console\n */\n log: (...args: any[]) => void,\n}\n\nexport class Logger implements Extension {\n name: string | null = null\n\n configuration: LoggerConfiguration = {\n prefix: null,\n onLoadDocument: true,\n onChange: true,\n onStoreDocument: true,\n onConnect: true,\n onDisconnect: true,\n onUpgrade: true,\n onRequest: true,\n onDestroy: true,\n onConfigure: true,\n log: console.log, // eslint-disable-line\n }\n\n /**\n * Constructor\n */\n constructor(configuration?: Partial<LoggerConfiguration>) {\n this.configuration = {\n ...this.configuration,\n ...configuration,\n }\n }\n\n async onConfigure(data: onConfigurePayload) {\n this.name = data.instance.configuration.name\n\n if (!this.configuration.onConfigure) {\n return\n }\n\n if (this.configuration.prefix) {\n console.warn('[hocuspocus warn] The Logger \\'prefix\\' is deprecated. Pass a \\'name\\' to the Hocuspocus configuration instead.')\n }\n }\n\n async onLoadDocument(data: onLoadDocumentPayload) {\n if (this.configuration.onLoadDocument) {\n this.log(`Loaded document \"${data.documentName}\".`)\n }\n }\n\n async onChange(data: onChangePayload) {\n if (this.configuration.onChange) {\n this.log(`Document \"${data.documentName}\" changed.`)\n }\n }\n\n async onStoreDocument(data: onDisconnectPayload) {\n if (this.configuration.onStoreDocument) {\n this.log(`Store \"${data.documentName}\".`)\n }\n }\n\n async onConnect(data: onConnectPayload) {\n if (this.configuration.onConnect) {\n this.log(`New connection to \"${data.documentName}\".`)\n }\n }\n\n async onDisconnect(data: onDisconnectPayload) {\n if (this.configuration.onDisconnect) {\n this.log(`Connection to \"${data.documentName}\" closed.`)\n }\n }\n\n async onUpgrade(data: onUpgradePayload) {\n if (this.configuration.onUpgrade) {\n this.log('Upgrading connection …')\n }\n }\n\n async onRequest(data: onRequestPayload) {\n if (this.configuration.onRequest) {\n this.log(`Incoming HTTP Request to ${data.request.url}`)\n }\n }\n\n async onDestroy(data: onDestroyPayload) {\n if (this.configuration.onDestroy) {\n this.log('Shut down.')\n }\n }\n\n private log(message: string) {\n const date = (new Date()).toISOString()\n let meta = `${date}`\n\n if (this.name) {\n meta = `${this.name} ${meta}`\n }\n\n message = `[${meta}] ${message}`\n\n this.configuration.log(message)\n }\n}\n"],"names":[],"mappings":"MA6Da,MAAM,CAAA;AAiBjB;;AAEG;AACH,IAAA,WAAA,CAAY,aAA4C,EAAA;QAnBxD,IAAI,CAAA,IAAA,GAAkB,IAAI;AAE1B,QAAA,IAAA,CAAA,aAAa,GAAwB;AACnC,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,cAAc,EAAE,IAAI;AACpB,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,eAAe,EAAE,IAAI;AACrB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB;QAMC,IAAI,CAAC,a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AA,IAAI,CAAK,EAAA,EAAA,OAAO,EAAE;AAEhC,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;;AAElC;;;;"}
@@ -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, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onSyncedParameters } 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
  /**
@@ -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
  };
@@ -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,
@@ -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-logger",
3
- "version": "3.0.4-rc.0",
3
+ "version": "3.0.6-rc.0",
4
4
  "description": "hocuspocus logging extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -16,7 +16,7 @@
16
16
  "types": "dist/packages/extension-logger/src/index.d.ts",
17
17
  "exports": {
18
18
  "source": {
19
- "import": "./src"
19
+ "import": "./src/index.ts"
20
20
  },
21
21
  "default": {
22
22
  "import": "./dist/hocuspocus-logger.esm.js",
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@hocuspocus/server": "^3.0.4-rc.0"
32
+ "@hocuspocus/server": "^3.0.6-rc.0"
33
33
  },
34
34
  "gitHead": "b3454a4ca289a84ddfb7fa5607a2d4b8d5c37e9d"
35
35
  }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './Logger.js'
1
+ export * from './Logger.ts'
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;