indexeddbshim 10.1.0 → 11.0.0-beta.0

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.
@@ -1,7 +1,8 @@
1
- /*! indexeddbshim - v10.0.0 - 12/8/2022 */
1
+ /*! indexeddbshim - v10.1.0 - 1/7/2023 */
2
2
 
3
3
  'use strict';
4
4
 
5
+ var fs$1 = require('node:fs');
5
6
  var path = require('path');
6
7
  var customOpenDatabase = require('websql/custom/index.js');
7
8
 
@@ -57,7 +58,7 @@ function _asyncToGenerator(fn) {
57
58
  };
58
59
  }
59
60
  function _defineProperty$1(obj, key, value) {
60
- key = _toPropertyKey(key);
61
+ key = _toPropertyKey$1(key);
61
62
  if (key in obj) {
62
63
  Object.defineProperty(obj, key, {
63
64
  value: value,
@@ -80,7 +81,7 @@ function _toPrimitive(input, hint) {
80
81
  }
81
82
  return (hint === "string" ? String : Number)(input);
82
83
  }
83
- function _toPropertyKey(arg) {
84
+ function _toPropertyKey$1(arg) {
84
85
  var key = _toPrimitive(arg, "string");
85
86
  return typeof key === "symbol" ? key : String(key);
86
87
  }
@@ -2862,26 +2863,26 @@ function possiblyUpdateKeyGenerator(tx, store, key, successCb, sqlFailCb) {
2862
2863
 
2863
2864
  var Key = /*#__PURE__*/Object.freeze({
2864
2865
  __proto__: null,
2865
- encode: encode$1,
2866
- decode: decode$1,
2867
- roundTrip: roundTrip,
2866
+ assignCurrentNumber: assignCurrentNumber,
2867
+ checkKeyCouldBeInjectedIntoValue: checkKeyCouldBeInjectedIntoValue,
2868
2868
  convertKeyToValue: convertKeyToValue,
2869
- convertValueToKeyValueDecoded: convertValueToKeyValueDecoded,
2870
- convertValueToMultiEntryKeyDecoded: convertValueToMultiEntryKeyDecoded,
2871
2869
  convertValueToKey: convertValueToKey,
2872
- convertValueToMultiEntryKey: convertValueToMultiEntryKey,
2873
2870
  convertValueToKeyRethrowingAndIfInvalid: convertValueToKeyRethrowingAndIfInvalid,
2874
- extractKeyFromValueUsingKeyPath: extractKeyFromValueUsingKeyPath,
2871
+ convertValueToKeyValueDecoded: convertValueToKeyValueDecoded,
2872
+ convertValueToMultiEntryKey: convertValueToMultiEntryKey,
2873
+ convertValueToMultiEntryKeyDecoded: convertValueToMultiEntryKeyDecoded,
2874
+ decode: decode$1,
2875
+ encode: encode$1,
2875
2876
  evaluateKeyPathOnValue: evaluateKeyPathOnValue,
2877
+ extractKeyFromValueUsingKeyPath: extractKeyFromValueUsingKeyPath,
2876
2878
  extractKeyValueDecodedFromValueUsingKeyPath: extractKeyValueDecodedFromValueUsingKeyPath,
2877
- injectKeyIntoValueUsingKeyPath: injectKeyIntoValueUsingKeyPath,
2878
- checkKeyCouldBeInjectedIntoValue: checkKeyCouldBeInjectedIntoValue,
2879
- isMultiEntryMatch: isMultiEntryMatch,
2880
- isKeyInRange: isKeyInRange,
2881
2879
  findMultiEntryMatches: findMultiEntryMatches,
2882
- assignCurrentNumber: assignCurrentNumber,
2883
2880
  generateKeyForStore: generateKeyForStore,
2884
- possiblyUpdateKeyGenerator: possiblyUpdateKeyGenerator
2881
+ injectKeyIntoValueUsingKeyPath: injectKeyIntoValueUsingKeyPath,
2882
+ isKeyInRange: isKeyInRange,
2883
+ isMultiEntryMatch: isMultiEntryMatch,
2884
+ possiblyUpdateKeyGenerator: possiblyUpdateKeyGenerator,
2885
+ roundTrip: roundTrip
2885
2886
  });
2886
2887
 
2887
2888
  const readonlyProperties$4 = ['lower', 'upper', 'lowerOpen', 'upperOpen'];
@@ -3294,6 +3295,7 @@ IDBTransaction.prototype.__executeRequests = function () {
3294
3295
  // Do not set __active flag to false yet: https://github.com/w3c/IndexedDB/issues/87
3295
3296
  if (e.__legacyOutputDidListenersThrowError) {
3296
3297
  logError('Error', 'An error occurred in a success handler attached to request chain', e.__legacyOutputDidListenersThrowError); // We do nothing else with this error as per spec
3298
+ // me.__active = false;
3297
3299
  me.__abortTransaction(createDOMException('AbortError', 'A request was aborted (in user handler after success).'));
3298
3300
  return;
3299
3301
  }
@@ -3755,11 +3757,11 @@ function _objectSpread2(e) {
3755
3757
  return e;
3756
3758
  }
3757
3759
  function _typeof(e) {
3758
- return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
3760
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
3759
3761
  return typeof e;
3760
3762
  } : function (e) {
3761
3763
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
3762
- })(e);
3764
+ }, _typeof(e);
3763
3765
  }
3764
3766
  function _classCallCheck(e, t) {
3765
3767
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
@@ -3767,7 +3769,7 @@ function _classCallCheck(e, t) {
3767
3769
  function _defineProperties(e, t) {
3768
3770
  for (var r = 0; r < t.length; r++) {
3769
3771
  var n = t[r];
3770
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
3772
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, _toPropertyKey(n.key), n);
3771
3773
  }
3772
3774
  }
3773
3775
  function _createClass(e, t, r) {
@@ -3776,7 +3778,7 @@ function _createClass(e, t, r) {
3776
3778
  }), e;
3777
3779
  }
3778
3780
  function _defineProperty(e, t, r) {
3779
- return t in e ? Object.defineProperty(e, t, {
3781
+ return (t = _toPropertyKey(t)) in e ? Object.defineProperty(e, t, {
3780
3782
  value: r,
3781
3783
  enumerable: !0,
3782
3784
  configurable: !0,
@@ -3791,21 +3793,26 @@ function _slicedToArray(e, t) {
3791
3793
  if (null != r) {
3792
3794
  var n,
3793
3795
  a,
3794
- o = [],
3795
- i = !0,
3796
- c = !1;
3796
+ o,
3797
+ i,
3798
+ c = [],
3799
+ s = !0,
3800
+ u = !1;
3797
3801
  try {
3798
- for (r = r.call(e); !(i = (n = r.next()).done) && (o.push(n.value), !t || o.length !== t); i = !0);
3802
+ if (o = (r = r.call(e)).next, 0 === t) {
3803
+ if (Object(r) !== r) return;
3804
+ s = !1;
3805
+ } else for (; !(s = (n = o.call(r)).done) && (c.push(n.value), c.length !== t); s = !0);
3799
3806
  } catch (e) {
3800
- c = !0, a = e;
3807
+ u = !0, a = e;
3801
3808
  } finally {
3802
3809
  try {
3803
- i || null == r.return || r.return();
3810
+ if (!s && null != r.return && (i = r.return(), Object(i) !== i)) return;
3804
3811
  } finally {
3805
- if (c) throw a;
3812
+ if (u) throw a;
3806
3813
  }
3807
3814
  }
3808
- return o;
3815
+ return c;
3809
3816
  }
3810
3817
  }(e, t) || _unsupportedIterableToArray(e, t) || function _nonIterableRest() {
3811
3818
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
@@ -3823,6 +3830,19 @@ function _arrayLikeToArray(e, t) {
3823
3830
  for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
3824
3831
  return n;
3825
3832
  }
3833
+ function _toPropertyKey(e) {
3834
+ var t = function _toPrimitive(e, t) {
3835
+ if ("object" != typeof e || null === e) return e;
3836
+ var r = e[Symbol.toPrimitive];
3837
+ if (void 0 !== r) {
3838
+ var n = r.call(e, t || "default");
3839
+ if ("object" != typeof n) return n;
3840
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3841
+ }
3842
+ return ("string" === t ? String : Number)(e);
3843
+ }(e, "string");
3844
+ return "symbol" == typeof t ? t : String(t);
3845
+ }
3826
3846
  var e = _createClass(function TypesonPromise(e) {
3827
3847
  _classCallCheck(this, TypesonPromise), this.p = new Promise(e);
3828
3848
  });
@@ -3883,10 +3903,10 @@ function isObject(e) {
3883
3903
  return e && "object" === _typeof(e);
3884
3904
  }
3885
3905
  function escapeKeyPathComponent(e) {
3886
- return e.replace(/~/g, "~0").replace(/\./g, "~1");
3906
+ return e.replace(/''/g, "''''").replace(/^$/, "''").replace(/~/g, "~0").replace(/\./g, "~1");
3887
3907
  }
3888
3908
  function unescapeKeyPathComponent(e) {
3889
- return e.replace(/~1/g, ".").replace(/~0/g, "~");
3909
+ return e.replace(/~1/g, ".").replace(/~0/g, "~").replace(/^''$/, "").replace(/''''/g, "''");
3890
3910
  }
3891
3911
  function getByKeyPath(e, t) {
3892
3912
  if ("" === t) return e;
@@ -4111,14 +4131,14 @@ var u = function () {
4111
4131
  !0 === a && (y.push(r), p.push(t));
4112
4132
  }
4113
4133
  var _,
4114
- A = isPlainObject(r),
4115
- w = i(r),
4116
- j = (A || w) && (!l.plainObjectReplacers.length || s.replaced) || s.iterateIn ? r : replace(t, r, s, u, A || w, null, O);
4134
+ w = isPlainObject(r),
4135
+ A = i(r),
4136
+ j = (w || A) && (!l.plainObjectReplacers.length || s.replaced) || s.iterateIn ? r : replace(t, r, s, u, w || A, null, O);
4117
4137
  if (j !== r ? (h = j, g = {
4118
4138
  replaced: j
4119
- }) : "" === t && hasConstructorOf(r, e) ? (u.push([t, r, a, s, void 0, void 0, s.type]), h = r) : w && "object" !== s.iterateIn || "array" === s.iterateIn ? (_ = new Array(r.length), g = {
4139
+ }) : "" === t && hasConstructorOf(r, e) ? (u.push([t, r, a, s, void 0, void 0, s.type]), h = r) : A && "object" !== s.iterateIn || "array" === s.iterateIn ? (_ = new Array(r.length), g = {
4120
4140
  clone: _
4121
- }) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !A && "object" !== s.iterateIn ? h = r : (_ = {}, s.addLength && (_.length = r.length), g = {
4141
+ }) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !w && "object" !== s.iterateIn ? h = r : (_ = {}, s.addLength && (_.length = r.length), g = {
4122
4142
  clone: _
4123
4143
  }), O && O(), n.iterateNone) return _ || h;
4124
4144
  if (!_) return h;
@@ -4482,7 +4502,7 @@ const O = {
4482
4502
  })
4483
4503
  }
4484
4504
  };
4485
- const A = {
4505
+ const w = {
4486
4506
  cryptokey: {
4487
4507
  test: e => "CryptoKey" === toStringTag(e) && e.extractable,
4488
4508
  replaceAsync: t => new e( /*#__PURE__*/function () {
@@ -4510,7 +4530,7 @@ const A = {
4510
4530
  }) => crypto.subtle.importKey("jwk", e, t, !0, r)
4511
4531
  }
4512
4532
  },
4513
- w = {
4533
+ A = {
4514
4534
  dataview: {
4515
4535
  test: e => "DataView" === toStringTag(e),
4516
4536
  replace({
@@ -4823,7 +4843,7 @@ const W = {
4823
4843
  }
4824
4844
  }],
4825
4845
  X = [K, x, L],
4826
- te = [G, W, H, D, X, j, M, E, C, P, N, O].concat("function" == typeof Map ? U : [], "function" == typeof Set ? J : [], "function" == typeof ArrayBuffer ? h : [], "function" == typeof Uint8Array ? q : [], "function" == typeof DataView ? w : [], "undefined" != typeof Intl ? B : [], "undefined" != typeof crypto ? A : [], "undefined" != typeof BigInt ? [m, g] : []);
4846
+ te = [G, W, H, D, X, j, M, E, C, P, N, O].concat("function" == typeof Map ? U : [], "function" == typeof Set ? J : [], "function" == typeof ArrayBuffer ? h : [], "function" == typeof Uint8Array ? q : [], "function" == typeof DataView ? A : [], "undefined" != typeof Intl ? B : [], "undefined" != typeof crypto ? w : [], "undefined" != typeof BigInt ? [m, g] : []);
4827
4847
  var re = te.concat({
4828
4848
  checkDataCloneException: {
4829
4849
  test(e) {
@@ -4877,9 +4897,9 @@ function clone(val) {
4877
4897
 
4878
4898
  var Sca = /*#__PURE__*/Object.freeze({
4879
4899
  __proto__: null,
4880
- encode: encode,
4881
- decode: decode,
4882
4900
  clone: clone,
4901
+ decode: decode,
4902
+ encode: encode,
4883
4903
  register: register
4884
4904
  });
4885
4905
 
@@ -6499,9 +6519,9 @@ Object.defineProperty(IDBDatabase, 'prototype', {
6499
6519
  });
6500
6520
 
6501
6521
  /* globals location */
6502
- let fs$1;
6522
+ let fs;
6503
6523
  const setFS = _fs => {
6504
- fs$1 = _fs;
6524
+ fs = _fs;
6505
6525
  };
6506
6526
  const getOrigin = () => {
6507
6527
  return typeof location !== 'object' || !location ? 'null' : location.origin;
@@ -6638,8 +6658,8 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
6638
6658
  });
6639
6659
  return;
6640
6660
  }
6641
- if (fs$1 && CFG.deleteDatabaseFiles !== false) {
6642
- fs$1.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), err => {
6661
+ if (fs && CFG.deleteDatabaseFiles !== false) {
6662
+ fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), err => {
6643
6663
  if (err && err.code !== 'ENOENT') {
6644
6664
  // Ignore if file is already deleted
6645
6665
  dbError({
@@ -8123,16 +8143,14 @@ function wrappedSQLiteDatabase(name) {
8123
8143
  }
8124
8144
  const nodeWebSQL = customOpenDatabase(wrappedSQLiteDatabase);
8125
8145
 
8126
- // eslint-disable-next-line import/no-commonjs
8127
- const fs = require('fs');
8128
8146
  CFG.win = {
8129
8147
  openDatabase: nodeWebSQL
8130
8148
  };
8131
8149
  const __setGlobalVars = function (idb, initialConfig = {}) {
8132
8150
  return setGlobalVars(idb, _objectSpread2$1({
8133
- fs
8151
+ fs: fs$1
8134
8152
  }, initialConfig));
8135
8153
  };
8136
8154
 
8137
8155
  module.exports = __setGlobalVars;
8138
- //# sourceMappingURL=indexeddbshim-node.js.map
8156
+ //# sourceMappingURL=indexeddbshim-node.cjs.map