dexie 4.0.1-alpha.23 → 4.0.1-alpha.24

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.1-alpha.23, Tue Jul 04 2023
7
+ * Version 4.0.1-alpha.24, Thu Jul 06 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.23, Tue Jul 04 2023
7
+ * Version 4.0.1-alpha.24, Thu Jul 06 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -612,21 +612,9 @@
612
612
  var NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;
613
613
  var patchGlobalPromise = !!resolvedGlobalPromise;
614
614
  var stack_being_generated = false;
615
- var schedulePhysicalTick = resolvedGlobalPromise ?
616
- function () { resolvedGlobalPromise.then(physicalTick); }
617
- :
618
- _global.setImmediate ?
619
- setImmediate.bind(null, physicalTick) :
620
- _global.MutationObserver ?
621
- function () {
622
- var hiddenDiv = document.createElement("div");
623
- (new MutationObserver(function () {
624
- physicalTick();
625
- hiddenDiv = null;
626
- })).observe(hiddenDiv, { attributes: true });
627
- hiddenDiv.setAttribute('i', '1');
628
- } :
629
- function () { setTimeout(physicalTick, 0); };
615
+ function schedulePhysicalTick() {
616
+ queueMicrotask(physicalTick);
617
+ }
630
618
  var asap = function (callback, args) {
631
619
  microtickQueue.push([callback, args]);
632
620
  if (needsNewPhysicalTick) {
@@ -1003,7 +991,9 @@
1003
991
  }
1004
992
  }
1005
993
  function physicalTick() {
1006
- beginMicroTickScope() && endMicroTickScope();
994
+ usePSD(globalPSD, function () {
995
+ beginMicroTickScope() && endMicroTickScope();
996
+ });
1007
997
  }
1008
998
  function beginMicroTickScope() {
1009
999
  var wasRootExec = isOutsideMicroTick;
@@ -1166,7 +1156,7 @@
1166
1156
  function switchToZone(targetZone, bEnteringZone) {
1167
1157
  var currentZone = PSD;
1168
1158
  if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {
1169
- enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);
1159
+ queueMicrotask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);
1170
1160
  }
1171
1161
  if (targetZone === PSD)
1172
1162
  return;
@@ -1216,9 +1206,6 @@
1216
1206
  switchToZone(outerScope, false);
1217
1207
  }
1218
1208
  }
1219
- function enqueueNativeMicroTask(job) {
1220
- nativePromiseThen.call(resolvedNativePromise, job);
1221
- }
1222
1209
  function nativeAwaitCompatibleWrap(fn, zone, possibleAwait, cleanup) {
1223
1210
  return typeof fn !== 'function' ? fn : function () {
1224
1211
  var outerZone = PSD;
@@ -1231,7 +1218,7 @@
1231
1218
  finally {
1232
1219
  switchToZone(outerZone, false);
1233
1220
  if (cleanup)
1234
- enqueueNativeMicroTask(decrementExpectedAwaits);
1221
+ queueMicrotask(decrementExpectedAwaits);
1235
1222
  }
1236
1223
  };
1237
1224
  }
@@ -1284,7 +1271,7 @@
1284
1271
  }
1285
1272
  }
1286
1273
 
1287
- var DEXIE_VERSION = '4.0.1-alpha.23';
1274
+ var DEXIE_VERSION = '4.0.1-alpha.24';
1288
1275
  var maxString = String.fromCharCode(65535);
1289
1276
  var minKey = -Infinity;
1290
1277
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -5473,14 +5460,20 @@
5473
5460
  var observable = new Observable(function (observer) {
5474
5461
  var scopeFuncIsAsync = isAsyncFunction(querier);
5475
5462
  function execute(ctx) {
5476
- if (scopeFuncIsAsync) {
5477
- incrementExpectedAwaits();
5463
+ var wasRootExec = beginMicroTickScope();
5464
+ try {
5465
+ if (scopeFuncIsAsync) {
5466
+ incrementExpectedAwaits();
5467
+ }
5468
+ var rv = newScope(querier, ctx);
5469
+ if (scopeFuncIsAsync) {
5470
+ rv.finally(decrementExpectedAwaits);
5471
+ }
5472
+ return rv;
5478
5473
  }
5479
- var rv = newScope(querier, ctx);
5480
- if (scopeFuncIsAsync) {
5481
- rv.finally(decrementExpectedAwaits);
5474
+ finally {
5475
+ wasRootExec && endMicroTickScope();
5482
5476
  }
5483
- return rv;
5484
5477
  }
5485
5478
  var closed = false;
5486
5479
  var abortController;