@hocuspocus/provider 2.0.5 → 2.1.0-alpha.0

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.
@@ -1,7 +1,6 @@
1
- import RedisClient, { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
2
- import Redlock from 'redlock';
3
- import { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, onListenPayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
4
- export type RedisInstance = RedisClient.Cluster | RedisClient.Redis;
1
+ import RedisClient, { ClusterNode, ClusterOptions, RedisOptions, Cluster as RedisClusterClient } from 'ioredis';
2
+ import { Extension, afterLoadDocumentPayload, onDisconnectPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
3
+ export type RedisInstance = RedisClient | RedisClusterClient;
5
4
  export interface Configuration {
6
5
  /**
7
6
  * Redis port
@@ -38,10 +37,6 @@ export interface Configuration {
38
37
  * Namespace for Redis keys, if none is provided 'hocuspocus' is used
39
38
  */
40
39
  prefix: string;
41
- /**
42
- * The maximum time for the Redis lock in ms (in case it can’t be released).
43
- */
44
- lockTimeout: number;
45
40
  /**
46
41
  * A delay before onDisconnect is executed. This allows last minute updates'
47
42
  * sync messages to be received by the subscription before it's closed.
@@ -59,16 +54,12 @@ export declare class Redis implements Extension {
59
54
  pub: RedisInstance;
60
55
  sub: RedisInstance;
61
56
  instance: Hocuspocus;
62
- redlock: Redlock;
63
- locks: Map<string, Redlock.Lock>;
64
57
  logger: Debugger;
65
58
  constructor(configuration: Partial<Configuration>);
66
59
  onConfigure({ instance }: onConfigurePayload): Promise<void>;
67
- onListen({ configuration }: onListenPayload): Promise<void>;
68
60
  private getKey;
69
61
  private pubKey;
70
62
  private subKey;
71
- private lockKey;
72
63
  /**
73
64
  * Once a document is laoded, subscribe to the channel in Redis.
74
65
  */
@@ -81,15 +72,6 @@ export declare class Redis implements Extension {
81
72
  * Let’s ask Redis who is connected already.
82
73
  */
83
74
  private requestAwarenessFromOtherInstances;
84
- /**
85
- * Before the document is stored, make sure to set a lock in Redis.
86
- * That’s meant to avoid conflicts with other instances trying to store the document.
87
- */
88
- onStoreDocument({ documentName }: onStoreDocumentPayload): Promise<unknown>;
89
- /**
90
- * Release the Redis lock, so other instances can store documents.
91
- */
92
- afterStoreDocument({ documentName }: afterStoreDocumentPayload): Promise<void>;
93
75
  /**
94
76
  * Handle awareness update messages received directly by this Hocuspocus instance.
95
77
  */
@@ -110,8 +92,4 @@ export declare class Redis implements Extension {
110
92
  */
111
93
  onDisconnect: ({ documentName }: onDisconnectPayload) => Promise<void>;
112
94
  beforeBroadcastStateless(data: beforeBroadcastStatelessPayload): Promise<number>;
113
- /**
114
- * Kill the Redlock connection immediately.
115
- */
116
- onDestroy(): Promise<void>;
117
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/provider",
3
- "version": "2.0.5",
3
+ "version": "2.1.0-alpha.0",
4
4
  "description": "hocuspocus provider",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@hocuspocus/common": "^2.0.5",
31
+ "@hocuspocus/common": "^2.1.0-alpha.0",
32
32
  "@lifeomic/attempt": "^3.0.2",
33
33
  "lib0": "^0.2.47",
34
34
  "ws": "^7.5.9"