reactronic 0.24.123 → 0.24.124

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.
Files changed (41) hide show
  1. package/README.md +5 -5
  2. package/build/dist/source/Logging.d.ts +4 -4
  3. package/build/dist/source/Options.d.ts +6 -6
  4. package/build/dist/source/Worker.d.ts +3 -3
  5. package/build/dist/source/core/Changeset.d.ts +2 -2
  6. package/build/dist/source/core/Changeset.js +33 -33
  7. package/build/dist/source/core/Data.d.ts +11 -11
  8. package/build/dist/source/core/Data.js +3 -3
  9. package/build/dist/source/core/Journal.d.ts +2 -2
  10. package/build/dist/source/core/Journal.js +12 -12
  11. package/build/dist/source/core/Meta.js +7 -7
  12. package/build/dist/source/core/Monitor.d.ts +2 -2
  13. package/build/dist/source/core/Monitor.js +6 -6
  14. package/build/dist/source/core/Mvcc.d.ts +6 -6
  15. package/build/dist/source/core/Mvcc.js +8 -8
  16. package/build/dist/source/core/MvccArray.d.ts +1 -1
  17. package/build/dist/source/core/MvccArray.js +2 -2
  18. package/build/dist/source/core/MvccMap.d.ts +1 -1
  19. package/build/dist/source/core/MvccMap.js +2 -2
  20. package/build/dist/source/core/MvccMergeList.d.ts +2 -2
  21. package/build/dist/source/core/MvccMergeList.js +1 -1
  22. package/build/dist/source/core/Reaction.d.ts +6 -6
  23. package/build/dist/source/core/Reaction.js +59 -59
  24. package/build/dist/source/core/RxNode.d.ts +9 -9
  25. package/build/dist/source/core/RxNode.js +15 -15
  26. package/build/dist/source/core/Transaction.d.ts +4 -4
  27. package/build/dist/source/core/Transaction.js +13 -13
  28. package/build/dist/source/util/Dbg.d.ts +1 -1
  29. package/build/dist/source/util/Dbg.js +11 -11
  30. package/build/dist/source/util/MergeList.d.ts +4 -4
  31. package/build/dist/source/util/MergeList.js +5 -5
  32. package/build/dist/source/util/Sealant.d.ts +4 -4
  33. package/build/dist/source/util/Sealant.js +5 -5
  34. package/build/dist/source/util/SealedArray.d.ts +1 -1
  35. package/build/dist/source/util/SealedArray.js +2 -2
  36. package/build/dist/source/util/SealedMap.d.ts +1 -1
  37. package/build/dist/source/util/SealedMap.js +2 -2
  38. package/build/dist/source/util/SealedSet.d.ts +1 -1
  39. package/build/dist/source/util/SealedSet.js +2 -2
  40. package/build/dist/source/util/Utils.js +14 -14
  41. package/package.json +1 -1
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 interface SnapshotOptions {
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
- interface MemberOptions {
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
- interface Worker {
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
- interface LoggingOptions {
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
- interface ProfilingOptions {
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
@@ -1,4 +1,4 @@
1
- export interface LoggingOptions {
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 interface ProfilingOptions {
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;
@@ -4,14 +4,14 @@ export { LoggingLevel } from './Logging.js';
4
4
  export type { LoggingOptions, ProfilingOptions } from './Logging.js';
5
5
  import { Journal } from './core/Journal.js';
6
6
  import { Monitor } from './core/Monitor.js';
7
- export interface SnapshotOptions {
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 interface MemberOptions {
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 interface AbstractReaction<T> {
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,8 +1,8 @@
1
- export interface Worker {
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): this;
6
+ cancel(error: Error, restartAfter?: Worker | null): void;
7
7
  whenFinished(): Promise<void>;
8
- }
8
+ };
@@ -1,5 +1,5 @@
1
- import { Kind, SnapshotOptions } from '../Options.js';
2
- import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle, ValueSnapshot, Observer } from './Data.js';
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 '../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';
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, '#this#', {
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, '#this#').data;
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 : 'noname'; }
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}]` : ''} (last committed T${h.head.changeset.id}[${h.head.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('', ' ++', `${Dump.obj(h)} - new snapshot is created (revision ${revision})`);
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]['#this#'];
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}]` : ''} (last committed T${h.head.changeset.id}[${h.head.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('╔══', `s${this.revision}`, `${this.hint}`);
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('╠╝', '', `${Dump.snapshot2(h, os.changeset)} is merged with ${Dump.snapshot2(h, h.head.changeset)} among ${merged} properties with ${os.conflicts.size} conflicts.`);
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 !== 'disposal') {
168
+ if (headDisposed || this.options.separation !== "disposal") {
169
169
  if (Log.isOn && Log.opt.change)
170
- Log.write('║╠', '', `${Dump.snapshot2(h, ours.changeset, m)} <> ${Dump.snapshot2(h, head.changeset, m)}`, 0, ' *** CONFLICT ***');
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('║╠', '', `${Dump.snapshot2(h, ours.changeset, m)} ${conflict ? '<>' : '=='} ${Dump.snapshot2(h, head.changeset, m)}`, 0, conflict ? ' *** CONFLICT ***' : undefined);
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('', '', `${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}`}`);
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 ? '╚══' : '═══', `s${this.revision}`, `${this.hint} - ${error ? 'CANCEL' : 'APPLY'}(${this.items.size})${error ? ` - ${error}` : ''}`);
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('', '[G]', `Total object/snapshot count: ${Changeset.totalObjectHandleCount}/${Changeset.totalObjectSnapshotCount}`);
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('', '[G]', `Dismiss history below t${this.id}s${this.revision} (${this.hint})`);
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(' ', ' ', `${Dump.snapshot2(h, os.former.snapshot.changeset)} is ready for GC because overwritten by ${Dump.snapshot2(h, os.changeset)}`);
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: '<boot>' }), undefined, {});
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: 'noname',
353
+ hint: "noname",
354
354
  separation: false,
355
355
  journal: undefined,
356
356
  logging: undefined,
@@ -1,10 +1,10 @@
1
- export { Meta } from './Meta.js';
2
- export interface AbstractChangeset {
1
+ export { Meta } from "./Meta.js";
2
+ export type AbstractChangeset = {
3
3
  readonly id: number;
4
4
  readonly hint: string;
5
5
  readonly timestamp: number;
6
6
  readonly sealed: boolean;
7
- }
7
+ };
8
8
  export declare class ValueSnapshot<T = any> {
9
9
  content: T;
10
10
  observers?: Set<Observer>;
@@ -12,20 +12,20 @@ export declare class ValueSnapshot<T = any> {
12
12
  get originSnapshotId(): number | undefined;
13
13
  constructor(content: T);
14
14
  }
15
- export type SeparationMode = boolean | 'isolated' | 'disposal';
16
- export interface Observer {
15
+ export type SeparationMode = boolean | "isolated" | "disposal";
16
+ export type Observer = {
17
17
  readonly order: number;
18
18
  readonly observables: Map<ValueSnapshot, Subscription> | undefined;
19
19
  readonly obsoleteSince: number;
20
20
  hint(nop?: boolean): string;
21
21
  markObsoleteDueTo(observable: ValueSnapshot, m: MemberName, changeset: AbstractChangeset, h: ObjectHandle, outer: string, since: number, reactive: Array<Observer>): void;
22
22
  relaunchIfNotUpToDate(now: boolean, nothrow: boolean): void;
23
- }
23
+ };
24
24
  export type MemberName = PropertyKey;
25
- export interface Subscription {
25
+ export type Subscription = {
26
26
  readonly memberHint: string;
27
27
  readonly usageCount: number;
28
- }
28
+ };
29
29
  export declare class ObjectSnapshot {
30
30
  readonly changeset: AbstractChangeset;
31
31
  readonly former: {
@@ -52,9 +52,9 @@ export declare class ObjectHandle {
52
52
  static getHint(obj: object, full: boolean): string | undefined;
53
53
  }
54
54
  export type PatchSet = Map<object, Map<MemberName, ValuePatch>>;
55
- export interface ValuePatch {
55
+ export type ValuePatch = {
56
56
  memberName: MemberName;
57
- patchKind: 'update' | 'add' | 'remove';
57
+ patchKind: "update" | "add" | "remove";
58
58
  freshValue: any;
59
59
  formerValue: any;
60
- }
60
+ };
@@ -1,6 +1,6 @@
1
- import { Log } from '../util/Dbg.js';
2
- import { Meta } from './Meta.js';
3
- export { Meta } from './Meta.js';
1
+ import { Log } from "../util/Dbg.js";
2
+ import { Meta } from "./Meta.js";
3
+ export { Meta } from "./Meta.js";
4
4
  export class ValueSnapshot {
5
5
  get isOperation() { return false; }
6
6
  get originSnapshotId() { return 0; }
@@ -1,5 +1,5 @@
1
- import { ObservableObject } from './Mvcc.js';
2
- import { ObjectHandle, ObjectSnapshot, PatchSet } from './Data.js';
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.js';
2
- import { Meta, ValueSnapshot } from './Data.js';
3
- import { Changeset, EMPTY_SNAPSHOT } from './Changeset.js';
4
- import { Transaction } from './Transaction.js';
5
- import { Sealant } from '../util/Sealant.js';
1
+ import { ObservableObject } from "./Mvcc.js";
2
+ import { Meta, ValueSnapshot } 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
  }
@@ -22,7 +22,7 @@ export class JournalImpl extends Journal {
22
22
  get canUndo() { return this._edits.length > 0 && this._position > 0; }
23
23
  get canRedo() { return this._position < this._edits.length; }
24
24
  edited(p) {
25
- Transaction.run({ hint: 'EditJournal.edited', separation: 'isolated' }, () => {
25
+ Transaction.run({ hint: "EditJournal.edited", separation: "isolated" }, () => {
26
26
  const items = this._edits = this._edits.toMutable();
27
27
  if (items.length >= this._capacity)
28
28
  items.shift();
@@ -37,10 +37,10 @@ export class JournalImpl extends Journal {
37
37
  if (this._unsaved === patch)
38
38
  this._unsaved = new Map();
39
39
  else
40
- throw new Error('not implemented');
40
+ throw new Error("not implemented");
41
41
  }
42
42
  undo(count = 1) {
43
- Transaction.run({ hint: 'Journal.undo', separation: 'isolated' }, () => {
43
+ Transaction.run({ hint: "Journal.undo", separation: "isolated" }, () => {
44
44
  let i = this._position - 1;
45
45
  while (i >= 0 && count > 0) {
46
46
  const patch = this._edits[i];
@@ -52,7 +52,7 @@ export class JournalImpl extends Journal {
52
52
  });
53
53
  }
54
54
  redo(count = 1) {
55
- Transaction.run({ hint: 'Journal.redo', separation: 'isolated' }, () => {
55
+ Transaction.run({ hint: "Journal.redo", separation: "isolated" }, () => {
56
56
  let i = this._position;
57
57
  while (i < this._edits.length && count > 0) {
58
58
  const patch = this._edits[i];
@@ -70,7 +70,7 @@ export class JournalImpl extends Journal {
70
70
  const former = os.former.snapshot !== EMPTY_SNAPSHOT ? os.former.snapshot.data : undefined;
71
71
  os.changes.forEach(m => {
72
72
  const vp = {
73
- memberName: m, patchKind: 'update',
73
+ memberName: m, patchKind: "update",
74
74
  freshValue: unseal(os.data[m]), formerValue: undefined,
75
75
  };
76
76
  if (former)
@@ -79,7 +79,7 @@ export class JournalImpl extends Journal {
79
79
  });
80
80
  if (!former) {
81
81
  const vp = {
82
- memberName: Meta.Revision, patchKind: 'remove',
82
+ memberName: Meta.Revision, patchKind: "remove",
83
83
  freshValue: Meta.Undefined, formerValue: undefined,
84
84
  };
85
85
  op.set(Meta.Revision, vp);
@@ -119,7 +119,7 @@ export class JournalImpl extends Journal {
119
119
  let merged = result.get(m);
120
120
  if (!merged)
121
121
  result.set(m, merged = {
122
- memberName: m, patchKind: 'update',
122
+ memberName: m, patchKind: "update",
123
123
  freshValue: undefined, formerValue: undefined,
124
124
  });
125
125
  const value = undoing ? vp.formerValue : vp.freshValue;
@@ -20,10 +20,10 @@ export class Meta {
20
20
  return (_a = proto[sym]) !== null && _a !== void 0 ? _a : EMPTY_META;
21
21
  }
22
22
  }
23
- Meta.Handle = Symbol('rx-handle');
24
- Meta.Revision = Symbol('rx-revision');
25
- Meta.Controller = Symbol('rx-controller');
26
- Meta.Initial = Symbol('rx-initial');
27
- Meta.Reactive = Symbol('rx-reactive');
28
- Meta.Raw = Symbol('rx-raw');
29
- Meta.Undefined = Symbol('rx-undefined');
23
+ Meta.Handle = Symbol("rx-handle");
24
+ Meta.Revision = Symbol("rx-revision");
25
+ Meta.Controller = Symbol("rx-controller");
26
+ Meta.Initial = Symbol("rx-initial");
27
+ Meta.Reactive = Symbol("rx-reactive");
28
+ Meta.Raw = Symbol("rx-raw");
29
+ Meta.Undefined = Symbol("rx-undefined");
@@ -1,5 +1,5 @@
1
- import { Worker } from '../Worker.js';
2
- import { ObservableObject } from './Mvcc.js';
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.js';
2
- import { Transaction } from './Transaction.js';
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);
@@ -34,7 +34,7 @@ export class MonitorImpl extends Monitor {
34
34
  MonitorImpl.deactivate(this, this.internals.deactivationDelay);
35
35
  }
36
36
  static create(hint, activationDelay, deactivationDelay, durationResolution) {
37
- return Transaction.run({ hint: 'Monitor.create' }, MonitorImpl.doCreate, hint, activationDelay, deactivationDelay, durationResolution);
37
+ return Transaction.run({ hint: "Monitor.create" }, MonitorImpl.doCreate, hint, activationDelay, deactivationDelay, durationResolution);
38
38
  }
39
39
  static enter(mon, worker) {
40
40
  mon.enter(worker);
@@ -59,7 +59,7 @@ export class MonitorImpl extends Monitor {
59
59
  }
60
60
  if (delay >= 0) {
61
61
  if (mon.internals.activationTimeout === undefined)
62
- mon.internals.activationTimeout = setTimeout(() => Transaction.run({ hint: 'Monitor.activate', separation: 'isolated' }, MonitorImpl.activate, mon, -1), delay);
62
+ mon.internals.activationTimeout = setTimeout(() => Transaction.run({ hint: "Monitor.activate", separation: "isolated" }, MonitorImpl.activate, mon, -1), delay);
63
63
  }
64
64
  else if (active)
65
65
  mon.isActive = true;
@@ -67,7 +67,7 @@ export class MonitorImpl extends Monitor {
67
67
  static deactivate(mon, delay) {
68
68
  if (delay >= 0) {
69
69
  clearTimeout(mon.internals.deactivationTimeout);
70
- mon.internals.deactivationTimeout = setTimeout(() => Transaction.run({ hint: 'Monitor.deactivate', separation: 'isolated' }, MonitorImpl.deactivate, mon, -1), delay);
70
+ mon.internals.deactivationTimeout = setTimeout(() => Transaction.run({ hint: "Monitor.deactivate", separation: "isolated" }, MonitorImpl.deactivate, mon, -1), delay);
71
71
  }
72
72
  else if (mon.counter <= 0) {
73
73
  mon.isActive = false;
@@ -92,5 +92,5 @@ export class MonitorImpl extends Monitor {
92
92
  }
93
93
  }
94
94
  const MONITOR_TICK_OPTIONS = Object.freeze({
95
- hint: 'Monitor.tick',
95
+ hint: "Monitor.tick",
96
96
  });
@@ -1,9 +1,9 @@
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';
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.js';
2
- import { Log, misuse } from '../util/Dbg.js';
3
- import { Kind, Reentrance } from '../Options.js';
4
- import { ObjectSnapshot, ObjectHandle, ValueSnapshot, Meta } from './Data.js';
5
- import { Changeset, Dump, EMPTY_SNAPSHOT } from './Changeset.js';
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, ValueSnapshot, 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;
@@ -190,7 +190,7 @@ export class Mvcc {
190
190
  let h = obj[Meta.Handle];
191
191
  if (!h) {
192
192
  if (obj !== Object(obj) || Array.isArray(obj))
193
- throw misuse('only objects can be observable');
193
+ throw misuse("only objects can be observable");
194
194
  const initial = Meta.getFrom(Object.getPrototypeOf(obj), Meta.Initial);
195
195
  const os = new ObjectSnapshot(EMPTY_SNAPSHOT.changeset, EMPTY_SNAPSHOT, Object.assign({}, initial));
196
196
  h = new ObjectHandle(obj, obj, Mvcc.observable, os, obj.constructor.name);
@@ -254,10 +254,10 @@ Mvcc.sensitivity = false;
254
254
  Mvcc.transactional = new Mvcc(false);
255
255
  Mvcc.observable = new Mvcc(true);
256
256
  Mvcc.createOperation = function (h, m, options) {
257
- throw misuse('this implementation of createOperation should never be called');
257
+ throw misuse("this implementation of createOperation should never be called");
258
258
  };
259
259
  Mvcc.rememberOperationOptions = function (proto, m, getter, setter, enumerable, configurable, options, implicit) {
260
- throw misuse('this implementation of rememberOperationOptions should never be called');
260
+ throw misuse("this implementation of rememberOperationOptions should never be called");
261
261
  };
262
262
  const EMPTY_PROP_DESCRIPTOR = {
263
263
  configurable: true,
@@ -1,4 +1,4 @@
1
- import { MvccObject } from './Mvcc.js';
1
+ import { MvccObject } from "./Mvcc.js";
2
2
  export declare class MvccArray<T> extends MvccObject {
3
3
  private impl;
4
4
  constructor(isObservable: boolean, array: Array<T>);
@@ -1,5 +1,5 @@
1
- import { Sealant } from '../util/Sealant.js';
2
- import { MvccObject } from './Mvcc.js';
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,4 +1,4 @@
1
- import { MvccObject } from './Mvcc.js';
1
+ import { MvccObject } from "./Mvcc.js";
2
2
  export declare class MvccMap<K, V> extends MvccObject {
3
3
  private impl;
4
4
  constructor(isObservable: boolean, map: Map<K, V>);
@@ -1,5 +1,5 @@
1
- import { Sealant } from '../util/Sealant.js';
2
- import { MvccObject } from './Mvcc.js';
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,5 +1,5 @@
1
- import { MergeList, MergedItem, MergeListReader } from '../util/MergeList.js';
2
- import { ObservableObject } from './Mvcc.js';
1
+ import { MergeList, MergedItem, MergeListReader } from "../util/MergeList.js";
2
+ import { ObservableObject } from "./Mvcc.js";
3
3
  export declare abstract class ObservableMergeList<T> extends ObservableObject implements MergeListReader<T> {
4
4
  protected abstract impl: MergeList<T>;
5
5
  get isStrict(): boolean;
@@ -1,4 +1,4 @@
1
- import { ObservableObject } from './Mvcc.js';
1
+ import { ObservableObject } from "./Mvcc.js";
2
2
  export class ObservableMergeList extends ObservableObject {
3
3
  get isStrict() { return this.impl.isStrict; }
4
4
  get count() { return this.impl.count; }