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.
Files changed (44) hide show
  1. package/.turbo/turbo-build.log +55 -57
  2. package/CHANGELOG.md +13 -0
  3. package/dist/cli/index.js +46 -0
  4. package/dist/cli/index.js.map +1 -0
  5. package/dist/coValues/account.js +9 -6
  6. package/dist/coValues/account.js.map +1 -1
  7. package/dist/coValues/coList.js +10 -7
  8. package/dist/coValues/coList.js.map +1 -1
  9. package/dist/coValues/coMap.js +57 -3
  10. package/dist/coValues/coMap.js.map +1 -1
  11. package/dist/coValues/coStream.js +55 -4
  12. package/dist/coValues/coStream.js.map +1 -1
  13. package/dist/coValues/extensions/imageDef.js +1 -0
  14. package/dist/coValues/extensions/imageDef.js.map +1 -1
  15. package/dist/coValues/group.js +8 -2
  16. package/dist/coValues/group.js.map +1 -1
  17. package/dist/coValues/interfaces.js +10 -1
  18. package/dist/coValues/interfaces.js.map +1 -1
  19. package/dist/implementation/schema.js +3 -1
  20. package/dist/implementation/schema.js.map +1 -1
  21. package/dist/implementation/subscriptionScope.js.map +1 -1
  22. package/dist/tests/coList.test.js +13 -13
  23. package/dist/tests/coList.test.js.map +1 -1
  24. package/dist/tests/coMap.test.js +22 -22
  25. package/dist/tests/coMap.test.js.map +1 -1
  26. package/dist/tests/coStream.test.js +9 -9
  27. package/dist/tests/coStream.test.js.map +1 -1
  28. package/dist/tests/groupsAndAccounts.test.js +6 -4
  29. package/dist/tests/groupsAndAccounts.test.js.map +1 -1
  30. package/package.json +14 -8
  31. package/src/cli/index.ts +69 -0
  32. package/src/coValues/account.ts +29 -42
  33. package/src/coValues/coList.ts +24 -17
  34. package/src/coValues/coMap.ts +73 -20
  35. package/src/coValues/coStream.ts +110 -18
  36. package/src/coValues/extensions/imageDef.ts +2 -1
  37. package/src/coValues/group.ts +34 -48
  38. package/src/coValues/interfaces.ts +30 -20
  39. package/src/implementation/schema.ts +5 -1
  40. package/src/implementation/subscriptionScope.ts +2 -2
  41. package/src/tests/coList.test.ts +16 -16
  42. package/src/tests/coMap.test.ts +35 -35
  43. package/src/tests/coStream.test.ts +11 -11
  44. 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<CustomProfile> {
16
+ class CustomProfile extends CoMap {
17
17
  name = co.string;
18
18
  color = co.string;
19
19
  }
20
20
 
21
- class CustomAccount extends Account<CustomAccount> {
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 = new Group({ owner: this });
27
+ const profileGroup = Group.create({ owner: this });
28
28
  profileGroup.addMember("everyone", "reader");
29
- this.profile = new CustomProfile(
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<CustomGroup> {
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<MyMap> {
83
+ class MyMap extends CoMap {
84
84
  name = co.string;
85
85
  }
86
86
 
87
- const map = new MyMap({name: "test"}, {owner: group});
87
+ const map = MyMap.create({ name: "test" }, { owner: group });
88
88
 
89
- const meAsCastMember = map._owner.as(CustomGroup).members.find((member) => member.id === me.id);
90
- expect(meAsCastMember?.account?.profile?.name).toBe("Hermes Puggington");
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();