@fireproof/core 0.7.0-alpha.2 → 0.7.0-alpha.3
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 +182 -217
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +187 -222
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/filesystem.js +3 -3
- package/package.json +1 -1
- package/src/storage/filesystem.js +3 -3
package/dist/src/fireproof.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var promises = require('fs/promises');
|
4
3
|
var http = require('node:http');
|
5
4
|
var https = require('node:https');
|
6
5
|
var zlib = require('node:zlib');
|
@@ -11486,15 +11485,7 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
11486
11485
|
|
11487
11486
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
11488
11487
|
|
11489
|
-
var streamBrowser;
|
11490
|
-
var hasRequiredStreamBrowser;
|
11491
|
-
|
11492
|
-
function requireStreamBrowser () {
|
11493
|
-
if (hasRequiredStreamBrowser) return streamBrowser;
|
11494
|
-
hasRequiredStreamBrowser = 1;
|
11495
|
-
streamBrowser = require$$0$1.EventEmitter;
|
11496
|
-
return streamBrowser;
|
11497
|
-
}
|
11488
|
+
var streamBrowser = require$$0$1.EventEmitter;
|
11498
11489
|
|
11499
11490
|
// shim for using process in browser
|
11500
11491
|
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
@@ -11637,7 +11628,7 @@ var argv = [];
|
|
11637
11628
|
var version$2 = ''; // empty string to avoid regexp issues
|
11638
11629
|
var versions = {};
|
11639
11630
|
var release = {};
|
11640
|
-
var config = {};
|
11631
|
+
var config$1 = {};
|
11641
11632
|
|
11642
11633
|
function noop$3() {}
|
11643
11634
|
|
@@ -11714,7 +11705,7 @@ var browser$1$1 = {
|
|
11714
11705
|
hrtime: hrtime,
|
11715
11706
|
platform: platform,
|
11716
11707
|
release: release,
|
11717
|
-
config: config,
|
11708
|
+
config: config$1,
|
11718
11709
|
uptime: uptime
|
11719
11710
|
};
|
11720
11711
|
|
@@ -11795,11 +11786,11 @@ function format(f) {
|
|
11795
11786
|
// Mark that a method should not be used.
|
11796
11787
|
// Returns a modified function which warns once by default.
|
11797
11788
|
// If --no-deprecation is set, then it is a no-op.
|
11798
|
-
function deprecate$
|
11789
|
+
function deprecate$2(fn, msg) {
|
11799
11790
|
// Allow for deprecating things in the process of starting up.
|
11800
11791
|
if (isUndefined(global$1.process)) {
|
11801
11792
|
return function() {
|
11802
|
-
return deprecate$
|
11793
|
+
return deprecate$2(fn, msg).apply(this, arguments);
|
11803
11794
|
};
|
11804
11795
|
}
|
11805
11796
|
|
@@ -12408,7 +12399,7 @@ var _polyfillNode_util = {
|
|
12408
12399
|
isBoolean: isBoolean,
|
12409
12400
|
isArray: isArray,
|
12410
12401
|
inspect: inspect,
|
12411
|
-
deprecate: deprecate$
|
12402
|
+
deprecate: deprecate$2,
|
12412
12403
|
format: format,
|
12413
12404
|
debuglog: debuglog,
|
12414
12405
|
promisify: promisify,
|
@@ -12421,7 +12412,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
12421
12412
|
callbackify: callbackify,
|
12422
12413
|
debuglog: debuglog,
|
12423
12414
|
default: _polyfillNode_util,
|
12424
|
-
deprecate: deprecate$
|
12415
|
+
deprecate: deprecate$2,
|
12425
12416
|
format: format,
|
12426
12417
|
inherits: inherits$w,
|
12427
12418
|
inspect: inspect,
|
@@ -12609,108 +12600,99 @@ function requireBuffer_list () {
|
|
12609
12600
|
return buffer_list;
|
12610
12601
|
}
|
12611
12602
|
|
12612
|
-
|
12613
|
-
|
12614
|
-
|
12615
|
-
|
12616
|
-
|
12617
|
-
|
12618
|
-
|
12619
|
-
|
12620
|
-
|
12621
|
-
|
12622
|
-
|
12623
|
-
|
12624
|
-
|
12625
|
-
|
12626
|
-
|
12627
|
-
|
12628
|
-
|
12629
|
-
} else if (!this._writableState.errorEmitted) {
|
12630
|
-
this._writableState.errorEmitted = true;
|
12631
|
-
process.nextTick(emitErrorNT, this, err);
|
12632
|
-
}
|
12633
|
-
}
|
12634
|
-
return this;
|
12635
|
-
}
|
12603
|
+
// undocumented cb() API, needed for core, not for public API
|
12604
|
+
function destroy(err, cb) {
|
12605
|
+
const readableDestroyed = this._readableState && this._readableState.destroyed;
|
12606
|
+
const writableDestroyed = this._writableState && this._writableState.destroyed;
|
12607
|
+
if (readableDestroyed || writableDestroyed) {
|
12608
|
+
if (cb) {
|
12609
|
+
cb(err);
|
12610
|
+
} else if (err) {
|
12611
|
+
if (!this._writableState) {
|
12612
|
+
process.nextTick(emitErrorNT, this, err);
|
12613
|
+
} else if (!this._writableState.errorEmitted) {
|
12614
|
+
this._writableState.errorEmitted = true;
|
12615
|
+
process.nextTick(emitErrorNT, this, err);
|
12616
|
+
}
|
12617
|
+
}
|
12618
|
+
return this;
|
12619
|
+
}
|
12636
12620
|
|
12637
|
-
|
12638
|
-
|
12621
|
+
// we set destroyed to true before firing error callbacks in order
|
12622
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
12639
12623
|
|
12640
|
-
|
12641
|
-
|
12642
|
-
|
12624
|
+
if (this._readableState) {
|
12625
|
+
this._readableState.destroyed = true;
|
12626
|
+
}
|
12643
12627
|
|
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
|
-
}
|
12696
|
-
function errorOrDestroy(stream, err) {
|
12697
|
-
// We have tests that rely on errors being emitted
|
12698
|
-
// in the same tick, so changing this is semver major.
|
12699
|
-
// For now when you opt-in to autoDestroy we allow
|
12700
|
-
// the error to be emitted nextTick. In a future
|
12701
|
-
// semver major update we should change the default to this.
|
12702
|
-
|
12703
|
-
const rState = stream._readableState;
|
12704
|
-
const wState = stream._writableState;
|
12705
|
-
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
12706
|
-
}
|
12707
|
-
destroy_1 = {
|
12708
|
-
destroy,
|
12709
|
-
undestroy,
|
12710
|
-
errorOrDestroy
|
12711
|
-
};
|
12712
|
-
return destroy_1;
|
12628
|
+
// if this is a duplex stream mark the writable part as destroyed as well
|
12629
|
+
if (this._writableState) {
|
12630
|
+
this._writableState.destroyed = true;
|
12631
|
+
}
|
12632
|
+
this._destroy(err || null, err => {
|
12633
|
+
if (!cb && err) {
|
12634
|
+
if (!this._writableState) {
|
12635
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12636
|
+
} else if (!this._writableState.errorEmitted) {
|
12637
|
+
this._writableState.errorEmitted = true;
|
12638
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12639
|
+
} else {
|
12640
|
+
process.nextTick(emitCloseNT, this);
|
12641
|
+
}
|
12642
|
+
} else if (cb) {
|
12643
|
+
process.nextTick(emitCloseNT, this);
|
12644
|
+
cb(err);
|
12645
|
+
} else {
|
12646
|
+
process.nextTick(emitCloseNT, this);
|
12647
|
+
}
|
12648
|
+
});
|
12649
|
+
return this;
|
12650
|
+
}
|
12651
|
+
function emitErrorAndCloseNT(self, err) {
|
12652
|
+
emitErrorNT(self, err);
|
12653
|
+
emitCloseNT(self);
|
12654
|
+
}
|
12655
|
+
function emitCloseNT(self) {
|
12656
|
+
if (self._writableState && !self._writableState.emitClose) return;
|
12657
|
+
if (self._readableState && !self._readableState.emitClose) return;
|
12658
|
+
self.emit('close');
|
12659
|
+
}
|
12660
|
+
function undestroy() {
|
12661
|
+
if (this._readableState) {
|
12662
|
+
this._readableState.destroyed = false;
|
12663
|
+
this._readableState.reading = false;
|
12664
|
+
this._readableState.ended = false;
|
12665
|
+
this._readableState.endEmitted = false;
|
12666
|
+
}
|
12667
|
+
if (this._writableState) {
|
12668
|
+
this._writableState.destroyed = false;
|
12669
|
+
this._writableState.ended = false;
|
12670
|
+
this._writableState.ending = false;
|
12671
|
+
this._writableState.finalCalled = false;
|
12672
|
+
this._writableState.prefinished = false;
|
12673
|
+
this._writableState.finished = false;
|
12674
|
+
this._writableState.errorEmitted = false;
|
12675
|
+
}
|
12676
|
+
}
|
12677
|
+
function emitErrorNT(self, err) {
|
12678
|
+
self.emit('error', err);
|
12713
12679
|
}
|
12680
|
+
function errorOrDestroy(stream, err) {
|
12681
|
+
// We have tests that rely on errors being emitted
|
12682
|
+
// in the same tick, so changing this is semver major.
|
12683
|
+
// For now when you opt-in to autoDestroy we allow
|
12684
|
+
// the error to be emitted nextTick. In a future
|
12685
|
+
// semver major update we should change the default to this.
|
12686
|
+
|
12687
|
+
const rState = stream._readableState;
|
12688
|
+
const wState = stream._writableState;
|
12689
|
+
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
12690
|
+
}
|
12691
|
+
var destroy_1 = {
|
12692
|
+
destroy,
|
12693
|
+
undestroy,
|
12694
|
+
errorOrDestroy
|
12695
|
+
};
|
12714
12696
|
|
12715
12697
|
var errorsBrowser = {};
|
12716
12698
|
|
@@ -12840,109 +12822,92 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
12840
12822
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
12841
12823
|
errorsBrowser.codes = codes;
|
12842
12824
|
|
12843
|
-
|
12844
|
-
|
12845
|
-
|
12846
|
-
function requireState () {
|
12847
|
-
if (hasRequiredState) return state;
|
12848
|
-
hasRequiredState = 1;
|
12849
|
-
|
12850
|
-
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
12851
|
-
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12852
|
-
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12853
|
-
}
|
12854
|
-
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12855
|
-
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12856
|
-
if (hwm != null) {
|
12857
|
-
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12858
|
-
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12859
|
-
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12860
|
-
}
|
12861
|
-
return Math.floor(hwm);
|
12862
|
-
}
|
12863
|
-
|
12864
|
-
// Default value
|
12865
|
-
return state.objectMode ? 16 : 16 * 1024;
|
12866
|
-
}
|
12867
|
-
state = {
|
12868
|
-
getHighWaterMark
|
12869
|
-
};
|
12870
|
-
return state;
|
12825
|
+
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
12826
|
+
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12827
|
+
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12871
12828
|
}
|
12829
|
+
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12830
|
+
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12831
|
+
if (hwm != null) {
|
12832
|
+
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12833
|
+
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12834
|
+
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12835
|
+
}
|
12836
|
+
return Math.floor(hwm);
|
12837
|
+
}
|
12872
12838
|
|
12873
|
-
|
12874
|
-
|
12839
|
+
// Default value
|
12840
|
+
return state.objectMode ? 16 : 16 * 1024;
|
12841
|
+
}
|
12842
|
+
var state = {
|
12843
|
+
getHighWaterMark
|
12844
|
+
};
|
12875
12845
|
|
12876
|
-
|
12877
|
-
|
12878
|
-
|
12879
|
-
/**
|
12880
|
-
* Module exports.
|
12881
|
-
*/
|
12846
|
+
/**
|
12847
|
+
* Module exports.
|
12848
|
+
*/
|
12882
12849
|
|
12883
|
-
|
12850
|
+
var browser$b = deprecate$1;
|
12884
12851
|
|
12885
|
-
|
12886
|
-
|
12887
|
-
|
12888
|
-
|
12889
|
-
|
12890
|
-
|
12891
|
-
|
12892
|
-
|
12893
|
-
|
12894
|
-
|
12895
|
-
|
12896
|
-
|
12897
|
-
|
12898
|
-
|
12899
|
-
|
12900
|
-
|
12901
|
-
|
12852
|
+
/**
|
12853
|
+
* Mark that a method should not be used.
|
12854
|
+
* Returns a modified function which warns once by default.
|
12855
|
+
*
|
12856
|
+
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
12857
|
+
*
|
12858
|
+
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
12859
|
+
* will throw an Error when invoked.
|
12860
|
+
*
|
12861
|
+
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
12862
|
+
* will invoke `console.trace()` instead of `console.error()`.
|
12863
|
+
*
|
12864
|
+
* @param {Function} fn - the function to deprecate
|
12865
|
+
* @param {String} msg - the string to print to the console when `fn` is invoked
|
12866
|
+
* @returns {Function} a new "deprecated" version of `fn`
|
12867
|
+
* @api public
|
12868
|
+
*/
|
12902
12869
|
|
12903
|
-
|
12904
|
-
|
12905
|
-
|
12906
|
-
|
12870
|
+
function deprecate$1 (fn, msg) {
|
12871
|
+
if (config('noDeprecation')) {
|
12872
|
+
return fn;
|
12873
|
+
}
|
12907
12874
|
|
12908
|
-
|
12909
|
-
|
12910
|
-
|
12911
|
-
|
12912
|
-
|
12913
|
-
|
12914
|
-
|
12915
|
-
|
12916
|
-
|
12917
|
-
|
12918
|
-
|
12919
|
-
|
12920
|
-
|
12921
|
-
|
12875
|
+
var warned = false;
|
12876
|
+
function deprecated() {
|
12877
|
+
if (!warned) {
|
12878
|
+
if (config('throwDeprecation')) {
|
12879
|
+
throw new Error(msg);
|
12880
|
+
} else if (config('traceDeprecation')) {
|
12881
|
+
console.trace(msg);
|
12882
|
+
} else {
|
12883
|
+
console.warn(msg);
|
12884
|
+
}
|
12885
|
+
warned = true;
|
12886
|
+
}
|
12887
|
+
return fn.apply(this, arguments);
|
12888
|
+
}
|
12922
12889
|
|
12923
|
-
|
12924
|
-
|
12890
|
+
return deprecated;
|
12891
|
+
}
|
12925
12892
|
|
12926
|
-
|
12927
|
-
|
12928
|
-
|
12929
|
-
|
12930
|
-
|
12931
|
-
|
12932
|
-
|
12893
|
+
/**
|
12894
|
+
* Checks `localStorage` for boolean values for the given `name`.
|
12895
|
+
*
|
12896
|
+
* @param {String} name
|
12897
|
+
* @returns {Boolean}
|
12898
|
+
* @api private
|
12899
|
+
*/
|
12933
12900
|
|
12934
|
-
|
12935
|
-
|
12936
|
-
|
12937
|
-
|
12938
|
-
|
12939
|
-
|
12940
|
-
|
12941
|
-
|
12942
|
-
|
12943
|
-
|
12944
|
-
}
|
12945
|
-
return browser$b;
|
12901
|
+
function config (name) {
|
12902
|
+
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
12903
|
+
try {
|
12904
|
+
if (!commonjsGlobal.localStorage) return false;
|
12905
|
+
} catch (_) {
|
12906
|
+
return false;
|
12907
|
+
}
|
12908
|
+
var val = commonjsGlobal.localStorage[name];
|
12909
|
+
if (null == val) return false;
|
12910
|
+
return String(val).toLowerCase() === 'true';
|
12946
12911
|
}
|
12947
12912
|
|
12948
12913
|
var _stream_writable;
|
@@ -12973,12 +12938,12 @@ function require_stream_writable () {
|
|
12973
12938
|
|
12974
12939
|
/*<replacement>*/
|
12975
12940
|
const internalUtil = {
|
12976
|
-
deprecate:
|
12941
|
+
deprecate: browser$b
|
12977
12942
|
};
|
12978
12943
|
/*</replacement>*/
|
12979
12944
|
|
12980
12945
|
/*<replacement>*/
|
12981
|
-
var Stream =
|
12946
|
+
var Stream = streamBrowser;
|
12982
12947
|
/*</replacement>*/
|
12983
12948
|
|
12984
12949
|
const Buffer = require$$6$1.Buffer;
|
@@ -12989,8 +12954,8 @@ function require_stream_writable () {
|
|
12989
12954
|
function _isUint8Array(obj) {
|
12990
12955
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
12991
12956
|
}
|
12992
|
-
const destroyImpl =
|
12993
|
-
const _require =
|
12957
|
+
const destroyImpl = destroy_1;
|
12958
|
+
const _require = state,
|
12994
12959
|
getHighWaterMark = _require.getHighWaterMark;
|
12995
12960
|
const _require$codes = errorsBrowser.codes,
|
12996
12961
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -14184,7 +14149,7 @@ function require_stream_readable () {
|
|
14184
14149
|
/*</replacement>*/
|
14185
14150
|
|
14186
14151
|
/*<replacement>*/
|
14187
|
-
var Stream =
|
14152
|
+
var Stream = streamBrowser;
|
14188
14153
|
/*</replacement>*/
|
14189
14154
|
|
14190
14155
|
const Buffer = require$$6$1.Buffer;
|
@@ -14207,8 +14172,8 @@ function require_stream_readable () {
|
|
14207
14172
|
/*</replacement>*/
|
14208
14173
|
|
14209
14174
|
const BufferList = requireBuffer_list();
|
14210
|
-
const destroyImpl =
|
14211
|
-
const _require =
|
14175
|
+
const destroyImpl = destroy_1;
|
14176
|
+
const _require = state,
|
14212
14177
|
getHighWaterMark = _require.getHighWaterMark;
|
14213
14178
|
const _require$codes = errorsBrowser.codes,
|
14214
14179
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -17574,7 +17539,7 @@ function WriteReq(chunk, encoding, cb) {
|
|
17574
17539
|
|
17575
17540
|
function WritableState(options, stream) {
|
17576
17541
|
Object.defineProperty(this, 'buffer', {
|
17577
|
-
get: deprecate$
|
17542
|
+
get: deprecate$2(function () {
|
17578
17543
|
return this.getBuffer();
|
17579
17544
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
17580
17545
|
});
|
@@ -39250,9 +39215,9 @@ function loadSync (filename) {
|
|
39250
39215
|
}
|
39251
39216
|
|
39252
39217
|
async function writeSync (fullpath, stringValue) {
|
39253
|
-
await promises.mkdir(dirname(fullpath), { recursive: true });
|
39218
|
+
await fs.promises.mkdir(dirname(fullpath), { recursive: true });
|
39254
39219
|
// writeFileSync(fullpath, stringValue)
|
39255
|
-
await promises.writeFile(fullpath, stringValue);
|
39220
|
+
await fs.promises.writeFile(fullpath, stringValue);
|
39256
39221
|
}
|
39257
39222
|
|
39258
39223
|
/**
|