@dra2020/baseclient 1.0.76 → 1.0.79
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 +1 -0
- package/dist/baseclient.js +28 -14
- package/dist/baseclient.js.map +1 -1
- package/dist/dataflow/dataflow.d.ts +18 -9
- package/docs/dataflow.md +167 -0
- package/lib/dataflow/dataflow.ts +40 -18
- package/lib/poly/polypack.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ These libraries are used across both client and server:
|
|
|
19
19
|
- [Poly](./docs/poly.md): A set of functions for processing polygons, typically in GeoJSON format.
|
|
20
20
|
- [Context](./docs/context.md): A set of functions for interrogating the context supplied to the application, either as
|
|
21
21
|
- [FSM](./docs/fsm.md): A set of functions for managing asynchronous, chainable finite state machines.
|
|
22
|
+
- [DataFlow](./docs/dataflow.md): A set of classes for managing synchronous, chainable dataflow.
|
|
22
23
|
- [LogAbstract](./docs/logabstract.md): An abstract logging interface. Different implementations are used on client and server.
|
|
23
24
|
- [LogClient](./docs/logclient.md): A client implementation of the logging abstract interface.
|
|
24
25
|
- [OT](./docs/ot-js.md): An Operational Transformation implementation, used as the basis for all content editing.
|
package/dist/baseclient.js
CHANGED
|
@@ -1024,40 +1024,41 @@ __exportStar(__webpack_require__(/*! ./dataflow */ "./lib/dataflow/dataflow.ts")
|
|
|
1024
1024
|
//
|
|
1025
1025
|
//
|
|
1026
1026
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1027
|
-
exports.DataFlowCallback = exports.DataFlow = void 0;
|
|
1027
|
+
exports.DataFlowStamp = exports.DataFlowCallback = exports.DataFlow = void 0;
|
|
1028
1028
|
class DataFlow {
|
|
1029
1029
|
constructor() {
|
|
1030
1030
|
this.usesList = [];
|
|
1031
1031
|
}
|
|
1032
1032
|
// override in subclass
|
|
1033
|
-
|
|
1033
|
+
dfid() { return null; }
|
|
1034
|
+
// override in subclass
|
|
1035
|
+
compute() {
|
|
1036
|
+
}
|
|
1034
1037
|
uses(df, name) {
|
|
1035
1038
|
this.usesList.push({ name: name, df: df });
|
|
1036
1039
|
}
|
|
1037
|
-
|
|
1040
|
+
stale() {
|
|
1038
1041
|
let isstale = false;
|
|
1039
1042
|
this.usesList.forEach(ui => {
|
|
1040
|
-
ui.
|
|
1041
|
-
if (ui.
|
|
1043
|
+
ui.wasfresh = ui.id !== ui.df.dfid();
|
|
1044
|
+
if (ui.wasfresh)
|
|
1042
1045
|
isstale = true;
|
|
1043
1046
|
});
|
|
1044
1047
|
return isstale;
|
|
1045
1048
|
}
|
|
1046
|
-
|
|
1049
|
+
wasFresh(name) {
|
|
1047
1050
|
let ui = this.usesList.find((ui) => ui.name === name);
|
|
1048
|
-
return ui != null && ui.
|
|
1051
|
+
return ui != null && ui.wasfresh;
|
|
1049
1052
|
}
|
|
1050
|
-
|
|
1051
|
-
this.usesList.forEach(ui => { ui.id = ui.df.
|
|
1053
|
+
remember() {
|
|
1054
|
+
this.usesList.forEach(ui => { ui.id = ui.df.dfid(); });
|
|
1052
1055
|
}
|
|
1053
1056
|
ifcompute() {
|
|
1054
|
-
if (this.
|
|
1055
|
-
this.
|
|
1057
|
+
if (this.stale()) {
|
|
1058
|
+
this.remember();
|
|
1056
1059
|
this.compute();
|
|
1057
1060
|
}
|
|
1058
1061
|
}
|
|
1059
|
-
compute() {
|
|
1060
|
-
}
|
|
1061
1062
|
}
|
|
1062
1063
|
exports.DataFlow = DataFlow;
|
|
1063
1064
|
// Takes callback that, eventually, returns non-null. The return value is both the value and the id.
|
|
@@ -1067,10 +1068,20 @@ class DataFlowCallback extends DataFlow {
|
|
|
1067
1068
|
super();
|
|
1068
1069
|
this._cb = cb;
|
|
1069
1070
|
}
|
|
1070
|
-
|
|
1071
|
+
dfid() { if (!this._value)
|
|
1071
1072
|
this._value = this._cb(); return this._value; }
|
|
1072
1073
|
}
|
|
1073
1074
|
exports.DataFlowCallback = DataFlowCallback;
|
|
1075
|
+
// Simple helper that maintains a simple monotonically increasing stamp
|
|
1076
|
+
class DataFlowStamp extends DataFlow {
|
|
1077
|
+
constructor() {
|
|
1078
|
+
super();
|
|
1079
|
+
this._stamp = 0;
|
|
1080
|
+
}
|
|
1081
|
+
dfid() { return this._stamp; }
|
|
1082
|
+
stamp() { this._stamp++; }
|
|
1083
|
+
}
|
|
1084
|
+
exports.DataFlowStamp = DataFlowStamp;
|
|
1074
1085
|
|
|
1075
1086
|
|
|
1076
1087
|
/***/ }),
|
|
@@ -8430,6 +8441,9 @@ function polyPack(coords, prepack) {
|
|
|
8430
8441
|
// Null feature?
|
|
8431
8442
|
if (coords == null || (coords.length !== undefined && coords.length == 0))
|
|
8432
8443
|
return null;
|
|
8444
|
+
// Null geometry?
|
|
8445
|
+
if (coords && coords.type === 'Feature' && coords.geometry == null)
|
|
8446
|
+
return null;
|
|
8433
8447
|
// Actually already a PolyPack?
|
|
8434
8448
|
if (coords.offset !== undefined)
|
|
8435
8449
|
return coords;
|