@hocuspocus/extension-webhook 2.13.5-rc.0 → 3.0.0-rc.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/hocuspocus-webhook.cjs +45004 -11
- package/dist/hocuspocus-webhook.cjs.map +1 -1
- package/dist/hocuspocus-webhook.esm.js +45002 -3
- package/dist/hocuspocus-webhook.esm.js.map +1 -1
- package/dist/packages/common/src/auth.d.ts +1 -1
- package/dist/packages/extension-database/src/Database.d.ts +1 -1
- package/dist/packages/extension-logger/src/Logger.d.ts +1 -1
- package/dist/packages/extension-redis/src/Redis.d.ts +4 -3
- package/dist/packages/extension-sqlite/src/SQLite.d.ts +2 -1
- package/dist/packages/extension-throttle/src/index.d.ts +2 -3
- package/dist/packages/extension-webhook/src/index.d.ts +3 -4
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +4 -13
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +5 -5
- package/dist/packages/provider/src/IncomingMessage.d.ts +3 -3
- package/dist/packages/provider/src/MessageReceiver.d.ts +2 -2
- package/dist/packages/provider/src/MessageSender.d.ts +2 -2
- package/dist/packages/provider/src/OutgoingMessage.d.ts +2 -2
- package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +2 -1
- package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +2 -1
- package/dist/packages/provider/src/TiptapCollabProvider.d.ts +2 -1
- package/dist/packages/provider/src/TiptapCollabProviderWebsocket.d.ts +2 -1
- package/dist/packages/provider/src/types.d.ts +12 -12
- package/dist/packages/server/src/ClientConnection.d.ts +6 -7
- package/dist/packages/server/src/Connection.d.ts +7 -9
- package/dist/packages/server/src/DirectConnection.d.ts +1 -1
- package/dist/packages/server/src/Document.d.ts +5 -5
- package/dist/packages/server/src/Hocuspocus.d.ts +6 -27
- package/dist/packages/server/src/IncomingMessage.d.ts +3 -3
- package/dist/packages/server/src/MessageReceiver.d.ts +5 -5
- package/dist/packages/server/src/OutgoingMessage.d.ts +3 -3
- package/dist/packages/server/src/Server.d.ts +22 -3
- package/dist/packages/server/src/index.d.ts +1 -0
- package/dist/packages/server/src/types.d.ts +7 -24
- package/dist/packages/server/src/util/getParameters.d.ts +1 -3
- package/dist/packages/transformer/src/Prosemirror.d.ts +1 -1
- package/dist/packages/transformer/src/Tiptap.d.ts +3 -3
- package/dist/packages/transformer/src/types.d.ts +1 -1
- package/dist/tests/utils/newHocuspocus.d.ts +2 -2
- package/dist/tests/utils/newHocuspocusProvider.d.ts +2 -2
- package/dist/tests/utils/newHocuspocusProviderWebsocket.d.ts +4 -3
- package/dist/tests/utils/retryableAssertion.d.ts +1 -1
- package/package.json +4 -4
- package/src/index.ts +5 -3
|
@@ -2,5 +2,5 @@ import * as encoding from 'lib0/encoding';
|
|
|
2
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
|
-
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope:
|
|
5
|
+
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: "readonly" | "read-write") => void;
|
|
6
6
|
export declare const readAuthMessage: (decoder: decoding.Decoder, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { 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,4 +1,4 @@
|
|
|
1
|
-
import { 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,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import RedisClient
|
|
1
|
+
import type { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
|
|
2
|
+
import RedisClient from 'ioredis';
|
|
3
3
|
import Redlock from 'redlock';
|
|
4
|
-
import { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload,
|
|
4
|
+
import type { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, onConfigurePayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
|
|
5
|
+
import { Debugger } from '@hocuspocus/server';
|
|
5
6
|
export type RedisInstance = RedisClient.Cluster | RedisClient.Redis;
|
|
6
7
|
export interface Configuration {
|
|
7
8
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DatabaseConfiguration } from '@hocuspocus/extension-database';
|
|
2
|
+
import { Database } from '@hocuspocus/extension-database';
|
|
2
3
|
import sqlite3 from 'sqlite3';
|
|
3
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)";
|
|
4
5
|
export declare const selectQuery = "\n SELECT data FROM \"documents\" WHERE name = $name ORDER BY rowid DESC\n";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Extension, onConnectPayload } from '@hocuspocus/server';
|
|
1
|
+
import type { Extension, onConnectPayload } from '@hocuspocus/server';
|
|
3
2
|
export interface ThrottleConfiguration {
|
|
4
3
|
throttle: number | null | false;
|
|
5
4
|
consideredSeconds: number;
|
|
@@ -10,7 +9,7 @@ export declare class Throttle implements Extension {
|
|
|
10
9
|
configuration: ThrottleConfiguration;
|
|
11
10
|
connectionsByIp: Map<string, Array<number>>;
|
|
12
11
|
bannedIps: Map<string, number>;
|
|
13
|
-
cleanupInterval?: NodeJS.
|
|
12
|
+
cleanupInterval?: NodeJS.Timeout;
|
|
14
13
|
/**
|
|
15
14
|
* Constructor
|
|
16
15
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { 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';
|
|
5
4
|
export declare enum Events {
|
|
6
5
|
onChange = "change",
|
|
7
6
|
onConnect = "connect",
|
|
@@ -3,8 +3,9 @@ import type { CloseEvent, Event, MessageEvent } from 'ws';
|
|
|
3
3
|
import { Awareness } from 'y-protocols/awareness';
|
|
4
4
|
import * as Y from 'yjs';
|
|
5
5
|
import EventEmitter from './EventEmitter.js';
|
|
6
|
-
import { CompleteHocuspocusProviderWebsocketConfiguration
|
|
7
|
-
import {
|
|
6
|
+
import type { CompleteHocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket.js';
|
|
7
|
+
import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.js';
|
|
8
|
+
import type { ConstructableOutgoingMessage, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters } from './types.js';
|
|
8
9
|
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name'>> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> | Required<Pick<CompleteHocuspocusProviderConfiguration, 'websocketProvider'>>);
|
|
9
10
|
export interface CompleteHocuspocusProviderConfiguration {
|
|
10
11
|
/**
|
|
@@ -81,24 +82,19 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
81
82
|
subscribedToBroadcastChannel: boolean;
|
|
82
83
|
isSynced: boolean;
|
|
83
84
|
unsyncedChanges: number;
|
|
84
|
-
status: WebSocketStatus;
|
|
85
85
|
isAuthenticated: boolean;
|
|
86
86
|
authorizedScope: string | undefined;
|
|
87
87
|
mux: mutex.mutex;
|
|
88
88
|
intervals: any;
|
|
89
|
-
isConnected: boolean;
|
|
90
89
|
constructor(configuration: HocuspocusProviderConfiguration);
|
|
91
|
-
boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;
|
|
92
90
|
boundPageHide: () => void;
|
|
93
91
|
boundOnOpen: (event: Event) => Promise<void>;
|
|
94
92
|
boundOnClose: (event: CloseEvent) => void;
|
|
95
|
-
boundOnStatus: ({ status }: onStatusParameters) => void;
|
|
96
93
|
forwardConnect: (e: any) => this;
|
|
97
94
|
forwardOpen: (e: any) => this;
|
|
98
95
|
forwardClose: (e: any) => this;
|
|
99
96
|
forwardDisconnect: (e: any) => this;
|
|
100
97
|
forwardDestroy: (e: any) => this;
|
|
101
|
-
onStatus({ status }: onStatusParameters): void;
|
|
102
98
|
setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
|
|
103
99
|
get document(): Y.Doc;
|
|
104
100
|
get awareness(): Awareness | null;
|
|
@@ -122,7 +118,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
122
118
|
set synced(state: boolean);
|
|
123
119
|
receiveStateless(payload: string): void;
|
|
124
120
|
get isAuthenticationRequired(): boolean;
|
|
125
|
-
connect(): Promise<
|
|
121
|
+
connect(): Promise<void>;
|
|
126
122
|
disconnect(): void;
|
|
127
123
|
onOpen(event: Event): Promise<void>;
|
|
128
124
|
getToken(): Promise<string | null>;
|
|
@@ -133,10 +129,5 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
133
129
|
destroy(): void;
|
|
134
130
|
permissionDeniedHandler(reason: string): void;
|
|
135
131
|
authenticatedHandler(scope: string): void;
|
|
136
|
-
get broadcastChannel(): string;
|
|
137
|
-
broadcastChannelSubscriber(data: ArrayBuffer): void;
|
|
138
|
-
subscribeToBroadcastChannel(): void;
|
|
139
|
-
disconnectBroadcastChannel(): void;
|
|
140
|
-
broadcast(Message: ConstructableOutgoingMessage, args?: any): void;
|
|
141
132
|
setAwarenessField(key: string, value: any): void;
|
|
142
133
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { MessageEvent } from 'ws';
|
|
2
|
-
import { Event } from 'ws';
|
|
1
|
+
import type { MessageEvent, Event } from 'ws';
|
|
3
2
|
import EventEmitter from './EventEmitter.js';
|
|
4
|
-
import { HocuspocusProvider } from './HocuspocusProvider.js';
|
|
5
|
-
import {
|
|
3
|
+
import type { HocuspocusProvider } from './HocuspocusProvider.js';
|
|
4
|
+
import type { onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.js';
|
|
5
|
+
import { WebSocketStatus } from './types.js';
|
|
6
6
|
export type HocusPocusWebSocket = WebSocket & {
|
|
7
7
|
identifier: string;
|
|
8
8
|
};
|
|
@@ -102,7 +102,7 @@ export declare class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
102
102
|
receivedOnStatusPayload?: onStatusParameters | undefined;
|
|
103
103
|
onOpen(event: Event): Promise<void>;
|
|
104
104
|
onStatus(data: onStatusParameters): Promise<void>;
|
|
105
|
-
attach(provider: HocuspocusProvider):
|
|
105
|
+
attach(provider: HocuspocusProvider): void;
|
|
106
106
|
detach(provider: HocuspocusProvider): void;
|
|
107
107
|
setConfiguration(configuration?: Partial<HocuspocusProviderWebsocketConfiguration>): void;
|
|
108
108
|
cancelWebsocketRetry?: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Decoder } from 'lib0/decoding';
|
|
2
|
-
import { Encoder } from 'lib0/encoding';
|
|
3
|
-
import { MessageType } from './types.js';
|
|
1
|
+
import type { Decoder } from 'lib0/decoding';
|
|
2
|
+
import type { Encoder } from 'lib0/encoding';
|
|
3
|
+
import type { MessageType } from './types.js';
|
|
4
4
|
export declare class IncomingMessage {
|
|
5
5
|
data: any;
|
|
6
6
|
encoder: Encoder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HocuspocusProvider } from './HocuspocusProvider.js';
|
|
2
|
-
import { IncomingMessage } from './IncomingMessage.js';
|
|
1
|
+
import type { HocuspocusProvider } from './HocuspocusProvider.js';
|
|
2
|
+
import type { IncomingMessage } from './IncomingMessage.js';
|
|
3
3
|
export declare class MessageReceiver {
|
|
4
4
|
message: IncomingMessage;
|
|
5
5
|
broadcasted: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Encoder } from 'lib0/encoding';
|
|
2
|
-
import { ConstructableOutgoingMessage } from './types.js';
|
|
1
|
+
import type { Encoder } from 'lib0/encoding';
|
|
2
|
+
import type { ConstructableOutgoingMessage } from './types.js';
|
|
3
3
|
export declare class MessageSender {
|
|
4
4
|
encoder: Encoder;
|
|
5
5
|
message: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Encoder } from 'lib0/encoding';
|
|
2
|
-
import { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.js';
|
|
1
|
+
import type { Encoder } from 'lib0/encoding';
|
|
2
|
+
import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from './types.js';
|
|
3
3
|
export declare class OutgoingMessage implements OutgoingMessageInterface {
|
|
4
4
|
encoder: Encoder;
|
|
5
5
|
type?: MessageType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
2
|
+
import { MessageType } from '../types.js';
|
|
2
3
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
3
4
|
export declare class AuthenticationMessage extends OutgoingMessage {
|
|
4
5
|
type: MessageType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
3
|
+
import { MessageType } from '../types.js';
|
|
3
4
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
4
5
|
export declare class AwarenessMessage extends OutgoingMessage {
|
|
5
6
|
type: MessageType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
3
|
+
import { MessageType } from '../types.js';
|
|
3
4
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
4
5
|
export declare class CloseMessage extends OutgoingMessage {
|
|
5
6
|
type: MessageType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
3
|
+
import { MessageType } from '../types.js';
|
|
3
4
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
4
5
|
export declare class QueryAwarenessMessage extends OutgoingMessage {
|
|
5
6
|
type: MessageType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
2
|
+
import { MessageType } from '../types.js';
|
|
2
3
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
3
4
|
export declare class StatelessMessage extends OutgoingMessage {
|
|
4
5
|
type: MessageType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
3
|
+
import { MessageType } from '../types.js';
|
|
3
4
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
4
5
|
export declare class SyncStepOneMessage extends OutgoingMessage {
|
|
5
6
|
type: MessageType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import {
|
|
2
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
3
|
+
import { MessageType } from '../types.js';
|
|
3
4
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
4
5
|
export declare class SyncStepTwoMessage extends OutgoingMessage {
|
|
5
6
|
type: MessageType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OutgoingMessageArguments } from '../types.js';
|
|
2
|
+
import { MessageType } from '../types.js';
|
|
2
3
|
import { OutgoingMessage } from '../OutgoingMessage.js';
|
|
3
4
|
export declare class UpdateMessage extends OutgoingMessage {
|
|
4
5
|
type: MessageType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AbstractType, YArrayEvent } from 'yjs';
|
|
2
2
|
import * as Y from 'yjs';
|
|
3
|
-
import {
|
|
3
|
+
import type { HocuspocusProviderConfiguration } from './HocuspocusProvider.js';
|
|
4
|
+
import { HocuspocusProvider } from './HocuspocusProvider.js';
|
|
4
5
|
import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js';
|
|
5
6
|
import type { TCollabComment, TCollabThread, THistoryVersion } from './types.js';
|
|
6
7
|
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & Pick<AdditionalTiptapCollabProviderConfiguration, 'user'>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CompleteHocuspocusProviderWebsocketConfiguration
|
|
1
|
+
import type { CompleteHocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket.js';
|
|
2
|
+
import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.js';
|
|
2
3
|
export type TiptapCollabProviderWebsocketConfiguration = Partial<CompleteHocuspocusProviderWebsocketConfiguration> & AdditionalTiptapCollabProviderWebsocketConfiguration;
|
|
3
4
|
export interface AdditionalTiptapCollabProviderWebsocketConfiguration {
|
|
4
5
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Encoder } from 'lib0/encoding';
|
|
1
|
+
import type { Encoder } from 'lib0/encoding';
|
|
2
2
|
import type { Event, MessageEvent } from 'ws';
|
|
3
|
-
import { Awareness } from 'y-protocols/awareness';
|
|
4
|
-
import * as Y from 'yjs';
|
|
5
|
-
import { CloseEvent } from '@hocuspocus/common';
|
|
6
|
-
import { IncomingMessage } from './IncomingMessage.js';
|
|
7
|
-
import { OutgoingMessage } from './OutgoingMessage.js';
|
|
8
|
-
import { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage.js';
|
|
9
|
-
import { AwarenessMessage } from './OutgoingMessages/AwarenessMessage.js';
|
|
10
|
-
import { QueryAwarenessMessage } from './OutgoingMessages/QueryAwarenessMessage.js';
|
|
11
|
-
import { SyncStepOneMessage } from './OutgoingMessages/SyncStepOneMessage.js';
|
|
12
|
-
import { SyncStepTwoMessage } from './OutgoingMessages/SyncStepTwoMessage.js';
|
|
13
|
-
import { UpdateMessage } from './OutgoingMessages/UpdateMessage.js';
|
|
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.js';
|
|
7
|
+
import type { OutgoingMessage } from './OutgoingMessage.js';
|
|
8
|
+
import type { AuthenticationMessage } from './OutgoingMessages/AuthenticationMessage.js';
|
|
9
|
+
import type { AwarenessMessage } from './OutgoingMessages/AwarenessMessage.js';
|
|
10
|
+
import type { QueryAwarenessMessage } from './OutgoingMessages/QueryAwarenessMessage.js';
|
|
11
|
+
import type { SyncStepOneMessage } from './OutgoingMessages/SyncStepOneMessage.js';
|
|
12
|
+
import type { SyncStepTwoMessage } from './OutgoingMessages/SyncStepTwoMessage.js';
|
|
13
|
+
import type { UpdateMessage } from './OutgoingMessages/UpdateMessage.js';
|
|
14
14
|
export declare enum MessageType {
|
|
15
15
|
Sync = 0,
|
|
16
16
|
Awareness = 1,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { onDisconnectPayload } from './types.js';
|
|
1
|
+
import type { IncomingMessage } from 'http';
|
|
2
|
+
import type WebSocket from 'ws';
|
|
3
|
+
import type { Debugger } from './Debugger.js';
|
|
4
|
+
import type Document from './Document.js';
|
|
5
|
+
import type { Hocuspocus } from './Hocuspocus.js';
|
|
6
|
+
import type { onDisconnectPayload } from './types.js';
|
|
8
7
|
/**
|
|
9
8
|
* The `ClientConnection` class is responsible for handling an incoming WebSocket
|
|
10
9
|
*
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { IncomingMessage as HTTPIncomingMessage } from 'http';
|
|
1
|
+
import type { IncomingMessage as HTTPIncomingMessage } from 'http';
|
|
4
2
|
import AsyncLock from 'async-lock';
|
|
5
|
-
import WebSocket from 'ws';
|
|
6
|
-
import { CloseEvent } from '@hocuspocus/common';
|
|
7
|
-
import Document from './Document.js';
|
|
8
|
-
import { Debugger } from './Debugger.js';
|
|
9
|
-
import { onStatelessPayload } from './types.js';
|
|
3
|
+
import type WebSocket from 'ws';
|
|
4
|
+
import type { CloseEvent } from '@hocuspocus/common';
|
|
5
|
+
import type Document from './Document.js';
|
|
6
|
+
import type { Debugger } from './Debugger.js';
|
|
7
|
+
import type { onStatelessPayload } from './types.js';
|
|
10
8
|
export declare class Connection {
|
|
11
9
|
webSocket: WebSocket;
|
|
12
10
|
context: any;
|
|
@@ -18,7 +16,7 @@ export declare class Connection {
|
|
|
18
16
|
callbacks: any;
|
|
19
17
|
socketId: string;
|
|
20
18
|
lock: AsyncLock;
|
|
21
|
-
readOnly:
|
|
19
|
+
readOnly: boolean;
|
|
22
20
|
logger: Debugger;
|
|
23
21
|
/**
|
|
24
22
|
* Constructor.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Document from './Document.js';
|
|
1
|
+
import type Document from './Document.js';
|
|
2
2
|
import type { Hocuspocus } from './Hocuspocus.js';
|
|
3
3
|
import type { DirectConnection as DirectConnectionInterface } from './types.js';
|
|
4
4
|
export declare class DirectConnection implements DirectConnectionInterface {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import WebSocket from 'ws';
|
|
1
|
+
import type WebSocket from 'ws';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
import { Doc } from 'yjs';
|
|
4
|
-
import { mutex } from 'lib0/mutex.js';
|
|
5
|
-
import Connection from './Connection.js';
|
|
6
|
-
import { Debugger } from './Debugger.js';
|
|
4
|
+
import type { mutex } from 'lib0/mutex.js';
|
|
5
|
+
import type Connection from './Connection.js';
|
|
6
|
+
import type { Debugger } from './Debugger.js';
|
|
7
7
|
export declare class Document extends Doc {
|
|
8
8
|
awareness: Awareness;
|
|
9
9
|
callbacks: {
|
|
@@ -23,7 +23,7 @@ export declare class Document extends Doc {
|
|
|
23
23
|
/**
|
|
24
24
|
* Constructor.
|
|
25
25
|
*/
|
|
26
|
-
constructor(name: string, logger?: Debugger, yDocOptions?:
|
|
26
|
+
constructor(name: string, logger?: Debugger, yDocOptions?: object);
|
|
27
27
|
/**
|
|
28
28
|
* Check if the Document (XMLFragment or Map) is empty
|
|
29
29
|
*/
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Server as HocuspocusServer } from './Server.js';
|
|
1
|
+
import type { IncomingMessage } from 'http';
|
|
2
|
+
import type WebSocket from 'ws';
|
|
3
|
+
import type { Server } from './Server.js';
|
|
5
4
|
import { Debugger } from './Debugger.js';
|
|
6
5
|
import { DirectConnection } from './DirectConnection.js';
|
|
7
6
|
import Document from './Document.js';
|
|
8
|
-
import { Configuration, ConnectionConfiguration, HookName, HookPayloadByName,
|
|
7
|
+
import type { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onStoreDocumentPayload } from './types.js';
|
|
9
8
|
export declare const defaultConfiguration: {
|
|
10
9
|
name: null;
|
|
11
|
-
port: number;
|
|
12
|
-
address: string;
|
|
13
10
|
timeout: number;
|
|
14
11
|
debounce: number;
|
|
15
12
|
maxDebounce: number;
|
|
@@ -19,16 +16,12 @@ export declare const defaultConfiguration: {
|
|
|
19
16
|
gcFilter: () => boolean;
|
|
20
17
|
};
|
|
21
18
|
unloadImmediately: boolean;
|
|
22
|
-
stopOnSignals: boolean;
|
|
23
19
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Hocuspocus Server
|
|
26
|
-
*/
|
|
27
20
|
export declare class Hocuspocus {
|
|
28
21
|
configuration: Configuration;
|
|
29
22
|
loadingDocuments: Map<string, Promise<Document>>;
|
|
30
23
|
documents: Map<string, Document>;
|
|
31
|
-
server?:
|
|
24
|
+
server?: Server;
|
|
32
25
|
debugger: Debugger;
|
|
33
26
|
debouncer: {
|
|
34
27
|
debounce: (id: string, func: Function, debounce: number, maxDebounce: number) => any;
|
|
@@ -37,19 +30,10 @@ export declare class Hocuspocus {
|
|
|
37
30
|
};
|
|
38
31
|
constructor(configuration?: Partial<Configuration>);
|
|
39
32
|
/**
|
|
40
|
-
* Configure
|
|
33
|
+
* Configure Hocuspocus
|
|
41
34
|
*/
|
|
42
35
|
configure(configuration: Partial<Configuration>): Hocuspocus;
|
|
43
36
|
get requiresAuthentication(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Start the server
|
|
46
|
-
*/
|
|
47
|
-
listen(portOrCallback?: number | ((data: onListenPayload) => Promise<any>) | null, callback?: any): Promise<Hocuspocus>;
|
|
48
|
-
get address(): AddressInfo;
|
|
49
|
-
get URL(): string;
|
|
50
|
-
get webSocketURL(): string;
|
|
51
|
-
get httpURL(): string;
|
|
52
|
-
private showStartScreen;
|
|
53
37
|
/**
|
|
54
38
|
* Get the total number of active documents
|
|
55
39
|
*/
|
|
@@ -62,10 +46,6 @@ export declare class Hocuspocus {
|
|
|
62
46
|
* Force close one or more connections
|
|
63
47
|
*/
|
|
64
48
|
closeConnections(documentName?: string): void;
|
|
65
|
-
/**
|
|
66
|
-
* Destroy the server
|
|
67
|
-
*/
|
|
68
|
-
destroy(): Promise<any>;
|
|
69
49
|
/**
|
|
70
50
|
* The `handleConnection` method receives incoming WebSocket connections,
|
|
71
51
|
* runs all hooks:
|
|
@@ -104,4 +84,3 @@ export declare class Hocuspocus {
|
|
|
104
84
|
getMessageLogs(): any[];
|
|
105
85
|
openDirectConnection(documentName: string, context?: any): Promise<DirectConnection>;
|
|
106
86
|
}
|
|
107
|
-
export declare const Server: Hocuspocus;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Decoder } from 'lib0/decoding';
|
|
2
|
-
import { Encoder } from 'lib0/encoding';
|
|
3
|
-
import { MessageType } from './types.js';
|
|
1
|
+
import type { Decoder } from 'lib0/decoding';
|
|
2
|
+
import type { Encoder } from 'lib0/encoding';
|
|
3
|
+
import type { MessageType } from './types.js';
|
|
4
4
|
export declare class IncomingMessage {
|
|
5
5
|
/**
|
|
6
6
|
* Access to the received message.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Connection from './Connection.js';
|
|
2
|
-
import { Debugger } from './Debugger.js';
|
|
3
|
-
import Document from './Document.js';
|
|
4
|
-
import { IncomingMessage } from './IncomingMessage.js';
|
|
1
|
+
import type Connection from './Connection.js';
|
|
2
|
+
import type { Debugger } from './Debugger.js';
|
|
3
|
+
import type Document from './Document.js';
|
|
4
|
+
import type { IncomingMessage } from './IncomingMessage.js';
|
|
5
5
|
export declare class MessageReceiver {
|
|
6
6
|
message: IncomingMessage;
|
|
7
7
|
logger: Debugger;
|
|
8
8
|
defaultTransactionOrigin?: string;
|
|
9
9
|
constructor(message: IncomingMessage, logger: Debugger, defaultTransactionOrigin?: string);
|
|
10
10
|
apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
|
|
11
|
-
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 |
|
|
11
|
+
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 1 | 2;
|
|
12
12
|
applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Encoder } from 'lib0/encoding';
|
|
2
|
-
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
-
import Document from './Document.js';
|
|
1
|
+
import type { Encoder } from 'lib0/encoding';
|
|
2
|
+
import type { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import type Document from './Document.js';
|
|
4
4
|
export declare class OutgoingMessage {
|
|
5
5
|
encoder: Encoder;
|
|
6
6
|
type?: number;
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import type { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
|
|
2
|
+
import type { AddressInfo } from 'ws';
|
|
3
3
|
import { WebSocketServer } from 'ws';
|
|
4
4
|
import { Hocuspocus } from './Hocuspocus.js';
|
|
5
|
+
import type { Configuration } from './types';
|
|
6
|
+
export interface ServerConfiguration extends Configuration {
|
|
7
|
+
port?: number;
|
|
8
|
+
address?: string;
|
|
9
|
+
stopOnSignals?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultServerConfiguration: {
|
|
12
|
+
port: number;
|
|
13
|
+
address: string;
|
|
14
|
+
stopOnSignals: boolean;
|
|
15
|
+
};
|
|
5
16
|
export declare class Server {
|
|
6
17
|
httpServer: HTTPServer;
|
|
7
18
|
webSocketServer: WebSocketServer;
|
|
8
19
|
hocuspocus: Hocuspocus;
|
|
9
|
-
|
|
20
|
+
configuration: ServerConfiguration;
|
|
21
|
+
constructor(configuration?: Partial<ServerConfiguration>);
|
|
10
22
|
setupWebsocketConnection: () => void;
|
|
11
23
|
setupHttpUpgrade: () => void;
|
|
12
24
|
requestHandler: (request: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
25
|
+
listen(port?: number, callback?: any): Promise<Hocuspocus>;
|
|
26
|
+
get address(): AddressInfo;
|
|
27
|
+
destroy(): Promise<any>;
|
|
28
|
+
get URL(): string;
|
|
29
|
+
get webSocketURL(): string;
|
|
30
|
+
get httpURL(): string;
|
|
31
|
+
private showStartScreen;
|
|
13
32
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import Connection from './Connection.js';
|
|
8
|
-
import Document from './Document.js';
|
|
9
|
-
import { Hocuspocus } from './Hocuspocus.js';
|
|
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.js';
|
|
5
|
+
import type Document from './Document.js';
|
|
6
|
+
import type { Hocuspocus } from './Hocuspocus.js';
|
|
10
7
|
export declare enum MessageType {
|
|
11
8
|
Unknown = -1,
|
|
12
9
|
Sync = 0,
|
|
13
10
|
Awareness = 1,
|
|
14
11
|
Auth = 2,
|
|
15
12
|
QueryAwareness = 3,
|
|
16
|
-
SyncReply = 4,
|
|
13
|
+
SyncReply = 4,// same as Sync, but won't trigger another 'SyncStep1'
|
|
17
14
|
Stateless = 5,
|
|
18
15
|
BroadcastStateless = 6,
|
|
19
16
|
CLOSE = 7,
|
|
@@ -85,14 +82,6 @@ export interface Configuration extends Extension {
|
|
|
85
82
|
* A list of hocuspocus extensions.
|
|
86
83
|
*/
|
|
87
84
|
extensions: Array<Extension>;
|
|
88
|
-
/**
|
|
89
|
-
* The port which the server listens on.
|
|
90
|
-
*/
|
|
91
|
-
port?: number;
|
|
92
|
-
/**
|
|
93
|
-
* The address which the server listens on.
|
|
94
|
-
*/
|
|
95
|
-
address?: string;
|
|
96
85
|
/**
|
|
97
86
|
* Defines in which interval the server sends a ping, and closes the connection when no pong is sent back.
|
|
98
87
|
*/
|
|
@@ -118,12 +107,6 @@ export interface Configuration extends Extension {
|
|
|
118
107
|
* your onStoreDocument is rate-limited.
|
|
119
108
|
*/
|
|
120
109
|
unloadImmediately: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* the server will gracefully stop if SIGINT, SIGQUIT or SIGTERM is received.
|
|
123
|
-
*
|
|
124
|
-
* Set this to false if you don't want that.
|
|
125
|
-
*/
|
|
126
|
-
stopOnSignals: boolean;
|
|
127
110
|
/**
|
|
128
111
|
* options to pass to the ydoc document
|
|
129
112
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Doc } from 'yjs';
|
|
2
2
|
import { Schema } from '@tiptap/pm/model';
|
|
3
|
-
import { Transformer } from './types.js';
|
|
3
|
+
import type { Transformer } from './types.js';
|
|
4
4
|
declare class Prosemirror implements Transformer {
|
|
5
5
|
defaultSchema: Schema;
|
|
6
6
|
schema(schema: Schema): Prosemirror;
|