reactronic 0.22.511 → 0.23.101
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/build/dist/source/Ref.d.ts +2 -2
- package/build/dist/source/impl/Changeset.js +2 -2
- package/build/dist/source/impl/Data.d.ts +3 -3
- package/build/dist/source/impl/Data.js +1 -1
- package/build/dist/source/impl/Journal.d.ts +1 -1
- package/build/dist/source/impl/Operation.js +7 -6
- package/build/dist/source/util/Collection.d.ts +1 -1
- package/build/dist/source/util/Utils.d.ts +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type BoolOnly<T> = Pick<T, {
|
|
2
2
|
[P in keyof T]: T[P] extends boolean ? P : never;
|
|
3
3
|
}[keyof T]>;
|
|
4
|
-
export
|
|
4
|
+
export type GivenTypeOnly<T, V> = Pick<T, {
|
|
5
5
|
[P in keyof T]: T[P] extends V ? P : never;
|
|
6
6
|
}[keyof T]>;
|
|
7
7
|
declare global {
|
|
@@ -27,6 +27,8 @@ 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 : 'noname'; }
|
|
31
|
+
get timestamp() { return this.revision; }
|
|
30
32
|
constructor(options) {
|
|
31
33
|
this.id = ++Changeset.idGen;
|
|
32
34
|
this.options = options !== null && options !== void 0 ? options : DefaultSnapshotOptions;
|
|
@@ -36,8 +38,6 @@ export class Changeset {
|
|
|
36
38
|
this.reactive = [];
|
|
37
39
|
this.sealed = false;
|
|
38
40
|
}
|
|
39
|
-
get hint() { var _a; return (_a = this.options.hint) !== null && _a !== void 0 ? _a : 'noname'; }
|
|
40
|
-
get timestamp() { return this.revision; }
|
|
41
41
|
lookupObjectSnapshot(h, m) {
|
|
42
42
|
let os = h.editing;
|
|
43
43
|
if (os && os.changeset !== this) {
|
|
@@ -12,7 +12,7 @@ export declare class Observable {
|
|
|
12
12
|
get originSnapshotId(): number | undefined;
|
|
13
13
|
constructor(content: any);
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type SeparationMode = boolean | 'isolated' | 'disposal';
|
|
16
16
|
export interface Observer {
|
|
17
17
|
readonly order: number;
|
|
18
18
|
readonly observables: Map<Observable, Subscription> | undefined;
|
|
@@ -21,7 +21,7 @@ export interface Observer {
|
|
|
21
21
|
markObsoleteDueTo(observable: Observable, m: MemberName, changeset: AbstractChangeset, h: ObjectHandle, outer: string, since: number, reactive: Array<Observer>): void;
|
|
22
22
|
runIfNotUpToDate(now: boolean, nothrow: boolean): void;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type MemberName = PropertyKey;
|
|
25
25
|
export interface Subscription {
|
|
26
26
|
readonly memberHint: string;
|
|
27
27
|
readonly usageCount: number;
|
|
@@ -51,7 +51,7 @@ export declare class ObjectHandle {
|
|
|
51
51
|
constructor(data: any, proxy: any, handler: ProxyHandler<ObjectHandle>, head: ObjectSnapshot, hint: string);
|
|
52
52
|
static getHint(obj: object, full: boolean): string | undefined;
|
|
53
53
|
}
|
|
54
|
-
export
|
|
54
|
+
export type PatchSet = Map<object, Map<MemberName, ValuePatch>>;
|
|
55
55
|
export interface ValuePatch {
|
|
56
56
|
memberName: MemberName;
|
|
57
57
|
patchKind: 'update' | 'add' | 'remove';
|
|
@@ -2,9 +2,9 @@ import { Log } from '../util/Dbg';
|
|
|
2
2
|
import { Meta } from './Meta';
|
|
3
3
|
export { Meta } from './Meta';
|
|
4
4
|
export class Observable {
|
|
5
|
-
constructor(content) { this.content = content; }
|
|
6
5
|
get isOperation() { return false; }
|
|
7
6
|
get originSnapshotId() { return 0; }
|
|
7
|
+
constructor(content) { this.content = content; }
|
|
8
8
|
}
|
|
9
9
|
export class ObjectSnapshot {
|
|
10
10
|
constructor(changeset, former, data) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObservableObject } from './Mvcc';
|
|
2
2
|
import { ObjectHandle, ObjectSnapshot, PatchSet } from './Data';
|
|
3
|
-
export
|
|
3
|
+
export type Saver = (patch: PatchSet) => Promise<void>;
|
|
4
4
|
export declare abstract class Journal extends ObservableObject {
|
|
5
5
|
abstract capacity: number;
|
|
6
6
|
abstract readonly edits: ReadonlyArray<PatchSet>;
|
|
@@ -11,11 +11,6 @@ const BOOT_ARGS = [];
|
|
|
11
11
|
const BOOT_CAUSE = '<boot>';
|
|
12
12
|
const EMPTY_HANDLE = new ObjectHandle(undefined, undefined, Mvcc.observable, EMPTY_SNAPSHOT, '<boot>');
|
|
13
13
|
export class OperationController extends Controller {
|
|
14
|
-
constructor(h, m) {
|
|
15
|
-
super();
|
|
16
|
-
this.objectHandle = h;
|
|
17
|
-
this.memberName = m;
|
|
18
|
-
}
|
|
19
14
|
configure(options) { return OperationController.configureImpl(this, options); }
|
|
20
15
|
get options() { return this.peek(undefined).operation.options; }
|
|
21
16
|
get unobservable() { return this.peek(undefined).operation.content; }
|
|
@@ -26,6 +21,11 @@ export class OperationController extends Controller {
|
|
|
26
21
|
get isUpToDate() { return this.use().isUpToDate; }
|
|
27
22
|
markObsolete() { Transaction.run({ hint: Log.isOn ? `markObsolete(${Dump.obj(this.objectHandle, this.memberName)})` : 'markObsolete()' }, OperationController.markObsolete, this); }
|
|
28
23
|
pullLastResult(args) { return this.useOrRun(true, args).content; }
|
|
24
|
+
constructor(h, m) {
|
|
25
|
+
super();
|
|
26
|
+
this.objectHandle = h;
|
|
27
|
+
this.memberName = m;
|
|
28
|
+
}
|
|
29
29
|
useOrRun(weak, args) {
|
|
30
30
|
var _a;
|
|
31
31
|
let oc = this.peek(args);
|
|
@@ -589,7 +589,8 @@ class Operation extends Observable {
|
|
|
589
589
|
return ok;
|
|
590
590
|
}
|
|
591
591
|
static canSubscribe(observable, os, m, h, timestamp) {
|
|
592
|
-
|
|
592
|
+
const observableHead = h.head.data[m];
|
|
593
|
+
let result = observable === observableHead || (!os.changeset.sealed && os.former.snapshot.data[m] === observableHead);
|
|
593
594
|
if (result && timestamp !== -1)
|
|
594
595
|
result = !(observable instanceof Operation && timestamp >= observable.obsoleteSince);
|
|
595
596
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactronic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.101",
|
|
4
4
|
"description": "Reactronic - Transactional Reactive State Management",
|
|
5
5
|
"publisher": "Nezaboodka Software",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/nezaboodka/reactronic/blob/master/README.md#readme",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "18.11.
|
|
35
|
-
"@types/react": "18.0.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
37
|
-
"@typescript-eslint/parser": "5.
|
|
34
|
+
"@types/node": "18.11.18",
|
|
35
|
+
"@types/react": "18.0.26",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "5.47.1",
|
|
37
|
+
"@typescript-eslint/parser": "5.47.1",
|
|
38
38
|
"ava": "4.3.3",
|
|
39
39
|
"c8": "7.12.0",
|
|
40
|
-
"eslint": "8.
|
|
40
|
+
"eslint": "8.30.0",
|
|
41
41
|
"react": "18.2.0",
|
|
42
42
|
"ts-node": "10.9.1",
|
|
43
|
-
"typescript": "4.
|
|
43
|
+
"typescript": "4.9.4"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "eslint source/**/*.ts test/**/*.ts react/**/*.tsx && tsc",
|