@hocuspocus/extension-throttle 1.0.0-alpha.34 → 1.0.0-alpha.39

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 @@
1
+ export * from './auth';
@@ -2,10 +2,53 @@ import { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoa
2
2
  export interface LoggerConfiguration {
3
3
  /**
4
4
  * Prepend all logging message with a string.
5
+ *
6
+ * @deprecated
5
7
  */
6
8
  prefix: null | string;
9
+ /**
10
+ * Whether to log something for the `onLoadDocument` hook.
11
+ */
12
+ onLoadDocument: boolean;
13
+ /**
14
+ * Whether to log something for the `onChange` hook.
15
+ */
16
+ onChange: boolean;
17
+ /**
18
+ * Whether to log something for the `onConnect` hook.
19
+ */
20
+ onConnect: boolean;
21
+ /**
22
+ * Whether to log something for the `onDisconnect` hook.
23
+ */
24
+ onDisconnect: boolean;
25
+ /**
26
+ * Whether to log something for the `onUpgrade` hook.
27
+ */
28
+ onUpgrade: boolean;
29
+ /**
30
+ * Whether to log something for the `onRequest` hook.
31
+ */
32
+ onRequest: boolean;
33
+ /**
34
+ * Whether to log something for the `onListen` hook.
35
+ */
36
+ onListen: boolean;
37
+ /**
38
+ * Whether to log something for the `onDestroy` hook.
39
+ */
40
+ onDestroy: boolean;
41
+ /**
42
+ * Whether to log something for the `onConfigure` hook.
43
+ */
44
+ onConfigure: boolean;
45
+ /**
46
+ * A log function, if none is provided output will go to console
47
+ */
48
+ log: (...args: any[]) => void;
7
49
  }
8
50
  export declare class Logger implements Extension {
51
+ name: string | null;
9
52
  configuration: LoggerConfiguration;
10
53
  /**
11
54
  * Constructor
@@ -20,5 +63,6 @@ export declare class Logger implements Extension {
20
63
  onListen(data: onListenPayload): Promise<void>;
21
64
  onDestroy(data: onDestroyPayload): Promise<void>;
22
65
  onConfigure(data: onConfigurePayload): Promise<void>;
66
+ private logRawText;
23
67
  private log;
24
68
  }
@@ -1,9 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import WebSocket, { WebSocketServer } from 'ws';
3
3
  import { IncomingMessage, Server as HTTPServer } from 'http';
4
- import { Configuration } from './types';
4
+ import { Configuration, Hook } from './types';
5
5
  import { MessageLogger } from './Debugger';
6
6
  export declare const defaultConfiguration: {
7
+ name: null;
7
8
  port: number;
8
9
  timeout: number;
9
10
  };
@@ -63,9 +64,8 @@ export declare class Hocuspocus {
63
64
  /**
64
65
  * Run the given hook on all configured extensions
65
66
  * Runs the given callback after each hook
66
- * @private
67
67
  */
68
- private hooks;
68
+ hooks(name: Hook, payload: any, callback?: Function | null): Promise<any>;
69
69
  /**
70
70
  * Get parameters by the given request
71
71
  * @private
@@ -45,7 +45,16 @@ export interface Extension {
45
45
  onRequest?(data: onRequestPayload): Promise<any>;
46
46
  onUpgrade?(data: onUpgradePayload): Promise<any>;
47
47
  }
48
+ export declare type Hook = 'onAuthenticate' | 'onChange' | 'onConnect' | 'onConfigure' |
49
+ /**
50
+ * @deprecated onCreateDocument is deprecated, use onLoadDocument instead
51
+ */
52
+ 'onCreateDocument' | 'onLoadDocument' | 'onDestroy' | 'onDisconnect' | 'onListen' | 'onRequest' | 'onUpgrade';
48
53
  export interface Configuration extends Extension {
54
+ /**
55
+ * A name for the instance, used for logging.
56
+ */
57
+ name: string | null;
49
58
  /**
50
59
  * A list of hocuspocus extenions.
51
60
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-throttle",
3
- "version": "1.0.0-alpha.34",
3
+ "version": "1.0.0-alpha.39",
4
4
  "description": "hocuspocus throttle extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -14,15 +14,20 @@
14
14
  "module": "dist/hocuspocus-throttle.esm.js",
15
15
  "types": "dist/packages/extension-throttle/src/index.d.ts",
16
16
  "exports": {
17
- "import": "./dist/hocuspocus-throttle.esm.js",
18
- "require": "./dist/hocuspocus-throttle.cjs"
17
+ "source": {
18
+ "import": "./src"
19
+ },
20
+ "default": {
21
+ "import": "./dist/hocuspocus-throttle.esm.js",
22
+ "require": "./dist/hocuspocus-throttle.cjs"
23
+ }
19
24
  },
20
25
  "files": [
21
26
  "src",
22
27
  "dist"
23
28
  ],
24
29
  "dependencies": {
25
- "@hocuspocus/server": "^1.0.0-alpha.78"
30
+ "@hocuspocus/server": "^1.0.0-alpha.83"
26
31
  },
27
- "gitHead": "0cc0acea1bbc8ba2106d9b5faa9384f4dc34f57d"
32
+ "gitHead": "0d060abd95ec14eb7e404270e1e2338b2a0db332"
28
33
  }