reactronic 0.24.275 → 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 +2 -2
- 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.js +5 -5
- package/build/dist/source/core/Transaction.d.ts +61 -2
- package/build/dist/source/core/Transaction.js +175 -16
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -310,7 +310,7 @@ function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
|
|
|
310
310
|
|
|
311
311
|
export type SnapshotOptions = {
|
|
312
312
|
readonly hint?: string
|
|
313
|
-
readonly
|
|
313
|
+
readonly isolation?: Isolation
|
|
314
314
|
readonly journal?: Journal
|
|
315
315
|
readonly logging?: Partial<LoggingOptions>
|
|
316
316
|
readonly token?: any
|
|
@@ -318,7 +318,7 @@ export type SnapshotOptions = {
|
|
|
318
318
|
|
|
319
319
|
type MemberOptions = {
|
|
320
320
|
readonly kind: Kind
|
|
321
|
-
readonly
|
|
321
|
+
readonly isolation: Isolation
|
|
322
322
|
readonly order: number
|
|
323
323
|
readonly noSideEffects: boolean
|
|
324
324
|
readonly triggeringArgs: boolean
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { LoggingOptions } from "./Logging.js";
|
|
2
|
-
import { SeparationMode } from "./core/Data.js";
|
|
3
2
|
export { LoggingLevel } from "./Logging.js";
|
|
4
3
|
export type { LoggingOptions, ProfilingOptions } from "./Logging.js";
|
|
5
4
|
import { Journal } from "./core/Journal.js";
|
|
6
5
|
import { Indicator } from "./core/Indicator.js";
|
|
7
6
|
export type SnapshotOptions = {
|
|
8
7
|
readonly hint?: string;
|
|
9
|
-
readonly
|
|
8
|
+
readonly isolation?: Isolation;
|
|
10
9
|
readonly journal?: Journal;
|
|
11
10
|
readonly logging?: Partial<LoggingOptions>;
|
|
12
11
|
readonly token?: any;
|
|
13
12
|
};
|
|
14
13
|
export type MemberOptions = {
|
|
15
14
|
readonly kind: Kind;
|
|
16
|
-
readonly
|
|
15
|
+
readonly isolation: Isolation;
|
|
17
16
|
readonly order: number;
|
|
18
17
|
readonly noSideEffects: boolean;
|
|
19
18
|
readonly triggeringArgs: boolean;
|
|
@@ -37,7 +36,14 @@ export declare enum Reentrance {
|
|
|
37
36
|
overwritePrevious = -3,
|
|
38
37
|
runSideBySide = -4
|
|
39
38
|
}
|
|
40
|
-
export
|
|
39
|
+
export declare enum Isolation {
|
|
40
|
+
joinToCurrentTransaction = 0,
|
|
41
|
+
joinAsNestedTransaction = 1,
|
|
42
|
+
disjoinFromOuterTransaction = 2,
|
|
43
|
+
disjoinFromOuterAndInnerTransactions = 3,
|
|
44
|
+
disjoinForInternalDisposal = 4
|
|
45
|
+
}
|
|
46
|
+
export type Operation<T> = {
|
|
41
47
|
readonly options: MemberOptions;
|
|
42
48
|
readonly args: ReadonlyArray<any>;
|
|
43
49
|
readonly result: T;
|
|
@@ -15,3 +15,11 @@ export var Reentrance;
|
|
|
15
15
|
Reentrance[Reentrance["overwritePrevious"] = -3] = "overwritePrevious";
|
|
16
16
|
Reentrance[Reentrance["runSideBySide"] = -4] = "runSideBySide";
|
|
17
17
|
})(Reentrance || (Reentrance = {}));
|
|
18
|
+
export var Isolation;
|
|
19
|
+
(function (Isolation) {
|
|
20
|
+
Isolation[Isolation["joinToCurrentTransaction"] = 0] = "joinToCurrentTransaction";
|
|
21
|
+
Isolation[Isolation["joinAsNestedTransaction"] = 1] = "joinAsNestedTransaction";
|
|
22
|
+
Isolation[Isolation["disjoinFromOuterTransaction"] = 2] = "disjoinFromOuterTransaction";
|
|
23
|
+
Isolation[Isolation["disjoinFromOuterAndInnerTransactions"] = 3] = "disjoinFromOuterAndInnerTransactions";
|
|
24
|
+
Isolation[Isolation["disjoinForInternalDisposal"] = 4] = "disjoinForInternalDisposal";
|
|
25
|
+
})(Isolation || (Isolation = {}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { F } from "./util/Utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Operation, MemberOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
|
|
3
3
|
export declare class RxSystem {
|
|
4
4
|
static why(brief?: boolean): string;
|
|
5
|
-
static
|
|
5
|
+
static getOperation<T>(method: F<T>): Operation<T>;
|
|
6
6
|
static pullLastResult<T>(method: F<Promise<T>>, args?: any[]): T | undefined;
|
|
7
7
|
static configureCurrentOperation(options: Partial<MemberOptions>): MemberOptions;
|
|
8
8
|
static getRevisionOf(obj: any): number;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Log } from "./util/Dbg.js";
|
|
2
|
-
import { Kind } from "./Options.js";
|
|
2
|
+
import { Kind, Isolation } from "./Options.js";
|
|
3
3
|
import { Meta, ObjectHandle } from "./core/Data.js";
|
|
4
4
|
import { Changeset } from "./core/Changeset.js";
|
|
5
5
|
import { Mvcc } from "./core/Mvcc.js";
|
|
6
6
|
import { Transaction } from "./core/Transaction.js";
|
|
7
|
-
import {
|
|
7
|
+
import { OperationImpl } from "./core/Operation.js";
|
|
8
8
|
export class RxSystem {
|
|
9
|
-
static why(brief = false) { return brief ?
|
|
10
|
-
static
|
|
11
|
-
static pullLastResult(method, args) { return RxSystem.
|
|
12
|
-
static configureCurrentOperation(options) { return
|
|
9
|
+
static why(brief = false) { return brief ? OperationImpl.briefWhy() : OperationImpl.why(); }
|
|
10
|
+
static getOperation(method) { return OperationImpl.getControllerOf(method); }
|
|
11
|
+
static pullLastResult(method, args) { return RxSystem.getOperation(method).pullLastResult(args); }
|
|
12
|
+
static configureCurrentOperation(options) { return OperationImpl.configureImpl(undefined, options); }
|
|
13
13
|
static getRevisionOf(obj) { return obj[Meta.Revision]; }
|
|
14
14
|
static takeSnapshot(obj) { return Changeset.takeSnapshot(obj); }
|
|
15
15
|
static dispose(obj) { Changeset.dispose(obj); }
|
|
@@ -26,7 +26,7 @@ export function transaction(action, ...args) {
|
|
|
26
26
|
return Transaction.run(null, action, ...args);
|
|
27
27
|
}
|
|
28
28
|
export function unobs(func, ...args) {
|
|
29
|
-
return
|
|
29
|
+
return OperationImpl.proceedWithinGivenLaunch(undefined, func, ...args);
|
|
30
30
|
}
|
|
31
31
|
export function sensitive(sensitivity, func, ...args) {
|
|
32
32
|
return Mvcc.sensitive(sensitivity, func, ...args);
|
|
@@ -38,15 +38,26 @@ export function obs(proto, prop) {
|
|
|
38
38
|
return Mvcc.decorateData(true, proto, prop);
|
|
39
39
|
}
|
|
40
40
|
export function transactional(proto, prop, pd) {
|
|
41
|
-
const opts = {
|
|
41
|
+
const opts = {
|
|
42
|
+
kind: Kind.transactional,
|
|
43
|
+
isolation: Isolation.joinToCurrentTransaction,
|
|
44
|
+
};
|
|
42
45
|
return Mvcc.decorateOperation(true, transactional, opts, proto, prop, pd);
|
|
43
46
|
}
|
|
44
47
|
export function reactive(proto, prop, pd) {
|
|
45
|
-
const opts = {
|
|
48
|
+
const opts = {
|
|
49
|
+
kind: Kind.reactive,
|
|
50
|
+
isolation: Isolation.joinAsNestedTransaction,
|
|
51
|
+
throttling: -1,
|
|
52
|
+
};
|
|
46
53
|
return Mvcc.decorateOperation(true, reactive, opts, proto, prop, pd);
|
|
47
54
|
}
|
|
48
55
|
export function cached(proto, prop, pd) {
|
|
49
|
-
const opts = {
|
|
56
|
+
const opts = {
|
|
57
|
+
kind: Kind.cached,
|
|
58
|
+
isolation: Isolation.joinToCurrentTransaction,
|
|
59
|
+
noSideEffects: true,
|
|
60
|
+
};
|
|
50
61
|
return Mvcc.decorateOperation(true, cached, opts, proto, prop, pd);
|
|
51
62
|
}
|
|
52
63
|
export function options(value) {
|
|
@@ -4,8 +4,8 @@ export type { MergedItem, MergeListReader } from "./util/MergeList.js";
|
|
|
4
4
|
export { SealedArray } from "./util/SealedArray.js";
|
|
5
5
|
export { SealedMap } from "./util/SealedMap.js";
|
|
6
6
|
export { SealedSet } from "./util/SealedSet.js";
|
|
7
|
-
export { Kind, Reentrance, LoggingLevel } from "./Options.js";
|
|
8
|
-
export type {
|
|
7
|
+
export { Kind, Reentrance, Isolation, LoggingLevel } from "./Options.js";
|
|
8
|
+
export type { Operation, MemberOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
|
|
9
9
|
export type { Worker } from "./Worker.js";
|
|
10
10
|
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from "./Ref.js";
|
|
11
11
|
export type { BoolOnly, GivenTypeOnly } from "./Ref.js";
|
package/build/dist/source/api.js
CHANGED
|
@@ -3,7 +3,7 @@ export { MergeList } from "./util/MergeList.js";
|
|
|
3
3
|
export { SealedArray } from "./util/SealedArray.js";
|
|
4
4
|
export { SealedMap } from "./util/SealedMap.js";
|
|
5
5
|
export { SealedSet } from "./util/SealedSet.js";
|
|
6
|
-
export { Kind, Reentrance, LoggingLevel } from "./Options.js";
|
|
6
|
+
export { Kind, Reentrance, Isolation, LoggingLevel } from "./Options.js";
|
|
7
7
|
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from "./Ref.js";
|
|
8
8
|
export { TransactionalObject, ObservableObject } from "./core/Mvcc.js";
|
|
9
9
|
export { TransactionalArray, ObservableArray } from "./core/MvccArray.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kind, SnapshotOptions } from "../Options.js";
|
|
2
|
-
import { AbstractChangeset,
|
|
2
|
+
import { AbstractChangeset, ObjectVersion, FieldKey, ObjectHandle, FieldVersion, Observer } from "./Data.js";
|
|
3
3
|
export declare const MAX_REVISION: number;
|
|
4
4
|
export declare const UNDEFINED_REVISION: number;
|
|
5
5
|
export declare class Changeset implements AbstractChangeset {
|
|
@@ -13,48 +13,50 @@ export declare class Changeset implements AbstractChangeset {
|
|
|
13
13
|
static totalObjectSnapshotCount: number;
|
|
14
14
|
readonly id: number;
|
|
15
15
|
readonly options: SnapshotOptions;
|
|
16
|
+
readonly parent?: Changeset;
|
|
16
17
|
get hint(): string;
|
|
17
18
|
get timestamp(): number;
|
|
18
19
|
private revision;
|
|
19
20
|
private bumper;
|
|
20
|
-
items: Map<ObjectHandle,
|
|
21
|
+
items: Map<ObjectHandle, ObjectVersion>;
|
|
21
22
|
obsolete: Observer[];
|
|
22
23
|
sealed: boolean;
|
|
23
|
-
constructor(options: SnapshotOptions | null);
|
|
24
|
+
constructor(options: SnapshotOptions | null, parent?: Changeset);
|
|
24
25
|
static current: () => Changeset;
|
|
25
26
|
static edit: () => Changeset;
|
|
26
|
-
static markUsed: (
|
|
27
|
-
static markEdited: (oldValue: any, newValue: any, edited: boolean,
|
|
27
|
+
static markUsed: (fv: FieldVersion, ov: ObjectVersion, fk: FieldKey, h: ObjectHandle, kind: Kind, weak: boolean) => void;
|
|
28
|
+
static markEdited: (oldValue: any, newValue: any, edited: boolean, ov: ObjectVersion, fk: FieldKey, h: ObjectHandle) => void;
|
|
28
29
|
static isConflicting: (oldValue: any, newValue: any) => boolean;
|
|
29
30
|
static propagateAllChangesThroughSubscriptions: (changeset: Changeset) => void;
|
|
30
31
|
static revokeAllSubscriptions: (changeset: Changeset) => void;
|
|
31
32
|
static enqueueReactiveFunctionsToRun: (reactive: Array<Observer>) => void;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
lookupObjectVersion(h: ObjectHandle, fk: FieldKey, editing: boolean): ObjectVersion;
|
|
34
|
+
getObjectVersion(h: ObjectHandle, fk: FieldKey): ObjectVersion;
|
|
35
|
+
getEditableObjectVersion(h: ObjectHandle, fk: FieldKey, value: any, token?: any): ObjectVersion;
|
|
36
|
+
setFieldContent(h: ObjectHandle, fk: FieldKey, ov: ObjectVersion, content: any, receiver: any, sensitivity: boolean): void;
|
|
35
37
|
static takeSnapshot<T>(obj: T): T;
|
|
36
38
|
static dispose(obj: any): void;
|
|
37
|
-
static doDispose(ctx: Changeset, h: ObjectHandle):
|
|
38
|
-
private
|
|
39
|
+
static doDispose(ctx: Changeset, h: ObjectHandle): ObjectVersion;
|
|
40
|
+
private isNewObjectVersionRequired;
|
|
39
41
|
acquire(outer: Changeset): void;
|
|
40
42
|
bumpBy(timestamp: number): void;
|
|
41
|
-
rebase():
|
|
43
|
+
rebase(): ObjectVersion[] | undefined;
|
|
42
44
|
private merge;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
static
|
|
46
|
-
static
|
|
45
|
+
seal(): void;
|
|
46
|
+
sealObjectVersion(h: ObjectHandle, ov: ObjectVersion): void;
|
|
47
|
+
static sealFieldVersion(fv: FieldVersion | symbol, fk: FieldKey, typeName: string): void;
|
|
48
|
+
static freezeObjectVersion(ov: ObjectVersion): ObjectVersion;
|
|
47
49
|
triggerGarbageCollection(): void;
|
|
48
50
|
private unlinkHistory;
|
|
49
51
|
static _init(): void;
|
|
50
52
|
}
|
|
51
53
|
export declare class Dump {
|
|
52
54
|
static valueHint: (value: any) => string;
|
|
53
|
-
static obj(h: ObjectHandle | undefined,
|
|
54
|
-
static snapshot2(h: ObjectHandle, s: AbstractChangeset,
|
|
55
|
-
static snapshot(
|
|
56
|
-
static conflicts(conflicts:
|
|
57
|
-
static conflictingMemberHint(
|
|
55
|
+
static obj(h: ObjectHandle | undefined, fk?: FieldKey | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, value?: any): string;
|
|
56
|
+
static snapshot2(h: ObjectHandle, s: AbstractChangeset, fk?: FieldKey, o?: FieldVersion): string;
|
|
57
|
+
static snapshot(ov: ObjectVersion, fk?: FieldKey): string;
|
|
58
|
+
static conflicts(conflicts: ObjectVersion[]): string;
|
|
59
|
+
static conflictingMemberHint(fk: FieldKey, ours: ObjectVersion, theirs: ObjectVersion): string;
|
|
58
60
|
}
|
|
59
|
-
export declare const
|
|
61
|
+
export declare const EMPTY_OBJECT_VERSION: ObjectVersion;
|
|
60
62
|
export declare const DefaultSnapshotOptions: SnapshotOptions;
|