@fireproof/core 0.7.2-dev.3 → 0.7.2-dev.4
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 -214
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +180 -214
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/browser.js +1 -1
- package/package.json +1 -1
- package/src/storage/browser.js +1 -1
package/dist/src/fireproof.js
CHANGED
@@ -11480,15 +11480,7 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
11480
11480
|
|
11481
11481
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
11482
11482
|
|
11483
|
-
var streamBrowser;
|
11484
|
-
var hasRequiredStreamBrowser;
|
11485
|
-
|
11486
|
-
function requireStreamBrowser () {
|
11487
|
-
if (hasRequiredStreamBrowser) return streamBrowser;
|
11488
|
-
hasRequiredStreamBrowser = 1;
|
11489
|
-
streamBrowser = require$$0$1.EventEmitter;
|
11490
|
-
return streamBrowser;
|
11491
|
-
}
|
11483
|
+
var streamBrowser = require$$0$1.EventEmitter;
|
11492
11484
|
|
11493
11485
|
// shim for using process in browser
|
11494
11486
|
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
@@ -11631,7 +11623,7 @@ var argv = [];
|
|
11631
11623
|
var version$1 = ''; // empty string to avoid regexp issues
|
11632
11624
|
var versions = {};
|
11633
11625
|
var release = {};
|
11634
|
-
var config = {};
|
11626
|
+
var config$1 = {};
|
11635
11627
|
|
11636
11628
|
function noop$2() {}
|
11637
11629
|
|
@@ -11708,7 +11700,7 @@ var browser$1$1 = {
|
|
11708
11700
|
hrtime: hrtime,
|
11709
11701
|
platform: platform,
|
11710
11702
|
release: release,
|
11711
|
-
config: config,
|
11703
|
+
config: config$1,
|
11712
11704
|
uptime: uptime
|
11713
11705
|
};
|
11714
11706
|
|
@@ -11789,11 +11781,11 @@ function format(f) {
|
|
11789
11781
|
// Mark that a method should not be used.
|
11790
11782
|
// Returns a modified function which warns once by default.
|
11791
11783
|
// If --no-deprecation is set, then it is a no-op.
|
11792
|
-
function deprecate(fn, msg) {
|
11784
|
+
function deprecate$1(fn, msg) {
|
11793
11785
|
// Allow for deprecating things in the process of starting up.
|
11794
11786
|
if (isUndefined(global$1.process)) {
|
11795
11787
|
return function() {
|
11796
|
-
return deprecate(fn, msg).apply(this, arguments);
|
11788
|
+
return deprecate$1(fn, msg).apply(this, arguments);
|
11797
11789
|
};
|
11798
11790
|
}
|
11799
11791
|
|
@@ -12402,7 +12394,7 @@ var _polyfillNode_util = {
|
|
12402
12394
|
isBoolean: isBoolean,
|
12403
12395
|
isArray: isArray,
|
12404
12396
|
inspect: inspect,
|
12405
|
-
deprecate: deprecate,
|
12397
|
+
deprecate: deprecate$1,
|
12406
12398
|
format: format,
|
12407
12399
|
debuglog: debuglog,
|
12408
12400
|
promisify: promisify,
|
@@ -12415,7 +12407,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
12415
12407
|
callbackify: callbackify,
|
12416
12408
|
debuglog: debuglog,
|
12417
12409
|
default: _polyfillNode_util,
|
12418
|
-
deprecate: deprecate,
|
12410
|
+
deprecate: deprecate$1,
|
12419
12411
|
format: format,
|
12420
12412
|
inherits: inherits$1,
|
12421
12413
|
inspect: inspect,
|
@@ -12603,108 +12595,99 @@ function requireBuffer_list () {
|
|
12603
12595
|
return buffer_list;
|
12604
12596
|
}
|
12605
12597
|
|
12606
|
-
|
12607
|
-
|
12608
|
-
|
12609
|
-
|
12610
|
-
|
12611
|
-
|
12612
|
-
|
12613
|
-
|
12614
|
-
|
12615
|
-
|
12616
|
-
|
12617
|
-
|
12618
|
-
|
12619
|
-
|
12620
|
-
|
12621
|
-
|
12622
|
-
|
12623
|
-
} else if (!this._writableState.errorEmitted) {
|
12624
|
-
this._writableState.errorEmitted = true;
|
12625
|
-
process.nextTick(emitErrorNT, this, err);
|
12626
|
-
}
|
12627
|
-
}
|
12628
|
-
return this;
|
12629
|
-
}
|
12598
|
+
// undocumented cb() API, needed for core, not for public API
|
12599
|
+
function destroy(err, cb) {
|
12600
|
+
const readableDestroyed = this._readableState && this._readableState.destroyed;
|
12601
|
+
const writableDestroyed = this._writableState && this._writableState.destroyed;
|
12602
|
+
if (readableDestroyed || writableDestroyed) {
|
12603
|
+
if (cb) {
|
12604
|
+
cb(err);
|
12605
|
+
} else if (err) {
|
12606
|
+
if (!this._writableState) {
|
12607
|
+
process.nextTick(emitErrorNT, this, err);
|
12608
|
+
} else if (!this._writableState.errorEmitted) {
|
12609
|
+
this._writableState.errorEmitted = true;
|
12610
|
+
process.nextTick(emitErrorNT, this, err);
|
12611
|
+
}
|
12612
|
+
}
|
12613
|
+
return this;
|
12614
|
+
}
|
12630
12615
|
|
12631
|
-
|
12632
|
-
|
12616
|
+
// we set destroyed to true before firing error callbacks in order
|
12617
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
12633
12618
|
|
12634
|
-
|
12635
|
-
|
12636
|
-
|
12619
|
+
if (this._readableState) {
|
12620
|
+
this._readableState.destroyed = true;
|
12621
|
+
}
|
12637
12622
|
|
12638
|
-
|
12639
|
-
|
12640
|
-
|
12641
|
-
|
12642
|
-
|
12643
|
-
|
12644
|
-
|
12645
|
-
|
12646
|
-
|
12647
|
-
|
12648
|
-
|
12649
|
-
|
12650
|
-
|
12651
|
-
|
12652
|
-
|
12653
|
-
|
12654
|
-
|
12655
|
-
|
12656
|
-
|
12657
|
-
|
12658
|
-
|
12659
|
-
|
12660
|
-
|
12661
|
-
|
12662
|
-
|
12663
|
-
|
12664
|
-
|
12665
|
-
|
12666
|
-
|
12667
|
-
|
12668
|
-
|
12669
|
-
|
12670
|
-
|
12671
|
-
|
12672
|
-
|
12673
|
-
|
12674
|
-
|
12675
|
-
|
12676
|
-
|
12677
|
-
|
12678
|
-
|
12679
|
-
|
12680
|
-
|
12681
|
-
|
12682
|
-
|
12683
|
-
|
12684
|
-
|
12685
|
-
|
12686
|
-
|
12687
|
-
|
12688
|
-
|
12689
|
-
|
12690
|
-
|
12691
|
-
|
12692
|
-
|
12693
|
-
|
12694
|
-
|
12695
|
-
|
12623
|
+
// if this is a duplex stream mark the writable part as destroyed as well
|
12624
|
+
if (this._writableState) {
|
12625
|
+
this._writableState.destroyed = true;
|
12626
|
+
}
|
12627
|
+
this._destroy(err || null, err => {
|
12628
|
+
if (!cb && err) {
|
12629
|
+
if (!this._writableState) {
|
12630
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12631
|
+
} else if (!this._writableState.errorEmitted) {
|
12632
|
+
this._writableState.errorEmitted = true;
|
12633
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12634
|
+
} else {
|
12635
|
+
process.nextTick(emitCloseNT, this);
|
12636
|
+
}
|
12637
|
+
} else if (cb) {
|
12638
|
+
process.nextTick(emitCloseNT, this);
|
12639
|
+
cb(err);
|
12640
|
+
} else {
|
12641
|
+
process.nextTick(emitCloseNT, this);
|
12642
|
+
}
|
12643
|
+
});
|
12644
|
+
return this;
|
12645
|
+
}
|
12646
|
+
function emitErrorAndCloseNT(self, err) {
|
12647
|
+
emitErrorNT(self, err);
|
12648
|
+
emitCloseNT(self);
|
12649
|
+
}
|
12650
|
+
function emitCloseNT(self) {
|
12651
|
+
if (self._writableState && !self._writableState.emitClose) return;
|
12652
|
+
if (self._readableState && !self._readableState.emitClose) return;
|
12653
|
+
self.emit('close');
|
12654
|
+
}
|
12655
|
+
function undestroy() {
|
12656
|
+
if (this._readableState) {
|
12657
|
+
this._readableState.destroyed = false;
|
12658
|
+
this._readableState.reading = false;
|
12659
|
+
this._readableState.ended = false;
|
12660
|
+
this._readableState.endEmitted = false;
|
12661
|
+
}
|
12662
|
+
if (this._writableState) {
|
12663
|
+
this._writableState.destroyed = false;
|
12664
|
+
this._writableState.ended = false;
|
12665
|
+
this._writableState.ending = false;
|
12666
|
+
this._writableState.finalCalled = false;
|
12667
|
+
this._writableState.prefinished = false;
|
12668
|
+
this._writableState.finished = false;
|
12669
|
+
this._writableState.errorEmitted = false;
|
12670
|
+
}
|
12671
|
+
}
|
12672
|
+
function emitErrorNT(self, err) {
|
12673
|
+
self.emit('error', err);
|
12674
|
+
}
|
12675
|
+
function errorOrDestroy(stream, err) {
|
12676
|
+
// We have tests that rely on errors being emitted
|
12677
|
+
// in the same tick, so changing this is semver major.
|
12678
|
+
// For now when you opt-in to autoDestroy we allow
|
12679
|
+
// the error to be emitted nextTick. In a future
|
12680
|
+
// semver major update we should change the default to this.
|
12696
12681
|
|
12697
|
-
|
12698
|
-
|
12699
|
-
|
12700
|
-
}
|
12701
|
-
destroy_1 = {
|
12702
|
-
destroy,
|
12703
|
-
undestroy,
|
12704
|
-
errorOrDestroy
|
12705
|
-
};
|
12706
|
-
return destroy_1;
|
12682
|
+
const rState = stream._readableState;
|
12683
|
+
const wState = stream._writableState;
|
12684
|
+
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
12707
12685
|
}
|
12686
|
+
var destroy_1 = {
|
12687
|
+
destroy,
|
12688
|
+
undestroy,
|
12689
|
+
errorOrDestroy
|
12690
|
+
};
|
12708
12691
|
|
12709
12692
|
var errorsBrowser = {};
|
12710
12693
|
|
@@ -12834,109 +12817,92 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
12834
12817
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
12835
12818
|
errorsBrowser.codes = codes;
|
12836
12819
|
|
12837
|
-
|
12838
|
-
|
12839
|
-
|
12840
|
-
function requireState () {
|
12841
|
-
if (hasRequiredState) return state;
|
12842
|
-
hasRequiredState = 1;
|
12843
|
-
|
12844
|
-
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
12845
|
-
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12846
|
-
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12847
|
-
}
|
12848
|
-
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12849
|
-
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12850
|
-
if (hwm != null) {
|
12851
|
-
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12852
|
-
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12853
|
-
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12854
|
-
}
|
12855
|
-
return Math.floor(hwm);
|
12856
|
-
}
|
12857
|
-
|
12858
|
-
// Default value
|
12859
|
-
return state.objectMode ? 16 : 16 * 1024;
|
12860
|
-
}
|
12861
|
-
state = {
|
12862
|
-
getHighWaterMark
|
12863
|
-
};
|
12864
|
-
return state;
|
12820
|
+
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
12821
|
+
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12822
|
+
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12865
12823
|
}
|
12824
|
+
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12825
|
+
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12826
|
+
if (hwm != null) {
|
12827
|
+
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12828
|
+
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12829
|
+
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12830
|
+
}
|
12831
|
+
return Math.floor(hwm);
|
12832
|
+
}
|
12866
12833
|
|
12867
|
-
|
12868
|
-
|
12834
|
+
// Default value
|
12835
|
+
return state.objectMode ? 16 : 16 * 1024;
|
12836
|
+
}
|
12837
|
+
var state = {
|
12838
|
+
getHighWaterMark
|
12839
|
+
};
|
12869
12840
|
|
12870
|
-
|
12871
|
-
|
12872
|
-
|
12873
|
-
/**
|
12874
|
-
* Module exports.
|
12875
|
-
*/
|
12841
|
+
/**
|
12842
|
+
* Module exports.
|
12843
|
+
*/
|
12876
12844
|
|
12877
|
-
|
12845
|
+
var browser$b = deprecate;
|
12878
12846
|
|
12879
|
-
|
12880
|
-
|
12881
|
-
|
12882
|
-
|
12883
|
-
|
12884
|
-
|
12885
|
-
|
12886
|
-
|
12887
|
-
|
12888
|
-
|
12889
|
-
|
12890
|
-
|
12891
|
-
|
12892
|
-
|
12893
|
-
|
12894
|
-
|
12895
|
-
|
12847
|
+
/**
|
12848
|
+
* Mark that a method should not be used.
|
12849
|
+
* Returns a modified function which warns once by default.
|
12850
|
+
*
|
12851
|
+
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
12852
|
+
*
|
12853
|
+
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
12854
|
+
* will throw an Error when invoked.
|
12855
|
+
*
|
12856
|
+
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
12857
|
+
* will invoke `console.trace()` instead of `console.error()`.
|
12858
|
+
*
|
12859
|
+
* @param {Function} fn - the function to deprecate
|
12860
|
+
* @param {String} msg - the string to print to the console when `fn` is invoked
|
12861
|
+
* @returns {Function} a new "deprecated" version of `fn`
|
12862
|
+
* @api public
|
12863
|
+
*/
|
12896
12864
|
|
12897
|
-
|
12898
|
-
|
12899
|
-
|
12900
|
-
|
12865
|
+
function deprecate (fn, msg) {
|
12866
|
+
if (config('noDeprecation')) {
|
12867
|
+
return fn;
|
12868
|
+
}
|
12901
12869
|
|
12902
|
-
|
12903
|
-
|
12904
|
-
|
12905
|
-
|
12906
|
-
|
12907
|
-
|
12908
|
-
|
12909
|
-
|
12910
|
-
|
12911
|
-
|
12912
|
-
|
12913
|
-
|
12914
|
-
|
12915
|
-
|
12870
|
+
var warned = false;
|
12871
|
+
function deprecated() {
|
12872
|
+
if (!warned) {
|
12873
|
+
if (config('throwDeprecation')) {
|
12874
|
+
throw new Error(msg);
|
12875
|
+
} else if (config('traceDeprecation')) {
|
12876
|
+
console.trace(msg);
|
12877
|
+
} else {
|
12878
|
+
console.warn(msg);
|
12879
|
+
}
|
12880
|
+
warned = true;
|
12881
|
+
}
|
12882
|
+
return fn.apply(this, arguments);
|
12883
|
+
}
|
12916
12884
|
|
12917
|
-
|
12918
|
-
|
12885
|
+
return deprecated;
|
12886
|
+
}
|
12919
12887
|
|
12920
|
-
|
12921
|
-
|
12922
|
-
|
12923
|
-
|
12924
|
-
|
12925
|
-
|
12926
|
-
|
12888
|
+
/**
|
12889
|
+
* Checks `localStorage` for boolean values for the given `name`.
|
12890
|
+
*
|
12891
|
+
* @param {String} name
|
12892
|
+
* @returns {Boolean}
|
12893
|
+
* @api private
|
12894
|
+
*/
|
12927
12895
|
|
12928
|
-
|
12929
|
-
|
12930
|
-
|
12931
|
-
|
12932
|
-
|
12933
|
-
|
12934
|
-
|
12935
|
-
|
12936
|
-
|
12937
|
-
|
12938
|
-
}
|
12939
|
-
return browser$b;
|
12896
|
+
function config (name) {
|
12897
|
+
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
12898
|
+
try {
|
12899
|
+
if (!commonjsGlobal.localStorage) return false;
|
12900
|
+
} catch (_) {
|
12901
|
+
return false;
|
12902
|
+
}
|
12903
|
+
var val = commonjsGlobal.localStorage[name];
|
12904
|
+
if (null == val) return false;
|
12905
|
+
return String(val).toLowerCase() === 'true';
|
12940
12906
|
}
|
12941
12907
|
|
12942
12908
|
var _stream_writable;
|
@@ -12967,12 +12933,12 @@ function require_stream_writable () {
|
|
12967
12933
|
|
12968
12934
|
/*<replacement>*/
|
12969
12935
|
const internalUtil = {
|
12970
|
-
deprecate:
|
12936
|
+
deprecate: browser$b
|
12971
12937
|
};
|
12972
12938
|
/*</replacement>*/
|
12973
12939
|
|
12974
12940
|
/*<replacement>*/
|
12975
|
-
var Stream =
|
12941
|
+
var Stream = streamBrowser;
|
12976
12942
|
/*</replacement>*/
|
12977
12943
|
|
12978
12944
|
const Buffer = require$$6$1.Buffer;
|
@@ -12983,8 +12949,8 @@ function require_stream_writable () {
|
|
12983
12949
|
function _isUint8Array(obj) {
|
12984
12950
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
12985
12951
|
}
|
12986
|
-
const destroyImpl =
|
12987
|
-
const _require =
|
12952
|
+
const destroyImpl = destroy_1;
|
12953
|
+
const _require = state,
|
12988
12954
|
getHighWaterMark = _require.getHighWaterMark;
|
12989
12955
|
const _require$codes = errorsBrowser.codes,
|
12990
12956
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -14178,7 +14144,7 @@ function require_stream_readable () {
|
|
14178
14144
|
/*</replacement>*/
|
14179
14145
|
|
14180
14146
|
/*<replacement>*/
|
14181
|
-
var Stream =
|
14147
|
+
var Stream = streamBrowser;
|
14182
14148
|
/*</replacement>*/
|
14183
14149
|
|
14184
14150
|
const Buffer = require$$6$1.Buffer;
|
@@ -14201,8 +14167,8 @@ function require_stream_readable () {
|
|
14201
14167
|
/*</replacement>*/
|
14202
14168
|
|
14203
14169
|
const BufferList = requireBuffer_list();
|
14204
|
-
const destroyImpl =
|
14205
|
-
const _require =
|
14170
|
+
const destroyImpl = destroy_1;
|
14171
|
+
const _require = state,
|
14206
14172
|
getHighWaterMark = _require.getHighWaterMark;
|
14207
14173
|
const _require$codes = errorsBrowser.codes,
|
14208
14174
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -17655,7 +17621,7 @@ function WriteReq(chunk, encoding, cb) {
|
|
17655
17621
|
|
17656
17622
|
function WritableState(options, stream) {
|
17657
17623
|
Object.defineProperty(this, 'buffer', {
|
17658
|
-
get: deprecate(function () {
|
17624
|
+
get: deprecate$1(function () {
|
17659
17625
|
return this.getBuffer();
|
17660
17626
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
17661
17627
|
});
|
@@ -39116,7 +39082,7 @@ class Browser extends Base {
|
|
39116
39082
|
|
39117
39083
|
loadHeader (branch = 'main') {
|
39118
39084
|
try {
|
39119
|
-
return localStorage.getItem(this.headerKey(branch))
|
39085
|
+
return JSON.parse(localStorage.getItem(this.headerKey(branch)))
|
39120
39086
|
} catch (e) {}
|
39121
39087
|
}
|
39122
39088
|
|