@fireproof/core 0.5.5 → 0.5.6

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.
@@ -9539,7 +9539,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
9539
9539
 
9540
9540
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
9541
9541
 
9542
- var streamBrowser = require$$0$1.EventEmitter;
9542
+ var streamBrowser;
9543
+ var hasRequiredStreamBrowser;
9544
+
9545
+ function requireStreamBrowser () {
9546
+ if (hasRequiredStreamBrowser) return streamBrowser;
9547
+ hasRequiredStreamBrowser = 1;
9548
+ streamBrowser = require$$0$1.EventEmitter;
9549
+ return streamBrowser;
9550
+ }
9543
9551
 
9544
9552
  // shim for using process in browser
9545
9553
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -9682,7 +9690,7 @@ var argv = [];
9682
9690
  var version$2 = ''; // empty string to avoid regexp issues
9683
9691
  var versions = {};
9684
9692
  var release = {};
9685
- var config$1 = {};
9693
+ var config = {};
9686
9694
 
9687
9695
  function noop$2() {}
9688
9696
 
@@ -9759,7 +9767,7 @@ var browser$1$1 = {
9759
9767
  hrtime: hrtime,
9760
9768
  platform: platform,
9761
9769
  release: release,
9762
- config: config$1,
9770
+ config: config,
9763
9771
  uptime: uptime
9764
9772
  };
9765
9773
 
@@ -9840,11 +9848,11 @@ function format(f) {
9840
9848
  // Mark that a method should not be used.
9841
9849
  // Returns a modified function which warns once by default.
9842
9850
  // If --no-deprecation is set, then it is a no-op.
9843
- function deprecate$2(fn, msg) {
9851
+ function deprecate$1(fn, msg) {
9844
9852
  // Allow for deprecating things in the process of starting up.
9845
9853
  if (isUndefined(global$1.process)) {
9846
9854
  return function() {
9847
- return deprecate$2(fn, msg).apply(this, arguments);
9855
+ return deprecate$1(fn, msg).apply(this, arguments);
9848
9856
  };
9849
9857
  }
9850
9858
 
@@ -10453,7 +10461,7 @@ var _polyfillNode_util = {
10453
10461
  isBoolean: isBoolean,
10454
10462
  isArray: isArray,
10455
10463
  inspect: inspect,
10456
- deprecate: deprecate$2,
10464
+ deprecate: deprecate$1,
10457
10465
  format: format,
10458
10466
  debuglog: debuglog,
10459
10467
  promisify: promisify,
@@ -10466,7 +10474,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
10466
10474
  callbackify: callbackify,
10467
10475
  debuglog: debuglog,
10468
10476
  default: _polyfillNode_util,
10469
- deprecate: deprecate$2,
10477
+ deprecate: deprecate$1,
10470
10478
  format: format,
10471
10479
  inherits: inherits$w,
10472
10480
  inspect: inspect,
@@ -10654,99 +10662,108 @@ function requireBuffer_list () {
10654
10662
  return buffer_list;
10655
10663
  }
10656
10664
 
10657
- // undocumented cb() API, needed for core, not for public API
10658
- function destroy(err, cb) {
10659
- const readableDestroyed = this._readableState && this._readableState.destroyed;
10660
- const writableDestroyed = this._writableState && this._writableState.destroyed;
10661
- if (readableDestroyed || writableDestroyed) {
10662
- if (cb) {
10663
- cb(err);
10664
- } else if (err) {
10665
- if (!this._writableState) {
10666
- process.nextTick(emitErrorNT, this, err);
10667
- } else if (!this._writableState.errorEmitted) {
10668
- this._writableState.errorEmitted = true;
10669
- process.nextTick(emitErrorNT, this, err);
10670
- }
10671
- }
10672
- return this;
10673
- }
10674
-
10675
- // we set destroyed to true before firing error callbacks in order
10676
- // to make it re-entrance safe in case destroy() is called within callbacks
10665
+ var destroy_1;
10666
+ var hasRequiredDestroy;
10667
+
10668
+ function requireDestroy () {
10669
+ if (hasRequiredDestroy) return destroy_1;
10670
+ hasRequiredDestroy = 1;
10671
+
10672
+ // undocumented cb() API, needed for core, not for public API
10673
+ function destroy(err, cb) {
10674
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
10675
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
10676
+ if (readableDestroyed || writableDestroyed) {
10677
+ if (cb) {
10678
+ cb(err);
10679
+ } else if (err) {
10680
+ if (!this._writableState) {
10681
+ process.nextTick(emitErrorNT, this, err);
10682
+ } else if (!this._writableState.errorEmitted) {
10683
+ this._writableState.errorEmitted = true;
10684
+ process.nextTick(emitErrorNT, this, err);
10685
+ }
10686
+ }
10687
+ return this;
10688
+ }
10677
10689
 
10678
- if (this._readableState) {
10679
- this._readableState.destroyed = true;
10680
- }
10690
+ // we set destroyed to true before firing error callbacks in order
10691
+ // to make it re-entrance safe in case destroy() is called within callbacks
10681
10692
 
10682
- // if this is a duplex stream mark the writable part as destroyed as well
10683
- if (this._writableState) {
10684
- this._writableState.destroyed = true;
10685
- }
10686
- this._destroy(err || null, err => {
10687
- if (!cb && err) {
10688
- if (!this._writableState) {
10689
- process.nextTick(emitErrorAndCloseNT, this, err);
10690
- } else if (!this._writableState.errorEmitted) {
10691
- this._writableState.errorEmitted = true;
10692
- process.nextTick(emitErrorAndCloseNT, this, err);
10693
- } else {
10694
- process.nextTick(emitCloseNT, this);
10695
- }
10696
- } else if (cb) {
10697
- process.nextTick(emitCloseNT, this);
10698
- cb(err);
10699
- } else {
10700
- process.nextTick(emitCloseNT, this);
10701
- }
10702
- });
10703
- return this;
10704
- }
10705
- function emitErrorAndCloseNT(self, err) {
10706
- emitErrorNT(self, err);
10707
- emitCloseNT(self);
10708
- }
10709
- function emitCloseNT(self) {
10710
- if (self._writableState && !self._writableState.emitClose) return;
10711
- if (self._readableState && !self._readableState.emitClose) return;
10712
- self.emit('close');
10713
- }
10714
- function undestroy() {
10715
- if (this._readableState) {
10716
- this._readableState.destroyed = false;
10717
- this._readableState.reading = false;
10718
- this._readableState.ended = false;
10719
- this._readableState.endEmitted = false;
10720
- }
10721
- if (this._writableState) {
10722
- this._writableState.destroyed = false;
10723
- this._writableState.ended = false;
10724
- this._writableState.ending = false;
10725
- this._writableState.finalCalled = false;
10726
- this._writableState.prefinished = false;
10727
- this._writableState.finished = false;
10728
- this._writableState.errorEmitted = false;
10729
- }
10730
- }
10731
- function emitErrorNT(self, err) {
10732
- self.emit('error', err);
10733
- }
10734
- function errorOrDestroy(stream, err) {
10735
- // We have tests that rely on errors being emitted
10736
- // in the same tick, so changing this is semver major.
10737
- // For now when you opt-in to autoDestroy we allow
10738
- // the error to be emitted nextTick. In a future
10739
- // semver major update we should change the default to this.
10693
+ if (this._readableState) {
10694
+ this._readableState.destroyed = true;
10695
+ }
10740
10696
 
10741
- const rState = stream._readableState;
10742
- const wState = stream._writableState;
10743
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10697
+ // if this is a duplex stream mark the writable part as destroyed as well
10698
+ if (this._writableState) {
10699
+ this._writableState.destroyed = true;
10700
+ }
10701
+ this._destroy(err || null, err => {
10702
+ if (!cb && err) {
10703
+ if (!this._writableState) {
10704
+ process.nextTick(emitErrorAndCloseNT, this, err);
10705
+ } else if (!this._writableState.errorEmitted) {
10706
+ this._writableState.errorEmitted = true;
10707
+ process.nextTick(emitErrorAndCloseNT, this, err);
10708
+ } else {
10709
+ process.nextTick(emitCloseNT, this);
10710
+ }
10711
+ } else if (cb) {
10712
+ process.nextTick(emitCloseNT, this);
10713
+ cb(err);
10714
+ } else {
10715
+ process.nextTick(emitCloseNT, this);
10716
+ }
10717
+ });
10718
+ return this;
10719
+ }
10720
+ function emitErrorAndCloseNT(self, err) {
10721
+ emitErrorNT(self, err);
10722
+ emitCloseNT(self);
10723
+ }
10724
+ function emitCloseNT(self) {
10725
+ if (self._writableState && !self._writableState.emitClose) return;
10726
+ if (self._readableState && !self._readableState.emitClose) return;
10727
+ self.emit('close');
10728
+ }
10729
+ function undestroy() {
10730
+ if (this._readableState) {
10731
+ this._readableState.destroyed = false;
10732
+ this._readableState.reading = false;
10733
+ this._readableState.ended = false;
10734
+ this._readableState.endEmitted = false;
10735
+ }
10736
+ if (this._writableState) {
10737
+ this._writableState.destroyed = false;
10738
+ this._writableState.ended = false;
10739
+ this._writableState.ending = false;
10740
+ this._writableState.finalCalled = false;
10741
+ this._writableState.prefinished = false;
10742
+ this._writableState.finished = false;
10743
+ this._writableState.errorEmitted = false;
10744
+ }
10745
+ }
10746
+ function emitErrorNT(self, err) {
10747
+ self.emit('error', err);
10748
+ }
10749
+ function errorOrDestroy(stream, err) {
10750
+ // We have tests that rely on errors being emitted
10751
+ // in the same tick, so changing this is semver major.
10752
+ // For now when you opt-in to autoDestroy we allow
10753
+ // the error to be emitted nextTick. In a future
10754
+ // semver major update we should change the default to this.
10755
+
10756
+ const rState = stream._readableState;
10757
+ const wState = stream._writableState;
10758
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10759
+ }
10760
+ destroy_1 = {
10761
+ destroy,
10762
+ undestroy,
10763
+ errorOrDestroy
10764
+ };
10765
+ return destroy_1;
10744
10766
  }
10745
- var destroy_1 = {
10746
- destroy,
10747
- undestroy,
10748
- errorOrDestroy
10749
- };
10750
10767
 
10751
10768
  var errorsBrowser = {};
10752
10769
 
@@ -10876,92 +10893,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
10876
10893
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
10877
10894
  errorsBrowser.codes = codes;
10878
10895
 
10879
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
10880
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
10881
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
10882
- }
10883
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
10884
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
10885
- if (hwm != null) {
10886
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
10887
- const name = isDuplex ? duplexKey : 'highWaterMark';
10888
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
10889
- }
10890
- return Math.floor(hwm);
10891
- }
10896
+ var state;
10897
+ var hasRequiredState;
10898
+
10899
+ function requireState () {
10900
+ if (hasRequiredState) return state;
10901
+ hasRequiredState = 1;
10902
+
10903
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
10904
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
10905
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
10906
+ }
10907
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
10908
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
10909
+ if (hwm != null) {
10910
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
10911
+ const name = isDuplex ? duplexKey : 'highWaterMark';
10912
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
10913
+ }
10914
+ return Math.floor(hwm);
10915
+ }
10892
10916
 
10893
- // Default value
10894
- return state.objectMode ? 16 : 16 * 1024;
10917
+ // Default value
10918
+ return state.objectMode ? 16 : 16 * 1024;
10919
+ }
10920
+ state = {
10921
+ getHighWaterMark
10922
+ };
10923
+ return state;
10895
10924
  }
10896
- var state = {
10897
- getHighWaterMark
10898
- };
10899
10925
 
10900
- /**
10901
- * Module exports.
10902
- */
10926
+ var browser$a;
10927
+ var hasRequiredBrowser$3;
10903
10928
 
10904
- var browser$a = deprecate$1;
10929
+ function requireBrowser$3 () {
10930
+ if (hasRequiredBrowser$3) return browser$a;
10931
+ hasRequiredBrowser$3 = 1;
10932
+ /**
10933
+ * Module exports.
10934
+ */
10905
10935
 
10906
- /**
10907
- * Mark that a method should not be used.
10908
- * Returns a modified function which warns once by default.
10909
- *
10910
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
10911
- *
10912
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
10913
- * will throw an Error when invoked.
10914
- *
10915
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
10916
- * will invoke `console.trace()` instead of `console.error()`.
10917
- *
10918
- * @param {Function} fn - the function to deprecate
10919
- * @param {String} msg - the string to print to the console when `fn` is invoked
10920
- * @returns {Function} a new "deprecated" version of `fn`
10921
- * @api public
10922
- */
10936
+ browser$a = deprecate;
10923
10937
 
10924
- function deprecate$1 (fn, msg) {
10925
- if (config('noDeprecation')) {
10926
- return fn;
10927
- }
10938
+ /**
10939
+ * Mark that a method should not be used.
10940
+ * Returns a modified function which warns once by default.
10941
+ *
10942
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
10943
+ *
10944
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
10945
+ * will throw an Error when invoked.
10946
+ *
10947
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
10948
+ * will invoke `console.trace()` instead of `console.error()`.
10949
+ *
10950
+ * @param {Function} fn - the function to deprecate
10951
+ * @param {String} msg - the string to print to the console when `fn` is invoked
10952
+ * @returns {Function} a new "deprecated" version of `fn`
10953
+ * @api public
10954
+ */
10928
10955
 
10929
- var warned = false;
10930
- function deprecated() {
10931
- if (!warned) {
10932
- if (config('throwDeprecation')) {
10933
- throw new Error(msg);
10934
- } else if (config('traceDeprecation')) {
10935
- console.trace(msg);
10936
- } else {
10937
- console.warn(msg);
10938
- }
10939
- warned = true;
10940
- }
10941
- return fn.apply(this, arguments);
10942
- }
10956
+ function deprecate (fn, msg) {
10957
+ if (config('noDeprecation')) {
10958
+ return fn;
10959
+ }
10943
10960
 
10944
- return deprecated;
10945
- }
10961
+ var warned = false;
10962
+ function deprecated() {
10963
+ if (!warned) {
10964
+ if (config('throwDeprecation')) {
10965
+ throw new Error(msg);
10966
+ } else if (config('traceDeprecation')) {
10967
+ console.trace(msg);
10968
+ } else {
10969
+ console.warn(msg);
10970
+ }
10971
+ warned = true;
10972
+ }
10973
+ return fn.apply(this, arguments);
10974
+ }
10946
10975
 
10947
- /**
10948
- * Checks `localStorage` for boolean values for the given `name`.
10949
- *
10950
- * @param {String} name
10951
- * @returns {Boolean}
10952
- * @api private
10953
- */
10976
+ return deprecated;
10977
+ }
10954
10978
 
10955
- function config (name) {
10956
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
10957
- try {
10958
- if (!commonjsGlobal.localStorage) return false;
10959
- } catch (_) {
10960
- return false;
10961
- }
10962
- var val = commonjsGlobal.localStorage[name];
10963
- if (null == val) return false;
10964
- return String(val).toLowerCase() === 'true';
10979
+ /**
10980
+ * Checks `localStorage` for boolean values for the given `name`.
10981
+ *
10982
+ * @param {String} name
10983
+ * @returns {Boolean}
10984
+ * @api private
10985
+ */
10986
+
10987
+ function config (name) {
10988
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
10989
+ try {
10990
+ if (!commonjsGlobal.localStorage) return false;
10991
+ } catch (_) {
10992
+ return false;
10993
+ }
10994
+ var val = commonjsGlobal.localStorage[name];
10995
+ if (null == val) return false;
10996
+ return String(val).toLowerCase() === 'true';
10997
+ }
10998
+ return browser$a;
10965
10999
  }
10966
11000
 
10967
11001
  var _stream_writable;
@@ -10992,12 +11026,12 @@ function require_stream_writable () {
10992
11026
 
10993
11027
  /*<replacement>*/
10994
11028
  const internalUtil = {
10995
- deprecate: browser$a
11029
+ deprecate: requireBrowser$3()
10996
11030
  };
10997
11031
  /*</replacement>*/
10998
11032
 
10999
11033
  /*<replacement>*/
11000
- var Stream = streamBrowser;
11034
+ var Stream = requireStreamBrowser();
11001
11035
  /*</replacement>*/
11002
11036
 
11003
11037
  const Buffer = require$$0$2.Buffer;
@@ -11008,8 +11042,8 @@ function require_stream_writable () {
11008
11042
  function _isUint8Array(obj) {
11009
11043
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
11010
11044
  }
11011
- const destroyImpl = destroy_1;
11012
- const _require = state,
11045
+ const destroyImpl = requireDestroy();
11046
+ const _require = requireState(),
11013
11047
  getHighWaterMark = _require.getHighWaterMark;
11014
11048
  const _require$codes = errorsBrowser.codes,
11015
11049
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -12203,7 +12237,7 @@ function require_stream_readable () {
12203
12237
  /*</replacement>*/
12204
12238
 
12205
12239
  /*<replacement>*/
12206
- var Stream = streamBrowser;
12240
+ var Stream = requireStreamBrowser();
12207
12241
  /*</replacement>*/
12208
12242
 
12209
12243
  const Buffer = require$$0$2.Buffer;
@@ -12226,8 +12260,8 @@ function require_stream_readable () {
12226
12260
  /*</replacement>*/
12227
12261
 
12228
12262
  const BufferList = requireBuffer_list();
12229
- const destroyImpl = destroy_1;
12230
- const _require = state,
12263
+ const destroyImpl = requireDestroy();
12264
+ const _require = requireState(),
12231
12265
  getHighWaterMark = _require.getHighWaterMark;
12232
12266
  const _require$codes = errorsBrowser.codes,
12233
12267
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -15593,7 +15627,7 @@ function WriteReq(chunk, encoding, cb) {
15593
15627
 
15594
15628
  function WritableState(options, stream) {
15595
15629
  Object.defineProperty(this, 'buffer', {
15596
- get: deprecate$2(function () {
15630
+ get: deprecate$1(function () {
15597
15631
  return this.getBuffer();
15598
15632
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
15599
15633
  });
@@ -38935,7 +38969,7 @@ class Fireproof {
38935
38969
  clock: {
38936
38970
  byId: byId ? parseCID(byId) : null,
38937
38971
  byKey: byKey ? parseCID(byKey) : null,
38938
- db: db ? db.map(c => parseCID(c)) : null
38972
+ db: (db && db.length > 0) ? db.map(c => parseCID(c)) : null
38939
38973
  },
38940
38974
  code,
38941
38975
  name