@hocuspocus/extension-logger 2.0.0-beta.0 → 2.0.1
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/extension-monitor/src/Dashboard.d.ts +1 -0
- package/dist/packages/extension-redis/src/Redis.d.ts +1 -1
- package/dist/packages/provider/src/HocuspocusCloudProvider.d.ts +1 -1
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +1 -1
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +1 -1
- package/dist/packages/provider/src/TiptapCollabProvider.d.ts +11 -0
- package/dist/packages/provider/src/index.d.ts +1 -1
- package/dist/packages/provider/src/types.d.ts +13 -13
- package/dist/packages/server/src/Connection.d.ts +2 -1
- package/dist/packages/server/src/Hocuspocus.d.ts +1 -0
- package/dist/packages/server/src/types.d.ts +5 -3
- package/dist/tests/utils/newHocuspocus.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import RedisClient, { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
|
|
2
2
|
import Redlock from 'redlock';
|
|
3
3
|
import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, onListenPayload, beforeBroadcastStatelessPayload } from '@hocuspocus/server';
|
|
4
|
-
export
|
|
4
|
+
export type RedisInstance = RedisClient.Cluster | RedisClient.Redis;
|
|
5
5
|
export interface Configuration {
|
|
6
6
|
/**
|
|
7
7
|
* Redis port
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider';
|
|
2
2
|
import { HocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket';
|
|
3
|
-
export
|
|
3
|
+
export type HocuspocusCloudProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & Partial<Pick<HocuspocusProviderWebsocketConfiguration, 'url'>> & AdditionalHocuspocusCloudProviderConfiguration;
|
|
4
4
|
export interface AdditionalHocuspocusCloudProviderConfiguration {
|
|
5
5
|
/**
|
|
6
6
|
* A Hocuspocus Cloud key, get one here: https://hocuspocus.cloud/
|
|
@@ -6,7 +6,7 @@ import EventEmitter from './EventEmitter';
|
|
|
6
6
|
import { ConstructableOutgoingMessage, onAuthenticationFailedParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters, WebSocketStatus } from './types';
|
|
7
7
|
import { CompleteHocuspocusProviderWebsocketConfiguration, HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket';
|
|
8
8
|
import { onAwarenessChangeParameters, onAwarenessUpdateParameters } from '.';
|
|
9
|
-
export
|
|
9
|
+
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name'>> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> | Required<Pick<CompleteHocuspocusProviderConfiguration, 'websocketProvider'>>);
|
|
10
10
|
export interface CompleteHocuspocusProviderConfiguration {
|
|
11
11
|
/**
|
|
12
12
|
* The identifier/name of your document
|
|
@@ -4,7 +4,7 @@ import { Event } from 'ws';
|
|
|
4
4
|
import EventEmitter from './EventEmitter';
|
|
5
5
|
import { onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters, WebSocketStatus } from './types';
|
|
6
6
|
import { HocuspocusProvider, onAwarenessChangeParameters, onAwarenessUpdateParameters } from '.';
|
|
7
|
-
export
|
|
7
|
+
export type HocuspocusProviderWebsocketConfiguration = Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> & Partial<CompleteHocuspocusProviderWebsocketConfiguration>;
|
|
8
8
|
export interface CompleteHocuspocusProviderWebsocketConfiguration {
|
|
9
9
|
/**
|
|
10
10
|
* URL of your @hocuspocus/server instance
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider';
|
|
2
|
+
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & AdditionalTiptapCollabProviderConfiguration;
|
|
3
|
+
export interface AdditionalTiptapCollabProviderConfiguration {
|
|
4
|
+
/**
|
|
5
|
+
* A Hocuspocus Cloud App ID, get one here: https://collab.tiptap.dev
|
|
6
|
+
*/
|
|
7
|
+
appId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class TiptapCollabProvider extends HocuspocusProvider {
|
|
10
|
+
constructor(configuration: TiptapCollabProviderConfiguration);
|
|
11
|
+
}
|
|
@@ -43,42 +43,42 @@ export interface OutgoingMessageArguments {
|
|
|
43
43
|
export interface Constructable<T> {
|
|
44
44
|
new (...args: any): T;
|
|
45
45
|
}
|
|
46
|
-
export
|
|
47
|
-
export
|
|
46
|
+
export type ConstructableOutgoingMessage = Constructable<AuthenticationMessage> | Constructable<AwarenessMessage> | Constructable<QueryAwarenessMessage> | Constructable<SyncStepOneMessage> | Constructable<SyncStepTwoMessage> | Constructable<UpdateMessage>;
|
|
47
|
+
export type onAuthenticationFailedParameters = {
|
|
48
48
|
reason: string;
|
|
49
49
|
};
|
|
50
|
-
export
|
|
50
|
+
export type onOpenParameters = {
|
|
51
51
|
event: Event;
|
|
52
52
|
};
|
|
53
|
-
export
|
|
53
|
+
export type onMessageParameters = {
|
|
54
54
|
event: MessageEvent;
|
|
55
55
|
message: IncomingMessage;
|
|
56
56
|
};
|
|
57
|
-
export
|
|
57
|
+
export type onOutgoingMessageParameters = {
|
|
58
58
|
message: OutgoingMessage;
|
|
59
59
|
};
|
|
60
|
-
export
|
|
60
|
+
export type onStatusParameters = {
|
|
61
61
|
status: WebSocketStatus;
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type onSyncedParameters = {
|
|
64
64
|
state: boolean;
|
|
65
65
|
};
|
|
66
|
-
export
|
|
66
|
+
export type onDisconnectParameters = {
|
|
67
67
|
event: CloseEvent;
|
|
68
68
|
};
|
|
69
|
-
export
|
|
69
|
+
export type onCloseParameters = {
|
|
70
70
|
event: CloseEvent;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
72
|
+
export type onAwarenessUpdateParameters = {
|
|
73
73
|
states: StatesArray;
|
|
74
74
|
};
|
|
75
|
-
export
|
|
75
|
+
export type onAwarenessChangeParameters = {
|
|
76
76
|
states: StatesArray;
|
|
77
77
|
};
|
|
78
|
-
export
|
|
78
|
+
export type onStatelessParameters = {
|
|
79
79
|
payload: string;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export type StatesArray = {
|
|
82
82
|
clientId: number;
|
|
83
83
|
[key: string | number]: any;
|
|
84
84
|
}[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { IncomingMessage as HTTPIncomingMessage } from 'http';
|
|
3
4
|
import AsyncLock from 'async-lock';
|
|
4
5
|
import WebSocket from 'ws';
|
|
@@ -23,7 +24,7 @@ export declare class Connection {
|
|
|
23
24
|
* Constructor.
|
|
24
25
|
*/
|
|
25
26
|
constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, timeout: number, socketId: string, context: any, readOnly: boolean | undefined, logger: Debugger);
|
|
26
|
-
boundClose: (event?: CloseEvent
|
|
27
|
+
boundClose: (event?: CloseEvent) => void;
|
|
27
28
|
boundHandleMessage: (data: Uint8Array) => void;
|
|
28
29
|
boundHandlePong: () => void;
|
|
29
30
|
handlePong(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { IncomingMessage, Server as HTTPServer } from 'http';
|
|
3
4
|
import WebSocket, { AddressInfo, WebSocketServer } from 'ws';
|
|
4
5
|
import { Configuration, HookName, HookPayload, onListenPayload } from './types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
|
|
3
5
|
import { URLSearchParams } from 'url';
|
|
4
6
|
import { Awareness } from 'y-protocols/awareness';
|
|
@@ -47,8 +49,8 @@ export interface Extension {
|
|
|
47
49
|
onDisconnect?(data: onDisconnectPayload): Promise<any>;
|
|
48
50
|
onDestroy?(data: onDestroyPayload): Promise<any>;
|
|
49
51
|
}
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
+
export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'onDestroy';
|
|
53
|
+
export type HookPayload = onConfigurePayload | onListenPayload | onUpgradePayload | onConnectPayload | connectedPayload | onAuthenticatePayload | onLoadDocumentPayload | onStatelessPayload | beforeHandleMessagePayload | beforeBroadcastStatelessPayload | onChangePayload | onStoreDocumentPayload | afterStoreDocumentPayload | onAwarenessUpdatePayload | onRequestPayload | onDisconnectPayload | onDestroyPayload;
|
|
52
54
|
export interface Configuration extends Extension {
|
|
53
55
|
/**
|
|
54
56
|
* A name for the instance, used for logging.
|
|
@@ -208,7 +210,7 @@ export interface onAwarenessUpdatePayload {
|
|
|
208
210
|
awareness: Awareness;
|
|
209
211
|
states: StatesArray;
|
|
210
212
|
}
|
|
211
|
-
export
|
|
213
|
+
export type StatesArray = {
|
|
212
214
|
clientId: number;
|
|
213
215
|
[key: string | number]: any;
|
|
214
216
|
}[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Hocuspocus, Configuration } from '@hocuspocus/server';
|
|
2
|
-
export declare const newHocuspocus: (options?: Partial<Configuration>
|
|
2
|
+
export declare const newHocuspocus: (options?: Partial<Configuration>) => Promise<Hocuspocus>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-logger",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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": "^2.0.
|
|
31
|
+
"@hocuspocus/server": "^2.0.1"
|
|
32
32
|
},
|
|
33
33
|
"gitHead": "b3454a4ca289a84ddfb7fa5607a2d4b8d5c37e9d"
|
|
34
34
|
}
|