jazz-tools 0.13.7 → 0.13.10

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.13.7 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.13.10 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,12 +11,12 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 1.50 KB
13
13
  ESM dist/testing.js 6.26 KB
14
- ESM dist/chunk-VQWUJIL4.js 127.66 KB
14
+ ESM dist/chunk-NFVKGXSH.js 128.03 KB
15
15
  ESM dist/index.js.map 259.00 B
16
16
  ESM dist/testing.js.map 12.37 KB
17
- ESM dist/chunk-VQWUJIL4.js.map 300.87 KB
18
- ESM ⚡️ Build success in 61ms
17
+ ESM dist/chunk-NFVKGXSH.js.map 301.60 KB
18
+ ESM ⚡️ Build success in 48ms
19
19
 
20
- > jazz-tools@0.13.7 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.13.10 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.13.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [f837cfe]
8
+ - cojson@0.13.10
9
+
10
+ ## 0.13.9
11
+
12
+ ### Patch Changes
13
+
14
+ - a6cf01f: Handle null values on CoList when using $each: true
15
+
3
16
  ## 0.13.7
4
17
 
5
18
  ### Patch Changes
@@ -73,7 +73,7 @@ function fulfillsDepth(depth, value) {
73
73
  const result = { status: "fulfilled" };
74
74
  for (const [key, item] of Object.entries(value)) {
75
75
  const rawValue = map._raw.get(key);
76
- if (rawValue !== void 0) {
76
+ if (rawValue !== void 0 && rawValue !== null) {
77
77
  if (!item) {
78
78
  if (hasReadAccess(map, key)) {
79
79
  result.status = "unfulfilled";
@@ -154,7 +154,17 @@ function fulfillsDepth(depth, value) {
154
154
  } else if (value._type === "CoList") {
155
155
  if ("$each" in depth) {
156
156
  const result = { status: "fulfilled" };
157
+ const list = value;
157
158
  for (const [key, item] of value.entries()) {
159
+ const rawValue = list._raw.get(key);
160
+ if (!rawValue) {
161
+ if (isOptionalField(value, ItemsSym)) {
162
+ continue;
163
+ }
164
+ throw new Error(
165
+ `The ref ${key} on ${list.constructor.name} is required but missing`
166
+ );
167
+ }
158
168
  if (hasRefValue(value, key)) {
159
169
  if (!item) {
160
170
  if (hasReadAccess(value, key)) {
@@ -2965,7 +2975,10 @@ var _CoList = class _CoList extends Array {
2965
2975
  _CoList.prototype._type = "CoList";
2966
2976
  var CoList = _CoList;
2967
2977
  function toRawItems(items, itemDescriptor) {
2968
- const rawItems = itemDescriptor === "json" ? items : "encoded" in itemDescriptor ? items?.map((e) => itemDescriptor.encoded.encode(e)) : isRefEncoded(itemDescriptor) ? items?.map((v) => v.id) : (() => {
2978
+ const rawItems = itemDescriptor === "json" ? items : "encoded" in itemDescriptor ? items?.map((e) => itemDescriptor.encoded.encode(e)) : isRefEncoded(itemDescriptor) ? items?.map((v) => {
2979
+ if (!v) return null;
2980
+ return v.id;
2981
+ }) : (() => {
2969
2982
  throw new Error("Invalid element descriptor");
2970
2983
  })();
2971
2984
  return rawItems;
@@ -4443,4 +4456,4 @@ export {
4443
4456
  consumeInviteLink
4444
4457
  };
4445
4458
  /* istanbul ignore file -- @preserve */
4446
- //# sourceMappingURL=chunk-VQWUJIL4.js.map
4459
+ //# sourceMappingURL=chunk-NFVKGXSH.js.map