reactronic 0.24.274 → 0.24.301
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 +2 -2
- package/build/dist/source/Options.d.ts +10 -4
- package/build/dist/source/Options.js +8 -0
- package/build/dist/source/RxSystem.d.ts +2 -2
- package/build/dist/source/RxSystem.js +21 -10
- package/build/dist/source/api.d.ts +3 -3
- package/build/dist/source/api.js +1 -1
- package/build/dist/source/core/Changeset.d.ts +23 -21
- package/build/dist/source/core/Changeset.js +145 -143
- package/build/dist/source/core/Data.d.ts +17 -18
- package/build/dist/source/core/Data.js +8 -7
- package/build/dist/source/core/Indicator.js +9 -8
- package/build/dist/source/core/Journal.d.ts +2 -2
- package/build/dist/source/core/Journal.js +36 -35
- package/build/dist/source/core/Mvcc.d.ts +12 -12
- package/build/dist/source/core/Mvcc.js +47 -62
- package/build/dist/source/core/{Reaction.d.ts → Operation.d.ts} +21 -19
- package/build/dist/source/core/{Reaction.js → Operation.js} +181 -152
- package/build/dist/source/core/RxNode.d.ts +17 -15
- package/build/dist/source/core/RxNode.js +37 -37
- package/build/dist/source/core/Transaction.d.ts +61 -2
- package/build/dist/source/core/Transaction.js +175 -16
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Isolation } from "../Options.js";
|
|
1
2
|
import { ObservableObject } from "./Mvcc.js";
|
|
2
|
-
import { Meta,
|
|
3
|
-
import { Changeset,
|
|
3
|
+
import { Meta, FieldVersion } from "./Data.js";
|
|
4
|
+
import { Changeset, EMPTY_OBJECT_VERSION } from "./Changeset.js";
|
|
4
5
|
import { Transaction } from "./Transaction.js";
|
|
5
6
|
import { Sealant } from "../util/Sealant.js";
|
|
6
7
|
export class Journal extends ObservableObject {
|
|
@@ -22,7 +23,7 @@ export class JournalImpl extends Journal {
|
|
|
22
23
|
get canUndo() { return this._edits.length > 0 && this._position > 0; }
|
|
23
24
|
get canRedo() { return this._position < this._edits.length; }
|
|
24
25
|
edited(p) {
|
|
25
|
-
Transaction.run({ hint: "EditJournal.edited",
|
|
26
|
+
Transaction.run({ hint: "EditJournal.edited", isolation: Isolation.disjoinFromOuterAndInnerTransactions }, () => {
|
|
26
27
|
const items = this._edits = this._edits.toMutable();
|
|
27
28
|
if (items.length >= this._capacity)
|
|
28
29
|
items.shift();
|
|
@@ -40,7 +41,7 @@ export class JournalImpl extends Journal {
|
|
|
40
41
|
throw new Error("not implemented");
|
|
41
42
|
}
|
|
42
43
|
undo(count = 1) {
|
|
43
|
-
Transaction.run({ hint: "Journal.undo",
|
|
44
|
+
Transaction.run({ hint: "Journal.undo", isolation: Isolation.disjoinFromOuterAndInnerTransactions }, () => {
|
|
44
45
|
let i = this._position - 1;
|
|
45
46
|
while (i >= 0 && count > 0) {
|
|
46
47
|
const patch = this._edits[i];
|
|
@@ -52,7 +53,7 @@ export class JournalImpl extends Journal {
|
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
redo(count = 1) {
|
|
55
|
-
Transaction.run({ hint: "Journal.redo",
|
|
56
|
+
Transaction.run({ hint: "Journal.redo", isolation: Isolation.disjoinFromOuterAndInnerTransactions }, () => {
|
|
56
57
|
let i = this._position;
|
|
57
58
|
while (i < this._edits.length && count > 0) {
|
|
58
59
|
const patch = this._edits[i];
|
|
@@ -65,22 +66,22 @@ export class JournalImpl extends Journal {
|
|
|
65
66
|
}
|
|
66
67
|
static buildPatch(hint, items) {
|
|
67
68
|
const patch = new Map();
|
|
68
|
-
items.forEach((
|
|
69
|
+
items.forEach((ov, h) => {
|
|
69
70
|
const op = new Map();
|
|
70
|
-
const former =
|
|
71
|
-
|
|
71
|
+
const former = ov.former.objectVersion !== EMPTY_OBJECT_VERSION ? ov.former.objectVersion.data : undefined;
|
|
72
|
+
ov.changes.forEach(fk => {
|
|
72
73
|
const vp = {
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
fieldKey: fk, patchKind: "update",
|
|
75
|
+
freshContent: unseal(ov.data[fk]), formerContent: undefined,
|
|
75
76
|
};
|
|
76
77
|
if (former)
|
|
77
|
-
vp.
|
|
78
|
-
op.set(
|
|
78
|
+
vp.formerContent = unseal(former[fk]);
|
|
79
|
+
op.set(fk, vp);
|
|
79
80
|
});
|
|
80
81
|
if (!former) {
|
|
81
82
|
const vp = {
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
fieldKey: Meta.Revision, patchKind: "remove",
|
|
84
|
+
freshContent: Meta.Undefined, formerContent: undefined,
|
|
84
85
|
};
|
|
85
86
|
op.set(Meta.Revision, vp);
|
|
86
87
|
}
|
|
@@ -93,15 +94,15 @@ export class JournalImpl extends Journal {
|
|
|
93
94
|
patch.forEach((op, obj) => {
|
|
94
95
|
const h = Meta.get(obj, Meta.Handle);
|
|
95
96
|
const rev = op.get(Meta.Revision);
|
|
96
|
-
const disposed = rev && (undoing ? rev.
|
|
97
|
+
const disposed = rev && (undoing ? rev.formerContent : rev.freshContent) === Meta.Undefined;
|
|
97
98
|
if (!disposed) {
|
|
98
|
-
op.forEach((vp,
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
const existing =
|
|
104
|
-
Changeset.markEdited(existing,
|
|
99
|
+
op.forEach((vp, fk) => {
|
|
100
|
+
const content = undoing ? vp.formerContent : vp.freshContent;
|
|
101
|
+
const ov = ctx.getEditableObjectVersion(h, fk, content);
|
|
102
|
+
if (ov.changeset === ctx) {
|
|
103
|
+
ov.data[fk] = new FieldVersion(content);
|
|
104
|
+
const existing = ov.former.objectVersion.data[fk];
|
|
105
|
+
Changeset.markEdited(existing, content, existing !== content, ov, fk, h);
|
|
105
106
|
}
|
|
106
107
|
});
|
|
107
108
|
}
|
|
@@ -115,21 +116,21 @@ export class JournalImpl extends Journal {
|
|
|
115
116
|
let result = unsaved.get(obj);
|
|
116
117
|
if (!result)
|
|
117
118
|
unsaved.set(obj, result = new Map());
|
|
118
|
-
op.forEach((vp,
|
|
119
|
-
let merged = result.get(
|
|
119
|
+
op.forEach((vp, fk) => {
|
|
120
|
+
let merged = result.get(fk);
|
|
120
121
|
if (!merged)
|
|
121
|
-
result.set(
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
result.set(fk, merged = {
|
|
123
|
+
fieldKey: fk, patchKind: "update",
|
|
124
|
+
freshContent: undefined, formerContent: undefined,
|
|
124
125
|
});
|
|
125
|
-
const value = undoing ? vp.
|
|
126
|
-
const former = undoing ? vp.
|
|
127
|
-
if (value !== merged.
|
|
128
|
-
merged.
|
|
129
|
-
merged.
|
|
126
|
+
const value = undoing ? vp.formerContent : vp.freshContent;
|
|
127
|
+
const former = undoing ? vp.freshContent : vp.formerContent;
|
|
128
|
+
if (value !== merged.formerContent) {
|
|
129
|
+
merged.freshContent = value;
|
|
130
|
+
merged.formerContent = former;
|
|
130
131
|
}
|
|
131
132
|
else {
|
|
132
|
-
result.delete(
|
|
133
|
+
result.delete(fk);
|
|
133
134
|
if (result.size === 0)
|
|
134
135
|
unsaved.delete(obj);
|
|
135
136
|
}
|
|
@@ -137,8 +138,8 @@ export class JournalImpl extends Journal {
|
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
|
-
function unseal(
|
|
141
|
-
const result =
|
|
141
|
+
function unseal(fv) {
|
|
142
|
+
const result = fv.content;
|
|
142
143
|
const createCopy = result === null || result === void 0 ? void 0 : result[Sealant.CreateCopy];
|
|
143
144
|
return createCopy !== undefined ? createCopy.call(result) : result;
|
|
144
145
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { F } from "../util/Utils.js";
|
|
2
|
-
import { MemberOptions, Kind, Reentrance } from "../Options.js";
|
|
2
|
+
import { MemberOptions, Kind, Reentrance, Isolation } from "../Options.js";
|
|
3
3
|
import { LoggingOptions, ProfilingOptions } from "../Logging.js";
|
|
4
|
-
import {
|
|
4
|
+
import { FieldKey, ObjectHandle } from "./Data.js";
|
|
5
5
|
import { Journal } from "./Journal.js";
|
|
6
6
|
import { Indicator } from "./Indicator.js";
|
|
7
7
|
export declare abstract class MvccObject {
|
|
@@ -18,7 +18,7 @@ export declare class OptionsImpl implements MemberOptions {
|
|
|
18
18
|
readonly getter: Function;
|
|
19
19
|
readonly setter: Function;
|
|
20
20
|
readonly kind: Kind;
|
|
21
|
-
readonly
|
|
21
|
+
readonly isolation: Isolation;
|
|
22
22
|
readonly order: number;
|
|
23
23
|
readonly noSideEffects: boolean;
|
|
24
24
|
readonly triggeringArgs: boolean;
|
|
@@ -41,14 +41,14 @@ export declare class Mvcc implements ProxyHandler<ObjectHandle> {
|
|
|
41
41
|
readonly isObservable: boolean;
|
|
42
42
|
constructor(isObservable: boolean);
|
|
43
43
|
getPrototypeOf(h: ObjectHandle): object | null;
|
|
44
|
-
get(h: ObjectHandle,
|
|
45
|
-
set(h: ObjectHandle,
|
|
46
|
-
has(h: ObjectHandle,
|
|
47
|
-
defineProperty?(h: ObjectHandle,
|
|
48
|
-
getOwnPropertyDescriptor(h: ObjectHandle,
|
|
44
|
+
get(h: ObjectHandle, fk: FieldKey, receiver: any): any;
|
|
45
|
+
set(h: ObjectHandle, fk: FieldKey, value: any, receiver: any): boolean;
|
|
46
|
+
has(h: ObjectHandle, fk: FieldKey): boolean;
|
|
47
|
+
defineProperty?(h: ObjectHandle, name: string | symbol, attributes: PropertyDescriptor): boolean;
|
|
48
|
+
getOwnPropertyDescriptor(h: ObjectHandle, fk: FieldKey): PropertyDescriptor | undefined;
|
|
49
49
|
ownKeys(h: ObjectHandle): Array<string | symbol>;
|
|
50
|
-
static decorateData(isObservable: boolean, proto: any,
|
|
51
|
-
static decorateOperation(implicit: boolean, decorator: Function, options: Partial<MemberOptions>, proto: any, member:
|
|
50
|
+
static decorateData(isObservable: boolean, proto: any, fk: FieldKey): any;
|
|
51
|
+
static decorateOperation(implicit: boolean, decorator: Function, options: Partial<MemberOptions>, proto: any, member: FieldKey, pd: PropertyDescriptor | undefined): any;
|
|
52
52
|
static decorateOperationParametrized(decorator: Function, options: Partial<MemberOptions>): F<any>;
|
|
53
53
|
static acquireHandle(obj: any): ObjectHandle;
|
|
54
54
|
static createHandleForMvccObject(proto: any, data: any, blank: any, hint: string, isObservable: boolean): ObjectHandle;
|
|
@@ -56,6 +56,6 @@ export declare class Mvcc implements ProxyHandler<ObjectHandle> {
|
|
|
56
56
|
static sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
|
|
57
57
|
static setHint<T>(obj: T, hint: string | undefined): T;
|
|
58
58
|
static getHint<T>(obj: T): string;
|
|
59
|
-
static createOperation: (h: ObjectHandle,
|
|
60
|
-
static rememberOperationOptions: (proto: any,
|
|
59
|
+
static createOperation: (h: ObjectHandle, fk: FieldKey, options: OptionsImpl) => F<any>;
|
|
60
|
+
static rememberOperationOptions: (proto: any, fk: FieldKey, getter: Function | undefined, setter: Function | undefined, enumerable: boolean, configurable: boolean, options: Partial<MemberOptions>, implicit: boolean) => OptionsImpl;
|
|
61
61
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UNDEF } from "../util/Utils.js";
|
|
2
2
|
import { Log, misuse } from "../util/Dbg.js";
|
|
3
|
-
import { Kind, Reentrance } from "../Options.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Changeset, Dump,
|
|
3
|
+
import { Kind, Reentrance, Isolation } from "../Options.js";
|
|
4
|
+
import { ObjectVersion, ObjectHandle, FieldVersion, Meta } from "./Data.js";
|
|
5
|
+
import { Changeset, Dump, EMPTY_OBJECT_VERSION } from "./Changeset.js";
|
|
6
6
|
export class MvccObject {
|
|
7
7
|
constructor(observable) {
|
|
8
8
|
const proto = new.target.prototype;
|
|
@@ -27,7 +27,7 @@ export class ObservableObject extends MvccObject {
|
|
|
27
27
|
}
|
|
28
28
|
const DEFAULT_OPTIONS = Object.freeze({
|
|
29
29
|
kind: Kind.plain,
|
|
30
|
-
|
|
30
|
+
isolation: Isolation.joinToCurrentTransaction,
|
|
31
31
|
order: 0,
|
|
32
32
|
noSideEffects: false,
|
|
33
33
|
triggeringArgs: false,
|
|
@@ -42,7 +42,7 @@ export class OptionsImpl {
|
|
|
42
42
|
this.getter = getter !== undefined ? getter : existing.getter;
|
|
43
43
|
this.setter = setter !== undefined ? setter : existing.setter;
|
|
44
44
|
this.kind = merge(DEFAULT_OPTIONS.kind, existing.kind, patch.kind, implicit);
|
|
45
|
-
this.
|
|
45
|
+
this.isolation = merge(DEFAULT_OPTIONS.isolation, existing.isolation, patch.isolation, implicit);
|
|
46
46
|
this.order = merge(DEFAULT_OPTIONS.order, existing.order, patch.order, implicit);
|
|
47
47
|
this.noSideEffects = merge(DEFAULT_OPTIONS.noSideEffects, existing.noSideEffects, patch.noSideEffects, implicit);
|
|
48
48
|
this.triggeringArgs = merge(DEFAULT_OPTIONS.triggeringArgs, existing.triggeringArgs, patch.triggeringArgs, implicit);
|
|
@@ -66,92 +66,77 @@ export class Mvcc {
|
|
|
66
66
|
getPrototypeOf(h) {
|
|
67
67
|
return Reflect.getPrototypeOf(h.data);
|
|
68
68
|
}
|
|
69
|
-
get(h,
|
|
69
|
+
get(h, fk, receiver) {
|
|
70
70
|
let result;
|
|
71
|
-
if (
|
|
71
|
+
if (fk !== Meta.Handle) {
|
|
72
72
|
const cs = Changeset.current();
|
|
73
|
-
const
|
|
74
|
-
result =
|
|
75
|
-
if (result instanceof
|
|
73
|
+
const ov = cs.getObjectVersion(h, fk);
|
|
74
|
+
result = ov.data[fk];
|
|
75
|
+
if (result instanceof FieldVersion && !result.isLaunch) {
|
|
76
76
|
if (this.isObservable)
|
|
77
|
-
Changeset.markUsed(result,
|
|
77
|
+
Changeset.markUsed(result, ov, fk, h, Kind.plain, false);
|
|
78
78
|
result = result.content;
|
|
79
79
|
}
|
|
80
80
|
else
|
|
81
|
-
result = Reflect.get(h.data,
|
|
81
|
+
result = Reflect.get(h.data, fk, receiver);
|
|
82
82
|
}
|
|
83
83
|
else
|
|
84
84
|
result = h;
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
|
-
set(h,
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (curr === undefined || curr.content !== value || Mvcc.sensitivity) {
|
|
93
|
-
const existing = curr === null || curr === void 0 ? void 0 : curr.content;
|
|
94
|
-
if (os.former.snapshot.data[m] === curr) {
|
|
95
|
-
curr = os.data[m] = new ValueSnapshot(value);
|
|
96
|
-
Changeset.markEdited(existing, value, true, os, m, h);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
curr.content = value;
|
|
100
|
-
Changeset.markEdited(existing, value, true, os, m, h);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else
|
|
105
|
-
Reflect.set(h.data, m, value, receiver);
|
|
106
|
-
}
|
|
87
|
+
set(h, fk, value, receiver) {
|
|
88
|
+
const cs = Changeset.edit();
|
|
89
|
+
const ov = cs.getEditableObjectVersion(h, fk, value);
|
|
90
|
+
if (ov !== EMPTY_OBJECT_VERSION)
|
|
91
|
+
cs.setFieldContent(h, fk, ov, value, receiver, Mvcc.sensitivity);
|
|
107
92
|
else
|
|
108
|
-
h.data[
|
|
93
|
+
h.data[fk] = value;
|
|
109
94
|
return true;
|
|
110
95
|
}
|
|
111
|
-
has(h,
|
|
112
|
-
const
|
|
113
|
-
return
|
|
96
|
+
has(h, fk) {
|
|
97
|
+
const ov = Changeset.current().getObjectVersion(h, fk);
|
|
98
|
+
return fk in ov.data || fk in h.data;
|
|
114
99
|
}
|
|
115
|
-
defineProperty(h,
|
|
100
|
+
defineProperty(h, name, attributes) {
|
|
116
101
|
const result = attributes.get !== undefined && attributes.set !== undefined;
|
|
117
102
|
if (result)
|
|
118
|
-
Object.defineProperty(h.data,
|
|
103
|
+
Object.defineProperty(h.data, name, attributes);
|
|
119
104
|
return result;
|
|
120
105
|
}
|
|
121
|
-
getOwnPropertyDescriptor(h,
|
|
122
|
-
const
|
|
123
|
-
const pd = Reflect.getOwnPropertyDescriptor(
|
|
106
|
+
getOwnPropertyDescriptor(h, fk) {
|
|
107
|
+
const ov = Changeset.current().getObjectVersion(h, fk);
|
|
108
|
+
const pd = Reflect.getOwnPropertyDescriptor(ov.data, fk);
|
|
124
109
|
if (pd)
|
|
125
110
|
pd.configurable = pd.writable = true;
|
|
126
111
|
return pd;
|
|
127
112
|
}
|
|
128
113
|
ownKeys(h) {
|
|
129
|
-
const
|
|
114
|
+
const ov = Changeset.current().getObjectVersion(h, Meta.Handle);
|
|
130
115
|
const result = [];
|
|
131
|
-
for (const
|
|
132
|
-
const
|
|
133
|
-
if (!(
|
|
134
|
-
result.push(
|
|
116
|
+
for (const fk of Object.getOwnPropertyNames(ov.data)) {
|
|
117
|
+
const field = ov.data[fk];
|
|
118
|
+
if (!(field instanceof FieldVersion) || !field.isLaunch)
|
|
119
|
+
result.push(fk);
|
|
135
120
|
}
|
|
136
121
|
return result;
|
|
137
122
|
}
|
|
138
|
-
static decorateData(isObservable, proto,
|
|
123
|
+
static decorateData(isObservable, proto, fk) {
|
|
139
124
|
if (isObservable) {
|
|
140
|
-
Meta.acquire(proto, Meta.Initial)[
|
|
125
|
+
Meta.acquire(proto, Meta.Initial)[fk] = new FieldVersion(undefined);
|
|
141
126
|
const get = function () {
|
|
142
127
|
const h = Mvcc.acquireHandle(this);
|
|
143
|
-
return Mvcc.observable.get(h,
|
|
128
|
+
return Mvcc.observable.get(h, fk, this);
|
|
144
129
|
};
|
|
145
130
|
const set = function (value) {
|
|
146
131
|
const h = Mvcc.acquireHandle(this);
|
|
147
|
-
return Mvcc.observable.set(h,
|
|
132
|
+
return Mvcc.observable.set(h, fk, value, this);
|
|
148
133
|
};
|
|
149
134
|
const enumerable = true;
|
|
150
135
|
const configurable = false;
|
|
151
|
-
return Object.defineProperty(proto,
|
|
136
|
+
return Object.defineProperty(proto, fk, { get, set, enumerable, configurable });
|
|
152
137
|
}
|
|
153
138
|
else
|
|
154
|
-
Meta.acquire(proto, Meta.Initial)[
|
|
139
|
+
Meta.acquire(proto, Meta.Initial)[fk] = Meta.Raw;
|
|
155
140
|
}
|
|
156
141
|
static decorateOperation(implicit, decorator, options, proto, member, pd) {
|
|
157
142
|
var _a, _b, _c, _d;
|
|
@@ -192,22 +177,22 @@ export class Mvcc {
|
|
|
192
177
|
if (obj !== Object(obj) || Array.isArray(obj))
|
|
193
178
|
throw misuse("only objects can be observable");
|
|
194
179
|
const initial = Meta.getFrom(Object.getPrototypeOf(obj), Meta.Initial);
|
|
195
|
-
const
|
|
196
|
-
h = new ObjectHandle(obj, obj, Mvcc.observable,
|
|
197
|
-
Meta.set(
|
|
180
|
+
const ov = new ObjectVersion(EMPTY_OBJECT_VERSION.changeset, EMPTY_OBJECT_VERSION, Object.assign({}, initial));
|
|
181
|
+
h = new ObjectHandle(obj, obj, Mvcc.observable, ov, obj.constructor.name);
|
|
182
|
+
Meta.set(ov.data, Meta.Handle, h);
|
|
198
183
|
Meta.set(obj, Meta.Handle, h);
|
|
199
|
-
Meta.set(
|
|
184
|
+
Meta.set(ov.data, Meta.Revision, new FieldVersion(1));
|
|
200
185
|
}
|
|
201
186
|
return h;
|
|
202
187
|
}
|
|
203
188
|
static createHandleForMvccObject(proto, data, blank, hint, isObservable) {
|
|
204
189
|
const ctx = Changeset.edit();
|
|
205
190
|
const mvcc = isObservable ? Mvcc.observable : Mvcc.transactional;
|
|
206
|
-
const h = new ObjectHandle(data, undefined, mvcc,
|
|
207
|
-
ctx.
|
|
191
|
+
const h = new ObjectHandle(data, undefined, mvcc, EMPTY_OBJECT_VERSION, hint);
|
|
192
|
+
ctx.getEditableObjectVersion(h, Meta.Handle, blank);
|
|
208
193
|
if (!Mvcc.reactivityAutoStartDisabled)
|
|
209
|
-
for (const
|
|
210
|
-
h.proxy[
|
|
194
|
+
for (const fk in Meta.getFrom(proto, Meta.Reactive))
|
|
195
|
+
h.proxy[fk][Meta.Controller].markObsolete();
|
|
211
196
|
return h;
|
|
212
197
|
}
|
|
213
198
|
static setProfilingMode(isOn, options) {
|
|
@@ -253,10 +238,10 @@ Mvcc.asyncActionDurationWarningThreshold = Number.MAX_SAFE_INTEGER;
|
|
|
253
238
|
Mvcc.sensitivity = false;
|
|
254
239
|
Mvcc.transactional = new Mvcc(false);
|
|
255
240
|
Mvcc.observable = new Mvcc(true);
|
|
256
|
-
Mvcc.createOperation = function (h,
|
|
241
|
+
Mvcc.createOperation = function (h, fk, options) {
|
|
257
242
|
throw misuse("this implementation of createOperation should never be called");
|
|
258
243
|
};
|
|
259
|
-
Mvcc.rememberOperationOptions = function (proto,
|
|
244
|
+
Mvcc.rememberOperationOptions = function (proto, fk, getter, setter, enumerable, configurable, options, implicit) {
|
|
260
245
|
throw misuse("this implementation of rememberOperationOptions should never be called");
|
|
261
246
|
};
|
|
262
247
|
const EMPTY_PROP_DESCRIPTOR = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { F } from "../util/Utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Operation, MemberOptions } from "../Options.js";
|
|
3
|
+
import { FieldKey, ObjectHandle, FieldVersion, Observer, Subscription, AbstractChangeset } from "./Data.js";
|
|
4
4
|
import { Transaction } from "./Transaction.js";
|
|
5
5
|
import { OptionsImpl } from "./Mvcc.js";
|
|
6
|
-
export declare class
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
6
|
+
export declare class OperationImpl implements Operation<any> {
|
|
7
|
+
readonly ownerHandle: ObjectHandle;
|
|
8
|
+
readonly fieldKey: FieldKey;
|
|
9
9
|
configure(options: Partial<MemberOptions>): MemberOptions;
|
|
10
10
|
get options(): MemberOptions;
|
|
11
11
|
get unobs(): any;
|
|
@@ -16,10 +16,10 @@ export declare class ReactionImpl implements AbstractReaction<any> {
|
|
|
16
16
|
get isUpToDate(): boolean;
|
|
17
17
|
markObsolete(): void;
|
|
18
18
|
pullLastResult(args?: any[]): any;
|
|
19
|
-
constructor(h: ObjectHandle,
|
|
19
|
+
constructor(h: ObjectHandle, fk: FieldKey);
|
|
20
20
|
reuseOrRelaunch(weak: boolean, args: any[] | undefined): Launch;
|
|
21
|
-
static getControllerOf(method: F<any>):
|
|
22
|
-
static configureImpl(self:
|
|
21
|
+
static getControllerOf(method: F<any>): Operation<any>;
|
|
22
|
+
static configureImpl(self: OperationImpl | undefined, options: Partial<MemberOptions>): MemberOptions;
|
|
23
23
|
static proceedWithinGivenLaunch<T>(launch: Launch | undefined, func: F<T>, ...args: any[]): T;
|
|
24
24
|
static why(): string;
|
|
25
25
|
static briefWhy(): string;
|
|
@@ -27,19 +27,19 @@ export declare class ReactionImpl implements AbstractReaction<any> {
|
|
|
27
27
|
private peek;
|
|
28
28
|
private use;
|
|
29
29
|
private edit;
|
|
30
|
-
private
|
|
30
|
+
private acquireFromObjectVersion;
|
|
31
31
|
private relaunch;
|
|
32
32
|
private static markObsolete;
|
|
33
33
|
}
|
|
34
|
-
declare class Launch extends
|
|
34
|
+
declare class Launch extends FieldVersion implements Observer {
|
|
35
35
|
static current?: Launch;
|
|
36
|
-
static
|
|
37
|
-
static
|
|
36
|
+
static queuedReactiveOperations: Array<Observer>;
|
|
37
|
+
static deferredReactiveOperations: Array<Launch>;
|
|
38
38
|
readonly margin: number;
|
|
39
39
|
readonly transaction: Transaction;
|
|
40
|
-
readonly
|
|
40
|
+
readonly operation: OperationImpl;
|
|
41
41
|
readonly changeset: AbstractChangeset;
|
|
42
|
-
observables: Map<
|
|
42
|
+
observables: Map<FieldVersion, Subscription> | undefined;
|
|
43
43
|
options: OptionsImpl;
|
|
44
44
|
cause: string | undefined;
|
|
45
45
|
args: any[];
|
|
@@ -49,18 +49,19 @@ declare class Launch extends ValueSnapshot implements Observer {
|
|
|
49
49
|
obsoleteDueTo: string | undefined;
|
|
50
50
|
obsoleteSince: number;
|
|
51
51
|
successor: Launch | undefined;
|
|
52
|
-
constructor(
|
|
53
|
-
get
|
|
52
|
+
constructor(transaction: Transaction, operation: OperationImpl, changeset: AbstractChangeset, former: Launch | OptionsImpl, clone: boolean);
|
|
53
|
+
get isLaunch(): boolean;
|
|
54
54
|
get originSnapshotId(): number;
|
|
55
55
|
hint(): string;
|
|
56
56
|
get order(): number;
|
|
57
57
|
get ["#this#"](): string;
|
|
58
|
+
clone(t: Transaction, cs: AbstractChangeset): FieldVersion;
|
|
58
59
|
why(): string;
|
|
59
60
|
briefWhy(): string;
|
|
60
61
|
dependencies(): string[];
|
|
61
62
|
wrap<T>(func: F<T>): F<T>;
|
|
62
63
|
proceed(proxy: any, args: any[] | undefined): void;
|
|
63
|
-
markObsoleteDueTo(observable:
|
|
64
|
+
markObsoleteDueTo(observable: FieldVersion, fk: FieldKey, changeset: AbstractChangeset, h: ObjectHandle, outer: string, since: number, obsolete: Observer[]): void;
|
|
64
65
|
relaunchIfNotUpToDate(now: boolean, nothrow: boolean): void;
|
|
65
66
|
isNotUpToDate(): boolean;
|
|
66
67
|
reenterOver(head: Launch): this;
|
|
@@ -77,9 +78,10 @@ declare class Launch extends ValueSnapshot implements Observer {
|
|
|
77
78
|
private static isConflicting;
|
|
78
79
|
private static propagateAllChangesThroughSubscriptions;
|
|
79
80
|
private static revokeAllSubscriptions;
|
|
80
|
-
private static
|
|
81
|
+
private static propagateFieldChangeThroughSubscriptions;
|
|
81
82
|
private static enqueueReactiveFunctionsToRun;
|
|
82
|
-
private static
|
|
83
|
+
private static createFieldVersion;
|
|
84
|
+
private static processQueuedReactiveOperations;
|
|
83
85
|
private unsubscribeFromAllObservables;
|
|
84
86
|
private subscribeTo;
|
|
85
87
|
private static canSubscribeTo;
|