jazz-tools 0.7.35-guest-auth.5 → 0.7.35-guest-auth.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -284,4 +284,41 @@ describe("BinaryCoStream loading & Subscription", async () => {
284
284
  });
285
285
  });
286
286
  });
287
+ describe("BinaryCoStream.loadAsBlob", async () => {
288
+ async function setup() {
289
+ const me = await Account.create({
290
+ creationProps: { name: "Hermes Puggington" },
291
+ crypto: Crypto,
292
+ });
293
+ const stream = BinaryCoStream.create({ owner: me });
294
+ stream.start({ mimeType: "text/plain" });
295
+ return { stream, me };
296
+ }
297
+ test("resolves only when the stream is ended", async () => {
298
+ const { stream, me } = await setup();
299
+ stream.push(new Uint8Array([1]));
300
+ const promise = BinaryCoStream.loadAsBlob(stream.id, me);
301
+ await stream.ensureLoaded([]);
302
+ stream.push(new Uint8Array([2]));
303
+ stream.end();
304
+ const blob = await promise;
305
+ // The promise resolves only when the stream is ended
306
+ // so we get a blob with all the chunks
307
+ expect(blob?.size).toBe(2);
308
+ });
309
+ test("resolves with an unfinshed blob if allowUnfinished: true", async () => {
310
+ const { stream, me } = await setup();
311
+ stream.push(new Uint8Array([1]));
312
+ const promise = BinaryCoStream.loadAsBlob(stream.id, me, {
313
+ allowUnfinished: true,
314
+ });
315
+ await stream.ensureLoaded([]);
316
+ stream.push(new Uint8Array([2]));
317
+ stream.end();
318
+ const blob = await promise;
319
+ // The promise resolves before the stream is ended
320
+ // so we get a blob only with the first chunk
321
+ expect(blob?.size).toBe(1);
322
+ });
323
+ });
287
324
  //# sourceMappingURL=coStream.test.js.map
@@ -1 +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,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACH,cAAc,EAEd,OAAO,EACP,QAAQ,EACR,EAAE,EACF,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AM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,EAAE,CAAC;QAEb,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;QAE3B,qDAAqD;QACrD,uCAAuC;QACvC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,KAAK,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjC,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE;YACrD,eAAe,EAAE,IAAI;SACxB,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAE9B,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,EAAE,CAAC;QAEb,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;QAE3B,kDAAkD;QAClD,6CAA6C;QAC7C,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -40,15 +40,16 @@ describe("Deep loading with depth arg", async () => {
40
40
  crypto: Crypto,
41
41
  });
42
42
  test("loading a deeply nested object will wait until all required refs are loaded", async () => {
43
+ const ownership = { owner: me };
43
44
  const map = TestMap.create({
44
45
  list: TestList.create([
45
46
  InnerMap.create({
46
47
  stream: TestStream.create([
47
- InnermostMap.create({ value: "hello" }, { owner: me }),
48
- ], { owner: me }),
49
- }, { owner: me }),
50
- ], { owner: me }),
51
- }, { owner: me });
48
+ InnermostMap.create({ value: "hello" }, ownership),
49
+ ], ownership),
50
+ }, ownership),
51
+ ], ownership),
52
+ }, ownership);
52
53
  const map1 = await TestMap.load(map.id, meOnSecondPeer, {});
53
54
  expectTypeOf(map1).toEqualTypeOf();
54
55
  if (map1 === undefined) {
@@ -81,8 +82,7 @@ describe("Deep loading with depth arg", async () => {
81
82
  throw new Error("map4 is undefined");
82
83
  }
83
84
  expect(map4.list[0]?.stream).not.toBe(null);
84
- // TODO: why is this actually defined?
85
- // expect(map4.list[0]?.stream?.[me.id]).toBe(undefined)
85
+ expect(map4.list[0]?.stream?.[me.id]).not.toBe(null);
86
86
  expect(map4.list[0]?.stream?.byMe?.value).toBe(null);
87
87
  const map5 = await TestMap.load(map.id, meOnSecondPeer, {
88
88
  list: [{ stream: [{}] }],
@@ -1 +1 @@
1
- {"version":3,"file":"deepLoading.test.js","sourceRoot":"","sources":["../../src/tests/deepLoading.test.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACH,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,EAER,UAAU,EACV,EAAE,EACF,OAAO,EACP,mBAAmB,EAEnB,iBAAiB,EACjB,oBAAoB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,OAAQ,SAAQ,KAAK;IACvB,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,WAAW,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,QAAQ,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,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;KACjB,CAAC,CAAC;IACH,YAAY,CAAC,YAAY,CAAC,CAAC,aAAa,EAOrC,CAAC;IACJ,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -5,14 +5,14 @@
5
5
  "types": "./src/index.ts",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
- "version": "0.7.35-guest-auth.5",
8
+ "version": "0.7.35-guest-auth.6",
9
9
  "dependencies": {
10
10
  "fast-check": "^3.17.2",
11
11
  "cojson": "0.7.35-guest-auth.5"
12
12
  },
13
13
  "devDependencies": {
14
14
  "typescript": "^5.3.3",
15
- "vitest": "^0.34.6"
15
+ "vitest": "1.5.3"
16
16
  },
17
17
  "madge": {
18
18
  "detectiveOptions": {
@@ -16,6 +16,7 @@ import type {
16
16
  DeeplyLoaded,
17
17
  CoValueClass,
18
18
  AnonymousJazzAgent,
19
+ co,
19
20
  } from "../internal.js";
20
21
  import {
21
22
  Account,
@@ -527,11 +528,44 @@ export type CoKeys<Map extends object> = Exclude<
527
528
  keyof CoMap
528
529
  >;
529
530
 
531
+ /**
532
+ * Force required ref fields to be non nullable
533
+ *
534
+ * Considering that:
535
+ * - Optional refs are typed as co<InstanceType<CoValueClass> | null | undefined>
536
+ * - Required refs are typed as co<InstanceType<CoValueClass> | null>
537
+ *
538
+ * This type works in two steps:
539
+ * - Remove the null from both types
540
+ * - Then we check if the input type accepts undefined, if positive we put the null union back
541
+ *
542
+ * So the optional refs stays unchanged while we safely remove the null union
543
+ * from required refs
544
+ *
545
+ * This way required refs can be marked as required in the CoMapInit while
546
+ * staying a nullable property for value access.
547
+ *
548
+ * Example:
549
+ *
550
+ * const map = MyCoMap.create({
551
+ * requiredRef: NestedMap.create({}) // null is not valid here
552
+ * })
553
+ *
554
+ * map.requiredRef // this value is still nullable
555
+ */
556
+ type ForceRequiredRef<V> = V extends co<InstanceType<CoValueClass> | null>
557
+ ? NonNullable<V>
558
+ : V extends co<InstanceType<CoValueClass> | undefined>
559
+ ? V | null
560
+ : V;
561
+
530
562
  export type CoMapInit<Map extends object> = {
531
563
  [Key in CoKeys<Map> as undefined extends Map[Key]
532
564
  ? never
533
- : IfCo<Map[Key], Key>]: Map[Key];
534
- } & { [Key in CoKeys<Map> as IfCo<Map[Key], Key>]?: Map[Key] };
565
+ : IfCo<Map[Key], Key>]: ForceRequiredRef<Map[Key]>;
566
+ } & {
567
+ [Key in CoKeys<Map> as IfCo<Map[Key], Key>]?: ForceRequiredRef<Map[Key]>;
568
+ };
535
569
 
536
570
  // TODO: cache handlers per descriptor for performance?
537
571
  const CoMapProxyHandler: ProxyHandler<CoMap> = {
@@ -587,10 +621,20 @@ const CoMapProxyHandler: ProxyHandler<CoMap> = {
587
621
  } else if ("encoded" in descriptor) {
588
622
  target._raw.set(key, descriptor.encoded.encode(value));
589
623
  } else if (isRefEncoded(descriptor)) {
590
- target._raw.set(key, value.id);
591
- subscriptionsScopes
592
- .get(target)
593
- ?.onRefAccessedOrSet(target.id, value.id);
624
+ if (value === null) {
625
+ if (descriptor.optional) {
626
+ target._raw.set(key, null);
627
+ } else {
628
+ throw new Error(
629
+ `Cannot set required reference ${key} to null`,
630
+ );
631
+ }
632
+ } else {
633
+ target._raw.set(key, value.id);
634
+ subscriptionsScopes
635
+ .get(target)
636
+ ?.onRefAccessedOrSet(target.id, value.id);
637
+ }
594
638
  }
595
639
  return true;
596
640
  } else {
@@ -518,6 +518,10 @@ export class BinaryCoStream extends CoValueBase implements CoValue {
518
518
  return this._raw.getBinaryChunks(options?.allowUnfinished);
519
519
  }
520
520
 
521
+ isBinaryStreamEnded(): boolean {
522
+ return this._raw.isBinaryStreamEnded();
523
+ }
524
+
521
525
  start(options: BinaryStreamInfo): void {
522
526
  this._raw.startBinaryStream(options);
523
527
  }
@@ -549,7 +553,28 @@ export class BinaryCoStream extends CoValueBase implements CoValue {
549
553
  allowUnfinished?: boolean;
550
554
  },
551
555
  ): Promise<Blob | undefined> {
552
- const stream = await this.load(id, as, []);
556
+ let stream = await this.load(id, as, []);
557
+
558
+ /**
559
+ * If the user hasn't requested an incomplete blob and the
560
+ * stream isn't complete wait for the stream download before progressing
561
+ */
562
+ if (!options?.allowUnfinished && !stream?.isBinaryStreamEnded()) {
563
+ stream = await new Promise<BinaryCoStream>((resolve) => {
564
+ const unsubscribe = subscribeToCoValue(
565
+ this,
566
+ id,
567
+ as,
568
+ [],
569
+ (value) => {
570
+ if (value.isBinaryStreamEnded()) {
571
+ unsubscribe();
572
+ resolve(value);
573
+ }
574
+ },
575
+ );
576
+ });
577
+ }
553
578
 
554
579
  return stream?.toBlob({
555
580
  allowUnfinished: options?.allowUnfinished,
@@ -17,6 +17,7 @@ export type AuthResult =
17
17
  credentials: { accountID: ID<Account>; secret: AgentSecret };
18
18
  onSuccess: () => void;
19
19
  onError: (error: string | Error) => void;
20
+ logOut: () => void;
20
21
  }
21
22
  | {
22
23
  type: "new";
@@ -28,6 +29,7 @@ export type AuthResult =
28
29
  }) => Promise<void>;
29
30
  onSuccess: () => void;
30
31
  onError: (error: string | Error) => void;
32
+ logOut: () => void;
31
33
  };
32
34
 
33
35
  export interface AuthMethod {
@@ -44,6 +46,20 @@ export const fixedCredentialsAuth = (credentials: {
44
46
  credentials,
45
47
  onSuccess: () => {},
46
48
  onError: () => {},
49
+ logOut: () => {},
50
+ }),
51
+ };
52
+ };
53
+
54
+ export const ephemeralCredentialsAuth = (): AuthMethod => {
55
+ return {
56
+ start: async () => ({
57
+ type: "new",
58
+ creationProps: { name: "Ephemeral" },
59
+ saveCredentials: async () => {},
60
+ onSuccess: () => {},
61
+ onError: () => {},
62
+ logOut: () => {},
47
63
  }),
48
64
  };
49
65
  };
@@ -74,28 +90,40 @@ type BaseContextParams = {
74
90
  crypto: CryptoProvider;
75
91
  };
76
92
 
93
+ export type JazzContextWithAccount<Acc extends Account> = {
94
+ account: Acc;
95
+ done: () => void;
96
+ logOut: () => void;
97
+ };
98
+
99
+ export type JazzContextWithAgent = {
100
+ agent: AnonymousJazzAgent;
101
+ done: () => void;
102
+ logOut: () => void;
103
+ };
104
+
105
+ export type JazzContext<Acc extends Account> = JazzContextWithAccount<Acc> | JazzContextWithAgent;
106
+
77
107
  export async function createJazzContext<Acc extends Account>({
78
108
  AccountSchema,
79
109
  auth,
80
110
  sessionProvider,
81
111
  peersToLoadFrom,
82
112
  crypto,
83
- }: ContextParamsWithAuth<Acc>): Promise<{ account: Acc; done: () => void }>;
113
+ }: ContextParamsWithAuth<Acc>): Promise<JazzContextWithAccount<Acc>>;
84
114
  export async function createJazzContext({
85
115
  peersToLoadFrom,
86
116
  crypto,
87
- }: BaseContextParams): Promise<{ agent: AnonymousJazzAgent; done: () => void }>;
117
+ }: BaseContextParams): Promise<JazzContextWithAgent>;
88
118
  export async function createJazzContext<Acc extends Account>(
89
119
  options: ContextParamsWithAuth<Acc> | BaseContextParams,
90
120
  ): Promise<
91
- | { account: Acc; done: () => void }
92
- | { agent: AnonymousJazzAgent; done: () => void }
121
+ JazzContext<Acc>
93
122
  >
94
123
  export async function createJazzContext<Acc extends Account>(
95
124
  options: ContextParamsWithAuth<Acc> | BaseContextParams,
96
125
  ): Promise<
97
- | { account: Acc; done: () => void }
98
- | { agent: AnonymousJazzAgent; done: () => void }
126
+ JazzContext<Acc>
99
127
  > {
100
128
  // eslint-disable-next-line no-constant-condition
101
129
  while (true) {
@@ -145,6 +173,11 @@ export async function createJazzContext<Acc extends Account>(
145
173
  node.gracefulShutdown();
146
174
  sessionDone();
147
175
  },
176
+ logOut: () => {
177
+ node.gracefulShutdown();
178
+ sessionDone();
179
+ authResult.logOut();
180
+ },
148
181
  };
149
182
  } catch (e) {
150
183
  authResult.onError(
@@ -188,6 +221,10 @@ export async function createJazzContext<Acc extends Account>(
188
221
  done: () => {
189
222
  node.gracefulShutdown();
190
223
  },
224
+ logOut: () => {
225
+ node.gracefulShutdown();
226
+ authResult.logOut();
227
+ },
191
228
  };
192
229
  } catch (e) {
193
230
  authResult.onError(
@@ -209,7 +246,7 @@ export async function createAnonymousJazzContext({
209
246
  }: {
210
247
  peersToLoadFrom: Peer[];
211
248
  crypto: CryptoProvider;
212
- }): Promise<{ agent: AnonymousJazzAgent; done: () => void }> {
249
+ }): Promise<JazzContextWithAgent> {
213
250
  const agentSecret = crypto.newRandomAgentSecret();
214
251
  const rawAgent = new ControlledAgent(agentSecret, crypto);
215
252
 
@@ -226,5 +263,6 @@ export async function createAnonymousJazzContext({
226
263
  return {
227
264
  agent: new AnonymousJazzAgent(node),
228
265
  done: () => {},
266
+ logOut: () => {},
229
267
  };
230
268
  }
@@ -1,3 +1,4 @@
1
+ /* istanbul ignore file -- @preserve */
1
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
3
  import { ItemsSym } from "./symbols.js";
3
4
 
@@ -88,6 +88,7 @@ function optionalRef<C extends CoValueClass>(
88
88
 
89
89
  function ref<C extends CoValueClass>(
90
90
  arg: C | ((_raw: InstanceType<C>["_raw"]) => C),
91
+ options?: never,
91
92
  ): co<InstanceType<C> | null>;
92
93
  function ref<C extends CoValueClass>(
93
94
  arg: C | ((_raw: InstanceType<C>["_raw"]) => C),
package/src/index.ts CHANGED
@@ -34,6 +34,7 @@ export {
34
34
  type AuthResult,
35
35
  createJazzContext,
36
36
  fixedCredentialsAuth,
37
+ ephemeralCredentialsAuth,
37
38
  AnonymousJazzAgent,
38
39
  createAnonymousJazzContext,
39
40
  } from "./internal.js";
@@ -1,4 +1,4 @@
1
- import { expect, describe, test } from "vitest";
1
+ import { expect, describe, test, expectTypeOf } from "vitest";
2
2
  import { connectedPeers } from "cojson/src/streamUtils.js";
3
3
  import {
4
4
  Account,
@@ -592,6 +592,7 @@ describe("CoMap applyDiff", async () => {
592
592
  birthday = co.encoded(Encoders.Date);
593
593
  nested = co.ref(NestedMap);
594
594
  optionalField = co.optional.string;
595
+ optionalNested = co.optional.ref(NestedMap);
595
596
  }
596
597
 
597
598
  class NestedMap extends CoMap {
@@ -737,6 +738,143 @@ describe("CoMap applyDiff", async () => {
737
738
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
738
739
  expect((map as any).invalidField).toBeUndefined();
739
740
  });
741
+
742
+ test("applyDiff with optional reference set to null", () => {
743
+ const map = TestMap.create(
744
+ {
745
+ name: "Jack",
746
+ age: 50,
747
+ isActive: true,
748
+ birthday: new Date("1970-01-01"),
749
+ nested: NestedMap.create({ value: "original" }, { owner: me }),
750
+ optionalNested: NestedMap.create(
751
+ { value: "optional" },
752
+ { owner: me },
753
+ ),
754
+ },
755
+ { owner: me },
756
+ );
757
+
758
+ const newValues = {
759
+ optionalNested: null,
760
+ };
761
+
762
+ map.applyDiff(newValues);
763
+
764
+ expect(map.optionalNested).toBeNull();
765
+ });
766
+
767
+ test("applyDiff with required reference set to null should throw", () => {
768
+ const map = TestMap.create(
769
+ {
770
+ name: "Kate",
771
+ age: 55,
772
+ isActive: true,
773
+ birthday: new Date("1965-01-01"),
774
+ nested: NestedMap.create({ value: "original" }, { owner: me }),
775
+ },
776
+ { owner: me },
777
+ );
778
+
779
+ const newValues = {
780
+ nested: null,
781
+ };
782
+
783
+ // @ts-expect-error testing invalid usage
784
+ expect(() => map.applyDiff(newValues)).toThrowError(
785
+ "Cannot set required reference nested to null",
786
+ );
787
+ });
788
+ });
789
+
790
+ describe("CoMap Typescript validation", async () => {
791
+ const me = await Account.create({
792
+ creationProps: { name: "Hermes Puggington" },
793
+ crypto: Crypto,
794
+ });
795
+
796
+ test("Is not ok to pass null into a required ref", () => {
797
+ class TestMap extends CoMap {
798
+ required = co.ref(NestedMap);
799
+ optional = co.optional.ref(NestedMap);
800
+ }
801
+
802
+ class NestedMap extends CoMap {
803
+ value = co.string;
804
+ }
805
+
806
+ expectTypeOf<typeof TestMap.create<TestMap>>().toBeCallableWith(
807
+ {
808
+ optional: NestedMap.create({ value: "" }, { owner: me }),
809
+ // @ts-expect-error null can't be passed to a non-optional field
810
+ required: null,
811
+ },
812
+ { owner: me },
813
+ );
814
+ });
815
+
816
+ test("Is not ok if a required ref is omitted", () => {
817
+ class TestMap extends CoMap {
818
+ required = co.ref(NestedMap);
819
+ optional = co.ref(NestedMap, { optional: true });
820
+ }
821
+
822
+ class NestedMap extends CoMap {
823
+ value = co.string;
824
+ }
825
+
826
+ expectTypeOf<typeof TestMap.create<TestMap>>().toBeCallableWith(
827
+ // @ts-expect-error non-optional fields can't be omitted
828
+ {},
829
+ { owner: me },
830
+ );
831
+ });
832
+
833
+ test("Is ok to omit optional fields", () => {
834
+ class TestMap extends CoMap {
835
+ required = co.ref(NestedMap);
836
+ optional = co.ref(NestedMap, { optional: true });
837
+ }
838
+
839
+ class NestedMap extends CoMap {
840
+ value = co.string;
841
+ }
842
+
843
+ expectTypeOf<typeof TestMap.create<TestMap>>().toBeCallableWith(
844
+ {
845
+ required: NestedMap.create({ value: "" }, { owner: me }),
846
+ },
847
+ { owner: me },
848
+ );
849
+
850
+ expectTypeOf<typeof TestMap.create<TestMap>>().toBeCallableWith(
851
+ {
852
+ required: NestedMap.create({ value: "" }, { owner: me }),
853
+ optional: null,
854
+ },
855
+ { owner: me },
856
+ );
857
+ });
858
+
859
+ test("the required refs should be nullable", () => {
860
+ class TestMap extends CoMap {
861
+ required = co.ref(NestedMap);
862
+ optional = co.ref(NestedMap, { optional: true });
863
+ }
864
+
865
+ class NestedMap extends CoMap {
866
+ value = co.string;
867
+ }
868
+
869
+ const map = TestMap.create(
870
+ {
871
+ required: NestedMap.create({ value: "" }, { owner: me }),
872
+ },
873
+ { owner: me },
874
+ );
875
+
876
+ expectTypeOf(map.required).toBeNullable();
877
+ });
740
878
  });
741
879
 
742
880
  describe("Creating and finding unique CoMaps", async () => {