@fireproof/core 0.7.2-dev.5 → 0.7.2-dev.6

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