@based/db 0.2.14 → 0.2.15

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.
Binary file
Binary file
@@ -36,7 +36,8 @@ const putReferences = (ctx, def, val, refOp) => {
36
36
  reserve(ctx, PROP_CURSOR_SIZE + 6 + val.length * 4);
37
37
  writePropCursor(ctx, def);
38
38
  writeU8(ctx, ctx.operation);
39
- writeU32(ctx, val.length * 4 + 1);
39
+ const sizepos = ctx.index;
40
+ ctx.index += 4; // reserve for size
40
41
  writeU8(ctx, refOp === REF_OP_OVERWRITE ? REF_OP_PUT_OVERWRITE : REF_OP_PUT_ADD);
41
42
  let index = 0;
42
43
  for (const id of val) {
@@ -48,7 +49,7 @@ const putReferences = (ctx, def, val, refOp) => {
48
49
  }
49
50
  if (typeof id === 'object' && id !== null && typeof id.id === 'number') {
50
51
  if (hasEdgeOrIndex(def, id)) {
51
- return index;
52
+ break;
52
53
  }
53
54
  validate(id.id, def);
54
55
  writeU32(ctx, id.id);
@@ -57,6 +58,7 @@ const putReferences = (ctx, def, val, refOp) => {
57
58
  }
58
59
  return index;
59
60
  }
61
+ writeUint32(ctx.array, index * 4 + 1, sizepos);
60
62
  return index;
61
63
  };
62
64
  const updateReferences = (ctx, def, val, index, length, refOp) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@based/db",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "scripts": {