@fireproof/core 0.7.0-alpha.6 → 0.7.0-alpha.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/loader.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Browser } from './storage/browser.js';
2
- // import { Rest } from './storage/rest.js'
2
+ import { Rest } from './storage/rest.js';
3
3
  export const Loader = {
4
4
  appropriate: (name, config = {}) => {
5
5
  if (config.StorageClass) {
6
6
  return new config.StorageClass(name, config);
7
7
  }
8
- // if (config.type === 'rest') {
9
- // return new Rest(name, config)
10
- // }
8
+ if (config.type === 'rest') {
9
+ return new Rest(name, config);
10
+ }
11
11
  return new Browser(name, config);
12
12
  }
13
13
  };
@@ -38977,7 +38977,7 @@ class VMemoryBlockstore {
38977
38977
  }
38978
38978
  }
38979
38979
 
38980
- const defaultConfig = {
38980
+ const defaultConfig$1 = {
38981
38981
  headerKeyPrefix: 'fp.'
38982
38982
  };
38983
38983
 
@@ -38985,7 +38985,7 @@ const defaultConfig = {
38985
38985
 
38986
38986
  class Browser extends Base {
38987
38987
  constructor (name, config = {}) {
38988
- super(name, Object.assign({}, defaultConfig, config));
38988
+ super(name, Object.assign({}, defaultConfig$1, config));
38989
38989
  this.isBrowser = false;
38990
38990
  try {
38991
38991
  this.isBrowser = window.localStorage && true;
@@ -39042,7 +39042,628 @@ class Browser extends Base {
39042
39042
  }
39043
39043
  }
39044
39044
 
39045
- // import { Rest } from './storage/rest.js'
39045
+ var browserPonyfillExports = {};
39046
+ var browserPonyfill = {
39047
+ get exports(){ return browserPonyfillExports; },
39048
+ set exports(v){ browserPonyfillExports = v; },
39049
+ };
39050
+
39051
+ (function (module, exports) {
39052
+ var global = typeof self !== 'undefined' ? self : commonjsGlobal;
39053
+ var __self__ = (function () {
39054
+ function F() {
39055
+ this.fetch = false;
39056
+ this.DOMException = global.DOMException;
39057
+ }
39058
+ F.prototype = global;
39059
+ return new F();
39060
+ })();
39061
+ (function(self) {
39062
+
39063
+ ((function (exports) {
39064
+
39065
+ var support = {
39066
+ searchParams: 'URLSearchParams' in self,
39067
+ iterable: 'Symbol' in self && 'iterator' in Symbol,
39068
+ blob:
39069
+ 'FileReader' in self &&
39070
+ 'Blob' in self &&
39071
+ (function() {
39072
+ try {
39073
+ new Blob();
39074
+ return true
39075
+ } catch (e) {
39076
+ return false
39077
+ }
39078
+ })(),
39079
+ formData: 'FormData' in self,
39080
+ arrayBuffer: 'ArrayBuffer' in self
39081
+ };
39082
+
39083
+ function isDataView(obj) {
39084
+ return obj && DataView.prototype.isPrototypeOf(obj)
39085
+ }
39086
+
39087
+ if (support.arrayBuffer) {
39088
+ var viewClasses = [
39089
+ '[object Int8Array]',
39090
+ '[object Uint8Array]',
39091
+ '[object Uint8ClampedArray]',
39092
+ '[object Int16Array]',
39093
+ '[object Uint16Array]',
39094
+ '[object Int32Array]',
39095
+ '[object Uint32Array]',
39096
+ '[object Float32Array]',
39097
+ '[object Float64Array]'
39098
+ ];
39099
+
39100
+ var isArrayBufferView =
39101
+ ArrayBuffer.isView ||
39102
+ function(obj) {
39103
+ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
39104
+ };
39105
+ }
39106
+
39107
+ function normalizeName(name) {
39108
+ if (typeof name !== 'string') {
39109
+ name = String(name);
39110
+ }
39111
+ if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
39112
+ throw new TypeError('Invalid character in header field name')
39113
+ }
39114
+ return name.toLowerCase()
39115
+ }
39116
+
39117
+ function normalizeValue(value) {
39118
+ if (typeof value !== 'string') {
39119
+ value = String(value);
39120
+ }
39121
+ return value
39122
+ }
39123
+
39124
+ // Build a destructive iterator for the value list
39125
+ function iteratorFor(items) {
39126
+ var iterator = {
39127
+ next: function() {
39128
+ var value = items.shift();
39129
+ return {done: value === undefined, value: value}
39130
+ }
39131
+ };
39132
+
39133
+ if (support.iterable) {
39134
+ iterator[Symbol.iterator] = function() {
39135
+ return iterator
39136
+ };
39137
+ }
39138
+
39139
+ return iterator
39140
+ }
39141
+
39142
+ function Headers(headers) {
39143
+ this.map = {};
39144
+
39145
+ if (headers instanceof Headers) {
39146
+ headers.forEach(function(value, name) {
39147
+ this.append(name, value);
39148
+ }, this);
39149
+ } else if (Array.isArray(headers)) {
39150
+ headers.forEach(function(header) {
39151
+ this.append(header[0], header[1]);
39152
+ }, this);
39153
+ } else if (headers) {
39154
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
39155
+ this.append(name, headers[name]);
39156
+ }, this);
39157
+ }
39158
+ }
39159
+
39160
+ Headers.prototype.append = function(name, value) {
39161
+ name = normalizeName(name);
39162
+ value = normalizeValue(value);
39163
+ var oldValue = this.map[name];
39164
+ this.map[name] = oldValue ? oldValue + ', ' + value : value;
39165
+ };
39166
+
39167
+ Headers.prototype['delete'] = function(name) {
39168
+ delete this.map[normalizeName(name)];
39169
+ };
39170
+
39171
+ Headers.prototype.get = function(name) {
39172
+ name = normalizeName(name);
39173
+ return this.has(name) ? this.map[name] : null
39174
+ };
39175
+
39176
+ Headers.prototype.has = function(name) {
39177
+ return this.map.hasOwnProperty(normalizeName(name))
39178
+ };
39179
+
39180
+ Headers.prototype.set = function(name, value) {
39181
+ this.map[normalizeName(name)] = normalizeValue(value);
39182
+ };
39183
+
39184
+ Headers.prototype.forEach = function(callback, thisArg) {
39185
+ for (var name in this.map) {
39186
+ if (this.map.hasOwnProperty(name)) {
39187
+ callback.call(thisArg, this.map[name], name, this);
39188
+ }
39189
+ }
39190
+ };
39191
+
39192
+ Headers.prototype.keys = function() {
39193
+ var items = [];
39194
+ this.forEach(function(value, name) {
39195
+ items.push(name);
39196
+ });
39197
+ return iteratorFor(items)
39198
+ };
39199
+
39200
+ Headers.prototype.values = function() {
39201
+ var items = [];
39202
+ this.forEach(function(value) {
39203
+ items.push(value);
39204
+ });
39205
+ return iteratorFor(items)
39206
+ };
39207
+
39208
+ Headers.prototype.entries = function() {
39209
+ var items = [];
39210
+ this.forEach(function(value, name) {
39211
+ items.push([name, value]);
39212
+ });
39213
+ return iteratorFor(items)
39214
+ };
39215
+
39216
+ if (support.iterable) {
39217
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
39218
+ }
39219
+
39220
+ function consumed(body) {
39221
+ if (body.bodyUsed) {
39222
+ return Promise.reject(new TypeError('Already read'))
39223
+ }
39224
+ body.bodyUsed = true;
39225
+ }
39226
+
39227
+ function fileReaderReady(reader) {
39228
+ return new Promise(function(resolve, reject) {
39229
+ reader.onload = function() {
39230
+ resolve(reader.result);
39231
+ };
39232
+ reader.onerror = function() {
39233
+ reject(reader.error);
39234
+ };
39235
+ })
39236
+ }
39237
+
39238
+ function readBlobAsArrayBuffer(blob) {
39239
+ var reader = new FileReader();
39240
+ var promise = fileReaderReady(reader);
39241
+ reader.readAsArrayBuffer(blob);
39242
+ return promise
39243
+ }
39244
+
39245
+ function readBlobAsText(blob) {
39246
+ var reader = new FileReader();
39247
+ var promise = fileReaderReady(reader);
39248
+ reader.readAsText(blob);
39249
+ return promise
39250
+ }
39251
+
39252
+ function readArrayBufferAsText(buf) {
39253
+ var view = new Uint8Array(buf);
39254
+ var chars = new Array(view.length);
39255
+
39256
+ for (var i = 0; i < view.length; i++) {
39257
+ chars[i] = String.fromCharCode(view[i]);
39258
+ }
39259
+ return chars.join('')
39260
+ }
39261
+
39262
+ function bufferClone(buf) {
39263
+ if (buf.slice) {
39264
+ return buf.slice(0)
39265
+ } else {
39266
+ var view = new Uint8Array(buf.byteLength);
39267
+ view.set(new Uint8Array(buf));
39268
+ return view.buffer
39269
+ }
39270
+ }
39271
+
39272
+ function Body() {
39273
+ this.bodyUsed = false;
39274
+
39275
+ this._initBody = function(body) {
39276
+ this._bodyInit = body;
39277
+ if (!body) {
39278
+ this._bodyText = '';
39279
+ } else if (typeof body === 'string') {
39280
+ this._bodyText = body;
39281
+ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
39282
+ this._bodyBlob = body;
39283
+ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
39284
+ this._bodyFormData = body;
39285
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
39286
+ this._bodyText = body.toString();
39287
+ } else if (support.arrayBuffer && support.blob && isDataView(body)) {
39288
+ this._bodyArrayBuffer = bufferClone(body.buffer);
39289
+ // IE 10-11 can't handle a DataView body.
39290
+ this._bodyInit = new Blob([this._bodyArrayBuffer]);
39291
+ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
39292
+ this._bodyArrayBuffer = bufferClone(body);
39293
+ } else {
39294
+ this._bodyText = body = Object.prototype.toString.call(body);
39295
+ }
39296
+
39297
+ if (!this.headers.get('content-type')) {
39298
+ if (typeof body === 'string') {
39299
+ this.headers.set('content-type', 'text/plain;charset=UTF-8');
39300
+ } else if (this._bodyBlob && this._bodyBlob.type) {
39301
+ this.headers.set('content-type', this._bodyBlob.type);
39302
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
39303
+ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
39304
+ }
39305
+ }
39306
+ };
39307
+
39308
+ if (support.blob) {
39309
+ this.blob = function() {
39310
+ var rejected = consumed(this);
39311
+ if (rejected) {
39312
+ return rejected
39313
+ }
39314
+
39315
+ if (this._bodyBlob) {
39316
+ return Promise.resolve(this._bodyBlob)
39317
+ } else if (this._bodyArrayBuffer) {
39318
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]))
39319
+ } else if (this._bodyFormData) {
39320
+ throw new Error('could not read FormData body as blob')
39321
+ } else {
39322
+ return Promise.resolve(new Blob([this._bodyText]))
39323
+ }
39324
+ };
39325
+
39326
+ this.arrayBuffer = function() {
39327
+ if (this._bodyArrayBuffer) {
39328
+ return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
39329
+ } else {
39330
+ return this.blob().then(readBlobAsArrayBuffer)
39331
+ }
39332
+ };
39333
+ }
39334
+
39335
+ this.text = function() {
39336
+ var rejected = consumed(this);
39337
+ if (rejected) {
39338
+ return rejected
39339
+ }
39340
+
39341
+ if (this._bodyBlob) {
39342
+ return readBlobAsText(this._bodyBlob)
39343
+ } else if (this._bodyArrayBuffer) {
39344
+ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
39345
+ } else if (this._bodyFormData) {
39346
+ throw new Error('could not read FormData body as text')
39347
+ } else {
39348
+ return Promise.resolve(this._bodyText)
39349
+ }
39350
+ };
39351
+
39352
+ if (support.formData) {
39353
+ this.formData = function() {
39354
+ return this.text().then(decode)
39355
+ };
39356
+ }
39357
+
39358
+ this.json = function() {
39359
+ return this.text().then(JSON.parse)
39360
+ };
39361
+
39362
+ return this
39363
+ }
39364
+
39365
+ // HTTP methods whose capitalization should be normalized
39366
+ var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
39367
+
39368
+ function normalizeMethod(method) {
39369
+ var upcased = method.toUpperCase();
39370
+ return methods.indexOf(upcased) > -1 ? upcased : method
39371
+ }
39372
+
39373
+ function Request(input, options) {
39374
+ options = options || {};
39375
+ var body = options.body;
39376
+
39377
+ if (input instanceof Request) {
39378
+ if (input.bodyUsed) {
39379
+ throw new TypeError('Already read')
39380
+ }
39381
+ this.url = input.url;
39382
+ this.credentials = input.credentials;
39383
+ if (!options.headers) {
39384
+ this.headers = new Headers(input.headers);
39385
+ }
39386
+ this.method = input.method;
39387
+ this.mode = input.mode;
39388
+ this.signal = input.signal;
39389
+ if (!body && input._bodyInit != null) {
39390
+ body = input._bodyInit;
39391
+ input.bodyUsed = true;
39392
+ }
39393
+ } else {
39394
+ this.url = String(input);
39395
+ }
39396
+
39397
+ this.credentials = options.credentials || this.credentials || 'same-origin';
39398
+ if (options.headers || !this.headers) {
39399
+ this.headers = new Headers(options.headers);
39400
+ }
39401
+ this.method = normalizeMethod(options.method || this.method || 'GET');
39402
+ this.mode = options.mode || this.mode || null;
39403
+ this.signal = options.signal || this.signal;
39404
+ this.referrer = null;
39405
+
39406
+ if ((this.method === 'GET' || this.method === 'HEAD') && body) {
39407
+ throw new TypeError('Body not allowed for GET or HEAD requests')
39408
+ }
39409
+ this._initBody(body);
39410
+ }
39411
+
39412
+ Request.prototype.clone = function() {
39413
+ return new Request(this, {body: this._bodyInit})
39414
+ };
39415
+
39416
+ function decode(body) {
39417
+ var form = new FormData();
39418
+ body
39419
+ .trim()
39420
+ .split('&')
39421
+ .forEach(function(bytes) {
39422
+ if (bytes) {
39423
+ var split = bytes.split('=');
39424
+ var name = split.shift().replace(/\+/g, ' ');
39425
+ var value = split.join('=').replace(/\+/g, ' ');
39426
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
39427
+ }
39428
+ });
39429
+ return form
39430
+ }
39431
+
39432
+ function parseHeaders(rawHeaders) {
39433
+ var headers = new Headers();
39434
+ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
39435
+ // https://tools.ietf.org/html/rfc7230#section-3.2
39436
+ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
39437
+ preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
39438
+ var parts = line.split(':');
39439
+ var key = parts.shift().trim();
39440
+ if (key) {
39441
+ var value = parts.join(':').trim();
39442
+ headers.append(key, value);
39443
+ }
39444
+ });
39445
+ return headers
39446
+ }
39447
+
39448
+ Body.call(Request.prototype);
39449
+
39450
+ function Response(bodyInit, options) {
39451
+ if (!options) {
39452
+ options = {};
39453
+ }
39454
+
39455
+ this.type = 'default';
39456
+ this.status = options.status === undefined ? 200 : options.status;
39457
+ this.ok = this.status >= 200 && this.status < 300;
39458
+ this.statusText = 'statusText' in options ? options.statusText : 'OK';
39459
+ this.headers = new Headers(options.headers);
39460
+ this.url = options.url || '';
39461
+ this._initBody(bodyInit);
39462
+ }
39463
+
39464
+ Body.call(Response.prototype);
39465
+
39466
+ Response.prototype.clone = function() {
39467
+ return new Response(this._bodyInit, {
39468
+ status: this.status,
39469
+ statusText: this.statusText,
39470
+ headers: new Headers(this.headers),
39471
+ url: this.url
39472
+ })
39473
+ };
39474
+
39475
+ Response.error = function() {
39476
+ var response = new Response(null, {status: 0, statusText: ''});
39477
+ response.type = 'error';
39478
+ return response
39479
+ };
39480
+
39481
+ var redirectStatuses = [301, 302, 303, 307, 308];
39482
+
39483
+ Response.redirect = function(url, status) {
39484
+ if (redirectStatuses.indexOf(status) === -1) {
39485
+ throw new RangeError('Invalid status code')
39486
+ }
39487
+
39488
+ return new Response(null, {status: status, headers: {location: url}})
39489
+ };
39490
+
39491
+ exports.DOMException = self.DOMException;
39492
+ try {
39493
+ new exports.DOMException();
39494
+ } catch (err) {
39495
+ exports.DOMException = function(message, name) {
39496
+ this.message = message;
39497
+ this.name = name;
39498
+ var error = Error(message);
39499
+ this.stack = error.stack;
39500
+ };
39501
+ exports.DOMException.prototype = Object.create(Error.prototype);
39502
+ exports.DOMException.prototype.constructor = exports.DOMException;
39503
+ }
39504
+
39505
+ function fetch(input, init) {
39506
+ return new Promise(function(resolve, reject) {
39507
+ var request = new Request(input, init);
39508
+
39509
+ if (request.signal && request.signal.aborted) {
39510
+ return reject(new exports.DOMException('Aborted', 'AbortError'))
39511
+ }
39512
+
39513
+ var xhr = new XMLHttpRequest();
39514
+
39515
+ function abortXhr() {
39516
+ xhr.abort();
39517
+ }
39518
+
39519
+ xhr.onload = function() {
39520
+ var options = {
39521
+ status: xhr.status,
39522
+ statusText: xhr.statusText,
39523
+ headers: parseHeaders(xhr.getAllResponseHeaders() || '')
39524
+ };
39525
+ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
39526
+ var body = 'response' in xhr ? xhr.response : xhr.responseText;
39527
+ resolve(new Response(body, options));
39528
+ };
39529
+
39530
+ xhr.onerror = function() {
39531
+ reject(new TypeError('Network request failed'));
39532
+ };
39533
+
39534
+ xhr.ontimeout = function() {
39535
+ reject(new TypeError('Network request failed'));
39536
+ };
39537
+
39538
+ xhr.onabort = function() {
39539
+ reject(new exports.DOMException('Aborted', 'AbortError'));
39540
+ };
39541
+
39542
+ xhr.open(request.method, request.url, true);
39543
+
39544
+ if (request.credentials === 'include') {
39545
+ xhr.withCredentials = true;
39546
+ } else if (request.credentials === 'omit') {
39547
+ xhr.withCredentials = false;
39548
+ }
39549
+
39550
+ if ('responseType' in xhr && support.blob) {
39551
+ xhr.responseType = 'blob';
39552
+ }
39553
+
39554
+ request.headers.forEach(function(value, name) {
39555
+ xhr.setRequestHeader(name, value);
39556
+ });
39557
+
39558
+ if (request.signal) {
39559
+ request.signal.addEventListener('abort', abortXhr);
39560
+
39561
+ xhr.onreadystatechange = function() {
39562
+ // DONE (success or failure)
39563
+ if (xhr.readyState === 4) {
39564
+ request.signal.removeEventListener('abort', abortXhr);
39565
+ }
39566
+ };
39567
+ }
39568
+
39569
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
39570
+ })
39571
+ }
39572
+
39573
+ fetch.polyfill = true;
39574
+
39575
+ if (!self.fetch) {
39576
+ self.fetch = fetch;
39577
+ self.Headers = Headers;
39578
+ self.Request = Request;
39579
+ self.Response = Response;
39580
+ }
39581
+
39582
+ exports.Headers = Headers;
39583
+ exports.Request = Request;
39584
+ exports.Response = Response;
39585
+ exports.fetch = fetch;
39586
+
39587
+ Object.defineProperty(exports, '__esModule', { value: true });
39588
+
39589
+ return exports;
39590
+
39591
+ }))({});
39592
+ })(__self__);
39593
+ __self__.fetch.ponyfill = true;
39594
+ // Remove "polyfill" property added by whatwg-fetch
39595
+ delete __self__.fetch.polyfill;
39596
+ // Choose between native implementation (global) or custom implementation (__self__)
39597
+ // var ctx = global.fetch ? global : __self__;
39598
+ var ctx = __self__; // this line disable service worker support temporarily
39599
+ exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
39600
+ exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
39601
+ exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
39602
+ exports.Headers = ctx.Headers;
39603
+ exports.Request = ctx.Request;
39604
+ exports.Response = ctx.Response;
39605
+ module.exports = exports;
39606
+ } (browserPonyfill, browserPonyfillExports));
39607
+
39608
+ var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfillExports);
39609
+
39610
+ const defaultConfig = {
39611
+ url: 'http://localhost:4000'
39612
+ };
39613
+
39614
+ class Rest extends Base {
39615
+ constructor (name, config = {}) {
39616
+ super(name, Object.assign({}, defaultConfig, config));
39617
+ // console.log('Rest', name, config)
39618
+ }
39619
+
39620
+ headerURL (branch = 'main') {
39621
+ return `${this.config.url}/${branch}.json`
39622
+ }
39623
+
39624
+ async writeCars (cars) {
39625
+ if (this.config.readonly) return
39626
+ for (const { cid, bytes } of cars) {
39627
+ const carURL = `${this.config.url}/${cid.toString()}.car`;
39628
+ const response = await fetch(carURL, {
39629
+ method: 'PUT',
39630
+ body: bytes,
39631
+ headers: { 'Content-Type': 'application/car' }
39632
+ });
39633
+ if (!response.ok) throw new Error(`An error occurred: ${response.statusText}`)
39634
+ }
39635
+ }
39636
+
39637
+ async readCar (carCid) {
39638
+ const carURL = `${this.config.url}/${carCid.toString()}.car`;
39639
+ const response = await fetch(carURL);
39640
+ if (!response.ok) throw new Error(`An error occurred: ${response.statusText}`)
39641
+ const got = await response.arrayBuffer();
39642
+ return new Uint8Array(got)
39643
+ }
39644
+
39645
+ async loadHeader (branch = 'main') {
39646
+ const response = await fetch(this.headerURL(branch));
39647
+ // console.log('rest getHeader', response.constructor.name)
39648
+ if (!response.ok) return null
39649
+ const got = await response.json();
39650
+ // console.log('rest getHeader', got)
39651
+ return got
39652
+ }
39653
+
39654
+ async writeHeader (branch, header) {
39655
+ if (this.config.readonly) return
39656
+ const pHeader = this.prepareHeader(header);
39657
+ // console.log('writeHeader rt', branch, pHeader)
39658
+
39659
+ const response = await fetch(this.headerURL(branch), {
39660
+ method: 'PUT',
39661
+ body: pHeader,
39662
+ headers: { 'Content-Type': 'application/json' }
39663
+ });
39664
+ if (!response.ok) throw new Error(`An error occurred: ${response.statusText}`)
39665
+ }
39666
+ }
39046
39667
 
39047
39668
  const Loader = {
39048
39669
  appropriate: (name, config = {}) => {
@@ -39050,9 +39671,9 @@ const Loader = {
39050
39671
  return new config.StorageClass(name, config)
39051
39672
  }
39052
39673
 
39053
- // if (config.type === 'rest') {
39054
- // return new Rest(name, config)
39055
- // }
39674
+ if (config.type === 'rest') {
39675
+ return new Rest(name, config)
39676
+ }
39056
39677
 
39057
39678
  return new Browser(name, config)
39058
39679
  }