@hocuspocus/extension-sqlite 3.3.2 → 3.4.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.
- package/dist/packages/server/src/Connection.d.ts +3 -3
- package/dist/packages/server/src/Document.d.ts +2 -1
- package/dist/packages/server/src/Hocuspocus.d.ts +4 -2
- package/dist/packages/server/src/MessageReceiver.d.ts +2 -2
- package/dist/packages/server/src/util/debounce.d.ts +2 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import type { IncomingMessage as HTTPIncomingMessage } from "node:http";
|
|
|
2
2
|
import { type CloseEvent } from "@hocuspocus/common";
|
|
3
3
|
import type WebSocket from "ws";
|
|
4
4
|
import type Document from "./Document.ts";
|
|
5
|
-
import type { beforeSyncPayload,
|
|
5
|
+
import type { beforeSyncPayload, onStatelessPayload, onTokenSyncPayload } from "./types.ts";
|
|
6
6
|
export declare class Connection {
|
|
7
7
|
webSocket: WebSocket;
|
|
8
8
|
context: any;
|
|
@@ -38,8 +38,8 @@ export declare class Connection {
|
|
|
38
38
|
*/
|
|
39
39
|
beforeSync(callback: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<any>): Connection;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* Set a callback that will be triggered when on token sync message is received
|
|
42
|
+
*/
|
|
43
43
|
onTokenSyncCallback(callback: (payload: onTokenSyncPayload) => Promise<void>): Connection;
|
|
44
44
|
/**
|
|
45
45
|
* Send the given message
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Mutex } from "async-mutex";
|
|
1
2
|
import type WebSocket from "ws";
|
|
2
3
|
import { Awareness } from "y-protocols/awareness";
|
|
3
4
|
import { Doc } from "yjs";
|
|
4
5
|
import type Connection from "./Connection.ts";
|
|
5
|
-
import { Mutex } from "async-mutex";
|
|
6
6
|
export declare class Document extends Doc {
|
|
7
7
|
awareness: Awareness;
|
|
8
8
|
callbacks: {
|
|
@@ -18,6 +18,7 @@ export declare class Document extends Doc {
|
|
|
18
18
|
isLoading: boolean;
|
|
19
19
|
isDestroyed: boolean;
|
|
20
20
|
saveMutex: Mutex;
|
|
21
|
+
lastChangeTime: number;
|
|
21
22
|
/**
|
|
22
23
|
* Constructor.
|
|
23
24
|
*/
|
|
@@ -23,8 +23,9 @@ export declare class Hocuspocus {
|
|
|
23
23
|
documents: Map<string, Document>;
|
|
24
24
|
server?: Server;
|
|
25
25
|
debouncer: {
|
|
26
|
-
debounce: (id: string, func:
|
|
26
|
+
debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>;
|
|
27
27
|
isDebounced: (id: string) => boolean;
|
|
28
|
+
isCurrentlyExecuting: (id: string) => boolean;
|
|
28
29
|
executeNow: (id: string) => any;
|
|
29
30
|
};
|
|
30
31
|
constructor(configuration?: Partial<Configuration>);
|
|
@@ -67,12 +68,13 @@ export declare class Hocuspocus {
|
|
|
67
68
|
*/
|
|
68
69
|
createDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
|
|
69
70
|
loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>;
|
|
70
|
-
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): any
|
|
71
|
+
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): Promise<any>;
|
|
71
72
|
/**
|
|
72
73
|
* Run the given hook on all configured extensions.
|
|
73
74
|
* Runs the given callback after each hook.
|
|
74
75
|
*/
|
|
75
76
|
hooks<T extends HookName>(name: T, payload: HookPayloadByName[T], callback?: Function | null): Promise<any>;
|
|
77
|
+
shouldUnloadDocument(document: Document): boolean;
|
|
76
78
|
unloadDocument(document: Document): Promise<any>;
|
|
77
79
|
openDirectConnection(documentName: string, context?: any): Promise<DirectConnection>;
|
|
78
80
|
}
|
|
@@ -5,7 +5,7 @@ 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):
|
|
9
|
-
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean):
|
|
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;
|
|
10
10
|
applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
|
|
11
11
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const useDebounce: () => {
|
|
2
|
-
debounce: (id: string, func:
|
|
2
|
+
debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>;
|
|
3
3
|
isDebounced: (id: string) => boolean;
|
|
4
|
+
isCurrentlyExecuting: (id: string) => boolean;
|
|
4
5
|
executeNow: (id: string) => any;
|
|
5
6
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-sqlite",
|
|
3
3
|
"description": "a generic Hocuspocus persistence driver for the sqlite",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"hocuspocus",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hocuspocus/extension-database": "^3.
|
|
30
|
+
"@hocuspocus/extension-database": "^3.4.0",
|
|
31
31
|
"kleur": "^4.1.4",
|
|
32
32
|
"sqlite3": "^5.1.7"
|
|
33
33
|
},
|