@react-native-firebase/app 20.0.0 → 20.2.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 (60) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
  3. package/ios/RNFBApp/RNFBVersion.m +1 -1
  4. package/lib/common/index.js +2 -0
  5. package/lib/index.d.ts +1 -0
  6. package/lib/internal/RNFBNativeEventEmitter.js +31 -6
  7. package/lib/internal/nativeModule.android.js +2 -0
  8. package/lib/internal/nativeModule.ios.js +2 -0
  9. package/lib/internal/nativeModule.js +4 -0
  10. package/lib/internal/nativeModuleAndroidIos.js +45 -0
  11. package/lib/internal/nativeModuleWeb.js +48 -0
  12. package/lib/internal/registry/app.js +2 -1
  13. package/lib/internal/registry/nativeModule.js +11 -15
  14. package/lib/internal/web/RNFBAppModule.js +266 -0
  15. package/lib/internal/web/firebaseApp.js +3 -0
  16. package/lib/internal/web/firebaseAppCheck.js +6 -0
  17. package/lib/internal/web/firebaseAuth.js +4 -0
  18. package/lib/internal/web/firebaseDatabase.js +4 -0
  19. package/lib/internal/web/firebaseFirestore.js +4 -0
  20. package/lib/internal/web/firebaseFunctions.js +4 -0
  21. package/lib/internal/web/firebaseInstallations.js +6 -0
  22. package/lib/internal/web/firebaseRemoteConfig.js +6 -0
  23. package/lib/internal/web/firebaseStorage.js +4 -0
  24. package/lib/internal/web/memidb/FDBCursor.js +503 -0
  25. package/lib/internal/web/memidb/FDBCursorWithValue.js +11 -0
  26. package/lib/internal/web/memidb/FDBDatabase.js +172 -0
  27. package/lib/internal/web/memidb/FDBFactory.js +256 -0
  28. package/lib/internal/web/memidb/FDBIndex.js +187 -0
  29. package/lib/internal/web/memidb/FDBKeyRange.js +71 -0
  30. package/lib/internal/web/memidb/FDBObjectStore.js +411 -0
  31. package/lib/internal/web/memidb/FDBOpenDBRequest.js +9 -0
  32. package/lib/internal/web/memidb/FDBRequest.js +33 -0
  33. package/lib/internal/web/memidb/FDBTransaction.js +216 -0
  34. package/lib/internal/web/memidb/FDBVersionChangeEvent.js +12 -0
  35. package/lib/internal/web/memidb/LICENSE +208 -0
  36. package/lib/internal/web/memidb/index.js +39 -0
  37. package/lib/internal/web/memidb/lib/Database.js +32 -0
  38. package/lib/internal/web/memidb/lib/FakeDOMStringList.js +72 -0
  39. package/lib/internal/web/memidb/lib/FakeEvent.js +38 -0
  40. package/lib/internal/web/memidb/lib/FakeEventTarget.js +110 -0
  41. package/lib/internal/web/memidb/lib/Index.js +157 -0
  42. package/lib/internal/web/memidb/lib/KeyGenerator.js +22 -0
  43. package/lib/internal/web/memidb/lib/ObjectStore.js +172 -0
  44. package/lib/internal/web/memidb/lib/RecordStore.js +141 -0
  45. package/lib/internal/web/memidb/lib/binarySearch.js +78 -0
  46. package/lib/internal/web/memidb/lib/canInjectKey.js +25 -0
  47. package/lib/internal/web/memidb/lib/cmp.js +77 -0
  48. package/lib/internal/web/memidb/lib/enforceRange.js +13 -0
  49. package/lib/internal/web/memidb/lib/errors.js +69 -0
  50. package/lib/internal/web/memidb/lib/extractKey.js +39 -0
  51. package/lib/internal/web/memidb/lib/scheduling.js +30 -0
  52. package/lib/internal/web/memidb/lib/types.js +1 -0
  53. package/lib/internal/web/memidb/lib/validateKeyPath.js +54 -0
  54. package/lib/internal/web/memidb/lib/valueToKey.js +62 -0
  55. package/lib/internal/web/memidb/lib/valueToKeyRange.js +19 -0
  56. package/lib/internal/web/structuredClone/index.js +222 -0
  57. package/lib/internal/web/utils.js +35 -0
  58. package/lib/utils/UtilsStatics.js +3 -2
  59. package/lib/version.js +1 -1
  60. package/package.json +9 -8
@@ -0,0 +1,256 @@
1
+ import FDBDatabase from './FDBDatabase.js';
2
+ import FDBOpenDBRequest from './FDBOpenDBRequest.js';
3
+ import FDBVersionChangeEvent from './FDBVersionChangeEvent.js';
4
+ import cmp from './lib/cmp.js';
5
+ import Database from './lib/Database.js';
6
+ import enforceRange from './lib/enforceRange.js';
7
+ import { AbortError, VersionError } from './lib/errors.js';
8
+ import FakeEvent from './lib/FakeEvent.js';
9
+ import { queueTask } from './lib/scheduling.js';
10
+ const waitForOthersClosedDelete = (databases, name, openDatabases, cb) => {
11
+ const anyOpen = openDatabases.some(openDatabase2 => {
12
+ return !openDatabase2._closed && !openDatabase2._closePending;
13
+ });
14
+ if (anyOpen) {
15
+ queueTask(() => waitForOthersClosedDelete(databases, name, openDatabases, cb));
16
+ return;
17
+ }
18
+ databases.delete(name);
19
+ cb(null);
20
+ };
21
+
22
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-deleting-a-database
23
+ const deleteDatabase = (databases, name, request, cb) => {
24
+ try {
25
+ const db = databases.get(name);
26
+ if (db === undefined) {
27
+ cb(null);
28
+ return;
29
+ }
30
+ db.deletePending = true;
31
+ const openDatabases = db.connections.filter(connection => {
32
+ return !connection._closed && !connection._closePending;
33
+ });
34
+ for (const openDatabase2 of openDatabases) {
35
+ if (!openDatabase2._closePending) {
36
+ const event = new FDBVersionChangeEvent('versionchange', {
37
+ newVersion: null,
38
+ oldVersion: db.version,
39
+ });
40
+ openDatabase2.dispatchEvent(event);
41
+ }
42
+ }
43
+ const anyOpen = openDatabases.some(openDatabase3 => {
44
+ return !openDatabase3._closed && !openDatabase3._closePending;
45
+ });
46
+ if (request && anyOpen) {
47
+ const event = new FDBVersionChangeEvent('blocked', {
48
+ newVersion: null,
49
+ oldVersion: db.version,
50
+ });
51
+ request.dispatchEvent(event);
52
+ }
53
+ waitForOthersClosedDelete(databases, name, openDatabases, cb);
54
+ } catch (err) {
55
+ cb(err);
56
+ }
57
+ };
58
+
59
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-running-a-versionchange-transaction
60
+ const runVersionchangeTransaction = (connection, version, request, cb) => {
61
+ connection._runningVersionchangeTransaction = true;
62
+ const oldVersion = connection.version;
63
+ const openDatabases = connection._rawDatabase.connections.filter(otherDatabase => {
64
+ return connection !== otherDatabase;
65
+ });
66
+ for (const openDatabase2 of openDatabases) {
67
+ if (!openDatabase2._closed && !openDatabase2._closePending) {
68
+ const event = new FDBVersionChangeEvent('versionchange', {
69
+ newVersion: version,
70
+ oldVersion,
71
+ });
72
+ openDatabase2.dispatchEvent(event);
73
+ }
74
+ }
75
+ const anyOpen = openDatabases.some(openDatabase3 => {
76
+ return !openDatabase3._closed && !openDatabase3._closePending;
77
+ });
78
+ if (anyOpen) {
79
+ const event = new FDBVersionChangeEvent('blocked', {
80
+ newVersion: version,
81
+ oldVersion,
82
+ });
83
+ request.dispatchEvent(event);
84
+ }
85
+ const waitForOthersClosed = () => {
86
+ const anyOpen2 = openDatabases.some(openDatabase2 => {
87
+ return !openDatabase2._closed && !openDatabase2._closePending;
88
+ });
89
+ if (anyOpen2) {
90
+ queueTask(waitForOthersClosed);
91
+ return;
92
+ }
93
+
94
+ // Set the version of database to version. This change is considered part of the transaction, and so if the
95
+ // transaction is aborted, this change is reverted.
96
+ connection._rawDatabase.version = version;
97
+ connection.version = version;
98
+
99
+ // Get rid of this setImmediate?
100
+ const transaction = connection.transaction(connection.objectStoreNames, 'versionchange');
101
+ request.result = connection;
102
+ request.readyState = 'done';
103
+ request.transaction = transaction;
104
+ transaction._rollbackLog.push(() => {
105
+ connection._rawDatabase.version = oldVersion;
106
+ connection.version = oldVersion;
107
+ });
108
+ const event = new FDBVersionChangeEvent('upgradeneeded', {
109
+ newVersion: version,
110
+ oldVersion,
111
+ });
112
+ request.dispatchEvent(event);
113
+ transaction.addEventListener('error', () => {
114
+ connection._runningVersionchangeTransaction = false;
115
+ // throw arguments[0].target.error;
116
+ // console.log("error in versionchange transaction - not sure if anything needs to be done here", e.target.error.name);
117
+ });
118
+ transaction.addEventListener('abort', () => {
119
+ connection._runningVersionchangeTransaction = false;
120
+ request.transaction = null;
121
+ queueTask(() => {
122
+ cb(new AbortError());
123
+ });
124
+ });
125
+ transaction.addEventListener('complete', () => {
126
+ connection._runningVersionchangeTransaction = false;
127
+ request.transaction = null;
128
+ // Let other complete event handlers run before continuing
129
+ queueTask(() => {
130
+ if (connection._closePending) {
131
+ cb(new AbortError());
132
+ } else {
133
+ cb(null);
134
+ }
135
+ });
136
+ });
137
+ };
138
+ waitForOthersClosed();
139
+ };
140
+
141
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-steps-for-opening-a-database
142
+ const openDatabase = (databases, name, version, request, cb) => {
143
+ let db = databases.get(name);
144
+ if (db === undefined) {
145
+ db = new Database(name, 0);
146
+ databases.set(name, db);
147
+ }
148
+ if (version === undefined) {
149
+ version = db.version !== 0 ? db.version : 1;
150
+ }
151
+ if (db.version > version) {
152
+ return cb(new VersionError());
153
+ }
154
+ const connection = new FDBDatabase(db);
155
+ if (db.version < version) {
156
+ runVersionchangeTransaction(connection, version, request, err => {
157
+ if (err) {
158
+ // DO THIS HERE: ensure that connection is closed by running the steps for closing a database connection before these
159
+ // steps are aborted.
160
+ return cb(err);
161
+ }
162
+ cb(null, connection);
163
+ });
164
+ } else {
165
+ cb(null, connection);
166
+ }
167
+ };
168
+ class FDBFactory {
169
+ cmp = cmp;
170
+ _databases = new Map();
171
+
172
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBFactory-deleteDatabase-IDBOpenDBRequest-DOMString-name
173
+ deleteDatabase(name) {
174
+ const request = new FDBOpenDBRequest();
175
+ request.source = null;
176
+ queueTask(() => {
177
+ const db = this._databases.get(name);
178
+ const oldVersion = db !== undefined ? db.version : 0;
179
+ deleteDatabase(this._databases, name, request, err => {
180
+ if (err) {
181
+ request.error = new DOMException(err.message, err.name);
182
+ request.readyState = 'done';
183
+ const event = new FakeEvent('error', {
184
+ bubbles: true,
185
+ cancelable: true,
186
+ });
187
+ event.eventPath = [];
188
+ request.dispatchEvent(event);
189
+ return;
190
+ }
191
+ request.result = undefined;
192
+ request.readyState = 'done';
193
+ const event2 = new FDBVersionChangeEvent('success', {
194
+ newVersion: null,
195
+ oldVersion,
196
+ });
197
+ request.dispatchEvent(event2);
198
+ });
199
+ });
200
+ return request;
201
+ }
202
+
203
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBFactory-open-IDBOpenDBRequest-DOMString-name-unsigned-long-long-version
204
+ open(name, version) {
205
+ if (arguments.length > 1 && version !== undefined) {
206
+ // Based on spec, not sure why "MAX_SAFE_INTEGER" instead of "unsigned long long", but it's needed to pass
207
+ // tests
208
+ version = enforceRange(version, 'MAX_SAFE_INTEGER');
209
+ }
210
+ if (version === 0) {
211
+ throw new TypeError();
212
+ }
213
+ const request = new FDBOpenDBRequest();
214
+ request.source = null;
215
+ queueTask(() => {
216
+ openDatabase(this._databases, name, version, request, (err, connection) => {
217
+ if (err) {
218
+ request.result = undefined;
219
+ request.readyState = 'done';
220
+ request.error = new DOMException(err.message, err.name);
221
+ const event = new FakeEvent('error', {
222
+ bubbles: true,
223
+ cancelable: true,
224
+ });
225
+ event.eventPath = [];
226
+ request.dispatchEvent(event);
227
+ return;
228
+ }
229
+ request.result = connection;
230
+ request.readyState = 'done';
231
+ const event2 = new FakeEvent('success');
232
+ event2.eventPath = [];
233
+ request.dispatchEvent(event2);
234
+ });
235
+ });
236
+ return request;
237
+ }
238
+
239
+ // https://w3c.github.io/IndexedDB/#dom-idbfactory-databases
240
+ databases() {
241
+ return new Promise(resolve => {
242
+ const result = [];
243
+ for (const [name, database] of this._databases) {
244
+ result.push({
245
+ name,
246
+ version: database.version,
247
+ });
248
+ }
249
+ resolve(result);
250
+ });
251
+ }
252
+ toString() {
253
+ return '[object IDBFactory]';
254
+ }
255
+ }
256
+ export default FDBFactory;
@@ -0,0 +1,187 @@
1
+ import FDBCursor from './FDBCursor.js';
2
+ import FDBCursorWithValue from './FDBCursorWithValue.js';
3
+ import FDBKeyRange from './FDBKeyRange.js';
4
+ import FDBRequest from './FDBRequest.js';
5
+ import enforceRange from './lib/enforceRange.js';
6
+ import { ConstraintError, InvalidStateError, TransactionInactiveError } from './lib/errors.js';
7
+ import FakeDOMStringList from './lib/FakeDOMStringList.js';
8
+ import valueToKey from './lib/valueToKey.js';
9
+ import valueToKeyRange from './lib/valueToKeyRange.js';
10
+ const confirmActiveTransaction = index => {
11
+ if (index._rawIndex.deleted || index.objectStore._rawObjectStore.deleted) {
12
+ throw new InvalidStateError();
13
+ }
14
+ if (index.objectStore.transaction._state !== 'active') {
15
+ throw new TransactionInactiveError();
16
+ }
17
+ };
18
+
19
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#idl-def-IDBIndex
20
+ class FDBIndex {
21
+ constructor(objectStore, rawIndex) {
22
+ this._rawIndex = rawIndex;
23
+ this._name = rawIndex.name;
24
+ this.objectStore = objectStore;
25
+ this.keyPath = rawIndex.keyPath;
26
+ this.multiEntry = rawIndex.multiEntry;
27
+ this.unique = rawIndex.unique;
28
+ }
29
+ get name() {
30
+ return this._name;
31
+ }
32
+
33
+ // https://w3c.github.io/IndexedDB/#dom-idbindex-name
34
+ set name(name) {
35
+ const transaction = this.objectStore.transaction;
36
+ if (!transaction.db._runningVersionchangeTransaction) {
37
+ throw new InvalidStateError();
38
+ }
39
+ if (transaction._state !== 'active') {
40
+ throw new TransactionInactiveError();
41
+ }
42
+ if (this._rawIndex.deleted || this.objectStore._rawObjectStore.deleted) {
43
+ throw new InvalidStateError();
44
+ }
45
+ name = String(name);
46
+ if (name === this._name) {
47
+ return;
48
+ }
49
+ if (this.objectStore.indexNames.contains(name)) {
50
+ throw new ConstraintError();
51
+ }
52
+ const oldName = this._name;
53
+ const oldIndexNames = [...this.objectStore.indexNames];
54
+ this._name = name;
55
+ this._rawIndex.name = name;
56
+ this.objectStore._indexesCache.delete(oldName);
57
+ this.objectStore._indexesCache.set(name, this);
58
+ this.objectStore._rawObjectStore.rawIndexes.delete(oldName);
59
+ this.objectStore._rawObjectStore.rawIndexes.set(name, this._rawIndex);
60
+ this.objectStore.indexNames = new FakeDOMStringList(
61
+ ...Array.from(this.objectStore._rawObjectStore.rawIndexes.keys())
62
+ .filter(indexName => {
63
+ const index = this.objectStore._rawObjectStore.rawIndexes.get(indexName);
64
+ return index && !index.deleted;
65
+ })
66
+ .sort(),
67
+ );
68
+ transaction._rollbackLog.push(() => {
69
+ this._name = oldName;
70
+ this._rawIndex.name = oldName;
71
+ this.objectStore._indexesCache.delete(name);
72
+ this.objectStore._indexesCache.set(oldName, this);
73
+ this.objectStore._rawObjectStore.rawIndexes.delete(name);
74
+ this.objectStore._rawObjectStore.rawIndexes.set(oldName, this._rawIndex);
75
+ this.objectStore.indexNames = new FakeDOMStringList(...oldIndexNames);
76
+ });
77
+ }
78
+
79
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBIndex-openCursor-IDBRequest-any-range-IDBCursorDirection-direction
80
+ openCursor(range, direction) {
81
+ confirmActiveTransaction(this);
82
+ if (range === null) {
83
+ range = undefined;
84
+ }
85
+ if (range !== undefined && !(range instanceof FDBKeyRange)) {
86
+ range = FDBKeyRange.only(valueToKey(range));
87
+ }
88
+ const request = new FDBRequest();
89
+ request.source = this;
90
+ request.transaction = this.objectStore.transaction;
91
+ const cursor = new FDBCursorWithValue(this, range, direction, request);
92
+ return this.objectStore.transaction._execRequestAsync({
93
+ operation: cursor._iterate.bind(cursor),
94
+ request,
95
+ source: this,
96
+ });
97
+ }
98
+
99
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBIndex-openKeyCursor-IDBRequest-any-range-IDBCursorDirection-direction
100
+ openKeyCursor(range, direction) {
101
+ confirmActiveTransaction(this);
102
+ if (range === null) {
103
+ range = undefined;
104
+ }
105
+ if (range !== undefined && !(range instanceof FDBKeyRange)) {
106
+ range = FDBKeyRange.only(valueToKey(range));
107
+ }
108
+ const request = new FDBRequest();
109
+ request.source = this;
110
+ request.transaction = this.objectStore.transaction;
111
+ const cursor = new FDBCursor(this, range, direction, request, true);
112
+ return this.objectStore.transaction._execRequestAsync({
113
+ operation: cursor._iterate.bind(cursor),
114
+ request,
115
+ source: this,
116
+ });
117
+ }
118
+ get(key) {
119
+ confirmActiveTransaction(this);
120
+ if (!(key instanceof FDBKeyRange)) {
121
+ key = valueToKey(key);
122
+ }
123
+ return this.objectStore.transaction._execRequestAsync({
124
+ operation: this._rawIndex.getValue.bind(this._rawIndex, key),
125
+ source: this,
126
+ });
127
+ }
128
+
129
+ // http://w3c.github.io/IndexedDB/#dom-idbindex-getall
130
+ getAll(query, count) {
131
+ if (arguments.length > 1 && count !== undefined) {
132
+ count = enforceRange(count, 'unsigned long');
133
+ }
134
+ confirmActiveTransaction(this);
135
+ const range = valueToKeyRange(query);
136
+ return this.objectStore.transaction._execRequestAsync({
137
+ operation: this._rawIndex.getAllValues.bind(this._rawIndex, range, count),
138
+ source: this,
139
+ });
140
+ }
141
+
142
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBIndex-getKey-IDBRequest-any-key
143
+ getKey(key) {
144
+ confirmActiveTransaction(this);
145
+ if (!(key instanceof FDBKeyRange)) {
146
+ key = valueToKey(key);
147
+ }
148
+ return this.objectStore.transaction._execRequestAsync({
149
+ operation: this._rawIndex.getKey.bind(this._rawIndex, key),
150
+ source: this,
151
+ });
152
+ }
153
+
154
+ // http://w3c.github.io/IndexedDB/#dom-idbindex-getallkeys
155
+ getAllKeys(query, count) {
156
+ if (arguments.length > 1 && count !== undefined) {
157
+ count = enforceRange(count, 'unsigned long');
158
+ }
159
+ confirmActiveTransaction(this);
160
+ const range = valueToKeyRange(query);
161
+ return this.objectStore.transaction._execRequestAsync({
162
+ operation: this._rawIndex.getAllKeys.bind(this._rawIndex, range, count),
163
+ source: this,
164
+ });
165
+ }
166
+
167
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#widl-IDBIndex-count-IDBRequest-any-key
168
+ count(key) {
169
+ confirmActiveTransaction(this);
170
+ if (key === null) {
171
+ key = undefined;
172
+ }
173
+ if (key !== undefined && !(key instanceof FDBKeyRange)) {
174
+ key = FDBKeyRange.only(valueToKey(key));
175
+ }
176
+ return this.objectStore.transaction._execRequestAsync({
177
+ operation: () => {
178
+ return this._rawIndex.count(key);
179
+ },
180
+ source: this,
181
+ });
182
+ }
183
+ toString() {
184
+ return '[object IDBIndex]';
185
+ }
186
+ }
187
+ export default FDBIndex;
@@ -0,0 +1,71 @@
1
+ import cmp from './lib/cmp.js';
2
+ import { DataError } from './lib/errors.js';
3
+ import valueToKey from './lib/valueToKey.js';
4
+
5
+ // http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#range-concept
6
+ class FDBKeyRange {
7
+ static only(value) {
8
+ if (arguments.length === 0) {
9
+ throw new TypeError();
10
+ }
11
+ value = valueToKey(value);
12
+ return new FDBKeyRange(value, value, false, false);
13
+ }
14
+ static lowerBound(lower, open = false) {
15
+ if (arguments.length === 0) {
16
+ throw new TypeError();
17
+ }
18
+ lower = valueToKey(lower);
19
+ return new FDBKeyRange(lower, undefined, open, true);
20
+ }
21
+ static upperBound(upper, open = false) {
22
+ if (arguments.length === 0) {
23
+ throw new TypeError();
24
+ }
25
+ upper = valueToKey(upper);
26
+ return new FDBKeyRange(undefined, upper, true, open);
27
+ }
28
+ static bound(lower, upper, lowerOpen = false, upperOpen = false) {
29
+ if (arguments.length < 2) {
30
+ throw new TypeError();
31
+ }
32
+ const cmpResult = cmp(lower, upper);
33
+ if (cmpResult === 1 || (cmpResult === 0 && (lowerOpen || upperOpen))) {
34
+ throw new DataError();
35
+ }
36
+ lower = valueToKey(lower);
37
+ upper = valueToKey(upper);
38
+ return new FDBKeyRange(lower, upper, lowerOpen, upperOpen);
39
+ }
40
+ constructor(lower, upper, lowerOpen, upperOpen) {
41
+ this.lower = lower;
42
+ this.upper = upper;
43
+ this.lowerOpen = lowerOpen;
44
+ this.upperOpen = upperOpen;
45
+ }
46
+
47
+ // https://w3c.github.io/IndexedDB/#dom-idbkeyrange-includes
48
+ includes(key) {
49
+ if (arguments.length === 0) {
50
+ throw new TypeError();
51
+ }
52
+ key = valueToKey(key);
53
+ if (this.lower !== undefined) {
54
+ const cmpResult = cmp(this.lower, key);
55
+ if (cmpResult === 1 || (cmpResult === 0 && this.lowerOpen)) {
56
+ return false;
57
+ }
58
+ }
59
+ if (this.upper !== undefined) {
60
+ const cmpResult = cmp(this.upper, key);
61
+ if (cmpResult === -1 || (cmpResult === 0 && this.upperOpen)) {
62
+ return false;
63
+ }
64
+ }
65
+ return true;
66
+ }
67
+ toString() {
68
+ return '[object IDBKeyRange]';
69
+ }
70
+ }
71
+ export default FDBKeyRange;