dexie 3.2.4-beta.1 → 3.2.5
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 +1 -1
- package/dist/dexie.js +93 -72
- 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 +93 -72
- 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 +94 -71
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +4 -1
package/dist/dexie.d.ts
CHANGED
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.
|
|
7
|
+
* Version 3.2.5, Thu Feb 08 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function getByKeyPath(obj, keyPath) {
|
|
139
|
-
if (hasOwn(obj, keyPath))
|
|
139
|
+
if (typeof keyPath === 'string' && hasOwn(obj, keyPath))
|
|
140
140
|
return obj[keyPath];
|
|
141
141
|
if (!keyPath)
|
|
142
142
|
return obj;
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
function flatten(a) {
|
|
220
220
|
return concat.apply([], a);
|
|
221
221
|
}
|
|
222
|
-
var intrinsicTypeNames = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey"
|
|
222
|
+
var intrinsicTypeNames = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey"
|
|
223
223
|
.split(',').concat(flatten([8, 16, 32, 64].map(function (num) { return ["Int", "Uint", "Float"].map(function (t) { return t + num + "Array"; }); }))).filter(function (t) { return _global[t]; });
|
|
224
224
|
var intrinsicTypes = intrinsicTypeNames.map(function (t) { return _global[t]; });
|
|
225
225
|
arrayToObject(intrinsicTypeNames, function (x) { return [x, true]; });
|
|
@@ -1287,7 +1287,7 @@
|
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
1289
|
|
|
1290
|
-
var DEXIE_VERSION = '3.2.
|
|
1290
|
+
var DEXIE_VERSION = '3.2.5';
|
|
1291
1291
|
var maxString = String.fromCharCode(65535);
|
|
1292
1292
|
var minKey = -Infinity;
|
|
1293
1293
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1373,14 +1373,22 @@
|
|
|
1373
1373
|
.where(keyPaths[0])
|
|
1374
1374
|
.equals(indexOrCrit[keyPaths[0]]);
|
|
1375
1375
|
var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function (ix) {
|
|
1376
|
-
|
|
1377
|
-
keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; })
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1376
|
+
if (ix.compound &&
|
|
1377
|
+
keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; })) {
|
|
1378
|
+
for (var i = 0; i < keyPaths.length; ++i) {
|
|
1379
|
+
if (keyPaths.indexOf(ix.keyPath[i]) === -1)
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
return true;
|
|
1383
|
+
}
|
|
1384
|
+
return false;
|
|
1385
|
+
}).sort(function (a, b) { return a.keyPath.length - b.keyPath.length; })[0];
|
|
1386
|
+
if (compoundIndex && this.db._maxKey !== maxString) {
|
|
1387
|
+
var keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);
|
|
1381
1388
|
return this
|
|
1382
|
-
.where(
|
|
1383
|
-
.equals(
|
|
1389
|
+
.where(keyPathsInValidOrder)
|
|
1390
|
+
.equals(keyPathsInValidOrder.map(function (kp) { return indexOrCrit[kp]; }));
|
|
1391
|
+
}
|
|
1384
1392
|
if (!compoundIndex && debug)
|
|
1385
1393
|
console.warn("The query " + JSON.stringify(indexOrCrit) + " on " + this.name + " would benefit of a " +
|
|
1386
1394
|
("compound index [" + keyPaths.join('+') + "]"));
|
|
@@ -3733,69 +3741,82 @@
|
|
|
3733
3741
|
}
|
|
3734
3742
|
var resolveDbReady = state.dbReadyResolve,
|
|
3735
3743
|
upgradeTransaction = null, wasCreated = false;
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3744
|
+
var tryOpenDB = function () { return new DexiePromise(function (resolve, reject) {
|
|
3745
|
+
throwIfCancelled();
|
|
3746
|
+
if (!indexedDB)
|
|
3747
|
+
throw new exceptions.MissingAPI();
|
|
3748
|
+
var dbName = db.name;
|
|
3749
|
+
var req = state.autoSchema ?
|
|
3750
|
+
indexedDB.open(dbName) :
|
|
3751
|
+
indexedDB.open(dbName, Math.round(db.verno * 10));
|
|
3752
|
+
if (!req)
|
|
3753
|
+
throw new exceptions.MissingAPI();
|
|
3754
|
+
req.onerror = eventRejectHandler(reject);
|
|
3755
|
+
req.onblocked = wrap(db._fireOnBlocked);
|
|
3756
|
+
req.onupgradeneeded = wrap(function (e) {
|
|
3757
|
+
upgradeTransaction = req.transaction;
|
|
3758
|
+
if (state.autoSchema && !db._options.allowEmptyDB) {
|
|
3759
|
+
req.onerror = preventDefault;
|
|
3760
|
+
upgradeTransaction.abort();
|
|
3761
|
+
req.result.close();
|
|
3762
|
+
var delreq = indexedDB.deleteDatabase(dbName);
|
|
3763
|
+
delreq.onsuccess = delreq.onerror = wrap(function () {
|
|
3764
|
+
reject(new exceptions.NoSuchDatabase("Database " + dbName + " doesnt exist"));
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3767
|
+
else {
|
|
3768
|
+
upgradeTransaction.onerror = eventRejectHandler(reject);
|
|
3769
|
+
var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;
|
|
3770
|
+
wasCreated = oldVer < 1;
|
|
3771
|
+
db._novip.idbdb = req.result;
|
|
3772
|
+
runUpgraders(db, oldVer / 10, upgradeTransaction, reject);
|
|
3773
|
+
}
|
|
3774
|
+
}, reject);
|
|
3775
|
+
req.onsuccess = wrap(function () {
|
|
3776
|
+
upgradeTransaction = null;
|
|
3777
|
+
var idbdb = db._novip.idbdb = req.result;
|
|
3778
|
+
var objectStoreNames = slice(idbdb.objectStoreNames);
|
|
3779
|
+
if (objectStoreNames.length > 0)
|
|
3780
|
+
try {
|
|
3781
|
+
var tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');
|
|
3782
|
+
if (state.autoSchema)
|
|
3783
|
+
readGlobalSchema(db, idbdb, tmpTrans);
|
|
3784
|
+
else {
|
|
3785
|
+
adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);
|
|
3786
|
+
if (!verifyInstalledSchema(db, tmpTrans)) {
|
|
3787
|
+
console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.");
|
|
3781
3788
|
}
|
|
3782
|
-
generateMiddlewareStacks(db, tmpTrans);
|
|
3783
|
-
}
|
|
3784
|
-
catch (e) {
|
|
3785
3789
|
}
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
}
|
|
3798
|
-
|
|
3790
|
+
generateMiddlewareStacks(db, tmpTrans);
|
|
3791
|
+
}
|
|
3792
|
+
catch (e) {
|
|
3793
|
+
}
|
|
3794
|
+
connections.push(db);
|
|
3795
|
+
idbdb.onversionchange = wrap(function (ev) {
|
|
3796
|
+
state.vcFired = true;
|
|
3797
|
+
db.on("versionchange").fire(ev);
|
|
3798
|
+
});
|
|
3799
|
+
idbdb.onclose = wrap(function (ev) {
|
|
3800
|
+
db.on("close").fire(ev);
|
|
3801
|
+
});
|
|
3802
|
+
if (wasCreated)
|
|
3803
|
+
_onDatabaseCreated(db._deps, dbName);
|
|
3804
|
+
resolve();
|
|
3805
|
+
}, reject);
|
|
3806
|
+
}).catch(function (err) {
|
|
3807
|
+
if (err && err.name === 'UnknownError' && state.PR1398_maxLoop > 0) {
|
|
3808
|
+
state.PR1398_maxLoop--;
|
|
3809
|
+
console.warn('Dexie: Workaround for Chrome UnknownError on open()');
|
|
3810
|
+
return tryOpenDB();
|
|
3811
|
+
}
|
|
3812
|
+
else {
|
|
3813
|
+
return DexiePromise.reject(err);
|
|
3814
|
+
}
|
|
3815
|
+
}); };
|
|
3816
|
+
return DexiePromise.race([
|
|
3817
|
+
openCanceller,
|
|
3818
|
+
(typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)
|
|
3819
|
+
]).then(function () {
|
|
3799
3820
|
throwIfCancelled();
|
|
3800
3821
|
state.onReadyBeingFired = [];
|
|
3801
3822
|
return DexiePromise.resolve(vip(function () { return db.on.ready.fire(db.vip); })).then(function fireRemainders() {
|