@hocuspocus/extension-logger 1.0.0-alpha.66 → 1.0.0-alpha.67

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.
@@ -0,0 +1,3 @@
1
+ export declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
2
+ clientId: number;
3
+ }[];
@@ -1,2 +1,3 @@
1
1
  export * from './auth';
2
2
  export * from './CloseEvents';
3
+ export * from './awarenessStatesToArray';
@@ -1,12 +1,16 @@
1
1
  import { Extension, onConnectPayload } from '@hocuspocus/server';
2
- export interface Configuration {
2
+ export interface ThrottleConfiguration {
3
3
  throttle: number | null | false;
4
4
  banTime: number;
5
5
  }
6
6
  export declare class Throttle implements Extension {
7
- configuration: Configuration;
7
+ configuration: ThrottleConfiguration;
8
8
  connectionsByIp: Map<string, Array<number>>;
9
9
  bannedIps: Map<string, number>;
10
+ /**
11
+ * Constructor
12
+ */
13
+ constructor(configuration?: Partial<ThrottleConfiguration>);
10
14
  /**
11
15
  * Throttle requests
12
16
  * @private
@@ -1,4 +1,3 @@
1
1
  export * from './HocuspocusProvider';
2
2
  export * from './HocuspocusCloudProvider';
3
3
  export * from './types';
4
- export * from './utils';
@@ -8,6 +8,6 @@ export declare class MessageReceiver {
8
8
  logger: Debugger;
9
9
  constructor(message: IncomingMessage, logger: Debugger);
10
10
  apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
11
- readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 | 1 | 2;
11
+ readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 | 2 | 1;
12
12
  applyQueryAwarenessMessage(awareness: Awareness, reply?: (message: Uint8Array) => void): void;
13
13
  }
@@ -38,6 +38,7 @@ export interface Extension {
38
38
  onListen?(data: onListenPayload): Promise<any>;
39
39
  onUpgrade?(data: onUpgradePayload): Promise<any>;
40
40
  onConnect?(data: onConnectPayload): Promise<any>;
41
+ connected?(data: connectedPayload): Promise<any>;
41
42
  onAuthenticate?(data: onAuthenticatePayload): Promise<any>;
42
43
  /**
43
44
  * @deprecated onCreateDocument is deprecated, use onLoadDocument instead
@@ -53,7 +54,7 @@ export interface Extension {
53
54
  onDisconnect?(data: onDisconnectPayload): Promise<any>;
54
55
  onDestroy?(data: onDestroyPayload): Promise<any>;
55
56
  }
56
- export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'onAuthenticate' |
57
+ export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
57
58
  /**
58
59
  * @deprecated onCreateDocument is deprecated, use onLoadDocument instead
59
60
  */
@@ -116,6 +117,15 @@ export interface onConnectPayload {
116
117
  socketId: string;
117
118
  connection: ConnectionConfiguration;
118
119
  }
120
+ export interface connectedPayload {
121
+ documentName: string;
122
+ instance: Hocuspocus;
123
+ request: IncomingMessage;
124
+ requestHeaders: IncomingHttpHeaders;
125
+ requestParameters: URLSearchParams;
126
+ socketId: string;
127
+ connection: ConnectionConfiguration;
128
+ }
119
129
  export interface onLoadDocumentPayload {
120
130
  context: any;
121
131
  document: Document;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-logger",
3
- "version": "1.0.0-alpha.66",
3
+ "version": "1.0.0-alpha.67",
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.92"
31
+ "@hocuspocus/server": "^1.0.0-alpha.93"
32
32
  },
33
- "gitHead": "125d94dc3520bb5185293c9b316f66ddd9215992"
33
+ "gitHead": "05a7eb3d660175613d2fe7b6d9ec030e8e509683"
34
34
  }
@@ -1,4 +0,0 @@
1
- declare const _default: (states: Map<number, Record<string, any>>) => {
2
- clientId: number;
3
- }[];
4
- export default _default;
@@ -1 +0,0 @@
1
- export { default as awarenessStatesToArray } from './awarenessStatesToArray';