@dabble/patches 0.5.7 → 0.5.8
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/net/PatchesSync.d.ts +15 -6
- package/dist/net/PatchesSync.js +16 -0
- package/dist/net/index.d.ts +1 -0
- package/dist/net/webrtc/WebRTCAwareness.d.ts +1 -0
- package/dist/net/webrtc/WebRTCTransport.d.ts +1 -0
- package/dist/net/webrtc/index.d.ts +1 -0
- package/dist/net/websocket/PatchesWebSocket.d.ts +1 -0
- package/dist/net/websocket/WebSocketTransport.d.ts +16 -15
- package/dist/net/websocket/WebSocketTransport.js +1 -1
- package/dist/solid/context.d.ts +2 -1
- package/dist/solid/index.d.ts +2 -1
- package/dist/vue/index.d.ts +2 -1
- package/dist/vue/provider.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { JSONRPCClient } from './protocol/JSONRPCClient.js';
|
|
2
1
|
import { Signal } from '../event-signal.js';
|
|
3
|
-
import { SizeCalculator } from '../algorithms/shared/changeBatching.js';
|
|
4
|
-
import { Patches } from '../client/Patches.js';
|
|
5
|
-
import { PatchesStore } from '../client/PatchesStore.js';
|
|
6
|
-
import { SyncingState, Change } from '../types.js';
|
|
7
2
|
import { ConnectionState } from './protocol/types.js';
|
|
3
|
+
import { SyncingState, Change } from '../types.js';
|
|
4
|
+
import { JSONRPCClient } from './protocol/JSONRPCClient.js';
|
|
8
5
|
import { PatchesWebSocket } from './websocket/PatchesWebSocket.js';
|
|
9
6
|
import { WebSocketOptions } from './websocket/WebSocketTransport.js';
|
|
7
|
+
import { SizeCalculator } from '../algorithms/shared/changeBatching.js';
|
|
8
|
+
import { Patches } from '../client/Patches.js';
|
|
9
|
+
import { PatchesStore } from '../client/PatchesStore.js';
|
|
10
10
|
import '../json-patch/JSONPatch.js';
|
|
11
11
|
import '@dabble/delta';
|
|
12
12
|
import '../json-patch/types.js';
|
|
13
|
-
import '../client/PatchesDoc.js';
|
|
14
13
|
import './PatchesClient.js';
|
|
14
|
+
import '../utils/deferred.js';
|
|
15
|
+
import '../client/PatchesDoc.js';
|
|
15
16
|
|
|
16
17
|
interface PatchesSyncState {
|
|
17
18
|
online: boolean;
|
|
@@ -53,6 +54,14 @@ declare class PatchesSync {
|
|
|
53
54
|
docId?: string;
|
|
54
55
|
}) => void>;
|
|
55
56
|
constructor(patches: Patches, url: string, options?: PatchesSyncOptions | undefined);
|
|
57
|
+
/**
|
|
58
|
+
* Gets the URL of the WebSocket connection.
|
|
59
|
+
*/
|
|
60
|
+
get url(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the URL of the WebSocket connection.
|
|
63
|
+
*/
|
|
64
|
+
set url(url: string);
|
|
56
65
|
/**
|
|
57
66
|
* Gets the current sync state.
|
|
58
67
|
*/
|
package/dist/net/PatchesSync.js
CHANGED
|
@@ -50,6 +50,22 @@ class PatchesSync {
|
|
|
50
50
|
patches.onUntrackDocs(this._handleDocsUntracked.bind(this));
|
|
51
51
|
patches.onDeleteDoc(this._handleDocDeleted.bind(this));
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the URL of the WebSocket connection.
|
|
55
|
+
*/
|
|
56
|
+
get url() {
|
|
57
|
+
return this.ws.transport.url;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets the URL of the WebSocket connection.
|
|
61
|
+
*/
|
|
62
|
+
set url(url) {
|
|
63
|
+
this.ws.transport.url = url;
|
|
64
|
+
if (this.state.connected) {
|
|
65
|
+
this.ws.disconnect();
|
|
66
|
+
this.ws.connect();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
53
69
|
/**
|
|
54
70
|
* Gets the current sync state.
|
|
55
71
|
*/
|
package/dist/net/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Signal } from '../../event-signal.js';
|
|
1
|
+
import { Unsubscriber, Signal } from '../../event-signal.js';
|
|
2
|
+
import { Deferred } from '../../utils/deferred.js';
|
|
2
3
|
import { ClientTransport, ConnectionState } from '../protocol/types.js';
|
|
3
4
|
import '../../types.js';
|
|
4
5
|
import '../../json-patch/JSONPatch.js';
|
|
@@ -14,17 +15,17 @@ interface WebSocketOptions {
|
|
|
14
15
|
* Includes automatic reconnection with exponential backoff.
|
|
15
16
|
*/
|
|
16
17
|
declare class WebSocketTransport implements ClientTransport {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
url: string;
|
|
19
|
+
wsOptions?: WebSocketOptions | undefined;
|
|
20
|
+
protected _state: ConnectionState;
|
|
21
|
+
protected ws: WebSocket | null;
|
|
22
|
+
protected reconnectTimer: any;
|
|
23
|
+
protected backoff: number;
|
|
24
|
+
protected connecting: boolean;
|
|
25
|
+
protected connectionDeferred: Deferred | null;
|
|
26
|
+
protected onlineUnsubscriber: Unsubscriber | null;
|
|
26
27
|
/** Flag representing the *intent* to be connected. It is set by `connect()` and cleared by `disconnect()`. */
|
|
27
|
-
|
|
28
|
+
protected shouldBeConnected: boolean;
|
|
28
29
|
/**
|
|
29
30
|
* Signal that emits when the connection state changes.
|
|
30
31
|
* Subscribers will receive the new connection state as an argument.
|
|
@@ -72,17 +73,17 @@ declare class WebSocketTransport implements ClientTransport {
|
|
|
72
73
|
/**
|
|
73
74
|
* Schedules a reconnection attempt using exponential backoff.
|
|
74
75
|
* The backoff time increases with each failed attempt, up to a maximum of 30 seconds.
|
|
75
|
-
* @
|
|
76
|
+
* @protected
|
|
76
77
|
*/
|
|
77
|
-
|
|
78
|
+
protected _scheduleReconnect(): void;
|
|
78
79
|
/**
|
|
79
80
|
* Internal helper that adds (once) listeners for the browser's online/offline
|
|
80
81
|
* events so we can automatically attempt to connect when the network comes
|
|
81
82
|
* back and forcibly close when it goes away.
|
|
82
83
|
*/
|
|
83
|
-
|
|
84
|
+
protected _ensureOnlineOfflineListeners(): void;
|
|
84
85
|
/** Removes previously registered online/offline listeners (if any) */
|
|
85
|
-
|
|
86
|
+
protected _removeOnlineOfflineListeners(): void;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export { type WebSocketOptions, WebSocketTransport };
|
|
@@ -143,7 +143,7 @@ class WebSocketTransport {
|
|
|
143
143
|
/**
|
|
144
144
|
* Schedules a reconnection attempt using exponential backoff.
|
|
145
145
|
* The backoff time increases with each failed attempt, up to a maximum of 30 seconds.
|
|
146
|
-
* @
|
|
146
|
+
* @protected
|
|
147
147
|
*/
|
|
148
148
|
_scheduleReconnect() {
|
|
149
149
|
if (!this.shouldBeConnected || onlineState.isOffline) {
|
package/dist/solid/context.d.ts
CHANGED
|
@@ -9,11 +9,12 @@ import '../json-patch/types.js';
|
|
|
9
9
|
import '../client/PatchesDoc.js';
|
|
10
10
|
import '../algorithms/shared/changeBatching.js';
|
|
11
11
|
import '../client/PatchesStore.js';
|
|
12
|
-
import '../net/protocol/JSONRPCClient.js';
|
|
13
12
|
import '../net/protocol/types.js';
|
|
13
|
+
import '../net/protocol/JSONRPCClient.js';
|
|
14
14
|
import '../net/websocket/PatchesWebSocket.js';
|
|
15
15
|
import '../net/PatchesClient.js';
|
|
16
16
|
import '../net/websocket/WebSocketTransport.js';
|
|
17
|
+
import '../utils/deferred.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Context value containing Patches and optional PatchesSync instances.
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ import '../client/PatchesDoc.js';
|
|
|
12
12
|
import '../algorithms/shared/changeBatching.js';
|
|
13
13
|
import '../client/PatchesStore.js';
|
|
14
14
|
import '../net/PatchesSync.js';
|
|
15
|
-
import '../net/protocol/JSONRPCClient.js';
|
|
16
15
|
import '../net/protocol/types.js';
|
|
16
|
+
import '../net/protocol/JSONRPCClient.js';
|
|
17
17
|
import '../net/websocket/PatchesWebSocket.js';
|
|
18
18
|
import '../net/PatchesClient.js';
|
|
19
19
|
import '../net/websocket/WebSocketTransport.js';
|
|
20
|
+
import '../utils/deferred.js';
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ import '../client/PatchesDoc.js';
|
|
|
12
12
|
import '../algorithms/shared/changeBatching.js';
|
|
13
13
|
import '../client/PatchesStore.js';
|
|
14
14
|
import '../net/PatchesSync.js';
|
|
15
|
-
import '../net/protocol/JSONRPCClient.js';
|
|
16
15
|
import '../net/protocol/types.js';
|
|
16
|
+
import '../net/protocol/JSONRPCClient.js';
|
|
17
17
|
import '../net/websocket/PatchesWebSocket.js';
|
|
18
18
|
import '../net/PatchesClient.js';
|
|
19
19
|
import '../net/websocket/WebSocketTransport.js';
|
|
20
|
+
import '../utils/deferred.js';
|
package/dist/vue/provider.d.ts
CHANGED
|
@@ -9,11 +9,12 @@ import '../json-patch/types.js';
|
|
|
9
9
|
import '../client/PatchesDoc.js';
|
|
10
10
|
import '../algorithms/shared/changeBatching.js';
|
|
11
11
|
import '../client/PatchesStore.js';
|
|
12
|
-
import '../net/protocol/JSONRPCClient.js';
|
|
13
12
|
import '../net/protocol/types.js';
|
|
13
|
+
import '../net/protocol/JSONRPCClient.js';
|
|
14
14
|
import '../net/websocket/PatchesWebSocket.js';
|
|
15
15
|
import '../net/PatchesClient.js';
|
|
16
16
|
import '../net/websocket/WebSocketTransport.js';
|
|
17
|
+
import '../utils/deferred.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Injection key for Patches instance.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
|
|
5
5
|
"author": "Jacob Wright <jacwright@gmail.com>",
|
|
6
6
|
"bugs": {
|
|
@@ -108,4 +108,4 @@
|
|
|
108
108
|
"optional": true
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|