jazz-tools 0.13.11 → 0.13.13

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.11 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.13.13 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.48 KB
13
13
  ESM dist/testing.js 6.26 KB
14
- ESM dist/chunk-I7NYAGLP.js 117.97 KB
14
+ ESM dist/chunk-GIZWJXSR.js 118.19 KB
15
15
  ESM dist/index.js.map 258.00 B
16
16
  ESM dist/testing.js.map 12.37 KB
17
- ESM dist/chunk-I7NYAGLP.js.map 276.92 KB
18
- ESM ⚡️ Build success in 53ms
17
+ ESM dist/chunk-GIZWJXSR.js.map 277.09 KB
18
+ ESM ⚡️ Build success in 35ms
19
19
 
20
- > jazz-tools@0.13.11 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.13.13 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.13.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ec9cb40]
8
+ - cojson@0.13.13
9
+
10
+ ## 0.13.12
11
+
12
+ ### Patch Changes
13
+
14
+ - 4547525: Skip non-schema related keys when calling CoMap.toJSON
15
+ - Updated dependencies [65719f2]
16
+ - cojson@0.13.12
17
+
3
18
  ## 0.13.11
4
19
 
5
20
  ### Patch Changes
@@ -323,7 +323,7 @@ var Ref = class _Ref {
323
323
  const entry = node.coValuesStore.get(
324
324
  this.id
325
325
  );
326
- if (entry.state.type === "available") {
326
+ if (entry.highLevelState === "available") {
327
327
  return new _Ref(this.id, this.controlledAccount, this.schema).value;
328
328
  }
329
329
  return void 0;
@@ -592,8 +592,8 @@ var SubscriptionScope = class {
592
592
  };
593
593
  function loadCoValue(node, id, callback, syncResolution) {
594
594
  const entry = node.coValuesStore.get(id);
595
- if (entry.state.type === "available" && syncResolution) {
596
- callback(entry.state.coValue);
595
+ if (entry.isAvailable() && syncResolution) {
596
+ callback(entry.core);
597
597
  } else {
598
598
  void node.loadCoValueCore(id).then((core) => {
599
599
  callback(core);
@@ -1525,30 +1525,38 @@ var _CoMap = class _CoMap extends CoValueBase {
1525
1525
  * @category Content
1526
1526
  */
1527
1527
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1528
- toJSON(_key, seenAbove) {
1529
- const jsonedFields = this._raw.keys().map((key) => {
1528
+ toJSON(_key, processedValues) {
1529
+ const result = {
1530
+ id: this.id,
1531
+ _type: this._type
1532
+ };
1533
+ for (const key of this._raw.keys()) {
1530
1534
  const tKey = key;
1531
1535
  const descriptor = this._schema[tKey] || this._schema[ItemsSym];
1536
+ if (!descriptor) {
1537
+ continue;
1538
+ }
1532
1539
  if (descriptor == "json" || "encoded" in descriptor) {
1533
- return [key, this._raw.get(key)];
1540
+ result[key] = this._raw.get(key);
1534
1541
  } else if (isRefEncoded(descriptor)) {
1535
- if (seenAbove?.includes(this[tKey]?.id)) {
1536
- return [key, { _circular: this[tKey]?.id }];
1542
+ const id = this._raw.get(key);
1543
+ if (processedValues?.includes(id) || id === this.id) {
1544
+ result[key] = { _circular: id };
1545
+ continue;
1546
+ }
1547
+ const ref2 = this[tKey];
1548
+ if (ref2 && typeof ref2 === "object" && "toJSON" in ref2 && typeof ref2.toJSON === "function") {
1549
+ const jsonedRef = ref2.toJSON(tKey, [
1550
+ ...processedValues || [],
1551
+ this.id
1552
+ ]);
1553
+ result[key] = jsonedRef;
1537
1554
  }
1538
- const jsonedRef = this[tKey]?.toJSON(tKey, [
1539
- ...seenAbove || [],
1540
- this.id
1541
- ]);
1542
- return [key, jsonedRef];
1543
1555
  } else {
1544
- return [key, void 0];
1556
+ result[key] = void 0;
1545
1557
  }
1546
- });
1547
- return {
1548
- id: this.id,
1549
- _type: this._type,
1550
- ...Object.fromEntries(jsonedFields)
1551
- };
1558
+ }
1559
+ return result;
1552
1560
  }
1553
1561
  [inspect]() {
1554
1562
  return this.toJSON();
@@ -4081,4 +4089,4 @@ export {
4081
4089
  consumeInviteLink
4082
4090
  };
4083
4091
  /* istanbul ignore file -- @preserve */
4084
- //# sourceMappingURL=chunk-I7NYAGLP.js.map
4092
+ //# sourceMappingURL=chunk-GIZWJXSR.js.map