indexeddbshim 11.0.0 → 12.0.0-pre.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.
Files changed (98) hide show
  1. package/badges/licenses-badge.svg +1 -1
  2. package/dist/CFG.d.ts +80 -0
  3. package/dist/CFG.d.ts.map +1 -0
  4. package/dist/DOMException.d.ts +71 -0
  5. package/dist/DOMException.d.ts.map +1 -0
  6. package/dist/DOMStringList.d.ts +20 -0
  7. package/dist/DOMStringList.d.ts.map +1 -0
  8. package/dist/Event.d.ts +21 -0
  9. package/dist/Event.d.ts.map +1 -0
  10. package/dist/IDBCursor.d.ts +289 -0
  11. package/dist/IDBCursor.d.ts.map +1 -0
  12. package/dist/IDBDatabase.d.ts +144 -0
  13. package/dist/IDBDatabase.d.ts.map +1 -0
  14. package/dist/IDBFactory.d.ts +96 -0
  15. package/dist/IDBFactory.d.ts.map +1 -0
  16. package/dist/IDBIndex.d.ts +243 -0
  17. package/dist/IDBIndex.d.ts.map +1 -0
  18. package/dist/IDBKeyRange.d.ts +79 -0
  19. package/dist/IDBKeyRange.d.ts.map +1 -0
  20. package/dist/IDBObjectStore.d.ts +273 -0
  21. package/dist/IDBObjectStore.d.ts.map +1 -0
  22. package/dist/IDBRequest.d.ts +90 -0
  23. package/dist/IDBRequest.d.ts.map +1 -0
  24. package/dist/IDBTransaction.d.ts +271 -0
  25. package/dist/IDBTransaction.d.ts.map +1 -0
  26. package/dist/IDBVersionChangeEvent.d.ts +23 -0
  27. package/dist/IDBVersionChangeEvent.d.ts.map +1 -0
  28. package/dist/Key.d.ts +214 -0
  29. package/dist/Key.d.ts.map +1 -0
  30. package/dist/Sca.d.ts +31 -0
  31. package/dist/Sca.d.ts.map +1 -0
  32. package/dist/UnicodeIdentifiers.d.ts +3 -0
  33. package/dist/UnicodeIdentifiers.d.ts.map +1 -0
  34. package/dist/browser-UnicodeIdentifiers.d.ts +2 -0
  35. package/dist/browser-UnicodeIdentifiers.d.ts.map +1 -0
  36. package/dist/browser-noninvasive.d.ts +3 -0
  37. package/dist/browser-noninvasive.d.ts.map +1 -0
  38. package/dist/browser.d.ts +2 -0
  39. package/dist/browser.d.ts.map +1 -0
  40. package/dist/cmp.d.ts +9 -0
  41. package/dist/cmp.d.ts.map +1 -0
  42. package/dist/indexeddbshim-Key.js +491 -189
  43. package/dist/indexeddbshim-Key.js.map +1 -1
  44. package/dist/indexeddbshim-Key.min.js +2 -2
  45. package/dist/indexeddbshim-Key.min.js.map +1 -1
  46. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +17263 -1396
  47. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  48. package/dist/indexeddbshim-UnicodeIdentifiers.js +3892 -1271
  49. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  50. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
  51. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  52. package/dist/indexeddbshim-node.cjs +17259 -1396
  53. package/dist/indexeddbshim-node.cjs.map +1 -1
  54. package/dist/indexeddbshim-noninvasive.js +3887 -1271
  55. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  56. package/dist/indexeddbshim-noninvasive.min.js +2 -2
  57. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  58. package/dist/indexeddbshim.js +3887 -1271
  59. package/dist/indexeddbshim.js.map +1 -1
  60. package/dist/indexeddbshim.min.js +2 -2
  61. package/dist/indexeddbshim.min.js.map +1 -1
  62. package/dist/node-UnicodeIdentifiers.d.ts +8 -0
  63. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -0
  64. package/dist/node.d.ts +8 -0
  65. package/dist/node.d.ts.map +1 -0
  66. package/dist/nodeWebSQL.d.ts +3 -0
  67. package/dist/nodeWebSQL.d.ts.map +1 -0
  68. package/dist/setGlobalVars.d.ts +79 -0
  69. package/dist/setGlobalVars.d.ts.map +1 -0
  70. package/dist/unicode-regex.d.ts +3 -0
  71. package/dist/unicode-regex.d.ts.map +1 -0
  72. package/dist/util.d.ts +174 -0
  73. package/dist/util.d.ts.map +1 -0
  74. package/package.json +40 -27
  75. package/src/CFG.js +89 -11
  76. package/src/DOMException.js +116 -29
  77. package/src/DOMStringList.js +92 -2
  78. package/src/Event.js +19 -4
  79. package/src/IDBCursor.js +339 -67
  80. package/src/IDBDatabase.js +87 -10
  81. package/src/IDBFactory.js +319 -56
  82. package/src/IDBIndex.js +385 -96
  83. package/src/IDBKeyRange.js +86 -13
  84. package/src/IDBObjectStore.js +326 -68
  85. package/src/IDBRequest.js +59 -1
  86. package/src/IDBTransaction.js +247 -38
  87. package/src/IDBVersionChangeEvent.js +28 -3
  88. package/src/Key.js +273 -156
  89. package/src/Sca.js +29 -4
  90. package/src/browser-UnicodeIdentifiers.js +5 -1
  91. package/src/cmp.js +5 -5
  92. package/src/node-UnicodeIdentifiers.js +9 -0
  93. package/src/node.js +5 -0
  94. package/src/nodeWebSQL.js +11 -5
  95. package/src/setGlobalVars.js +156 -21
  96. package/src/unicode-regex.js +9 -1
  97. package/src/util.js +228 -40
  98. package/typings/shimIndexedDB.d.ts +9 -0
package/src/Sca.js CHANGED
@@ -8,13 +8,24 @@ import {createDOMException, ShimDOMException} from './DOMException.js';
8
8
 
9
9
  let typeson = new Typeson().register(structuredCloningThrowing);
10
10
 
11
+ /**
12
+ * @param {(preset: import('typeson-registry').Preset) =>
13
+ * import('typeson-registry').Preset} func
14
+ * @returns {void}
15
+ */
11
16
  function register (func) {
12
17
  typeson = new Typeson().register(func(structuredCloningThrowing));
13
18
  }
14
19
 
15
- // We are keeping the callback approach for now in case we wish to reexpose
16
- // `Blob`, `File`, `FileList` asynchronously (though in such a case, we
17
- // should probably refactor as a Promise)
20
+ /**
21
+ * We are keeping the callback approach for now in case we wish to reexpose
22
+ * `Blob`, `File`, `FileList` asynchronously (though in such a case, we
23
+ * should probably refactor as a Promise).
24
+ * @param {AnyValue} obj
25
+ * @param {(str: string) => void} [func]
26
+ * @throws {Error}
27
+ * @returns {string}
28
+ */
18
29
  function encode (obj, func) {
19
30
  let ret;
20
31
  try {
@@ -34,14 +45,28 @@ function encode (obj, func) {
34
45
  // throwing getters (as in the W3C test, key-conversion-exceptions.htm)
35
46
  throw err;
36
47
  }
37
- if (func) func(ret);
48
+ if (func) {
49
+ func(ret);
50
+ }
38
51
  return ret;
39
52
  }
40
53
 
54
+ /**
55
+ * @typedef {any} AnyValue
56
+ */
57
+
58
+ /**
59
+ * @param {string} obj
60
+ * @returns {AnyValue}
61
+ */
41
62
  function decode (obj) {
42
63
  return typeson.parse(obj);
43
64
  }
44
65
 
66
+ /**
67
+ * @param {AnyValue} val
68
+ * @returns {AnyValue}
69
+ */
45
70
  function clone (val) {
46
71
  // We don't return the intermediate `encode` as we'll need to reencode
47
72
  // the clone as it may differ
@@ -1,5 +1,5 @@
1
1
  /* eslint-env browser, worker */
2
- /* global shimIndexedDB */
2
+ /* globals shimIndexedDB */
3
3
  import * as UnicodeIdentifiers from './UnicodeIdentifiers.js';
4
4
 
5
5
  // BEGIN: Same code as in browser.js
@@ -14,6 +14,10 @@ setGlobalVars();
14
14
  const __setUnicodeIdentifiers = shimIndexedDB.__setUnicodeIdentifiers.bind(
15
15
  shimIndexedDB
16
16
  );
17
+
18
+ /**
19
+ * @returns {void}
20
+ */
17
21
  shimIndexedDB.__setUnicodeIdentifiers = function () {
18
22
  __setUnicodeIdentifiers(UnicodeIdentifiers);
19
23
  };
package/src/cmp.js CHANGED
@@ -3,13 +3,13 @@ import {encode as keyEncode, decode as keyDecode} from './Key.js';
3
3
 
4
4
  /**
5
5
  * Compares two keys.
6
- * @param first
7
- * @param second
8
- * @returns {number}
6
+ * @param {import('./Key.js').Key} first
7
+ * @param {import('./Key.js').Key} second
8
+ * @returns {0|1|-1}
9
9
  */
10
10
  function cmp (first, second) {
11
- const encodedKey1 = keyEncode(first);
12
- const encodedKey2 = keyEncode(second);
11
+ const encodedKey1 = /** @type {string} */ (keyEncode(first));
12
+ const encodedKey2 = /** @type {string} */ (keyEncode(second));
13
13
  const result = encodedKey1 > encodedKey2
14
14
  ? 1
15
15
  : encodedKey1 === encodedKey2 ? 0 : -1;
@@ -7,8 +7,17 @@ import * as UnicodeIdentifiers from './UnicodeIdentifiers.js';
7
7
 
8
8
  CFG.win = {openDatabase: nodeWebSQL};
9
9
 
10
+ /**
11
+ * @param {import('./setGlobalVars.js').ShimmedObject} idb
12
+ * @param {import('./CFG.js').default} initialConfig
13
+ * @returns {{}|Window}
14
+ */
10
15
  const __setGlobalVars = function (idb, initialConfig = {}) {
11
16
  const obj = setGlobalVars(idb, {fs, ...initialConfig});
17
+ /* istanbul ignore next -- TS guard */
18
+ if (!obj.shimIndexedDB) {
19
+ return obj;
20
+ }
12
21
  obj.shimIndexedDB.__setUnicodeIdentifiers(UnicodeIdentifiers);
13
22
 
14
23
  return obj;
package/src/node.js CHANGED
@@ -6,6 +6,11 @@ import CFG from './CFG.js';
6
6
 
7
7
  CFG.win = {openDatabase: nodeWebSQL};
8
8
 
9
+ /**
10
+ * @param {import('./setGlobalVars.js').ShimmedObject} idb
11
+ * @param {import('./CFG.js').default} initialConfig
12
+ * @returns {{}|Window}
13
+ */
9
14
  const __setGlobalVars = function (idb, initialConfig = {}) {
10
15
  return setGlobalVars(idb, {fs, ...initialConfig});
11
16
  };
package/src/nodeWebSQL.js CHANGED
@@ -1,20 +1,26 @@
1
- import customOpenDatabase from 'websql/custom/index.js';
2
- import SQLiteDatabase from 'websql/lib/sqlite/SQLiteDatabase.js';
1
+ import customOpenDatabase from 'websql-configurable/custom/index.js';
2
+ import SQLiteDatabase from 'websql-configurable/lib/sqlite/SQLiteDatabase.js';
3
3
  import CFG from './CFG.js';
4
4
 
5
+ /**
6
+ * @param {string} name
7
+ * @returns {SQLiteDatabase}
8
+ */
5
9
  function wrappedSQLiteDatabase (name) {
6
- const db = new SQLiteDatabase(name);
10
+ const db = new SQLiteDatabase(name, {});
7
11
  if (CFG.sqlBusyTimeout) {
8
- db._db.configure('busyTimeout', CFG.sqlBusyTimeout); // Default is 1000
12
+ db._db.configure('busyTimeout', /** @type {number} */ (CFG.sqlBusyTimeout)); // Default is 1000
9
13
  }
10
14
  if (CFG.sqlTrace) {
15
+ // @ts-expect-error native API?
11
16
  db._db.configure('trace', CFG.sqlTrace);
12
17
  }
13
18
  if (CFG.sqlProfile) {
19
+ // @ts-expect-error native API?
14
20
  db._db.configure('profile', CFG.sqlProfile);
15
21
  }
16
22
  return db;
17
23
  }
18
24
 
19
- const nodeWebSQL = customOpenDatabase(wrappedSQLiteDatabase);
25
+ const nodeWebSQL = customOpenDatabase(wrappedSQLiteDatabase, {});
20
26
  export default nodeWebSQL;
@@ -1,4 +1,3 @@
1
- /* globals self */
2
1
  import {setPrototypeOfCustomEvent} from 'eventtargeter';
3
2
  import shimIDBVersionChangeEvent from './IDBVersionChangeEvent.js';
4
3
  import {IDBCursor as shimIDBCursor, IDBCursorWithValue as shimIDBCursorWithValue} from './IDBCursor.js';
@@ -16,37 +15,135 @@ import shimIDBDatabase from './IDBDatabase.js';
16
15
  import CFG from './CFG.js';
17
16
  import {isNullish} from './util.js';
18
17
 
18
+ /**
19
+ * @typedef {any} AnyValue
20
+ */
21
+
22
+ /**
23
+ * @callback SetConfig
24
+ * @param {import('./CFG.js').KeyofConfigValues|
25
+ * Partial<import('./CFG.js').ConfigValues>} prop
26
+ * @param {AnyValue} [val]
27
+ * @throws {Error}
28
+ * @returns {void}
29
+ */
30
+
31
+ /** @type {SetConfig} */
19
32
  function setConfig (prop, val) {
20
33
  if (prop && typeof prop === 'object') {
21
34
  Object.entries(prop).forEach(([p, val]) => {
22
- setConfig(p, val);
35
+ setConfig(
36
+ /** @type {import('./CFG.js').KeyofConfigValues} */
37
+ (p),
38
+ val
39
+ );
23
40
  });
24
41
  return;
25
42
  }
26
43
  if (!(prop in CFG)) {
27
44
  throw new Error(prop + ' is not a valid configuration property');
28
45
  }
46
+ // @ts-expect-error Should not be `never` here!
29
47
  CFG[prop] = val;
30
48
  if (prop === 'registerSCA' && typeof val === 'function') {
31
- register(val);
49
+ register(
50
+ /**
51
+ * @type {(
52
+ * preset: import('typeson').Preset
53
+ * ) => import('typeson').Preset}
54
+ */ (
55
+ val
56
+ )
57
+ );
32
58
  }
33
59
  }
34
60
 
61
+ /**
62
+ * @typedef {(
63
+ * prop: import('./CFG.js').KeyofConfigValues
64
+ * ) => import('../src/CFG.js').ConfigValue} GetConfig
65
+ */
66
+
67
+ /**
68
+ * @typedef {(cfg: {
69
+ * UnicodeIDStart: string,
70
+ * UnicodeIDContinue: string
71
+ * }) => void} SetUnicodeIdentifiers
72
+ */
73
+
74
+ /**
75
+ * @typedef {(IDBFactory|object) & {
76
+ * __useShim: () => void,
77
+ * __debug: (val: boolean) => void,
78
+ * __setConfig: SetConfig,
79
+ * __getConfig: GetConfig,
80
+ * __setUnicodeIdentifiers: SetUnicodeIdentifiers,
81
+ * __setConnectionQueueOrigin: (origin?: string) => void
82
+ * }} ShimIndexedDB
83
+ */
84
+
85
+ /**
86
+ * @typedef {number} Integer
87
+ */
88
+
89
+ /**
90
+ * @typedef {(typeof globalThis|object) & {
91
+ * indexedDB?: Partial<IDBFactory>,
92
+ * IDBFactory: typeof IDBFactory,
93
+ * IDBOpenDBRequest: typeof IDBOpenDBRequest,
94
+ * IDBRequest: typeof IDBRequest,
95
+ * IDBCursorWithValue: typeof IDBCursorWithValue,
96
+ * IDBCursor: typeof IDBCursor,
97
+ * IDBDatabase: typeof IDBDatabase,
98
+ * IDBTransaction: typeof IDBTransaction,
99
+ * IDBKeyRange: typeof IDBKeyRange,
100
+ * shimIndexedDB?: ShimIndexedDB
101
+ * }} ShimmedObject
102
+ */
103
+
104
+ /**
105
+ *
106
+ * @param {ShimmedObject} [idb]
107
+ * @param {import('./CFG.js').ConfigValues} [initialConfig]
108
+ * @returns {ShimmedObject}
109
+ */
35
110
  function setGlobalVars (idb, initialConfig) {
36
111
  if (initialConfig) {
37
112
  setConfig(initialConfig);
38
113
  }
39
- const IDB = idb || (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : (typeof global !== 'undefined' ? global : {})));
114
+ const IDB = idb || globalThis || {};
115
+ /**
116
+ * @typedef {any} AnyClass
117
+ */
118
+ /**
119
+ * @typedef {any} AnyValue
120
+ */
121
+ /**
122
+ * @typedef {Function} AnyFunction
123
+ */
124
+ /**
125
+ * @param {string} name
126
+ * @param {AnyClass} value
127
+ * @param {PropertyDescriptor & {
128
+ * shimNS?: object
129
+ * }|undefined} [propDesc]
130
+ * @returns {void}
131
+ */
40
132
  function shim (name, value, propDesc) {
41
133
  if (!propDesc || !Object.defineProperty) {
42
134
  try {
43
135
  // Try setting the property. This will fail if the property is read-only.
136
+ // @ts-expect-error It's ok
44
137
  IDB[name] = value;
45
138
  } catch (e) {
46
139
  console.log(e);
47
140
  }
48
141
  }
49
- if (IDB[name] !== value && Object.defineProperty) {
142
+ if (
143
+ // @ts-expect-error It's ok
144
+ IDB[name] !== value &&
145
+ Object.defineProperty
146
+ ) {
50
147
  // Setting a read-only property failed, so try re-defining the property
51
148
  try {
52
149
  let desc = propDesc || {};
@@ -59,11 +156,20 @@ function setGlobalVars (idb, initialConfig) {
59
156
  }
60
157
  } else {
61
158
  const o = {
159
+ /**
160
+ * @returns {AnyValue}
161
+ */
62
162
  get [name] () {
63
- return propDesc.get.call(this);
163
+ return /** @type {AnyFunction} */ (
164
+ /** @type {PropertyDescriptor} */ (
165
+ propDesc
166
+ ).get
167
+ ).call(this);
64
168
  }
65
169
  };
66
- desc = Object.getOwnPropertyDescriptor(o, name);
170
+ desc = /** @type {PropertyDescriptor} */ (
171
+ Object.getOwnPropertyDescriptor(o, name)
172
+ );
67
173
  }
68
174
  Object.defineProperty(IDB, name, desc);
69
175
  } catch (e) {
@@ -72,6 +178,8 @@ function setGlobalVars (idb, initialConfig) {
72
178
  // get here since no WebSQL to use for shimming)
73
179
  }
74
180
  }
181
+
182
+ // @ts-expect-error It's ok
75
183
  if (IDB[name] !== value) {
76
184
  typeof console !== 'undefined' && console.warn && console.warn('Unable to shim ' + name);
77
185
  }
@@ -82,8 +190,13 @@ function setGlobalVars (idb, initialConfig) {
82
190
  configurable: true
83
191
  });
84
192
  }
85
- if (IDB.shimIndexedDB) {
193
+ if ('shimIndexedDB' in IDB && IDB.shimIndexedDB) {
86
194
  IDB.shimIndexedDB.__useShim = function () {
195
+ /**
196
+ *
197
+ * @param {"Shim"|""} [prefix]
198
+ * @returns {void}
199
+ */
87
200
  function setNonIDBGlobals (prefix = '') {
88
201
  shim(prefix + 'DOMException', ShimDOMException);
89
202
  shim(prefix + 'DOMStringList', DOMStringList, {
@@ -125,7 +238,8 @@ function setGlobalVars (idb, initialConfig) {
125
238
  return shimIndexedDB;
126
239
  }
127
240
  });
128
- [
241
+ /** @type {[string, any][]} */
242
+ ([
129
243
  ['IDBFactory', shimIDBFactory],
130
244
  ['IDBDatabase', shimIDBDatabase],
131
245
  ['IDBObjectStore', shimIDBObjectStore],
@@ -137,7 +251,7 @@ function setGlobalVars (idb, initialConfig) {
137
251
  ['IDBRequest', shimIDBRequest],
138
252
  ['IDBOpenDBRequest', shimIDBOpenDBRequest],
139
253
  ['IDBVersionChangeEvent', shimIDBVersionChangeEvent]
140
- ].forEach(([prop, obj]) => {
254
+ ]).forEach(([prop, obj]) => {
141
255
  shim(prop, obj, {
142
256
  enumerable: false,
143
257
  configurable: true
@@ -172,6 +286,10 @@ function setGlobalVars (idb, initialConfig) {
172
286
  setNonIDBGlobals();
173
287
  }
174
288
  }
289
+ /* istanbul ignore next -- TS guard */
290
+ if (!IDB.shimIndexedDB) {
291
+ return;
292
+ }
175
293
  IDB.shimIndexedDB.__setConnectionQueueOrigin();
176
294
  }
177
295
  };
@@ -180,22 +298,31 @@ function setGlobalVars (idb, initialConfig) {
180
298
  CFG.DEBUG = val;
181
299
  };
182
300
  IDB.shimIndexedDB.__setConfig = setConfig;
301
+
302
+ /** @type {GetConfig} */
183
303
  IDB.shimIndexedDB.__getConfig = function (prop) {
184
304
  if (!(prop in CFG)) {
185
305
  throw new Error(prop + ' is not a valid configuration property');
186
306
  }
187
307
  return CFG[prop];
188
308
  };
189
- IDB.shimIndexedDB.__setUnicodeIdentifiers = function ({UnicodeIDStart, UnicodeIDContinue}) {
309
+
310
+ /** @type {SetUnicodeIdentifiers} */
311
+ IDB.shimIndexedDB.__setUnicodeIdentifiers = function ({
312
+ UnicodeIDStart, UnicodeIDContinue
313
+ }) {
190
314
  setConfig({UnicodeIDStart, UnicodeIDContinue});
191
315
  };
192
316
  } else {
193
317
  // We no-op the harmless set-up properties and methods with a warning; the `IDBFactory` methods,
194
318
  // however (including our non-standard methods), are not stubbed as they ought
195
319
  // to fail earlier rather than potentially having side effects.
196
- IDB.shimIndexedDB = {};
197
- ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach((prop) => {
198
- IDB.shimIndexedDB[prop] = function () {
320
+ IDB.shimIndexedDB = /** @type {ShimIndexedDB} */ ({});
321
+ /** @type {const} */ ([
322
+ '__useShim', '__debug', '__setConfig',
323
+ '__getConfig', '__setUnicodeIdentifiers'
324
+ ]).forEach((prop) => {
325
+ /** @type {ShimIndexedDB} */ (IDB.shimIndexedDB)[prop] = /** @type {() => any} */ function () {
199
326
  console.warn('This browser does not have WebSQL to shim.');
200
327
  };
201
328
  });
@@ -203,7 +330,11 @@ function setGlobalVars (idb, initialConfig) {
203
330
 
204
331
  // Workaround to prevent an error in Firefox
205
332
  if (!('indexedDB' in IDB) && typeof window !== 'undefined') { // 2nd condition avoids problems in Node
206
- IDB.indexedDB = IDB.indexedDB || IDB.webkitIndexedDB || IDB.mozIndexedDB || IDB.oIndexedDB || IDB.msIndexedDB;
333
+ IDB.indexedDB = /** @type {IDBFactory} */ (IDB.indexedDB ||
334
+ ('webkitIndexedDB' in IDB && IDB.webkitIndexedDB) ||
335
+ ('mozIndexedDB' in IDB && IDB.mozIndexedDB) ||
336
+ ('oIndexedDB' in IDB && IDB.oIndexedDB) ||
337
+ ('msIndexedDB' in IDB && IDB.msIndexedDB));
207
338
  }
208
339
 
209
340
  // Detect browsers with known IndexedDB issues (e.g. Android pre-4.4)
@@ -224,7 +355,7 @@ function setGlobalVars (idb, initialConfig) {
224
355
  // Detect iOS: http://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
225
356
  // and detect version 9: http://stackoverflow.com/a/26363560/271577
226
357
  (/(iPad|iPhone|iPod).* os 9_/ui).test(navigator.userAgent) &&
227
- !window.MSStream // But avoid IE11
358
+ !('MSStream' in window) // But avoid IE11
228
359
  )
229
360
  )
230
361
  ) {
@@ -251,12 +382,16 @@ function setGlobalVars (idb, initialConfig) {
251
382
  ) {
252
383
  IDB.shimIndexedDB.__useShim();
253
384
  } else {
254
- IDB.IDBDatabase = IDB.IDBDatabase || IDB.webkitIDBDatabase;
255
- IDB.IDBTransaction = IDB.IDBTransaction || IDB.webkitIDBTransaction || {};
256
- IDB.IDBCursor = IDB.IDBCursor || IDB.webkitIDBCursor;
257
- IDB.IDBKeyRange = IDB.IDBKeyRange || IDB.webkitIDBKeyRange;
385
+ IDB.IDBDatabase = IDB.IDBDatabase ||
386
+ ('webkitIDBDatabase' in IDB && IDB.webkitIDBDatabase);
387
+ IDB.IDBTransaction = IDB.IDBTransaction ||
388
+ ('webkitIDBTransaction' in IDB && IDB.webkitIDBTransaction) || {};
389
+ IDB.IDBCursor = IDB.IDBCursor ||
390
+ ('webkitIDBCursor' in IDB && IDB.webkitIDBCursor);
391
+ IDB.IDBKeyRange = IDB.IDBKeyRange ||
392
+ ('webkitIDBKeyRange' in IDB && IDB.webkitIDBKeyRange);
258
393
  }
259
- return IDB;
394
+ return /** @type {ShimmedObject} */ (IDB);
260
395
  }
261
396
 
262
397
  // Expose for ease in simulating such exceptions during testing
@@ -1,3 +1,11 @@
1
+ // @ts-nocheck
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
1
7
  var regex=/[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
2
8
 
3
- export { regex as default };
9
+ var regex$1 = /*@__PURE__*/getDefaultExportFromCjs(regex);
10
+
11
+ export { regex$1 as default };