@hocuspocus/extension-logger 1.0.0-alpha.76 → 1.0.0-alpha.79

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.
@@ -1,6 +1,6 @@
1
1
  import RedisClient from 'ioredis';
2
2
  import Redlock from 'redlock';
3
- import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
3
+ import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
4
4
  export interface Configuration {
5
5
  /**
6
6
  * Redis port
@@ -75,13 +75,17 @@ export declare class Redis implements Extension {
75
75
  /**
76
76
  * Handle awareness update messages received directly by this Hocuspocus instance.
77
77
  */
78
- onAwarenessUpdate({ documentName, awareness }: onAwarenessUpdatePayload): Promise<number>;
78
+ onAwarenessUpdate({ documentName, awareness, added, updated, removed, }: onAwarenessUpdatePayload): Promise<number>;
79
79
  /**
80
80
  * Handle incoming messages published on all subscribed document channels.
81
81
  * Note that this will also include messages from ourselves as it is not possible
82
82
  * in Redis to filter these.
83
83
  */
84
84
  private handleIncomingMessage;
85
+ /**
86
+ * if the ydoc changed, we'll need to inform other Hocuspocus servers about it.
87
+ */
88
+ onChange(data: onChangePayload): Promise<any>;
85
89
  /**
86
90
  * Make sure to *not* listen for further changes, when there’s
87
91
  * noone connected anymore.
@@ -110,6 +110,7 @@ export declare class HocuspocusProvider extends EventEmitter {
110
110
  shouldConnect: boolean;
111
111
  status: WebSocketStatus;
112
112
  isSynced: boolean;
113
+ unsyncedChanges: number;
113
114
  isAuthenticated: boolean;
114
115
  lastMessageReceived: number;
115
116
  mux: mutex.mutex;
@@ -120,6 +121,7 @@ export declare class HocuspocusProvider extends EventEmitter {
120
121
  } | null;
121
122
  constructor(configuration: HocuspocusProviderConfiguration);
122
123
  setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
124
+ boundConnect: () => Promise<void>;
123
125
  connect(): Promise<void>;
124
126
  createWebSocketConnection(): Promise<unknown>;
125
127
  resolveConnectionAttempt(): void;
@@ -127,8 +129,11 @@ export declare class HocuspocusProvider extends EventEmitter {
127
129
  rejectConnectionAttempt(): void;
128
130
  get document(): Y.Doc;
129
131
  get awareness(): Awareness;
132
+ get hasUnsyncedChanges(): boolean;
130
133
  checkConnection(): void;
131
134
  forceSync(): void;
135
+ boundBeforeUnload: () => void;
136
+ beforeUnload(): void;
132
137
  registerEventListeners(): void;
133
138
  documentUpdateHandler(update: Uint8Array, origin: any): void;
134
139
  awarenessUpdateHandler({ added, updated, removed }: any, origin: any): void;
@@ -148,6 +153,7 @@ export declare class HocuspocusProvider extends EventEmitter {
148
153
  onClose(event: CloseEvent): void;
149
154
  destroy(): void;
150
155
  get broadcastChannel(): string;
156
+ boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;
151
157
  broadcastChannelSubscriber(data: ArrayBuffer): void;
152
158
  subscribeToBroadcastChannel(): void;
153
159
  disconnectBroadcastChannel(): void;
@@ -16,10 +16,11 @@ export declare class Document extends Doc {
16
16
  name: string;
17
17
  mux: mutex;
18
18
  logger: Debugger;
19
+ isLoading: boolean;
19
20
  /**
20
21
  * Constructor.
21
22
  */
22
- constructor(name: string, logger: Debugger);
23
+ constructor(name: string, logger: Debugger, yDocOptions: {});
23
24
  /**
24
25
  * Check if the Document is empty
25
26
  */
@@ -12,6 +12,10 @@ export declare const defaultConfiguration: {
12
12
  debounce: number;
13
13
  maxDebounce: number;
14
14
  quiet: boolean;
15
+ yDocOptions: {
16
+ gc: boolean;
17
+ gcFilter: () => boolean;
18
+ };
15
19
  };
16
20
  /**
17
21
  * Hocuspocus Server
@@ -8,6 +8,6 @@ export declare class MessageReceiver {
8
8
  logger: Debugger;
9
9
  constructor(message: IncomingMessage, logger: Debugger);
10
10
  apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
11
- readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 | 2 | 1;
11
+ readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 2 | 1;
12
12
  applyQueryAwarenessMessage(awareness: Awareness, reply?: (message: Uint8Array) => void): void;
13
13
  }
@@ -7,6 +7,7 @@ export declare class OutgoingMessage {
7
7
  category?: string;
8
8
  constructor();
9
9
  createSyncMessage(): OutgoingMessage;
10
+ createSyncReplyMessage(): OutgoingMessage;
10
11
  createAwarenessUpdateMessage(awareness: Awareness, changedClients?: Array<any>): OutgoingMessage;
11
12
  writeQueryAwareness(): OutgoingMessage;
12
13
  writeAuthenticated(): OutgoingMessage;
@@ -9,7 +9,8 @@ export declare enum MessageType {
9
9
  Sync = 0,
10
10
  Awareness = 1,
11
11
  Auth = 2,
12
- QueryAwareness = 3
12
+ QueryAwareness = 3,
13
+ SyncReply = 4
13
14
  }
14
15
  export interface AwarenessUpdate {
15
16
  added: Array<any>;
@@ -79,6 +80,13 @@ export interface Configuration extends Extension {
79
80
  * By default, the servers show a start screen. If passed false, the server will start quietly.
80
81
  */
81
82
  quiet: boolean;
83
+ /**
84
+ * options to pass to the ydoc document
85
+ */
86
+ yDocOptions: {
87
+ gc: boolean;
88
+ gcFilter: () => boolean;
89
+ };
82
90
  /**
83
91
  * Function which returns the (customized) document name based on the request
84
92
  */
@@ -0,0 +1,2 @@
1
+ import { ExecutionContext } from 'ava';
2
+ export declare const retryableAssertion: (t: ExecutionContext, recoverableTry: (tt: ExecutionContext) => void) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-logger",
3
- "version": "1.0.0-alpha.76",
3
+ "version": "1.0.0-alpha.79",
4
4
  "description": "hocuspocus logging extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@hocuspocus/server": "^1.0.0-alpha.102"
31
+ "@hocuspocus/server": "^1.0.0-alpha.105"
32
32
  },
33
- "gitHead": "450e12c89b027bc62683f151330a98074cd8e8fb"
33
+ "gitHead": "6865794352a68372a54c579040513e45aac422d1"
34
34
  }
@@ -1,22 +0,0 @@
1
- import { Extension, onLoadDocumentPayload } from '@hocuspocus/server';
2
- import { LeveldbPersistence } from 'y-leveldb';
3
- export interface Configuration {
4
- options: object | undefined;
5
- path: string;
6
- }
7
- export declare class RocksDB implements Extension {
8
- configuration: Configuration;
9
- provider: LeveldbPersistence;
10
- /**
11
- * Constructor
12
- */
13
- constructor(configuration?: Partial<Configuration>);
14
- /**
15
- * onLoadDocument hook
16
- */
17
- onLoadDocument(data: onLoadDocumentPayload): Promise<any>;
18
- /**
19
- * store updates in y-leveldb persistence
20
- */
21
- store(documentName: string, update: Uint8Array): Promise<any>;
22
- }
@@ -1 +0,0 @@
1
- export {};