@evolu/common 6.0.1-preview.19 → 6.0.1-preview.20
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/src/Assert.d.ts.map +1 -1
- package/dist/src/Assert.js +1 -1
- package/dist/src/Buffer.d.ts +1 -1
- package/dist/src/Buffer.d.ts.map +1 -1
- package/dist/src/Buffer.js +1 -1
- package/dist/src/CallbackRegistry.d.ts +53 -0
- package/dist/src/CallbackRegistry.d.ts.map +1 -0
- package/dist/src/CallbackRegistry.js +25 -0
- package/dist/src/Console.d.ts +31 -6
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +72 -9
- package/dist/src/Crypto.d.ts +48 -37
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +27 -50
- package/dist/src/Evolu/Db.d.ts +138 -66
- package/dist/src/Evolu/Db.d.ts.map +1 -1
- package/dist/src/Evolu/Db.js +248 -645
- package/dist/src/Evolu/Diff.d.ts +3 -3
- package/dist/src/Evolu/Diff.d.ts.map +1 -1
- package/dist/src/Evolu/Diff.js +7 -5
- package/dist/src/Evolu/Evolu.d.ts +79 -116
- package/dist/src/Evolu/Evolu.d.ts.map +1 -1
- package/dist/src/Evolu/Evolu.js +275 -132
- package/dist/src/Evolu/Internal.d.ts +0 -2
- package/dist/src/Evolu/Internal.d.ts.map +1 -1
- package/dist/src/Evolu/Internal.js +0 -2
- package/dist/src/Evolu/LocalAuth.d.ts +144 -0
- package/dist/src/Evolu/LocalAuth.d.ts.map +1 -0
- package/dist/src/Evolu/LocalAuth.js +171 -0
- package/dist/src/Evolu/Owner.d.ts +129 -83
- package/dist/src/Evolu/Owner.d.ts.map +1 -1
- package/dist/src/Evolu/Owner.js +80 -89
- package/dist/src/Evolu/Platform.d.ts +9 -7
- package/dist/src/Evolu/Platform.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.d.ts +114 -191
- package/dist/src/Evolu/Protocol.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.js +409 -416
- package/dist/src/Evolu/Public.d.ts +6 -8
- package/dist/src/Evolu/Public.d.ts.map +1 -1
- package/dist/src/Evolu/Public.js +2 -3
- package/dist/src/Evolu/PublicKysely.js +3 -3
- package/dist/src/Evolu/Relay.d.ts +1 -2
- package/dist/src/Evolu/Relay.d.ts.map +1 -1
- package/dist/src/Evolu/Relay.js +11 -9
- package/dist/src/Evolu/Schema.d.ts +88 -27
- package/dist/src/Evolu/Schema.d.ts.map +1 -1
- package/dist/src/Evolu/Schema.js +141 -24
- package/dist/src/Evolu/Storage.d.ts +158 -14
- package/dist/src/Evolu/Storage.d.ts.map +1 -1
- package/dist/src/Evolu/Storage.js +32 -32
- package/dist/src/Evolu/Sync.d.ts +77 -13
- package/dist/src/Evolu/Sync.d.ts.map +1 -1
- package/dist/src/Evolu/Sync.js +453 -20
- package/dist/src/Evolu/Timestamp.d.ts +29 -27
- package/dist/src/Evolu/Timestamp.d.ts.map +1 -1
- package/dist/src/Evolu/Timestamp.js +20 -18
- package/dist/src/ManyToManyMap.d.ts +74 -10
- package/dist/src/ManyToManyMap.d.ts.map +1 -1
- package/dist/src/ManyToManyMap.js +41 -6
- package/dist/src/Random.d.ts +3 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/RefCountedResourceManager.d.ts +119 -0
- package/dist/src/RefCountedResourceManager.d.ts.map +1 -0
- package/dist/src/RefCountedResourceManager.js +197 -0
- package/dist/src/Result.d.ts +144 -22
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +5 -2
- package/dist/src/Sqlite.d.ts +20 -4
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +50 -8
- package/dist/src/Task.d.ts +511 -0
- package/dist/src/Task.d.ts.map +1 -0
- package/dist/src/Task.js +410 -0
- package/dist/src/Time.d.ts +59 -0
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +87 -4
- package/dist/src/Type.d.ts +431 -341
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +458 -466
- package/dist/src/WebSocket.d.ts +5 -2
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +12 -13
- package/dist/src/Worker.d.ts +39 -11
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +22 -4
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/package.json +7 -7
- package/src/Assert.ts +2 -4
- package/src/Buffer.ts +1 -1
- package/src/CallbackRegistry.ts +84 -0
- package/src/Console.ts +91 -11
- package/src/Crypto.ts +78 -91
- package/src/Evolu/Db.ts +455 -947
- package/src/Evolu/Diff.ts +7 -5
- package/src/Evolu/Evolu.ts +545 -307
- package/src/Evolu/Internal.ts +0 -2
- package/src/Evolu/LocalAuth.ts +422 -0
- package/src/Evolu/Owner.ts +191 -131
- package/src/Evolu/Platform.ts +9 -9
- package/src/Evolu/Protocol.ts +536 -653
- package/src/Evolu/Public.ts +7 -9
- package/src/Evolu/PublicKysely.ts +3 -3
- package/src/Evolu/Relay.ts +17 -12
- package/src/Evolu/Schema.ts +271 -66
- package/src/Evolu/Storage.ts +263 -55
- package/src/Evolu/Sync.ts +758 -37
- package/src/Evolu/Timestamp.ts +30 -35
- package/src/ManyToManyMap.ts +127 -24
- package/src/Random.ts +3 -2
- package/src/RefCountedResourceManager.ts +368 -0
- package/src/Result.ts +149 -23
- package/src/Sqlite.ts +59 -24
- package/src/Task.ts +779 -0
- package/src/Time.ts +168 -4
- package/src/Type.ts +657 -695
- package/src/WebSocket.ts +23 -17
- package/src/Worker.ts +72 -23
- package/src/index.ts +2 -3
- package/dist/src/Callbacks.d.ts +0 -20
- package/dist/src/Callbacks.d.ts.map +0 -1
- package/dist/src/Callbacks.js +0 -18
- package/dist/src/Evolu/Config.d.ts +0 -82
- package/dist/src/Evolu/Config.d.ts.map +0 -1
- package/dist/src/Evolu/Config.js +0 -9
- package/dist/src/Evolu/Kysely.d.ts +0 -6
- package/dist/src/Evolu/Kysely.d.ts.map +0 -1
- package/dist/src/Evolu/Kysely.js +0 -21
- package/dist/src/NanoId.d.ts +0 -27
- package/dist/src/NanoId.d.ts.map +0 -1
- package/dist/src/NanoId.js +0 -6
- package/dist/src/Promise.d.ts +0 -180
- package/dist/src/Promise.d.ts.map +0 -1
- package/dist/src/Promise.js +0 -176
- package/src/Callbacks.ts +0 -43
- package/src/Evolu/Config.ts +0 -97
- package/src/Evolu/Kysely.ts +0 -38
- package/src/NanoId.ts +0 -39
- package/src/Promise.ts +0 -295
|
@@ -3,15 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Evolu Protocol is a local-first, end-to-end encrypted binary synchronization
|
|
5
5
|
* protocol optimized for minimal size and maximum speed. It enables data sync
|
|
6
|
-
* between a client and a relay
|
|
7
|
-
*
|
|
6
|
+
* between a client and a relay. In the future, direct peer-to-peer (P2P) sync
|
|
7
|
+
* between clients will be possible without a relay.
|
|
8
|
+
*
|
|
9
|
+
* Relays don't need to sync with each other—clients using those relays will
|
|
10
|
+
* sync them eventually. If a relay is offline (e.g., for maintenance), it will
|
|
11
|
+
* sync automatically later via client sync logic. For relay backup using
|
|
12
|
+
* SQLite, see https://sqlite.org/rsync.html (uses a similar algorithm to Evolu
|
|
13
|
+
* RBSR).
|
|
8
14
|
*
|
|
9
15
|
* Evolu Protocol is designed for SQLite but can be extended to any database. It
|
|
10
16
|
* implements [Range-Based Set
|
|
11
17
|
* Reconciliation](https://arxiv.org/abs/2212.13567). To learn how RBSR works,
|
|
12
18
|
* check [Negentropy](https://logperiodic.com/rbsr.html). Evolu Protocol is
|
|
13
19
|
* similar to Negentropy but uses different encoding and also provides data
|
|
14
|
-
* transfer and
|
|
20
|
+
* transfer, ownership, real-time broadcasting, request-response semantics, and
|
|
21
|
+
* error handling.
|
|
15
22
|
*
|
|
16
23
|
* ### Message Structure
|
|
17
24
|
*
|
|
@@ -20,12 +27,15 @@
|
|
|
20
27
|
* | **Header** | |
|
|
21
28
|
* | - {@link protocolVersion} | |
|
|
22
29
|
* | - {@link OwnerId} | {@link Owner} |
|
|
23
|
-
* |
|
|
24
|
-
* |
|
|
25
|
-
* | -
|
|
26
|
-
* | - {@link
|
|
27
|
-
* |
|
|
30
|
+
* | - messageType | {@link MessageType} |
|
|
31
|
+
* | **Request (messageType=0)** | |
|
|
32
|
+
* | - hasWriteKey | 0 = no, 1 = yes |
|
|
33
|
+
* | - {@link OwnerWriteKey} | If hasWriteKey = 1 |
|
|
34
|
+
* | - subscriptionFlag | {@link SubscriptionFlags} |
|
|
35
|
+
* | **Response (messageType=1)** | |
|
|
28
36
|
* | - {@link ProtocolErrorCode} | |
|
|
37
|
+
* | **Broadcast (messageType=2)** | |
|
|
38
|
+
* | - (no additional fields) | |
|
|
29
39
|
* | **Messages** | |
|
|
30
40
|
* | - {@link NonNegativeInt} | A number of messages. |
|
|
31
41
|
* | - {@link EncryptedCrdtMessage} | |
|
|
@@ -35,19 +45,12 @@
|
|
|
35
45
|
*
|
|
36
46
|
* ### WriteKey Validation
|
|
37
47
|
*
|
|
38
|
-
* The initiator sends
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* ### WriteKey Rotation
|
|
45
|
-
*
|
|
46
|
-
* When initiator's {@link WriteKeyMode} is `Rotation`, two WriteKeys are
|
|
47
|
-
* present:
|
|
48
|
-
*
|
|
49
|
-
* 1. Current WriteKey (for validation)
|
|
50
|
-
* 2. New WriteKey (to be stored)
|
|
48
|
+
* The initiator sends a hasWriteKey flag and optionally a WriteKey. The
|
|
49
|
+
* WriteKey is required when sending messages as a secure token proving the
|
|
50
|
+
* initiator can write changes. It's ok to not send a WriteKey if the initiator
|
|
51
|
+
* is only syncing (read-only) and not sending messages. The non-initiator
|
|
52
|
+
* validates the WriteKey immediately after parsing the initiator header, before
|
|
53
|
+
* processing any messages or ranges.
|
|
51
54
|
*
|
|
52
55
|
* ### Synchronization
|
|
53
56
|
*
|
|
@@ -63,18 +66,18 @@
|
|
|
63
66
|
*
|
|
64
67
|
* The **non-initiator always responds** to provide sync completion feedback,
|
|
65
68
|
* even with empty messages containing only the header and no error. This allows
|
|
66
|
-
* the initiator to
|
|
69
|
+
* the initiator to detect when synchronization is complete.
|
|
67
70
|
*
|
|
68
71
|
* Both **Messages** and **Ranges** are optional, allowing each side to send,
|
|
69
72
|
* sync, or only subscribe data as needed.
|
|
70
73
|
*
|
|
71
|
-
* When the initiator sends data, the {@link
|
|
72
|
-
*
|
|
73
|
-
* responds without a {@link
|
|
74
|
-
* signals it wants data. If the non-initiator detects an issue, it
|
|
75
|
-
* error code via the `Error` field in the header back to the
|
|
76
|
-
* relay-to-relay or P2P sync, both sides may require the
|
|
77
|
-
* depending on who is the initiator.
|
|
74
|
+
* When the initiator sends data, the {@link OwnerWriteKey} is required as a
|
|
75
|
+
* secure token proving the initiator can write changes. The non-initiator
|
|
76
|
+
* responds without a {@link OwnerWriteKey}, since the initiator’s request
|
|
77
|
+
* already signals it wants data. If the non-initiator detects an issue, it
|
|
78
|
+
* sends an error code via the `Error` field in the header back to the
|
|
79
|
+
* initiator. In relay-to-relay or P2P sync, both sides may require the
|
|
80
|
+
* {@link OwnerWriteKey} depending on who is the initiator.
|
|
78
81
|
*
|
|
79
82
|
* ### Protocol Errors
|
|
80
83
|
*
|
|
@@ -88,15 +91,21 @@
|
|
|
88
91
|
* - {@link ProtocolUnsupportedVersionError}: Protocol version mismatch.
|
|
89
92
|
* - {@link ProtocolInvalidDataError}: The message is malformed or corrupted.
|
|
90
93
|
*
|
|
91
|
-
* All protocol errors except `ProtocolInvalidDataError` include the `
|
|
94
|
+
* All protocol errors except `ProtocolInvalidDataError` include the `OwnerId`
|
|
92
95
|
* to allow clients to associate errors with the correct owner.
|
|
93
96
|
*
|
|
94
97
|
* ### Message Size Limit
|
|
95
98
|
*
|
|
96
99
|
* The protocol enforces a strict maximum size for all messages, defined by
|
|
97
100
|
* {@link maxProtocolMessageSize}. This ensures every {@link ProtocolMessage} is
|
|
98
|
-
* less than or equal to this limit,
|
|
99
|
-
*
|
|
101
|
+
* less than or equal to this limit, enabling stateless transports, simplified
|
|
102
|
+
* relay implementation, and predictable memory usage. When all messages don't
|
|
103
|
+
* fit within the limit, the protocol automatically continues synchronization in
|
|
104
|
+
* subsequent rounds using range-based reconciliation.
|
|
105
|
+
*
|
|
106
|
+
* Individual database mutations are limited to `maxMutationSize` (640KB), which
|
|
107
|
+
* is smaller than the protocol message limit to ensure efficient sync with
|
|
108
|
+
* {@link maxProtocolMessageRangesSize}.
|
|
100
109
|
*
|
|
101
110
|
* ### Why Binary?
|
|
102
111
|
*
|
|
@@ -104,13 +113,12 @@
|
|
|
104
113
|
*
|
|
105
114
|
* - Encrypted data doesn’t compress well, unlike plain JSON.
|
|
106
115
|
* - Message size must be controlled during creation.
|
|
107
|
-
* - Sequential byte reading is faster than parsing and
|
|
116
|
+
* - Sequential byte reading is faster than parsing and avoids conversions.
|
|
108
117
|
*
|
|
109
118
|
* It uses structure-aware encoding, significantly outperforming generic binary
|
|
110
119
|
* serialization formats with the following optimizations:
|
|
111
120
|
*
|
|
112
121
|
* - **NonNegativeInt:** Up to 33% smaller than MessagePack.
|
|
113
|
-
* - **Base64Url Strings:** Up to 25% size reduction.
|
|
114
122
|
* - **DateIso:** Up to 75% smaller.
|
|
115
123
|
* - **Timestamp Encoding:** Delta encoding for milliseconds and run-length
|
|
116
124
|
* encoding (RLE) for counters and NodeIds.
|
|
@@ -143,14 +151,15 @@
|
|
|
143
151
|
* @module
|
|
144
152
|
*/
|
|
145
153
|
import { NonEmptyReadonlyArray } from "../Array.js";
|
|
154
|
+
import { Brand } from "../Brand.js";
|
|
146
155
|
import { Buffer } from "../Buffer.js";
|
|
147
|
-
import {
|
|
156
|
+
import { EncryptionKey, RandomBytesDep, SymmetricCryptoDecryptError, SymmetricCryptoDep } from "../Crypto.js";
|
|
148
157
|
import { Result } from "../Result.js";
|
|
149
158
|
import { SqliteValue } from "../Sqlite.js";
|
|
150
|
-
import {
|
|
151
|
-
import {
|
|
152
|
-
import {
|
|
153
|
-
import {
|
|
159
|
+
import { NonNegativeInt, PositiveInt } from "../Type.js";
|
|
160
|
+
import { Owner, OwnerId, OwnerWriteKey } from "./Owner.js";
|
|
161
|
+
import { BaseRange, CrdtMessage, DbChange, EncryptedCrdtMessage, EncryptedDbChange, FingerprintRange, RangeType, SkipRange, StorageDep } from "./Storage.js";
|
|
162
|
+
import { NodeId, Timestamp } from "./Timestamp.js";
|
|
154
163
|
/** Maximum size of the entire protocol message in bytes. */
|
|
155
164
|
export declare const maxProtocolMessageSize: PositiveInt;
|
|
156
165
|
/** Maximum size of the ranges in bytes. */
|
|
@@ -159,6 +168,24 @@ export declare const maxProtocolMessageRangesSize: PositiveInt;
|
|
|
159
168
|
export type ProtocolMessage = Uint8Array & Brand<"ProtocolMessage">;
|
|
160
169
|
/** Evolu Protocol version. */
|
|
161
170
|
export declare const protocolVersion: NonNegativeInt;
|
|
171
|
+
export declare const MessageType: {
|
|
172
|
+
/** Request message from initiator (client) to non-initiator (relay). */
|
|
173
|
+
readonly Request: 0;
|
|
174
|
+
/** Response message from non-initiator (relay) to initiator (client). */
|
|
175
|
+
readonly Response: 1;
|
|
176
|
+
/** Broadcast message from non-initiator (relay) to subscribed clients. */
|
|
177
|
+
readonly Broadcast: 2;
|
|
178
|
+
};
|
|
179
|
+
export type MessageType = (typeof MessageType)[keyof typeof MessageType];
|
|
180
|
+
export declare const SubscriptionFlags: {
|
|
181
|
+
/** No subscription changes for this owner. */
|
|
182
|
+
readonly None: 0;
|
|
183
|
+
/** Subscribe to updates for this owner. */
|
|
184
|
+
readonly Subscribe: 1;
|
|
185
|
+
/** Unsubscribe from updates for this owner. */
|
|
186
|
+
readonly Unsubscribe: 2;
|
|
187
|
+
};
|
|
188
|
+
export type SubscriptionFlag = (typeof SubscriptionFlags)[keyof typeof SubscriptionFlags];
|
|
162
189
|
export declare const ProtocolErrorCode: {
|
|
163
190
|
readonly NoError: 0;
|
|
164
191
|
/** A code for {@link ProtocolWriteKeyError}. */
|
|
@@ -169,120 +196,6 @@ export declare const ProtocolErrorCode: {
|
|
|
169
196
|
readonly SyncError: 3;
|
|
170
197
|
};
|
|
171
198
|
type ProtocolErrorCode = (typeof ProtocolErrorCode)[keyof typeof ProtocolErrorCode];
|
|
172
|
-
export declare const WriteKeyMode: {
|
|
173
|
-
readonly None: 0;
|
|
174
|
-
readonly Single: 1;
|
|
175
|
-
readonly Rotation: 2;
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* Evolu Protocol Storage
|
|
179
|
-
*
|
|
180
|
-
* The protocol is agnostic to storage implementation details—any storage can be
|
|
181
|
-
* plugged in, as long as it implements this interface. Implementations must
|
|
182
|
-
* handle their own errors; return values only indicates overall success or
|
|
183
|
-
* failure.
|
|
184
|
-
*/
|
|
185
|
-
export interface Storage {
|
|
186
|
-
readonly getSize: (ownerId: BinaryOwnerId) => NonNegativeInt | null;
|
|
187
|
-
readonly fingerprint: (ownerId: BinaryOwnerId, begin: NonNegativeInt, end: NonNegativeInt) => Fingerprint | null;
|
|
188
|
-
/**
|
|
189
|
-
* Computes fingerprints with their upper bounds in one call.
|
|
190
|
-
*
|
|
191
|
-
* This function can be replaced with many fingerprint/findLowerBound calls,
|
|
192
|
-
* but implementations can leverage it for batching and more efficient
|
|
193
|
-
* fingerprint computation.
|
|
194
|
-
*/
|
|
195
|
-
readonly fingerprintRanges: (ownerId: BinaryOwnerId, buckets: ReadonlyArray<NonNegativeInt>, upperBound?: RangeUpperBound) => ReadonlyArray<FingerprintRange> | null;
|
|
196
|
-
readonly findLowerBound: (ownerId: BinaryOwnerId, begin: NonNegativeInt, end: NonNegativeInt, upperBound: RangeUpperBound) => NonNegativeInt | null;
|
|
197
|
-
readonly iterate: (ownerId: BinaryOwnerId, begin: NonNegativeInt, end: NonNegativeInt, callback: (timestamp: BinaryTimestamp, index: NonNegativeInt) => boolean) => void;
|
|
198
|
-
/** Validates the {@link WriteKey} for the given {@link Owner}. */
|
|
199
|
-
readonly validateWriteKey: (ownerId: BinaryOwnerId, writeKey: WriteKey) => boolean;
|
|
200
|
-
/** Sets the {@link WriteKey} for the given {@link Owner}. */
|
|
201
|
-
readonly setWriteKey: (ownerId: BinaryOwnerId, writeKey: WriteKey) => boolean;
|
|
202
|
-
/** Write encrypted {@link CrdtMessage}s to storage. */
|
|
203
|
-
readonly writeMessages: (ownerId: BinaryOwnerId, messages: NonEmptyReadonlyArray<EncryptedCrdtMessage>) => boolean;
|
|
204
|
-
/** Read encrypted {@link DbChange}s from storage. */
|
|
205
|
-
readonly readDbChange: (ownerId: BinaryOwnerId, timestamp: BinaryTimestamp) => EncryptedDbChange | null;
|
|
206
|
-
/** Delete all data for the given {@link Owner}. */
|
|
207
|
-
readonly deleteOwner: (ownerId: BinaryOwnerId) => boolean;
|
|
208
|
-
}
|
|
209
|
-
export interface StorageDep {
|
|
210
|
-
readonly storage: Storage;
|
|
211
|
-
}
|
|
212
|
-
/** An encrypted {@link CrdtMessage}. */
|
|
213
|
-
export interface EncryptedCrdtMessage {
|
|
214
|
-
readonly timestamp: Timestamp;
|
|
215
|
-
readonly change: EncryptedDbChange;
|
|
216
|
-
}
|
|
217
|
-
/** Encrypted DbChange */
|
|
218
|
-
export type EncryptedDbChange = Uint8Array & Brand<"EncryptedDbChange">;
|
|
219
|
-
/**
|
|
220
|
-
* A CRDT message that combines a unique {@link Timestamp} with a
|
|
221
|
-
* {@link DbChange}.
|
|
222
|
-
*/
|
|
223
|
-
export interface CrdtMessage {
|
|
224
|
-
readonly timestamp: Timestamp;
|
|
225
|
-
readonly change: DbChange;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Base64Url string with maximum length of 256 characters. Encoding strings as
|
|
229
|
-
* Base64UrlString saves up to 25% in size compared to regular strings.
|
|
230
|
-
*/
|
|
231
|
-
export declare const Base64Url256: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", string & Brand<"Base64Url">, string, import("../Type.js").RegexError<"Base64Url">, string, import("../Type.js").StringError>, "MaxLength256", import("../Type.js").MaxLengthError<256>, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">>;
|
|
232
|
-
export type Base64Url256 = typeof Base64Url256.Type;
|
|
233
|
-
/**
|
|
234
|
-
* A DbChange is a change to a table row. Together with a unique
|
|
235
|
-
* {@link Timestamp}, it forms a {@link CrdtMessage}.
|
|
236
|
-
*/
|
|
237
|
-
export declare const DbChange: import("../Type.js").ObjectType<{
|
|
238
|
-
table: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", string & Brand<"Base64Url">, string, import("../Type.js").RegexError<"Base64Url">, string, import("../Type.js").StringError>, "MaxLength256", import("../Type.js").MaxLengthError<256>, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">>;
|
|
239
|
-
id: import("../Type.js").BrandType<import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "Id", import("../Type.js").RegexError<"Id">, import("../Type.js").StringError>;
|
|
240
|
-
values: import("../Type.js").RecordType<"Brand", string & Brand<"Base64Url"> & Brand<"MaxLength256">, string, import("../Type.js").MaxLengthError<256>, string & Brand<"Base64Url">, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]>>;
|
|
241
|
-
}>;
|
|
242
|
-
export type DbChange = typeof DbChange.Type;
|
|
243
|
-
export declare const RangeType: {
|
|
244
|
-
readonly Fingerprint: 1;
|
|
245
|
-
readonly Skip: 0;
|
|
246
|
-
readonly Timestamps: 2;
|
|
247
|
-
};
|
|
248
|
-
export type RangeType = (typeof RangeType)[keyof typeof RangeType];
|
|
249
|
-
export declare const InfiniteUpperBound: unique symbol;
|
|
250
|
-
export type InfiniteUpperBound = typeof InfiniteUpperBound;
|
|
251
|
-
/**
|
|
252
|
-
* Union type for Range's upperBound: either a {@link BinaryTimestamp} or
|
|
253
|
-
* {@link InfiniteUpperBound}.
|
|
254
|
-
*/
|
|
255
|
-
export type RangeUpperBound = BinaryTimestamp | InfiniteUpperBound;
|
|
256
|
-
interface BaseRange {
|
|
257
|
-
readonly upperBound: RangeUpperBound;
|
|
258
|
-
}
|
|
259
|
-
export interface SkipRange extends BaseRange {
|
|
260
|
-
readonly type: typeof RangeType.Skip;
|
|
261
|
-
}
|
|
262
|
-
export interface FingerprintRange extends BaseRange {
|
|
263
|
-
readonly type: typeof RangeType.Fingerprint;
|
|
264
|
-
readonly fingerprint: Fingerprint;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* A cryptographic hash used for efficiently comparing collections of
|
|
268
|
-
* {@link BinaryTimestamp}s.
|
|
269
|
-
*
|
|
270
|
-
* It consists of the first {@link fingerprintSize} bytes of the SHA-256 hash of
|
|
271
|
-
* one or more timestamps.
|
|
272
|
-
*/
|
|
273
|
-
export type Fingerprint = Uint8Array & Brand<"Fingerprint">;
|
|
274
|
-
export declare const fingerprintSize: NonNegativeInt;
|
|
275
|
-
/** A fingerprint of an empty range. */
|
|
276
|
-
export declare const zeroFingerprint: Fingerprint;
|
|
277
|
-
export interface TimestampsRange extends BaseRange {
|
|
278
|
-
readonly type: typeof RangeType.Timestamps;
|
|
279
|
-
readonly timestamps: ReadonlyArray<BinaryTimestamp>;
|
|
280
|
-
}
|
|
281
|
-
export interface TimestampsRangeWithTimestampsBuffer extends BaseRange {
|
|
282
|
-
readonly type: typeof RangeType.Timestamps;
|
|
283
|
-
readonly timestamps: TimestampsBuffer;
|
|
284
|
-
}
|
|
285
|
-
export type Range = SkipRange | FingerprintRange | TimestampsRange;
|
|
286
199
|
export type ProtocolError = ProtocolUnsupportedVersionError | ProtocolInvalidDataError | ProtocolWriteKeyError | ProtocolWriteError | ProtocolSyncError | ProtocolTimestampMismatchError;
|
|
287
200
|
/** Base interface for all protocol errors. */
|
|
288
201
|
export interface ProtocolErrorBase {
|
|
@@ -304,7 +217,7 @@ export interface ProtocolInvalidDataError {
|
|
|
304
217
|
readonly data: globalThis.Uint8Array;
|
|
305
218
|
readonly error: unknown;
|
|
306
219
|
}
|
|
307
|
-
/** Error when a {@link
|
|
220
|
+
/** Error when a {@link OwnerWriteKey} is invalid, missing, or fails validation. */
|
|
308
221
|
export interface ProtocolWriteKeyError extends ProtocolErrorBase {
|
|
309
222
|
readonly type: "ProtocolWriteKeyError";
|
|
310
223
|
}
|
|
@@ -339,11 +252,10 @@ export interface ProtocolTimestampMismatchError {
|
|
|
339
252
|
* ensures all messages will be sent in the next round(s) even over
|
|
340
253
|
* unidirectional and stateless transports.
|
|
341
254
|
*/
|
|
342
|
-
export declare const createProtocolMessageFromCrdtMessages: (deps:
|
|
255
|
+
export declare const createProtocolMessageFromCrdtMessages: (deps: RandomBytesDep & SymmetricCryptoDep) => (owner: Owner, messages: NonEmptyReadonlyArray<CrdtMessage>, maxSize?: PositiveInt) => ProtocolMessage;
|
|
343
256
|
/** Creates a {@link ProtocolMessage} for sync. */
|
|
344
|
-
export declare const createProtocolMessageForSync: (deps: StorageDep) => (ownerId: OwnerId) => ProtocolMessage | null;
|
|
345
|
-
|
|
346
|
-
export declare const createProtocolMessageForWriteKeyRotation: (ownerId: OwnerId, currentWriteKey: WriteKey, newWriteKey: WriteKey) => ProtocolMessage;
|
|
257
|
+
export declare const createProtocolMessageForSync: (deps: StorageDep) => (ownerId: OwnerId, subscriptionFlag?: SubscriptionFlag) => ProtocolMessage | null;
|
|
258
|
+
export declare const createProtocolMessageForUnsubscribe: (ownerId: OwnerId) => ProtocolMessage;
|
|
347
259
|
/**
|
|
348
260
|
* Mutable builder for constructing {@link ProtocolMessage} respecting size
|
|
349
261
|
* limits.
|
|
@@ -362,13 +274,19 @@ export declare const createProtocolMessageBuffer: (ownerId: OwnerId, options: {
|
|
|
362
274
|
readonly rangesMaxSize?: PositiveInt | undefined;
|
|
363
275
|
readonly version?: NonNegativeInt;
|
|
364
276
|
} & ({
|
|
365
|
-
readonly
|
|
366
|
-
|
|
367
|
-
readonly
|
|
277
|
+
readonly messageType: typeof MessageType.Request;
|
|
278
|
+
readonly writeKey?: OwnerWriteKey;
|
|
279
|
+
readonly subscriptionFlag?: SubscriptionFlag;
|
|
368
280
|
} | {
|
|
369
|
-
readonly
|
|
281
|
+
readonly messageType: typeof MessageType.Response;
|
|
370
282
|
readonly errorCode: ProtocolErrorCode;
|
|
283
|
+
} | {
|
|
284
|
+
readonly messageType: typeof MessageType.Broadcast;
|
|
371
285
|
})) => ProtocolMessageBuffer;
|
|
286
|
+
export interface TimestampsRangeWithTimestampsBuffer extends BaseRange {
|
|
287
|
+
readonly type: typeof RangeType.Timestamps;
|
|
288
|
+
readonly timestamps: TimestampsBuffer;
|
|
289
|
+
}
|
|
372
290
|
export interface TimestampsBuffer {
|
|
373
291
|
readonly add: (timestamp: Timestamp) => void;
|
|
374
292
|
readonly addInfinite: () => void;
|
|
@@ -378,51 +296,57 @@ export interface TimestampsBuffer {
|
|
|
378
296
|
}
|
|
379
297
|
export declare const createTimestampsBuffer: () => TimestampsBuffer;
|
|
380
298
|
export interface ApplyProtocolMessageAsClientOptions {
|
|
381
|
-
getWriteKey?: (ownerId: OwnerId) =>
|
|
299
|
+
getWriteKey?: (ownerId: OwnerId) => OwnerWriteKey | null;
|
|
382
300
|
/** For testing purposes only; should not be used in production. */
|
|
383
301
|
version?: NonNegativeInt;
|
|
384
302
|
totalMaxSize?: PositiveInt;
|
|
385
303
|
rangesMaxSize?: PositiveInt;
|
|
386
304
|
}
|
|
387
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Result type for {@link applyProtocolMessageAsClient} that distinguishes
|
|
307
|
+
* between responses to client requests and broadcast messages.
|
|
308
|
+
*/
|
|
309
|
+
export type ApplyProtocolMessageAsClientResult = {
|
|
310
|
+
readonly type: "response";
|
|
311
|
+
readonly message: ProtocolMessage;
|
|
312
|
+
} | {
|
|
313
|
+
readonly type: "no-response";
|
|
314
|
+
} | {
|
|
315
|
+
readonly type: "broadcast";
|
|
316
|
+
};
|
|
317
|
+
export declare const applyProtocolMessageAsClient: (deps: StorageDep) => (inputMessage: Uint8Array, options?: ApplyProtocolMessageAsClientOptions) => Promise<Result<ApplyProtocolMessageAsClientResult, ProtocolInvalidDataError | ProtocolSyncError | ProtocolUnsupportedVersionError | ProtocolWriteError | ProtocolWriteKeyError>>;
|
|
388
318
|
export interface ApplyProtocolMessageAsRelayOptions {
|
|
389
319
|
/** To subscribe an owner for broadcasting. */
|
|
390
320
|
subscribe?: (ownerId: OwnerId) => void;
|
|
321
|
+
/** To unsubscribe an owner from broadcasting. */
|
|
322
|
+
unsubscribe?: (ownerId: OwnerId) => void;
|
|
391
323
|
/** To broadcast a protocol message to all subscribers. */
|
|
392
324
|
broadcast?: (ownerId: OwnerId, message: ProtocolMessage) => void;
|
|
393
325
|
totalMaxSize?: PositiveInt;
|
|
394
326
|
rangesMaxSize?: PositiveInt;
|
|
395
327
|
}
|
|
396
|
-
export declare const applyProtocolMessageAsRelay: (deps: StorageDep) => (inputMessage: Uint8Array, { subscribe, broadcast, totalMaxSize, rangesMaxSize, }?: ApplyProtocolMessageAsRelayOptions,
|
|
397
|
-
/** For testing purposes only; should not be used in production. */
|
|
398
|
-
version?: number & Brand<"Int"> & Brand<"NonNegative">) => Result<ProtocolMessage | null, ProtocolInvalidDataError>;
|
|
399
|
-
/** Binary representation of {@link Id}. */
|
|
400
|
-
export type BinaryId = Uint8Array & Brand<"BinaryId">;
|
|
401
|
-
export declare const binaryIdLength: NonNegativeInt;
|
|
402
|
-
export declare const idToBinaryId: (id: Id) => BinaryId;
|
|
403
|
-
export declare const binaryIdToId: (binaryId: BinaryId) => Id;
|
|
404
|
-
/** Binary representation of {@link OwnerId}. */
|
|
405
|
-
export type BinaryOwnerId = Uint8Array & Brand<"BinaryOwnerId">;
|
|
406
|
-
export declare const ownerIdToBinaryOwnerId: (ownerId: OwnerId) => BinaryOwnerId;
|
|
407
|
-
export declare const binaryOwnerIdToOwnerId: (binaryOwnerId: BinaryOwnerId) => OwnerId;
|
|
408
328
|
/**
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
*
|
|
415
|
-
*
|
|
329
|
+
* Result type for {@link applyProtocolMessageAsRelay}.
|
|
330
|
+
*
|
|
331
|
+
* Unlike {@link ApplyProtocolMessageAsClientResult}, relays always respond with
|
|
332
|
+
* a message to provide sync completion feedback. This ensures the initiator can
|
|
333
|
+
* reliably detect when synchronization is complete, even when there's nothing
|
|
334
|
+
* to sync. Clients may choose not to respond in certain cases (like when they
|
|
335
|
+
* receive broadcast messages or when they lack a write key for syncing).
|
|
416
336
|
*/
|
|
417
|
-
export
|
|
418
|
-
|
|
337
|
+
export interface ApplyProtocolMessageAsRelayResult {
|
|
338
|
+
readonly type: "response";
|
|
339
|
+
readonly message: ProtocolMessage;
|
|
340
|
+
}
|
|
341
|
+
export declare const applyProtocolMessageAsRelay: (deps: StorageDep) => (inputMessage: Uint8Array, options?: ApplyProtocolMessageAsRelayOptions,
|
|
342
|
+
/** For testing purposes only; should not be used in production. */
|
|
343
|
+
version?: number & Brand<"Int"> & Brand<"NonNegative">) => Promise<Result<ApplyProtocolMessageAsRelayResult, ProtocolInvalidDataError>>;
|
|
419
344
|
/**
|
|
420
345
|
* Evolu uses MessagePack to handle all number variants except for
|
|
421
346
|
* NonNegativeInt. For NonNegativeInt, Evolu provides more efficient encoding.
|
|
422
347
|
*/
|
|
423
348
|
export declare const encodeNumber: (buffer: Buffer, number: number) => void;
|
|
424
349
|
export declare const decodeNumber: (buffer: Buffer) => number;
|
|
425
|
-
export declare const binaryTimestampToFingerprint: (timestamp: BinaryTimestamp) => Fingerprint;
|
|
426
350
|
/**
|
|
427
351
|
* Encodes and encrypts a {@link DbChange} using the provided owner's encryption
|
|
428
352
|
* key. Returns an encrypted binary representation as {@link EncryptedDbChange}.
|
|
@@ -457,16 +381,15 @@ export declare const encodeString: (buffer: Buffer, value: string) => void;
|
|
|
457
381
|
export declare const decodeString: (buffer: Buffer) => string;
|
|
458
382
|
export declare const encodeNodeId: (buffer: Buffer, nodeId: NodeId) => void;
|
|
459
383
|
export declare const decodeNodeId: (buffer: Buffer) => NodeId;
|
|
460
|
-
export declare const encodeBase64Url256: (buffer: Buffer, string: Base64Url256Variant) => void;
|
|
461
|
-
export declare const decodeBase64Url256WithLength: (buffer: Buffer) => Base64Url256;
|
|
462
384
|
export declare const ProtocolValueType: {
|
|
463
385
|
readonly String: NonNegativeInt;
|
|
464
386
|
readonly Number: NonNegativeInt;
|
|
465
387
|
readonly Null: NonNegativeInt;
|
|
466
|
-
readonly
|
|
467
|
-
readonly Id: NonNegativeInt;
|
|
468
|
-
readonly Base64Url256: NonNegativeInt;
|
|
388
|
+
readonly Bytes: NonNegativeInt;
|
|
469
389
|
readonly NonNegativeInt: NonNegativeInt;
|
|
390
|
+
readonly EmptyString: NonNegativeInt;
|
|
391
|
+
readonly Base64Url: NonNegativeInt;
|
|
392
|
+
readonly Id: NonNegativeInt;
|
|
470
393
|
readonly Json: NonNegativeInt;
|
|
471
394
|
readonly DateIsoWithNonNegativeTime: NonNegativeInt;
|
|
472
395
|
readonly DateIsoWithNegativeTime: NonNegativeInt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.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