@hocuspocus/extension-database 1.0.0-alpha.13 → 1.0.0-alpha.14

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.
@@ -50,11 +50,12 @@ export declare class Collector {
50
50
  documents(): {};
51
51
  info(): Promise<{
52
52
  configuration: Partial<Configuration>;
53
- ipAddress: string;
53
+ ipAddress: string | null;
54
54
  nodeVersion: string;
55
55
  platform: NodeJS.Platform;
56
56
  started: string;
57
57
  version: string;
58
58
  }>;
59
+ private getIpAddress;
59
60
  private static readableYDoc;
60
61
  }
@@ -1,6 +1,6 @@
1
1
  import RedisClient from 'ioredis';
2
2
  import Redlock from 'redlock';
3
- import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, Debugger, onConfigurePayload } from '@hocuspocus/server';
3
+ import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
4
4
  export interface Configuration {
5
5
  /**
6
6
  * Redis port
@@ -46,7 +46,7 @@ export declare class Redis implements Extension {
46
46
  logger: Debugger;
47
47
  constructor(configuration: Partial<Configuration>);
48
48
  onConfigure({ instance }: onConfigurePayload): Promise<void>;
49
- onListen(): Promise<void>;
49
+ onListen({ configuration }: onListenPayload): Promise<void>;
50
50
  private getKey;
51
51
  private pubKey;
52
52
  private subKey;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import WebSocket, { AddressInfo, WebSocketServer } from 'ws';
3
3
  import { IncomingMessage, Server as HTTPServer } from 'http';
4
- import { Configuration, Hook } from './types';
4
+ import { Configuration, HookName, HookPayload } from './types';
5
5
  import Document from './Document';
6
6
  import { Debugger } from './Debugger';
7
7
  import { onListenPayload } from '.';
@@ -88,7 +88,7 @@ export declare class Hocuspocus {
88
88
  * Run the given hook on all configured extensions.
89
89
  * Runs the given callback after each hook.
90
90
  */
91
- hooks(name: Hook, payload: any, callback?: Function | null): Promise<any>;
91
+ hooks(name: HookName, payload: HookPayload, callback?: Function | null): Promise<any>;
92
92
  /**
93
93
  * Get parameters by the given request
94
94
  */
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
3
3
  import { URLSearchParams } from 'url';
4
- import { Socket } from 'net';
5
4
  import { Awareness } from 'y-protocols/awareness';
6
5
  import Document from './Document';
7
6
  import { Hocuspocus } from './Hocuspocus';
@@ -44,11 +43,12 @@ export interface Extension {
44
43
  onDisconnect?(data: onDisconnectPayload): Promise<any>;
45
44
  onDestroy?(data: onDestroyPayload): Promise<any>;
46
45
  }
47
- export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
46
+ export declare type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
48
47
  /**
49
48
  * @deprecated onCreateDocument is deprecated, use onLoadDocument instead
50
49
  */
51
50
  'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'onDestroy';
51
+ export declare type HookPayload = onConfigurePayload | onListenPayload | onUpgradePayload | onConnectPayload | connectedPayload | onAuthenticatePayload | onLoadDocumentPayload | onLoadDocumentPayload | onLoadDocumentPayload | onChangePayload | onStoreDocumentPayload | afterStoreDocumentPayload | onAwarenessUpdatePayload | onRequestPayload | onDisconnectPayload | onDestroyPayload;
52
52
  export interface Configuration extends Extension {
53
53
  /**
54
54
  * A name for the instance, used for logging.
@@ -198,19 +198,21 @@ export interface onRequestPayload {
198
198
  instance: Hocuspocus;
199
199
  }
200
200
  export interface onUpgradePayload {
201
- head: any;
202
201
  request: IncomingMessage;
203
- socket: Socket;
202
+ socket: any;
203
+ head: any;
204
204
  instance: Hocuspocus;
205
205
  }
206
206
  export interface onListenPayload {
207
+ instance: Hocuspocus;
208
+ configuration: Configuration;
207
209
  port: number;
208
210
  }
209
211
  export interface onDestroyPayload {
210
212
  instance: Hocuspocus;
211
213
  }
212
214
  export interface onConfigurePayload {
215
+ instance: Hocuspocus;
213
216
  configuration: Configuration;
214
217
  version: string;
215
- instance: Hocuspocus;
216
218
  }
@@ -2,6 +2,7 @@ export * from './createDirectory';
2
2
  export * from './flushRedis';
3
3
  export * from './newHocuspocus';
4
4
  export * from './newHocuspocusProvider';
5
+ export * from './randomInteger';
5
6
  export * from './redisConnectionSettings';
6
7
  export * from './removeDirectory';
7
8
  export * from './sleep';
@@ -0,0 +1 @@
1
+ export declare const randomInteger: (min: number, max: number) => number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-database",
3
3
  "description": "a generic Hocuspocus persistence driver for the database",
4
- "version": "1.0.0-alpha.13",
4
+ "version": "1.0.0-alpha.14",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
7
7
  "hocuspocus",
@@ -26,11 +26,11 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@hocuspocus/server": "^1.0.0-alpha.99",
29
+ "@hocuspocus/server": "^1.0.0-alpha.100",
30
30
  "yjs": "^13.5.29"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "e26a5eeaa9278b9587d4b475cec53bf14bc569b9"
35
+ "gitHead": "29d403cdc2b972cf3129229abcaceb08e365fbb4"
36
36
  }