jazz-tools 0.10.7 → 0.10.8

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.10.7 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.10.8 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,8 +11,8 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 1.50 KB
13
13
  ESM dist/testing.js 6.28 KB
14
- ESM dist/chunk-TSEO4KAO.js 113.17 KB
14
+ ESM dist/chunk-6OJCOJJ6.js 113.88 KB
15
15
  ESM dist/index.js.map 259.00 B
16
16
  ESM dist/testing.js.map 12.41 KB
17
- ESM dist/chunk-TSEO4KAO.js.map 271.81 KB
18
- ESM ⚡️ Build success in 42ms
17
+ ESM dist/chunk-6OJCOJJ6.js.map 273.01 KB
18
+ ESM ⚡️ Build success in 40ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.10.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 2fb6428: Allow explicit keys when loading values from a CoMap.Record and throw when a required ref is undefined
8
+ - Updated dependencies [153dc99]
9
+ - cojson@0.10.8
10
+
3
11
  ## 0.10.7
4
12
 
5
13
  ### Patch Changes
@@ -58,8 +58,28 @@ function fulfillsDepth(depth, value) {
58
58
  } else {
59
59
  for (const key of Object.keys(depth)) {
60
60
  const map = value;
61
- if (!map._refs[key] && map._schema[key].optional) {
62
- continue;
61
+ if (map._raw.get(key) === void 0) {
62
+ if (!map._schema?.[key]) {
63
+ if (map._schema?.[ItemsSym]) {
64
+ if (map._schema[ItemsSym].optional) {
65
+ continue;
66
+ } else {
67
+ throw new Error(
68
+ `The ref ${key} requested on ${map.constructor.name} is missing`
69
+ );
70
+ }
71
+ } else {
72
+ throw new Error(
73
+ `The ref ${key} requested on ${map.constructor.name} is not defined in the schema`
74
+ );
75
+ }
76
+ } else if (map._schema[key].optional) {
77
+ continue;
78
+ } else {
79
+ throw new Error(
80
+ `The ref ${key} on ${map.constructor.name} is required but missing`
81
+ );
82
+ }
63
83
  }
64
84
  if (!map[key]) {
65
85
  return false;
@@ -810,6 +830,7 @@ function subscribeToCoValue(cls, id, as, depth, listener, onUnavailable, syncRes
810
830
  } else {
811
831
  ref2.load().then((value) => subscribe(value)).catch((e) => {
812
832
  console.error("Failed to load / subscribe to CoValue", e);
833
+ onUnavailable?.();
813
834
  });
814
835
  }
815
836
  return function unsubscribeAtAnyPoint() {
@@ -3972,4 +3993,4 @@ export {
3972
3993
  consumeInviteLink
3973
3994
  };
3974
3995
  /* istanbul ignore file -- @preserve */
3975
- //# sourceMappingURL=chunk-TSEO4KAO.js.map
3996
+ //# sourceMappingURL=chunk-6OJCOJJ6.js.map