@hocuspocus/common
Advanced tools
@@ -5,3 +5,3 @@ import type { IncomingMessage as HTTPIncomingMessage } from "node:http"; | ||
| import type Document from "./Document.ts"; | ||
| import type { beforeSyncPayload, onTokenSyncPayload, onStatelessPayload } from "./types.ts"; | ||
| import type { beforeSyncPayload, onStatelessPayload, onTokenSyncPayload } from "./types.ts"; | ||
| export declare class Connection { | ||
@@ -42,4 +42,4 @@ webSocket: WebSocket; | ||
| /** | ||
| * Set a callback that will be triggered when on token sync message is received | ||
| */ | ||
| * Set a callback that will be triggered when on token sync message is received | ||
| */ | ||
| onTokenSyncCallback(callback: (payload: onTokenSyncPayload) => Promise<void>): Connection; | ||
@@ -46,0 +46,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
| import { Mutex } from "async-mutex"; | ||
| import type WebSocket from "ws"; | ||
@@ -5,3 +6,2 @@ import { Awareness } from "y-protocols/awareness"; | ||
| import type Connection from "./Connection.ts"; | ||
| import { Mutex } from "async-mutex"; | ||
| export declare class Document extends Doc { | ||
@@ -22,2 +22,3 @@ awareness: Awareness; | ||
| saveMutex: Mutex; | ||
| lastChangeTime: number; | ||
| /** | ||
@@ -24,0 +25,0 @@ * Constructor. |
@@ -26,4 +26,5 @@ import type { IncomingMessage } from "node:http"; | ||
| debouncer: { | ||
| debounce: (id: string, func: Function, debounce: number, maxDebounce: number) => any; | ||
| debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>; | ||
| isDebounced: (id: string) => boolean; | ||
| isCurrentlyExecuting: (id: string) => boolean; | ||
| executeNow: (id: string) => any; | ||
@@ -71,3 +72,3 @@ }; | ||
| loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>; | ||
| storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): any; | ||
| storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): Promise<any>; | ||
| /** | ||
@@ -78,4 +79,5 @@ * Run the given hook on all configured extensions. | ||
| hooks<T extends HookName>(name: T, payload: HookPayloadByName[T], callback?: Function | null): Promise<any>; | ||
| shouldUnloadDocument(document: Document): boolean; | ||
| unloadDocument(document: Document): Promise<any>; | ||
| openDirectConnection(documentName: string, context?: any): Promise<DirectConnection>; | ||
| } |
@@ -8,5 +8,5 @@ import type Connection from "./Connection.ts"; | ||
| constructor(message: IncomingMessage, defaultTransactionOrigin?: string); | ||
| apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): Promise<void>; | ||
| readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): Promise<0 | 1 | 2>; | ||
| apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void; | ||
| readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 1 | 2; | ||
| applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void; | ||
| } |
| export declare const useDebounce: () => { | ||
| debounce: (id: string, func: Function, debounce: number, maxDebounce: number) => any; | ||
| debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>; | ||
| isDebounced: (id: string) => boolean; | ||
| isCurrentlyExecuting: (id: string) => boolean; | ||
| executeNow: (id: string) => any; | ||
| }; |
+1
-1
| { | ||
| "name": "@hocuspocus/common", | ||
| "description": "shared code for multiple Hocuspocus packages", | ||
| "version": "3.3.2", | ||
| "version": "3.4.0", | ||
| "homepage": "https://hocuspocus.dev", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
228644
0.1%2874
0.14%