dbm 1.0.0

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 (90) hide show
  1. package/commands/CallFunction.js +21 -0
  2. package/commands/CommandBaseObject.js +11 -0
  3. package/commands/ResolvePromise.js +20 -0
  4. package/commands/index.js +36 -0
  5. package/core/BaseObject.js +23 -0
  6. package/core/GlobalObject.js +18 -0
  7. package/core/LifeCycleObject.js +25 -0
  8. package/core/index.js +3 -0
  9. package/dbm.js +71 -0
  10. package/flow/DirtyCommands.js +45 -0
  11. package/flow/FlowBaseObject.js +78 -0
  12. package/flow/FlowProperty.js +146 -0
  13. package/flow/FlowUpdateFunction.js +39 -0
  14. package/flow/UpdateFunctionInputs.js +58 -0
  15. package/flow/UpdateFunctionOutputs.js +51 -0
  16. package/flow/index.js +40 -0
  17. package/flow/updatefunctions/basic/CombineString.js +45 -0
  18. package/flow/updatefunctions/basic/RunCommand.js +34 -0
  19. package/flow/updatefunctions/basic/index.js +2 -0
  20. package/flow/updatefunctions/debug/Log.js +30 -0
  21. package/flow/updatefunctions/debug/index.js +1 -0
  22. package/flow/updatefunctions/dom/ElementSize.js +47 -0
  23. package/flow/updatefunctions/dom/StyleObject.js +43 -0
  24. package/flow/updatefunctions/dom/index.js +2 -0
  25. package/flow/updatefunctions/index.js +5 -0
  26. package/flow/updatefunctions/logic/Addition.js +19 -0
  27. package/flow/updatefunctions/logic/Multiplication.js +19 -0
  28. package/flow/updatefunctions/logic/RangeSwitch.js +46 -0
  29. package/flow/updatefunctions/logic/Subtraction.js +19 -0
  30. package/flow/updatefunctions/logic/index.js +38 -0
  31. package/flow/updatefunctions/react/UpdateState.js +22 -0
  32. package/flow/updatefunctions/react/index.js +1 -0
  33. package/graphapi/index.js +1 -0
  34. package/graphapi/webclient/WebSocketConnection.js +236 -0
  35. package/graphapi/webclient/WebSocketRequest.js +30 -0
  36. package/graphapi/webclient/decode/DecodeBaseObject.js +48 -0
  37. package/graphapi/webclient/decode/index.js +59 -0
  38. package/graphapi/webclient/index.js +4 -0
  39. package/index.js +1 -0
  40. package/loading/JsonLoader.js +128 -0
  41. package/loading/LoadingStatus.js +4 -0
  42. package/loading/ScriptLoader.js +40 -0
  43. package/loading/index.js +24 -0
  44. package/package.json +17 -0
  45. package/react/BaseObject.js +179 -0
  46. package/react/RefToProperty.js +20 -0
  47. package/react/admin/Editor.js +153 -0
  48. package/react/admin/EditorBlock.js +53 -0
  49. package/react/admin/EditorBlockName.js +19 -0
  50. package/react/admin/index.js +3 -0
  51. package/react/area/HasData.js +22 -0
  52. package/react/area/InsertElement.js +22 -0
  53. package/react/area/index.js +2 -0
  54. package/react/blocks/index.js +61 -0
  55. package/react/context/AddContextVariables.js +22 -0
  56. package/react/context/Context.js +4 -0
  57. package/react/context/index.js +2 -0
  58. package/react/cookies/CookieBar.js +162 -0
  59. package/react/cookies/CookieSettings.js +118 -0
  60. package/react/cookies/index.js +2 -0
  61. package/react/form/Checkbox.js +28 -0
  62. package/react/form/FormField.js +28 -0
  63. package/react/form/index.js +2 -0
  64. package/react/index.js +13 -0
  65. package/react/login/LoginForm.js +113 -0
  66. package/react/login/index.js +1 -0
  67. package/react/modules/ModuleCreator.js +30 -0
  68. package/react/modules/index.js +1 -0
  69. package/react/source/ContextVariableSource.js +19 -0
  70. package/react/source/index.js +1 -0
  71. package/react/text/HtmlText.js +14 -0
  72. package/react/text/Text.js +13 -0
  73. package/react/text/index.js +19 -0
  74. package/repository/Item.js +70 -0
  75. package/repository/Repository.js +60 -0
  76. package/repository/index.js +2 -0
  77. package/site/SiteDataLoader.js +62 -0
  78. package/site/SiteNavigation.js +242 -0
  79. package/site/index.js +2 -0
  80. package/startup/Controller.js +43 -0
  81. package/startup/Runner.js +40 -0
  82. package/startup/index.js +28 -0
  83. package/tracking/Controller.js +157 -0
  84. package/tracking/DataLayerTracker.js +80 -0
  85. package/tracking/index.js +16 -0
  86. package/updater/PropertyUpdater.js +127 -0
  87. package/updater/RequestAnimationFrameTimer.js +43 -0
  88. package/updater/index.js +16 -0
  89. package/utils/ArrayFunctions.js +20 -0
  90. package/utils/index.js +1 -0
@@ -0,0 +1,21 @@
1
+ import Dbm from "../index.js";
2
+ import CommandBaseObject from "./CommandBaseObject.js"
3
+
4
+ export default class CallFunction extends CommandBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this.item.setValue("scopeObject", null);
9
+ this.item.setValue("callFunction", null);
10
+ this.item.setValue("callArguments", []);
11
+ }
12
+
13
+ perform(aFromObject, aData) {
14
+
15
+ //METODO: resolve input
16
+ let callFunction = this.item.callFunction;
17
+
18
+ //METODO: try catch
19
+ callFunction.apply(this.item.scopeObject, this.item.callArguments);
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class CommandBaseObject extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+ }
7
+
8
+ perform(aFromObject, aData) {
9
+ //MENOTE: should be overridden
10
+ }
11
+ }
@@ -0,0 +1,20 @@
1
+ import Dbm from "../index.js";
2
+ import CommandBaseObject from "./CommandBaseObject.js"
3
+
4
+ export default class ResolvePromise extends CommandBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this.item.setValue("promise", new Promise((aResolve, aReject) => {
9
+ this.item.setValue("resolve", aResolve);
10
+ this.item.setValue("reject", aReject);
11
+ }));
12
+
13
+ this.item.setValue("value", null);
14
+ }
15
+
16
+ perform(aFromObject, aData) {
17
+
18
+ this.item.resolve(this.item.value);
19
+ }
20
+ }
@@ -0,0 +1,36 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export {default as CommandBaseObject} from "./CommandBaseObject.js";
4
+ export {default as CallFunction} from "./CallFunction.js";
5
+ export {default as ResolvePromise} from "./ResolvePromise.js";
6
+
7
+
8
+ let callScopedFunction = function(aScopeObject, aFunction, aArguments = []) {
9
+ let newCommand = new Dbm.commands.CallFunction();
10
+ newCommand.item.setValue("scopeObject", aScopeObject);
11
+ newCommand.item.setValue("callFunction", aFunction);
12
+ newCommand.item.setValue("callArguments", aArguments);
13
+
14
+ return newCommand;
15
+ }
16
+
17
+ export {callScopedFunction};
18
+
19
+ let callFunction = function(aFunction, aArguments = []) {
20
+ let newCommand = new Dbm.commands.CallFunction();
21
+ newCommand.item.setValue("callFunction", aFunction);
22
+ newCommand.item.setValue("callArguments", aArguments);
23
+
24
+ return newCommand;
25
+ }
26
+
27
+ export {callFunction};
28
+
29
+ let resolvePromise = function(aValue = null) {
30
+ let newCommand = new Dbm.commands.ResolvePromise();
31
+ newCommand.item.setValue("value", aValue);
32
+
33
+ return newCommand;
34
+ }
35
+
36
+ export {resolvePromise};
@@ -0,0 +1,23 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class BaseObject extends Dbm.core.LifeCycleObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+ this._item = null;
8
+ }
9
+
10
+ get item() {
11
+ if(!this._item) {
12
+ this._item = new Dbm.repository.Item();
13
+ this._item.setValue("controller", this);
14
+ }
15
+ return this._item;
16
+ }
17
+
18
+ setItem(aItem) {
19
+ this._item = aItem;
20
+
21
+ return this;
22
+ }
23
+ }
@@ -0,0 +1,18 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class GlobalObject extends Dbm.core.BaseObject {
4
+ constructor() {
5
+ super();
6
+
7
+ this._repository = new Dbm.repository.Repository();
8
+ this._nextId = 0;
9
+ }
10
+
11
+ get repository() {
12
+ return this._repository;
13
+ }
14
+
15
+ getNextId() {
16
+ return this._nextId++;
17
+ }
18
+ }
@@ -0,0 +1,25 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class LifeCycleObject {
4
+ constructor() {
5
+
6
+ if(process.env.NODE_ENV === "development") {
7
+ this._debugId = Math.round(Math.random()*1000000000000);
8
+ }
9
+
10
+ this._constructProperties();
11
+ this._construct();
12
+ }
13
+
14
+ _constructProperties() {
15
+
16
+ }
17
+
18
+ _construct() {
19
+
20
+ }
21
+
22
+ destroy() {
23
+ //METODO
24
+ }
25
+ }
package/core/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export {default as LifeCycleObject} from "./LifeCycleObject.js";
2
+ export {default as BaseObject} from "./BaseObject.js";
3
+ export {default as GlobalObject} from "./GlobalObject.js";
package/dbm.js ADDED
@@ -0,0 +1,71 @@
1
+ import {GlobalObject} from "./core/index.js";
2
+
3
+ if(!globalThis.dbm) {
4
+ globalThis.dbm = new GlobalObject();
5
+ }
6
+
7
+ export let getInstance = function() {
8
+ return globalThis.dbm;
9
+ }
10
+
11
+ //export {getInstance};
12
+
13
+ export let objectPath = function(aObject, aPath) {
14
+ //console.log("objectPath");
15
+
16
+ let currentObject = aObject;
17
+
18
+ aPath += "";
19
+ if(aPath.length === 0) {
20
+ return currentObject;
21
+ }
22
+
23
+ let currentArray = aPath.split(".");
24
+ let currentArrayLength = currentArray.length;
25
+ for(let i = 0; i < currentArrayLength; i++) {
26
+ let currentPathPart = currentArray[0];
27
+
28
+ if(currentObject === null || currentObject === undefined) {
29
+ break;
30
+ }
31
+
32
+ /*
33
+ else if(currentPathPart === "(every)") {
34
+ currentArray.shift();
35
+ let currentItems = Wprr.utils.array.singleOrArray(currentObject);
36
+ let returnArray = Wprr.utils.array.mapField(currentItems, currentArray.join("."));
37
+ return returnArray;
38
+ }
39
+ */
40
+
41
+ if(currentPathPart === "(self)") {
42
+ continue;
43
+ }
44
+ else {
45
+ currentArray.shift();
46
+
47
+ let partAsInt = parseInt(currentPathPart, 10);
48
+ if(partAsInt.toString() === currentPathPart) {
49
+ currentObject = currentObject[partAsInt];
50
+ }
51
+ else {
52
+ currentObject = currentObject[currentPathPart];
53
+ }
54
+ }
55
+ }
56
+
57
+ return currentObject;
58
+ }
59
+
60
+ export * as utils from "./utils/index.js";
61
+ export * as core from "./core/index.js";
62
+ export * as loading from "./loading/index.js";
63
+ export * as react from "./react/index.js";
64
+ export * as repository from "./repository/index.js";
65
+ export * as graphapi from "./graphapi/index.js";
66
+ export * as commands from "./commands/index.js";
67
+ export * as flow from "./flow/index.js";
68
+ export * as updater from "./updater/index.js";
69
+ export * as startup from "./startup/index.js";
70
+ export * as site from "./site/index.js";
71
+ export * as tracking from "./tracking/index.js";
@@ -0,0 +1,45 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class DirtyCommands extends Dbm.flow.FlowBaseObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this.commands = [];
9
+ this._upstreamConnection = null;
10
+ }
11
+
12
+ get isDirty() {
13
+ return false;
14
+ }
15
+
16
+ set isDirty(aValue) {
17
+ if(aValue) {
18
+ let currentArray = this.commands;
19
+ let currentArrayLength = currentArray.length;
20
+ for(let i = 0; i < currentArrayLength; i++) {
21
+ let currentCommand = currentArray[i];
22
+ currentCommand.perform(this, null);
23
+ }
24
+ }
25
+ }
26
+
27
+ _connection_connectUpstream(aFlowObject) {
28
+ if(this._upstreamConnection) {
29
+ //METODO: disconnect old input
30
+
31
+ }
32
+
33
+ this._upstreamConnection = aFlowObject;
34
+ }
35
+
36
+ destroy() {
37
+ super.destroy();
38
+
39
+ this.commands = [];
40
+ if(this._upstreamConnection) {
41
+ //METODO: remove as outgoing
42
+ this._upstreamConnection = null;
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,78 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class FlowBaseObject extends Dbm.core.LifeCycleObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this._downstreamConnections = [];
9
+ this.isDirty = false;
10
+ }
11
+
12
+ connectInput(aFlowObject) {
13
+ this._connection_connectUpstream(aFlowObject);
14
+ aFlowObject._connection_connectDownstream(this);
15
+
16
+ return this;
17
+ }
18
+
19
+ _connection_connectUpstream(aFlowObject) {
20
+ //MENOTE: should be overridden
21
+ }
22
+
23
+ connectOutput(aFlowObject) {
24
+ aFlowObject._connection_connectUpstream(this);
25
+ this._connection_connectDownstream(aFlowObject);
26
+
27
+ return this;
28
+ }
29
+
30
+ _connection_connectDownstream(aFlowObject) {
31
+ this._downstreamConnections.push(aFlowObject);
32
+ aFlowObject.setAsDirty();
33
+ }
34
+
35
+ _internal_updateFlow() {
36
+ //MENOTE: should be overridden
37
+ }
38
+
39
+ _internal_setValueInFlow(aValue) {
40
+
41
+ }
42
+
43
+ setAsDirty() {
44
+ this.isDirty = true;
45
+ this.setDownstreamAsDirty();
46
+
47
+ return this;
48
+ }
49
+
50
+ setDownstreamAsDirty() {
51
+ //console.log("setDownstreamAsDirty");
52
+ //console.log(this);
53
+
54
+ let currentArray = [];
55
+ this.collectAndMarkDownstreamConnectionsAsDirty(currentArray);
56
+ for(let i = 0; i < currentArray.length; i++) { //MENOTE: length increases in the loop
57
+ let currentFlowObject = currentArray[i];
58
+ //console.log(currentFlowObject);
59
+ currentFlowObject.collectAndMarkDownstreamConnectionsAsDirty(currentArray);
60
+ }
61
+
62
+ return this;
63
+ }
64
+
65
+ collectAndMarkDownstreamConnectionsAsDirty(aReturnArray) {
66
+ //console.log("collectAndMarkDownstreamConnectionsAsDirty");
67
+
68
+ let currentArray = this._downstreamConnections;
69
+ let currentArrayLength = currentArray.length;
70
+ for(let i = 0; i < currentArrayLength; i++) {
71
+ let currentConenction = currentArray[i];
72
+ if(!currentConenction.isDirty) {
73
+ currentConenction.isDirty = true;
74
+ aReturnArray.push(currentConenction);
75
+ }
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,146 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class FlowProperty extends Dbm.flow.FlowBaseObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this._value = null;
9
+
10
+ this._upstreamConnection = null;
11
+
12
+ }
13
+
14
+ get isFlowProperty() {
15
+ return true;
16
+ }
17
+
18
+ setValue(aValue) {
19
+ if(this._upstreamConnection) {
20
+ //METODO: add warning
21
+ //METODO: check if upstream can be changed
22
+ }
23
+ else {
24
+ if(aValue !== this._value) {
25
+ this._value = aValue;
26
+ this.isDirty = false;
27
+ this.setDownstreamAsDirty();
28
+ }
29
+ }
30
+
31
+ return this;
32
+ }
33
+
34
+ setOrConnect(aValueOrProperty) {
35
+ if(aValueOrProperty && aValueOrProperty.isFlowProperty) {
36
+ this.connectInput(aValueOrProperty);
37
+ }
38
+ else {
39
+ this.setValue(aValueOrProperty);
40
+ }
41
+
42
+ return this;
43
+ }
44
+
45
+ animateValue(aToValue, aTime = 0.5, aDelay = 0, aEasing = null) {
46
+ Dbm.getInstance().repository.getItem("propertyUpdater").controller.animateProperty(this, aToValue, aTime, aDelay, aEasing);
47
+
48
+ return this;
49
+ }
50
+
51
+ getMostUpstreamProperty() {
52
+
53
+ let debugCounter = 0;
54
+
55
+ let currentProperty = this;
56
+ while(currentProperty._upstreamConnection) {
57
+ if(debugCounter++ > 10000) {
58
+ console.error("Loop ran for too long");
59
+ return null;
60
+ }
61
+ currentProperty = currentProperty._upstreamConnection;
62
+ }
63
+ return currentProperty;
64
+ }
65
+
66
+ _connection_connectUpstream(aFlowObject) {
67
+ if(this._upstreamConnection) {
68
+ //METODO: disconnect old input
69
+
70
+ }
71
+
72
+ this._upstreamConnection = aFlowObject;
73
+ }
74
+
75
+ _internal_setValueInFlow(aValue) {
76
+ this._value = aValue;
77
+ this.isDirty = false;
78
+ }
79
+
80
+ _internal_setValueInFlowOutsideOfUpdate(aValue) {
81
+ if(aValue !== this._value) {
82
+ this._value = aValue;
83
+ this.isDirty = false;
84
+ this.setDownstreamAsDirty();
85
+ }
86
+ }
87
+
88
+ set value(aValue) {
89
+ this.setValue(aValue);
90
+ }
91
+
92
+ get value() {
93
+
94
+ this.updateFlow();
95
+
96
+ return this._value;
97
+ }
98
+
99
+ updateFlow() {
100
+ //console.log("updateFlow");
101
+ if(this.isDirty) {
102
+ if(this._upstreamConnection) {
103
+ this._upstreamConnection._internal_updateFlow();
104
+ }
105
+ else {
106
+ this.isDirty = false;
107
+ }
108
+ }
109
+
110
+ return this;
111
+ }
112
+
113
+ getValueWithoutFlow() {
114
+ return this._value;
115
+ }
116
+
117
+ _internal_updateFlow() {
118
+ let newValue = this.value;
119
+ let currentArray = this._downstreamConnections;
120
+ let currentArrayLength = currentArray.length;
121
+ for(let i = 0; i < currentArrayLength; i++) {
122
+ let currentConnection = currentArray[i];
123
+ currentConnection._internal_setValueInFlow(newValue);
124
+ }
125
+ }
126
+
127
+ startUpdating() {
128
+ Dbm.getInstance().repository.getItem("propertyUpdater").controller.addProperty(this);
129
+ return this;
130
+ }
131
+
132
+ stopUpdating() {
133
+ Dbm.getInstance().repository.getItem("propertyUpdater").controller.removeProperty(this);
134
+ return this;
135
+ }
136
+
137
+ destroy() {
138
+ super.destroy();
139
+
140
+ this._value = null;
141
+ if(this._upstreamConnection) {
142
+ //METODO: remove as outgoing
143
+ this._upstreamConnection = null;
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,39 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class FlowUpdateFunction extends Dbm.flow.FlowBaseObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this._upstreamConnections = [];
9
+ this.input = (new Dbm.flow.UpdateFunctionInputs()).setOwner(this);
10
+ this.output = (new Dbm.flow.UpdateFunctionOutputs()).setOwner(this);
11
+ }
12
+
13
+ _connection_connectUpstream(aFlowObject) {
14
+ this._upstreamConnections.push(aFlowObject);
15
+ }
16
+
17
+ _internal_updateFlow() {
18
+ //console.log("_internal_updateFlow");
19
+
20
+ let shouldUpdate = this.input.updateValues();
21
+
22
+ try {
23
+ if(shouldUpdate) {
24
+ this._update();
25
+ }
26
+ else {
27
+ this.output.markAsClean();
28
+ }
29
+ this.isDirty = false;
30
+ }
31
+ catch(theError) {
32
+ console.error(theError);
33
+ }
34
+ }
35
+
36
+ _update() {
37
+ //MENOTE: should be overridden
38
+ }
39
+ }
@@ -0,0 +1,58 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class UpdateFunctionInputs extends Dbm.core.LifeCycleObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this.properties = {};
9
+ this._cachedValues = [];
10
+ this._owner = null;
11
+ }
12
+
13
+ setOwner(aOwner) {
14
+
15
+ this._owner = aOwner;
16
+
17
+ return this;
18
+ }
19
+
20
+ register(aName, aInitialValue = null) {
21
+ if(!this.properties.hasOwnProperty(aName)) {
22
+ let property = new Dbm.flow.FlowProperty();
23
+ property.value = aInitialValue;
24
+ this._owner.connectInput(property);
25
+
26
+ Object.defineProperty(this, aName, {
27
+ get() {
28
+ return property.value;
29
+ },
30
+ set(aValue) {
31
+ property.value = aValue;
32
+ }
33
+ });
34
+
35
+ let cacheObject = {"value": aInitialValue, "property": property};
36
+ this.properties[aName] = property;
37
+ this._cachedValues.push(cacheObject);
38
+ }
39
+
40
+ return this.properties[aName];
41
+ }
42
+
43
+ updateValues() {
44
+ let needsToUpdate = false;
45
+ let currentArray = this._cachedValues;
46
+ let currentArrayLength = currentArray.length;
47
+ for(let i = 0; i < currentArrayLength; i++) {
48
+ let currentCache = currentArray[i];
49
+ let newValue = currentCache.property.value;
50
+ if(newValue !== currentCache.value) {
51
+ currentCache.value = newValue;
52
+ needsToUpdate = true;
53
+ }
54
+ }
55
+
56
+ return needsToUpdate;
57
+ }
58
+ }
@@ -0,0 +1,51 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class UpdateFunctionOutputs extends Dbm.core.LifeCycleObject {
4
+
5
+ _constructProperties() {
6
+ super._constructProperties();
7
+
8
+ this.properties = {};
9
+ this._propertiesList = [];
10
+ this._owner = null;
11
+
12
+ }
13
+
14
+ setOwner(aOwner) {
15
+
16
+ this._owner = aOwner;
17
+
18
+ return this;
19
+ }
20
+
21
+ register(aName, aInitialValue = null) {
22
+ if(!this.properties.hasOwnProperty(aName)) {
23
+ let property = new Dbm.flow.FlowProperty();
24
+ property.value = aInitialValue;
25
+ this._owner.connectOutput(property);
26
+
27
+ Object.defineProperty(this, aName, {
28
+ get() {
29
+ return property.value;
30
+ },
31
+ set(aValue) {
32
+ property._internal_setValueInFlow(aValue);
33
+ }
34
+ });
35
+
36
+ this.properties[aName] = property;
37
+ this._propertiesList.push(property);
38
+ }
39
+
40
+ return this.properties[aName];
41
+ }
42
+
43
+ markAsClean() {
44
+ let currentArray = this._propertiesList;
45
+ let currentArrayLength = currentArray.length;
46
+ for(let i = 0; i < currentArrayLength; i++) {
47
+ let currentProperty = currentArray[i];
48
+ currentProperty.isDirty = false;
49
+ }
50
+ }
51
+ }
package/flow/index.js ADDED
@@ -0,0 +1,40 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export {default as FlowBaseObject} from "./FlowBaseObject.js";
4
+ export {default as FlowProperty} from "./FlowProperty.js";
5
+ export {default as FlowUpdateFunction} from "./FlowUpdateFunction.js";
6
+ export {default as UpdateFunctionInputs} from "./UpdateFunctionInputs.js";
7
+ export {default as UpdateFunctionOutputs} from "./UpdateFunctionOutputs.js";
8
+ export {default as DirtyCommands} from "./DirtyCommands.js";
9
+
10
+ export * as updatefunctions from "./updatefunctions/index.js";
11
+
12
+ export let addUpdateCommand = function(aProperty, aCommand) {
13
+ let updateFunction = new Dbm.flow.updatefunctions.basic.RunCommand();
14
+ updateFunction.input.properties.value.connectInput(aProperty);
15
+ updateFunction.input.command = aCommand;
16
+ updateFunction.noFirstTriggger();
17
+
18
+ let updatePropertyCommand = Dbm.commands.callFunction(Dbm.getInstance().repository.getItem("propertyUpdater").controller.addSinglePropertyUpdateBound, [updateFunction.output.properties.value]);
19
+
20
+ let dirtyCommands = new Dbm.flow.DirtyCommands();
21
+ updateFunction.output.properties.value.connectOutput(dirtyCommands);
22
+ dirtyCommands.commands.push(updatePropertyCommand);
23
+
24
+ return {"updateFunction": updateFunction, "dirtyCommands": dirtyCommands};
25
+ }
26
+
27
+ export let addDirectUpdateCommand = function(aProperty, aCommand) {
28
+ let updateFunction = new Dbm.flow.updatefunctions.basic.RunCommand();
29
+ updateFunction.input.properties.value.connectInput(aProperty);
30
+ updateFunction.input.command = aCommand;
31
+ updateFunction.noFirstTriggger();
32
+
33
+ let updatePropertyCommand = Dbm.commands.callFunction(updateFunction.output.properties.value.updateFlow.bind(updateFunction.output.properties.value), []);
34
+
35
+ let dirtyCommands = new Dbm.flow.DirtyCommands();
36
+ updateFunction.output.properties.value.connectOutput(dirtyCommands);
37
+ dirtyCommands.commands.push(updatePropertyCommand);
38
+
39
+ return {"updateFunction": updateFunction, "dirtyCommands": dirtyCommands};
40
+ }