jazz-tools 0.7.0-alpha.36 → 0.7.0-alpha.38
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +3 -10
- package/.prettierrc.js +9 -0
- package/.turbo/turbo-build.log +3 -91
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +140 -0
- package/CHANGELOG.md +19 -0
- package/README.md +10 -2
- package/dist/coValues/account.js +22 -12
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +7 -9
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +11 -3
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +15 -8
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/deepLoading.js +57 -0
- package/dist/coValues/deepLoading.js.map +1 -0
- package/dist/coValues/extensions/imageDef.js +1 -1
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +1 -0
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +34 -28
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/devtoolsFormatters.js +1 -0
- package/dist/implementation/devtoolsFormatters.js.map +1 -1
- package/dist/implementation/refs.js +4 -2
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/schema.js +5 -1
- package/dist/implementation/schema.js.map +1 -1
- package/dist/implementation/subscriptionScope.js +9 -4
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/implementation/symbols.js.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/internal.js +2 -1
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +20 -17
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +27 -17
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +39 -24
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +188 -0
- package/dist/tests/deepLoading.test.js.map +1 -0
- package/dist/tests/groupsAndAccounts.test.js +6 -11
- package/dist/tests/groupsAndAccounts.test.js.map +1 -1
- package/package.json +12 -6
- package/src/coValues/account.ts +60 -58
- package/src/coValues/coList.ts +31 -51
- package/src/coValues/coMap.ts +27 -21
- package/src/coValues/coStream.ts +44 -32
- package/src/coValues/deepLoading.ts +215 -0
- package/src/coValues/extensions/imageDef.ts +3 -3
- package/src/coValues/group.ts +11 -13
- package/src/coValues/interfaces.ts +151 -93
- package/src/implementation/devtoolsFormatters.ts +1 -0
- package/src/implementation/inspect.ts +1 -1
- package/src/implementation/refs.ts +29 -15
- package/src/implementation/schema.ts +21 -6
- package/src/implementation/subscriptionScope.ts +33 -17
- package/src/implementation/symbols.ts +0 -1
- package/src/index.ts +5 -3
- package/src/internal.ts +3 -2
- package/src/tests/coList.test.ts +33 -28
- package/src/tests/coMap.test.ts +63 -55
- package/src/tests/coStream.test.ts +82 -67
- package/src/tests/deepLoading.test.ts +301 -0
- package/src/tests/groupsAndAccounts.test.ts +9 -18
@@ -1,16 +1,7 @@
|
|
1
|
-
import { expect, describe, test
|
1
|
+
import { expect, describe, test } from "vitest";
|
2
|
+
import { Account, CoMap, co, Group, WasmCrypto } from "../index.js";
|
2
3
|
|
3
|
-
|
4
|
-
import { Account, jazzReady, CoMap, co, Group } from "..";
|
5
|
-
|
6
|
-
if (!("crypto" in globalThis)) {
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8
|
-
(globalThis as any).crypto = webcrypto;
|
9
|
-
}
|
10
|
-
|
11
|
-
beforeEach(async () => {
|
12
|
-
await jazzReady;
|
13
|
-
});
|
4
|
+
const Crypto = await WasmCrypto.create();
|
14
5
|
|
15
6
|
describe("Custom accounts and groups", async () => {
|
16
7
|
class CustomProfile extends CoMap {
|
@@ -28,7 +19,7 @@ describe("Custom accounts and groups", async () => {
|
|
28
19
|
profileGroup.addMember("everyone", "reader");
|
29
20
|
this.profile = CustomProfile.create(
|
30
21
|
{ name: creationProps.name, color: "blue" },
|
31
|
-
{ owner: this }
|
22
|
+
{ owner: this },
|
32
23
|
);
|
33
24
|
}
|
34
25
|
}
|
@@ -44,11 +35,10 @@ describe("Custom accounts and groups", async () => {
|
|
44
35
|
}
|
45
36
|
}
|
46
37
|
|
47
|
-
type T = CustomGroup[typeof co.members];
|
48
|
-
|
49
38
|
test("Custom account and group", async () => {
|
50
39
|
const me = await CustomAccount.create({
|
51
40
|
creationProps: { name: "Hermes Puggington" },
|
41
|
+
crypto: Crypto,
|
52
42
|
});
|
53
43
|
|
54
44
|
expect(me.profile).toBeDefined();
|
@@ -66,13 +56,13 @@ describe("Custom accounts and groups", async () => {
|
|
66
56
|
expect(group.nMembers).toBe(2);
|
67
57
|
|
68
58
|
await new Promise<void>((resolve) => {
|
69
|
-
|
59
|
+
CustomGroup.subscribe(group, {}, (update) => {
|
70
60
|
const meAsMember = update.members.find((member) => {
|
71
61
|
return member.id === me.id && member.account?.profile;
|
72
62
|
});
|
73
63
|
if (meAsMember) {
|
74
64
|
expect(meAsMember.account?.profile?.name).toBe(
|
75
|
-
"Hermes Puggington"
|
65
|
+
"Hermes Puggington",
|
76
66
|
);
|
77
67
|
expect(meAsMember.account?.profile?.color).toBe("blue");
|
78
68
|
resolve();
|
@@ -90,10 +80,11 @@ describe("Custom accounts and groups", async () => {
|
|
90
80
|
.as(CustomGroup)
|
91
81
|
.members.find((member) => member.id === me.id);
|
92
82
|
expect(meAsCastMember?.account?.profile?.name).toBe(
|
93
|
-
"Hermes Puggington"
|
83
|
+
"Hermes Puggington",
|
94
84
|
);
|
95
85
|
expect(meAsCastMember?.account?.profile?.color).toBe("blue");
|
96
86
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
97
88
|
expect((map._owner as any).nMembers).toBeUndefined();
|
98
89
|
expect(map._owner.as(CustomGroup).nMembers).toBe(2);
|
99
90
|
});
|