reactronic 0.21.513 → 0.21.514

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 CHANGED
@@ -240,7 +240,7 @@ to a new one.
240
240
 
241
241
  There are multiple options to configure behavior of transactional reactivity.
242
242
 
243
- **Priority** options defines order of reactions execution:
243
+ **Order** options defines order of reactions execution:
244
244
 
245
245
  - (TBD)
246
246
 
@@ -302,7 +302,7 @@ function reaction(proto, prop, pd) // method only
302
302
  function cached(proto, prop, pd) // method only
303
303
 
304
304
  function noSideEffects(value: boolean) // transaction & cached & reaction
305
- function observableArgs(value: boolean) // cached & reaction
305
+ function sensitiveArgs(value: boolean) // cached & reaction
306
306
  function throttling(milliseconds: number) // reaction only
307
307
  function reentrance(value: Reentrance) // transaction & reaction
308
308
  function monitor(value: Monitor | null)
@@ -11,7 +11,7 @@ export interface SnapshotOptions {
11
11
  }
12
12
  export interface MemberOptions {
13
13
  readonly kind: Kind;
14
- readonly priority: number;
14
+ readonly order: number;
15
15
  readonly noSideEffects: boolean;
16
16
  readonly sensitiveArgs: boolean;
17
17
  readonly throttling: number;
@@ -1,8 +1,6 @@
1
1
  import { F } from './util/Utils';
2
2
  import { Controller } from './Controller';
3
- import { Reentrance, MemberOptions, TraceOptions, ProfilingOptions, Sensitivity } from './Options';
4
- import { TransactionJournal } from './impl/TransactionJournal';
5
- import { Monitor } from './impl/Monitor';
3
+ import { MemberOptions, TraceOptions, ProfilingOptions, Sensitivity } from './Options';
6
4
  export declare class Reactronic {
7
5
  static why(brief?: boolean): string;
8
6
  static getController<T>(method: F<T>): Controller<T>;
@@ -26,11 +24,4 @@ export declare function unobservable(proto: object, prop: PropertyKey): any;
26
24
  export declare function transaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
27
25
  export declare function reaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
28
26
  export declare function cached(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
29
- export declare function priority(value: number): F<any>;
30
- export declare function noSideEffects(value: boolean): F<any>;
31
- export declare function observableArgs(value: boolean): F<any>;
32
- export declare function throttling(milliseconds: number): F<any>;
33
- export declare function reentrance(value: Reentrance): F<any>;
34
- export declare function journal(value: TransactionJournal | undefined): F<any>;
35
- export declare function monitor(value: Monitor | null): F<any>;
36
- export declare function trace(value: Partial<TraceOptions>): F<any>;
27
+ export declare function options(value: Partial<MemberOptions>): F<any>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trace = exports.monitor = exports.journal = exports.reentrance = exports.throttling = exports.observableArgs = exports.noSideEffects = exports.priority = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Reactronic = void 0;
3
+ exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Reactronic = void 0;
4
4
  const Dbg_1 = require("./util/Dbg");
5
5
  const Options_1 = require("./Options");
6
6
  const Data_1 = require("./impl/Data");
@@ -56,35 +56,7 @@ function cached(proto, prop, pd) {
56
56
  return Hooks_1.Hooks.decorateOperation(true, cached, opts, proto, prop, pd);
57
57
  }
58
58
  exports.cached = cached;
59
- function priority(value) {
60
- return Hooks_1.Hooks.decorateOperationParametrized(priority, { priority: value });
59
+ function options(value) {
60
+ return Hooks_1.Hooks.decorateOperationParametrized(options, value);
61
61
  }
62
- exports.priority = priority;
63
- function noSideEffects(value) {
64
- return Hooks_1.Hooks.decorateOperationParametrized(noSideEffects, { noSideEffects: value });
65
- }
66
- exports.noSideEffects = noSideEffects;
67
- function observableArgs(value) {
68
- return Hooks_1.Hooks.decorateOperationParametrized(observableArgs, { sensitiveArgs: value });
69
- }
70
- exports.observableArgs = observableArgs;
71
- function throttling(milliseconds) {
72
- return Hooks_1.Hooks.decorateOperationParametrized(throttling, { throttling: milliseconds });
73
- }
74
- exports.throttling = throttling;
75
- function reentrance(value) {
76
- return Hooks_1.Hooks.decorateOperationParametrized(reentrance, { reentrance: value });
77
- }
78
- exports.reentrance = reentrance;
79
- function journal(value) {
80
- return Hooks_1.Hooks.decorateOperationParametrized(journal, { journal: value });
81
- }
82
- exports.journal = journal;
83
- function monitor(value) {
84
- return Hooks_1.Hooks.decorateOperationParametrized(monitor, { monitor: value });
85
- }
86
- exports.monitor = monitor;
87
- function trace(value) {
88
- return Hooks_1.Hooks.decorateOperationParametrized(trace, { trace: value });
89
- }
90
- exports.trace = trace;
62
+ exports.options = options;
@@ -11,4 +11,4 @@ export { Snapshot } from './impl/Snapshot';
11
11
  export { Transaction } from './impl/Transaction';
12
12
  export { Monitor } from './impl/Monitor';
13
13
  export { TransactionJournal } from './impl/TransactionJournal';
14
- export { Reactronic, nonreactive, standalone, sensitive, unobservable, transaction, reaction, cached, priority, noSideEffects, observableArgs, throttling, reentrance, journal, monitor, trace } from './Reactronic';
14
+ export { Reactronic, nonreactive, standalone, sensitive, unobservable, transaction, reaction, cached, options } from './Reactronic';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trace = exports.monitor = exports.journal = exports.reentrance = exports.throttling = exports.observableArgs = exports.noSideEffects = exports.priority = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Reactronic = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.TraceLevel = exports.Sensitivity = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.sleep = exports.all = void 0;
3
+ exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.standalone = exports.nonreactive = exports.Reactronic = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.TraceLevel = exports.Sensitivity = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.sleep = exports.all = void 0;
4
4
  var Utils_1 = require("./util/Utils");
5
5
  Object.defineProperty(exports, "all", { enumerable: true, get: function () { return Utils_1.all; } });
6
6
  Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return Utils_1.sleep; } });
@@ -39,11 +39,4 @@ Object.defineProperty(exports, "unobservable", { enumerable: true, get: function
39
39
  Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return Reactronic_1.transaction; } });
40
40
  Object.defineProperty(exports, "reaction", { enumerable: true, get: function () { return Reactronic_1.reaction; } });
41
41
  Object.defineProperty(exports, "cached", { enumerable: true, get: function () { return Reactronic_1.cached; } });
42
- Object.defineProperty(exports, "priority", { enumerable: true, get: function () { return Reactronic_1.priority; } });
43
- Object.defineProperty(exports, "noSideEffects", { enumerable: true, get: function () { return Reactronic_1.noSideEffects; } });
44
- Object.defineProperty(exports, "observableArgs", { enumerable: true, get: function () { return Reactronic_1.observableArgs; } });
45
- Object.defineProperty(exports, "throttling", { enumerable: true, get: function () { return Reactronic_1.throttling; } });
46
- Object.defineProperty(exports, "reentrance", { enumerable: true, get: function () { return Reactronic_1.reentrance; } });
47
- Object.defineProperty(exports, "journal", { enumerable: true, get: function () { return Reactronic_1.journal; } });
48
- Object.defineProperty(exports, "monitor", { enumerable: true, get: function () { return Reactronic_1.monitor; } });
49
- Object.defineProperty(exports, "trace", { enumerable: true, get: function () { return Reactronic_1.trace; } });
42
+ Object.defineProperty(exports, "options", { enumerable: true, get: function () { return Reactronic_1.options; } });
@@ -12,7 +12,7 @@ export declare class Observable {
12
12
  constructor(value: any);
13
13
  }
14
14
  export interface Observer {
15
- readonly priority: number;
15
+ readonly order: number;
16
16
  readonly observables: Map<Observable, MemberInfo> | undefined;
17
17
  readonly obsoleteSince: number;
18
18
  hint(nop?: boolean): string;
@@ -12,7 +12,7 @@ export declare class OptionsImpl implements MemberOptions {
12
12
  readonly getter: Function;
13
13
  readonly setter: Function;
14
14
  readonly kind: Kind;
15
- readonly priority: number;
15
+ readonly order: number;
16
16
  readonly noSideEffects: boolean;
17
17
  readonly sensitiveArgs: boolean;
18
18
  readonly throttling: number;
@@ -26,7 +26,7 @@ class ObservableObject {
26
26
  exports.ObservableObject = ObservableObject;
27
27
  const DEFAULT_OPTIONS = Object.freeze({
28
28
  kind: Options_1.Kind.Plain,
29
- priority: 0,
29
+ order: 0,
30
30
  noSideEffects: false,
31
31
  sensitiveArgs: false,
32
32
  throttling: Number.MAX_SAFE_INTEGER,
@@ -40,7 +40,7 @@ class OptionsImpl {
40
40
  this.getter = getter !== undefined ? getter : existing.getter;
41
41
  this.setter = setter !== undefined ? setter : existing.setter;
42
42
  this.kind = merge(DEFAULT_OPTIONS.kind, existing.kind, patch.kind, implicit);
43
- this.priority = merge(DEFAULT_OPTIONS.priority, existing.priority, patch.priority, implicit);
43
+ this.order = merge(DEFAULT_OPTIONS.order, existing.order, patch.order, implicit);
44
44
  this.noSideEffects = merge(DEFAULT_OPTIONS.noSideEffects, existing.noSideEffects, patch.noSideEffects, implicit);
45
45
  this.sensitiveArgs = merge(DEFAULT_OPTIONS.sensitiveArgs, existing.sensitiveArgs, patch.sensitiveArgs, implicit);
46
46
  this.throttling = merge(DEFAULT_OPTIONS.throttling, existing.throttling, patch.throttling, implicit);
@@ -52,7 +52,7 @@ declare class Operation extends Observable implements Observer {
52
52
  constructor(controller: OperationController, revision: ObjectRevision, prev: Operation | OptionsImpl);
53
53
  get isOperation(): boolean;
54
54
  hint(): string;
55
- get priority(): number;
55
+ get order(): number;
56
56
  why(): string;
57
57
  briefWhy(): string;
58
58
  dependencies(): string[];
@@ -209,7 +209,7 @@ class Operation extends Data_1.Observable {
209
209
  }
210
210
  get isOperation() { return true; }
211
211
  hint() { return `${Snapshot_1.Dump.rev(this.revision, this.controller.memberName)}`; }
212
- get priority() { return this.options.priority; }
212
+ get order() { return this.options.order; }
213
213
  why() {
214
214
  let ms = Date.now();
215
215
  const prev = this.revision.prev.revision.data[this.controller.memberName];
@@ -264,8 +264,8 @@ class Operation extends Data_1.Observable {
264
264
  const isReaction = this.options.kind === Options_1.Kind.Reaction;
265
265
  if (Dbg_1.Dbg.isOn && (Dbg_1.Dbg.trace.obsolete || ((_a = this.options.trace) === null || _a === void 0 ? void 0 : _a.obsolete)))
266
266
  Dbg_1.Dbg.log(Dbg_1.Dbg.trace.transaction && !Snapshot_1.Snapshot.current().sealed ? '║' : ' ', isReaction ? '█' : '▒', isReaction && cause.revision === Snapshot_1.ROOT_REV
267
- ? `${this.hint()} is a reaction and will run automatically (priority ${this.options.priority})`
268
- : `${this.hint()} is obsolete due to ${Snapshot_1.Dump.rev(cause.revision, cause.memberName)} since v${since}${isReaction ? ` and will run automatically (priority ${this.options.priority})` : ''}`);
267
+ ? `${this.hint()} is a reaction and will run automatically (order ${this.options.order})`
268
+ : `${this.hint()} is obsolete due to ${Snapshot_1.Dump.rev(cause.revision, cause.memberName)} since v${since}${isReaction ? ` and will run automatically (order ${this.options.order})` : ''}`);
269
269
  if (isReaction)
270
270
  reactions.push(this);
271
271
  else
@@ -462,7 +462,7 @@ class Operation extends Data_1.Observable {
462
462
  for (const m in r.prev.revision.data)
463
463
  Operation.propagateMemberChangeThroughSubscriptions(true, since, r, m, h, reactions);
464
464
  });
465
- reactions.sort(compareReactionsByPriority);
465
+ reactions.sort(compareReactionsByOrder);
466
466
  (_a = snapshot.options.journal) === null || _a === void 0 ? void 0 : _a.remember(TransactionJournal_1.TransactionJournalImpl.createPatch(snapshot.hint, snapshot.changeset));
467
467
  }
468
468
  static revokeAllSubscriptions(snapshot) {
@@ -661,8 +661,8 @@ function reactronicHookedThen(resolve, reject) {
661
661
  }
662
662
  return ORIGINAL_PROMISE_THEN.call(this, resolve, reject);
663
663
  }
664
- function compareReactionsByPriority(a, b) {
665
- return a.priority - b.priority;
664
+ function compareReactionsByOrder(a, b) {
665
+ return a.order - b.order;
666
666
  }
667
667
  function resolveReturn(value) {
668
668
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.21.513",
3
+ "version": "0.21.514",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "main": "build/dist/source/api.js",
6
6
  "types": "build/dist/source/api.d.ts",