@evolu/common 8.10.0 → 8.12.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 +39 -2
- package/dist/src/Bytes.d.ts.map +1 -1
- package/dist/src/Bytes.js +50 -2
- package/dist/src/Config.d.ts +22 -22
- package/dist/src/Config.d.ts.map +1 -1
- package/dist/src/Console.d.ts +62 -7
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +20 -4
- package/dist/src/Crypto.d.ts +76 -4
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +55 -4
- package/dist/src/Error.d.ts +45 -0
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +69 -0
- package/dist/src/Fs.d.ts +92 -18
- package/dist/src/Fs.d.ts.map +1 -1
- package/dist/src/Fs.js +2 -0
- package/dist/src/Identicon.d.ts +2 -2
- package/dist/src/Identicon.js +2 -2
- package/dist/src/LeakDetector.d.ts +22 -3
- package/dist/src/LeakDetector.d.ts.map +1 -1
- package/dist/src/LeakDetector.js +12 -2
- package/dist/src/LockManager.d.ts +8 -0
- package/dist/src/LockManager.d.ts.map +1 -1
- package/dist/src/LockManager.js +6 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +5 -0
- package/dist/src/Platform.d.ts +47 -7
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +24 -5
- package/dist/src/Random.d.ts +25 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/Random.js +14 -2
- package/dist/src/Resource.d.ts +156 -1
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +201 -72
- package/dist/src/Schedule.d.ts +11 -10
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/Schedule.js +1 -1
- package/dist/src/Sqlite.d.ts +132 -16
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +63 -9
- package/dist/src/Task.d.ts +15 -4
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +41 -15
- package/dist/src/Test.d.ts +9 -0
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +4 -0
- package/dist/src/Time.d.ts +106 -9
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +55 -4
- package/dist/src/Type.d.ts +1455 -1310
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +1274 -517
- package/dist/src/WebSocket.d.ts +164 -13
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +133 -24
- package/dist/src/Worker.d.ts +90 -8
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +28 -2
- package/dist/src/index.d.ts +6 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/dist/src/local-first/Db.d.ts +52 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +412 -137
- package/dist/src/local-first/Evolu.d.ts +412 -213
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +181 -18
- package/dist/src/local-first/Owner.d.ts +13 -30
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +13 -30
- package/dist/src/local-first/Protocol.d.ts +106 -19
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +162 -60
- package/dist/src/local-first/Query.d.ts +8 -15
- package/dist/src/local-first/Query.d.ts.map +1 -1
- package/dist/src/local-first/Relay.d.ts.map +1 -1
- package/dist/src/local-first/Relay.js +4 -2
- package/dist/src/local-first/Schema.d.ts +346 -23
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +214 -17
- package/dist/src/local-first/Shared.d.ts +537 -22
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +1437 -234
- package/dist/src/local-first/Storage.d.ts +195 -17
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +85 -22
- package/dist/src/local-first/Timestamp.d.ts +392 -41
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +403 -81
- package/dist/src/local-first/index.d.ts +0 -1
- package/dist/src/local-first/index.d.ts.map +1 -1
- package/dist/src/local-first/index.js +0 -1
- package/package.json +1 -1
- package/src/Assert.test.ts +2 -5
- package/src/Bytes.test.ts +27 -0
- package/src/Bytes.ts +58 -2
- package/src/Config.test.ts +2 -6
- package/src/Config.ts +133 -133
- package/src/Console.ts +62 -7
- package/src/Crypto.ts +76 -4
- package/src/Eq.test.ts +2 -3
- package/src/Error.test.ts +76 -3
- package/src/Error.ts +71 -0
- package/src/Fs.ts +92 -18
- package/src/Identicon.ts +2 -2
- package/src/LeakDetector.ts +22 -3
- package/src/LockManager.ts +8 -0
- package/src/Object.test.ts +27 -12
- package/src/Object.ts +5 -0
- package/src/Platform.ts +50 -8
- package/src/Random.ts +25 -2
- package/src/Resource.test.ts +837 -0
- package/src/Resource.ts +235 -15
- package/src/Schedule.test.ts +50 -12
- package/src/Schedule.ts +24 -14
- package/src/Sqlite.ts +137 -17
- package/src/Task.test.ts +189 -8
- package/src/Task.ts +56 -17
- package/src/Test.ts +9 -0
- package/src/Time.ts +106 -9
- package/src/Type.test.ts +946 -1028
- package/src/Type.ts +4195 -3136
- package/src/Types.test.ts +4 -14
- package/src/WebSocket.ts +313 -40
- package/src/Worker.ts +90 -8
- package/src/index.ts +20 -6
- package/src/local-first/Db.ts +644 -339
- package/src/local-first/Evolu.test.ts +994 -22
- package/src/local-first/Evolu.ts +625 -232
- package/src/local-first/Owner.ts +13 -30
- package/src/local-first/Protocol.test.ts +634 -10
- package/src/local-first/Protocol.ts +255 -109
- package/src/local-first/Query.ts +8 -15
- package/src/local-first/Relay.ts +4 -2
- package/src/local-first/Schema.test.ts +143 -0
- package/src/local-first/Schema.ts +376 -26
- package/src/local-first/Shared.test.ts +7731 -559
- package/src/local-first/Shared.ts +2036 -267
- package/src/local-first/Storage.ts +224 -36
- package/src/local-first/Timestamp.test.ts +344 -70
- package/src/local-first/Timestamp.ts +434 -118
- package/src/local-first/index.ts +0 -1
- package/dist/src/local-first/Error.d.ts +0 -12
- package/dist/src/local-first/Error.d.ts.map +0 -1
- package/dist/src/local-first/Error.js +0 -6
- package/dist/src/local-first/LocalAuth.d.ts +0 -150
- package/dist/src/local-first/LocalAuth.d.ts.map +0 -1
- package/dist/src/local-first/LocalAuth.js +0 -179
- package/src/local-first/Error.ts +0 -17
- package/src/local-first/LocalAuth.ts +0 -457
package/src/local-first/Owner.ts
CHANGED
|
@@ -445,38 +445,27 @@ export interface OwnerWebSocketTransport extends Typed<"WebSocket"> {
|
|
|
445
445
|
*
|
|
446
446
|
* ```ts
|
|
447
447
|
* import {
|
|
448
|
-
* AppName,
|
|
449
448
|
* assertEqual,
|
|
450
|
-
* assertTrue,
|
|
451
|
-
* createAppOwner,
|
|
452
449
|
* createEvolu,
|
|
453
450
|
* createOwnerWebSocketTransport,
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
451
|
+
* testAppName,
|
|
452
|
+
* testAppOwner,
|
|
453
|
+
* testEvoluSchema,
|
|
457
454
|
* } from "@evolu/common";
|
|
458
455
|
*
|
|
459
|
-
* // Create once, persist the mnemonic securely, and restore it on later runs.
|
|
460
|
-
* const appOwner = createAppOwner(
|
|
461
|
-
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
462
|
-
* );
|
|
463
456
|
* const transport = createOwnerWebSocketTransport({
|
|
464
457
|
* url: "wss://relay.evolu.dev",
|
|
465
|
-
* ownerId:
|
|
458
|
+
* ownerId: testAppOwner.id,
|
|
459
|
+
* });
|
|
460
|
+
* const _createTodoEvolu = createEvolu(testEvoluSchema, {
|
|
461
|
+
* appName: testAppName,
|
|
462
|
+
* appOwner: testAppOwner,
|
|
463
|
+
* transports: [transport],
|
|
466
464
|
* });
|
|
467
|
-
* const createTodoEvolu = createEvolu(
|
|
468
|
-
* { todo: { id: id("Todo") } },
|
|
469
|
-
* {
|
|
470
|
-
* appName: AppName.orThrow("OwnerTransportExample"),
|
|
471
|
-
* appOwner,
|
|
472
|
-
* transports: [transport],
|
|
473
|
-
* },
|
|
474
|
-
* );
|
|
475
465
|
*
|
|
476
|
-
* assertTrue(typeof createTodoEvolu === "function");
|
|
477
466
|
* assertEqual(transport, {
|
|
478
467
|
* type: "WebSocket",
|
|
479
|
-
* url: `wss://relay.evolu.dev?ownerId=${
|
|
468
|
+
* url: `wss://relay.evolu.dev?ownerId=${testAppOwner.id}`,
|
|
480
469
|
* });
|
|
481
470
|
* ```
|
|
482
471
|
*
|
|
@@ -502,21 +491,15 @@ export const createOwnerWebSocketTransport = (config: {
|
|
|
502
491
|
* ```ts
|
|
503
492
|
* import {
|
|
504
493
|
* assertEqual,
|
|
505
|
-
* createAppOwner,
|
|
506
|
-
* createOwnerSecret,
|
|
507
|
-
* createRandomBytes,
|
|
508
494
|
* parseOwnerIdFromOwnerWebSocketTransportUrl,
|
|
495
|
+
* testAppOwner,
|
|
509
496
|
* } from "@evolu/common";
|
|
510
497
|
*
|
|
511
|
-
*
|
|
512
|
-
* const appOwner = createAppOwner(
|
|
513
|
-
* createOwnerSecret({ randomBytes: createRandomBytes() }),
|
|
514
|
-
* );
|
|
515
|
-
* const url = `/sync?ownerId=${appOwner.id}`;
|
|
498
|
+
* const url = `/sync?ownerId=${testAppOwner.id}`;
|
|
516
499
|
*
|
|
517
500
|
* assertEqual(
|
|
518
501
|
* parseOwnerIdFromOwnerWebSocketTransportUrl(url),
|
|
519
|
-
*
|
|
502
|
+
* testAppOwner.id,
|
|
520
503
|
* );
|
|
521
504
|
* assertEqual(
|
|
522
505
|
* parseOwnerIdFromOwnerWebSocketTransportUrl("/sync?ownerId=invalid"),
|