@hocuspocus/extension-database
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -7,2 +7,5 @@ import * as mutex from 'lib0/mutex'; | ||
import { WebSocketStatus, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.js'; | ||
export type HocusPocusWebSocket = WebSocket & { | ||
identifier: string; | ||
}; | ||
export type HocuspocusProviderWebsocketConfiguration = Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> & Partial<CompleteHocuspocusProviderWebsocketConfiguration>; | ||
@@ -83,6 +86,10 @@ export interface CompleteHocuspocusProviderWebsocketConfiguration { | ||
subscribedToBroadcastChannel: boolean; | ||
webSocket: WebSocket | null; | ||
webSocket: HocusPocusWebSocket | null; | ||
webSocketHandlers: { | ||
[key: string]: any; | ||
}; | ||
shouldConnect: boolean; | ||
status: WebSocketStatus; | ||
lastMessageReceived: number; | ||
identifier: number; | ||
mux: mutex.mutex; | ||
@@ -105,2 +112,4 @@ intervals: any; | ||
connect(): Promise<unknown>; | ||
attachWebSocketListeners(ws: HocusPocusWebSocket, reject: Function): void; | ||
cleanupWebSocket(): void; | ||
createWebSocketConnection(): Promise<unknown>; | ||
@@ -113,3 +122,2 @@ onMessage(event: MessageEvent): void; | ||
checkConnection(): void; | ||
registerEventListeners(): void; | ||
get serverUrl(): string; | ||
@@ -116,0 +124,0 @@ get url(): string; |
import type { AbstractType, YArrayEvent } from 'yjs'; | ||
import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider.js'; | ||
import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js'; | ||
import type { THistoryVersion } from './types'; | ||
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>); | ||
@@ -12,15 +13,25 @@ export interface AdditionalTiptapCollabProviderConfiguration { | ||
} | ||
export type AuditHistoryVersion = { | ||
name?: string; | ||
version: number; | ||
date: number; | ||
}; | ||
export declare class TiptapCollabProvider extends HocuspocusProvider { | ||
tiptapCollabConfigurationPrefix: string; | ||
constructor(configuration: TiptapCollabProviderConfiguration); | ||
/** | ||
* note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan. | ||
*/ | ||
createVersion(name?: string): void; | ||
/** | ||
* note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan. | ||
*/ | ||
revertToVersion(targetVersion: number): void; | ||
getVersions(): AuditHistoryVersion[]; | ||
watchVersions(callback: Parameters<AbstractType<YArrayEvent<AuditHistoryVersion>>['observe']>[0]): void; | ||
unwatchVersions(callback: Parameters<AbstractType<YArrayEvent<AuditHistoryVersion>>['unobserve']>[0]): void; | ||
/** | ||
* note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan. | ||
* | ||
* The server will reply with a stateless message (THistoryVersionPreviewEvent) | ||
*/ | ||
previewVersion(targetVersion: number): void; | ||
/** | ||
* note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan. | ||
*/ | ||
getVersions(): THistoryVersion[]; | ||
watchVersions(callback: Parameters<AbstractType<YArrayEvent<THistoryVersion>>['observe']>[0]): void; | ||
unwatchVersions(callback: Parameters<AbstractType<YArrayEvent<THistoryVersion>>['unobserve']>[0]): void; | ||
isAutoVersioning(): boolean; | ||
@@ -27,0 +38,0 @@ enableAutoVersioning(): 1; |
@@ -87,1 +87,46 @@ import { Encoder } from 'lib0/encoding'; | ||
}[]; | ||
export type THistoryVersion = { | ||
name?: string; | ||
version: number; | ||
date: number; | ||
}; | ||
export type THistoryConfiguration = { | ||
autoVersioning: boolean; | ||
currentVersion: number; | ||
stateCaptured: number; | ||
}; | ||
export type THistoryAction = THistoryDocumentRevertAction | THistoryVersionCreateAction | THistoryVersionPreviewAction; | ||
export type THistoryDocumentRevertAction = { | ||
action: 'document.revert'; | ||
/** | ||
* if changes havent been persisted to a version yet, we'll create one with the specified name, | ||
* expect when `false` is passed. | ||
*/ | ||
currentVersionName?: string | false; | ||
/** | ||
* Name of the version that is created after the revert. Pass `false` to avoid generating a new version. | ||
*/ | ||
newVersionName?: string | false; | ||
}; | ||
export type THistoryVersionCreateAction = { | ||
action: 'version.create'; | ||
name?: string; | ||
}; | ||
export type THistoryVersionPreviewAction = { | ||
action: 'version.preview'; | ||
version: number; | ||
}; | ||
export type THistoryEvent = THistoryVersionPreviewEvent | THistoryVersionCreatedEvent | THistoryDocumentRevertedEvent; | ||
export type THistoryVersionCreatedEvent = { | ||
event: 'version.created'; | ||
version: number; | ||
}; | ||
export type THistoryVersionPreviewEvent = { | ||
event: 'version.preview'; | ||
version: number; | ||
ydoc: string; | ||
}; | ||
export type THistoryDocumentRevertedEvent = { | ||
event: 'document.reverted'; | ||
version: number; | ||
}; |
@@ -42,3 +42,3 @@ /// <reference types="node" /> | ||
onLoadDocument?(data: onLoadDocumentPayload): Promise<any>; | ||
afterLoadDocument?(data: onLoadDocumentPayload): Promise<any>; | ||
afterLoadDocument?(data: afterLoadDocumentPayload): Promise<any>; | ||
beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>; | ||
@@ -53,3 +53,3 @@ beforeBroadcastStateless?(data: beforeBroadcastStatelessPayload): Promise<any>; | ||
onDisconnect?(data: onDisconnectPayload): Promise<any>; | ||
afterUnloadDocument?(data: onLoadDocumentPayload): Promise<any>; | ||
afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>; | ||
onDestroy?(data: onDestroyPayload): Promise<any>; | ||
@@ -66,3 +66,3 @@ } | ||
onLoadDocument: onLoadDocumentPayload; | ||
afterLoadDocument: onLoadDocumentPayload; | ||
afterLoadDocument: afterLoadDocumentPayload; | ||
beforeHandleMessage: beforeHandleMessagePayload; | ||
@@ -146,2 +146,3 @@ beforeBroadcastStateless: beforeBroadcastStatelessPayload; | ||
export interface onConnectPayload { | ||
context: any; | ||
documentName: string; | ||
@@ -148,0 +149,0 @@ instance: Hocuspocus; |
{ | ||
"name": "@hocuspocus/extension-database", | ||
"description": "a generic Hocuspocus persistence driver for the database", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@hocuspocus/server": "^2.5.0" | ||
"@hocuspocus/server": "^2.6.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75657
1973
Updated@hocuspocus/server@^2.6.0