@fireproof/core 0.3.20 → 0.3.22

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