@fireproof/core 0.7.2-dev.5 → 0.7.2-dev.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.
@@ -8200,15 +8200,7 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
8200
8200
 
8201
8201
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
8202
8202
 
8203
- var streamBrowser;
8204
- var hasRequiredStreamBrowser;
8205
-
8206
- function requireStreamBrowser () {
8207
- if (hasRequiredStreamBrowser) return streamBrowser;
8208
- hasRequiredStreamBrowser = 1;
8209
- streamBrowser = require$$0$1.EventEmitter;
8210
- return streamBrowser;
8211
- }
8203
+ var streamBrowser = require$$0$1.EventEmitter;
8212
8204
 
8213
8205
  // shim for using process in browser
8214
8206
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -8351,7 +8343,7 @@ var argv = [];
8351
8343
  var version$1 = ''; // empty string to avoid regexp issues
8352
8344
  var versions = {};
8353
8345
  var release = {};
8354
- var config = {};
8346
+ var config$1 = {};
8355
8347
 
8356
8348
  function noop$3() {}
8357
8349
 
@@ -8428,7 +8420,7 @@ var browser$1$1 = {
8428
8420
  hrtime: hrtime,
8429
8421
  platform: platform,
8430
8422
  release: release,
8431
- config: config,
8423
+ config: config$1,
8432
8424
  uptime: uptime
8433
8425
  };
8434
8426
 
@@ -8509,11 +8501,11 @@ function format(f) {
8509
8501
  // Mark that a method should not be used.
8510
8502
  // Returns a modified function which warns once by default.
8511
8503
  // If --no-deprecation is set, then it is a no-op.
8512
- function deprecate(fn, msg) {
8504
+ function deprecate$1(fn, msg) {
8513
8505
  // Allow for deprecating things in the process of starting up.
8514
8506
  if (isUndefined(global$1.process)) {
8515
8507
  return function() {
8516
- return deprecate(fn, msg).apply(this, arguments);
8508
+ return deprecate$1(fn, msg).apply(this, arguments);
8517
8509
  };
8518
8510
  }
8519
8511
 
@@ -9122,7 +9114,7 @@ var _polyfillNode_util = {
9122
9114
  isBoolean: isBoolean,
9123
9115
  isArray: isArray,
9124
9116
  inspect: inspect,
9125
- deprecate: deprecate,
9117
+ deprecate: deprecate$1,
9126
9118
  format: format,
9127
9119
  debuglog: debuglog,
9128
9120
  promisify: promisify,
@@ -9135,7 +9127,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
9135
9127
  callbackify: callbackify,
9136
9128
  debuglog: debuglog,
9137
9129
  default: _polyfillNode_util,
9138
- deprecate: deprecate,
9130
+ deprecate: deprecate$1,
9139
9131
  format: format,
9140
9132
  inherits: inherits$1,
9141
9133
  inspect: inspect,
@@ -9323,108 +9315,99 @@ function requireBuffer_list () {
9323
9315
  return buffer_list;
9324
9316
  }
9325
9317
 
9326
- var destroy_1;
9327
- var hasRequiredDestroy;
9328
-
9329
- function requireDestroy () {
9330
- if (hasRequiredDestroy) return destroy_1;
9331
- hasRequiredDestroy = 1;
9332
-
9333
- // undocumented cb() API, needed for core, not for public API
9334
- function destroy(err, cb) {
9335
- const readableDestroyed = this._readableState && this._readableState.destroyed;
9336
- const writableDestroyed = this._writableState && this._writableState.destroyed;
9337
- if (readableDestroyed || writableDestroyed) {
9338
- if (cb) {
9339
- cb(err);
9340
- } else if (err) {
9341
- if (!this._writableState) {
9342
- process.nextTick(emitErrorNT, this, err);
9343
- } else if (!this._writableState.errorEmitted) {
9344
- this._writableState.errorEmitted = true;
9345
- process.nextTick(emitErrorNT, this, err);
9346
- }
9347
- }
9348
- return this;
9349
- }
9318
+ // undocumented cb() API, needed for core, not for public API
9319
+ function destroy(err, cb) {
9320
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
9321
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
9322
+ if (readableDestroyed || writableDestroyed) {
9323
+ if (cb) {
9324
+ cb(err);
9325
+ } else if (err) {
9326
+ if (!this._writableState) {
9327
+ process.nextTick(emitErrorNT, this, err);
9328
+ } else if (!this._writableState.errorEmitted) {
9329
+ this._writableState.errorEmitted = true;
9330
+ process.nextTick(emitErrorNT, this, err);
9331
+ }
9332
+ }
9333
+ return this;
9334
+ }
9350
9335
 
9351
- // we set destroyed to true before firing error callbacks in order
9352
- // to make it re-entrance safe in case destroy() is called within callbacks
9336
+ // we set destroyed to true before firing error callbacks in order
9337
+ // to make it re-entrance safe in case destroy() is called within callbacks
9353
9338
 
9354
- if (this._readableState) {
9355
- this._readableState.destroyed = true;
9356
- }
9339
+ if (this._readableState) {
9340
+ this._readableState.destroyed = true;
9341
+ }
9357
9342
 
9358
- // if this is a duplex stream mark the writable part as destroyed as well
9359
- if (this._writableState) {
9360
- this._writableState.destroyed = true;
9361
- }
9362
- this._destroy(err || null, err => {
9363
- if (!cb && err) {
9364
- if (!this._writableState) {
9365
- process.nextTick(emitErrorAndCloseNT, this, err);
9366
- } else if (!this._writableState.errorEmitted) {
9367
- this._writableState.errorEmitted = true;
9368
- process.nextTick(emitErrorAndCloseNT, this, err);
9369
- } else {
9370
- process.nextTick(emitCloseNT, this);
9371
- }
9372
- } else if (cb) {
9373
- process.nextTick(emitCloseNT, this);
9374
- cb(err);
9375
- } else {
9376
- process.nextTick(emitCloseNT, this);
9377
- }
9378
- });
9379
- return this;
9380
- }
9381
- function emitErrorAndCloseNT(self, err) {
9382
- emitErrorNT(self, err);
9383
- emitCloseNT(self);
9384
- }
9385
- function emitCloseNT(self) {
9386
- if (self._writableState && !self._writableState.emitClose) return;
9387
- if (self._readableState && !self._readableState.emitClose) return;
9388
- self.emit('close');
9389
- }
9390
- function undestroy() {
9391
- if (this._readableState) {
9392
- this._readableState.destroyed = false;
9393
- this._readableState.reading = false;
9394
- this._readableState.ended = false;
9395
- this._readableState.endEmitted = false;
9396
- }
9397
- if (this._writableState) {
9398
- this._writableState.destroyed = false;
9399
- this._writableState.ended = false;
9400
- this._writableState.ending = false;
9401
- this._writableState.finalCalled = false;
9402
- this._writableState.prefinished = false;
9403
- this._writableState.finished = false;
9404
- this._writableState.errorEmitted = false;
9405
- }
9406
- }
9407
- function emitErrorNT(self, err) {
9408
- self.emit('error', err);
9409
- }
9410
- function errorOrDestroy(stream, err) {
9411
- // We have tests that rely on errors being emitted
9412
- // in the same tick, so changing this is semver major.
9413
- // For now when you opt-in to autoDestroy we allow
9414
- // the error to be emitted nextTick. In a future
9415
- // semver major update we should change the default to this.
9343
+ // if this is a duplex stream mark the writable part as destroyed as well
9344
+ if (this._writableState) {
9345
+ this._writableState.destroyed = true;
9346
+ }
9347
+ this._destroy(err || null, err => {
9348
+ if (!cb && err) {
9349
+ if (!this._writableState) {
9350
+ process.nextTick(emitErrorAndCloseNT, this, err);
9351
+ } else if (!this._writableState.errorEmitted) {
9352
+ this._writableState.errorEmitted = true;
9353
+ process.nextTick(emitErrorAndCloseNT, this, err);
9354
+ } else {
9355
+ process.nextTick(emitCloseNT, this);
9356
+ }
9357
+ } else if (cb) {
9358
+ process.nextTick(emitCloseNT, this);
9359
+ cb(err);
9360
+ } else {
9361
+ process.nextTick(emitCloseNT, this);
9362
+ }
9363
+ });
9364
+ return this;
9365
+ }
9366
+ function emitErrorAndCloseNT(self, err) {
9367
+ emitErrorNT(self, err);
9368
+ emitCloseNT(self);
9369
+ }
9370
+ function emitCloseNT(self) {
9371
+ if (self._writableState && !self._writableState.emitClose) return;
9372
+ if (self._readableState && !self._readableState.emitClose) return;
9373
+ self.emit('close');
9374
+ }
9375
+ function undestroy() {
9376
+ if (this._readableState) {
9377
+ this._readableState.destroyed = false;
9378
+ this._readableState.reading = false;
9379
+ this._readableState.ended = false;
9380
+ this._readableState.endEmitted = false;
9381
+ }
9382
+ if (this._writableState) {
9383
+ this._writableState.destroyed = false;
9384
+ this._writableState.ended = false;
9385
+ this._writableState.ending = false;
9386
+ this._writableState.finalCalled = false;
9387
+ this._writableState.prefinished = false;
9388
+ this._writableState.finished = false;
9389
+ this._writableState.errorEmitted = false;
9390
+ }
9391
+ }
9392
+ function emitErrorNT(self, err) {
9393
+ self.emit('error', err);
9394
+ }
9395
+ function errorOrDestroy(stream, err) {
9396
+ // We have tests that rely on errors being emitted
9397
+ // in the same tick, so changing this is semver major.
9398
+ // For now when you opt-in to autoDestroy we allow
9399
+ // the error to be emitted nextTick. In a future
9400
+ // semver major update we should change the default to this.
9416
9401
 
9417
- const rState = stream._readableState;
9418
- const wState = stream._writableState;
9419
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
9420
- }
9421
- destroy_1 = {
9422
- destroy,
9423
- undestroy,
9424
- errorOrDestroy
9425
- };
9426
- return destroy_1;
9402
+ const rState = stream._readableState;
9403
+ const wState = stream._writableState;
9404
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
9427
9405
  }
9406
+ var destroy_1 = {
9407
+ destroy,
9408
+ undestroy,
9409
+ errorOrDestroy
9410
+ };
9428
9411
 
9429
9412
  var errorsBrowser = {};
9430
9413
 
@@ -9554,109 +9537,92 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
9554
9537
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
9555
9538
  errorsBrowser.codes = codes;
9556
9539
 
9557
- var state;
9558
- var hasRequiredState;
9559
-
9560
- function requireState () {
9561
- if (hasRequiredState) return state;
9562
- hasRequiredState = 1;
9563
-
9564
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
9565
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
9566
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
9567
- }
9568
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
9569
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
9570
- if (hwm != null) {
9571
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
9572
- const name = isDuplex ? duplexKey : 'highWaterMark';
9573
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
9574
- }
9575
- return Math.floor(hwm);
9576
- }
9577
-
9578
- // Default value
9579
- return state.objectMode ? 16 : 16 * 1024;
9580
- }
9581
- state = {
9582
- getHighWaterMark
9583
- };
9584
- return state;
9540
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
9541
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
9542
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
9585
9543
  }
9544
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
9545
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
9546
+ if (hwm != null) {
9547
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
9548
+ const name = isDuplex ? duplexKey : 'highWaterMark';
9549
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
9550
+ }
9551
+ return Math.floor(hwm);
9552
+ }
9586
9553
 
9587
- var browser$b;
9588
- var hasRequiredBrowser$a;
9554
+ // Default value
9555
+ return state.objectMode ? 16 : 16 * 1024;
9556
+ }
9557
+ var state = {
9558
+ getHighWaterMark
9559
+ };
9589
9560
 
9590
- function requireBrowser$a () {
9591
- if (hasRequiredBrowser$a) return browser$b;
9592
- hasRequiredBrowser$a = 1;
9593
- /**
9594
- * Module exports.
9595
- */
9561
+ /**
9562
+ * Module exports.
9563
+ */
9596
9564
 
9597
- browser$b = deprecate;
9565
+ var browser$b = deprecate;
9598
9566
 
9599
- /**
9600
- * Mark that a method should not be used.
9601
- * Returns a modified function which warns once by default.
9602
- *
9603
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
9604
- *
9605
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
9606
- * will throw an Error when invoked.
9607
- *
9608
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
9609
- * will invoke `console.trace()` instead of `console.error()`.
9610
- *
9611
- * @param {Function} fn - the function to deprecate
9612
- * @param {String} msg - the string to print to the console when `fn` is invoked
9613
- * @returns {Function} a new "deprecated" version of `fn`
9614
- * @api public
9615
- */
9567
+ /**
9568
+ * Mark that a method should not be used.
9569
+ * Returns a modified function which warns once by default.
9570
+ *
9571
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
9572
+ *
9573
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
9574
+ * will throw an Error when invoked.
9575
+ *
9576
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
9577
+ * will invoke `console.trace()` instead of `console.error()`.
9578
+ *
9579
+ * @param {Function} fn - the function to deprecate
9580
+ * @param {String} msg - the string to print to the console when `fn` is invoked
9581
+ * @returns {Function} a new "deprecated" version of `fn`
9582
+ * @api public
9583
+ */
9616
9584
 
9617
- function deprecate (fn, msg) {
9618
- if (config('noDeprecation')) {
9619
- return fn;
9620
- }
9585
+ function deprecate (fn, msg) {
9586
+ if (config('noDeprecation')) {
9587
+ return fn;
9588
+ }
9621
9589
 
9622
- var warned = false;
9623
- function deprecated() {
9624
- if (!warned) {
9625
- if (config('throwDeprecation')) {
9626
- throw new Error(msg);
9627
- } else if (config('traceDeprecation')) {
9628
- console.trace(msg);
9629
- } else {
9630
- console.warn(msg);
9631
- }
9632
- warned = true;
9633
- }
9634
- return fn.apply(this, arguments);
9635
- }
9590
+ var warned = false;
9591
+ function deprecated() {
9592
+ if (!warned) {
9593
+ if (config('throwDeprecation')) {
9594
+ throw new Error(msg);
9595
+ } else if (config('traceDeprecation')) {
9596
+ console.trace(msg);
9597
+ } else {
9598
+ console.warn(msg);
9599
+ }
9600
+ warned = true;
9601
+ }
9602
+ return fn.apply(this, arguments);
9603
+ }
9636
9604
 
9637
- return deprecated;
9638
- }
9605
+ return deprecated;
9606
+ }
9639
9607
 
9640
- /**
9641
- * Checks `localStorage` for boolean values for the given `name`.
9642
- *
9643
- * @param {String} name
9644
- * @returns {Boolean}
9645
- * @api private
9646
- */
9608
+ /**
9609
+ * Checks `localStorage` for boolean values for the given `name`.
9610
+ *
9611
+ * @param {String} name
9612
+ * @returns {Boolean}
9613
+ * @api private
9614
+ */
9647
9615
 
9648
- function config (name) {
9649
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
9650
- try {
9651
- if (!commonjsGlobal.localStorage) return false;
9652
- } catch (_) {
9653
- return false;
9654
- }
9655
- var val = commonjsGlobal.localStorage[name];
9656
- if (null == val) return false;
9657
- return String(val).toLowerCase() === 'true';
9658
- }
9659
- return browser$b;
9616
+ function config (name) {
9617
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
9618
+ try {
9619
+ if (!commonjsGlobal.localStorage) return false;
9620
+ } catch (_) {
9621
+ return false;
9622
+ }
9623
+ var val = commonjsGlobal.localStorage[name];
9624
+ if (null == val) return false;
9625
+ return String(val).toLowerCase() === 'true';
9660
9626
  }
9661
9627
 
9662
9628
  var _stream_writable;
@@ -9687,12 +9653,12 @@ function require_stream_writable () {
9687
9653
 
9688
9654
  /*<replacement>*/
9689
9655
  const internalUtil = {
9690
- deprecate: requireBrowser$a()
9656
+ deprecate: browser$b
9691
9657
  };
9692
9658
  /*</replacement>*/
9693
9659
 
9694
9660
  /*<replacement>*/
9695
- var Stream = requireStreamBrowser();
9661
+ var Stream = streamBrowser;
9696
9662
  /*</replacement>*/
9697
9663
 
9698
9664
  const Buffer = require$$6$1.Buffer;
@@ -9703,8 +9669,8 @@ function require_stream_writable () {
9703
9669
  function _isUint8Array(obj) {
9704
9670
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
9705
9671
  }
9706
- const destroyImpl = requireDestroy();
9707
- const _require = requireState(),
9672
+ const destroyImpl = destroy_1;
9673
+ const _require = state,
9708
9674
  getHighWaterMark = _require.getHighWaterMark;
9709
9675
  const _require$codes = errorsBrowser.codes,
9710
9676
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -10898,7 +10864,7 @@ function require_stream_readable () {
10898
10864
  /*</replacement>*/
10899
10865
 
10900
10866
  /*<replacement>*/
10901
- var Stream = requireStreamBrowser();
10867
+ var Stream = streamBrowser;
10902
10868
  /*</replacement>*/
10903
10869
 
10904
10870
  const Buffer = require$$6$1.Buffer;
@@ -10921,8 +10887,8 @@ function require_stream_readable () {
10921
10887
  /*</replacement>*/
10922
10888
 
10923
10889
  const BufferList = requireBuffer_list();
10924
- const destroyImpl = requireDestroy();
10925
- const _require = requireState(),
10890
+ const destroyImpl = destroy_1;
10891
+ const _require = state,
10926
10892
  getHighWaterMark = _require.getHighWaterMark;
10927
10893
  const _require$codes = errorsBrowser.codes,
10928
10894
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -14375,7 +14341,7 @@ function WriteReq(chunk, encoding, cb) {
14375
14341
 
14376
14342
  function WritableState(options, stream) {
14377
14343
  Object.defineProperty(this, 'buffer', {
14378
- get: deprecate(function () {
14344
+ get: deprecate$1(function () {
14379
14345
  return this.getBuffer();
14380
14346
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
14381
14347
  });
@@ -38937,6 +38903,7 @@ class Base {
38937
38903
  const block = await this.getLoaderBlock(cid);
38938
38904
  allBlocks.set(cid, block);
38939
38905
  }
38906
+ cidMap.clear();
38940
38907
  const blocks = {
38941
38908
  lastCid: clock[0],
38942
38909
  get: cid => allBlocks.get(cid.toString())