dexie 3.2.0-beta.3 → 3.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.
- package/dist/dexie.d.ts +12 -9
- package/dist/dexie.js +188 -118
- 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 +187 -118
- 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 +173 -110
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +4 -4
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.0
|
|
7
|
+
* Version 3.2.0, Thu Nov 18 2021
|
|
8
8
|
*
|
|
9
9
|
* http://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;
|
|
@@ -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;
|
|
@@ -646,7 +645,7 @@ export interface Table<T = any, TKey = IndexableType> {
|
|
|
646
645
|
bulkPut(items: readonly T[], keys?: IndexableTypeArrayReadonly, options?: {
|
|
647
646
|
allKeys: boolean;
|
|
648
647
|
}): PromiseExtended<TKey>;
|
|
649
|
-
bulkDelete(keys:
|
|
648
|
+
bulkDelete(keys: TKey[]): PromiseExtended<void>;
|
|
650
649
|
}
|
|
651
650
|
export interface Version {
|
|
652
651
|
stores(schema: {
|
|
@@ -702,14 +701,14 @@ export type ObservabilitySet = {
|
|
|
702
701
|
// `idb:${dbName}/${tableName}/changedIndexes/${indexName}` - indexes
|
|
703
702
|
[part: string]: IntervalTree;
|
|
704
703
|
};
|
|
705
|
-
export interface
|
|
704
|
+
export interface DexieOnStorageMutatedEvent {
|
|
706
705
|
subscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
707
706
|
unsubscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
708
707
|
fire(parts: ObservabilitySet): any;
|
|
709
708
|
}
|
|
710
709
|
export interface GlobalDexieEvents extends DexieEventSet {
|
|
711
|
-
(eventName: "
|
|
712
|
-
|
|
710
|
+
(eventName: "storagemutated", subscriber: (parts: ObservabilitySet) => any): void;
|
|
711
|
+
storagemutated: DexieOnStorageMutatedEvent;
|
|
713
712
|
}
|
|
714
713
|
export type DbSchema = {
|
|
715
714
|
[tableName: string]: TableSchema;
|
|
@@ -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,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 3.2.0
|
|
7
|
+
* Version 3.2.0, Thu Nov 18 2021
|
|
8
8
|
*
|
|
9
9
|
* http://dexie.org
|
|
10
10
|
*
|
|
@@ -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 :
|
|
@@ -1277,7 +1281,7 @@
|
|
|
1277
1281
|
}
|
|
1278
1282
|
}
|
|
1279
1283
|
|
|
1280
|
-
var DEXIE_VERSION = '3.2.0
|
|
1284
|
+
var DEXIE_VERSION = '3.2.0';
|
|
1281
1285
|
var maxString = String.fromCharCode(65535);
|
|
1282
1286
|
var minKey = -Infinity;
|
|
1283
1287
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1299,37 +1303,11 @@
|
|
|
1299
1303
|
filter2;
|
|
1300
1304
|
}
|
|
1301
1305
|
|
|
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
1306
|
var AnyRange = {
|
|
1329
1307
|
type: 3 ,
|
|
1330
1308
|
lower: -Infinity,
|
|
1331
1309
|
lowerOpen: false,
|
|
1332
|
-
|
|
1310
|
+
upper: [[]],
|
|
1333
1311
|
upperOpen: false
|
|
1334
1312
|
};
|
|
1335
1313
|
|
|
@@ -1797,6 +1775,82 @@
|
|
|
1797
1775
|
});
|
|
1798
1776
|
}
|
|
1799
1777
|
|
|
1778
|
+
function cmp(a, b) {
|
|
1779
|
+
try {
|
|
1780
|
+
var ta = type(a);
|
|
1781
|
+
var tb = type(b);
|
|
1782
|
+
if (ta !== tb) {
|
|
1783
|
+
if (ta === 'Array')
|
|
1784
|
+
return 1;
|
|
1785
|
+
if (tb === 'Array')
|
|
1786
|
+
return -1;
|
|
1787
|
+
if (ta === 'binary')
|
|
1788
|
+
return 1;
|
|
1789
|
+
if (tb === 'binary')
|
|
1790
|
+
return -1;
|
|
1791
|
+
if (ta === 'string')
|
|
1792
|
+
return 1;
|
|
1793
|
+
if (tb === 'string')
|
|
1794
|
+
return -1;
|
|
1795
|
+
if (ta === 'Date')
|
|
1796
|
+
return 1;
|
|
1797
|
+
if (tb !== 'Date')
|
|
1798
|
+
return NaN;
|
|
1799
|
+
return -1;
|
|
1800
|
+
}
|
|
1801
|
+
switch (ta) {
|
|
1802
|
+
case 'number':
|
|
1803
|
+
case 'Date':
|
|
1804
|
+
case 'string':
|
|
1805
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
1806
|
+
case 'binary': {
|
|
1807
|
+
return compareUint8Arrays(getUint8Array(a), getUint8Array(b));
|
|
1808
|
+
}
|
|
1809
|
+
case 'Array':
|
|
1810
|
+
return compareArrays(a, b);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
catch (_a) { }
|
|
1814
|
+
return NaN;
|
|
1815
|
+
}
|
|
1816
|
+
function compareArrays(a, b) {
|
|
1817
|
+
var al = a.length;
|
|
1818
|
+
var bl = b.length;
|
|
1819
|
+
var l = al < bl ? al : bl;
|
|
1820
|
+
for (var i = 0; i < l; ++i) {
|
|
1821
|
+
var res = cmp(a[i], b[i]);
|
|
1822
|
+
if (res !== 0)
|
|
1823
|
+
return res;
|
|
1824
|
+
}
|
|
1825
|
+
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
1826
|
+
}
|
|
1827
|
+
function compareUint8Arrays(a, b) {
|
|
1828
|
+
var al = a.length;
|
|
1829
|
+
var bl = b.length;
|
|
1830
|
+
var l = al < bl ? al : bl;
|
|
1831
|
+
for (var i = 0; i < l; ++i) {
|
|
1832
|
+
if (a[i] !== b[i])
|
|
1833
|
+
return a[i] < b[i] ? -1 : 1;
|
|
1834
|
+
}
|
|
1835
|
+
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
1836
|
+
}
|
|
1837
|
+
function type(x) {
|
|
1838
|
+
var t = typeof x;
|
|
1839
|
+
if (t !== 'object')
|
|
1840
|
+
return t;
|
|
1841
|
+
if (ArrayBuffer.isView(x))
|
|
1842
|
+
return 'binary';
|
|
1843
|
+
var tsTag = toStringTag(x);
|
|
1844
|
+
return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;
|
|
1845
|
+
}
|
|
1846
|
+
function getUint8Array(a) {
|
|
1847
|
+
if (a instanceof Uint8Array)
|
|
1848
|
+
return a;
|
|
1849
|
+
if (ArrayBuffer.isView(a))
|
|
1850
|
+
return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
|
|
1851
|
+
return new Uint8Array(a);
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1800
1854
|
var Collection = (function () {
|
|
1801
1855
|
function Collection() {
|
|
1802
1856
|
}
|
|
@@ -2080,7 +2134,6 @@
|
|
|
2080
2134
|
var coreTable = ctx.table.core;
|
|
2081
2135
|
var _a = coreTable.schema.primaryKey, outbound = _a.outbound, extractKey = _a.extractKey;
|
|
2082
2136
|
var limit = _this.db._options.modifyChunkSize || 200;
|
|
2083
|
-
var cmp = _this.db.core.cmp;
|
|
2084
2137
|
var totalFailures = [];
|
|
2085
2138
|
var successCount = 0;
|
|
2086
2139
|
var failedKeys = [];
|
|
@@ -2612,7 +2665,9 @@
|
|
|
2612
2665
|
event.preventDefault();
|
|
2613
2666
|
}
|
|
2614
2667
|
|
|
2615
|
-
var
|
|
2668
|
+
var DEXIE_STORAGE_MUTATED_EVENT_NAME = 'storagemutated';
|
|
2669
|
+
var STORAGE_MUTATED_DOM_EVENT_NAME = 'x-storagemutated-1';
|
|
2670
|
+
var globalEvents = Events(null, DEXIE_STORAGE_MUTATED_EVENT_NAME);
|
|
2616
2671
|
|
|
2617
2672
|
var Transaction = (function () {
|
|
2618
2673
|
function Transaction() {
|
|
@@ -2680,7 +2735,7 @@
|
|
|
2680
2735
|
_this.active = false;
|
|
2681
2736
|
_this._resolve();
|
|
2682
2737
|
if ('mutatedParts' in idbtrans) {
|
|
2683
|
-
globalEvents.
|
|
2738
|
+
globalEvents.storagemutated.fire(idbtrans["mutatedParts"]);
|
|
2684
2739
|
}
|
|
2685
2740
|
});
|
|
2686
2741
|
return this;
|
|
@@ -2840,6 +2895,21 @@
|
|
|
2840
2895
|
};
|
|
2841
2896
|
}
|
|
2842
2897
|
|
|
2898
|
+
function safariMultiStoreFix(storeNames) {
|
|
2899
|
+
return storeNames.length === 1 ? storeNames[0] : storeNames;
|
|
2900
|
+
}
|
|
2901
|
+
var getMaxKey = function (IdbKeyRange) {
|
|
2902
|
+
try {
|
|
2903
|
+
IdbKeyRange.only([[]]);
|
|
2904
|
+
getMaxKey = function () { return [[]]; };
|
|
2905
|
+
return [[]];
|
|
2906
|
+
}
|
|
2907
|
+
catch (e) {
|
|
2908
|
+
getMaxKey = function () { return maxString; };
|
|
2909
|
+
return maxString;
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2843
2913
|
function getKeyExtractor(keyPath) {
|
|
2844
2914
|
if (keyPath == null) {
|
|
2845
2915
|
return function () { return undefined; };
|
|
@@ -2872,8 +2942,7 @@
|
|
|
2872
2942
|
keyPath :
|
|
2873
2943
|
"[" + keyPath.join('+') + "]";
|
|
2874
2944
|
}
|
|
2875
|
-
function createDBCore(db,
|
|
2876
|
-
var cmp = indexedDB.cmp.bind(indexedDB);
|
|
2945
|
+
function createDBCore(db, IdbKeyRange, tmpTrans) {
|
|
2877
2946
|
function extractSchema(db, trans) {
|
|
2878
2947
|
var tables = arrayify(db.objectStoreNames);
|
|
2879
2948
|
return {
|
|
@@ -3208,7 +3277,6 @@
|
|
|
3208
3277
|
throw new Error("Table '" + name + "' not found");
|
|
3209
3278
|
return tableMap[name];
|
|
3210
3279
|
},
|
|
3211
|
-
cmp: cmp,
|
|
3212
3280
|
MIN_KEY: -Infinity,
|
|
3213
3281
|
MAX_KEY: getMaxKey(IdbKeyRange),
|
|
3214
3282
|
schema: schema
|
|
@@ -3222,8 +3290,8 @@
|
|
|
3222
3290
|
}, stackImpl);
|
|
3223
3291
|
}
|
|
3224
3292
|
function createMiddlewareStacks(middlewares, idbdb, _a, tmpTrans) {
|
|
3225
|
-
var IDBKeyRange = _a.IDBKeyRange
|
|
3226
|
-
var dbcore = createMiddlewareStack(createDBCore(idbdb,
|
|
3293
|
+
var IDBKeyRange = _a.IDBKeyRange; _a.indexedDB;
|
|
3294
|
+
var dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);
|
|
3227
3295
|
return {
|
|
3228
3296
|
dbcore: dbcore
|
|
3229
3297
|
};
|
|
@@ -3449,12 +3517,9 @@
|
|
|
3449
3517
|
});
|
|
3450
3518
|
}
|
|
3451
3519
|
function deleteRemovedTables(newSchema, idbtrans) {
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
idbtrans.db.deleteObjectStore(storeName);
|
|
3456
|
-
}
|
|
3457
|
-
}
|
|
3520
|
+
[].slice.call(idbtrans.db.objectStoreNames).forEach(function (storeName) {
|
|
3521
|
+
return newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName);
|
|
3522
|
+
});
|
|
3458
3523
|
}
|
|
3459
3524
|
function addIndex(store, idx) {
|
|
3460
3525
|
store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });
|
|
@@ -3631,18 +3696,17 @@
|
|
|
3631
3696
|
}
|
|
3632
3697
|
|
|
3633
3698
|
function idbReady() {
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
return clearInterval(intervalId);
|
|
3645
|
-
});
|
|
3699
|
+
var isSafari = !navigator.userAgentData &&
|
|
3700
|
+
/Safari\//.test(navigator.userAgent) &&
|
|
3701
|
+
!/Chrom(e|ium)\//.test(navigator.userAgent);
|
|
3702
|
+
if (!isSafari || !indexedDB.databases)
|
|
3703
|
+
return Promise.resolve();
|
|
3704
|
+
var intervalId;
|
|
3705
|
+
return new Promise(function (resolve) {
|
|
3706
|
+
var tryIdb = function () { return indexedDB.databases().finally(resolve); };
|
|
3707
|
+
intervalId = setInterval(tryIdb, 100);
|
|
3708
|
+
tryIdb();
|
|
3709
|
+
}).finally(function () { return clearInterval(intervalId); });
|
|
3646
3710
|
}
|
|
3647
3711
|
|
|
3648
3712
|
function dexieOpen(db) {
|
|
@@ -3663,7 +3727,7 @@
|
|
|
3663
3727
|
}
|
|
3664
3728
|
var resolveDbReady = state.dbReadyResolve,
|
|
3665
3729
|
upgradeTransaction = null, wasCreated = false;
|
|
3666
|
-
return DexiePromise.race([openCanceller, idbReady().then(function () { return new DexiePromise(function (resolve, reject) {
|
|
3730
|
+
return DexiePromise.race([openCanceller, (typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(function () { return new DexiePromise(function (resolve, reject) {
|
|
3667
3731
|
throwIfCancelled();
|
|
3668
3732
|
if (!indexedDB)
|
|
3669
3733
|
throw new exceptions.MissingAPI();
|
|
@@ -3912,6 +3976,11 @@
|
|
|
3912
3976
|
cursor.continuePrimaryKey(pad(key, down.MAX_KEY, keyTail), primaryKey);
|
|
3913
3977
|
}
|
|
3914
3978
|
},
|
|
3979
|
+
primaryKey: {
|
|
3980
|
+
get: function () {
|
|
3981
|
+
return cursor.primaryKey;
|
|
3982
|
+
}
|
|
3983
|
+
},
|
|
3915
3984
|
key: {
|
|
3916
3985
|
get: function () {
|
|
3917
3986
|
var key = cursor.key;
|
|
@@ -4017,9 +4086,9 @@
|
|
|
4017
4086
|
throw new Error("Keys missing");
|
|
4018
4087
|
req = req.type === 'add' || req.type === 'put' ? __assign(__assign({}, req), { keys: keys }) : __assign({}, req);
|
|
4019
4088
|
if (req.type !== 'delete')
|
|
4020
|
-
req.values = __spreadArray([], req.values);
|
|
4089
|
+
req.values = __spreadArray([], req.values, true);
|
|
4021
4090
|
if (req.keys)
|
|
4022
|
-
req.keys = __spreadArray([], req.keys);
|
|
4091
|
+
req.keys = __spreadArray([], req.keys, true);
|
|
4023
4092
|
return getExistingValues(downTable, req, keys).then(function (existingValues) {
|
|
4024
4093
|
var contexts = keys.map(function (key, i) {
|
|
4025
4094
|
var existingValue = existingValues[i];
|
|
@@ -4105,24 +4174,6 @@
|
|
|
4105
4174
|
: table.getMany({ trans: req.trans, keys: effectiveKeys, cache: "immutable" });
|
|
4106
4175
|
}
|
|
4107
4176
|
|
|
4108
|
-
var _cmp;
|
|
4109
|
-
function cmp(a, b) {
|
|
4110
|
-
if (_cmp)
|
|
4111
|
-
return _cmp(a, b);
|
|
4112
|
-
var indexedDB = domDeps.indexedDB;
|
|
4113
|
-
if (!indexedDB)
|
|
4114
|
-
throw new exceptions.MissingAPI();
|
|
4115
|
-
_cmp = function (a, b) {
|
|
4116
|
-
try {
|
|
4117
|
-
return a == null || b == null ? NaN : indexedDB.cmp(a, b);
|
|
4118
|
-
}
|
|
4119
|
-
catch (_a) {
|
|
4120
|
-
return NaN;
|
|
4121
|
-
}
|
|
4122
|
-
};
|
|
4123
|
-
return _cmp(a, b);
|
|
4124
|
-
}
|
|
4125
|
-
|
|
4126
4177
|
function getFromTransactionCache(keys, cache, clone) {
|
|
4127
4178
|
try {
|
|
4128
4179
|
if (!cache)
|
|
@@ -4814,7 +4865,7 @@
|
|
|
4814
4865
|
}());
|
|
4815
4866
|
|
|
4816
4867
|
var symbolObservable = typeof Symbol !== "undefined" && "observable" in Symbol
|
|
4817
|
-
? Symbol
|
|
4868
|
+
? Symbol.observable
|
|
4818
4869
|
: "@@observable";
|
|
4819
4870
|
var Observable = (function () {
|
|
4820
4871
|
function Observable(subscribe) {
|
|
@@ -4863,7 +4914,7 @@
|
|
|
4863
4914
|
},
|
|
4864
4915
|
unsubscribe: function () {
|
|
4865
4916
|
closed = true;
|
|
4866
|
-
globalEvents.
|
|
4917
|
+
globalEvents.storagemutated.unsubscribe(mutationListener);
|
|
4867
4918
|
},
|
|
4868
4919
|
};
|
|
4869
4920
|
observer.start && observer.start(subscription);
|
|
@@ -4886,7 +4937,7 @@
|
|
|
4886
4937
|
var subscr = {};
|
|
4887
4938
|
var ret = execute(subscr);
|
|
4888
4939
|
if (!startedListening) {
|
|
4889
|
-
globalEvents(
|
|
4940
|
+
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, mutationListener);
|
|
4890
4941
|
startedListening = true;
|
|
4891
4942
|
}
|
|
4892
4943
|
querying = true;
|
|
@@ -4913,6 +4964,17 @@
|
|
|
4913
4964
|
});
|
|
4914
4965
|
}
|
|
4915
4966
|
|
|
4967
|
+
var domDeps;
|
|
4968
|
+
try {
|
|
4969
|
+
domDeps = {
|
|
4970
|
+
indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,
|
|
4971
|
+
IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange
|
|
4972
|
+
};
|
|
4973
|
+
}
|
|
4974
|
+
catch (e) {
|
|
4975
|
+
domDeps = { indexedDB: null, IDBKeyRange: null };
|
|
4976
|
+
}
|
|
4977
|
+
|
|
4916
4978
|
var Dexie = Dexie$1;
|
|
4917
4979
|
props(Dexie, __assign(__assign({}, fullNameExceptions), {
|
|
4918
4980
|
delete: function (databaseName) {
|
|
@@ -4985,7 +5047,7 @@
|
|
|
4985
5047
|
},
|
|
4986
5048
|
derive: derive, extend: extend, props: props, override: override,
|
|
4987
5049
|
Events: Events, on: globalEvents, liveQuery: liveQuery, extendObservabilitySet: extendObservabilitySet,
|
|
4988
|
-
getByKeyPath: getByKeyPath, setByKeyPath: setByKeyPath, delByKeyPath: delByKeyPath, shallowClone: shallowClone, deepClone: deepClone, getObjectDiff: getObjectDiff, asap: asap$1,
|
|
5050
|
+
getByKeyPath: getByKeyPath, setByKeyPath: setByKeyPath, delByKeyPath: delByKeyPath, shallowClone: shallowClone, deepClone: deepClone, getObjectDiff: getObjectDiff, cmp: cmp, asap: asap$1,
|
|
4989
5051
|
minKey: minKey,
|
|
4990
5052
|
addons: [],
|
|
4991
5053
|
connections: connections,
|
|
@@ -4996,38 +5058,46 @@
|
|
|
4996
5058
|
.reduce(function (p, c, i) { return p + (c / Math.pow(10, i * 2)); }) }));
|
|
4997
5059
|
Dexie.maxKey = getMaxKey(Dexie.dependencies.IDBKeyRange);
|
|
4998
5060
|
|
|
4999
|
-
|
|
5061
|
+
if (typeof dispatchEvent !== 'undefined' && typeof addEventListener !== 'undefined') {
|
|
5062
|
+
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (updatedParts) {
|
|
5063
|
+
if (!propagatingLocally) {
|
|
5064
|
+
var event_1;
|
|
5065
|
+
if (isIEOrEdge) {
|
|
5066
|
+
event_1 = document.createEvent('CustomEvent');
|
|
5067
|
+
event_1.initCustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, true, true, updatedParts);
|
|
5068
|
+
}
|
|
5069
|
+
else {
|
|
5070
|
+
event_1 = new CustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, {
|
|
5071
|
+
detail: updatedParts
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5074
|
+
propagatingLocally = true;
|
|
5075
|
+
dispatchEvent(event_1);
|
|
5076
|
+
propagatingLocally = false;
|
|
5077
|
+
}
|
|
5078
|
+
});
|
|
5079
|
+
addEventListener(STORAGE_MUTATED_DOM_EVENT_NAME, function (_a) {
|
|
5080
|
+
var detail = _a.detail;
|
|
5081
|
+
if (!propagatingLocally) {
|
|
5082
|
+
propagateLocally(detail);
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
function propagateLocally(updateParts) {
|
|
5000
5087
|
var wasMe = propagatingLocally;
|
|
5001
5088
|
try {
|
|
5002
5089
|
propagatingLocally = true;
|
|
5003
|
-
globalEvents.
|
|
5090
|
+
globalEvents.storagemutated.fire(updateParts);
|
|
5004
5091
|
}
|
|
5005
5092
|
finally {
|
|
5006
5093
|
propagatingLocally = wasMe;
|
|
5007
5094
|
}
|
|
5008
5095
|
}
|
|
5009
|
-
var propagateLocally = fireLocally;
|
|
5010
5096
|
var propagatingLocally = false;
|
|
5011
|
-
var accumulatedParts = {};
|
|
5012
|
-
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
5013
|
-
var fireIfVisible_1 = function () {
|
|
5014
|
-
if (document.visibilityState === "visible") {
|
|
5015
|
-
if (Object.keys(accumulatedParts).length > 0) {
|
|
5016
|
-
fireLocally(accumulatedParts);
|
|
5017
|
-
}
|
|
5018
|
-
accumulatedParts = {};
|
|
5019
|
-
}
|
|
5020
|
-
};
|
|
5021
|
-
document.addEventListener("visibilitychange", fireIfVisible_1);
|
|
5022
|
-
propagateLocally = function (changedParts) {
|
|
5023
|
-
extendObservabilitySet(accumulatedParts, changedParts);
|
|
5024
|
-
fireIfVisible_1();
|
|
5025
|
-
};
|
|
5026
|
-
}
|
|
5027
5097
|
|
|
5028
|
-
if (typeof BroadcastChannel !==
|
|
5029
|
-
var bc_1 = new BroadcastChannel(
|
|
5030
|
-
globalEvents(
|
|
5098
|
+
if (typeof BroadcastChannel !== 'undefined') {
|
|
5099
|
+
var bc_1 = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);
|
|
5100
|
+
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (changedParts) {
|
|
5031
5101
|
if (!propagatingLocally) {
|
|
5032
5102
|
bc_1.postMessage(changedParts);
|
|
5033
5103
|
}
|
|
@@ -5037,20 +5107,20 @@
|
|
|
5037
5107
|
propagateLocally(ev.data);
|
|
5038
5108
|
};
|
|
5039
5109
|
}
|
|
5040
|
-
else if (typeof self !==
|
|
5041
|
-
globalEvents(
|
|
5110
|
+
else if (typeof self !== 'undefined' && typeof navigator !== 'undefined') {
|
|
5111
|
+
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function (changedParts) {
|
|
5042
5112
|
try {
|
|
5043
5113
|
if (!propagatingLocally) {
|
|
5044
|
-
if (typeof localStorage !==
|
|
5045
|
-
localStorage.setItem(
|
|
5114
|
+
if (typeof localStorage !== 'undefined') {
|
|
5115
|
+
localStorage.setItem(STORAGE_MUTATED_DOM_EVENT_NAME, JSON.stringify({
|
|
5046
5116
|
trig: Math.random(),
|
|
5047
5117
|
changedParts: changedParts,
|
|
5048
5118
|
}));
|
|
5049
5119
|
}
|
|
5050
|
-
if (typeof self[
|
|
5051
|
-
__spreadArray([], self[
|
|
5120
|
+
if (typeof self['clients'] === 'object') {
|
|
5121
|
+
__spreadArray([], self['clients'].matchAll({ includeUncontrolled: true }), true).forEach(function (client) {
|
|
5052
5122
|
return client.postMessage({
|
|
5053
|
-
type:
|
|
5123
|
+
type: STORAGE_MUTATED_DOM_EVENT_NAME,
|
|
5054
5124
|
changedParts: changedParts,
|
|
5055
5125
|
});
|
|
5056
5126
|
});
|
|
@@ -5059,8 +5129,8 @@
|
|
|
5059
5129
|
}
|
|
5060
5130
|
catch (_a) { }
|
|
5061
5131
|
});
|
|
5062
|
-
addEventListener(
|
|
5063
|
-
if (ev.key ===
|
|
5132
|
+
addEventListener('storage', function (ev) {
|
|
5133
|
+
if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {
|
|
5064
5134
|
var data = JSON.parse(ev.newValue);
|
|
5065
5135
|
if (data)
|
|
5066
5136
|
propagateLocally(data.changedParts);
|
|
@@ -5073,7 +5143,7 @@
|
|
|
5073
5143
|
}
|
|
5074
5144
|
function propagateMessageLocally(_a) {
|
|
5075
5145
|
var data = _a.data;
|
|
5076
|
-
if (data && data.type ===
|
|
5146
|
+
if (data && data.type === STORAGE_MUTATED_DOM_EVENT_NAME) {
|
|
5077
5147
|
propagateLocally(data.changedParts);
|
|
5078
5148
|
}
|
|
5079
5149
|
}
|
|
@@ -5095,5 +5165,5 @@
|
|
|
5095
5165
|
|
|
5096
5166
|
return Dexie$1;
|
|
5097
5167
|
|
|
5098
|
-
}))
|
|
5168
|
+
}));
|
|
5099
5169
|
//# sourceMappingURL=dexie.js.map
|