@dra2020/baseclient 1.0.72 → 1.0.73

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/dist/all/all.d.ts CHANGED
@@ -24,3 +24,5 @@ import * as CSV from '../csv/all';
24
24
  export { CSV };
25
25
  import * as Colors from '../colors/colors';
26
26
  export { Colors };
27
+ import * as DataFlow from '../dataflow/all';
28
+ export { DataFlow };
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
39
  return result;
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", ({ value: true }));
42
- exports.Colors = exports.CSV = exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
42
+ exports.DataFlow = exports.Colors = exports.CSV = exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
43
43
  // Client and Server
44
44
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
45
45
  exports.Util = Util;
@@ -67,6 +67,8 @@ const CSV = __importStar(__webpack_require__(/*! ../csv/all */ "./lib/csv/all.ts
67
67
  exports.CSV = CSV;
68
68
  const Colors = __importStar(__webpack_require__(/*! ../colors/colors */ "./lib/colors/colors.ts"));
69
69
  exports.Colors = Colors;
70
+ const DataFlow = __importStar(__webpack_require__(/*! ../dataflow/all */ "./lib/dataflow/all.ts"));
71
+ exports.DataFlow = DataFlow;
70
72
 
71
73
 
72
74
  /***/ }),
@@ -978,6 +980,117 @@ class ParseOne {
978
980
  exports.ParseOne = ParseOne;
979
981
 
980
982
 
983
+ /***/ }),
984
+
985
+ /***/ "./lib/dataflow/all.ts":
986
+ /*!*****************************!*\
987
+ !*** ./lib/dataflow/all.ts ***!
988
+ \*****************************/
989
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
990
+
991
+
992
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
993
+ if (k2 === undefined) k2 = k;
994
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
995
+ }) : (function(o, m, k, k2) {
996
+ if (k2 === undefined) k2 = k;
997
+ o[k2] = m[k];
998
+ }));
999
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1000
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1001
+ };
1002
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1003
+ __exportStar(__webpack_require__(/*! ./dataflow */ "./lib/dataflow/dataflow.ts"), exports);
1004
+
1005
+
1006
+ /***/ }),
1007
+
1008
+ /***/ "./lib/dataflow/dataflow.ts":
1009
+ /*!**********************************!*\
1010
+ !*** ./lib/dataflow/dataflow.ts ***!
1011
+ \**********************************/
1012
+ /***/ ((__unused_webpack_module, exports) => {
1013
+
1014
+
1015
+ //
1016
+ // DataFlow: mechanism for setting up a data-flow dependency graph that gets computed on demand.
1017
+ //
1018
+ // Semantics are these:
1019
+ // 1. The simplest "atomic" DataFlow object just has an id() and a value(). The id() is used to check for exact
1020
+ // equivalence when determining if any dependents need to be recomputed. id() and value() might be the same
1021
+ // for something that just creates a new whole object when recomputed. In other cases, id() might represent a
1022
+ // hash or changestamp/timestamp that is distinct from the value(). The value may or may not be "ready" as well.
1023
+ // If the value is not "ready", no dependents can be computed.
1024
+ // 2. A DataFlow object can record that it "uses" another DataFlow object. If it does, it can use a set of helper
1025
+ // routines to track the state of its dependents. When its dependents are all ready(), it remembers their ids
1026
+ // and can later test if they are stale.
1027
+ //
1028
+ //
1029
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1030
+ exports.DataFlowNonNull = exports.DataFlow = void 0;
1031
+ class DataFlow {
1032
+ constructor() {
1033
+ this.usesList = {};
1034
+ this.uniquename = 1;
1035
+ }
1036
+ // override in subclass
1037
+ ready() { return this.usesReady(); }
1038
+ id() { return null; }
1039
+ value() { return null; }
1040
+ uses(df, name) {
1041
+ if (!name)
1042
+ name = `_df_${this.uniquename++}`;
1043
+ this.usesList[name] = { name: name, df: df };
1044
+ }
1045
+ find(name) {
1046
+ let ui = this.usesList[name];
1047
+ return ui ? ui.df : undefined;
1048
+ }
1049
+ findValue(name) {
1050
+ let df = this.find(name);
1051
+ return df ? df.value() : undefined;
1052
+ }
1053
+ usesReady() {
1054
+ let isready = true;
1055
+ Object.values(this.usesList).forEach((ui) => { if (!ui.df.ready())
1056
+ isready = false; });
1057
+ return isready;
1058
+ }
1059
+ usesStale() {
1060
+ let isstale = false;
1061
+ Object.values(this.usesList).forEach((ui) => { if (ui.df.id !== ui.df.id())
1062
+ isstale = true; });
1063
+ return isstale;
1064
+ }
1065
+ usesRemember() {
1066
+ Object.values(this.usesList).forEach((ui) => { ui.df.id = ui.df.id(); });
1067
+ }
1068
+ }
1069
+ exports.DataFlow = DataFlow;
1070
+ // Takes callback that, when ready, returns non-null. The return value is both the value and the id.
1071
+ class DataFlowNonNull extends DataFlow {
1072
+ constructor(cb) {
1073
+ super();
1074
+ this._cb = cb;
1075
+ }
1076
+ ready() {
1077
+ // Allow chaining
1078
+ if (!this.usesReady())
1079
+ return false;
1080
+ // Real core semantics, with chaining on stale
1081
+ if (!this._value || this.usesStale()) {
1082
+ this._value = this._cb();
1083
+ if (this._value)
1084
+ this.usesRemember();
1085
+ }
1086
+ return !!this._value;
1087
+ }
1088
+ id() { return this.ready(), this._value; }
1089
+ value() { return this.ready(), this._value; }
1090
+ }
1091
+ exports.DataFlowNonNull = DataFlowNonNull;
1092
+
1093
+
981
1094
  /***/ }),
982
1095
 
983
1096
  /***/ "./lib/emit/all.ts":