@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.
- package/dist/src/fireproof.js +180 -213
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +180 -213
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/base.js +1 -0
- package/package.json +1 -1
- package/src/storage/base.js +1 -0
package/dist/src/fireproof.js
CHANGED
@@ -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
|
-
|
9327
|
-
|
9328
|
-
|
9329
|
-
|
9330
|
-
|
9331
|
-
|
9332
|
-
|
9333
|
-
|
9334
|
-
|
9335
|
-
|
9336
|
-
|
9337
|
-
|
9338
|
-
|
9339
|
-
|
9340
|
-
|
9341
|
-
|
9342
|
-
|
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
|
-
|
9352
|
-
|
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
|
-
|
9355
|
-
|
9356
|
-
|
9339
|
+
if (this._readableState) {
|
9340
|
+
this._readableState.destroyed = true;
|
9341
|
+
}
|
9357
9342
|
|
9358
|
-
|
9359
|
-
|
9360
|
-
|
9361
|
-
|
9362
|
-
|
9363
|
-
|
9364
|
-
|
9365
|
-
|
9366
|
-
|
9367
|
-
|
9368
|
-
|
9369
|
-
|
9370
|
-
|
9371
|
-
|
9372
|
-
|
9373
|
-
|
9374
|
-
|
9375
|
-
|
9376
|
-
|
9377
|
-
|
9378
|
-
|
9379
|
-
|
9380
|
-
|
9381
|
-
|
9382
|
-
|
9383
|
-
|
9384
|
-
|
9385
|
-
|
9386
|
-
|
9387
|
-
|
9388
|
-
|
9389
|
-
|
9390
|
-
|
9391
|
-
|
9392
|
-
|
9393
|
-
|
9394
|
-
|
9395
|
-
|
9396
|
-
|
9397
|
-
|
9398
|
-
|
9399
|
-
|
9400
|
-
|
9401
|
-
|
9402
|
-
|
9403
|
-
|
9404
|
-
|
9405
|
-
|
9406
|
-
|
9407
|
-
|
9408
|
-
|
9409
|
-
|
9410
|
-
|
9411
|
-
|
9412
|
-
|
9413
|
-
|
9414
|
-
|
9415
|
-
|
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
|
-
|
9418
|
-
|
9419
|
-
|
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
|
-
|
9558
|
-
|
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
|
-
|
9588
|
-
|
9554
|
+
// Default value
|
9555
|
+
return state.objectMode ? 16 : 16 * 1024;
|
9556
|
+
}
|
9557
|
+
var state = {
|
9558
|
+
getHighWaterMark
|
9559
|
+
};
|
9589
9560
|
|
9590
|
-
|
9591
|
-
|
9592
|
-
|
9593
|
-
/**
|
9594
|
-
* Module exports.
|
9595
|
-
*/
|
9561
|
+
/**
|
9562
|
+
* Module exports.
|
9563
|
+
*/
|
9596
9564
|
|
9597
|
-
|
9565
|
+
var browser$b = deprecate;
|
9598
9566
|
|
9599
|
-
|
9600
|
-
|
9601
|
-
|
9602
|
-
|
9603
|
-
|
9604
|
-
|
9605
|
-
|
9606
|
-
|
9607
|
-
|
9608
|
-
|
9609
|
-
|
9610
|
-
|
9611
|
-
|
9612
|
-
|
9613
|
-
|
9614
|
-
|
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
|
-
|
9618
|
-
|
9619
|
-
|
9620
|
-
|
9585
|
+
function deprecate (fn, msg) {
|
9586
|
+
if (config('noDeprecation')) {
|
9587
|
+
return fn;
|
9588
|
+
}
|
9621
9589
|
|
9622
|
-
|
9623
|
-
|
9624
|
-
|
9625
|
-
|
9626
|
-
|
9627
|
-
|
9628
|
-
|
9629
|
-
|
9630
|
-
|
9631
|
-
|
9632
|
-
|
9633
|
-
|
9634
|
-
|
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
|
-
|
9638
|
-
|
9605
|
+
return deprecated;
|
9606
|
+
}
|
9639
9607
|
|
9640
|
-
|
9641
|
-
|
9642
|
-
|
9643
|
-
|
9644
|
-
|
9645
|
-
|
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
|
-
|
9649
|
-
|
9650
|
-
|
9651
|
-
|
9652
|
-
|
9653
|
-
|
9654
|
-
|
9655
|
-
|
9656
|
-
|
9657
|
-
|
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:
|
9656
|
+
deprecate: browser$b
|
9691
9657
|
};
|
9692
9658
|
/*</replacement>*/
|
9693
9659
|
|
9694
9660
|
/*<replacement>*/
|
9695
|
-
var Stream =
|
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 =
|
9707
|
-
const _require =
|
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 =
|
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 =
|
10925
|
-
const _require =
|
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())
|