hakuban 0.7.3 → 0.8.0
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/README.md +23 -24
- package/hakuban-with-wasm.js +806 -1329
- package/hakuban-with-wasm.js.map +1 -1
- package/hakuban-with-wasm.min.js +1 -1
- package/hakuban-with-wasm.min.js.map +1 -1
- package/hakuban.js +804 -1322
- package/hakuban.js.map +1 -1
- package/hakuban.min.js +1 -1
- package/hakuban.min.js.map +1 -1
- package/hakuban.wasm +0 -0
- package/package.json +5 -6
package/hakuban.js
CHANGED
|
@@ -1,54 +1,40 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let cachedUint8Memory0 = new Uint8Array();
|
|
8
|
-
|
|
9
|
-
function getUint8Memory0() {
|
|
10
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
11
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
-
}
|
|
13
|
-
return cachedUint8Memory0;
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
6
|
+
return idx;
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
function
|
|
17
|
-
|
|
9
|
+
function handleError(f, args) {
|
|
10
|
+
try {
|
|
11
|
+
return f.apply(this, args);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
const idx = addToExternrefTable0(e);
|
|
14
|
+
wasm.__wbindgen_exn_store(idx);
|
|
15
|
+
}
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
heap.push(undefined, null, true, false);
|
|
23
|
-
|
|
24
|
-
let heap_next = heap.length;
|
|
25
|
-
|
|
26
|
-
function addHeapObject(obj) {
|
|
27
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
-
const idx = heap_next;
|
|
29
|
-
heap_next = heap[idx];
|
|
18
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
30
19
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
20
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
|
|
21
|
+
let cachedUint8ArrayMemory0 = null;
|
|
34
22
|
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
heap_next = idx;
|
|
23
|
+
function getUint8ArrayMemory0() {
|
|
24
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
25
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
26
|
+
}
|
|
27
|
+
return cachedUint8ArrayMemory0;
|
|
41
28
|
}
|
|
42
29
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return ret;
|
|
30
|
+
function getStringFromWasm0(ptr, len) {
|
|
31
|
+
ptr = ptr >>> 0;
|
|
32
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
47
33
|
}
|
|
48
34
|
|
|
49
35
|
let WASM_VECTOR_LEN = 0;
|
|
50
36
|
|
|
51
|
-
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
37
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
52
38
|
|
|
53
39
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
54
40
|
? function (arg, view) {
|
|
@@ -67,16 +53,16 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
67
53
|
|
|
68
54
|
if (realloc === undefined) {
|
|
69
55
|
const buf = cachedTextEncoder.encode(arg);
|
|
70
|
-
const ptr = malloc(buf.length);
|
|
71
|
-
|
|
56
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
57
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
72
58
|
WASM_VECTOR_LEN = buf.length;
|
|
73
59
|
return ptr;
|
|
74
60
|
}
|
|
75
61
|
|
|
76
62
|
let len = arg.length;
|
|
77
|
-
let ptr = malloc(len);
|
|
63
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
78
64
|
|
|
79
|
-
const mem =
|
|
65
|
+
const mem = getUint8ArrayMemory0();
|
|
80
66
|
|
|
81
67
|
let offset = 0;
|
|
82
68
|
|
|
@@ -90,338 +76,283 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
90
76
|
if (offset !== 0) {
|
|
91
77
|
arg = arg.slice(offset);
|
|
92
78
|
}
|
|
93
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
94
|
-
const view =
|
|
79
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
80
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
95
81
|
const ret = encodeString(arg, view);
|
|
96
82
|
|
|
97
83
|
offset += ret.written;
|
|
84
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
98
85
|
}
|
|
99
86
|
|
|
100
87
|
WASM_VECTOR_LEN = offset;
|
|
101
88
|
return ptr;
|
|
102
89
|
}
|
|
103
90
|
|
|
91
|
+
let cachedDataViewMemory0 = null;
|
|
92
|
+
|
|
93
|
+
function getDataViewMemory0() {
|
|
94
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
95
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
96
|
+
}
|
|
97
|
+
return cachedDataViewMemory0;
|
|
98
|
+
}
|
|
99
|
+
|
|
104
100
|
function isLikeNone(x) {
|
|
105
101
|
return x === undefined || x === null;
|
|
106
102
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} default_log_level
|
|
105
|
+
* @returns {WasmResult}
|
|
106
|
+
*/
|
|
107
|
+
function hakuban_logger_initialize(default_log_level) {
|
|
108
|
+
const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
110
|
+
const ret = wasm.hakuban_logger_initialize(ptr0, len0);
|
|
111
|
+
return WasmResult.__wrap(ret);
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (type == 'symbol') {
|
|
127
|
-
const description = val.description;
|
|
128
|
-
if (description == null) {
|
|
129
|
-
return 'Symbol';
|
|
130
|
-
} else {
|
|
131
|
-
return `Symbol(${description})`;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (type == 'function') {
|
|
135
|
-
const name = val.name;
|
|
136
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
137
|
-
return `Function(${name})`;
|
|
138
|
-
} else {
|
|
139
|
-
return 'Function';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// objects
|
|
143
|
-
if (Array.isArray(val)) {
|
|
144
|
-
const length = val.length;
|
|
145
|
-
let debug = '[';
|
|
146
|
-
if (length > 0) {
|
|
147
|
-
debug += debugString(val[0]);
|
|
148
|
-
}
|
|
149
|
-
for(let i = 1; i < length; i++) {
|
|
150
|
-
debug += ', ' + debugString(val[i]);
|
|
151
|
-
}
|
|
152
|
-
debug += ']';
|
|
153
|
-
return debug;
|
|
154
|
-
}
|
|
155
|
-
// Test for built-in
|
|
156
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
157
|
-
let className;
|
|
158
|
-
if (builtInMatches.length > 1) {
|
|
159
|
-
className = builtInMatches[1];
|
|
160
|
-
} else {
|
|
161
|
-
// Failed to match the standard '[object ClassName]'
|
|
162
|
-
return toString.call(val);
|
|
163
|
-
}
|
|
164
|
-
if (className == 'Object') {
|
|
165
|
-
// we're a user defined class or Object
|
|
166
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
167
|
-
// easier than looping through ownProperties of `val`.
|
|
168
|
-
try {
|
|
169
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
170
|
-
} catch (_) {
|
|
171
|
-
return 'Object';
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// errors
|
|
175
|
-
if (val instanceof Error) {
|
|
176
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
177
|
-
}
|
|
178
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
179
|
-
return className;
|
|
114
|
+
/**
|
|
115
|
+
* @param {number} exchange
|
|
116
|
+
* @param {number} descriptor
|
|
117
|
+
* @param {number} capacity
|
|
118
|
+
* @returns {number}
|
|
119
|
+
*/
|
|
120
|
+
function hakuban_object_expose_contract_new(exchange, descriptor, capacity) {
|
|
121
|
+
const ret = wasm.hakuban_object_expose_contract_new(exchange, descriptor, capacity);
|
|
122
|
+
return ret >>> 0;
|
|
180
123
|
}
|
|
124
|
+
|
|
181
125
|
/**
|
|
182
|
-
* @param {number}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
function hakuban_tag_expose_contract_new(local_exchange, descriptor) {
|
|
187
|
-
const ret = wasm.hakuban_tag_expose_contract_new(local_exchange, descriptor);
|
|
188
|
-
return ret;
|
|
126
|
+
* @param {number} object_ptr
|
|
127
|
+
*/
|
|
128
|
+
function hakuban_object_expose_contract_drop(object_ptr) {
|
|
129
|
+
wasm.hakuban_object_expose_contract_drop(object_ptr);
|
|
189
130
|
}
|
|
190
131
|
|
|
191
132
|
/**
|
|
192
|
-
* @param {number}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
133
|
+
* @param {number} object_expose_pointer
|
|
134
|
+
* @returns {number}
|
|
135
|
+
*/
|
|
136
|
+
function hakuban_object_expose_contract_next(object_expose_pointer) {
|
|
137
|
+
const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
|
|
138
|
+
return ret >>> 0;
|
|
196
139
|
}
|
|
197
140
|
|
|
198
141
|
/**
|
|
199
|
-
* @param {number}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
142
|
+
* @param {number} exchange
|
|
143
|
+
* @param {number} descriptor
|
|
144
|
+
* @returns {number}
|
|
145
|
+
*/
|
|
146
|
+
function hakuban_object_observe_contract_new(exchange, descriptor) {
|
|
147
|
+
const ret = wasm.hakuban_object_observe_contract_new(exchange, descriptor);
|
|
148
|
+
return ret >>> 0;
|
|
203
149
|
}
|
|
204
150
|
|
|
205
151
|
/**
|
|
206
|
-
* @param {number}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
|
|
211
|
-
return ret;
|
|
152
|
+
* @param {number} object_ptr
|
|
153
|
+
*/
|
|
154
|
+
function hakuban_object_observe_contract_drop(object_ptr) {
|
|
155
|
+
wasm.hakuban_object_observe_contract_drop(object_ptr);
|
|
212
156
|
}
|
|
213
157
|
|
|
214
|
-
|
|
158
|
+
/**
|
|
159
|
+
* @param {number} object_observe_pointer
|
|
160
|
+
* @returns {number}
|
|
161
|
+
*/
|
|
162
|
+
function hakuban_object_observe_contract_next(object_observe_pointer) {
|
|
163
|
+
const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
|
|
164
|
+
return ret >>> 0;
|
|
165
|
+
}
|
|
215
166
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
167
|
+
/**
|
|
168
|
+
* @param {number} object_state_sink_pointer
|
|
169
|
+
* @returns {number}
|
|
170
|
+
*/
|
|
171
|
+
function hakuban_object_state_sink_descriptor(object_state_sink_pointer) {
|
|
172
|
+
const ret = wasm.hakuban_object_state_sink_descriptor(object_state_sink_pointer);
|
|
173
|
+
return ret >>> 0;
|
|
221
174
|
}
|
|
222
175
|
|
|
223
|
-
|
|
224
|
-
|
|
176
|
+
/**
|
|
177
|
+
* @param {number} object_state_sink_pointer
|
|
178
|
+
*/
|
|
179
|
+
function hakuban_object_state_sink_drop(object_state_sink_pointer) {
|
|
180
|
+
wasm.hakuban_object_state_sink_drop(object_state_sink_pointer);
|
|
225
181
|
}
|
|
182
|
+
|
|
226
183
|
/**
|
|
227
|
-
* @param {number}
|
|
228
|
-
* @returns {
|
|
229
|
-
*/
|
|
230
|
-
function
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
wasm.hakuban_tag_expose_contract_ready(retptr, tag_expose_pointer);
|
|
234
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
-
var v0 = getArrayU32FromWasm0(r0, r1).slice();
|
|
237
|
-
wasm.__wbindgen_free(r0, r1 * 4);
|
|
238
|
-
return v0;
|
|
239
|
-
} finally {
|
|
240
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
-
}
|
|
184
|
+
* @param {number} object_state_sink_pointer
|
|
185
|
+
* @returns {number}
|
|
186
|
+
*/
|
|
187
|
+
function hakuban_object_state_sink_next(object_state_sink_pointer) {
|
|
188
|
+
const ret = wasm.hakuban_object_state_sink_next(object_state_sink_pointer);
|
|
189
|
+
return ret >>> 0;
|
|
242
190
|
}
|
|
243
191
|
|
|
244
192
|
/**
|
|
245
|
-
* @param {number}
|
|
246
|
-
* @param {number}
|
|
247
|
-
* @returns {number}
|
|
248
|
-
*/
|
|
249
|
-
function
|
|
250
|
-
const ret = wasm.
|
|
251
|
-
return ret;
|
|
193
|
+
* @param {number} object_state_sink_pointer
|
|
194
|
+
* @param {number} object_state_pointer
|
|
195
|
+
* @returns {number}
|
|
196
|
+
*/
|
|
197
|
+
function hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer) {
|
|
198
|
+
const ret = wasm.hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer);
|
|
199
|
+
return ret >>> 0;
|
|
252
200
|
}
|
|
253
201
|
|
|
254
202
|
/**
|
|
255
|
-
* @param {number}
|
|
256
|
-
*/
|
|
257
|
-
function
|
|
258
|
-
wasm.
|
|
203
|
+
* @param {number} object_state_sink_params_pointer
|
|
204
|
+
*/
|
|
205
|
+
function hakuban_object_state_sink_params_drop(object_state_sink_params_pointer) {
|
|
206
|
+
wasm.hakuban_object_state_sink_params_drop(object_state_sink_params_pointer);
|
|
259
207
|
}
|
|
260
208
|
|
|
261
209
|
/**
|
|
262
|
-
* @param {number}
|
|
263
|
-
*/
|
|
264
|
-
function
|
|
265
|
-
wasm.
|
|
210
|
+
* @param {number} object_state_stream_pointer
|
|
211
|
+
*/
|
|
212
|
+
function hakuban_object_state_stream_drop(object_state_stream_pointer) {
|
|
213
|
+
wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
|
|
266
214
|
}
|
|
267
215
|
|
|
268
216
|
/**
|
|
269
|
-
* @param {number}
|
|
270
|
-
* @returns {number}
|
|
271
|
-
*/
|
|
272
|
-
function
|
|
273
|
-
const ret = wasm.
|
|
274
|
-
return ret;
|
|
217
|
+
* @param {number} object_state_stream_pointer
|
|
218
|
+
* @returns {number}
|
|
219
|
+
*/
|
|
220
|
+
function hakuban_object_state_stream_next(object_state_stream_pointer) {
|
|
221
|
+
const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
|
|
222
|
+
return ret >>> 0;
|
|
275
223
|
}
|
|
276
224
|
|
|
277
225
|
/**
|
|
278
|
-
* @param {number}
|
|
279
|
-
* @returns {
|
|
280
|
-
*/
|
|
281
|
-
function
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
wasm.hakuban_tag_observe_contract_ready(retptr, tag_observe_pointer);
|
|
285
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
286
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
287
|
-
var v0 = getArrayU32FromWasm0(r0, r1).slice();
|
|
288
|
-
wasm.__wbindgen_free(r0, r1 * 4);
|
|
289
|
-
return v0;
|
|
290
|
-
} finally {
|
|
291
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
292
|
-
}
|
|
226
|
+
* @param {number} object_state_stream_pointer
|
|
227
|
+
* @returns {number}
|
|
228
|
+
*/
|
|
229
|
+
function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
|
|
230
|
+
const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
|
|
231
|
+
return ret >>> 0;
|
|
293
232
|
}
|
|
294
233
|
|
|
295
234
|
/**
|
|
296
|
-
* @param {
|
|
297
|
-
* @
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
return WasmResultWithPointer.__wrap(ret);
|
|
235
|
+
* @param {number} exchange
|
|
236
|
+
* @param {number} descriptor
|
|
237
|
+
* @returns {number}
|
|
238
|
+
*/
|
|
239
|
+
function hakuban_tag_observe_contract_new(exchange, descriptor) {
|
|
240
|
+
const ret = wasm.hakuban_tag_observe_contract_new(exchange, descriptor);
|
|
241
|
+
return ret >>> 0;
|
|
304
242
|
}
|
|
305
243
|
|
|
306
244
|
/**
|
|
307
|
-
* @param {number}
|
|
308
|
-
*/
|
|
309
|
-
function
|
|
310
|
-
wasm.
|
|
245
|
+
* @param {number} tag_pointer
|
|
246
|
+
*/
|
|
247
|
+
function hakuban_tag_observe_contract_drop(tag_pointer) {
|
|
248
|
+
wasm.hakuban_tag_observe_contract_drop(tag_pointer);
|
|
311
249
|
}
|
|
312
250
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
251
|
+
/**
|
|
252
|
+
* @param {number} tag_observe_pointer
|
|
253
|
+
* @returns {number}
|
|
254
|
+
*/
|
|
255
|
+
function hakuban_tag_observe_contract_next(tag_observe_pointer) {
|
|
256
|
+
const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
|
|
257
|
+
return ret >>> 0;
|
|
318
258
|
}
|
|
259
|
+
|
|
319
260
|
/**
|
|
320
|
-
* @param {
|
|
321
|
-
* @param {
|
|
322
|
-
* @
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
261
|
+
* @param {number} exchange_pointer
|
|
262
|
+
* @param {string} local_name
|
|
263
|
+
* @param {string} local_address
|
|
264
|
+
* @returns {number}
|
|
265
|
+
*/
|
|
266
|
+
function hakuban_upstream_connection_new(exchange_pointer, local_name, local_address) {
|
|
267
|
+
const ptr0 = passStringToWasm0(local_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
326
268
|
const len0 = WASM_VECTOR_LEN;
|
|
327
|
-
const ptr1 =
|
|
269
|
+
const ptr1 = passStringToWasm0(local_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
328
270
|
const len1 = WASM_VECTOR_LEN;
|
|
329
|
-
const ret = wasm.
|
|
330
|
-
return
|
|
271
|
+
const ret = wasm.hakuban_upstream_connection_new(exchange_pointer, ptr0, len0, ptr1, len1);
|
|
272
|
+
return ret >>> 0;
|
|
331
273
|
}
|
|
332
274
|
|
|
333
275
|
/**
|
|
334
|
-
* @param {number}
|
|
335
|
-
*/
|
|
336
|
-
function
|
|
337
|
-
wasm.
|
|
276
|
+
* @param {number} wasm_upstream_connection
|
|
277
|
+
*/
|
|
278
|
+
function hakuban_upstream_connection_drop(wasm_upstream_connection) {
|
|
279
|
+
wasm.hakuban_upstream_connection_drop(wasm_upstream_connection);
|
|
338
280
|
}
|
|
339
281
|
|
|
340
282
|
/**
|
|
341
|
-
* @param {number}
|
|
342
|
-
* @returns {
|
|
343
|
-
*/
|
|
344
|
-
function
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
wasm.hakuban_object_descriptor_json(retptr, descriptor_pointer);
|
|
348
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
349
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
350
|
-
return getStringFromWasm0(r0, r1);
|
|
351
|
-
} finally {
|
|
352
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
353
|
-
wasm.__wbindgen_free(r0, r1);
|
|
354
|
-
}
|
|
283
|
+
* @param {number} wasm_upstream_connection
|
|
284
|
+
* @returns {number}
|
|
285
|
+
*/
|
|
286
|
+
function hakuban_upstream_connection_next_message_to_network(wasm_upstream_connection) {
|
|
287
|
+
const ret = wasm.hakuban_upstream_connection_next_message_to_network(wasm_upstream_connection);
|
|
288
|
+
return ret >>> 0;
|
|
355
289
|
}
|
|
356
290
|
|
|
291
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
292
|
+
ptr = ptr >>> 0;
|
|
293
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
294
|
+
}
|
|
357
295
|
/**
|
|
358
|
-
* @param {number}
|
|
359
|
-
* @returns {
|
|
360
|
-
*/
|
|
361
|
-
function
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
367
|
-
var v0 = getArrayU32FromWasm0(r0, r1).slice();
|
|
368
|
-
wasm.__wbindgen_free(r0, r1 * 4);
|
|
369
|
-
return v0;
|
|
370
|
-
} finally {
|
|
371
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
372
|
-
}
|
|
296
|
+
* @param {number} message_pointer
|
|
297
|
+
* @returns {Uint8Array}
|
|
298
|
+
*/
|
|
299
|
+
function hakuban_message_serialize(message_pointer) {
|
|
300
|
+
const ret = wasm.hakuban_message_serialize(message_pointer);
|
|
301
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
302
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
303
|
+
return v1;
|
|
373
304
|
}
|
|
374
305
|
|
|
306
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
307
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
308
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
309
|
+
WASM_VECTOR_LEN = arg.length;
|
|
310
|
+
return ptr;
|
|
311
|
+
}
|
|
375
312
|
/**
|
|
376
|
-
* @param {
|
|
377
|
-
* @
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
313
|
+
* @param {number} wasm_upstream_connection
|
|
314
|
+
* @param {Uint8Array} message_data
|
|
315
|
+
* @returns {number}
|
|
316
|
+
*/
|
|
317
|
+
function hakuban_upstream_connection_send_message_from_network(wasm_upstream_connection, message_data) {
|
|
318
|
+
const ptr0 = passArray8ToWasm0(message_data, wasm.__wbindgen_malloc);
|
|
381
319
|
const len0 = WASM_VECTOR_LEN;
|
|
382
|
-
const ret = wasm.
|
|
320
|
+
const ret = wasm.hakuban_upstream_connection_send_message_from_network(wasm_upstream_connection, ptr0, len0);
|
|
383
321
|
return ret >>> 0;
|
|
384
322
|
}
|
|
385
323
|
|
|
386
|
-
let
|
|
324
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
387
325
|
|
|
388
|
-
function
|
|
389
|
-
if (
|
|
390
|
-
|
|
326
|
+
function getBigUint64ArrayMemory0() {
|
|
327
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
328
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
391
329
|
}
|
|
392
|
-
return
|
|
330
|
+
return cachedBigUint64ArrayMemory0;
|
|
393
331
|
}
|
|
394
332
|
|
|
395
333
|
function passArray64ToWasm0(arg, malloc) {
|
|
396
|
-
const ptr = malloc(arg.length * 8);
|
|
397
|
-
|
|
334
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
335
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
398
336
|
WASM_VECTOR_LEN = arg.length;
|
|
399
337
|
return ptr;
|
|
400
338
|
}
|
|
401
339
|
|
|
402
340
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
403
|
-
const ptr = malloc(array.length * 4);
|
|
404
|
-
const mem = getUint32Memory0();
|
|
341
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
405
342
|
for (let i = 0; i < array.length; i++) {
|
|
406
|
-
|
|
343
|
+
const add = addToExternrefTable0(array[i]);
|
|
344
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
407
345
|
}
|
|
408
346
|
WASM_VECTOR_LEN = array.length;
|
|
409
347
|
return ptr;
|
|
410
348
|
}
|
|
411
|
-
|
|
412
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
413
|
-
const ptr = malloc(arg.length * 1);
|
|
414
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
415
|
-
WASM_VECTOR_LEN = arg.length;
|
|
416
|
-
return ptr;
|
|
417
|
-
}
|
|
418
349
|
/**
|
|
419
|
-
* @param {BigInt64Array} version
|
|
420
|
-
* @param {any[]} format_jsvalues
|
|
421
|
-
* @param {Uint8Array} data
|
|
422
|
-
* @param {bigint} synchronized_us_ago
|
|
423
|
-
* @returns {
|
|
424
|
-
*/
|
|
350
|
+
* @param {BigInt64Array} version
|
|
351
|
+
* @param {any[]} format_jsvalues
|
|
352
|
+
* @param {Uint8Array} data
|
|
353
|
+
* @param {bigint} synchronized_us_ago
|
|
354
|
+
* @returns {WasmResult}
|
|
355
|
+
*/
|
|
425
356
|
function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
|
|
426
357
|
const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
|
|
427
358
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -430,509 +361,332 @@ function hakuban_object_state_new(version, format_jsvalues, data, synchronized_u
|
|
|
430
361
|
const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
431
362
|
const len2 = WASM_VECTOR_LEN;
|
|
432
363
|
const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
|
|
433
|
-
return
|
|
364
|
+
return WasmResult.__wrap(ret);
|
|
434
365
|
}
|
|
435
366
|
|
|
436
367
|
/**
|
|
437
|
-
* @param {number} object_state_pointer
|
|
438
|
-
*/
|
|
368
|
+
* @param {number} object_state_pointer
|
|
369
|
+
*/
|
|
439
370
|
function hakuban_object_state_drop(object_state_pointer) {
|
|
440
371
|
wasm.hakuban_object_state_drop(object_state_pointer);
|
|
441
372
|
}
|
|
442
373
|
|
|
443
|
-
let
|
|
374
|
+
let cachedBigInt64ArrayMemory0 = null;
|
|
444
375
|
|
|
445
|
-
function
|
|
446
|
-
if (
|
|
447
|
-
|
|
376
|
+
function getBigInt64ArrayMemory0() {
|
|
377
|
+
if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
|
|
378
|
+
cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
|
|
448
379
|
}
|
|
449
|
-
return
|
|
380
|
+
return cachedBigInt64ArrayMemory0;
|
|
450
381
|
}
|
|
451
382
|
|
|
452
383
|
function getArrayI64FromWasm0(ptr, len) {
|
|
453
|
-
|
|
384
|
+
ptr = ptr >>> 0;
|
|
385
|
+
return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
454
386
|
}
|
|
455
387
|
/**
|
|
456
|
-
* @param {number} object_state_pointer
|
|
457
|
-
* @returns {BigInt64Array}
|
|
458
|
-
*/
|
|
388
|
+
* @param {number} object_state_pointer
|
|
389
|
+
* @returns {BigInt64Array}
|
|
390
|
+
*/
|
|
459
391
|
function hakuban_object_state_version(object_state_pointer) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
465
|
-
var v0 = getArrayI64FromWasm0(r0, r1).slice();
|
|
466
|
-
wasm.__wbindgen_free(r0, r1 * 8);
|
|
467
|
-
return v0;
|
|
468
|
-
} finally {
|
|
469
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
470
|
-
}
|
|
392
|
+
const ret = wasm.hakuban_object_state_version(object_state_pointer);
|
|
393
|
+
var v1 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
|
|
394
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
395
|
+
return v1;
|
|
471
396
|
}
|
|
472
397
|
|
|
473
398
|
/**
|
|
474
|
-
* @param {number} object_state_pointer
|
|
475
|
-
* @returns {bigint}
|
|
476
|
-
*/
|
|
399
|
+
* @param {number} object_state_pointer
|
|
400
|
+
* @returns {bigint}
|
|
401
|
+
*/
|
|
477
402
|
function hakuban_object_state_synchronized_ago(object_state_pointer) {
|
|
478
403
|
const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
|
|
479
404
|
return BigInt.asUintN(64, ret);
|
|
480
405
|
}
|
|
481
406
|
|
|
482
407
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
483
|
-
|
|
484
|
-
const
|
|
408
|
+
ptr = ptr >>> 0;
|
|
409
|
+
const mem = getDataViewMemory0();
|
|
485
410
|
const result = [];
|
|
486
|
-
for (let i =
|
|
487
|
-
result.push(
|
|
411
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
412
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
488
413
|
}
|
|
414
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
489
415
|
return result;
|
|
490
416
|
}
|
|
491
417
|
/**
|
|
492
|
-
* @param {number} object_state_pointer
|
|
493
|
-
* @returns {any[]}
|
|
494
|
-
*/
|
|
418
|
+
* @param {number} object_state_pointer
|
|
419
|
+
* @returns {any[]}
|
|
420
|
+
*/
|
|
495
421
|
function hakuban_object_state_format(object_state_pointer) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
501
|
-
var v0 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
502
|
-
wasm.__wbindgen_free(r0, r1 * 4);
|
|
503
|
-
return v0;
|
|
504
|
-
} finally {
|
|
505
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
506
|
-
}
|
|
422
|
+
const ret = wasm.hakuban_object_state_format(object_state_pointer);
|
|
423
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
424
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
425
|
+
return v1;
|
|
507
426
|
}
|
|
508
427
|
|
|
509
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
510
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
511
|
-
}
|
|
512
428
|
/**
|
|
513
|
-
* @param {number} object_state_pointer
|
|
514
|
-
* @returns {Uint8Array}
|
|
515
|
-
*/
|
|
429
|
+
* @param {number} object_state_pointer
|
|
430
|
+
* @returns {Uint8Array}
|
|
431
|
+
*/
|
|
516
432
|
function hakuban_object_state_data(object_state_pointer) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
522
|
-
var v0 = getArrayU8FromWasm0(r0, r1).slice();
|
|
523
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
524
|
-
return v0;
|
|
525
|
-
} finally {
|
|
526
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
527
|
-
}
|
|
433
|
+
const ret = wasm.hakuban_object_state_data(object_state_pointer);
|
|
434
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
435
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
436
|
+
return v1;
|
|
528
437
|
}
|
|
529
438
|
|
|
530
439
|
/**
|
|
531
|
-
* @param {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
440
|
+
* @param {string} json_string
|
|
441
|
+
* @returns {WasmResult}
|
|
442
|
+
*/
|
|
443
|
+
function hakuban_tag_descriptor_new(json_string) {
|
|
444
|
+
const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
445
|
+
const len0 = WASM_VECTOR_LEN;
|
|
446
|
+
const ret = wasm.hakuban_tag_descriptor_new(ptr0, len0);
|
|
447
|
+
return WasmResult.__wrap(ret);
|
|
535
448
|
}
|
|
536
449
|
|
|
537
450
|
/**
|
|
538
|
-
* @param {number}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
|
|
543
|
-
return ret;
|
|
451
|
+
* @param {number} descriptor_pointer
|
|
452
|
+
*/
|
|
453
|
+
function hakuban_tag_descriptor_drop(descriptor_pointer) {
|
|
454
|
+
wasm.hakuban_tag_descriptor_drop(descriptor_pointer);
|
|
544
455
|
}
|
|
545
456
|
|
|
546
|
-
|
|
547
|
-
* @param {number} object_state_stream_pointer
|
|
548
|
-
* @returns {WasmResultWithPointer}
|
|
549
|
-
*/
|
|
550
|
-
function hakuban_object_state_stream_current(object_state_stream_pointer) {
|
|
551
|
-
const ret = wasm.hakuban_object_state_stream_current(object_state_stream_pointer);
|
|
552
|
-
return WasmResultWithPointer.__wrap(ret);
|
|
553
|
-
}
|
|
457
|
+
let cachedUint32ArrayMemory0 = null;
|
|
554
458
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
|
|
561
|
-
return ret;
|
|
459
|
+
function getUint32ArrayMemory0() {
|
|
460
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
461
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
462
|
+
}
|
|
463
|
+
return cachedUint32ArrayMemory0;
|
|
562
464
|
}
|
|
563
465
|
|
|
564
|
-
|
|
565
|
-
*
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
* @returns {number}
|
|
570
|
-
*/
|
|
571
|
-
function hakuban_remote_exchange_new(local_exchange_pointer, upstream, diff_produce, diff_request) {
|
|
572
|
-
const ret = wasm.hakuban_remote_exchange_new(local_exchange_pointer, upstream, diff_produce, diff_request);
|
|
573
|
-
return ret;
|
|
466
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
467
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
468
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
469
|
+
WASM_VECTOR_LEN = arg.length;
|
|
470
|
+
return ptr;
|
|
574
471
|
}
|
|
575
|
-
|
|
576
472
|
/**
|
|
577
|
-
* @param {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
473
|
+
* @param {string} json_string
|
|
474
|
+
* @param {Uint32Array} tag_pointers
|
|
475
|
+
* @returns {WasmResult}
|
|
476
|
+
*/
|
|
477
|
+
function hakuban_object_descriptor_new(json_string, tag_pointers) {
|
|
478
|
+
const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
479
|
+
const len0 = WASM_VECTOR_LEN;
|
|
480
|
+
const ptr1 = passArray32ToWasm0(tag_pointers, wasm.__wbindgen_malloc);
|
|
481
|
+
const len1 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.hakuban_object_descriptor_new(ptr0, len0, ptr1, len1);
|
|
483
|
+
return WasmResult.__wrap(ret);
|
|
581
484
|
}
|
|
582
485
|
|
|
583
486
|
/**
|
|
584
|
-
* @param {number}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
const ret = wasm.hakuban_remote_exchange_next_message_to_network(remote_exchange_pointer);
|
|
589
|
-
return ret;
|
|
487
|
+
* @param {number} descriptor_pointer
|
|
488
|
+
*/
|
|
489
|
+
function hakuban_object_descriptor_drop(descriptor_pointer) {
|
|
490
|
+
wasm.hakuban_object_descriptor_drop(descriptor_pointer);
|
|
590
491
|
}
|
|
591
492
|
|
|
592
493
|
/**
|
|
593
|
-
* @param {number}
|
|
594
|
-
* @returns {
|
|
595
|
-
*/
|
|
596
|
-
function
|
|
494
|
+
* @param {number} descriptor_pointer
|
|
495
|
+
* @returns {string}
|
|
496
|
+
*/
|
|
497
|
+
function hakuban_object_descriptor_json(descriptor_pointer) {
|
|
498
|
+
let deferred1_0;
|
|
499
|
+
let deferred1_1;
|
|
597
500
|
try {
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
var v0 = getArrayU8FromWasm0(r0, r1).slice();
|
|
603
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
604
|
-
return v0;
|
|
501
|
+
const ret = wasm.hakuban_object_descriptor_json(descriptor_pointer);
|
|
502
|
+
deferred1_0 = ret[0];
|
|
503
|
+
deferred1_1 = ret[1];
|
|
504
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
605
505
|
} finally {
|
|
606
|
-
wasm.
|
|
506
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
607
507
|
}
|
|
608
508
|
}
|
|
609
509
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
* @returns {number}
|
|
614
|
-
*/
|
|
615
|
-
function hakuban_remote_exchange_send_message_from_network(remote_exchange_pointer, message_data) {
|
|
616
|
-
const ptr0 = passArray8ToWasm0(message_data, wasm.__wbindgen_malloc);
|
|
617
|
-
const len0 = WASM_VECTOR_LEN;
|
|
618
|
-
const ret = wasm.hakuban_remote_exchange_send_message_from_network(remote_exchange_pointer, ptr0, len0);
|
|
619
|
-
return ret;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* @param {number} local_exchange_pointer
|
|
624
|
-
* @param {number} future_pointer
|
|
625
|
-
* @param {bigint} waker_id
|
|
626
|
-
* @returns {WasmResultWithPointer}
|
|
627
|
-
*/
|
|
628
|
-
function hakuban_future_returning_pointer_poll(local_exchange_pointer, future_pointer, waker_id) {
|
|
629
|
-
const ret = wasm.hakuban_future_returning_pointer_poll(local_exchange_pointer, future_pointer, waker_id);
|
|
630
|
-
return WasmResultWithPointer.__wrap(ret);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* @param {number} future
|
|
635
|
-
*/
|
|
636
|
-
function hakuban_future_returning_pointer_drop(future) {
|
|
637
|
-
wasm.hakuban_future_returning_nothing_drop(future);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* @param {number} local_exchange_pointer
|
|
642
|
-
* @param {number} future_pointer
|
|
643
|
-
* @param {bigint} waker_id
|
|
644
|
-
* @returns {WasmResultWithNothing}
|
|
645
|
-
*/
|
|
646
|
-
function hakuban_future_returning_nothing_poll(local_exchange_pointer, future_pointer, waker_id) {
|
|
647
|
-
const ret = wasm.hakuban_future_returning_nothing_poll(local_exchange_pointer, future_pointer, waker_id);
|
|
648
|
-
return WasmResultWithNothing.__wrap(ret);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* @param {number} future
|
|
653
|
-
*/
|
|
654
|
-
function hakuban_future_returning_nothing_drop(future) {
|
|
655
|
-
wasm.hakuban_future_returning_nothing_drop(future);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* @param {number} object_state_sink_pointer
|
|
660
|
-
* @returns {number}
|
|
661
|
-
*/
|
|
662
|
-
function hakuban_object_state_sink_descriptor(object_state_sink_pointer) {
|
|
663
|
-
const ret = wasm.hakuban_object_state_sink_descriptor(object_state_sink_pointer);
|
|
664
|
-
return ret;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* @param {number} object_state_sink_pointer
|
|
669
|
-
*/
|
|
670
|
-
function hakuban_object_state_sink_drop(object_state_sink_pointer) {
|
|
671
|
-
wasm.hakuban_object_state_sink_drop(object_state_sink_pointer);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* @param {number} object_state_sink_pointer
|
|
676
|
-
* @returns {number}
|
|
677
|
-
*/
|
|
678
|
-
function hakuban_object_state_sink_next(object_state_sink_pointer) {
|
|
679
|
-
const ret = wasm.hakuban_object_state_sink_next(object_state_sink_pointer);
|
|
680
|
-
return ret;
|
|
510
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
511
|
+
ptr = ptr >>> 0;
|
|
512
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
681
513
|
}
|
|
682
|
-
|
|
683
514
|
/**
|
|
684
|
-
* @param {number}
|
|
685
|
-
* @returns {
|
|
686
|
-
*/
|
|
687
|
-
function
|
|
688
|
-
const ret = wasm.
|
|
689
|
-
|
|
515
|
+
* @param {number} descriptor_pointer
|
|
516
|
+
* @returns {Uint32Array}
|
|
517
|
+
*/
|
|
518
|
+
function hakuban_object_descriptor_tags(descriptor_pointer) {
|
|
519
|
+
const ret = wasm.hakuban_object_descriptor_tags(descriptor_pointer);
|
|
520
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
521
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
522
|
+
return v1;
|
|
690
523
|
}
|
|
691
524
|
|
|
692
525
|
/**
|
|
693
|
-
* @param {number}
|
|
694
|
-
* @param {number}
|
|
695
|
-
* @
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
526
|
+
* @param {number} exchange
|
|
527
|
+
* @param {number} descriptor
|
|
528
|
+
* @param {number} capacity
|
|
529
|
+
* @returns {number}
|
|
530
|
+
*/
|
|
531
|
+
function hakuban_tag_expose_contract_new(exchange, descriptor, capacity) {
|
|
532
|
+
const ret = wasm.hakuban_tag_expose_contract_new(exchange, descriptor, capacity);
|
|
533
|
+
return ret >>> 0;
|
|
700
534
|
}
|
|
701
535
|
|
|
702
536
|
/**
|
|
703
|
-
* @param {number}
|
|
704
|
-
*/
|
|
705
|
-
function
|
|
706
|
-
wasm.
|
|
537
|
+
* @param {number} tag_expose_contract_pointer
|
|
538
|
+
*/
|
|
539
|
+
function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
|
|
540
|
+
wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
|
|
707
541
|
}
|
|
708
542
|
|
|
709
543
|
/**
|
|
710
|
-
* @param {number}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
544
|
+
* @param {number} tag_expose_pointer
|
|
545
|
+
* @returns {number}
|
|
546
|
+
*/
|
|
547
|
+
function hakuban_tag_expose_contract_next(tag_expose_pointer) {
|
|
548
|
+
const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
|
|
549
|
+
return ret >>> 0;
|
|
714
550
|
}
|
|
715
551
|
|
|
716
552
|
/**
|
|
717
|
-
* @
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
const len0 = WASM_VECTOR_LEN;
|
|
723
|
-
const ret = wasm.hakuban_local_exchange_new(ptr0, len0);
|
|
724
|
-
return WasmResultWithPointer.__wrap(ret);
|
|
553
|
+
* @returns {WasmResult}
|
|
554
|
+
*/
|
|
555
|
+
function hakuban_exchange_new() {
|
|
556
|
+
const ret = wasm.hakuban_exchange_new();
|
|
557
|
+
return WasmResult.__wrap(ret);
|
|
725
558
|
}
|
|
726
559
|
|
|
727
560
|
/**
|
|
728
|
-
* @param {number}
|
|
729
|
-
*/
|
|
730
|
-
function
|
|
731
|
-
wasm.
|
|
561
|
+
* @param {number} exchange
|
|
562
|
+
*/
|
|
563
|
+
function hakuban_exchange_drop(exchange) {
|
|
564
|
+
wasm.hakuban_exchange_drop(exchange);
|
|
732
565
|
}
|
|
733
566
|
|
|
734
567
|
function getArrayU64FromWasm0(ptr, len) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
/**
|
|
738
|
-
* @param {number} local_exchange
|
|
739
|
-
* @returns {BigUint64Array}
|
|
740
|
-
*/
|
|
741
|
-
function hakuban_local_exchange_notified(local_exchange) {
|
|
742
|
-
try {
|
|
743
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
744
|
-
wasm.hakuban_local_exchange_notified(retptr, local_exchange);
|
|
745
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
746
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
747
|
-
var v0 = getArrayU64FromWasm0(r0, r1).slice();
|
|
748
|
-
wasm.__wbindgen_free(r0, r1 * 8);
|
|
749
|
-
return v0;
|
|
750
|
-
} finally {
|
|
751
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* @param {number} local_exchange
|
|
757
|
-
* @param {number} descriptor
|
|
758
|
-
* @returns {number}
|
|
759
|
-
*/
|
|
760
|
-
function hakuban_object_expose_contract_new(local_exchange, descriptor) {
|
|
761
|
-
const ret = wasm.hakuban_object_expose_contract_new(local_exchange, descriptor);
|
|
762
|
-
return ret;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* @param {number} object_ptr
|
|
767
|
-
*/
|
|
768
|
-
function hakuban_object_expose_contract_drop(object_ptr) {
|
|
769
|
-
wasm.hakuban_object_expose_contract_drop(object_ptr);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* @param {number} object_expose_pointer
|
|
774
|
-
*/
|
|
775
|
-
function hakuban_object_expose_contract_terminate(object_expose_pointer) {
|
|
776
|
-
wasm.hakuban_object_expose_contract_terminate(object_expose_pointer);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* @param {number} object_expose_pointer
|
|
781
|
-
* @returns {number}
|
|
782
|
-
*/
|
|
783
|
-
function hakuban_object_expose_contract_next(object_expose_pointer) {
|
|
784
|
-
const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
|
|
785
|
-
return ret;
|
|
568
|
+
ptr = ptr >>> 0;
|
|
569
|
+
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
786
570
|
}
|
|
787
|
-
|
|
788
571
|
/**
|
|
789
|
-
* @param {number}
|
|
790
|
-
* @returns {
|
|
791
|
-
*/
|
|
792
|
-
function
|
|
793
|
-
const ret = wasm.
|
|
794
|
-
|
|
572
|
+
* @param {number} exchange
|
|
573
|
+
* @returns {BigUint64Array}
|
|
574
|
+
*/
|
|
575
|
+
function hakuban_exchange_notified(exchange) {
|
|
576
|
+
const ret = wasm.hakuban_exchange_notified(exchange);
|
|
577
|
+
var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
|
|
578
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
579
|
+
return v1;
|
|
795
580
|
}
|
|
796
581
|
|
|
797
582
|
/**
|
|
798
|
-
* @param {number}
|
|
799
|
-
* @param {number}
|
|
800
|
-
* @
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
583
|
+
* @param {number} exchange_pointer
|
|
584
|
+
* @param {number} future_pointer
|
|
585
|
+
* @param {bigint} waker_id
|
|
586
|
+
* @returns {WasmResult}
|
|
587
|
+
*/
|
|
588
|
+
function hakuban_future_poll(exchange_pointer, future_pointer, waker_id) {
|
|
589
|
+
const ret = wasm.hakuban_future_poll(exchange_pointer, future_pointer, waker_id);
|
|
590
|
+
return WasmResult.__wrap(ret);
|
|
805
591
|
}
|
|
806
592
|
|
|
807
593
|
/**
|
|
808
|
-
* @param {number}
|
|
809
|
-
*/
|
|
810
|
-
function
|
|
811
|
-
wasm.
|
|
594
|
+
* @param {number} future
|
|
595
|
+
*/
|
|
596
|
+
function hakuban_future_drop(future) {
|
|
597
|
+
wasm.hakuban_future_drop(future);
|
|
812
598
|
}
|
|
813
599
|
|
|
814
600
|
/**
|
|
815
|
-
* @
|
|
816
|
-
*/
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
601
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}
|
|
602
|
+
*/
|
|
603
|
+
Object.freeze({
|
|
604
|
+
Ok: 0, "0": "Ok",
|
|
605
|
+
Pointer: 1, "1": "Pointer",
|
|
606
|
+
Pending: 2, "2": "Pending",
|
|
607
|
+
EndOfStream: 3, "3": "EndOfStream",
|
|
608
|
+
InvalidString: 4, "4": "InvalidString",
|
|
609
|
+
InvalidJSON: 5, "5": "InvalidJSON",
|
|
610
|
+
InvalidURL: 6, "6": "InvalidURL",
|
|
611
|
+
InvalidLogLevel: 7, "7": "InvalidLogLevel",
|
|
612
|
+
LoggerInitializationError: 8, "8": "LoggerInitializationError",
|
|
613
|
+
ConnectionTerminated: 9, "9": "ConnectionTerminated",
|
|
614
|
+
});
|
|
820
615
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
*/
|
|
825
|
-
function hakuban_object_observe_contract_next(object_observe_pointer) {
|
|
826
|
-
const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
|
|
827
|
-
return ret;
|
|
828
|
-
}
|
|
616
|
+
const WasmResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
617
|
+
? { register: () => {}, unregister: () => {} }
|
|
618
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmresult_free(ptr >>> 0, 1));
|
|
829
619
|
|
|
830
|
-
|
|
831
|
-
* @param {number} object_observe_pointer
|
|
832
|
-
* @returns {WasmResultWithPointer}
|
|
833
|
-
*/
|
|
834
|
-
function hakuban_object_observe_contract_ready(object_observe_pointer) {
|
|
835
|
-
const ret = wasm.hakuban_object_observe_contract_ready(object_observe_pointer);
|
|
836
|
-
return WasmResultWithPointer.__wrap(ret);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
function handleError(f, args) {
|
|
840
|
-
try {
|
|
841
|
-
return f.apply(this, args);
|
|
842
|
-
} catch (e) {
|
|
843
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
*/
|
|
848
|
-
Object.freeze({ Ok:0,"0":"Ok",Pending:1,"1":"Pending",NotAvailable:2,"2":"NotAvailable",InvalidString:3,"3":"InvalidString",InvalidJSON:4,"4":"InvalidJSON",InvalidURL:5,"5":"InvalidURL",InvalidLogLevel:6,"6":"InvalidLogLevel",UnknownError:7,"7":"UnknownError", });
|
|
849
|
-
/**
|
|
850
|
-
*/
|
|
851
|
-
class WasmResultWithNothing {
|
|
620
|
+
class WasmResult {
|
|
852
621
|
|
|
853
622
|
static __wrap(ptr) {
|
|
854
|
-
|
|
855
|
-
obj
|
|
856
|
-
|
|
623
|
+
ptr = ptr >>> 0;
|
|
624
|
+
const obj = Object.create(WasmResult.prototype);
|
|
625
|
+
obj.__wbg_ptr = ptr;
|
|
626
|
+
WasmResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
857
627
|
return obj;
|
|
858
628
|
}
|
|
859
629
|
|
|
860
630
|
__destroy_into_raw() {
|
|
861
|
-
const ptr = this.
|
|
862
|
-
this.
|
|
863
|
-
|
|
631
|
+
const ptr = this.__wbg_ptr;
|
|
632
|
+
this.__wbg_ptr = 0;
|
|
633
|
+
WasmResultFinalization.unregister(this);
|
|
864
634
|
return ptr;
|
|
865
635
|
}
|
|
866
636
|
|
|
867
637
|
free() {
|
|
868
638
|
const ptr = this.__destroy_into_raw();
|
|
869
|
-
wasm.
|
|
639
|
+
wasm.__wbg_wasmresult_free(ptr, 0);
|
|
870
640
|
}
|
|
871
641
|
/**
|
|
872
|
-
|
|
873
|
-
|
|
642
|
+
* @returns {WasmResultStatus}
|
|
643
|
+
*/
|
|
874
644
|
get status() {
|
|
875
|
-
const ret = wasm.
|
|
876
|
-
return ret
|
|
645
|
+
const ret = wasm.__wbg_get_wasmresult_status(this.__wbg_ptr);
|
|
646
|
+
return ret;
|
|
877
647
|
}
|
|
878
648
|
/**
|
|
879
|
-
|
|
880
|
-
|
|
649
|
+
* @param {WasmResultStatus} arg0
|
|
650
|
+
*/
|
|
881
651
|
set status(arg0) {
|
|
882
|
-
wasm.
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
*/
|
|
887
|
-
class WasmResultWithPointer {
|
|
888
|
-
|
|
889
|
-
static __wrap(ptr) {
|
|
890
|
-
const obj = Object.create(WasmResultWithPointer.prototype);
|
|
891
|
-
obj.ptr = ptr;
|
|
892
|
-
|
|
893
|
-
return obj;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
__destroy_into_raw() {
|
|
897
|
-
const ptr = this.ptr;
|
|
898
|
-
this.ptr = 0;
|
|
899
|
-
|
|
900
|
-
return ptr;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
free() {
|
|
904
|
-
const ptr = this.__destroy_into_raw();
|
|
905
|
-
wasm.__wbg_wasmresultwithpointer_free(ptr);
|
|
652
|
+
wasm.__wbg_set_wasmresult_status(this.__wbg_ptr, arg0);
|
|
906
653
|
}
|
|
907
654
|
/**
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
get
|
|
911
|
-
const ret = wasm.
|
|
912
|
-
return ret
|
|
655
|
+
* @returns {number | undefined}
|
|
656
|
+
*/
|
|
657
|
+
get pointer() {
|
|
658
|
+
const ret = wasm.__wbg_get_wasmresult_pointer(this.__wbg_ptr);
|
|
659
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
913
660
|
}
|
|
914
661
|
/**
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
set
|
|
918
|
-
wasm.
|
|
662
|
+
* @param {number | null} [arg0]
|
|
663
|
+
*/
|
|
664
|
+
set pointer(arg0) {
|
|
665
|
+
wasm.__wbg_set_wasmresult_pointer(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : (arg0) >>> 0);
|
|
919
666
|
}
|
|
920
667
|
/**
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
get
|
|
924
|
-
const ret = wasm.
|
|
925
|
-
|
|
668
|
+
* @returns {string | undefined}
|
|
669
|
+
*/
|
|
670
|
+
get error_message() {
|
|
671
|
+
const ret = wasm.__wbg_get_wasmresult_error_message(this.__wbg_ptr);
|
|
672
|
+
let v1;
|
|
673
|
+
if (ret[0] !== 0) {
|
|
674
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
675
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
676
|
+
}
|
|
677
|
+
return v1;
|
|
926
678
|
}
|
|
927
679
|
/**
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
set
|
|
931
|
-
wasm.
|
|
680
|
+
* @param {string | null} [arg0]
|
|
681
|
+
*/
|
|
682
|
+
set error_message(arg0) {
|
|
683
|
+
var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
684
|
+
var len0 = WASM_VECTOR_LEN;
|
|
685
|
+
wasm.__wbg_set_wasmresult_error_message(this.__wbg_ptr, ptr0, len0);
|
|
932
686
|
}
|
|
933
687
|
}
|
|
934
688
|
|
|
935
|
-
async function
|
|
689
|
+
async function __wbg_load(module, imports) {
|
|
936
690
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
937
691
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
938
692
|
try {
|
|
@@ -940,7 +694,7 @@ async function load(module, imports) {
|
|
|
940
694
|
|
|
941
695
|
} catch (e) {
|
|
942
696
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
943
|
-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve
|
|
697
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
944
698
|
|
|
945
699
|
} else {
|
|
946
700
|
throw e;
|
|
@@ -963,103 +717,102 @@ async function load(module, imports) {
|
|
|
963
717
|
}
|
|
964
718
|
}
|
|
965
719
|
|
|
966
|
-
function
|
|
720
|
+
function __wbg_get_imports() {
|
|
967
721
|
const imports = {};
|
|
968
722
|
imports.wbg = {};
|
|
969
|
-
imports.wbg.
|
|
970
|
-
const ret =
|
|
971
|
-
return
|
|
723
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
724
|
+
const ret = arg0.call(arg1);
|
|
725
|
+
return ret;
|
|
726
|
+
}, arguments) };
|
|
727
|
+
imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
|
|
728
|
+
console.debug(arg0);
|
|
972
729
|
};
|
|
973
|
-
imports.wbg.
|
|
974
|
-
|
|
730
|
+
imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
|
|
731
|
+
console.error(arg0);
|
|
975
732
|
};
|
|
976
|
-
imports.wbg.
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
733
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
734
|
+
let deferred0_0;
|
|
735
|
+
let deferred0_1;
|
|
736
|
+
try {
|
|
737
|
+
deferred0_0 = arg0;
|
|
738
|
+
deferred0_1 = arg1;
|
|
739
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
740
|
+
} finally {
|
|
741
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
742
|
+
}
|
|
983
743
|
};
|
|
984
|
-
imports.wbg.
|
|
985
|
-
console.
|
|
744
|
+
imports.wbg.__wbg_info_3daf2e093e091b66 = function(arg0) {
|
|
745
|
+
console.info(arg0);
|
|
986
746
|
};
|
|
987
|
-
imports.wbg.
|
|
988
|
-
console.
|
|
747
|
+
imports.wbg.__wbg_log_c222819a41e063d3 = function(arg0) {
|
|
748
|
+
console.log(arg0);
|
|
989
749
|
};
|
|
990
|
-
imports.wbg.
|
|
991
|
-
|
|
750
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
751
|
+
const ret = new Error();
|
|
752
|
+
return ret;
|
|
992
753
|
};
|
|
993
|
-
imports.wbg.
|
|
994
|
-
|
|
754
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
755
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
756
|
+
return ret;
|
|
995
757
|
};
|
|
996
|
-
imports.wbg.
|
|
997
|
-
|
|
758
|
+
imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {
|
|
759
|
+
const ret = arg0.now();
|
|
760
|
+
return ret;
|
|
998
761
|
};
|
|
999
|
-
imports.wbg.
|
|
1000
|
-
const ret =
|
|
762
|
+
imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
|
|
763
|
+
const ret = arg0.performance;
|
|
1001
764
|
return ret;
|
|
1002
765
|
};
|
|
1003
|
-
imports.wbg.
|
|
1004
|
-
const ret =
|
|
1005
|
-
|
|
766
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
767
|
+
const ret = arg1.stack;
|
|
768
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
769
|
+
const len1 = WASM_VECTOR_LEN;
|
|
770
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
771
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1006
772
|
};
|
|
1007
|
-
imports.wbg.
|
|
1008
|
-
const ret =
|
|
1009
|
-
return
|
|
1010
|
-
}, arguments) };
|
|
1011
|
-
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
|
1012
|
-
const ret = getObject(arg0).call(getObject(arg1));
|
|
1013
|
-
return addHeapObject(ret);
|
|
1014
|
-
}, arguments) };
|
|
1015
|
-
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
|
1016
|
-
const ret = self.self;
|
|
1017
|
-
return addHeapObject(ret);
|
|
1018
|
-
}, arguments) };
|
|
1019
|
-
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
|
|
1020
|
-
const ret = window.window;
|
|
1021
|
-
return addHeapObject(ret);
|
|
1022
|
-
}, arguments) };
|
|
1023
|
-
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
|
|
1024
|
-
const ret = globalThis.globalThis;
|
|
1025
|
-
return addHeapObject(ret);
|
|
1026
|
-
}, arguments) };
|
|
1027
|
-
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
|
|
1028
|
-
const ret = global.global;
|
|
1029
|
-
return addHeapObject(ret);
|
|
1030
|
-
}, arguments) };
|
|
1031
|
-
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1032
|
-
const ret = getObject(arg0) === undefined;
|
|
1033
|
-
return ret;
|
|
773
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
774
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
775
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1034
776
|
};
|
|
1035
|
-
imports.wbg.
|
|
1036
|
-
const ret =
|
|
1037
|
-
return
|
|
777
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
778
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
779
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1038
780
|
};
|
|
1039
|
-
imports.wbg.
|
|
1040
|
-
const ret =
|
|
1041
|
-
return
|
|
781
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
782
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
783
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1042
784
|
};
|
|
1043
|
-
imports.wbg.
|
|
1044
|
-
const ret =
|
|
1045
|
-
|
|
1046
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1047
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
1048
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
785
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
786
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
787
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1049
788
|
};
|
|
1050
|
-
imports.wbg.
|
|
1051
|
-
|
|
1052
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
1053
|
-
} finally {
|
|
1054
|
-
wasm.__wbindgen_free(arg0, arg1);
|
|
1055
|
-
}
|
|
789
|
+
imports.wbg.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
|
|
790
|
+
console.warn(arg0);
|
|
1056
791
|
};
|
|
1057
|
-
imports.wbg.
|
|
1058
|
-
const
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
792
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
793
|
+
const table = wasm.__wbindgen_export_2;
|
|
794
|
+
const offset = table.grow(4);
|
|
795
|
+
table.set(0, undefined);
|
|
796
|
+
table.set(offset + 0, undefined);
|
|
797
|
+
table.set(offset + 1, null);
|
|
798
|
+
table.set(offset + 2, true);
|
|
799
|
+
table.set(offset + 3, false);
|
|
800
|
+
};
|
|
801
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
802
|
+
const ret = arg0 === undefined;
|
|
803
|
+
return ret;
|
|
804
|
+
};
|
|
805
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
806
|
+
const obj = arg1;
|
|
807
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
808
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
809
|
+
var len1 = WASM_VECTOR_LEN;
|
|
810
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
811
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
812
|
+
};
|
|
813
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
814
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
815
|
+
return ret;
|
|
1063
816
|
};
|
|
1064
817
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1065
818
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
@@ -1068,59 +821,62 @@ function getImports() {
|
|
|
1068
821
|
return imports;
|
|
1069
822
|
}
|
|
1070
823
|
|
|
1071
|
-
function
|
|
824
|
+
function __wbg_finalize_init(instance, module) {
|
|
1072
825
|
wasm = instance.exports;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
826
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
827
|
+
cachedBigInt64ArrayMemory0 = null;
|
|
828
|
+
cachedBigUint64ArrayMemory0 = null;
|
|
829
|
+
cachedDataViewMemory0 = null;
|
|
830
|
+
cachedUint32ArrayMemory0 = null;
|
|
831
|
+
cachedUint8ArrayMemory0 = null;
|
|
1079
832
|
|
|
1080
833
|
|
|
834
|
+
wasm.__wbindgen_start();
|
|
1081
835
|
return wasm;
|
|
1082
836
|
}
|
|
1083
837
|
|
|
1084
|
-
async function
|
|
1085
|
-
if (
|
|
1086
|
-
|
|
838
|
+
async function __wbg_init(module_or_path) {
|
|
839
|
+
if (wasm !== undefined) return wasm;
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
if (typeof module_or_path !== 'undefined') {
|
|
843
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
844
|
+
({module_or_path} = module_or_path);
|
|
845
|
+
} else {
|
|
846
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead');
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
if (typeof module_or_path === 'undefined') {
|
|
851
|
+
module_or_path = new URL('hakuban_bg.wasm', import.meta.url);
|
|
1087
852
|
}
|
|
1088
|
-
const imports =
|
|
853
|
+
const imports = __wbg_get_imports();
|
|
1089
854
|
|
|
1090
|
-
if (typeof
|
|
1091
|
-
|
|
855
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
856
|
+
module_or_path = fetch(module_or_path);
|
|
1092
857
|
}
|
|
1093
858
|
|
|
1094
|
-
const { instance, module } = await
|
|
859
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1095
860
|
|
|
1096
|
-
return
|
|
861
|
+
return __wbg_finalize_init(instance, module);
|
|
1097
862
|
}
|
|
1098
863
|
|
|
1099
864
|
var unwrap_pointer = function(result) {
|
|
1100
|
-
if (result.status ===
|
|
1101
|
-
return result.
|
|
1102
|
-
} else {
|
|
1103
|
-
throw "hakuban wasm call failed: " + result.status;
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
var unwrap_pointer_or_null = function(result) {
|
|
1108
|
-
if (result.status === 0) {
|
|
1109
|
-
return result.value;
|
|
1110
|
-
} else if (result.status === 2) { //unavailable
|
|
1111
|
-
return null;
|
|
865
|
+
if (result.status === 1) {
|
|
866
|
+
return result.pointer;
|
|
1112
867
|
} else {
|
|
1113
868
|
throw "hakuban wasm call failed: " + result.status;
|
|
1114
869
|
}
|
|
1115
870
|
};
|
|
1116
871
|
|
|
1117
872
|
var Future = class Future {
|
|
1118
|
-
constructor(
|
|
1119
|
-
this.
|
|
873
|
+
constructor(exchange, future_owner, poll_function, drop_function, _pointer, debug_description) {
|
|
874
|
+
this.exchange = exchange;
|
|
1120
875
|
this.future_owner = future_owner;
|
|
1121
876
|
this.poll_function = poll_function;
|
|
1122
877
|
this.drop_function = drop_function;
|
|
1123
878
|
this._pointer = _pointer;
|
|
879
|
+
this.debug_description = debug_description;
|
|
1124
880
|
}
|
|
1125
881
|
|
|
1126
882
|
async await_and_drop(aborted = null) {
|
|
@@ -1130,14 +886,23 @@ var Future = class Future {
|
|
|
1130
886
|
return this.lock_id = this.future_owner.drop_lock(about_to_drop_notification);
|
|
1131
887
|
});
|
|
1132
888
|
while (true) {
|
|
1133
|
-
notified = this.
|
|
1134
|
-
|
|
1135
|
-
|
|
889
|
+
notified = this.exchange.notified();
|
|
890
|
+
if (this.debug_description && log_level() === "trace") {
|
|
891
|
+
console.debug("polling " + this.debug_description, notified.id);
|
|
892
|
+
}
|
|
893
|
+
result = this.exchange.with_pointer((exchange_pointer) => {
|
|
894
|
+
return this.poll_function(exchange_pointer, this._pointer, notified.id);
|
|
1136
895
|
});
|
|
896
|
+
if (this.debug_description && log_level() === "trace") {
|
|
897
|
+
console.debug("polled " + this.debug_description, notified.id, result.status);
|
|
898
|
+
}
|
|
899
|
+
this.exchange.notify();
|
|
1137
900
|
switch (result.status) {
|
|
1138
|
-
case 0: //ok
|
|
1139
|
-
return
|
|
1140
|
-
case 1: //
|
|
901
|
+
case 0: // ok
|
|
902
|
+
return true;
|
|
903
|
+
case 1: // pointer
|
|
904
|
+
return result.pointer;
|
|
905
|
+
case 2: // pending
|
|
1141
906
|
to_listen = [notified, about_to_drop_notification_received];
|
|
1142
907
|
if (aborted != null) {
|
|
1143
908
|
to_listen.push(aborted);
|
|
@@ -1149,9 +914,10 @@ var Future = class Future {
|
|
|
1149
914
|
return null;
|
|
1150
915
|
}
|
|
1151
916
|
break;
|
|
1152
|
-
case
|
|
917
|
+
case 3: // end of stream
|
|
1153
918
|
return null;
|
|
1154
919
|
default:
|
|
920
|
+
console.error(result.error_message);
|
|
1155
921
|
throw result.status; //TODO: convert that to specific error
|
|
1156
922
|
}
|
|
1157
923
|
}
|
|
@@ -1159,24 +925,37 @@ var Future = class Future {
|
|
|
1159
925
|
this.drop_function(this._pointer);
|
|
1160
926
|
this.future_owner.drop_release(this.lock_id);
|
|
1161
927
|
if (notified != null) {
|
|
1162
|
-
this.
|
|
928
|
+
this.exchange.return_notified(notified);
|
|
1163
929
|
}
|
|
1164
930
|
}
|
|
1165
931
|
}
|
|
1166
932
|
|
|
1167
933
|
};
|
|
1168
934
|
|
|
935
|
+
var logger_initialized, logger_log_level;
|
|
936
|
+
|
|
937
|
+
logger_initialized = false;
|
|
938
|
+
|
|
939
|
+
logger_log_level = void 0;
|
|
940
|
+
|
|
1169
941
|
var logger_initialize = function(log_level, skip_if_already_initialized = false) {
|
|
1170
|
-
var
|
|
1171
|
-
if (
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
942
|
+
var result;
|
|
943
|
+
if (!logger_initialized || !skip_if_already_initialized) {
|
|
944
|
+
result = hakuban_logger_initialize(log_level);
|
|
945
|
+
if (result.status === 0) {
|
|
946
|
+
logger_initialized = true;
|
|
947
|
+
return logger_log_level = log_level;
|
|
948
|
+
} else {
|
|
949
|
+
return console.error("Failed to initialize logger, error " + result.error_message);
|
|
950
|
+
}
|
|
1176
951
|
}
|
|
1177
952
|
};
|
|
1178
953
|
|
|
1179
|
-
var
|
|
954
|
+
var log_level = function() {
|
|
955
|
+
return logger_log_level;
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
var do_and_drop, do_and_drop_or_return, finalization_registry;
|
|
1180
959
|
|
|
1181
960
|
finalization_registry = new FinalizationRegistry(function(function_and_arg) {
|
|
1182
961
|
return function_and_arg[0](function_and_arg[1]);
|
|
@@ -1213,7 +992,7 @@ do_and_drop = function(object_or_objects, block) {
|
|
|
1213
992
|
}
|
|
1214
993
|
};
|
|
1215
994
|
|
|
1216
|
-
|
|
995
|
+
do_and_drop_or_return = function(object_or_objects, block) {
|
|
1217
996
|
if (block != null) {
|
|
1218
997
|
return do_and_drop(object_or_objects, block);
|
|
1219
998
|
} else {
|
|
@@ -1229,8 +1008,8 @@ var PointerAlreadyDropped$1 = class PointerAlreadyDropped {
|
|
|
1229
1008
|
};
|
|
1230
1009
|
|
|
1231
1010
|
var FFIObject = class FFIObject {
|
|
1232
|
-
initialize_pointer(
|
|
1233
|
-
this.
|
|
1011
|
+
initialize_pointer(_exchange, _pointer, _drop_function) {
|
|
1012
|
+
this._exchange = _exchange;
|
|
1234
1013
|
this._pointer = _pointer;
|
|
1235
1014
|
this._drop_function = _drop_function;
|
|
1236
1015
|
this._was_dropped = null;
|
|
@@ -1264,8 +1043,8 @@ var FFIObject = class FFIObject {
|
|
|
1264
1043
|
}
|
|
1265
1044
|
finalization_registry.unregister(this);
|
|
1266
1045
|
this._drop_function(this._pointer);
|
|
1267
|
-
if (this.
|
|
1268
|
-
this.
|
|
1046
|
+
if (this._exchange != null) {
|
|
1047
|
+
this._exchange.notify();
|
|
1269
1048
|
}
|
|
1270
1049
|
}
|
|
1271
1050
|
this._pointer = false;
|
|
@@ -1410,6 +1189,10 @@ var ObjectState = class ObjectState extends FFIObject {
|
|
|
1410
1189
|
}
|
|
1411
1190
|
}
|
|
1412
1191
|
|
|
1192
|
+
static from_pointer(_exchange, pointer) {
|
|
1193
|
+
return new ObjectState(null, null, null, null, pointer);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1413
1196
|
with_pointer(block) {
|
|
1414
1197
|
var pointer;
|
|
1415
1198
|
if (this.dropped()) {
|
|
@@ -1453,127 +1236,123 @@ var ObjectState = class ObjectState extends FFIObject {
|
|
|
1453
1236
|
|
|
1454
1237
|
};
|
|
1455
1238
|
|
|
1456
|
-
var
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
call_or_return(block) {
|
|
1472
|
-
if (block != null) {
|
|
1473
|
-
return this.call(block);
|
|
1474
|
-
} else {
|
|
1475
|
-
return this;
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
async call(block) {
|
|
1480
|
-
var new_item, results;
|
|
1481
|
-
results = [];
|
|
1482
|
-
while ((new_item = (await this._stream.next())) != null) {
|
|
1483
|
-
if (this._async) {
|
|
1484
|
-
//TODO: will GC eat it before it fullfils?
|
|
1485
|
-
results.push(new Promise(async(_resolve) => {
|
|
1486
|
-
var item;
|
|
1487
|
-
item = new_item; // :(
|
|
1488
|
-
if (this._without_implicit_drop) {
|
|
1489
|
-
return (await block(item));
|
|
1239
|
+
var Stream = class Stream {
|
|
1240
|
+
static mixin(new_object, _ffi_next, _item_constructor, debug_description) {
|
|
1241
|
+
var StreamAsyncIterator;
|
|
1242
|
+
// Rust StreamExt-like methods
|
|
1243
|
+
new_object.next = async function(block) {
|
|
1244
|
+
var error, future_pointer, pointer;
|
|
1245
|
+
try {
|
|
1246
|
+
future_pointer = this.with_pointer((pointer) => {
|
|
1247
|
+
return _ffi_next(pointer);
|
|
1248
|
+
});
|
|
1249
|
+
pointer = (await new Future(this.exchange, this, hakuban_future_poll, hakuban_future_drop, future_pointer, debug_description + ".next").await_and_drop());
|
|
1250
|
+
if (pointer != null) {
|
|
1251
|
+
if (_item_constructor != null) {
|
|
1252
|
+
return (await new _item_constructor(this.exchange, pointer).do_and_drop_or_return(block));
|
|
1490
1253
|
} else {
|
|
1491
|
-
|
|
1492
|
-
return (await block(item));
|
|
1493
|
-
} finally {
|
|
1494
|
-
await item.drop();
|
|
1495
|
-
}
|
|
1254
|
+
return pointer;
|
|
1496
1255
|
}
|
|
1497
|
-
}));
|
|
1498
|
-
} else {
|
|
1499
|
-
if (this._without_implicit_drop) {
|
|
1500
|
-
results.push((await block(new_item)));
|
|
1501
1256
|
} else {
|
|
1257
|
+
return null;
|
|
1258
|
+
}
|
|
1259
|
+
} catch (error1) {
|
|
1260
|
+
error = error1;
|
|
1261
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1262
|
+
return null;
|
|
1263
|
+
}
|
|
1264
|
+
throw error;
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
new_object.for_each_concurrent = async function(block) {
|
|
1268
|
+
var id, item, ref, sequence, task, tasks;
|
|
1269
|
+
//TODO: simplify when we get rid of coffee
|
|
1270
|
+
task = function(tasks, id, item) {
|
|
1271
|
+
return new Promise(async(_resolve) => {
|
|
1502
1272
|
try {
|
|
1503
|
-
|
|
1273
|
+
return (await block(item));
|
|
1504
1274
|
} finally {
|
|
1505
|
-
await
|
|
1275
|
+
await item.drop();
|
|
1276
|
+
delete tasks[id];
|
|
1506
1277
|
}
|
|
1278
|
+
});
|
|
1279
|
+
};
|
|
1280
|
+
tasks = {};
|
|
1281
|
+
sequence = 0;
|
|
1282
|
+
ref = this;
|
|
1283
|
+
for await (item of ref) {
|
|
1284
|
+
id = ++sequence;
|
|
1285
|
+
tasks[id] = task(tasks, id, item);
|
|
1286
|
+
}
|
|
1287
|
+
return (await Promise.all(Object.values(tasks)));
|
|
1288
|
+
};
|
|
1289
|
+
new_object.for_each = async function(block) {
|
|
1290
|
+
var item, ref, results;
|
|
1291
|
+
ref = this;
|
|
1292
|
+
results = [];
|
|
1293
|
+
for await (item of ref) {
|
|
1294
|
+
try {
|
|
1295
|
+
results.push((await block(item)));
|
|
1296
|
+
} finally {
|
|
1297
|
+
await item.drop();
|
|
1507
1298
|
}
|
|
1508
1299
|
}
|
|
1509
|
-
|
|
1510
|
-
|
|
1300
|
+
return results;
|
|
1301
|
+
};
|
|
1302
|
+
// JS AsyncIterator methods
|
|
1303
|
+
StreamAsyncIterator = class StreamAsyncIterator {
|
|
1304
|
+
constructor(stream) {
|
|
1305
|
+
this.next = async function() {
|
|
1306
|
+
var item;
|
|
1307
|
+
item = (await stream.next());
|
|
1308
|
+
if (item != null) {
|
|
1309
|
+
return {
|
|
1310
|
+
done: false,
|
|
1311
|
+
value: item
|
|
1312
|
+
};
|
|
1313
|
+
} else {
|
|
1314
|
+
return {
|
|
1315
|
+
done: true
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
this.return = function(value) {
|
|
1320
|
+
stream.drop();
|
|
1321
|
+
return {
|
|
1322
|
+
done: true,
|
|
1323
|
+
value: value
|
|
1324
|
+
};
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
};
|
|
1329
|
+
return new_object[Symbol.asyncIterator] = function() {
|
|
1330
|
+
return new StreamAsyncIterator(this);
|
|
1331
|
+
};
|
|
1511
1332
|
}
|
|
1512
1333
|
|
|
1513
1334
|
};
|
|
1514
1335
|
|
|
1515
1336
|
var ObjectStateStream = class ObjectStateStream extends FFIObject {
|
|
1516
|
-
constructor(
|
|
1337
|
+
constructor(exchange, pointer) {
|
|
1517
1338
|
super();
|
|
1518
|
-
this
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
return this.with_pointer(function(pointer) {
|
|
1524
|
-
return new ObjectDescriptor(null, null, hakuban_object_state_stream_descriptor(pointer));
|
|
1525
|
-
});
|
|
1339
|
+
Stream.mixin(this, hakuban_object_state_stream_next, (function(_exchange, pointer) {
|
|
1340
|
+
return new ObjectState(null, null, null, null, pointer);
|
|
1341
|
+
}), "ObjectStateStream");
|
|
1342
|
+
this.exchange = exchange;
|
|
1343
|
+
this.initialize_pointer(this.exchange, pointer, hakuban_object_state_stream_drop);
|
|
1526
1344
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
return hakuban_object_state_stream_next(pointer);
|
|
1533
|
-
});
|
|
1534
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1535
|
-
if (pointer != null) {
|
|
1536
|
-
return new ObjectState(null, null, null, null, pointer).do_and_drop_or_return(block);
|
|
1537
|
-
} else {
|
|
1538
|
-
return null;
|
|
1539
|
-
}
|
|
1540
|
-
} catch (error1) {
|
|
1541
|
-
error = error1;
|
|
1542
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1543
|
-
return null;
|
|
1544
|
-
}
|
|
1545
|
-
throw error;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
each(block) {
|
|
1550
|
-
return new StreamEnumerator(this).call_or_return(block);
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
current(block) {
|
|
1554
|
-
var error, pointer;
|
|
1555
|
-
try {
|
|
1556
|
-
pointer = this.with_pointer((pointer) => {
|
|
1557
|
-
return unwrap_pointer_or_null(hakuban_object_state_stream_current(pointer));
|
|
1558
|
-
});
|
|
1559
|
-
if (pointer != null) {
|
|
1560
|
-
return new ObjectState(null, null, null, null, pointer).do_and_drop_or_return(block);
|
|
1561
|
-
} else {
|
|
1562
|
-
return null;
|
|
1563
|
-
}
|
|
1564
|
-
} catch (error1) {
|
|
1565
|
-
error = error1;
|
|
1566
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1567
|
-
return null;
|
|
1568
|
-
}
|
|
1569
|
-
throw error;
|
|
1570
|
-
}
|
|
1345
|
+
|
|
1346
|
+
descriptor() {
|
|
1347
|
+
return this.with_pointer(function(pointer) {
|
|
1348
|
+
return new ObjectDescriptor(null, null, hakuban_object_state_stream_descriptor(pointer));
|
|
1349
|
+
});
|
|
1571
1350
|
}
|
|
1572
1351
|
|
|
1573
1352
|
};
|
|
1574
1353
|
|
|
1575
1354
|
var ObjectStateSinkParams = class ObjectStateSinkParams extends FFIObject {
|
|
1576
|
-
constructor(pointer) {
|
|
1355
|
+
constructor(_exchange, pointer) {
|
|
1577
1356
|
super();
|
|
1578
1357
|
this.initialize_pointer(null, pointer, hakuban_object_state_sink_params_drop);
|
|
1579
1358
|
}
|
|
@@ -1581,10 +1360,11 @@ var ObjectStateSinkParams = class ObjectStateSinkParams extends FFIObject {
|
|
|
1581
1360
|
};
|
|
1582
1361
|
|
|
1583
1362
|
var ObjectStateSink = class ObjectStateSink extends FFIObject {
|
|
1584
|
-
constructor(
|
|
1363
|
+
constructor(exchange, pointer) {
|
|
1585
1364
|
super();
|
|
1586
|
-
this
|
|
1587
|
-
this.
|
|
1365
|
+
Stream.mixin(this, hakuban_object_state_sink_next, ObjectStateSinkParams);
|
|
1366
|
+
this.exchange = exchange;
|
|
1367
|
+
this.initialize_pointer(this.exchange, pointer, hakuban_object_state_sink_drop);
|
|
1588
1368
|
}
|
|
1589
1369
|
|
|
1590
1370
|
descriptor() {
|
|
@@ -1601,74 +1381,11 @@ var ObjectStateSink = class ObjectStateSink extends FFIObject {
|
|
|
1601
1381
|
return hakuban_object_state_sink_push(sink_pointer, object_state_pointer);
|
|
1602
1382
|
});
|
|
1603
1383
|
});
|
|
1604
|
-
await new Future(this.
|
|
1605
|
-
this.local_exchange.notify();
|
|
1606
|
-
return true;
|
|
1607
|
-
} catch (error1) {
|
|
1608
|
-
error = error1;
|
|
1609
|
-
if (error instanceof PointerAlreadyDropped) {
|
|
1610
|
-
return null;
|
|
1611
|
-
}
|
|
1612
|
-
throw error;
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
async next(block) {
|
|
1617
|
-
var error, future_pointer, pointer;
|
|
1618
|
-
try {
|
|
1619
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
1620
|
-
return hakuban_object_state_sink_next(pointer);
|
|
1621
|
-
});
|
|
1622
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1623
|
-
if (pointer != null) {
|
|
1624
|
-
return new ObjectStateSinkParams(pointer).do_and_drop_or_return(block);
|
|
1625
|
-
} else {
|
|
1626
|
-
return null;
|
|
1627
|
-
}
|
|
1628
|
-
} catch (error1) {
|
|
1629
|
-
error = error1;
|
|
1630
|
-
if (error instanceof PointerAlreadyDropped) {
|
|
1631
|
-
return null;
|
|
1632
|
-
}
|
|
1633
|
-
throw error;
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
each(block) {
|
|
1638
|
-
return new StreamEnumerator(this).call_or_return(block);
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
current(block) {
|
|
1642
|
-
var error, pointer;
|
|
1643
|
-
try {
|
|
1644
|
-
pointer = this.with_pointer((pointer) => {
|
|
1645
|
-
return unwrap_pointer_or_null(hakuban_object_state_sink_current(pointer));
|
|
1646
|
-
});
|
|
1647
|
-
if (pointer != null) {
|
|
1648
|
-
return new ObjectStateSinkParams(pointer).do_and_drop_or_return(block);
|
|
1649
|
-
} else {
|
|
1650
|
-
return null;
|
|
1651
|
-
}
|
|
1652
|
-
} catch (error1) {
|
|
1653
|
-
error = error1;
|
|
1654
|
-
if (error instanceof PointerAlreadyDropped) {
|
|
1655
|
-
return null;
|
|
1656
|
-
}
|
|
1657
|
-
throw error;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
desynchronize() {
|
|
1662
|
-
var error;
|
|
1663
|
-
try {
|
|
1664
|
-
this.with_pointer((pointer) => {
|
|
1665
|
-
return hakuban_object_state_sink_desynchronize(pointer);
|
|
1666
|
-
});
|
|
1667
|
-
this.local_exchange.notify();
|
|
1384
|
+
await new Future(this.exchange, this, hakuban_future_poll, hakuban_future_drop, future_pointer).await_and_drop();
|
|
1668
1385
|
return true;
|
|
1669
1386
|
} catch (error1) {
|
|
1670
1387
|
error = error1;
|
|
1671
|
-
if (error instanceof PointerAlreadyDropped) {
|
|
1388
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1672
1389
|
return null;
|
|
1673
1390
|
}
|
|
1674
1391
|
throw error;
|
|
@@ -1677,342 +1394,101 @@ var ObjectStateSink = class ObjectStateSink extends FFIObject {
|
|
|
1677
1394
|
|
|
1678
1395
|
};
|
|
1679
1396
|
|
|
1680
|
-
var
|
|
1681
|
-
|
|
1682
|
-
Contract = class Contract extends FFIObject {
|
|
1683
|
-
each(block) {
|
|
1684
|
-
return new StreamEnumerator(this).call_or_return(block);
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
};
|
|
1688
|
-
|
|
1689
|
-
var ObjectObserveContract = class ObjectObserveContract extends Contract {
|
|
1690
|
-
constructor(local_exchange, descriptor) {
|
|
1397
|
+
var ObjectObserveContract = class ObjectObserveContract extends FFIObject {
|
|
1398
|
+
constructor(exchange, descriptor) {
|
|
1691
1399
|
super();
|
|
1692
|
-
this
|
|
1400
|
+
Stream.mixin(this, hakuban_object_observe_contract_next, ObjectStateStream);
|
|
1401
|
+
this.exchange = exchange;
|
|
1693
1402
|
this.descriptor = descriptor[0] instanceof ObjectDescriptor ? descriptor[0] : new ObjectDescriptor(...descriptor);
|
|
1694
|
-
this.
|
|
1403
|
+
this.exchange.with_pointer((exchange_pointer) => {
|
|
1695
1404
|
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1696
|
-
return this.initialize_pointer(this.
|
|
1405
|
+
return this.initialize_pointer(this.exchange, hakuban_object_observe_contract_new(exchange_pointer, descriptor_pointer), hakuban_object_observe_contract_drop);
|
|
1697
1406
|
});
|
|
1698
1407
|
});
|
|
1699
|
-
this.
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
terminate() {
|
|
1703
|
-
var error;
|
|
1704
|
-
try {
|
|
1705
|
-
this.with_pointer((pointer) => {
|
|
1706
|
-
return hakuban_object_observe_contract_terminate(pointer);
|
|
1707
|
-
});
|
|
1708
|
-
return this.local_exchange.notify();
|
|
1709
|
-
} catch (error1) {
|
|
1710
|
-
error = error1;
|
|
1711
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1712
|
-
return null;
|
|
1713
|
-
}
|
|
1714
|
-
throw error;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
async next(block) {
|
|
1719
|
-
var error, future_pointer, pointer;
|
|
1720
|
-
try {
|
|
1721
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
1722
|
-
return hakuban_object_observe_contract_next(pointer);
|
|
1723
|
-
});
|
|
1724
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1725
|
-
this.local_exchange.notify();
|
|
1726
|
-
if (pointer != null) {
|
|
1727
|
-
return (await new ObjectStateStream(this.local_exchange, pointer).do_and_drop_or_return(block));
|
|
1728
|
-
} else {
|
|
1729
|
-
return null;
|
|
1730
|
-
}
|
|
1731
|
-
} catch (error1) {
|
|
1732
|
-
error = error1;
|
|
1733
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1734
|
-
return null;
|
|
1735
|
-
}
|
|
1736
|
-
throw error;
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
ready(block) {
|
|
1741
|
-
var error, pointer;
|
|
1742
|
-
try {
|
|
1743
|
-
pointer = this.with_pointer((pointer) => {
|
|
1744
|
-
return unwrap_pointer_or_null(hakuban_object_observe_contract_ready(pointer));
|
|
1745
|
-
});
|
|
1746
|
-
this.local_exchange.notify();
|
|
1747
|
-
if (pointer != null) {
|
|
1748
|
-
return new ObjectStateStream(this.local_exchange, pointer).do_and_drop_or_return(block);
|
|
1749
|
-
} else {
|
|
1750
|
-
return null;
|
|
1751
|
-
}
|
|
1752
|
-
} catch (error1) {
|
|
1753
|
-
error = error1;
|
|
1754
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1755
|
-
return null;
|
|
1756
|
-
}
|
|
1757
|
-
throw error;
|
|
1758
|
-
}
|
|
1408
|
+
this.exchange.notify();
|
|
1759
1409
|
}
|
|
1760
1410
|
|
|
1761
1411
|
};
|
|
1762
1412
|
|
|
1763
|
-
var ObjectExposeContract = class ObjectExposeContract extends
|
|
1764
|
-
constructor(
|
|
1413
|
+
var ObjectExposeContract = class ObjectExposeContract extends FFIObject {
|
|
1414
|
+
constructor(exchange, descriptor, capacity) {
|
|
1765
1415
|
super();
|
|
1766
|
-
this
|
|
1416
|
+
Stream.mixin(this, hakuban_object_expose_contract_next, ObjectStateSink);
|
|
1417
|
+
this.exchange = exchange;
|
|
1767
1418
|
this.descriptor = descriptor[0] instanceof ObjectDescriptor ? descriptor[0] : new ObjectDescriptor(...descriptor);
|
|
1768
|
-
this.
|
|
1419
|
+
this.exchange.with_pointer((exchange_pointer) => {
|
|
1769
1420
|
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1770
|
-
return this.initialize_pointer(this.
|
|
1421
|
+
return this.initialize_pointer(this.exchange, hakuban_object_expose_contract_new(exchange_pointer, descriptor_pointer, capacity), hakuban_object_expose_contract_drop);
|
|
1771
1422
|
});
|
|
1772
1423
|
});
|
|
1773
|
-
this.
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
terminate() {
|
|
1777
|
-
var error;
|
|
1778
|
-
try {
|
|
1779
|
-
this.with_pointer((pointer) => {
|
|
1780
|
-
return hakuban_object_expose_contract_terminate(pointer);
|
|
1781
|
-
});
|
|
1782
|
-
return this.local_exchange.notify();
|
|
1783
|
-
} catch (error1) {
|
|
1784
|
-
error = error1;
|
|
1785
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1786
|
-
return null;
|
|
1787
|
-
}
|
|
1788
|
-
throw error;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
async next(block) {
|
|
1793
|
-
var error, future_pointer, pointer;
|
|
1794
|
-
try {
|
|
1795
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
1796
|
-
return hakuban_object_expose_contract_next(pointer);
|
|
1797
|
-
});
|
|
1798
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1799
|
-
this.local_exchange.notify();
|
|
1800
|
-
if (pointer != null) {
|
|
1801
|
-
return (await new ObjectStateSink(this.local_exchange, pointer).do_and_drop_or_return(block));
|
|
1802
|
-
} else {
|
|
1803
|
-
return null;
|
|
1804
|
-
}
|
|
1805
|
-
} catch (error1) {
|
|
1806
|
-
error = error1;
|
|
1807
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1808
|
-
return null;
|
|
1809
|
-
}
|
|
1810
|
-
throw error;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
ready(block) {
|
|
1815
|
-
var error, pointer;
|
|
1816
|
-
try {
|
|
1817
|
-
pointer = this.with_pointer((pointer) => {
|
|
1818
|
-
return unwrap_pointer_or_null(hakuban_object_expose_contract_ready(pointer));
|
|
1819
|
-
});
|
|
1820
|
-
this.local_exchange.notify();
|
|
1821
|
-
if (pointer != null) {
|
|
1822
|
-
return new ObjectStateSink(this.local_exchange, pointer).do_and_drop_or_return(block);
|
|
1823
|
-
} else {
|
|
1824
|
-
return null;
|
|
1825
|
-
}
|
|
1826
|
-
} catch (error1) {
|
|
1827
|
-
error = error1;
|
|
1828
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1829
|
-
return null;
|
|
1830
|
-
}
|
|
1831
|
-
throw error;
|
|
1832
|
-
}
|
|
1424
|
+
this.exchange.notify();
|
|
1833
1425
|
}
|
|
1834
1426
|
|
|
1835
1427
|
};
|
|
1836
1428
|
|
|
1837
|
-
var TagObserveContract = class TagObserveContract extends
|
|
1838
|
-
constructor(
|
|
1429
|
+
var TagObserveContract = class TagObserveContract extends FFIObject {
|
|
1430
|
+
constructor(exchange, descriptor) {
|
|
1839
1431
|
super();
|
|
1840
|
-
this
|
|
1432
|
+
Stream.mixin(this, hakuban_tag_observe_contract_next, ObjectStateStream);
|
|
1433
|
+
this.exchange = exchange;
|
|
1841
1434
|
this.descriptor = descriptor;
|
|
1842
1435
|
if (!(this.descriptor instanceof TagDescriptor)) {
|
|
1843
1436
|
this.descriptor = new TagDescriptor(this.descriptor);
|
|
1844
1437
|
}
|
|
1845
|
-
this.
|
|
1438
|
+
this.exchange.with_pointer((exchange_pointer) => {
|
|
1846
1439
|
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1847
|
-
return this.initialize_pointer(this.
|
|
1440
|
+
return this.initialize_pointer(this.exchange, hakuban_tag_observe_contract_new(exchange_pointer, descriptor_pointer), hakuban_tag_observe_contract_drop);
|
|
1848
1441
|
});
|
|
1849
1442
|
});
|
|
1850
|
-
this.
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
terminate() {
|
|
1854
|
-
var error;
|
|
1855
|
-
try {
|
|
1856
|
-
this.with_pointer((pointer) => {
|
|
1857
|
-
return hakuban_tag_observe_contract_terminate(pointer);
|
|
1858
|
-
});
|
|
1859
|
-
return this.local_exchange.notify();
|
|
1860
|
-
} catch (error1) {
|
|
1861
|
-
error = error1;
|
|
1862
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1863
|
-
return null;
|
|
1864
|
-
}
|
|
1865
|
-
throw error;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
async next(block) {
|
|
1870
|
-
var error, future_pointer, pointer;
|
|
1871
|
-
try {
|
|
1872
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
1873
|
-
return hakuban_tag_observe_contract_next(pointer);
|
|
1874
|
-
});
|
|
1875
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1876
|
-
this.local_exchange.notify();
|
|
1877
|
-
if (pointer != null) {
|
|
1878
|
-
return new ObjectStateStream(this.local_exchange, pointer).do_and_drop_or_return(block);
|
|
1879
|
-
} else {
|
|
1880
|
-
return null;
|
|
1881
|
-
}
|
|
1882
|
-
} catch (error1) {
|
|
1883
|
-
error = error1;
|
|
1884
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1885
|
-
return null;
|
|
1886
|
-
}
|
|
1887
|
-
throw error;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
ready(block) {
|
|
1892
|
-
var error, pointer, pointers;
|
|
1893
|
-
try {
|
|
1894
|
-
pointers = this.with_pointer((pointer) => {
|
|
1895
|
-
return hakuban_tag_observe_contract_ready(pointer);
|
|
1896
|
-
});
|
|
1897
|
-
this.local_exchange.notify();
|
|
1898
|
-
return do_and_drop_or_return((function() {
|
|
1899
|
-
var i, len, results;
|
|
1900
|
-
results = [];
|
|
1901
|
-
for (i = 0, len = pointers.length; i < len; i++) {
|
|
1902
|
-
pointer = pointers[i];
|
|
1903
|
-
results.push(new ObjectStateStream(this.local_exchange, pointer));
|
|
1904
|
-
}
|
|
1905
|
-
return results;
|
|
1906
|
-
}).call(this), block);
|
|
1907
|
-
} catch (error1) {
|
|
1908
|
-
error = error1;
|
|
1909
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1910
|
-
return null;
|
|
1911
|
-
}
|
|
1912
|
-
throw error;
|
|
1913
|
-
}
|
|
1443
|
+
this.exchange.notify();
|
|
1914
1444
|
}
|
|
1915
1445
|
|
|
1916
1446
|
};
|
|
1917
1447
|
|
|
1918
|
-
var TagExposeContract = class TagExposeContract extends
|
|
1919
|
-
constructor(
|
|
1448
|
+
var TagExposeContract = class TagExposeContract extends FFIObject {
|
|
1449
|
+
constructor(exchange, descriptor, capacity) {
|
|
1920
1450
|
super();
|
|
1921
|
-
this
|
|
1451
|
+
Stream.mixin(this, hakuban_tag_expose_contract_next, ObjectStateSink);
|
|
1452
|
+
this.exchange = exchange;
|
|
1922
1453
|
this.descriptor = descriptor;
|
|
1923
1454
|
if (!(this.descriptor instanceof TagDescriptor)) {
|
|
1924
1455
|
this.descriptor = new TagDescriptor(this.descriptor);
|
|
1925
1456
|
}
|
|
1926
|
-
this.
|
|
1457
|
+
this.exchange.with_pointer((exchange_pointer) => {
|
|
1927
1458
|
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1928
|
-
return this.initialize_pointer(this.
|
|
1459
|
+
return this.initialize_pointer(this.exchange, hakuban_tag_expose_contract_new(exchange_pointer, descriptor_pointer, capacity), hakuban_tag_expose_contract_drop);
|
|
1929
1460
|
});
|
|
1930
1461
|
});
|
|
1931
|
-
this.
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
terminate() {
|
|
1935
|
-
var error;
|
|
1936
|
-
try {
|
|
1937
|
-
this.with_pointer((pointer) => {
|
|
1938
|
-
return hakuban_tag_expose_contract_terminate(pointer);
|
|
1939
|
-
});
|
|
1940
|
-
return this.local_exchange.notify();
|
|
1941
|
-
} catch (error1) {
|
|
1942
|
-
error = error1;
|
|
1943
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1944
|
-
return null;
|
|
1945
|
-
}
|
|
1946
|
-
throw error;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
async next(block) {
|
|
1951
|
-
var error, future_pointer, pointer;
|
|
1952
|
-
try {
|
|
1953
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
1954
|
-
return hakuban_tag_expose_contract_next(pointer);
|
|
1955
|
-
});
|
|
1956
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
1957
|
-
this.local_exchange.notify();
|
|
1958
|
-
if (pointer != null) {
|
|
1959
|
-
return new ObjectStateSink(this.local_exchange, pointer).do_and_drop_or_return(block);
|
|
1960
|
-
} else {
|
|
1961
|
-
return null;
|
|
1962
|
-
}
|
|
1963
|
-
} catch (error1) {
|
|
1964
|
-
error = error1;
|
|
1965
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1966
|
-
return null;
|
|
1967
|
-
}
|
|
1968
|
-
throw error;
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
ready(block) {
|
|
1973
|
-
var error, pointer, pointers;
|
|
1974
|
-
try {
|
|
1975
|
-
pointers = this.with_pointer((pointer) => {
|
|
1976
|
-
return hakuban_tag_expose_contract_ready(pointer);
|
|
1977
|
-
});
|
|
1978
|
-
this.local_exchange.notify();
|
|
1979
|
-
return do_and_drop_or_return((function() {
|
|
1980
|
-
var i, len, results;
|
|
1981
|
-
results = [];
|
|
1982
|
-
for (i = 0, len = pointers.length; i < len; i++) {
|
|
1983
|
-
pointer = pointers[i];
|
|
1984
|
-
results.push(new ObjectStateSink(this.local_exchange, pointer));
|
|
1985
|
-
}
|
|
1986
|
-
return results;
|
|
1987
|
-
}).call(this), block);
|
|
1988
|
-
} catch (error1) {
|
|
1989
|
-
error = error1;
|
|
1990
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
1991
|
-
return null;
|
|
1992
|
-
}
|
|
1993
|
-
throw error;
|
|
1994
|
-
}
|
|
1462
|
+
this.exchange.notify();
|
|
1995
1463
|
}
|
|
1996
1464
|
|
|
1997
1465
|
};
|
|
1998
1466
|
|
|
1999
|
-
var
|
|
1467
|
+
var ObjectExposeContractBuilder, ObjectObserveContractBuilder, TagExposeContractBuilder, TagObserveContractBuilder;
|
|
2000
1468
|
|
|
2001
|
-
var
|
|
1469
|
+
var Exchange = class Exchange extends FFIObject {
|
|
2002
1470
|
constructor(name = "wasm") {
|
|
2003
1471
|
super();
|
|
2004
1472
|
this.name = name;
|
|
2005
1473
|
this._notification_sequence = BigInt(0);
|
|
2006
1474
|
this._notification_resolve = {};
|
|
2007
|
-
this.initialize_pointer(null, unwrap_pointer(
|
|
1475
|
+
this.initialize_pointer(null, unwrap_pointer(hakuban_exchange_new(this.name)), hakuban_exchange_drop);
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
object_observe_contract(descriptor_or_tags, json_or_nothing) {
|
|
1479
|
+
return new ObjectObserveContractBuilder(this, [descriptor_or_tags, json_or_nothing]);
|
|
2008
1480
|
}
|
|
2009
1481
|
|
|
2010
|
-
|
|
2011
|
-
return new
|
|
1482
|
+
object_expose_contract(descriptor_or_tags, json_or_nothing) {
|
|
1483
|
+
return new ObjectExposeContractBuilder(this, [descriptor_or_tags, json_or_nothing]);
|
|
2012
1484
|
}
|
|
2013
1485
|
|
|
2014
|
-
|
|
2015
|
-
return new
|
|
1486
|
+
tag_observe_contract(descriptor) {
|
|
1487
|
+
return new TagObserveContractBuilder(this, descriptor);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
tag_expose_contract(descriptor) {
|
|
1491
|
+
return new TagExposeContractBuilder(this, descriptor);
|
|
2016
1492
|
}
|
|
2017
1493
|
|
|
2018
1494
|
notified() {
|
|
@@ -2028,7 +1504,7 @@ var LocalExchange = class LocalExchange extends FFIObject {
|
|
|
2028
1504
|
notify() {
|
|
2029
1505
|
var i, id, len, ref, results;
|
|
2030
1506
|
ref = this.with_pointer(function(pointer) {
|
|
2031
|
-
return
|
|
1507
|
+
return hakuban_exchange_notified(pointer);
|
|
2032
1508
|
});
|
|
2033
1509
|
results = [];
|
|
2034
1510
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
@@ -2050,73 +1526,81 @@ var LocalExchange = class LocalExchange extends FFIObject {
|
|
|
2050
1526
|
|
|
2051
1527
|
};
|
|
2052
1528
|
|
|
2053
|
-
|
|
2054
|
-
constructor(
|
|
2055
|
-
this.
|
|
1529
|
+
ObjectObserveContractBuilder = class ObjectObserveContractBuilder {
|
|
1530
|
+
constructor(exchange, descriptor1) {
|
|
1531
|
+
this.exchange = exchange;
|
|
1532
|
+
this.descriptor = descriptor1;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
build(block) {
|
|
1536
|
+
return new ObjectObserveContract(this.exchange, this.descriptor).do_and_drop_or_return(block);
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
ObjectExposeContractBuilder = class ObjectExposeContractBuilder {
|
|
1542
|
+
constructor(exchange, descriptor1) {
|
|
1543
|
+
this.exchange = exchange;
|
|
2056
1544
|
this.descriptor = descriptor1;
|
|
1545
|
+
this.capacity = 1;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
with_capacity(capacity) {
|
|
1549
|
+
return this.capacity = capacity;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
build(block) {
|
|
1553
|
+
return new ObjectExposeContract(this.exchange, this.descriptor, this.capacity).do_and_drop_or_return(block);
|
|
2057
1554
|
}
|
|
2058
1555
|
|
|
2059
|
-
|
|
2060
|
-
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
TagObserveContractBuilder = class TagObserveContractBuilder {
|
|
1559
|
+
constructor(exchange, descriptor1) {
|
|
1560
|
+
this.exchange = exchange;
|
|
1561
|
+
this.descriptor = descriptor1;
|
|
2061
1562
|
}
|
|
2062
1563
|
|
|
2063
|
-
|
|
2064
|
-
return new
|
|
1564
|
+
build(block) {
|
|
1565
|
+
return new TagObserveContract(this.exchange, this.descriptor).do_and_drop_or_return(block);
|
|
2065
1566
|
}
|
|
2066
1567
|
|
|
2067
1568
|
};
|
|
2068
1569
|
|
|
2069
|
-
|
|
2070
|
-
constructor(
|
|
2071
|
-
this.
|
|
1570
|
+
TagExposeContractBuilder = class TagExposeContractBuilder {
|
|
1571
|
+
constructor(exchange, descriptor1) {
|
|
1572
|
+
this.exchange = exchange;
|
|
2072
1573
|
this.descriptor = descriptor1;
|
|
1574
|
+
this.capacity = 1;
|
|
2073
1575
|
}
|
|
2074
1576
|
|
|
2075
|
-
|
|
2076
|
-
return
|
|
1577
|
+
with_capacity(capacity) {
|
|
1578
|
+
return this.capacity = capacity;
|
|
2077
1579
|
}
|
|
2078
1580
|
|
|
2079
|
-
|
|
2080
|
-
return new TagExposeContract(this.
|
|
1581
|
+
build(block) {
|
|
1582
|
+
return new TagExposeContract(this.exchange, this.descriptor, this.capacity).do_and_drop_or_return(block);
|
|
2081
1583
|
}
|
|
2082
1584
|
|
|
2083
1585
|
};
|
|
2084
1586
|
|
|
2085
|
-
var
|
|
2086
|
-
constructor(
|
|
1587
|
+
var UpstreamConnection = class UpstreamConnection extends FFIObject {
|
|
1588
|
+
constructor(exchange, local_name, local_address) {
|
|
2087
1589
|
super();
|
|
2088
|
-
this
|
|
2089
|
-
this.
|
|
2090
|
-
|
|
1590
|
+
Stream.mixin(this, hakuban_upstream_connection_next_message_to_network, void 0, "UpstreamConnection");
|
|
1591
|
+
this.exchange = exchange;
|
|
1592
|
+
this.exchange.with_pointer((exchange_pointer) => {
|
|
1593
|
+
return this.initialize_pointer(this.exchange, hakuban_upstream_connection_new(exchange_pointer, local_name, local_address), hakuban_upstream_connection_drop);
|
|
2091
1594
|
});
|
|
2092
1595
|
}
|
|
2093
1596
|
|
|
2094
|
-
async next() {
|
|
2095
|
-
var error, future_pointer, pointer;
|
|
2096
|
-
try {
|
|
2097
|
-
future_pointer = this.with_pointer((pointer) => {
|
|
2098
|
-
return hakuban_remote_exchange_next_message_to_network(pointer);
|
|
2099
|
-
});
|
|
2100
|
-
pointer = (await new Future(this.local_exchange, this, hakuban_future_returning_pointer_poll, hakuban_future_returning_pointer_drop, future_pointer).await_and_drop());
|
|
2101
|
-
this.local_exchange.notify();
|
|
2102
|
-
return pointer;
|
|
2103
|
-
} catch (error1) {
|
|
2104
|
-
error = error1;
|
|
2105
|
-
if (error instanceof PointerAlreadyDropped$1) {
|
|
2106
|
-
return null;
|
|
2107
|
-
}
|
|
2108
|
-
throw error;
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
1597
|
async send(data) {
|
|
2113
1598
|
var error, future_pointer;
|
|
2114
1599
|
try {
|
|
2115
1600
|
future_pointer = this.with_pointer((pointer) => {
|
|
2116
|
-
return
|
|
1601
|
+
return hakuban_upstream_connection_send_message_from_network(pointer, new Uint8Array(data));
|
|
2117
1602
|
});
|
|
2118
|
-
await new Future(this.
|
|
2119
|
-
return this.local_exchange.notify();
|
|
1603
|
+
return (await new Future(this.exchange, this, hakuban_future_poll, hakuban_future_drop, future_pointer, "UpstreamConnection.send").await_and_drop());
|
|
2120
1604
|
} catch (error1) {
|
|
2121
1605
|
error = error1;
|
|
2122
1606
|
if (error instanceof PointerAlreadyDropped$1) {
|
|
@@ -2129,14 +1613,15 @@ var RemoteExchange = class RemoteExchange extends FFIObject {
|
|
|
2129
1613
|
};
|
|
2130
1614
|
|
|
2131
1615
|
//TODO: hide private methods
|
|
1616
|
+
//TODO: implement timeout
|
|
1617
|
+
//TODO: make timeout and keep-alive interval configurable
|
|
2132
1618
|
var WebsocketConnector = class WebsocketConnector {
|
|
2133
|
-
constructor(
|
|
1619
|
+
constructor(exchange, uri) {
|
|
2134
1620
|
this.connect = this.connect.bind(this);
|
|
2135
1621
|
this.ping = this.ping.bind(this);
|
|
2136
1622
|
this.send = this.send.bind(this);
|
|
2137
|
-
this.
|
|
1623
|
+
this.exchange = exchange;
|
|
2138
1624
|
this.uri = uri;
|
|
2139
|
-
this.options = options;
|
|
2140
1625
|
this._status_change({
|
|
2141
1626
|
connected: false
|
|
2142
1627
|
});
|
|
@@ -2146,6 +1631,7 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2146
1631
|
this.connect();
|
|
2147
1632
|
}
|
|
2148
1633
|
|
|
1634
|
+
//TOOD: make this iterable
|
|
2149
1635
|
status() {
|
|
2150
1636
|
return Promise.resolve([this.status, this.next_status_promise]);
|
|
2151
1637
|
}
|
|
@@ -2179,7 +1665,7 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2179
1665
|
this.socket = new WebSocket(this.uri);
|
|
2180
1666
|
} catch (error1) {
|
|
2181
1667
|
error = error1;
|
|
2182
|
-
console.error('Error connecting to
|
|
1668
|
+
console.error('Error connecting to remote exchange:', error);
|
|
2183
1669
|
this._status_change({
|
|
2184
1670
|
connected: false,
|
|
2185
1671
|
error: error
|
|
@@ -2187,16 +1673,15 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2187
1673
|
return false;
|
|
2188
1674
|
}
|
|
2189
1675
|
this.socket.binaryType = "arraybuffer";
|
|
2190
|
-
this.socket.onopen = () => {
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
}
|
|
2194
|
-
this.remote_exchange = new RemoteExchange(this.local_exchange, true, true, true);
|
|
1676
|
+
this.socket.onopen = (event) => {
|
|
1677
|
+
console.debug('Connected to remote exchange');
|
|
1678
|
+
this.upstream_connection = new UpstreamConnection(this.exchange, "js-client", "unknown");
|
|
2195
1679
|
this.forwarding_to_network_stopped = new Promise(async(resolve) => {
|
|
2196
|
-
var message_pointer;
|
|
1680
|
+
var message_pointer, ref;
|
|
2197
1681
|
try {
|
|
2198
|
-
|
|
2199
|
-
|
|
1682
|
+
ref = this.upstream_connection;
|
|
1683
|
+
for await (message_pointer of ref) {
|
|
1684
|
+
this.send(hakuban_message_serialize(message_pointer));
|
|
2200
1685
|
}
|
|
2201
1686
|
} catch (error1) {
|
|
2202
1687
|
error = error1;
|
|
@@ -2213,12 +1698,8 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2213
1698
|
};
|
|
2214
1699
|
// this may fire even if onopen never did
|
|
2215
1700
|
this.socket.onclose = async(event) => {
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
}
|
|
2219
|
-
if (this.options.debug && (this.remote_exchange == null)) {
|
|
2220
|
-
console.debug('Failed to connect to hakuban remote exchange');
|
|
2221
|
-
}
|
|
1701
|
+
console.debug('Disconnected from remote exchange');
|
|
1702
|
+
console.debug('Failed to connect to remote exchange');
|
|
2222
1703
|
this._status_change({
|
|
2223
1704
|
connected: false,
|
|
2224
1705
|
disconnect_reason: event.reason,
|
|
@@ -2233,22 +1714,25 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2233
1714
|
clearTimeout(this.reconnection_timer);
|
|
2234
1715
|
this.reconnection_timer = null;
|
|
2235
1716
|
}
|
|
2236
|
-
if (this.
|
|
2237
|
-
await this.
|
|
1717
|
+
if (this.upstream_connection != null) {
|
|
1718
|
+
await this.upstream_connection.drop();
|
|
2238
1719
|
await this.forwarding_to_network_stopped;
|
|
2239
1720
|
this.forwarding_to_network_stopped = null;
|
|
2240
|
-
this.
|
|
1721
|
+
this.upstream_connection = null;
|
|
2241
1722
|
}
|
|
2242
1723
|
if (this.reconnect_on_close) {
|
|
2243
1724
|
return this.reconnection_timer = setTimeout(this.connect, 1000);
|
|
2244
1725
|
}
|
|
2245
1726
|
};
|
|
2246
1727
|
return this.socket.onmessage = async(event) => {
|
|
2247
|
-
if (
|
|
1728
|
+
if ((event.data.byteLength === 0) || (event.data.length === 0) || (typeof event.data === 'string') || (event.data instanceof String)) {
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
if (this.upstream_connection == null) {
|
|
2248
1732
|
return;
|
|
2249
1733
|
}
|
|
2250
1734
|
try {
|
|
2251
|
-
return (await this.
|
|
1735
|
+
return (await this.upstream_connection.send(event.data));
|
|
2252
1736
|
} catch (error1) {
|
|
2253
1737
|
error = error1;
|
|
2254
1738
|
console.error('Error processing hakuban connection:', error);
|
|
@@ -2260,29 +1744,27 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2260
1744
|
}
|
|
2261
1745
|
|
|
2262
1746
|
ping() {
|
|
2263
|
-
if (this.socket) {
|
|
2264
|
-
return this.socket.send(
|
|
1747
|
+
if (this.socket != null) {
|
|
1748
|
+
return this.socket.send(".");
|
|
2265
1749
|
}
|
|
2266
1750
|
}
|
|
2267
1751
|
|
|
2268
1752
|
send(bytes_to_send) {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
clearInterval(this.keep_alive_interval);
|
|
2273
|
-
}
|
|
2274
|
-
return this.keep_alive_interval = setInterval(this.ping, 10000);
|
|
1753
|
+
this.socket.send(bytes_to_send);
|
|
1754
|
+
if (this.keep_alive_interval) {
|
|
1755
|
+
clearInterval(this.keep_alive_interval);
|
|
2275
1756
|
}
|
|
1757
|
+
return this.keep_alive_interval = setInterval(this.ping, 10000);
|
|
2276
1758
|
}
|
|
2277
1759
|
|
|
2278
1760
|
};
|
|
2279
1761
|
|
|
2280
1762
|
var initialize = async function(wasm, log_level) {
|
|
2281
1763
|
var result;
|
|
2282
|
-
result = (await
|
|
1764
|
+
result = (await __wbg_init(wasm));
|
|
2283
1765
|
logger_initialize(log_level);
|
|
2284
1766
|
return result;
|
|
2285
1767
|
};
|
|
2286
1768
|
|
|
2287
|
-
export {
|
|
1769
|
+
export { Exchange, ObjectDescriptor, ObjectExposeContract, ObjectObserveContract, ObjectState, TagDescriptor, TagExposeContract, TagObserveContract, WebsocketConnector, initialize };
|
|
2288
1770
|
//# sourceMappingURL=hakuban.js.map
|