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 ADDED
@@ -0,0 +1,46 @@
1
+ ## Can't find dexie.js?
2
+ Dexie's dist files are no longer checked in to github except temporarily when tagging
3
+ a release version (just so that bower will continue to work). The reason for this is because
4
+ checking in dist files bloats the commit history and makes it error prone to contribute to the
5
+ repo. To support bower though, we have to continue checking in dist files when releasing,
6
+ but that is now handled by the release.sh script, who also removes them directly afterwards.
7
+
8
+ If you still just want to download dexie.js to include in a test HTML page, go
9
+ to the following download site:
10
+
11
+ ### Download
12
+ [dexie.min.js](https://unpkg.com/dexie/dist/dexie.min.js)
13
+
14
+ [dexie.min.js.map](https://unpkg.com/dexie/dist/dexie.min.js.map)
15
+
16
+ ### Typings
17
+ [dexie.d.ts](https://unpkg.com/dexie/dist/dexie.d.ts)
18
+
19
+ ### Optional Stuff
20
+ [dexie.js (non-minified version)](https://unpkg.com/dexie/dist/dexie.js)
21
+
22
+ [dexie.js.map](https://unpkg.com/dexie/dist/dexie.js.map)
23
+
24
+ [dexie.min.js.gz (Minified and gzipped)](https://unpkg.com/dexie/dist/dexie.min.js.gz)
25
+
26
+ ## Install from NPM
27
+ ```
28
+ npm install dexie
29
+ ```
30
+
31
+ ## How to build
32
+ 1. cd to dexie package
33
+ 2. npm install
34
+ 3. npm run build
35
+
36
+ ## Contributing to Dexie.js?
37
+
38
+ Watch:
39
+ ```
40
+ npm run watch
41
+ ```
42
+
43
+ Test:
44
+ ```
45
+ npm test
46
+ ```
package/dist/dexie.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.1-alpha.19, Wed Jun 07 2023
7
+ * Version 4.0.1-alpha.21+test1, Wed Jun 14 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
package/dist/dexie.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.1-alpha.19, Wed Jun 07 2023
7
+ * Version 4.0.1-alpha.21+test1, Wed Jun 14 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1284,7 +1284,7 @@
1284
1284
  }
1285
1285
  }
1286
1286
 
1287
- var DEXIE_VERSION = '4.0.1-alpha.19';
1287
+ var DEXIE_VERSION = '4.0.1-alpha.21+test1';
1288
1288
  var maxString = String.fromCharCode(65535);
1289
1289
  var minKey = -Infinity;
1290
1290
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1450,14 +1450,22 @@
1450
1450
  .where(keyPaths[0])
1451
1451
  .equals(indexOrCrit[keyPaths[0]]);
1452
1452
  var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function (ix) {
1453
- return ix.compound &&
1454
- keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; }) &&
1455
- ix.keyPath.every(function (keyPath) { return keyPaths.indexOf(keyPath) >= 0; });
1456
- })[0];
1457
- if (compoundIndex && this.db._maxKey !== maxString)
1453
+ if (ix.compound &&
1454
+ keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; })) {
1455
+ for (var i = 0; i < keyPaths.length; ++i) {
1456
+ if (keyPaths.indexOf(ix.keyPath[i]) === -1)
1457
+ return false;
1458
+ }
1459
+ return true;
1460
+ }
1461
+ return false;
1462
+ }).sort(function (a, b) { return a.keyPath.length - b.keyPath.length; })[0];
1463
+ if (compoundIndex && this.db._maxKey !== maxString) {
1464
+ var keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);
1458
1465
  return this
1459
- .where(compoundIndex.name)
1460
- .equals(compoundIndex.keyPath.map(function (kp) { return indexOrCrit[kp]; }));
1466
+ .where(keyPathsInValidOrder)
1467
+ .equals(keyPathsInValidOrder.map(function (kp) { return indexOrCrit[kp]; }));
1468
+ }
1461
1469
  if (!compoundIndex && debug)
1462
1470
  console.warn("The query ".concat(JSON.stringify(indexOrCrit), " on ").concat(this.name, " would benefit of a ") +
1463
1471
  "compound index [".concat(keyPaths.join('+'), "]"));
@@ -4593,9 +4601,6 @@
4593
4601
  ? req.obsSet = {}
4594
4602
  : subscr;
4595
4603
  if (isLiveQuery) {
4596
- var signal = PSD.signal;
4597
- if (signal && signal.aborted)
4598
- throw new exceptions.Abort();
4599
4604
  var getRangeSet = function (indexName) {
4600
4605
  var part = "idb://".concat(dbName, "/").concat(tableName, "/").concat(indexName);
4601
4606
  return (obsSet[part] ||
@@ -4948,15 +4953,10 @@
4948
4953
  var dbName = core.schema.name;
4949
4954
  var coreMW = __assign(__assign({}, core), { transaction: function (stores, mode, options) {
4950
4955
  var idbtrans = core.transaction(stores, mode, options);
4951
- var txs = PSD.txs;
4952
- if (txs || mode === 'readwrite') {
4953
- if (txs)
4954
- txs.push(idbtrans);
4956
+ if (mode === 'readwrite') {
4955
4957
  var ac_1 = new AbortController();
4956
4958
  var signal = ac_1.signal;
4957
4959
  var endTransaction = function (wasCommitted) { return function () {
4958
- if (txs)
4959
- delArrayItem(txs, idbtrans);
4960
4960
  ac_1.abort();
4961
4961
  if (mode === 'readwrite') {
4962
4962
  var affectedSubscribers_1 = new Set();
@@ -5078,13 +5078,7 @@
5078
5078
  });
5079
5079
  cacheEntry = {
5080
5080
  obsSet: req.obsSet,
5081
- promise: promise.catch(function (error) {
5082
- if (req.trans.aborted) {
5083
- var trans = coreMW.transaction([tableName], 'readonly');
5084
- return tableMW.query(__assign(__assign({}, req), { trans: trans }));
5085
- }
5086
- return Promise.reject(error);
5087
- }),
5081
+ promise: promise,
5088
5082
  subscribers: new Set(),
5089
5083
  type: 'query',
5090
5084
  req: req,
@@ -5474,7 +5468,6 @@
5474
5468
  }
5475
5469
  var closed = false;
5476
5470
  var abortController;
5477
- var txs = [];
5478
5471
  var accumMuts = {};
5479
5472
  var currentObs = {};
5480
5473
  var subscription = {
@@ -5489,13 +5482,6 @@
5489
5482
  abortController.abort();
5490
5483
  if (startedListening)
5491
5484
  globalEvents.storagemutated.unsubscribe(mutationListener);
5492
- txs.forEach(function (idbtrans) {
5493
- idbtrans.aborted = true;
5494
- try {
5495
- idbtrans.abort();
5496
- }
5497
- catch (_a) { }
5498
- });
5499
5485
  },
5500
5486
  };
5501
5487
  observer.start && observer.start(subscription);
@@ -5520,19 +5506,8 @@
5520
5506
  if (abortController)
5521
5507
  abortController.abort();
5522
5508
  abortController = new AbortController();
5523
- if (txs.length) {
5524
- txs.forEach(function (idbtrans) {
5525
- idbtrans.aborted = true;
5526
- try {
5527
- idbtrans.abort();
5528
- }
5529
- catch (_a) { }
5530
- });
5531
- txs.length = 0;
5532
- }
5533
5509
  var ctx = {
5534
5510
  subscr: subscr,
5535
- txs: txs,
5536
5511
  signal: abortController.signal,
5537
5512
  requery: doQuery,
5538
5513
  trans: null