@evolu/common 8.17.0 → 8.18.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.
- package/dist/src/Bytes.d.ts +31 -14
- package/dist/src/Bytes.d.ts.map +1 -1
- package/dist/src/Bytes.js +48 -8
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +5 -1
- package/dist/src/Polyfills.d.ts.map +1 -1
- package/dist/src/Polyfills.js +3 -2
- package/dist/src/Task.d.ts +4 -3
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +4 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +18 -7
- package/dist/src/local-first/Evolu.d.ts +10 -1
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +5 -1
- package/dist/src/local-first/Protocol.d.ts +215 -93
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +799 -489
- package/dist/src/local-first/Relay.d.ts +9 -1
- package/dist/src/local-first/Relay.d.ts.map +1 -1
- package/dist/src/local-first/Relay.js +41 -36
- package/dist/src/local-first/Shared.d.ts +75 -49
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +62 -42
- package/dist/src/local-first/Storage.d.ts +80 -18
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +20 -4
- package/package.json +1 -1
- package/src/Bytes.test.ts +212 -0
- package/src/Bytes.ts +67 -17
- package/src/Error.ts +5 -1
- package/src/Polyfills.ts +3 -2
- package/src/Task.ts +4 -3
- package/src/local-first/Db.ts +29 -14
- package/src/local-first/Evolu.test.ts +43 -12
- package/src/local-first/Evolu.ts +16 -2
- package/src/local-first/Protocol.test.ts +1541 -44
- package/src/local-first/Protocol.ts +1070 -605
- package/src/local-first/Relay.ts +80 -69
- package/src/local-first/Shared.ts +106 -67
- package/src/local-first/Storage.ts +100 -27
|
@@ -43,14 +43,24 @@
|
|
|
43
43
|
* | - {@link NonNegativeInt} | Number of ranges. |
|
|
44
44
|
* | - {@link Range} | |
|
|
45
45
|
*
|
|
46
|
+
* Range upper bounds must not decrease. The last range always has
|
|
47
|
+
* {@link InfiniteUpperBound}, which is not encoded. A message with decreasing
|
|
48
|
+
* bounds, or with a hasWriteKey or subscriptionFlag value not listed above, is
|
|
49
|
+
* rejected as {@link ProtocolInvalidDataError}. So is a request with a change
|
|
50
|
+
* shorter than 41 bytes, the smallest {@link EncryptedDbChange}. A client passes
|
|
51
|
+
* such a change to storage, which skips a change it cannot read.
|
|
52
|
+
*
|
|
46
53
|
* ## WriteKey validation
|
|
47
54
|
*
|
|
48
55
|
* The initiator sends a hasWriteKey flag and optionally a WriteKey. The
|
|
49
56
|
* WriteKey is required when sending messages as a secure token proving the
|
|
50
57
|
* initiator can write changes. It's ok to not send a WriteKey if the initiator
|
|
51
58
|
* is only syncing (read-only) and not sending messages. The non-initiator
|
|
52
|
-
*
|
|
53
|
-
*
|
|
59
|
+
* decodes the whole request first and then validates the WriteKey, before
|
|
60
|
+
* storing any messages or reconciling ranges. Only the subscriptionFlag takes
|
|
61
|
+
* effect before that, because subscribing needs no WriteKey: broadcasts carry
|
|
62
|
+
* only encrypted changes. So a request rejected with
|
|
63
|
+
* {@link ProtocolWriteKeyError} still changes its subscription.
|
|
54
64
|
*
|
|
55
65
|
* ## Synchronization
|
|
56
66
|
*
|
|
@@ -64,9 +74,14 @@
|
|
|
64
74
|
* if further sync is needed or possible, continuing until both sides are
|
|
65
75
|
* synchronized.
|
|
66
76
|
*
|
|
67
|
-
* The **non-initiator
|
|
68
|
-
* even with empty messages containing only the header and
|
|
69
|
-
* the initiator to detect when synchronization is
|
|
77
|
+
* The **non-initiator answers every request it can decode** to provide sync
|
|
78
|
+
* completion feedback, even with empty messages containing only the header and
|
|
79
|
+
* no error. This allows the initiator to detect when synchronization is
|
|
80
|
+
* complete. A request it cannot decode, or one larger than the relay's
|
|
81
|
+
* `totalMaxSize`, gets no answer and has no effect.
|
|
82
|
+
*
|
|
83
|
+
* Ranges are compared by their {@link Fingerprint}, which anyone who can write
|
|
84
|
+
* for an owner can make collide. Its documentation describes the consequences.
|
|
70
85
|
*
|
|
71
86
|
* Both **Messages** and **Ranges** are optional, allowing each side to send,
|
|
72
87
|
* sync, or only subscribe data as needed.
|
|
@@ -81,18 +96,35 @@
|
|
|
81
96
|
*
|
|
82
97
|
* ## Protocol errors
|
|
83
98
|
*
|
|
84
|
-
*
|
|
99
|
+
* A Response carries a {@link ProtocolErrorCode} in its header. The initiator
|
|
100
|
+
* reports every code except `NoError` as an error with the `OwnerId`:
|
|
85
101
|
*
|
|
86
|
-
* - {@link ProtocolWriteKeyError}: The
|
|
87
|
-
*
|
|
102
|
+
* - {@link ProtocolWriteKeyError}: The WriteKey is invalid, or missing from a
|
|
103
|
+
* request with messages.
|
|
104
|
+
* - {@link ProtocolWriteError}: The relay failed to store the messages or to
|
|
105
|
+
* validate the WriteKey.
|
|
88
106
|
* - {@link ProtocolQuotaError}: Storage or billing quota exceeded.
|
|
89
|
-
* - {@link ProtocolSyncError}:
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
107
|
+
* - {@link ProtocolSyncError}: The relay's storage failed while it reconciled the
|
|
108
|
+
* ranges.
|
|
109
|
+
*
|
|
110
|
+
* The initiator also reports {@link ProtocolVersionError}, with the `OwnerId`,
|
|
111
|
+
* for a reply of another version, and {@link ProtocolInvalidDataError}, without
|
|
112
|
+
* it, for a message it cannot decode, including one with an unknown code.
|
|
113
|
+
*
|
|
114
|
+
* A relay answers every request it can decode within its `totalMaxSize`. It
|
|
115
|
+
* decodes a whole request before acting on it, so for a malformed one it
|
|
116
|
+
* returns `ProtocolInvalidDataError` without subscribing, storing, or
|
|
117
|
+
* broadcasting anything, and sends no reply. When its storage throws while
|
|
118
|
+
* validating the WriteKey, for example because SQLite cannot store a new
|
|
119
|
+
* owner's key on a full disk, the relay logs the error and answers with
|
|
120
|
+
* `ProtocolWriteError`, like a failed write. Likewise, a client applies nothing
|
|
121
|
+
* from a message it cannot decode.
|
|
122
|
+
*
|
|
123
|
+
* {@link decryptAndDecodeDbChange} returns `ProtocolInvalidDataError`,
|
|
124
|
+
* {@link ProtocolTimestampMismatchError}, or
|
|
125
|
+
* {@link DecryptWithXChaCha20Poly1305Error} for a change it cannot read. These
|
|
126
|
+
* describe a change rather than a protocol message, and client storage skips
|
|
127
|
+
* such a change.
|
|
96
128
|
*
|
|
97
129
|
* ## Message size limit
|
|
98
130
|
*
|
|
@@ -105,7 +137,10 @@
|
|
|
105
137
|
*
|
|
106
138
|
* Each mutation is limited to {@link maxMutationSize}, so every change fits one
|
|
107
139
|
* message of {@link defaultProtocolMessageMaxSize} next to the largest ranges
|
|
108
|
-
* section.
|
|
140
|
+
* section. Changes saved before that limit existed, and crafted changes a relay
|
|
141
|
+
* stores, can be larger. Sync skips a stored change that cannot fit an empty
|
|
142
|
+
* message after a pending Skip range, which is the message a later round is
|
|
143
|
+
* guaranteed to reach, and reports it as a {@link ProtocolChangeTooLargeError}.
|
|
109
144
|
*
|
|
110
145
|
* ## Why Binary?
|
|
111
146
|
*
|
|
@@ -129,24 +164,18 @@
|
|
|
129
164
|
*
|
|
130
165
|
* ## Versioning
|
|
131
166
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* **How version negotiation works:**
|
|
167
|
+
* Every message of every protocol version begins with the version and the
|
|
168
|
+
* `OwnerId`, so a peer can route and report a message of any version. Nothing
|
|
169
|
+
* negotiates a version, and no side falls back to the other's.
|
|
137
170
|
*
|
|
138
|
-
* -
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* and handle it appropriately (e.g., prompt for an update or halt sync).
|
|
147
|
-
*
|
|
148
|
-
* Version negotiation is per-owner, allowing Evolu Protocol to evolve safely
|
|
149
|
-
* over time and provide clear feedback about version mismatches.
|
|
171
|
+
* A non-initiator answers a request of another version with only its own
|
|
172
|
+
* version and that `OwnerId`. The initiator reports it as
|
|
173
|
+
* {@link ProtocolVersionError} for that owner, whose `isInitiator` tells which
|
|
174
|
+
* side is older, and stops syncing the owner through that relay. Clients from
|
|
175
|
+
* `@evolu/common` 8.0.0 before 8.11.0 drop that reply and stop syncing the
|
|
176
|
+
* owner through that relay without reporting anything, while 7.x clients report
|
|
177
|
+
* it as a `ProtocolVersionError`. So a relay that moves to another version must
|
|
178
|
+
* keep answering version 1 while such clients remain.
|
|
150
179
|
*
|
|
151
180
|
* ## Credible exit
|
|
152
181
|
*
|
|
@@ -180,33 +209,38 @@ import { type DecryptWithXChaCha20Poly1305Error, EncryptionKey, type RandomBytes
|
|
|
180
209
|
import { type Result } from "../Result.ts";
|
|
181
210
|
import type { SqliteValue } from "../Sqlite.ts";
|
|
182
211
|
import { type Task } from "../Task.ts";
|
|
183
|
-
import { NonNegativeInt, PositiveInt, type Typed } from "../Type.ts";
|
|
212
|
+
import { NonNegativeInt, type PositiveInt, type Typed } from "../Type.ts";
|
|
184
213
|
import { type Owner, type OwnerError, OwnerId, OwnerWriteKey } from "./Owner.ts";
|
|
185
214
|
import { type BaseRange, type CrdtMessage, DbChange, type EncryptedCrdtMessage, type EncryptedDbChange, type FingerprintRange, RangeType, type SkipRange, type StorageDep, type StorageWriteMessagesError } from "./Storage.ts";
|
|
186
215
|
import { Timestamp } from "./Timestamp.ts";
|
|
187
216
|
/**
|
|
188
|
-
* Protocol message maximum size.
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
217
|
+
* Protocol message maximum size, from 1MB to 100MB.
|
|
218
|
+
*
|
|
219
|
+
* A message never exceeds its maximum size, inclusive. Builders measure each
|
|
220
|
+
* write exactly and keep room to close the message (see
|
|
221
|
+
* {@link ProtocolMessageBuffer.tryWrite}), and sync sends what does not fit in
|
|
222
|
+
* later rounds.
|
|
223
|
+
*
|
|
224
|
+
* Clients send at most {@link defaultProtocolMessageMaxSize} and enforce no
|
|
225
|
+
* receive limit. A relay can answer with larger messages, configured with the
|
|
226
|
+
* `totalMaxSize` option of {@link applyProtocolMessageAsRelay}, to reduce
|
|
227
|
+
* roundtrips for large syncs. Clients must not send larger messages, because
|
|
228
|
+
* relays accept at most the default: the Node.js relay closes the connection on
|
|
229
|
+
* a larger one, and relays up to `@evolu/nodejs` 4.0.0 crash on it.
|
|
230
|
+
*
|
|
231
|
+
* The default cannot be smaller either. Deployed clients send messages of that
|
|
232
|
+
* size, a change within {@link maxMutationSize} fits one message next to the
|
|
233
|
+
* largest ranges section, and changes saved before that limit existed, which
|
|
234
|
+
* can be nearly as large as a message, must stay servable.
|
|
202
235
|
*/
|
|
203
236
|
export declare const ProtocolMessageMaxSize: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Number", number, number, import("../Type.ts").TypeOfError<"Number">, null, import("../Type.ts").TypeOfError<"Number">, never, number, true>, "NonNaN", import("../Type.ts").NonNaNError>, "Finite", import("../Type.ts").FiniteError>, "Int", import("../Type.ts").IntError>, "Between1000000-100000000", import("../Type.ts").BetweenError<1000000, 100000000>>;
|
|
204
237
|
export type ProtocolMessageMaxSize = typeof ProtocolMessageMaxSize.Output;
|
|
205
238
|
/**
|
|
206
239
|
* Default {@link ProtocolMessageMaxSize} (1MB).
|
|
207
240
|
*
|
|
208
|
-
* The standard size used across Evolu implementations.
|
|
209
|
-
*
|
|
241
|
+
* The standard size used across Evolu implementations. Clients send at most
|
|
242
|
+
* this size, and relays accept it. Relays with more resources can answer with
|
|
243
|
+
* larger messages to reduce roundtrips.
|
|
210
244
|
*/
|
|
211
245
|
export declare const defaultProtocolMessageMaxSize: ProtocolMessageMaxSize;
|
|
212
246
|
/**
|
|
@@ -218,7 +252,8 @@ export declare const defaultProtocolMessageMaxSize: ProtocolMessageMaxSize;
|
|
|
218
252
|
*
|
|
219
253
|
* The upper bound is set to ensure ranges fit within the default 1MB
|
|
220
254
|
* {@link defaultProtocolMessageMaxSize}, maintaining compatibility between all
|
|
221
|
-
* clients and relays.
|
|
255
|
+
* clients and relays. A received message whose ranges section exceeds twice the
|
|
256
|
+
* upper bound is rejected as {@link ProtocolInvalidDataError}.
|
|
222
257
|
*/
|
|
223
258
|
export declare const ProtocolMessageRangesMaxSize: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Number", number, number, import("../Type.ts").TypeOfError<"Number">, null, import("../Type.ts").TypeOfError<"Number">, never, number, true>, "NonNaN", import("../Type.ts").NonNaNError>, "Finite", import("../Type.ts").FiniteError>, "Int", import("../Type.ts").IntError>, "Between3000-100000", import("../Type.ts").BetweenError<3000, 100000>>;
|
|
224
259
|
export type ProtocolMessageRangesMaxSize = typeof ProtocolMessageRangesMaxSize.Output;
|
|
@@ -273,6 +308,14 @@ export declare const SubscriptionFlags: {
|
|
|
273
308
|
readonly Unsubscribe: 2;
|
|
274
309
|
};
|
|
275
310
|
export type SubscriptionFlag = (typeof SubscriptionFlags)[keyof typeof SubscriptionFlags];
|
|
311
|
+
/**
|
|
312
|
+
* The error code in the header of a Response.
|
|
313
|
+
*
|
|
314
|
+
* A client reports a code it does not know as {@link ProtocolInvalidDataError},
|
|
315
|
+
* which carries no `OwnerId`, and that relay's round for the owner ends. Every
|
|
316
|
+
* released client does this, so a relay can add a code under the same
|
|
317
|
+
* {@link protocolVersion} only where that outcome is acceptable.
|
|
318
|
+
*/
|
|
276
319
|
export declare const ProtocolErrorCode: {
|
|
277
320
|
readonly NoError: 0;
|
|
278
321
|
/** A code for {@link ProtocolWriteKeyError}. */
|
|
@@ -284,7 +327,7 @@ export declare const ProtocolErrorCode: {
|
|
|
284
327
|
/** A code for {@link ProtocolSyncError}. */
|
|
285
328
|
readonly SyncError: 4;
|
|
286
329
|
};
|
|
287
|
-
type ProtocolErrorCode = (typeof ProtocolErrorCode)[keyof typeof ProtocolErrorCode];
|
|
330
|
+
export type ProtocolErrorCode = (typeof ProtocolErrorCode)[keyof typeof ProtocolErrorCode];
|
|
288
331
|
export type ProtocolError = ProtocolVersionError | ProtocolInvalidDataError | ProtocolWriteKeyError | ProtocolWriteError | ProtocolSyncError | ProtocolQuotaError | ProtocolTimestampMismatchError;
|
|
289
332
|
/**
|
|
290
333
|
* Represents a version mismatch in the Evolu Protocol. Occurs when the
|
|
@@ -295,7 +338,16 @@ export interface ProtocolVersionError extends OwnerError, Typed<"ProtocolVersion
|
|
|
295
338
|
/** Indicates which side is obsolete and should update. */
|
|
296
339
|
readonly isInitiator: boolean;
|
|
297
340
|
}
|
|
298
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* Error for a malformed {@link ProtocolMessage} or {@link EncryptedDbChange},
|
|
343
|
+
* with its bytes as `data` and the decoding error as `error`.
|
|
344
|
+
*
|
|
345
|
+
* A protocol message is decoded whole before any of it is applied, so a
|
|
346
|
+
* malformed one has no effect, and a relay does not reply to it. A message of a
|
|
347
|
+
* type its receiver does not accept, such as a Request sent to a client, is
|
|
348
|
+
* malformed too. A throw while applying a decoded message is a defect, not this
|
|
349
|
+
* error.
|
|
350
|
+
*/
|
|
299
351
|
export interface ProtocolInvalidDataError extends Typed<"ProtocolInvalidDataError"> {
|
|
300
352
|
readonly data: Uint8Array;
|
|
301
353
|
readonly error: unknown;
|
|
@@ -342,12 +394,39 @@ export interface ProtocolTimestampMismatchError extends Typed<"ProtocolTimestamp
|
|
|
342
394
|
readonly expected: Timestamp;
|
|
343
395
|
readonly timestamp: Timestamp;
|
|
344
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Error for a stored change that sync skipped because it cannot fit an empty
|
|
399
|
+
* {@link ProtocolMessage} after a pending Skip range, which is the message a
|
|
400
|
+
* later round is guaranteed to reach.
|
|
401
|
+
*
|
|
402
|
+
* Every change within {@link maxMutationSize} fits. Larger ones are changes
|
|
403
|
+
* saved before that limit existed and crafted changes a relay stores. A change
|
|
404
|
+
* up to 22 bytes too large for that message can still fit one without a pending
|
|
405
|
+
* skip, so sync may send it, sometimes after reporting it, but usually reports
|
|
406
|
+
* it in every sync like a larger one. With
|
|
407
|
+
* {@link defaultProtocolMessageMaxSize}, PADMÉ padding leaves no honest change
|
|
408
|
+
* size in that 22-byte window.
|
|
409
|
+
*
|
|
410
|
+
* An answer to a Timestamps range neither sends nor lists a skipped change, so
|
|
411
|
+
* range fingerprints keep disagreeing about it. A request or a split still
|
|
412
|
+
* lists its timestamp, so a peer that lacks it may ask for it once per sync and
|
|
413
|
+
* gets an answer without it. Every sync narrows the fingerprints to it, skips
|
|
414
|
+
* it again, and ends.
|
|
415
|
+
*/
|
|
416
|
+
export interface ProtocolChangeTooLargeError extends Typed<"ProtocolChangeTooLargeError"> {
|
|
417
|
+
readonly timestamp: Timestamp;
|
|
418
|
+
/** The length of the encrypted change in bytes. */
|
|
419
|
+
readonly size: PositiveInt;
|
|
420
|
+
}
|
|
345
421
|
/**
|
|
346
422
|
* Creates a {@link ProtocolMessage} from CRDT messages.
|
|
347
423
|
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
424
|
+
* The message holds the leading CRDT messages that fit `maxSize`, by default
|
|
425
|
+
* {@link defaultProtocolMessageMaxSize}, measured exactly. When one does not
|
|
426
|
+
* fit, it and the rest are left out, and the message ends with a range that
|
|
427
|
+
* makes the non-initiator answer with ranges. Sync then sends them in later
|
|
428
|
+
* rounds, even over unidirectional and stateless transports, because every
|
|
429
|
+
* change within {@link maxMutationSize} fits an empty message.
|
|
351
430
|
*/
|
|
352
431
|
export declare const createProtocolMessageFromCrdtMessages: (deps: RandomBytesDep) => (owner: Owner, messages: NonEmptyReadonlyArray<CrdtMessage>, maxSize?: ProtocolMessageMaxSize) => ProtocolMessage;
|
|
353
432
|
/**
|
|
@@ -396,14 +475,37 @@ export declare const createProtocolMessageForUnsubscribe: (ownerId: OwnerId) =>
|
|
|
396
475
|
/**
|
|
397
476
|
* Mutable builder for constructing {@link ProtocolMessage} respecting size
|
|
398
477
|
* limits.
|
|
478
|
+
*
|
|
479
|
+
* A frame never exceeds `totalMaxSize`. Make ordinary writes inside `tryWrite`,
|
|
480
|
+
* which keeps them only if the frame can still be closed. A write outside a
|
|
481
|
+
* trial is a closing write: `addMessage` and `addRange` assert that the frame
|
|
482
|
+
* fits `totalMaxSize`.
|
|
483
|
+
*
|
|
484
|
+
* The builder references each change, which `unwrap` copies into the frame it
|
|
485
|
+
* returns, so a change must not be modified while the builder is in use.
|
|
486
|
+
* `unwrap` leaves the builder unchanged, so it can be called again.
|
|
399
487
|
*/
|
|
400
488
|
export interface ProtocolMessageBuffer {
|
|
401
|
-
readonly canAddMessage: (message: EncryptedCrdtMessage) => boolean;
|
|
402
489
|
readonly addMessage: (message: EncryptedCrdtMessage) => void;
|
|
403
|
-
readonly canSplitRange: () => boolean;
|
|
404
|
-
readonly canAddTimestampsRangeAndMessage: (timestamps: TimestampsBuffer, message: EncryptedCrdtMessage | null) => boolean;
|
|
405
490
|
readonly addRange: (range: SkipRange | FingerprintRange | TimestampsRangeWithTimestampsBuffer) => void;
|
|
491
|
+
/**
|
|
492
|
+
* Runs `write` and keeps what it wrote only if the frame can still be closed,
|
|
493
|
+
* returning whether it was kept.
|
|
494
|
+
*
|
|
495
|
+
* The frame can be closed when its exact size plus the bytes needed to append
|
|
496
|
+
* one Fingerprint range with {@link InfiniteUpperBound} plus `reserve` is at
|
|
497
|
+
* most `totalMaxSize`, and its ranges section plus the same bytes is at most
|
|
498
|
+
* `rangesMaxSize`. Nothing is needed to close a broadcast, which holds no
|
|
499
|
+
* ranges, or a frame whose last range has InfiniteUpperBound. Use `reserve`
|
|
500
|
+
* for bytes the caller adds later, such as a range it is still collecting.
|
|
501
|
+
*
|
|
502
|
+
* When the frame cannot be closed, or `write` throws, everything `write`
|
|
503
|
+
* wrote is undone, so the frame is as if `write` never ran. Inside `write`,
|
|
504
|
+
* `addMessage` and `addRange` do not assert the size limit.
|
|
505
|
+
*/
|
|
506
|
+
readonly tryWrite: (write: () => void, reserve?: NonNegativeInt) => boolean;
|
|
406
507
|
readonly unwrap: () => ProtocolMessage;
|
|
508
|
+
/** Returns the exact encoded size of the frame. */
|
|
407
509
|
readonly getSize: () => PositiveInt;
|
|
408
510
|
}
|
|
409
511
|
export declare const createProtocolMessageBuffer: (ownerId: OwnerId, options: {
|
|
@@ -430,13 +532,28 @@ export interface TimestampsBuffer {
|
|
|
430
532
|
readonly getCount: () => NonNegativeInt;
|
|
431
533
|
readonly getLength: () => number;
|
|
432
534
|
readonly append: (buffer: Buffer) => void;
|
|
535
|
+
/**
|
|
536
|
+
* Returns a function that restores the buffer, in constant time, to the state
|
|
537
|
+
* it had when this was called, discarding every timestamp added since.
|
|
538
|
+
*
|
|
539
|
+
* A restore function can be called repeatedly. It is valid until the buffer
|
|
540
|
+
* is restored to an earlier checkpoint.
|
|
541
|
+
*/
|
|
542
|
+
readonly checkpoint: () => () => void;
|
|
433
543
|
}
|
|
434
544
|
export declare const createTimestampsBuffer: () => TimestampsBuffer;
|
|
435
545
|
export interface ApplyProtocolMessageAsClientOptions {
|
|
436
|
-
writeKey?: OwnerWriteKey;
|
|
437
|
-
rangesMaxSize?: ProtocolMessageRangesMaxSize;
|
|
546
|
+
readonly writeKey?: OwnerWriteKey;
|
|
547
|
+
readonly rangesMaxSize?: ProtocolMessageRangesMaxSize;
|
|
548
|
+
/**
|
|
549
|
+
* Called for each stored change that sync skipped as a
|
|
550
|
+
* {@link ProtocolChangeTooLargeError}. Without it, the error is logged with
|
|
551
|
+
* `console.warn`. It must not throw, because a throw is a defect that aborts
|
|
552
|
+
* the Run.
|
|
553
|
+
*/
|
|
554
|
+
readonly onChangeTooLarge?: (error: ProtocolChangeTooLargeError) => void;
|
|
438
555
|
/** For tests only. */
|
|
439
|
-
version?: NonNegativeInt;
|
|
556
|
+
readonly version?: NonNegativeInt;
|
|
440
557
|
}
|
|
441
558
|
/**
|
|
442
559
|
* Result of {@link applyProtocolMessageAsClient}: a continuation for the
|
|
@@ -469,34 +586,48 @@ export interface ApplyProtocolMessageAsClientReadonly extends Typed<"Readonly">
|
|
|
469
586
|
* Result of {@link applyProtocolMessageAsClient}: the protocol logged an
|
|
470
587
|
* exception thrown by calling the storage's `writeMessages` (`Write`) or a
|
|
471
588
|
* failed range reconciliation (`Sync`) to the console. An exception while the
|
|
472
|
-
* returned Task runs
|
|
473
|
-
*
|
|
474
|
-
* {@link StorageWriteMessagesError} through {@link Result}.
|
|
475
|
-
* fail after messages have been committed; that failure does
|
|
476
|
-
* write.
|
|
589
|
+
* returned Task runs is a defect that aborts the Run instead. A rejected or
|
|
590
|
+
* failed write, which the built-in storages return when SQLite fails it, gives
|
|
591
|
+
* the original {@link StorageWriteMessagesError} through {@link Result}.
|
|
592
|
+
* Reconciliation can fail after messages have been committed; that failure does
|
|
593
|
+
* not roll back the write.
|
|
477
594
|
*/
|
|
478
595
|
export interface ApplyProtocolMessageAsClientFailed extends Typed<"Failed"> {
|
|
479
596
|
readonly cause: "Write" | "Sync";
|
|
480
597
|
}
|
|
481
598
|
export type ApplyProtocolMessageAsClientResult = ApplyProtocolMessageAsClientResponse | ApplyProtocolMessageAsClientConverged | ApplyProtocolMessageAsClientBroadcast | ApplyProtocolMessageAsClientReadonly | ApplyProtocolMessageAsClientFailed;
|
|
482
599
|
export declare const applyProtocolMessageAsClient: (inputMessage: Uint8Array, options?: ApplyProtocolMessageAsClientOptions) => Task<ApplyProtocolMessageAsClientResult, ProtocolError | StorageWriteMessagesError, StorageDep>;
|
|
600
|
+
/**
|
|
601
|
+
* Options for {@link applyProtocolMessageAsRelay}. The callbacks must not throw,
|
|
602
|
+
* because a throw is a defect that aborts the Run.
|
|
603
|
+
*/
|
|
483
604
|
export interface ApplyProtocolMessageAsRelayOptions {
|
|
484
605
|
/** To subscribe an owner for broadcasting. */
|
|
485
|
-
subscribe?: (ownerId: OwnerId) => void;
|
|
606
|
+
readonly subscribe?: (ownerId: OwnerId) => void;
|
|
486
607
|
/** To unsubscribe an owner from broadcasting. */
|
|
487
|
-
unsubscribe?: (ownerId: OwnerId) => void;
|
|
608
|
+
readonly unsubscribe?: (ownerId: OwnerId) => void;
|
|
488
609
|
/** To broadcast a protocol message to all subscribers. */
|
|
489
|
-
broadcast?: (ownerId: OwnerId, message: ProtocolMessage) => void;
|
|
490
|
-
|
|
491
|
-
|
|
610
|
+
readonly broadcast?: (ownerId: OwnerId, message: ProtocolMessage) => void;
|
|
611
|
+
/**
|
|
612
|
+
* The maximum size of the relay's responses and broadcasts, and of the
|
|
613
|
+
* requests it accepts. A larger request is a
|
|
614
|
+
* {@link ProtocolInvalidDataError}.
|
|
615
|
+
*/
|
|
616
|
+
readonly totalMaxSize?: ProtocolMessageMaxSize;
|
|
617
|
+
readonly rangesMaxSize?: ProtocolMessageRangesMaxSize;
|
|
492
618
|
}
|
|
493
619
|
/**
|
|
494
620
|
* Result type for {@link applyProtocolMessageAsRelay}.
|
|
495
621
|
*
|
|
496
|
-
* Unlike {@link ApplyProtocolMessageAsClientResult},
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
622
|
+
* Unlike {@link ApplyProtocolMessageAsClientResult}, a relay answers every
|
|
623
|
+
* request it can decode within its `totalMaxSize` to provide sync completion
|
|
624
|
+
* feedback. This ensures the initiator can reliably detect when synchronization
|
|
625
|
+
* is complete, even when there's nothing to sync. A storage that throws while
|
|
626
|
+
* validating the write key is answered with a `WriteError` code, like a failed
|
|
627
|
+
* write. For a larger request or one it cannot decode,
|
|
628
|
+
* {@link applyProtocolMessageAsRelay} returns {@link ProtocolInvalidDataError}
|
|
629
|
+
* before subscribing, storing, or broadcasting anything, and the relay sends
|
|
630
|
+
* nothing. Clients may choose not to respond in certain cases (like when they
|
|
500
631
|
* receive broadcast messages or when they lack a write key for syncing).
|
|
501
632
|
*/
|
|
502
633
|
export interface ApplyProtocolMessageAsRelayResult extends Typed<"Response"> {
|
|
@@ -509,9 +640,11 @@ version?: NonNegativeInt) => Task<ApplyProtocolMessageAsRelayResult, ProtocolInv
|
|
|
509
640
|
* Encodes and encrypts a {@link DbChange} using the provided owner's encryption
|
|
510
641
|
* key. Returns an encrypted binary representation as {@link EncryptedDbChange}.
|
|
511
642
|
*
|
|
512
|
-
* The
|
|
513
|
-
*
|
|
514
|
-
*
|
|
643
|
+
* The plaintext starts with the format version of the change, which is
|
|
644
|
+
* independent of {@link protocolVersion}, and the timestamp, which proves that
|
|
645
|
+
* the change belongs to the timestamp it is sent with.
|
|
646
|
+
* {@link decryptAndDecodeDbChange} rejects a newer format version and accepts
|
|
647
|
+
* older ones.
|
|
515
648
|
*/
|
|
516
649
|
export declare const encodeAndEncryptDbChange: (deps: RandomBytesDep) => (message: CrdtMessage, key: EncryptionKey) => EncryptedDbChange;
|
|
517
650
|
/**
|
|
@@ -527,21 +660,11 @@ export declare const encodeDbChange: (buffer: Buffer, message: CrdtMessage) => v
|
|
|
527
660
|
* Decrypts and decodes an {@link EncryptedCrdtMessage} using the provided
|
|
528
661
|
* owner's encryption key. Verifies that the embedded timestamp matches the
|
|
529
662
|
* expected timestamp to ensure message integrity.
|
|
530
|
-
*/
|
|
531
|
-
export declare const decryptAndDecodeDbChange: (message: EncryptedCrdtMessage, key: EncryptionKey) => Result<DbChange, DecryptWithXChaCha20Poly1305Error | ProtocolInvalidDataError | ProtocolTimestampMismatchError>;
|
|
532
|
-
/**
|
|
533
|
-
* Decodes a ProtocolMessage into a readable JSON object for debugging.
|
|
534
|
-
*
|
|
535
|
-
* Note: This is a stub for future implementation. It should use:
|
|
536
663
|
*
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
* - DecodeMessages
|
|
540
|
-
* - DecodeRanges
|
|
541
|
-
*
|
|
542
|
-
* If you want to help, please contribute to this function.
|
|
664
|
+
* A change with a newer format version than {@link encodeAndEncryptDbChange}
|
|
665
|
+
* writes is a {@link ProtocolInvalidDataError}.
|
|
543
666
|
*/
|
|
544
|
-
export declare const
|
|
667
|
+
export declare const decryptAndDecodeDbChange: (message: EncryptedCrdtMessage, key: EncryptionKey) => Result<DbChange, DecryptWithXChaCha20Poly1305Error | ProtocolInvalidDataError | ProtocolTimestampMismatchError>;
|
|
545
668
|
export declare const ProtocolValueType: {
|
|
546
669
|
readonly String: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
547
670
|
readonly Number: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
@@ -557,5 +680,4 @@ export declare const ProtocolValueType: {
|
|
|
557
680
|
};
|
|
558
681
|
export declare const encodeSqliteValue: (buffer: Buffer, value: SqliteValue) => void;
|
|
559
682
|
export declare const decodeSqliteValue: (buffer: Buffer) => SqliteValue;
|
|
560
|
-
export {};
|
|
561
683
|
//# sourceMappingURL=Protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/local-first/Protocol.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/local-first/Protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6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