dexie 4.0.1-alpha.19 → 4.0.1-alpha.21
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/README.md +46 -0
- package/dist/dexie.d.ts +1 -1
- package/dist/dexie.js +19 -44
- 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 +19 -44
- 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 +20 -43
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +1 -1
- package/pnpm-workspace.yaml +2 -0
package/dist/modern/dexie.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 4.0.1-alpha.
|
|
7
|
+
* Version 4.0.1-alpha.21+test1, Wed Jun 14 2023
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -1226,7 +1226,7 @@ function tempTransaction(db, mode, storeNames, fn) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
|
-
const DEXIE_VERSION = '4.0.1-alpha.
|
|
1229
|
+
const DEXIE_VERSION = '4.0.1-alpha.21+test1';
|
|
1230
1230
|
const maxString = String.fromCharCode(65535);
|
|
1231
1231
|
const minKey = -Infinity;
|
|
1232
1232
|
const INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1388,13 +1388,23 @@ class Table {
|
|
|
1388
1388
|
return this
|
|
1389
1389
|
.where(keyPaths[0])
|
|
1390
1390
|
.equals(indexOrCrit[keyPaths[0]]);
|
|
1391
|
-
const compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix =>
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1391
|
+
const compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix => {
|
|
1392
|
+
if (ix.compound &&
|
|
1393
|
+
keyPaths.every(keyPath => ix.keyPath.indexOf(keyPath) >= 0)) {
|
|
1394
|
+
for (let i = 0; i < keyPaths.length; ++i) {
|
|
1395
|
+
if (keyPaths.indexOf(ix.keyPath[i]) === -1)
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
return true;
|
|
1399
|
+
}
|
|
1400
|
+
return false;
|
|
1401
|
+
}).sort((a, b) => a.keyPath.length - b.keyPath.length)[0];
|
|
1402
|
+
if (compoundIndex && this.db._maxKey !== maxString) {
|
|
1403
|
+
const keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);
|
|
1395
1404
|
return this
|
|
1396
|
-
.where(
|
|
1397
|
-
.equals(
|
|
1405
|
+
.where(keyPathsInValidOrder)
|
|
1406
|
+
.equals(keyPathsInValidOrder.map(kp => indexOrCrit[kp]));
|
|
1407
|
+
}
|
|
1398
1408
|
if (!compoundIndex && debug)
|
|
1399
1409
|
console.warn(`The query ${JSON.stringify(indexOrCrit)} on ${this.name} would benefit of a ` +
|
|
1400
1410
|
`compound index [${keyPaths.join('+')}]`);
|
|
@@ -4481,9 +4491,6 @@ const observabilityMiddleware = {
|
|
|
4481
4491
|
? req.obsSet = {}
|
|
4482
4492
|
: subscr;
|
|
4483
4493
|
if (isLiveQuery) {
|
|
4484
|
-
const { signal } = PSD;
|
|
4485
|
-
if (signal && signal.aborted)
|
|
4486
|
-
throw new exceptions.Abort();
|
|
4487
4494
|
const getRangeSet = (indexName) => {
|
|
4488
4495
|
const part = `idb://${dbName}/${tableName}/${indexName}`;
|
|
4489
4496
|
return (obsSet[part] ||
|
|
@@ -4829,15 +4836,10 @@ const cacheMiddleware = {
|
|
|
4829
4836
|
...core,
|
|
4830
4837
|
transaction: (stores, mode, options) => {
|
|
4831
4838
|
const idbtrans = core.transaction(stores, mode, options);
|
|
4832
|
-
|
|
4833
|
-
if (txs || mode === 'readwrite') {
|
|
4834
|
-
if (txs)
|
|
4835
|
-
txs.push(idbtrans);
|
|
4839
|
+
if (mode === 'readwrite') {
|
|
4836
4840
|
const ac = new AbortController();
|
|
4837
4841
|
const { signal } = ac;
|
|
4838
4842
|
const endTransaction = (wasCommitted) => () => {
|
|
4839
|
-
if (txs)
|
|
4840
|
-
delArrayItem(txs, idbtrans);
|
|
4841
4843
|
ac.abort();
|
|
4842
4844
|
if (mode === 'readwrite') {
|
|
4843
4845
|
const affectedSubscribers = new Set();
|
|
@@ -4965,13 +4967,7 @@ const cacheMiddleware = {
|
|
|
4965
4967
|
});
|
|
4966
4968
|
cacheEntry = {
|
|
4967
4969
|
obsSet: req.obsSet,
|
|
4968
|
-
promise
|
|
4969
|
-
if (req.trans.aborted) {
|
|
4970
|
-
const trans = coreMW.transaction([tableName], 'readonly');
|
|
4971
|
-
return tableMW.query({ ...req, trans });
|
|
4972
|
-
}
|
|
4973
|
-
return Promise.reject(error);
|
|
4974
|
-
}),
|
|
4970
|
+
promise,
|
|
4975
4971
|
subscribers: new Set(),
|
|
4976
4972
|
type: 'query',
|
|
4977
4973
|
req,
|
|
@@ -5352,7 +5348,6 @@ function liveQuery(querier) {
|
|
|
5352
5348
|
}
|
|
5353
5349
|
let closed = false;
|
|
5354
5350
|
let abortController;
|
|
5355
|
-
const txs = [];
|
|
5356
5351
|
let accumMuts = {};
|
|
5357
5352
|
let currentObs = {};
|
|
5358
5353
|
const subscription = {
|
|
@@ -5367,13 +5362,6 @@ function liveQuery(querier) {
|
|
|
5367
5362
|
abortController.abort();
|
|
5368
5363
|
if (startedListening)
|
|
5369
5364
|
globalEvents.storagemutated.unsubscribe(mutationListener);
|
|
5370
|
-
txs.forEach(idbtrans => {
|
|
5371
|
-
idbtrans.aborted = true;
|
|
5372
|
-
try {
|
|
5373
|
-
idbtrans.abort();
|
|
5374
|
-
}
|
|
5375
|
-
catch (_a) { }
|
|
5376
|
-
});
|
|
5377
5365
|
},
|
|
5378
5366
|
};
|
|
5379
5367
|
observer.start && observer.start(subscription);
|
|
@@ -5398,19 +5386,8 @@ function liveQuery(querier) {
|
|
|
5398
5386
|
if (abortController)
|
|
5399
5387
|
abortController.abort();
|
|
5400
5388
|
abortController = new AbortController();
|
|
5401
|
-
if (txs.length) {
|
|
5402
|
-
txs.forEach(idbtrans => {
|
|
5403
|
-
idbtrans.aborted = true;
|
|
5404
|
-
try {
|
|
5405
|
-
idbtrans.abort();
|
|
5406
|
-
}
|
|
5407
|
-
catch (_a) { }
|
|
5408
|
-
});
|
|
5409
|
-
txs.length = 0;
|
|
5410
|
-
}
|
|
5411
5389
|
const ctx = {
|
|
5412
5390
|
subscr,
|
|
5413
|
-
txs,
|
|
5414
5391
|
signal: abortController.signal,
|
|
5415
5392
|
requery: doQuery,
|
|
5416
5393
|
trans: null
|