reactronic 0.23.103 → 0.23.105
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 +175 -0
- package/build/dist/source/Buffer.d.ts +1 -1
- package/build/dist/source/Buffer.js +1 -1
- package/build/dist/source/Clock.d.ts +12 -0
- package/build/dist/source/Clock.js +53 -0
- package/build/dist/source/Controller.d.ts +1 -1
- package/build/dist/source/Options.d.ts +6 -6
- package/build/dist/source/Options.js +1 -1
- package/build/dist/source/Ref.js +2 -2
- package/build/dist/source/Rx.d.ts +3 -3
- package/build/dist/source/Rx.js +6 -6
- package/build/dist/source/api.d.ts +21 -20
- package/build/dist/source/api.js +17 -16
- package/build/dist/source/impl/Changeset.d.ts +5 -5
- package/build/dist/source/impl/Changeset.js +12 -12
- package/build/dist/source/impl/Data.d.ts +4 -4
- package/build/dist/source/impl/Data.js +4 -4
- package/build/dist/source/impl/Journal.d.ts +2 -2
- package/build/dist/source/impl/Journal.js +6 -6
- package/build/dist/source/impl/Monitor.d.ts +2 -2
- package/build/dist/source/impl/Monitor.js +2 -2
- package/build/dist/source/impl/Mvcc.d.ts +6 -6
- package/build/dist/source/impl/Mvcc.js +10 -10
- package/build/dist/source/impl/MvccArray.d.ts +1 -1
- package/build/dist/source/impl/MvccArray.js +2 -2
- package/build/dist/source/impl/MvccCollection.d.ts +2 -2
- package/build/dist/source/impl/MvccCollection.js +1 -1
- package/build/dist/source/impl/MvccMap.d.ts +1 -1
- package/build/dist/source/impl/MvccMap.js +2 -2
- package/build/dist/source/impl/Operation.d.ts +10 -10
- package/build/dist/source/impl/Operation.js +14 -14
- package/build/dist/source/impl/Transaction.d.ts +4 -4
- package/build/dist/source/impl/Transaction.js +3 -3
- package/build/dist/source/util/Dbg.d.ts +1 -1
- package/build/dist/source/util/Sealant.js +1 -1
- package/build/dist/source/util/SealedArray.d.ts +1 -1
- package/build/dist/source/util/SealedArray.js +1 -1
- package/build/dist/source/util/SealedMap.d.ts +1 -1
- package/build/dist/source/util/SealedMap.js +1 -1
- package/build/dist/source/util/SealedSet.d.ts +1 -1
- package/build/dist/source/util/SealedSet.js +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -446,6 +446,181 @@ class Reactronic {
|
|
|
446
446
|
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
+
## API (Artel)
|
|
450
|
+
|
|
451
|
+
```артель
|
|
452
|
+
// Classes
|
|
453
|
+
|
|
454
|
+
тип ТранзакционныйОбъект = объект { }
|
|
455
|
+
тип НаблюдаемыйОбъект = объект на основе ТранзакционныйОбъект { }
|
|
456
|
+
|
|
457
|
+
// Decorators & Operators
|
|
458
|
+
|
|
459
|
+
// function raw(proto, prop) // field only
|
|
460
|
+
// function transaction(proto, prop, pd) // method only
|
|
461
|
+
// function reactive(proto, prop, pd) // method only
|
|
462
|
+
// function cached(proto, prop, pd) // method only
|
|
463
|
+
// function options(value: Partial<MemberOptions>): F<any>
|
|
464
|
+
|
|
465
|
+
// function nonreactive<T>(func: F<T>, ...args: any[]): T
|
|
466
|
+
// function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
|
|
467
|
+
|
|
468
|
+
// SnapshotOptions, MemberOptions, Kind, Reentrance, Monitor, LoggingOptions, ProfilingOptions
|
|
469
|
+
|
|
470
|
+
тип НастройкиТранзакции = интерфейс
|
|
471
|
+
{
|
|
472
|
+
постоянная подсказка: Текст?
|
|
473
|
+
постоянное раздельно?: РежимРазделения
|
|
474
|
+
постоянный журнал: Журнал?
|
|
475
|
+
постоянное журнализация: Выборочно<НастройкиЖурнализации>
|
|
476
|
+
постоянный ключ: Нечто?
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
тип НастройкиЧленаОбъекта = интерфейс
|
|
480
|
+
{
|
|
481
|
+
постоянный разновидность: Разновидность
|
|
482
|
+
постоянное раздельно?: РежимРазделения
|
|
483
|
+
постоянный порядок: Целое
|
|
484
|
+
постоянный безПобочныхЭффектов: Булево
|
|
485
|
+
постоянный триггерныеАргументы: Булево
|
|
486
|
+
постоянный дроссель: Целое // миллисекунды, -1 немедленно, Целое.Макс никогда
|
|
487
|
+
постоянный рецидив: Рецидив
|
|
488
|
+
постоянный журнал: Журнал?
|
|
489
|
+
постоянный монитор: Монитор?
|
|
490
|
+
постоянная журнализация: Выборочно<НастройкиЖурнализации>
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
тип Разновидность = вариант
|
|
494
|
+
{
|
|
495
|
+
Plain = 0
|
|
496
|
+
Транзакционное = 1
|
|
497
|
+
Реактивное = 2
|
|
498
|
+
Кэшируемое = 3
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
тип Рецидив = вариант
|
|
502
|
+
{
|
|
503
|
+
PreventWithError = 1, // fail with error if there is an existing call in progress (default)
|
|
504
|
+
WaitAndRestart = 0, // wait for existing call to finish and then restart current one
|
|
505
|
+
CancelPrevious = -1, // cancel previous call in favor of recent one
|
|
506
|
+
CancelAndWaitPrevious = -2, // cancel previous call in favor of recent one (but wait until canceling is completed)
|
|
507
|
+
OverwritePrevious = -2, // allow previous to complete, but overwrite it with ignoring any conflicts
|
|
508
|
+
RunSideBySide = -3 // multiple simultaneous calls are allowed
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
тип Монитор = объект
|
|
512
|
+
{
|
|
513
|
+
постоянное активно: Булево
|
|
514
|
+
постоянный счетчик: Целое
|
|
515
|
+
постоянные работы: ЧитаемоеМножество<Работа>
|
|
516
|
+
при создании(подсказка: Текст,
|
|
517
|
+
задержкаАктивации: Целое, задержкаДеактивации: Целое)
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
тип Работа = интерфейс
|
|
521
|
+
{
|
|
522
|
+
постоянный код: Целое
|
|
523
|
+
постоянная подсказка: Текст
|
|
524
|
+
отменено: Булево
|
|
525
|
+
завершено: Булево
|
|
526
|
+
операция отменить(о: Ошибка?, повторПосле: Транзакция?)
|
|
527
|
+
параллельная операция ожидание-окончания()
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
тип НастройкиЖурнализации = интерфейс
|
|
531
|
+
{
|
|
532
|
+
постоянный выключено: Булево
|
|
533
|
+
постоянный транзакция: Булево
|
|
534
|
+
постоянный операция: Булево
|
|
535
|
+
постоянный шаг: Булево
|
|
536
|
+
постоянный монитор: Булево
|
|
537
|
+
постоянный чтение: Булево
|
|
538
|
+
постоянный запись: Булево
|
|
539
|
+
постоянный изменение: Булево
|
|
540
|
+
постоянный аннулирование: Булево
|
|
541
|
+
постоянный ошибка: Булево
|
|
542
|
+
постоянный предупреждение: Булево
|
|
543
|
+
постоянный уборка-мусора: Булево
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
тип НастройкиПрофилирования =
|
|
547
|
+
{
|
|
548
|
+
порогПредупрежденияПриМногократномИспользовании: Целое // 10 раз
|
|
549
|
+
порогПредупрежденияПриБлокировкеГлавногоПотока: Целое // 16.6 мс
|
|
550
|
+
порогПредупрежденияПриДлительномПараллельномВыполнении: Целое // 150 мс
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Транзакция
|
|
554
|
+
|
|
555
|
+
тип Ф<Т> = операция(арг: Элементы<Нечто>): Т
|
|
556
|
+
|
|
557
|
+
тип Транзакция = объект на основе Работа
|
|
558
|
+
{
|
|
559
|
+
общая охраняемая типом текущая: Транзакция
|
|
560
|
+
|
|
561
|
+
охраняемый типом код: Целое
|
|
562
|
+
охраняемая типом подсказка: Текст
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
исполнить<Т>(ф: Ф<Т>, арг: Элементы<Нечто>): Т
|
|
566
|
+
wrap<T>(func: F<T>): F<T>
|
|
567
|
+
зафиксировать()
|
|
568
|
+
опечатать() // a1.seal().whenFinished().then(fulfill, reject)
|
|
569
|
+
отменить(о: Ошибка?, повтор-после: Транзакция? = пусто)
|
|
570
|
+
отменено: Булево
|
|
571
|
+
завершено: Булево
|
|
572
|
+
whenFinished(): Promise<void>
|
|
573
|
+
join<T>(p: Promise<T>): Promise<T>
|
|
574
|
+
|
|
575
|
+
общая операция создать(настройки: НастройкиСнимка?): Транзакция
|
|
576
|
+
общая операция исполнить<Т>(настройки: НастройкиСнимка?, ф: Ф<Т>, арг: Элементы<Т>): Т
|
|
577
|
+
общая операция вне-транзакции<Т>(ф: Ф<Т>, арг: Элементы<Нечто>): Т
|
|
578
|
+
|
|
579
|
+
общая операция фрейм-окончен(шаг: Целое, лимит-времени: Целое): Булево
|
|
580
|
+
общая параллельная операция запросить-следующий-фрейм(время-сна: Целое)
|
|
581
|
+
общее отменено: Булево
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Контролер
|
|
585
|
+
|
|
586
|
+
тип Контролер = объект
|
|
587
|
+
{
|
|
588
|
+
охраняемое типом options: Options
|
|
589
|
+
охраняемое типом args: ReadonlyArray<any>
|
|
590
|
+
охраняемое типом value: T
|
|
591
|
+
охраняемое типом error: any
|
|
592
|
+
охраняемое типом stamp: number
|
|
593
|
+
охраняемое типом isUpToDate: boolean
|
|
594
|
+
|
|
595
|
+
настроить(настройки: Выборочно<Настройки>): Настройки
|
|
596
|
+
аннулировать(): Булево
|
|
597
|
+
взять-последний-результат<Т>(арг: Элементы<Нечто>): Т?
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// Реактроник
|
|
601
|
+
|
|
602
|
+
тип Реактроник = объект
|
|
603
|
+
{
|
|
604
|
+
общая операция почему(кратко: Булево = нет): Текст
|
|
605
|
+
общая операция взятьКэшОперации<Т>(о: Оп<Т>): Кэш<Т>
|
|
606
|
+
общая операция configureCurrentOperation(options: Partial<Options>): Options
|
|
607
|
+
общая операция взятьРевизию(о: Нечто): Целое
|
|
608
|
+
общая операция взятьСнимок<Т>(о: Т): Т
|
|
609
|
+
общая операция dispose(obj: Нечто)
|
|
610
|
+
общая операция reactivityAutoStartDisabled: boolean
|
|
611
|
+
общее охраняемое журнализация-включена: Булево
|
|
612
|
+
общая охраняемое настройки-журнализации: НастройкиЖурнализации
|
|
613
|
+
общая операция пустьРежимЖурнализации(
|
|
614
|
+
вкл: Булево, настройки: НастройкиЖурнализации? = пусто)
|
|
615
|
+
общая операция пустьПодсказкаЖурнализации<Т extends Объект>(
|
|
616
|
+
о: Т, подсказка: Текст?)
|
|
617
|
+
общая операция взятьПодсказкуЖурнализации<Т extends Объект>(о: Т): Текст?
|
|
618
|
+
общая операция пустьРежимПрофилирования(
|
|
619
|
+
вкл: Булево, настройки: Выборочно<НастройкиЖурнализации>? = пусто)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
|
|
449
624
|
## Contribution
|
|
450
625
|
|
|
451
626
|
By contributing, you agree that your contributions will be
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ObservableObject } from './impl/Mvcc.js';
|
|
2
|
+
export declare class Clock extends ObservableObject {
|
|
3
|
+
hour: number;
|
|
4
|
+
minute: number;
|
|
5
|
+
second: number;
|
|
6
|
+
ms: number;
|
|
7
|
+
interval: number;
|
|
8
|
+
paused: boolean;
|
|
9
|
+
constructor(interval?: number);
|
|
10
|
+
pause(value?: boolean): void;
|
|
11
|
+
private tick;
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ObservableObject } from './impl/Mvcc.js';
|
|
11
|
+
import { transactional } from './Rx.js';
|
|
12
|
+
export class Clock extends ObservableObject {
|
|
13
|
+
constructor(interval = 1000) {
|
|
14
|
+
super();
|
|
15
|
+
this.hour = 0;
|
|
16
|
+
this.minute = 0;
|
|
17
|
+
this.second = 0;
|
|
18
|
+
this.ms = 0;
|
|
19
|
+
this.interval = 0;
|
|
20
|
+
this.paused = false;
|
|
21
|
+
this.interval = interval;
|
|
22
|
+
this.tick();
|
|
23
|
+
}
|
|
24
|
+
pause(value = true) {
|
|
25
|
+
this.paused = value;
|
|
26
|
+
}
|
|
27
|
+
tick() {
|
|
28
|
+
let calibration = 0;
|
|
29
|
+
try {
|
|
30
|
+
const now = new Date();
|
|
31
|
+
this.hour = now.getHours();
|
|
32
|
+
this.minute = now.getMinutes();
|
|
33
|
+
this.second = now.getSeconds();
|
|
34
|
+
this.ms = now.getMilliseconds();
|
|
35
|
+
calibration = now.getTime() % this.interval;
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setTimeout(() => this.tick(), this.interval - calibration);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
__decorate([
|
|
43
|
+
transactional,
|
|
44
|
+
__metadata("design:type", Function),
|
|
45
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
46
|
+
__metadata("design:returntype", void 0)
|
|
47
|
+
], Clock.prototype, "pause", null);
|
|
48
|
+
__decorate([
|
|
49
|
+
transactional,
|
|
50
|
+
__metadata("design:type", Function),
|
|
51
|
+
__metadata("design:paramtypes", []),
|
|
52
|
+
__metadata("design:returntype", void 0)
|
|
53
|
+
], Clock.prototype, "tick", null);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LoggingOptions } from './Logging';
|
|
2
|
-
import { SeparationMode } from './impl/Data';
|
|
3
|
-
export { LoggingLevel } from './Logging';
|
|
4
|
-
export type { LoggingOptions, ProfilingOptions } from './Logging';
|
|
5
|
-
import { Journal } from './impl/Journal';
|
|
6
|
-
import { Monitor } from './impl/Monitor';
|
|
1
|
+
import { LoggingOptions } from './Logging.js';
|
|
2
|
+
import { SeparationMode } from './impl/Data.js';
|
|
3
|
+
export { LoggingLevel } from './Logging.js';
|
|
4
|
+
export type { LoggingOptions, ProfilingOptions } from './Logging.js';
|
|
5
|
+
import { Journal } from './impl/Journal.js';
|
|
6
|
+
import { Monitor } from './impl/Monitor.js';
|
|
7
7
|
export interface SnapshotOptions {
|
|
8
8
|
readonly hint?: string;
|
|
9
9
|
readonly separation?: SeparationMode;
|
package/build/dist/source/Ref.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F } from './util/Utils';
|
|
2
|
-
import { Controller } from './Controller';
|
|
3
|
-
import { MemberOptions, LoggingOptions, ProfilingOptions } from './Options';
|
|
1
|
+
import { F } from './util/Utils.js';
|
|
2
|
+
import { Controller } from './Controller.js';
|
|
3
|
+
import { MemberOptions, LoggingOptions, ProfilingOptions } from './Options.js';
|
|
4
4
|
export declare class Rx {
|
|
5
5
|
static why(brief?: boolean): string;
|
|
6
6
|
static getController<T>(method: F<T>): Controller<T>;
|
package/build/dist/source/Rx.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Log } from './util/Dbg';
|
|
2
|
-
import { Kind } from './Options';
|
|
3
|
-
import { Meta, ObjectHandle } from './impl/Data';
|
|
4
|
-
import { Changeset } from './impl/Changeset';
|
|
5
|
-
import { Mvcc } from './impl/Mvcc';
|
|
6
|
-
import { OperationController } from './impl/Operation';
|
|
1
|
+
import { Log } from './util/Dbg.js';
|
|
2
|
+
import { Kind } from './Options.js';
|
|
3
|
+
import { Meta, ObjectHandle } from './impl/Data.js';
|
|
4
|
+
import { Changeset } from './impl/Changeset.js';
|
|
5
|
+
import { Mvcc } from './impl/Mvcc.js';
|
|
6
|
+
import { OperationController } from './impl/Operation.js';
|
|
7
7
|
export class Rx {
|
|
8
8
|
static why(brief = false) { return brief ? OperationController.briefWhy() : OperationController.why(); }
|
|
9
9
|
static getController(method) { return OperationController.getControllerOf(method); }
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
export { all, pause } from './util/Utils';
|
|
2
|
-
export { Collection } from './util/Collection';
|
|
3
|
-
export type { Item, CollectionReader } from './util/Collection';
|
|
4
|
-
export { SealedArray } from './util/SealedArray';
|
|
5
|
-
export { SealedMap } from './util/SealedMap';
|
|
6
|
-
export { SealedSet } from './util/SealedSet';
|
|
7
|
-
export { Kind, Reentrance, LoggingLevel } from './Options';
|
|
8
|
-
export type { MemberOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from './Options';
|
|
9
|
-
export type { Worker } from './Worker';
|
|
10
|
-
export { Controller } from './Controller';
|
|
11
|
-
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref';
|
|
12
|
-
export type { BoolOnly, GivenTypeOnly } from './Ref';
|
|
13
|
-
export { TransactionalObject, ObservableObject } from './impl/Mvcc';
|
|
14
|
-
export { TransactionalArray, ObservableArray } from './impl/MvccArray';
|
|
15
|
-
export { TransactionalMap, ObservableMap } from './impl/MvccMap';
|
|
16
|
-
export { Changeset } from './impl/Changeset';
|
|
17
|
-
export { Transaction } from './impl/Transaction';
|
|
18
|
-
export { Monitor } from './impl/Monitor';
|
|
19
|
-
export { Journal } from './impl/Journal';
|
|
20
|
-
export { Rx, raw, observable, transactional, reactive, cached, nonreactive, sensitive, options } from './Rx';
|
|
1
|
+
export { all, pause } from './util/Utils.js';
|
|
2
|
+
export { Collection } from './util/Collection.js';
|
|
3
|
+
export type { Item, CollectionReader } from './util/Collection.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 { MemberOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from './Options.js';
|
|
9
|
+
export type { Worker } from './Worker.js';
|
|
10
|
+
export { Controller } from './Controller.js';
|
|
11
|
+
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref.js';
|
|
12
|
+
export type { BoolOnly, GivenTypeOnly } from './Ref.js';
|
|
13
|
+
export { TransactionalObject, ObservableObject } from './impl/Mvcc.js';
|
|
14
|
+
export { TransactionalArray, ObservableArray } from './impl/MvccArray.js';
|
|
15
|
+
export { TransactionalMap, ObservableMap } from './impl/MvccMap.js';
|
|
16
|
+
export { Changeset } from './impl/Changeset.js';
|
|
17
|
+
export { Transaction } from './impl/Transaction.js';
|
|
18
|
+
export { Monitor } from './impl/Monitor.js';
|
|
19
|
+
export { Journal } from './impl/Journal.js';
|
|
20
|
+
export { Rx, raw, observable, transactional, reactive, cached, nonreactive, sensitive, options } from './Rx.js';
|
|
21
|
+
export { Clock } from './Clock.js';
|
package/build/dist/source/api.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { all, pause } from './util/Utils';
|
|
2
|
-
export { Collection } from './util/Collection';
|
|
3
|
-
export { SealedArray } from './util/SealedArray';
|
|
4
|
-
export { SealedMap } from './util/SealedMap';
|
|
5
|
-
export { SealedSet } from './util/SealedSet';
|
|
6
|
-
export { Kind, Reentrance, LoggingLevel } from './Options';
|
|
7
|
-
export { Controller } from './Controller';
|
|
8
|
-
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref';
|
|
9
|
-
export { TransactionalObject, ObservableObject } from './impl/Mvcc';
|
|
10
|
-
export { TransactionalArray, ObservableArray } from './impl/MvccArray';
|
|
11
|
-
export { TransactionalMap, ObservableMap } from './impl/MvccMap';
|
|
12
|
-
export { Changeset } from './impl/Changeset';
|
|
13
|
-
export { Transaction } from './impl/Transaction';
|
|
14
|
-
export { Monitor } from './impl/Monitor';
|
|
15
|
-
export { Journal } from './impl/Journal';
|
|
16
|
-
export { Rx, raw, observable, transactional, reactive, cached, nonreactive, sensitive, options } from './Rx';
|
|
1
|
+
export { all, pause } from './util/Utils.js';
|
|
2
|
+
export { Collection } from './util/Collection.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 { Controller } from './Controller.js';
|
|
8
|
+
export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref.js';
|
|
9
|
+
export { TransactionalObject, ObservableObject } from './impl/Mvcc.js';
|
|
10
|
+
export { TransactionalArray, ObservableArray } from './impl/MvccArray.js';
|
|
11
|
+
export { TransactionalMap, ObservableMap } from './impl/MvccMap.js';
|
|
12
|
+
export { Changeset } from './impl/Changeset.js';
|
|
13
|
+
export { Transaction } from './impl/Transaction.js';
|
|
14
|
+
export { Monitor } from './impl/Monitor.js';
|
|
15
|
+
export { Journal } from './impl/Journal.js';
|
|
16
|
+
export { Rx, raw, observable, transactional, reactive, cached, nonreactive, sensitive, options } from './Rx.js';
|
|
17
|
+
export { Clock } from './Clock.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Kind, SnapshotOptions } from '../Options';
|
|
2
|
-
import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle,
|
|
1
|
+
import { Kind, SnapshotOptions } from '../Options.js';
|
|
2
|
+
import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle, ObservableValue, 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 {
|
|
@@ -23,7 +23,7 @@ export declare class Changeset implements AbstractChangeset {
|
|
|
23
23
|
constructor(options: SnapshotOptions | null);
|
|
24
24
|
static current: () => Changeset;
|
|
25
25
|
static edit: () => Changeset;
|
|
26
|
-
static markUsed: (observable:
|
|
26
|
+
static markUsed: (observable: ObservableValue, os: ObjectSnapshot, m: MemberName, h: ObjectHandle, kind: Kind, weak: boolean) => void;
|
|
27
27
|
static markEdited: (oldValue: any, newValue: any, edited: boolean, os: ObjectSnapshot, m: MemberName, h: ObjectHandle) => void;
|
|
28
28
|
static isConflicting: (oldValue: any, newValue: any) => boolean;
|
|
29
29
|
static propagateAllChangesThroughSubscriptions: (changeset: Changeset) => void;
|
|
@@ -42,7 +42,7 @@ export declare class Changeset implements AbstractChangeset {
|
|
|
42
42
|
private merge;
|
|
43
43
|
applyOrDiscard(error?: any): Array<Observer>;
|
|
44
44
|
static sealObjectSnapshot(h: ObjectHandle, os: ObjectSnapshot): void;
|
|
45
|
-
static
|
|
45
|
+
static sealObservableValue(o: ObservableValue | symbol, m: MemberName, typeName: string): void;
|
|
46
46
|
static freezeObjectSnapshot(os: ObjectSnapshot): ObjectSnapshot;
|
|
47
47
|
triggerGarbageCollection(): void;
|
|
48
48
|
private unlinkHistory;
|
|
@@ -51,7 +51,7 @@ export declare class Changeset implements AbstractChangeset {
|
|
|
51
51
|
export declare class Dump {
|
|
52
52
|
static valueHint: (value: any) => string;
|
|
53
53
|
static obj(h: ObjectHandle | undefined, m?: MemberName | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, value?: any): string;
|
|
54
|
-
static snapshot2(h: ObjectHandle, s: AbstractChangeset, m?: MemberName, o?:
|
|
54
|
+
static snapshot2(h: ObjectHandle, s: AbstractChangeset, m?: MemberName, o?: ObservableValue): string;
|
|
55
55
|
static snapshot(os: ObjectSnapshot, m?: MemberName): string;
|
|
56
56
|
static conflicts(conflicts: ObjectSnapshot[]): string;
|
|
57
57
|
static conflictingMemberHint(m: MemberName, ours: ObjectSnapshot, theirs: ObjectSnapshot): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Utils, UNDEF } from '../util/Utils';
|
|
2
|
-
import { Log, misuse } from '../util/Dbg';
|
|
3
|
-
import { Sealant } from '../util/Sealant';
|
|
4
|
-
import { SealedArray } from '../util/SealedArray';
|
|
5
|
-
import { SealedMap } from '../util/SealedMap';
|
|
6
|
-
import { SealedSet } from '../util/SealedSet';
|
|
7
|
-
import { ObjectSnapshot, ObjectHandle,
|
|
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, ObservableValue, Meta } from './Data.js';
|
|
8
8
|
export const MAX_REVISION = Number.MAX_SAFE_INTEGER;
|
|
9
9
|
export const UNDEFINED_REVISION = MAX_REVISION - 1;
|
|
10
10
|
Object.defineProperty(ObjectHandle.prototype, '#this#', {
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(ObjectHandle.prototype, '#this#', {
|
|
|
14
14
|
const data = Changeset.current().getObjectSnapshot(this, '#this#').data;
|
|
15
15
|
for (const m in data) {
|
|
16
16
|
const v = data[m];
|
|
17
|
-
if (v instanceof
|
|
17
|
+
if (v instanceof ObservableValue)
|
|
18
18
|
result[m] = v.content;
|
|
19
19
|
else if (v === Meta.Raw)
|
|
20
20
|
result[m] = this.data[m];
|
|
@@ -67,7 +67,7 @@ export class Changeset {
|
|
|
67
67
|
const revision = m === Meta.Handle ? 1 : os.revision + 1;
|
|
68
68
|
const data = Object.assign({}, m === Meta.Handle ? value : os.data);
|
|
69
69
|
Meta.set(data, Meta.Handle, h);
|
|
70
|
-
Meta.set(data, Meta.Revision, new
|
|
70
|
+
Meta.set(data, Meta.Revision, new ObservableValue(revision));
|
|
71
71
|
os = new ObjectSnapshot(this, os, data);
|
|
72
72
|
this.items.set(h, os);
|
|
73
73
|
h.editing = os;
|
|
@@ -218,15 +218,15 @@ export class Changeset {
|
|
|
218
218
|
}
|
|
219
219
|
static sealObjectSnapshot(h, os) {
|
|
220
220
|
if (!os.disposed)
|
|
221
|
-
os.changes.forEach((o, m) => Changeset.
|
|
221
|
+
os.changes.forEach((o, m) => Changeset.sealObservableValue(os.data[m], m, h.proxy.constructor.name));
|
|
222
222
|
else
|
|
223
223
|
for (const m in os.former.snapshot.data)
|
|
224
224
|
os.data[m] = Meta.Undefined;
|
|
225
225
|
if (Log.isOn)
|
|
226
226
|
Changeset.freezeObjectSnapshot(os);
|
|
227
227
|
}
|
|
228
|
-
static
|
|
229
|
-
if (o instanceof
|
|
228
|
+
static sealObservableValue(o, m, typeName) {
|
|
229
|
+
if (o instanceof ObservableValue) {
|
|
230
230
|
const value = o.content;
|
|
231
231
|
if (value !== undefined && value !== null) {
|
|
232
232
|
const sealedType = Object.getPrototypeOf(value)[Sealant.SealedType];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Meta } from './Meta';
|
|
1
|
+
export { Meta } from './Meta.js';
|
|
2
2
|
export interface AbstractChangeset {
|
|
3
3
|
readonly id: number;
|
|
4
4
|
readonly hint: string;
|
|
5
5
|
readonly timestamp: number;
|
|
6
6
|
readonly sealed: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class ObservableValue {
|
|
9
9
|
content: any;
|
|
10
10
|
observers?: Set<Observer>;
|
|
11
11
|
get isOperation(): boolean;
|
|
@@ -15,10 +15,10 @@ export declare class Observable {
|
|
|
15
15
|
export type SeparationMode = boolean | 'isolated' | 'disposal';
|
|
16
16
|
export interface Observer {
|
|
17
17
|
readonly order: number;
|
|
18
|
-
readonly observables: Map<
|
|
18
|
+
readonly observables: Map<ObservableValue, Subscription> | undefined;
|
|
19
19
|
readonly obsoleteSince: number;
|
|
20
20
|
hint(nop?: boolean): string;
|
|
21
|
-
markObsoleteDueTo(observable:
|
|
21
|
+
markObsoleteDueTo(observable: ObservableValue, 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
24
|
export type MemberName = PropertyKey;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Log } from '../util/Dbg';
|
|
2
|
-
import { Meta } from './Meta';
|
|
3
|
-
export { Meta } from './Meta';
|
|
4
|
-
export class
|
|
1
|
+
import { Log } from '../util/Dbg.js';
|
|
2
|
+
import { Meta } from './Meta.js';
|
|
3
|
+
export { Meta } from './Meta.js';
|
|
4
|
+
export class ObservableValue {
|
|
5
5
|
get isOperation() { return false; }
|
|
6
6
|
get originSnapshotId() { return 0; }
|
|
7
7
|
constructor(content) { this.content = content; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ObservableObject } from './Mvcc';
|
|
2
|
-
import { ObjectHandle, ObjectSnapshot, PatchSet } from './Data';
|
|
1
|
+
import { ObservableObject } from './Mvcc.js';
|
|
2
|
+
import { ObjectHandle, ObjectSnapshot, PatchSet } from './Data.js';
|
|
3
3
|
export type Saver = (patch: PatchSet) => Promise<void>;
|
|
4
4
|
export declare abstract class Journal extends ObservableObject {
|
|
5
5
|
abstract capacity: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ObservableObject } from './Mvcc';
|
|
2
|
-
import { Meta,
|
|
3
|
-
import { Changeset, EMPTY_SNAPSHOT } from './Changeset';
|
|
4
|
-
import { Transaction } from './Transaction';
|
|
5
|
-
import { Sealant } from '../util/Sealant';
|
|
1
|
+
import { ObservableObject } from './Mvcc.js';
|
|
2
|
+
import { Meta, ObservableValue } from './Data.js';
|
|
3
|
+
import { Changeset, EMPTY_SNAPSHOT } from './Changeset.js';
|
|
4
|
+
import { Transaction } from './Transaction.js';
|
|
5
|
+
import { Sealant } from '../util/Sealant.js';
|
|
6
6
|
export class Journal extends ObservableObject {
|
|
7
7
|
static create() { return new JournalImpl(); }
|
|
8
8
|
}
|
|
@@ -99,7 +99,7 @@ export class JournalImpl extends Journal {
|
|
|
99
99
|
const value = undoing ? vp.formerValue : vp.freshValue;
|
|
100
100
|
const os = ctx.getEditableObjectSnapshot(h, m, value);
|
|
101
101
|
if (os.changeset === ctx) {
|
|
102
|
-
os.data[m] = new
|
|
102
|
+
os.data[m] = new ObservableValue(value);
|
|
103
103
|
const existing = os.former.snapshot.data[m];
|
|
104
104
|
Changeset.markEdited(existing, value, existing !== value, os, m, h);
|
|
105
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Worker } from '../Worker';
|
|
2
|
-
import { ObservableObject } from './Mvcc';
|
|
1
|
+
import { Worker } from '../Worker.js';
|
|
2
|
+
import { ObservableObject } from './Mvcc.js';
|
|
3
3
|
export declare abstract class Monitor extends ObservableObject {
|
|
4
4
|
abstract readonly isActive: boolean;
|
|
5
5
|
abstract readonly counter: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ObservableObject, Mvcc } from './Mvcc';
|
|
2
|
-
import { Transaction } from './Transaction';
|
|
1
|
+
import { ObservableObject, Mvcc } from './Mvcc.js';
|
|
2
|
+
import { Transaction } from './Transaction.js';
|
|
3
3
|
export class Monitor extends ObservableObject {
|
|
4
4
|
static create(hint, activationDelay, deactivationDelay, durationResolution) {
|
|
5
5
|
return MonitorImpl.create(hint, activationDelay, deactivationDelay, durationResolution);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F } from '../util/Utils';
|
|
2
|
-
import { MemberOptions, Kind, Reentrance } from '../Options';
|
|
3
|
-
import { LoggingOptions, ProfilingOptions } from '../Logging';
|
|
4
|
-
import { MemberName, ObjectHandle, SeparationMode } from './Data';
|
|
5
|
-
import { Journal } from './Journal';
|
|
6
|
-
import { Monitor } from './Monitor';
|
|
1
|
+
import { F } from '../util/Utils.js';
|
|
2
|
+
import { MemberOptions, Kind, Reentrance } from '../Options.js';
|
|
3
|
+
import { LoggingOptions, ProfilingOptions } from '../Logging.js';
|
|
4
|
+
import { MemberName, ObjectHandle, SeparationMode } from './Data.js';
|
|
5
|
+
import { Journal } from './Journal.js';
|
|
6
|
+
import { Monitor } from './Monitor.js';
|
|
7
7
|
export declare abstract class MvccObject {
|
|
8
8
|
protected constructor(observable: boolean);
|
|
9
9
|
[Symbol.toStringTag](): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UNDEF } from '../util/Utils';
|
|
2
|
-
import { Log, misuse } from '../util/Dbg';
|
|
3
|
-
import { Kind, Reentrance } from '../Options';
|
|
4
|
-
import { ObjectSnapshot, ObjectHandle,
|
|
5
|
-
import { Changeset, Dump, EMPTY_SNAPSHOT } from './Changeset';
|
|
1
|
+
import { UNDEF } from '../util/Utils.js';
|
|
2
|
+
import { Log, misuse } from '../util/Dbg.js';
|
|
3
|
+
import { Kind, Reentrance } from '../Options.js';
|
|
4
|
+
import { ObjectSnapshot, ObjectHandle, ObservableValue, Meta } from './Data.js';
|
|
5
|
+
import { Changeset, Dump, EMPTY_SNAPSHOT } from './Changeset.js';
|
|
6
6
|
export class MvccObject {
|
|
7
7
|
constructor(observable) {
|
|
8
8
|
const proto = new.target.prototype;
|
|
@@ -72,7 +72,7 @@ export class Mvcc {
|
|
|
72
72
|
const cs = Changeset.current();
|
|
73
73
|
const os = cs.getObjectSnapshot(h, m);
|
|
74
74
|
result = os.data[m];
|
|
75
|
-
if (result instanceof
|
|
75
|
+
if (result instanceof ObservableValue && !result.isOperation) {
|
|
76
76
|
if (this.isObservable)
|
|
77
77
|
Changeset.markUsed(result, os, m, h, Kind.Plain, false);
|
|
78
78
|
result = result.content;
|
|
@@ -92,7 +92,7 @@ export class Mvcc {
|
|
|
92
92
|
if (curr === undefined || curr.content !== value || Mvcc.sensitivity) {
|
|
93
93
|
const existing = curr === null || curr === void 0 ? void 0 : curr.content;
|
|
94
94
|
if (os.former.snapshot.data[m] === curr) {
|
|
95
|
-
curr = os.data[m] = new
|
|
95
|
+
curr = os.data[m] = new ObservableValue(value);
|
|
96
96
|
Changeset.markEdited(existing, value, true, os, m, h);
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
@@ -130,14 +130,14 @@ export class Mvcc {
|
|
|
130
130
|
const result = [];
|
|
131
131
|
for (const m of Object.getOwnPropertyNames(os.data)) {
|
|
132
132
|
const value = os.data[m];
|
|
133
|
-
if (!(value instanceof
|
|
133
|
+
if (!(value instanceof ObservableValue) || !value.isOperation)
|
|
134
134
|
result.push(m);
|
|
135
135
|
}
|
|
136
136
|
return result;
|
|
137
137
|
}
|
|
138
138
|
static decorateData(isObservable, proto, member) {
|
|
139
139
|
if (isObservable) {
|
|
140
|
-
Meta.acquire(proto, Meta.Initial)[member] = new
|
|
140
|
+
Meta.acquire(proto, Meta.Initial)[member] = new ObservableValue(undefined);
|
|
141
141
|
const get = function () {
|
|
142
142
|
const h = Mvcc.acquireHandle(this);
|
|
143
143
|
return Mvcc.observable.get(h, member, this);
|
|
@@ -196,7 +196,7 @@ export class Mvcc {
|
|
|
196
196
|
h = new ObjectHandle(obj, obj, Mvcc.observable, os, obj.constructor.name);
|
|
197
197
|
Meta.set(os.data, Meta.Handle, h);
|
|
198
198
|
Meta.set(obj, Meta.Handle, h);
|
|
199
|
-
Meta.set(os.data, Meta.Revision, new
|
|
199
|
+
Meta.set(os.data, Meta.Revision, new ObservableValue(1));
|
|
200
200
|
}
|
|
201
201
|
return h;
|
|
202
202
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sealant } from '../util/Sealant';
|
|
2
|
-
import { MvccObject } from './Mvcc';
|
|
1
|
+
import { Sealant } from '../util/Sealant.js';
|
|
2
|
+
import { MvccObject } from './Mvcc.js';
|
|
3
3
|
export class MvccArray extends MvccObject {
|
|
4
4
|
constructor(isObservable, array) {
|
|
5
5
|
super(isObservable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collection, Item, CollectionReader } from '../util/Collection';
|
|
2
|
-
import { ObservableObject } from './Mvcc';
|
|
1
|
+
import { Collection, Item, CollectionReader } from '../util/Collection.js';
|
|
2
|
+
import { ObservableObject } from './Mvcc.js';
|
|
3
3
|
export declare abstract class ObservableCollection<T> extends ObservableObject implements CollectionReader<T> {
|
|
4
4
|
protected abstract impl: Collection<T>;
|
|
5
5
|
get isStrict(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sealant } from '../util/Sealant';
|
|
2
|
-
import { MvccObject } from './Mvcc';
|
|
1
|
+
import { Sealant } from '../util/Sealant.js';
|
|
2
|
+
import { MvccObject } from './Mvcc.js';
|
|
3
3
|
export class MvccMap extends MvccObject {
|
|
4
4
|
constructor(isObservable, map) {
|
|
5
5
|
super(isObservable);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F } from '../util/Utils';
|
|
2
|
-
import { MemberOptions } from '../Options';
|
|
3
|
-
import { Controller } from '../Controller';
|
|
4
|
-
import { MemberName, ObjectHandle,
|
|
5
|
-
import { Transaction } from './Transaction';
|
|
6
|
-
import { OptionsImpl } from './Mvcc';
|
|
1
|
+
import { F } from '../util/Utils.js';
|
|
2
|
+
import { MemberOptions } from '../Options.js';
|
|
3
|
+
import { Controller } from '../Controller.js';
|
|
4
|
+
import { MemberName, ObjectHandle, ObservableValue, Observer, Subscription, AbstractChangeset } from './Data.js';
|
|
5
|
+
import { Transaction } from './Transaction.js';
|
|
6
|
+
import { OptionsImpl } from './Mvcc.js';
|
|
7
7
|
export declare class OperationController extends Controller<any> {
|
|
8
8
|
readonly objectHandle: ObjectHandle;
|
|
9
9
|
readonly memberName: MemberName;
|
|
@@ -32,7 +32,7 @@ export declare class OperationController extends Controller<any> {
|
|
|
32
32
|
private run;
|
|
33
33
|
private static markObsolete;
|
|
34
34
|
}
|
|
35
|
-
declare class Operation extends
|
|
35
|
+
declare class Operation extends ObservableValue implements Observer {
|
|
36
36
|
static current?: Operation;
|
|
37
37
|
static queuedReactiveFunctions: Array<Observer>;
|
|
38
38
|
static deferredReactiveFunctions: Array<Operation>;
|
|
@@ -40,7 +40,7 @@ declare class Operation extends Observable implements Observer {
|
|
|
40
40
|
readonly transaction: Transaction;
|
|
41
41
|
readonly controller: OperationController;
|
|
42
42
|
readonly changeset: AbstractChangeset;
|
|
43
|
-
observables: Map<
|
|
43
|
+
observables: Map<ObservableValue, Subscription> | undefined;
|
|
44
44
|
options: OptionsImpl;
|
|
45
45
|
cause: string | undefined;
|
|
46
46
|
args: any[];
|
|
@@ -61,7 +61,7 @@ declare class Operation extends Observable implements Observer {
|
|
|
61
61
|
dependencies(): string[];
|
|
62
62
|
wrap<T>(func: F<T>): F<T>;
|
|
63
63
|
run(proxy: any, args: any[] | undefined): void;
|
|
64
|
-
markObsoleteDueTo(observable:
|
|
64
|
+
markObsoleteDueTo(observable: ObservableValue, m: MemberName, changeset: AbstractChangeset, h: ObjectHandle, outer: string, since: number, reactive: Observer[]): void;
|
|
65
65
|
runIfNotUpToDate(now: boolean, nothrow: boolean): void;
|
|
66
66
|
isNotUpToDate(): boolean;
|
|
67
67
|
reenterOver(head: Operation): this;
|
|
@@ -83,7 +83,7 @@ declare class Operation extends Observable implements Observer {
|
|
|
83
83
|
private static runQueuedReactiveLoop;
|
|
84
84
|
private unsubscribeFromAllObservables;
|
|
85
85
|
private subscribeTo;
|
|
86
|
-
private static
|
|
86
|
+
private static canSubscribeTo;
|
|
87
87
|
private static createOperation;
|
|
88
88
|
private static rememberOperationOptions;
|
|
89
89
|
static init(): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Log, misuse } from '../util/Dbg';
|
|
2
|
-
import { Kind, Reentrance } from '../Options';
|
|
3
|
-
import { Controller } from '../Controller';
|
|
4
|
-
import { ObjectHandle,
|
|
5
|
-
import { Changeset, Dump, EMPTY_SNAPSHOT, MAX_REVISION } from './Changeset';
|
|
6
|
-
import { Transaction } from './Transaction';
|
|
7
|
-
import { MonitorImpl } from './Monitor';
|
|
8
|
-
import { Mvcc, OptionsImpl } from './Mvcc';
|
|
9
|
-
import { JournalImpl } from './Journal';
|
|
1
|
+
import { Log, misuse } from '../util/Dbg.js';
|
|
2
|
+
import { Kind, Reentrance } from '../Options.js';
|
|
3
|
+
import { Controller } from '../Controller.js';
|
|
4
|
+
import { ObjectHandle, ObservableValue, Meta } from './Data.js';
|
|
5
|
+
import { Changeset, Dump, EMPTY_SNAPSHOT, MAX_REVISION } from './Changeset.js';
|
|
6
|
+
import { Transaction } from './Transaction.js';
|
|
7
|
+
import { MonitorImpl } from './Monitor.js';
|
|
8
|
+
import { Mvcc, OptionsImpl } from './Mvcc.js';
|
|
9
|
+
import { JournalImpl } from './Journal.js';
|
|
10
10
|
const BOOT_ARGS = [];
|
|
11
11
|
const BOOT_CAUSE = '<boot>';
|
|
12
12
|
const EMPTY_HANDLE = new ObjectHandle(undefined, undefined, Mvcc.observable, EMPTY_SNAPSHOT, '<boot>');
|
|
@@ -199,7 +199,7 @@ export class OperationController extends Controller {
|
|
|
199
199
|
oc.operation.markObsoleteDueTo(oc.operation, self.memberName, EMPTY_SNAPSHOT.changeset, EMPTY_HANDLE, BOOT_CAUSE, ctx.timestamp, ctx.reactive);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
class Operation extends
|
|
202
|
+
class Operation extends ObservableValue {
|
|
203
203
|
constructor(controller, changeset, former) {
|
|
204
204
|
super(undefined);
|
|
205
205
|
this.margin = Operation.current ? Operation.current.margin + 1 : 1;
|
|
@@ -499,7 +499,7 @@ class Operation extends Observable {
|
|
|
499
499
|
const curr = os.data[m];
|
|
500
500
|
if (reactive) {
|
|
501
501
|
const former = os.former.snapshot.data[m];
|
|
502
|
-
if (former !== undefined && former instanceof
|
|
502
|
+
if (former !== undefined && former instanceof ObservableValue) {
|
|
503
503
|
const why = `T${os.changeset.id}[${os.changeset.hint}]`;
|
|
504
504
|
if (former instanceof Operation) {
|
|
505
505
|
if ((former.obsoleteSince === MAX_REVISION || former.obsoleteSince <= 0)) {
|
|
@@ -530,7 +530,7 @@ class Operation extends Observable {
|
|
|
530
530
|
curr.unsubscribeFromAllObservables();
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
else if (curr instanceof
|
|
533
|
+
else if (curr instanceof ObservableValue && curr.observers) {
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
static enqueueReactiveFunctionsToRun(reactive) {
|
|
@@ -563,7 +563,7 @@ class Operation extends Observable {
|
|
|
563
563
|
}
|
|
564
564
|
subscribeTo(observable, os, m, h, timestamp) {
|
|
565
565
|
var _a, _b, _c;
|
|
566
|
-
const ok = Operation.
|
|
566
|
+
const ok = Operation.canSubscribeTo(observable, os, m, h, timestamp);
|
|
567
567
|
if (ok) {
|
|
568
568
|
let times = 0;
|
|
569
569
|
if (Mvcc.repetitiveUsageWarningThreshold < Number.MAX_SAFE_INTEGER) {
|
|
@@ -588,7 +588,7 @@ class Operation extends Observable {
|
|
|
588
588
|
}
|
|
589
589
|
return ok;
|
|
590
590
|
}
|
|
591
|
-
static
|
|
591
|
+
static canSubscribeTo(observable, os, m, h, timestamp) {
|
|
592
592
|
const observableHead = h.head.data[m];
|
|
593
593
|
let result = observable === observableHead || (!os.changeset.sealed && os.former.snapshot.data[m] === observableHead);
|
|
594
594
|
if (result && timestamp !== -1)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F } from '../util/Utils';
|
|
2
|
-
import { Worker } from '../Worker';
|
|
3
|
-
import { SnapshotOptions } from '../Options';
|
|
4
|
-
import { Changeset } from './Changeset';
|
|
1
|
+
import { F } from '../util/Utils.js';
|
|
2
|
+
import { Worker } from '../Worker.js';
|
|
3
|
+
import { SnapshotOptions } from '../Options.js';
|
|
4
|
+
import { Changeset } from './Changeset.js';
|
|
5
5
|
export declare abstract class Transaction implements Worker {
|
|
6
6
|
static get current(): Transaction;
|
|
7
7
|
abstract readonly id: number;
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { UNDEF, pause } from '../util/Utils';
|
|
11
|
-
import { Log, misuse, error, fatal } from '../util/Dbg';
|
|
12
|
-
import { Changeset, Dump } from './Changeset';
|
|
10
|
+
import { UNDEF, pause } from '../util/Utils.js';
|
|
11
|
+
import { Log, misuse, error, fatal } from '../util/Dbg.js';
|
|
12
|
+
import { Changeset, Dump } from './Changeset.js';
|
|
13
13
|
export class Transaction {
|
|
14
14
|
static get current() { return TransactionImpl.current; }
|
|
15
15
|
whenFinished() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoggingOptions } from '../Logging';
|
|
1
|
+
import { LoggingOptions } from '../Logging.js';
|
|
2
2
|
export declare function error(message: string, dump: Error | undefined): Error;
|
|
3
3
|
export declare function misuse(message: string, dump?: any): Error;
|
|
4
4
|
export declare function fatal(error: Error): Error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactronic",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.105",
|
|
4
4
|
"description": "Reactronic - Transactional Reactive State Management",
|
|
5
5
|
"publisher": "Nezaboodka Software",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/nezaboodka/reactronic/blob/master/README.md#readme",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "
|
|
35
|
-
"@types/react": "18.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "
|
|
37
|
-
"@typescript-eslint/parser": "
|
|
38
|
-
"ava": "
|
|
39
|
-
"c8": "
|
|
40
|
-
"eslint": "8.
|
|
34
|
+
"@types/node": "20.6.3",
|
|
35
|
+
"@types/react": "18.2.22",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "6.7.2",
|
|
37
|
+
"@typescript-eslint/parser": "6.7.2",
|
|
38
|
+
"ava": "5.3.1",
|
|
39
|
+
"c8": "8.0.1",
|
|
40
|
+
"eslint": "8.49.0",
|
|
41
41
|
"react": "18.2.0",
|
|
42
42
|
"ts-node": "10.9.1",
|
|
43
|
-
"typescript": "
|
|
43
|
+
"typescript": "5.2.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "eslint source/**/*.ts test/**/*.ts react/**/*.tsx && tsc",
|
|
47
|
-
"fix": "eslint --fix source/**/*.ts test/**/*.ts react/**/*.tsx",
|
|
48
|
-
"pack": "eslint source/**/*.ts test/**/*.ts react/**/*.tsx && tsc --sourceMap false --removeComments true",
|
|
46
|
+
"build": "eslint source/**/*.ts test/**/*.test.ts react/**/*.tsx && tsc",
|
|
47
|
+
"fix": "eslint --fix source/**/*.ts test/**/*.test.ts react/**/*.tsx",
|
|
48
|
+
"pack": "eslint source/**/*.ts test/**/*.test.ts react/**/*.tsx && tsc --sourceMap false --removeComments true",
|
|
49
49
|
"test": "ava",
|
|
50
50
|
"cover": "c8 ava && open build/coverage/index.html"
|
|
51
51
|
}
|