@kemu-io/edge-runtime 0.1.30 → 0.2.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 (3) hide show
  1. package/package.json +1 -1
  2. package/runner.d.ts +20 -3
  3. package/runner.js +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kemu-io/edge-runtime",
3
3
  "type": "module",
4
- "version": "0.1.30",
4
+ "version": "0.2.0",
5
5
  "description": "Kemu Edge runtime for running Kemu recipes",
6
6
  "author": "Kemu Pty Ltd",
7
7
  "main": "runner.js",
package/runner.d.ts CHANGED
@@ -110,7 +110,8 @@ declare enum WidgetType {
110
110
  variable = "variable",
111
111
  hubService = "hubService",
112
112
  imageFilter = "imageFilter",
113
- recipeLoad = "recipeLoad"
113
+ recipeLoad = "recipeLoad",
114
+ note = "note"
114
115
  }
115
116
  export type VariableDefinition = {
116
117
  /**
@@ -137,6 +138,7 @@ export type VariableDefinition = {
137
138
  export type VarValueChangeEvt = Readonly<Pick<VariableDefinition, "type" | "value"> & {
138
139
  varName: string;
139
140
  }>;
141
+ export type SendToInputWidgetFn = (inputName: string, data: PartialData | number | string | boolean | Array<any>) => Promise<void>;
140
142
  export declare const utils: {
141
143
  /**
142
144
  * Builds an object that represents an ImageData type. This is useful when services
@@ -172,8 +174,23 @@ declare const _default: {
172
174
  **/
173
175
  apiKey?: string;
174
176
  }) => Promise<{
175
- /** use it to send data to input widgets */
176
- sendToInputWidget: (inputName: string, data: PartialData, thingId?: string | undefined) => Promise<void>;
177
+ /**
178
+ * use it to send data to input widgets
179
+ * @param inputName the name of the input widget to send data to.
180
+ * @param data the data to send to the input widget.
181
+ * @example
182
+ * ```typescript
183
+ * await sendToInputWidget('myInputName', 'this is my value');
184
+ * await sendToInputWidget('counter', 1234);
185
+ *
186
+ * // For non primitive types such as images, you can specify the data type
187
+ * await sendToInputWidget('myImageInputName', {
188
+ * type: DataType.ImageData,
189
+ * data: utils.createImageDataLike(image, 100, 200),
190
+ * });
191
+ * ```
192
+ */
193
+ sendToInputWidget: SendToInputWidgetFn;
177
194
  }>;
178
195
  terminate: () => Promise<void>;
179
196
  /**