@fireproof/core 0.8.0-dev.2 → 0.8.0-dev.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9333,7 +9333,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
9333
9333
 
9334
9334
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
9335
9335
 
9336
- var streamBrowser = require$$0$1.EventEmitter;
9336
+ var streamBrowser;
9337
+ var hasRequiredStreamBrowser;
9338
+
9339
+ function requireStreamBrowser () {
9340
+ if (hasRequiredStreamBrowser) return streamBrowser;
9341
+ hasRequiredStreamBrowser = 1;
9342
+ streamBrowser = require$$0$1.EventEmitter;
9343
+ return streamBrowser;
9344
+ }
9337
9345
 
9338
9346
  // shim for using process in browser
9339
9347
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -9476,7 +9484,7 @@ var argv = [];
9476
9484
  var version$1 = ''; // empty string to avoid regexp issues
9477
9485
  var versions = {};
9478
9486
  var release = {};
9479
- var config$2 = {};
9487
+ var config$1 = {};
9480
9488
 
9481
9489
  function noop$3() {}
9482
9490
 
@@ -9553,7 +9561,7 @@ var browser$1$1 = {
9553
9561
  hrtime: hrtime,
9554
9562
  platform: platform,
9555
9563
  release: release,
9556
- config: config$2,
9564
+ config: config$1,
9557
9565
  uptime: uptime
9558
9566
  };
9559
9567
 
@@ -9634,11 +9642,11 @@ function format$6(f) {
9634
9642
  // Mark that a method should not be used.
9635
9643
  // Returns a modified function which warns once by default.
9636
9644
  // If --no-deprecation is set, then it is a no-op.
9637
- function deprecate$1(fn, msg) {
9645
+ function deprecate(fn, msg) {
9638
9646
  // Allow for deprecating things in the process of starting up.
9639
9647
  if (isUndefined(global$1.process)) {
9640
9648
  return function() {
9641
- return deprecate$1(fn, msg).apply(this, arguments);
9649
+ return deprecate(fn, msg).apply(this, arguments);
9642
9650
  };
9643
9651
  }
9644
9652
 
@@ -10247,7 +10255,7 @@ var _polyfillNode_util = {
10247
10255
  isBoolean: isBoolean,
10248
10256
  isArray: isArray,
10249
10257
  inspect: inspect,
10250
- deprecate: deprecate$1,
10258
+ deprecate: deprecate,
10251
10259
  format: format$6,
10252
10260
  debuglog: debuglog,
10253
10261
  promisify: promisify,
@@ -10260,7 +10268,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
10260
10268
  callbackify: callbackify,
10261
10269
  debuglog: debuglog,
10262
10270
  default: _polyfillNode_util,
10263
- deprecate: deprecate$1,
10271
+ deprecate: deprecate,
10264
10272
  format: format$6,
10265
10273
  inherits: inherits$1,
10266
10274
  inspect: inspect,
@@ -10448,99 +10456,108 @@ function requireBuffer_list () {
10448
10456
  return buffer_list;
10449
10457
  }
10450
10458
 
10451
- // undocumented cb() API, needed for core, not for public API
10452
- function destroy(err, cb) {
10453
- const readableDestroyed = this._readableState && this._readableState.destroyed;
10454
- const writableDestroyed = this._writableState && this._writableState.destroyed;
10455
- if (readableDestroyed || writableDestroyed) {
10456
- if (cb) {
10457
- cb(err);
10458
- } else if (err) {
10459
- if (!this._writableState) {
10460
- process.nextTick(emitErrorNT, this, err);
10461
- } else if (!this._writableState.errorEmitted) {
10462
- this._writableState.errorEmitted = true;
10463
- process.nextTick(emitErrorNT, this, err);
10464
- }
10465
- }
10466
- return this;
10467
- }
10459
+ var destroy_1;
10460
+ var hasRequiredDestroy;
10468
10461
 
10469
- // we set destroyed to true before firing error callbacks in order
10470
- // to make it re-entrance safe in case destroy() is called within callbacks
10462
+ function requireDestroy () {
10463
+ if (hasRequiredDestroy) return destroy_1;
10464
+ hasRequiredDestroy = 1;
10471
10465
 
10472
- if (this._readableState) {
10473
- this._readableState.destroyed = true;
10474
- }
10466
+ // undocumented cb() API, needed for core, not for public API
10467
+ function destroy(err, cb) {
10468
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
10469
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
10470
+ if (readableDestroyed || writableDestroyed) {
10471
+ if (cb) {
10472
+ cb(err);
10473
+ } else if (err) {
10474
+ if (!this._writableState) {
10475
+ process.nextTick(emitErrorNT, this, err);
10476
+ } else if (!this._writableState.errorEmitted) {
10477
+ this._writableState.errorEmitted = true;
10478
+ process.nextTick(emitErrorNT, this, err);
10479
+ }
10480
+ }
10481
+ return this;
10482
+ }
10475
10483
 
10476
- // if this is a duplex stream mark the writable part as destroyed as well
10477
- if (this._writableState) {
10478
- this._writableState.destroyed = true;
10479
- }
10480
- this._destroy(err || null, err => {
10481
- if (!cb && err) {
10482
- if (!this._writableState) {
10483
- process.nextTick(emitErrorAndCloseNT, this, err);
10484
- } else if (!this._writableState.errorEmitted) {
10485
- this._writableState.errorEmitted = true;
10486
- process.nextTick(emitErrorAndCloseNT, this, err);
10487
- } else {
10488
- process.nextTick(emitCloseNT, this);
10489
- }
10490
- } else if (cb) {
10491
- process.nextTick(emitCloseNT, this);
10492
- cb(err);
10493
- } else {
10494
- process.nextTick(emitCloseNT, this);
10495
- }
10496
- });
10497
- return this;
10498
- }
10499
- function emitErrorAndCloseNT(self, err) {
10500
- emitErrorNT(self, err);
10501
- emitCloseNT(self);
10502
- }
10503
- function emitCloseNT(self) {
10504
- if (self._writableState && !self._writableState.emitClose) return;
10505
- if (self._readableState && !self._readableState.emitClose) return;
10506
- self.emit('close');
10507
- }
10508
- function undestroy() {
10509
- if (this._readableState) {
10510
- this._readableState.destroyed = false;
10511
- this._readableState.reading = false;
10512
- this._readableState.ended = false;
10513
- this._readableState.endEmitted = false;
10514
- }
10515
- if (this._writableState) {
10516
- this._writableState.destroyed = false;
10517
- this._writableState.ended = false;
10518
- this._writableState.ending = false;
10519
- this._writableState.finalCalled = false;
10520
- this._writableState.prefinished = false;
10521
- this._writableState.finished = false;
10522
- this._writableState.errorEmitted = false;
10523
- }
10524
- }
10525
- function emitErrorNT(self, err) {
10526
- self.emit('error', err);
10527
- }
10528
- function errorOrDestroy(stream, err) {
10529
- // We have tests that rely on errors being emitted
10530
- // in the same tick, so changing this is semver major.
10531
- // For now when you opt-in to autoDestroy we allow
10532
- // the error to be emitted nextTick. In a future
10533
- // semver major update we should change the default to this.
10484
+ // we set destroyed to true before firing error callbacks in order
10485
+ // to make it re-entrance safe in case destroy() is called within callbacks
10534
10486
 
10535
- const rState = stream._readableState;
10536
- const wState = stream._writableState;
10537
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10487
+ if (this._readableState) {
10488
+ this._readableState.destroyed = true;
10489
+ }
10490
+
10491
+ // if this is a duplex stream mark the writable part as destroyed as well
10492
+ if (this._writableState) {
10493
+ this._writableState.destroyed = true;
10494
+ }
10495
+ this._destroy(err || null, err => {
10496
+ if (!cb && err) {
10497
+ if (!this._writableState) {
10498
+ process.nextTick(emitErrorAndCloseNT, this, err);
10499
+ } else if (!this._writableState.errorEmitted) {
10500
+ this._writableState.errorEmitted = true;
10501
+ process.nextTick(emitErrorAndCloseNT, this, err);
10502
+ } else {
10503
+ process.nextTick(emitCloseNT, this);
10504
+ }
10505
+ } else if (cb) {
10506
+ process.nextTick(emitCloseNT, this);
10507
+ cb(err);
10508
+ } else {
10509
+ process.nextTick(emitCloseNT, this);
10510
+ }
10511
+ });
10512
+ return this;
10513
+ }
10514
+ function emitErrorAndCloseNT(self, err) {
10515
+ emitErrorNT(self, err);
10516
+ emitCloseNT(self);
10517
+ }
10518
+ function emitCloseNT(self) {
10519
+ if (self._writableState && !self._writableState.emitClose) return;
10520
+ if (self._readableState && !self._readableState.emitClose) return;
10521
+ self.emit('close');
10522
+ }
10523
+ function undestroy() {
10524
+ if (this._readableState) {
10525
+ this._readableState.destroyed = false;
10526
+ this._readableState.reading = false;
10527
+ this._readableState.ended = false;
10528
+ this._readableState.endEmitted = false;
10529
+ }
10530
+ if (this._writableState) {
10531
+ this._writableState.destroyed = false;
10532
+ this._writableState.ended = false;
10533
+ this._writableState.ending = false;
10534
+ this._writableState.finalCalled = false;
10535
+ this._writableState.prefinished = false;
10536
+ this._writableState.finished = false;
10537
+ this._writableState.errorEmitted = false;
10538
+ }
10539
+ }
10540
+ function emitErrorNT(self, err) {
10541
+ self.emit('error', err);
10542
+ }
10543
+ function errorOrDestroy(stream, err) {
10544
+ // We have tests that rely on errors being emitted
10545
+ // in the same tick, so changing this is semver major.
10546
+ // For now when you opt-in to autoDestroy we allow
10547
+ // the error to be emitted nextTick. In a future
10548
+ // semver major update we should change the default to this.
10549
+
10550
+ const rState = stream._readableState;
10551
+ const wState = stream._writableState;
10552
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
10553
+ }
10554
+ destroy_1 = {
10555
+ destroy,
10556
+ undestroy,
10557
+ errorOrDestroy
10558
+ };
10559
+ return destroy_1;
10538
10560
  }
10539
- var destroy_1 = {
10540
- destroy,
10541
- undestroy,
10542
- errorOrDestroy
10543
- };
10544
10561
 
10545
10562
  var errorsBrowser = {};
10546
10563
 
@@ -10670,92 +10687,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
10670
10687
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
10671
10688
  errorsBrowser.codes = codes;
10672
10689
 
10673
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
10674
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
10675
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
10676
- }
10677
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
10678
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
10679
- if (hwm != null) {
10680
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
10681
- const name = isDuplex ? duplexKey : 'highWaterMark';
10682
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
10683
- }
10684
- return Math.floor(hwm);
10685
- }
10690
+ var state;
10691
+ var hasRequiredState;
10692
+
10693
+ function requireState () {
10694
+ if (hasRequiredState) return state;
10695
+ hasRequiredState = 1;
10686
10696
 
10687
- // Default value
10688
- return state.objectMode ? 16 : 16 * 1024;
10697
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
10698
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
10699
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
10700
+ }
10701
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
10702
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
10703
+ if (hwm != null) {
10704
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
10705
+ const name = isDuplex ? duplexKey : 'highWaterMark';
10706
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
10707
+ }
10708
+ return Math.floor(hwm);
10709
+ }
10710
+
10711
+ // Default value
10712
+ return state.objectMode ? 16 : 16 * 1024;
10713
+ }
10714
+ state = {
10715
+ getHighWaterMark
10716
+ };
10717
+ return state;
10689
10718
  }
10690
- var state = {
10691
- getHighWaterMark
10692
- };
10693
10719
 
10694
- /**
10695
- * Module exports.
10696
- */
10720
+ var browser$c;
10721
+ var hasRequiredBrowser$b;
10697
10722
 
10698
- var browser$c = deprecate;
10723
+ function requireBrowser$b () {
10724
+ if (hasRequiredBrowser$b) return browser$c;
10725
+ hasRequiredBrowser$b = 1;
10726
+ /**
10727
+ * Module exports.
10728
+ */
10699
10729
 
10700
- /**
10701
- * Mark that a method should not be used.
10702
- * Returns a modified function which warns once by default.
10703
- *
10704
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
10705
- *
10706
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
10707
- * will throw an Error when invoked.
10708
- *
10709
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
10710
- * will invoke `console.trace()` instead of `console.error()`.
10711
- *
10712
- * @param {Function} fn - the function to deprecate
10713
- * @param {String} msg - the string to print to the console when `fn` is invoked
10714
- * @returns {Function} a new "deprecated" version of `fn`
10715
- * @api public
10716
- */
10730
+ browser$c = deprecate;
10717
10731
 
10718
- function deprecate (fn, msg) {
10719
- if (config$1('noDeprecation')) {
10720
- return fn;
10721
- }
10732
+ /**
10733
+ * Mark that a method should not be used.
10734
+ * Returns a modified function which warns once by default.
10735
+ *
10736
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
10737
+ *
10738
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
10739
+ * will throw an Error when invoked.
10740
+ *
10741
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
10742
+ * will invoke `console.trace()` instead of `console.error()`.
10743
+ *
10744
+ * @param {Function} fn - the function to deprecate
10745
+ * @param {String} msg - the string to print to the console when `fn` is invoked
10746
+ * @returns {Function} a new "deprecated" version of `fn`
10747
+ * @api public
10748
+ */
10722
10749
 
10723
- var warned = false;
10724
- function deprecated() {
10725
- if (!warned) {
10726
- if (config$1('throwDeprecation')) {
10727
- throw new Error(msg);
10728
- } else if (config$1('traceDeprecation')) {
10729
- console.trace(msg);
10730
- } else {
10731
- console.warn(msg);
10732
- }
10733
- warned = true;
10734
- }
10735
- return fn.apply(this, arguments);
10736
- }
10750
+ function deprecate (fn, msg) {
10751
+ if (config('noDeprecation')) {
10752
+ return fn;
10753
+ }
10737
10754
 
10738
- return deprecated;
10739
- }
10755
+ var warned = false;
10756
+ function deprecated() {
10757
+ if (!warned) {
10758
+ if (config('throwDeprecation')) {
10759
+ throw new Error(msg);
10760
+ } else if (config('traceDeprecation')) {
10761
+ console.trace(msg);
10762
+ } else {
10763
+ console.warn(msg);
10764
+ }
10765
+ warned = true;
10766
+ }
10767
+ return fn.apply(this, arguments);
10768
+ }
10740
10769
 
10741
- /**
10742
- * Checks `localStorage` for boolean values for the given `name`.
10743
- *
10744
- * @param {String} name
10745
- * @returns {Boolean}
10746
- * @api private
10747
- */
10770
+ return deprecated;
10771
+ }
10748
10772
 
10749
- function config$1 (name) {
10750
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
10751
- try {
10752
- if (!commonjsGlobal.localStorage) return false;
10753
- } catch (_) {
10754
- return false;
10755
- }
10756
- var val = commonjsGlobal.localStorage[name];
10757
- if (null == val) return false;
10758
- return String(val).toLowerCase() === 'true';
10773
+ /**
10774
+ * Checks `localStorage` for boolean values for the given `name`.
10775
+ *
10776
+ * @param {String} name
10777
+ * @returns {Boolean}
10778
+ * @api private
10779
+ */
10780
+
10781
+ function config (name) {
10782
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
10783
+ try {
10784
+ if (!commonjsGlobal.localStorage) return false;
10785
+ } catch (_) {
10786
+ return false;
10787
+ }
10788
+ var val = commonjsGlobal.localStorage[name];
10789
+ if (null == val) return false;
10790
+ return String(val).toLowerCase() === 'true';
10791
+ }
10792
+ return browser$c;
10759
10793
  }
10760
10794
 
10761
10795
  var _stream_writable;
@@ -10786,12 +10820,12 @@ function require_stream_writable () {
10786
10820
 
10787
10821
  /*<replacement>*/
10788
10822
  const internalUtil = {
10789
- deprecate: browser$c
10823
+ deprecate: requireBrowser$b()
10790
10824
  };
10791
10825
  /*</replacement>*/
10792
10826
 
10793
10827
  /*<replacement>*/
10794
- var Stream = streamBrowser;
10828
+ var Stream = requireStreamBrowser();
10795
10829
  /*</replacement>*/
10796
10830
 
10797
10831
  const Buffer = require$$6$1.Buffer;
@@ -10802,8 +10836,8 @@ function require_stream_writable () {
10802
10836
  function _isUint8Array(obj) {
10803
10837
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
10804
10838
  }
10805
- const destroyImpl = destroy_1;
10806
- const _require = state,
10839
+ const destroyImpl = requireDestroy();
10840
+ const _require = requireState(),
10807
10841
  getHighWaterMark = _require.getHighWaterMark;
10808
10842
  const _require$codes = errorsBrowser.codes,
10809
10843
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -11997,7 +12031,7 @@ function require_stream_readable () {
11997
12031
  /*</replacement>*/
11998
12032
 
11999
12033
  /*<replacement>*/
12000
- var Stream = streamBrowser;
12034
+ var Stream = requireStreamBrowser();
12001
12035
  /*</replacement>*/
12002
12036
 
12003
12037
  const Buffer = require$$6$1.Buffer;
@@ -12020,8 +12054,8 @@ function require_stream_readable () {
12020
12054
  /*</replacement>*/
12021
12055
 
12022
12056
  const BufferList = requireBuffer_list();
12023
- const destroyImpl = destroy_1;
12024
- const _require = state,
12057
+ const destroyImpl = requireDestroy();
12058
+ const _require = requireState(),
12025
12059
  getHighWaterMark = _require.getHighWaterMark;
12026
12060
  const _require$codes = errorsBrowser.codes,
12027
12061
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -15474,7 +15508,7 @@ function WriteReq(chunk, encoding, cb) {
15474
15508
 
15475
15509
  function WritableState(options, stream) {
15476
15510
  Object.defineProperty(this, 'buffer', {
15477
- get: deprecate$1(function () {
15511
+ get: deprecate(function () {
15478
15512
  return this.getBuffer();
15479
15513
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
15480
15514
  });
@@ -37259,7 +37293,7 @@ let Base$1 = class Base {
37259
37293
  header.key && this.setKeyMaterial(header.key);
37260
37294
  // this.setCarCidMapCarCid(header.car) // instead we should just extract the list of cars from the car
37261
37295
  const carHeader = await this.readHeaderCar(header.car);
37262
- this.carLog = carHeader.cars;
37296
+ this.carLog = carHeader.cars || [];
37263
37297
  // console.log('stored carHeader', this.name, this.config.type, this.carLog)
37264
37298
 
37265
37299
  // this.lastCar = header.car // ?