@fireproof/core 0.5.15 → 0.5.16

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.
@@ -115,8 +115,8 @@ export class TransactionBlockstore {
115
115
  */
116
116
  async *entries() {
117
117
  for (const transaction of this.inflightTransactions) {
118
- for (const [str, bytes] of transaction) {
119
- yield { cid: str, bytes };
118
+ for (const [cid, bytes] of transaction.entries()) { // test for this?
119
+ yield { cid: cid.toString(), bytes };
120
120
  }
121
121
  }
122
122
  for (const [str, bytes] of this.committedBlocks) {
@@ -164,7 +164,7 @@ export class TransactionBlockstore {
164
164
  doCommit = async (innerBlockstore) => {
165
165
  const cids = new Set();
166
166
  for (const { cid, bytes } of innerBlockstore.entries()) {
167
- const stringCid = cid.toString(); // unnecessary string conversion, can we fix upstream?
167
+ const stringCid = cid.toString();
168
168
  if (this.committedBlocks.has(stringCid)) {
169
169
  // console.log('Duplicate block: ' + stringCid) // todo some of this can be avoided, cost is extra size on car files
170
170
  }
package/dist/src/clock.js CHANGED
@@ -227,7 +227,7 @@ export async function findEventsToSync(blocks, head) {
227
227
  // console.time(callTag + '.contains')
228
228
  const toSync = ancestor ? await asyncFilter(sorted, async (uks) => !(await contains(events, ancestor, uks.cid))) : sorted;
229
229
  // console.timeEnd(callTag + '.contains')
230
- console.log('toSync', !!ancestor, sorted.length - toSync.length);
230
+ // console.log('optimize sorted', !!ancestor, sorted.length - toSync.length)
231
231
  return { cids: events, events: toSync };
232
232
  }
233
233
  const asyncFilter = async (arr, predicate) => Promise.all(arr.map(predicate)).then(results => arr.filter((_v, index) => results[index]));
@@ -5720,7 +5720,7 @@ async function findEventsToSync (blocks, head) {
5720
5720
 
5721
5721
  const toSync = ancestor ? await asyncFilter(sorted, async uks => !(await contains(events, ancestor, uks.cid))) : sorted;
5722
5722
  // console.timeEnd(callTag + '.contains')
5723
- console.log('toSync', !!ancestor, sorted.length - toSync.length);
5723
+ // console.log('optimize sorted', !!ancestor, sorted.length - toSync.length)
5724
5724
 
5725
5725
  return { cids: events, events: toSync }
5726
5726
  }
@@ -9659,7 +9659,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
9659
9659
 
9660
9660
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
9661
9661
 
9662
- var streamBrowser = require$$0$1.EventEmitter;
9662
+ var streamBrowser;
9663
+ var hasRequiredStreamBrowser;
9664
+
9665
+ function requireStreamBrowser () {
9666
+ if (hasRequiredStreamBrowser) return streamBrowser;
9667
+ hasRequiredStreamBrowser = 1;
9668
+ streamBrowser = require$$0$1.EventEmitter;
9669
+ return streamBrowser;
9670
+ }
9663
9671
 
9664
9672
  // shim for using process in browser
9665
9673
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -9802,7 +9810,7 @@ var argv = [];
9802
9810
  var version$2 = ''; // empty string to avoid regexp issues
9803
9811
  var versions = {};
9804
9812
  var release = {};
9805
- var config$1 = {};
9813
+ var config = {};
9806
9814
 
9807
9815
  function noop$2() {}
9808
9816
 
@@ -9879,7 +9887,7 @@ var browser$1$1 = {
9879
9887
  hrtime: hrtime,
9880
9888
  platform: platform,
9881
9889
  release: release,
9882
- config: config$1,
9890
+ config: config,
9883
9891
  uptime: uptime
9884
9892
  };
9885
9893
 
@@ -9960,11 +9968,11 @@ function format(f) {
9960
9968
  // Mark that a method should not be used.
9961
9969
  // Returns a modified function which warns once by default.
9962
9970
  // If --no-deprecation is set, then it is a no-op.
9963
- function deprecate$2(fn, msg) {
9971
+ function deprecate$1(fn, msg) {
9964
9972
  // Allow for deprecating things in the process of starting up.
9965
9973
  if (isUndefined(global$1.process)) {
9966
9974
  return function() {
9967
- return deprecate$2(fn, msg).apply(this, arguments);
9975
+ return deprecate$1(fn, msg).apply(this, arguments);
9968
9976
  };
9969
9977
  }
9970
9978
 
@@ -10573,7 +10581,7 @@ var _polyfillNode_util = {
10573
10581
  isBoolean: isBoolean,
10574
10582
  isArray: isArray,
10575
10583
  inspect: inspect,
10576
- deprecate: deprecate$2,
10584
+ deprecate: deprecate$1,
10577
10585
  format: format,
10578
10586
  debuglog: debuglog,
10579
10587
  promisify: promisify,
@@ -10586,7 +10594,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
10586
10594
  callbackify: callbackify,
10587
10595
  debuglog: debuglog,
10588
10596
  default: _polyfillNode_util,
10589
- deprecate: deprecate$2,
10597
+ deprecate: deprecate$1,
10590
10598
  format: format,
10591
10599
  inherits: inherits$w,
10592
10600
  inspect: inspect,
@@ -10774,99 +10782,108 @@ function requireBuffer_list () {
10774
10782
  return buffer_list;
10775
10783
  }
10776
10784
 
10777
- // undocumented cb() API, needed for core, not for public API
10778
- function destroy(err, cb) {
10779
- const readableDestroyed = this._readableState && this._readableState.destroyed;
10780
- const writableDestroyed = this._writableState && this._writableState.destroyed;
10781
- if (readableDestroyed || writableDestroyed) {
10782
- if (cb) {
10783
- cb(err);
10784
- } else if (err) {
10785
- if (!this._writableState) {
10786
- process.nextTick(emitErrorNT, this, err);
10787
- } else if (!this._writableState.errorEmitted) {
10788
- this._writableState.errorEmitted = true;
10789
- process.nextTick(emitErrorNT, this, err);
10790
- }
10791
- }
10792
- return this;
10793
- }
10794
-
10795
- // we set destroyed to true before firing error callbacks in order
10796
- // to make it re-entrance safe in case destroy() is called within callbacks
10785
+ var destroy_1;
10786
+ var hasRequiredDestroy;
10787
+
10788
+ function requireDestroy () {
10789
+ if (hasRequiredDestroy) return destroy_1;
10790
+ hasRequiredDestroy = 1;
10791
+
10792
+ // undocumented cb() API, needed for core, not for public API
10793
+ function destroy(err, cb) {
10794
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
10795
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
10796
+ if (readableDestroyed || writableDestroyed) {
10797
+ if (cb) {
10798
+ cb(err);
10799
+ } else if (err) {
10800
+ if (!this._writableState) {
10801
+ process.nextTick(emitErrorNT, this, err);
10802
+ } else if (!this._writableState.errorEmitted) {
10803
+ this._writableState.errorEmitted = true;
10804
+ process.nextTick(emitErrorNT, this, err);
10805
+ }
10806
+ }
10807
+ return this;
10808
+ }
10797
10809
 
10798
- if (this._readableState) {
10799
- this._readableState.destroyed = true;
10800
- }
10810
+ // we set destroyed to true before firing error callbacks in order
10811
+ // to make it re-entrance safe in case destroy() is called within callbacks
10801
10812
 
10802
- // if this is a duplex stream mark the writable part as destroyed as well
10803
- if (this._writableState) {
10804
- this._writableState.destroyed = true;
10805
- }
10806
- this._destroy(err || null, err => {
10807
- if (!cb && err) {
10808
- if (!this._writableState) {
10809
- process.nextTick(emitErrorAndCloseNT, this, err);
10810
- } else if (!this._writableState.errorEmitted) {
10811
- this._writableState.errorEmitted = true;
10812
- process.nextTick(emitErrorAndCloseNT, this, err);
10813
- } else {
10814
- process.nextTick(emitCloseNT, this);
10815
- }
10816
- } else if (cb) {
10817
- process.nextTick(emitCloseNT, this);
10818
- cb(err);
10819
- } else {
10820
- process.nextTick(emitCloseNT, this);
10821
- }
10822
- });
10823
- return this;
10824
- }
10825
- function emitErrorAndCloseNT(self, err) {
10826
- emitErrorNT(self, err);
10827
- emitCloseNT(self);
10828
- }
10829
- function emitCloseNT(self) {
10830
- if (self._writableState && !self._writableState.emitClose) return;
10831
- if (self._readableState && !self._readableState.emitClose) return;
10832
- self.emit('close');
10833
- }
10834
- function undestroy() {
10835
- if (this._readableState) {
10836
- this._readableState.destroyed = false;
10837
- this._readableState.reading = false;
10838
- this._readableState.ended = false;
10839
- this._readableState.endEmitted = false;
10840
- }
10841
- if (this._writableState) {
10842
- this._writableState.destroyed = false;
10843
- this._writableState.ended = false;
10844
- this._writableState.ending = false;
10845
- this._writableState.finalCalled = false;
10846
- this._writableState.prefinished = false;
10847
- this._writableState.finished = false;
10848
- this._writableState.errorEmitted = false;
10849
- }
10850
- }
10851
- function emitErrorNT(self, err) {
10852
- self.emit('error', err);
10853
- }
10854
- function errorOrDestroy(stream, err) {
10855
- // We have tests that rely on errors being emitted
10856
- // in the same tick, so changing this is semver major.
10857
- // For now when you opt-in to autoDestroy we allow
10858
- // the error to be emitted nextTick. In a future
10859
- // semver major update we should change the default to this.
10813
+ if (this._readableState) {
10814
+ this._readableState.destroyed = true;
10815
+ }
10860
10816
 
10861
- const rState = stream._readableState;
10862
- const wState = stream._writableState;
10863
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10817
+ // if this is a duplex stream mark the writable part as destroyed as well
10818
+ if (this._writableState) {
10819
+ this._writableState.destroyed = true;
10820
+ }
10821
+ this._destroy(err || null, err => {
10822
+ if (!cb && err) {
10823
+ if (!this._writableState) {
10824
+ process.nextTick(emitErrorAndCloseNT, this, err);
10825
+ } else if (!this._writableState.errorEmitted) {
10826
+ this._writableState.errorEmitted = true;
10827
+ process.nextTick(emitErrorAndCloseNT, this, err);
10828
+ } else {
10829
+ process.nextTick(emitCloseNT, this);
10830
+ }
10831
+ } else if (cb) {
10832
+ process.nextTick(emitCloseNT, this);
10833
+ cb(err);
10834
+ } else {
10835
+ process.nextTick(emitCloseNT, this);
10836
+ }
10837
+ });
10838
+ return this;
10839
+ }
10840
+ function emitErrorAndCloseNT(self, err) {
10841
+ emitErrorNT(self, err);
10842
+ emitCloseNT(self);
10843
+ }
10844
+ function emitCloseNT(self) {
10845
+ if (self._writableState && !self._writableState.emitClose) return;
10846
+ if (self._readableState && !self._readableState.emitClose) return;
10847
+ self.emit('close');
10848
+ }
10849
+ function undestroy() {
10850
+ if (this._readableState) {
10851
+ this._readableState.destroyed = false;
10852
+ this._readableState.reading = false;
10853
+ this._readableState.ended = false;
10854
+ this._readableState.endEmitted = false;
10855
+ }
10856
+ if (this._writableState) {
10857
+ this._writableState.destroyed = false;
10858
+ this._writableState.ended = false;
10859
+ this._writableState.ending = false;
10860
+ this._writableState.finalCalled = false;
10861
+ this._writableState.prefinished = false;
10862
+ this._writableState.finished = false;
10863
+ this._writableState.errorEmitted = false;
10864
+ }
10865
+ }
10866
+ function emitErrorNT(self, err) {
10867
+ self.emit('error', err);
10868
+ }
10869
+ function errorOrDestroy(stream, err) {
10870
+ // We have tests that rely on errors being emitted
10871
+ // in the same tick, so changing this is semver major.
10872
+ // For now when you opt-in to autoDestroy we allow
10873
+ // the error to be emitted nextTick. In a future
10874
+ // semver major update we should change the default to this.
10875
+
10876
+ const rState = stream._readableState;
10877
+ const wState = stream._writableState;
10878
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10879
+ }
10880
+ destroy_1 = {
10881
+ destroy,
10882
+ undestroy,
10883
+ errorOrDestroy
10884
+ };
10885
+ return destroy_1;
10864
10886
  }
10865
- var destroy_1 = {
10866
- destroy,
10867
- undestroy,
10868
- errorOrDestroy
10869
- };
10870
10887
 
10871
10888
  var errorsBrowser = {};
10872
10889
 
@@ -10996,92 +11013,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
10996
11013
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
10997
11014
  errorsBrowser.codes = codes;
10998
11015
 
10999
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
11000
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
11001
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
11002
- }
11003
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
11004
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
11005
- if (hwm != null) {
11006
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
11007
- const name = isDuplex ? duplexKey : 'highWaterMark';
11008
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
11009
- }
11010
- return Math.floor(hwm);
11011
- }
11016
+ var state;
11017
+ var hasRequiredState;
11018
+
11019
+ function requireState () {
11020
+ if (hasRequiredState) return state;
11021
+ hasRequiredState = 1;
11012
11022
 
11013
- // Default value
11014
- return state.objectMode ? 16 : 16 * 1024;
11023
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
11024
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
11025
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
11026
+ }
11027
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
11028
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
11029
+ if (hwm != null) {
11030
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
11031
+ const name = isDuplex ? duplexKey : 'highWaterMark';
11032
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
11033
+ }
11034
+ return Math.floor(hwm);
11035
+ }
11036
+
11037
+ // Default value
11038
+ return state.objectMode ? 16 : 16 * 1024;
11039
+ }
11040
+ state = {
11041
+ getHighWaterMark
11042
+ };
11043
+ return state;
11015
11044
  }
11016
- var state = {
11017
- getHighWaterMark
11018
- };
11019
11045
 
11020
- /**
11021
- * Module exports.
11022
- */
11046
+ var browser$b;
11047
+ var hasRequiredBrowser$3;
11023
11048
 
11024
- var browser$b = deprecate$1;
11049
+ function requireBrowser$3 () {
11050
+ if (hasRequiredBrowser$3) return browser$b;
11051
+ hasRequiredBrowser$3 = 1;
11052
+ /**
11053
+ * Module exports.
11054
+ */
11025
11055
 
11026
- /**
11027
- * Mark that a method should not be used.
11028
- * Returns a modified function which warns once by default.
11029
- *
11030
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
11031
- *
11032
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
11033
- * will throw an Error when invoked.
11034
- *
11035
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
11036
- * will invoke `console.trace()` instead of `console.error()`.
11037
- *
11038
- * @param {Function} fn - the function to deprecate
11039
- * @param {String} msg - the string to print to the console when `fn` is invoked
11040
- * @returns {Function} a new "deprecated" version of `fn`
11041
- * @api public
11042
- */
11056
+ browser$b = deprecate;
11043
11057
 
11044
- function deprecate$1 (fn, msg) {
11045
- if (config('noDeprecation')) {
11046
- return fn;
11047
- }
11058
+ /**
11059
+ * Mark that a method should not be used.
11060
+ * Returns a modified function which warns once by default.
11061
+ *
11062
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
11063
+ *
11064
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
11065
+ * will throw an Error when invoked.
11066
+ *
11067
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
11068
+ * will invoke `console.trace()` instead of `console.error()`.
11069
+ *
11070
+ * @param {Function} fn - the function to deprecate
11071
+ * @param {String} msg - the string to print to the console when `fn` is invoked
11072
+ * @returns {Function} a new "deprecated" version of `fn`
11073
+ * @api public
11074
+ */
11048
11075
 
11049
- var warned = false;
11050
- function deprecated() {
11051
- if (!warned) {
11052
- if (config('throwDeprecation')) {
11053
- throw new Error(msg);
11054
- } else if (config('traceDeprecation')) {
11055
- console.trace(msg);
11056
- } else {
11057
- console.warn(msg);
11058
- }
11059
- warned = true;
11060
- }
11061
- return fn.apply(this, arguments);
11062
- }
11076
+ function deprecate (fn, msg) {
11077
+ if (config('noDeprecation')) {
11078
+ return fn;
11079
+ }
11063
11080
 
11064
- return deprecated;
11065
- }
11081
+ var warned = false;
11082
+ function deprecated() {
11083
+ if (!warned) {
11084
+ if (config('throwDeprecation')) {
11085
+ throw new Error(msg);
11086
+ } else if (config('traceDeprecation')) {
11087
+ console.trace(msg);
11088
+ } else {
11089
+ console.warn(msg);
11090
+ }
11091
+ warned = true;
11092
+ }
11093
+ return fn.apply(this, arguments);
11094
+ }
11066
11095
 
11067
- /**
11068
- * Checks `localStorage` for boolean values for the given `name`.
11069
- *
11070
- * @param {String} name
11071
- * @returns {Boolean}
11072
- * @api private
11073
- */
11096
+ return deprecated;
11097
+ }
11074
11098
 
11075
- function config (name) {
11076
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
11077
- try {
11078
- if (!commonjsGlobal.localStorage) return false;
11079
- } catch (_) {
11080
- return false;
11081
- }
11082
- var val = commonjsGlobal.localStorage[name];
11083
- if (null == val) return false;
11084
- return String(val).toLowerCase() === 'true';
11099
+ /**
11100
+ * Checks `localStorage` for boolean values for the given `name`.
11101
+ *
11102
+ * @param {String} name
11103
+ * @returns {Boolean}
11104
+ * @api private
11105
+ */
11106
+
11107
+ function config (name) {
11108
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
11109
+ try {
11110
+ if (!commonjsGlobal.localStorage) return false;
11111
+ } catch (_) {
11112
+ return false;
11113
+ }
11114
+ var val = commonjsGlobal.localStorage[name];
11115
+ if (null == val) return false;
11116
+ return String(val).toLowerCase() === 'true';
11117
+ }
11118
+ return browser$b;
11085
11119
  }
11086
11120
 
11087
11121
  var _stream_writable;
@@ -11112,12 +11146,12 @@ function require_stream_writable () {
11112
11146
 
11113
11147
  /*<replacement>*/
11114
11148
  const internalUtil = {
11115
- deprecate: browser$b
11149
+ deprecate: requireBrowser$3()
11116
11150
  };
11117
11151
  /*</replacement>*/
11118
11152
 
11119
11153
  /*<replacement>*/
11120
- var Stream = streamBrowser;
11154
+ var Stream = requireStreamBrowser();
11121
11155
  /*</replacement>*/
11122
11156
 
11123
11157
  const Buffer = require$$6$1.Buffer;
@@ -11128,8 +11162,8 @@ function require_stream_writable () {
11128
11162
  function _isUint8Array(obj) {
11129
11163
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
11130
11164
  }
11131
- const destroyImpl = destroy_1;
11132
- const _require = state,
11165
+ const destroyImpl = requireDestroy();
11166
+ const _require = requireState(),
11133
11167
  getHighWaterMark = _require.getHighWaterMark;
11134
11168
  const _require$codes = errorsBrowser.codes,
11135
11169
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -12323,7 +12357,7 @@ function require_stream_readable () {
12323
12357
  /*</replacement>*/
12324
12358
 
12325
12359
  /*<replacement>*/
12326
- var Stream = streamBrowser;
12360
+ var Stream = requireStreamBrowser();
12327
12361
  /*</replacement>*/
12328
12362
 
12329
12363
  const Buffer = require$$6$1.Buffer;
@@ -12346,8 +12380,8 @@ function require_stream_readable () {
12346
12380
  /*</replacement>*/
12347
12381
 
12348
12382
  const BufferList = requireBuffer_list();
12349
- const destroyImpl = destroy_1;
12350
- const _require = state,
12383
+ const destroyImpl = requireDestroy();
12384
+ const _require = requireState(),
12351
12385
  getHighWaterMark = _require.getHighWaterMark;
12352
12386
  const _require$codes = errorsBrowser.codes,
12353
12387
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -15713,7 +15747,7 @@ function WriteReq(chunk, encoding, cb) {
15713
15747
 
15714
15748
  function WritableState(options, stream) {
15715
15749
  Object.defineProperty(this, 'buffer', {
15716
- get: deprecate$2(function () {
15750
+ get: deprecate$1(function () {
15717
15751
  return this.getBuffer();
15718
15752
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
15719
15753
  });
@@ -37425,8 +37459,8 @@ class TransactionBlockstore {
37425
37459
  */
37426
37460
  async * entries () {
37427
37461
  for (const transaction of this.inflightTransactions) {
37428
- for (const [str, bytes] of transaction) {
37429
- yield { cid: str, bytes };
37462
+ for (const [cid, bytes] of transaction.entries()) { // test for this?
37463
+ yield { cid: cid.toString(), bytes };
37430
37464
  }
37431
37465
  }
37432
37466
  for (const [str, bytes] of this.committedBlocks) {
@@ -37477,7 +37511,7 @@ class TransactionBlockstore {
37477
37511
  doCommit = async innerBlockstore => {
37478
37512
  const cids = new Set();
37479
37513
  for (const { cid, bytes } of innerBlockstore.entries()) {
37480
- const stringCid = cid.toString(); // unnecessary string conversion, can we fix upstream?
37514
+ const stringCid = cid.toString();
37481
37515
  if (this.committedBlocks.has(stringCid)) ; else {
37482
37516
  this.committedBlocks.set(stringCid, bytes);
37483
37517
  cids.add(stringCid);
@@ -37698,6 +37732,9 @@ const bulkFromEvents = (sorted, event) => {
37698
37732
  const {
37699
37733
  data: { type, value, key }
37700
37734
  } = event;
37735
+ if (!key) {
37736
+ throw new Error('key is required')
37737
+ }
37701
37738
  const bulkEvent = type === 'put' ? { key, value } : { key, del: true };
37702
37739
  bulk.set(bulkEvent.key, bulkEvent); // last wins
37703
37740
  }
@@ -41339,14 +41376,15 @@ class Sync {
41339
41376
  const blocks = database.blocks;
41340
41377
  const rootCIDs = database.clock;
41341
41378
 
41342
- const syncCIDs = [...new Set([...rootCIDs, ...allCIDs])].filter(cid => !skip.includes(cid.toString()));
41379
+ const newCIDs = [...new Set([...rootCIDs, ...allCIDs])].filter(cid => !skip.includes(cid.toString()));
41380
+ const syncCIDs = [...new Set([...rootCIDs, ...allCIDs.filter(cid => !skip.includes(cid.toString()))])];
41343
41381
  // console.log(
41344
41382
  // 'makeCar',
41345
41383
  // rootCIDs.map(c => c.toString()),
41346
41384
  // syncCIDs.map(c => c.toString()),
41347
41385
  // allCIDs.map(c => c.toString())
41348
41386
  // )
41349
- if (syncCIDs.length === 0) {
41387
+ if (newCIDs.length === 0) {
41350
41388
  return null
41351
41389
  }
41352
41390