reactronic 0.24.123 → 0.24.125
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 +5 -5
- package/build/dist/source/Clock.d.ts +1 -1
- package/build/dist/source/Clock.js +2 -2
- package/build/dist/source/Logging.d.ts +4 -4
- package/build/dist/source/Logging.js +6 -6
- package/build/dist/source/Options.d.ts +12 -12
- package/build/dist/source/Options.js +1 -1
- package/build/dist/source/Pipe.d.ts +1 -1
- package/build/dist/source/Pipe.js +2 -2
- package/build/dist/source/Reaction.d.ts +2 -2
- package/build/dist/source/Reaction.js +2 -2
- package/build/dist/source/Ref.js +4 -4
- package/build/dist/source/RxSystem.d.ts +2 -2
- package/build/dist/source/RxSystem.js +7 -7
- package/build/dist/source/Worker.d.ts +3 -3
- package/build/dist/source/api.d.ts +23 -23
- package/build/dist/source/api.js +18 -18
- package/build/dist/source/core/Changeset.d.ts +2 -2
- package/build/dist/source/core/Changeset.js +33 -33
- package/build/dist/source/core/Data.d.ts +11 -11
- package/build/dist/source/core/Data.js +3 -3
- package/build/dist/source/core/Journal.d.ts +2 -2
- package/build/dist/source/core/Journal.js +12 -12
- package/build/dist/source/core/Meta.js +7 -7
- package/build/dist/source/core/Monitor.d.ts +2 -2
- package/build/dist/source/core/Monitor.js +6 -6
- package/build/dist/source/core/Mvcc.d.ts +6 -6
- package/build/dist/source/core/Mvcc.js +8 -8
- package/build/dist/source/core/MvccArray.d.ts +1 -1
- package/build/dist/source/core/MvccArray.js +2 -2
- package/build/dist/source/core/MvccMap.d.ts +1 -1
- package/build/dist/source/core/MvccMap.js +2 -2
- package/build/dist/source/core/MvccMergeList.d.ts +2 -2
- package/build/dist/source/core/MvccMergeList.js +1 -1
- package/build/dist/source/core/Reaction.d.ts +6 -6
- package/build/dist/source/core/Reaction.js +59 -59
- package/build/dist/source/core/RxNode.d.ts +9 -9
- package/build/dist/source/core/RxNode.js +15 -15
- package/build/dist/source/core/Transaction.d.ts +4 -4
- package/build/dist/source/core/Transaction.js +13 -13
- package/build/dist/source/util/Dbg.d.ts +1 -1
- package/build/dist/source/util/Dbg.js +11 -11
- package/build/dist/source/util/MergeList.d.ts +4 -4
- package/build/dist/source/util/MergeList.js +5 -5
- package/build/dist/source/util/Sealant.d.ts +4 -4
- package/build/dist/source/util/Sealant.js +5 -5
- package/build/dist/source/util/SealedArray.d.ts +1 -1
- package/build/dist/source/util/SealedArray.js +2 -2
- package/build/dist/source/util/SealedMap.d.ts +1 -1
- package/build/dist/source/util/SealedMap.js +2 -2
- package/build/dist/source/util/SealedSet.d.ts +1 -1
- package/build/dist/source/util/SealedSet.js +2 -2
- package/build/dist/source/util/Utils.js +14 -14
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -308,7 +308,7 @@ function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
|
|
|
308
308
|
|
|
309
309
|
// SnapshotOptions, MemberOptions, Kind, Reentrance, Monitor, LoggingOptions, ProfilingOptions
|
|
310
310
|
|
|
311
|
-
export
|
|
311
|
+
export type SnapshotOptions = {
|
|
312
312
|
readonly hint?: string
|
|
313
313
|
readonly separation?: SeparationMode
|
|
314
314
|
readonly journal?: Journal
|
|
@@ -316,7 +316,7 @@ export interface SnapshotOptions {
|
|
|
316
316
|
readonly token?: any
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
|
|
319
|
+
type MemberOptions = {
|
|
320
320
|
readonly kind: Kind
|
|
321
321
|
readonly separation: SeparationMode
|
|
322
322
|
readonly order: number
|
|
@@ -352,7 +352,7 @@ class Monitor {
|
|
|
352
352
|
static create(hint: string, activationDelay: number, deactivationDelay: number): Monitor
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
|
|
355
|
+
type Worker = {
|
|
356
356
|
readonly id: number
|
|
357
357
|
readonly hint: string
|
|
358
358
|
isCanceled: boolean
|
|
@@ -361,7 +361,7 @@ interface Worker {
|
|
|
361
361
|
whenFinished(): Promise<void>
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
type LoggingOptions = {
|
|
365
365
|
readonly off: boolean
|
|
366
366
|
readonly transaction: boolean
|
|
367
367
|
readonly operation: boolean
|
|
@@ -376,7 +376,7 @@ interface LoggingOptions {
|
|
|
376
376
|
readonly gc: boolean
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
type ProfilingOptions = {
|
|
380
380
|
repetitiveUsageWarningThreshold: number // default: 10 times
|
|
381
381
|
mainThreadBlockingWarningThreshold: number // default: 16.6 ms
|
|
382
382
|
asyncActionDurationWarningThreshold: number // default: 150 ms
|
|
@@ -7,8 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { ObservableObject } from
|
|
11
|
-
import { transactional } from
|
|
10
|
+
import { ObservableObject } from "./core/Mvcc.js";
|
|
11
|
+
import { transactional } from "./RxSystem.js";
|
|
12
12
|
export class Clock extends ObservableObject {
|
|
13
13
|
constructor(interval = 1000) {
|
|
14
14
|
super();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LoggingOptions = {
|
|
2
2
|
readonly enabled: boolean;
|
|
3
3
|
readonly transaction: boolean;
|
|
4
4
|
readonly operation: boolean;
|
|
@@ -15,13 +15,13 @@ export interface LoggingOptions {
|
|
|
15
15
|
readonly prefix: string;
|
|
16
16
|
readonly margin1: number;
|
|
17
17
|
readonly margin2: number;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
};
|
|
19
|
+
export type ProfilingOptions = {
|
|
20
20
|
repetitiveUsageWarningThreshold: number;
|
|
21
21
|
mainThreadBlockingWarningThreshold: number;
|
|
22
22
|
asyncActionDurationWarningThreshold: number;
|
|
23
23
|
garbageCollectionSummaryInterval: number;
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
export declare const LoggingLevel: {
|
|
26
26
|
readonly Off: LoggingOptions;
|
|
27
27
|
readonly ErrorsOnly: LoggingOptions;
|
|
@@ -13,7 +13,7 @@ export const LoggingLevel = {
|
|
|
13
13
|
warning: true,
|
|
14
14
|
gc: false,
|
|
15
15
|
color: 37,
|
|
16
|
-
prefix:
|
|
16
|
+
prefix: "",
|
|
17
17
|
margin1: 0,
|
|
18
18
|
margin2: 0,
|
|
19
19
|
},
|
|
@@ -31,7 +31,7 @@ export const LoggingLevel = {
|
|
|
31
31
|
warning: true,
|
|
32
32
|
gc: false,
|
|
33
33
|
color: 37,
|
|
34
|
-
prefix:
|
|
34
|
+
prefix: "",
|
|
35
35
|
margin1: 0,
|
|
36
36
|
margin2: 0,
|
|
37
37
|
},
|
|
@@ -49,7 +49,7 @@ export const LoggingLevel = {
|
|
|
49
49
|
warning: true,
|
|
50
50
|
gc: false,
|
|
51
51
|
color: 37,
|
|
52
|
-
prefix:
|
|
52
|
+
prefix: "",
|
|
53
53
|
margin1: 0,
|
|
54
54
|
margin2: 0,
|
|
55
55
|
},
|
|
@@ -67,7 +67,7 @@ export const LoggingLevel = {
|
|
|
67
67
|
warning: true,
|
|
68
68
|
gc: false,
|
|
69
69
|
color: 37,
|
|
70
|
-
prefix:
|
|
70
|
+
prefix: "",
|
|
71
71
|
margin1: 0,
|
|
72
72
|
margin2: 0,
|
|
73
73
|
},
|
|
@@ -85,7 +85,7 @@ export const LoggingLevel = {
|
|
|
85
85
|
warning: true,
|
|
86
86
|
gc: false,
|
|
87
87
|
color: 37,
|
|
88
|
-
prefix:
|
|
88
|
+
prefix: "",
|
|
89
89
|
margin1: 0,
|
|
90
90
|
margin2: 0,
|
|
91
91
|
},
|
|
@@ -103,7 +103,7 @@ export const LoggingLevel = {
|
|
|
103
103
|
warning: true,
|
|
104
104
|
gc: false,
|
|
105
105
|
color: 37,
|
|
106
|
-
prefix:
|
|
106
|
+
prefix: "",
|
|
107
107
|
margin1: 0,
|
|
108
108
|
margin2: 0,
|
|
109
109
|
},
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { LoggingOptions } from
|
|
2
|
-
import { SeparationMode } from
|
|
3
|
-
export { LoggingLevel } from
|
|
4
|
-
export type { LoggingOptions, ProfilingOptions } from
|
|
5
|
-
import { Journal } from
|
|
6
|
-
import { Monitor } from
|
|
7
|
-
export
|
|
1
|
+
import { LoggingOptions } from "./Logging.js";
|
|
2
|
+
import { SeparationMode } from "./core/Data.js";
|
|
3
|
+
export { LoggingLevel } from "./Logging.js";
|
|
4
|
+
export type { LoggingOptions, ProfilingOptions } from "./Logging.js";
|
|
5
|
+
import { Journal } from "./core/Journal.js";
|
|
6
|
+
import { Monitor } from "./core/Monitor.js";
|
|
7
|
+
export type SnapshotOptions = {
|
|
8
8
|
readonly hint?: string;
|
|
9
9
|
readonly separation?: SeparationMode;
|
|
10
10
|
readonly journal?: Journal;
|
|
11
11
|
readonly logging?: Partial<LoggingOptions>;
|
|
12
12
|
readonly token?: any;
|
|
13
|
-
}
|
|
14
|
-
export
|
|
13
|
+
};
|
|
14
|
+
export type MemberOptions = {
|
|
15
15
|
readonly kind: Kind;
|
|
16
16
|
readonly separation: SeparationMode;
|
|
17
17
|
readonly order: number;
|
|
@@ -22,7 +22,7 @@ export interface MemberOptions {
|
|
|
22
22
|
readonly journal: Journal | undefined;
|
|
23
23
|
readonly monitor: Monitor | null;
|
|
24
24
|
readonly logging?: Partial<LoggingOptions>;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
export declare enum Kind {
|
|
27
27
|
Plain = 0,
|
|
28
28
|
Transactional = 1,
|
|
@@ -37,7 +37,7 @@ export declare enum Reentrance {
|
|
|
37
37
|
OverwritePrevious = -3,
|
|
38
38
|
RunSideBySide = -4
|
|
39
39
|
}
|
|
40
|
-
export
|
|
40
|
+
export type AbstractReaction<T> = {
|
|
41
41
|
readonly options: MemberOptions;
|
|
42
42
|
readonly args: ReadonlyArray<any>;
|
|
43
43
|
readonly result: T;
|
|
@@ -47,4 +47,4 @@ export interface AbstractReaction<T> {
|
|
|
47
47
|
configure(options: Partial<MemberOptions>): MemberOptions;
|
|
48
48
|
markObsolete(): void;
|
|
49
49
|
pullLastResult(args?: any[]): T | undefined;
|
|
50
|
-
}
|
|
50
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ObservableObject } from
|
|
1
|
+
import { ObservableObject } from "./core/Mvcc.js";
|
|
2
2
|
export class Pipe extends ObservableObject {
|
|
3
|
-
static create(hint, capacity) { throw new Error(
|
|
3
|
+
static create(hint, capacity) { throw new Error("not implemented"); }
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F } from
|
|
2
|
-
import { ObservableObject } from
|
|
1
|
+
import { F } from "./util/Utils.js";
|
|
2
|
+
import { ObservableObject } from "./core/Mvcc.js";
|
|
3
3
|
export declare class Reaction<T> extends ObservableObject {
|
|
4
4
|
protected action: F<T>;
|
|
5
5
|
constructor(action: F<T>);
|
|
@@ -7,8 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { ObservableObject } from
|
|
11
|
-
import { reactive } from
|
|
10
|
+
import { ObservableObject } from "./core/Mvcc.js";
|
|
11
|
+
import { reactive } from "./RxSystem.js";
|
|
12
12
|
export class Reaction extends ObservableObject {
|
|
13
13
|
constructor(action) {
|
|
14
14
|
super();
|
package/build/dist/source/Ref.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Transaction } from
|
|
2
|
-
import { unobs } from
|
|
1
|
+
import { Transaction } from "./core/Transaction.js";
|
|
2
|
+
import { unobs } from "./RxSystem.js";
|
|
3
3
|
export function refs(owner) {
|
|
4
4
|
return new Proxy(owner, RefGettingProxy);
|
|
5
5
|
}
|
|
@@ -35,7 +35,7 @@ export class Ref {
|
|
|
35
35
|
return this.variable;
|
|
36
36
|
}
|
|
37
37
|
unobserve() {
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error("not implemented");
|
|
39
39
|
}
|
|
40
40
|
static sameRefs(v1, v2) {
|
|
41
41
|
return v1.owner === v2.owner && v1.name === v2.name && v1.index === v2.index;
|
|
@@ -83,7 +83,7 @@ class CustomToggleRefGettingProxy {
|
|
|
83
83
|
return new ToggleRef(obj, prop, this.value1, this.value2);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
Object.defineProperty(Object.prototype,
|
|
86
|
+
Object.defineProperty(Object.prototype, "$$", {
|
|
87
87
|
configurable: false, enumerable: false,
|
|
88
88
|
get() {
|
|
89
89
|
return new Proxy(this, RefGettingProxy);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F } from
|
|
2
|
-
import { AbstractReaction, MemberOptions, LoggingOptions, ProfilingOptions } from
|
|
1
|
+
import { F } from "./util/Utils.js";
|
|
2
|
+
import { AbstractReaction, MemberOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
|
|
3
3
|
export declare class RxSystem {
|
|
4
4
|
static why(brief?: boolean): string;
|
|
5
5
|
static getReaction<T>(method: F<T>): AbstractReaction<T>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Log } from
|
|
2
|
-
import { Kind } from
|
|
3
|
-
import { Meta, ObjectHandle } from
|
|
4
|
-
import { Changeset } from
|
|
5
|
-
import { Mvcc } from
|
|
6
|
-
import { Transaction } from
|
|
7
|
-
import { ReactionImpl } from
|
|
1
|
+
import { Log } from "./util/Dbg.js";
|
|
2
|
+
import { Kind } from "./Options.js";
|
|
3
|
+
import { Meta, ObjectHandle } from "./core/Data.js";
|
|
4
|
+
import { Changeset } from "./core/Changeset.js";
|
|
5
|
+
import { Mvcc } from "./core/Mvcc.js";
|
|
6
|
+
import { Transaction } from "./core/Transaction.js";
|
|
7
|
+
import { ReactionImpl } from "./core/Reaction.js";
|
|
8
8
|
export class RxSystem {
|
|
9
9
|
static why(brief = false) { return brief ? ReactionImpl.briefWhy() : ReactionImpl.why(); }
|
|
10
10
|
static getReaction(method) { return ReactionImpl.getControllerOf(method); }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Worker = {
|
|
2
2
|
readonly id: number;
|
|
3
3
|
readonly hint: string;
|
|
4
4
|
readonly isCanceled: boolean;
|
|
5
5
|
readonly isFinished: boolean;
|
|
6
|
-
cancel(error: Error, restartAfter?: Worker | null):
|
|
6
|
+
cancel(error: Error, restartAfter?: Worker | null): void;
|
|
7
7
|
whenFinished(): Promise<void>;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { all, pause } from
|
|
2
|
-
export { MergeList } from
|
|
3
|
-
export type { MergedItem, MergeListReader } from
|
|
4
|
-
export { SealedArray } from
|
|
5
|
-
export { SealedMap } from
|
|
6
|
-
export { SealedSet } from
|
|
7
|
-
export { Kind, Reentrance, LoggingLevel } from
|
|
8
|
-
export type { AbstractReaction, MemberOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from
|
|
9
|
-
export type { Worker } from
|
|
10
|
-
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from
|
|
11
|
-
export type { BoolOnly, GivenTypeOnly } from
|
|
12
|
-
export { TransactionalObject, ObservableObject } from
|
|
13
|
-
export { TransactionalArray, ObservableArray } from
|
|
14
|
-
export { TransactionalMap, ObservableMap } from
|
|
15
|
-
export { Changeset } from
|
|
16
|
-
export { Transaction } from
|
|
17
|
-
export { Monitor } from
|
|
18
|
-
export { Journal } from
|
|
19
|
-
export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from
|
|
20
|
-
export { Reaction } from
|
|
21
|
-
export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from
|
|
22
|
-
export type { Delegate, SimpleDelegate, RxNodeDecl, RxNodeDriver, RxNodeContext } from
|
|
23
|
-
export { Clock } from
|
|
1
|
+
export { all, pause } from "./util/Utils.js";
|
|
2
|
+
export { MergeList } from "./util/MergeList.js";
|
|
3
|
+
export type { MergedItem, MergeListReader } from "./util/MergeList.js";
|
|
4
|
+
export { SealedArray } from "./util/SealedArray.js";
|
|
5
|
+
export { SealedMap } from "./util/SealedMap.js";
|
|
6
|
+
export { SealedSet } from "./util/SealedSet.js";
|
|
7
|
+
export { Kind, Reentrance, LoggingLevel } from "./Options.js";
|
|
8
|
+
export type { AbstractReaction, MemberOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
|
|
9
|
+
export type { Worker } from "./Worker.js";
|
|
10
|
+
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from "./Ref.js";
|
|
11
|
+
export type { BoolOnly, GivenTypeOnly } from "./Ref.js";
|
|
12
|
+
export { TransactionalObject, ObservableObject } from "./core/Mvcc.js";
|
|
13
|
+
export { TransactionalArray, ObservableArray } from "./core/MvccArray.js";
|
|
14
|
+
export { TransactionalMap, ObservableMap } from "./core/MvccMap.js";
|
|
15
|
+
export { Changeset } from "./core/Changeset.js";
|
|
16
|
+
export { Transaction } from "./core/Transaction.js";
|
|
17
|
+
export { Monitor } from "./core/Monitor.js";
|
|
18
|
+
export { Journal } from "./core/Journal.js";
|
|
19
|
+
export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./RxSystem.js";
|
|
20
|
+
export { Reaction } from "./Reaction.js";
|
|
21
|
+
export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from "./core/RxNode.js";
|
|
22
|
+
export type { Delegate, SimpleDelegate, RxNodeDecl, RxNodeDriver, RxNodeContext } from "./core/RxNode.js";
|
|
23
|
+
export { Clock } from "./Clock.js";
|
package/build/dist/source/api.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { all, pause } from
|
|
2
|
-
export { MergeList } from
|
|
3
|
-
export { SealedArray } from
|
|
4
|
-
export { SealedMap } from
|
|
5
|
-
export { SealedSet } from
|
|
6
|
-
export { Kind, Reentrance, LoggingLevel } from
|
|
7
|
-
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from
|
|
8
|
-
export { TransactionalObject, ObservableObject } from
|
|
9
|
-
export { TransactionalArray, ObservableArray } from
|
|
10
|
-
export { TransactionalMap, ObservableMap } from
|
|
11
|
-
export { Changeset } from
|
|
12
|
-
export { Transaction } from
|
|
13
|
-
export { Monitor } from
|
|
14
|
-
export { Journal } from
|
|
15
|
-
export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from
|
|
16
|
-
export { Reaction } from
|
|
17
|
-
export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from
|
|
18
|
-
export { Clock } from
|
|
1
|
+
export { all, pause } from "./util/Utils.js";
|
|
2
|
+
export { MergeList } from "./util/MergeList.js";
|
|
3
|
+
export { SealedArray } from "./util/SealedArray.js";
|
|
4
|
+
export { SealedMap } from "./util/SealedMap.js";
|
|
5
|
+
export { SealedSet } from "./util/SealedSet.js";
|
|
6
|
+
export { Kind, Reentrance, LoggingLevel } from "./Options.js";
|
|
7
|
+
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from "./Ref.js";
|
|
8
|
+
export { TransactionalObject, ObservableObject } from "./core/Mvcc.js";
|
|
9
|
+
export { TransactionalArray, ObservableArray } from "./core/MvccArray.js";
|
|
10
|
+
export { TransactionalMap, ObservableMap } from "./core/MvccMap.js";
|
|
11
|
+
export { Changeset } from "./core/Changeset.js";
|
|
12
|
+
export { Transaction } from "./core/Transaction.js";
|
|
13
|
+
export { Monitor } from "./core/Monitor.js";
|
|
14
|
+
export { Journal } from "./core/Journal.js";
|
|
15
|
+
export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./RxSystem.js";
|
|
16
|
+
export { Reaction } from "./Reaction.js";
|
|
17
|
+
export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from "./core/RxNode.js";
|
|
18
|
+
export { Clock } from "./Clock.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Kind, SnapshotOptions } from
|
|
2
|
-
import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle, ValueSnapshot, Observer } from
|
|
1
|
+
import { Kind, SnapshotOptions } from "../Options.js";
|
|
2
|
+
import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle, ValueSnapshot, 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 {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Utils, UNDEF } from
|
|
2
|
-
import { Log, misuse } from
|
|
3
|
-
import { Sealant } from
|
|
4
|
-
import { SealedArray } from
|
|
5
|
-
import { SealedMap } from
|
|
6
|
-
import { SealedSet } from
|
|
7
|
-
import { ObjectSnapshot, ObjectHandle, ValueSnapshot, Meta } from
|
|
1
|
+
import { Utils, UNDEF } from "../util/Utils.js";
|
|
2
|
+
import { Log, misuse } from "../util/Dbg.js";
|
|
3
|
+
import { Sealant } from "../util/Sealant.js";
|
|
4
|
+
import { SealedArray } from "../util/SealedArray.js";
|
|
5
|
+
import { SealedMap } from "../util/SealedMap.js";
|
|
6
|
+
import { SealedSet } from "../util/SealedSet.js";
|
|
7
|
+
import { ObjectSnapshot, ObjectHandle, ValueSnapshot, Meta } from "./Data.js";
|
|
8
8
|
export const MAX_REVISION = Number.MAX_SAFE_INTEGER;
|
|
9
9
|
export const UNDEFINED_REVISION = MAX_REVISION - 1;
|
|
10
|
-
Object.defineProperty(ObjectHandle.prototype,
|
|
10
|
+
Object.defineProperty(ObjectHandle.prototype, "#this#", {
|
|
11
11
|
configurable: false, enumerable: false,
|
|
12
12
|
get() {
|
|
13
13
|
const result = {};
|
|
14
|
-
const data = Changeset.current().getObjectSnapshot(this,
|
|
14
|
+
const data = Changeset.current().getObjectSnapshot(this, "#this#").data;
|
|
15
15
|
for (const m in data) {
|
|
16
16
|
const v = data[m];
|
|
17
17
|
if (v instanceof ValueSnapshot)
|
|
@@ -27,7 +27,7 @@ Object.defineProperty(ObjectHandle.prototype, '#this#', {
|
|
|
27
27
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
28
28
|
const EMPTY_MAP = Utils.freezeMap(new Map());
|
|
29
29
|
export class Changeset {
|
|
30
|
-
get hint() { var _a; return (_a = this.options.hint) !== null && _a !== void 0 ? _a :
|
|
30
|
+
get hint() { var _a; return (_a = this.options.hint) !== null && _a !== void 0 ? _a : "noname"; }
|
|
31
31
|
get timestamp() { return this.revision; }
|
|
32
32
|
constructor(options) {
|
|
33
33
|
this.id = ++Changeset.idGen;
|
|
@@ -55,7 +55,7 @@ export class Changeset {
|
|
|
55
55
|
getObjectSnapshot(h, m) {
|
|
56
56
|
const r = this.lookupObjectSnapshot(h, m);
|
|
57
57
|
if (r === EMPTY_SNAPSHOT)
|
|
58
|
-
throw misuse(`${Dump.obj(h, m)} is not yet available for T${this.id}[${this.hint}] because of uncommitted ${h.editing ? `T${h.editing.changeset.id}[${h.editing.changeset.hint}]` :
|
|
58
|
+
throw misuse(`${Dump.obj(h, m)} is not yet available for T${this.id}[${this.hint}] because of uncommitted ${h.editing ? `T${h.editing.changeset.id}[${h.editing.changeset.hint}]` : ""} (last committed T${h.head.changeset.id}[${h.head.changeset.hint}])`);
|
|
59
59
|
return r;
|
|
60
60
|
}
|
|
61
61
|
getEditableObjectSnapshot(h, m, value, token) {
|
|
@@ -73,7 +73,7 @@ export class Changeset {
|
|
|
73
73
|
h.editing = os;
|
|
74
74
|
h.editors++;
|
|
75
75
|
if (Log.isOn && Log.opt.write)
|
|
76
|
-
Log.write(
|
|
76
|
+
Log.write("║", " ++", `${Dump.obj(h)} - new snapshot is created (revision ${revision})`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
else
|
|
@@ -81,7 +81,7 @@ export class Changeset {
|
|
|
81
81
|
return os;
|
|
82
82
|
}
|
|
83
83
|
static takeSnapshot(obj) {
|
|
84
|
-
return obj[Meta.Handle][
|
|
84
|
+
return obj[Meta.Handle]["#this#"];
|
|
85
85
|
}
|
|
86
86
|
static dispose(obj) {
|
|
87
87
|
const ctx = Changeset.edit();
|
|
@@ -106,7 +106,7 @@ export class Changeset {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
if (os === EMPTY_SNAPSHOT)
|
|
109
|
-
throw misuse(`${Dump.snapshot(os, m)} is not yet available for T${this.id}[${this.hint}] because of uncommitted ${h.editing ? `T${h.editing.changeset.id}[${h.editing.changeset.hint}]` :
|
|
109
|
+
throw misuse(`${Dump.snapshot(os, m)} is not yet available for T${this.id}[${this.hint}] because of uncommitted ${h.editing ? `T${h.editing.changeset.id}[${h.editing.changeset.hint}]` : ""} (last committed T${h.head.changeset.id}[${h.head.changeset.hint}])`);
|
|
110
110
|
}
|
|
111
111
|
return os.changeset !== this && !this.sealed;
|
|
112
112
|
}
|
|
@@ -118,7 +118,7 @@ export class Changeset {
|
|
|
118
118
|
if (Changeset.oldest === undefined)
|
|
119
119
|
Changeset.oldest = this;
|
|
120
120
|
if (Log.isOn && Log.opt.transaction)
|
|
121
|
-
Log.write(
|
|
121
|
+
Log.write("╔══", `s${this.revision}`, `${this.hint}`);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
bumpBy(timestamp) {
|
|
@@ -137,7 +137,7 @@ export class Changeset {
|
|
|
137
137
|
conflicts.push(os);
|
|
138
138
|
}
|
|
139
139
|
if (Log.isOn && Log.opt.transaction)
|
|
140
|
-
Log.write(
|
|
140
|
+
Log.write("╠╝", "", `${Dump.snapshot2(h, os.changeset)} is merged with ${Dump.snapshot2(h, h.head.changeset)} among ${merged} properties with ${os.conflicts.size} conflicts.`);
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
143
|
if (this.options.token === undefined) {
|
|
@@ -165,9 +165,9 @@ export class Changeset {
|
|
|
165
165
|
merged[m] = ours.data[m];
|
|
166
166
|
if (headDisposed || oursDisposed) {
|
|
167
167
|
if (headDisposed !== oursDisposed) {
|
|
168
|
-
if (headDisposed || this.options.separation !==
|
|
168
|
+
if (headDisposed || this.options.separation !== "disposal") {
|
|
169
169
|
if (Log.isOn && Log.opt.change)
|
|
170
|
-
Log.write(
|
|
170
|
+
Log.write("║╠", "", `${Dump.snapshot2(h, ours.changeset, m)} <> ${Dump.snapshot2(h, head.changeset, m)}`, 0, " *** CONFLICT ***");
|
|
171
171
|
ours.conflicts.set(m, head);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -177,7 +177,7 @@ export class Changeset {
|
|
|
177
177
|
if (conflict)
|
|
178
178
|
ours.conflicts.set(m, head);
|
|
179
179
|
if (Log.isOn && Log.opt.change)
|
|
180
|
-
Log.write(
|
|
180
|
+
Log.write("║╠", "", `${Dump.snapshot2(h, ours.changeset, m)} ${conflict ? "<>" : "=="} ${Dump.snapshot2(h, head.changeset, m)}`, 0, conflict ? " *** CONFLICT ***" : undefined);
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
183
|
Utils.copyAllMembers(merged, ours.data);
|
|
@@ -205,12 +205,12 @@ export class Changeset {
|
|
|
205
205
|
this.items.forEach((os, h) => {
|
|
206
206
|
const members = [];
|
|
207
207
|
os.changes.forEach((o, m) => members.push(m.toString()));
|
|
208
|
-
const s = members.join(
|
|
209
|
-
Log.write(
|
|
208
|
+
const s = members.join(", ");
|
|
209
|
+
Log.write("║", "√", `${Dump.snapshot2(h, os.changeset)} (${s}) is ${os.former.snapshot === EMPTY_SNAPSHOT ? "constructed" : `applied over #${h.id}t${os.former.snapshot.changeset.id}s${os.former.snapshot.changeset.timestamp}`}`);
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
if (Log.opt.transaction)
|
|
213
|
-
Log.write(this.revision < UNDEFINED_REVISION ?
|
|
213
|
+
Log.write(this.revision < UNDEFINED_REVISION ? "╚══" : "═══", `s${this.revision}`, `${this.hint} - ${error ? "CANCEL" : "APPLY"}(${this.items.size})${error ? ` - ${error}` : ""}`);
|
|
214
214
|
}
|
|
215
215
|
if (!error)
|
|
216
216
|
Changeset.propagateAllChangesThroughSubscriptions(this);
|
|
@@ -255,7 +255,7 @@ export class Changeset {
|
|
|
255
255
|
Changeset.oldest = Changeset.pending[0];
|
|
256
256
|
const now = Date.now();
|
|
257
257
|
if (now - Changeset.lastGarbageCollectionSummaryTimestamp > Changeset.garbageCollectionSummaryInterval) {
|
|
258
|
-
Log.write(
|
|
258
|
+
Log.write("", "[G]", `Total object/snapshot count: ${Changeset.totalObjectHandleCount}/${Changeset.totalObjectSnapshotCount}`);
|
|
259
259
|
Changeset.lastGarbageCollectionSummaryTimestamp = now;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
@@ -263,10 +263,10 @@ export class Changeset {
|
|
|
263
263
|
}
|
|
264
264
|
unlinkHistory() {
|
|
265
265
|
if (Log.isOn && Log.opt.gc)
|
|
266
|
-
Log.write(
|
|
266
|
+
Log.write("", "[G]", `Dismiss history below t${this.id}s${this.revision} (${this.hint})`);
|
|
267
267
|
this.items.forEach((os, h) => {
|
|
268
268
|
if (Log.isOn && Log.opt.gc && os.former.snapshot !== EMPTY_SNAPSHOT)
|
|
269
|
-
Log.write(
|
|
269
|
+
Log.write(" ", " ", `${Dump.snapshot2(h, os.former.snapshot.changeset)} is ready for GC because overwritten by ${Dump.snapshot2(h, os.changeset)}`);
|
|
270
270
|
if (Changeset.garbageCollectionSummaryInterval < Number.MAX_SAFE_INTEGER) {
|
|
271
271
|
if (os.former.snapshot !== EMPTY_SNAPSHOT)
|
|
272
272
|
Changeset.totalObjectSnapshotCount--;
|
|
@@ -312,14 +312,14 @@ Changeset.revokeAllSubscriptions = (changeset) => { };
|
|
|
312
312
|
Changeset.enqueueReactiveFunctionsToRun = (reactive) => { };
|
|
313
313
|
export class Dump {
|
|
314
314
|
static obj(h, m, stamp, snapshotId, originSnapshotId, value) {
|
|
315
|
-
const member = m !== undefined ? `.${m.toString()}` :
|
|
315
|
+
const member = m !== undefined ? `.${m.toString()}` : "";
|
|
316
316
|
let result;
|
|
317
317
|
if (h !== undefined) {
|
|
318
|
-
const v = value !== undefined && value !== Meta.Undefined ? `[=${Dump.valueHint(value)}]` :
|
|
318
|
+
const v = value !== undefined && value !== Meta.Undefined ? `[=${Dump.valueHint(value)}]` : "";
|
|
319
319
|
if (stamp === undefined)
|
|
320
320
|
result = `${h.hint}${member}${v} #${h.id}`;
|
|
321
321
|
else
|
|
322
|
-
result = `${h.hint}${member}${v} #${h.id}t${snapshotId}s${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` :
|
|
322
|
+
result = `${h.hint}${member}${v} #${h.id}t${snapshotId}s${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` : ""}`;
|
|
323
323
|
}
|
|
324
324
|
else
|
|
325
325
|
result = `boot${member}`;
|
|
@@ -340,17 +340,17 @@ export class Dump {
|
|
|
340
340
|
ours.conflicts.forEach((theirs, m) => {
|
|
341
341
|
items.push(Dump.conflictingMemberHint(m, ours, theirs));
|
|
342
342
|
});
|
|
343
|
-
return items.join(
|
|
344
|
-
}).join(
|
|
343
|
+
return items.join(", ");
|
|
344
|
+
}).join(", ");
|
|
345
345
|
}
|
|
346
346
|
static conflictingMemberHint(m, ours, theirs) {
|
|
347
347
|
return `${theirs.changeset.hint} (${Dump.snapshot(theirs, m)})`;
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
Dump.valueHint = (value) =>
|
|
351
|
-
export const EMPTY_SNAPSHOT = new ObjectSnapshot(new Changeset({ hint:
|
|
350
|
+
Dump.valueHint = (value) => "???";
|
|
351
|
+
export const EMPTY_SNAPSHOT = new ObjectSnapshot(new Changeset({ hint: "<boot>" }), undefined, {});
|
|
352
352
|
export const DefaultSnapshotOptions = Object.freeze({
|
|
353
|
-
hint:
|
|
353
|
+
hint: "noname",
|
|
354
354
|
separation: false,
|
|
355
355
|
journal: undefined,
|
|
356
356
|
logging: undefined,
|