jazz-tools 0.15.9 → 0.15.11

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.
Files changed (104) hide show
  1. package/.turbo/turbo-build.log +38 -38
  2. package/CHANGELOG.md +20 -0
  3. package/dist/{chunk-5PFEKHX5.js → chunk-MLLG3GBR.js} +422 -303
  4. package/dist/chunk-MLLG3GBR.js.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/react/index.js +2 -0
  7. package/dist/react/index.js.map +1 -1
  8. package/dist/react/testing.js +2 -0
  9. package/dist/react/testing.js.map +1 -1
  10. package/dist/testing.js +1 -1
  11. package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
  12. package/dist/tools/coValues/coMap.d.ts.map +1 -1
  13. package/dist/tools/coValues/inbox.d.ts.map +1 -1
  14. package/dist/tools/coValues/schemaUnion.d.ts +27 -1
  15. package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
  16. package/dist/tools/implementation/zodSchema/coExport.d.ts +1 -1
  17. package/dist/tools/implementation/zodSchema/coExport.d.ts.map +1 -1
  18. package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts +6 -3
  19. package/dist/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +1 -1
  20. package/dist/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts +6 -25
  21. package/dist/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts.map +1 -1
  22. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +2 -1
  23. package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
  24. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts +30 -0
  25. package/dist/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.d.ts.map +1 -0
  26. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +2 -1
  27. package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
  28. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +3 -3
  29. package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
  30. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +3 -3
  31. package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
  32. package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts +11 -0
  33. package/dist/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.d.ts.map +1 -0
  34. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +2 -3
  35. package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
  36. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +5 -2
  37. package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
  38. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +5 -2
  39. package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
  40. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +5 -2
  41. package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
  42. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +7 -12
  43. package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
  44. package/dist/tools/implementation/zodSchema/unionUtils.d.ts +2 -3
  45. package/dist/tools/implementation/zodSchema/unionUtils.d.ts.map +1 -1
  46. package/dist/tools/implementation/zodSchema/zodCo.d.ts +6 -6
  47. package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
  48. package/dist/tools/implementation/zodSchema/zodReExport.d.ts +8 -1
  49. package/dist/tools/implementation/zodSchema/zodReExport.d.ts.map +1 -1
  50. package/dist/tools/implementation/zodSchema/zodSchema.d.ts +18 -13
  51. package/dist/tools/implementation/zodSchema/zodSchema.d.ts.map +1 -1
  52. package/dist/tools/internal.d.ts +1 -0
  53. package/dist/tools/internal.d.ts.map +1 -1
  54. package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
  55. package/dist/tools/tests/coDiscriminatedUnion.test-d.d.ts +2 -0
  56. package/dist/tools/tests/coDiscriminatedUnion.test-d.d.ts.map +1 -0
  57. package/dist/tools/tests/coDiscriminatedUnion.test.d.ts +2 -0
  58. package/dist/tools/tests/coDiscriminatedUnion.test.d.ts.map +1 -0
  59. package/dist/tools/tests/coOptional.test.d.ts +2 -0
  60. package/dist/tools/tests/coOptional.test.d.ts.map +1 -0
  61. package/dist/tools/tests/zod.test-d.d.ts +2 -0
  62. package/dist/tools/tests/zod.test-d.d.ts.map +1 -0
  63. package/package.json +5 -4
  64. package/src/react-core/tests/useAccount.test.ts +1 -11
  65. package/src/tools/coValues/CoValueBase.ts +2 -2
  66. package/src/tools/coValues/inbox.ts +0 -2
  67. package/src/tools/coValues/schemaUnion.ts +62 -0
  68. package/src/tools/implementation/zodSchema/coExport.ts +2 -0
  69. package/src/tools/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +29 -12
  70. package/src/tools/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.ts +93 -63
  71. package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +62 -3
  72. package/src/tools/implementation/zodSchema/schemaTypes/CoDiscriminatedUnionSchema.ts +90 -0
  73. package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +27 -2
  74. package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +27 -5
  75. package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +60 -5
  76. package/src/tools/implementation/zodSchema/schemaTypes/CoOptionalSchema.ts +33 -0
  77. package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +3 -5
  78. package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +32 -2
  79. package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +30 -2
  80. package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +26 -2
  81. package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +10 -13
  82. package/src/tools/implementation/zodSchema/unionUtils.ts +22 -14
  83. package/src/tools/implementation/zodSchema/zodCo.ts +68 -256
  84. package/src/tools/implementation/zodSchema/zodReExport.ts +35 -5
  85. package/src/tools/implementation/zodSchema/zodSchema.ts +78 -19
  86. package/src/tools/internal.ts +1 -0
  87. package/src/tools/subscribe/SubscriptionScope.ts +1 -2
  88. package/src/tools/tests/ContextManager.test.ts +5 -6
  89. package/src/tools/tests/coDiscriminatedUnion.test-d.ts +57 -0
  90. package/src/tools/tests/coDiscriminatedUnion.test.ts +93 -0
  91. package/src/tools/tests/coList.test.ts +4 -12
  92. package/src/tools/tests/coMap.record.test.ts +4 -4
  93. package/src/tools/tests/coMap.test-d.ts +3 -3
  94. package/src/tools/tests/coMap.test.ts +10 -10
  95. package/src/tools/tests/coOptional.test.ts +39 -0
  96. package/src/tools/tests/createContext.test.ts +5 -4
  97. package/src/tools/tests/deepLoading.test.ts +9 -9
  98. package/src/tools/tests/inbox.test.ts +3 -11
  99. package/src/tools/tests/patterns/requestToJoin.test.ts +1 -1
  100. package/src/tools/tests/schemaUnion.test.ts +11 -22
  101. package/src/tools/tests/subscribe.test.ts +25 -39
  102. package/src/tools/tests/zod.test-d.ts +70 -0
  103. package/src/tools/tests/zod.test.ts +64 -5
  104. package/dist/chunk-5PFEKHX5.js.map +0 -1
@@ -7,27 +7,13 @@ import {
7
7
  onTestFinished,
8
8
  vi,
9
9
  } from "vitest";
10
+ import { Account, Group, cojsonInternals, z } from "../index.js";
10
11
  import {
11
- Account,
12
- CoFeed,
13
- CoList,
14
- CoMap,
15
- FileStream,
16
- Group,
17
- coField,
18
- cojsonInternals,
19
- z,
20
- } from "../index.js";
21
- import {
22
- CoMapInstance,
23
- ID,
24
- InstanceOrPrimitiveOfSchema,
25
12
  Loaded,
26
- Resolved,
13
+ anySchemaToCoSchema,
27
14
  co,
28
15
  createCoValueObservable,
29
16
  subscribeToCoValue,
30
- zodSchemaToCoSchema,
31
17
  } from "../internal.js";
32
18
  import {
33
19
  createJazzTestAccount,
@@ -43,7 +29,7 @@ const ReactionsFeed = co.feed(z.string());
43
29
  const Message = co.map({
44
30
  text: z.string(),
45
31
  reactions: ReactionsFeed,
46
- attachment: z.optional(co.fileStream()),
32
+ attachment: co.optional(co.fileStream()),
47
33
  });
48
34
 
49
35
  const ChatRoom = co.map({
@@ -84,7 +70,7 @@ describe("subscribeToCoValue", () => {
84
70
  let result = null as Loaded<typeof ChatRoom, true> | null;
85
71
 
86
72
  const unsubscribe = subscribeToCoValue(
87
- zodSchemaToCoSchema(ChatRoom),
73
+ anySchemaToCoSchema(ChatRoom),
88
74
  chatRoom.id,
89
75
  { loadAs: meOnSecondPeer },
90
76
  (value) => {
@@ -131,7 +117,7 @@ describe("subscribeToCoValue", () => {
131
117
  let result = null as Loaded<typeof ChatRoom, {}> | null;
132
118
 
133
119
  const unsubscribe = subscribeToCoValue(
134
- zodSchemaToCoSchema(ChatRoom),
120
+ anySchemaToCoSchema(ChatRoom),
135
121
  chatRoom.id,
136
122
  {
137
123
  loadAs: meOnSecondPeer,
@@ -172,7 +158,7 @@ describe("subscribeToCoValue", () => {
172
158
  messages.push(createMessage(me, "Hello"));
173
159
 
174
160
  const unsubscribe = subscribeToCoValue(
175
- zodSchemaToCoSchema(ChatRoom),
161
+ anySchemaToCoSchema(ChatRoom),
176
162
  chatRoom.id,
177
163
  {
178
164
  loadAs: meOnSecondPeer,
@@ -215,7 +201,7 @@ describe("subscribeToCoValue", () => {
215
201
  const updateFn = vi.fn();
216
202
 
217
203
  const unsubscribe = subscribeToCoValue(
218
- zodSchemaToCoSchema(ChatRoom),
204
+ anySchemaToCoSchema(ChatRoom),
219
205
  chatRoom.id,
220
206
  {
221
207
  loadAs: meOnSecondPeer,
@@ -275,7 +261,7 @@ describe("subscribeToCoValue", () => {
275
261
  >[];
276
262
 
277
263
  const unsubscribe = subscribeToCoValue(
278
- zodSchemaToCoSchema(ChatRoom),
264
+ anySchemaToCoSchema(ChatRoom),
279
265
  chatRoom.id,
280
266
  {
281
267
  loadAs: meOnSecondPeer,
@@ -346,7 +332,7 @@ describe("subscribeToCoValue", () => {
346
332
  const updateFn = vi.fn();
347
333
 
348
334
  const unsubscribe = subscribeToCoValue(
349
- zodSchemaToCoSchema(ChatRoom),
335
+ anySchemaToCoSchema(ChatRoom),
350
336
  chatRoom.id,
351
337
  {
352
338
  loadAs: meOnSecondPeer,
@@ -410,7 +396,7 @@ describe("subscribeToCoValue", () => {
410
396
  const updateFn = vi.fn();
411
397
 
412
398
  const unsubscribe = subscribeToCoValue(
413
- zodSchemaToCoSchema(TestList),
399
+ anySchemaToCoSchema(TestList),
414
400
  list.id,
415
401
  {
416
402
  loadAs: account,
@@ -471,7 +457,7 @@ describe("subscribeToCoValue", () => {
471
457
  const onUnauthorized = vi.fn();
472
458
 
473
459
  const unsubscribe = subscribeToCoValue(
474
- zodSchemaToCoSchema(TestList),
460
+ anySchemaToCoSchema(TestList),
475
461
  list.id,
476
462
  {
477
463
  loadAs: reader,
@@ -542,7 +528,7 @@ describe("subscribeToCoValue", () => {
542
528
  const onUnavailable = vi.fn();
543
529
 
544
530
  const unsubscribe = subscribeToCoValue(
545
- zodSchemaToCoSchema(TestList),
531
+ anySchemaToCoSchema(TestList),
546
532
  list.id,
547
533
  {
548
534
  loadAs: reader,
@@ -617,7 +603,7 @@ describe("subscribeToCoValue", () => {
617
603
  const onUnavailable = vi.fn();
618
604
 
619
605
  const unsubscribe = subscribeToCoValue(
620
- zodSchemaToCoSchema(TestList),
606
+ anySchemaToCoSchema(TestList),
621
607
  list.id,
622
608
  {
623
609
  loadAs: reader,
@@ -654,7 +640,7 @@ describe("subscribeToCoValue", () => {
654
640
  value: z.string(),
655
641
  });
656
642
 
657
- const TestList = co.list(z.optional(TestMap));
643
+ const TestList = co.list(co.optional(TestMap));
658
644
 
659
645
  const reader = await createJazzTestAccount({
660
646
  isCurrentActiveAccount: true,
@@ -687,7 +673,7 @@ describe("subscribeToCoValue", () => {
687
673
  const onUnavailable = vi.fn();
688
674
 
689
675
  const unsubscribe = subscribeToCoValue(
690
- zodSchemaToCoSchema(TestList),
676
+ anySchemaToCoSchema(TestList),
691
677
  list.id,
692
678
  {
693
679
  loadAs: reader,
@@ -718,7 +704,7 @@ describe("subscribeToCoValue", () => {
718
704
  value: z.string(),
719
705
  });
720
706
 
721
- const TestList = co.list(z.optional(TestMap));
707
+ const TestList = co.list(co.optional(TestMap));
722
708
 
723
709
  const creator = await createJazzTestAccount({
724
710
  isCurrentActiveAccount: true,
@@ -739,7 +725,7 @@ describe("subscribeToCoValue", () => {
739
725
  });
740
726
 
741
727
  const unsubscribe = subscribeToCoValue(
742
- zodSchemaToCoSchema(TestList),
728
+ anySchemaToCoSchema(TestList),
743
729
  list.id,
744
730
  {
745
731
  loadAs: creator,
@@ -806,7 +792,7 @@ describe("subscribeToCoValue", () => {
806
792
  });
807
793
 
808
794
  const unsubscribe = subscribeToCoValue(
809
- zodSchemaToCoSchema(TestList),
795
+ anySchemaToCoSchema(TestList),
810
796
  list.id,
811
797
  {
812
798
  loadAs: creator,
@@ -895,7 +881,7 @@ describe("subscribeToCoValue", () => {
895
881
  });
896
882
 
897
883
  const unsubscribe = subscribeToCoValue(
898
- zodSchemaToCoSchema(Person),
884
+ anySchemaToCoSchema(Person),
899
885
  person.id,
900
886
  {
901
887
  loadAs: reader,
@@ -982,7 +968,7 @@ describe("subscribeToCoValue", () => {
982
968
  const onUnavailable = vi.fn();
983
969
 
984
970
  const unsubscribe = subscribeToCoValue(
985
- zodSchemaToCoSchema(TestList),
971
+ anySchemaToCoSchema(TestList),
986
972
  list.id,
987
973
  {
988
974
  loadAs: reader,
@@ -1069,7 +1055,7 @@ describe("subscribeToCoValue", () => {
1069
1055
  const onUnavailable = vi.fn();
1070
1056
 
1071
1057
  const unsubscribe = subscribeToCoValue(
1072
- zodSchemaToCoSchema(PersonList),
1058
+ anySchemaToCoSchema(PersonList),
1073
1059
  list.id,
1074
1060
  {
1075
1061
  loadAs: reader,
@@ -1165,7 +1151,7 @@ describe("subscribeToCoValue", () => {
1165
1151
  const onUnavailable = vi.fn();
1166
1152
 
1167
1153
  const unsubscribe = subscribeToCoValue(
1168
- zodSchemaToCoSchema(PersonList),
1154
+ anySchemaToCoSchema(PersonList),
1169
1155
  list.id,
1170
1156
  {
1171
1157
  loadAs: reader,
@@ -1248,7 +1234,7 @@ describe("subscribeToCoValue", () => {
1248
1234
 
1249
1235
  // Test subscribing to the large coValue
1250
1236
  const unsubscribe = subscribeToCoValue(
1251
- zodSchemaToCoSchema(LargeDataset),
1237
+ anySchemaToCoSchema(LargeDataset),
1252
1238
  largeMap.id,
1253
1239
  {
1254
1240
  loadAs: alice,
@@ -1314,7 +1300,7 @@ describe("createCoValueObservable", () => {
1314
1300
  const mockListener = vi.fn();
1315
1301
 
1316
1302
  const unsubscribe = observable.subscribe(
1317
- zodSchemaToCoSchema(TestMap),
1303
+ anySchemaToCoSchema(TestMap),
1318
1304
  testMap.id,
1319
1305
  {
1320
1306
  loadAs: meOnSecondPeer,
@@ -1343,7 +1329,7 @@ describe("createCoValueObservable", () => {
1343
1329
  const mockListener = vi.fn();
1344
1330
 
1345
1331
  const unsubscribe = observable.subscribe(
1346
- zodSchemaToCoSchema(TestMap),
1332
+ anySchemaToCoSchema(TestMap),
1347
1333
  testMap.id,
1348
1334
  {
1349
1335
  loadAs: meOnSecondPeer,
@@ -0,0 +1,70 @@
1
+ import { describe, test } from "vitest";
2
+ import { z } from "../exports";
3
+ import { co } from "../internal";
4
+
5
+ describe("CoValue and Zod schema compatibility", () => {
6
+ test("cannot use z.record with CoValue schemas as values", () => {
7
+ const Dog = co.map({
8
+ type: z.literal("dog"),
9
+ });
10
+
11
+ const Person = co.map({
12
+ // @ts-expect-error: cannot use z.record with a CoValue schema
13
+ // (z.record is not exported by jazz-tools)
14
+ pets: z.record(z.string(), Dog),
15
+ });
16
+ });
17
+
18
+ test("cannot use z.union with CoValue schemas as values", () => {
19
+ const Dog = co.map({
20
+ type: z.literal("dog"),
21
+ });
22
+
23
+ const Cat = co.map({
24
+ type: z.literal("cat"),
25
+ });
26
+
27
+ const Person = co.map({
28
+ // @ts-expect-error: cannot use z.union with a CoValue schema
29
+ pets: z.union([Dog, Cat]),
30
+ });
31
+ });
32
+
33
+ test("cannot use z.intersection with CoValue schemas as values", () => {
34
+ const Dog = co.map({
35
+ type: z.literal("dog"),
36
+ });
37
+
38
+ const Cat = co.map({
39
+ type: z.literal("cat"),
40
+ });
41
+
42
+ const Person = co.map({
43
+ // @ts-expect-error: cannot use z.intersection with a CoValue schema
44
+ // (z.intersection is not exported by jazz-tools)
45
+ pets: z.intersection(Dog, Cat),
46
+ });
47
+ });
48
+
49
+ test("cannot use z.array with CoValue schemas as values", () => {
50
+ const Dog = co.map({
51
+ type: z.literal("dog"),
52
+ });
53
+
54
+ const Person = co.map({
55
+ // @ts-expect-error: cannot use z.array with a CoValue schema
56
+ pets: z.array(Dog),
57
+ });
58
+ });
59
+
60
+ test("cannot use z.tuple with CoValue schemas as values", () => {
61
+ const Dog = co.map({
62
+ type: z.literal("dog"),
63
+ });
64
+
65
+ const Person = co.map({
66
+ // @ts-expect-error: cannot use z.tuple with a CoValue schema
67
+ pets: z.tuple([Dog]),
68
+ });
69
+ });
70
+ });
@@ -1,10 +1,18 @@
1
- import { describe, expect, it, vi } from "vitest";
1
+ import { beforeAll, describe, expect, it, vi } from "vitest";
2
2
  import { z } from "../exports.js";
3
3
  import { co } from "../internal.js";
4
- import { createJazzTestAccount } from "../testing.js";
4
+ import { createJazzTestAccount, setupJazzTestSync } from "../testing.js";
5
5
 
6
6
  describe("co.map and Zod schema compatibility", () => {
7
- // Helper function to create a test account
7
+ beforeAll(async () => {
8
+ await setupJazzTestSync();
9
+
10
+ await createJazzTestAccount({
11
+ isCurrentActiveAccount: true,
12
+ creationProps: { name: "Hermes Puggington" },
13
+ });
14
+ });
15
+
8
16
  describe("Primitive types", () => {
9
17
  it("should handle string fields", async () => {
10
18
  const schema = co.map({
@@ -348,12 +356,63 @@ describe("co.map and Zod schema compatibility", () => {
348
356
  // ]),
349
357
  // });
350
358
  // const account = await createJazzTestAccount();
351
- // const successMap = schema.create({ result: { status: "success", data: "data" } }, account);
352
- // const failedMap = schema.create({ result: { status: "failed", error: "error" } }, account);
359
+ // const successMap = schema.create(
360
+ // { result: { status: "success", data: "data" } },
361
+ // account,
362
+ // );
363
+ // const failedMap = schema.create(
364
+ // { result: { status: "failed", error: "error" } },
365
+ // account,
366
+ // );
353
367
  // expect(successMap.result).toEqual({ status: "success", data: "data" });
354
368
  // expect(failedMap.result).toEqual({ status: "failed", error: "error" });
355
369
  // });
356
370
 
371
+ it("should handle discriminated unions of CoValues", () => {
372
+ const Dog = co.map({
373
+ type: z.literal("dog"),
374
+ breed: z.string(),
375
+ });
376
+
377
+ const Cat = co.map({
378
+ type: z.literal("cat"),
379
+ name: z.string(),
380
+ });
381
+
382
+ const Person = co.map({
383
+ pet: z.discriminatedUnion("type", [Dog, Cat]),
384
+ });
385
+
386
+ const person = Person.create({
387
+ pet: Dog.create({ type: "dog", breed: "Labrador" }),
388
+ });
389
+
390
+ expect(person.pet).toEqual({ type: "dog", breed: "Labrador" });
391
+
392
+ person.pet = Cat.create({ type: "cat", name: "Whiskers" });
393
+
394
+ expect(person.pet).toEqual({ type: "cat", name: "Whiskers" });
395
+ });
396
+
397
+ it("should handle optional CoValues", () => {
398
+ const Dog = co.map({
399
+ name: z.string(),
400
+ breed: z.string(),
401
+ });
402
+
403
+ const Person = co.map({
404
+ pet: z.optional(Dog),
405
+ });
406
+
407
+ const person = Person.create({});
408
+
409
+ expect(person.pet).toBeUndefined();
410
+
411
+ person.pet = Dog.create({ name: "Rex", breed: "Labrador" });
412
+
413
+ expect(person.pet).toEqual({ name: "Rex", breed: "Labrador" });
414
+ });
415
+
357
416
  // it("should handle intersections", async () => {
358
417
  // const schema = co.map({
359
418
  // value: z.intersection(