logic-mesh 0.1.2 → 0.1.3
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/index.d.ts +92 -0
- package/logic_mesh.d.ts +35 -1
- package/logic_mesh_bg.js +102 -50
- package/logic_mesh_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type JsBlock = {
|
|
|
31
31
|
* The block description
|
|
32
32
|
*/
|
|
33
33
|
desc: BlockDesc
|
|
34
|
+
|
|
34
35
|
/**
|
|
35
36
|
* The block function
|
|
36
37
|
* @param inputs The block inputs that have been set
|
|
@@ -49,17 +50,24 @@ export interface BlockPin {
|
|
|
49
50
|
* The pin name
|
|
50
51
|
*/
|
|
51
52
|
name: string
|
|
53
|
+
|
|
52
54
|
/**
|
|
53
55
|
* The pin kind
|
|
54
56
|
* Must be a valid haystack type kind.
|
|
55
57
|
* See https://project-haystack.org/doc/docHaystack/Kinds
|
|
56
58
|
*/
|
|
57
59
|
kind: Kind
|
|
60
|
+
|
|
58
61
|
/**
|
|
59
62
|
* The pin value
|
|
60
63
|
* Value is a Haystack value encoded as JSON.
|
|
61
64
|
*/
|
|
62
65
|
value?: unknown
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* True if the pin is connected to another pin.
|
|
69
|
+
*/
|
|
70
|
+
isConnected?: boolean
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
/**
|
|
@@ -70,34 +78,42 @@ export interface BlockDesc {
|
|
|
70
78
|
* The block name
|
|
71
79
|
*/
|
|
72
80
|
name: string
|
|
81
|
+
|
|
73
82
|
/**
|
|
74
83
|
* The block display name
|
|
75
84
|
*/
|
|
76
85
|
dis: string
|
|
86
|
+
|
|
77
87
|
/**
|
|
78
88
|
* The block library name
|
|
79
89
|
*/
|
|
80
90
|
lib: string
|
|
91
|
+
|
|
81
92
|
/**
|
|
82
93
|
* The block library version
|
|
83
94
|
*/
|
|
84
95
|
ver: string
|
|
96
|
+
|
|
85
97
|
/**
|
|
86
98
|
* The block category
|
|
87
99
|
*/
|
|
88
100
|
category: string
|
|
101
|
+
|
|
89
102
|
/**
|
|
90
103
|
* The block documentation
|
|
91
104
|
*/
|
|
92
105
|
doc: string
|
|
106
|
+
|
|
93
107
|
/**
|
|
94
108
|
* The block implementation
|
|
95
109
|
*/
|
|
96
110
|
implementation: 'native' | 'external'
|
|
111
|
+
|
|
97
112
|
/**
|
|
98
113
|
* The block inputs
|
|
99
114
|
*/
|
|
100
115
|
inputs: BlockPin[]
|
|
116
|
+
|
|
101
117
|
/**
|
|
102
118
|
* The block outputs
|
|
103
119
|
*/
|
|
@@ -131,3 +147,79 @@ export interface BlockNotification {
|
|
|
131
147
|
value: {}
|
|
132
148
|
}[]
|
|
133
149
|
}
|
|
150
|
+
|
|
151
|
+
export interface LinkData {
|
|
152
|
+
/**
|
|
153
|
+
* The link id
|
|
154
|
+
*/
|
|
155
|
+
id?: string
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The link source block pin name
|
|
159
|
+
*/
|
|
160
|
+
sourceBlockPinName: string
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The link source block uuid
|
|
164
|
+
*/
|
|
165
|
+
sourceBlockUuid: string
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The link target block pin name
|
|
169
|
+
*/
|
|
170
|
+
targetBlockPinName: string
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The link target block uuid
|
|
174
|
+
*/
|
|
175
|
+
targetBlockUuid: string
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Describes a program that would be loaded in the engine.
|
|
180
|
+
*
|
|
181
|
+
* The program is a set of blocks and links between them.
|
|
182
|
+
* The program and the blocks have meta data that would be used in the editor
|
|
183
|
+
* for example to position the blocks.
|
|
184
|
+
*/
|
|
185
|
+
export interface Program {
|
|
186
|
+
/**
|
|
187
|
+
* The program name
|
|
188
|
+
*/
|
|
189
|
+
name: string
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Optional program description
|
|
193
|
+
*/
|
|
194
|
+
description?: string
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Blocks used in the program
|
|
198
|
+
*/
|
|
199
|
+
blocks: {
|
|
200
|
+
[blockUuid: string]: {
|
|
201
|
+
name: string
|
|
202
|
+
lib: string
|
|
203
|
+
|
|
204
|
+
positions: {
|
|
205
|
+
x: number
|
|
206
|
+
y: number
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
inputs?: {
|
|
210
|
+
[pinName: string]: { value?: unknown; isConnected?: boolean }
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
outputs?: {
|
|
214
|
+
[pinName: string]: { value?: unknown }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Links between blocks
|
|
221
|
+
*/
|
|
222
|
+
links: {
|
|
223
|
+
[linkUuid: string]: LinkData
|
|
224
|
+
}
|
|
225
|
+
}
|
package/logic_mesh.d.ts
CHANGED
|
@@ -63,9 +63,10 @@ export class EngineCommand {
|
|
|
63
63
|
* Adds a block instance to the engine
|
|
64
64
|
* to be immediately scheduled for execution
|
|
65
65
|
* @param {string} block_name
|
|
66
|
+
* @param {string | undefined} block_uuid
|
|
66
67
|
* @returns {Promise<string>}
|
|
67
68
|
*/
|
|
68
|
-
addBlock(block_name: string): Promise<string>;
|
|
69
|
+
addBlock(block_name: string, block_uuid?: string): Promise<string>;
|
|
69
70
|
/**
|
|
70
71
|
* Removes a block instance from the engine
|
|
71
72
|
* to be immediately unscheduled for execution
|
|
@@ -131,6 +132,22 @@ export class EngineCommand {
|
|
|
131
132
|
*/
|
|
132
133
|
writeBlockOutput(block_uuid: string, output_name: string, value: any): Promise<any>;
|
|
133
134
|
/**
|
|
135
|
+
* Writes the given block input with a value
|
|
136
|
+
*
|
|
137
|
+
* # Arguments
|
|
138
|
+
* * `block_uuid` - The UUID of the block to write to
|
|
139
|
+
* * `input_name` - The name of the input to write to
|
|
140
|
+
* * `value` - The value to write
|
|
141
|
+
*
|
|
142
|
+
* # Returns
|
|
143
|
+
* The previous value of the input
|
|
144
|
+
* @param {string} block_uuid
|
|
145
|
+
* @param {string} input_name
|
|
146
|
+
* @param {any} value
|
|
147
|
+
* @returns {Promise<any>}
|
|
148
|
+
*/
|
|
149
|
+
writeBlockInput(block_uuid: string, input_name: string, value: any): Promise<any>;
|
|
150
|
+
/**
|
|
134
151
|
* Get the current running engine program.
|
|
135
152
|
* The program contains the scheduled blocks, their properties, and their links.
|
|
136
153
|
* @returns {Promise<any>}
|
|
@@ -148,4 +165,21 @@ export class EngineCommand {
|
|
|
148
165
|
* @returns {Promise<any>}
|
|
149
166
|
*/
|
|
150
167
|
createWatch(callback: Function): Promise<any>;
|
|
168
|
+
/**
|
|
169
|
+
* Pauses the execution of the engine
|
|
170
|
+
* If the engine is already paused, this does nothing
|
|
171
|
+
* @returns {Promise<void>}
|
|
172
|
+
*/
|
|
173
|
+
pauseExecution(): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Resumes the execution of the engine
|
|
176
|
+
* If the engine is not paused, this does nothing
|
|
177
|
+
* @returns {Promise<void>}
|
|
178
|
+
*/
|
|
179
|
+
resumeExecution(): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Resets the engine state, clears all blocks and links
|
|
182
|
+
* @returns {Promise<void>}
|
|
183
|
+
*/
|
|
184
|
+
resetEngine(): Promise<void>;
|
|
151
185
|
}
|
package/logic_mesh_bg.js
CHANGED
|
@@ -24,6 +24,35 @@ function takeObject(idx) {
|
|
|
24
24
|
return ret;
|
|
25
25
|
}
|
|
26
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
|
+
|
|
27
56
|
function isLikeNone(x) {
|
|
28
57
|
return x === undefined || x === null;
|
|
29
58
|
}
|
|
@@ -46,26 +75,8 @@ function getInt32Memory0() {
|
|
|
46
75
|
return cachedInt32Memory0;
|
|
47
76
|
}
|
|
48
77
|
|
|
49
|
-
function addHeapObject(obj) {
|
|
50
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
51
|
-
const idx = heap_next;
|
|
52
|
-
heap_next = heap[idx];
|
|
53
|
-
|
|
54
|
-
heap[idx] = obj;
|
|
55
|
-
return idx;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
78
|
let WASM_VECTOR_LEN = 0;
|
|
59
79
|
|
|
60
|
-
let cachedUint8Memory0 = null;
|
|
61
|
-
|
|
62
|
-
function getUint8Memory0() {
|
|
63
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
64
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
65
|
-
}
|
|
66
|
-
return cachedUint8Memory0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
80
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
70
81
|
|
|
71
82
|
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
@@ -121,17 +132,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
121
132
|
return ptr;
|
|
122
133
|
}
|
|
123
134
|
|
|
124
|
-
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
125
|
-
|
|
126
|
-
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
127
|
-
|
|
128
|
-
cachedTextDecoder.decode();
|
|
129
|
-
|
|
130
|
-
function getStringFromWasm0(ptr, len) {
|
|
131
|
-
ptr = ptr >>> 0;
|
|
132
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
135
|
let cachedBigInt64Memory0 = null;
|
|
136
136
|
|
|
137
137
|
function getBigInt64Memory0() {
|
|
@@ -261,7 +261,7 @@ function handleError(f, args) {
|
|
|
261
261
|
wasm.__wbindgen_export_5(addHeapObject(e));
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function __wbg_adapter_149(arg0, arg1, arg2, arg3) {
|
|
265
265
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -391,12 +391,15 @@ export class EngineCommand {
|
|
|
391
391
|
* Adds a block instance to the engine
|
|
392
392
|
* to be immediately scheduled for execution
|
|
393
393
|
* @param {string} block_name
|
|
394
|
+
* @param {string | undefined} block_uuid
|
|
394
395
|
* @returns {Promise<string>}
|
|
395
396
|
*/
|
|
396
|
-
addBlock(block_name) {
|
|
397
|
+
addBlock(block_name, block_uuid) {
|
|
397
398
|
const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
398
399
|
const len0 = WASM_VECTOR_LEN;
|
|
399
|
-
|
|
400
|
+
var ptr1 = isLikeNone(block_uuid) ? 0 : passStringToWasm0(block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
401
|
+
var len1 = WASM_VECTOR_LEN;
|
|
402
|
+
const ret = wasm.enginecommand_addBlock(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
400
403
|
return takeObject(ret);
|
|
401
404
|
}
|
|
402
405
|
/**
|
|
@@ -492,6 +495,29 @@ export class EngineCommand {
|
|
|
492
495
|
return takeObject(ret);
|
|
493
496
|
}
|
|
494
497
|
/**
|
|
498
|
+
* Writes the given block input with a value
|
|
499
|
+
*
|
|
500
|
+
* # Arguments
|
|
501
|
+
* * `block_uuid` - The UUID of the block to write to
|
|
502
|
+
* * `input_name` - The name of the input to write to
|
|
503
|
+
* * `value` - The value to write
|
|
504
|
+
*
|
|
505
|
+
* # Returns
|
|
506
|
+
* The previous value of the input
|
|
507
|
+
* @param {string} block_uuid
|
|
508
|
+
* @param {string} input_name
|
|
509
|
+
* @param {any} value
|
|
510
|
+
* @returns {Promise<any>}
|
|
511
|
+
*/
|
|
512
|
+
writeBlockInput(block_uuid, input_name, value) {
|
|
513
|
+
const ptr0 = passStringToWasm0(block_uuid, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
514
|
+
const len0 = WASM_VECTOR_LEN;
|
|
515
|
+
const ptr1 = passStringToWasm0(input_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
516
|
+
const len1 = WASM_VECTOR_LEN;
|
|
517
|
+
const ret = wasm.enginecommand_writeBlockInput(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(value));
|
|
518
|
+
return takeObject(ret);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
495
521
|
* Get the current running engine program.
|
|
496
522
|
* The program contains the scheduled blocks, their properties, and their links.
|
|
497
523
|
* @returns {Promise<any>}
|
|
@@ -520,6 +546,32 @@ export class EngineCommand {
|
|
|
520
546
|
const ret = wasm.enginecommand_createWatch(this.__wbg_ptr, addHeapObject(callback));
|
|
521
547
|
return takeObject(ret);
|
|
522
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Pauses the execution of the engine
|
|
551
|
+
* If the engine is already paused, this does nothing
|
|
552
|
+
* @returns {Promise<void>}
|
|
553
|
+
*/
|
|
554
|
+
pauseExecution() {
|
|
555
|
+
const ret = wasm.enginecommand_pauseExecution(this.__wbg_ptr);
|
|
556
|
+
return takeObject(ret);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Resumes the execution of the engine
|
|
560
|
+
* If the engine is not paused, this does nothing
|
|
561
|
+
* @returns {Promise<void>}
|
|
562
|
+
*/
|
|
563
|
+
resumeExecution() {
|
|
564
|
+
const ret = wasm.enginecommand_resumeExecution(this.__wbg_ptr);
|
|
565
|
+
return takeObject(ret);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Resets the engine state, clears all blocks and links
|
|
569
|
+
* @returns {Promise<void>}
|
|
570
|
+
*/
|
|
571
|
+
resetEngine() {
|
|
572
|
+
const ret = wasm.enginecommand_resetEngine(this.__wbg_ptr);
|
|
573
|
+
return takeObject(ret);
|
|
574
|
+
}
|
|
523
575
|
}
|
|
524
576
|
|
|
525
577
|
export function __wbindgen_object_drop_ref(arg0) {
|
|
@@ -531,6 +583,21 @@ export function __wbindgen_is_array(arg0) {
|
|
|
531
583
|
return ret;
|
|
532
584
|
};
|
|
533
585
|
|
|
586
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
|
587
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
588
|
+
return addHeapObject(ret);
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
export function __wbindgen_error_new(arg0, arg1) {
|
|
592
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
593
|
+
return addHeapObject(ret);
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export function __wbindgen_object_clone_ref(arg0) {
|
|
597
|
+
const ret = getObject(arg0);
|
|
598
|
+
return addHeapObject(ret);
|
|
599
|
+
};
|
|
600
|
+
|
|
534
601
|
export function __wbindgen_is_undefined(arg0) {
|
|
535
602
|
const ret = getObject(arg0) === undefined;
|
|
536
603
|
return ret;
|
|
@@ -589,21 +656,6 @@ export function __wbindgen_bigint_from_u64(arg0) {
|
|
|
589
656
|
return addHeapObject(ret);
|
|
590
657
|
};
|
|
591
658
|
|
|
592
|
-
export function __wbindgen_error_new(arg0, arg1) {
|
|
593
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
594
|
-
return addHeapObject(ret);
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
export function __wbindgen_string_new(arg0, arg1) {
|
|
598
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
599
|
-
return addHeapObject(ret);
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
export function __wbindgen_object_clone_ref(arg0) {
|
|
603
|
-
const ret = getObject(arg0);
|
|
604
|
-
return addHeapObject(ret);
|
|
605
|
-
};
|
|
606
|
-
|
|
607
659
|
export function __wbindgen_jsval_loose_eq(arg0, arg1) {
|
|
608
660
|
const ret = getObject(arg0) == getObject(arg1);
|
|
609
661
|
return ret;
|
|
@@ -879,7 +931,7 @@ export function __wbg_new_43f1b47c28813cbd(arg0, arg1) {
|
|
|
879
931
|
const a = state0.a;
|
|
880
932
|
state0.a = 0;
|
|
881
933
|
try {
|
|
882
|
-
return
|
|
934
|
+
return __wbg_adapter_149(a, state0.b, arg0, arg1);
|
|
883
935
|
} finally {
|
|
884
936
|
state0.a = a;
|
|
885
937
|
}
|
|
@@ -975,8 +1027,8 @@ export function __wbindgen_memory() {
|
|
|
975
1027
|
return addHeapObject(ret);
|
|
976
1028
|
};
|
|
977
1029
|
|
|
978
|
-
export function
|
|
979
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1030
|
+
export function __wbindgen_closure_wrapper2599(arg0, arg1, arg2) {
|
|
1031
|
+
const ret = makeMutClosure(arg0, arg1, 966, __wbg_adapter_50);
|
|
980
1032
|
return addHeapObject(ret);
|
|
981
1033
|
};
|
|
982
1034
|
|
package/logic_mesh_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED