jazz-tools 0.7.0-alpha.30 → 0.7.0-alpha.32
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +55 -57
- package/CHANGELOG.md +13 -0
- package/dist/cli/index.js +46 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/coValues/account.js +9 -6
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +10 -7
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +57 -3
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +55 -4
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/extensions/imageDef.js +1 -0
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +8 -2
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +10 -1
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/schema.js +3 -1
- package/dist/implementation/schema.js.map +1 -1
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/tests/coList.test.js +13 -13
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +22 -22
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +9 -9
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/groupsAndAccounts.test.js +6 -4
- package/dist/tests/groupsAndAccounts.test.js.map +1 -1
- package/package.json +14 -8
- package/src/cli/index.ts +69 -0
- package/src/coValues/account.ts +29 -42
- package/src/coValues/coList.ts +24 -17
- package/src/coValues/coMap.ts +73 -20
- package/src/coValues/coStream.ts +110 -18
- package/src/coValues/extensions/imageDef.ts +2 -1
- package/src/coValues/group.ts +34 -48
- package/src/coValues/interfaces.ts +30 -20
- package/src/implementation/schema.ts +5 -1
- package/src/implementation/subscriptionScope.ts +2 -2
- package/src/tests/coList.test.ts +16 -16
- package/src/tests/coMap.test.ts +35 -35
- package/src/tests/coStream.test.ts +11 -11
- package/src/tests/groupsAndAccounts.test.ts +13 -9
@@ -13,20 +13,20 @@ beforeEach(async () => {
|
|
13
13
|
});
|
14
14
|
|
15
15
|
describe("Custom accounts and groups", async () => {
|
16
|
-
class CustomProfile extends CoMap
|
16
|
+
class CustomProfile extends CoMap {
|
17
17
|
name = co.string;
|
18
18
|
color = co.string;
|
19
19
|
}
|
20
20
|
|
21
|
-
class CustomAccount extends Account
|
21
|
+
class CustomAccount extends Account {
|
22
22
|
profile = co.ref(CustomProfile);
|
23
23
|
root = co.ref(CoMap);
|
24
24
|
|
25
25
|
migrate(creationProps?: { name: string }) {
|
26
26
|
if (creationProps) {
|
27
|
-
const profileGroup =
|
27
|
+
const profileGroup = Group.create({ owner: this });
|
28
28
|
profileGroup.addMember("everyone", "reader");
|
29
|
-
this.profile =
|
29
|
+
this.profile = CustomProfile.create(
|
30
30
|
{ name: creationProps.name, color: "blue" },
|
31
31
|
{ owner: this }
|
32
32
|
);
|
@@ -34,7 +34,7 @@ describe("Custom accounts and groups", async () => {
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
37
|
-
class CustomGroup extends Group
|
37
|
+
class CustomGroup extends Group {
|
38
38
|
profile = co.null;
|
39
39
|
root = co.null;
|
40
40
|
[co.members] = co.ref(CustomAccount);
|
@@ -80,14 +80,18 @@ describe("Custom accounts and groups", async () => {
|
|
80
80
|
});
|
81
81
|
});
|
82
82
|
|
83
|
-
class MyMap extends CoMap
|
83
|
+
class MyMap extends CoMap {
|
84
84
|
name = co.string;
|
85
85
|
}
|
86
86
|
|
87
|
-
const map =
|
87
|
+
const map = MyMap.create({ name: "test" }, { owner: group });
|
88
88
|
|
89
|
-
const meAsCastMember = map._owner
|
90
|
-
|
89
|
+
const meAsCastMember = map._owner
|
90
|
+
.as(CustomGroup)
|
91
|
+
.members.find((member) => member.id === me.id);
|
92
|
+
expect(meAsCastMember?.account?.profile?.name).toBe(
|
93
|
+
"Hermes Puggington"
|
94
|
+
);
|
91
95
|
expect(meAsCastMember?.account?.profile?.color).toBe("blue");
|
92
96
|
|
93
97
|
expect((map._owner as any).nMembers).toBeUndefined();
|