@evolu/common 8.0.0-next.4 → 8.0.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/Array.d.ts +279 -173
- package/dist/src/Array.d.ts.map +1 -1
- package/dist/src/Array.js +105 -101
- package/dist/src/Assert.d.ts +44 -44
- package/dist/src/Assert.d.ts.map +1 -1
- package/dist/src/Assert.js +44 -32
- package/dist/src/BigInt.d.ts +6 -3
- package/dist/src/BigInt.d.ts.map +1 -1
- package/dist/src/BigInt.js +5 -2
- package/dist/src/Brand.d.ts +27 -40
- package/dist/src/Brand.d.ts.map +1 -1
- package/dist/src/Buffer.d.ts +27 -11
- package/dist/src/Buffer.d.ts.map +1 -1
- package/dist/src/Cache.d.ts +9 -4
- package/dist/src/Cache.d.ts.map +1 -1
- package/dist/src/Cache.js +8 -3
- package/dist/src/Callbacks.d.ts +30 -19
- package/dist/src/Callbacks.d.ts.map +1 -1
- package/dist/src/Console.d.ts +145 -66
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +91 -43
- package/dist/src/Crypto.d.ts +85 -42
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +44 -20
- package/dist/src/Eq.d.ts +87 -21
- package/dist/src/Eq.d.ts.map +1 -1
- package/dist/src/Eq.js +67 -19
- package/dist/src/Error.d.ts +5 -3
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +16 -0
- package/dist/src/Function.d.ts +119 -58
- package/dist/src/Function.d.ts.map +1 -1
- package/dist/src/Function.js +86 -43
- package/dist/src/Http.d.ts +394 -0
- package/dist/src/Http.d.ts.map +1 -0
- package/dist/src/Http.js +102 -0
- package/dist/src/Identicon.d.ts +16 -7
- package/dist/src/Identicon.d.ts.map +1 -1
- package/dist/src/Identicon.js +14 -5
- package/dist/src/LeakDetector.d.ts +88 -0
- package/dist/src/LeakDetector.d.ts.map +1 -0
- package/dist/src/LeakDetector.js +86 -0
- package/dist/src/LockManager.d.ts +18 -9
- package/dist/src/LockManager.d.ts.map +1 -1
- package/dist/src/LockManager.js +7 -8
- package/dist/src/Lookup.d.ts +43 -13
- package/dist/src/Lookup.d.ts.map +1 -1
- package/dist/src/Lookup.js +28 -8
- package/dist/src/Microtask.d.ts +1 -1
- package/dist/src/Microtask.d.ts.map +1 -1
- package/dist/src/Microtask.js +3 -7
- package/dist/src/Number.d.ts +49 -13
- package/dist/src/Number.d.ts.map +1 -1
- package/dist/src/Number.js +34 -5
- package/dist/src/Object.d.ts +160 -40
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +92 -46
- package/dist/src/Option.d.ts +10 -7
- package/dist/src/Option.d.ts.map +1 -1
- package/dist/src/Option.js +9 -6
- package/dist/src/Order.d.ts +21 -21
- package/dist/src/Order.d.ts.map +1 -1
- package/dist/src/Order.js +18 -21
- package/dist/src/Platform.d.ts +31 -0
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +98 -0
- package/dist/src/Random.d.ts +32 -17
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/Random.js +12 -8
- package/dist/src/Redacted.d.ts +43 -29
- package/dist/src/Redacted.d.ts.map +1 -1
- package/dist/src/Redacted.js +14 -3
- package/dist/src/Ref.d.ts +11 -3
- package/dist/src/Ref.d.ts.map +1 -1
- package/dist/src/Ref.js +2 -2
- package/dist/src/RefCount.d.ts +2 -6
- package/dist/src/RefCount.d.ts.map +1 -1
- package/dist/src/RefCount.js +33 -90
- package/dist/src/Relation.d.ts +70 -5
- package/dist/src/Relation.d.ts.map +1 -1
- package/dist/src/Relation.js +77 -2
- package/dist/src/Resource.d.ts +590 -155
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +592 -343
- package/dist/src/Result.d.ts +838 -191
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +163 -102
- package/dist/src/Schedule.d.ts +684 -231
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/Schedule.js +766 -295
- package/dist/src/Set.d.ts +89 -40
- package/dist/src/Set.d.ts.map +1 -1
- package/dist/src/Set.js +50 -29
- package/dist/src/Sqlite.d.ts +29 -72
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +41 -46
- package/dist/src/StackTrace.d.ts +40 -0
- package/dist/src/StackTrace.d.ts.map +1 -0
- package/dist/src/StackTrace.js +140 -0
- package/dist/src/Store.d.ts +5 -4
- package/dist/src/Store.d.ts.map +1 -1
- package/dist/src/Store.js +5 -4
- package/dist/src/String.d.ts +7 -1
- package/dist/src/String.d.ts.map +1 -1
- package/dist/src/String.js +20 -7
- package/dist/src/Task.d.ts +3572 -1770
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +1879 -1274
- package/dist/src/Test.d.ts +17 -125
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +17 -68
- package/dist/src/Time.d.ts +108 -49
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +172 -73
- package/dist/src/Type.d.ts +3542 -1926
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +3070 -1784
- package/dist/src/Types.d.ts +200 -108
- package/dist/src/Types.d.ts.map +1 -1
- package/dist/src/Types.js +39 -8
- package/dist/src/WebSocket.d.ts +48 -23
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +15 -6
- package/dist/src/Worker.d.ts +94 -36
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +58 -24
- package/dist/src/index.d.ts +55 -52
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/intl/cs.d.ts +94 -0
- package/dist/src/intl/cs.d.ts.map +1 -0
- package/dist/src/intl/cs.js +220 -0
- package/dist/src/intl/index.d.ts +7 -0
- package/dist/src/intl/index.d.ts.map +1 -0
- package/dist/src/intl/index.js +6 -0
- package/dist/src/local-first/Db.d.ts +12 -8
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +109 -132
- package/dist/src/local-first/Error.d.ts +4 -4
- package/dist/src/local-first/Evolu.d.ts +338 -92
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +47 -55
- package/dist/src/local-first/LocalAuth.d.ts +4 -4
- package/dist/src/local-first/LocalAuth.d.ts.map +1 -1
- package/dist/src/local-first/Owner.d.ts +61 -24
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +45 -8
- package/dist/src/local-first/Protocol.d.ts +44 -31
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +36 -13
- package/dist/src/local-first/Query.d.ts +147 -62
- package/dist/src/local-first/Query.d.ts.map +1 -1
- package/dist/src/local-first/Query.js +112 -58
- package/dist/src/local-first/Relay.d.ts +44 -14
- package/dist/src/local-first/Relay.d.ts.map +1 -1
- package/dist/src/local-first/Schema.d.ts +92 -41
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +25 -8
- package/dist/src/local-first/Shared.d.ts +23 -21
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +100 -57
- package/dist/src/local-first/Storage.d.ts +53 -32
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +194 -234
- package/dist/src/local-first/Timestamp.d.ts +21 -21
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +2 -2
- package/dist/src/local-first/index.d.ts +11 -11
- package/package.json +14 -13
- package/src/Array.ts +306 -205
- package/src/Assert.ts +54 -69
- package/src/BigInt.ts +6 -3
- package/src/Brand.ts +27 -40
- package/src/Buffer.ts +28 -12
- package/src/Cache.ts +9 -4
- package/src/Callbacks.ts +30 -19
- package/src/Console.ts +156 -84
- package/src/Crypto.ts +83 -41
- package/src/Eq.ts +95 -22
- package/src/Error.ts +8 -4
- package/src/Function.ts +167 -59
- package/src/Http.ts +549 -0
- package/src/Identicon.ts +16 -7
- package/src/LeakDetector.ts +182 -0
- package/src/LockManager.ts +43 -39
- package/src/Lookup.ts +62 -28
- package/src/Microtask.ts +19 -23
- package/src/Number.ts +64 -12
- package/src/Object.ts +173 -49
- package/src/Option.ts +10 -7
- package/src/Order.ts +23 -21
- package/src/Platform.ts +136 -0
- package/src/Polyfills.ts +6 -12
- package/src/Random.ts +32 -19
- package/src/Redacted.ts +44 -30
- package/src/Ref.ts +14 -6
- package/src/RefCount.ts +38 -80
- package/src/Relation.ts +202 -10
- package/src/Resource.ts +1199 -591
- package/src/Result.ts +930 -271
- package/src/Schedule.ts +859 -343
- package/src/Set.ts +89 -40
- package/src/Sqlite.ts +144 -138
- package/src/StackTrace.ts +230 -0
- package/src/Store.ts +8 -7
- package/src/String.ts +22 -5
- package/src/Task.ts +5101 -2832
- package/src/Test.ts +20 -168
- package/src/Time.ts +293 -90
- package/src/Type.ts +10034 -4117
- package/src/Types.ts +227 -110
- package/src/WebSocket.ts +64 -36
- package/src/Worker.ts +180 -72
- package/src/index.ts +55 -52
- package/src/intl/cs.ts +388 -0
- package/src/intl/index.ts +7 -0
- package/src/local-first/Db.ts +152 -179
- package/src/local-first/Error.ts +4 -4
- package/src/local-first/Evolu.ts +495 -250
- package/src/local-first/LocalAuth.ts +6 -12
- package/src/local-first/Owner.ts +58 -21
- package/src/local-first/Protocol.ts +49 -31
- package/src/local-first/Query.ts +146 -61
- package/src/local-first/Relay.ts +51 -21
- package/src/local-first/Schema.ts +109 -51
- package/src/local-first/Shared.ts +266 -226
- package/src/local-first/Storage.ts +266 -264
- package/src/local-first/Timestamp.ts +25 -18
- package/src/local-first/index.ts +11 -11
- package/dist/src/Skiplist.d.ts +0 -28
- package/dist/src/Skiplist.d.ts.map +0 -1
- package/dist/src/Skiplist.js +0 -64
- package/dist/src/Tracer.d.ts +0 -48
- package/dist/src/Tracer.d.ts.map +0 -1
- package/dist/src/Tracer.js +0 -6
- package/src/Skiplist.ts +0 -108
- package/src/Tracer.ts +0 -54
|
@@ -56,11 +56,11 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
56
56
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
57
57
|
});
|
|
58
58
|
import { emptyArray, isNonEmptyArray, mapArray, } from "../Array.js";
|
|
59
|
-
import { assert, assertNonEmptyReadonlyArray
|
|
59
|
+
import { assert, assertNonEmptyReadonlyArray } from "../Assert.js";
|
|
60
60
|
import { createCallbacks } from "../Callbacks.js";
|
|
61
61
|
import { createConsole } from "../Console.js";
|
|
62
62
|
import { createUnknownError } from "../Error.js";
|
|
63
|
-
import { exhaustiveCheck, todo } from "../Function.js";
|
|
63
|
+
import { disposable, exhaustiveCheck, todo } from "../Function.js";
|
|
64
64
|
import { acquireLeaderLock, acquireLeaderLockCallback, } from "../LockManager.js";
|
|
65
65
|
import { createMicrotaskBatch } from "../Microtask.js";
|
|
66
66
|
import { createRefCountByKey } from "../RefCount.js";
|
|
@@ -68,7 +68,6 @@ import { err, ok } from "../Result.js";
|
|
|
68
68
|
import { isNonEmptySet } from "../Set.js";
|
|
69
69
|
import { SqliteBoolean, sqliteBooleanToBoolean } from "../Sqlite.js";
|
|
70
70
|
import { createStore } from "../Store.js";
|
|
71
|
-
import {} from "../Task.js";
|
|
72
71
|
import { brand, createId, createIdFromString, Name, UrlSafeString, } from "../Type.js";
|
|
73
72
|
import { createOwnerWebSocketTransport } from "./Owner.js";
|
|
74
73
|
import { applyPatches } from "./Query.js";
|
|
@@ -86,8 +85,8 @@ import { DbChange } from "./Storage.js";
|
|
|
86
85
|
* `_`) and must be between 1 and 41 characters.
|
|
87
86
|
*/
|
|
88
87
|
export const AppName = /*#__PURE__*/ brand("AppName", UrlSafeString, (value) => value.length >= 1 && value.length <= 41
|
|
89
|
-
? ok(
|
|
90
|
-
: err({ type: "AppName", value }));
|
|
88
|
+
? ok()
|
|
89
|
+
: err({ type: "AppName", value }), (error) => `The value ${JSON.stringify(error.value)} is not between 1 and 41 characters.`);
|
|
91
90
|
export const testAppName = /*#__PURE__*/ AppName.orThrow("AppName");
|
|
92
91
|
/**
|
|
93
92
|
* Creates shared dependencies used by all {@link createEvolu} instances on a
|
|
@@ -136,12 +135,11 @@ export const createEvoluDeps = (deps) => {
|
|
|
136
135
|
consoleLevel: console.getLevel(),
|
|
137
136
|
});
|
|
138
137
|
}));
|
|
139
|
-
|
|
140
|
-
return {
|
|
138
|
+
return disposable({
|
|
141
139
|
...deps,
|
|
140
|
+
console,
|
|
142
141
|
evoluError,
|
|
143
|
-
|
|
144
|
-
};
|
|
142
|
+
}, disposer);
|
|
145
143
|
}
|
|
146
144
|
catch (e_1) {
|
|
147
145
|
env_1.error = e_1;
|
|
@@ -221,31 +219,12 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
221
219
|
exportDatabasePending?.reject({ type: "EvoluDisposedError" });
|
|
222
220
|
exportDatabasePending = null;
|
|
223
221
|
});
|
|
224
|
-
const mutateBatch = disposer.use(createMicrotaskBatch((items) => {
|
|
225
|
-
console.debug("mutateBatch", { changeCount: items.length });
|
|
226
|
-
releaseUnsubscribedLoadingPromises();
|
|
227
|
-
postMessage({
|
|
228
|
-
type: "Mutate",
|
|
229
|
-
changes: mapArray(items, (item) => item.change),
|
|
230
|
-
onCompleteIds: items.flatMap((item) => item.onComplete
|
|
231
|
-
? [onMutateCompleteCallbacks.register(item.onComplete)]
|
|
232
|
-
: []),
|
|
233
|
-
subscribedQueries: subscribedQueriesRefCount.keys(),
|
|
234
|
-
});
|
|
235
|
-
}));
|
|
236
|
-
const queryBatch = disposer.use(createMicrotaskBatch((queries) => {
|
|
237
|
-
const dedupedQueries = new Set(queries);
|
|
238
|
-
assert(isNonEmptySet(dedupedQueries), "Expected non-empty query batch.");
|
|
239
|
-
console.debug("queryBatch", { queryCount: dedupedQueries.size });
|
|
240
|
-
postMessage({ type: "Query", queries: dedupedQueries });
|
|
241
|
-
}));
|
|
242
|
-
const useOwnerBatch = disposer.use(createMicrotaskBatch((actions) => postMessage({ type: "UseOwner", actions })));
|
|
243
222
|
let postMessage;
|
|
244
223
|
// Scope worker/channel wiring and keep only postMessage outside.
|
|
245
224
|
{
|
|
246
225
|
const id = createId(run.deps);
|
|
247
226
|
const { createMessageChannel, sharedWorker } = run.deps;
|
|
248
|
-
disposer.use(await run.
|
|
227
|
+
disposer.use(await run.ok(acquireLeaderLock(id)));
|
|
249
228
|
const evoluChannel = disposer.use(createMessageChannel());
|
|
250
229
|
evoluChannel.port1.onMessage = (message) => {
|
|
251
230
|
switch (message.type) {
|
|
@@ -320,8 +299,34 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
320
299
|
}, [evoluChannel.port2.native]);
|
|
321
300
|
postMessage = evoluChannel.port1.postMessage;
|
|
322
301
|
}
|
|
302
|
+
const mutateBatch = disposer.use(createMicrotaskBatch((items) => {
|
|
303
|
+
if (disposed)
|
|
304
|
+
return;
|
|
305
|
+
console.debug("mutateBatch", { changeCount: items.length });
|
|
306
|
+
releaseUnsubscribedLoadingPromises();
|
|
307
|
+
postMessage({
|
|
308
|
+
type: "Mutate",
|
|
309
|
+
changes: mapArray(items, (item) => item.change),
|
|
310
|
+
onCompleteIds: items.flatMap((item) => item.onComplete
|
|
311
|
+
? [onMutateCompleteCallbacks.register(item.onComplete)]
|
|
312
|
+
: []),
|
|
313
|
+
subscribedQueries: subscribedQueriesRefCount.keys(),
|
|
314
|
+
});
|
|
315
|
+
}));
|
|
316
|
+
const queryBatch = disposer.use(createMicrotaskBatch((queries) => {
|
|
317
|
+
if (disposed)
|
|
318
|
+
return;
|
|
319
|
+
const dedupedQueries = new Set(queries);
|
|
320
|
+
assert(isNonEmptySet(dedupedQueries), "Expected non-empty query batch.");
|
|
321
|
+
console.debug("queryBatch", { queryCount: dedupedQueries.size });
|
|
322
|
+
postMessage({ type: "Query", queries: dedupedQueries });
|
|
323
|
+
}));
|
|
324
|
+
const useOwnerBatch = disposer.use(createMicrotaskBatch((actions) => {
|
|
325
|
+
if (disposed)
|
|
326
|
+
return;
|
|
327
|
+
postMessage({ type: "UseOwner", actions });
|
|
328
|
+
}));
|
|
323
329
|
const createMutation = (kind) => (table, values, options) => {
|
|
324
|
-
assertNotDisposed(disposables);
|
|
325
330
|
const { id = createId(run.deps), isDeleted, ...changeValues } = values;
|
|
326
331
|
const dbChange = {
|
|
327
332
|
table,
|
|
@@ -340,7 +345,6 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
340
345
|
return { id };
|
|
341
346
|
};
|
|
342
347
|
const loadQuery = (query) => {
|
|
343
|
-
assertNotDisposed(disposables);
|
|
344
348
|
const loadingPromise = loadingPromisesByQuery.get(query);
|
|
345
349
|
if (loadingPromise) {
|
|
346
350
|
return loadingPromise.promise;
|
|
@@ -356,13 +360,8 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
356
360
|
queryBatch.push(query);
|
|
357
361
|
return typedPromise;
|
|
358
362
|
};
|
|
359
|
-
const getQueryRows = (query) =>
|
|
360
|
-
assertNotDisposed(disposables);
|
|
361
|
-
return (rowsByQueryMapStore.get().get(query) ??
|
|
362
|
-
emptyArray);
|
|
363
|
-
};
|
|
363
|
+
const getQueryRows = (query) => (rowsByQueryMapStore.get().get(query) ?? emptyArray);
|
|
364
364
|
const useOwner = (owner, ownerTransports) => {
|
|
365
|
-
assertNotDisposed(disposables);
|
|
366
365
|
const effectiveTransports = ownerTransports ?? transports;
|
|
367
366
|
assertNonEmptyReadonlyArray(effectiveTransports, "useOwner requires explicit non-empty transports when config.transports is empty.");
|
|
368
367
|
const syncOwner = {
|
|
@@ -375,7 +374,7 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
375
374
|
});
|
|
376
375
|
let isUsed = true;
|
|
377
376
|
return () => {
|
|
378
|
-
if (
|
|
377
|
+
if (disposed)
|
|
379
378
|
return;
|
|
380
379
|
assert(isUsed, "UnuseOwner can be called only once.");
|
|
381
380
|
isUsed = false;
|
|
@@ -385,13 +384,15 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
385
384
|
});
|
|
386
385
|
};
|
|
387
386
|
};
|
|
388
|
-
|
|
387
|
+
let disposed = false;
|
|
388
|
+
disposer.defer(() => {
|
|
389
|
+
disposed = true;
|
|
390
|
+
console.info("disposeEvolu");
|
|
391
|
+
});
|
|
389
392
|
if (isNonEmptyArray(transports))
|
|
390
393
|
useOwner(appOwner);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
return ok({
|
|
394
|
+
run.signal.throwIfAborted();
|
|
395
|
+
return ok(disposable({
|
|
395
396
|
name,
|
|
396
397
|
appOwner,
|
|
397
398
|
insert: createMutation("insert"),
|
|
@@ -400,7 +401,6 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
400
401
|
loadQuery,
|
|
401
402
|
loadQueries: (queries) => queries.map((query) => loadQuery(query)),
|
|
402
403
|
subscribeQuery: (query) => (listener) => {
|
|
403
|
-
assertNotDisposed(disposables);
|
|
404
404
|
subscribedQueriesRefCount.increment(query);
|
|
405
405
|
let isSubscribed = true;
|
|
406
406
|
let previousRows = null;
|
|
@@ -415,15 +415,14 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
415
415
|
assert(isSubscribed, "subscribeQuery unsubscribe can be called only once.");
|
|
416
416
|
isSubscribed = false;
|
|
417
417
|
previousRows = null;
|
|
418
|
-
|
|
419
|
-
if (disposables.disposed)
|
|
418
|
+
if (disposed)
|
|
420
419
|
return;
|
|
420
|
+
unsubscribe();
|
|
421
421
|
subscribedQueriesRefCount.decrement(query);
|
|
422
422
|
};
|
|
423
423
|
},
|
|
424
424
|
getQueryRows,
|
|
425
425
|
exportDatabase: () => {
|
|
426
|
-
assertNotDisposed(disposables);
|
|
427
426
|
if (!exportDatabasePending) {
|
|
428
427
|
exportDatabasePending =
|
|
429
428
|
Promise.withResolvers();
|
|
@@ -432,21 +431,14 @@ export const createEvolu = (schema, config) => async (run) => {
|
|
|
432
431
|
return exportDatabasePending.promise;
|
|
433
432
|
},
|
|
434
433
|
deleteDatabase: () => {
|
|
435
|
-
assertNotDisposed(disposables);
|
|
436
434
|
todo();
|
|
437
435
|
},
|
|
438
436
|
deleteOwner: (owner) => {
|
|
439
|
-
assertNotDisposed(disposables);
|
|
440
437
|
void owner;
|
|
441
438
|
todo();
|
|
442
439
|
},
|
|
443
440
|
useOwner,
|
|
444
|
-
|
|
445
|
-
if (!disposables.disposed)
|
|
446
|
-
console.info("disposeEvolu");
|
|
447
|
-
return disposables.disposeAsync();
|
|
448
|
-
},
|
|
449
|
-
});
|
|
441
|
+
}, disposer));
|
|
450
442
|
}
|
|
451
443
|
catch (e_2) {
|
|
452
444
|
env_2.error = e_2;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { RandomBytesDep } from "../Crypto.
|
|
7
|
-
import type { Mnemonic } from "../Type.
|
|
8
|
-
import type { AppOwner } from "./Owner.
|
|
9
|
-
import { OwnerId } from "./Owner.
|
|
6
|
+
import type { RandomBytesDep } from "../Crypto.ts";
|
|
7
|
+
import type { Mnemonic } from "../Type.ts";
|
|
8
|
+
import type { AppOwner } from "./Owner.ts";
|
|
9
|
+
import { OwnerId } from "./Owner.ts";
|
|
10
10
|
/**
|
|
11
11
|
* Local authentication and authorization system for Evolu. This is API is
|
|
12
12
|
* subject to change and not recommended for production use.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAuth.d.ts","sourceRoot":"","sources":["../../../src/local-first/LocalAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAKL,OAAO,EAER,MA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 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { NonEmptyReadonlyArray } from "../Array.
|
|
7
|
-
import type { RandomBytesDep } from "../Crypto.
|
|
8
|
-
import { Mnemonic, NonNegativeInt, type Typed } from "../Type.
|
|
9
|
-
import { TimestampBytes } from "./Timestamp.
|
|
6
|
+
import type { NonEmptyReadonlyArray } from "../Array.ts";
|
|
7
|
+
import type { RandomBytesDep } from "../Crypto.ts";
|
|
8
|
+
import { Mnemonic, NonNegativeInt, type Typed } from "../Type.ts";
|
|
9
|
+
import { TimestampBytes } from "./Timestamp.ts";
|
|
10
10
|
/**
|
|
11
11
|
* {@link Owner} without a {@link OwnerWriteKey}.
|
|
12
12
|
*
|
|
@@ -61,25 +61,25 @@ export interface SyncOwner {
|
|
|
61
61
|
readonly transports: NonEmptyReadonlyArray<OwnerTransport>;
|
|
62
62
|
}
|
|
63
63
|
/** OwnerId is a branded {@link Id} that uniquely identifies an {@link Owner}. */
|
|
64
|
-
export declare const OwnerId: import("../Type.
|
|
65
|
-
export type OwnerId = typeof OwnerId.
|
|
64
|
+
export declare const OwnerId: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"String", string, string, import("../Type.ts").TypeOfError<"String">, null, import("../Type.ts").TypeOfError<"String">, never, string, true>, "Id", import("../Type.ts").IdError>, "OwnerId", never>;
|
|
65
|
+
export type OwnerId = typeof OwnerId.Output;
|
|
66
66
|
/** Bytes representation of {@link OwnerId}. */
|
|
67
|
-
export declare const OwnerIdBytes: import("../Type.
|
|
68
|
-
export type OwnerIdBytes = typeof OwnerIdBytes.
|
|
67
|
+
export declare const OwnerIdBytes: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Length16", import("../Type.ts").LengthError<16>>, "IdBytes", never>, "OwnerIdBytes", never>;
|
|
68
|
+
export type OwnerIdBytes = typeof OwnerIdBytes.Output;
|
|
69
69
|
/** Converts {@link OwnerId} to {@link OwnerIdBytes}. */
|
|
70
70
|
export declare const ownerIdToOwnerIdBytes: (ownerId: OwnerId) => OwnerIdBytes;
|
|
71
71
|
/** Converts {@link OwnerIdBytes} to {@link OwnerId}. */
|
|
72
72
|
export declare const ownerIdBytesToOwnerId: (ownerIdBytes: OwnerIdBytes) => OwnerId;
|
|
73
|
-
export declare const ownerWriteKeyLength: number & import("../Brand.
|
|
73
|
+
export declare const ownerWriteKeyLength: number & import("../Brand.ts").Brand<"NonNaN"> & import("../Brand.ts").Brand<"Finite"> & import("../Brand.ts").Brand<"Int"> & import("../Brand.ts").Brand<"NonNegative">;
|
|
74
74
|
/** Symmetric encryption key for {@link Owner} data protection. */
|
|
75
|
-
export declare const OwnerEncryptionKey: import("../Type.
|
|
76
|
-
export type OwnerEncryptionKey = typeof OwnerEncryptionKey.
|
|
75
|
+
export declare const OwnerEncryptionKey: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("../Type.ts").LengthError<32>>, "EncryptionKey", never>, "OwnerEncryptionKey", never>;
|
|
76
|
+
export type OwnerEncryptionKey = typeof OwnerEncryptionKey.Output;
|
|
77
77
|
/**
|
|
78
78
|
* A secure token for write operations. It's derived from {@link OwnerSecret} by
|
|
79
79
|
* default and can be rotated via {@link createOwnerWriteKey}.
|
|
80
80
|
*/
|
|
81
|
-
export declare const OwnerWriteKey: import("../Type.
|
|
82
|
-
export type OwnerWriteKey = typeof OwnerWriteKey.
|
|
81
|
+
export declare const OwnerWriteKey: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length16", import("../Type.ts").LengthError<16>>, "OwnerWriteKey", never>;
|
|
82
|
+
export type OwnerWriteKey = typeof OwnerWriteKey.Output;
|
|
83
83
|
/**
|
|
84
84
|
* Creates a new random {@link OwnerWriteKey} for rotation.
|
|
85
85
|
*
|
|
@@ -94,12 +94,12 @@ export declare const createOwnerWriteKey: (deps: RandomBytesDep) => OwnerWriteKe
|
|
|
94
94
|
* Can be created using {@link createOwnerSecret} or converted from a
|
|
95
95
|
* {@link Mnemonic} using {@link mnemonicToOwnerSecret}.
|
|
96
96
|
*/
|
|
97
|
-
export declare const OwnerSecret: import("../Type.
|
|
98
|
-
export type OwnerSecret = typeof OwnerSecret.
|
|
97
|
+
export declare const OwnerSecret: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("../Type.ts").LengthError<32>>, "OwnerSecret", never>;
|
|
98
|
+
export type OwnerSecret = typeof OwnerSecret.Output;
|
|
99
99
|
/** Creates a {@link OwnerSecret}. */
|
|
100
100
|
export declare const createOwnerSecret: (deps: RandomBytesDep) => OwnerSecret;
|
|
101
101
|
/** Deterministic {@link OwnerSecret} for tests. */
|
|
102
|
-
export declare const testOwnerSecret: Uint8Array<ArrayBufferLike> & import("../Brand.
|
|
102
|
+
export declare const testOwnerSecret: Uint8Array<ArrayBufferLike> & import("../Brand.ts").Brand<"Entropy"> & import("../Brand.ts").Brand<"Length32"> & import("../Brand.ts").Brand<"OwnerSecret">;
|
|
103
103
|
/** Converts an {@link OwnerSecret} to a {@link Mnemonic}. */
|
|
104
104
|
export declare const ownerSecretToMnemonic: (secret: OwnerSecret) => Mnemonic;
|
|
105
105
|
/** Converts a {@link Mnemonic} to an {@link OwnerSecret}. */
|
|
@@ -251,15 +251,37 @@ export interface OwnerWebSocketTransport extends Typed<"WebSocket"> {
|
|
|
251
251
|
* ### Example
|
|
252
252
|
*
|
|
253
253
|
* ```ts
|
|
254
|
-
*
|
|
254
|
+
* import {
|
|
255
|
+
* AppName,
|
|
256
|
+
* createAppOwner,
|
|
257
|
+
* createEvolu,
|
|
258
|
+
* createOwnerWebSocketTransport,
|
|
259
|
+
* createOwnerSecret,
|
|
260
|
+
* createRandomBytes,
|
|
261
|
+
* id,
|
|
262
|
+
* } from "@evolu/common";
|
|
263
|
+
*
|
|
264
|
+
* // Create once, persist the mnemonic securely, and restore it on later runs.
|
|
265
|
+
* const appOwner = createAppOwner(
|
|
266
|
+
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
267
|
+
* );
|
|
255
268
|
* const transport = createOwnerWebSocketTransport({
|
|
256
269
|
* url: "wss://relay.evolu.dev",
|
|
257
|
-
* ownerId:
|
|
270
|
+
* ownerId: appOwner.id,
|
|
258
271
|
* });
|
|
272
|
+
* const createTodoEvolu = createEvolu(
|
|
273
|
+
* { todo: { id: id("Todo") } },
|
|
274
|
+
* {
|
|
275
|
+
* appName: AppName.orThrow("OwnerTransportExample"),
|
|
276
|
+
* appOwner,
|
|
277
|
+
* transports: [transport],
|
|
278
|
+
* },
|
|
279
|
+
* );
|
|
259
280
|
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
281
|
+
* expect(createTodoEvolu).toBeTypeOf("function");
|
|
282
|
+
* expect(transport).toEqual({
|
|
283
|
+
* type: "WebSocket",
|
|
284
|
+
* url: `wss://relay.evolu.dev?ownerId=${appOwner.id}`,
|
|
263
285
|
* });
|
|
264
286
|
* ```
|
|
265
287
|
*/
|
|
@@ -277,10 +299,25 @@ export declare const createOwnerWebSocketTransport: (config: {
|
|
|
277
299
|
* ### Example
|
|
278
300
|
*
|
|
279
301
|
* ```ts
|
|
280
|
-
*
|
|
281
|
-
*
|
|
302
|
+
* import {
|
|
303
|
+
* createAppOwner,
|
|
304
|
+
* createOwnerSecret,
|
|
305
|
+
* createRandomBytes,
|
|
306
|
+
* parseOwnerIdFromOwnerWebSocketTransportUrl,
|
|
307
|
+
* } from "@evolu/common";
|
|
308
|
+
*
|
|
309
|
+
* // Create once, persist the mnemonic securely, and restore it on later runs.
|
|
310
|
+
* const appOwner = createAppOwner(
|
|
311
|
+
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
312
|
+
* );
|
|
313
|
+
* const url = `/sync?ownerId=${appOwner.id}`;
|
|
314
|
+
*
|
|
315
|
+
* expect(parseOwnerIdFromOwnerWebSocketTransportUrl(url)).toBe(
|
|
316
|
+
* appOwner.id,
|
|
282
317
|
* );
|
|
283
|
-
*
|
|
318
|
+
* expect(
|
|
319
|
+
* parseOwnerIdFromOwnerWebSocketTransportUrl("/sync?ownerId=invalid"),
|
|
320
|
+
* ).toBeNull();
|
|
284
321
|
* ```
|
|
285
322
|
*/
|
|
286
323
|
export declare const parseOwnerIdFromOwnerWebSocketTransportUrl: (url: string) => OwnerId | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Owner.d.ts","sourceRoot":"","sources":["../../../src/local-first/Owner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUnD,OAAO,EAML,QAAQ,EACR,cAAc,EACd,KAAK,KAAK,EACX,MAAM,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O,MAAM,6BAA6B,WAAY;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,KAAG,uBAGF,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,0CAA0C,QAChD,MAAM,KACV,OAAO,GAAG,IAAyD,CAAC;AAEvE,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAE/B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAErC,wEAAwE;IACxE,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IAE/C;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa,GAAG,qBAAqB,CAAC;CAC5E"}
|
|
@@ -128,15 +128,37 @@ export const createSharedReadonlyOwner = (sharedOwner) => ({
|
|
|
128
128
|
* ### Example
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
*
|
|
131
|
+
* import {
|
|
132
|
+
* AppName,
|
|
133
|
+
* createAppOwner,
|
|
134
|
+
* createEvolu,
|
|
135
|
+
* createOwnerWebSocketTransport,
|
|
136
|
+
* createOwnerSecret,
|
|
137
|
+
* createRandomBytes,
|
|
138
|
+
* id,
|
|
139
|
+
* } from "@evolu/common";
|
|
140
|
+
*
|
|
141
|
+
* // Create once, persist the mnemonic securely, and restore it on later runs.
|
|
142
|
+
* const appOwner = createAppOwner(
|
|
143
|
+
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
144
|
+
* );
|
|
132
145
|
* const transport = createOwnerWebSocketTransport({
|
|
133
146
|
* url: "wss://relay.evolu.dev",
|
|
134
|
-
* ownerId:
|
|
147
|
+
* ownerId: appOwner.id,
|
|
135
148
|
* });
|
|
149
|
+
* const createTodoEvolu = createEvolu(
|
|
150
|
+
* { todo: { id: id("Todo") } },
|
|
151
|
+
* {
|
|
152
|
+
* appName: AppName.orThrow("OwnerTransportExample"),
|
|
153
|
+
* appOwner,
|
|
154
|
+
* transports: [transport],
|
|
155
|
+
* },
|
|
156
|
+
* );
|
|
136
157
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
158
|
+
* expect(createTodoEvolu).toBeTypeOf("function");
|
|
159
|
+
* expect(transport).toEqual({
|
|
160
|
+
* type: "WebSocket",
|
|
161
|
+
* url: `wss://relay.evolu.dev?ownerId=${appOwner.id}`,
|
|
140
162
|
* });
|
|
141
163
|
* ```
|
|
142
164
|
*/
|
|
@@ -154,10 +176,25 @@ export const createOwnerWebSocketTransport = (config) => ({
|
|
|
154
176
|
* ### Example
|
|
155
177
|
*
|
|
156
178
|
* ```ts
|
|
157
|
-
*
|
|
158
|
-
*
|
|
179
|
+
* import {
|
|
180
|
+
* createAppOwner,
|
|
181
|
+
* createOwnerSecret,
|
|
182
|
+
* createRandomBytes,
|
|
183
|
+
* parseOwnerIdFromOwnerWebSocketTransportUrl,
|
|
184
|
+
* } from "@evolu/common";
|
|
185
|
+
*
|
|
186
|
+
* // Create once, persist the mnemonic securely, and restore it on later runs.
|
|
187
|
+
* const appOwner = createAppOwner(
|
|
188
|
+
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
189
|
+
* );
|
|
190
|
+
* const url = `/sync?ownerId=${appOwner.id}`;
|
|
191
|
+
*
|
|
192
|
+
* expect(parseOwnerIdFromOwnerWebSocketTransportUrl(url)).toBe(
|
|
193
|
+
* appOwner.id,
|
|
159
194
|
* );
|
|
160
|
-
*
|
|
195
|
+
* expect(
|
|
196
|
+
* parseOwnerIdFromOwnerWebSocketTransportUrl("/sync?ownerId=invalid"),
|
|
197
|
+
* ).toBeNull();
|
|
161
198
|
* ```
|
|
162
199
|
*/
|
|
163
200
|
export const parseOwnerIdFromOwnerWebSocketTransportUrl = (url) => getOrNull(OwnerId.fromUnknown(url.split("=")[1]));
|
|
@@ -159,18 +159,18 @@
|
|
|
159
159
|
*
|
|
160
160
|
* @module
|
|
161
161
|
*/
|
|
162
|
-
import { type NonEmptyReadonlyArray } from "../Array.
|
|
163
|
-
import type { Brand } from "../Brand.
|
|
164
|
-
import { type Buffer } from "../Buffer.
|
|
165
|
-
import type { ConsoleDep } from "../Console.
|
|
166
|
-
import { type DecryptWithXChaCha20Poly1305Error, EncryptionKey, type RandomBytesDep } from "../Crypto.
|
|
167
|
-
import { type Result } from "../Result.
|
|
168
|
-
import { SqliteValue } from "../Sqlite.
|
|
169
|
-
import type
|
|
170
|
-
import { NonNegativeInt, PositiveInt, type Typed } from "../Type.
|
|
171
|
-
import { type Owner, type OwnerError, OwnerId, OwnerWriteKey } from "./Owner.
|
|
172
|
-
import { type BaseRange, type CrdtMessage, DbChange, type EncryptedCrdtMessage, type EncryptedDbChange, type FingerprintRange, RangeType, type SkipRange, type StorageDep } from "./Storage.
|
|
173
|
-
import { NodeId, Timestamp } from "./Timestamp.
|
|
162
|
+
import { type NonEmptyReadonlyArray } from "../Array.ts";
|
|
163
|
+
import type { Brand } from "../Brand.ts";
|
|
164
|
+
import { type Buffer } from "../Buffer.ts";
|
|
165
|
+
import type { ConsoleDep } from "../Console.ts";
|
|
166
|
+
import { type DecryptWithXChaCha20Poly1305Error, EncryptionKey, type RandomBytesDep } from "../Crypto.ts";
|
|
167
|
+
import { type Result } from "../Result.ts";
|
|
168
|
+
import { SqliteValue } from "../Sqlite.ts";
|
|
169
|
+
import { type Task } from "../Task.ts";
|
|
170
|
+
import { NonNegativeInt, PositiveInt, type Typed } from "../Type.ts";
|
|
171
|
+
import { type Owner, type OwnerError, OwnerId, OwnerWriteKey } from "./Owner.ts";
|
|
172
|
+
import { type BaseRange, type CrdtMessage, DbChange, type EncryptedCrdtMessage, type EncryptedDbChange, type FingerprintRange, RangeType, type SkipRange, type StorageDep } from "./Storage.ts";
|
|
173
|
+
import { NodeId, Timestamp } from "./Timestamp.ts";
|
|
174
174
|
/**
|
|
175
175
|
* Protocol message maximum size.
|
|
176
176
|
*
|
|
@@ -187,8 +187,8 @@ import { NodeId, Timestamp } from "./Timestamp.js";
|
|
|
187
187
|
* Increasing this value on the client side would break compatibility with
|
|
188
188
|
* relays that enforce smaller limits.
|
|
189
189
|
*/
|
|
190
|
-
export declare const ProtocolMessageMaxSize: import("../Type.
|
|
191
|
-
export type ProtocolMessageMaxSize = typeof ProtocolMessageMaxSize.
|
|
190
|
+
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>>;
|
|
191
|
+
export type ProtocolMessageMaxSize = typeof ProtocolMessageMaxSize.Output;
|
|
192
192
|
/**
|
|
193
193
|
* Default {@link ProtocolMessageMaxSize} (1MB).
|
|
194
194
|
*
|
|
@@ -207,8 +207,8 @@ export declare const defaultProtocolMessageMaxSize: ProtocolMessageMaxSize;
|
|
|
207
207
|
* {@link defaultProtocolMessageMaxSize}, maintaining compatibility between all
|
|
208
208
|
* clients and relays.
|
|
209
209
|
*/
|
|
210
|
-
export declare const ProtocolMessageRangesMaxSize: import("../Type.
|
|
211
|
-
export type ProtocolMessageRangesMaxSize = typeof ProtocolMessageRangesMaxSize.
|
|
210
|
+
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>>;
|
|
211
|
+
export type ProtocolMessageRangesMaxSize = typeof ProtocolMessageRangesMaxSize.Output;
|
|
212
212
|
/**
|
|
213
213
|
* Default {@link ProtocolMessageRangesMaxSize} (30KB).
|
|
214
214
|
*
|
|
@@ -219,7 +219,7 @@ export declare const defaultProtocolMessageRangesMaxSize: ProtocolMessageRangesM
|
|
|
219
219
|
/** Evolu Protocol Message. */
|
|
220
220
|
export type ProtocolMessage = Uint8Array & Brand<"ProtocolMessage">;
|
|
221
221
|
/** Evolu Protocol version. */
|
|
222
|
-
export declare const protocolVersion: number & Brand<"Int"> & Brand<"NonNegative"> & Brand<"Positive">;
|
|
222
|
+
export declare const protocolVersion: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative"> & Brand<"Positive">;
|
|
223
223
|
export declare const MessageType: {
|
|
224
224
|
/** Request message from initiator (client) to non-initiator (relay). */
|
|
225
225
|
readonly Request: 0;
|
|
@@ -427,7 +427,13 @@ export declare const decodeNumber: (buffer: Buffer) => number;
|
|
|
427
427
|
* ### Example
|
|
428
428
|
*
|
|
429
429
|
* ```ts
|
|
430
|
-
*
|
|
430
|
+
* import { createBuffer } from "@evolu/common";
|
|
431
|
+
* import { encodeFlags } from "@evolu/common/local-first";
|
|
432
|
+
*
|
|
433
|
+
* const buffer = createBuffer();
|
|
434
|
+
* encodeFlags(buffer, [true, false, true]);
|
|
435
|
+
*
|
|
436
|
+
* expect(buffer.unwrap()).toEqual(new Uint8Array([0b101]));
|
|
431
437
|
* ```
|
|
432
438
|
*/
|
|
433
439
|
export declare const encodeFlags: (buffer: Buffer, flags: ReadonlyArray<boolean>) => void;
|
|
@@ -437,7 +443,14 @@ export declare const encodeFlags: (buffer: Buffer, flags: ReadonlyArray<boolean>
|
|
|
437
443
|
* ### Example
|
|
438
444
|
*
|
|
439
445
|
* ```ts
|
|
440
|
-
*
|
|
446
|
+
* import { createBuffer, PositiveInt } from "@evolu/common";
|
|
447
|
+
* import { decodeFlags } from "@evolu/common/local-first";
|
|
448
|
+
*
|
|
449
|
+
* const buffer = createBuffer([0b101]);
|
|
450
|
+
* const flags = decodeFlags(buffer, PositiveInt.orThrow(3));
|
|
451
|
+
*
|
|
452
|
+
* expect(flags).toEqual([true, false, true]);
|
|
453
|
+
* expect(buffer.getLength()).toBe(0);
|
|
441
454
|
* ```
|
|
442
455
|
*/
|
|
443
456
|
export declare const decodeFlags: (buffer: Buffer, count: PositiveInt) => ReadonlyArray<boolean>;
|
|
@@ -470,23 +483,23 @@ export declare const encodeNonNegativeInt: (buffer: Buffer, int: NonNegativeInt)
|
|
|
470
483
|
*/
|
|
471
484
|
export declare const decodeNonNegativeInt: (buffer: Buffer) => NonNegativeInt;
|
|
472
485
|
export declare const encodeLength: (buffer: Buffer, value: ArrayLike<any>) => void;
|
|
473
|
-
export declare const decodeLength:
|
|
486
|
+
export declare const decodeLength: typeof decodeNonNegativeInt;
|
|
474
487
|
export declare const encodeString: (buffer: Buffer, value: string) => void;
|
|
475
488
|
export declare const decodeString: (buffer: Buffer) => string;
|
|
476
489
|
export declare const encodeNodeId: (buffer: Buffer, nodeId: NodeId) => void;
|
|
477
490
|
export declare const decodeNodeId: (buffer: Buffer) => NodeId;
|
|
478
491
|
export declare const ProtocolValueType: {
|
|
479
|
-
readonly String: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
480
|
-
readonly Number: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
481
|
-
readonly Null: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
482
|
-
readonly Bytes: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
483
|
-
readonly NonNegativeInt: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
484
|
-
readonly EmptyString: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
485
|
-
readonly Base64Url: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
486
|
-
readonly Id: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
487
|
-
readonly Json: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
488
|
-
readonly DateIsoWithNonNegativeTime: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
489
|
-
readonly DateIsoWithNegativeTime: number & Brand<"Int"> & Brand<"NonNegative">;
|
|
492
|
+
readonly String: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
493
|
+
readonly Number: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
494
|
+
readonly Null: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
495
|
+
readonly Bytes: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
496
|
+
readonly NonNegativeInt: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
497
|
+
readonly EmptyString: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
498
|
+
readonly Base64Url: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
499
|
+
readonly Id: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
500
|
+
readonly Json: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
501
|
+
readonly DateIsoWithNonNegativeTime: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
502
|
+
readonly DateIsoWithNegativeTime: number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
|
|
490
503
|
};
|
|
491
504
|
export declare const encodeSqliteValue: (buffer: Buffer, value: SqliteValue) => void;
|
|
492
505
|
export declare const decodeSqliteValue: (buffer: Buffer) => SqliteValue;
|