logic-mesh 0.1.1

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 ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2023 Radu Racariu
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ [![GitHub CI](https://github.com/rracariu/logic-mesh/actions/workflows/main.yml/badge.svg)](https://github.com/rracariu/logic-mesh/actions/workflows/main.yml)
2
+ [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/rracariu/logic-mesh/blob/master/LICENSE)
3
+ [![crates.io](https://img.shields.io/crates/v/logic-mesh.svg)](https://crates.io/crates/logic-mesh)
4
+
5
+ # Logic Mesh
6
+ A logic engine that is fully async, dynamic, and reactive written in Rust.
7
+
8
+ ## Possible applications
9
+ Logic Mesh started as a hardware control engine, but the scope expanded to anything that requires a reactive and dynamic evaluation engine.
10
+ It is designed to be used in a variety of applications, from hardware controls, games to web servers. It is designed to be fast, efficient, and easy to use.
11
+
12
+ The included WASM support allows it to be used in web applications, with the option to use the same codebase for both the frontend and backend.
13
+
14
+ ## Features
15
+ - Fully async and reactive
16
+ - WASM support
17
+ - Uses Tokio for async runtime
18
+ - The API is simple enough to be used in a variety of applications
19
+ - A low code editor is included as an example of how Logic Mesh can be used
20
+ - A growing library of built-in blocks
21
+ - Extensible with custom blocks, either in Rust or JavaScript when running in a WASM environment
22
+
23
+ ## UI Editor
24
+ There is a sample low code editor that is built on top of Logic Mesh, which can be found [here](https://rracariu.github.io/logic-mesh/). It serves as an example of how Logic Mesh can be used, and as
25
+ a simple way to experiment with the Logic Mesh engine.
26
+
27
+ ## Examples
28
+
29
+ The following examples are written in Rust.
30
+
31
+ ```rust
32
+ // Init a Add block
33
+ let mut add1 = Add::new();
34
+ // Init a SineWave block
35
+ let mut sine1 = SineWave::new();
36
+
37
+ // Se the amplitude and frequency of the sine wave
38
+ sine1.amplitude.val = Some(3.into());
39
+ sine1.freq.val = Some(200.into());
40
+ // Connect the output of the sine wave to the first input of the add block
41
+ connect_output(&mut sine1.out, add1.inputs_mut()[0]).expect("Connected");
42
+
43
+ // Init another SineWave block
44
+ let mut sine2 = SineWave::new();
45
+ sine2.amplitude.val = Some(7.into());
46
+ sine2.freq.val = Some(400.into());
47
+
48
+ // Connect the output of the sine wave to the second input of the add block
49
+ sine2
50
+ .connect_output("out", add1.inputs_mut()[1])
51
+ .expect("Connected");
52
+
53
+ // Init a single threaded engine
54
+ let mut engine = SingleThreadedEngine::new();
55
+
56
+ // Schedule the blocks to be run
57
+ engine.schedule(add1);
58
+ engine.schedule(sine1);
59
+ engine.schedule(sine2);
60
+
61
+ // Run the engine
62
+ engine.run().await;
63
+ ```
64
+
@@ -0,0 +1,119 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @returns {BlocksEngine}
5
+ */
6
+ export function initEngine(): BlocksEngine;
7
+ /**
8
+ */
9
+ export function start(): void;
10
+ /**
11
+ */
12
+ export function init_panic_hook(): void;
13
+ /**
14
+ * Controls the execution or the blocks.
15
+ * Loads programs and enables inspection and debugging
16
+ * of the blocks and their inputs and outputs.
17
+ */
18
+ export class BlocksEngine {
19
+ free(): void;
20
+ /**
21
+ * Create a new instance of an engine
22
+ */
23
+ constructor();
24
+ /**
25
+ * Lists all available blocks
26
+ * @returns {Array<any>}
27
+ */
28
+ listBlocks(): Array<any>;
29
+ /**
30
+ * @returns {EngineCommand}
31
+ */
32
+ engineCommand(): EngineCommand;
33
+ /**
34
+ * Runs the engine asynchronously
35
+ * After this is called, the engine instance can't be used directly
36
+ * Instead use the command object to communicate with the engine.
37
+ * @returns {Promise<void>}
38
+ */
39
+ run(): Promise<void>;
40
+ }
41
+ /**
42
+ * Commands a running instance of a Block Engine.
43
+ */
44
+ export class EngineCommand {
45
+ free(): void;
46
+ /**
47
+ * Adds a block instance to the engine
48
+ * to be immediately scheduled for execution
49
+ * @param {string} block_name
50
+ * @returns {Promise<string | undefined>}
51
+ */
52
+ addBlock(block_name: string): Promise<string | undefined>;
53
+ /**
54
+ * Removes a block instance from the engine
55
+ * to be immediately unscheduled for execution
56
+ * and removed from the engine together with all its links.
57
+ *
58
+ * # Arguments
59
+ * * `block_uuid` - The UUID of the block to be removed
60
+ *
61
+ * # Returns
62
+ * The UUID of the removed block
63
+ * @param {string} block_uuid
64
+ * @returns {Promise<string | undefined>}
65
+ */
66
+ removeBlock(block_uuid: string): Promise<string | undefined>;
67
+ /**
68
+ * Creates a link between two blocks
69
+ *
70
+ * # Arguments
71
+ * * `source_block_uuid` - The UUID of the source block
72
+ * * `target_block_uuid` - The UUID of the target block
73
+ * * `source_block_pin_name` - The name of the output pin of the source block
74
+ * * `target_block_input_name` - The name of the input pin of the target block
75
+ *
76
+ * # Returns
77
+ * A `LinkData` object with the following properties:
78
+ * * `source_block_uuid` - The UUID of the source block
79
+ * * `target_block_uuid` - The UUID of the target block
80
+ * * `source_block_pin_name` - The name of the output pin of the source block
81
+ * * `target_block_input_name` - The name of the input pin of the target block
82
+ * @param {string} source_block_uuid
83
+ * @param {string} target_block_uuid
84
+ * @param {string} source_block_pin_name
85
+ * @param {string} target_block_pin_name
86
+ * @returns {Promise<any>}
87
+ */
88
+ createLink(source_block_uuid: string, target_block_uuid: string, source_block_pin_name: string, target_block_pin_name: string): Promise<any>;
89
+ /**
90
+ * Removes a link between two blocks
91
+ *
92
+ * # Arguments
93
+ * * `link_uuid` - The UUID of the link to be removed
94
+ *
95
+ * # Returns
96
+ * True if the link was removed, false otherwise
97
+ * @param {string} link_uuid
98
+ * @returns {Promise<boolean>}
99
+ */
100
+ removeLink(link_uuid: string): Promise<boolean>;
101
+ /**
102
+ * Get the current running engine program.
103
+ * The program contains the scheduled blocks, their properties, and their links.
104
+ * @returns {Promise<any>}
105
+ */
106
+ getProgram(): Promise<any>;
107
+ /**
108
+ * Inspects the current state of a block
109
+ * @param {string} block_uuid
110
+ * @returns {Promise<any>}
111
+ */
112
+ inspectBlock(block_uuid: string): Promise<any>;
113
+ /**
114
+ * Creates a watch on block changes
115
+ * @param {Function} callback
116
+ * @returns {Promise<any>}
117
+ */
118
+ createWatch(callback: Function): Promise<any>;
119
+ }
package/logic_mesh.js ADDED
@@ -0,0 +1,6 @@
1
+ import * as wasm from "./logic_mesh_bg.wasm";
2
+ import { __wbg_set_wasm } from "./logic_mesh_bg.js";
3
+ __wbg_set_wasm(wasm);
4
+ export * from "./logic_mesh_bg.js";
5
+
6
+ wasm.__wbindgen_start();
@@ -0,0 +1,744 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ const heap = new Array(128).fill(undefined);
8
+
9
+ heap.push(undefined, null, true, false);
10
+
11
+ function getObject(idx) { return heap[idx]; }
12
+
13
+ let heap_next = heap.length;
14
+
15
+ function dropObject(idx) {
16
+ if (idx < 132) return;
17
+ heap[idx] = heap_next;
18
+ heap_next = idx;
19
+ }
20
+
21
+ function takeObject(idx) {
22
+ const ret = getObject(idx);
23
+ dropObject(idx);
24
+ return ret;
25
+ }
26
+
27
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
28
+
29
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
30
+
31
+ cachedTextDecoder.decode();
32
+
33
+ let cachedUint8Memory0 = null;
34
+
35
+ function getUint8Memory0() {
36
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
37
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
38
+ }
39
+ return cachedUint8Memory0;
40
+ }
41
+
42
+ function getStringFromWasm0(ptr, len) {
43
+ ptr = ptr >>> 0;
44
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
45
+ }
46
+
47
+ function addHeapObject(obj) {
48
+ if (heap_next === heap.length) heap.push(heap.length + 1);
49
+ const idx = heap_next;
50
+ heap_next = heap[idx];
51
+
52
+ heap[idx] = obj;
53
+ return idx;
54
+ }
55
+
56
+ function debugString(val) {
57
+ // primitive types
58
+ const type = typeof val;
59
+ if (type == 'number' || type == 'boolean' || val == null) {
60
+ return `${val}`;
61
+ }
62
+ if (type == 'string') {
63
+ return `"${val}"`;
64
+ }
65
+ if (type == 'symbol') {
66
+ const description = val.description;
67
+ if (description == null) {
68
+ return 'Symbol';
69
+ } else {
70
+ return `Symbol(${description})`;
71
+ }
72
+ }
73
+ if (type == 'function') {
74
+ const name = val.name;
75
+ if (typeof name == 'string' && name.length > 0) {
76
+ return `Function(${name})`;
77
+ } else {
78
+ return 'Function';
79
+ }
80
+ }
81
+ // objects
82
+ if (Array.isArray(val)) {
83
+ const length = val.length;
84
+ let debug = '[';
85
+ if (length > 0) {
86
+ debug += debugString(val[0]);
87
+ }
88
+ for(let i = 1; i < length; i++) {
89
+ debug += ', ' + debugString(val[i]);
90
+ }
91
+ debug += ']';
92
+ return debug;
93
+ }
94
+ // Test for built-in
95
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
96
+ let className;
97
+ if (builtInMatches.length > 1) {
98
+ className = builtInMatches[1];
99
+ } else {
100
+ // Failed to match the standard '[object ClassName]'
101
+ return toString.call(val);
102
+ }
103
+ if (className == 'Object') {
104
+ // we're a user defined class or Object
105
+ // JSON.stringify avoids problems with cycles, and is generally much
106
+ // easier than looping through ownProperties of `val`.
107
+ try {
108
+ return 'Object(' + JSON.stringify(val) + ')';
109
+ } catch (_) {
110
+ return 'Object';
111
+ }
112
+ }
113
+ // errors
114
+ if (val instanceof Error) {
115
+ return `${val.name}: ${val.message}\n${val.stack}`;
116
+ }
117
+ // TODO we could test for more things here, like `Set`s and `Map`s.
118
+ return className;
119
+ }
120
+
121
+ let WASM_VECTOR_LEN = 0;
122
+
123
+ const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
124
+
125
+ let cachedTextEncoder = new lTextEncoder('utf-8');
126
+
127
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
128
+ ? function (arg, view) {
129
+ return cachedTextEncoder.encodeInto(arg, view);
130
+ }
131
+ : function (arg, view) {
132
+ const buf = cachedTextEncoder.encode(arg);
133
+ view.set(buf);
134
+ return {
135
+ read: arg.length,
136
+ written: buf.length
137
+ };
138
+ });
139
+
140
+ function passStringToWasm0(arg, malloc, realloc) {
141
+
142
+ if (realloc === undefined) {
143
+ const buf = cachedTextEncoder.encode(arg);
144
+ const ptr = malloc(buf.length, 1) >>> 0;
145
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
146
+ WASM_VECTOR_LEN = buf.length;
147
+ return ptr;
148
+ }
149
+
150
+ let len = arg.length;
151
+ let ptr = malloc(len, 1) >>> 0;
152
+
153
+ const mem = getUint8Memory0();
154
+
155
+ let offset = 0;
156
+
157
+ for (; offset < len; offset++) {
158
+ const code = arg.charCodeAt(offset);
159
+ if (code > 0x7F) break;
160
+ mem[ptr + offset] = code;
161
+ }
162
+
163
+ if (offset !== len) {
164
+ if (offset !== 0) {
165
+ arg = arg.slice(offset);
166
+ }
167
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
168
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
169
+ const ret = encodeString(arg, view);
170
+
171
+ offset += ret.written;
172
+ }
173
+
174
+ WASM_VECTOR_LEN = offset;
175
+ return ptr;
176
+ }
177
+
178
+ let cachedInt32Memory0 = null;
179
+
180
+ function getInt32Memory0() {
181
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
182
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
183
+ }
184
+ return cachedInt32Memory0;
185
+ }
186
+
187
+ function makeMutClosure(arg0, arg1, dtor, f) {
188
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
189
+ const real = (...args) => {
190
+ // First up with a closure we increment the internal reference
191
+ // count. This ensures that the Rust closure environment won't
192
+ // be deallocated while we're invoking it.
193
+ state.cnt++;
194
+ const a = state.a;
195
+ state.a = 0;
196
+ try {
197
+ return f(a, state.b, ...args);
198
+ } finally {
199
+ if (--state.cnt === 0) {
200
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
201
+
202
+ } else {
203
+ state.a = a;
204
+ }
205
+ }
206
+ };
207
+ real.original = state;
208
+
209
+ return real;
210
+ }
211
+ function __wbg_adapter_30(arg0, arg1, arg2) {
212
+ wasm.__wbindgen_export_3(arg0, arg1, addHeapObject(arg2));
213
+ }
214
+
215
+ /**
216
+ * @returns {BlocksEngine}
217
+ */
218
+ export function initEngine() {
219
+ const ret = wasm.initEngine();
220
+ return BlocksEngine.__wrap(ret);
221
+ }
222
+
223
+ /**
224
+ */
225
+ export function start() {
226
+ wasm.start();
227
+ }
228
+
229
+ /**
230
+ */
231
+ export function init_panic_hook() {
232
+ wasm.init_panic_hook();
233
+ }
234
+
235
+ function handleError(f, args) {
236
+ try {
237
+ return f.apply(this, args);
238
+ } catch (e) {
239
+ wasm.__wbindgen_export_5(addHeapObject(e));
240
+ }
241
+ }
242
+ function __wbg_adapter_97(arg0, arg1, arg2, arg3) {
243
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
244
+ }
245
+
246
+ /**
247
+ * Controls the execution or the blocks.
248
+ * Loads programs and enables inspection and debugging
249
+ * of the blocks and their inputs and outputs.
250
+ */
251
+ export class BlocksEngine {
252
+
253
+ static __wrap(ptr) {
254
+ ptr = ptr >>> 0;
255
+ const obj = Object.create(BlocksEngine.prototype);
256
+ obj.__wbg_ptr = ptr;
257
+
258
+ return obj;
259
+ }
260
+
261
+ __destroy_into_raw() {
262
+ const ptr = this.__wbg_ptr;
263
+ this.__wbg_ptr = 0;
264
+
265
+ return ptr;
266
+ }
267
+
268
+ free() {
269
+ const ptr = this.__destroy_into_raw();
270
+ wasm.__wbg_blocksengine_free(ptr);
271
+ }
272
+ /**
273
+ * Create a new instance of an engine
274
+ */
275
+ constructor() {
276
+ const ret = wasm.blocksengine_new();
277
+ return BlocksEngine.__wrap(ret);
278
+ }
279
+ /**
280
+ * Lists all available blocks
281
+ * @returns {Array<any>}
282
+ */
283
+ listBlocks() {
284
+ const ret = wasm.blocksengine_listBlocks(this.__wbg_ptr);
285
+ return takeObject(ret);
286
+ }
287
+ /**
288
+ * @returns {EngineCommand}
289
+ */
290
+ engineCommand() {
291
+ const ret = wasm.blocksengine_engineCommand(this.__wbg_ptr);
292
+ return EngineCommand.__wrap(ret);
293
+ }
294
+ /**
295
+ * Runs the engine asynchronously
296
+ * After this is called, the engine instance can't be used directly
297
+ * Instead use the command object to communicate with the engine.
298
+ * @returns {Promise<void>}
299
+ */
300
+ run() {
301
+ const ret = wasm.blocksengine_run(this.__wbg_ptr);
302
+ return takeObject(ret);
303
+ }
304
+ }
305
+ /**
306
+ * Commands a running instance of a Block Engine.
307
+ */
308
+ export class EngineCommand {
309
+
310
+ static __wrap(ptr) {
311
+ ptr = ptr >>> 0;
312
+ const obj = Object.create(EngineCommand.prototype);
313
+ obj.__wbg_ptr = ptr;
314
+
315
+ return obj;
316
+ }
317
+
318
+ __destroy_into_raw() {
319
+ const ptr = this.__wbg_ptr;
320
+ this.__wbg_ptr = 0;
321
+
322
+ return ptr;
323
+ }
324
+
325
+ free() {
326
+ const ptr = this.__destroy_into_raw();
327
+ wasm.__wbg_enginecommand_free(ptr);
328
+ }
329
+ /**
330
+ * Adds a block instance to the engine
331
+ * to be immediately scheduled for execution
332
+ * @param {string} block_name
333
+ * @returns {Promise<string | undefined>}
334
+ */
335
+ addBlock(block_name) {
336
+ const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
337
+ const len0 = WASM_VECTOR_LEN;
338
+ const ret = wasm.enginecommand_addBlock(this.__wbg_ptr, ptr0, len0);
339
+ return takeObject(ret);
340
+ }
341
+ /**
342
+ * Removes a block instance from the engine
343
+ * to be immediately unscheduled for execution
344
+ * and removed from the engine together with all its links.
345
+ *
346
+ * # Arguments
347
+ * * `block_uuid` - The UUID of the block to be removed
348
+ *
349
+ * # Returns
350
+ * The UUID of the removed block
351
+ * @param {string} block_uuid
352
+ * @returns {Promise<string | undefined>}
353
+ */
354
+ removeBlock(block_uuid) {
355
+ const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ const ret = wasm.enginecommand_removeBlock(this.__wbg_ptr, ptr0, len0);
358
+ return takeObject(ret);
359
+ }
360
+ /**
361
+ * Creates a link between two blocks
362
+ *
363
+ * # Arguments
364
+ * * `source_block_uuid` - The UUID of the source block
365
+ * * `target_block_uuid` - The UUID of the target block
366
+ * * `source_block_pin_name` - The name of the output pin of the source block
367
+ * * `target_block_input_name` - The name of the input pin of the target block
368
+ *
369
+ * # Returns
370
+ * A `LinkData` object with the following properties:
371
+ * * `source_block_uuid` - The UUID of the source block
372
+ * * `target_block_uuid` - The UUID of the target block
373
+ * * `source_block_pin_name` - The name of the output pin of the source block
374
+ * * `target_block_input_name` - The name of the input pin of the target block
375
+ * @param {string} source_block_uuid
376
+ * @param {string} target_block_uuid
377
+ * @param {string} source_block_pin_name
378
+ * @param {string} target_block_pin_name
379
+ * @returns {Promise<any>}
380
+ */
381
+ createLink(source_block_uuid, target_block_uuid, source_block_pin_name, target_block_pin_name) {
382
+ const ptr0 = passStringToWasm0(source_block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ptr1 = passStringToWasm0(target_block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
385
+ const len1 = WASM_VECTOR_LEN;
386
+ const ptr2 = passStringToWasm0(source_block_pin_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
387
+ const len2 = WASM_VECTOR_LEN;
388
+ const ptr3 = passStringToWasm0(target_block_pin_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
389
+ const len3 = WASM_VECTOR_LEN;
390
+ const ret = wasm.enginecommand_createLink(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
391
+ return takeObject(ret);
392
+ }
393
+ /**
394
+ * Removes a link between two blocks
395
+ *
396
+ * # Arguments
397
+ * * `link_uuid` - The UUID of the link to be removed
398
+ *
399
+ * # Returns
400
+ * True if the link was removed, false otherwise
401
+ * @param {string} link_uuid
402
+ * @returns {Promise<boolean>}
403
+ */
404
+ removeLink(link_uuid) {
405
+ const ptr0 = passStringToWasm0(link_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
406
+ const len0 = WASM_VECTOR_LEN;
407
+ const ret = wasm.enginecommand_removeLink(this.__wbg_ptr, ptr0, len0);
408
+ return takeObject(ret);
409
+ }
410
+ /**
411
+ * Get the current running engine program.
412
+ * The program contains the scheduled blocks, their properties, and their links.
413
+ * @returns {Promise<any>}
414
+ */
415
+ getProgram() {
416
+ const ret = wasm.enginecommand_getProgram(this.__wbg_ptr);
417
+ return takeObject(ret);
418
+ }
419
+ /**
420
+ * Inspects the current state of a block
421
+ * @param {string} block_uuid
422
+ * @returns {Promise<any>}
423
+ */
424
+ inspectBlock(block_uuid) {
425
+ const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
426
+ const len0 = WASM_VECTOR_LEN;
427
+ const ret = wasm.enginecommand_inspectBlock(this.__wbg_ptr, ptr0, len0);
428
+ return takeObject(ret);
429
+ }
430
+ /**
431
+ * Creates a watch on block changes
432
+ * @param {Function} callback
433
+ * @returns {Promise<any>}
434
+ */
435
+ createWatch(callback) {
436
+ const ret = wasm.enginecommand_createWatch(this.__wbg_ptr, addHeapObject(callback));
437
+ return takeObject(ret);
438
+ }
439
+ }
440
+
441
+ export function __wbindgen_object_drop_ref(arg0) {
442
+ takeObject(arg0);
443
+ };
444
+
445
+ export function __wbindgen_error_new(arg0, arg1) {
446
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
447
+ return addHeapObject(ret);
448
+ };
449
+
450
+ export function __wbindgen_string_new(arg0, arg1) {
451
+ const ret = getStringFromWasm0(arg0, arg1);
452
+ return addHeapObject(ret);
453
+ };
454
+
455
+ export function __wbindgen_object_clone_ref(arg0) {
456
+ const ret = getObject(arg0);
457
+ return addHeapObject(ret);
458
+ };
459
+
460
+ export function __wbindgen_is_object(arg0) {
461
+ const val = getObject(arg0);
462
+ const ret = typeof(val) === 'object' && val !== null;
463
+ return ret;
464
+ };
465
+
466
+ export function __wbindgen_number_new(arg0) {
467
+ const ret = arg0;
468
+ return addHeapObject(ret);
469
+ };
470
+
471
+ export function __wbindgen_bigint_from_i64(arg0) {
472
+ const ret = arg0;
473
+ return addHeapObject(ret);
474
+ };
475
+
476
+ export function __wbg_set_841ac57cff3d672b(arg0, arg1, arg2) {
477
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
478
+ };
479
+
480
+ export function __wbg_log_53ed96ea72ace5e9(arg0, arg1) {
481
+ console.log(getStringFromWasm0(arg0, arg1));
482
+ };
483
+
484
+ export function __wbg_error_93b671ae91baaee7(arg0, arg1) {
485
+ console.error(getStringFromWasm0(arg0, arg1));
486
+ };
487
+
488
+ export function __wbg_warn_52c5b3e773c3a056(arg0, arg1) {
489
+ console.warn(getStringFromWasm0(arg0, arg1));
490
+ };
491
+
492
+ export function __wbindgen_cb_drop(arg0) {
493
+ const obj = takeObject(arg0).original;
494
+ if (obj.cnt-- == 1) {
495
+ obj.a = 0;
496
+ return true;
497
+ }
498
+ const ret = false;
499
+ return ret;
500
+ };
501
+
502
+ export function __wbg_new_abda76e883ba8a5f() {
503
+ const ret = new Error();
504
+ return addHeapObject(ret);
505
+ };
506
+
507
+ export function __wbg_stack_658279fe44541cf6(arg0, arg1) {
508
+ const ret = getObject(arg1).stack;
509
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
510
+ const len1 = WASM_VECTOR_LEN;
511
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
512
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
513
+ };
514
+
515
+ export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
516
+ let deferred0_0;
517
+ let deferred0_1;
518
+ try {
519
+ deferred0_0 = arg0;
520
+ deferred0_1 = arg1;
521
+ console.error(getStringFromWasm0(arg0, arg1));
522
+ } finally {
523
+ wasm.__wbindgen_export_4(deferred0_0, deferred0_1, 1);
524
+ }
525
+ };
526
+
527
+ export function __wbg_instanceof_Window_9029196b662bc42a(arg0) {
528
+ let result;
529
+ try {
530
+ result = getObject(arg0) instanceof Window;
531
+ } catch {
532
+ result = false;
533
+ }
534
+ const ret = result;
535
+ return ret;
536
+ };
537
+
538
+ export function __wbg_setTimeout_eb1a0d116c26d9f6() { return handleError(function (arg0, arg1, arg2) {
539
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
540
+ return ret;
541
+ }, arguments) };
542
+
543
+ export function __wbg_crypto_c48a774b022d20ac(arg0) {
544
+ const ret = getObject(arg0).crypto;
545
+ return addHeapObject(ret);
546
+ };
547
+
548
+ export function __wbg_process_298734cf255a885d(arg0) {
549
+ const ret = getObject(arg0).process;
550
+ return addHeapObject(ret);
551
+ };
552
+
553
+ export function __wbg_versions_e2e78e134e3e5d01(arg0) {
554
+ const ret = getObject(arg0).versions;
555
+ return addHeapObject(ret);
556
+ };
557
+
558
+ export function __wbg_node_1cd7a5d853dbea79(arg0) {
559
+ const ret = getObject(arg0).node;
560
+ return addHeapObject(ret);
561
+ };
562
+
563
+ export function __wbindgen_is_string(arg0) {
564
+ const ret = typeof(getObject(arg0)) === 'string';
565
+ return ret;
566
+ };
567
+
568
+ export function __wbg_require_8f08ceecec0f4fee() { return handleError(function () {
569
+ const ret = module.require;
570
+ return addHeapObject(ret);
571
+ }, arguments) };
572
+
573
+ export function __wbg_msCrypto_bcb970640f50a1e8(arg0) {
574
+ const ret = getObject(arg0).msCrypto;
575
+ return addHeapObject(ret);
576
+ };
577
+
578
+ export function __wbg_randomFillSync_dc1e9a60c158336d() { return handleError(function (arg0, arg1) {
579
+ getObject(arg0).randomFillSync(takeObject(arg1));
580
+ }, arguments) };
581
+
582
+ export function __wbg_getRandomValues_37fa2ca9e4e07fab() { return handleError(function (arg0, arg1) {
583
+ getObject(arg0).getRandomValues(getObject(arg1));
584
+ }, arguments) };
585
+
586
+ export function __wbg_new_898a68150f225f2e() {
587
+ const ret = new Array();
588
+ return addHeapObject(ret);
589
+ };
590
+
591
+ export function __wbindgen_is_function(arg0) {
592
+ const ret = typeof(getObject(arg0)) === 'function';
593
+ return ret;
594
+ };
595
+
596
+ export function __wbg_newnoargs_581967eacc0e2604(arg0, arg1) {
597
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
598
+ return addHeapObject(ret);
599
+ };
600
+
601
+ export function __wbg_new_56693dbed0c32988() {
602
+ const ret = new Map();
603
+ return addHeapObject(ret);
604
+ };
605
+
606
+ export function __wbg_call_cb65541d95d71282() { return handleError(function (arg0, arg1) {
607
+ const ret = getObject(arg0).call(getObject(arg1));
608
+ return addHeapObject(ret);
609
+ }, arguments) };
610
+
611
+ export function __wbg_new_b51585de1b234aff() {
612
+ const ret = new Object();
613
+ return addHeapObject(ret);
614
+ };
615
+
616
+ export function __wbg_self_1ff1d729e9aae938() { return handleError(function () {
617
+ const ret = self.self;
618
+ return addHeapObject(ret);
619
+ }, arguments) };
620
+
621
+ export function __wbg_window_5f4faef6c12b79ec() { return handleError(function () {
622
+ const ret = window.window;
623
+ return addHeapObject(ret);
624
+ }, arguments) };
625
+
626
+ export function __wbg_globalThis_1d39714405582d3c() { return handleError(function () {
627
+ const ret = globalThis.globalThis;
628
+ return addHeapObject(ret);
629
+ }, arguments) };
630
+
631
+ export function __wbg_global_651f05c6a0944d1c() { return handleError(function () {
632
+ const ret = global.global;
633
+ return addHeapObject(ret);
634
+ }, arguments) };
635
+
636
+ export function __wbindgen_is_undefined(arg0) {
637
+ const ret = getObject(arg0) === undefined;
638
+ return ret;
639
+ };
640
+
641
+ export function __wbg_set_502d29070ea18557(arg0, arg1, arg2) {
642
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
643
+ };
644
+
645
+ export function __wbg_push_ca1c26067ef907ac(arg0, arg1) {
646
+ const ret = getObject(arg0).push(getObject(arg1));
647
+ return ret;
648
+ };
649
+
650
+ export function __wbg_call_01734de55d61e11d() { return handleError(function (arg0, arg1, arg2) {
651
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
652
+ return addHeapObject(ret);
653
+ }, arguments) };
654
+
655
+ export function __wbg_set_bedc3d02d0f05eb0(arg0, arg1, arg2) {
656
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
657
+ return addHeapObject(ret);
658
+ };
659
+
660
+ export function __wbg_new_43f1b47c28813cbd(arg0, arg1) {
661
+ try {
662
+ var state0 = {a: arg0, b: arg1};
663
+ var cb0 = (arg0, arg1) => {
664
+ const a = state0.a;
665
+ state0.a = 0;
666
+ try {
667
+ return __wbg_adapter_97(a, state0.b, arg0, arg1);
668
+ } finally {
669
+ state0.a = a;
670
+ }
671
+ };
672
+ const ret = new Promise(cb0);
673
+ return addHeapObject(ret);
674
+ } finally {
675
+ state0.a = state0.b = 0;
676
+ }
677
+ };
678
+
679
+ export function __wbg_resolve_53698b95aaf7fcf8(arg0) {
680
+ const ret = Promise.resolve(getObject(arg0));
681
+ return addHeapObject(ret);
682
+ };
683
+
684
+ export function __wbg_then_f7e06ee3c11698eb(arg0, arg1) {
685
+ const ret = getObject(arg0).then(getObject(arg1));
686
+ return addHeapObject(ret);
687
+ };
688
+
689
+ export function __wbg_then_b2267541e2a73865(arg0, arg1, arg2) {
690
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
691
+ return addHeapObject(ret);
692
+ };
693
+
694
+ export function __wbg_buffer_085ec1f694018c4f(arg0) {
695
+ const ret = getObject(arg0).buffer;
696
+ return addHeapObject(ret);
697
+ };
698
+
699
+ export function __wbg_newwithbyteoffsetandlength_6da8e527659b86aa(arg0, arg1, arg2) {
700
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
701
+ return addHeapObject(ret);
702
+ };
703
+
704
+ export function __wbg_new_8125e318e6245eed(arg0) {
705
+ const ret = new Uint8Array(getObject(arg0));
706
+ return addHeapObject(ret);
707
+ };
708
+
709
+ export function __wbg_set_5cf90238115182c3(arg0, arg1, arg2) {
710
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
711
+ };
712
+
713
+ export function __wbg_newwithlength_e5d69174d6984cd7(arg0) {
714
+ const ret = new Uint8Array(arg0 >>> 0);
715
+ return addHeapObject(ret);
716
+ };
717
+
718
+ export function __wbg_subarray_13db269f57aa838d(arg0, arg1, arg2) {
719
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
720
+ return addHeapObject(ret);
721
+ };
722
+
723
+ export function __wbindgen_debug_string(arg0, arg1) {
724
+ const ret = debugString(getObject(arg1));
725
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
726
+ const len1 = WASM_VECTOR_LEN;
727
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
728
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
729
+ };
730
+
731
+ export function __wbindgen_throw(arg0, arg1) {
732
+ throw new Error(getStringFromWasm0(arg0, arg1));
733
+ };
734
+
735
+ export function __wbindgen_memory() {
736
+ const ret = wasm.memory;
737
+ return addHeapObject(ret);
738
+ };
739
+
740
+ export function __wbindgen_closure_wrapper1887(arg0, arg1, arg2) {
741
+ const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_30);
742
+ return addHeapObject(ret);
743
+ };
744
+
Binary file
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "logic-mesh",
3
+ "collaborators": [
4
+ "Radu Racariu <radu.racariu@gmail.com>"
5
+ ],
6
+ "description": "Control logic engine using event based and reactive blocks written in Rust.",
7
+ "version": "0.1.1",
8
+ "license": "BSD-3-Clause",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/rracariu/logic-mesh"
12
+ },
13
+ "files": [
14
+ "logic_mesh_bg.wasm",
15
+ "logic_mesh.js",
16
+ "logic_mesh_bg.js",
17
+ "logic_mesh.d.ts"
18
+ ],
19
+ "module": "logic_mesh.js",
20
+ "types": "logic_mesh.d.ts",
21
+ "sideEffects": [
22
+ "./logic_mesh.js",
23
+ "./snippets/*"
24
+ ],
25
+ "keywords": [
26
+ "logic",
27
+ "control",
28
+ "reactive",
29
+ "wasm",
30
+ "low-code"
31
+ ]
32
+ }