reactronic 0.22.314 → 0.22.317
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 +23 -23
- package/build/dist/source/Buffer.d.ts +2 -2
- package/build/dist/source/Buffer.js +2 -2
- package/build/dist/source/Options.d.ts +3 -3
- package/build/dist/source/Rx.d.ts +2 -2
- package/build/dist/source/Rx.js +14 -14
- package/build/dist/source/api.d.ts +5 -5
- package/build/dist/source/api.js +4 -4
- package/build/dist/source/impl/Changeset.js +8 -8
- package/build/dist/source/impl/Data.d.ts +1 -1
- package/build/dist/source/impl/Journal.d.ts +2 -2
- package/build/dist/source/impl/Journal.js +5 -5
- package/build/dist/source/impl/Meta.d.ts +1 -1
- package/build/dist/source/impl/Meta.js +1 -1
- package/build/dist/source/impl/Monitor.d.ts +2 -2
- package/build/dist/source/impl/Monitor.js +5 -5
- package/build/dist/source/impl/{Hooks.d.ts → Mvcc.d.ts} +15 -12
- package/build/dist/source/impl/{Hooks.js → Mvcc.js} +57 -52
- package/build/dist/source/impl/MvccArray.d.ts +60 -0
- package/build/dist/source/impl/MvccArray.js +58 -0
- package/build/dist/source/impl/MvccCollection.d.ts +25 -0
- package/build/dist/source/impl/MvccCollection.js +23 -0
- package/build/dist/source/impl/MvccMap.d.ts +25 -0
- package/build/dist/source/impl/MvccMap.js +35 -0
- package/build/dist/source/impl/Operation.d.ts +3 -3
- package/build/dist/source/impl/Operation.js +20 -20
- package/build/dist/source/impl/Transaction.d.ts +2 -2
- package/build/dist/source/impl/Transaction.js +9 -9
- package/build/dist/source/util/Collection.d.ts +3 -1
- package/build/dist/source/util/Collection.js +16 -8
- package/package.json +1 -1
- package/build/dist/source/impl/ReactiveArray.d.ts +0 -33
- package/build/dist/source/impl/ReactiveArray.js +0 -42
- package/build/dist/source/impl/ReactiveMap.d.ts +0 -15
- package/build/dist/source/impl/ReactiveMap.js +0 -24
|
@@ -17,8 +17,8 @@ export class Transaction {
|
|
|
17
17
|
}
|
|
18
18
|
static create(options) { return new TransactionImpl(options); }
|
|
19
19
|
static run(options, func, ...args) { return TransactionImpl.run(options, func, ...args); }
|
|
20
|
-
static
|
|
21
|
-
static
|
|
20
|
+
static separate(func, ...args) { return TransactionImpl.separate(func, ...args); }
|
|
21
|
+
static outside(func, ...args) { return TransactionImpl.outside(func, ...args); }
|
|
22
22
|
static isFrameOver(everyN = 1, timeLimit = 10) { return TransactionImpl.isFrameOver(everyN, timeLimit); }
|
|
23
23
|
static requestNextFrame(sleepTime = 0) { return TransactionImpl.requestNextFrame(sleepTime); }
|
|
24
24
|
static get isCanceled() { return TransactionImpl.current.isCanceled; }
|
|
@@ -118,7 +118,7 @@ class TransactionImpl extends Transaction {
|
|
|
118
118
|
let result = t.runImpl(options === null || options === void 0 ? void 0 : options.logging, func, ...args);
|
|
119
119
|
if (root) {
|
|
120
120
|
if (result instanceof Promise) {
|
|
121
|
-
result = TransactionImpl.
|
|
121
|
+
result = TransactionImpl.outside(() => {
|
|
122
122
|
return t.wrapToRetry(t.wrapToWaitUntilFinish(result), func, ...args);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -126,10 +126,10 @@ class TransactionImpl extends Transaction {
|
|
|
126
126
|
}
|
|
127
127
|
return result;
|
|
128
128
|
}
|
|
129
|
-
static
|
|
130
|
-
return TransactionImpl.run({
|
|
129
|
+
static separate(func, ...args) {
|
|
130
|
+
return TransactionImpl.run({ separation: true }, func, ...args);
|
|
131
131
|
}
|
|
132
|
-
static
|
|
132
|
+
static outside(func, ...args) {
|
|
133
133
|
const outer = TransactionImpl.curr;
|
|
134
134
|
try {
|
|
135
135
|
TransactionImpl.curr = TransactionImpl.none;
|
|
@@ -153,7 +153,7 @@ class TransactionImpl extends Transaction {
|
|
|
153
153
|
}
|
|
154
154
|
static acquire(options) {
|
|
155
155
|
const curr = TransactionImpl.curr;
|
|
156
|
-
if ((options === null || options === void 0 ? void 0 : options.
|
|
156
|
+
if ((options === null || options === void 0 ? void 0 : options.separation) || curr.isFinished || curr.options.separation === 'isolated')
|
|
157
157
|
return new TransactionImpl(options);
|
|
158
158
|
else
|
|
159
159
|
return TransactionImpl.curr;
|
|
@@ -176,7 +176,7 @@ class TransactionImpl extends Transaction {
|
|
|
176
176
|
yield this.after.whenFinished();
|
|
177
177
|
const options = {
|
|
178
178
|
hint: `${this.hint} - restart after T${this.after.id}`,
|
|
179
|
-
|
|
179
|
+
separation: this.options.separation === 'isolated' ? 'isolated' : true,
|
|
180
180
|
logging: this.changeset.options.logging,
|
|
181
181
|
token: this.changeset.options.token,
|
|
182
182
|
};
|
|
@@ -226,7 +226,7 @@ class TransactionImpl extends Transaction {
|
|
|
226
226
|
if (this.sealed && this.pending === 0) {
|
|
227
227
|
const reactions = this.applyOrDiscard();
|
|
228
228
|
TransactionImpl.curr = outer;
|
|
229
|
-
TransactionImpl.
|
|
229
|
+
TransactionImpl.outside(Changeset.enqueueReactionsToRun, reactions);
|
|
230
230
|
}
|
|
231
231
|
else
|
|
232
232
|
TransactionImpl.curr = outer;
|
|
@@ -42,7 +42,9 @@ export declare class Collection<T> implements CollectionReader<T> {
|
|
|
42
42
|
get removedCount(): number;
|
|
43
43
|
get isMergeInProgress(): boolean;
|
|
44
44
|
lookup(key: string | undefined): Item<T> | undefined;
|
|
45
|
-
claim(key: string
|
|
45
|
+
claim(key: string, resolution?: {
|
|
46
|
+
isDuplicate: boolean;
|
|
47
|
+
}): Item<T> | undefined;
|
|
46
48
|
add(self: T): Item<T>;
|
|
47
49
|
remove(item: Item<T>): void;
|
|
48
50
|
move(item: Item<T>, after: Item<T>): void;
|
|
@@ -37,7 +37,7 @@ export class Collection {
|
|
|
37
37
|
}
|
|
38
38
|
return result;
|
|
39
39
|
}
|
|
40
|
-
claim(key) {
|
|
40
|
+
claim(key, resolution) {
|
|
41
41
|
const tag = this.tag;
|
|
42
42
|
if (tag < 0)
|
|
43
43
|
throw new Error('merge is not in progress');
|
|
@@ -45,15 +45,23 @@ export class Collection {
|
|
|
45
45
|
if (key !== (item ? this.getKey(item.self) : undefined))
|
|
46
46
|
item = this.lookup(key);
|
|
47
47
|
if (item) {
|
|
48
|
-
if (item.tag
|
|
48
|
+
if (item.tag !== tag) {
|
|
49
|
+
item.tag = tag;
|
|
50
|
+
if (this.strict && item !== this.strictNextItem)
|
|
51
|
+
item.status = tag;
|
|
52
|
+
this.strictNextItem = item.next;
|
|
53
|
+
this.removed.exclude(item);
|
|
54
|
+
this.current.include(item);
|
|
55
|
+
if (resolution)
|
|
56
|
+
resolution.isDuplicate = false;
|
|
57
|
+
}
|
|
58
|
+
else if (resolution)
|
|
59
|
+
resolution.isDuplicate = true;
|
|
60
|
+
else
|
|
49
61
|
throw new Error(`duplicate item: ${key}`);
|
|
50
|
-
item.tag = tag;
|
|
51
|
-
if (this.strict && item !== this.strictNextItem)
|
|
52
|
-
item.status = tag;
|
|
53
|
-
this.strictNextItem = item.next;
|
|
54
|
-
this.removed.exclude(item);
|
|
55
|
-
this.current.include(item);
|
|
56
62
|
}
|
|
63
|
+
else if (resolution)
|
|
64
|
+
resolution.isDuplicate = false;
|
|
57
65
|
return item;
|
|
58
66
|
}
|
|
59
67
|
add(self) {
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ReactiveObject } from './Hooks';
|
|
2
|
-
export declare class ReactiveArray<T> extends ReactiveObject {
|
|
3
|
-
private a;
|
|
4
|
-
get length(): number;
|
|
5
|
-
set length(n: number);
|
|
6
|
-
get(n: number): T;
|
|
7
|
-
set(n: number, item: T): void;
|
|
8
|
-
toString(): string;
|
|
9
|
-
toLocaleString(): string;
|
|
10
|
-
pop(): T | undefined;
|
|
11
|
-
push(...items: T[]): number;
|
|
12
|
-
concat(...items: (T | ConcatArray<T>)[]): T[];
|
|
13
|
-
join(separator?: string): string;
|
|
14
|
-
reverse(): T[];
|
|
15
|
-
shift(): T | undefined;
|
|
16
|
-
slice(start?: number, end?: number): T[];
|
|
17
|
-
sort(compareFn?: (a: T, b: T) => number): this;
|
|
18
|
-
splice(start: number, deleteCount?: number): T[];
|
|
19
|
-
unshift(...items: T[]): number;
|
|
20
|
-
indexOf(searchElement: T, fromIndex?: number): number;
|
|
21
|
-
lastIndexOf(searchElement: T, fromIndex?: number): number;
|
|
22
|
-
every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
|
|
23
|
-
some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
|
|
24
|
-
forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
|
25
|
-
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
|
26
|
-
filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
|
|
27
|
-
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
|
|
28
|
-
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
|
|
29
|
-
entries(): IterableIterator<[number, T]>;
|
|
30
|
-
keys(): IterableIterator<number>;
|
|
31
|
-
values(): IterableIterator<T>;
|
|
32
|
-
private get mutable();
|
|
33
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Sealant } from '../util/Sealant';
|
|
2
|
-
import { ReactiveObject } from './Hooks';
|
|
3
|
-
export class ReactiveArray extends ReactiveObject {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.a = new Array();
|
|
7
|
-
}
|
|
8
|
-
get length() { return this.a.length; }
|
|
9
|
-
set length(n) { this.a.length = n; }
|
|
10
|
-
get(n) { return this.a[n]; }
|
|
11
|
-
set(n, item) { this.mutable[n] = item; }
|
|
12
|
-
toString() { return this.a.toString(); }
|
|
13
|
-
toLocaleString() { return this.a.toLocaleString(); }
|
|
14
|
-
pop() { return this.mutable.pop(); }
|
|
15
|
-
push(...items) { return this.mutable.push(...items); }
|
|
16
|
-
concat(...items) { return this.a.concat(...items); }
|
|
17
|
-
join(separator) { return this.a.join(separator); }
|
|
18
|
-
reverse() { return this.mutable.reverse(); }
|
|
19
|
-
shift() { return this.mutable.shift(); }
|
|
20
|
-
slice(start, end) { return this.a.slice(start, end); }
|
|
21
|
-
sort(compareFn) { this.mutable.sort(compareFn); return this; }
|
|
22
|
-
splice(start, deleteCount, ...items) { return this.mutable.splice(start, deleteCount, ...items); }
|
|
23
|
-
unshift(...items) { return this.mutable.unshift(...items); }
|
|
24
|
-
indexOf(searchElement, fromIndex) { return this.a.indexOf(searchElement, fromIndex); }
|
|
25
|
-
lastIndexOf(searchElement, fromIndex) { return this.a.lastIndexOf(searchElement, fromIndex); }
|
|
26
|
-
every(predicate, thisArg) { return this.a.every(predicate, thisArg); }
|
|
27
|
-
some(predicate, thisArg) { return this.a.some(predicate, thisArg); }
|
|
28
|
-
forEach(callbackfn, thisArg) { return this.a.forEach(callbackfn, thisArg); }
|
|
29
|
-
map(callbackfn, thisArg) { return this.a.map(callbackfn, thisArg); }
|
|
30
|
-
filter(predicate, thisArg) { return this.a.filter(predicate, thisArg); }
|
|
31
|
-
reduce(callbackfn, initialValue) { return this.a.reduce(callbackfn, initialValue); }
|
|
32
|
-
reduceRight(callbackfn, initialValue) { return this.a.reduceRight(callbackfn, initialValue); }
|
|
33
|
-
entries() { return this.a.entries(); }
|
|
34
|
-
keys() { return this.a.keys(); }
|
|
35
|
-
values() { return this.a.values(); }
|
|
36
|
-
get mutable() {
|
|
37
|
-
const createCopy = this.a[Sealant.CreateCopy];
|
|
38
|
-
if (createCopy)
|
|
39
|
-
return this.a = createCopy.call(this.a);
|
|
40
|
-
return this.a;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactiveObject } from './Hooks';
|
|
2
|
-
export declare class ReactiveMap<K, V> extends ReactiveObject {
|
|
3
|
-
private m;
|
|
4
|
-
clear(): void;
|
|
5
|
-
delete(key: K): boolean;
|
|
6
|
-
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
7
|
-
get(key: K): V | undefined;
|
|
8
|
-
has(key: K): boolean;
|
|
9
|
-
set(key: K, value: V): this;
|
|
10
|
-
get size(): number;
|
|
11
|
-
entries(): IterableIterator<[K, V]>;
|
|
12
|
-
keys(): IterableIterator<K>;
|
|
13
|
-
values(): IterableIterator<V>;
|
|
14
|
-
private get mutable();
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Sealant } from '../util/Sealant';
|
|
2
|
-
import { ReactiveObject } from './Hooks';
|
|
3
|
-
export class ReactiveMap extends ReactiveObject {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.m = new Map();
|
|
7
|
-
}
|
|
8
|
-
clear() { this.mutable.clear(); }
|
|
9
|
-
delete(key) { return this.mutable.delete(key); }
|
|
10
|
-
forEach(callbackfn, thisArg) { this.m.forEach(callbackfn, thisArg); }
|
|
11
|
-
get(key) { return this.m.get(key); }
|
|
12
|
-
has(key) { return this.m.has(key); }
|
|
13
|
-
set(key, value) { this.mutable.set(key, value); return this; }
|
|
14
|
-
get size() { return this.m.size; }
|
|
15
|
-
entries() { return this.m.entries(); }
|
|
16
|
-
keys() { return this.m.keys(); }
|
|
17
|
-
values() { return this.m.values(); }
|
|
18
|
-
get mutable() {
|
|
19
|
-
const createCopy = this.m[Sealant.CreateCopy];
|
|
20
|
-
if (createCopy)
|
|
21
|
-
return this.m = createCopy.call(this.m);
|
|
22
|
-
return this.m;
|
|
23
|
-
}
|
|
24
|
-
}
|