@kemu-io/edge-runtime 0.1.29 → 0.1.31

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 +18 -2
  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.29",
4
+ "version": "0.1.31",
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
@@ -137,6 +137,7 @@ export type VariableDefinition = {
137
137
  export type VarValueChangeEvt = Readonly<Pick<VariableDefinition, "type" | "value"> & {
138
138
  varName: string;
139
139
  }>;
140
+ export type SendToInputWidgetFn = (inputName: string, data: PartialData | number | string | boolean | Array<any>) => Promise<void>;
140
141
  export declare const utils: {
141
142
  /**
142
143
  * Builds an object that represents an ImageData type. This is useful when services
@@ -172,8 +173,23 @@ declare const _default: {
172
173
  **/
173
174
  apiKey?: string;
174
175
  }) => Promise<{
175
- /** use it to send data to input widgets */
176
- sendToInputWidget: (inputName: string, data: PartialData, thingId?: string | undefined) => Promise<void>;
176
+ /**
177
+ * use it to send data to input widgets
178
+ * @param inputName the name of the input widget to send data to.
179
+ * @param data the data to send to the input widget.
180
+ * @example
181
+ * ```typescript
182
+ * await sendToInputWidget('myInputName', 'this is my value');
183
+ * await sendToInputWidget('counter', 1234);
184
+ *
185
+ * // For non primitive types such as images, you can specify the data type
186
+ * await sendToInputWidget('myImageInputName', {
187
+ * type: DataType.ImageData,
188
+ * data: utils.createImageDataLike(image, 100, 200),
189
+ * });
190
+ * ```
191
+ */
192
+ sendToInputWidget: SendToInputWidgetFn;
177
193
  }>;
178
194
  terminate: () => Promise<void>;
179
195
  /**