hypercore-storage 2.8.0 → 2.9.0

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.
@@ -364,14 +364,14 @@ const dataUpgrade = {
364
364
  c.uint.preencode(state, u.length)
365
365
  nodeArray.preencode(state, u.nodes)
366
366
  nodeArray.preencode(state, u.additionalNodes)
367
- c.buffer.preencode(state, u.signature)
367
+ c.optionalBuffer.preencode(state, u.signature)
368
368
  },
369
369
  encode (state, u) {
370
370
  c.uint.encode(state, u.start)
371
371
  c.uint.encode(state, u.length)
372
372
  nodeArray.encode(state, u.nodes)
373
373
  nodeArray.encode(state, u.additionalNodes)
374
- c.buffer.encode(state, u.signature)
374
+ c.optionalBuffer.encode(state, u.signature)
375
375
  },
376
376
  decode (state) {
377
377
  return {
@@ -379,7 +379,7 @@ const dataUpgrade = {
379
379
  length: c.uint.decode(state),
380
380
  nodes: nodeArray.decode(state),
381
381
  additionalNodes: nodeArray.decode(state),
382
- signature: c.buffer.decode(state)
382
+ signature: c.optionalBuffer.decode(state)
383
383
  }
384
384
  }
385
385
  }
@@ -404,18 +404,18 @@ const dataSeek = {
404
404
  const dataBlock = {
405
405
  preencode (state, b) {
406
406
  c.uint.preencode(state, b.index)
407
- c.buffer.preencode(state, b.value)
407
+ c.optionalBuffer.preencode(state, b.value)
408
408
  nodeArray.preencode(state, b.nodes)
409
409
  },
410
410
  encode (state, b) {
411
411
  c.uint.encode(state, b.index)
412
- c.buffer.encode(state, b.value)
412
+ c.optionalBuffer.encode(state, b.value)
413
413
  nodeArray.encode(state, b.nodes)
414
414
  },
415
415
  decode (state) {
416
416
  return {
417
417
  index: c.uint.decode(state),
418
- value: c.buffer.decode(state) || EMPTY,
418
+ value: c.optionalBuffer.decode(state) || EMPTY,
419
419
  nodes: nodeArray.decode(state)
420
420
  }
421
421
  }
@@ -633,16 +633,16 @@ wire.extension = {
633
633
  const keyValue = {
634
634
  preencode (state, p) {
635
635
  c.string.preencode(state, p.key)
636
- c.buffer.preencode(state, p.value)
636
+ c.optionalBuffer.preencode(state, p.value)
637
637
  },
638
638
  encode (state, p) {
639
639
  c.string.encode(state, p.key)
640
- c.buffer.encode(state, p.value)
640
+ c.optionalBuffer.encode(state, p.value)
641
641
  },
642
642
  decode (state) {
643
643
  return {
644
644
  key: c.string.decode(state),
645
- value: c.buffer.decode(state)
645
+ value: c.optionalBuffer.decode(state)
646
646
  }
647
647
  }
648
648
  }
@@ -652,20 +652,20 @@ const treeUpgrade = {
652
652
  c.uint.preencode(state, u.fork)
653
653
  c.uint.preencode(state, u.ancestors)
654
654
  c.uint.preencode(state, u.length)
655
- c.buffer.preencode(state, u.signature)
655
+ c.optionalBuffer.preencode(state, u.signature)
656
656
  },
657
657
  encode (state, u) {
658
658
  c.uint.encode(state, u.fork)
659
659
  c.uint.encode(state, u.ancestors)
660
660
  c.uint.encode(state, u.length)
661
- c.buffer.encode(state, u.signature)
661
+ c.optionalBuffer.encode(state, u.signature)
662
662
  },
663
663
  decode (state) {
664
664
  return {
665
665
  fork: c.uint.decode(state),
666
666
  ancestors: c.uint.decode(state),
667
667
  length: c.uint.decode(state),
668
- signature: c.buffer.decode(state)
668
+ signature: c.optionalBuffer.decode(state)
669
669
  }
670
670
  }
671
671
  }
@@ -737,17 +737,17 @@ oplog.entry = {
737
737
 
738
738
  const keyPair = {
739
739
  preencode (state, kp) {
740
- c.buffer.preencode(state, kp.publicKey)
741
- c.buffer.preencode(state, kp.secretKey)
740
+ c.optionalBuffer.preencode(state, kp.publicKey)
741
+ c.optionalBuffer.preencode(state, kp.secretKey)
742
742
  },
743
743
  encode (state, kp) {
744
- c.buffer.encode(state, kp.publicKey)
745
- c.buffer.encode(state, kp.secretKey)
744
+ c.optionalBuffer.encode(state, kp.publicKey)
745
+ c.optionalBuffer.encode(state, kp.secretKey)
746
746
  },
747
747
  decode (state) {
748
748
  return {
749
- publicKey: c.buffer.decode(state),
750
- secretKey: c.buffer.decode(state)
749
+ publicKey: c.optionalBuffer.decode(state),
750
+ secretKey: c.optionalBuffer.decode(state)
751
751
  }
752
752
  }
753
753
  }
@@ -795,21 +795,21 @@ const treeHeader = {
795
795
  preencode (state, t) {
796
796
  c.uint.preencode(state, t.fork)
797
797
  c.uint.preencode(state, t.length)
798
- c.buffer.preencode(state, t.rootHash)
799
- c.buffer.preencode(state, t.signature)
798
+ c.optionalBuffer.preencode(state, t.rootHash)
799
+ c.optionalBuffer.preencode(state, t.signature)
800
800
  },
801
801
  encode (state, t) {
802
802
  c.uint.encode(state, t.fork)
803
803
  c.uint.encode(state, t.length)
804
- c.buffer.encode(state, t.rootHash)
805
- c.buffer.encode(state, t.signature)
804
+ c.optionalBuffer.encode(state, t.rootHash)
805
+ c.optionalBuffer.encode(state, t.signature)
806
806
  },
807
807
  decode (state) {
808
808
  return {
809
809
  fork: c.uint.decode(state),
810
810
  length: c.uint.decode(state),
811
- rootHash: c.buffer.decode(state),
812
- signature: c.buffer.decode(state)
811
+ rootHash: c.optionalBuffer.decode(state),
812
+ signature: c.optionalBuffer.decode(state)
813
813
  }
814
814
  }
815
815
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",
@@ -41,7 +41,7 @@
41
41
  "b4a": "^1.6.7",
42
42
  "bare-fs": "^4.0.1",
43
43
  "bare-path": "^3.0.0",
44
- "compact-encoding": "^2.16.0",
44
+ "compact-encoding": "^3.0.0",
45
45
  "device-file": "^2.1.2",
46
46
  "flat-tree": "^1.12.1",
47
47
  "hypercore-crypto": "^3.4.2",
@@ -299,15 +299,15 @@ const encoding9 = {
299
299
  const encoding10 = {
300
300
  preencode(state, m) {
301
301
  c.buffer.preencode(state, m.publicKey)
302
- c.buffer.preencode(state, m.secretKey)
302
+ c.optionalBuffer.preencode(state, m.secretKey)
303
303
  },
304
304
  encode(state, m) {
305
305
  c.buffer.encode(state, m.publicKey)
306
- c.buffer.encode(state, m.secretKey)
306
+ c.optionalBuffer.encode(state, m.secretKey)
307
307
  },
308
308
  decode(state) {
309
309
  const r0 = c.buffer.decode(state)
310
- const r1 = c.buffer.decode(state)
310
+ const r1 = c.optionalBuffer.decode(state)
311
311
 
312
312
  return {
313
313
  publicKey: r0,
@@ -362,19 +362,19 @@ const encoding12 = {
362
362
  c.uint.preencode(state, m.fork)
363
363
  c.uint.preencode(state, m.length)
364
364
  c.fixed32.preencode(state, m.rootHash)
365
- c.buffer.preencode(state, m.signature)
365
+ c.optionalBuffer.preencode(state, m.signature)
366
366
  },
367
367
  encode(state, m) {
368
368
  c.uint.encode(state, m.fork)
369
369
  c.uint.encode(state, m.length)
370
370
  c.fixed32.encode(state, m.rootHash)
371
- c.buffer.encode(state, m.signature)
371
+ c.optionalBuffer.encode(state, m.signature)
372
372
  },
373
373
  decode(state) {
374
374
  const r0 = c.uint.decode(state)
375
375
  const r1 = c.uint.decode(state)
376
376
  const r2 = c.fixed32.decode(state)
377
- const r3 = c.buffer.decode(state)
377
+ const r3 = c.optionalBuffer.decode(state)
378
378
 
379
379
  return {
380
380
  fork: r0,