jazz-tools 0.7.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/.eslintrc.cjs +24 -0
  2. package/.turbo/turbo-build.log +24 -0
  3. package/CHANGELOG.md +42 -0
  4. package/LICENSE.txt +19 -0
  5. package/README.md +3 -0
  6. package/dist/coValueInterfaces.js +8 -0
  7. package/dist/coValueInterfaces.js.map +1 -0
  8. package/dist/coValues/account/account.js +11 -0
  9. package/dist/coValues/account/account.js.map +1 -0
  10. package/dist/coValues/account/accountOf.js +150 -0
  11. package/dist/coValues/account/accountOf.js.map +1 -0
  12. package/dist/coValues/account/migration.js +4 -0
  13. package/dist/coValues/account/migration.js.map +1 -0
  14. package/dist/coValues/coList/coList.js +2 -0
  15. package/dist/coValues/coList/coList.js.map +1 -0
  16. package/dist/coValues/coList/coListOf.js +235 -0
  17. package/dist/coValues/coList/coListOf.js.map +1 -0
  18. package/dist/coValues/coList/internalDocs.js +2 -0
  19. package/dist/coValues/coList/internalDocs.js.map +1 -0
  20. package/dist/coValues/coMap/coMap.js +2 -0
  21. package/dist/coValues/coMap/coMap.js.map +1 -0
  22. package/dist/coValues/coMap/coMapOf.js +262 -0
  23. package/dist/coValues/coMap/coMapOf.js.map +1 -0
  24. package/dist/coValues/coMap/internalDocs.js +2 -0
  25. package/dist/coValues/coMap/internalDocs.js.map +1 -0
  26. package/dist/coValues/coStream/coStream.js +2 -0
  27. package/dist/coValues/coStream/coStream.js.map +1 -0
  28. package/dist/coValues/coStream/coStreamOf.js +244 -0
  29. package/dist/coValues/coStream/coStreamOf.js.map +1 -0
  30. package/dist/coValues/construction.js +34 -0
  31. package/dist/coValues/construction.js.map +1 -0
  32. package/dist/coValues/extensions/imageDef.js +36 -0
  33. package/dist/coValues/extensions/imageDef.js.map +1 -0
  34. package/dist/coValues/group/group.js +2 -0
  35. package/dist/coValues/group/group.js.map +1 -0
  36. package/dist/coValues/group/groupOf.js +109 -0
  37. package/dist/coValues/group/groupOf.js.map +1 -0
  38. package/dist/coValues/resolution.js +66 -0
  39. package/dist/coValues/resolution.js.map +1 -0
  40. package/dist/errors.js +2 -0
  41. package/dist/errors.js.map +1 -0
  42. package/dist/index.js +31 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/refs.js +95 -0
  45. package/dist/refs.js.map +1 -0
  46. package/dist/schemaHelpers.js +14 -0
  47. package/dist/schemaHelpers.js.map +1 -0
  48. package/dist/subscriptionScope.js +81 -0
  49. package/dist/subscriptionScope.js.map +1 -0
  50. package/dist/tests/coList.test.js +207 -0
  51. package/dist/tests/coList.test.js.map +1 -0
  52. package/dist/tests/coMap.test.js +238 -0
  53. package/dist/tests/coMap.test.js.map +1 -0
  54. package/dist/tests/coStream.test.js +263 -0
  55. package/dist/tests/coStream.test.js.map +1 -0
  56. package/dist/tests/types.test.js +33 -0
  57. package/dist/tests/types.test.js.map +1 -0
  58. package/package.json +23 -0
  59. package/src/coValueInterfaces.ts +105 -0
  60. package/src/coValues/account/account.ts +106 -0
  61. package/src/coValues/account/accountOf.ts +284 -0
  62. package/src/coValues/account/migration.ts +12 -0
  63. package/src/coValues/coList/coList.ts +57 -0
  64. package/src/coValues/coList/coListOf.ts +377 -0
  65. package/src/coValues/coList/internalDocs.ts +1 -0
  66. package/src/coValues/coMap/coMap.ts +110 -0
  67. package/src/coValues/coMap/coMapOf.ts +451 -0
  68. package/src/coValues/coMap/internalDocs.ts +1 -0
  69. package/src/coValues/coStream/coStream.ts +63 -0
  70. package/src/coValues/coStream/coStreamOf.ts +404 -0
  71. package/src/coValues/construction.ts +110 -0
  72. package/src/coValues/extensions/imageDef.ts +51 -0
  73. package/src/coValues/group/group.ts +27 -0
  74. package/src/coValues/group/groupOf.ts +183 -0
  75. package/src/coValues/resolution.ts +111 -0
  76. package/src/errors.ts +1 -0
  77. package/src/index.ts +68 -0
  78. package/src/refs.ts +128 -0
  79. package/src/schemaHelpers.ts +72 -0
  80. package/src/subscriptionScope.ts +118 -0
  81. package/src/tests/coList.test.ts +283 -0
  82. package/src/tests/coMap.test.ts +357 -0
  83. package/src/tests/coStream.test.ts +415 -0
  84. package/src/tests/types.test.ts +37 -0
  85. package/tsconfig.json +15 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coList.test.js","sourceRoot":"","sources":["../../src/tests/coList.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/C,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC7D,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,UAAU,CAAC,KAAK,IAAI,EAAE;IAClB,MAAM,SAAS,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;IAC5C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,EAAE,mBAAmB;KAC5B,CAAC,CAAC;IAEH,MAAM,QAAS,SAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAY;KAAG;IAE1D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAEvE,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;QAC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AC,KAAK,CAAC,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEhD,mDAAmD;YACnD,kBAAkB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,CAAC,CAAC,CACL,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,238 @@
1
+ import { expect, describe, test, beforeEach } from "vitest";
2
+ import { webcrypto } from "node:crypto";
3
+ import { connectedPeers } from "cojson/src/streamUtils.js";
4
+ import { newRandomSessionID } from "cojson/src/coValueCore.js";
5
+ import { Effect, Queue } from "effect";
6
+ import { Co, S, Account, jazzReady } from "..";
7
+ if (!("crypto" in globalThis)) {
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ globalThis.crypto = webcrypto;
10
+ }
11
+ beforeEach(async () => {
12
+ await jazzReady;
13
+ });
14
+ describe("Simple CoMap operations", async () => {
15
+ const me = await Account.create({
16
+ name: "Hermes Puggington",
17
+ });
18
+ class TestMap extends Co.map({
19
+ color: S.string,
20
+ height: S.number,
21
+ birthday: S.Date,
22
+ name: S.optional(S.string),
23
+ }).as() {
24
+ get roughColor() {
25
+ return this.color + "ish";
26
+ }
27
+ }
28
+ const birthday = new Date();
29
+ const map = new TestMap({
30
+ color: "red",
31
+ height: 10,
32
+ birthday: birthday,
33
+ }, { owner: me });
34
+ test("Construction", () => {
35
+ expect(map.color).toEqual("red");
36
+ expect(map.roughColor).toEqual("redish");
37
+ expect(map.height).toEqual(10);
38
+ expect(map.birthday).toEqual(birthday);
39
+ expect(map._raw.get("birthday")).toEqual(birthday.toISOString());
40
+ });
41
+ describe("Mutation", () => {
42
+ test("assignment", () => {
43
+ map.color = "blue";
44
+ expect(map.color).toEqual("blue");
45
+ expect(map._raw.get("color")).toEqual("blue");
46
+ const newBirthday = new Date();
47
+ map.birthday = newBirthday;
48
+ expect(map.birthday).toEqual(newBirthday);
49
+ expect(map._raw.get("birthday")).toEqual(newBirthday.toISOString());
50
+ Object.assign(map, { color: "green", height: 20 });
51
+ expect(map.color).toEqual("green");
52
+ expect(map._raw.get("color")).toEqual("green");
53
+ expect(map.height).toEqual(20);
54
+ expect(map._raw.get("height")).toEqual(20);
55
+ map.name = "Secret name";
56
+ expect(map.name).toEqual("Secret name");
57
+ delete map.name;
58
+ expect(map.name).toEqual(undefined);
59
+ });
60
+ });
61
+ });
62
+ describe("CoMap resolution", async () => {
63
+ class TwiceNestedMap extends Co.map({
64
+ taste: S.string,
65
+ }).as() {
66
+ }
67
+ class NestedMap extends Co.map({
68
+ name: S.string,
69
+ twiceNested: TwiceNestedMap,
70
+ }).as() {
71
+ get fancyName() {
72
+ return "Sir " + this.name;
73
+ }
74
+ }
75
+ class TestMap extends Co.map({
76
+ color: S.string,
77
+ height: S.number,
78
+ nested: NestedMap,
79
+ }).as() {
80
+ get roughColor() {
81
+ return this.color + "ish";
82
+ }
83
+ }
84
+ const initNodeAndMap = async () => {
85
+ const me = await Account.create({
86
+ name: "Hermes Puggington",
87
+ });
88
+ const map = new TestMap({
89
+ color: "red",
90
+ height: 10,
91
+ nested: new NestedMap({
92
+ name: "nested",
93
+ twiceNested: new TwiceNestedMap({ taste: "sour" }, { owner: me }),
94
+ }, { owner: me }),
95
+ }, { owner: me });
96
+ return { me, map };
97
+ };
98
+ test("Construction", async () => {
99
+ const { map } = await initNodeAndMap();
100
+ // const test: Schema.Schema.To<typeof NestedMap>
101
+ expect(map.color).toEqual("red");
102
+ expect(map.roughColor).toEqual("redish");
103
+ expect(map.height).toEqual(10);
104
+ expect(map.nested?.name).toEqual("nested");
105
+ expect(map.nested?.fancyName).toEqual("Sir nested");
106
+ expect(map.nested?.id).toBeDefined();
107
+ expect(map.nested?.twiceNested?.taste).toEqual("sour");
108
+ });
109
+ test("Loading and availability", async () => {
110
+ const { me, map } = await initNodeAndMap();
111
+ const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
112
+ me._raw.core.node.syncManager.addPeer(secondPeer);
113
+ const meOnSecondPeer = await Account.become({
114
+ accountID: me.id,
115
+ accountSecret: me._raw.agentSecret,
116
+ peersToLoadFrom: [initialAsPeer],
117
+ sessionID: newRandomSessionID(me.id),
118
+ });
119
+ const loadedMap = await TestMap.load(map.id, { as: meOnSecondPeer });
120
+ expect(loadedMap?.color).toEqual("red");
121
+ expect(loadedMap?.height).toEqual(10);
122
+ expect(loadedMap?.nested).toEqual(undefined);
123
+ expect(loadedMap?._refs.nested?.id).toEqual(map.nested?.id);
124
+ expect(loadedMap?._refs.nested?.value).toEqual(undefined);
125
+ const loadedNestedMap = await NestedMap.load(map.nested.id, {
126
+ as: meOnSecondPeer,
127
+ });
128
+ expect(loadedMap?.nested?.name).toEqual("nested");
129
+ expect(loadedMap?.nested.fancyName).toEqual("Sir nested");
130
+ expect(loadedMap?._refs.nested?.value).toEqual(loadedNestedMap);
131
+ expect(loadedMap?.nested?.twiceNested?.taste).toEqual(undefined);
132
+ const loadedTwiceNestedMap = await TwiceNestedMap.load(map.nested.twiceNested.id, { as: meOnSecondPeer });
133
+ expect(loadedMap?.nested?.twiceNested?.taste).toEqual("sour");
134
+ expect(loadedMap?.nested?._refs.twiceNested?.value).toEqual(loadedTwiceNestedMap);
135
+ const otherNestedMap = new NestedMap({
136
+ name: "otherNested",
137
+ twiceNested: new TwiceNestedMap({ taste: "sweet" }, { owner: meOnSecondPeer }),
138
+ }, { owner: meOnSecondPeer });
139
+ loadedMap.nested = otherNestedMap;
140
+ expect(loadedMap?.nested?.name).toEqual("otherNested");
141
+ expect(loadedMap?._refs.nested?.id).toEqual(otherNestedMap.id);
142
+ expect(loadedMap?._refs.nested?.value).toEqual(otherNestedMap);
143
+ expect(loadedMap?.nested?.twiceNested?.taste).toEqual("sweet");
144
+ expect(loadedMap?.nested?._refs.twiceNested?.value).toBeDefined();
145
+ });
146
+ test("Subscription & auto-resolution", async () => {
147
+ const { me, map } = await initNodeAndMap();
148
+ const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
149
+ me._raw.core.node.syncManager.addPeer(secondAsPeer);
150
+ const meOnSecondPeer = await Account.become({
151
+ accountID: me.id,
152
+ accountSecret: me._raw.agentSecret,
153
+ peersToLoadFrom: [initialAsPeer],
154
+ sessionID: newRandomSessionID(me.id),
155
+ });
156
+ await Effect.runPromise(Effect.gen(function* ($) {
157
+ const queue = yield* $(Queue.unbounded());
158
+ TestMap.subscribe(map.id, { as: meOnSecondPeer }, (subscribedMap) => {
159
+ console.log("subscribedMap.nested?.twiceNested?.taste", subscribedMap.nested?.twiceNested?.taste);
160
+ Effect.runPromise(Queue.offer(queue, subscribedMap));
161
+ });
162
+ const update1 = yield* $(Queue.take(queue));
163
+ expect(update1.nested).toEqual(undefined);
164
+ const update2 = yield* $(Queue.take(queue));
165
+ expect(update2.nested?.name).toEqual("nested");
166
+ map.nested.name = "nestedUpdated";
167
+ const _ = yield* $(Queue.take(queue));
168
+ const update3 = yield* $(Queue.take(queue));
169
+ expect(update3.nested?.name).toEqual("nestedUpdated");
170
+ const oldTwiceNested = update3.nested.twiceNested;
171
+ expect(oldTwiceNested?.taste).toEqual("sour");
172
+ // When assigning a new nested value, we get an update
173
+ const newTwiceNested = new TwiceNestedMap({
174
+ taste: "sweet",
175
+ }, { owner: meOnSecondPeer });
176
+ const newNested = new NestedMap({
177
+ name: "newNested",
178
+ twiceNested: newTwiceNested,
179
+ }, { owner: meOnSecondPeer });
180
+ update3.nested = newNested;
181
+ yield* $(Queue.take(queue));
182
+ // const update4 = yield* $(Queue.take(queue));
183
+ const update4b = yield* $(Queue.take(queue));
184
+ expect(update4b.nested?.name).toEqual("newNested");
185
+ expect(update4b.nested?.twiceNested?.taste).toEqual("sweet");
186
+ // we get updates when the new nested value changes
187
+ newTwiceNested.taste = "salty";
188
+ const update5 = yield* $(Queue.take(queue));
189
+ expect(update5.nested?.twiceNested?.taste).toEqual("salty");
190
+ newTwiceNested.taste = "umami";
191
+ const update6 = yield* $(Queue.take(queue));
192
+ expect(update6.nested?.twiceNested?.taste).toEqual("umami");
193
+ }));
194
+ });
195
+ class TestMapWithOptionalRef extends Co.map({
196
+ color: S.string,
197
+ nested: S.optional(NestedMap),
198
+ }).as() {
199
+ }
200
+ test("Construction with optional", async () => {
201
+ const me = await Account.create({
202
+ name: "Hermes Puggington",
203
+ });
204
+ const mapWithout = new TestMapWithOptionalRef({
205
+ color: "red",
206
+ }, { owner: me });
207
+ expect(mapWithout.color).toEqual("red");
208
+ expect(mapWithout.nested).toEqual(undefined);
209
+ const mapWith = new TestMapWithOptionalRef({
210
+ color: "red",
211
+ nested: new NestedMap({
212
+ name: "wow!",
213
+ twiceNested: new TwiceNestedMap({ taste: "sour" }, { owner: me }),
214
+ }, { owner: me }),
215
+ }, { owner: me });
216
+ expect(mapWith.color).toEqual("red");
217
+ expect(mapWith.nested?.name).toEqual("wow!");
218
+ expect(mapWith.nested?.fancyName).toEqual("Sir wow!");
219
+ expect(mapWith.nested?._raw).toBeDefined();
220
+ });
221
+ class TestRecord extends Co.map({ color: S.string }, { key: S.string, value: S.string }).as() {
222
+ }
223
+ test("Construction with index signature", async () => {
224
+ const me = await Account.create({
225
+ name: "Hermes Puggington",
226
+ });
227
+ const record = new TestRecord({
228
+ color: "red",
229
+ other: "wild",
230
+ }, { owner: me });
231
+ expect(record.color).toEqual("red");
232
+ expect(record._raw.get("color")).toEqual("red");
233
+ expect(record.other).toEqual("wild");
234
+ expect(record._raw.get("other")).toEqual("wild");
235
+ expect(Object.keys(record)).toEqual(["color", "other"]);
236
+ });
237
+ });
238
+ //# sourceMappingURL=coMap.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coMap.test.js","sourceRoot":"","sources":["../../src/tests/coMap.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/C,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC7D,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,UAAU,CAAC,KAAK,IAAI,EAAE;IAClB,MAAM,SAAS,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;IAC3C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,EAAE,mBAAmB;KAC5B,CAAC,CAAC;IAEH,MAAM,OAAQ,SAAQ,EAAE,CAAC,GAAG,CAAC;QACzB,KAAK,EAAE,CAAC,CAAC,MAAM;QACf,MAAM,EAAE,CAAC,CAAC,MAAM;Q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E,EAAE,EAAE,CAChB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,263 @@
1
+ import { expect, describe, test, beforeEach } from "vitest";
2
+ import { webcrypto } from "node:crypto";
3
+ import { connectedPeers } from "cojson/src/streamUtils.js";
4
+ import { newRandomSessionID } from "cojson/src/coValueCore.js";
5
+ import { Effect, Queue } from "effect";
6
+ import { Co, S, Account, jazzReady } from "..";
7
+ if (!("crypto" in globalThis)) {
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ globalThis.crypto = webcrypto;
10
+ }
11
+ beforeEach(async () => {
12
+ await jazzReady;
13
+ });
14
+ describe("Simple CoStream operations", async () => {
15
+ const me = await Account.create({
16
+ name: "Hermes Puggington",
17
+ });
18
+ class TestStream extends Co.stream(S.string).as() {
19
+ }
20
+ const stream = new TestStream(["milk"], { owner: me });
21
+ test("Construction", () => {
22
+ expect(stream.by[me.id]?.value).toEqual("milk");
23
+ expect(stream.in[me.sessionID]?.value).toEqual("milk");
24
+ });
25
+ describe("Mutation", () => {
26
+ test("pushing", () => {
27
+ stream.push("bread");
28
+ expect(stream.by[me.id]?.value).toEqual("bread");
29
+ expect(stream.in[me.sessionID]?.value).toEqual("bread");
30
+ stream.push("butter");
31
+ expect(stream.by[me.id]?.value).toEqual("butter");
32
+ expect(stream.in[me.sessionID]?.value).toEqual("butter");
33
+ });
34
+ });
35
+ });
36
+ describe("CoStream resolution", async () => {
37
+ class TwiceNestedStream extends Co.stream(S.string).as() {
38
+ fancyValueOf(account) {
39
+ return "Sir " + this.by[account]?.value;
40
+ }
41
+ }
42
+ class NestedStream extends Co.stream(TwiceNestedStream).as() {
43
+ }
44
+ class TestStream extends Co.stream(NestedStream).as() {
45
+ }
46
+ const initNodeAndStream = async () => {
47
+ const me = await Account.create({
48
+ name: "Hermes Puggington",
49
+ });
50
+ const stream = new TestStream([
51
+ new NestedStream([new TwiceNestedStream(["milk"], { owner: me })], { owner: me }),
52
+ ], { owner: me });
53
+ return { me, stream };
54
+ };
55
+ test("Construction", async () => {
56
+ const { me, stream } = await initNodeAndStream();
57
+ expect(stream.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value).toEqual("milk");
58
+ });
59
+ test("Loading and availability", async () => {
60
+ const { me, stream } = await initNodeAndStream();
61
+ const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
62
+ me._raw.core.node.syncManager.addPeer(secondPeer);
63
+ const meOnSecondPeer = await Account.become({
64
+ accountID: me.id,
65
+ accountSecret: me._raw.agentSecret,
66
+ peersToLoadFrom: [initialAsPeer],
67
+ sessionID: newRandomSessionID(me.id),
68
+ });
69
+ const loadedStream = await TestStream.load(stream.id, {
70
+ as: meOnSecondPeer,
71
+ });
72
+ expect(loadedStream?.by[me.id]?.value).toEqual(undefined);
73
+ expect(loadedStream?.by[me.id]?.ref?.id).toEqual(stream.by[me.id]?.value?.id);
74
+ const loadedNestedStream = await NestedStream.load(stream.by[me.id].value.id, { as: meOnSecondPeer });
75
+ expect(loadedStream?.by[me.id]?.value).toEqual(loadedNestedStream);
76
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.value).toEqual(undefined);
77
+ expect(loadedStream?.by[me.id]?.ref?.value).toEqual(loadedNestedStream);
78
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.ref?.id).toEqual(stream.by[me.id]?.value?.by[me.id]?.value?.id);
79
+ const loadedTwiceNestedStream = await TwiceNestedStream.load(stream.by[me.id].value.by[me.id].value.id, { as: meOnSecondPeer });
80
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.value).toEqual(loadedTwiceNestedStream);
81
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.value?.fancyValueOf(me.id)).toEqual("Sir milk");
82
+ expect(loadedStream?.by[me.id]?.ref?.value).toEqual(loadedNestedStream);
83
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.ref?.value).toEqual(loadedTwiceNestedStream);
84
+ const otherNestedStream = new NestedStream([new TwiceNestedStream(["butter"], { owner: meOnSecondPeer })], { owner: meOnSecondPeer });
85
+ loadedStream?.push(otherNestedStream);
86
+ expect(loadedStream?.by[me.id]?.value).toEqual(otherNestedStream);
87
+ expect(loadedStream?.by[me.id]?.ref?.value).toEqual(otherNestedStream);
88
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.value).toEqual(otherNestedStream.by[me.id]?.value);
89
+ expect(loadedStream?.by[me.id]?.value?.by[me.id]?.value?.fancyValueOf(me.id)).toEqual("Sir butter");
90
+ });
91
+ test("Subscription & auto-resolution", async () => {
92
+ const { me, stream } = await initNodeAndStream();
93
+ const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
94
+ me._raw.core.node.syncManager.addPeer(secondAsPeer);
95
+ const meOnSecondPeer = await Account.become({
96
+ accountID: me.id,
97
+ accountSecret: me._raw.agentSecret,
98
+ peersToLoadFrom: [initialAsPeer],
99
+ sessionID: newRandomSessionID(me.id),
100
+ });
101
+ await Effect.runPromise(Effect.gen(function* ($) {
102
+ const queue = yield* $(Queue.unbounded());
103
+ TestStream.subscribe(stream.id, { as: meOnSecondPeer }, (subscribedStream) => {
104
+ console.log("subscribedStream.by[me.id]", subscribedStream.by[me.id]);
105
+ console.log("subscribedStream.by[me.id]?.value?.by[me.id]?.value", subscribedStream.by[me.id]?.value?.by[me.id]?.value);
106
+ console.log("subscribedStream.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value", subscribedStream.by[me.id]?.value?.by[me.id]?.value
107
+ ?.by[me.id]?.value);
108
+ Effect.runPromise(Queue.offer(queue, subscribedStream));
109
+ });
110
+ const te = stream;
111
+ const update1 = yield* $(Queue.take(queue));
112
+ expect(update1.by[me.id]?.value).toEqual(undefined);
113
+ const update2 = yield* $(Queue.take(queue));
114
+ expect(update2.by[me.id]?.value).toBeDefined();
115
+ expect(update2.by[me.id]?.value?.by[me.id]?.value).toBeUndefined();
116
+ const update3 = yield* $(Queue.take(queue));
117
+ expect(update3.by[me.id]?.value?.by[me.id]?.value).toBeDefined();
118
+ expect(update3.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value).toBe("milk");
119
+ update3.by[me.id].value.by[me.id].value.push("bread");
120
+ const update4 = yield* $(Queue.take(queue));
121
+ expect(update4.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value).toBe("bread");
122
+ // When assigning a new nested stream, we get an update
123
+ const newTwiceNested = new TwiceNestedStream(["butter"], {
124
+ owner: meOnSecondPeer,
125
+ });
126
+ const newNested = new NestedStream([newTwiceNested], {
127
+ owner: meOnSecondPeer,
128
+ });
129
+ update4.push(newNested);
130
+ const update5 = yield* $(Queue.take(queue));
131
+ expect(update5.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value).toBe("butter");
132
+ // we get updates when the new nested stream changes
133
+ newTwiceNested.push("jam");
134
+ const update6 = yield* $(Queue.take(queue));
135
+ expect(update6.by[me.id]?.value?.by[me.id]?.value?.by[me.id]?.value).toBe("jam");
136
+ }));
137
+ });
138
+ });
139
+ describe("Simple BinaryCoStream operations", async () => {
140
+ const me = await Account.create({
141
+ name: "Hermes Puggington",
142
+ });
143
+ const stream = new Co.binaryStream(undefined, { owner: me });
144
+ test("Construction", () => {
145
+ expect(stream.getChunks()).toBeUndefined();
146
+ });
147
+ test("Mutation", () => {
148
+ stream.start({ mimeType: "text/plain" });
149
+ stream.push(new Uint8Array([1, 2, 3]));
150
+ stream.push(new Uint8Array([4, 5, 6]));
151
+ stream.end();
152
+ const chunks = stream.getChunks();
153
+ expect(chunks?.mimeType).toBe("text/plain");
154
+ expect(chunks?.chunks).toEqual([
155
+ new Uint8Array([1, 2, 3]),
156
+ new Uint8Array([4, 5, 6]),
157
+ ]);
158
+ expect(chunks?.finished).toBe(true);
159
+ });
160
+ });
161
+ describe("BinaryCoStream loading & Subscription", async () => {
162
+ const initNodeAndStream = async () => {
163
+ const me = await Account.create({
164
+ name: "Hermes Puggington",
165
+ });
166
+ const stream = new Co.binaryStream(undefined, { owner: me });
167
+ stream.start({ mimeType: "text/plain" });
168
+ stream.push(new Uint8Array([1, 2, 3]));
169
+ stream.push(new Uint8Array([4, 5, 6]));
170
+ stream.end();
171
+ return { me, stream };
172
+ };
173
+ test("Construction", async () => {
174
+ const { me, stream } = await initNodeAndStream();
175
+ expect(stream.getChunks()).toEqual({
176
+ mimeType: "text/plain",
177
+ chunks: [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])],
178
+ finished: true,
179
+ });
180
+ });
181
+ test("Loading and availability", async () => {
182
+ const { me, stream } = await initNodeAndStream();
183
+ const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
184
+ me._raw.core.node.syncManager.addPeer(secondAsPeer);
185
+ const meOnSecondPeer = await Account.become({
186
+ accountID: me.id,
187
+ accountSecret: me._raw.agentSecret,
188
+ peersToLoadFrom: [initialAsPeer],
189
+ sessionID: newRandomSessionID(me.id),
190
+ });
191
+ const loadedStream = await Co.binaryStream.load(stream.id, {
192
+ as: meOnSecondPeer,
193
+ });
194
+ expect(loadedStream?.getChunks()).toEqual({
195
+ mimeType: "text/plain",
196
+ chunks: [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])],
197
+ finished: true,
198
+ });
199
+ });
200
+ test("Subscription", async () => {
201
+ const { me } = await initNodeAndStream();
202
+ const stream = new Co.binaryStream(undefined, { owner: me });
203
+ const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
204
+ me._raw.core.node.syncManager.addPeer(secondAsPeer);
205
+ const meOnSecondPeer = await Account.become({
206
+ accountID: me.id,
207
+ accountSecret: me._raw.agentSecret,
208
+ peersToLoadFrom: [initialAsPeer],
209
+ sessionID: newRandomSessionID(me.id),
210
+ });
211
+ await Effect.runPromise(Effect.gen(function* ($) {
212
+ const queue = yield* $(Queue.unbounded());
213
+ Co.binaryStream.subscribe(stream.id, { as: meOnSecondPeer }, (subscribedStream) => {
214
+ Effect.runPromise(Queue.offer(queue, subscribedStream));
215
+ });
216
+ const update1 = yield* $(Queue.take(queue));
217
+ expect(update1.getChunks()).toBeUndefined();
218
+ stream.start({ mimeType: "text/plain" });
219
+ const update2 = yield* $(Queue.take(queue));
220
+ expect(update2.getChunks({ allowUnfinished: true })).toEqual({
221
+ mimeType: "text/plain",
222
+ fileName: undefined,
223
+ chunks: [],
224
+ totalSizeBytes: undefined,
225
+ finished: false,
226
+ });
227
+ stream.push(new Uint8Array([1, 2, 3]));
228
+ const update3 = yield* $(Queue.take(queue));
229
+ expect(update3.getChunks({ allowUnfinished: true })).toEqual({
230
+ mimeType: "text/plain",
231
+ fileName: undefined,
232
+ chunks: [new Uint8Array([1, 2, 3])],
233
+ totalSizeBytes: undefined,
234
+ finished: false,
235
+ });
236
+ stream.push(new Uint8Array([4, 5, 6]));
237
+ const update4 = yield* $(Queue.take(queue));
238
+ expect(update4.getChunks({ allowUnfinished: true })).toEqual({
239
+ mimeType: "text/plain",
240
+ fileName: undefined,
241
+ chunks: [
242
+ new Uint8Array([1, 2, 3]),
243
+ new Uint8Array([4, 5, 6]),
244
+ ],
245
+ totalSizeBytes: undefined,
246
+ finished: false,
247
+ });
248
+ stream.end();
249
+ const update5 = yield* $(Queue.take(queue));
250
+ expect(update5.getChunks()).toEqual({
251
+ mimeType: "text/plain",
252
+ fileName: undefined,
253
+ chunks: [
254
+ new Uint8Array([1, 2, 3]),
255
+ new Uint8Array([4, 5, 6]),
256
+ ],
257
+ totalSizeBytes: undefined,
258
+ finished: true,
259
+ });
260
+ }));
261
+ });
262
+ });
263
+ //# sourceMappingURL=coStream.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coStream.test.js","sourceRoot":"","sources":["../../src/tests/coStream.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAQ,MAAM,QAAQ,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAA8B,EAAE,EAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAG/E,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC7D,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,UAAU,CAAC,KAAK,IAAI,EAAE;IAClB,MAAM,SAAS,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;IAC9C,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC;QAC5B,IAAI,EAAE,mBAAmB;KAC5B,CAAC,CAAC;IAEH,MAAM,UAAW,SAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,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EAAE,YAAY;gBACtB,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE;oBACJ,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;oBACzB,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC5B;gBACD,cAAc,EAAE,SAAS;gBACzB,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Account, Co, ImageDefinition, S, jazzReady } from "..";
2
+ import { describe, test, beforeEach, expectTypeOf } from "vitest";
3
+ import { webcrypto } from "node:crypto";
4
+ if (!("crypto" in globalThis)) {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ globalThis.crypto = webcrypto;
7
+ }
8
+ beforeEach(async () => {
9
+ await jazzReady;
10
+ });
11
+ class TestMap extends Co.map({
12
+ name: S.string,
13
+ image: Co.media.imageDef,
14
+ maybeImage: S.optional(Co.media.imageDef),
15
+ }).as() {
16
+ }
17
+ describe("CoMap type tests", () => {
18
+ test("Optional field refs work", async () => {
19
+ const me = await Account.create({
20
+ name: "Hermes Puggington",
21
+ });
22
+ const map = new TestMap({
23
+ name: "Hermes",
24
+ image: new ImageDefinition({
25
+ originalSize: [100, 100],
26
+ placeholderDataURL: "data:image/png;base64,",
27
+ }, { owner: me }),
28
+ }, { owner: me });
29
+ expectTypeOf(map._refs.image).toMatchTypeOf();
30
+ expectTypeOf(map._refs.maybeImage).toMatchTypeOf();
31
+ });
32
+ });
33
+ //# sourceMappingURL=types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../../src/tests/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,MAA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CAAC,CAAC,aAAa,EAA6B,CAAC;IAClF,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "jazz-tools",
3
+ "module": "dist/index.js",
4
+ "main": "dist/index.js",
5
+ "types": "src/index.ts",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "version": "0.7.0-alpha.0",
9
+ "dependencies": {
10
+ "@effect/schema": "^0.63.0",
11
+ "effect": "^2.4.0",
12
+ "cojson": "0.7.0-alpha.0"
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "^5.3.3",
16
+ "vitest": "^0.34.6"
17
+ },
18
+ "scripts": {
19
+ "test": "vitest",
20
+ "lint": "eslint src/**/*.ts",
21
+ "build": "npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist"
22
+ }
23
+ }