@evolu/common 8.7.0 → 8.8.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 +21 -21
- package/dist/src/Array.js +5 -5
- package/dist/src/Assert.d.ts +478 -141
- package/dist/src/Assert.d.ts.map +1 -1
- package/dist/src/Assert.js +644 -99
- package/dist/src/{Buffer.d.ts → Binary.d.ts} +85 -12
- package/dist/src/Binary.d.ts.map +1 -0
- package/dist/src/{Buffer.js → Binary.js} +206 -24
- package/dist/src/Console.d.ts +2 -10
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +6 -12
- package/dist/src/Crypto.d.ts +5 -5
- package/dist/src/Crypto.js +1 -1
- package/dist/src/Eq.d.ts +35 -40
- package/dist/src/Eq.d.ts.map +1 -1
- package/dist/src/Eq.js +51 -87
- package/dist/src/Function.d.ts +9 -14
- package/dist/src/Function.d.ts.map +1 -1
- package/dist/src/Function.js +7 -9
- package/dist/src/Http.d.ts +6 -7
- package/dist/src/Http.d.ts.map +1 -1
- package/dist/src/LeakDetector.d.ts.map +1 -1
- package/dist/src/LeakDetector.js +1 -0
- package/dist/src/LockManager.d.ts +1 -1
- package/dist/src/LockManager.js +1 -1
- package/dist/src/Lookup.d.ts +3 -2
- package/dist/src/Lookup.d.ts.map +1 -1
- package/dist/src/Lookup.js +4 -3
- package/dist/src/Number.d.ts +1 -1
- package/dist/src/Number.d.ts.map +1 -1
- package/dist/src/Number.js +1 -1
- package/dist/src/Object.d.ts +4 -4
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +5 -4
- package/dist/src/Option.d.ts +1 -2
- package/dist/src/Option.d.ts.map +1 -1
- package/dist/src/Option.js +1 -2
- package/dist/src/Platform.js +2 -0
- package/dist/src/Polyfills.js +4 -1
- package/dist/src/Random.d.ts +1 -1
- package/dist/src/Result.d.ts +49 -54
- package/dist/src/Result.d.ts.map +1 -1
- package/dist/src/Result.js +17 -22
- package/dist/src/Set.d.ts +6 -6
- package/dist/src/Set.js +2 -2
- package/dist/src/Sqlite.js +1 -1
- package/dist/src/String.js +3 -2
- package/dist/src/Task.d.ts +32 -32
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +20 -22
- package/dist/src/Test.d.ts +31 -3
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +46 -3
- package/dist/src/Time.d.ts +3 -11
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +10 -18
- package/dist/src/Type.d.ts +87 -85
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +70 -63
- package/dist/src/Types.d.ts +12 -12
- package/dist/src/Types.js +1 -1
- package/dist/src/WebSocket.d.ts +4 -7
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/Worker.d.ts +1 -1
- package/dist/src/Worker.js +7 -7
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/intl/_en.d.ts.map +1 -1
- package/dist/src/intl/_en.js +1 -1
- package/dist/src/intl/ar.d.ts.map +1 -1
- package/dist/src/intl/ar.js +1 -1
- package/dist/src/intl/bn.d.ts.map +1 -1
- package/dist/src/intl/bn.js +1 -1
- package/dist/src/intl/ca.d.ts.map +1 -1
- package/dist/src/intl/ca.js +1 -1
- package/dist/src/intl/cs.d.ts.map +1 -1
- package/dist/src/intl/cs.js +1 -1
- package/dist/src/intl/da.d.ts.map +1 -1
- package/dist/src/intl/da.js +1 -1
- package/dist/src/intl/de.d.ts.map +1 -1
- package/dist/src/intl/de.js +1 -1
- package/dist/src/intl/el.d.ts.map +1 -1
- package/dist/src/intl/el.js +1 -1
- package/dist/src/intl/es.d.ts.map +1 -1
- package/dist/src/intl/es.js +1 -1
- package/dist/src/intl/fa.d.ts.map +1 -1
- package/dist/src/intl/fa.js +1 -1
- package/dist/src/intl/fi.d.ts.map +1 -1
- package/dist/src/intl/fi.js +1 -1
- package/dist/src/intl/fil.d.ts.map +1 -1
- package/dist/src/intl/fil.js +1 -1
- package/dist/src/intl/fr.d.ts.map +1 -1
- package/dist/src/intl/fr.js +1 -1
- package/dist/src/intl/he.d.ts.map +1 -1
- package/dist/src/intl/he.js +1 -1
- package/dist/src/intl/hi.d.ts.map +1 -1
- package/dist/src/intl/hi.js +1 -1
- package/dist/src/intl/hr.d.ts.map +1 -1
- package/dist/src/intl/hr.js +1 -1
- package/dist/src/intl/hu.d.ts.map +1 -1
- package/dist/src/intl/hu.js +1 -1
- package/dist/src/intl/id.d.ts.map +1 -1
- package/dist/src/intl/id.js +1 -1
- package/dist/src/intl/it.d.ts.map +1 -1
- package/dist/src/intl/it.js +1 -1
- package/dist/src/intl/ja.d.ts.map +1 -1
- package/dist/src/intl/ja.js +1 -1
- package/dist/src/intl/ko.d.ts.map +1 -1
- package/dist/src/intl/ko.js +1 -1
- package/dist/src/intl/ml.d.ts.map +1 -1
- package/dist/src/intl/ml.js +1 -1
- package/dist/src/intl/mr.d.ts.map +1 -1
- package/dist/src/intl/mr.js +1 -1
- package/dist/src/intl/ms.d.ts.map +1 -1
- package/dist/src/intl/ms.js +1 -1
- package/dist/src/intl/nb.d.ts.map +1 -1
- package/dist/src/intl/nb.js +1 -1
- package/dist/src/intl/nl.d.ts.map +1 -1
- package/dist/src/intl/nl.js +1 -1
- package/dist/src/intl/pa.d.ts.map +1 -1
- package/dist/src/intl/pa.js +1 -1
- package/dist/src/intl/pl.d.ts.map +1 -1
- package/dist/src/intl/pl.js +1 -1
- package/dist/src/intl/pt-BR.d.ts.map +1 -1
- package/dist/src/intl/pt-BR.js +1 -1
- package/dist/src/intl/pt.d.ts.map +1 -1
- package/dist/src/intl/pt.js +1 -1
- package/dist/src/intl/ro.d.ts.map +1 -1
- package/dist/src/intl/ro.js +1 -1
- package/dist/src/intl/sk.d.ts.map +1 -1
- package/dist/src/intl/sk.js +1 -1
- package/dist/src/intl/sl.d.ts.map +1 -1
- package/dist/src/intl/sl.js +1 -1
- package/dist/src/intl/sv.d.ts.map +1 -1
- package/dist/src/intl/sv.js +1 -1
- package/dist/src/intl/sw.d.ts.map +1 -1
- package/dist/src/intl/sw.js +1 -1
- package/dist/src/intl/ta.d.ts.map +1 -1
- package/dist/src/intl/ta.js +1 -1
- package/dist/src/intl/te.d.ts.map +1 -1
- package/dist/src/intl/te.js +1 -1
- package/dist/src/intl/th.d.ts.map +1 -1
- package/dist/src/intl/th.js +1 -1
- package/dist/src/intl/tr.d.ts.map +1 -1
- package/dist/src/intl/tr.js +1 -1
- package/dist/src/intl/uk.d.ts.map +1 -1
- package/dist/src/intl/uk.js +1 -1
- package/dist/src/intl/ur.d.ts.map +1 -1
- package/dist/src/intl/ur.js +1 -1
- package/dist/src/intl/vi.d.ts.map +1 -1
- package/dist/src/intl/vi.js +1 -1
- package/dist/src/intl/zh-CN.d.ts.map +1 -1
- package/dist/src/intl/zh-CN.js +1 -1
- package/dist/src/intl/zh-TW.d.ts.map +1 -1
- package/dist/src/intl/zh-TW.js +1 -1
- package/dist/src/local-first/Evolu.d.ts +12 -12
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +2 -2
- package/dist/src/local-first/Protocol.d.ts +14 -76
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +29 -206
- package/dist/src/local-first/Query.d.ts +11 -11
- package/dist/src/local-first/Query.js +6 -6
- package/dist/src/local-first/Relay.d.ts +2 -2
- package/dist/src/local-first/Schema.d.ts +3 -5
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +2 -4
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +5 -5
- package/dist/src/local-first/Storage.js +4 -4
- package/dist/src/local-first/Timestamp.d.ts +9 -0
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +13 -10
- package/package.json +7 -4
- package/src/Array.test.ts +809 -0
- package/src/Array.ts +21 -21
- package/src/Assert.test.ts +1181 -0
- package/src/Assert.ts +971 -227
- package/src/BigInt.test.ts +28 -0
- package/src/Binary.test.ts +1128 -0
- package/src/{Buffer.ts → Binary.ts} +273 -46
- package/src/Brand.test.ts +90 -0
- package/src/Cache.test.ts +183 -0
- package/src/Callbacks.test.ts +66 -0
- package/src/Console.test.ts +809 -0
- package/src/Console.ts +9 -17
- package/src/Crypto.test.ts +138 -0
- package/src/Crypto.ts +5 -5
- package/src/Eq.test.ts +333 -0
- package/src/Eq.ts +110 -176
- package/src/Error.test.ts +118 -0
- package/src/Function.test.ts +204 -0
- package/src/Function.ts +10 -15
- package/src/Http.test.ts +816 -0
- package/src/Http.ts +6 -7
- package/src/LeakDetector.test.ts +210 -0
- package/src/LeakDetector.ts +1 -0
- package/src/LockManager.ts +2 -2
- package/src/Lookup.test.ts +418 -0
- package/src/Lookup.ts +4 -3
- package/src/Microtask.test.ts +140 -0
- package/src/Number.test.ts +218 -0
- package/src/Number.ts +2 -2
- package/src/Object.test.ts +293 -0
- package/src/Object.ts +5 -4
- package/src/Option.test.ts +104 -0
- package/src/Option.ts +1 -2
- package/src/Order.test.ts +56 -0
- package/src/Platform.ts +2 -0
- package/src/Polyfills.ts +3 -4
- package/src/Random.test.ts +89 -0
- package/src/Random.ts +1 -1
- package/src/Ref.test.ts +139 -0
- package/src/RefCount.test.ts +184 -0
- package/src/Relation.test.ts +505 -0
- package/src/Resource.test.ts +4623 -0
- package/src/Result.test.ts +1829 -0
- package/src/Result.ts +49 -54
- package/src/Schedule.test.ts +1554 -0
- package/src/Set.test.ts +279 -0
- package/src/Set.ts +6 -6
- package/src/Sqlite.ts +1 -1
- package/src/Store.test.ts +288 -0
- package/src/String.test.ts +54 -0
- package/src/String.ts +3 -3
- package/src/Task.test.ts +10820 -0
- package/src/Task.ts +38 -43
- package/src/Test.test.ts +88 -0
- package/src/Test.ts +49 -3
- package/src/Time.test.ts +926 -0
- package/src/Time.ts +13 -21
- package/src/Type.base64.test.ts +88 -0
- package/src/Type.test.ts +20465 -0
- package/src/Type.ts +114 -111
- package/src/Types.test.ts +324 -0
- package/src/Types.ts +13 -13
- package/src/WebSocket.ts +4 -7
- package/src/Worker.test.ts +755 -0
- package/src/Worker.ts +13 -18
- package/src/index.ts +1 -1
- package/src/intl/_en.ts +1 -1
- package/src/intl/ar.ts +1 -1
- package/src/intl/bn.ts +1 -1
- package/src/intl/ca.ts +1 -1
- package/src/intl/cs.ts +1 -1
- package/src/intl/da.ts +1 -1
- package/src/intl/de.ts +1 -1
- package/src/intl/el.ts +1 -1
- package/src/intl/es.ts +1 -1
- package/src/intl/fa.ts +1 -1
- package/src/intl/fi.ts +1 -1
- package/src/intl/fil.ts +1 -1
- package/src/intl/fr.ts +1 -1
- package/src/intl/he.ts +1 -1
- package/src/intl/hi.ts +1 -1
- package/src/intl/hr.ts +1 -1
- package/src/intl/hu.ts +1 -1
- package/src/intl/id.ts +1 -1
- package/src/intl/intl.test.ts +3106 -0
- package/src/intl/it.ts +1 -1
- package/src/intl/ja.ts +1 -1
- package/src/intl/ko.ts +1 -1
- package/src/intl/ml.ts +1 -1
- package/src/intl/mr.ts +1 -1
- package/src/intl/ms.ts +1 -1
- package/src/intl/nb.ts +1 -1
- package/src/intl/nl.ts +1 -1
- package/src/intl/pa.ts +1 -1
- package/src/intl/pl.ts +1 -1
- package/src/intl/pt-BR.ts +1 -1
- package/src/intl/pt.ts +1 -1
- package/src/intl/ro.ts +1 -1
- package/src/intl/sk.ts +1 -1
- package/src/intl/sl.ts +1 -1
- package/src/intl/sv.ts +1 -1
- package/src/intl/sw.ts +1 -1
- package/src/intl/ta.ts +1 -1
- package/src/intl/te.ts +1 -1
- package/src/intl/th.ts +1 -1
- package/src/intl/tr.ts +1 -1
- package/src/intl/uk.ts +1 -1
- package/src/intl/ur.ts +1 -1
- package/src/intl/vi.ts +1 -1
- package/src/intl/zh-CN.ts +1 -1
- package/src/intl/zh-TW.ts +1 -1
- package/src/local-first/Evolu.test.ts +1921 -0
- package/src/local-first/Evolu.ts +18 -14
- package/src/local-first/Owner.test.ts +83 -0
- package/src/local-first/Protocol.test.ts +1037 -0
- package/src/local-first/Protocol.ts +58 -261
- package/src/local-first/Query.test.ts +349 -0
- package/src/local-first/Query.ts +11 -11
- package/src/local-first/Relay.ts +2 -2
- package/src/local-first/Schema.ts +3 -5
- package/src/local-first/Shared.test.ts +1828 -0
- package/src/local-first/Shared.ts +9 -8
- package/src/local-first/Storage.ts +4 -4
- package/src/local-first/Timestamp.test.ts +374 -0
- package/src/local-first/Timestamp.ts +22 -10
- package/dist/src/Buffer.d.ts.map +0 -1
package/src/local-first/Evolu.ts
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
mapArray,
|
|
11
11
|
type NonEmptyReadonlyArray,
|
|
12
12
|
} from "../Array.ts";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
assert,
|
|
15
|
+
assertNonEmptyReadonlyArray,
|
|
16
|
+
assertNotUndefined,
|
|
17
|
+
} from "../Assert.ts";
|
|
14
18
|
import { createCallbacks } from "../Callbacks.ts";
|
|
15
19
|
import type { ConsoleDep } from "../Console.ts";
|
|
16
20
|
import { createConsole } from "../Console.ts";
|
|
@@ -371,11 +375,11 @@ export interface Evolu<
|
|
|
371
375
|
* ).id;
|
|
372
376
|
*
|
|
373
377
|
* assertType<
|
|
374
|
-
* [TodoId, TodoId],
|
|
375
378
|
* [
|
|
376
379
|
* ReturnType<typeof insertTodo>,
|
|
377
380
|
* ReturnType<typeof insertTodoAndNotify>,
|
|
378
|
-
* ]
|
|
381
|
+
* ],
|
|
382
|
+
* [TodoId, TodoId]
|
|
379
383
|
* >();
|
|
380
384
|
* ```
|
|
381
385
|
*
|
|
@@ -415,8 +419,8 @@ export interface Evolu<
|
|
|
415
419
|
* evolu.update("todo", { id: todoId, isDeleted: sqliteTrue }).id;
|
|
416
420
|
*
|
|
417
421
|
* assertType<
|
|
418
|
-
* [
|
|
419
|
-
* [
|
|
422
|
+
* [ReturnType<typeof renameTodo>, ReturnType<typeof softDeleteTodo>],
|
|
423
|
+
* [TodoId, TodoId]
|
|
420
424
|
* >();
|
|
421
425
|
* ```
|
|
422
426
|
*
|
|
@@ -459,7 +463,7 @@ export interface Evolu<
|
|
|
459
463
|
* title: NonEmptyTrimmedString100.orThrow("Learn Evolu"),
|
|
460
464
|
* }).id;
|
|
461
465
|
*
|
|
462
|
-
* assertType<
|
|
466
|
+
* assertType<ReturnType<typeof upsertTodo>, TodoId>();
|
|
463
467
|
* ```
|
|
464
468
|
*
|
|
465
469
|
* @see {@link Mutation}
|
|
@@ -506,8 +510,8 @@ export interface Evolu<
|
|
|
506
510
|
* };
|
|
507
511
|
*
|
|
508
512
|
* assertType<
|
|
509
|
-
*
|
|
510
|
-
*
|
|
513
|
+
* ReturnType<typeof loadTodos>,
|
|
514
|
+
* Promise<QueryRows<typeof allTodos.Row>>
|
|
511
515
|
* >();
|
|
512
516
|
* ```
|
|
513
517
|
*/
|
|
@@ -553,11 +557,11 @@ export interface Evolu<
|
|
|
553
557
|
* evolu.loadQueries([allTodos, firstTodo]);
|
|
554
558
|
*
|
|
555
559
|
* assertType<
|
|
560
|
+
* ReturnType<typeof loadTodoQueries>,
|
|
556
561
|
* [
|
|
557
562
|
* Promise<QueryRows<typeof allTodos.Row>>,
|
|
558
563
|
* Promise<QueryRows<typeof firstTodo.Row>>,
|
|
559
|
-
* ]
|
|
560
|
-
* ReturnType<typeof loadTodoQueries>
|
|
564
|
+
* ]
|
|
561
565
|
* >();
|
|
562
566
|
* ```
|
|
563
567
|
*/
|
|
@@ -596,7 +600,7 @@ export interface Evolu<
|
|
|
596
600
|
* onRows(evolu.getQueryRows(allTodos));
|
|
597
601
|
* });
|
|
598
602
|
*
|
|
599
|
-
* assertType<
|
|
603
|
+
* assertType<ReturnType<typeof subscribeToTodos>, Unsubscribe>();
|
|
600
604
|
* ```
|
|
601
605
|
*/
|
|
602
606
|
readonly subscribeQuery: (
|
|
@@ -629,8 +633,8 @@ export interface Evolu<
|
|
|
629
633
|
* evolu.getQueryRows(allTodos);
|
|
630
634
|
*
|
|
631
635
|
* assertType<
|
|
632
|
-
*
|
|
633
|
-
*
|
|
636
|
+
* ReturnType<typeof getTodos>,
|
|
637
|
+
* QueryRows<typeof allTodos.Row>
|
|
634
638
|
* >();
|
|
635
639
|
* ```
|
|
636
640
|
*/
|
|
@@ -1056,7 +1060,7 @@ export const createEvolu =
|
|
|
1056
1060
|
if (!loadingPromise) continue;
|
|
1057
1061
|
|
|
1058
1062
|
const rows = nextRowsByQueryMap.get(query);
|
|
1059
|
-
|
|
1063
|
+
assertNotUndefined(rows);
|
|
1060
1064
|
|
|
1061
1065
|
fulfillLoadingPromise(loadingPromise, rows);
|
|
1062
1066
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { eqData } from "../Eq.ts";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { assertEqual, assertFalse, assertNotUndefined } from "../Assert.ts";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createAppOwner,
|
|
7
|
+
createOwnerSecret,
|
|
8
|
+
deriveShardOwner,
|
|
9
|
+
mnemonicToOwnerSecret,
|
|
10
|
+
ownerIdBytesToOwnerId,
|
|
11
|
+
ownerIdToOwnerIdBytes,
|
|
12
|
+
ownerSecretToMnemonic,
|
|
13
|
+
testAppOwner,
|
|
14
|
+
testOwnerSecret,
|
|
15
|
+
} from "./Owner.ts";
|
|
16
|
+
import { testCreateDeps } from "../Task.ts";
|
|
17
|
+
|
|
18
|
+
const testOwnerSecret2 = createOwnerSecret(testCreateDeps({ seed: "owner-2" }));
|
|
19
|
+
|
|
20
|
+
test("ownerIdToOwnerIdBytes/ownerIdBytesToOwnerId", () => {
|
|
21
|
+
const id = testAppOwner.id;
|
|
22
|
+
assertEqual(ownerIdBytesToOwnerId(ownerIdToOwnerIdBytes(id)), id);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("ownerSecretToMnemonic and mnemonicToOwnerSecret are inverses", () => {
|
|
26
|
+
const deps = testCreateDeps();
|
|
27
|
+
const secret = createOwnerSecret(deps);
|
|
28
|
+
const mnemonic = ownerSecretToMnemonic(secret);
|
|
29
|
+
const backToSecret = mnemonicToOwnerSecret(mnemonic);
|
|
30
|
+
|
|
31
|
+
assertEqual(backToSecret, secret);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("createAppOwner is deterministic", () => {
|
|
35
|
+
const owner1 = createAppOwner(testOwnerSecret);
|
|
36
|
+
const owner2 = createAppOwner(testOwnerSecret);
|
|
37
|
+
|
|
38
|
+
assertEqual(owner1, owner2);
|
|
39
|
+
assertEqual(owner1.type, "AppOwner");
|
|
40
|
+
assertNotUndefined(owner1.mnemonic);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("deriveShardOwner is deterministic", () => {
|
|
44
|
+
const appOwner = createAppOwner(testOwnerSecret);
|
|
45
|
+
|
|
46
|
+
const shard1 = deriveShardOwner(appOwner, ["contacts"]);
|
|
47
|
+
const shard2 = deriveShardOwner(appOwner, ["contacts"]);
|
|
48
|
+
|
|
49
|
+
assertEqual(shard1, shard2);
|
|
50
|
+
assertEqual(shard1.type, "ShardOwner");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("deriveShardOwner with different paths produces different owners", () => {
|
|
54
|
+
const appOwner = createAppOwner(testOwnerSecret);
|
|
55
|
+
|
|
56
|
+
const contacts = deriveShardOwner(appOwner, ["contacts"]);
|
|
57
|
+
const photos = deriveShardOwner(appOwner, ["photos"]);
|
|
58
|
+
|
|
59
|
+
assertFalse(Object.is(contacts.id, photos.id));
|
|
60
|
+
assertFalse(eqData(contacts.encryptionKey, photos.encryptionKey));
|
|
61
|
+
assertFalse(eqData(contacts.writeKey, photos.writeKey));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("deriveShardOwner with nested paths", () => {
|
|
65
|
+
const appOwner = createAppOwner(testOwnerSecret);
|
|
66
|
+
|
|
67
|
+
const project1 = deriveShardOwner(appOwner, ["projects", "project-1"]);
|
|
68
|
+
const project2 = deriveShardOwner(appOwner, ["projects", "project-2"]);
|
|
69
|
+
|
|
70
|
+
assertFalse(Object.is(project1.id, project2.id));
|
|
71
|
+
assertEqual(project1.type, "ShardOwner");
|
|
72
|
+
assertEqual(project2.type, "ShardOwner");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("different app owners produce different shard owners", () => {
|
|
76
|
+
const appOwner1 = createAppOwner(testOwnerSecret);
|
|
77
|
+
const appOwner2 = createAppOwner(testOwnerSecret2);
|
|
78
|
+
|
|
79
|
+
const shard1 = deriveShardOwner(appOwner1, ["contacts"]);
|
|
80
|
+
const shard2 = deriveShardOwner(appOwner2, ["contacts"]);
|
|
81
|
+
|
|
82
|
+
assertFalse(Object.is(shard1.id, shard2.id));
|
|
83
|
+
});
|