@hocuspocus/extension-logger 3.1.3 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/hocuspocus-logger.cjs +4 -4
  2. package/dist/hocuspocus-logger.cjs.map +1 -1
  3. package/dist/hocuspocus-logger.esm.js +4 -4
  4. package/dist/hocuspocus-logger.esm.js.map +1 -1
  5. package/dist/packages/common/src/auth.d.ts +2 -2
  6. package/dist/packages/common/src/index.d.ts +4 -4
  7. package/dist/packages/extension-database/src/Database.d.ts +1 -1
  8. package/dist/packages/extension-database/src/index.d.ts +1 -1
  9. package/dist/packages/extension-logger/src/Logger.d.ts +1 -1
  10. package/dist/packages/extension-logger/src/index.d.ts +1 -1
  11. package/dist/packages/extension-redis/src/index.d.ts +1 -1
  12. package/dist/packages/extension-sqlite/src/SQLite.d.ts +3 -3
  13. package/dist/packages/extension-sqlite/src/index.d.ts +1 -1
  14. package/dist/packages/extension-throttle/src/index.d.ts +1 -1
  15. package/dist/packages/extension-webhook/src/index.d.ts +3 -3
  16. package/dist/packages/provider/src/HocuspocusProvider.d.ts +10 -10
  17. package/dist/packages/provider/src/IncomingMessage.d.ts +3 -3
  18. package/dist/packages/provider/src/MessageReceiver.d.ts +2 -2
  19. package/dist/packages/provider/src/OutgoingMessage.d.ts +2 -2
  20. package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +3 -3
  21. package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +4 -4
  22. package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +4 -4
  23. package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +4 -4
  24. package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +3 -3
  25. package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +4 -4
  26. package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +4 -4
  27. package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +3 -3
  28. package/dist/packages/provider/src/index.d.ts +3 -3
  29. package/dist/packages/provider/src/types.d.ts +14 -14
  30. package/dist/packages/server/src/ClientConnection.d.ts +17 -17
  31. package/dist/packages/server/src/Connection.d.ts +6 -6
  32. package/dist/packages/server/src/DirectConnection.d.ts +3 -3
  33. package/dist/packages/server/src/Document.d.ts +4 -4
  34. package/dist/packages/server/src/Hocuspocus.d.ts +8 -8
  35. package/dist/packages/server/src/IncomingMessage.d.ts +3 -3
  36. package/dist/packages/server/src/MessageReceiver.d.ts +3 -3
  37. package/dist/packages/server/src/OutgoingMessage.d.ts +3 -3
  38. package/dist/packages/server/src/Server.d.ts +5 -5
  39. package/dist/packages/server/src/index.d.ts +9 -9
  40. package/dist/packages/server/src/types.d.ts +7 -7
  41. package/dist/packages/server/src/util/getParameters.d.ts +5 -5
  42. package/dist/packages/transformer/src/Prosemirror.d.ts +3 -3
  43. package/dist/packages/transformer/src/Tiptap.d.ts +3 -3
  44. package/dist/packages/transformer/src/index.d.ts +3 -3
  45. package/dist/packages/transformer/src/types.d.ts +1 -1
  46. package/dist/playground/frontend/app/SocketContext1.d.ts +2 -0
  47. package/dist/playground/frontend/app/SocketContext2.d.ts +2 -0
  48. package/package.json +33 -33
  49. package/src/Logger.ts +156 -154
  50. package/src/index.ts +1 -1
  51. package/dist/playground/frontend/app/SocketContext.d.ts +0 -2
@@ -30,7 +30,7 @@ class Logger {
30
30
  return;
31
31
  }
32
32
  if (this.configuration.prefix) {
33
- console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
33
+ console.warn("[hocuspocus warn] The Logger 'prefix' is deprecated. Pass a 'name' to the Hocuspocus configuration instead.");
34
34
  }
35
35
  }
36
36
  async onLoadDocument(data) {
@@ -60,7 +60,7 @@ class Logger {
60
60
  }
61
61
  async onUpgrade(data) {
62
62
  if (this.configuration.onUpgrade) {
63
- this.log('Upgrading connection …');
63
+ this.log("Upgrading connection …");
64
64
  }
65
65
  }
66
66
  async onRequest(data) {
@@ -70,11 +70,11 @@ class Logger {
70
70
  }
71
71
  async onDestroy(data) {
72
72
  if (this.configuration.onDestroy) {
73
- this.log('Shut down.');
73
+ this.log("Shut down.");
74
74
  }
75
75
  }
76
76
  log(message) {
77
- const date = (new Date()).toISOString();
77
+ const date = new Date().toISOString();
78
78
  let meta = `${date}`;
79
79
  if (this.name) {
80
80
  meta = `${this.name} ${meta}`;
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-logger.cjs","sources":["../src/Logger.ts"],"sourcesContent":[null],"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,aAAa,CAAC,WAAW,EAAE;YACnC;;AAGF,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;AAC7B,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AAI,CAAC,GAAG,CAAC,CAAA,eAAA,EAAkB,IAAI,CAAC,YAAY,CAAW,SAAA,CAAA,CAAC;;;IAI1D,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;AACjC,YAAA,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;;;IAIpC,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;YACjC,IAAI,CAAC,GAAG,CAAC,CAA4B,yBAAA,EAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAE,CAAA,CAAC;;;IAI1D,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;AACjC,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;;;AAIhB,IAAA,GAAG,CAAC,OAAe,EAAA;QAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACrC,QAAA,IAAI,IAAI,GAAG,CAAG,EAAA,IAAI,EAAE;AAEpB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,EAAE;;AAG9B,QAAA,OAAO,GAAG,CAAI,CAAA,EAAA,IAAI,CAAK,EAAA,EAAA,OAAO,EAAE;AAEhC,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;;AAEhC;;;;"}
@@ -28,7 +28,7 @@ class Logger {
28
28
  return;
29
29
  }
30
30
  if (this.configuration.prefix) {
31
- console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
31
+ console.warn("[hocuspocus warn] The Logger 'prefix' is deprecated. Pass a 'name' to the Hocuspocus configuration instead.");
32
32
  }
33
33
  }
34
34
  async onLoadDocument(data) {
@@ -58,7 +58,7 @@ class Logger {
58
58
  }
59
59
  async onUpgrade(data) {
60
60
  if (this.configuration.onUpgrade) {
61
- this.log('Upgrading connection …');
61
+ this.log("Upgrading connection …");
62
62
  }
63
63
  }
64
64
  async onRequest(data) {
@@ -68,11 +68,11 @@ class Logger {
68
68
  }
69
69
  async onDestroy(data) {
70
70
  if (this.configuration.onDestroy) {
71
- this.log('Shut down.');
71
+ this.log("Shut down.");
72
72
  }
73
73
  }
74
74
  log(message) {
75
- const date = (new Date()).toISOString();
75
+ const date = new Date().toISOString();
76
76
  let meta = `${date}`;
77
77
  if (this.name) {
78
78
  meta = `${this.name} ${meta}`;
@@ -1 +1 @@
1
- {"version":3,"file":"hocuspocus-logger.esm.js","sources":["../src/Logger.ts"],"sourcesContent":[null],"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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C;;;IAIvD,MAAM,YAAY,CAAC,IAAyB,EAAA;AAC3C,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;YACpC,IAAI,CAAC,GAAG,CAAC,CAAA,eAAA,EAAkB,IAAI,CAAC,YAAY,CAAW,SAAA,CAAA,CAAC;;;IAI1D,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;AACjC,YAAA,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;;;IAIpC,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;YACjC,IAAI,CAAC,GAAG,CAAC,CAA4B,yBAAA,EAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAE,CAAA,CAAC;;;IAI1D,MAAM,SAAS,CAAC,IAAsB,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;AACjC,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;;;AAIhB,IAAA,GAAG,CAAC,OAAe,EAAA;QAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACrC,QAAA,IAAI,IAAI,GAAG,CAAG,EAAA,IAAI,EAAE;AAEpB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,EAAE;;AAG9B,QAAA,OAAO,GAAG,CAAI,CAAA,EAAA,IAAI,CAAK,EAAA,EAAA,OAAO,EAAE;AAEhC,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;;AAEhC;;;;"}
@@ -1,5 +1,5 @@
1
- import * as encoding from 'lib0/encoding';
2
- import * as decoding from 'lib0/decoding';
1
+ import * as encoding from "lib0/encoding";
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
5
  export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: "readonly" | "read-write") => void;
@@ -1,4 +1,4 @@
1
- export * from './auth.ts';
2
- export * from './CloseEvents.ts';
3
- export * from './awarenessStatesToArray.ts';
4
- export * from './types.ts';
1
+ export * from "./auth.ts";
2
+ export * from "./CloseEvents.ts";
3
+ export * from "./awarenessStatesToArray.ts";
4
+ export * from "./types.ts";
@@ -1,4 +1,4 @@
1
- import type { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
1
+ import type { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from "@hocuspocus/server";
2
2
  export interface DatabaseConfiguration {
3
3
  /**
4
4
  * Pass a Promise to retrieve updates from your database. The Promise should resolve to
@@ -1 +1 @@
1
- export * from './Database.ts';
1
+ export * from "./Database.ts";
@@ -1,4 +1,4 @@
1
- import type { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from '@hocuspocus/server';
1
+ import type { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from "@hocuspocus/server";
2
2
  export interface LoggerConfiguration {
3
3
  /**
4
4
  * Prepend all logging message with a string.
@@ -1 +1 @@
1
- export * from './Logger.ts';
1
+ export * from "./Logger.ts";
@@ -1 +1 @@
1
- export * from './Redis.ts';
1
+ export * from "./Redis.ts";
@@ -1,6 +1,6 @@
1
- import type { DatabaseConfiguration } from '@hocuspocus/extension-database';
2
- import { Database } from '@hocuspocus/extension-database';
3
- import sqlite3 from 'sqlite3';
1
+ import type { DatabaseConfiguration } from "@hocuspocus/extension-database";
2
+ import { Database } from "@hocuspocus/extension-database";
3
+ import sqlite3 from "sqlite3";
4
4
  export declare const schema = "CREATE TABLE IF NOT EXISTS \"documents\" (\n \"name\" varchar(255) NOT NULL,\n \"data\" blob NOT NULL,\n UNIQUE(name)\n)";
5
5
  export declare const selectQuery = "\n SELECT data FROM \"documents\" WHERE name = $name ORDER BY rowid DESC\n";
6
6
  export declare const upsertQuery = "\n INSERT INTO \"documents\" (\"name\", \"data\") VALUES ($name, $data)\n ON CONFLICT(name) DO UPDATE SET data = $data\n";
@@ -1 +1 @@
1
- export * from './SQLite.ts';
1
+ export * from "./SQLite.ts";
@@ -1,4 +1,4 @@
1
- import type { Extension, onConnectPayload } from '@hocuspocus/server';
1
+ import type { Extension, onConnectPayload } from "@hocuspocus/server";
2
2
  export interface ThrottleConfiguration {
3
3
  throttle: number | null | false;
4
4
  consideredSeconds: number;
@@ -1,6 +1,6 @@
1
- import type { Extension, onChangePayload, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from '@hocuspocus/server';
2
- import type { Doc } from 'yjs';
3
- import type { Transformer } from '@hocuspocus/transformer';
1
+ import type { Extension, onChangePayload, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from "@hocuspocus/server";
2
+ import type { Doc } from "yjs";
3
+ import type { Transformer } from "@hocuspocus/transformer";
4
4
  export declare enum Events {
5
5
  onChange = "change",
6
6
  onConnect = "connect",
@@ -1,15 +1,15 @@
1
- import type { Event, MessageEvent } from 'ws';
2
- import { Awareness } from 'y-protocols/awareness';
3
- import * as Y from 'yjs';
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
- export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name'>> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> | Required<Pick<CompleteHocuspocusProviderConfiguration, 'websocketProvider'>>);
1
+ import type { Event, MessageEvent } from "ws";
2
+ import { Awareness } from "y-protocols/awareness";
3
+ import * as Y from "yjs";
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
+ export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, "name">> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "url">> | Required<Pick<CompleteHocuspocusProviderConfiguration, "websocketProvider">>);
9
9
  export interface CompleteHocuspocusProviderConfiguration {
10
10
  /**
11
- * The identifier/name of your document
12
- */
11
+ * The identifier/name of your document
12
+ */
13
13
  name: string;
14
14
  /**
15
15
  * The actual Y.js document
@@ -1,6 +1,6 @@
1
- import type { Decoder } from 'lib0/decoding';
2
- import type { Encoder } from 'lib0/encoding';
3
- import type { MessageType } from './types.ts';
1
+ import type { Decoder } from "lib0/decoding";
2
+ import type { Encoder } from "lib0/encoding";
3
+ import type { MessageType } from "./types.ts";
4
4
  export declare class IncomingMessage {
5
5
  data: any;
6
6
  encoder: Encoder;
@@ -1,5 +1,5 @@
1
- import type { HocuspocusProvider } from './HocuspocusProvider.ts';
2
- import type { IncomingMessage } from './IncomingMessage.ts';
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,5 +1,5 @@
1
- import type { Encoder } from 'lib0/encoding';
2
- import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.ts';
1
+ import type { Encoder } from "lib0/encoding";
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;
@@ -1,6 +1,6 @@
1
- import type { OutgoingMessageArguments } from '../types.ts';
2
- import { MessageType } from '../types.ts';
3
- import { OutgoingMessage } from '../OutgoingMessage.ts';
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
- import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.ts';
3
- import { MessageType } from '../types.ts';
4
- import { OutgoingMessage } from '../OutgoingMessage.ts';
1
+ import * as encoding from "lib0/encoding";
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
- import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.ts';
3
- import { MessageType } from '../types.ts';
4
- import { OutgoingMessage } from '../OutgoingMessage.ts';
1
+ import * as encoding from "lib0/encoding";
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
- import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.ts';
3
- import { MessageType } from '../types.ts';
4
- import { OutgoingMessage } from '../OutgoingMessage.ts';
1
+ import * as encoding from "lib0/encoding";
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.ts';
2
- import { MessageType } from '../types.ts';
3
- import { OutgoingMessage } from '../OutgoingMessage.ts';
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
- import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.ts';
3
- import { MessageType } from '../types.ts';
4
- import { OutgoingMessage } from '../OutgoingMessage.ts';
1
+ import * as encoding from "lib0/encoding";
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
- import * as encoding from 'lib0/encoding';
2
- import type { OutgoingMessageArguments } from '../types.ts';
3
- import { MessageType } from '../types.ts';
4
- import { OutgoingMessage } from '../OutgoingMessage.ts';
1
+ import * as encoding from "lib0/encoding";
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.ts';
2
- import { MessageType } from '../types.ts';
3
- import { OutgoingMessage } from '../OutgoingMessage.ts';
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.ts';
2
- export * from './HocuspocusProviderWebsocket.ts';
3
- export * from './types.ts';
1
+ export * from "./HocuspocusProvider.ts";
2
+ export * from "./HocuspocusProviderWebsocket.ts";
3
+ export * from "./types.ts";
@@ -1,16 +1,16 @@
1
- import type { Encoder } from 'lib0/encoding';
2
- import type { Event, MessageEvent } from 'ws';
3
- import type { Awareness } from 'y-protocols/awareness';
4
- import type * as Y from 'yjs';
5
- import type { CloseEvent } from '@hocuspocus/common';
6
- import type { IncomingMessage } from './IncomingMessage.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';
1
+ import type { Encoder } from "lib0/encoding";
2
+ import type { Event, MessageEvent } from "ws";
3
+ import type { Awareness } from "y-protocols/awareness";
4
+ import type * as Y from "yjs";
5
+ import type { CloseEvent } from "@hocuspocus/common";
6
+ import type { IncomingMessage } from "./IncomingMessage.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,
@@ -50,7 +50,7 @@ export type onAuthenticationFailedParameters = {
50
50
  reason: string;
51
51
  };
52
52
  export type onAuthenticatedParameters = {
53
- scope: 'read-write' | 'readonly';
53
+ scope: "read-write" | "readonly";
54
54
  };
55
55
  export type onOpenParameters = {
56
56
  event: Event;
@@ -1,9 +1,9 @@
1
- import type { IncomingMessage } from 'http';
2
- import { type CloseEvent } from '@hocuspocus/common';
3
- import type WebSocket from 'ws';
4
- import type Document from './Document.ts';
5
- import type { Hocuspocus } from './Hocuspocus.ts';
6
- import type { onDisconnectPayload } from './types.ts';
1
+ import type { IncomingMessage } from "http";
2
+ import { type CloseEvent } from "@hocuspocus/common";
3
+ import type WebSocket from "ws";
4
+ import type Document from "./Document.ts";
5
+ import type { Hocuspocus } from "./Hocuspocus.ts";
6
+ import type { onDisconnectPayload } from "./types.ts";
7
7
  /**
8
8
  * The `ClientConnection` class is responsible for handling an incoming WebSocket
9
9
  *
@@ -27,18 +27,18 @@ export declare class ClientConnection {
27
27
  pingInterval: NodeJS.Timeout;
28
28
  pongReceived: boolean;
29
29
  /**
30
- * The `ClientConnection` class receives incoming WebSocket connections,
31
- * runs all hooks:
32
- *
33
- * - onConnect for all connections
34
- * - onAuthenticate only if required
35
- *
36
- * … and if nothings fails it’ll fully establish the connection and
37
- * load the Document then.
38
- */
30
+ * The `ClientConnection` class receives incoming WebSocket connections,
31
+ * runs all hooks:
32
+ *
33
+ * - onConnect for all connections
34
+ * - onAuthenticate only if required
35
+ *
36
+ * … and if nothings fails it’ll fully establish the connection and
37
+ * load the Document then.
38
+ */
39
39
  constructor(websocket: WebSocket, request: IncomingMessage, documentProvider: {
40
- createDocument: Hocuspocus['createDocument'];
41
- }, hooks: Hocuspocus['hooks'], opts: {
40
+ createDocument: Hocuspocus["createDocument"];
41
+ }, hooks: Hocuspocus["hooks"], opts: {
42
42
  timeout: number;
43
43
  }, defaultContext?: any);
44
44
  private handleWebsocketClose;
@@ -1,8 +1,8 @@
1
- import type { IncomingMessage as HTTPIncomingMessage } from 'http';
2
- import { type CloseEvent } from '@hocuspocus/common';
3
- import type WebSocket from 'ws';
4
- import type Document from './Document.ts';
5
- import type { beforeSyncPayload, onStatelessPayload } from './types.ts';
1
+ import type { IncomingMessage as HTTPIncomingMessage } from "http";
2
+ import { type CloseEvent } from "@hocuspocus/common";
3
+ import type WebSocket from "ws";
4
+ import type Document from "./Document.ts";
5
+ import type { beforeSyncPayload, onStatelessPayload } from "./types.ts";
6
6
  export declare class Connection {
7
7
  webSocket: WebSocket;
8
8
  context: any;
@@ -35,7 +35,7 @@ export declare class Connection {
35
35
  /**
36
36
  * Set a callback that will be triggered before a sync message is handled
37
37
  */
38
- beforeSync(callback: (connection: Connection, payload: Pick<beforeSyncPayload, 'type' | 'payload'>) => Promise<any>): Connection;
38
+ beforeSync(callback: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<any>): Connection;
39
39
  /**
40
40
  * Send the given message
41
41
  */
@@ -1,6 +1,6 @@
1
- import type Document from './Document.ts';
2
- import type { Hocuspocus } from './Hocuspocus.ts';
3
- import type { DirectConnection as DirectConnectionInterface } from './types.ts';
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
- import type WebSocket from 'ws';
2
- import { Awareness } from 'y-protocols/awareness';
3
- import { Doc } from 'yjs';
4
- import type Connection from './Connection.ts';
1
+ import type WebSocket from "ws";
2
+ import { Awareness } from "y-protocols/awareness";
3
+ import { Doc } from "yjs";
4
+ import type Connection from "./Connection.ts";
5
5
  export declare class Document extends Doc {
6
6
  awareness: Awareness;
7
7
  callbacks: {
@@ -1,9 +1,9 @@
1
- import type { IncomingMessage } from 'http';
2
- import type WebSocket from 'ws';
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';
1
+ import type { IncomingMessage } from "http";
2
+ import type WebSocket from "ws";
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";
7
7
  export declare const defaultConfiguration: {
8
8
  name: null;
9
9
  timeout: number;
@@ -64,8 +64,8 @@ export declare class Hocuspocus {
64
64
  /**
65
65
  * Create a new document by the given request
66
66
  */
67
- createDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
68
- loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>;
67
+ createDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
68
+ loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>;
69
69
  storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): any;
70
70
  /**
71
71
  * Run the given hook on all configured extensions.
@@ -1,6 +1,6 @@
1
- import type { Decoder } from 'lib0/decoding';
2
- import type { Encoder } from 'lib0/encoding';
3
- import type { MessageType } from './types.ts';
1
+ import type { Decoder } from "lib0/decoding";
2
+ import type { Encoder } from "lib0/encoding";
3
+ import type { MessageType } from "./types.ts";
4
4
  export declare class IncomingMessage {
5
5
  /**
6
6
  * Access to the received message.
@@ -1,6 +1,6 @@
1
- import type Connection from './Connection.ts';
2
- import type Document from './Document.ts';
3
- import type { IncomingMessage } from './IncomingMessage.ts';
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;
@@ -1,6 +1,6 @@
1
- import type { Encoder } from 'lib0/encoding';
2
- import type { Awareness } from 'y-protocols/awareness';
3
- import type Document from './Document.ts';
1
+ import type { Encoder } from "lib0/encoding";
2
+ import type { Awareness } from "y-protocols/awareness";
3
+ import type Document from "./Document.ts";
4
4
  export declare class OutgoingMessage {
5
5
  encoder: Encoder;
6
6
  type?: number;
@@ -1,8 +1,8 @@
1
- import type { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
2
- import { WebSocketServer } from 'ws';
3
- import type { AddressInfo, ServerOptions } from 'ws';
4
- import { Hocuspocus } from './Hocuspocus.ts';
5
- import type { Configuration } from './types.ts';
1
+ import type { Server as HTTPServer, IncomingMessage, ServerResponse } from "http";
2
+ import { WebSocketServer } from "ws";
3
+ import type { AddressInfo, ServerOptions } from "ws";
4
+ import { Hocuspocus } from "./Hocuspocus.ts";
5
+ import type { Configuration } from "./types.ts";
6
6
  export interface ServerConfiguration extends Configuration {
7
7
  port?: number;
8
8
  address?: string;
@@ -1,9 +1,9 @@
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
+ 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,9 +1,9 @@
1
- import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
2
- import type { URLSearchParams } from 'url';
3
- import type { Awareness } from 'y-protocols/awareness';
4
- import type Connection from './Connection.ts';
5
- import type Document from './Document.ts';
6
- import type { Hocuspocus } from './Hocuspocus.ts';
1
+ import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "http";
2
+ import type { URLSearchParams } from "url";
3
+ import type { Awareness } from "y-protocols/awareness";
4
+ import type Connection from "./Connection.ts";
5
+ import type Document from "./Document.ts";
6
+ import type { Hocuspocus } from "./Hocuspocus.ts";
7
7
  export declare enum MessageType {
8
8
  Unknown = -1,
9
9
  Sync = 0,
@@ -51,7 +51,7 @@ export interface Extension {
51
51
  afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>;
52
52
  onDestroy?(data: onDestroyPayload): Promise<any>;
53
53
  }
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';
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";
55
55
  export type HookPayloadByName = {
56
56
  onConfigure: onConfigurePayload;
57
57
  onListen: onListenPayload;
@@ -1,6 +1,6 @@
1
- import type { IncomingMessage } from 'http';
2
- import { URLSearchParams } from 'url';
1
+ import type { IncomingMessage } from "http";
2
+ import { URLSearchParams } from "url";
3
3
  /**
4
- * Get parameters by the given request
5
- */
6
- export declare function getParameters(request?: Pick<IncomingMessage, 'url'>): URLSearchParams;
4
+ * Get parameters by the given request
5
+ */
6
+ export declare function getParameters(request?: Pick<IncomingMessage, "url">): URLSearchParams;
@@ -1,6 +1,6 @@
1
- import { Doc } from 'yjs';
2
- import { Schema } from '@tiptap/pm/model';
3
- import type { Transformer } from './types.ts';
1
+ import { Doc } from "yjs";
2
+ import { Schema } from "@tiptap/pm/model";
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
- import type { Doc } from 'yjs';
2
- import type { Extensions } from '@tiptap/core';
3
- import type { Transformer } from './types.ts';
1
+ import type { Doc } from "yjs";
2
+ import type { Extensions } from "@tiptap/core";
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.ts';
2
- export * from './Tiptap.ts';
3
- export * from './types.ts';
1
+ export * from "./Prosemirror.ts";
2
+ export * from "./Tiptap.ts";
3
+ export * from "./types.ts";
@@ -1,4 +1,4 @@
1
- import type { Doc } from 'yjs';
1
+ import type { Doc } from "yjs";
2
2
  export interface Transformer {
3
3
  fromYdoc: (document: Doc, fieldName?: string | Array<string>) => any;
4
4
  toYdoc: (document: any, fieldName: string) => Doc;
@@ -0,0 +1,2 @@
1
+ import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
2
+ export declare const SocketContext1: import("react").Context<HocuspocusProviderWebsocket | null>;
@@ -0,0 +1,2 @@
1
+ import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
2
+ export declare const SocketContext2: import("react").Context<HocuspocusProviderWebsocket | null>;
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
- "name": "@hocuspocus/extension-logger",
3
- "version": "3.1.3",
4
- "description": "hocuspocus logging extension",
5
- "homepage": "https://hocuspocus.dev",
6
- "keywords": [
7
- "hocuspocus",
8
- "logging",
9
- "logger",
10
- "yjs"
11
- ],
12
- "license": "MIT",
13
- "type": "module",
14
- "main": "dist/hocuspocus-logger.cjs",
15
- "module": "dist/hocuspocus-logger.esm.js",
16
- "types": "dist/packages/extension-logger/src/index.d.ts",
17
- "exports": {
18
- "source": {
19
- "import": "./src/index.ts"
20
- },
21
- "default": {
22
- "import": "./dist/hocuspocus-logger.esm.js",
23
- "require": "./dist/hocuspocus-logger.cjs",
24
- "types": "./dist/packages/extension-logger/src/index.d.ts"
25
- }
26
- },
27
- "files": [
28
- "src",
29
- "dist"
30
- ],
31
- "dependencies": {
32
- "@hocuspocus/server": "^3.1.3"
33
- },
34
- "gitHead": "b3454a4ca289a84ddfb7fa5607a2d4b8d5c37e9d"
2
+ "name": "@hocuspocus/extension-logger",
3
+ "version": "3.1.4",
4
+ "description": "hocuspocus logging extension",
5
+ "homepage": "https://hocuspocus.dev",
6
+ "keywords": [
7
+ "hocuspocus",
8
+ "logging",
9
+ "logger",
10
+ "yjs"
11
+ ],
12
+ "license": "MIT",
13
+ "type": "module",
14
+ "main": "dist/hocuspocus-logger.cjs",
15
+ "module": "dist/hocuspocus-logger.esm.js",
16
+ "types": "dist/packages/extension-logger/src/index.d.ts",
17
+ "exports": {
18
+ "source": {
19
+ "import": "./src/index.ts"
20
+ },
21
+ "default": {
22
+ "import": "./dist/hocuspocus-logger.esm.js",
23
+ "require": "./dist/hocuspocus-logger.cjs",
24
+ "types": "./dist/packages/extension-logger/src/index.d.ts"
25
+ }
26
+ },
27
+ "files": [
28
+ "src",
29
+ "dist"
30
+ ],
31
+ "dependencies": {
32
+ "@hocuspocus/server": "^3.1.4"
33
+ },
34
+ "gitHead": "b3454a4ca289a84ddfb7fa5607a2d4b8d5c37e9d"
35
35
  }
package/src/Logger.ts CHANGED
@@ -1,161 +1,163 @@
1
1
  import type {
2
- Extension,
3
- onChangePayload,
4
- onConfigurePayload,
5
- onConnectPayload,
6
- onLoadDocumentPayload,
7
- onDestroyPayload,
8
- onDisconnectPayload,
9
- onRequestPayload,
10
- onUpgradePayload,
11
- } from '@hocuspocus/server'
2
+ Extension,
3
+ onChangePayload,
4
+ onConfigurePayload,
5
+ onConnectPayload,
6
+ onLoadDocumentPayload,
7
+ onDestroyPayload,
8
+ onDisconnectPayload,
9
+ onRequestPayload,
10
+ onUpgradePayload,
11
+ } from "@hocuspocus/server";
12
12
 
13
13
  export interface LoggerConfiguration {
14
- /**
15
- * Prepend all logging message with a string.
16
- *
17
- * @deprecated
18
- */
19
- prefix: null | string,
20
- /**
21
- * Whether to log something for the `onLoadDocument` hook.
22
- */
23
- onLoadDocument: boolean,
24
- /**
25
- * Whether to log something for the `onChange` hook.
26
- */
27
- onChange: boolean,
28
- /**
29
- * Whether to log something for the `onStoreDocument` hook.
30
- */
31
- onStoreDocument: boolean,
32
- /**
33
- * Whether to log something for the `onConnect` hook.
34
- */
35
- onConnect: boolean,
36
- /**
37
- * Whether to log something for the `onDisconnect` hook.
38
- */
39
- onDisconnect: boolean,
40
- /**
41
- * Whether to log something for the `onUpgrade` hook.
42
- */
43
- onUpgrade: boolean,
44
- /**
45
- * Whether to log something for the `onRequest` hook.
46
- */
47
- onRequest: boolean,
48
- /**
49
- * Whether to log something for the `onDestroy` hook.
50
- */
51
- onDestroy: boolean,
52
- /**
53
- * Whether to log something for the `onConfigure` hook.
54
- */
55
- onConfigure: boolean,
56
- /**
57
- * A log function, if none is provided output will go to console
58
- */
59
- log: (...args: any[]) => void,
14
+ /**
15
+ * Prepend all logging message with a string.
16
+ *
17
+ * @deprecated
18
+ */
19
+ prefix: null | string;
20
+ /**
21
+ * Whether to log something for the `onLoadDocument` hook.
22
+ */
23
+ onLoadDocument: boolean;
24
+ /**
25
+ * Whether to log something for the `onChange` hook.
26
+ */
27
+ onChange: boolean;
28
+ /**
29
+ * Whether to log something for the `onStoreDocument` hook.
30
+ */
31
+ onStoreDocument: boolean;
32
+ /**
33
+ * Whether to log something for the `onConnect` hook.
34
+ */
35
+ onConnect: boolean;
36
+ /**
37
+ * Whether to log something for the `onDisconnect` hook.
38
+ */
39
+ onDisconnect: boolean;
40
+ /**
41
+ * Whether to log something for the `onUpgrade` hook.
42
+ */
43
+ onUpgrade: boolean;
44
+ /**
45
+ * Whether to log something for the `onRequest` hook.
46
+ */
47
+ onRequest: boolean;
48
+ /**
49
+ * Whether to log something for the `onDestroy` hook.
50
+ */
51
+ onDestroy: boolean;
52
+ /**
53
+ * Whether to log something for the `onConfigure` hook.
54
+ */
55
+ onConfigure: boolean;
56
+ /**
57
+ * A log function, if none is provided output will go to console
58
+ */
59
+ log: (...args: any[]) => void;
60
60
  }
61
61
 
62
62
  export class Logger implements Extension {
63
- name: string | null = null
64
-
65
- configuration: LoggerConfiguration = {
66
- prefix: null,
67
- onLoadDocument: true,
68
- onChange: true,
69
- onStoreDocument: true,
70
- onConnect: true,
71
- onDisconnect: true,
72
- onUpgrade: true,
73
- onRequest: true,
74
- onDestroy: true,
75
- onConfigure: true,
76
- log: console.log, // eslint-disable-line
77
- }
78
-
79
- /**
80
- * Constructor
81
- */
82
- constructor(configuration?: Partial<LoggerConfiguration>) {
83
- this.configuration = {
84
- ...this.configuration,
85
- ...configuration,
86
- }
87
- }
88
-
89
- async onConfigure(data: onConfigurePayload) {
90
- this.name = data.instance.configuration.name
91
-
92
- if (!this.configuration.onConfigure) {
93
- return
94
- }
95
-
96
- if (this.configuration.prefix) {
97
- console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.')
98
- }
99
- }
100
-
101
- async onLoadDocument(data: onLoadDocumentPayload) {
102
- if (this.configuration.onLoadDocument) {
103
- this.log(`Loaded document "${data.documentName}".`)
104
- }
105
- }
106
-
107
- async onChange(data: onChangePayload) {
108
- if (this.configuration.onChange) {
109
- this.log(`Document "${data.documentName}" changed.`)
110
- }
111
- }
112
-
113
- async onStoreDocument(data: onDisconnectPayload) {
114
- if (this.configuration.onStoreDocument) {
115
- this.log(`Store "${data.documentName}".`)
116
- }
117
- }
118
-
119
- async onConnect(data: onConnectPayload) {
120
- if (this.configuration.onConnect) {
121
- this.log(`New connection to "${data.documentName}".`)
122
- }
123
- }
124
-
125
- async onDisconnect(data: onDisconnectPayload) {
126
- if (this.configuration.onDisconnect) {
127
- this.log(`Connection to "${data.documentName}" closed.`)
128
- }
129
- }
130
-
131
- async onUpgrade(data: onUpgradePayload) {
132
- if (this.configuration.onUpgrade) {
133
- this.log('Upgrading connection …')
134
- }
135
- }
136
-
137
- async onRequest(data: onRequestPayload) {
138
- if (this.configuration.onRequest) {
139
- this.log(`Incoming HTTP Request to ${data.request.url}`)
140
- }
141
- }
142
-
143
- async onDestroy(data: onDestroyPayload) {
144
- if (this.configuration.onDestroy) {
145
- this.log('Shut down.')
146
- }
147
- }
148
-
149
- private log(message: string) {
150
- const date = (new Date()).toISOString()
151
- let meta = `${date}`
152
-
153
- if (this.name) {
154
- meta = `${this.name} ${meta}`
155
- }
156
-
157
- message = `[${meta}] ${message}`
158
-
159
- this.configuration.log(message)
160
- }
63
+ name: string | null = null;
64
+
65
+ configuration: LoggerConfiguration = {
66
+ prefix: null,
67
+ onLoadDocument: true,
68
+ onChange: true,
69
+ onStoreDocument: true,
70
+ onConnect: true,
71
+ onDisconnect: true,
72
+ onUpgrade: true,
73
+ onRequest: true,
74
+ onDestroy: true,
75
+ onConfigure: true,
76
+ log: console.log, // eslint-disable-line
77
+ };
78
+
79
+ /**
80
+ * Constructor
81
+ */
82
+ constructor(configuration?: Partial<LoggerConfiguration>) {
83
+ this.configuration = {
84
+ ...this.configuration,
85
+ ...configuration,
86
+ };
87
+ }
88
+
89
+ async onConfigure(data: onConfigurePayload) {
90
+ this.name = data.instance.configuration.name;
91
+
92
+ if (!this.configuration.onConfigure) {
93
+ return;
94
+ }
95
+
96
+ if (this.configuration.prefix) {
97
+ console.warn(
98
+ "[hocuspocus warn] The Logger 'prefix' is deprecated. Pass a 'name' to the Hocuspocus configuration instead.",
99
+ );
100
+ }
101
+ }
102
+
103
+ async onLoadDocument(data: onLoadDocumentPayload) {
104
+ if (this.configuration.onLoadDocument) {
105
+ this.log(`Loaded document "${data.documentName}".`);
106
+ }
107
+ }
108
+
109
+ async onChange(data: onChangePayload) {
110
+ if (this.configuration.onChange) {
111
+ this.log(`Document "${data.documentName}" changed.`);
112
+ }
113
+ }
114
+
115
+ async onStoreDocument(data: onDisconnectPayload) {
116
+ if (this.configuration.onStoreDocument) {
117
+ this.log(`Store "${data.documentName}".`);
118
+ }
119
+ }
120
+
121
+ async onConnect(data: onConnectPayload) {
122
+ if (this.configuration.onConnect) {
123
+ this.log(`New connection to "${data.documentName}".`);
124
+ }
125
+ }
126
+
127
+ async onDisconnect(data: onDisconnectPayload) {
128
+ if (this.configuration.onDisconnect) {
129
+ this.log(`Connection to "${data.documentName}" closed.`);
130
+ }
131
+ }
132
+
133
+ async onUpgrade(data: onUpgradePayload) {
134
+ if (this.configuration.onUpgrade) {
135
+ this.log("Upgrading connection …");
136
+ }
137
+ }
138
+
139
+ async onRequest(data: onRequestPayload) {
140
+ if (this.configuration.onRequest) {
141
+ this.log(`Incoming HTTP Request to ${data.request.url}`);
142
+ }
143
+ }
144
+
145
+ async onDestroy(data: onDestroyPayload) {
146
+ if (this.configuration.onDestroy) {
147
+ this.log("Shut down.");
148
+ }
149
+ }
150
+
151
+ private log(message: string) {
152
+ const date = new Date().toISOString();
153
+ let meta = `${date}`;
154
+
155
+ if (this.name) {
156
+ meta = `${this.name} ${meta}`;
157
+ }
158
+
159
+ message = `[${meta}] ${message}`;
160
+
161
+ this.configuration.log(message);
162
+ }
161
163
  }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './Logger.ts'
1
+ export * from "./Logger.ts";
@@ -1,2 +0,0 @@
1
- import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
2
- export declare const SocketContext: import("react").Context<HocuspocusProviderWebsocket | null>;