serializable-bptree 5.0.1 → 5.0.3

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.
package/README.md CHANGED
@@ -102,7 +102,7 @@ import {
102
102
  ValueComparator,
103
103
  NumericComparator,
104
104
  StringComparator
105
- } from 'https://cdn.jsdelivr.net/npm/serializable-bptree@5.x.x/dist/esm/index.min.js'
105
+ } from 'https://cdn.jsdelivr.net/npm/serializable-bptree@5/+esm'
106
106
  </script>
107
107
  ```
108
108
 
@@ -73,6 +73,13 @@ var InvertedWeakMap = class {
73
73
  return this._map.clear();
74
74
  }
75
75
  delete(key) {
76
+ const ref = this._map.get(key);
77
+ if (ref) {
78
+ const raw = ref.deref();
79
+ if (raw !== void 0) {
80
+ this._registry.unregister(raw);
81
+ }
82
+ }
76
83
  return this._map.delete(key);
77
84
  }
78
85
  get(key) {
@@ -1125,8 +1132,8 @@ var BPTreeAsync = class extends BPTree {
1125
1132
  this.root = await this._createNode(true, [], [], true);
1126
1133
  this.strategy.head.root = this.root.id;
1127
1134
  this.bufferForNodeCreate(this.root);
1128
- this.commitHeadBuffer();
1129
- this.commitNodeCreateBuffer();
1135
+ await this.commitHeadBuffer();
1136
+ await this.commitNodeCreateBuffer();
1130
1137
  } else {
1131
1138
  const { root, order } = head;
1132
1139
  this.strategy.head = head;
@@ -39,6 +39,13 @@ var InvertedWeakMap = class {
39
39
  return this._map.clear();
40
40
  }
41
41
  delete(key) {
42
+ const ref = this._map.get(key);
43
+ if (ref) {
44
+ const raw = ref.deref();
45
+ if (raw !== void 0) {
46
+ this._registry.unregister(raw);
47
+ }
48
+ }
42
49
  return this._map.delete(key);
43
50
  }
44
51
  get(key) {
@@ -1091,8 +1098,8 @@ var BPTreeAsync = class extends BPTree {
1091
1098
  this.root = await this._createNode(true, [], [], true);
1092
1099
  this.strategy.head.root = this.root.id;
1093
1100
  this.bufferForNodeCreate(this.root);
1094
- this.commitHeadBuffer();
1095
- this.commitNodeCreateBuffer();
1101
+ await this.commitHeadBuffer();
1102
+ await this.commitNodeCreateBuffer();
1096
1103
  } else {
1097
1104
  const { root, order } = head;
1098
1105
  this.strategy.head = head;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serializable-bptree",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Store the B+tree flexibly, not only in-memory.",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "main": "./dist/cjs/index.cjs",