@kemu-io/edge-runtime 0.1.17 → 0.1.21

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 +15 -7
  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.17",
4
+ "version": "0.1.21",
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
@@ -148,6 +148,14 @@ export declare const utils: {
148
148
  * @returns the loaded image as ImageData
149
149
  */
150
150
  loadImageFile: (filePath: string | URL | Buffer | ArrayBufferLike | Uint8Array | Readable) => Promise<ImageData$1>;
151
+ /**
152
+ * Encodes raw ImageData type to a common image file format.
153
+ * @param imageData the ImageData to encode.
154
+ * @param format the format to encode the image in.
155
+ * @param quality the quality of the image to encode. Only applies to jpeg and webp formats.
156
+ * @returns the encoded image as a buffer.
157
+ */
158
+ encodeImageData: (imageData: ImageData$1, format?: "png" | "jpeg" | "webp", quality?: number) => Promise<Buffer>;
151
159
  };
152
160
  declare const _default: {
153
161
  start: (config?: {
@@ -165,15 +173,15 @@ declare const _default: {
165
173
  }) => Promise<{
166
174
  /** use it to send data to input widgets */
167
175
  sendToInputWidget: (inputName: string, data: PartialData, thingId?: string | undefined) => Promise<void>;
168
- /**
169
- * Sets a listener to changes in the value of a variable.
170
- * @param varName the name of the variable to listen to. Set it to `*` to listen to all variable changes.
171
- * @param cb the callback function to be invoked.
172
- * @returns a function to remove the listener.
173
- */
174
- onVariableChange: (varName: string, cb: (evt: VarValueChangeEvt) => void | Promise<void>) => void;
175
176
  }>;
176
177
  terminate: () => Promise<void>;
178
+ /**
179
+ * Sets a listener to changes in the value of a variable.
180
+ * @param varName the name of the variable to listen to. Set it to `*` to listen to all variable changes.
181
+ * @param cb the callback function to be invoked.
182
+ * @returns a function to remove the listener.
183
+ */
184
+ onVariableChange: (varName: string, cb: (evt: VarValueChangeEvt) => void | Promise<void>) => () => void;
177
185
  };
178
186
 
179
187
  export {