@fireproof/core 0.7.2-dev.6 → 0.7.2-dev.7
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 +229 -192
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +229 -192
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/base.js +14 -0
- package/dist/valet.js +0 -12
- package/package.json +1 -1
- package/src/storage/base.js +16 -0
- package/src/valet.js +0 -13
package/dist/src/fireproof.mjs
CHANGED
@@ -8198,7 +8198,15 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
8198
8198
|
|
8199
8199
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
8200
8200
|
|
8201
|
-
var streamBrowser
|
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
|
+
}
|
8202
8210
|
|
8203
8211
|
// shim for using process in browser
|
8204
8212
|
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
@@ -8341,7 +8349,7 @@ var argv = [];
|
|
8341
8349
|
var version$1 = ''; // empty string to avoid regexp issues
|
8342
8350
|
var versions = {};
|
8343
8351
|
var release = {};
|
8344
|
-
var config
|
8352
|
+
var config = {};
|
8345
8353
|
|
8346
8354
|
function noop$3() {}
|
8347
8355
|
|
@@ -8418,7 +8426,7 @@ var browser$1$1 = {
|
|
8418
8426
|
hrtime: hrtime,
|
8419
8427
|
platform: platform,
|
8420
8428
|
release: release,
|
8421
|
-
config: config
|
8429
|
+
config: config,
|
8422
8430
|
uptime: uptime
|
8423
8431
|
};
|
8424
8432
|
|
@@ -8499,11 +8507,11 @@ function format(f) {
|
|
8499
8507
|
// Mark that a method should not be used.
|
8500
8508
|
// Returns a modified function which warns once by default.
|
8501
8509
|
// If --no-deprecation is set, then it is a no-op.
|
8502
|
-
function deprecate
|
8510
|
+
function deprecate(fn, msg) {
|
8503
8511
|
// Allow for deprecating things in the process of starting up.
|
8504
8512
|
if (isUndefined(global$1.process)) {
|
8505
8513
|
return function() {
|
8506
|
-
return deprecate
|
8514
|
+
return deprecate(fn, msg).apply(this, arguments);
|
8507
8515
|
};
|
8508
8516
|
}
|
8509
8517
|
|
@@ -9112,7 +9120,7 @@ var _polyfillNode_util = {
|
|
9112
9120
|
isBoolean: isBoolean,
|
9113
9121
|
isArray: isArray,
|
9114
9122
|
inspect: inspect,
|
9115
|
-
deprecate: deprecate
|
9123
|
+
deprecate: deprecate,
|
9116
9124
|
format: format,
|
9117
9125
|
debuglog: debuglog,
|
9118
9126
|
promisify: promisify,
|
@@ -9125,7 +9133,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
9125
9133
|
callbackify: callbackify,
|
9126
9134
|
debuglog: debuglog,
|
9127
9135
|
default: _polyfillNode_util,
|
9128
|
-
deprecate: deprecate
|
9136
|
+
deprecate: deprecate,
|
9129
9137
|
format: format,
|
9130
9138
|
inherits: inherits$1,
|
9131
9139
|
inspect: inspect,
|
@@ -9313,99 +9321,108 @@ function requireBuffer_list () {
|
|
9313
9321
|
return buffer_list;
|
9314
9322
|
}
|
9315
9323
|
|
9316
|
-
|
9317
|
-
|
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
|
-
}
|
9324
|
+
var destroy_1;
|
9325
|
+
var hasRequiredDestroy;
|
9333
9326
|
|
9334
|
-
|
9335
|
-
|
9327
|
+
function requireDestroy () {
|
9328
|
+
if (hasRequiredDestroy) return destroy_1;
|
9329
|
+
hasRequiredDestroy = 1;
|
9336
9330
|
|
9337
|
-
|
9338
|
-
|
9339
|
-
|
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
|
+
}
|
9340
9348
|
|
9341
|
-
|
9342
|
-
|
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.
|
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
|
9399
9351
|
|
9400
|
-
|
9401
|
-
|
9402
|
-
|
9352
|
+
if (this._readableState) {
|
9353
|
+
this._readableState.destroyed = true;
|
9354
|
+
}
|
9355
|
+
|
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.
|
9414
|
+
|
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;
|
9403
9425
|
}
|
9404
|
-
var destroy_1 = {
|
9405
|
-
destroy,
|
9406
|
-
undestroy,
|
9407
|
-
errorOrDestroy
|
9408
|
-
};
|
9409
9426
|
|
9410
9427
|
var errorsBrowser = {};
|
9411
9428
|
|
@@ -9535,92 +9552,109 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
|
|
9535
9552
|
createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
|
9536
9553
|
errorsBrowser.codes = codes;
|
9537
9554
|
|
9538
|
-
|
9539
|
-
|
9540
|
-
|
9541
|
-
|
9542
|
-
|
9543
|
-
|
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
|
-
}
|
9555
|
+
var state;
|
9556
|
+
var hasRequiredState;
|
9557
|
+
|
9558
|
+
function requireState () {
|
9559
|
+
if (hasRequiredState) return state;
|
9560
|
+
hasRequiredState = 1;
|
9551
9561
|
|
9552
|
-
|
9553
|
-
|
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;
|
9554
9583
|
}
|
9555
|
-
var state = {
|
9556
|
-
getHighWaterMark
|
9557
|
-
};
|
9558
9584
|
|
9559
|
-
|
9560
|
-
|
9561
|
-
*/
|
9585
|
+
var browser$b;
|
9586
|
+
var hasRequiredBrowser$a;
|
9562
9587
|
|
9563
|
-
|
9588
|
+
function requireBrowser$a () {
|
9589
|
+
if (hasRequiredBrowser$a) return browser$b;
|
9590
|
+
hasRequiredBrowser$a = 1;
|
9591
|
+
/**
|
9592
|
+
* Module exports.
|
9593
|
+
*/
|
9564
9594
|
|
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
|
-
*/
|
9595
|
+
browser$b = deprecate;
|
9582
9596
|
|
9583
|
-
|
9584
|
-
|
9585
|
-
|
9586
|
-
|
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
|
+
*/
|
9587
9614
|
|
9588
|
-
|
9589
|
-
|
9590
|
-
|
9591
|
-
|
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
|
-
}
|
9615
|
+
function deprecate (fn, msg) {
|
9616
|
+
if (config('noDeprecation')) {
|
9617
|
+
return fn;
|
9618
|
+
}
|
9602
9619
|
|
9603
|
-
|
9604
|
-
|
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
|
+
}
|
9605
9634
|
|
9606
|
-
|
9607
|
-
|
9608
|
-
*
|
9609
|
-
* @param {String} name
|
9610
|
-
* @returns {Boolean}
|
9611
|
-
* @api private
|
9612
|
-
*/
|
9635
|
+
return deprecated;
|
9636
|
+
}
|
9613
9637
|
|
9614
|
-
|
9615
|
-
|
9616
|
-
|
9617
|
-
|
9618
|
-
|
9619
|
-
|
9620
|
-
|
9621
|
-
|
9622
|
-
|
9623
|
-
|
9638
|
+
/**
|
9639
|
+
* Checks `localStorage` for boolean values for the given `name`.
|
9640
|
+
*
|
9641
|
+
* @param {String} name
|
9642
|
+
* @returns {Boolean}
|
9643
|
+
* @api private
|
9644
|
+
*/
|
9645
|
+
|
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;
|
9624
9658
|
}
|
9625
9659
|
|
9626
9660
|
var _stream_writable;
|
@@ -9651,12 +9685,12 @@ function require_stream_writable () {
|
|
9651
9685
|
|
9652
9686
|
/*<replacement>*/
|
9653
9687
|
const internalUtil = {
|
9654
|
-
deprecate:
|
9688
|
+
deprecate: requireBrowser$a()
|
9655
9689
|
};
|
9656
9690
|
/*</replacement>*/
|
9657
9691
|
|
9658
9692
|
/*<replacement>*/
|
9659
|
-
var Stream =
|
9693
|
+
var Stream = requireStreamBrowser();
|
9660
9694
|
/*</replacement>*/
|
9661
9695
|
|
9662
9696
|
const Buffer = require$$6$1.Buffer;
|
@@ -9667,8 +9701,8 @@ function require_stream_writable () {
|
|
9667
9701
|
function _isUint8Array(obj) {
|
9668
9702
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
9669
9703
|
}
|
9670
|
-
const destroyImpl =
|
9671
|
-
const _require =
|
9704
|
+
const destroyImpl = requireDestroy();
|
9705
|
+
const _require = requireState(),
|
9672
9706
|
getHighWaterMark = _require.getHighWaterMark;
|
9673
9707
|
const _require$codes = errorsBrowser.codes,
|
9674
9708
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -10862,7 +10896,7 @@ function require_stream_readable () {
|
|
10862
10896
|
/*</replacement>*/
|
10863
10897
|
|
10864
10898
|
/*<replacement>*/
|
10865
|
-
var Stream =
|
10899
|
+
var Stream = requireStreamBrowser();
|
10866
10900
|
/*</replacement>*/
|
10867
10901
|
|
10868
10902
|
const Buffer = require$$6$1.Buffer;
|
@@ -10885,8 +10919,8 @@ function require_stream_readable () {
|
|
10885
10919
|
/*</replacement>*/
|
10886
10920
|
|
10887
10921
|
const BufferList = requireBuffer_list();
|
10888
|
-
const destroyImpl =
|
10889
|
-
const _require =
|
10922
|
+
const destroyImpl = requireDestroy();
|
10923
|
+
const _require = requireState(),
|
10890
10924
|
getHighWaterMark = _require.getHighWaterMark;
|
10891
10925
|
const _require$codes = errorsBrowser.codes,
|
10892
10926
|
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
@@ -14339,7 +14373,7 @@ function WriteReq(chunk, encoding, cb) {
|
|
14339
14373
|
|
14340
14374
|
function WritableState(options, stream) {
|
14341
14375
|
Object.defineProperty(this, 'buffer', {
|
14342
|
-
get: deprecate
|
14376
|
+
get: deprecate(function () {
|
14343
14377
|
return this.getBuffer();
|
14344
14378
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
14345
14379
|
});
|
@@ -38906,6 +38940,7 @@ class Base {
|
|
38906
38940
|
lastCid: clock[0],
|
38907
38941
|
get: cid => allBlocks.get(cid.toString())
|
38908
38942
|
};
|
38943
|
+
console.log('compact', this.instanceId, this.name, blocks.lastCid.toString(), dataCids.length);
|
38909
38944
|
await this.parkCar(blocks, dataCids);
|
38910
38945
|
}
|
38911
38946
|
|
@@ -39050,6 +39085,7 @@ class Base {
|
|
39050
39085
|
|
39051
39086
|
async mapForIPLDHashmapCarCid (carCid) {
|
39052
39087
|
// console.log('mapForIPLDHashmapCarCid', carCid)
|
39088
|
+
// todo why is this writeable?
|
39053
39089
|
const carMapReader = await this.getWriteableCarReader(carCid);
|
39054
39090
|
const indexNode = await load$1(carMapReader, carMapReader.root.cid, {
|
39055
39091
|
blockHasher: blockOpts$1.hasher,
|
@@ -39088,7 +39124,21 @@ class Base {
|
|
39088
39124
|
return combinedReader
|
39089
39125
|
}
|
39090
39126
|
|
39127
|
+
async xgetCarReader (carCid) {
|
39128
|
+
return this.getCarReaderImpl(carCid)
|
39129
|
+
}
|
39130
|
+
|
39131
|
+
carReaderCache = new Map()
|
39091
39132
|
async getCarReader (carCid) {
|
39133
|
+
if (this.carReaderCache.has(carCid)) {
|
39134
|
+
return this.carReaderCache.get(carCid)
|
39135
|
+
}
|
39136
|
+
const result = await this.getCarReaderImpl(carCid);
|
39137
|
+
this.carReaderCache.set(carCid, result);
|
39138
|
+
return result
|
39139
|
+
}
|
39140
|
+
|
39141
|
+
async getCarReaderImpl (carCid) {
|
39092
39142
|
carCid = carCid.toString();
|
39093
39143
|
const carBytes = await this.readCar(carCid);
|
39094
39144
|
// console.log('getCarReader', this.constructor.name, carCid, carBytes.length)
|
@@ -40079,19 +40129,6 @@ class Valet {
|
|
40079
40129
|
}
|
40080
40130
|
}
|
40081
40131
|
|
40082
|
-
// async compact() {
|
40083
|
-
// const carCids = []
|
40084
|
-
// // for await (const { cid } of this.valet.cids()) {
|
40085
|
-
// // yield { cid }
|
40086
|
-
// // }
|
40087
|
-
// // create a blockstore with all data
|
40088
|
-
// {
|
40089
|
-
// entries: () => syncCIDs.map(cid => ({ cid })),
|
40090
|
-
// get: async cid => await blocks.get(cid)
|
40091
|
-
// }
|
40092
|
-
// // park it
|
40093
|
-
// }
|
40094
|
-
|
40095
40132
|
/**
|
40096
40133
|
* Iterate over all blocks in the store.
|
40097
40134
|
*
|