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