@hocuspocus/extension-logger 1.0.0-alpha.62 → 1.0.0-alpha.63
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/common/src/CloseEvents.d.ts +23 -0
- package/dist/packages/common/src/index.d.ts +1 -0
- package/dist/packages/provider/src/HocuspocusCloudProvider.d.ts +4 -3
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +9 -4
- package/dist/packages/server/src/Connection.d.ts +1 -1
- package/dist/packages/server/src/Hocuspocus.d.ts +8 -1
- package/dist/packages/server/src/types.d.ts +4 -8
- package/package.json +3 -3
- package/dist/packages/server/src/CloseEvents.d.ts +0 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CloseEvent {
|
|
2
|
+
code: number;
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The server successfully processed the request, asks that the requester reset
|
|
7
|
+
* its document view, and is not returning any content.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ResetConnection: CloseEvent;
|
|
10
|
+
/**
|
|
11
|
+
* Similar to Forbidden, but specifically for use when authentication is required and has
|
|
12
|
+
* failed or has not yet been provided.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Unauthorized: CloseEvent;
|
|
15
|
+
/**
|
|
16
|
+
* The request contained valid data and was understood by the server, but the server
|
|
17
|
+
* is refusing action.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Forbidden: CloseEvent;
|
|
20
|
+
/**
|
|
21
|
+
* The server timed out waiting for the request.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ConnectionTimeout: CloseEvent;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { HocuspocusProvider,
|
|
2
|
-
export
|
|
1
|
+
import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider';
|
|
2
|
+
export declare type HocuspocusCloudProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & AdditionalHocuspocusCloudProviderConfiguration;
|
|
3
|
+
export interface AdditionalHocuspocusCloudProviderConfiguration {
|
|
3
4
|
/**
|
|
4
5
|
* A Hocuspocus Cloud key, get one here: https://hocuspocus.cloud/
|
|
5
6
|
*/
|
|
6
7
|
key: string;
|
|
7
8
|
}
|
|
8
9
|
export declare class HocuspocusCloudProvider extends HocuspocusProvider {
|
|
9
|
-
constructor(
|
|
10
|
+
constructor(configuration: HocuspocusCloudProviderConfiguration);
|
|
10
11
|
}
|
|
@@ -10,7 +10,8 @@ export declare enum WebSocketStatus {
|
|
|
10
10
|
Connected = "connected",
|
|
11
11
|
Disconnected = "disconnected"
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export declare type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'url' | 'name'>> & Partial<CompleteHocuspocusProviderConfiguration>;
|
|
14
|
+
export interface CompleteHocuspocusProviderConfiguration {
|
|
14
15
|
/**
|
|
15
16
|
* URL of your @hocuspocus/server instance
|
|
16
17
|
*/
|
|
@@ -104,9 +105,13 @@ export interface HocuspocusProviderOptions {
|
|
|
104
105
|
onDestroy: () => void;
|
|
105
106
|
onAwarenessUpdate: (states: any) => void;
|
|
106
107
|
onAwarenessChange: (states: any) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Don’t output any warnings.
|
|
110
|
+
*/
|
|
111
|
+
quiet: boolean;
|
|
107
112
|
}
|
|
108
113
|
export declare class HocuspocusProvider extends EventEmitter {
|
|
109
|
-
|
|
114
|
+
configuration: CompleteHocuspocusProviderConfiguration;
|
|
110
115
|
subscribedToBroadcastChannel: boolean;
|
|
111
116
|
webSocket: WebSocket | null;
|
|
112
117
|
shouldConnect: boolean;
|
|
@@ -120,8 +125,8 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
120
125
|
resolve: (value?: any) => void;
|
|
121
126
|
reject: (reason?: any) => void;
|
|
122
127
|
} | null;
|
|
123
|
-
constructor(
|
|
124
|
-
|
|
128
|
+
constructor(configuration: HocuspocusProviderConfiguration);
|
|
129
|
+
setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
|
|
125
130
|
connect(): Promise<void>;
|
|
126
131
|
createWebSocketConnection(): Promise<unknown>;
|
|
127
132
|
resolveConnectionAttempt(): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import AsyncLock from 'async-lock';
|
|
3
3
|
import WebSocket from 'ws';
|
|
4
4
|
import { IncomingMessage as HTTPIncomingMessage } from 'http';
|
|
5
|
+
import { CloseEvent } from '@hocuspocus/common';
|
|
5
6
|
import Document from './Document';
|
|
6
|
-
import { CloseEvent } from './types';
|
|
7
7
|
import { MessageLogger } from './Debugger';
|
|
8
8
|
declare class Connection {
|
|
9
9
|
webSocket: WebSocket;
|
|
@@ -46,7 +46,14 @@ export declare class Hocuspocus {
|
|
|
46
46
|
*/
|
|
47
47
|
destroy(): Promise<any>;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* The `handleConnection` method receives incoming WebSocket connections,
|
|
50
|
+
* runs all hooks:
|
|
51
|
+
*
|
|
52
|
+
* - onConnect for all connections
|
|
53
|
+
* - onAuthenticate only if required
|
|
54
|
+
*
|
|
55
|
+
* … and if nothings fails it’ll fully establish the connection and
|
|
56
|
+
* load the Document then.
|
|
50
57
|
*/
|
|
51
58
|
handleConnection(incoming: WebSocket, request: IncomingMessage, documentName: string, context?: any): void;
|
|
52
59
|
/**
|
|
@@ -25,7 +25,7 @@ export interface AwarenessUpdate {
|
|
|
25
25
|
updated: Array<any>;
|
|
26
26
|
removed: Array<any>;
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
28
|
+
export interface ConnectionConfiguration {
|
|
29
29
|
readOnly: boolean;
|
|
30
30
|
requiresAuthentication: boolean;
|
|
31
31
|
isAuthenticated: boolean;
|
|
@@ -88,7 +88,7 @@ export interface onAuthenticatePayload {
|
|
|
88
88
|
requestParameters: URLSearchParams;
|
|
89
89
|
socketId: string;
|
|
90
90
|
token: string;
|
|
91
|
-
connection:
|
|
91
|
+
connection: ConnectionConfiguration;
|
|
92
92
|
}
|
|
93
93
|
export interface onConnectPayload {
|
|
94
94
|
documentName: string;
|
|
@@ -97,7 +97,7 @@ export interface onConnectPayload {
|
|
|
97
97
|
requestHeaders: IncomingHttpHeaders;
|
|
98
98
|
requestParameters: URLSearchParams;
|
|
99
99
|
socketId: string;
|
|
100
|
-
connection:
|
|
100
|
+
connection: ConnectionConfiguration;
|
|
101
101
|
}
|
|
102
102
|
export interface onLoadDocumentPayload {
|
|
103
103
|
context: any;
|
|
@@ -107,7 +107,7 @@ export interface onLoadDocumentPayload {
|
|
|
107
107
|
requestHeaders: IncomingHttpHeaders;
|
|
108
108
|
requestParameters: URLSearchParams;
|
|
109
109
|
socketId: string;
|
|
110
|
-
connection:
|
|
110
|
+
connection: ConnectionConfiguration;
|
|
111
111
|
}
|
|
112
112
|
export interface onChangePayload {
|
|
113
113
|
clientsCount: number;
|
|
@@ -153,7 +153,3 @@ export interface onConfigurePayload {
|
|
|
153
153
|
yjsVersion: string;
|
|
154
154
|
instance: Hocuspocus;
|
|
155
155
|
}
|
|
156
|
-
export interface CloseEvent {
|
|
157
|
-
code: number;
|
|
158
|
-
reason: string;
|
|
159
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-logger",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.63",
|
|
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": "^1.0.0-alpha.
|
|
31
|
+
"@hocuspocus/server": "^1.0.0-alpha.89"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "87b715d1d28c603702879f4413c17d2c4a38c51a"
|
|
34
34
|
}
|