reactronic 0.94.25037 → 0.95.25043
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/README.md +67 -66
- package/build/dist/source/Enums.d.ts +3 -3
- package/build/dist/source/Enums.js +3 -3
- package/build/dist/source/OperationEx.d.ts +2 -2
- package/build/dist/source/OperationEx.js +5 -5
- package/build/dist/source/Options.d.ts +2 -2
- package/build/dist/source/Pipe.d.ts +2 -2
- package/build/dist/source/Pipe.js +2 -2
- package/build/dist/source/Ref.d.ts +2 -2
- package/build/dist/source/Ref.js +5 -5
- package/build/dist/source/System.d.ts +14 -14
- package/build/dist/source/System.js +22 -22
- package/build/dist/source/api.d.ts +7 -7
- package/build/dist/source/api.js +6 -6
- package/build/dist/source/core/Changeset.js +1 -1
- package/build/dist/source/core/Data.d.ts +1 -1
- package/build/dist/source/core/Indicator.d.ts +2 -2
- package/build/dist/source/core/Indicator.js +2 -2
- package/build/dist/source/core/Journal.d.ts +2 -2
- package/build/dist/source/core/Journal.js +2 -2
- package/build/dist/source/core/Mvcc.d.ts +10 -10
- package/build/dist/source/core/Mvcc.js +19 -19
- package/build/dist/source/core/MvccArray.d.ts +3 -3
- package/build/dist/source/core/MvccArray.js +4 -4
- package/build/dist/source/core/MvccMap.d.ts +3 -3
- package/build/dist/source/core/MvccMap.js +4 -4
- package/build/dist/source/core/MvccReconciliationList.d.ts +12 -11
- package/build/dist/source/core/MvccReconciliationList.js +12 -11
- package/build/dist/source/core/Operation.d.ts +8 -8
- package/build/dist/source/core/Operation.js +41 -41
- package/build/dist/source/core/Transaction.js +28 -28
- package/build/dist/source/core/TreeNode.d.ts +17 -17
- package/build/dist/source/core/TreeNode.js +52 -52
- package/build/dist/source/util/LinkedList.d.ts +52 -0
- package/build/dist/source/util/LinkedList.js +177 -0
- package/build/dist/source/util/LinkedListRenovation.d.ts +20 -0
- package/build/dist/source/util/LinkedListRenovation.js +134 -0
- package/build/dist/source/util/ReconciliationList.d.ts +10 -8
- package/build/dist/source/util/ReconciliationList.js +59 -58
- package/package.json +10 -9
|
@@ -8,9 +8,9 @@ import { Mvcc, OptionsImpl } from "./Mvcc.js";
|
|
|
8
8
|
import { JournalImpl } from "./Journal.js";
|
|
9
9
|
const BOOT_ARGS = [];
|
|
10
10
|
const BOOT_CAUSE = "<boot>";
|
|
11
|
-
const EMPTY_HANDLE = new ObjectHandle(undefined, undefined, Mvcc.
|
|
12
|
-
export class
|
|
13
|
-
configure(options) { return
|
|
11
|
+
const EMPTY_HANDLE = new ObjectHandle(undefined, undefined, Mvcc.sx, EMPTY_OBJECT_VERSION, "<boot>");
|
|
12
|
+
export class ReactionImpl {
|
|
13
|
+
configure(options) { return ReactionImpl.configureImpl(this, options); }
|
|
14
14
|
get options() { return this.peek(undefined).footprint.options; }
|
|
15
15
|
get nonreactive() { return this.peek(undefined).footprint.content; }
|
|
16
16
|
get args() { return this.use().footprint.args; }
|
|
@@ -18,7 +18,7 @@ export class ReactiveOperationImpl {
|
|
|
18
18
|
get error() { return this.use().footprint.error; }
|
|
19
19
|
get stamp() { return this.use().objectVersion.changeset.timestamp; }
|
|
20
20
|
get isReusable() { return this.use().isReusable; }
|
|
21
|
-
markObsolete() { Transaction.run({ hint: Log.isOn ? `markObsolete(${Dump.obj(this.ownerHandle, this.fieldKey)})` : "markObsolete()" },
|
|
21
|
+
markObsolete() { Transaction.run({ hint: Log.isOn ? `markObsolete(${Dump.obj(this.ownerHandle, this.fieldKey)})` : "markObsolete()" }, ReactionImpl.markObsolete, this); }
|
|
22
22
|
pullLastResult(args) { return this.reuseOrRelaunch(true, args).content; }
|
|
23
23
|
constructor(h, fk) {
|
|
24
24
|
this.ownerHandle = h;
|
|
@@ -46,7 +46,7 @@ export class ReactiveOperationImpl {
|
|
|
46
46
|
Changeset.markUsed(t, ror.objectVersion, this.fieldKey, this.ownerHandle, t.options.kind, weak);
|
|
47
47
|
return t;
|
|
48
48
|
}
|
|
49
|
-
static
|
|
49
|
+
static manageReaction(method) {
|
|
50
50
|
const ctl = Meta.get(method, Meta.Descriptor);
|
|
51
51
|
if (!ctl)
|
|
52
52
|
throw misuse(`given method is not decorated as reactronic one: ${method.name}`);
|
|
@@ -99,9 +99,9 @@ export class ReactiveOperationImpl {
|
|
|
99
99
|
const ov = ctx.lookupObjectVersion(this.ownerHandle, this.fieldKey, false);
|
|
100
100
|
const footprint = this.acquireFromObjectVersion(ov, args);
|
|
101
101
|
const applied = this.ownerHandle.applied.data[this.fieldKey];
|
|
102
|
-
const isReusable = footprint.options.kind !== Kind.
|
|
102
|
+
const isReusable = footprint.options.kind !== Kind.transaction && footprint.cause !== BOOT_CAUSE &&
|
|
103
103
|
(ctx === footprint.changeset || ctx.timestamp < footprint.obsoleteSince || applied.obsoleteDueTo === undefined) &&
|
|
104
|
-
(!footprint.options.
|
|
104
|
+
(!footprint.options.signalArgs || args === undefined ||
|
|
105
105
|
footprint.args.length === args.length && footprint.args.every((t, i) => t === args[i])) || ov.disposed;
|
|
106
106
|
return { footprint, isReusable, changeset: ctx, objectVersion: ov };
|
|
107
107
|
}
|
|
@@ -175,7 +175,7 @@ export class ReactiveOperationImpl {
|
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
177
177
|
ror = this.peek(argsx);
|
|
178
|
-
if (ror.footprint.options.kind === Kind.
|
|
178
|
+
if (ror.footprint.options.kind === Kind.transaction || !ror.isReusable) {
|
|
179
179
|
ror = this.edit();
|
|
180
180
|
if (Log.isOn && Log.opt.operation)
|
|
181
181
|
Log.write("║", " o", `${ror.footprint.why()}`);
|
|
@@ -201,7 +201,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
201
201
|
this.transaction = transaction;
|
|
202
202
|
this.descriptor = descriptor;
|
|
203
203
|
this.changeset = changeset;
|
|
204
|
-
this.
|
|
204
|
+
this.signals = new Map();
|
|
205
205
|
if (former instanceof OperationFootprintImpl) {
|
|
206
206
|
this.options = former.options;
|
|
207
207
|
this.cause = former.obsoleteDueTo;
|
|
@@ -251,7 +251,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
251
251
|
let cause;
|
|
252
252
|
if (this.cause)
|
|
253
253
|
cause = ` ◀◀ ${this.cause}`;
|
|
254
|
-
else if (this.descriptor.options.kind === Kind.
|
|
254
|
+
else if (this.descriptor.options.kind === Kind.transaction)
|
|
255
255
|
cause = " ◀◀ operation";
|
|
256
256
|
else
|
|
257
257
|
cause = ` ◀◀ T${this.changeset.id}[${this.changeset.hint}]`;
|
|
@@ -268,7 +268,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
268
268
|
if (Log.isOn && Log.opt.step && this.result)
|
|
269
269
|
Log.writeAs({ margin2: this.margin }, "║", "‾\\", `${this.hint()} - step in `, 0, " │");
|
|
270
270
|
const started = Date.now();
|
|
271
|
-
const result =
|
|
271
|
+
const result = ReactionImpl.proceedWithinGivenLaunch(this, func, ...args);
|
|
272
272
|
const ms = Date.now() - started;
|
|
273
273
|
if (Log.isOn && Log.opt.step && this.result)
|
|
274
274
|
Log.writeAs({ margin2: this.margin }, "║", "_/", `${this.hint()} - step out `, 0, this.started > 0 ? " │" : "");
|
|
@@ -283,25 +283,25 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
283
283
|
this.args = args;
|
|
284
284
|
this.obsoleteSince = MAX_REVISION;
|
|
285
285
|
if (!this.error)
|
|
286
|
-
|
|
286
|
+
ReactionImpl.proceedWithinGivenLaunch(this, OperationFootprintImpl.proceed, this, proxy);
|
|
287
287
|
else
|
|
288
288
|
this.result = Promise.reject(this.error);
|
|
289
289
|
}
|
|
290
290
|
markObsoleteDueTo(footprint, fk, changeset, h, outer, since, collector) {
|
|
291
291
|
var _a, _b, _c;
|
|
292
|
-
if (this.
|
|
292
|
+
if (this.signals !== undefined) {
|
|
293
293
|
const skip = !footprint.isComputed &&
|
|
294
294
|
changeset.id === this.lastEditorChangesetId;
|
|
295
295
|
if (!skip) {
|
|
296
296
|
const why = `${Dump.snapshot2(h, changeset, fk, footprint)} ◀◀ ${outer}`;
|
|
297
|
-
const isReactive = this.options.kind === Kind.
|
|
297
|
+
const isReactive = this.options.kind === Kind.reaction;
|
|
298
298
|
this.obsoleteDueTo = why;
|
|
299
299
|
this.obsoleteSince = since;
|
|
300
300
|
if (Log.isOn && (Log.opt.obsolete || ((_a = this.options.logging) === null || _a === void 0 ? void 0 : _a.obsolete)))
|
|
301
301
|
Log.write(Log.opt.transaction && !Changeset.current().sealed ? "║" : " ", isReactive ? "█" : "▒", isReactive && changeset === EMPTY_OBJECT_VERSION.changeset
|
|
302
302
|
? `${this.hint()} is reactive and will run automatically (order ${this.options.order})`
|
|
303
303
|
: `${this.hint()} is obsolete due to ${Dump.snapshot2(h, changeset, fk)} since s${since}${isReactive ? ` and will run automatically (order ${this.options.order})` : ""}`);
|
|
304
|
-
this.
|
|
304
|
+
this.unsubscribeFromAllSignals();
|
|
305
305
|
if (isReactive)
|
|
306
306
|
collector.push(this);
|
|
307
307
|
else
|
|
@@ -326,14 +326,14 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
326
326
|
const footprint = this.descriptor.reuseOrRelaunch(false, undefined);
|
|
327
327
|
if (footprint.result instanceof Promise)
|
|
328
328
|
footprint.result.catch(error => {
|
|
329
|
-
if (footprint.options.kind === Kind.
|
|
329
|
+
if (footprint.options.kind === Kind.reaction)
|
|
330
330
|
misuse(`reactive function ${footprint.hint()} failed and will not run anymore: ${error}`, error);
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
catch (e) {
|
|
334
334
|
if (!nothrow)
|
|
335
335
|
throw e;
|
|
336
|
-
else if (this.options.kind === Kind.
|
|
336
|
+
else if (this.options.kind === Kind.reaction)
|
|
337
337
|
misuse(`reactive ${this.hint()} failed and will not run anymore: ${e}`, e);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
@@ -346,7 +346,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
isNotUpToDate() {
|
|
349
|
-
return !this.error && (this.options.kind === Kind.
|
|
349
|
+
return !this.error && (this.options.kind === Kind.transaction ||
|
|
350
350
|
!this.successor || this.successor.transaction.isCanceled);
|
|
351
351
|
}
|
|
352
352
|
reenterOver(head) {
|
|
@@ -442,7 +442,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
442
442
|
isolation: Isolation.disjoinFromOuterAndInnerTransactions,
|
|
443
443
|
logging: Log.isOn && Log.opt.indicator ? undefined : Log.global
|
|
444
444
|
};
|
|
445
|
-
|
|
445
|
+
ReactionImpl.proceedWithinGivenLaunch(undefined, Transaction.run, options, IndicatorImpl.enter, mon, this.transaction);
|
|
446
446
|
}
|
|
447
447
|
indicatorLeave(mon) {
|
|
448
448
|
Transaction.outside(() => {
|
|
@@ -452,7 +452,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
452
452
|
isolation: Isolation.disjoinFromOuterAndInnerTransactions,
|
|
453
453
|
logging: Log.isOn && Log.opt.indicator ? undefined : Log.DefaultLevel
|
|
454
454
|
};
|
|
455
|
-
|
|
455
|
+
ReactionImpl.proceedWithinGivenLaunch(undefined, Transaction.run, options, IndicatorImpl.leave, mon, this.transaction);
|
|
456
456
|
};
|
|
457
457
|
this.transaction.whenFinished().then(leave, leave);
|
|
458
458
|
});
|
|
@@ -469,9 +469,9 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
469
469
|
x.relaunchIfNotUpToDate(true, true);
|
|
470
470
|
}
|
|
471
471
|
static markUsed(footprint, ov, fk, h, kind, weak) {
|
|
472
|
-
if (kind !== Kind.
|
|
472
|
+
if (kind !== Kind.transaction) {
|
|
473
473
|
const subscriber = OperationFootprintImpl.current;
|
|
474
|
-
if (subscriber && subscriber.options.kind !== Kind.
|
|
474
|
+
if (subscriber && subscriber.options.kind !== Kind.transaction &&
|
|
475
475
|
subscriber.transaction === Transaction.current && fk !== Meta.Handle) {
|
|
476
476
|
const ctx = Changeset.current();
|
|
477
477
|
if (ctx !== ov.changeset)
|
|
@@ -534,7 +534,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
534
534
|
if ((former.obsoleteSince === MAX_REVISION || former.obsoleteSince <= 0)) {
|
|
535
535
|
former.obsoleteDueTo = why;
|
|
536
536
|
former.obsoleteSince = timestamp;
|
|
537
|
-
former.
|
|
537
|
+
former.unsubscribeFromAllSignals();
|
|
538
538
|
}
|
|
539
539
|
const formerSuccessor = former.successor;
|
|
540
540
|
if (formerSuccessor !== curr) {
|
|
@@ -552,15 +552,15 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
if (curr instanceof OperationFootprintImpl) {
|
|
555
|
-
if (curr.changeset === ov.changeset && curr.
|
|
555
|
+
if (curr.changeset === ov.changeset && curr.signals !== undefined) {
|
|
556
556
|
if (Mvcc.repetitiveUsageWarningThreshold < Number.MAX_SAFE_INTEGER) {
|
|
557
|
-
curr.
|
|
557
|
+
curr.signals.forEach((info, v) => {
|
|
558
558
|
if (info.usageCount > Mvcc.repetitiveUsageWarningThreshold)
|
|
559
559
|
Log.write("", "[!]", `${curr.hint()} uses ${info.memberHint} ${info.usageCount} times (consider remembering it in a local variable)`, 0, " *** WARNING ***");
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
562
|
if (unsubscribe)
|
|
563
|
-
curr.
|
|
563
|
+
curr.unsubscribeFromAllSignals();
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
566
|
else if (curr instanceof ContentFootprint && curr.subscribers) {
|
|
@@ -572,7 +572,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
572
572
|
for (const r of reactions)
|
|
573
573
|
queue.push(r);
|
|
574
574
|
if (isKickOff)
|
|
575
|
-
|
|
575
|
+
ReactionImpl.proceedWithinGivenLaunch(undefined, OperationFootprintImpl.processQueuedReactions);
|
|
576
576
|
}
|
|
577
577
|
static migrateContentFootprint(cf, target) {
|
|
578
578
|
let result;
|
|
@@ -592,15 +592,15 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
592
592
|
}
|
|
593
593
|
OperationFootprintImpl.queuedReactions = [];
|
|
594
594
|
}
|
|
595
|
-
|
|
595
|
+
unsubscribeFromAllSignals() {
|
|
596
596
|
var _a;
|
|
597
|
-
(_a = this.
|
|
597
|
+
(_a = this.signals) === null || _a === void 0 ? void 0 : _a.forEach((info, value) => {
|
|
598
598
|
var _a;
|
|
599
599
|
value.subscribers.delete(this);
|
|
600
600
|
if (Log.isOn && (Log.opt.read || ((_a = this.options.logging) === null || _a === void 0 ? void 0 : _a.read)))
|
|
601
601
|
Log.write(Log.opt.transaction && !Changeset.current().sealed ? "║" : " ", "-", `${this.hint()} is unsubscribed from ${info.memberHint}`);
|
|
602
602
|
});
|
|
603
|
-
this.
|
|
603
|
+
this.signals = undefined;
|
|
604
604
|
}
|
|
605
605
|
subscribeTo(footprint, ov, fk, h, timestamp) {
|
|
606
606
|
var _a, _b, _c;
|
|
@@ -609,15 +609,15 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
609
609
|
if (ok) {
|
|
610
610
|
let times = 0;
|
|
611
611
|
if (Mvcc.repetitiveUsageWarningThreshold < Number.MAX_SAFE_INTEGER) {
|
|
612
|
-
const existing = this.
|
|
612
|
+
const existing = this.signals.get(footprint);
|
|
613
613
|
times = existing ? existing.usageCount + 1 : 1;
|
|
614
614
|
}
|
|
615
|
-
if (this.
|
|
615
|
+
if (this.signals !== undefined) {
|
|
616
616
|
if (!footprint.subscribers)
|
|
617
617
|
footprint.subscribers = new Set();
|
|
618
618
|
const subscription = { memberHint: Dump.snapshot2(h, ov.changeset, fk), usageCount: times };
|
|
619
619
|
footprint.subscribers.add(this);
|
|
620
|
-
this.
|
|
620
|
+
this.signals.set(footprint, subscription);
|
|
621
621
|
if (Log.isOn && (Log.opt.read || ((_a = this.options.logging) === null || _a === void 0 ? void 0 : _a.read)))
|
|
622
622
|
Log.write("║", " ∞", `${this.hint()} is subscribed to ${Dump.snapshot2(h, ov.changeset, fk, footprint)}${subscription.usageCount > 1 ? ` (${subscription.usageCount} times)` : ""}`);
|
|
623
623
|
}
|
|
@@ -639,7 +639,7 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
639
639
|
return result;
|
|
640
640
|
}
|
|
641
641
|
static createOperationDescriptor(h, fk, options) {
|
|
642
|
-
const ctl = new
|
|
642
|
+
const ctl = new ReactionImpl(h, fk);
|
|
643
643
|
const operation = (...args) => {
|
|
644
644
|
return ctl.reuseOrRelaunch(false, args).result;
|
|
645
645
|
};
|
|
@@ -649,14 +649,14 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
649
649
|
static rememberOperationOptions(proto, fk, getter, setter, enumerable, configurable, options, implicit) {
|
|
650
650
|
const initial = Meta.acquire(proto, Meta.Initial);
|
|
651
651
|
let footprint = initial[fk];
|
|
652
|
-
const ctl = footprint ? footprint.descriptor : new
|
|
652
|
+
const ctl = footprint ? footprint.descriptor : new ReactionImpl(EMPTY_HANDLE, fk);
|
|
653
653
|
const opts = footprint ? footprint.options : OptionsImpl.INITIAL;
|
|
654
654
|
initial[fk] = footprint = new OperationFootprintImpl(Transaction.current, ctl, EMPTY_OBJECT_VERSION.changeset, new OptionsImpl(getter, setter, opts, options, implicit), false);
|
|
655
|
-
if (footprint.options.kind === Kind.
|
|
655
|
+
if (footprint.options.kind === Kind.reaction && footprint.options.throttling < Number.MAX_SAFE_INTEGER) {
|
|
656
656
|
const reactive = Meta.acquire(proto, Meta.Reactive);
|
|
657
657
|
reactive[fk] = footprint;
|
|
658
658
|
}
|
|
659
|
-
else if (footprint.options.kind === Kind.
|
|
659
|
+
else if (footprint.options.kind === Kind.reaction && footprint.options.throttling >= Number.MAX_SAFE_INTEGER) {
|
|
660
660
|
const reactive = Meta.getFrom(proto, Meta.Reactive);
|
|
661
661
|
delete reactive[fk];
|
|
662
662
|
}
|
|
@@ -678,20 +678,20 @@ class OperationFootprintImpl extends ContentFootprint {
|
|
|
678
678
|
Promise.prototype.then = reactronicHookedThen;
|
|
679
679
|
try {
|
|
680
680
|
Object.defineProperty(globalThis, "rWhy", {
|
|
681
|
-
get:
|
|
681
|
+
get: ReactionImpl.why, configurable: false, enumerable: false,
|
|
682
682
|
});
|
|
683
683
|
Object.defineProperty(globalThis, "rBriefWhy", {
|
|
684
|
-
get:
|
|
684
|
+
get: ReactionImpl.briefWhy, configurable: false, enumerable: false,
|
|
685
685
|
});
|
|
686
686
|
}
|
|
687
687
|
catch (e) {
|
|
688
688
|
}
|
|
689
689
|
try {
|
|
690
690
|
Object.defineProperty(global, "rWhy", {
|
|
691
|
-
get:
|
|
691
|
+
get: ReactionImpl.why, configurable: false, enumerable: false,
|
|
692
692
|
});
|
|
693
693
|
Object.defineProperty(global, "rBriefWhy", {
|
|
694
|
-
get:
|
|
694
|
+
get: ReactionImpl.briefWhy, configurable: false, enumerable: false,
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
697
|
catch (e) {
|
|
@@ -363,10 +363,10 @@ export class TransactionImpl extends Transaction {
|
|
|
363
363
|
if (subscribers) {
|
|
364
364
|
const migratedSubscribers = migrated.subscribers = new Set();
|
|
365
365
|
subscribers.forEach(o => {
|
|
366
|
-
const
|
|
367
|
-
const sub =
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
const conformingSignals = o.signals;
|
|
367
|
+
const sub = conformingSignals.get(cfParent);
|
|
368
|
+
conformingSignals.delete(cfParent);
|
|
369
|
+
conformingSignals.set(migrated, sub);
|
|
370
370
|
migratedSubscribers.add(o);
|
|
371
371
|
});
|
|
372
372
|
cfParent.subscribers = undefined;
|
|
@@ -377,24 +377,24 @@ export class TransactionImpl extends Transaction {
|
|
|
377
377
|
if (migratedSubscribers === undefined)
|
|
378
378
|
migratedSubscribers = migrated.subscribers = new Set();
|
|
379
379
|
subscribers.forEach(o => {
|
|
380
|
-
const
|
|
381
|
-
const sub =
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
const conformingSignals = o.signals;
|
|
381
|
+
const sub = conformingSignals.get(cf);
|
|
382
|
+
conformingSignals.delete(cf);
|
|
383
|
+
conformingSignals.set(migrated, sub);
|
|
384
384
|
migratedSubscribers.add(o);
|
|
385
385
|
});
|
|
386
386
|
cf.subscribers = undefined;
|
|
387
387
|
}
|
|
388
|
-
const
|
|
389
|
-
const
|
|
390
|
-
if (
|
|
391
|
-
|
|
388
|
+
const signals = cf.signals;
|
|
389
|
+
const migratedSignals = migrated.signals;
|
|
390
|
+
if (signals) {
|
|
391
|
+
signals.forEach((s, o) => {
|
|
392
392
|
const conformingSubscribers = o.subscribers;
|
|
393
393
|
conformingSubscribers.delete(cf);
|
|
394
394
|
conformingSubscribers.add(migrated);
|
|
395
|
-
|
|
395
|
+
migratedSignals.set(o, s);
|
|
396
396
|
});
|
|
397
|
-
|
|
397
|
+
signals.clear();
|
|
398
398
|
}
|
|
399
399
|
ovParent.data[fk] = migrated;
|
|
400
400
|
}
|
|
@@ -403,24 +403,24 @@ export class TransactionImpl extends Transaction {
|
|
|
403
403
|
if (subscribers) {
|
|
404
404
|
const migratedReactions = migrated.subscribers = new Set();
|
|
405
405
|
subscribers.forEach(o => {
|
|
406
|
-
const
|
|
407
|
-
const sub =
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
const conformingSignals = o.signals;
|
|
407
|
+
const sub = conformingSignals.get(cf);
|
|
408
|
+
conformingSignals.delete(cf);
|
|
409
|
+
conformingSignals.set(migrated, sub);
|
|
410
410
|
migratedReactions.add(o);
|
|
411
411
|
});
|
|
412
412
|
cf.subscribers = undefined;
|
|
413
413
|
}
|
|
414
|
-
const
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
417
|
-
|
|
414
|
+
const signals = cf.signals;
|
|
415
|
+
const migratedSignals = migrated.signals;
|
|
416
|
+
if (signals) {
|
|
417
|
+
signals.forEach((s, o) => {
|
|
418
418
|
const conformingSubscribers = o.subscribers;
|
|
419
419
|
conformingSubscribers.delete(cf);
|
|
420
420
|
conformingSubscribers.add(migrated);
|
|
421
|
-
|
|
421
|
+
migratedSignals.set(o, s);
|
|
422
422
|
});
|
|
423
|
-
|
|
423
|
+
signals.clear();
|
|
424
424
|
}
|
|
425
425
|
ovParent.data[fk] = migrated;
|
|
426
426
|
}
|
|
@@ -436,10 +436,10 @@ export class TransactionImpl extends Transaction {
|
|
|
436
436
|
if (cfParent.subscribers === undefined)
|
|
437
437
|
cfParent.subscribers = new Set();
|
|
438
438
|
subscribers.forEach(o => {
|
|
439
|
-
const
|
|
440
|
-
const sub =
|
|
441
|
-
|
|
442
|
-
|
|
439
|
+
const conformingSignals = o.signals;
|
|
440
|
+
const sub = conformingSignals.get(cf);
|
|
441
|
+
conformingSignals.delete(cf);
|
|
442
|
+
conformingSignals.set(cfParent, sub);
|
|
443
443
|
cfParent.subscribers.add(o);
|
|
444
444
|
});
|
|
445
445
|
}
|
|
@@ -2,10 +2,10 @@ import { LoggingOptions } from "../Logging.js";
|
|
|
2
2
|
import { ReconciliationList, ReconciliationListReader, LinkedItem } from "../util/ReconciliationList.js";
|
|
3
3
|
import { Priority, Mode } from "../Enums.js";
|
|
4
4
|
import { ReactivityOptions } from "../Options.js";
|
|
5
|
-
import {
|
|
6
|
-
export type Script<E> = (
|
|
7
|
-
export type ScriptAsync<E> = (
|
|
8
|
-
export type Handler<E = unknown, R = void> = (
|
|
5
|
+
import { SxObject } from "../core/Mvcc.js";
|
|
6
|
+
export type Script<E> = (o: E, basis: () => void) => void;
|
|
7
|
+
export type ScriptAsync<E> = (o: E, basis: () => Promise<void>) => Promise<void>;
|
|
8
|
+
export type Handler<E = unknown, R = void> = (o: E) => R;
|
|
9
9
|
export declare function declare<E = void>(driver: ReactiveTreeNodeDriver<E>, script?: Script<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, preparation?: Script<E>, preparationAsync?: ScriptAsync<E>, finalization?: Script<E>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<E>): ReactiveTreeNode<E>;
|
|
10
10
|
export declare function declare<E = void>(driver: ReactiveTreeNodeDriver<E>, declaration?: ReactiveTreeNodeDecl<E>): ReactiveTreeNode<E>;
|
|
11
11
|
export declare function declare<E = void>(driver: ReactiveTreeNodeDriver<E>, scriptOrDeclaration?: Script<E> | ReactiveTreeNodeDecl<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, preparation?: Script<E>, preparationAsync?: ScriptAsync<E>, finalization?: Script<E>, triggers?: unknown, basis?: ReactiveTreeNodeDecl<E>): ReactiveTreeNode<E>;
|
|
@@ -93,15 +93,15 @@ export declare class ReactiveTreeVariable<T extends Object = Object> {
|
|
|
93
93
|
get value(): T;
|
|
94
94
|
get valueOrUndefined(): T | undefined;
|
|
95
95
|
}
|
|
96
|
-
export declare function generateKey(owner?:
|
|
96
|
+
export declare function generateKey(owner?: ReactiveTreeNode$): string;
|
|
97
97
|
export declare function getModeUsingBasisChain(declaration?: ReactiveTreeNodeDecl<any>): Mode;
|
|
98
|
-
declare class
|
|
99
|
-
next:
|
|
98
|
+
declare class ReactiveTreeNodeContext$<T extends Object = Object> extends SxObject implements ReactiveTreeNodeContext<T> {
|
|
99
|
+
next: ReactiveTreeNodeContext$<object> | undefined;
|
|
100
100
|
variable: ReactiveTreeVariable<T>;
|
|
101
101
|
value: T;
|
|
102
102
|
constructor(variable: ReactiveTreeVariable<T>, value: T);
|
|
103
103
|
}
|
|
104
|
-
declare class
|
|
104
|
+
declare class ReactiveTreeNode$<E = unknown> extends ReactiveTreeNode<E> {
|
|
105
105
|
static logging: LoggingOptions | undefined;
|
|
106
106
|
static grandNodeCount: number;
|
|
107
107
|
static disposableNodeCount: number;
|
|
@@ -109,18 +109,18 @@ declare class ReactiveTreeNodeImpl<E = unknown> extends ReactiveTreeNode<E> {
|
|
|
109
109
|
readonly driver: ReactiveTreeNodeDriver<E>;
|
|
110
110
|
declaration: ReactiveTreeNodeDecl<E>;
|
|
111
111
|
readonly level: number;
|
|
112
|
-
readonly owner:
|
|
112
|
+
readonly owner: ReactiveTreeNode$;
|
|
113
113
|
readonly element: E;
|
|
114
|
-
host:
|
|
115
|
-
readonly children: ReconciliationList<
|
|
116
|
-
slot: LinkedItem<
|
|
114
|
+
host: ReactiveTreeNode$;
|
|
115
|
+
readonly children: ReconciliationList<ReactiveTreeNode$>;
|
|
116
|
+
slot: LinkedItem<ReactiveTreeNode$<E>> | undefined;
|
|
117
117
|
stamp: number;
|
|
118
|
-
outer:
|
|
119
|
-
context:
|
|
118
|
+
outer: ReactiveTreeNode$;
|
|
119
|
+
context: ReactiveTreeNodeContext$<any> | undefined;
|
|
120
120
|
numerator: number;
|
|
121
121
|
priority: Priority;
|
|
122
122
|
childrenShuffling: boolean;
|
|
123
|
-
constructor(key: string, driver: ReactiveTreeNodeDriver<E>, declaration: Readonly<ReactiveTreeNodeDecl<E>>, owner:
|
|
123
|
+
constructor(key: string, driver: ReactiveTreeNodeDriver<E>, declaration: Readonly<ReactiveTreeNodeDecl<E>>, owner: ReactiveTreeNode$ | undefined);
|
|
124
124
|
getUri(relativeTo?: ReactiveTreeNode<any>): string;
|
|
125
125
|
get strictOrder(): boolean;
|
|
126
126
|
set strictOrder(value: boolean);
|
|
@@ -128,10 +128,10 @@ declare class ReactiveTreeNodeImpl<E = unknown> extends ReactiveTreeNode<E> {
|
|
|
128
128
|
has(mode: Mode): boolean;
|
|
129
129
|
script(_triggers: unknown): void;
|
|
130
130
|
configureReactivity(options: Partial<ReactivityOptions>): ReactivityOptions;
|
|
131
|
-
static get nodeSlot(): LinkedItem<
|
|
131
|
+
static get nodeSlot(): LinkedItem<ReactiveTreeNode$>;
|
|
132
132
|
static tryUseTreeVariableValue<T extends Object>(variable: ReactiveTreeVariable<T>): T | undefined;
|
|
133
133
|
static useTreeVariableValue<T extends Object>(variable: ReactiveTreeVariable<T>): T;
|
|
134
134
|
static setTreeVariableValue<T extends Object>(variable: ReactiveTreeVariable<T>, value: T | undefined): void;
|
|
135
135
|
}
|
|
136
|
-
export declare function
|
|
136
|
+
export declare function signalsAreEqual(a1: any, a2: any): boolean;
|
|
137
137
|
export {};
|