dexie 3.2.0-rc.2 → 3.2.0-rc.3
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 +8 -3
- package/dist/dexie.js +126 -70
- 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 +125 -70
- 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 +111 -61
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +3 -3
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-rc.
|
|
7
|
+
* Version 3.2.0-rc.3, Thu Oct 28 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;
|
|
@@ -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;
|
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-rc.
|
|
7
|
+
* Version 3.2.0-rc.3, Thu Oct 28 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-rc.
|
|
1284
|
+
var DEXIE_VERSION = '3.2.0-rc.3';
|
|
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 = [];
|
|
@@ -2842,6 +2895,21 @@
|
|
|
2842
2895
|
};
|
|
2843
2896
|
}
|
|
2844
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
|
+
|
|
2845
2913
|
function getKeyExtractor(keyPath) {
|
|
2846
2914
|
if (keyPath == null) {
|
|
2847
2915
|
return function () { return undefined; };
|
|
@@ -2874,8 +2942,7 @@
|
|
|
2874
2942
|
keyPath :
|
|
2875
2943
|
"[" + keyPath.join('+') + "]";
|
|
2876
2944
|
}
|
|
2877
|
-
function createDBCore(db,
|
|
2878
|
-
var cmp = indexedDB.cmp.bind(indexedDB);
|
|
2945
|
+
function createDBCore(db, IdbKeyRange, tmpTrans) {
|
|
2879
2946
|
function extractSchema(db, trans) {
|
|
2880
2947
|
var tables = arrayify(db.objectStoreNames);
|
|
2881
2948
|
return {
|
|
@@ -3210,7 +3277,6 @@
|
|
|
3210
3277
|
throw new Error("Table '" + name + "' not found");
|
|
3211
3278
|
return tableMap[name];
|
|
3212
3279
|
},
|
|
3213
|
-
cmp: cmp,
|
|
3214
3280
|
MIN_KEY: -Infinity,
|
|
3215
3281
|
MAX_KEY: getMaxKey(IdbKeyRange),
|
|
3216
3282
|
schema: schema
|
|
@@ -3224,8 +3290,8 @@
|
|
|
3224
3290
|
}, stackImpl);
|
|
3225
3291
|
}
|
|
3226
3292
|
function createMiddlewareStacks(middlewares, idbdb, _a, tmpTrans) {
|
|
3227
|
-
var IDBKeyRange = _a.IDBKeyRange
|
|
3228
|
-
var dbcore = createMiddlewareStack(createDBCore(idbdb,
|
|
3293
|
+
var IDBKeyRange = _a.IDBKeyRange; _a.indexedDB;
|
|
3294
|
+
var dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);
|
|
3229
3295
|
return {
|
|
3230
3296
|
dbcore: dbcore
|
|
3231
3297
|
};
|
|
@@ -3451,12 +3517,9 @@
|
|
|
3451
3517
|
});
|
|
3452
3518
|
}
|
|
3453
3519
|
function deleteRemovedTables(newSchema, idbtrans) {
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
idbtrans.db.deleteObjectStore(storeName);
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3520
|
+
[].slice.call(idbtrans.db.objectStoreNames).forEach(function (storeName) {
|
|
3521
|
+
return newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName);
|
|
3522
|
+
});
|
|
3460
3523
|
}
|
|
3461
3524
|
function addIndex(store, idx) {
|
|
3462
3525
|
store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });
|
|
@@ -4023,9 +4086,9 @@
|
|
|
4023
4086
|
throw new Error("Keys missing");
|
|
4024
4087
|
req = req.type === 'add' || req.type === 'put' ? __assign(__assign({}, req), { keys: keys }) : __assign({}, req);
|
|
4025
4088
|
if (req.type !== 'delete')
|
|
4026
|
-
req.values = __spreadArray([], req.values);
|
|
4089
|
+
req.values = __spreadArray([], req.values, true);
|
|
4027
4090
|
if (req.keys)
|
|
4028
|
-
req.keys = __spreadArray([], req.keys);
|
|
4091
|
+
req.keys = __spreadArray([], req.keys, true);
|
|
4029
4092
|
return getExistingValues(downTable, req, keys).then(function (existingValues) {
|
|
4030
4093
|
var contexts = keys.map(function (key, i) {
|
|
4031
4094
|
var existingValue = existingValues[i];
|
|
@@ -4111,24 +4174,6 @@
|
|
|
4111
4174
|
: table.getMany({ trans: req.trans, keys: effectiveKeys, cache: "immutable" });
|
|
4112
4175
|
}
|
|
4113
4176
|
|
|
4114
|
-
var _cmp;
|
|
4115
|
-
function cmp(a, b) {
|
|
4116
|
-
if (_cmp)
|
|
4117
|
-
return _cmp(a, b);
|
|
4118
|
-
var indexedDB = domDeps.indexedDB;
|
|
4119
|
-
if (!indexedDB)
|
|
4120
|
-
throw new exceptions.MissingAPI();
|
|
4121
|
-
_cmp = function (a, b) {
|
|
4122
|
-
try {
|
|
4123
|
-
return a == null || b == null ? NaN : indexedDB.cmp(a, b);
|
|
4124
|
-
}
|
|
4125
|
-
catch (_a) {
|
|
4126
|
-
return NaN;
|
|
4127
|
-
}
|
|
4128
|
-
};
|
|
4129
|
-
return _cmp(a, b);
|
|
4130
|
-
}
|
|
4131
|
-
|
|
4132
4177
|
function getFromTransactionCache(keys, cache, clone) {
|
|
4133
4178
|
try {
|
|
4134
4179
|
if (!cache)
|
|
@@ -4820,7 +4865,7 @@
|
|
|
4820
4865
|
}());
|
|
4821
4866
|
|
|
4822
4867
|
var symbolObservable = typeof Symbol !== "undefined" && "observable" in Symbol
|
|
4823
|
-
? Symbol
|
|
4868
|
+
? Symbol.observable
|
|
4824
4869
|
: "@@observable";
|
|
4825
4870
|
var Observable = (function () {
|
|
4826
4871
|
function Observable(subscribe) {
|
|
@@ -4919,6 +4964,17 @@
|
|
|
4919
4964
|
});
|
|
4920
4965
|
}
|
|
4921
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
|
+
|
|
4922
4978
|
var Dexie = Dexie$1;
|
|
4923
4979
|
props(Dexie, __assign(__assign({}, fullNameExceptions), {
|
|
4924
4980
|
delete: function (databaseName) {
|
|
@@ -4991,7 +5047,7 @@
|
|
|
4991
5047
|
},
|
|
4992
5048
|
derive: derive, extend: extend, props: props, override: override,
|
|
4993
5049
|
Events: Events, on: globalEvents, liveQuery: liveQuery, extendObservabilitySet: extendObservabilitySet,
|
|
4994
|
-
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,
|
|
4995
5051
|
minKey: minKey,
|
|
4996
5052
|
addons: [],
|
|
4997
5053
|
connections: connections,
|
|
@@ -5062,7 +5118,7 @@
|
|
|
5062
5118
|
}));
|
|
5063
5119
|
}
|
|
5064
5120
|
if (typeof self['clients'] === 'object') {
|
|
5065
|
-
__spreadArray([], self['clients'].matchAll({ includeUncontrolled: true })).forEach(function (client) {
|
|
5121
|
+
__spreadArray([], self['clients'].matchAll({ includeUncontrolled: true }), true).forEach(function (client) {
|
|
5066
5122
|
return client.postMessage({
|
|
5067
5123
|
type: STORAGE_MUTATED_DOM_EVENT_NAME,
|
|
5068
5124
|
changedParts: changedParts,
|
|
@@ -5109,5 +5165,5 @@
|
|
|
5109
5165
|
|
|
5110
5166
|
return Dexie$1;
|
|
5111
5167
|
|
|
5112
|
-
}))
|
|
5168
|
+
}));
|
|
5113
5169
|
//# sourceMappingURL=dexie.js.map
|