@evolu/common 6.0.1-preview.20 → 6.0.1-preview.21
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/Evolu/Db.d.ts +23 -1
- package/dist/src/Evolu/Db.d.ts.map +1 -1
- package/dist/src/Evolu/Owner.d.ts +60 -0
- package/dist/src/Evolu/Owner.d.ts.map +1 -1
- package/dist/src/Evolu/Owner.js +33 -0
- package/dist/src/Evolu/Protocol.d.ts +91 -30
- package/dist/src/Evolu/Protocol.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.js +80 -25
- package/dist/src/Evolu/Relay.d.ts +70 -3
- package/dist/src/Evolu/Relay.d.ts.map +1 -1
- package/dist/src/Evolu/Relay.js +74 -1
- package/dist/src/Evolu/Sync.d.ts +2 -11
- package/dist/src/Evolu/Sync.d.ts.map +1 -1
- package/dist/src/Evolu/Sync.js +7 -46
- package/dist/src/Result.d.ts +45 -16
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +23 -0
- package/dist/src/Task.js +1 -1
- package/dist/src/Type.d.ts +12 -0
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +12 -0
- package/package.json +1 -1
- package/src/Evolu/Db.ts +24 -1
- package/src/Evolu/Owner.ts +70 -1
- package/src/Evolu/Protocol.ts +117 -36
- package/src/Evolu/Relay.ts +180 -6
- package/src/Evolu/Sync.ts +7 -57
- package/src/Result.ts +47 -16
- package/src/Task.ts +3 -3
- package/src/Type.ts +12 -0
package/dist/src/Evolu/Db.d.ts
CHANGED
|
@@ -38,6 +38,13 @@ export interface DbConfig extends ConsoleConfig, TimestampConfig {
|
|
|
38
38
|
* Transport configuration for data sync and backup. Supports single transport
|
|
39
39
|
* or multiple transports simultaneously for redundancy.
|
|
40
40
|
*
|
|
41
|
+
* **Redundancy:** The ideal setup uses at least two completely independent
|
|
42
|
+
* relays - for example, a home relay and a geographically separate relay.
|
|
43
|
+
* Data is sent to both relays simultaneously, providing true redundancy
|
|
44
|
+
* similar to using two independent clouds. This eliminates vendor lock-in and
|
|
45
|
+
* ensures your app continues working regardless of circumstances - whether
|
|
46
|
+
* home relay hardware is stolen or a remote relay provider shuts down.
|
|
47
|
+
*
|
|
41
48
|
* Currently supports:
|
|
42
49
|
*
|
|
43
50
|
* - WebSocket: Real-time bidirectional communication with relay servers
|
|
@@ -46,6 +53,11 @@ export interface DbConfig extends ConsoleConfig, TimestampConfig {
|
|
|
46
53
|
* added and removed for any owner (including {@link AppOwner}) via
|
|
47
54
|
* {@link Evolu#useOwner}.
|
|
48
55
|
*
|
|
56
|
+
* Use {@link createWebSocketTransportConfig} to create WebSocket transport
|
|
57
|
+
* configurations with proper URL formatting and {@link OwnerId} inclusion. The
|
|
58
|
+
* {@link OwnerId} in the URL enables relay authentication, allowing relay
|
|
59
|
+
* servers to control access (e.g., for paid tiers or private instances).
|
|
60
|
+
*
|
|
49
61
|
* The default value is:
|
|
50
62
|
*
|
|
51
63
|
* `{ type: "WebSocket", url: "wss://free.evoluhq.com" }`.
|
|
@@ -63,8 +75,18 @@ export interface DbConfig extends ConsoleConfig, TimestampConfig {
|
|
|
63
75
|
* { type: "WebSocket", url: "wss://relay3.example.com" },
|
|
64
76
|
* ];
|
|
65
77
|
*
|
|
66
|
-
* // Local-only instance (no sync) - useful for device settings
|
|
78
|
+
* // Local-only instance (no sync) - useful for device settings or when relay
|
|
79
|
+
* // URL will be provided later (e.g., after authentication), allowing users
|
|
80
|
+
* // to work offline before the app connects
|
|
67
81
|
* transports: [];
|
|
82
|
+
*
|
|
83
|
+
* // Using createWebSocketTransportConfig helper for relay authentication
|
|
84
|
+
* transports: [
|
|
85
|
+
* createWebSocketTransportConfig({
|
|
86
|
+
* relayUrl: "ws://localhost:4000",
|
|
87
|
+
* ownerId,
|
|
88
|
+
* }),
|
|
89
|
+
* ];
|
|
68
90
|
* ```
|
|
69
91
|
*/
|
|
70
92
|
readonly transports: ReadonlyArray<TransportConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,cAAc,EACd,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAEL,qBAAqB,EAIrB,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAGL,MAAM,EACP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"Db.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAEL,aAAa,EACb,cAAc,EACd,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAE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ACT,OAAO,CAAC;AAgBV,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACzD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,GACpC,cAAc,oBAAoB,KACjC,QAKsD,CAAC"}
|
|
@@ -115,11 +115,71 @@ export interface AppOwner extends Owner {
|
|
|
115
115
|
}
|
|
116
116
|
/** Creates an {@link AppOwner} from an {@link OwnerSecret}. */
|
|
117
117
|
export declare const createAppOwner: (secret: OwnerSecret) => AppOwner;
|
|
118
|
+
/**
|
|
119
|
+
* Transport configuration for connecting to relays.
|
|
120
|
+
*
|
|
121
|
+
* Each {@link Owner} can specify one or more transports to connect to different
|
|
122
|
+
* relays for data synchronization. Currently supports WebSocket transport, with
|
|
123
|
+
* future support planned for Bluetooth, LocalNetwork, and other protocols.
|
|
124
|
+
*/
|
|
118
125
|
export type TransportConfig = WebSocketTransportConfig;
|
|
126
|
+
/**
|
|
127
|
+
* WebSocket transport configuration for relay connections.
|
|
128
|
+
*
|
|
129
|
+
* Use {@link createWebSocketTransportConfig} to create a properly formatted URL
|
|
130
|
+
* with {@link OwnerId}. The relay uses {@link parseOwnerIdFromUrl} to extract the
|
|
131
|
+
* OwnerId from the query string.
|
|
132
|
+
*
|
|
133
|
+
* ### Authentication and Error Handling
|
|
134
|
+
*
|
|
135
|
+
* When a relay rejects a connection (invalid OwnerId, unauthorized owner, or
|
|
136
|
+
* server error), the browser WebSocket API does not expose the specific HTTP
|
|
137
|
+
* status code or reason - it only reports a generic connection failure. The
|
|
138
|
+
* client automatically retries with exponential backoff and jitter, eventually
|
|
139
|
+
* succeeding once the configuration or server issue is resolved.
|
|
140
|
+
*
|
|
141
|
+
* Legitimate clients will be properly configured with valid credentials, so
|
|
142
|
+
* automatic retry is appropriate.
|
|
143
|
+
*
|
|
144
|
+
* @see {@link createWebSocketTransportConfig}
|
|
145
|
+
* @see {@link parseOwnerIdFromUrl}
|
|
146
|
+
*/
|
|
119
147
|
export interface WebSocketTransportConfig {
|
|
120
148
|
readonly type: "WebSocket";
|
|
121
149
|
readonly url: string;
|
|
122
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Creates a {@link WebSocketTransportConfig} for the given relay URL and
|
|
153
|
+
* {@link OwnerId}.
|
|
154
|
+
*
|
|
155
|
+
* ### Example
|
|
156
|
+
*
|
|
157
|
+
* ```ts
|
|
158
|
+
* const transport = createWebSocketTransportConfig({
|
|
159
|
+
* relayUrl: "wss://relay.evolu.dev",
|
|
160
|
+
* ownerId: owner.id,
|
|
161
|
+
* });
|
|
162
|
+
* // Result: { type: "WebSocket", url: "wss://relay.evolu.dev?ownerId=..." }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare const createWebSocketTransportConfig: ({ relayUrl, ownerId, }: {
|
|
166
|
+
readonly relayUrl: string;
|
|
167
|
+
readonly ownerId: OwnerId;
|
|
168
|
+
}) => WebSocketTransportConfig;
|
|
169
|
+
/**
|
|
170
|
+
* Extracts {@link OwnerId} from a URL query string.
|
|
171
|
+
*
|
|
172
|
+
* Parses the query string `?ownerId=...` and validates that the extracted value
|
|
173
|
+
* is a valid {@link OwnerId}.
|
|
174
|
+
*
|
|
175
|
+
* ### Example
|
|
176
|
+
*
|
|
177
|
+
* ```ts
|
|
178
|
+
* parseOwnerIdFromUrl("/sync?ownerId=_12345678abcdefgh");
|
|
179
|
+
* // Returns: OwnerId or null
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare const parseOwnerIdFromUrl: (url: string | undefined) => OwnerId | null;
|
|
123
183
|
/**
|
|
124
184
|
* An {@link Owner} for sharding data.
|
|
125
185
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Owner.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Owner.ts"],"names":[],"mappings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@@ import * as bip39 from "@scure/bip39";
|
|
|
2
2
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
3
3
|
import { createSlip21, EncryptionKey, Entropy16, Entropy32, } from "../Crypto.js";
|
|
4
4
|
import { brand, Id, IdBytes, idBytesToId, idToIdBytes, } from "../Type.js";
|
|
5
|
+
import { getOrNull } from "../Result.js";
|
|
5
6
|
/**
|
|
6
7
|
* 32 bytes of cryptographic entropy used to derive {@link Owner} keys.
|
|
7
8
|
*
|
|
@@ -55,6 +56,38 @@ export const createAppOwner = (secret) => ({
|
|
|
55
56
|
mnemonic: ownerSecretToMnemonic(secret),
|
|
56
57
|
...createOwner(secret),
|
|
57
58
|
});
|
|
59
|
+
/**
|
|
60
|
+
* Creates a {@link WebSocketTransportConfig} for the given relay URL and
|
|
61
|
+
* {@link OwnerId}.
|
|
62
|
+
*
|
|
63
|
+
* ### Example
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const transport = createWebSocketTransportConfig({
|
|
67
|
+
* relayUrl: "wss://relay.evolu.dev",
|
|
68
|
+
* ownerId: owner.id,
|
|
69
|
+
* });
|
|
70
|
+
* // Result: { type: "WebSocket", url: "wss://relay.evolu.dev?ownerId=..." }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export const createWebSocketTransportConfig = ({ relayUrl, ownerId, }) => ({
|
|
74
|
+
type: "WebSocket",
|
|
75
|
+
url: `${relayUrl}?ownerId=${ownerId}`,
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Extracts {@link OwnerId} from a URL query string.
|
|
79
|
+
*
|
|
80
|
+
* Parses the query string `?ownerId=...` and validates that the extracted value
|
|
81
|
+
* is a valid {@link OwnerId}.
|
|
82
|
+
*
|
|
83
|
+
* ### Example
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* parseOwnerIdFromUrl("/sync?ownerId=_12345678abcdefgh");
|
|
87
|
+
* // Returns: OwnerId or null
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export const parseOwnerIdFromUrl = (url) => getOrNull(OwnerId.fromUnknown(url?.split("=")[1]));
|
|
58
91
|
/** Creates a {@link ShardOwner} from an {@link OwnerSecret}. */
|
|
59
92
|
export const createShardOwner = (secret, transports) => {
|
|
60
93
|
return {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* transfer, ownership, real-time broadcasting, request-response semantics, and
|
|
21
21
|
* error handling.
|
|
22
22
|
*
|
|
23
|
-
* ### Message
|
|
23
|
+
* ### Message structure
|
|
24
24
|
*
|
|
25
25
|
* | Field | Notes |
|
|
26
26
|
* | :----------------------------- | :------------------------ |
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* | - {@link NonNegativeInt} | Number of ranges. |
|
|
44
44
|
* | - {@link Range} | |
|
|
45
45
|
*
|
|
46
|
-
* ### WriteKey
|
|
46
|
+
* ### WriteKey validation
|
|
47
47
|
*
|
|
48
48
|
* The initiator sends a hasWriteKey flag and optionally a WriteKey. The
|
|
49
49
|
* WriteKey is required when sending messages as a secure token proving the
|
|
@@ -79,33 +79,33 @@
|
|
|
79
79
|
* initiator. In relay-to-relay or P2P sync, both sides may require the
|
|
80
80
|
* {@link OwnerWriteKey} depending on who is the initiator.
|
|
81
81
|
*
|
|
82
|
-
* ### Protocol
|
|
82
|
+
* ### Protocol errors
|
|
83
83
|
*
|
|
84
84
|
* The protocol uses error codes in the header to signal issues:
|
|
85
85
|
*
|
|
86
86
|
* - {@link ProtocolWriteKeyError}: The provided WriteKey is invalid or missing.
|
|
87
|
-
* - {@link ProtocolWriteError}: A write
|
|
88
|
-
*
|
|
89
|
-
* - {@link ProtocolSyncError}: A generic or unexpected synchronization failure
|
|
87
|
+
* - {@link ProtocolWriteError}: A serious relay-side write failure occurred.
|
|
88
|
+
* - {@link ProtocolSyncError}: A serious relay-side synchronization failure
|
|
90
89
|
* occurred.
|
|
90
|
+
* - {@link ProtocolQuotaExceededError}: Storage or billing quota exceeded.
|
|
91
91
|
* - {@link ProtocolUnsupportedVersionError}: Protocol version mismatch.
|
|
92
92
|
* - {@link ProtocolInvalidDataError}: The message is malformed or corrupted.
|
|
93
93
|
*
|
|
94
94
|
* All protocol errors except `ProtocolInvalidDataError` include the `OwnerId`
|
|
95
95
|
* to allow clients to associate errors with the correct owner.
|
|
96
96
|
*
|
|
97
|
-
* ### Message
|
|
97
|
+
* ### Message size limit
|
|
98
98
|
*
|
|
99
99
|
* The protocol enforces a strict maximum size for all messages, defined by
|
|
100
|
-
* {@link
|
|
100
|
+
* {@link ProtocolMessageMaxSize}. This ensures every {@link ProtocolMessage} is
|
|
101
101
|
* less than or equal to this limit, enabling stateless transports, simplified
|
|
102
102
|
* relay implementation, and predictable memory usage. When all messages don't
|
|
103
103
|
* fit within the limit, the protocol automatically continues synchronization in
|
|
104
104
|
* subsequent rounds using range-based reconciliation.
|
|
105
105
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* {@link
|
|
106
|
+
* Database mutations are limited to 640KB, which is smaller than the protocol
|
|
107
|
+
* message limit to ensure efficient sync with
|
|
108
|
+
* {@link defaultProtocolMessageRangesMaxSize}.
|
|
109
109
|
*
|
|
110
110
|
* ### Why Binary?
|
|
111
111
|
*
|
|
@@ -148,6 +148,15 @@
|
|
|
148
148
|
* Version negotiation is per-owner, allowing Evolu Protocol to evolve safely
|
|
149
149
|
* over time and provide clear feedback about version mismatches.
|
|
150
150
|
*
|
|
151
|
+
* ### Credible exit
|
|
152
|
+
*
|
|
153
|
+
* The protocol specification is intentionally non-configurable to ensure
|
|
154
|
+
* universal compatibility. This design allows applications (users) to switch
|
|
155
|
+
* between any compliant relay without negotiation or compatibility checks
|
|
156
|
+
* beyond version matching. Relays are generic infrastructure that any
|
|
157
|
+
* application can use interchangeably making exit from any single provider
|
|
158
|
+
* technically feasible and economically viable.
|
|
159
|
+
*
|
|
151
160
|
* @module
|
|
152
161
|
*/
|
|
153
162
|
import { NonEmptyReadonlyArray } from "../Array.js";
|
|
@@ -160,10 +169,51 @@ import { NonNegativeInt, PositiveInt } from "../Type.js";
|
|
|
160
169
|
import { Owner, OwnerId, OwnerWriteKey } from "./Owner.js";
|
|
161
170
|
import { BaseRange, CrdtMessage, DbChange, EncryptedCrdtMessage, EncryptedDbChange, FingerprintRange, RangeType, SkipRange, StorageDep } from "./Storage.js";
|
|
162
171
|
import { NodeId, Timestamp } from "./Timestamp.js";
|
|
163
|
-
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Protocol message maximum size.
|
|
174
|
+
*
|
|
175
|
+
* Defines the upper limit for how large a single protocol message can be.
|
|
176
|
+
* Implementations must enforce a maximum size between 1MB and 100MB to ensure
|
|
177
|
+
* compatibility across all Evolu implementations (the maximum size of mutation
|
|
178
|
+
* change is hardcoded and enforced hence the maximum size can't be smaller).
|
|
179
|
+
*
|
|
180
|
+
* Larger maximum sizes can be configured by relays to reduce roundtrips. For
|
|
181
|
+
* example, a dedicated relay with ample resources could configure a 100MB
|
|
182
|
+
* maximum to minimize roundtrips for large syncs.
|
|
183
|
+
*
|
|
184
|
+
* Only relays can safely configure larger sizes, as clients will handle them.
|
|
185
|
+
* Increasing this value on the client side would break compatibility with
|
|
186
|
+
* relays that enforce smaller limits.
|
|
187
|
+
*/
|
|
188
|
+
export declare const ProtocolMessageMaxSize: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", number & Brand<"Int">, number, import("../Type.js").IntError, number, import("../Type.js").NumberError>, "Between1000000-100000000", import("../Type.js").BetweenError<1000000, 100000000>, import("../Type.js").IntError | import("../Type.js").NumberError>;
|
|
189
|
+
export type ProtocolMessageMaxSize = typeof ProtocolMessageMaxSize.Type;
|
|
190
|
+
/**
|
|
191
|
+
* Default {@link ProtocolMessageMaxSize} (1MB).
|
|
192
|
+
*
|
|
193
|
+
* The standard size used across Evolu implementations. Relays with more
|
|
194
|
+
* resources can configure larger sizes to reduce roundtrips.
|
|
195
|
+
*/
|
|
196
|
+
export declare const defaultProtocolMessageMaxSize: ProtocolMessageMaxSize;
|
|
197
|
+
/**
|
|
198
|
+
* Protocol message ranges maximum size.
|
|
199
|
+
*
|
|
200
|
+
* Defines the upper limit for how large the ranges section of a protocol
|
|
201
|
+
* message can be. Implementations must enforce a maximum size between 3KB and
|
|
202
|
+
* 100KB to ensure compatibility.
|
|
203
|
+
*
|
|
204
|
+
* The upper bound is set to ensure ranges fit within the default 1MB
|
|
205
|
+
* {@link defaultProtocolMessageMaxSize}, maintaining compatibility between all
|
|
206
|
+
* clients and relays.
|
|
207
|
+
*/
|
|
208
|
+
export declare const ProtocolMessageRangesMaxSize: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", number & Brand<"Int">, number, import("../Type.js").IntError, number, import("../Type.js").NumberError>, "Between3000-100000", import("../Type.js").BetweenError<3000, 100000>, import("../Type.js").IntError | import("../Type.js").NumberError>;
|
|
209
|
+
export type ProtocolMessageRangesMaxSize = typeof ProtocolMessageRangesMaxSize.Type;
|
|
210
|
+
/**
|
|
211
|
+
* Default {@link ProtocolMessageRangesMaxSize} (30KB).
|
|
212
|
+
*
|
|
213
|
+
* The standard size used across Evolu implementations. Relays with more
|
|
214
|
+
* resources can configure larger sizes to reduce roundtrips.
|
|
215
|
+
*/
|
|
216
|
+
export declare const defaultProtocolMessageRangesMaxSize: ProtocolMessageRangesMaxSize;
|
|
167
217
|
/** Evolu Protocol Message. */
|
|
168
218
|
export type ProtocolMessage = Uint8Array & Brand<"ProtocolMessage">;
|
|
169
219
|
/** Evolu Protocol version. */
|
|
@@ -194,9 +244,11 @@ export declare const ProtocolErrorCode: {
|
|
|
194
244
|
readonly WriteError: 2;
|
|
195
245
|
/** A code for {@link ProtocolSyncError}. */
|
|
196
246
|
readonly SyncError: 3;
|
|
247
|
+
/** A code for {@link ProtocolQuotaExceededError}. */
|
|
248
|
+
readonly QuotaExceededError: 4;
|
|
197
249
|
};
|
|
198
250
|
type ProtocolErrorCode = (typeof ProtocolErrorCode)[keyof typeof ProtocolErrorCode];
|
|
199
|
-
export type ProtocolError = ProtocolUnsupportedVersionError | ProtocolInvalidDataError | ProtocolWriteKeyError | ProtocolWriteError | ProtocolSyncError | ProtocolTimestampMismatchError;
|
|
251
|
+
export type ProtocolError = ProtocolUnsupportedVersionError | ProtocolInvalidDataError | ProtocolWriteKeyError | ProtocolWriteError | ProtocolSyncError | ProtocolQuotaExceededError | ProtocolTimestampMismatchError;
|
|
200
252
|
/** Base interface for all protocol errors. */
|
|
201
253
|
export interface ProtocolErrorBase {
|
|
202
254
|
readonly ownerId: OwnerId;
|
|
@@ -222,19 +274,29 @@ export interface ProtocolWriteKeyError extends ProtocolErrorBase {
|
|
|
222
274
|
readonly type: "ProtocolWriteKeyError";
|
|
223
275
|
}
|
|
224
276
|
/**
|
|
225
|
-
* Error
|
|
226
|
-
*
|
|
277
|
+
* Error indicating a serious relay-side write failure. Clients should log this
|
|
278
|
+
* error and show a generic sync error to the user.
|
|
227
279
|
*/
|
|
228
280
|
export interface ProtocolWriteError extends ProtocolErrorBase {
|
|
229
281
|
readonly type: "ProtocolWriteError";
|
|
230
282
|
}
|
|
231
283
|
/**
|
|
232
|
-
* Error indicating a synchronization failure
|
|
233
|
-
*
|
|
284
|
+
* Error indicating a serious relay-side synchronization failure. Clients should
|
|
285
|
+
* log this error and show a generic sync error to the user.
|
|
234
286
|
*/
|
|
235
287
|
export interface ProtocolSyncError extends ProtocolErrorBase {
|
|
236
288
|
readonly type: "ProtocolSyncError";
|
|
237
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Error when storage or billing quota is exceeded. Clients should prompt the
|
|
292
|
+
* user to upgrade their plan or expand capacity.
|
|
293
|
+
*
|
|
294
|
+
* TODO: Add callback to relay config to check quota and return this error when
|
|
295
|
+
* limits are reached.
|
|
296
|
+
*/
|
|
297
|
+
export interface ProtocolQuotaExceededError extends ProtocolErrorBase {
|
|
298
|
+
readonly type: "ProtocolQuotaExceededError";
|
|
299
|
+
}
|
|
238
300
|
/**
|
|
239
301
|
* Error when embedded timestamp doesn't match expected timestamp in
|
|
240
302
|
* EncryptedDbChange. Indicates potential tampering or corruption of CRDT
|
|
@@ -248,11 +310,11 @@ export interface ProtocolTimestampMismatchError {
|
|
|
248
310
|
/**
|
|
249
311
|
* Creates a {@link ProtocolMessage} from CRDT messages.
|
|
250
312
|
*
|
|
251
|
-
* If the message size would exceed {@link
|
|
252
|
-
* ensures all messages will be sent in the next round(s) even over
|
|
313
|
+
* If the message size would exceed {@link defaultProtocolMessageMaxSize}, the
|
|
314
|
+
* protocol ensures all messages will be sent in the next round(s) even over
|
|
253
315
|
* unidirectional and stateless transports.
|
|
254
316
|
*/
|
|
255
|
-
export declare const createProtocolMessageFromCrdtMessages: (deps: RandomBytesDep & SymmetricCryptoDep) => (owner: Owner, messages: NonEmptyReadonlyArray<CrdtMessage>, maxSize?:
|
|
317
|
+
export declare const createProtocolMessageFromCrdtMessages: (deps: RandomBytesDep & SymmetricCryptoDep) => (owner: Owner, messages: NonEmptyReadonlyArray<CrdtMessage>, maxSize?: ProtocolMessageMaxSize) => ProtocolMessage;
|
|
256
318
|
/** Creates a {@link ProtocolMessage} for sync. */
|
|
257
319
|
export declare const createProtocolMessageForSync: (deps: StorageDep) => (ownerId: OwnerId, subscriptionFlag?: SubscriptionFlag) => ProtocolMessage | null;
|
|
258
320
|
export declare const createProtocolMessageForUnsubscribe: (ownerId: OwnerId) => ProtocolMessage;
|
|
@@ -270,8 +332,8 @@ export interface ProtocolMessageBuffer {
|
|
|
270
332
|
readonly getSize: () => PositiveInt;
|
|
271
333
|
}
|
|
272
334
|
export declare const createProtocolMessageBuffer: (ownerId: OwnerId, options: {
|
|
273
|
-
readonly totalMaxSize?:
|
|
274
|
-
readonly rangesMaxSize?:
|
|
335
|
+
readonly totalMaxSize?: ProtocolMessageMaxSize | undefined;
|
|
336
|
+
readonly rangesMaxSize?: ProtocolMessageRangesMaxSize | undefined;
|
|
275
337
|
readonly version?: NonNegativeInt;
|
|
276
338
|
} & ({
|
|
277
339
|
readonly messageType: typeof MessageType.Request;
|
|
@@ -299,8 +361,7 @@ export interface ApplyProtocolMessageAsClientOptions {
|
|
|
299
361
|
getWriteKey?: (ownerId: OwnerId) => OwnerWriteKey | null;
|
|
300
362
|
/** For testing purposes only; should not be used in production. */
|
|
301
363
|
version?: NonNegativeInt;
|
|
302
|
-
|
|
303
|
-
rangesMaxSize?: PositiveInt;
|
|
364
|
+
rangesMaxSize?: ProtocolMessageRangesMaxSize;
|
|
304
365
|
}
|
|
305
366
|
/**
|
|
306
367
|
* Result type for {@link applyProtocolMessageAsClient} that distinguishes
|
|
@@ -314,7 +375,7 @@ export type ApplyProtocolMessageAsClientResult = {
|
|
|
314
375
|
} | {
|
|
315
376
|
readonly type: "broadcast";
|
|
316
377
|
};
|
|
317
|
-
export declare const applyProtocolMessageAsClient: (deps: StorageDep) => (inputMessage: Uint8Array, options?: ApplyProtocolMessageAsClientOptions) => Promise<Result<ApplyProtocolMessageAsClientResult, ProtocolInvalidDataError | ProtocolSyncError | ProtocolUnsupportedVersionError | ProtocolWriteError | ProtocolWriteKeyError>>;
|
|
378
|
+
export declare const applyProtocolMessageAsClient: (deps: StorageDep) => (inputMessage: Uint8Array, options?: ApplyProtocolMessageAsClientOptions) => Promise<Result<ApplyProtocolMessageAsClientResult, ProtocolInvalidDataError | ProtocolSyncError | ProtocolUnsupportedVersionError | ProtocolWriteError | ProtocolWriteKeyError | ProtocolQuotaExceededError>>;
|
|
318
379
|
export interface ApplyProtocolMessageAsRelayOptions {
|
|
319
380
|
/** To subscribe an owner for broadcasting. */
|
|
320
381
|
subscribe?: (ownerId: OwnerId) => void;
|
|
@@ -322,8 +383,8 @@ export interface ApplyProtocolMessageAsRelayOptions {
|
|
|
322
383
|
unsubscribe?: (ownerId: OwnerId) => void;
|
|
323
384
|
/** To broadcast a protocol message to all subscribers. */
|
|
324
385
|
broadcast?: (ownerId: OwnerId, message: ProtocolMessage) => void;
|
|
325
|
-
totalMaxSize?:
|
|
326
|
-
rangesMaxSize?:
|
|
386
|
+
totalMaxSize?: ProtocolMessageMaxSize;
|
|
387
|
+
rangesMaxSize?: ProtocolMessageRangesMaxSize;
|
|
327
388
|
}
|
|
328
389
|
/**
|
|
329
390
|
* Result type for {@link applyProtocolMessageAsRelay}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgKG;AAGH,OAAO,EAA2B,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,MAAM,EAMP,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EAEb,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAW,MAAM,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAaL,cAAc,EAEd,WAAW,EAEZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,EACL,OAAO,EAGP,aAAa,EAEd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EAEjB,gBAAgB,EAIhB,SAAS,EAET,SAAS,EACT,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EA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