@fireproof/core 0.5.14 → 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.
- package/dist/src/blockstore.js +3 -3
- package/dist/src/clock.js +1 -1
- package/dist/src/db-index.js +2 -1
- package/dist/src/fireproof.d.ts +1 -1
- package/dist/src/fireproof.js +226 -187
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +226 -187
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/src/prolly.js +3 -0
- package/dist/src/sync.js +3 -2
- package/package.json +1 -1
- package/src/blockstore.js +3 -3
- package/src/clock.js +1 -1
- package/src/db-index.js +2 -1
- package/src/prolly.js +3 -0
- package/src/sync.js +3 -2
package/dist/src/fireproof.mjs
CHANGED
@@ -5718,7 +5718,7 @@ async function findEventsToSync (blocks, head) {
|
|
5718
5718
|
|
5719
5719
|
const toSync = ancestor ? await asyncFilter(sorted, async uks => !(await contains(events, ancestor, uks.cid))) : sorted;
|
5720
5720
|
// console.timeEnd(callTag + '.contains')
|
5721
|
-
console.log('
|
5721
|
+
// console.log('optimize sorted', !!ancestor, sorted.length - toSync.length)
|
5722
5722
|
|
5723
5723
|
return { cids: events, events: toSync }
|
5724
5724
|
}
|
@@ -9657,7 +9657,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
9657
9657
|
|
9658
9658
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
9659
9659
|
|
9660
|
-
var streamBrowser
|
9660
|
+
var streamBrowser;
|
9661
|
+
var hasRequiredStreamBrowser;
|
9662
|
+
|
9663
|
+
function requireStreamBrowser () {
|
9664
|
+
if (hasRequiredStreamBrowser) return streamBrowser;
|
9665
|
+
hasRequiredStreamBrowser = 1;
|
9666
|
+
streamBrowser = require$$0$1.EventEmitter;
|
9667
|
+
return streamBrowser;
|
9668
|
+
}
|
9661
9669
|
|
9662
9670
|
// shim for using process in browser
|
9663
9671
|
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
@@ -9800,7 +9808,7 @@ var argv = [];
|
|
9800
9808
|
var version$2 = ''; // empty string to avoid regexp issues
|
9801
9809
|
var versions = {};
|
9802
9810
|
var release = {};
|
9803
|
-
var config
|
9811
|
+
var config = {};
|
9804
9812
|
|
9805
9813
|
function noop$2() {}
|
9806
9814
|
|
@@ -9877,7 +9885,7 @@ var browser$1$1 = {
|
|
9877
9885
|
hrtime: hrtime,
|
9878
9886
|
platform: platform,
|
9879
9887
|
release: release,
|
9880
|
-
config: config
|
9888
|
+
config: config,
|
9881
9889
|
uptime: uptime
|
9882
9890
|
};
|
9883
9891
|
|
@@ -9958,11 +9966,11 @@ function format(f) {
|
|
9958
9966
|
// Mark that a method should not be used.
|
9959
9967
|
// Returns a modified function which warns once by default.
|
9960
9968
|
// If --no-deprecation is set, then it is a no-op.
|
9961
|
-
function deprecate$
|
9969
|
+
function deprecate$1(fn, msg) {
|
9962
9970
|
// Allow for deprecating things in the process of starting up.
|
9963
9971
|
if (isUndefined(global$1.process)) {
|
9964
9972
|
return function() {
|
9965
|
-
return deprecate$
|
9973
|
+
return deprecate$1(fn, msg).apply(this, arguments);
|
9966
9974
|
};
|
9967
9975
|
}
|
9968
9976
|
|
@@ -10571,7 +10579,7 @@ var _polyfillNode_util = {
|
|
10571
10579
|
isBoolean: isBoolean,
|
10572
10580
|
isArray: isArray,
|
10573
10581
|
inspect: inspect,
|
10574
|
-
deprecate: deprecate$
|
10582
|
+
deprecate: deprecate$1,
|
10575
10583
|
format: format,
|
10576
10584
|
debuglog: debuglog,
|
10577
10585
|
promisify: promisify,
|
@@ -10584,7 +10592,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
10584
10592
|
callbackify: callbackify,
|
10585
10593
|
debuglog: debuglog,
|
10586
10594
|
default: _polyfillNode_util,
|
10587
|
-
deprecate: deprecate$
|
10595
|
+
deprecate: deprecate$1,
|
10588
10596
|
format: format,
|
10589
10597
|
inherits: inherits$w,
|
10590
10598
|
inspect: inspect,
|
@@ -10772,99 +10780,108 @@ function requireBuffer_list () {
|
|
10772
10780
|
return buffer_list;
|
10773
10781
|
}
|
10774
10782
|
|
10775
|
-
|
10776
|
-
|
10777
|
-
|
10778
|
-
|
10779
|
-
|
10780
|
-
|
10781
|
-
|
10782
|
-
|
10783
|
-
|
10784
|
-
|
10785
|
-
|
10786
|
-
|
10787
|
-
|
10788
|
-
|
10789
|
-
|
10790
|
-
|
10791
|
-
|
10792
|
-
|
10793
|
-
|
10794
|
-
|
10783
|
+
var destroy_1;
|
10784
|
+
var hasRequiredDestroy;
|
10785
|
+
|
10786
|
+
function requireDestroy () {
|
10787
|
+
if (hasRequiredDestroy) return destroy_1;
|
10788
|
+
hasRequiredDestroy = 1;
|
10789
|
+
|
10790
|
+
// undocumented cb() API, needed for core, not for public API
|
10791
|
+
function destroy(err, cb) {
|
10792
|
+
const readableDestroyed = this._readableState && this._readableState.destroyed;
|
10793
|
+
const writableDestroyed = this._writableState && this._writableState.destroyed;
|
10794
|
+
if (readableDestroyed || writableDestroyed) {
|
10795
|
+
if (cb) {
|
10796
|
+
cb(err);
|
10797
|
+
} else if (err) {
|
10798
|
+
if (!this._writableState) {
|
10799
|
+
process.nextTick(emitErrorNT, this, err);
|
10800
|
+
} else if (!this._writableState.errorEmitted) {
|
10801
|
+
this._writableState.errorEmitted = true;
|
10802
|
+
process.nextTick(emitErrorNT, this, err);
|
10803
|
+
}
|
10804
|
+
}
|
10805
|
+
return this;
|
10806
|
+
}
|
10795
10807
|
|
10796
|
-
|
10797
|
-
|
10798
|
-
}
|
10808
|
+
// we set destroyed to true before firing error callbacks in order
|
10809
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
10799
10810
|
|
10800
|
-
|
10801
|
-
|
10802
|
-
|
10803
|
-
}
|
10804
|
-
this._destroy(err || null, err => {
|
10805
|
-
if (!cb && err) {
|
10806
|
-
if (!this._writableState) {
|
10807
|
-
process.nextTick(emitErrorAndCloseNT, this, err);
|
10808
|
-
} else if (!this._writableState.errorEmitted) {
|
10809
|
-
this._writableState.errorEmitted = true;
|
10810
|
-
process.nextTick(emitErrorAndCloseNT, this, err);
|
10811
|
-
} else {
|
10812
|
-
process.nextTick(emitCloseNT, this);
|
10813
|
-
}
|
10814
|
-
} else if (cb) {
|
10815
|
-
process.nextTick(emitCloseNT, this);
|
10816
|
-
cb(err);
|
10817
|
-
} else {
|
10818
|
-
process.nextTick(emitCloseNT, this);
|
10819
|
-
}
|
10820
|
-
});
|
10821
|
-
return this;
|
10822
|
-
}
|
10823
|
-
function emitErrorAndCloseNT(self, err) {
|
10824
|
-
emitErrorNT(self, err);
|
10825
|
-
emitCloseNT(self);
|
10826
|
-
}
|
10827
|
-
function emitCloseNT(self) {
|
10828
|
-
if (self._writableState && !self._writableState.emitClose) return;
|
10829
|
-
if (self._readableState && !self._readableState.emitClose) return;
|
10830
|
-
self.emit('close');
|
10831
|
-
}
|
10832
|
-
function undestroy() {
|
10833
|
-
if (this._readableState) {
|
10834
|
-
this._readableState.destroyed = false;
|
10835
|
-
this._readableState.reading = false;
|
10836
|
-
this._readableState.ended = false;
|
10837
|
-
this._readableState.endEmitted = false;
|
10838
|
-
}
|
10839
|
-
if (this._writableState) {
|
10840
|
-
this._writableState.destroyed = false;
|
10841
|
-
this._writableState.ended = false;
|
10842
|
-
this._writableState.ending = false;
|
10843
|
-
this._writableState.finalCalled = false;
|
10844
|
-
this._writableState.prefinished = false;
|
10845
|
-
this._writableState.finished = false;
|
10846
|
-
this._writableState.errorEmitted = false;
|
10847
|
-
}
|
10848
|
-
}
|
10849
|
-
function emitErrorNT(self, err) {
|
10850
|
-
self.emit('error', err);
|
10851
|
-
}
|
10852
|
-
function errorOrDestroy(stream, err) {
|
10853
|
-
// We have tests that rely on errors being emitted
|
10854
|
-
// in the same tick, so changing this is semver major.
|
10855
|
-
// For now when you opt-in to autoDestroy we allow
|
10856
|
-
// the error to be emitted nextTick. In a future
|
10857
|
-
// semver major update we should change the default to this.
|
10811
|
+
if (this._readableState) {
|
10812
|
+
this._readableState.destroyed = true;
|
10813
|
+
}
|
10858
10814
|
|
10859
|
-
|
10860
|
-
|
10861
|
-
|
10815
|
+
// if this is a duplex stream mark the writable part as destroyed as well
|
10816
|
+
if (this._writableState) {
|
10817
|
+
this._writableState.destroyed = true;
|
10818
|
+
}
|
10819
|
+
this._destroy(err || null, err => {
|
10820
|
+
if (!cb && err) {
|
10821
|
+
if (!this._writableState) {
|
10822
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
10823
|
+
} else if (!this._writableState.errorEmitted) {
|
10824
|
+
this._writableState.errorEmitted = true;
|
10825
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
10826
|
+
} else {
|
10827
|
+
process.nextTick(emitCloseNT, this);
|
10828
|
+
}
|
10829
|
+
} else if (cb) {
|
10830
|
+
process.nextTick(emitCloseNT, this);
|
10831
|
+
cb(err);
|
10832
|
+
} else {
|
10833
|
+
process.nextTick(emitCloseNT, this);
|
10834
|
+
}
|
10835
|
+
});
|
10836
|
+
return this;
|
10837
|
+
}
|
10838
|
+
function emitErrorAndCloseNT(self, err) {
|
10839
|
+
emitErrorNT(self, err);
|
10840
|
+
emitCloseNT(self);
|
10841
|
+
}
|
10842
|
+
function emitCloseNT(self) {
|
10843
|
+
if (self._writableState && !self._writableState.emitClose) return;
|
10844
|
+
if (self._readableState && !self._readableState.emitClose) return;
|
10845
|
+
self.emit('close');
|
10846
|
+
}
|
10847
|
+
function undestroy() {
|
10848
|
+
if (this._readableState) {
|
10849
|
+
this._readableState.destroyed = false;
|
10850
|
+
this._readableState.reading = false;
|
10851
|
+
this._readableState.ended = false;
|
10852
|
+
this._readableState.endEmitted = false;
|
10853
|
+
}
|
10854
|
+
if (this._writableState) {
|
10855
|
+
this._writableState.destroyed = false;
|
10856
|
+
this._writableState.ended = false;
|
10857
|
+
this._writableState.ending = false;
|
10858
|
+
this._writableState.finalCalled = false;
|
10859
|
+
this._writableState.prefinished = false;
|
10860
|
+
this._writableState.finished = false;
|
10861
|
+
this._writableState.errorEmitted = false;
|
10862
|
+
}
|
10863
|
+
}
|
10864
|
+
function emitErrorNT(self, err) {
|
10865
|
+
self.emit('error', err);
|
10866
|
+
}
|
10867
|
+
function errorOrDestroy(stream, err) {
|
10868
|
+
// We have tests that rely on errors being emitted
|
10869
|
+
// in the same tick, so changing this is semver major.
|
10870
|
+
// For now when you opt-in to autoDestroy we allow
|
10871
|
+
// the error to be emitted nextTick. In a future
|
10872
|
+
// semver major update we should change the default to this.
|
10873
|
+
|
10874
|
+
const rState = stream._readableState;
|
10875
|
+
const wState = stream._writableState;
|
10876
|
+
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
10877
|
+
}
|
10878
|
+
destroy_1 = {
|
10879
|
+
destroy,
|
10880
|
+
undestroy,
|
10881
|
+
errorOrDestroy
|
10882
|
+
};
|
10883
|
+
return destroy_1;
|
10862
10884
|
}
|
10863
|
-
var destroy_1 = {
|
10864
|
-
destroy,
|
10865
|
-
undestroy,
|
10866
|
-
errorOrDestroy
|
10867
|
-
};
|
10868
10885
|
|
10869
10886
|
var errorsBrowser = {};
|
10870
10887
|
|
@@ -10994,92 +11011,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
10994
11011
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
10995
11012
|
errorsBrowser.codes = codes;
|
10996
11013
|
|
10997
|
-
|
10998
|
-
|
10999
|
-
|
11000
|
-
|
11001
|
-
|
11002
|
-
|
11003
|
-
if (hwm != null) {
|
11004
|
-
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
11005
|
-
const name = isDuplex ? duplexKey : 'highWaterMark';
|
11006
|
-
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
11007
|
-
}
|
11008
|
-
return Math.floor(hwm);
|
11009
|
-
}
|
11014
|
+
var state;
|
11015
|
+
var hasRequiredState;
|
11016
|
+
|
11017
|
+
function requireState () {
|
11018
|
+
if (hasRequiredState) return state;
|
11019
|
+
hasRequiredState = 1;
|
11010
11020
|
|
11011
|
-
|
11012
|
-
|
11021
|
+
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
11022
|
+
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
11023
|
+
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
11024
|
+
}
|
11025
|
+
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
11026
|
+
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
11027
|
+
if (hwm != null) {
|
11028
|
+
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
11029
|
+
const name = isDuplex ? duplexKey : 'highWaterMark';
|
11030
|
+
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
11031
|
+
}
|
11032
|
+
return Math.floor(hwm);
|
11033
|
+
}
|
11034
|
+
|
11035
|
+
// Default value
|
11036
|
+
return state.objectMode ? 16 : 16 * 1024;
|
11037
|
+
}
|
11038
|
+
state = {
|
11039
|
+
getHighWaterMark
|
11040
|
+
};
|
11041
|
+
return state;
|
11013
11042
|
}
|
11014
|
-
var state = {
|
11015
|
-
getHighWaterMark
|
11016
|
-
};
|
11017
11043
|
|
11018
|
-
|
11019
|
-
|
11020
|
-
*/
|
11044
|
+
var browser$b;
|
11045
|
+
var hasRequiredBrowser$3;
|
11021
11046
|
|
11022
|
-
|
11047
|
+
function requireBrowser$3 () {
|
11048
|
+
if (hasRequiredBrowser$3) return browser$b;
|
11049
|
+
hasRequiredBrowser$3 = 1;
|
11050
|
+
/**
|
11051
|
+
* Module exports.
|
11052
|
+
*/
|
11023
11053
|
|
11024
|
-
|
11025
|
-
* Mark that a method should not be used.
|
11026
|
-
* Returns a modified function which warns once by default.
|
11027
|
-
*
|
11028
|
-
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
11029
|
-
*
|
11030
|
-
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
11031
|
-
* will throw an Error when invoked.
|
11032
|
-
*
|
11033
|
-
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
11034
|
-
* will invoke `console.trace()` instead of `console.error()`.
|
11035
|
-
*
|
11036
|
-
* @param {Function} fn - the function to deprecate
|
11037
|
-
* @param {String} msg - the string to print to the console when `fn` is invoked
|
11038
|
-
* @returns {Function} a new "deprecated" version of `fn`
|
11039
|
-
* @api public
|
11040
|
-
*/
|
11054
|
+
browser$b = deprecate;
|
11041
11055
|
|
11042
|
-
|
11043
|
-
|
11044
|
-
|
11045
|
-
|
11056
|
+
/**
|
11057
|
+
* Mark that a method should not be used.
|
11058
|
+
* Returns a modified function which warns once by default.
|
11059
|
+
*
|
11060
|
+
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
11061
|
+
*
|
11062
|
+
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
11063
|
+
* will throw an Error when invoked.
|
11064
|
+
*
|
11065
|
+
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
11066
|
+
* will invoke `console.trace()` instead of `console.error()`.
|
11067
|
+
*
|
11068
|
+
* @param {Function} fn - the function to deprecate
|
11069
|
+
* @param {String} msg - the string to print to the console when `fn` is invoked
|
11070
|
+
* @returns {Function} a new "deprecated" version of `fn`
|
11071
|
+
* @api public
|
11072
|
+
*/
|
11046
11073
|
|
11047
|
-
|
11048
|
-
|
11049
|
-
|
11050
|
-
|
11051
|
-
throw new Error(msg);
|
11052
|
-
} else if (config('traceDeprecation')) {
|
11053
|
-
console.trace(msg);
|
11054
|
-
} else {
|
11055
|
-
console.warn(msg);
|
11056
|
-
}
|
11057
|
-
warned = true;
|
11058
|
-
}
|
11059
|
-
return fn.apply(this, arguments);
|
11060
|
-
}
|
11074
|
+
function deprecate (fn, msg) {
|
11075
|
+
if (config('noDeprecation')) {
|
11076
|
+
return fn;
|
11077
|
+
}
|
11061
11078
|
|
11062
|
-
|
11063
|
-
|
11079
|
+
var warned = false;
|
11080
|
+
function deprecated() {
|
11081
|
+
if (!warned) {
|
11082
|
+
if (config('throwDeprecation')) {
|
11083
|
+
throw new Error(msg);
|
11084
|
+
} else if (config('traceDeprecation')) {
|
11085
|
+
console.trace(msg);
|
11086
|
+
} else {
|
11087
|
+
console.warn(msg);
|
11088
|
+
}
|
11089
|
+
warned = true;
|
11090
|
+
}
|
11091
|
+
return fn.apply(this, arguments);
|
11092
|
+
}
|
11064
11093
|
|
11065
|
-
|
11066
|
-
|
11067
|
-
*
|
11068
|
-
* @param {String} name
|
11069
|
-
* @returns {Boolean}
|
11070
|
-
* @api private
|
11071
|
-
*/
|
11094
|
+
return deprecated;
|
11095
|
+
}
|
11072
11096
|
|
11073
|
-
|
11074
|
-
|
11075
|
-
|
11076
|
-
|
11077
|
-
|
11078
|
-
|
11079
|
-
|
11080
|
-
|
11081
|
-
|
11082
|
-
|
11097
|
+
/**
|
11098
|
+
* Checks `localStorage` for boolean values for the given `name`.
|
11099
|
+
*
|
11100
|
+
* @param {String} name
|
11101
|
+
* @returns {Boolean}
|
11102
|
+
* @api private
|
11103
|
+
*/
|
11104
|
+
|
11105
|
+
function config (name) {
|
11106
|
+
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
11107
|
+
try {
|
11108
|
+
if (!commonjsGlobal.localStorage) return false;
|
11109
|
+
} catch (_) {
|
11110
|
+
return false;
|
11111
|
+
}
|
11112
|
+
var val = commonjsGlobal.localStorage[name];
|
11113
|
+
if (null == val) return false;
|
11114
|
+
return String(val).toLowerCase() === 'true';
|
11115
|
+
}
|
11116
|
+
return browser$b;
|
11083
11117
|
}
|
11084
11118
|
|
11085
11119
|
var _stream_writable;
|
@@ -11110,12 +11144,12 @@ function require_stream_writable () {
|
|
11110
11144
|
|
11111
11145
|
/*<replacement>*/
|
11112
11146
|
const internalUtil = {
|
11113
|
-
deprecate:
|
11147
|
+
deprecate: requireBrowser$3()
|
11114
11148
|
};
|
11115
11149
|
/*</replacement>*/
|
11116
11150
|
|
11117
11151
|
/*<replacement>*/
|
11118
|
-
var Stream =
|
11152
|
+
var Stream = requireStreamBrowser();
|
11119
11153
|
/*</replacement>*/
|
11120
11154
|
|
11121
11155
|
const Buffer = require$$6$1.Buffer;
|
@@ -11126,8 +11160,8 @@ function require_stream_writable () {
|
|
11126
11160
|
function _isUint8Array(obj) {
|
11127
11161
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
11128
11162
|
}
|
11129
|
-
const destroyImpl =
|
11130
|
-
const _require =
|
11163
|
+
const destroyImpl = requireDestroy();
|
11164
|
+
const _require = requireState(),
|
11131
11165
|
getHighWaterMark = _require.getHighWaterMark;
|
11132
11166
|
const _require$codes = errorsBrowser.codes,
|
11133
11167
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -12321,7 +12355,7 @@ function require_stream_readable () {
|
|
12321
12355
|
/*</replacement>*/
|
12322
12356
|
|
12323
12357
|
/*<replacement>*/
|
12324
|
-
var Stream =
|
12358
|
+
var Stream = requireStreamBrowser();
|
12325
12359
|
/*</replacement>*/
|
12326
12360
|
|
12327
12361
|
const Buffer = require$$6$1.Buffer;
|
@@ -12344,8 +12378,8 @@ function require_stream_readable () {
|
|
12344
12378
|
/*</replacement>*/
|
12345
12379
|
|
12346
12380
|
const BufferList = requireBuffer_list();
|
12347
|
-
const destroyImpl =
|
12348
|
-
const _require =
|
12381
|
+
const destroyImpl = requireDestroy();
|
12382
|
+
const _require = requireState(),
|
12349
12383
|
getHighWaterMark = _require.getHighWaterMark;
|
12350
12384
|
const _require$codes = errorsBrowser.codes,
|
12351
12385
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -15711,7 +15745,7 @@ function WriteReq(chunk, encoding, cb) {
|
|
15711
15745
|
|
15712
15746
|
function WritableState(options, stream) {
|
15713
15747
|
Object.defineProperty(this, 'buffer', {
|
15714
|
-
get: deprecate$
|
15748
|
+
get: deprecate$1(function () {
|
15715
15749
|
return this.getBuffer();
|
15716
15750
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
15717
15751
|
});
|
@@ -37423,8 +37457,8 @@ class TransactionBlockstore {
|
|
37423
37457
|
*/
|
37424
37458
|
async * entries () {
|
37425
37459
|
for (const transaction of this.inflightTransactions) {
|
37426
|
-
for (const [
|
37427
|
-
yield { cid:
|
37460
|
+
for (const [cid, bytes] of transaction.entries()) { // test for this?
|
37461
|
+
yield { cid: cid.toString(), bytes };
|
37428
37462
|
}
|
37429
37463
|
}
|
37430
37464
|
for (const [str, bytes] of this.committedBlocks) {
|
@@ -37475,7 +37509,7 @@ class TransactionBlockstore {
|
|
37475
37509
|
doCommit = async innerBlockstore => {
|
37476
37510
|
const cids = new Set();
|
37477
37511
|
for (const { cid, bytes } of innerBlockstore.entries()) {
|
37478
|
-
const stringCid = cid.toString();
|
37512
|
+
const stringCid = cid.toString();
|
37479
37513
|
if (this.committedBlocks.has(stringCid)) ; else {
|
37480
37514
|
this.committedBlocks.set(stringCid, bytes);
|
37481
37515
|
cids.add(stringCid);
|
@@ -37696,6 +37730,9 @@ const bulkFromEvents = (sorted, event) => {
|
|
37696
37730
|
const {
|
37697
37731
|
data: { type, value, key }
|
37698
37732
|
} = event;
|
37733
|
+
if (!key) {
|
37734
|
+
throw new Error('key is required')
|
37735
|
+
}
|
37699
37736
|
const bulkEvent = type === 'put' ? { key, value } : { key, del: true };
|
37700
37737
|
bulk.set(bulkEvent.key, bulkEvent); // last wins
|
37701
37738
|
}
|
@@ -39012,6 +39049,8 @@ class DbIndex {
|
|
39012
39049
|
this.mapFn = mapFn;
|
39013
39050
|
this.mapFnString = mapFn.toString();
|
39014
39051
|
}
|
39052
|
+
const matches = /=>\s*(.*)/.exec(this.mapFnString);
|
39053
|
+
this.includeDocsDefault = matches && matches.length > 0;
|
39015
39054
|
this.name = name || this.makeName();
|
39016
39055
|
}
|
39017
39056
|
|
@@ -39025,7 +39064,6 @@ class DbIndex {
|
|
39025
39064
|
return this.mapFnString
|
39026
39065
|
} else {
|
39027
39066
|
// it's a consise arrow function, match everythign after the arrow
|
39028
|
-
this.includeDocsDefault = true;
|
39029
39067
|
return matches[1]
|
39030
39068
|
}
|
39031
39069
|
}
|
@@ -41336,14 +41374,15 @@ class Sync {
|
|
41336
41374
|
const blocks = database.blocks;
|
41337
41375
|
const rootCIDs = database.clock;
|
41338
41376
|
|
41339
|
-
const
|
41377
|
+
const newCIDs = [...new Set([...rootCIDs, ...allCIDs])].filter(cid => !skip.includes(cid.toString()));
|
41378
|
+
const syncCIDs = [...new Set([...rootCIDs, ...allCIDs.filter(cid => !skip.includes(cid.toString()))])];
|
41340
41379
|
// console.log(
|
41341
41380
|
// 'makeCar',
|
41342
41381
|
// rootCIDs.map(c => c.toString()),
|
41343
41382
|
// syncCIDs.map(c => c.toString()),
|
41344
41383
|
// allCIDs.map(c => c.toString())
|
41345
41384
|
// )
|
41346
|
-
if (
|
41385
|
+
if (newCIDs.length === 0) {
|
41347
41386
|
return null
|
41348
41387
|
}
|
41349
41388
|
|