dexie 3.2.0-rc.1 → 3.2.1-beta.1
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/CONTRIBUTING.md +1 -1
- package/README.md +10 -10
- package/dist/dexie.d.ts +42 -39
- package/dist/dexie.js +159 -86
- package/dist/dexie.js.map +1 -1
- package/dist/dexie.min.js +1 -1
- package/dist/dexie.min.js.map +1 -1
- package/dist/dexie.mjs +158 -86
- package/dist/dexie.mjs.map +1 -1
- package/dist/modern/dexie.min.mjs +1 -1
- package/dist/modern/dexie.min.mjs.map +1 -1
- package/dist/modern/dexie.mjs +144 -77
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +4 -4
package/CONTRIBUTING.md
CHANGED
|
@@ -6,7 +6,7 @@ We appreciate contributions in forms of:
|
|
|
6
6
|
* issues
|
|
7
7
|
* help answering questions in [issues](https://github.com/dfahlander/Dexie.js/issues) and on [stackoverflow](https://stackexchange.com/filters/233583/dexie-stackoverflow)
|
|
8
8
|
* fixing bugs via pull-requests
|
|
9
|
-
* developing addons or other [derived work](
|
|
9
|
+
* developing addons or other [derived work](https://dexie.org/docs/DerivedWork)
|
|
10
10
|
* promoting Dexie.js
|
|
11
11
|
* sharing ideas
|
|
12
12
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Dexie.js
|
|
2
2
|
========
|
|
3
3
|
|
|
4
|
-
[![NPM Version][npm-image]][npm-url] [](https://travis-ci.com/dfahlander/Dexie.js)[](https://travis-ci.com/dfahlander/Dexie.js)[](https://www.browserstack.com)
|
|
5
5
|
|
|
6
|
-
Dexie.js is a wrapper library for indexedDB - the standard database in the browser.
|
|
6
|
+
Dexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org
|
|
7
7
|
|
|
8
8
|
#### Why?
|
|
9
9
|
Dexie solves three main issues with the native IndexedDB API:
|
|
@@ -46,15 +46,15 @@ Dexie provides a neat database API with a well thought-through API design, robus
|
|
|
46
46
|
```
|
|
47
47
|
Yes, it's that simple.
|
|
48
48
|
|
|
49
|
-
[Tutorial](
|
|
49
|
+
[Tutorial](https://dexie.org/docs/Tutorial)
|
|
50
50
|
|
|
51
|
-
[API Reference](
|
|
51
|
+
[API Reference](https://dexie.org/docs/API-Reference)
|
|
52
52
|
|
|
53
|
-
[Samples](
|
|
53
|
+
[Samples](https://dexie.org/docs/Samples)
|
|
54
54
|
|
|
55
55
|
### Performance
|
|
56
56
|
|
|
57
|
-
Dexie has kick-ass performance. Its [bulk methods](
|
|
57
|
+
Dexie has kick-ass performance. Its [bulk methods](https://dexie.org/docs/Table/Table.bulkPut()) take advantage of a lesser-known feature in IndexedDB that makes it possible to store stuff without listening to every onsuccess event. This speeds up the performance to a maximum.
|
|
58
58
|
|
|
59
59
|
#### Supported operations
|
|
60
60
|
```js
|
|
@@ -108,7 +108,7 @@ uniqueKeys(): Promise;
|
|
|
108
108
|
until(filter: (value) => boolean, includeStopEntry?: boolean): Collection;
|
|
109
109
|
update(key: Key, changes: { [keyPath: string]: any }): Promise;
|
|
110
110
|
```
|
|
111
|
-
This is a mix of methods from [WhereClause](
|
|
111
|
+
This is a mix of methods from [WhereClause](https://dexie.org/docs/WhereClause/WhereClause), [Table](https://dexie.org/docs/Table/Table) and [Collection](https://dexie.org/docs/Collection/Collection). Dive into the [API reference](https://dexie.org/docs/API-Reference) to see the details.
|
|
112
112
|
|
|
113
113
|
#### Hello World (ES2016 / ES7)
|
|
114
114
|
```js
|
|
@@ -189,17 +189,17 @@ db.transaction('rw', db.friends, async() => {
|
|
|
189
189
|
|
|
190
190
|
Samples
|
|
191
191
|
-------
|
|
192
|
-
|
|
192
|
+
https://dexie.org/docs/Samples
|
|
193
193
|
|
|
194
194
|
https://github.com/dfahlander/Dexie.js/tree/master/samples
|
|
195
195
|
|
|
196
196
|
Knowledge Base
|
|
197
197
|
-----
|
|
198
|
-
[
|
|
198
|
+
[https://dexie.org/docs/Questions-and-Answers](https://dexie.org/docs/Questions-and-Answers)
|
|
199
199
|
|
|
200
200
|
Website
|
|
201
201
|
-------
|
|
202
|
-
[
|
|
202
|
+
[https://dexie.org](https://dexie.org)
|
|
203
203
|
|
|
204
204
|
Install over npm
|
|
205
205
|
----------------
|
package/dist/dexie.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 3.2.
|
|
7
|
+
* Version 3.2.1-beta.1, Fri Nov 19 2021
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* https://dexie.org
|
|
10
10
|
*
|
|
11
11
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
12
12
|
*/
|
|
13
|
-
// Generated by dts-bundle-generator v5.
|
|
13
|
+
// Generated by dts-bundle-generator v5.9.0
|
|
14
14
|
|
|
15
15
|
export interface IndexSpec {
|
|
16
16
|
name: string;
|
|
@@ -551,9 +551,9 @@ export interface DBCoreIndex {
|
|
|
551
551
|
readonly name: string | null;
|
|
552
552
|
/** True if this index represents the primary key */
|
|
553
553
|
readonly isPrimaryKey?: boolean;
|
|
554
|
-
/** True if this index represents the primary key and is not inbound (
|
|
554
|
+
/** True if this index represents the primary key and is not inbound (https://dexie.org/docs/inbound) */
|
|
555
555
|
readonly outbound?: boolean;
|
|
556
|
-
/** True if and only if keyPath is an array (
|
|
556
|
+
/** True if and only if keyPath is an array (https://dexie.org/docs/Compound-Index) */
|
|
557
557
|
readonly compound?: boolean;
|
|
558
558
|
/** keyPath, null for primary key, string for single-property indexes, Array<string> for compound indexes */
|
|
559
559
|
readonly keyPath: null | string | string[];
|
|
@@ -571,7 +571,6 @@ export interface DBCore {
|
|
|
571
571
|
// Transaction and Object Store
|
|
572
572
|
transaction(stores: string[], mode: "readonly" | "readwrite", options?: DbCoreTransactionOptions): DBCoreTransaction;
|
|
573
573
|
// Utility methods
|
|
574
|
-
cmp(a: any, b: any): number;
|
|
575
574
|
readonly MIN_KEY: any;
|
|
576
575
|
readonly MAX_KEY: any;
|
|
577
576
|
readonly schema: DBCoreSchema;
|
|
@@ -791,7 +790,7 @@ export interface Dexie extends Database {
|
|
|
791
790
|
* Common base class for all errors originating from Dexie.js except TypeError,
|
|
792
791
|
* SyntaxError and RangeError.
|
|
793
792
|
*
|
|
794
|
-
*
|
|
793
|
+
* https://dexie.org/docs/DexieErrors/DexieError
|
|
795
794
|
*
|
|
796
795
|
*/
|
|
797
796
|
export interface DexieError extends Error {
|
|
@@ -805,7 +804,7 @@ export interface DexieError extends Error {
|
|
|
805
804
|
* List of the names of auto-generated error classes that extends DexieError
|
|
806
805
|
* and shares the interface of DexieError.
|
|
807
806
|
*
|
|
808
|
-
* Each error should be documented at
|
|
807
|
+
* Each error should be documented at https://dexie.org/docs/DexieErrors/Dexie.<errname>
|
|
809
808
|
*
|
|
810
809
|
* The generic type DexieExceptionClasses is a map of full error name to
|
|
811
810
|
* error constructor. The DexieExceptionClasses is mixed in into Dexie,
|
|
@@ -825,64 +824,64 @@ export interface DexieError extends Error {
|
|
|
825
824
|
* }
|
|
826
825
|
*/
|
|
827
826
|
export type DexieErrors = {
|
|
828
|
-
//
|
|
827
|
+
// https://dexie.org/docs/DexieErrors/Dexie.OpenFailedError
|
|
829
828
|
OpenFailed: "OpenFailedError";
|
|
830
|
-
//
|
|
829
|
+
// https://dexie.org/docs/DexieErrors/Dexie.VersionChangeError
|
|
831
830
|
VersionChange: "VersionChangeError";
|
|
832
|
-
//
|
|
831
|
+
// https://dexie.org/docs/DexieErrors/Dexie.SchemaError
|
|
833
832
|
Schema: "SchemaError";
|
|
834
|
-
//
|
|
833
|
+
// https://dexie.org/docs/DexieErrors/Dexie.UpgradeError
|
|
835
834
|
Upgrade: "UpgradeError";
|
|
836
|
-
//
|
|
835
|
+
// https://dexie.org/docs/DexieErrors/Dexie.InvalidTableError
|
|
837
836
|
InvalidTable: "InvalidTableError";
|
|
838
|
-
//
|
|
837
|
+
// https://dexie.org/docs/DexieErrors/Dexie.MissingAPIError
|
|
839
838
|
MissingAPI: "MissingAPIError";
|
|
840
|
-
//
|
|
839
|
+
// https://dexie.org/docs/DexieErrors/Dexie.NoSuchDatabaseError
|
|
841
840
|
NoSuchDatabase: "NoSuchDatabaseError";
|
|
842
|
-
//
|
|
841
|
+
// https://dexie.org/docs/DexieErrors/Dexie.InvalidArgumentError
|
|
843
842
|
InvalidArgument: "InvalidArgumentError";
|
|
844
|
-
//
|
|
843
|
+
// https://dexie.org/docs/DexieErrors/Dexie.SubTransactionError
|
|
845
844
|
SubTransaction: "SubTransactionError";
|
|
846
|
-
//
|
|
845
|
+
// https://dexie.org/docs/DexieErrors/Dexie.UnsupportedError
|
|
847
846
|
Unsupported: "UnsupportedError";
|
|
848
|
-
//
|
|
847
|
+
// https://dexie.org/docs/DexieErrors/Dexie.InternalError
|
|
849
848
|
Internal: "InternalError";
|
|
850
|
-
//
|
|
849
|
+
// https://dexie.org/docs/DexieErrors/Dexie.DatabaseClosedError
|
|
851
850
|
DatabaseClosed: "DatabaseClosedError";
|
|
852
|
-
//
|
|
851
|
+
// https://dexie.org/docs/DexieErrors/Dexie.PrematureCommitError
|
|
853
852
|
PrematureCommit: "PrematureCommitError";
|
|
854
|
-
//
|
|
853
|
+
// https://dexie.org/docs/DexieErrors/Dexie.ForeignAwaitError
|
|
855
854
|
ForeignAwait: "ForeignAwaitError";
|
|
856
|
-
//
|
|
855
|
+
// https://dexie.org/docs/DexieErrors/Dexie.UnknownError
|
|
857
856
|
Unknown: "UnknownError";
|
|
858
|
-
//
|
|
857
|
+
// https://dexie.org/docs/DexieErrors/Dexie.ConstraintError
|
|
859
858
|
Constraint: "ConstraintError";
|
|
860
|
-
//
|
|
859
|
+
// https://dexie.org/docs/DexieErrors/Dexie.DataError
|
|
861
860
|
Data: "DataError";
|
|
862
|
-
//
|
|
861
|
+
// https://dexie.org/docs/DexieErrors/Dexie.TransactionInactiveError
|
|
863
862
|
TransactionInactive: "TransactionInactiveError";
|
|
864
|
-
//
|
|
863
|
+
// https://dexie.org/docs/DexieErrors/Dexie.ReadOnlyError
|
|
865
864
|
ReadOnly: "ReadOnlyError";
|
|
866
|
-
//
|
|
865
|
+
// https://dexie.org/docs/DexieErrors/Dexie.VersionError
|
|
867
866
|
Version: "VersionError";
|
|
868
|
-
//
|
|
867
|
+
// https://dexie.org/docs/DexieErrors/Dexie.NotFoundError
|
|
869
868
|
NotFound: "NotFoundError";
|
|
870
|
-
//
|
|
869
|
+
// https://dexie.org/docs/DexieErrors/Dexie.InvalidStateError
|
|
871
870
|
InvalidState: "InvalidStateError";
|
|
872
|
-
//
|
|
871
|
+
// https://dexie.org/docs/DexieErrors/Dexie.InvalidAccessError
|
|
873
872
|
InvalidAccess: "InvalidAccessError";
|
|
874
|
-
//
|
|
873
|
+
// https://dexie.org/docs/DexieErrors/Dexie.AbortError
|
|
875
874
|
Abort: "AbortError";
|
|
876
|
-
//
|
|
875
|
+
// https://dexie.org/docs/DexieErrors/Dexie.TimeoutError
|
|
877
876
|
Timeout: "TimeoutError";
|
|
878
|
-
//
|
|
877
|
+
// https://dexie.org/docs/DexieErrors/Dexie.QuotaExceededError
|
|
879
878
|
QuotaExceeded: "QuotaExceededError";
|
|
880
|
-
//
|
|
879
|
+
// https://dexie.org/docs/DexieErrors/Dexie.DataCloneError
|
|
881
880
|
DataClone: "DataCloneError";
|
|
882
881
|
};
|
|
883
882
|
/** ModifyError
|
|
884
883
|
*
|
|
885
|
-
*
|
|
884
|
+
* https://dexie.org/docs/DexieErrors/Dexie.ModifyError
|
|
886
885
|
*/
|
|
887
886
|
export interface ModifyError extends DexieError {
|
|
888
887
|
failures: Array<any>;
|
|
@@ -891,7 +890,7 @@ export interface ModifyError extends DexieError {
|
|
|
891
890
|
}
|
|
892
891
|
/** BulkError
|
|
893
892
|
*
|
|
894
|
-
*
|
|
893
|
+
* https://dexie.org/docs/DexieErrors/Dexie.BulkError
|
|
895
894
|
*/
|
|
896
895
|
export interface BulkError extends DexieError {
|
|
897
896
|
failures: Error[];
|
|
@@ -926,9 +925,15 @@ export interface DexieDOMDependencies {
|
|
|
926
925
|
indexedDB: IDBFactory;
|
|
927
926
|
IDBKeyRange: typeof IDBKeyRange;
|
|
928
927
|
}
|
|
928
|
+
declare global {
|
|
929
|
+
interface SymbolConstructor {
|
|
930
|
+
readonly observable: symbol;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
929
933
|
export interface Observable<T = any> {
|
|
930
934
|
subscribe(onNext?: ((value: T) => void) | null, onError?: ((error: any) => void) | null, onComplete?: (() => void) | null): Subscription;
|
|
931
935
|
subscribe(observer?: Observer<T> | null): Subscription;
|
|
936
|
+
[Symbol.observable]: () => Observable<T>;
|
|
932
937
|
}
|
|
933
938
|
export interface Subscription {
|
|
934
939
|
unsubscribe(): void;
|
|
@@ -1012,6 +1017,4 @@ export function rangesOverlap(rangeSet1: IntervalTree, rangeSet2: IntervalTree):
|
|
|
1012
1017
|
**/
|
|
1013
1018
|
export default Dexie;
|
|
1014
1019
|
|
|
1015
|
-
export as namespace Dexie;
|
|
1016
|
-
|
|
1017
1020
|
export {};
|
package/dist/dexie.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 3.2.
|
|
7
|
+
* Version 3.2.1-beta.1, Fri Nov 19 2021
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* https://dexie.org
|
|
10
10
|
*
|
|
11
11
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
12
12
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
16
16
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
17
17
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dexie = factory());
|
|
18
|
-
}(this, (function () { 'use strict';
|
|
18
|
+
})(this, (function () { 'use strict';
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
21
21
|
Copyright (c) Microsoft Corporation.
|
|
@@ -39,10 +39,14 @@
|
|
|
39
39
|
};
|
|
40
40
|
return __assign.apply(this, arguments);
|
|
41
41
|
};
|
|
42
|
-
function __spreadArray(to, from) {
|
|
43
|
-
for (var i = 0,
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
function __spreadArray(to, from, pack) {
|
|
43
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
44
|
+
if (ar || !(i in from)) {
|
|
45
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
46
|
+
ar[i] = from[i];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
var _global = typeof globalThis !== 'undefined' ? globalThis :
|
|
@@ -1262,8 +1266,14 @@
|
|
|
1262
1266
|
var trans = db._createTransaction(mode, storeNames, db._dbSchema);
|
|
1263
1267
|
try {
|
|
1264
1268
|
trans.create();
|
|
1269
|
+
db._state.PR1398_maxLoop = 3;
|
|
1265
1270
|
}
|
|
1266
1271
|
catch (ex) {
|
|
1272
|
+
if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {
|
|
1273
|
+
console.warn('Dexie: Need to reopen db');
|
|
1274
|
+
db._close();
|
|
1275
|
+
return db.open().then(function () { return tempTransaction(db, mode, storeNames, fn); });
|
|
1276
|
+
}
|
|
1267
1277
|
return rejection(ex);
|
|
1268
1278
|
}
|
|
1269
1279
|
return trans._promise(mode, function (resolve, reject) {
|
|
@@ -1277,7 +1287,7 @@
|
|
|
1277
1287
|
}
|
|
1278
1288
|
}
|
|
1279
1289
|
|
|
1280
|
-
var DEXIE_VERSION = '3.2.
|
|
1290
|
+
var DEXIE_VERSION = '3.2.1-beta.1';
|
|
1281
1291
|
var maxString = String.fromCharCode(65535);
|
|
1282
1292
|
var minKey = -Infinity;
|
|
1283
1293
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1299,37 +1309,11 @@
|
|
|
1299
1309
|
filter2;
|
|
1300
1310
|
}
|
|
1301
1311
|
|
|
1302
|
-
var domDeps;
|
|
1303
|
-
try {
|
|
1304
|
-
domDeps = {
|
|
1305
|
-
indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,
|
|
1306
|
-
IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
catch (e) {
|
|
1310
|
-
domDeps = { indexedDB: null, IDBKeyRange: null };
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
function safariMultiStoreFix(storeNames) {
|
|
1314
|
-
return storeNames.length === 1 ? storeNames[0] : storeNames;
|
|
1315
|
-
}
|
|
1316
|
-
var getMaxKey = function (IdbKeyRange) {
|
|
1317
|
-
try {
|
|
1318
|
-
IdbKeyRange.only([[]]);
|
|
1319
|
-
getMaxKey = function () { return [[]]; };
|
|
1320
|
-
return [[]];
|
|
1321
|
-
}
|
|
1322
|
-
catch (e) {
|
|
1323
|
-
getMaxKey = function () { return maxString; };
|
|
1324
|
-
return maxString;
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
1312
|
var AnyRange = {
|
|
1329
1313
|
type: 3 ,
|
|
1330
1314
|
lower: -Infinity,
|
|
1331
1315
|
lowerOpen: false,
|
|
1332
|
-
|
|
1316
|
+
upper: [[]],
|
|
1333
1317
|
upperOpen: false
|
|
1334
1318
|
};
|
|
1335
1319
|
|
|
@@ -1797,6 +1781,82 @@
|
|
|
1797
1781
|
});
|
|
1798
1782
|
}
|
|
1799
1783
|
|
|
1784
|
+
function cmp(a, b) {
|
|
1785
|
+
try {
|
|
1786
|
+
var ta = type(a);
|
|
1787
|
+
var tb = type(b);
|
|
1788
|
+
if (ta !== tb) {
|
|
1789
|
+
if (ta === 'Array')
|
|
1790
|
+
return 1;
|
|
1791
|
+
if (tb === 'Array')
|
|
1792
|
+
return -1;
|
|
1793
|
+
if (ta === 'binary')
|
|
1794
|
+
return 1;
|
|
1795
|
+
if (tb === 'binary')
|
|
1796
|
+
return -1;
|
|
1797
|
+
if (ta === 'string')
|
|
1798
|
+
return 1;
|
|
1799
|
+
if (tb === 'string')
|
|
1800
|
+
return -1;
|
|
1801
|
+
if (ta === 'Date')
|
|
1802
|
+
return 1;
|
|
1803
|
+
if (tb !== 'Date')
|
|
1804
|
+
return NaN;
|
|
1805
|
+
return -1;
|
|
1806
|
+
}
|
|
1807
|
+
switch (ta) {
|
|
1808
|
+
case 'number':
|
|
1809
|
+
case 'Date':
|
|
1810
|
+
case 'string':
|
|
1811
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
1812
|
+
case 'binary': {
|
|
1813
|
+
return compareUint8Arrays(getUint8Array(a), getUint8Array(b));
|
|
1814
|
+
}
|
|
1815
|
+
case 'Array':
|
|
1816
|
+
return compareArrays(a, b);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
catch (_a) { }
|
|
1820
|
+
return NaN;
|
|
1821
|
+
}
|
|
1822
|
+
function compareArrays(a, b) {
|
|
1823
|
+
var al = a.length;
|
|
1824
|
+
var bl = b.length;
|
|
1825
|
+
var l = al < bl ? al : bl;
|
|
1826
|
+
for (var i = 0; i < l; ++i) {
|
|
1827
|
+
var res = cmp(a[i], b[i]);
|
|
1828
|
+
if (res !== 0)
|
|
1829
|
+
return res;
|
|
1830
|
+
}
|
|
1831
|
+
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
1832
|
+
}
|
|
1833
|
+
function compareUint8Arrays(a, b) {
|
|
1834
|
+
var al = a.length;
|
|
1835
|
+
var bl = b.length;
|
|
1836
|
+
var l = al < bl ? al : bl;
|
|
1837
|
+
for (var i = 0; i < l; ++i) {
|
|
1838
|
+
if (a[i] !== b[i])
|
|
1839
|
+
return a[i] < b[i] ? -1 : 1;
|
|
1840
|
+
}
|
|
1841
|
+
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
1842
|
+
}
|
|
1843
|
+
function type(x) {
|
|
1844
|
+
var t = typeof x;
|
|
1845
|
+
if (t !== 'object')
|
|
1846
|
+
return t;
|
|
1847
|
+
if (ArrayBuffer.isView(x))
|
|
1848
|
+
return 'binary';
|
|
1849
|
+
var tsTag = toStringTag(x);
|
|
1850
|
+
return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;
|
|
1851
|
+
}
|
|
1852
|
+
function getUint8Array(a) {
|
|
1853
|
+
if (a instanceof Uint8Array)
|
|
1854
|
+
return a;
|
|
1855
|
+
if (ArrayBuffer.isView(a))
|
|
1856
|
+
return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
|
|
1857
|
+
return new Uint8Array(a);
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1800
1860
|
var Collection = (function () {
|
|
1801
1861
|
function Collection() {
|
|
1802
1862
|
}
|
|
@@ -2080,7 +2140,6 @@
|
|
|
2080
2140
|
var coreTable = ctx.table.core;
|
|
2081
2141
|
var _a = coreTable.schema.primaryKey, outbound = _a.outbound, extractKey = _a.extractKey;
|
|
2082
2142
|
var limit = _this.db._options.modifyChunkSize || 200;
|
|
2083
|
-
var cmp = _this.db.core.cmp;
|
|
2084
2143
|
var totalFailures = [];
|
|
2085
2144
|
var successCount = 0;
|
|
2086
2145
|
var failedKeys = [];
|
|
@@ -2842,6 +2901,21 @@
|
|
|
2842
2901
|
};
|
|
2843
2902
|
}
|
|
2844
2903
|
|
|
2904
|
+
function safariMultiStoreFix(storeNames) {
|
|
2905
|
+
return storeNames.length === 1 ? storeNames[0] : storeNames;
|
|
2906
|
+
}
|
|
2907
|
+
var getMaxKey = function (IdbKeyRange) {
|
|
2908
|
+
try {
|
|
2909
|
+
IdbKeyRange.only([[]]);
|
|
2910
|
+
getMaxKey = function () { return [[]]; };
|
|
2911
|
+
return [[]];
|
|
2912
|
+
}
|
|
2913
|
+
catch (e) {
|
|
2914
|
+
getMaxKey = function () { return maxString; };
|
|
2915
|
+
return maxString;
|
|
2916
|
+
}
|
|
2917
|
+
};
|
|
2918
|
+
|
|
2845
2919
|
function getKeyExtractor(keyPath) {
|
|
2846
2920
|
if (keyPath == null) {
|
|
2847
2921
|
return function () { return undefined; };
|
|
@@ -2874,8 +2948,7 @@
|
|
|
2874
2948
|
keyPath :
|
|
2875
2949
|
"[" + keyPath.join('+') + "]";
|
|
2876
2950
|
}
|
|
2877
|
-
function createDBCore(db,
|
|
2878
|
-
var cmp = indexedDB.cmp.bind(indexedDB);
|
|
2951
|
+
function createDBCore(db, IdbKeyRange, tmpTrans) {
|
|
2879
2952
|
function extractSchema(db, trans) {
|
|
2880
2953
|
var tables = arrayify(db.objectStoreNames);
|
|
2881
2954
|
return {
|
|
@@ -3210,7 +3283,6 @@
|
|
|
3210
3283
|
throw new Error("Table '" + name + "' not found");
|
|
3211
3284
|
return tableMap[name];
|
|
3212
3285
|
},
|
|
3213
|
-
cmp: cmp,
|
|
3214
3286
|
MIN_KEY: -Infinity,
|
|
3215
3287
|
MAX_KEY: getMaxKey(IdbKeyRange),
|
|
3216
3288
|
schema: schema
|
|
@@ -3224,8 +3296,8 @@
|
|
|
3224
3296
|
}, stackImpl);
|
|
3225
3297
|
}
|
|
3226
3298
|
function createMiddlewareStacks(middlewares, idbdb, _a, tmpTrans) {
|
|
3227
|
-
var IDBKeyRange = _a.IDBKeyRange
|
|
3228
|
-
var dbcore = createMiddlewareStack(createDBCore(idbdb,
|
|
3299
|
+
var IDBKeyRange = _a.IDBKeyRange; _a.indexedDB;
|
|
3300
|
+
var dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);
|
|
3229
3301
|
return {
|
|
3230
3302
|
dbcore: dbcore
|
|
3231
3303
|
};
|
|
@@ -3451,12 +3523,9 @@
|
|
|
3451
3523
|
});
|
|
3452
3524
|
}
|
|
3453
3525
|
function deleteRemovedTables(newSchema, idbtrans) {
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
idbtrans.db.deleteObjectStore(storeName);
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3526
|
+
[].slice.call(idbtrans.db.objectStoreNames).forEach(function (storeName) {
|
|
3527
|
+
return newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName);
|
|
3528
|
+
});
|
|
3460
3529
|
}
|
|
3461
3530
|
function addIndex(store, idx) {
|
|
3462
3531
|
store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });
|
|
@@ -3633,18 +3702,17 @@
|
|
|
3633
3702
|
}
|
|
3634
3703
|
|
|
3635
3704
|
function idbReady() {
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
return clearInterval(intervalId);
|
|
3647
|
-
});
|
|
3705
|
+
var isSafari = !navigator.userAgentData &&
|
|
3706
|
+
/Safari\//.test(navigator.userAgent) &&
|
|
3707
|
+
!/Chrom(e|ium)\//.test(navigator.userAgent);
|
|
3708
|
+
if (!isSafari || !indexedDB.databases)
|
|
3709
|
+
return Promise.resolve();
|
|
3710
|
+
var intervalId;
|
|
3711
|
+
return new Promise(function (resolve) {
|
|
3712
|
+
var tryIdb = function () { return indexedDB.databases().finally(resolve); };
|
|
3713
|
+
intervalId = setInterval(tryIdb, 100);
|
|
3714
|
+
tryIdb();
|
|
3715
|
+
}).finally(function () { return clearInterval(intervalId); });
|
|
3648
3716
|
}
|
|
3649
3717
|
|
|
3650
3718
|
function dexieOpen(db) {
|
|
@@ -3665,7 +3733,7 @@
|
|
|
3665
3733
|
}
|
|
3666
3734
|
var resolveDbReady = state.dbReadyResolve,
|
|
3667
3735
|
upgradeTransaction = null, wasCreated = false;
|
|
3668
|
-
return DexiePromise.race([openCanceller, idbReady().then(function () { return new DexiePromise(function (resolve, reject) {
|
|
3736
|
+
return DexiePromise.race([openCanceller, (typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(function () { return new DexiePromise(function (resolve, reject) {
|
|
3669
3737
|
throwIfCancelled();
|
|
3670
3738
|
if (!indexedDB)
|
|
3671
3739
|
throw new exceptions.MissingAPI();
|
|
@@ -3795,7 +3863,18 @@
|
|
|
3795
3863
|
trans.idbtrans = parentTransaction.idbtrans;
|
|
3796
3864
|
}
|
|
3797
3865
|
else {
|
|
3798
|
-
|
|
3866
|
+
try {
|
|
3867
|
+
trans.create();
|
|
3868
|
+
db._state.PR1398_maxLoop = 3;
|
|
3869
|
+
}
|
|
3870
|
+
catch (ex) {
|
|
3871
|
+
if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {
|
|
3872
|
+
console.warn('Dexie: Need to reopen db');
|
|
3873
|
+
db._close();
|
|
3874
|
+
return db.open().then(function () { return enterTransactionScope(db, mode, storeNames, null, scopeFunc); });
|
|
3875
|
+
}
|
|
3876
|
+
return rejection(ex);
|
|
3877
|
+
}
|
|
3799
3878
|
}
|
|
3800
3879
|
var scopeFuncIsAsync = isAsyncFunction(scopeFunc);
|
|
3801
3880
|
if (scopeFuncIsAsync) {
|
|
@@ -4024,9 +4103,9 @@
|
|
|
4024
4103
|
throw new Error("Keys missing");
|
|
4025
4104
|
req = req.type === 'add' || req.type === 'put' ? __assign(__assign({}, req), { keys: keys }) : __assign({}, req);
|
|
4026
4105
|
if (req.type !== 'delete')
|
|
4027
|
-
req.values = __spreadArray([], req.values);
|
|
4106
|
+
req.values = __spreadArray([], req.values, true);
|
|
4028
4107
|
if (req.keys)
|
|
4029
|
-
req.keys = __spreadArray([], req.keys);
|
|
4108
|
+
req.keys = __spreadArray([], req.keys, true);
|
|
4030
4109
|
return getExistingValues(downTable, req, keys).then(function (existingValues) {
|
|
4031
4110
|
var contexts = keys.map(function (key, i) {
|
|
4032
4111
|
var existingValue = existingValues[i];
|
|
@@ -4112,24 +4191,6 @@
|
|
|
4112
4191
|
: table.getMany({ trans: req.trans, keys: effectiveKeys, cache: "immutable" });
|
|
4113
4192
|
}
|
|
4114
4193
|
|
|
4115
|
-
var _cmp;
|
|
4116
|
-
function cmp(a, b) {
|
|
4117
|
-
if (_cmp)
|
|
4118
|
-
return _cmp(a, b);
|
|
4119
|
-
var indexedDB = domDeps.indexedDB;
|
|
4120
|
-
if (!indexedDB)
|
|
4121
|
-
throw new exceptions.MissingAPI();
|
|
4122
|
-
_cmp = function (a, b) {
|
|
4123
|
-
try {
|
|
4124
|
-
return a == null || b == null ? NaN : indexedDB.cmp(a, b);
|
|
4125
|
-
}
|
|
4126
|
-
catch (_a) {
|
|
4127
|
-
return NaN;
|
|
4128
|
-
}
|
|
4129
|
-
};
|
|
4130
|
-
return _cmp(a, b);
|
|
4131
|
-
}
|
|
4132
|
-
|
|
4133
4194
|
function getFromTransactionCache(keys, cache, clone) {
|
|
4134
4195
|
try {
|
|
4135
4196
|
if (!cache)
|
|
@@ -4545,7 +4606,8 @@
|
|
|
4545
4606
|
dbReadyPromise: null,
|
|
4546
4607
|
cancelOpen: nop,
|
|
4547
4608
|
openCanceller: null,
|
|
4548
|
-
autoSchema: true
|
|
4609
|
+
autoSchema: true,
|
|
4610
|
+
PR1398_maxLoop: 3
|
|
4549
4611
|
};
|
|
4550
4612
|
state.dbReadyPromise = new DexiePromise(function (resolve) {
|
|
4551
4613
|
state.dbReadyResolve = resolve;
|
|
@@ -4821,7 +4883,7 @@
|
|
|
4821
4883
|
}());
|
|
4822
4884
|
|
|
4823
4885
|
var symbolObservable = typeof Symbol !== "undefined" && "observable" in Symbol
|
|
4824
|
-
? Symbol
|
|
4886
|
+
? Symbol.observable
|
|
4825
4887
|
: "@@observable";
|
|
4826
4888
|
var Observable = (function () {
|
|
4827
4889
|
function Observable(subscribe) {
|
|
@@ -4920,6 +4982,17 @@
|
|
|
4920
4982
|
});
|
|
4921
4983
|
}
|
|
4922
4984
|
|
|
4985
|
+
var domDeps;
|
|
4986
|
+
try {
|
|
4987
|
+
domDeps = {
|
|
4988
|
+
indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,
|
|
4989
|
+
IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange
|
|
4990
|
+
};
|
|
4991
|
+
}
|
|
4992
|
+
catch (e) {
|
|
4993
|
+
domDeps = { indexedDB: null, IDBKeyRange: null };
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4923
4996
|
var Dexie = Dexie$1;
|
|
4924
4997
|
props(Dexie, __assign(__assign({}, fullNameExceptions), {
|
|
4925
4998
|
delete: function (databaseName) {
|
|
@@ -4992,7 +5065,7 @@
|
|
|
4992
5065
|
},
|
|
4993
5066
|
derive: derive, extend: extend, props: props, override: override,
|
|
4994
5067
|
Events: Events, on: globalEvents, liveQuery: liveQuery, extendObservabilitySet: extendObservabilitySet,
|
|
4995
|
-
getByKeyPath: getByKeyPath, setByKeyPath: setByKeyPath, delByKeyPath: delByKeyPath, shallowClone: shallowClone, deepClone: deepClone, getObjectDiff: getObjectDiff, asap: asap$1,
|
|
5068
|
+
getByKeyPath: getByKeyPath, setByKeyPath: setByKeyPath, delByKeyPath: delByKeyPath, shallowClone: shallowClone, deepClone: deepClone, getObjectDiff: getObjectDiff, cmp: cmp, asap: asap$1,
|
|
4996
5069
|
minKey: minKey,
|
|
4997
5070
|
addons: [],
|
|
4998
5071
|
connections: connections,
|
|
@@ -5063,7 +5136,7 @@
|
|
|
5063
5136
|
}));
|
|
5064
5137
|
}
|
|
5065
5138
|
if (typeof self['clients'] === 'object') {
|
|
5066
|
-
__spreadArray([], self['clients'].matchAll({ includeUncontrolled: true })).forEach(function (client) {
|
|
5139
|
+
__spreadArray([], self['clients'].matchAll({ includeUncontrolled: true }), true).forEach(function (client) {
|
|
5067
5140
|
return client.postMessage({
|
|
5068
5141
|
type: STORAGE_MUTATED_DOM_EVENT_NAME,
|
|
5069
5142
|
changedParts: changedParts,
|
|
@@ -5110,5 +5183,5 @@
|
|
|
5110
5183
|
|
|
5111
5184
|
return Dexie$1;
|
|
5112
5185
|
|
|
5113
|
-
}))
|
|
5186
|
+
}));
|
|
5114
5187
|
//# sourceMappingURL=dexie.js.map
|