logic-mesh 0.1.5 → 0.1.6

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/logic_mesh.d.ts CHANGED
@@ -65,9 +65,10 @@ export class EngineCommand {
65
65
  * to be immediately scheduled for execution
66
66
  * @param {string} block_name
67
67
  * @param {string | undefined} [block_uuid]
68
+ * @param {string | undefined} [lib]
68
69
  * @returns {Promise<string>}
69
70
  */
70
- addBlock(block_name: string, block_uuid?: string): Promise<string>;
71
+ addBlock(block_name: string, block_uuid?: string, lib?: string): Promise<string>;
71
72
  /**
72
73
  * Removes a block instance from the engine
73
74
  * to be immediately unscheduled for execution
@@ -161,6 +162,21 @@ export class EngineCommand {
161
162
  */
162
163
  inspectBlock(block_uuid: string): Promise<any>;
163
164
  /**
165
+ * Evaluates a block by name
166
+ * This will create a block instance and execute it.
167
+ *
168
+ * # Arguments
169
+ * * `block_name` - The name of the block to evaluate
170
+ * * `inputs` - The input values to the block
171
+ *
172
+ * # Returns
173
+ * A list of values representing the outputs of the block
174
+ * @param {string} block_name
175
+ * @param {any[]} inputs
176
+ * @returns {Promise<any>}
177
+ */
178
+ evalBlock(block_name: string, inputs: any[]): Promise<any>;
179
+ /**
164
180
  * Creates a watch on block changes
165
181
  * @param {Function} callback
166
182
  * @returns {Promise<void>}
package/logic_mesh_bg.js CHANGED
@@ -234,6 +234,24 @@ function __wbg_adapter_50(arg0, arg1, arg2) {
234
234
  wasm.__wbindgen_export_3(arg0, arg1, addHeapObject(arg2));
235
235
  }
236
236
 
237
+ let cachedUint32Memory0 = null;
238
+
239
+ function getUint32Memory0() {
240
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
241
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
242
+ }
243
+ return cachedUint32Memory0;
244
+ }
245
+
246
+ function passArrayJsValueToWasm0(array, malloc) {
247
+ const ptr = malloc(array.length * 4, 4) >>> 0;
248
+ const mem = getUint32Memory0();
249
+ for (let i = 0; i < array.length; i++) {
250
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
251
+ }
252
+ WASM_VECTOR_LEN = array.length;
253
+ return ptr;
254
+ }
237
255
  /**
238
256
  * @returns {BlocksEngine}
239
257
  */
@@ -261,7 +279,7 @@ function handleError(f, args) {
261
279
  wasm.__wbindgen_export_5(addHeapObject(e));
262
280
  }
263
281
  }
264
- function __wbg_adapter_154(arg0, arg1, arg2, arg3) {
282
+ function __wbg_adapter_155(arg0, arg1, arg2, arg3) {
265
283
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
266
284
  }
267
285
 
@@ -394,14 +412,17 @@ export class EngineCommand {
394
412
  * to be immediately scheduled for execution
395
413
  * @param {string} block_name
396
414
  * @param {string | undefined} [block_uuid]
415
+ * @param {string | undefined} [lib]
397
416
  * @returns {Promise<string>}
398
417
  */
399
- addBlock(block_name, block_uuid) {
418
+ addBlock(block_name, block_uuid, lib) {
400
419
  const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
401
420
  const len0 = WASM_VECTOR_LEN;
402
421
  var ptr1 = isLikeNone(block_uuid) ? 0 : passStringToWasm0(block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
403
422
  var len1 = WASM_VECTOR_LEN;
404
- const ret = wasm.enginecommand_addBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1);
423
+ var ptr2 = isLikeNone(lib) ? 0 : passStringToWasm0(lib, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
424
+ var len2 = WASM_VECTOR_LEN;
425
+ const ret = wasm.enginecommand_addBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
405
426
  return takeObject(ret);
406
427
  }
407
428
  /**
@@ -540,6 +561,28 @@ export class EngineCommand {
540
561
  return takeObject(ret);
541
562
  }
542
563
  /**
564
+ * Evaluates a block by name
565
+ * This will create a block instance and execute it.
566
+ *
567
+ * # Arguments
568
+ * * `block_name` - The name of the block to evaluate
569
+ * * `inputs` - The input values to the block
570
+ *
571
+ * # Returns
572
+ * A list of values representing the outputs of the block
573
+ * @param {string} block_name
574
+ * @param {any[]} inputs
575
+ * @returns {Promise<any>}
576
+ */
577
+ evalBlock(block_name, inputs) {
578
+ const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
579
+ const len0 = WASM_VECTOR_LEN;
580
+ const ptr1 = passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export_0);
581
+ const len1 = WASM_VECTOR_LEN;
582
+ const ret = wasm.enginecommand_evalBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1);
583
+ return takeObject(ret);
584
+ }
585
+ /**
543
586
  * Creates a watch on block changes
544
587
  * @param {Function} callback
545
588
  * @returns {Promise<void>}
@@ -593,13 +636,13 @@ export function __wbindgen_is_array(arg0) {
593
636
  return ret;
594
637
  };
595
638
 
596
- export function __wbindgen_error_new(arg0, arg1) {
597
- const ret = new Error(getStringFromWasm0(arg0, arg1));
639
+ export function __wbindgen_string_new(arg0, arg1) {
640
+ const ret = getStringFromWasm0(arg0, arg1);
598
641
  return addHeapObject(ret);
599
642
  };
600
643
 
601
- export function __wbindgen_string_new(arg0, arg1) {
602
- const ret = getStringFromWasm0(arg0, arg1);
644
+ export function __wbindgen_error_new(arg0, arg1) {
645
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
603
646
  return addHeapObject(ret);
604
647
  };
605
648
 
@@ -705,16 +748,6 @@ export function __wbg_warn_52c5b3e773c3a056(arg0, arg1) {
705
748
  console.warn(getStringFromWasm0(arg0, arg1));
706
749
  };
707
750
 
708
- export function __wbg_queueMicrotask_adae4bc085237231(arg0) {
709
- const ret = getObject(arg0).queueMicrotask;
710
- return addHeapObject(ret);
711
- };
712
-
713
- export function __wbindgen_is_function(arg0) {
714
- const ret = typeof(getObject(arg0)) === 'function';
715
- return ret;
716
- };
717
-
718
751
  export function __wbindgen_cb_drop(arg0) {
719
752
  const obj = takeObject(arg0).original;
720
753
  if (obj.cnt-- == 1) {
@@ -729,6 +762,16 @@ export function __wbg_queueMicrotask_4d890031a6a5a50c(arg0) {
729
762
  queueMicrotask(getObject(arg0));
730
763
  };
731
764
 
765
+ export function __wbg_queueMicrotask_adae4bc085237231(arg0) {
766
+ const ret = getObject(arg0).queueMicrotask;
767
+ return addHeapObject(ret);
768
+ };
769
+
770
+ export function __wbindgen_is_function(arg0) {
771
+ const ret = typeof(getObject(arg0)) === 'function';
772
+ return ret;
773
+ };
774
+
732
775
  export function __wbg_new_abda76e883ba8a5f() {
733
776
  const ret = new Error();
734
777
  return addHeapObject(ret);
@@ -950,7 +993,7 @@ export function __wbg_new_60f57089c7563e81(arg0, arg1) {
950
993
  const a = state0.a;
951
994
  state0.a = 0;
952
995
  try {
953
- return __wbg_adapter_154(a, state0.b, arg0, arg1);
996
+ return __wbg_adapter_155(a, state0.b, arg0, arg1);
954
997
  } finally {
955
998
  state0.a = a;
956
999
  }
@@ -1046,8 +1089,8 @@ export function __wbindgen_memory() {
1046
1089
  return addHeapObject(ret);
1047
1090
  };
1048
1091
 
1049
- export function __wbindgen_closure_wrapper2991(arg0, arg1, arg2) {
1050
- const ret = makeMutClosure(arg0, arg1, 1111, __wbg_adapter_50);
1092
+ export function __wbindgen_closure_wrapper3497(arg0, arg1, arg2) {
1093
+ const ret = makeMutClosure(arg0, arg1, 1193, __wbg_adapter_50);
1051
1094
  return addHeapObject(ret);
1052
1095
  };
1053
1096
 
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Radu Racariu <radu.racariu@gmail.com>"
5
5
  ],
6
6
  "description": "Control logic engine using event based and reactive blocks written in Rust.",
7
- "version": "0.1.5",
7
+ "version": "0.1.6",
8
8
  "license": "BSD-3-Clause",
9
9
  "repository": {
10
10
  "type": "git",