@foresthubai/workflow-core 0.4.3 → 0.4.5
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/LICENSE +202 -202
- package/NOTICE +14 -14
- package/README.md +63 -63
- package/dist/api/deployment.d.ts +74 -0
- package/dist/api/deployment.d.ts.map +1 -0
- package/dist/api/deployment.js +6 -0
- package/dist/api/deployment.js.map +1 -0
- package/dist/api/engine.d.ts +744 -0
- package/dist/api/engine.d.ts.map +1 -0
- package/dist/api/engine.js +6 -0
- package/dist/api/engine.js.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/workflow.d.ts +25 -9
- package/dist/api/workflow.d.ts.map +1 -1
- package/dist/channel/Channel.d.ts +1 -1
- package/dist/channel/Channel.d.ts.map +1 -1
- package/dist/channel/Channel.js +3 -1
- package/dist/channel/Channel.js.map +1 -1
- package/dist/channel/ChannelDefinition.d.ts.map +1 -1
- package/dist/channel/ChannelDefinition.js +24 -0
- package/dist/channel/ChannelDefinition.js.map +1 -1
- package/dist/channel/index.d.ts.map +1 -1
- package/dist/channel/index.js +2 -0
- package/dist/channel/index.js.map +1 -1
- package/dist/channel/serialization.d.ts.map +1 -1
- package/dist/channel/serialization.js +8 -0
- package/dist/channel/serialization.js.map +1 -1
- package/dist/deploy/index.d.ts +5 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +4 -1
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/inputs.d.ts +26 -0
- package/dist/deploy/inputs.d.ts.map +1 -0
- package/dist/deploy/inputs.js +4 -0
- package/dist/deploy/inputs.js.map +1 -0
- package/dist/deploy/requirements.d.ts +24 -0
- package/dist/deploy/requirements.d.ts.map +1 -1
- package/dist/deploy/requirements.js +63 -0
- package/dist/deploy/requirements.js.map +1 -1
- package/dist/deploy/spec.d.ts +27 -0
- package/dist/deploy/spec.d.ts.map +1 -0
- package/dist/deploy/spec.js +352 -0
- package/dist/deploy/spec.js.map +1 -0
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.d.ts.map +1 -1
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.js +2 -0
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.js.map +1 -1
- package/dist/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics/diagnostics.js +2 -0
- package/dist/diagnostics/diagnostics.js.map +1 -1
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/diagnostics/index.js +2 -0
- package/dist/diagnostics/index.js.map +1 -1
- package/dist/edge/Edge.d.ts.map +1 -1
- package/dist/edge/Edge.js +2 -0
- package/dist/edge/Edge.js.map +1 -1
- package/dist/edge/EdgeDefinition.d.ts.map +1 -1
- package/dist/edge/EdgeDefinition.js +2 -0
- package/dist/edge/EdgeDefinition.js.map +1 -1
- package/dist/edge/EdgeType.d.ts.map +1 -1
- package/dist/edge/EdgeType.js +2 -0
- package/dist/edge/EdgeType.js.map +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +2 -2
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/serialization.d.ts.map +1 -1
- package/dist/edge/serialization.js +2 -0
- package/dist/edge/serialization.js.map +1 -1
- package/dist/expression/index.d.ts.map +1 -1
- package/dist/expression/index.js +2 -0
- package/dist/expression/index.js.map +1 -1
- package/dist/expression/parser.d.ts.map +1 -1
- package/dist/expression/parser.js +2 -0
- package/dist/expression/parser.js.map +1 -1
- package/dist/expression/types.d.ts.map +1 -1
- package/dist/expression/types.js +2 -0
- package/dist/expression/types.js.map +1 -1
- package/dist/function/FunctionDeclaration.d.ts.map +1 -1
- package/dist/function/FunctionDeclaration.js +2 -0
- package/dist/function/FunctionDeclaration.js.map +1 -1
- package/dist/function/index.d.ts.map +1 -1
- package/dist/function/index.js +2 -0
- package/dist/function/index.js.map +1 -1
- package/dist/function/serialization.d.ts.map +1 -1
- package/dist/function/serialization.js +2 -0
- package/dist/function/serialization.js.map +1 -1
- package/dist/id/index.d.ts.map +1 -1
- package/dist/id/index.js +2 -0
- package/dist/id/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/Memory.d.ts.map +1 -1
- package/dist/memory/Memory.js +2 -0
- package/dist/memory/Memory.js.map +1 -1
- package/dist/memory/MemoryDefinition.d.ts.map +1 -1
- package/dist/memory/MemoryDefinition.js +2 -0
- package/dist/memory/MemoryDefinition.js.map +1 -1
- package/dist/memory/MemoryFileDefinition.d.ts.map +1 -1
- package/dist/memory/MemoryFileDefinition.js +2 -0
- package/dist/memory/MemoryFileDefinition.js.map +1 -1
- package/dist/memory/MemoryRegistry.d.ts.map +1 -1
- package/dist/memory/MemoryRegistry.js +2 -0
- package/dist/memory/MemoryRegistry.js.map +1 -1
- package/dist/memory/VectorDatabaseDefinition.d.ts.map +1 -1
- package/dist/memory/VectorDatabaseDefinition.js +2 -0
- package/dist/memory/VectorDatabaseDefinition.js.map +1 -1
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/serialization.d.ts.map +1 -1
- package/dist/memory/serialization.js +2 -0
- package/dist/memory/serialization.js.map +1 -1
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +2 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/migrate.d.ts.map +1 -1
- package/dist/migration/migrate.js +2 -0
- package/dist/migration/migrate.js.map +1 -1
- package/dist/migration/migrations.d.ts.map +1 -1
- package/dist/migration/migrations.js +2 -0
- package/dist/migration/migrations.js.map +1 -1
- package/dist/migration/version.d.ts.map +1 -1
- package/dist/migration/version.js +2 -0
- package/dist/migration/version.js.map +1 -1
- package/dist/model/LLMModelDefinition.d.ts.map +1 -1
- package/dist/model/LLMModelDefinition.js +2 -0
- package/dist/model/LLMModelDefinition.js.map +1 -1
- package/dist/model/Model.d.ts.map +1 -1
- package/dist/model/Model.js +2 -13
- package/dist/model/Model.js.map +1 -1
- package/dist/model/ModelDefinition.d.ts.map +1 -1
- package/dist/model/ModelDefinition.js +2 -0
- package/dist/model/ModelDefinition.js.map +1 -1
- package/dist/model/ModelRegistry.d.ts.map +1 -1
- package/dist/model/ModelRegistry.js +2 -0
- package/dist/model/ModelRegistry.js.map +1 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +2 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/serialization.d.ts.map +1 -1
- package/dist/model/serialization.js +2 -0
- package/dist/model/serialization.js.map +1 -1
- package/dist/node/AgentNode.d.ts.map +1 -1
- package/dist/node/AgentNode.js +2 -0
- package/dist/node/AgentNode.js.map +1 -1
- package/dist/node/DataNode.d.ts.map +1 -1
- package/dist/node/DataNode.js +2 -0
- package/dist/node/DataNode.js.map +1 -1
- package/dist/node/FunctionNode.d.ts.map +1 -1
- package/dist/node/FunctionNode.js +2 -0
- package/dist/node/FunctionNode.js.map +1 -1
- package/dist/node/InputNode.d.ts.map +1 -1
- package/dist/node/InputNode.js +2 -0
- package/dist/node/InputNode.js.map +1 -1
- package/dist/node/LogicNode.d.ts.map +1 -1
- package/dist/node/LogicNode.js +2 -0
- package/dist/node/LogicNode.js.map +1 -1
- package/dist/node/MqttNode.d.ts.map +1 -1
- package/dist/node/MqttNode.js +2 -0
- package/dist/node/MqttNode.js.map +1 -1
- package/dist/node/Node.d.ts.map +1 -1
- package/dist/node/Node.js +2 -7
- package/dist/node/Node.js.map +1 -1
- package/dist/node/NodeDefinition.d.ts.map +1 -1
- package/dist/node/NodeDefinition.js +2 -0
- package/dist/node/NodeDefinition.js.map +1 -1
- package/dist/node/NodeRegistry.d.ts.map +1 -1
- package/dist/node/NodeRegistry.js +2 -0
- package/dist/node/NodeRegistry.js.map +1 -1
- package/dist/node/OutputNode.d.ts.map +1 -1
- package/dist/node/OutputNode.js +4 -2
- package/dist/node/OutputNode.js.map +1 -1
- package/dist/node/ToolNode.d.ts.map +1 -1
- package/dist/node/ToolNode.js +2 -0
- package/dist/node/ToolNode.js.map +1 -1
- package/dist/node/TriggerNode.d.ts.map +1 -1
- package/dist/node/TriggerNode.js +2 -0
- package/dist/node/TriggerNode.js.map +1 -1
- package/dist/node/constants.d.ts.map +1 -1
- package/dist/node/constants.js +2 -0
- package/dist/node/constants.js.map +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/methods.d.ts.map +1 -1
- package/dist/node/methods.js +2 -0
- package/dist/node/methods.js.map +1 -1
- package/dist/node/serialization.d.ts.map +1 -1
- package/dist/node/serialization.js +33 -13
- package/dist/node/serialization.js.map +1 -1
- package/dist/parameter/OutputParameter.d.ts.map +1 -1
- package/dist/parameter/OutputParameter.js +2 -0
- package/dist/parameter/OutputParameter.js.map +1 -1
- package/dist/parameter/Parameter.d.ts.map +1 -1
- package/dist/parameter/Parameter.js +2 -0
- package/dist/parameter/Parameter.js.map +1 -1
- package/dist/parameter/index.d.ts.map +1 -1
- package/dist/parameter/index.js +2 -0
- package/dist/parameter/index.js.map +1 -1
- package/dist/variable/Variable.d.ts.map +1 -1
- package/dist/variable/Variable.js +2 -0
- package/dist/variable/Variable.js.map +1 -1
- package/dist/variable/index.d.ts.map +1 -1
- package/dist/variable/index.js +2 -3
- package/dist/variable/index.js.map +1 -1
- package/dist/variable/operations.d.ts.map +1 -1
- package/dist/variable/operations.js +2 -0
- package/dist/variable/operations.js.map +1 -1
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +2 -0
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/serialization.d.ts.map +1 -1
- package/dist/workflow/serialization.js +2 -4
- package/dist/workflow/serialization.js.map +1 -1
- package/package.json +2 -2
- package/src/api/deployment.ts +74 -0
- package/src/api/engine.ts +744 -0
- package/src/api/index.ts +29 -11
- package/src/api/workflow.ts +25 -9
- package/src/channel/Channel.ts +14 -11
- package/src/channel/ChannelDefinition.ts +101 -76
- package/src/channel/index.ts +9 -6
- package/src/channel/serialization.ts +77 -68
- package/src/deploy/index.ts +17 -1
- package/src/deploy/inputs.ts +44 -0
- package/src/deploy/requirements.test.ts +64 -61
- package/src/deploy/requirements.ts +159 -41
- package/src/deploy/spec.test.ts +227 -0
- package/src/deploy/spec.ts +397 -0
- package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +161 -158
- package/src/diagnostics/diagnostics.test.ts +881 -878
- package/src/diagnostics/diagnostics.ts +939 -936
- package/src/diagnostics/index.ts +14 -11
- package/src/edge/Edge.ts +26 -23
- package/src/edge/EdgeDefinition.ts +48 -45
- package/src/edge/EdgeType.ts +22 -19
- package/src/edge/index.ts +11 -8
- package/src/edge/serialization.ts +86 -83
- package/src/expression/index.ts +7 -4
- package/src/expression/parser.ts +365 -362
- package/src/expression/types.ts +33 -30
- package/src/function/FunctionDeclaration.ts +57 -54
- package/src/function/index.ts +6 -3
- package/src/function/serialization.ts +43 -40
- package/src/globals.d.ts +12 -9
- package/src/id/index.ts +11 -8
- package/src/index.ts +25 -22
- package/src/memory/Memory.ts +18 -15
- package/src/memory/MemoryDefinition.ts +19 -16
- package/src/memory/MemoryFileDefinition.ts +40 -37
- package/src/memory/MemoryRegistry.ts +38 -35
- package/src/memory/VectorDatabaseDefinition.ts +24 -21
- package/src/memory/index.ts +11 -8
- package/src/memory/serialization.ts +50 -47
- package/src/migration/index.ts +7 -4
- package/src/migration/migrate.test.ts +47 -44
- package/src/migration/migrate.ts +61 -58
- package/src/migration/migrations.ts +27 -24
- package/src/migration/version.ts +12 -9
- package/src/model/LLMModelDefinition.ts +15 -12
- package/src/model/Model.ts +42 -39
- package/src/model/ModelDefinition.ts +18 -15
- package/src/model/ModelRegistry.ts +36 -33
- package/src/model/index.ts +10 -7
- package/src/model/serialization.ts +33 -30
- package/src/node/AgentNode.ts +85 -82
- package/src/node/DataNode.ts +44 -41
- package/src/node/FunctionNode.ts +79 -76
- package/src/node/InputNode.ts +188 -185
- package/src/node/LogicNode.ts +36 -33
- package/src/node/MqttNode.ts +130 -127
- package/src/node/Node.ts +64 -61
- package/src/node/NodeDefinition.ts +40 -37
- package/src/node/NodeRegistry.ts +88 -85
- package/src/node/OutputNode.ts +90 -87
- package/src/node/ToolNode.ts +35 -32
- package/src/node/TriggerNode.ts +275 -272
- package/src/node/constants.ts +19 -16
- package/src/node/index.ts +29 -26
- package/src/node/methods.ts +281 -278
- package/src/node/serialization.test.ts +51 -0
- package/src/node/serialization.ts +565 -544
- package/src/parameter/OutputParameter.ts +71 -68
- package/src/parameter/Parameter.ts +246 -243
- package/src/parameter/index.ts +36 -33
- package/src/variable/Variable.ts +13 -10
- package/src/variable/index.ts +19 -16
- package/src/variable/operations.ts +109 -106
- package/src/workflow/Workflow.ts +44 -41
- package/src/workflow/index.ts +6 -3
- package/src/workflow/serialization.test.ts +243 -240
- package/src/workflow/serialization.ts +245 -242
package/src/node/TriggerNode.ts
CHANGED
|
@@ -1,272 +1,275 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| "
|
|
80
|
-
| "
|
|
81
|
-
| "
|
|
82
|
-
| "
|
|
83
|
-
| "
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
{ value: "
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) 2026 ForestHub.
|
|
3
|
+
|
|
4
|
+
import { NodeBase } from "./Node";
|
|
5
|
+
import type { Reference } from "../api";
|
|
6
|
+
import { OutputBinding } from "../parameter";
|
|
7
|
+
import { NodeCategory, NodeTag } from "./constants";
|
|
8
|
+
import { NodeDefinition } from "./NodeDefinition";
|
|
9
|
+
|
|
10
|
+
// On Function Call Trigger - fires when a user-defined function is called
|
|
11
|
+
export interface OnFunctionCallNode extends NodeBase {
|
|
12
|
+
type: "OnFunctionCall";
|
|
13
|
+
arguments: Record<string, never>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Delay Node - pauses execution for a specified duration
|
|
17
|
+
export interface DelayNode extends NodeBase {
|
|
18
|
+
type: "Delay";
|
|
19
|
+
arguments: {
|
|
20
|
+
delayMs: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Ticker Trigger - fires repeatedly at a specified interval
|
|
25
|
+
export interface TickerNode extends NodeBase {
|
|
26
|
+
type: "Ticker";
|
|
27
|
+
arguments: {
|
|
28
|
+
intervalValue: number | undefined;
|
|
29
|
+
intervalUnit: "milliseconds" | "seconds" | "minutes" | "hours";
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Alarm Trigger - fires at a scheduled time on selected days
|
|
34
|
+
export interface AlarmNode extends NodeBase {
|
|
35
|
+
type: "Alarm";
|
|
36
|
+
arguments: {
|
|
37
|
+
time: string;
|
|
38
|
+
days: string[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// On Startup Trigger - fires once when device powers on
|
|
43
|
+
export interface OnStartupNode extends NodeBase {
|
|
44
|
+
type: "OnStartup";
|
|
45
|
+
arguments: Record<string, never>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// On Pin Edge Trigger - fires when a digital pin transitions
|
|
49
|
+
export interface OnPinEdgeNode extends NodeBase {
|
|
50
|
+
type: "OnPinEdge";
|
|
51
|
+
arguments: {
|
|
52
|
+
pinReference: string | undefined;
|
|
53
|
+
edge: "rising" | "falling" | "both";
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// On Serial Receive Trigger - fires when serial data arrives
|
|
58
|
+
export interface OnSerialReceiveNode extends NodeBase {
|
|
59
|
+
type: "OnSerialReceive";
|
|
60
|
+
arguments: {
|
|
61
|
+
portReference: string | undefined;
|
|
62
|
+
output: OutputBinding;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// On Threshold Trigger - fires when a numeric variable crosses a threshold
|
|
67
|
+
export interface OnThresholdNode extends NodeBase {
|
|
68
|
+
type: "OnThreshold";
|
|
69
|
+
arguments: {
|
|
70
|
+
variable: Reference | undefined;
|
|
71
|
+
threshold: number | undefined;
|
|
72
|
+
direction: "rising" | "falling" | "both";
|
|
73
|
+
deadband: number | undefined;
|
|
74
|
+
output: OutputBinding;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type TriggerNodeType =
|
|
79
|
+
| "OnFunctionCall"
|
|
80
|
+
| "Delay"
|
|
81
|
+
| "Ticker"
|
|
82
|
+
| "Alarm"
|
|
83
|
+
| "OnStartup"
|
|
84
|
+
| "OnPinEdge"
|
|
85
|
+
| "OnSerialReceive"
|
|
86
|
+
| "OnThreshold";
|
|
87
|
+
export type TriggerNode =
|
|
88
|
+
| OnFunctionCallNode
|
|
89
|
+
| DelayNode
|
|
90
|
+
| TickerNode
|
|
91
|
+
| AlarmNode
|
|
92
|
+
| OnStartupNode
|
|
93
|
+
| OnPinEdgeNode
|
|
94
|
+
| OnSerialReceiveNode
|
|
95
|
+
| OnThresholdNode;
|
|
96
|
+
|
|
97
|
+
// Node Definitions
|
|
98
|
+
|
|
99
|
+
export const OnFunctionCallNodeDefinition: NodeDefinition = {
|
|
100
|
+
type: "OnFunctionCall",
|
|
101
|
+
label: "On Function Call",
|
|
102
|
+
category: NodeCategory.Trigger,
|
|
103
|
+
description: "Fires when this function is invoked by a Function Call node",
|
|
104
|
+
parameters: [],
|
|
105
|
+
isUnremovable: true, // Cannot be added or removed by user
|
|
106
|
+
isSingleton: true,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const DelayNodeDefinition: NodeDefinition = {
|
|
110
|
+
type: "Delay",
|
|
111
|
+
label: "Delay",
|
|
112
|
+
category: NodeCategory.Trigger,
|
|
113
|
+
description:
|
|
114
|
+
"Pauses execution for a specified duration and triggers once the delay is complete. During this pause other node chains may run.",
|
|
115
|
+
parameters: [
|
|
116
|
+
{
|
|
117
|
+
id: "delayMs",
|
|
118
|
+
label: "Delay (ms)",
|
|
119
|
+
description: "Time in milliseconds to pause execution",
|
|
120
|
+
type: "int",
|
|
121
|
+
default: 1000,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const TickerNodeDefinition: NodeDefinition = {
|
|
127
|
+
type: "Ticker",
|
|
128
|
+
label: "Ticker",
|
|
129
|
+
category: NodeCategory.Trigger,
|
|
130
|
+
description: "Fires repeatedly at a specified interval",
|
|
131
|
+
parameters: [
|
|
132
|
+
{
|
|
133
|
+
id: "intervalValue",
|
|
134
|
+
label: "Interval",
|
|
135
|
+
description: "How many units between ticks",
|
|
136
|
+
type: "int",
|
|
137
|
+
default: 1,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "intervalUnit",
|
|
141
|
+
label: "Unit",
|
|
142
|
+
description: "Time unit for the interval",
|
|
143
|
+
type: "selection",
|
|
144
|
+
options: [
|
|
145
|
+
{ value: "milliseconds", label: "Milliseconds" },
|
|
146
|
+
{ value: "seconds", label: "Seconds" },
|
|
147
|
+
{ value: "minutes", label: "Minutes" },
|
|
148
|
+
{ value: "hours", label: "Hours" },
|
|
149
|
+
],
|
|
150
|
+
default: "seconds",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const AlarmNodeDefinition: NodeDefinition = {
|
|
156
|
+
type: "Alarm",
|
|
157
|
+
label: "Alarm",
|
|
158
|
+
category: NodeCategory.Trigger,
|
|
159
|
+
description: "Fires at a scheduled time on selected days of the week",
|
|
160
|
+
parameters: [
|
|
161
|
+
{
|
|
162
|
+
id: "time",
|
|
163
|
+
label: "Time",
|
|
164
|
+
description: "Time of day to fire (24h format)",
|
|
165
|
+
type: "time",
|
|
166
|
+
default: "12:00",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "days",
|
|
170
|
+
label: "Days",
|
|
171
|
+
description: "Days of the week to fire on (empty = every day)",
|
|
172
|
+
type: "weekdays",
|
|
173
|
+
default: [],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const OnStartupNodeDefinition: NodeDefinition = {
|
|
179
|
+
type: "OnStartup",
|
|
180
|
+
label: "On Startup",
|
|
181
|
+
category: NodeCategory.Trigger,
|
|
182
|
+
description: "Fires once when the device powers on",
|
|
183
|
+
parameters: [],
|
|
184
|
+
isSingleton: true,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const OnPinEdgeNodeDefinition: NodeDefinition = {
|
|
188
|
+
type: "OnPinEdge",
|
|
189
|
+
label: "On Pin Edge",
|
|
190
|
+
category: NodeCategory.Trigger,
|
|
191
|
+
tags: [NodeTag.Pin],
|
|
192
|
+
description: "Fires when a digital pin transitions",
|
|
193
|
+
parameters: [
|
|
194
|
+
{
|
|
195
|
+
id: "pinReference",
|
|
196
|
+
label: "Pin",
|
|
197
|
+
description: "Digital pin to watch",
|
|
198
|
+
type: "channelSelect",
|
|
199
|
+
channelType: ["GPIOIN"],
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: "edge",
|
|
203
|
+
label: "Edge",
|
|
204
|
+
description: "Edge transition that fires the trigger",
|
|
205
|
+
type: "selection",
|
|
206
|
+
options: [
|
|
207
|
+
{ value: "rising", label: "Rising" },
|
|
208
|
+
{ value: "falling", label: "Falling" },
|
|
209
|
+
{ value: "both", label: "Both" },
|
|
210
|
+
],
|
|
211
|
+
default: "both",
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const OnSerialReceiveNodeDefinition: NodeDefinition = {
|
|
217
|
+
type: "OnSerialReceive",
|
|
218
|
+
label: "On Serial Receive",
|
|
219
|
+
category: NodeCategory.Trigger,
|
|
220
|
+
tags: [NodeTag.Serial],
|
|
221
|
+
description: "Fires when serial data arrives",
|
|
222
|
+
outputs: [{ id: "output", label: "Serial Data", type: "static", dataType: "string" }],
|
|
223
|
+
parameters: [
|
|
224
|
+
{
|
|
225
|
+
id: "portReference",
|
|
226
|
+
label: "Port",
|
|
227
|
+
description: "Serial port to listen on",
|
|
228
|
+
type: "channelSelect",
|
|
229
|
+
channelType: ["UART"],
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const OnThresholdNodeDefinition: NodeDefinition = {
|
|
235
|
+
type: "OnThreshold",
|
|
236
|
+
label: "On Threshold",
|
|
237
|
+
category: NodeCategory.Trigger,
|
|
238
|
+
description: "Fires when a numeric variable crosses a threshold",
|
|
239
|
+
outputs: [{ id: "output", label: "Triggering Value", type: "static", dataType: "float" }],
|
|
240
|
+
parameters: [
|
|
241
|
+
{
|
|
242
|
+
id: "variable",
|
|
243
|
+
label: "Variable",
|
|
244
|
+
description: "Numeric variable to watch for threshold crossings",
|
|
245
|
+
type: "variableSelect",
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "threshold",
|
|
249
|
+
label: "Threshold",
|
|
250
|
+
description: "Value the variable crosses to fire the trigger",
|
|
251
|
+
type: "float",
|
|
252
|
+
default: 0,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "direction",
|
|
256
|
+
label: "Direction",
|
|
257
|
+
description: "Crossing direction to fire on",
|
|
258
|
+
type: "selection",
|
|
259
|
+
options: [
|
|
260
|
+
{ value: "rising", label: "Rising" },
|
|
261
|
+
{ value: "falling", label: "Falling" },
|
|
262
|
+
{ value: "both", label: "Both" },
|
|
263
|
+
],
|
|
264
|
+
default: "both",
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "deadband",
|
|
268
|
+
label: "Deadband",
|
|
269
|
+
description: "Hysteresis band width around threshold (0 disables)",
|
|
270
|
+
type: "float",
|
|
271
|
+
default: 0,
|
|
272
|
+
optional: true,
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
};
|
package/src/node/constants.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) 2026 ForestHub.
|
|
3
|
+
|
|
4
|
+
export enum NodeCategory {
|
|
5
|
+
Input = "Input",
|
|
6
|
+
Output = "Output",
|
|
7
|
+
Logic = "Logic",
|
|
8
|
+
Data = "Data",
|
|
9
|
+
Trigger = "Trigger",
|
|
10
|
+
Tool = "Tool",
|
|
11
|
+
AI = "AI",
|
|
12
|
+
Function = "Function",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum NodeTag {
|
|
16
|
+
Network = "Network",
|
|
17
|
+
Pin = "Pin",
|
|
18
|
+
Serial = "Serial",
|
|
19
|
+
}
|
package/src/node/index.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export type {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) 2026 ForestHub.
|
|
3
|
+
|
|
4
|
+
// Base domain node types
|
|
5
|
+
export type {
|
|
6
|
+
NodeOutput,
|
|
7
|
+
NodeType,
|
|
8
|
+
NodeData,
|
|
9
|
+
Node,
|
|
10
|
+
NodeBase,
|
|
11
|
+
} from "./Node";
|
|
12
|
+
|
|
13
|
+
// Constants & registry
|
|
14
|
+
export { NodeCategory, NodeTag } from "./constants";
|
|
15
|
+
export { NodeRegistry } from "./NodeRegistry";
|
|
16
|
+
export type { NodeDefinition, Port, PortDefinitions } from "./NodeDefinition";
|
|
17
|
+
export type { OutputParameter, StaticOutput, OutputList, OutputBinding, OutputDeclaration } from "../parameter";
|
|
18
|
+
|
|
19
|
+
// NodeMethods — read helpers over a NodeData
|
|
20
|
+
export { getPorts, getArguments, getNodeOutput, getNodeAvailableOutput, getOutputBinding, getInput, isNodeUsedAsTool } from "./methods";
|
|
21
|
+
export type { ExternalInput } from "./methods";
|
|
22
|
+
|
|
23
|
+
// FunctionCall — special node whose definition is built from FunctionInfo
|
|
24
|
+
export type { FunctionCallNode, FunctionCallNodeType, FunctionNodeDefinition } from "./FunctionNode";
|
|
25
|
+
export { buildFunctionNodeDef } from "./FunctionNode";
|
|
26
|
+
|
|
27
|
+
// Serialization — domain Node <-> api
|
|
28
|
+
export { serialize, deserialize } from "./serialization";
|
|
29
|
+
export type { ApiNode } from "./serialization";
|