dexie 4.0.1-alpha.24 → 4.0.1-alpha.26

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.24, Thu Jul 06 2023
7
+ * Version 4.0.1-alpha.26, Fri Oct 13 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1085,6 +1085,7 @@ export interface DexieConstructor extends DexieExceptionClasses {
1085
1085
  dependencies: DexieDOMDependencies;
1086
1086
  default: Dexie; // Work-around for different build tools handling default imports differently.
1087
1087
  cache: GlobalQueryCache;
1088
+ debug: boolean | "dexie";
1088
1089
  Promise: PromiseExtendedConstructor;
1089
1090
  //TableSchema: {}; // Deprecate!
1090
1091
  //IndexSpec: {new():IndexSpec}; //? Deprecate
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.24, Thu Jul 06 2023
7
+ * Version 4.0.1-alpha.26, Fri Oct 13 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1271,7 +1271,7 @@
1271
1271
  }
1272
1272
  }
1273
1273
 
1274
- var DEXIE_VERSION = '4.0.1-alpha.24';
1274
+ var DEXIE_VERSION = '4.0.1-alpha.26';
1275
1275
  var maxString = String.fromCharCode(65535);
1276
1276
  var minKey = -Infinity;
1277
1277
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1406,7 +1406,7 @@
1406
1406
  }
1407
1407
  var wasRootExec = beginMicroTickScope();
1408
1408
  try {
1409
- return trans && trans.db === this.db ?
1409
+ return trans && trans.db._novip === this.db._novip ?
1410
1410
  trans === PSD.trans ?
1411
1411
  trans._promise(mode, checkTableInTransaction, writeLocked) :
1412
1412
  newScope(function () { return trans._promise(mode, checkTableInTransaction, writeLocked); }, { trans: trans, transless: PSD.transless || PSD }) :
@@ -3361,8 +3361,7 @@
3361
3361
  dbcore: dbcore
3362
3362
  };
3363
3363
  }
3364
- function generateMiddlewareStacks(_a, tmpTrans) {
3365
- var db = _a._novip;
3364
+ function generateMiddlewareStacks(db, tmpTrans) {
3366
3365
  var idbdb = tmpTrans.db;
3367
3366
  var stacks = createMiddlewareStacks(db._middlewares, idbdb, db._deps, tmpTrans);
3368
3367
  db.core = stacks.dbcore;
@@ -3377,8 +3376,7 @@
3377
3376
  });
3378
3377
  }
3379
3378
 
3380
- function setApiOnPlace(_a, objs, tableNames, dbschema) {
3381
- var db = _a._novip;
3379
+ function setApiOnPlace(db, objs, tableNames, dbschema) {
3382
3380
  tableNames.forEach(function (tableName) {
3383
3381
  var schema = dbschema[tableName];
3384
3382
  objs.forEach(function (obj) {
@@ -3399,8 +3397,7 @@
3399
3397
  });
3400
3398
  });
3401
3399
  }
3402
- function removeTablesApi(_a, objs) {
3403
- var db = _a._novip;
3400
+ function removeTablesApi(db, objs) {
3404
3401
  objs.forEach(function (obj) {
3405
3402
  for (var key in obj) {
3406
3403
  if (obj[key] instanceof db.Table)
@@ -3432,8 +3429,7 @@
3432
3429
  updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans).catch(rejectTransaction);
3433
3430
  });
3434
3431
  }
3435
- function updateTablesAndIndexes(_a, oldVersion, trans, idbUpgradeTrans) {
3436
- var db = _a._novip;
3432
+ function updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans) {
3437
3433
  var queue = [];
3438
3434
  var versions = db._versions;
3439
3435
  var globalSchema = db._dbSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);
@@ -3607,8 +3603,7 @@
3607
3603
  });
3608
3604
  return globalSchema;
3609
3605
  }
3610
- function readGlobalSchema(_a, idbdb, tmpTrans) {
3611
- var db = _a._novip;
3606
+ function readGlobalSchema(db, idbdb, tmpTrans) {
3612
3607
  db.verno = idbdb.version / 10;
3613
3608
  var globalSchema = db._dbSchema = buildGlobalSchema(db, idbdb, tmpTrans);
3614
3609
  db._storeNames = slice(idbdb.objectStoreNames, 0);
@@ -3619,8 +3614,7 @@
3619
3614
  var diff = getSchemaDiff(installedSchema, db._dbSchema);
3620
3615
  return !(diff.add.length || diff.change.some(function (ch) { return ch.add.length || ch.change.length; }));
3621
3616
  }
3622
- function adjustToExistingIndexNames(_a, schema, idbtrans) {
3623
- var db = _a._novip;
3617
+ function adjustToExistingIndexNames(db, schema, idbtrans) {
3624
3618
  var storeNames = idbtrans.db.objectStoreNames;
3625
3619
  for (var i = 0; i < storeNames.length; ++i) {
3626
3620
  var storeName = storeNames[i];
@@ -3958,12 +3952,12 @@
3958
3952
  extendObservabilitySet(unsignaledParts, part);
3959
3953
  if (!isTaskEnqueued) {
3960
3954
  isTaskEnqueued = true;
3961
- queueMicrotask(function () {
3955
+ setTimeout(function () {
3962
3956
  isTaskEnqueued = false;
3963
3957
  var parts = unsignaledParts;
3964
3958
  unsignaledParts = {};
3965
3959
  signalSubscribersNow(parts);
3966
- });
3960
+ }, 0);
3967
3961
  }
3968
3962
  }
3969
3963
  function signalSubscribersNow(updatedParts, deleteAffectedCacheEntries) {
@@ -4050,13 +4044,13 @@
4050
4044
  upgradeTransaction.onerror = eventRejectHandler(reject);
4051
4045
  var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;
4052
4046
  wasCreated = oldVer < 1;
4053
- db._novip.idbdb = req.result;
4047
+ db.idbdb = req.result;
4054
4048
  runUpgraders(db, oldVer / 10, upgradeTransaction, reject);
4055
4049
  }
4056
4050
  }, reject);
4057
4051
  req.onsuccess = wrap(function () {
4058
4052
  upgradeTransaction = null;
4059
- var idbdb = db._novip.idbdb = req.result;
4053
+ var idbdb = db.idbdb = req.result;
4060
4054
  var objectStoreNames = slice(idbdb.objectStoreNames);
4061
4055
  if (objectStoreNames.length > 0)
4062
4056
  try {
@@ -5116,6 +5110,16 @@
5116
5110
  },
5117
5111
  };
5118
5112
 
5113
+ function vipify(target, vipDb) {
5114
+ return new Proxy(target, {
5115
+ get: function (target, prop, receiver) {
5116
+ if (prop === 'db')
5117
+ return vipDb;
5118
+ return Reflect.get(target, prop, receiver);
5119
+ }
5120
+ });
5121
+ }
5122
+
5119
5123
  var Dexie$1 = (function () {
5120
5124
  function Dexie(name, options) {
5121
5125
  var _this = this;
@@ -5216,7 +5220,26 @@
5216
5220
  this.use(observabilityMiddleware);
5217
5221
  this.use(virtualIndexMiddleware);
5218
5222
  this.use(hooksMiddleware);
5219
- this.vip = Object.create(this, { _vip: { value: true } });
5223
+ var vipDB = new Proxy(this, {
5224
+ get: function (_, prop, receiver) {
5225
+ if (prop === '_vip')
5226
+ return true;
5227
+ if (prop === 'table')
5228
+ return function (tableName) { return vipify(_this.table(tableName), vipDB); };
5229
+ var rv = Reflect.get(_, prop, receiver);
5230
+ if (rv instanceof Table)
5231
+ return vipify(rv, vipDB);
5232
+ if (prop === 'tables')
5233
+ return rv.map(function (t) { return vipify(t, vipDB); });
5234
+ if (prop === '_createTransaction')
5235
+ return function () {
5236
+ var tx = rv.apply(this, arguments);
5237
+ return vipify(tx, vipDB);
5238
+ };
5239
+ return rv;
5240
+ }
5241
+ });
5242
+ this.vip = vipDB;
5220
5243
  addons.forEach(function (addon) { return addon(_this); });
5221
5244
  }
5222
5245
  Dexie.prototype.version = function (versionNumber) {
@@ -5288,7 +5311,7 @@
5288
5311
  this.idbdb.close();
5289
5312
  }
5290
5313
  catch (e) { }
5291
- this._novip.idbdb = null;
5314
+ this.idbdb = null;
5292
5315
  }
5293
5316
  state.dbReadyPromise = new DexiePromise(function (resolve) {
5294
5317
  state.dbReadyResolve = resolve;