@fireproof/core 0.7.0-alpha.4 → 0.7.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/dist/fireproof.js +4 -2
- package/dist/loader.js +3 -13
- package/dist/src/fireproof.d.ts +5 -116
- package/dist/src/fireproof.js +224 -400
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +229 -405
- package/dist/src/fireproof.mjs.map +1 -1
- package/package.json +1 -1
- package/src/fireproof.js +4 -2
- package/src/loader.js +4 -14
package/dist/src/fireproof.mjs
CHANGED
@@ -3,7 +3,7 @@ import https from 'node:https';
|
|
3
3
|
import zlib from 'node:zlib';
|
4
4
|
import Stream$1, { PassThrough as PassThrough$2, pipeline as pipeline$2 } from 'node:stream';
|
5
5
|
import { Buffer as Buffer$H } from 'node:buffer';
|
6
|
-
import { types, promisify as promisify$1, deprecate as deprecate$
|
6
|
+
import { types, promisify as promisify$1, deprecate as deprecate$2 } from 'node:util';
|
7
7
|
import { format as format$2 } from 'node:url';
|
8
8
|
import { isIP } from 'node:net';
|
9
9
|
import 'node:fs';
|
@@ -11483,7 +11483,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
11483
11483
|
|
11484
11484
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
11485
11485
|
|
11486
|
-
var streamBrowser
|
11486
|
+
var streamBrowser;
|
11487
|
+
var hasRequiredStreamBrowser;
|
11488
|
+
|
11489
|
+
function requireStreamBrowser () {
|
11490
|
+
if (hasRequiredStreamBrowser) return streamBrowser;
|
11491
|
+
hasRequiredStreamBrowser = 1;
|
11492
|
+
streamBrowser = require$$0$1.EventEmitter;
|
11493
|
+
return streamBrowser;
|
11494
|
+
}
|
11487
11495
|
|
11488
11496
|
// shim for using process in browser
|
11489
11497
|
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
@@ -11626,7 +11634,7 @@ var argv = [];
|
|
11626
11634
|
var version$2 = ''; // empty string to avoid regexp issues
|
11627
11635
|
var versions = {};
|
11628
11636
|
var release = {};
|
11629
|
-
var config
|
11637
|
+
var config = {};
|
11630
11638
|
|
11631
11639
|
function noop$3() {}
|
11632
11640
|
|
@@ -11703,7 +11711,7 @@ var browser$1$1 = {
|
|
11703
11711
|
hrtime: hrtime,
|
11704
11712
|
platform: platform,
|
11705
11713
|
release: release,
|
11706
|
-
config: config
|
11714
|
+
config: config,
|
11707
11715
|
uptime: uptime
|
11708
11716
|
};
|
11709
11717
|
|
@@ -11784,11 +11792,11 @@ function format(f) {
|
|
11784
11792
|
// Mark that a method should not be used.
|
11785
11793
|
// Returns a modified function which warns once by default.
|
11786
11794
|
// If --no-deprecation is set, then it is a no-op.
|
11787
|
-
function deprecate$
|
11795
|
+
function deprecate$1(fn, msg) {
|
11788
11796
|
// Allow for deprecating things in the process of starting up.
|
11789
11797
|
if (isUndefined(global$1.process)) {
|
11790
11798
|
return function() {
|
11791
|
-
return deprecate$
|
11799
|
+
return deprecate$1(fn, msg).apply(this, arguments);
|
11792
11800
|
};
|
11793
11801
|
}
|
11794
11802
|
|
@@ -12397,7 +12405,7 @@ var _polyfillNode_util = {
|
|
12397
12405
|
isBoolean: isBoolean,
|
12398
12406
|
isArray: isArray,
|
12399
12407
|
inspect: inspect,
|
12400
|
-
deprecate: deprecate$
|
12408
|
+
deprecate: deprecate$1,
|
12401
12409
|
format: format,
|
12402
12410
|
debuglog: debuglog,
|
12403
12411
|
promisify: promisify,
|
@@ -12410,7 +12418,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
12410
12418
|
callbackify: callbackify,
|
12411
12419
|
debuglog: debuglog,
|
12412
12420
|
default: _polyfillNode_util,
|
12413
|
-
deprecate: deprecate$
|
12421
|
+
deprecate: deprecate$1,
|
12414
12422
|
format: format,
|
12415
12423
|
inherits: inherits$w,
|
12416
12424
|
inspect: inspect,
|
@@ -12598,99 +12606,108 @@ function requireBuffer_list () {
|
|
12598
12606
|
return buffer_list;
|
12599
12607
|
}
|
12600
12608
|
|
12601
|
-
|
12602
|
-
|
12603
|
-
|
12604
|
-
|
12605
|
-
|
12606
|
-
|
12607
|
-
|
12608
|
-
|
12609
|
-
|
12610
|
-
|
12611
|
-
|
12612
|
-
|
12613
|
-
|
12614
|
-
|
12615
|
-
|
12616
|
-
|
12617
|
-
|
12609
|
+
var destroy_1;
|
12610
|
+
var hasRequiredDestroy;
|
12611
|
+
|
12612
|
+
function requireDestroy () {
|
12613
|
+
if (hasRequiredDestroy) return destroy_1;
|
12614
|
+
hasRequiredDestroy = 1;
|
12615
|
+
|
12616
|
+
// undocumented cb() API, needed for core, not for public API
|
12617
|
+
function destroy(err, cb) {
|
12618
|
+
const readableDestroyed = this._readableState && this._readableState.destroyed;
|
12619
|
+
const writableDestroyed = this._writableState && this._writableState.destroyed;
|
12620
|
+
if (readableDestroyed || writableDestroyed) {
|
12621
|
+
if (cb) {
|
12622
|
+
cb(err);
|
12623
|
+
} else if (err) {
|
12624
|
+
if (!this._writableState) {
|
12625
|
+
process.nextTick(emitErrorNT, this, err);
|
12626
|
+
} else if (!this._writableState.errorEmitted) {
|
12627
|
+
this._writableState.errorEmitted = true;
|
12628
|
+
process.nextTick(emitErrorNT, this, err);
|
12629
|
+
}
|
12630
|
+
}
|
12631
|
+
return this;
|
12632
|
+
}
|
12618
12633
|
|
12619
|
-
|
12620
|
-
|
12634
|
+
// we set destroyed to true before firing error callbacks in order
|
12635
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
12621
12636
|
|
12622
|
-
|
12623
|
-
|
12624
|
-
|
12625
|
-
|
12626
|
-
// if this is a duplex stream mark the writable part as destroyed as well
|
12627
|
-
if (this._writableState) {
|
12628
|
-
this._writableState.destroyed = true;
|
12629
|
-
}
|
12630
|
-
this._destroy(err || null, err => {
|
12631
|
-
if (!cb && err) {
|
12632
|
-
if (!this._writableState) {
|
12633
|
-
process.nextTick(emitErrorAndCloseNT, this, err);
|
12634
|
-
} else if (!this._writableState.errorEmitted) {
|
12635
|
-
this._writableState.errorEmitted = true;
|
12636
|
-
process.nextTick(emitErrorAndCloseNT, this, err);
|
12637
|
-
} else {
|
12638
|
-
process.nextTick(emitCloseNT, this);
|
12639
|
-
}
|
12640
|
-
} else if (cb) {
|
12641
|
-
process.nextTick(emitCloseNT, this);
|
12642
|
-
cb(err);
|
12643
|
-
} else {
|
12644
|
-
process.nextTick(emitCloseNT, this);
|
12645
|
-
}
|
12646
|
-
});
|
12647
|
-
return this;
|
12648
|
-
}
|
12649
|
-
function emitErrorAndCloseNT(self, err) {
|
12650
|
-
emitErrorNT(self, err);
|
12651
|
-
emitCloseNT(self);
|
12652
|
-
}
|
12653
|
-
function emitCloseNT(self) {
|
12654
|
-
if (self._writableState && !self._writableState.emitClose) return;
|
12655
|
-
if (self._readableState && !self._readableState.emitClose) return;
|
12656
|
-
self.emit('close');
|
12657
|
-
}
|
12658
|
-
function undestroy() {
|
12659
|
-
if (this._readableState) {
|
12660
|
-
this._readableState.destroyed = false;
|
12661
|
-
this._readableState.reading = false;
|
12662
|
-
this._readableState.ended = false;
|
12663
|
-
this._readableState.endEmitted = false;
|
12664
|
-
}
|
12665
|
-
if (this._writableState) {
|
12666
|
-
this._writableState.destroyed = false;
|
12667
|
-
this._writableState.ended = false;
|
12668
|
-
this._writableState.ending = false;
|
12669
|
-
this._writableState.finalCalled = false;
|
12670
|
-
this._writableState.prefinished = false;
|
12671
|
-
this._writableState.finished = false;
|
12672
|
-
this._writableState.errorEmitted = false;
|
12673
|
-
}
|
12674
|
-
}
|
12675
|
-
function emitErrorNT(self, err) {
|
12676
|
-
self.emit('error', err);
|
12677
|
-
}
|
12678
|
-
function errorOrDestroy(stream, err) {
|
12679
|
-
// We have tests that rely on errors being emitted
|
12680
|
-
// in the same tick, so changing this is semver major.
|
12681
|
-
// For now when you opt-in to autoDestroy we allow
|
12682
|
-
// the error to be emitted nextTick. In a future
|
12683
|
-
// semver major update we should change the default to this.
|
12637
|
+
if (this._readableState) {
|
12638
|
+
this._readableState.destroyed = true;
|
12639
|
+
}
|
12684
12640
|
|
12685
|
-
|
12686
|
-
|
12687
|
-
|
12641
|
+
// if this is a duplex stream mark the writable part as destroyed as well
|
12642
|
+
if (this._writableState) {
|
12643
|
+
this._writableState.destroyed = true;
|
12644
|
+
}
|
12645
|
+
this._destroy(err || null, err => {
|
12646
|
+
if (!cb && err) {
|
12647
|
+
if (!this._writableState) {
|
12648
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12649
|
+
} else if (!this._writableState.errorEmitted) {
|
12650
|
+
this._writableState.errorEmitted = true;
|
12651
|
+
process.nextTick(emitErrorAndCloseNT, this, err);
|
12652
|
+
} else {
|
12653
|
+
process.nextTick(emitCloseNT, this);
|
12654
|
+
}
|
12655
|
+
} else if (cb) {
|
12656
|
+
process.nextTick(emitCloseNT, this);
|
12657
|
+
cb(err);
|
12658
|
+
} else {
|
12659
|
+
process.nextTick(emitCloseNT, this);
|
12660
|
+
}
|
12661
|
+
});
|
12662
|
+
return this;
|
12663
|
+
}
|
12664
|
+
function emitErrorAndCloseNT(self, err) {
|
12665
|
+
emitErrorNT(self, err);
|
12666
|
+
emitCloseNT(self);
|
12667
|
+
}
|
12668
|
+
function emitCloseNT(self) {
|
12669
|
+
if (self._writableState && !self._writableState.emitClose) return;
|
12670
|
+
if (self._readableState && !self._readableState.emitClose) return;
|
12671
|
+
self.emit('close');
|
12672
|
+
}
|
12673
|
+
function undestroy() {
|
12674
|
+
if (this._readableState) {
|
12675
|
+
this._readableState.destroyed = false;
|
12676
|
+
this._readableState.reading = false;
|
12677
|
+
this._readableState.ended = false;
|
12678
|
+
this._readableState.endEmitted = false;
|
12679
|
+
}
|
12680
|
+
if (this._writableState) {
|
12681
|
+
this._writableState.destroyed = false;
|
12682
|
+
this._writableState.ended = false;
|
12683
|
+
this._writableState.ending = false;
|
12684
|
+
this._writableState.finalCalled = false;
|
12685
|
+
this._writableState.prefinished = false;
|
12686
|
+
this._writableState.finished = false;
|
12687
|
+
this._writableState.errorEmitted = false;
|
12688
|
+
}
|
12689
|
+
}
|
12690
|
+
function emitErrorNT(self, err) {
|
12691
|
+
self.emit('error', err);
|
12692
|
+
}
|
12693
|
+
function errorOrDestroy(stream, err) {
|
12694
|
+
// We have tests that rely on errors being emitted
|
12695
|
+
// in the same tick, so changing this is semver major.
|
12696
|
+
// For now when you opt-in to autoDestroy we allow
|
12697
|
+
// the error to be emitted nextTick. In a future
|
12698
|
+
// semver major update we should change the default to this.
|
12699
|
+
|
12700
|
+
const rState = stream._readableState;
|
12701
|
+
const wState = stream._writableState;
|
12702
|
+
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
|
12703
|
+
}
|
12704
|
+
destroy_1 = {
|
12705
|
+
destroy,
|
12706
|
+
undestroy,
|
12707
|
+
errorOrDestroy
|
12708
|
+
};
|
12709
|
+
return destroy_1;
|
12688
12710
|
}
|
12689
|
-
var destroy_1 = {
|
12690
|
-
destroy,
|
12691
|
-
undestroy,
|
12692
|
-
errorOrDestroy
|
12693
|
-
};
|
12694
12711
|
|
12695
12712
|
var errorsBrowser = {};
|
12696
12713
|
|
@@ -12820,92 +12837,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
12820
12837
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
12821
12838
|
errorsBrowser.codes = codes;
|
12822
12839
|
|
12823
|
-
|
12824
|
-
|
12825
|
-
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12826
|
-
}
|
12827
|
-
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12828
|
-
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12829
|
-
if (hwm != null) {
|
12830
|
-
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12831
|
-
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12832
|
-
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12833
|
-
}
|
12834
|
-
return Math.floor(hwm);
|
12835
|
-
}
|
12840
|
+
var state;
|
12841
|
+
var hasRequiredState;
|
12836
12842
|
|
12837
|
-
|
12838
|
-
|
12843
|
+
function requireState () {
|
12844
|
+
if (hasRequiredState) return state;
|
12845
|
+
hasRequiredState = 1;
|
12846
|
+
|
12847
|
+
const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
|
12848
|
+
function highWaterMarkFrom(options, isDuplex, duplexKey) {
|
12849
|
+
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
|
12850
|
+
}
|
12851
|
+
function getHighWaterMark(state, options, duplexKey, isDuplex) {
|
12852
|
+
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
|
12853
|
+
if (hwm != null) {
|
12854
|
+
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
|
12855
|
+
const name = isDuplex ? duplexKey : 'highWaterMark';
|
12856
|
+
throw new ERR_INVALID_OPT_VALUE(name, hwm);
|
12857
|
+
}
|
12858
|
+
return Math.floor(hwm);
|
12859
|
+
}
|
12860
|
+
|
12861
|
+
// Default value
|
12862
|
+
return state.objectMode ? 16 : 16 * 1024;
|
12863
|
+
}
|
12864
|
+
state = {
|
12865
|
+
getHighWaterMark
|
12866
|
+
};
|
12867
|
+
return state;
|
12839
12868
|
}
|
12840
|
-
var state = {
|
12841
|
-
getHighWaterMark
|
12842
|
-
};
|
12843
12869
|
|
12844
|
-
|
12845
|
-
|
12846
|
-
*/
|
12870
|
+
var browser$b;
|
12871
|
+
var hasRequiredBrowser$3;
|
12847
12872
|
|
12848
|
-
|
12873
|
+
function requireBrowser$3 () {
|
12874
|
+
if (hasRequiredBrowser$3) return browser$b;
|
12875
|
+
hasRequiredBrowser$3 = 1;
|
12876
|
+
/**
|
12877
|
+
* Module exports.
|
12878
|
+
*/
|
12849
12879
|
|
12850
|
-
|
12851
|
-
* Mark that a method should not be used.
|
12852
|
-
* Returns a modified function which warns once by default.
|
12853
|
-
*
|
12854
|
-
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
12855
|
-
*
|
12856
|
-
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
12857
|
-
* will throw an Error when invoked.
|
12858
|
-
*
|
12859
|
-
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
12860
|
-
* will invoke `console.trace()` instead of `console.error()`.
|
12861
|
-
*
|
12862
|
-
* @param {Function} fn - the function to deprecate
|
12863
|
-
* @param {String} msg - the string to print to the console when `fn` is invoked
|
12864
|
-
* @returns {Function} a new "deprecated" version of `fn`
|
12865
|
-
* @api public
|
12866
|
-
*/
|
12880
|
+
browser$b = deprecate;
|
12867
12881
|
|
12868
|
-
|
12869
|
-
|
12870
|
-
|
12871
|
-
|
12882
|
+
/**
|
12883
|
+
* Mark that a method should not be used.
|
12884
|
+
* Returns a modified function which warns once by default.
|
12885
|
+
*
|
12886
|
+
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
12887
|
+
*
|
12888
|
+
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
12889
|
+
* will throw an Error when invoked.
|
12890
|
+
*
|
12891
|
+
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
12892
|
+
* will invoke `console.trace()` instead of `console.error()`.
|
12893
|
+
*
|
12894
|
+
* @param {Function} fn - the function to deprecate
|
12895
|
+
* @param {String} msg - the string to print to the console when `fn` is invoked
|
12896
|
+
* @returns {Function} a new "deprecated" version of `fn`
|
12897
|
+
* @api public
|
12898
|
+
*/
|
12872
12899
|
|
12873
|
-
|
12874
|
-
|
12875
|
-
|
12876
|
-
|
12877
|
-
throw new Error(msg);
|
12878
|
-
} else if (config('traceDeprecation')) {
|
12879
|
-
console.trace(msg);
|
12880
|
-
} else {
|
12881
|
-
console.warn(msg);
|
12882
|
-
}
|
12883
|
-
warned = true;
|
12884
|
-
}
|
12885
|
-
return fn.apply(this, arguments);
|
12886
|
-
}
|
12900
|
+
function deprecate (fn, msg) {
|
12901
|
+
if (config('noDeprecation')) {
|
12902
|
+
return fn;
|
12903
|
+
}
|
12887
12904
|
|
12888
|
-
|
12889
|
-
|
12905
|
+
var warned = false;
|
12906
|
+
function deprecated() {
|
12907
|
+
if (!warned) {
|
12908
|
+
if (config('throwDeprecation')) {
|
12909
|
+
throw new Error(msg);
|
12910
|
+
} else if (config('traceDeprecation')) {
|
12911
|
+
console.trace(msg);
|
12912
|
+
} else {
|
12913
|
+
console.warn(msg);
|
12914
|
+
}
|
12915
|
+
warned = true;
|
12916
|
+
}
|
12917
|
+
return fn.apply(this, arguments);
|
12918
|
+
}
|
12890
12919
|
|
12891
|
-
|
12892
|
-
|
12893
|
-
*
|
12894
|
-
* @param {String} name
|
12895
|
-
* @returns {Boolean}
|
12896
|
-
* @api private
|
12897
|
-
*/
|
12920
|
+
return deprecated;
|
12921
|
+
}
|
12898
12922
|
|
12899
|
-
|
12900
|
-
|
12901
|
-
|
12902
|
-
|
12903
|
-
|
12904
|
-
|
12905
|
-
|
12906
|
-
|
12907
|
-
|
12908
|
-
|
12923
|
+
/**
|
12924
|
+
* Checks `localStorage` for boolean values for the given `name`.
|
12925
|
+
*
|
12926
|
+
* @param {String} name
|
12927
|
+
* @returns {Boolean}
|
12928
|
+
* @api private
|
12929
|
+
*/
|
12930
|
+
|
12931
|
+
function config (name) {
|
12932
|
+
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
|
12933
|
+
try {
|
12934
|
+
if (!commonjsGlobal.localStorage) return false;
|
12935
|
+
} catch (_) {
|
12936
|
+
return false;
|
12937
|
+
}
|
12938
|
+
var val = commonjsGlobal.localStorage[name];
|
12939
|
+
if (null == val) return false;
|
12940
|
+
return String(val).toLowerCase() === 'true';
|
12941
|
+
}
|
12942
|
+
return browser$b;
|
12909
12943
|
}
|
12910
12944
|
|
12911
12945
|
var _stream_writable;
|
@@ -12936,12 +12970,12 @@ function require_stream_writable () {
|
|
12936
12970
|
|
12937
12971
|
/*<replacement>*/
|
12938
12972
|
const internalUtil = {
|
12939
|
-
deprecate:
|
12973
|
+
deprecate: requireBrowser$3()
|
12940
12974
|
};
|
12941
12975
|
/*</replacement>*/
|
12942
12976
|
|
12943
12977
|
/*<replacement>*/
|
12944
|
-
var Stream =
|
12978
|
+
var Stream = requireStreamBrowser();
|
12945
12979
|
/*</replacement>*/
|
12946
12980
|
|
12947
12981
|
const Buffer = require$$6$1.Buffer;
|
@@ -12952,8 +12986,8 @@ function require_stream_writable () {
|
|
12952
12986
|
function _isUint8Array(obj) {
|
12953
12987
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
12954
12988
|
}
|
12955
|
-
const destroyImpl =
|
12956
|
-
const _require =
|
12989
|
+
const destroyImpl = requireDestroy();
|
12990
|
+
const _require = requireState(),
|
12957
12991
|
getHighWaterMark = _require.getHighWaterMark;
|
12958
12992
|
const _require$codes = errorsBrowser.codes,
|
12959
12993
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -14147,7 +14181,7 @@ function require_stream_readable () {
|
|
14147
14181
|
/*</replacement>*/
|
14148
14182
|
|
14149
14183
|
/*<replacement>*/
|
14150
|
-
var Stream =
|
14184
|
+
var Stream = requireStreamBrowser();
|
14151
14185
|
/*</replacement>*/
|
14152
14186
|
|
14153
14187
|
const Buffer = require$$6$1.Buffer;
|
@@ -14170,8 +14204,8 @@ function require_stream_readable () {
|
|
14170
14204
|
/*</replacement>*/
|
14171
14205
|
|
14172
14206
|
const BufferList = requireBuffer_list();
|
14173
|
-
const destroyImpl =
|
14174
|
-
const _require =
|
14207
|
+
const destroyImpl = requireDestroy();
|
14208
|
+
const _require = requireState(),
|
14175
14209
|
getHighWaterMark = _require.getHighWaterMark;
|
14176
14210
|
const _require$codes = errorsBrowser.codes,
|
14177
14211
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -17537,7 +17571,7 @@ function WriteReq(chunk, encoding, cb) {
|
|
17537
17571
|
|
17538
17572
|
function WritableState(options, stream) {
|
17539
17573
|
Object.defineProperty(this, 'buffer', {
|
17540
|
-
get: deprecate$
|
17574
|
+
get: deprecate$1(function () {
|
17541
17575
|
return this.getBuffer();
|
17542
17576
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
17543
17577
|
});
|
@@ -38950,7 +38984,7 @@ class VMemoryBlockstore {
|
|
38950
38984
|
}
|
38951
38985
|
}
|
38952
38986
|
|
38953
|
-
const defaultConfig$
|
38987
|
+
const defaultConfig$1 = {
|
38954
38988
|
headerKeyPrefix: 'fp.'
|
38955
38989
|
};
|
38956
38990
|
|
@@ -38958,7 +38992,7 @@ const defaultConfig$2 = {
|
|
38958
38992
|
|
38959
38993
|
class Browser extends Base {
|
38960
38994
|
constructor (name, config = {}) {
|
38961
|
-
super(name, Object.assign({}, defaultConfig$
|
38995
|
+
super(name, Object.assign({}, defaultConfig$1, config));
|
38962
38996
|
this.isBrowser = false;
|
38963
38997
|
try {
|
38964
38998
|
this.isBrowser = window.localStorage && true;
|
@@ -39015,209 +39049,6 @@ class Browser extends Base {
|
|
39015
39049
|
}
|
39016
39050
|
}
|
39017
39051
|
|
39018
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
39019
|
-
//
|
39020
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
39021
|
-
// copy of this software and associated documentation files (the
|
39022
|
-
// "Software"), to deal in the Software without restriction, including
|
39023
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
39024
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
39025
|
-
// persons to whom the Software is furnished to do so, subject to the
|
39026
|
-
// following conditions:
|
39027
|
-
//
|
39028
|
-
// The above copyright notice and this permission notice shall be included
|
39029
|
-
// in all copies or substantial portions of the Software.
|
39030
|
-
//
|
39031
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
39032
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
39033
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
39034
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
39035
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
39036
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
39037
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
39038
|
-
|
39039
|
-
// resolves . and .. elements in a path array with directory names there
|
39040
|
-
// must be no slashes, empty elements, or device names (c:\) in the array
|
39041
|
-
// (so also no leading and trailing slashes - it does not distinguish
|
39042
|
-
// relative and absolute paths)
|
39043
|
-
function normalizeArray(parts, allowAboveRoot) {
|
39044
|
-
// if the path tries to go above the root, `up` ends up > 0
|
39045
|
-
var up = 0;
|
39046
|
-
for (var i = parts.length - 1; i >= 0; i--) {
|
39047
|
-
var last = parts[i];
|
39048
|
-
if (last === '.') {
|
39049
|
-
parts.splice(i, 1);
|
39050
|
-
} else if (last === '..') {
|
39051
|
-
parts.splice(i, 1);
|
39052
|
-
up++;
|
39053
|
-
} else if (up) {
|
39054
|
-
parts.splice(i, 1);
|
39055
|
-
up--;
|
39056
|
-
}
|
39057
|
-
}
|
39058
|
-
|
39059
|
-
// if the path is allowed to go above the root, restore leading ..s
|
39060
|
-
if (allowAboveRoot) {
|
39061
|
-
for (; up--; up) {
|
39062
|
-
parts.unshift('..');
|
39063
|
-
}
|
39064
|
-
}
|
39065
|
-
|
39066
|
-
return parts;
|
39067
|
-
}
|
39068
|
-
|
39069
|
-
// Split a filename into [root, dir, basename, ext], unix version
|
39070
|
-
// 'root' is just a slash, or nothing.
|
39071
|
-
var splitPathRe =
|
39072
|
-
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
39073
|
-
var splitPath = function(filename) {
|
39074
|
-
return splitPathRe.exec(filename).slice(1);
|
39075
|
-
};
|
39076
|
-
|
39077
|
-
// path.normalize(path)
|
39078
|
-
// posix version
|
39079
|
-
function normalize(path) {
|
39080
|
-
var isPathAbsolute = isAbsolute(path),
|
39081
|
-
trailingSlash = substr(path, -1) === '/';
|
39082
|
-
|
39083
|
-
// Normalize the path
|
39084
|
-
path = normalizeArray(filter(path.split('/'), function(p) {
|
39085
|
-
return !!p;
|
39086
|
-
}), !isPathAbsolute).join('/');
|
39087
|
-
|
39088
|
-
if (!path && !isPathAbsolute) {
|
39089
|
-
path = '.';
|
39090
|
-
}
|
39091
|
-
if (path && trailingSlash) {
|
39092
|
-
path += '/';
|
39093
|
-
}
|
39094
|
-
|
39095
|
-
return (isPathAbsolute ? '/' : '') + path;
|
39096
|
-
}
|
39097
|
-
// posix version
|
39098
|
-
function isAbsolute(path) {
|
39099
|
-
return path.charAt(0) === '/';
|
39100
|
-
}
|
39101
|
-
|
39102
|
-
// posix version
|
39103
|
-
function join() {
|
39104
|
-
var paths = Array.prototype.slice.call(arguments, 0);
|
39105
|
-
return normalize(filter(paths, function(p, index) {
|
39106
|
-
if (typeof p !== 'string') {
|
39107
|
-
throw new TypeError('Arguments to path.join must be strings');
|
39108
|
-
}
|
39109
|
-
return p;
|
39110
|
-
}).join('/'));
|
39111
|
-
}
|
39112
|
-
|
39113
|
-
function dirname(path) {
|
39114
|
-
var result = splitPath(path),
|
39115
|
-
root = result[0],
|
39116
|
-
dir = result[1];
|
39117
|
-
|
39118
|
-
if (!root && !dir) {
|
39119
|
-
// No dirname whatsoever
|
39120
|
-
return '.';
|
39121
|
-
}
|
39122
|
-
|
39123
|
-
if (dir) {
|
39124
|
-
// It has a dirname, strip trailing slash
|
39125
|
-
dir = dir.substr(0, dir.length - 1);
|
39126
|
-
}
|
39127
|
-
|
39128
|
-
return root + dir;
|
39129
|
-
}
|
39130
|
-
function filter (xs, f) {
|
39131
|
-
if (xs.filter) return xs.filter(f);
|
39132
|
-
var res = [];
|
39133
|
-
for (var i = 0; i < xs.length; i++) {
|
39134
|
-
if (f(xs[i], i, xs)) res.push(xs[i]);
|
39135
|
-
}
|
39136
|
-
return res;
|
39137
|
-
}
|
39138
|
-
|
39139
|
-
// String.prototype.substr - negative index don't work in IE8
|
39140
|
-
var substr = 'ab'.substr(-1) === 'b' ?
|
39141
|
-
function (str, start, len) { return str.substr(start, len) } :
|
39142
|
-
function (str, start, len) {
|
39143
|
-
if (start < 0) start = str.length + start;
|
39144
|
-
return str.substr(start, len);
|
39145
|
-
}
|
39146
|
-
;
|
39147
|
-
|
39148
|
-
function homedir(){
|
39149
|
-
return '$HOME'
|
39150
|
-
}
|
39151
|
-
|
39152
|
-
var fs = {};
|
39153
|
-
|
39154
|
-
const readFileSync = fs.readFileSync;
|
39155
|
-
|
39156
|
-
const defaultConfig$1 = {
|
39157
|
-
dataDir: join(homedir(), '.fireproof')
|
39158
|
-
};
|
39159
|
-
|
39160
|
-
class Filesystem extends Base {
|
39161
|
-
constructor (name, config = {}) {
|
39162
|
-
const mergedConfig = Object.assign({}, defaultConfig$1, config);
|
39163
|
-
// console.log('Filesystem', name, mergedConfig, header)
|
39164
|
-
super(name, mergedConfig);
|
39165
|
-
}
|
39166
|
-
|
39167
|
-
async writeCars (cars) {
|
39168
|
-
if (this.config.readonly) return
|
39169
|
-
const writes = [];
|
39170
|
-
for (const { cid, bytes } of cars) {
|
39171
|
-
const carFilename = join(this.config.dataDir, this.name, `${cid.toString()}.car`);
|
39172
|
-
// console.log('writeCars', carFilename)
|
39173
|
-
writes.push(writeSync(carFilename, bytes));
|
39174
|
-
}
|
39175
|
-
await Promise.all(writes);
|
39176
|
-
}
|
39177
|
-
|
39178
|
-
async readCar (carCid) {
|
39179
|
-
const carFilename = join(this.config.dataDir, this.name, `${carCid.toString()}.car`);
|
39180
|
-
const got = readFileSync(carFilename);
|
39181
|
-
// console.log('readCar', carFilename, got.constructor.name)
|
39182
|
-
return got
|
39183
|
-
}
|
39184
|
-
|
39185
|
-
loadHeader (branch = 'main') {
|
39186
|
-
const header = loadSync(this.headerFilename(branch));
|
39187
|
-
// console.log('fs getHeader', this.headerFilename(), header, typeof header)
|
39188
|
-
if (!header) return null
|
39189
|
-
return JSON.parse(header)
|
39190
|
-
}
|
39191
|
-
|
39192
|
-
async writeHeader (branch, header) {
|
39193
|
-
// console.log('saveHeader', this.isBrowser)
|
39194
|
-
if (this.config.readonly) return
|
39195
|
-
const pHeader = this.prepareHeader(header);
|
39196
|
-
// console.log('writeHeader fs', branch, pHeader)
|
39197
|
-
await writeSync(this.headerFilename(branch), pHeader);
|
39198
|
-
}
|
39199
|
-
|
39200
|
-
headerFilename (branch = 'main') {
|
39201
|
-
// console.log('headerFilename', this.config.dataDir, this.name)
|
39202
|
-
return join(this.config.dataDir, this.name, branch + '.json')
|
39203
|
-
}
|
39204
|
-
}
|
39205
|
-
|
39206
|
-
function loadSync (filename) {
|
39207
|
-
try {
|
39208
|
-
return readFileSync(filename, 'utf8').toString()
|
39209
|
-
} catch (error) {
|
39210
|
-
// console.log('error', error)
|
39211
|
-
return null
|
39212
|
-
}
|
39213
|
-
}
|
39214
|
-
|
39215
|
-
async function writeSync (fullpath, stringValue) {
|
39216
|
-
await fs.promises.mkdir(dirname(fullpath), { recursive: true });
|
39217
|
-
// writeFileSync(fullpath, stringValue)
|
39218
|
-
await fs.promises.writeFile(fullpath, stringValue);
|
39219
|
-
}
|
39220
|
-
|
39221
39052
|
/**
|
39222
39053
|
* Returns a `Buffer` instance from the given data URI `uri`.
|
39223
39054
|
*
|
@@ -44155,7 +43986,7 @@ class Body {
|
|
44155
43986
|
}
|
44156
43987
|
}
|
44157
43988
|
|
44158
|
-
Body.prototype.buffer = deprecate$
|
43989
|
+
Body.prototype.buffer = deprecate$2(Body.prototype.buffer, 'Please use \'response.arrayBuffer()\' instead of \'response.buffer()\'', 'node-fetch#buffer');
|
44159
43990
|
|
44160
43991
|
// In browsers, all properties are enumerable.
|
44161
43992
|
Object.defineProperties(Body.prototype, {
|
@@ -44165,7 +43996,7 @@ Object.defineProperties(Body.prototype, {
|
|
44165
43996
|
blob: {enumerable: true},
|
44166
43997
|
json: {enumerable: true},
|
44167
43998
|
text: {enumerable: true},
|
44168
|
-
data: {get: deprecate$
|
43999
|
+
data: {get: deprecate$2(() => {},
|
44169
44000
|
'data doesn\'t exist, use json(), text(), arrayBuffer(), or body instead',
|
44170
44001
|
'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}
|
44171
44002
|
});
|
@@ -44269,7 +44100,7 @@ const clone = (instance, highWaterMark) => {
|
|
44269
44100
|
return body;
|
44270
44101
|
};
|
44271
44102
|
|
44272
|
-
const getNonSpecFormDataBoundary = deprecate$
|
44103
|
+
const getNonSpecFormDataBoundary = deprecate$2(
|
44273
44104
|
body => body.getBoundary(),
|
44274
44105
|
'form-data doesn\'t follow the spec and requires special treatment. Use alternative package',
|
44275
44106
|
'https://github.com/node-fetch/node-fetch/issues/1167'
|
@@ -45186,7 +45017,7 @@ const isRequest = object => {
|
|
45186
45017
|
);
|
45187
45018
|
};
|
45188
45019
|
|
45189
|
-
const doBadDataWarn = deprecate$
|
45020
|
+
const doBadDataWarn = deprecate$2(() => {},
|
45190
45021
|
'.data is not a valid RequestInit property, use .body instead',
|
45191
45022
|
'https://github.com/node-fetch/node-fetch/issues/1000 (request)');
|
45192
45023
|
|
@@ -45941,26 +45772,17 @@ class Rest extends Base {
|
|
45941
45772
|
}
|
45942
45773
|
}
|
45943
45774
|
|
45944
|
-
const FORCE_IDB = typeof process !== 'undefined' && !!process.env?.FORCE_IDB;
|
45945
|
-
|
45946
|
-
/* global window */
|
45947
|
-
|
45948
45775
|
const Loader = {
|
45949
45776
|
appropriate: (name, config = {}) => {
|
45950
|
-
|
45951
|
-
|
45952
|
-
|
45953
|
-
} catch (e) {}
|
45777
|
+
if (config.StorageClass) {
|
45778
|
+
return new config.StorageClass(name, config)
|
45779
|
+
}
|
45954
45780
|
|
45955
45781
|
if (config.type === 'rest') {
|
45956
45782
|
return new Rest(name, config)
|
45957
45783
|
}
|
45958
45784
|
|
45959
|
-
|
45960
|
-
return new Browser(name, config)
|
45961
|
-
} else {
|
45962
|
-
return new Filesystem(name, config)
|
45963
|
-
}
|
45785
|
+
return new Browser(name, config)
|
45964
45786
|
}
|
45965
45787
|
};
|
45966
45788
|
|
@@ -50354,7 +50176,7 @@ class Fireproof {
|
|
50354
50176
|
clock: {
|
50355
50177
|
byId: byId ? parseCID(byId) : null,
|
50356
50178
|
byKey: byKey ? parseCID(byKey) : null,
|
50357
|
-
db:
|
50179
|
+
db: db && db.length > 0 ? db.map(c => parseCID(c)) : null
|
50358
50180
|
},
|
50359
50181
|
code,
|
50360
50182
|
name
|
@@ -50377,7 +50199,9 @@ class Fireproof {
|
|
50377
50199
|
|
50378
50200
|
const withBlocks = new Database(database.name);
|
50379
50201
|
withBlocks.blocks = database.blocks;
|
50380
|
-
withBlocks.
|
50202
|
+
withBlocks.ready.then(() => {
|
50203
|
+
withBlocks.clock = definition.clock.map(c => parseCID(c));
|
50204
|
+
});
|
50381
50205
|
|
50382
50206
|
const snappedDb = Fireproof.fromJSON(definition, null, withBlocks)
|
50383
50207
|
;[...database.indexes.values()].forEach(index => {
|