reactronic 0.92.25007 → 0.92.25008

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.
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { ObservableObject } from "./core/Mvcc.js";
11
- import { atomicAction } from "./ReactiveSystem.js";
11
+ import { atomic } from "./ReactiveSystem.js";
12
12
  export class Clock extends ObservableObject {
13
13
  constructor(interval = 1000) {
14
14
  super();
@@ -40,13 +40,13 @@ export class Clock extends ObservableObject {
40
40
  }
41
41
  }
42
42
  __decorate([
43
- atomicAction,
43
+ atomic,
44
44
  __metadata("design:type", Function),
45
45
  __metadata("design:paramtypes", [Boolean]),
46
46
  __metadata("design:returntype", void 0)
47
47
  ], Clock.prototype, "pause", null);
48
48
  __decorate([
49
- atomicAction,
49
+ atomic,
50
50
  __metadata("design:type", Function),
51
51
  __metadata("design:paramtypes", []),
52
52
  __metadata("design:returntype", void 0)
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { ObservableObject } from "./core/Mvcc.js";
11
- import { reactiveProcess } from "./ReactiveSystem.js";
11
+ import { reactive } from "./ReactiveSystem.js";
12
12
  export class ReactiveProcess extends ObservableObject {
13
13
  constructor(action) {
14
14
  super();
@@ -19,7 +19,7 @@ export class ReactiveProcess extends ObservableObject {
19
19
  }
20
20
  }
21
21
  __decorate([
22
- reactiveProcess,
22
+ reactive,
23
23
  __metadata("design:type", Function),
24
24
  __metadata("design:paramtypes", []),
25
25
  __metadata("design:returntype", Object)
@@ -17,14 +17,14 @@ export declare class ReactiveSystem {
17
17
  static getLoggingHint<T extends object>(obj: T, full?: boolean): string | undefined;
18
18
  static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
19
19
  }
20
- export declare function atomically<T>(func: F<T>, ...args: any[]): T;
21
- export declare function atomically<T>(options: SnapshotOptions, func: F<T>, ...args: any[]): T;
22
- export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
23
- export declare function sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
24
- export declare function contextually<T>(p: Promise<T>): Promise<T>;
20
+ export declare function atomicRun<T>(func: F<T>, ...args: any[]): T;
21
+ export declare function atomicRun<T>(options: SnapshotOptions, func: F<T>, ...args: any[]): T;
22
+ export declare function nonReactiveRun<T>(func: F<T>, ...args: any[]): T;
23
+ export declare function sensitiveRun<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
24
+ export declare function contextualRun<T>(p: Promise<T>): Promise<T>;
25
25
  export declare function unobservable(proto: object, prop: PropertyKey): any;
26
26
  export declare function observable(proto: object, prop: PropertyKey): any;
27
- export declare function atomicAction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
28
- export declare function reactiveProcess(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
29
- export declare function cachedResult(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
27
+ export declare function atomic(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
28
+ export declare function reactive(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
29
+ export declare function cached(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
30
30
  export declare function options(value: Partial<MemberOptions>): F<any>;
@@ -22,7 +22,7 @@ export class ReactiveSystem {
22
22
  static getLoggingHint(obj, full = false) { return ObjectHandle.getHint(obj, full); }
23
23
  static setProfilingMode(isOn, options) { Mvcc.setProfilingMode(isOn, options); }
24
24
  }
25
- export function atomically(p1, p2, p3) {
25
+ export function atomicRun(p1, p2, p3) {
26
26
  if (p1 instanceof Function) {
27
27
  if (p2 !== undefined)
28
28
  return Transaction.run(null, p1, ...p2);
@@ -36,13 +36,13 @@ export function atomically(p1, p2, p3) {
36
36
  return Transaction.run(p1, p2);
37
37
  }
38
38
  }
39
- export function nonreactive(func, ...args) {
39
+ export function nonReactiveRun(func, ...args) {
40
40
  return OperationImpl.proceedWithinGivenLaunch(undefined, func, ...args);
41
41
  }
42
- export function sensitive(sensitivity, func, ...args) {
42
+ export function sensitiveRun(sensitivity, func, ...args) {
43
43
  return Mvcc.sensitive(sensitivity, func, ...args);
44
44
  }
45
- export function contextually(p) {
45
+ export function contextualRun(p) {
46
46
  throw new Error("not implemented yet");
47
47
  }
48
48
  export function unobservable(proto, prop) {
@@ -51,28 +51,28 @@ export function unobservable(proto, prop) {
51
51
  export function observable(proto, prop) {
52
52
  return Mvcc.decorateData(true, proto, prop);
53
53
  }
54
- export function atomicAction(proto, prop, pd) {
54
+ export function atomic(proto, prop, pd) {
55
55
  const opts = {
56
56
  kind: Kind.atomicAction,
57
57
  isolation: Isolation.joinToCurrentTransaction,
58
58
  };
59
- return Mvcc.decorateOperation(true, atomicAction, opts, proto, prop, pd);
59
+ return Mvcc.decorateOperation(true, atomic, opts, proto, prop, pd);
60
60
  }
61
- export function reactiveProcess(proto, prop, pd) {
61
+ export function reactive(proto, prop, pd) {
62
62
  const opts = {
63
63
  kind: Kind.reactiveProcess,
64
64
  isolation: Isolation.joinAsNestedTransaction,
65
65
  throttling: -1,
66
66
  };
67
- return Mvcc.decorateOperation(true, reactiveProcess, opts, proto, prop, pd);
67
+ return Mvcc.decorateOperation(true, reactive, opts, proto, prop, pd);
68
68
  }
69
- export function cachedResult(proto, prop, pd) {
69
+ export function cached(proto, prop, pd) {
70
70
  const opts = {
71
71
  kind: Kind.cachedResult,
72
72
  isolation: Isolation.joinToCurrentTransaction,
73
73
  noSideEffects: true,
74
74
  };
75
- return Mvcc.decorateOperation(true, cachedResult, opts, proto, prop, pd);
75
+ return Mvcc.decorateOperation(true, cached, opts, proto, prop, pd);
76
76
  }
77
77
  export function options(value) {
78
78
  return Mvcc.decorateOperationParametrized(options, value);
@@ -1,4 +1,4 @@
1
- import { atomically, nonreactive } from "./ReactiveSystem.js";
1
+ import { atomicRun, nonReactiveRun } from "./ReactiveSystem.js";
2
2
  export function refs(owner) {
3
3
  return new Proxy(owner, RefGettingProxy);
4
4
  }
@@ -28,7 +28,7 @@ export class Ref {
28
28
  this.owner[this.name][this.index] = value;
29
29
  }
30
30
  unobs() {
31
- return nonreactive(() => this.variable);
31
+ return nonReactiveRun(() => this.variable);
32
32
  }
33
33
  observe() {
34
34
  return this.variable;
@@ -52,7 +52,7 @@ export class ToggleRef extends Ref {
52
52
  toggle() {
53
53
  const o = this.owner;
54
54
  const p = this.name;
55
- atomically({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
55
+ atomicRun({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
56
56
  const v = o[p];
57
57
  const isOn = v === this.valueOn || (v instanceof Ref && this.valueOn instanceof Ref &&
58
58
  Ref.sameRefs(v, this.valueOn));
@@ -16,8 +16,8 @@ export { Changeset } from "./core/Changeset.js";
16
16
  export { Transaction } from "./core/Transaction.js";
17
17
  export { Indicator } from "./core/Indicator.js";
18
18
  export { Journal } from "./core/Journal.js";
19
- export { atomically, nonreactive, sensitive, contextually } from "./ReactiveSystem.js";
20
- export { ReactiveSystem, observable, unobservable, atomicAction, reactiveProcess, cachedResult, options } from "./ReactiveSystem.js";
19
+ export { atomicRun, nonReactiveRun, sensitiveRun, contextualRun } from "./ReactiveSystem.js";
20
+ export { ReactiveSystem, observable, unobservable, atomic, reactive, cached, options } from "./ReactiveSystem.js";
21
21
  export { ReactiveProcess } from "./Reaction.js";
22
22
  export { ReactiveNode, Mode, Priority, BaseDriver, ReactiveNodeVariable } from "./core/ReactiveNode.js";
23
23
  export type { Script, ScriptAsync, Handler, ReactiveNodeDecl, ReactiveNodeDriver, ReactiveNodeContext } from "./core/ReactiveNode.js";
@@ -12,8 +12,8 @@ export { Changeset } from "./core/Changeset.js";
12
12
  export { Transaction } from "./core/Transaction.js";
13
13
  export { Indicator } from "./core/Indicator.js";
14
14
  export { Journal } from "./core/Journal.js";
15
- export { atomically, nonreactive, sensitive, contextually } from "./ReactiveSystem.js";
16
- export { ReactiveSystem, observable, unobservable, atomicAction, reactiveProcess, cachedResult, options } from "./ReactiveSystem.js";
15
+ export { atomicRun, nonReactiveRun, sensitiveRun, contextualRun } from "./ReactiveSystem.js";
16
+ export { ReactiveSystem, observable, unobservable, atomic, reactive, cached, options } from "./ReactiveSystem.js";
17
17
  export { ReactiveProcess } from "./Reaction.js";
18
18
  export { ReactiveNode, Mode, Priority, BaseDriver, ReactiveNodeVariable } from "./core/ReactiveNode.js";
19
19
  export { Clock } from "./Clock.js";
@@ -22,7 +22,7 @@ import { emitLetters, getCallerInfo, proceedSyncOrAsync } from "../util/Utils.js
22
22
  import { Isolation, Reentrance } from "../Options.js";
23
23
  import { ObservableObject } from "../core/Mvcc.js";
24
24
  import { Transaction } from "../core/Transaction.js";
25
- import { ReactiveSystem, options, unobservable, reactiveProcess, atomically, nonreactive } from "../ReactiveSystem.js";
25
+ import { ReactiveSystem, options, unobservable, reactive, atomicRun, nonReactiveRun } from "../ReactiveSystem.js";
26
26
  export var Mode;
27
27
  (function (Mode) {
28
28
  Mode[Mode["default"] = 0] = "default";
@@ -333,13 +333,13 @@ class ReactiveNodeImpl extends ReactiveNode {
333
333
  static setNodeVariableValue(variable, value) {
334
334
  const node = ReactiveNodeImpl.ownSlot.instance;
335
335
  const owner = node.owner;
336
- const hostCtx = nonreactive(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
336
+ const hostCtx = nonReactiveRun(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
337
337
  if (value && value !== hostCtx) {
338
338
  if (hostCtx)
339
339
  node.outer = owner;
340
340
  else
341
341
  node.outer = owner.outer;
342
- atomically({ isolation: Isolation.joinAsNestedTransaction }, () => {
342
+ atomicRun({ isolation: Isolation.joinAsNestedTransaction }, () => {
343
343
  const ctx = node.context;
344
344
  if (ctx) {
345
345
  ctx.variable = variable;
@@ -359,7 +359,7 @@ ReactiveNodeImpl.logging = undefined;
359
359
  ReactiveNodeImpl.grandNodeCount = 0;
360
360
  ReactiveNodeImpl.disposableNodeCount = 0;
361
361
  __decorate([
362
- reactiveProcess,
362
+ reactive,
363
363
  options({
364
364
  reentrance: Reentrance.cancelAndWaitPrevious,
365
365
  allowObsoleteToFinish: true,
@@ -484,7 +484,7 @@ function triggerUpdateViaSlot(slot) {
484
484
  });
485
485
  });
486
486
  }
487
- nonreactive(node.update, node.declaration.triggers);
487
+ nonReactiveRun(node.update, node.declaration.triggers);
488
488
  }
489
489
  else
490
490
  updateNow(slot);
@@ -493,7 +493,7 @@ function triggerUpdateViaSlot(slot) {
493
493
  function mountOrRemountIfNecessary(node) {
494
494
  const driver = node.driver;
495
495
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
496
- nonreactive(() => {
496
+ nonReactiveRun(() => {
497
497
  node.stamp = Number.MAX_SAFE_INTEGER - 1;
498
498
  driver.runPreparation(node);
499
499
  if (!node.has(Mode.manualMount)) {
@@ -504,7 +504,7 @@ function mountOrRemountIfNecessary(node) {
504
504
  });
505
505
  }
506
506
  else if (node.isMoved && !node.has(Mode.manualMount) && node.host !== node)
507
- nonreactive(() => driver.runMount(node));
507
+ nonReactiveRun(() => driver.runMount(node));
508
508
  }
509
509
  function updateNow(slot) {
510
510
  const node = slot.instance;
@@ -537,7 +537,7 @@ function triggerFinalization(slot, isLeader, individual) {
537
537
  if (individual && node.key !== node.declaration.key && !driver.isPartition)
538
538
  console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
539
539
  node.stamp = ~node.stamp;
540
- const childrenAreLeaders = nonreactive(() => driver.runFinalization(node, isLeader));
540
+ const childrenAreLeaders = nonReactiveRun(() => driver.runFinalization(node, isLeader));
541
541
  if (node.has(Mode.autonomous)) {
542
542
  slot.aux = undefined;
543
543
  const last = gLastToDispose;
@@ -546,7 +546,7 @@ function triggerFinalization(slot, isLeader, individual) {
546
546
  else
547
547
  gFirstToDispose = gLastToDispose = slot;
548
548
  if (gFirstToDispose === slot)
549
- atomically({ isolation: Isolation.disjoinForInternalDisposal, hint: `runDisposalLoop(initiator=${slot.instance.key})` }, () => {
549
+ atomicRun({ isolation: Isolation.disjoinForInternalDisposal, hint: `runDisposalLoop(initiator=${slot.instance.key})` }, () => {
550
550
  void runDisposalLoop().then(NOP, error => console.log(error));
551
551
  });
552
552
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.92.25007",
3
+ "version": "0.92.25008",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",