hakuban 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -20
- package/hakuban-with-wasm.js +1533 -1917
- 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 +1532 -1915
- 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 +8 -2
package/hakuban.js
CHANGED
|
@@ -20,18 +20,87 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
let
|
|
23
|
+
let WASM_VECTOR_LEN = 0;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
26
26
|
|
|
27
|
-
let cachegetUint8Memory0 = null;
|
|
28
27
|
function getUint8Memory0() {
|
|
29
|
-
if (
|
|
30
|
-
|
|
28
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
29
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
30
|
+
}
|
|
31
|
+
return cachedUint8Memory0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
35
|
+
|
|
36
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
37
|
+
? function (arg, view) {
|
|
38
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
39
|
+
}
|
|
40
|
+
: function (arg, view) {
|
|
41
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
42
|
+
view.set(buf);
|
|
43
|
+
return {
|
|
44
|
+
read: arg.length,
|
|
45
|
+
written: buf.length
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
50
|
+
|
|
51
|
+
if (realloc === undefined) {
|
|
52
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
53
|
+
const ptr = malloc(buf.length);
|
|
54
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
55
|
+
WASM_VECTOR_LEN = buf.length;
|
|
56
|
+
return ptr;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let len = arg.length;
|
|
60
|
+
let ptr = malloc(len);
|
|
61
|
+
|
|
62
|
+
const mem = getUint8Memory0();
|
|
63
|
+
|
|
64
|
+
let offset = 0;
|
|
65
|
+
|
|
66
|
+
for (; offset < len; offset++) {
|
|
67
|
+
const code = arg.charCodeAt(offset);
|
|
68
|
+
if (code > 0x7F) break;
|
|
69
|
+
mem[ptr + offset] = code;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (offset !== len) {
|
|
73
|
+
if (offset !== 0) {
|
|
74
|
+
arg = arg.slice(offset);
|
|
75
|
+
}
|
|
76
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
77
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
78
|
+
const ret = encodeString(arg, view);
|
|
79
|
+
|
|
80
|
+
offset += ret.written;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
WASM_VECTOR_LEN = offset;
|
|
84
|
+
return ptr;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function isLikeNone(x) {
|
|
88
|
+
return x === undefined || x === null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let cachedInt32Memory0 = new Int32Array();
|
|
92
|
+
|
|
93
|
+
function getInt32Memory0() {
|
|
94
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
95
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
31
96
|
}
|
|
32
|
-
return
|
|
97
|
+
return cachedInt32Memory0;
|
|
33
98
|
}
|
|
34
99
|
|
|
100
|
+
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
101
|
+
|
|
102
|
+
cachedTextDecoder.decode();
|
|
103
|
+
|
|
35
104
|
function getStringFromWasm0(ptr, len) {
|
|
36
105
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
37
106
|
}
|
|
@@ -109,220 +178,173 @@ function debugString(val) {
|
|
|
109
178
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
110
179
|
return className;
|
|
111
180
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return
|
|
181
|
+
/**
|
|
182
|
+
* @param {number} local_exchange
|
|
183
|
+
* @param {number} descriptor
|
|
184
|
+
* @returns {number}
|
|
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;
|
|
120
189
|
}
|
|
121
|
-
: function (arg, view) {
|
|
122
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
123
|
-
view.set(buf);
|
|
124
|
-
return {
|
|
125
|
-
read: arg.length,
|
|
126
|
-
written: buf.length
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
131
|
-
|
|
132
|
-
if (realloc === undefined) {
|
|
133
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
134
|
-
const ptr = malloc(buf.length);
|
|
135
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
136
|
-
WASM_VECTOR_LEN = buf.length;
|
|
137
|
-
return ptr;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
let len = arg.length;
|
|
141
|
-
let ptr = malloc(len);
|
|
142
|
-
|
|
143
|
-
const mem = getUint8Memory0();
|
|
144
|
-
|
|
145
|
-
let offset = 0;
|
|
146
|
-
|
|
147
|
-
for (; offset < len; offset++) {
|
|
148
|
-
const code = arg.charCodeAt(offset);
|
|
149
|
-
if (code > 0x7F) break;
|
|
150
|
-
mem[ptr + offset] = code;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (offset !== len) {
|
|
154
|
-
if (offset !== 0) {
|
|
155
|
-
arg = arg.slice(offset);
|
|
156
|
-
}
|
|
157
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
158
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
159
|
-
const ret = encodeString(arg, view);
|
|
160
190
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
191
|
+
/**
|
|
192
|
+
* @param {number} tag_expose_contract_pointer
|
|
193
|
+
*/
|
|
194
|
+
function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
|
|
195
|
+
wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
|
|
166
196
|
}
|
|
167
197
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return cachegetInt32Memory0;
|
|
198
|
+
/**
|
|
199
|
+
* @param {number} tag_expose_pointer
|
|
200
|
+
*/
|
|
201
|
+
function hakuban_tag_expose_contract_terminate(tag_expose_pointer) {
|
|
202
|
+
wasm.hakuban_tag_expose_contract_terminate(tag_expose_pointer);
|
|
174
203
|
}
|
|
175
204
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
state.a = 0;
|
|
185
|
-
try {
|
|
186
|
-
return f(a, state.b, ...args);
|
|
187
|
-
} finally {
|
|
188
|
-
if (--state.cnt === 0) {
|
|
189
|
-
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
|
205
|
+
/**
|
|
206
|
+
* @param {number} tag_expose_pointer
|
|
207
|
+
* @returns {number}
|
|
208
|
+
*/
|
|
209
|
+
function hakuban_tag_expose_contract_next(tag_expose_pointer) {
|
|
210
|
+
const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
|
|
211
|
+
return ret;
|
|
212
|
+
}
|
|
190
213
|
|
|
191
|
-
|
|
192
|
-
state.a = a;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
real.original = state;
|
|
214
|
+
let cachedUint32Memory0 = new Uint32Array();
|
|
197
215
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
216
|
+
function getUint32Memory0() {
|
|
217
|
+
if (cachedUint32Memory0.byteLength === 0) {
|
|
218
|
+
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
219
|
+
}
|
|
220
|
+
return cachedUint32Memory0;
|
|
202
221
|
}
|
|
203
222
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
223
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
224
|
+
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
225
|
+
}
|
|
207
226
|
/**
|
|
208
|
-
* @param {
|
|
209
|
-
* @returns {
|
|
227
|
+
* @param {number} tag_expose_pointer
|
|
228
|
+
* @returns {Uint32Array}
|
|
210
229
|
*/
|
|
211
|
-
function
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
230
|
+
function hakuban_tag_expose_contract_ready(tag_expose_pointer) {
|
|
231
|
+
try {
|
|
232
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
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
|
+
}
|
|
216
242
|
}
|
|
217
243
|
|
|
218
244
|
/**
|
|
219
|
-
* @param {
|
|
245
|
+
* @param {number} local_exchange
|
|
246
|
+
* @param {number} descriptor
|
|
220
247
|
* @returns {number}
|
|
221
248
|
*/
|
|
222
|
-
function
|
|
223
|
-
|
|
224
|
-
var len0 = WASM_VECTOR_LEN;
|
|
225
|
-
var ret = wasm.hakuban_logger_initialize(ptr0, len0);
|
|
249
|
+
function hakuban_tag_observe_contract_new(local_exchange, descriptor) {
|
|
250
|
+
const ret = wasm.hakuban_tag_observe_contract_new(local_exchange, descriptor);
|
|
226
251
|
return ret;
|
|
227
252
|
}
|
|
228
253
|
|
|
229
254
|
/**
|
|
230
|
-
* @param {
|
|
231
|
-
* @returns {WasmLocalNodeNewResult}
|
|
255
|
+
* @param {number} tag_pointer
|
|
232
256
|
*/
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
var len0 = WASM_VECTOR_LEN;
|
|
236
|
-
var ret = wasm.hakuban_local_node_new(ptr0, len0);
|
|
237
|
-
return WasmLocalNodeNewResult.__wrap(ret);
|
|
257
|
+
function hakuban_tag_observe_contract_drop(tag_pointer) {
|
|
258
|
+
wasm.hakuban_tag_observe_contract_drop(tag_pointer);
|
|
238
259
|
}
|
|
239
260
|
|
|
240
261
|
/**
|
|
241
|
-
* @param {number}
|
|
262
|
+
* @param {number} tag_observe_pointer
|
|
242
263
|
*/
|
|
243
|
-
function
|
|
244
|
-
wasm.
|
|
264
|
+
function hakuban_tag_observe_contract_terminate(tag_observe_pointer) {
|
|
265
|
+
wasm.hakuban_tag_observe_contract_terminate(tag_observe_pointer);
|
|
245
266
|
}
|
|
246
267
|
|
|
247
268
|
/**
|
|
248
|
-
* @param {number}
|
|
249
|
-
* @
|
|
250
|
-
* @returns {WasmObjectObserveResult}
|
|
269
|
+
* @param {number} tag_observe_pointer
|
|
270
|
+
* @returns {number}
|
|
251
271
|
*/
|
|
252
|
-
function
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
var ret = wasm.hakuban_object_observe_new(local_node, ptr0, len0);
|
|
256
|
-
return WasmObjectObserveResult.__wrap(ret);
|
|
272
|
+
function hakuban_tag_observe_contract_next(tag_observe_pointer) {
|
|
273
|
+
const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
|
|
274
|
+
return ret;
|
|
257
275
|
}
|
|
258
276
|
|
|
259
277
|
/**
|
|
260
|
-
* @param {number}
|
|
278
|
+
* @param {number} tag_observe_pointer
|
|
279
|
+
* @returns {Uint32Array}
|
|
261
280
|
*/
|
|
262
|
-
function
|
|
263
|
-
|
|
281
|
+
function hakuban_tag_observe_contract_ready(tag_observe_pointer) {
|
|
282
|
+
try {
|
|
283
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
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
|
+
}
|
|
264
293
|
}
|
|
265
294
|
|
|
266
295
|
/**
|
|
267
|
-
* @param {
|
|
268
|
-
* @returns {
|
|
296
|
+
* @param {string} json_string
|
|
297
|
+
* @returns {WasmResultWithPointer}
|
|
269
298
|
*/
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
|
|
299
|
+
function hakuban_tag_descriptor_new(json_string) {
|
|
300
|
+
const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
301
|
+
const len0 = WASM_VECTOR_LEN;
|
|
302
|
+
const ret = wasm.hakuban_tag_descriptor_new(ptr0, len0);
|
|
303
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
273
304
|
}
|
|
274
305
|
|
|
275
306
|
/**
|
|
276
|
-
* @param {number}
|
|
307
|
+
* @param {number} descriptor_pointer
|
|
277
308
|
*/
|
|
278
|
-
function
|
|
279
|
-
wasm.
|
|
309
|
+
function hakuban_tag_descriptor_drop(descriptor_pointer) {
|
|
310
|
+
wasm.hakuban_tag_descriptor_drop(descriptor_pointer);
|
|
280
311
|
}
|
|
281
312
|
|
|
313
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
314
|
+
const ptr = malloc(arg.length * 4);
|
|
315
|
+
getUint32Memory0().set(arg, ptr / 4);
|
|
316
|
+
WASM_VECTOR_LEN = arg.length;
|
|
317
|
+
return ptr;
|
|
318
|
+
}
|
|
282
319
|
/**
|
|
283
|
-
* @param {
|
|
284
|
-
* @
|
|
320
|
+
* @param {string} json_string
|
|
321
|
+
* @param {Uint32Array} tag_pointers
|
|
322
|
+
* @returns {WasmResultWithPointer}
|
|
285
323
|
*/
|
|
286
|
-
function
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
u32CvtShim[1] = r1;
|
|
294
|
-
const n0 = uint64CvtShim[0];
|
|
295
|
-
return n0;
|
|
296
|
-
} finally {
|
|
297
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
298
|
-
}
|
|
324
|
+
function hakuban_object_descriptor_new(json_string, tag_pointers) {
|
|
325
|
+
const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
const ptr1 = passArray32ToWasm0(tag_pointers, wasm.__wbindgen_malloc);
|
|
328
|
+
const len1 = WASM_VECTOR_LEN;
|
|
329
|
+
const ret = wasm.hakuban_object_descriptor_new(ptr0, len0, ptr1, len1);
|
|
330
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
299
331
|
}
|
|
300
332
|
|
|
301
333
|
/**
|
|
302
|
-
* @param {number}
|
|
303
|
-
* @returns {string}
|
|
334
|
+
* @param {number} descriptor_pointer
|
|
304
335
|
*/
|
|
305
|
-
function
|
|
306
|
-
|
|
307
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
308
|
-
wasm.hakuban_object_observe_state_data_version(retptr, state_ptr);
|
|
309
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
310
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
311
|
-
return getStringFromWasm0(r0, r1);
|
|
312
|
-
} finally {
|
|
313
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
314
|
-
wasm.__wbindgen_free(r0, r1);
|
|
315
|
-
}
|
|
336
|
+
function hakuban_object_descriptor_drop(descriptor_pointer) {
|
|
337
|
+
wasm.hakuban_object_descriptor_drop(descriptor_pointer);
|
|
316
338
|
}
|
|
317
339
|
|
|
318
340
|
/**
|
|
319
|
-
* @param {number}
|
|
341
|
+
* @param {number} descriptor_pointer
|
|
320
342
|
* @returns {string}
|
|
321
343
|
*/
|
|
322
|
-
function
|
|
344
|
+
function hakuban_object_descriptor_json(descriptor_pointer) {
|
|
323
345
|
try {
|
|
324
346
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
325
|
-
wasm.
|
|
347
|
+
wasm.hakuban_object_descriptor_json(retptr, descriptor_pointer);
|
|
326
348
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
327
349
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
328
350
|
return getStringFromWasm0(r0, r1);
|
|
@@ -332,21 +354,18 @@ function hakuban_object_observe_state_data_type(state_ptr) {
|
|
|
332
354
|
}
|
|
333
355
|
}
|
|
334
356
|
|
|
335
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
336
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
337
|
-
}
|
|
338
357
|
/**
|
|
339
|
-
* @param {number}
|
|
340
|
-
* @returns {
|
|
358
|
+
* @param {number} descriptor_pointer
|
|
359
|
+
* @returns {Uint32Array}
|
|
341
360
|
*/
|
|
342
|
-
function
|
|
361
|
+
function hakuban_object_descriptor_tags(descriptor_pointer) {
|
|
343
362
|
try {
|
|
344
363
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
345
|
-
wasm.
|
|
364
|
+
wasm.hakuban_object_descriptor_tags(retptr, descriptor_pointer);
|
|
346
365
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
347
366
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
348
|
-
var v0 =
|
|
349
|
-
wasm.__wbindgen_free(r0, r1 *
|
|
367
|
+
var v0 = getArrayU32FromWasm0(r0, r1).slice();
|
|
368
|
+
wasm.__wbindgen_free(r0, r1 * 4);
|
|
350
369
|
return v0;
|
|
351
370
|
} finally {
|
|
352
371
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -354,125 +373,152 @@ function hakuban_object_observe_state_data(state_ptr) {
|
|
|
354
373
|
}
|
|
355
374
|
|
|
356
375
|
/**
|
|
357
|
-
* @param {
|
|
376
|
+
* @param {string} default_log_level
|
|
358
377
|
* @returns {number}
|
|
359
378
|
*/
|
|
360
|
-
function
|
|
361
|
-
|
|
362
|
-
|
|
379
|
+
function hakuban_logger_initialize(default_log_level) {
|
|
380
|
+
const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
const ret = wasm.hakuban_logger_initialize(ptr0, len0);
|
|
383
|
+
return ret >>> 0;
|
|
363
384
|
}
|
|
364
385
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
386
|
+
let cachedBigUint64Memory0 = new BigUint64Array();
|
|
387
|
+
|
|
388
|
+
function getBigUint64Memory0() {
|
|
389
|
+
if (cachedBigUint64Memory0.byteLength === 0) {
|
|
390
|
+
cachedBigUint64Memory0 = new BigUint64Array(wasm.memory.buffer);
|
|
391
|
+
}
|
|
392
|
+
return cachedBigUint64Memory0;
|
|
370
393
|
}
|
|
371
394
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
function hakuban_object_descriptor_events_next(events_pointer, cancel) {
|
|
378
|
-
var ret = wasm.hakuban_object_descriptor_events_next(events_pointer, addHeapObject(cancel));
|
|
379
|
-
return takeObject(ret);
|
|
395
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
396
|
+
const ptr = malloc(arg.length * 8);
|
|
397
|
+
getBigUint64Memory0().set(arg, ptr / 8);
|
|
398
|
+
WASM_VECTOR_LEN = arg.length;
|
|
399
|
+
return ptr;
|
|
380
400
|
}
|
|
381
401
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
var ret = wasm.hakuban_tag_observe_new(local_node, ptr0, len0);
|
|
391
|
-
return WasmTagObserveResult.__wrap(ret);
|
|
402
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
403
|
+
const ptr = malloc(array.length * 4);
|
|
404
|
+
const mem = getUint32Memory0();
|
|
405
|
+
for (let i = 0; i < array.length; i++) {
|
|
406
|
+
mem[ptr / 4 + i] = addHeapObject(array[i]);
|
|
407
|
+
}
|
|
408
|
+
WASM_VECTOR_LEN = array.length;
|
|
409
|
+
return ptr;
|
|
392
410
|
}
|
|
393
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
|
+
}
|
|
394
418
|
/**
|
|
395
|
-
* @param {
|
|
419
|
+
* @param {BigInt64Array} version
|
|
420
|
+
* @param {any[]} format_jsvalues
|
|
421
|
+
* @param {Uint8Array} data
|
|
422
|
+
* @param {bigint} synchronized_us_ago
|
|
423
|
+
* @returns {WasmResultWithPointer}
|
|
396
424
|
*/
|
|
397
|
-
function
|
|
398
|
-
wasm.
|
|
425
|
+
function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
|
|
426
|
+
const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
|
|
427
|
+
const len0 = WASM_VECTOR_LEN;
|
|
428
|
+
const ptr1 = passArrayJsValueToWasm0(format_jsvalues, wasm.__wbindgen_malloc);
|
|
429
|
+
const len1 = WASM_VECTOR_LEN;
|
|
430
|
+
const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
431
|
+
const len2 = WASM_VECTOR_LEN;
|
|
432
|
+
const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
|
|
433
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
399
434
|
}
|
|
400
435
|
|
|
401
436
|
/**
|
|
402
|
-
* @param {number}
|
|
403
|
-
* @param {string} object_descriptor
|
|
404
|
-
* @returns {WasmTagObserveObjectStateBorrowResult}
|
|
437
|
+
* @param {number} object_state_pointer
|
|
405
438
|
*/
|
|
406
|
-
function
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
439
|
+
function hakuban_object_state_drop(object_state_pointer) {
|
|
440
|
+
wasm.hakuban_object_state_drop(object_state_pointer);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
let cachedBigInt64Memory0 = new BigInt64Array();
|
|
444
|
+
|
|
445
|
+
function getBigInt64Memory0() {
|
|
446
|
+
if (cachedBigInt64Memory0.byteLength === 0) {
|
|
447
|
+
cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
|
|
448
|
+
}
|
|
449
|
+
return cachedBigInt64Memory0;
|
|
411
450
|
}
|
|
412
451
|
|
|
452
|
+
function getArrayI64FromWasm0(ptr, len) {
|
|
453
|
+
return getBigInt64Memory0().subarray(ptr / 8, ptr / 8 + len);
|
|
454
|
+
}
|
|
413
455
|
/**
|
|
414
|
-
* @param {number}
|
|
415
|
-
* @returns {
|
|
456
|
+
* @param {number} object_state_pointer
|
|
457
|
+
* @returns {BigInt64Array}
|
|
416
458
|
*/
|
|
417
|
-
function
|
|
459
|
+
function hakuban_object_state_version(object_state_pointer) {
|
|
418
460
|
try {
|
|
419
461
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
420
|
-
wasm.
|
|
462
|
+
wasm.hakuban_object_state_version(retptr, object_state_pointer);
|
|
421
463
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
422
464
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
423
|
-
|
|
465
|
+
var v0 = getArrayI64FromWasm0(r0, r1).slice();
|
|
466
|
+
wasm.__wbindgen_free(r0, r1 * 8);
|
|
467
|
+
return v0;
|
|
424
468
|
} finally {
|
|
425
469
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
426
|
-
wasm.__wbindgen_free(r0, r1);
|
|
427
470
|
}
|
|
428
471
|
}
|
|
429
472
|
|
|
430
473
|
/**
|
|
431
|
-
* @param {number}
|
|
432
|
-
* @returns {
|
|
474
|
+
* @param {number} object_state_pointer
|
|
475
|
+
* @returns {bigint}
|
|
433
476
|
*/
|
|
434
|
-
function
|
|
435
|
-
|
|
436
|
-
return ret;
|
|
477
|
+
function hakuban_object_state_synchronized_ago(object_state_pointer) {
|
|
478
|
+
const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
|
|
479
|
+
return BigInt.asUintN(64, ret);
|
|
437
480
|
}
|
|
438
481
|
|
|
439
|
-
function
|
|
440
|
-
|
|
482
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
483
|
+
const mem = getUint32Memory0();
|
|
484
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
485
|
+
const result = [];
|
|
486
|
+
for (let i = 0; i < slice.length; i++) {
|
|
487
|
+
result.push(takeObject(slice[i]));
|
|
488
|
+
}
|
|
489
|
+
return result;
|
|
441
490
|
}
|
|
442
491
|
/**
|
|
443
|
-
* @param {number}
|
|
444
|
-
* @
|
|
445
|
-
* @param {boolean | undefined} diff_produce
|
|
446
|
-
* @param {boolean | undefined} diff_request
|
|
447
|
-
* @returns {WasmRemoteNodeNewResult}
|
|
492
|
+
* @param {number} object_state_pointer
|
|
493
|
+
* @returns {any[]}
|
|
448
494
|
*/
|
|
449
|
-
function
|
|
450
|
-
|
|
451
|
-
|
|
495
|
+
function hakuban_object_state_format(object_state_pointer) {
|
|
496
|
+
try {
|
|
497
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
498
|
+
wasm.hakuban_object_state_format(retptr, object_state_pointer);
|
|
499
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
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
|
+
}
|
|
452
507
|
}
|
|
453
508
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
*/
|
|
457
|
-
function hakuban_remote_node_drop(remote_node_pointer) {
|
|
458
|
-
wasm.hakuban_remote_node_drop(remote_node_pointer);
|
|
509
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
510
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
459
511
|
}
|
|
460
|
-
|
|
461
512
|
/**
|
|
462
|
-
* @param {number}
|
|
513
|
+
* @param {number} object_state_pointer
|
|
463
514
|
* @returns {Uint8Array}
|
|
464
515
|
*/
|
|
465
|
-
function
|
|
516
|
+
function hakuban_object_state_data(object_state_pointer) {
|
|
466
517
|
try {
|
|
467
518
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
468
|
-
wasm.
|
|
519
|
+
wasm.hakuban_object_state_data(retptr, object_state_pointer);
|
|
469
520
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
470
521
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
471
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
472
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
473
|
-
if (r3) {
|
|
474
|
-
throw takeObject(r2);
|
|
475
|
-
}
|
|
476
522
|
var v0 = getArrayU8FromWasm0(r0, r1).slice();
|
|
477
523
|
wasm.__wbindgen_free(r0, r1 * 1);
|
|
478
524
|
return v0;
|
|
@@ -482,88 +528,75 @@ function hakuban_remote_node_connected(remote_node_pointer) {
|
|
|
482
528
|
}
|
|
483
529
|
|
|
484
530
|
/**
|
|
485
|
-
* @param {number}
|
|
531
|
+
* @param {number} object_state_stream_pointer
|
|
486
532
|
*/
|
|
487
|
-
function
|
|
488
|
-
wasm.
|
|
533
|
+
function hakuban_object_state_stream_drop(object_state_stream_pointer) {
|
|
534
|
+
wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
|
|
489
535
|
}
|
|
490
536
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
537
|
+
/**
|
|
538
|
+
* @param {number} object_state_stream_pointer
|
|
539
|
+
* @returns {number}
|
|
540
|
+
*/
|
|
541
|
+
function hakuban_object_state_stream_next(object_state_stream_pointer) {
|
|
542
|
+
const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
|
|
543
|
+
return ret;
|
|
496
544
|
}
|
|
545
|
+
|
|
497
546
|
/**
|
|
498
|
-
* @param {number}
|
|
499
|
-
* @
|
|
500
|
-
* @returns {Uint8Array}
|
|
547
|
+
* @param {number} object_state_stream_pointer
|
|
548
|
+
* @returns {WasmResultWithPointer}
|
|
501
549
|
*/
|
|
502
|
-
function
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
506
|
-
var len0 = WASM_VECTOR_LEN;
|
|
507
|
-
wasm.hakuban_remote_node_received_message(retptr, remote_node_pointer, ptr0, len0);
|
|
508
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
509
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
510
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
511
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
512
|
-
if (r3) {
|
|
513
|
-
throw takeObject(r2);
|
|
514
|
-
}
|
|
515
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
516
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
517
|
-
return v1;
|
|
518
|
-
} finally {
|
|
519
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
520
|
-
}
|
|
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);
|
|
521
553
|
}
|
|
522
554
|
|
|
523
555
|
/**
|
|
524
|
-
* @param {number}
|
|
525
|
-
* @
|
|
526
|
-
* @returns {Promise<any>}
|
|
556
|
+
* @param {number} object_state_stream_pointer
|
|
557
|
+
* @returns {number}
|
|
527
558
|
*/
|
|
528
|
-
function
|
|
529
|
-
|
|
530
|
-
return
|
|
559
|
+
function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
|
|
560
|
+
const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
|
|
561
|
+
return ret;
|
|
531
562
|
}
|
|
532
563
|
|
|
533
564
|
/**
|
|
534
|
-
* @param {number}
|
|
535
|
-
* @param {
|
|
536
|
-
* @
|
|
565
|
+
* @param {number} local_exchange_pointer
|
|
566
|
+
* @param {boolean} upstream
|
|
567
|
+
* @param {boolean} diff_produce
|
|
568
|
+
* @param {boolean} diff_request
|
|
569
|
+
* @returns {number}
|
|
537
570
|
*/
|
|
538
|
-
function
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* @param {number} remote_exchange_pointer
|
|
578
|
+
*/
|
|
579
|
+
function hakuban_remote_exchange_drop(remote_exchange_pointer) {
|
|
580
|
+
wasm.hakuban_remote_exchange_drop(remote_exchange_pointer);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* @param {number} remote_exchange_pointer
|
|
585
|
+
* @returns {number}
|
|
586
|
+
*/
|
|
587
|
+
function hakuban_remote_exchange_next_message_to_network(remote_exchange_pointer) {
|
|
588
|
+
const ret = wasm.hakuban_remote_exchange_next_message_to_network(remote_exchange_pointer);
|
|
589
|
+
return ret;
|
|
557
590
|
}
|
|
558
591
|
|
|
559
592
|
/**
|
|
560
|
-
* @param {number}
|
|
593
|
+
* @param {number} message_pointer
|
|
561
594
|
* @returns {Uint8Array}
|
|
562
595
|
*/
|
|
563
|
-
function
|
|
596
|
+
function hakuban_message_take(message_pointer) {
|
|
564
597
|
try {
|
|
565
598
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
566
|
-
wasm.
|
|
599
|
+
wasm.hakuban_message_take(retptr, message_pointer);
|
|
567
600
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
568
601
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
569
602
|
var v0 = getArrayU8FromWasm0(r0, r1).slice();
|
|
@@ -575,263 +608,250 @@ function hakuban_remote_node_ack(remote_node_pointer) {
|
|
|
575
608
|
}
|
|
576
609
|
|
|
577
610
|
/**
|
|
578
|
-
* @param {number}
|
|
579
|
-
* @param {
|
|
580
|
-
* @returns {
|
|
611
|
+
* @param {number} remote_exchange_pointer
|
|
612
|
+
* @param {Uint8Array} message_data
|
|
613
|
+
* @returns {number}
|
|
581
614
|
*/
|
|
582
|
-
function
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
return
|
|
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;
|
|
587
620
|
}
|
|
588
621
|
|
|
589
622
|
/**
|
|
590
|
-
* @param {number}
|
|
623
|
+
* @param {number} local_exchange_pointer
|
|
624
|
+
* @param {number} future_pointer
|
|
625
|
+
* @param {bigint} waker_id
|
|
626
|
+
* @returns {WasmResultWithPointer}
|
|
591
627
|
*/
|
|
592
|
-
function
|
|
593
|
-
wasm.
|
|
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);
|
|
594
631
|
}
|
|
595
632
|
|
|
596
633
|
/**
|
|
597
|
-
* @param {number}
|
|
598
|
-
* @returns {string}
|
|
634
|
+
* @param {number} future
|
|
599
635
|
*/
|
|
600
|
-
function
|
|
601
|
-
|
|
602
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
603
|
-
wasm.hakuban_tag_expose_object_descriptors(retptr, tag_expose_pointer);
|
|
604
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
605
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
606
|
-
return getStringFromWasm0(r0, r1);
|
|
607
|
-
} finally {
|
|
608
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
609
|
-
wasm.__wbindgen_free(r0, r1);
|
|
610
|
-
}
|
|
636
|
+
function hakuban_future_returning_pointer_drop(future) {
|
|
637
|
+
wasm.hakuban_future_returning_nothing_drop(future);
|
|
611
638
|
}
|
|
612
639
|
|
|
613
640
|
/**
|
|
614
|
-
* @param {number}
|
|
615
|
-
* @param {
|
|
616
|
-
* @param {
|
|
617
|
-
* @
|
|
618
|
-
* @param {Uint8Array} data
|
|
619
|
-
* @param {BigInt} assignment_id
|
|
620
|
-
* @returns {WasmTagExposeSetObjectStateResult}
|
|
641
|
+
* @param {number} local_exchange_pointer
|
|
642
|
+
* @param {number} future_pointer
|
|
643
|
+
* @param {bigint} waker_id
|
|
644
|
+
* @returns {WasmResultWithNothing}
|
|
621
645
|
*/
|
|
622
|
-
function
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
var ptr1 = passStringToWasm0(data_version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
626
|
-
var len1 = WASM_VECTOR_LEN;
|
|
627
|
-
var ptr2 = passStringToWasm0(data_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
628
|
-
var len2 = WASM_VECTOR_LEN;
|
|
629
|
-
var ptr3 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
630
|
-
var len3 = WASM_VECTOR_LEN;
|
|
631
|
-
uint64CvtShim[0] = assignment_id;
|
|
632
|
-
const low4 = u32CvtShim[0];
|
|
633
|
-
const high4 = u32CvtShim[1];
|
|
634
|
-
var ret = wasm.hakuban_tag_expose_set_object_state(tag_expose_pointer, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, low4, high4);
|
|
635
|
-
return WasmTagExposeSetObjectStateResult.__wrap(ret);
|
|
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);
|
|
636
649
|
}
|
|
637
650
|
|
|
638
651
|
/**
|
|
639
|
-
* @param {number}
|
|
640
|
-
* @param {string} object_descriptor
|
|
641
|
-
* @returns {WasmTagExposeAssignmentResult}
|
|
652
|
+
* @param {number} future
|
|
642
653
|
*/
|
|
643
|
-
function
|
|
644
|
-
|
|
645
|
-
var len0 = WASM_VECTOR_LEN;
|
|
646
|
-
var ret = wasm.hakuban_tag_expose_assignment(tag_expose_pointer, ptr0, len0);
|
|
647
|
-
return WasmTagExposeAssignmentResult.__wrap(ret);
|
|
654
|
+
function hakuban_future_returning_nothing_drop(future) {
|
|
655
|
+
wasm.hakuban_future_returning_nothing_drop(future);
|
|
648
656
|
}
|
|
649
657
|
|
|
650
658
|
/**
|
|
651
|
-
* @param {number}
|
|
652
|
-
* @param {string} object_descriptor
|
|
653
|
-
* @param {BigInt} assignment_id
|
|
659
|
+
* @param {number} object_state_sink_pointer
|
|
654
660
|
* @returns {number}
|
|
655
661
|
*/
|
|
656
|
-
function
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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);
|
|
664
672
|
}
|
|
665
673
|
|
|
666
674
|
/**
|
|
667
|
-
* @param {number}
|
|
675
|
+
* @param {number} object_state_sink_pointer
|
|
668
676
|
* @returns {number}
|
|
669
677
|
*/
|
|
670
|
-
function
|
|
671
|
-
|
|
678
|
+
function hakuban_object_state_sink_next(object_state_sink_pointer) {
|
|
679
|
+
const ret = wasm.hakuban_object_state_sink_next(object_state_sink_pointer);
|
|
672
680
|
return ret;
|
|
673
681
|
}
|
|
674
682
|
|
|
675
683
|
/**
|
|
676
|
-
* @param {number}
|
|
677
|
-
* @
|
|
678
|
-
* @returns {WasmObjectExposeResult}
|
|
684
|
+
* @param {number} object_state_sink_pointer
|
|
685
|
+
* @returns {WasmResultWithPointer}
|
|
679
686
|
*/
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
var ret = wasm.hakuban_object_expose_new(local_node, ptr0, len0);
|
|
684
|
-
return WasmObjectExposeResult.__wrap(ret);
|
|
687
|
+
function hakuban_object_state_sink_current(object_state_sink_pointer) {
|
|
688
|
+
const ret = wasm.hakuban_object_state_sink_current(object_state_sink_pointer);
|
|
689
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
685
690
|
}
|
|
686
691
|
|
|
687
692
|
/**
|
|
688
|
-
* @param {number}
|
|
693
|
+
* @param {number} object_state_sink_pointer
|
|
694
|
+
* @param {number} object_state_pointer
|
|
695
|
+
* @returns {number}
|
|
689
696
|
*/
|
|
690
|
-
function
|
|
691
|
-
wasm.
|
|
697
|
+
function hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer) {
|
|
698
|
+
const ret = wasm.hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer);
|
|
699
|
+
return ret;
|
|
692
700
|
}
|
|
693
701
|
|
|
694
702
|
/**
|
|
695
|
-
* @param {number}
|
|
696
|
-
* @param {string} data_version
|
|
697
|
-
* @param {string} data_type
|
|
698
|
-
* @param {Uint8Array} data
|
|
699
|
-
* @param {BigInt} assignment_id
|
|
700
|
-
* @returns {WasmObjectExposeStateResult}
|
|
703
|
+
* @param {number} object_state_sink_params_pointer
|
|
701
704
|
*/
|
|
702
|
-
function
|
|
703
|
-
|
|
704
|
-
var len0 = WASM_VECTOR_LEN;
|
|
705
|
-
var ptr1 = passStringToWasm0(data_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
706
|
-
var len1 = WASM_VECTOR_LEN;
|
|
707
|
-
var ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
708
|
-
var len2 = WASM_VECTOR_LEN;
|
|
709
|
-
uint64CvtShim[0] = assignment_id;
|
|
710
|
-
const low3 = u32CvtShim[0];
|
|
711
|
-
const high3 = u32CvtShim[1];
|
|
712
|
-
var ret = wasm.hakuban_object_expose_set_state(object_expose_pointer, ptr0, len0, ptr1, len1, ptr2, len2, low3, high3);
|
|
713
|
-
return WasmObjectExposeStateResult.__wrap(ret);
|
|
705
|
+
function hakuban_object_state_sink_params_drop(object_state_sink_params_pointer) {
|
|
706
|
+
wasm.hakuban_object_state_sink_params_drop(object_state_sink_params_pointer);
|
|
714
707
|
}
|
|
715
708
|
|
|
716
709
|
/**
|
|
717
|
-
* @param {number}
|
|
718
|
-
|
|
710
|
+
* @param {number} object_state_sink_pointer
|
|
711
|
+
*/
|
|
712
|
+
function hakuban_object_state_sink_desynchronize(object_state_sink_pointer) {
|
|
713
|
+
wasm.hakuban_object_state_sink_desynchronize(object_state_sink_pointer);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @param {string} name_str
|
|
718
|
+
* @returns {WasmResultWithPointer}
|
|
719
|
+
*/
|
|
720
|
+
function hakuban_local_exchange_new(name_str) {
|
|
721
|
+
const ptr0 = passStringToWasm0(name_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
722
|
+
const len0 = WASM_VECTOR_LEN;
|
|
723
|
+
const ret = wasm.hakuban_local_exchange_new(ptr0, len0);
|
|
724
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* @param {number} local_exchange
|
|
729
|
+
*/
|
|
730
|
+
function hakuban_local_exchange_drop(local_exchange) {
|
|
731
|
+
wasm.hakuban_local_exchange_drop(local_exchange);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function getArrayU64FromWasm0(ptr, len) {
|
|
735
|
+
return getBigUint64Memory0().subarray(ptr / 8, ptr / 8 + len);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* @param {number} local_exchange
|
|
739
|
+
* @returns {BigUint64Array}
|
|
719
740
|
*/
|
|
720
|
-
function
|
|
741
|
+
function hakuban_local_exchange_notified(local_exchange) {
|
|
721
742
|
try {
|
|
722
743
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
723
|
-
wasm.
|
|
744
|
+
wasm.hakuban_local_exchange_notified(retptr, local_exchange);
|
|
724
745
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
725
746
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
return n0;
|
|
747
|
+
var v0 = getArrayU64FromWasm0(r0, r1).slice();
|
|
748
|
+
wasm.__wbindgen_free(r0, r1 * 8);
|
|
749
|
+
return v0;
|
|
730
750
|
} finally {
|
|
731
751
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
732
752
|
}
|
|
733
753
|
}
|
|
734
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
|
+
|
|
735
772
|
/**
|
|
736
773
|
* @param {number} object_expose_pointer
|
|
737
|
-
* @param {BigInt} assignment_id
|
|
738
774
|
*/
|
|
739
|
-
function
|
|
740
|
-
|
|
741
|
-
const low0 = u32CvtShim[0];
|
|
742
|
-
const high0 = u32CvtShim[1];
|
|
743
|
-
wasm.hakuban_object_expose_desynchronize(object_expose_pointer, low0, high0);
|
|
775
|
+
function hakuban_object_expose_contract_terminate(object_expose_pointer) {
|
|
776
|
+
wasm.hakuban_object_expose_contract_terminate(object_expose_pointer);
|
|
744
777
|
}
|
|
745
778
|
|
|
746
779
|
/**
|
|
747
|
-
* @param {number}
|
|
780
|
+
* @param {number} object_expose_pointer
|
|
748
781
|
* @returns {number}
|
|
749
782
|
*/
|
|
750
|
-
function
|
|
751
|
-
|
|
783
|
+
function hakuban_object_expose_contract_next(object_expose_pointer) {
|
|
784
|
+
const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
|
|
752
785
|
return ret;
|
|
753
786
|
}
|
|
754
787
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
function __wbg_adapter_120(arg0, arg1, arg2, arg3) {
|
|
763
|
-
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3fbc4a767cc461bf(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
788
|
+
/**
|
|
789
|
+
* @param {number} object_expose_pointer
|
|
790
|
+
* @returns {WasmResultWithPointer}
|
|
791
|
+
*/
|
|
792
|
+
function hakuban_object_expose_contract_ready(object_expose_pointer) {
|
|
793
|
+
const ret = wasm.hakuban_object_expose_contract_ready(object_expose_pointer);
|
|
794
|
+
return WasmResultWithPointer.__wrap(ret);
|
|
764
795
|
}
|
|
765
796
|
|
|
766
797
|
/**
|
|
798
|
+
* @param {number} local_exchange
|
|
799
|
+
* @param {number} descriptor
|
|
800
|
+
* @returns {number}
|
|
767
801
|
*/
|
|
768
|
-
|
|
802
|
+
function hakuban_object_observe_contract_new(local_exchange, descriptor) {
|
|
803
|
+
const ret = wasm.hakuban_object_observe_contract_new(local_exchange, descriptor);
|
|
804
|
+
return ret;
|
|
805
|
+
}
|
|
806
|
+
|
|
769
807
|
/**
|
|
808
|
+
* @param {number} object_ptr
|
|
770
809
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
const obj = Object.create(WasmHashResult.prototype);
|
|
775
|
-
obj.ptr = ptr;
|
|
810
|
+
function hakuban_object_observe_contract_drop(object_ptr) {
|
|
811
|
+
wasm.hakuban_object_observe_contract_drop(object_ptr);
|
|
812
|
+
}
|
|
776
813
|
|
|
777
|
-
|
|
778
|
-
|
|
814
|
+
/**
|
|
815
|
+
* @param {number} object_observe_pointer
|
|
816
|
+
*/
|
|
817
|
+
function hakuban_object_observe_contract_terminate(object_observe_pointer) {
|
|
818
|
+
wasm.hakuban_object_observe_contract_terminate(object_observe_pointer);
|
|
819
|
+
}
|
|
779
820
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
821
|
+
/**
|
|
822
|
+
* @param {number} object_observe_pointer
|
|
823
|
+
* @returns {number}
|
|
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
|
+
}
|
|
783
829
|
|
|
784
|
-
|
|
785
|
-
|
|
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
|
+
}
|
|
786
838
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
*/
|
|
793
|
-
get error() {
|
|
794
|
-
var ret = wasm.__wbg_get_wasmhashresult_error(this.ptr);
|
|
795
|
-
return ret >>> 0;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* @param {number} arg0
|
|
799
|
-
*/
|
|
800
|
-
set error(arg0) {
|
|
801
|
-
wasm.__wbg_set_wasmhashresult_error(this.ptr, arg0);
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
*/
|
|
805
|
-
get hash() {
|
|
806
|
-
try {
|
|
807
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
808
|
-
wasm.__wbg_get_wasmhashresult_hash(retptr, this.ptr);
|
|
809
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
810
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
811
|
-
u32CvtShim[0] = r0;
|
|
812
|
-
u32CvtShim[1] = r1;
|
|
813
|
-
const n0 = uint64CvtShim[0];
|
|
814
|
-
return n0;
|
|
815
|
-
} finally {
|
|
816
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* @param {BigInt} arg0
|
|
821
|
-
*/
|
|
822
|
-
set hash(arg0) {
|
|
823
|
-
uint64CvtShim[0] = arg0;
|
|
824
|
-
const low0 = u32CvtShim[0];
|
|
825
|
-
const high0 = u32CvtShim[1];
|
|
826
|
-
wasm.__wbg_set_wasmhashresult_hash(this.ptr, low0, high0);
|
|
839
|
+
function handleError(f, args) {
|
|
840
|
+
try {
|
|
841
|
+
return f.apply(this, args);
|
|
842
|
+
} catch (e) {
|
|
843
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
827
844
|
}
|
|
828
845
|
}
|
|
829
846
|
/**
|
|
830
847
|
*/
|
|
831
|
-
|
|
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 {
|
|
832
852
|
|
|
833
853
|
static __wrap(ptr) {
|
|
834
|
-
const obj = Object.create(
|
|
854
|
+
const obj = Object.create(WasmResultWithNothing.prototype);
|
|
835
855
|
obj.ptr = ptr;
|
|
836
856
|
|
|
837
857
|
return obj;
|
|
@@ -846,39 +866,28 @@ class WasmLocalNodeNewResult {
|
|
|
846
866
|
|
|
847
867
|
free() {
|
|
848
868
|
const ptr = this.__destroy_into_raw();
|
|
849
|
-
wasm.
|
|
869
|
+
wasm.__wbg_wasmresultwithnothing_free(ptr);
|
|
850
870
|
}
|
|
851
871
|
/**
|
|
872
|
+
* @returns {number}
|
|
852
873
|
*/
|
|
853
|
-
get
|
|
854
|
-
|
|
874
|
+
get status() {
|
|
875
|
+
const ret = wasm.__wbg_get_wasmresultwithnothing_status(this.ptr);
|
|
855
876
|
return ret >>> 0;
|
|
856
877
|
}
|
|
857
878
|
/**
|
|
858
879
|
* @param {number} arg0
|
|
859
880
|
*/
|
|
860
|
-
set
|
|
861
|
-
wasm.
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
*/
|
|
865
|
-
get local_node_pointer() {
|
|
866
|
-
var ret = wasm.__wbg_get_wasmlocalnodenewresult_local_node_pointer(this.ptr);
|
|
867
|
-
return ret;
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* @param {number} arg0
|
|
871
|
-
*/
|
|
872
|
-
set local_node_pointer(arg0) {
|
|
873
|
-
wasm.__wbg_set_wasmlocalnodenewresult_local_node_pointer(this.ptr, arg0);
|
|
881
|
+
set status(arg0) {
|
|
882
|
+
wasm.__wbg_set_wasmresultwithnothing_status(this.ptr, arg0);
|
|
874
883
|
}
|
|
875
884
|
}
|
|
876
885
|
/**
|
|
877
886
|
*/
|
|
878
|
-
class
|
|
887
|
+
class WasmResultWithPointer {
|
|
879
888
|
|
|
880
889
|
static __wrap(ptr) {
|
|
881
|
-
const obj = Object.create(
|
|
890
|
+
const obj = Object.create(WasmResultWithPointer.prototype);
|
|
882
891
|
obj.ptr = ptr;
|
|
883
892
|
|
|
884
893
|
return obj;
|
|
@@ -893,577 +902,152 @@ class WasmObjectExposeResult {
|
|
|
893
902
|
|
|
894
903
|
free() {
|
|
895
904
|
const ptr = this.__destroy_into_raw();
|
|
896
|
-
wasm.
|
|
905
|
+
wasm.__wbg_wasmresultwithpointer_free(ptr);
|
|
897
906
|
}
|
|
898
907
|
/**
|
|
908
|
+
* @returns {number}
|
|
899
909
|
*/
|
|
900
|
-
get
|
|
901
|
-
|
|
910
|
+
get status() {
|
|
911
|
+
const ret = wasm.__wbg_get_wasmresultwithpointer_status(this.ptr);
|
|
902
912
|
return ret >>> 0;
|
|
903
913
|
}
|
|
904
914
|
/**
|
|
905
915
|
* @param {number} arg0
|
|
906
916
|
*/
|
|
907
|
-
set
|
|
908
|
-
wasm.
|
|
917
|
+
set status(arg0) {
|
|
918
|
+
wasm.__wbg_set_wasmresultwithpointer_status(this.ptr, arg0);
|
|
909
919
|
}
|
|
910
920
|
/**
|
|
921
|
+
* @returns {number}
|
|
911
922
|
*/
|
|
912
|
-
get
|
|
913
|
-
|
|
923
|
+
get value() {
|
|
924
|
+
const ret = wasm.__wbg_get_wasmresultwithpointer_value(this.ptr);
|
|
914
925
|
return ret;
|
|
915
926
|
}
|
|
916
927
|
/**
|
|
917
928
|
* @param {number} arg0
|
|
918
929
|
*/
|
|
919
|
-
set
|
|
920
|
-
wasm.
|
|
930
|
+
set value(arg0) {
|
|
931
|
+
wasm.__wbg_set_wasmresultwithpointer_value(this.ptr, arg0);
|
|
921
932
|
}
|
|
922
933
|
}
|
|
923
|
-
/**
|
|
924
|
-
*/
|
|
925
|
-
class WasmObjectExposeStateResult {
|
|
926
|
-
|
|
927
|
-
static __wrap(ptr) {
|
|
928
|
-
const obj = Object.create(WasmObjectExposeStateResult.prototype);
|
|
929
|
-
obj.ptr = ptr;
|
|
930
934
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
this.ptr = 0;
|
|
935
|
+
async function load(module, imports) {
|
|
936
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
937
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
938
|
+
try {
|
|
939
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
937
940
|
|
|
938
|
-
|
|
939
|
-
|
|
941
|
+
} catch (e) {
|
|
942
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
943
|
+
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);
|
|
940
944
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
*/
|
|
947
|
-
get error() {
|
|
948
|
-
var ret = wasm.__wbg_get_wasmobjectexposestateresult_error(this.ptr);
|
|
949
|
-
return ret >>> 0;
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* @param {number} arg0
|
|
953
|
-
*/
|
|
954
|
-
set error(arg0) {
|
|
955
|
-
wasm.__wbg_set_wasmobjectexposestateresult_error(this.ptr, arg0);
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
*/
|
|
959
|
-
get changed() {
|
|
960
|
-
var ret = wasm.__wbg_get_wasmobjectexposestateresult_changed(this.ptr);
|
|
961
|
-
return ret !== 0;
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* @param {boolean} arg0
|
|
965
|
-
*/
|
|
966
|
-
set changed(arg0) {
|
|
967
|
-
wasm.__wbg_set_wasmobjectexposestateresult_changed(this.ptr, arg0);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
*/
|
|
972
|
-
class WasmObjectObserveResult {
|
|
945
|
+
} else {
|
|
946
|
+
throw e;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
973
950
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
obj.ptr = ptr;
|
|
951
|
+
const bytes = await module.arrayBuffer();
|
|
952
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
977
953
|
|
|
978
|
-
|
|
979
|
-
|
|
954
|
+
} else {
|
|
955
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
980
956
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
this.ptr = 0;
|
|
957
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
958
|
+
return { instance, module };
|
|
984
959
|
|
|
985
|
-
|
|
960
|
+
} else {
|
|
961
|
+
return instance;
|
|
962
|
+
}
|
|
986
963
|
}
|
|
964
|
+
}
|
|
987
965
|
|
|
988
|
-
|
|
989
|
-
const ptr = this.__destroy_into_raw();
|
|
990
|
-
wasm.__wbg_wasmobjectobserveresult_free(ptr);
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
*/
|
|
994
|
-
get error() {
|
|
995
|
-
var ret = wasm.__wbg_get_wasmobjectobserveresult_error(this.ptr);
|
|
996
|
-
return ret >>> 0;
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* @param {number} arg0
|
|
1000
|
-
*/
|
|
1001
|
-
set error(arg0) {
|
|
1002
|
-
wasm.__wbg_set_wasmobjectobserveresult_error(this.ptr, arg0);
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
*/
|
|
1006
|
-
get object_observe_pointer() {
|
|
1007
|
-
var ret = wasm.__wbg_get_wasmobjectobserveresult_object_observe_pointer(this.ptr);
|
|
1008
|
-
return ret;
|
|
1009
|
-
}
|
|
1010
|
-
/**
|
|
1011
|
-
* @param {number} arg0
|
|
1012
|
-
*/
|
|
1013
|
-
set object_observe_pointer(arg0) {
|
|
1014
|
-
wasm.__wbg_set_wasmobjectobserveresult_object_observe_pointer(this.ptr, arg0);
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
*/
|
|
1019
|
-
class WasmRemoteNodeNewResult {
|
|
1020
|
-
|
|
1021
|
-
static __wrap(ptr) {
|
|
1022
|
-
const obj = Object.create(WasmRemoteNodeNewResult.prototype);
|
|
1023
|
-
obj.ptr = ptr;
|
|
1024
|
-
|
|
1025
|
-
return obj;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
__destroy_into_raw() {
|
|
1029
|
-
const ptr = this.ptr;
|
|
1030
|
-
this.ptr = 0;
|
|
1031
|
-
|
|
1032
|
-
return ptr;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
free() {
|
|
1036
|
-
const ptr = this.__destroy_into_raw();
|
|
1037
|
-
wasm.__wbg_wasmremotenodenewresult_free(ptr);
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
*/
|
|
1041
|
-
get error() {
|
|
1042
|
-
var ret = wasm.__wbg_get_wasmremotenodenewresult_error(this.ptr);
|
|
1043
|
-
return ret >>> 0;
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
* @param {number} arg0
|
|
1047
|
-
*/
|
|
1048
|
-
set error(arg0) {
|
|
1049
|
-
wasm.__wbg_set_wasmremotenodenewresult_error(this.ptr, arg0);
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
*/
|
|
1053
|
-
get remote_node_pointer() {
|
|
1054
|
-
var ret = wasm.__wbg_get_wasmremotenodenewresult_remote_node_pointer(this.ptr);
|
|
1055
|
-
return ret;
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* @param {number} arg0
|
|
1059
|
-
*/
|
|
1060
|
-
set remote_node_pointer(arg0) {
|
|
1061
|
-
wasm.__wbg_set_wasmremotenodenewresult_remote_node_pointer(this.ptr, arg0);
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
*/
|
|
1066
|
-
class WasmTagExposeAssignmentResult {
|
|
1067
|
-
|
|
1068
|
-
static __wrap(ptr) {
|
|
1069
|
-
const obj = Object.create(WasmTagExposeAssignmentResult.prototype);
|
|
1070
|
-
obj.ptr = ptr;
|
|
1071
|
-
|
|
1072
|
-
return obj;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
__destroy_into_raw() {
|
|
1076
|
-
const ptr = this.ptr;
|
|
1077
|
-
this.ptr = 0;
|
|
1078
|
-
|
|
1079
|
-
return ptr;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
free() {
|
|
1083
|
-
const ptr = this.__destroy_into_raw();
|
|
1084
|
-
wasm.__wbg_wasmtagexposeassignmentresult_free(ptr);
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
*/
|
|
1088
|
-
get error() {
|
|
1089
|
-
var ret = wasm.__wbg_get_wasmtagexposeassignmentresult_error(this.ptr);
|
|
1090
|
-
return ret >>> 0;
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* @param {number} arg0
|
|
1094
|
-
*/
|
|
1095
|
-
set error(arg0) {
|
|
1096
|
-
wasm.__wbg_set_wasmtagexposeassignmentresult_error(this.ptr, arg0);
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
*/
|
|
1100
|
-
get assignment() {
|
|
1101
|
-
try {
|
|
1102
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1103
|
-
wasm.__wbg_get_wasmtagexposeassignmentresult_assignment(retptr, this.ptr);
|
|
1104
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1105
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1106
|
-
u32CvtShim[0] = r0;
|
|
1107
|
-
u32CvtShim[1] = r1;
|
|
1108
|
-
const n0 = uint64CvtShim[0];
|
|
1109
|
-
return n0;
|
|
1110
|
-
} finally {
|
|
1111
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* @param {BigInt} arg0
|
|
1116
|
-
*/
|
|
1117
|
-
set assignment(arg0) {
|
|
1118
|
-
uint64CvtShim[0] = arg0;
|
|
1119
|
-
const low0 = u32CvtShim[0];
|
|
1120
|
-
const high0 = u32CvtShim[1];
|
|
1121
|
-
wasm.__wbg_set_wasmtagexposeassignmentresult_assignment(this.ptr, low0, high0);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
*/
|
|
1126
|
-
class WasmTagExposeResult {
|
|
1127
|
-
|
|
1128
|
-
static __wrap(ptr) {
|
|
1129
|
-
const obj = Object.create(WasmTagExposeResult.prototype);
|
|
1130
|
-
obj.ptr = ptr;
|
|
1131
|
-
|
|
1132
|
-
return obj;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
__destroy_into_raw() {
|
|
1136
|
-
const ptr = this.ptr;
|
|
1137
|
-
this.ptr = 0;
|
|
1138
|
-
|
|
1139
|
-
return ptr;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
free() {
|
|
1143
|
-
const ptr = this.__destroy_into_raw();
|
|
1144
|
-
wasm.__wbg_wasmtagexposeresult_free(ptr);
|
|
1145
|
-
}
|
|
1146
|
-
/**
|
|
1147
|
-
*/
|
|
1148
|
-
get error() {
|
|
1149
|
-
var ret = wasm.__wbg_get_wasmtagexposeresult_error(this.ptr);
|
|
1150
|
-
return ret >>> 0;
|
|
1151
|
-
}
|
|
1152
|
-
/**
|
|
1153
|
-
* @param {number} arg0
|
|
1154
|
-
*/
|
|
1155
|
-
set error(arg0) {
|
|
1156
|
-
wasm.__wbg_set_wasmtagexposeresult_error(this.ptr, arg0);
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
*/
|
|
1160
|
-
get tag_expose_pointer() {
|
|
1161
|
-
var ret = wasm.__wbg_get_wasmtagexposeresult_tag_expose_pointer(this.ptr);
|
|
1162
|
-
return ret;
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* @param {number} arg0
|
|
1166
|
-
*/
|
|
1167
|
-
set tag_expose_pointer(arg0) {
|
|
1168
|
-
wasm.__wbg_set_wasmtagexposeresult_tag_expose_pointer(this.ptr, arg0);
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
*/
|
|
1173
|
-
class WasmTagExposeSetObjectStateResult {
|
|
1174
|
-
|
|
1175
|
-
static __wrap(ptr) {
|
|
1176
|
-
const obj = Object.create(WasmTagExposeSetObjectStateResult.prototype);
|
|
1177
|
-
obj.ptr = ptr;
|
|
1178
|
-
|
|
1179
|
-
return obj;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
__destroy_into_raw() {
|
|
1183
|
-
const ptr = this.ptr;
|
|
1184
|
-
this.ptr = 0;
|
|
1185
|
-
|
|
1186
|
-
return ptr;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
free() {
|
|
1190
|
-
const ptr = this.__destroy_into_raw();
|
|
1191
|
-
wasm.__wbg_wasmtagexposesetobjectstateresult_free(ptr);
|
|
1192
|
-
}
|
|
1193
|
-
/**
|
|
1194
|
-
*/
|
|
1195
|
-
get error() {
|
|
1196
|
-
var ret = wasm.__wbg_get_wasmtagexposesetobjectstateresult_error(this.ptr);
|
|
1197
|
-
return ret >>> 0;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* @param {number} arg0
|
|
1201
|
-
*/
|
|
1202
|
-
set error(arg0) {
|
|
1203
|
-
wasm.__wbg_set_wasmtagexposesetobjectstateresult_error(this.ptr, arg0);
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
*/
|
|
1207
|
-
get changed() {
|
|
1208
|
-
var ret = wasm.__wbg_get_wasmtagexposesetobjectstateresult_changed(this.ptr);
|
|
1209
|
-
return ret !== 0;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* @param {boolean} arg0
|
|
1213
|
-
*/
|
|
1214
|
-
set changed(arg0) {
|
|
1215
|
-
wasm.__wbg_set_wasmtagexposesetobjectstateresult_changed(this.ptr, arg0);
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
/**
|
|
1219
|
-
*/
|
|
1220
|
-
class WasmTagObserveObjectStateBorrowResult {
|
|
1221
|
-
|
|
1222
|
-
static __wrap(ptr) {
|
|
1223
|
-
const obj = Object.create(WasmTagObserveObjectStateBorrowResult.prototype);
|
|
1224
|
-
obj.ptr = ptr;
|
|
1225
|
-
|
|
1226
|
-
return obj;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
__destroy_into_raw() {
|
|
1230
|
-
const ptr = this.ptr;
|
|
1231
|
-
this.ptr = 0;
|
|
1232
|
-
|
|
1233
|
-
return ptr;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
free() {
|
|
1237
|
-
const ptr = this.__destroy_into_raw();
|
|
1238
|
-
wasm.__wbg_wasmtagobserveobjectstateborrowresult_free(ptr);
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
*/
|
|
1242
|
-
get error() {
|
|
1243
|
-
var ret = wasm.__wbg_get_wasmtagobserveobjectstateborrowresult_error(this.ptr);
|
|
1244
|
-
return ret >>> 0;
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* @param {number} arg0
|
|
1248
|
-
*/
|
|
1249
|
-
set error(arg0) {
|
|
1250
|
-
wasm.__wbg_set_wasmtagobserveobjectstateborrowresult_error(this.ptr, arg0);
|
|
1251
|
-
}
|
|
1252
|
-
/**
|
|
1253
|
-
*/
|
|
1254
|
-
get state_pointer() {
|
|
1255
|
-
var ret = wasm.__wbg_get_wasmtagobserveobjectstateborrowresult_state_pointer(this.ptr);
|
|
1256
|
-
return ret;
|
|
1257
|
-
}
|
|
1258
|
-
/**
|
|
1259
|
-
* @param {number} arg0
|
|
1260
|
-
*/
|
|
1261
|
-
set state_pointer(arg0) {
|
|
1262
|
-
wasm.__wbg_set_wasmtagobserveobjectstateborrowresult_state_pointer(this.ptr, arg0);
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
*/
|
|
1267
|
-
class WasmTagObserveResult {
|
|
1268
|
-
|
|
1269
|
-
static __wrap(ptr) {
|
|
1270
|
-
const obj = Object.create(WasmTagObserveResult.prototype);
|
|
1271
|
-
obj.ptr = ptr;
|
|
1272
|
-
|
|
1273
|
-
return obj;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
__destroy_into_raw() {
|
|
1277
|
-
const ptr = this.ptr;
|
|
1278
|
-
this.ptr = 0;
|
|
1279
|
-
|
|
1280
|
-
return ptr;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
free() {
|
|
1284
|
-
const ptr = this.__destroy_into_raw();
|
|
1285
|
-
wasm.__wbg_wasmtagobserveresult_free(ptr);
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
*/
|
|
1289
|
-
get error() {
|
|
1290
|
-
var ret = wasm.__wbg_get_wasmtagobserveresult_error(this.ptr);
|
|
1291
|
-
return ret >>> 0;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* @param {number} arg0
|
|
1295
|
-
*/
|
|
1296
|
-
set error(arg0) {
|
|
1297
|
-
wasm.__wbg_set_wasmtagobserveresult_error(this.ptr, arg0);
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
*/
|
|
1301
|
-
get tag_observe_pointer() {
|
|
1302
|
-
var ret = wasm.__wbg_get_wasmtagobserveresult_tag_observe_pointer(this.ptr);
|
|
1303
|
-
return ret;
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* @param {number} arg0
|
|
1307
|
-
*/
|
|
1308
|
-
set tag_observe_pointer(arg0) {
|
|
1309
|
-
wasm.__wbg_set_wasmtagobserveresult_tag_observe_pointer(this.ptr, arg0);
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
async function load(module, imports) {
|
|
1314
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
1315
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1316
|
-
try {
|
|
1317
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1318
|
-
|
|
1319
|
-
} catch (e) {
|
|
1320
|
-
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
1321
|
-
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);
|
|
1322
|
-
|
|
1323
|
-
} else {
|
|
1324
|
-
throw e;
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
const bytes = await module.arrayBuffer();
|
|
1330
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
1331
|
-
|
|
1332
|
-
} else {
|
|
1333
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
1334
|
-
|
|
1335
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
1336
|
-
return { instance, module };
|
|
1337
|
-
|
|
1338
|
-
} else {
|
|
1339
|
-
return instance;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
async function init(input) {
|
|
1345
|
-
if (typeof input === 'undefined') {
|
|
1346
|
-
input = new URL('hakuban_bg.wasm', import.meta.url);
|
|
1347
|
-
}
|
|
966
|
+
function getImports() {
|
|
1348
967
|
const imports = {};
|
|
1349
968
|
imports.wbg = {};
|
|
1350
969
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1351
970
|
takeObject(arg0);
|
|
1352
971
|
};
|
|
972
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
973
|
+
const obj = getObject(arg1);
|
|
974
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
975
|
+
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
976
|
+
var len0 = WASM_VECTOR_LEN;
|
|
977
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
978
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
979
|
+
};
|
|
1353
980
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
1354
|
-
|
|
981
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1355
982
|
return addHeapObject(ret);
|
|
1356
983
|
};
|
|
1357
|
-
imports.wbg.
|
|
1358
|
-
const
|
|
1359
|
-
if (obj.cnt-- == 1) {
|
|
1360
|
-
obj.a = 0;
|
|
1361
|
-
return true;
|
|
1362
|
-
}
|
|
1363
|
-
var ret = false;
|
|
984
|
+
imports.wbg.__wbg_now_8172cd917e5eda6b = function(arg0) {
|
|
985
|
+
const ret = getObject(arg0).now();
|
|
1364
986
|
return ret;
|
|
1365
987
|
};
|
|
1366
|
-
imports.wbg.
|
|
988
|
+
imports.wbg.__wbg_debug_f15cb542ea509609 = function(arg0) {
|
|
1367
989
|
console.debug(getObject(arg0));
|
|
1368
990
|
};
|
|
1369
|
-
imports.wbg.
|
|
991
|
+
imports.wbg.__wbg_error_ef9a0be47931175f = function(arg0) {
|
|
1370
992
|
console.error(getObject(arg0));
|
|
1371
993
|
};
|
|
1372
|
-
imports.wbg.
|
|
994
|
+
imports.wbg.__wbg_info_2874fdd5393f35ce = function(arg0) {
|
|
1373
995
|
console.info(getObject(arg0));
|
|
1374
996
|
};
|
|
1375
|
-
imports.wbg.
|
|
997
|
+
imports.wbg.__wbg_log_4b5638ad60bdc54a = function(arg0) {
|
|
1376
998
|
console.log(getObject(arg0));
|
|
1377
999
|
};
|
|
1378
|
-
imports.wbg.
|
|
1000
|
+
imports.wbg.__wbg_warn_58110c4a199df084 = function(arg0) {
|
|
1379
1001
|
console.warn(getObject(arg0));
|
|
1380
1002
|
};
|
|
1381
|
-
imports.wbg.
|
|
1382
|
-
|
|
1383
|
-
return ret;
|
|
1384
|
-
};
|
|
1385
|
-
imports.wbg.__wbg_newnoargs_f579424187aa1717 = function(arg0, arg1) {
|
|
1386
|
-
var ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1003
|
+
imports.wbg.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
|
|
1004
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1387
1005
|
return addHeapObject(ret);
|
|
1388
1006
|
};
|
|
1389
|
-
imports.wbg.
|
|
1390
|
-
|
|
1007
|
+
imports.wbg.__wbg_get_765201544a2b6869 = function() { return handleError(function (arg0, arg1) {
|
|
1008
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1391
1009
|
return addHeapObject(ret);
|
|
1392
1010
|
}, arguments) };
|
|
1393
|
-
imports.wbg.
|
|
1394
|
-
|
|
1011
|
+
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
|
1012
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
1395
1013
|
return addHeapObject(ret);
|
|
1396
1014
|
}, arguments) };
|
|
1397
|
-
imports.wbg.
|
|
1398
|
-
|
|
1015
|
+
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
|
1016
|
+
const ret = self.self;
|
|
1399
1017
|
return addHeapObject(ret);
|
|
1400
1018
|
}, arguments) };
|
|
1401
|
-
imports.wbg.
|
|
1402
|
-
|
|
1403
|
-
var state0 = {a: arg0, b: arg1};
|
|
1404
|
-
var cb0 = (arg0, arg1) => {
|
|
1405
|
-
const a = state0.a;
|
|
1406
|
-
state0.a = 0;
|
|
1407
|
-
try {
|
|
1408
|
-
return __wbg_adapter_120(a, state0.b, arg0, arg1);
|
|
1409
|
-
} finally {
|
|
1410
|
-
state0.a = a;
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1413
|
-
var ret = new Promise(cb0);
|
|
1414
|
-
return addHeapObject(ret);
|
|
1415
|
-
} finally {
|
|
1416
|
-
state0.a = state0.b = 0;
|
|
1417
|
-
}
|
|
1418
|
-
};
|
|
1419
|
-
imports.wbg.__wbg_resolve_4f8f547f26b30b27 = function(arg0) {
|
|
1420
|
-
var ret = Promise.resolve(getObject(arg0));
|
|
1421
|
-
return addHeapObject(ret);
|
|
1422
|
-
};
|
|
1423
|
-
imports.wbg.__wbg_then_a6860c82b90816ca = function(arg0, arg1) {
|
|
1424
|
-
var ret = getObject(arg0).then(getObject(arg1));
|
|
1425
|
-
return addHeapObject(ret);
|
|
1426
|
-
};
|
|
1427
|
-
imports.wbg.__wbg_then_58a04e42527f52c6 = function(arg0, arg1, arg2) {
|
|
1428
|
-
var ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
1429
|
-
return addHeapObject(ret);
|
|
1430
|
-
};
|
|
1431
|
-
imports.wbg.__wbg_self_e23d74ae45fb17d1 = function() { return handleError(function () {
|
|
1432
|
-
var ret = self.self;
|
|
1433
|
-
return addHeapObject(ret);
|
|
1434
|
-
}, arguments) };
|
|
1435
|
-
imports.wbg.__wbg_window_b4be7f48b24ac56e = function() { return handleError(function () {
|
|
1436
|
-
var ret = window.window;
|
|
1019
|
+
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
|
|
1020
|
+
const ret = window.window;
|
|
1437
1021
|
return addHeapObject(ret);
|
|
1438
1022
|
}, arguments) };
|
|
1439
|
-
imports.wbg.
|
|
1440
|
-
|
|
1023
|
+
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
|
|
1024
|
+
const ret = globalThis.globalThis;
|
|
1441
1025
|
return addHeapObject(ret);
|
|
1442
1026
|
}, arguments) };
|
|
1443
|
-
imports.wbg.
|
|
1444
|
-
|
|
1027
|
+
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
|
|
1028
|
+
const ret = global.global;
|
|
1445
1029
|
return addHeapObject(ret);
|
|
1446
1030
|
}, arguments) };
|
|
1447
1031
|
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
1448
|
-
|
|
1032
|
+
const ret = getObject(arg0) === undefined;
|
|
1449
1033
|
return ret;
|
|
1450
1034
|
};
|
|
1451
1035
|
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
1452
|
-
|
|
1036
|
+
const ret = getObject(arg0);
|
|
1453
1037
|
return addHeapObject(ret);
|
|
1454
1038
|
};
|
|
1455
|
-
imports.wbg.
|
|
1456
|
-
|
|
1039
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
1040
|
+
const ret = new Error();
|
|
1457
1041
|
return addHeapObject(ret);
|
|
1458
1042
|
};
|
|
1459
|
-
imports.wbg.
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1043
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
1044
|
+
const ret = getObject(arg1).stack;
|
|
1045
|
+
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1046
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1463
1047
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
1464
1048
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
1465
1049
|
};
|
|
1466
|
-
imports.wbg.
|
|
1050
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
1467
1051
|
try {
|
|
1468
1052
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
1469
1053
|
} finally {
|
|
@@ -1471,1126 +1055,1207 @@ async function init(input) {
|
|
|
1471
1055
|
}
|
|
1472
1056
|
};
|
|
1473
1057
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1058
|
+
const ret = debugString(getObject(arg1));
|
|
1059
|
+
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1060
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1477
1061
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
1478
1062
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
1479
1063
|
};
|
|
1480
1064
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1481
1065
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1482
1066
|
};
|
|
1483
|
-
imports.wbg.__wbindgen_closure_wrapper2024 = function(arg0, arg1, arg2) {
|
|
1484
|
-
var ret = makeMutClosure(arg0, arg1, 490, __wbg_adapter_16);
|
|
1485
|
-
return addHeapObject(ret);
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
1489
|
-
input = fetch(input);
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
1067
|
|
|
1494
|
-
|
|
1068
|
+
return imports;
|
|
1069
|
+
}
|
|
1495
1070
|
|
|
1071
|
+
function finalizeInit(instance, module) {
|
|
1496
1072
|
wasm = instance.exports;
|
|
1497
1073
|
init.__wbindgen_wasm_module = module;
|
|
1074
|
+
cachedBigInt64Memory0 = new BigInt64Array();
|
|
1075
|
+
cachedBigUint64Memory0 = new BigUint64Array();
|
|
1076
|
+
cachedInt32Memory0 = new Int32Array();
|
|
1077
|
+
cachedUint32Memory0 = new Uint32Array();
|
|
1078
|
+
cachedUint8Memory0 = new Uint8Array();
|
|
1079
|
+
|
|
1498
1080
|
|
|
1499
1081
|
return wasm;
|
|
1500
1082
|
}
|
|
1501
1083
|
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
constructor() {
|
|
1506
|
-
this.queue = [];
|
|
1507
|
-
this.wake = null;
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
push(value) {
|
|
1511
|
-
this.queue.push(value);
|
|
1512
|
-
if (this.wake != null) {
|
|
1513
|
-
this.wake();
|
|
1514
|
-
return this.wake = null;
|
|
1084
|
+
async function init(input) {
|
|
1085
|
+
if (typeof input === 'undefined') {
|
|
1086
|
+
input = new URL('hakuban_bg.wasm', import.meta.url);
|
|
1515
1087
|
}
|
|
1516
|
-
|
|
1088
|
+
const imports = getImports();
|
|
1517
1089
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
while (true) {
|
|
1521
|
-
value = this.queue.shift();
|
|
1522
|
-
if (value != null) {
|
|
1523
|
-
return value;
|
|
1524
|
-
} else {
|
|
1525
|
-
if (this.wake != null) {
|
|
1526
|
-
throw "2 concurrent shifts on a single queue";
|
|
1527
|
-
}
|
|
1528
|
-
await new Promise((wake) => {
|
|
1529
|
-
this.wake = wake;
|
|
1530
|
-
return null;
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1090
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
1091
|
+
input = fetch(input);
|
|
1533
1092
|
}
|
|
1534
|
-
}
|
|
1535
1093
|
|
|
1536
|
-
|
|
1537
|
-
return this.queue = [];
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
};
|
|
1094
|
+
const { instance, module } = await load(await input, imports);
|
|
1541
1095
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
this.contract = contract;
|
|
1545
|
-
this.managed_object_class = managed_object_class;
|
|
1546
|
-
this._on_exception_policy = "retry";
|
|
1547
|
-
this._retry_backoff = [0.01, 0.1, 1.0, 10.0];
|
|
1548
|
-
this._terminate_on_deactivation = false;
|
|
1549
|
-
}
|
|
1096
|
+
return finalizeInit(instance, module);
|
|
1097
|
+
}
|
|
1550
1098
|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
return
|
|
1099
|
+
var unwrap_pointer = function(result) {
|
|
1100
|
+
if (result.status === 0) {
|
|
1101
|
+
return result.value;
|
|
1102
|
+
} else {
|
|
1103
|
+
throw "hakuban wasm call failed: " + result.status;
|
|
1554
1104
|
}
|
|
1105
|
+
};
|
|
1555
1106
|
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
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;
|
|
1112
|
+
} else {
|
|
1113
|
+
throw "hakuban wasm call failed: " + result.status;
|
|
1562
1114
|
}
|
|
1115
|
+
};
|
|
1563
1116
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1117
|
+
var Future = class Future {
|
|
1118
|
+
constructor(local_exchange, future_owner, poll_function, drop_function, _pointer) {
|
|
1119
|
+
this.local_exchange = local_exchange;
|
|
1120
|
+
this.future_owner = future_owner;
|
|
1121
|
+
this.poll_function = poll_function;
|
|
1122
|
+
this.drop_function = drop_function;
|
|
1123
|
+
this._pointer = _pointer;
|
|
1566
1124
|
}
|
|
1567
1125
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
var event, events;
|
|
1587
|
-
events = this.contract.events();
|
|
1588
|
-
while (event = (await Promise.race([events.next(), event_loop_stop_requested]))) {
|
|
1589
|
-
if (typeof event === "undefined" || event === null) {
|
|
1590
|
-
break;
|
|
1591
|
-
}
|
|
1592
|
-
this.event_queue.push(event);
|
|
1593
|
-
}
|
|
1594
|
-
events.drop();
|
|
1595
|
-
return resolve();
|
|
1596
|
-
});
|
|
1597
|
-
this.async_loop_stopped = new Promise(async(resolve, reject) => {
|
|
1598
|
-
var base, base1, descriptor_for_lambda, error, event, heal_multiplier, i, interval_since_last_exception, key, len, name, name1, object, ref, ref1;
|
|
1599
|
-
while ((event = (await this.event_queue.shift())) != null) {
|
|
1600
|
-
switch (event.action) {
|
|
1601
|
-
case "Insert":
|
|
1602
|
-
case "Change":
|
|
1603
|
-
case "Remove":
|
|
1604
|
-
case "Stopped":
|
|
1605
|
-
case "Timer":
|
|
1606
|
-
object = (base = this._existing_objects)[name = event.descriptor.hash()] || (base[name] = new object_class(this.contract, event.descriptor));
|
|
1607
|
-
if (!object.running && (object.block_result != null)) {
|
|
1608
|
-
error = (await object.block_result);
|
|
1609
|
-
object.block_result = null;
|
|
1610
|
-
if (object.last_exception_at != null) {
|
|
1611
|
-
interval_since_last_exception = Date.now() - object.last_exception_at;
|
|
1612
|
-
heal_multiplier = 10;
|
|
1613
|
-
object.current_delay_index -= Math.floor(interval_since_last_exception / (retry_backoff[retry_backoff.length - 1] * 1000.0 * heal_multiplier));
|
|
1614
|
-
if (object.current_delay_index < 0) {
|
|
1615
|
-
object.current_delay_index = 0;
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
if (error != null) {
|
|
1619
|
-
switch (on_exception_policy) {
|
|
1620
|
-
case "throw":
|
|
1621
|
-
case "raise":
|
|
1622
|
-
throw error.exception;
|
|
1623
|
-
case "retry":
|
|
1624
|
-
object.last_exception_at = Date.now();
|
|
1625
|
-
object.earliest_next_run = Date.now() + retry_backoff[object.current_delay_index] * 1000.0;
|
|
1626
|
-
//wrapped to avoid weird capture effects of coffee
|
|
1627
|
-
(function(lambda_sleep_time, lambda_descriptor, lambda_event_queue) {
|
|
1628
|
-
return setTimeout((() => {
|
|
1629
|
-
return lambda_event_queue.push({
|
|
1630
|
-
action: "Timer",
|
|
1631
|
-
descriptor: lambda_descriptor
|
|
1632
|
-
});
|
|
1633
|
-
}), lambda_sleep_time);
|
|
1634
|
-
})(object.earliest_next_run - Date.now(), event.descriptor, this.event_queue);
|
|
1635
|
-
if (object.current_delay_index < retry_backoff.length - 1) {
|
|
1636
|
-
object.current_delay_index += 1;
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1126
|
+
async await_and_drop(aborted = null) {
|
|
1127
|
+
var about_to_drop_notification_received, notified, result, to_listen;
|
|
1128
|
+
try {
|
|
1129
|
+
about_to_drop_notification_received = new Promise((about_to_drop_notification) => {
|
|
1130
|
+
return this.lock_id = this.future_owner.drop_lock(about_to_drop_notification);
|
|
1131
|
+
});
|
|
1132
|
+
while (true) {
|
|
1133
|
+
notified = this.local_exchange.notified();
|
|
1134
|
+
result = this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
1135
|
+
return this.poll_function(local_exchange_pointer, this._pointer, notified.id);
|
|
1136
|
+
});
|
|
1137
|
+
switch (result.status) {
|
|
1138
|
+
case 0: //ok
|
|
1139
|
+
return result.value;
|
|
1140
|
+
case 1: //pending
|
|
1141
|
+
to_listen = [notified, about_to_drop_notification_received];
|
|
1142
|
+
if (aborted != null) {
|
|
1143
|
+
to_listen.push(aborted);
|
|
1640
1144
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
object.running = true;
|
|
1647
|
-
//wrapped to avoid weird capture effects of coffee
|
|
1648
|
-
object.block_result = (function(descriptor, object, block, event_queue) {
|
|
1649
|
-
return new Promise(async(resolve, reject) => {
|
|
1650
|
-
try {
|
|
1651
|
-
await object.run(block);
|
|
1652
|
-
return resolve(void 0);
|
|
1653
|
-
} catch (error1) {
|
|
1654
|
-
error = error1;
|
|
1655
|
-
console.error("Exception in hakuban manager lambda:", error);
|
|
1656
|
-
return resolve(error);
|
|
1657
|
-
} finally {
|
|
1658
|
-
object.running = false;
|
|
1659
|
-
event_queue.push({
|
|
1660
|
-
action: "Stopped",
|
|
1661
|
-
descriptor: descriptor_for_lambda
|
|
1662
|
-
});
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
|
-
})(event.descriptor, object, block, this.event_queue);
|
|
1666
|
-
}
|
|
1667
|
-
(base1 = this._active_objects)[name1 = event.descriptor.hash()] || (base1[name1] = object);
|
|
1668
|
-
object.change();
|
|
1669
|
-
} else {
|
|
1670
|
-
delete this._active_objects[event.descriptor.hash()];
|
|
1671
|
-
if (object.running) {
|
|
1672
|
-
object.stop();
|
|
1673
|
-
} else {
|
|
1674
|
-
delete this._existing_objects[event.descriptor.hash()];
|
|
1675
|
-
}
|
|
1145
|
+
switch ((await Promise.race(to_listen))) {
|
|
1146
|
+
case "ABORT":
|
|
1147
|
+
return false;
|
|
1148
|
+
case "DROP":
|
|
1149
|
+
return null;
|
|
1676
1150
|
}
|
|
1677
1151
|
break;
|
|
1678
|
-
case
|
|
1679
|
-
|
|
1680
|
-
await this.event_loop_stopped;
|
|
1681
|
-
ref = {...this._existing_objects};
|
|
1682
|
-
for (key in ref) {
|
|
1683
|
-
object = ref[key];
|
|
1684
|
-
if (object.running) {
|
|
1685
|
-
object.stop();
|
|
1686
|
-
} else {
|
|
1687
|
-
delete this._existing_objects[key];
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
while (Object.keys(this._existing_objects).length > 0) {
|
|
1691
|
-
event = (await this.event_queue.shift());
|
|
1692
|
-
if (event.action === "Stopped") {
|
|
1693
|
-
delete this._existing_objects[event.descriptor.hash()];
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
this.event_queue.clear();
|
|
1697
|
-
ref1 = Object.keys(this._active_objects);
|
|
1698
|
-
for (i = 0, len = ref1.length; i < len; i++) {
|
|
1699
|
-
key = ref1[i];
|
|
1700
|
-
delete this._active_objects[key];
|
|
1701
|
-
}
|
|
1702
|
-
this.contract.drop();
|
|
1703
|
-
this.contract = null;
|
|
1704
|
-
this.event_queue = null;
|
|
1705
|
-
resolve();
|
|
1706
|
-
return;
|
|
1152
|
+
case 2: //unavailable, channel closed
|
|
1153
|
+
return null;
|
|
1707
1154
|
default:
|
|
1708
|
-
throw
|
|
1155
|
+
throw result.status; //TODO: convert that to specific error
|
|
1709
1156
|
}
|
|
1710
1157
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
object() {
|
|
1720
|
-
return Object.values(this._active_objects)[0];
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
async drop() {
|
|
1724
|
-
if (this.contract) {
|
|
1725
|
-
this.event_queue.push({
|
|
1726
|
-
action: 'Drop'
|
|
1727
|
-
});
|
|
1728
|
-
return (await this.async_loop_stopped);
|
|
1158
|
+
} finally {
|
|
1159
|
+
this.drop_function(this._pointer);
|
|
1160
|
+
this.future_owner.drop_release(this.lock_id);
|
|
1161
|
+
if (notified != null) {
|
|
1162
|
+
this.local_exchange.return_notified(notified);
|
|
1163
|
+
}
|
|
1729
1164
|
}
|
|
1730
1165
|
}
|
|
1731
1166
|
|
|
1732
1167
|
};
|
|
1733
1168
|
|
|
1734
|
-
var
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
this.contract = contract;
|
|
1742
|
-
this.descriptor = descriptor1;
|
|
1743
|
-
this._changes = new Queue();
|
|
1744
|
-
this.current_delay_index = 0;
|
|
1169
|
+
var logger_initialize = function(log_level, skip_if_already_initialized = false) {
|
|
1170
|
+
var error;
|
|
1171
|
+
if (0 === (error = hakuban_logger_initialize(log_level))) {
|
|
1172
|
+
return true;
|
|
1173
|
+
} else {
|
|
1174
|
+
console.error("Failed to initialize logger, error " + error);
|
|
1175
|
+
return false;
|
|
1745
1176
|
}
|
|
1177
|
+
};
|
|
1746
1178
|
|
|
1747
|
-
|
|
1748
|
-
return (await handler(this));
|
|
1749
|
-
}
|
|
1179
|
+
var do_and_drop, finalization_registry;
|
|
1750
1180
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1181
|
+
finalization_registry = new FinalizationRegistry(function(function_and_arg) {
|
|
1182
|
+
return function_and_arg[0](function_and_arg[1]);
|
|
1183
|
+
});
|
|
1754
1184
|
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1185
|
+
do_and_drop = function(object_or_objects, block) {
|
|
1186
|
+
var block_returned_promise, i, len, object, ref, ret;
|
|
1187
|
+
try {
|
|
1188
|
+
block_returned_promise = false;
|
|
1189
|
+
ret = block(object_or_objects);
|
|
1190
|
+
if ((ret != null) && typeof ret.then === 'function') {
|
|
1191
|
+
block_returned_promise = true;
|
|
1192
|
+
return ret.finally(() => {
|
|
1193
|
+
var i, len, object, ref, results;
|
|
1194
|
+
ref = [object_or_objects].flat();
|
|
1195
|
+
results = [];
|
|
1196
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1197
|
+
object = ref[i];
|
|
1198
|
+
results.push(object.drop());
|
|
1199
|
+
}
|
|
1200
|
+
return results;
|
|
1201
|
+
});
|
|
1202
|
+
} else {
|
|
1203
|
+
return ret;
|
|
1204
|
+
}
|
|
1205
|
+
} finally {
|
|
1206
|
+
if (!block_returned_promise) {
|
|
1207
|
+
ref = [object_or_objects].flat();
|
|
1208
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1209
|
+
object = ref[i];
|
|
1210
|
+
object.drop();
|
|
1762
1211
|
}
|
|
1763
1212
|
}
|
|
1764
1213
|
}
|
|
1765
|
-
|
|
1766
|
-
change() {
|
|
1767
|
-
return this._changes.push("change");
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
stop() {
|
|
1771
|
-
return this._changes.push("stop");
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
1214
|
};
|
|
1775
1215
|
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
logger_initialized = false;
|
|
1780
|
-
|
|
1781
|
-
var initialize_wasm = async function(wasm) {
|
|
1782
|
-
return (await init(wasm));
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
var logger_initialize = async function(log_level, skip_if_already_initialized = false) {
|
|
1786
|
-
var error;
|
|
1787
|
-
if (logger_initialized && skip_if_already_initialized) {
|
|
1788
|
-
return true;
|
|
1789
|
-
}
|
|
1790
|
-
if (0 === (error = (await hakuban_logger_initialize(log_level)))) {
|
|
1791
|
-
return logger_initialized = true;
|
|
1216
|
+
var do_and_drop_or_return = function(object_or_objects, block) {
|
|
1217
|
+
if (block != null) {
|
|
1218
|
+
return do_and_drop(object_or_objects, block);
|
|
1792
1219
|
} else {
|
|
1793
|
-
|
|
1794
|
-
return false;
|
|
1220
|
+
return object_or_objects;
|
|
1795
1221
|
}
|
|
1796
1222
|
};
|
|
1797
1223
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1224
|
+
var PointerAlreadyDropped$1 = class PointerAlreadyDropped {
|
|
1225
|
+
constructor() {
|
|
1226
|
+
this.message = "PointerAlreadyDropped";
|
|
1801
1227
|
}
|
|
1802
|
-
};
|
|
1803
1228
|
|
|
1804
|
-
var JSON_serialize = function(data_type, cooked) {
|
|
1805
|
-
return {
|
|
1806
|
-
data_type: ["JSON"].concat(data_type),
|
|
1807
|
-
data: new TextEncoder().encode(JSON.stringify(cooked))
|
|
1808
|
-
};
|
|
1809
1229
|
};
|
|
1810
1230
|
|
|
1811
|
-
var
|
|
1812
|
-
|
|
1813
|
-
|
|
1231
|
+
var FFIObject = class FFIObject {
|
|
1232
|
+
initialize_pointer(_local_exchange, _pointer, _drop_function) {
|
|
1233
|
+
this._local_exchange = _local_exchange;
|
|
1234
|
+
this._pointer = _pointer;
|
|
1235
|
+
this._drop_function = _drop_function;
|
|
1236
|
+
this._was_dropped = null;
|
|
1237
|
+
this._drop_locks_sequence = 0;
|
|
1238
|
+
this._drop_locks = {};
|
|
1239
|
+
return finalization_registry.register(this, [this._drop_function, this._pointer], this);
|
|
1814
1240
|
}
|
|
1815
|
-
return {
|
|
1816
|
-
data_type: data_type.slice(1),
|
|
1817
|
-
data: JSON.parse(new TextDecoder().decode(raw))
|
|
1818
|
-
};
|
|
1819
|
-
};
|
|
1820
1241
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
var tag;
|
|
1824
|
-
this.json = json1;
|
|
1825
|
-
this.tags = (function() {
|
|
1826
|
-
var i, len, results;
|
|
1827
|
-
results = [];
|
|
1828
|
-
for (i = 0, len = tags.length; i < len; i++) {
|
|
1829
|
-
tag = tags[i];
|
|
1830
|
-
results.push(tag instanceof TagDescriptor ? tag : new TagDescriptor(tag));
|
|
1831
|
-
}
|
|
1832
|
-
return results;
|
|
1833
|
-
})();
|
|
1242
|
+
dropped() {
|
|
1243
|
+
return this._was_dropped != null;
|
|
1834
1244
|
}
|
|
1835
1245
|
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1246
|
+
drop() {
|
|
1247
|
+
if (this._was_dropped == null) {
|
|
1248
|
+
this._was_dropped = new Promise(async(resolve) => {
|
|
1249
|
+
var about_to_drop_notification, all_locks_dropped, i, len, ref;
|
|
1250
|
+
if (this._pointer != null) {
|
|
1251
|
+
if (Object.keys(this._drop_locks).length > 0) {
|
|
1252
|
+
all_locks_dropped = new Promise((_all_locks_dropped_set) => {
|
|
1253
|
+
this._all_locks_dropped_set = _all_locks_dropped_set;
|
|
1254
|
+
});
|
|
1255
|
+
ref = Object.values(this._drop_locks);
|
|
1256
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1257
|
+
about_to_drop_notification = ref[i];
|
|
1258
|
+
about_to_drop_notification("DROP");
|
|
1259
|
+
}
|
|
1260
|
+
await all_locks_dropped;
|
|
1261
|
+
}
|
|
1262
|
+
if (Object.keys(this._drop_locks).length > 0) {
|
|
1263
|
+
throw "Hakuban internal error: drop was attempted with existing drop locks";
|
|
1264
|
+
}
|
|
1265
|
+
finalization_registry.unregister(this);
|
|
1266
|
+
this._drop_function(this._pointer);
|
|
1267
|
+
if (this._local_exchange != null) {
|
|
1268
|
+
this._local_exchange.notify();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
this._pointer = false;
|
|
1272
|
+
return resolve();
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
return this._was_dropped;
|
|
1843
1276
|
}
|
|
1844
1277
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
this._hash = this.tags.map(function(tag) {
|
|
1849
|
-
return tag.hash().toString();
|
|
1850
|
-
}).sort().join(",") + "|";
|
|
1851
|
-
ret = hakuban_json_hash(JSON.stringify(this.json));
|
|
1852
|
-
raise_if_error(ret.error);
|
|
1853
|
-
this._hash += ret.hash.toString();
|
|
1278
|
+
with_pointer(block) {
|
|
1279
|
+
if (this.dropped()) {
|
|
1280
|
+
throw new PointerAlreadyDropped$1();
|
|
1854
1281
|
}
|
|
1855
|
-
return this.
|
|
1282
|
+
return block(this._pointer);
|
|
1856
1283
|
}
|
|
1857
1284
|
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
var TagDescriptor = class TagDescriptor {
|
|
1861
|
-
constructor(json1) {
|
|
1862
|
-
this.json = json1;
|
|
1285
|
+
do_and_drop_or_return(block) {
|
|
1286
|
+
return do_and_drop_or_return(this, block);
|
|
1863
1287
|
}
|
|
1864
1288
|
|
|
1865
|
-
|
|
1866
|
-
|
|
1289
|
+
drop_lock(about_to_drop_notification) {
|
|
1290
|
+
var lock_id;
|
|
1291
|
+
if (this._was_dropped != null) {
|
|
1292
|
+
raise(FFIObject.prototype.PointerAlreadyDropped);
|
|
1293
|
+
}
|
|
1294
|
+
lock_id = this._drop_locks_sequence++;
|
|
1295
|
+
this._drop_locks[lock_id] = about_to_drop_notification;
|
|
1296
|
+
return lock_id;
|
|
1867
1297
|
}
|
|
1868
1298
|
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
if (this.
|
|
1872
|
-
|
|
1873
|
-
raise_if_error(ret.error);
|
|
1874
|
-
this._hash = ret.hash;
|
|
1299
|
+
drop_release(lock_id) {
|
|
1300
|
+
delete this._drop_locks[lock_id];
|
|
1301
|
+
if ((this._was_dropped != null) && Object.keys(this._drop_locks).length === 0) {
|
|
1302
|
+
return this._all_locks_dropped_set();
|
|
1875
1303
|
}
|
|
1876
|
-
return this._hash;
|
|
1877
1304
|
}
|
|
1878
1305
|
|
|
1879
1306
|
};
|
|
1880
1307
|
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1308
|
+
var ObjectDescriptor = class ObjectDescriptor extends FFIObject {
|
|
1309
|
+
constructor(tags, json, pointer = null) {
|
|
1310
|
+
var tag, tag_pointer;
|
|
1311
|
+
super();
|
|
1312
|
+
if (pointer != null) {
|
|
1313
|
+
this.json = JSON.parse(hakuban_object_descriptor_json(pointer));
|
|
1314
|
+
this.tags = (function() {
|
|
1315
|
+
var i, len, ref, results;
|
|
1316
|
+
ref = hakuban_object_descriptor_tags(pointer);
|
|
1317
|
+
results = [];
|
|
1318
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1319
|
+
tag_pointer = ref[i];
|
|
1320
|
+
results.push(new TagDescriptor(null, null, tag_pointer));
|
|
1321
|
+
}
|
|
1322
|
+
return results;
|
|
1323
|
+
})();
|
|
1324
|
+
} else {
|
|
1325
|
+
this.json = json;
|
|
1326
|
+
this.tags = (function() {
|
|
1327
|
+
var i, len, results;
|
|
1328
|
+
results = [];
|
|
1329
|
+
for (i = 0, len = tags.length; i < len; i++) {
|
|
1330
|
+
tag = tags[i];
|
|
1331
|
+
results.push(tag instanceof TagDescriptor ? tag : new TagDescriptor(tag));
|
|
1332
|
+
}
|
|
1333
|
+
return results;
|
|
1334
|
+
})();
|
|
1335
|
+
pointer = unwrap_pointer(hakuban_object_descriptor_new(JSON.stringify(this.json), (function() {
|
|
1336
|
+
var i, len, ref, results;
|
|
1337
|
+
ref = this.tags;
|
|
1338
|
+
results = [];
|
|
1339
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1340
|
+
tag = ref[i];
|
|
1341
|
+
results.push(tag._pointer);
|
|
1342
|
+
}
|
|
1343
|
+
return results;
|
|
1344
|
+
}).call(this)));
|
|
1345
|
+
}
|
|
1346
|
+
this.initialize_pointer(null, pointer, hakuban_object_descriptor_drop);
|
|
1896
1347
|
}
|
|
1897
1348
|
|
|
1898
|
-
|
|
1899
|
-
hakuban_local_node_drop(this.pointer);
|
|
1900
|
-
return LocalNode_finalization_registry.unregister(this);
|
|
1901
|
-
}
|
|
1349
|
+
};
|
|
1902
1350
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1351
|
+
var TagDescriptor = class TagDescriptor extends FFIObject {
|
|
1352
|
+
constructor(json) {
|
|
1353
|
+
var pointer;
|
|
1354
|
+
super();
|
|
1355
|
+
this.json = json;
|
|
1356
|
+
pointer = unwrap_pointer(hakuban_tag_descriptor_new(JSON.stringify(this.json)));
|
|
1357
|
+
this.initialize_pointer(null, pointer, hakuban_tag_descriptor_drop);
|
|
1905
1358
|
}
|
|
1906
1359
|
|
|
1907
|
-
|
|
1908
|
-
return new TagBuilder(this, this.default_serializer, this.default_deserializer, json);
|
|
1909
|
-
}
|
|
1360
|
+
};
|
|
1910
1361
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1362
|
+
var ObjectState_last_generated_version;
|
|
1363
|
+
|
|
1364
|
+
ObjectState_last_generated_version = [0, 0, 0];
|
|
1365
|
+
|
|
1366
|
+
//TODO: make this immutable for the users somehow
|
|
1367
|
+
var ObjectState = class ObjectState extends FFIObject {
|
|
1368
|
+
constructor(data = null, version = null, format = null, synchronized_us_ago = 0, pointer = null) {
|
|
1369
|
+
var timestamp, version_element, x;
|
|
1370
|
+
super();
|
|
1371
|
+
if (pointer != null) {
|
|
1372
|
+
this.initialize_pointer(null, pointer, hakuban_object_state_drop);
|
|
1373
|
+
this.version = (function() {
|
|
1374
|
+
var i, len, ref, results;
|
|
1375
|
+
ref = hakuban_object_state_version(pointer);
|
|
1376
|
+
results = [];
|
|
1377
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
|
1378
|
+
x = ref[i];
|
|
1379
|
+
results.push(x);
|
|
1380
|
+
}
|
|
1381
|
+
return results;
|
|
1382
|
+
})();
|
|
1383
|
+
this.synchronized_us_ago = hakuban_object_state_synchronized_ago(pointer);
|
|
1384
|
+
this.format = hakuban_object_state_format(pointer);
|
|
1385
|
+
this.data = new TextDecoder().decode(hakuban_object_state_data(pointer));
|
|
1386
|
+
} else {
|
|
1387
|
+
if (version == null) {
|
|
1388
|
+
timestamp = new Date().getTime();
|
|
1389
|
+
version = [0, Math.floor(timestamp / 1000), (timestamp % 1000) * 1000];
|
|
1390
|
+
while (version[1] === ObjectState_last_generated_version[1] && version[2] <= ObjectState_last_generated_version[2]) {
|
|
1391
|
+
version[2]++;
|
|
1392
|
+
}
|
|
1393
|
+
ObjectState_last_generated_version = version;
|
|
1394
|
+
}
|
|
1395
|
+
this.version = (function() {
|
|
1396
|
+
var i, len, results;
|
|
1397
|
+
results = [];
|
|
1398
|
+
for (i = 0, len = version.length; i < len; i++) {
|
|
1399
|
+
version_element = version[i];
|
|
1400
|
+
results.push(BigInt(version_element));
|
|
1401
|
+
}
|
|
1402
|
+
return results;
|
|
1403
|
+
})();
|
|
1404
|
+
if (format == null) {
|
|
1405
|
+
format = [];
|
|
1406
|
+
}
|
|
1407
|
+
this.format = [format].flat(2e308);
|
|
1408
|
+
this.synchronized_us_ago = BigInt(synchronized_us_ago);
|
|
1409
|
+
this.data = data;
|
|
1410
|
+
}
|
|
1914
1411
|
}
|
|
1915
1412
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1413
|
+
with_pointer(block) {
|
|
1414
|
+
var pointer;
|
|
1415
|
+
if (this.dropped()) {
|
|
1416
|
+
throw new PointerAlreadyDropped();
|
|
1417
|
+
}
|
|
1418
|
+
if (this._pointer != null) {
|
|
1419
|
+
return block(this._pointer);
|
|
1420
|
+
} else {
|
|
1421
|
+
pointer = unwrap_pointer(hakuban_object_state_new(this.version, this.format, new TextEncoder().encode(this.data), this.synchronized_us_ago));
|
|
1422
|
+
this.initialize_pointer(null, pointer, hakuban_object_state_drop);
|
|
1423
|
+
return block(this._pointer);
|
|
1424
|
+
}
|
|
1919
1425
|
}
|
|
1920
1426
|
|
|
1921
|
-
|
|
1427
|
+
with_data(data) {
|
|
1428
|
+
return new ObjectState(data, this.version, this.format, this.synchronized_us_ago);
|
|
1429
|
+
}
|
|
1922
1430
|
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
this.local_node = local_node;
|
|
1926
|
-
this.serializer = serializer;
|
|
1927
|
-
this.deserializer = deserializer;
|
|
1928
|
-
this.tags = tags1;
|
|
1929
|
-
this.json = json1;
|
|
1431
|
+
with_version(version) {
|
|
1432
|
+
return new ObjectState(this.data, version, this.format, this.synchronized_us_ago);
|
|
1930
1433
|
}
|
|
1931
1434
|
|
|
1932
|
-
|
|
1933
|
-
return new
|
|
1435
|
+
with_format(format) {
|
|
1436
|
+
return new ObjectState(this.data, this.version, format, this.synchronized_us_ago);
|
|
1934
1437
|
}
|
|
1935
1438
|
|
|
1936
|
-
|
|
1937
|
-
return new
|
|
1439
|
+
with_synchronized_us_ago(synchronized_us_ago) {
|
|
1440
|
+
return new ObjectState(this.data, this.version, this.format, synchronized_us_ago);
|
|
1938
1441
|
}
|
|
1939
1442
|
|
|
1940
|
-
|
|
1941
|
-
this.
|
|
1942
|
-
|
|
1443
|
+
json_deserialize() {
|
|
1444
|
+
if (this.format[this.format.length - 1] !== "JSON") {
|
|
1445
|
+
throw "Invalid data format";
|
|
1446
|
+
}
|
|
1447
|
+
return new ObjectState(JSON.parse(this.data), this.version, this.format.slice(0, -1), this.synchronized_us_ago);
|
|
1943
1448
|
}
|
|
1944
1449
|
|
|
1945
|
-
|
|
1946
|
-
this.
|
|
1947
|
-
return this;
|
|
1450
|
+
json_serialize() {
|
|
1451
|
+
return new ObjectState(JSON.stringify(this.data), this.version, this.format.concat("JSON"), this.synchronized_us_ago);
|
|
1948
1452
|
}
|
|
1949
1453
|
|
|
1950
1454
|
};
|
|
1951
1455
|
|
|
1952
|
-
|
|
1953
|
-
constructor(
|
|
1954
|
-
this.
|
|
1955
|
-
this.
|
|
1956
|
-
this.
|
|
1957
|
-
this.json = json1;
|
|
1456
|
+
var StreamEnumerator = class StreamEnumerator {
|
|
1457
|
+
constructor(_stream, _without_implicit_drop = false, _async = false) {
|
|
1458
|
+
this._stream = _stream;
|
|
1459
|
+
this._without_implicit_drop = _without_implicit_drop;
|
|
1460
|
+
this._async = _async;
|
|
1958
1461
|
}
|
|
1959
1462
|
|
|
1960
|
-
|
|
1961
|
-
return new
|
|
1463
|
+
async(block) {
|
|
1464
|
+
return new StreamEnumerator(this._stream, this._without_implicit_drop, true).call_or_return(block);
|
|
1962
1465
|
}
|
|
1963
1466
|
|
|
1964
|
-
|
|
1965
|
-
return new
|
|
1467
|
+
without_implicit_drop(block) {
|
|
1468
|
+
return new StreamEnumerator(this._stream, true, this._async).call_or_return(block);
|
|
1966
1469
|
}
|
|
1967
1470
|
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1471
|
+
call_or_return(block) {
|
|
1472
|
+
if (block != null) {
|
|
1473
|
+
return this.call(block);
|
|
1474
|
+
} else {
|
|
1475
|
+
return this;
|
|
1476
|
+
}
|
|
1971
1477
|
}
|
|
1972
1478
|
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
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));
|
|
1490
|
+
} else {
|
|
1491
|
+
try {
|
|
1492
|
+
return (await block(item));
|
|
1493
|
+
} finally {
|
|
1494
|
+
await item.drop();
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}));
|
|
1498
|
+
} else {
|
|
1499
|
+
if (this._without_implicit_drop) {
|
|
1500
|
+
results.push((await block(new_item)));
|
|
1501
|
+
} else {
|
|
1502
|
+
try {
|
|
1503
|
+
results.push((await block(new_item)));
|
|
1504
|
+
} finally {
|
|
1505
|
+
await new_item.drop();
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
return results;
|
|
1976
1511
|
}
|
|
1977
1512
|
|
|
1978
1513
|
};
|
|
1979
1514
|
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1515
|
+
var ObjectStateStream = class ObjectStateStream extends FFIObject {
|
|
1516
|
+
constructor(local_exchange, pointer) {
|
|
1517
|
+
super();
|
|
1518
|
+
this.local_exchange = local_exchange;
|
|
1519
|
+
this.initialize_pointer(this.local_exchange, pointer, hakuban_object_state_stream_drop);
|
|
1520
|
+
}
|
|
1983
1521
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
this.drop = this.drop.bind(this);
|
|
1989
|
-
this.pointer = pointer1;
|
|
1990
|
-
ObjectDescriptorEvents_finalization_registry.register(this, this.pointer, this);
|
|
1522
|
+
descriptor() {
|
|
1523
|
+
return this.with_pointer(function(pointer) {
|
|
1524
|
+
return new ObjectDescriptor(null, null, hakuban_object_state_stream_descriptor(pointer));
|
|
1525
|
+
});
|
|
1991
1526
|
}
|
|
1992
1527
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1528
|
+
async next(block) {
|
|
1529
|
+
var error, future_pointer, pointer;
|
|
1530
|
+
try {
|
|
1531
|
+
future_pointer = this.with_pointer((pointer) => {
|
|
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
|
+
}
|
|
1995
1547
|
}
|
|
1996
1548
|
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
this.wait_released = new Promise((wait_release) => {
|
|
2000
|
-
this.wait_release = wait_release;
|
|
2001
|
-
return null;
|
|
2002
|
-
});
|
|
2003
|
-
cancel_waiting_promise = new Promise((resolve) => {
|
|
2004
|
-
return this.cancel_waiting_resolve = resolve;
|
|
2005
|
-
});
|
|
2006
|
-
next_event_promise = hakuban_object_descriptor_events_next(this.pointer, cancel_waiting_promise);
|
|
2007
|
-
next_event_promise.cancel = async(value) => {
|
|
2008
|
-
this.cancel_waiting_resolve.resolve(value);
|
|
2009
|
-
return (await next_event_promise);
|
|
2010
|
-
};
|
|
2011
|
-
return next_event_promise.then((value) => {
|
|
2012
|
-
var parsed;
|
|
2013
|
-
this.wait_release();
|
|
2014
|
-
this.wait_released = null;
|
|
2015
|
-
this.cancel_waiting_resolve = null;
|
|
2016
|
-
parsed = JSON.parse(value);
|
|
2017
|
-
return {
|
|
2018
|
-
action: parsed.action,
|
|
2019
|
-
descriptor: new ObjectDescriptor(parsed.key.tags, parsed.key.json)
|
|
2020
|
-
};
|
|
2021
|
-
});
|
|
1549
|
+
each(block) {
|
|
1550
|
+
return new StreamEnumerator(this).call_or_return(block);
|
|
2022
1551
|
}
|
|
2023
1552
|
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
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;
|
|
2028
1570
|
}
|
|
2029
|
-
ObjectDescriptorEvents_finalization_registry.unregister(this);
|
|
2030
|
-
hakuban_object_descriptor_events_drop(this.pointer);
|
|
2031
|
-
return this.pointer = null;
|
|
2032
1571
|
}
|
|
2033
1572
|
|
|
2034
1573
|
};
|
|
2035
1574
|
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1575
|
+
var ObjectStateSinkParams = class ObjectStateSinkParams extends FFIObject {
|
|
1576
|
+
constructor(pointer) {
|
|
1577
|
+
super();
|
|
1578
|
+
this.initialize_pointer(null, pointer, hakuban_object_state_sink_params_drop);
|
|
1579
|
+
}
|
|
2039
1580
|
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
this.
|
|
2046
|
-
this.
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
var ObjectStateSink = class ObjectStateSink extends FFIObject {
|
|
1584
|
+
constructor(local_exchange, pointer) {
|
|
1585
|
+
super();
|
|
1586
|
+
this.local_exchange = local_exchange;
|
|
1587
|
+
this.initialize_pointer(this.local_exchange, pointer, hakuban_object_state_sink_drop);
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
descriptor() {
|
|
1591
|
+
return this.with_pointer(function(pointer) {
|
|
1592
|
+
return new ObjectDescriptor(null, null, hakuban_object_state_sink_descriptor(pointer));
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
async send(object_state) {
|
|
1597
|
+
var error, future_pointer;
|
|
1598
|
+
try {
|
|
1599
|
+
future_pointer = this.with_pointer((sink_pointer) => {
|
|
1600
|
+
return object_state.with_pointer((object_state_pointer) => {
|
|
1601
|
+
return hakuban_object_state_sink_push(sink_pointer, object_state_pointer);
|
|
1602
|
+
});
|
|
1603
|
+
});
|
|
1604
|
+
await new Future(this.local_exchange, this, hakuban_future_returning_nothing_poll, hakuban_future_returning_nothing_drop, future_pointer).await_and_drop();
|
|
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
|
+
}
|
|
2055
1614
|
}
|
|
2056
1615
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
raw = hakuban_object_observe_state_data(state_pointer);
|
|
2077
|
-
hakuban_object_observe_state_return(state_pointer);
|
|
2078
|
-
deserialized = this.deserializer(data_type, raw);
|
|
2079
|
-
return {
|
|
2080
|
-
version: version,
|
|
2081
|
-
data: deserialized.data,
|
|
2082
|
-
data_type: deserialized.data_type,
|
|
2083
|
-
synchronized: synchronized
|
|
2084
|
-
};
|
|
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
|
+
}
|
|
2085
1635
|
}
|
|
2086
1636
|
|
|
2087
|
-
|
|
2088
|
-
return new
|
|
1637
|
+
each(block) {
|
|
1638
|
+
return new StreamEnumerator(this).call_or_return(block);
|
|
2089
1639
|
}
|
|
2090
1640
|
|
|
2091
|
-
|
|
2092
|
-
var
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
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;
|
|
2097
1651
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
return
|
|
1652
|
+
} catch (error1) {
|
|
1653
|
+
error = error1;
|
|
1654
|
+
if (error instanceof PointerAlreadyDropped) {
|
|
1655
|
+
return null;
|
|
2102
1656
|
}
|
|
1657
|
+
throw error;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
2103
1660
|
|
|
2104
|
-
|
|
2105
|
-
|
|
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();
|
|
1668
|
+
return true;
|
|
1669
|
+
} catch (error1) {
|
|
1670
|
+
error = error1;
|
|
1671
|
+
if (error instanceof PointerAlreadyDropped) {
|
|
1672
|
+
return null;
|
|
2106
1673
|
}
|
|
2107
|
-
|
|
2108
|
-
}
|
|
2109
|
-
return new ObjectManagerBuilder(this, ManagedObject$1);
|
|
1674
|
+
throw error;
|
|
1675
|
+
}
|
|
2110
1676
|
}
|
|
2111
1677
|
|
|
2112
1678
|
};
|
|
2113
1679
|
|
|
2114
|
-
|
|
2115
|
-
return hakuban_object_expose_drop(pointer);
|
|
2116
|
-
});
|
|
2117
|
-
|
|
2118
|
-
ObjectExpose = class ObjectExpose {
|
|
2119
|
-
constructor(local_node, descriptor1, serializer) {
|
|
2120
|
-
var result;
|
|
2121
|
-
this.drop = this.drop.bind(this);
|
|
2122
|
-
this.set_object_state = this.set_object_state.bind(this);
|
|
2123
|
-
this.assignment = this.assignment.bind(this);
|
|
2124
|
-
this.assigned = this.assigned.bind(this);
|
|
2125
|
-
this.desynchronize = this.desynchronize.bind(this);
|
|
2126
|
-
this.events = this.events.bind(this);
|
|
2127
|
-
this.manage = this.manage.bind(this);
|
|
2128
|
-
this.local_node = local_node;
|
|
2129
|
-
this.descriptor = descriptor1;
|
|
2130
|
-
this.serializer = serializer;
|
|
2131
|
-
result = hakuban_object_expose_new(this.local_node.pointer, this.descriptor.as_json());
|
|
2132
|
-
raise_if_error(result.error);
|
|
2133
|
-
this.pointer = result.object_expose_pointer;
|
|
2134
|
-
ObjectExpose_finalization_registry.register(this, this.pointer, this);
|
|
2135
|
-
this.dropped = false;
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
drop() {
|
|
2139
|
-
this.dropped = true;
|
|
2140
|
-
hakuban_object_expose_drop(this.pointer);
|
|
2141
|
-
return ObjectExpose_finalization_registry.unregister(this);
|
|
2142
|
-
}
|
|
1680
|
+
var Contract;
|
|
2143
1681
|
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
if (!(typeof assignment === 'bigint')) {
|
|
2148
|
-
assignment = BigInt(assignment);
|
|
2149
|
-
}
|
|
2150
|
-
result = hakuban_object_expose_set_state(this.pointer, JSON.stringify(version), JSON.stringify(serialized.data_type), serialized.data, assignment);
|
|
2151
|
-
raise_if_error(result.error);
|
|
2152
|
-
return result.changed;
|
|
1682
|
+
Contract = class Contract extends FFIObject {
|
|
1683
|
+
each(block) {
|
|
1684
|
+
return new StreamEnumerator(this).call_or_return(block);
|
|
2153
1685
|
}
|
|
2154
1686
|
|
|
2155
|
-
|
|
2156
|
-
return hakuban_object_expose_assignment(this.pointer);
|
|
2157
|
-
}
|
|
1687
|
+
};
|
|
2158
1688
|
|
|
2159
|
-
|
|
2160
|
-
|
|
1689
|
+
var ObjectObserveContract = class ObjectObserveContract extends Contract {
|
|
1690
|
+
constructor(local_exchange, descriptor) {
|
|
1691
|
+
super();
|
|
1692
|
+
this.local_exchange = local_exchange;
|
|
1693
|
+
this.descriptor = descriptor[0] instanceof ObjectDescriptor ? descriptor[0] : new ObjectDescriptor(...descriptor);
|
|
1694
|
+
this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
1695
|
+
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1696
|
+
return this.initialize_pointer(this.local_exchange, hakuban_object_observe_contract_new(local_exchange_pointer, descriptor_pointer), hakuban_object_observe_contract_drop);
|
|
1697
|
+
});
|
|
1698
|
+
});
|
|
1699
|
+
this.local_exchange.notify();
|
|
2161
1700
|
}
|
|
2162
1701
|
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
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;
|
|
2166
1715
|
}
|
|
2167
|
-
return hakuban_object_expose_desynchronize(this.pointer, assignment);
|
|
2168
1716
|
}
|
|
2169
1717
|
|
|
2170
|
-
|
|
2171
|
-
|
|
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
|
+
}
|
|
2172
1738
|
}
|
|
2173
1739
|
|
|
2174
|
-
|
|
2175
|
-
var
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
this._assignment = contract.assignment();
|
|
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;
|
|
2186
1751
|
}
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
await super.run(handler);
|
|
2192
|
-
return (ref = this.contract) != null ? ref.desynchronize(this._assignment) : void 0;
|
|
1752
|
+
} catch (error1) {
|
|
1753
|
+
error = error1;
|
|
1754
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1755
|
+
return null;
|
|
2193
1756
|
}
|
|
1757
|
+
throw error;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
2194
1760
|
|
|
2195
|
-
|
|
2196
|
-
var ref;
|
|
2197
|
-
boundMethodCheck(this, ManagedObject$1);
|
|
2198
|
-
this._assignment = (ref = this.contract) != null ? ref.assignment() : void 0;
|
|
2199
|
-
return super.do_change(change);
|
|
2200
|
-
}
|
|
1761
|
+
};
|
|
2201
1762
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
1763
|
+
var ObjectExposeContract = class ObjectExposeContract extends Contract {
|
|
1764
|
+
constructor(local_exchange, descriptor) {
|
|
1765
|
+
super();
|
|
1766
|
+
this.local_exchange = local_exchange;
|
|
1767
|
+
this.descriptor = descriptor[0] instanceof ObjectDescriptor ? descriptor[0] : new ObjectDescriptor(...descriptor);
|
|
1768
|
+
this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
1769
|
+
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1770
|
+
return this.initialize_pointer(this.local_exchange, hakuban_object_expose_contract_new(local_exchange_pointer, descriptor_pointer), hakuban_object_expose_contract_drop);
|
|
1771
|
+
});
|
|
1772
|
+
});
|
|
1773
|
+
this.local_exchange.notify();
|
|
1774
|
+
}
|
|
2207
1775
|
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
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;
|
|
2212
1787
|
}
|
|
1788
|
+
throw error;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
2213
1791
|
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
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;
|
|
2218
1804
|
}
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
timestamp = new Date().getTime();
|
|
2224
|
-
return this.set_state([1, Math.floor(timestamp / 1000), timestamp - Math.floor(timestamp / 1000) * 1000, 0], data);
|
|
1805
|
+
} catch (error1) {
|
|
1806
|
+
error = error1;
|
|
1807
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1808
|
+
return null;
|
|
2225
1809
|
}
|
|
1810
|
+
throw error;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
2226
1813
|
|
|
2227
|
-
|
|
2228
|
-
|
|
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;
|
|
2229
1825
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
1826
|
+
} catch (error1) {
|
|
1827
|
+
error = error1;
|
|
1828
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1829
|
+
return null;
|
|
1830
|
+
}
|
|
1831
|
+
throw error;
|
|
1832
|
+
}
|
|
2233
1833
|
}
|
|
2234
1834
|
|
|
2235
1835
|
};
|
|
2236
1836
|
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
this.
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
raise_if_error(result.error);
|
|
2252
|
-
this.pointer = result.tag_observe_pointer;
|
|
2253
|
-
TagObserve_finalization_registry.register(this, this.pointer, this);
|
|
2254
|
-
this.dropped = false;
|
|
1837
|
+
var TagObserveContract = class TagObserveContract extends Contract {
|
|
1838
|
+
constructor(local_exchange, descriptor) {
|
|
1839
|
+
super();
|
|
1840
|
+
this.local_exchange = local_exchange;
|
|
1841
|
+
this.descriptor = descriptor;
|
|
1842
|
+
if (!(this.descriptor instanceof TagDescriptor)) {
|
|
1843
|
+
this.descriptor = new TagDescriptor(this.descriptor);
|
|
1844
|
+
}
|
|
1845
|
+
this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
1846
|
+
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1847
|
+
return this.initialize_pointer(this.local_exchange, hakuban_tag_observe_contract_new(local_exchange_pointer, descriptor_pointer), hakuban_tag_observe_contract_drop);
|
|
1848
|
+
});
|
|
1849
|
+
});
|
|
1850
|
+
this.local_exchange.notify();
|
|
2255
1851
|
}
|
|
2256
1852
|
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
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
|
+
}
|
|
2261
1867
|
}
|
|
2262
1868
|
|
|
2263
|
-
|
|
2264
|
-
var
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
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;
|
|
2271
1888
|
}
|
|
2272
|
-
return results;
|
|
2273
1889
|
}
|
|
2274
1890
|
|
|
2275
|
-
|
|
2276
|
-
var
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
return
|
|
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;
|
|
2283
1913
|
}
|
|
2284
|
-
synchronized = hakuban_object_observe_state_synchronized(result.state_pointer);
|
|
2285
|
-
version = JSON.parse(hakuban_object_observe_state_data_version(result.state_pointer));
|
|
2286
|
-
data_type = JSON.parse(hakuban_object_observe_state_data_type(result.state_pointer));
|
|
2287
|
-
raw = hakuban_object_observe_state_data(result.state_pointer);
|
|
2288
|
-
hakuban_object_observe_state_return(result.state_pointer);
|
|
2289
|
-
deserialized = this.deserializer(data_type, raw);
|
|
2290
|
-
return {
|
|
2291
|
-
version: version,
|
|
2292
|
-
data: deserialized.data,
|
|
2293
|
-
data_type: deserialized.data_type,
|
|
2294
|
-
synchronized: synchronized
|
|
2295
|
-
};
|
|
2296
1914
|
}
|
|
2297
1915
|
|
|
2298
|
-
|
|
2299
|
-
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
var TagExposeContract = class TagExposeContract extends Contract {
|
|
1919
|
+
constructor(local_exchange, descriptor) {
|
|
1920
|
+
super();
|
|
1921
|
+
this.local_exchange = local_exchange;
|
|
1922
|
+
this.descriptor = descriptor;
|
|
1923
|
+
if (!(this.descriptor instanceof TagDescriptor)) {
|
|
1924
|
+
this.descriptor = new TagDescriptor(this.descriptor);
|
|
1925
|
+
}
|
|
1926
|
+
this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
1927
|
+
return this.descriptor.with_pointer((descriptor_pointer) => {
|
|
1928
|
+
return this.initialize_pointer(this.local_exchange, hakuban_tag_expose_contract_new(local_exchange_pointer, descriptor_pointer), hakuban_tag_expose_contract_drop);
|
|
1929
|
+
});
|
|
1930
|
+
});
|
|
1931
|
+
this.local_exchange.notify();
|
|
2300
1932
|
}
|
|
2301
1933
|
|
|
2302
|
-
|
|
2303
|
-
var
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
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;
|
|
2308
1945
|
}
|
|
1946
|
+
throw error;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
2309
1949
|
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
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;
|
|
2313
1962
|
}
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
1963
|
+
} catch (error1) {
|
|
1964
|
+
error = error1;
|
|
1965
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
1966
|
+
return null;
|
|
2317
1967
|
}
|
|
1968
|
+
throw error;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
2318
1971
|
|
|
2319
|
-
|
|
2320
|
-
|
|
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
|
+
}
|
|
2321
1995
|
}
|
|
2322
1996
|
|
|
2323
1997
|
};
|
|
2324
1998
|
|
|
2325
|
-
|
|
2326
|
-
return hakuban_tag_expose_drop(pointer);
|
|
2327
|
-
});
|
|
1999
|
+
var ObjectContractBuilder, TagContractBuilder;
|
|
2328
2000
|
|
|
2329
|
-
|
|
2330
|
-
constructor(
|
|
2331
|
-
|
|
2332
|
-
this.
|
|
2333
|
-
this.
|
|
2334
|
-
this.
|
|
2335
|
-
this.
|
|
2336
|
-
this.assigned = this.assigned.bind(this);
|
|
2337
|
-
this.desynchronize = this.desynchronize.bind(this);
|
|
2338
|
-
this.events = this.events.bind(this);
|
|
2339
|
-
this.manage = this.manage.bind(this);
|
|
2340
|
-
this.local_node = local_node;
|
|
2341
|
-
this.descriptor = descriptor1;
|
|
2342
|
-
this.serializer = serializer;
|
|
2343
|
-
result = hakuban_tag_expose_new(this.local_node.pointer, this.descriptor.as_json());
|
|
2344
|
-
raise_if_error(result.error);
|
|
2345
|
-
this.pointer = result.tag_expose_pointer;
|
|
2346
|
-
TagExpose_finalization_registry.register(this, this.pointer, this);
|
|
2347
|
-
this.dropped = false;
|
|
2001
|
+
var LocalExchange = class LocalExchange extends FFIObject {
|
|
2002
|
+
constructor(name = "wasm") {
|
|
2003
|
+
super();
|
|
2004
|
+
this.name = name;
|
|
2005
|
+
this._notification_sequence = BigInt(0);
|
|
2006
|
+
this._notification_resolve = {};
|
|
2007
|
+
this.initialize_pointer(null, unwrap_pointer(hakuban_local_exchange_new(this.name)), hakuban_local_exchange_drop);
|
|
2348
2008
|
}
|
|
2349
2009
|
|
|
2350
|
-
|
|
2351
|
-
this
|
|
2352
|
-
|
|
2353
|
-
|
|
2010
|
+
object(descriptor_or_tags, json_or_nothing) {
|
|
2011
|
+
return new ObjectContractBuilder(this, [descriptor_or_tags, json_or_nothing]);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
tag(descriptor) {
|
|
2015
|
+
return new TagContractBuilder(this, descriptor);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
notified() {
|
|
2019
|
+
var id, promise;
|
|
2020
|
+
id = ++this._notification_sequence;
|
|
2021
|
+
promise = new Promise((resolve) => {
|
|
2022
|
+
return this._notification_resolve[id] = resolve;
|
|
2023
|
+
});
|
|
2024
|
+
promise.id = id;
|
|
2025
|
+
return promise;
|
|
2354
2026
|
}
|
|
2355
2027
|
|
|
2356
|
-
|
|
2357
|
-
var
|
|
2358
|
-
|
|
2359
|
-
|
|
2028
|
+
notify() {
|
|
2029
|
+
var i, id, len, ref, results;
|
|
2030
|
+
ref = this.with_pointer(function(pointer) {
|
|
2031
|
+
return hakuban_local_exchange_notified(pointer);
|
|
2032
|
+
});
|
|
2360
2033
|
results = [];
|
|
2361
2034
|
for (i = 0, len = ref.length; i < len; i++) {
|
|
2362
|
-
|
|
2363
|
-
|
|
2035
|
+
id = ref[i];
|
|
2036
|
+
// if you want to put console.log here, you forgot to await
|
|
2037
|
+
if (this._notification_resolve[id] != null) {
|
|
2038
|
+
this._notification_resolve[id](true);
|
|
2039
|
+
results.push(delete this._notification_resolve[id]);
|
|
2040
|
+
} else {
|
|
2041
|
+
results.push(void 0);
|
|
2042
|
+
}
|
|
2364
2043
|
}
|
|
2365
2044
|
return results;
|
|
2366
2045
|
}
|
|
2367
2046
|
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
serialized = this.serializer(data_type, cooked_data);
|
|
2371
|
-
if (!(typeof assignment === 'bigint')) {
|
|
2372
|
-
assignment = BigInt(assignment);
|
|
2373
|
-
}
|
|
2374
|
-
result = hakuban_tag_expose_set_object_state(this.pointer, object_descriptor.as_json(), JSON.stringify(version), JSON.stringify(serialized.data_type), serialized.data, assignment);
|
|
2375
|
-
raise_if_error(result.error);
|
|
2376
|
-
return result.changed;
|
|
2047
|
+
return_notified(notification_promise) {
|
|
2048
|
+
return delete this._notification_resolve[notification_promise.id];
|
|
2377
2049
|
}
|
|
2378
2050
|
|
|
2379
|
-
|
|
2380
|
-
var result;
|
|
2381
|
-
result = hakuban_tag_expose_assignment(this.pointer, object_descriptor.as_json());
|
|
2382
|
-
raise_if_error(result.error);
|
|
2383
|
-
return result.assignment;
|
|
2384
|
-
}
|
|
2051
|
+
};
|
|
2385
2052
|
|
|
2386
|
-
|
|
2387
|
-
|
|
2053
|
+
ObjectContractBuilder = class ObjectContractBuilder {
|
|
2054
|
+
constructor(local_exchange, descriptor1) {
|
|
2055
|
+
this.local_exchange = local_exchange;
|
|
2056
|
+
this.descriptor = descriptor1;
|
|
2388
2057
|
}
|
|
2389
2058
|
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
if (!(typeof assignment === 'bigint')) {
|
|
2393
|
-
assignment = BigInt(assignment);
|
|
2394
|
-
}
|
|
2395
|
-
error = hakuban_tag_expose_desynchronize(this.pointer, object_descriptor.as_json(), assignment);
|
|
2396
|
-
return raise_if_error(error);
|
|
2059
|
+
observe(block) {
|
|
2060
|
+
return new ObjectObserveContract(this.local_exchange, this.descriptor).do_and_drop_or_return(block);
|
|
2397
2061
|
}
|
|
2398
2062
|
|
|
2399
|
-
|
|
2400
|
-
return new
|
|
2063
|
+
expose(block) {
|
|
2064
|
+
return new ObjectExposeContract(this.local_exchange, this.descriptor).do_and_drop_or_return(block);
|
|
2401
2065
|
}
|
|
2402
2066
|
|
|
2403
|
-
|
|
2404
|
-
var ManagedObject$1;
|
|
2405
|
-
ManagedObject$1 = class ManagedObject$1 extends ManagedObject {
|
|
2406
|
-
constructor(contract, descriptor) {
|
|
2407
|
-
super(contract, descriptor);
|
|
2408
|
-
this.run = this.run.bind(this);
|
|
2409
|
-
this.do_change = this.do_change.bind(this);
|
|
2410
|
-
this.assignment = this.assignment.bind(this);
|
|
2411
|
-
this.assigned = this.assigned.bind(this);
|
|
2412
|
-
this.set_state = this.set_state.bind(this);
|
|
2413
|
-
this.set_data = this.set_data.bind(this);
|
|
2414
|
-
this._assignment = contract.assignment(this.descriptor);
|
|
2415
|
-
}
|
|
2067
|
+
};
|
|
2416
2068
|
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
}
|
|
2069
|
+
TagContractBuilder = class TagContractBuilder {
|
|
2070
|
+
constructor(local_exchange, descriptor1) {
|
|
2071
|
+
this.local_exchange = local_exchange;
|
|
2072
|
+
this.descriptor = descriptor1;
|
|
2073
|
+
}
|
|
2423
2074
|
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
this._assignment = (ref = this.contract) != null ? ref.assignment(this.descriptor) : void 0;
|
|
2428
|
-
return super.do_change(change);
|
|
2429
|
-
}
|
|
2075
|
+
observe(block) {
|
|
2076
|
+
return new TagObserveContract(this.local_exchange, this.descriptor).do_and_drop_or_return(block);
|
|
2077
|
+
}
|
|
2430
2078
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
return (ref = this.contract) != null ? ref.assignment(this.descriptor) : void 0;
|
|
2435
|
-
}
|
|
2079
|
+
expose(block) {
|
|
2080
|
+
return new TagExposeContract(this.local_exchange, this.descriptor).do_and_drop_or_return(block);
|
|
2081
|
+
}
|
|
2436
2082
|
|
|
2437
|
-
|
|
2438
|
-
var ref;
|
|
2439
|
-
boundMethodCheck(this, ManagedObject$1);
|
|
2440
|
-
return (ref = this.contract) != null ? ref.assigned(this.descriptor) : void 0;
|
|
2441
|
-
}
|
|
2083
|
+
};
|
|
2442
2084
|
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2085
|
+
var RemoteExchange = class RemoteExchange extends FFIObject {
|
|
2086
|
+
constructor(local_exchange, upstream, diff_produce, diff_request) {
|
|
2087
|
+
super();
|
|
2088
|
+
this.local_exchange = local_exchange;
|
|
2089
|
+
this.local_exchange.with_pointer((local_exchange_pointer) => {
|
|
2090
|
+
return this.initialize_pointer(this.local_exchange, hakuban_remote_exchange_new(local_exchange_pointer, upstream, diff_produce, diff_request), hakuban_remote_exchange_drop);
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2448
2093
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
return
|
|
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;
|
|
2454
2107
|
}
|
|
2108
|
+
throw error;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2455
2111
|
|
|
2456
|
-
|
|
2457
|
-
|
|
2112
|
+
async send(data) {
|
|
2113
|
+
var error, future_pointer;
|
|
2114
|
+
try {
|
|
2115
|
+
future_pointer = this.with_pointer((pointer) => {
|
|
2116
|
+
return hakuban_remote_exchange_send_message_from_network(pointer, new Uint8Array(data));
|
|
2117
|
+
});
|
|
2118
|
+
await new Future(this.local_exchange, this, hakuban_future_returning_nothing_poll, hakuban_future_returning_nothing_drop, future_pointer).await_and_drop();
|
|
2119
|
+
return this.local_exchange.notify();
|
|
2120
|
+
} catch (error1) {
|
|
2121
|
+
error = error1;
|
|
2122
|
+
if (error instanceof PointerAlreadyDropped$1) {
|
|
2123
|
+
return null;
|
|
2458
2124
|
}
|
|
2459
|
-
|
|
2460
|
-
}
|
|
2461
|
-
return new ObjectManagerBuilder(this, ManagedObject$1);
|
|
2125
|
+
throw error;
|
|
2126
|
+
}
|
|
2462
2127
|
}
|
|
2463
2128
|
|
|
2464
2129
|
};
|
|
2465
2130
|
|
|
2466
|
-
WebsocketConnector_finalization_registry = new FinalizationRegistry((pointer) => {
|
|
2467
|
-
return hakuban_remote_node_drop(pointer);
|
|
2468
|
-
});
|
|
2469
|
-
|
|
2470
2131
|
//TODO: hide private methods
|
|
2471
|
-
//TODO: handle errors somehow
|
|
2472
2132
|
var WebsocketConnector = class WebsocketConnector {
|
|
2473
|
-
constructor(
|
|
2474
|
-
var result;
|
|
2133
|
+
constructor(local_exchange, uri, options = {}) {
|
|
2475
2134
|
this.connect = this.connect.bind(this);
|
|
2476
2135
|
this.ping = this.ping.bind(this);
|
|
2477
2136
|
this.send = this.send.bind(this);
|
|
2478
|
-
this.
|
|
2479
|
-
this.local_node = local_node;
|
|
2137
|
+
this.local_exchange = local_exchange;
|
|
2480
2138
|
this.uri = uri;
|
|
2481
2139
|
this.options = options;
|
|
2482
|
-
this.
|
|
2140
|
+
this._status_change({
|
|
2141
|
+
connected: false
|
|
2142
|
+
});
|
|
2483
2143
|
this.socket = void 0;
|
|
2484
|
-
this.error = void 0;
|
|
2485
2144
|
this.reconnection_timer = void 0;
|
|
2486
2145
|
this.reconnect_on_close = true;
|
|
2487
|
-
this.ack_timer = void 0;
|
|
2488
|
-
result = hakuban_remote_node_new(this.local_node.pointer, true, true, true);
|
|
2489
|
-
raise_if_error(result.error);
|
|
2490
|
-
this.remote_node_pointer = result.remote_node_pointer;
|
|
2491
|
-
this.event_loop_stop = new Promise((resolve) => {
|
|
2492
|
-
return this.event_loop_stop_resolve = resolve;
|
|
2493
|
-
});
|
|
2494
|
-
this.event_loop_promise = this.event_loop();
|
|
2495
|
-
WebsocketConnector_finalization_registry.register(this, this.remote_node_pointer, this);
|
|
2496
2146
|
this.connect();
|
|
2497
2147
|
}
|
|
2498
2148
|
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
this.
|
|
2149
|
+
status() {
|
|
2150
|
+
return Promise.resolve([this.status, this.next_status_promise]);
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
_status_change(new_status) {
|
|
2154
|
+
var old_next_status_promise_resolve;
|
|
2155
|
+
this.status = new_status;
|
|
2156
|
+
old_next_status_promise_resolve = this.next_status_promise_resolve;
|
|
2157
|
+
this.next_status_promise = new Promise((next_status_promise_resolve) => {
|
|
2158
|
+
this.next_status_promise_resolve = next_status_promise_resolve;
|
|
2159
|
+
});
|
|
2160
|
+
if (old_next_status_promise_resolve != null) {
|
|
2161
|
+
return old_next_status_promise_resolve([this.status, this.next_status_promise]);
|
|
2509
2162
|
}
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
disconnect() {
|
|
2166
|
+
this.reconnect_on_close = false;
|
|
2510
2167
|
if (this.socket != null) {
|
|
2511
|
-
this.socket.
|
|
2512
|
-
this.socket.onerror = null;
|
|
2513
|
-
this.socket.onmessage = null;
|
|
2514
|
-
this.socket.close();
|
|
2515
|
-
this.socket_onclose();
|
|
2516
|
-
}
|
|
2517
|
-
if (this.ack_timer != null) {
|
|
2518
|
-
clearTimeout(this.ack_timer);
|
|
2519
|
-
this.ack_timer = null;
|
|
2168
|
+
return this.socket.close();
|
|
2520
2169
|
}
|
|
2521
|
-
hakuban_remote_node_drop(this.remote_node_pointer);
|
|
2522
|
-
return WebsocketConnector_finalization_registry.unregister(this);
|
|
2523
2170
|
}
|
|
2524
2171
|
|
|
2525
2172
|
connect() {
|
|
2526
2173
|
var error;
|
|
2174
|
+
if (this.reconnection_timer != null) {
|
|
2175
|
+
clearTimeout(this.reconnection_timer);
|
|
2176
|
+
}
|
|
2527
2177
|
this.reconnection_timer = void 0;
|
|
2528
2178
|
try {
|
|
2529
2179
|
this.socket = new WebSocket(this.uri);
|
|
2530
2180
|
} catch (error1) {
|
|
2531
2181
|
error = error1;
|
|
2532
|
-
|
|
2533
|
-
|
|
2182
|
+
console.error('Error connecting to hakuban remote exchange:', error);
|
|
2183
|
+
this._status_change({
|
|
2184
|
+
connected: false,
|
|
2534
2185
|
error: error
|
|
2535
|
-
};
|
|
2536
|
-
if (this.onstatuschange_proc != null) {
|
|
2537
|
-
this.onstatuschange_proc(this);
|
|
2538
|
-
}
|
|
2186
|
+
});
|
|
2539
2187
|
return false;
|
|
2540
2188
|
}
|
|
2541
2189
|
this.socket.binaryType = "arraybuffer";
|
|
2542
2190
|
this.socket.onopen = () => {
|
|
2543
|
-
var bytes_to_send;
|
|
2544
2191
|
if (this.options.debug) {
|
|
2545
|
-
console.debug('Connected to hakuban remote
|
|
2546
|
-
}
|
|
2547
|
-
this.connected = true;
|
|
2548
|
-
this.error = void 0;
|
|
2549
|
-
if (this.onstatuschange_proc != null) {
|
|
2550
|
-
this.onstatuschange_proc(this);
|
|
2192
|
+
console.debug('Connected to hakuban remote exchange');
|
|
2551
2193
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2194
|
+
this.remote_exchange = new RemoteExchange(this.local_exchange, true, true, true);
|
|
2195
|
+
this.forwarding_to_network_stopped = new Promise(async(resolve) => {
|
|
2196
|
+
var message_pointer;
|
|
2197
|
+
try {
|
|
2198
|
+
while ((this.remote_exchange != null) && ((message_pointer = (await this.remote_exchange.next())) != null)) {
|
|
2199
|
+
this.send(hakuban_message_take(message_pointer));
|
|
2200
|
+
}
|
|
2201
|
+
} catch (error1) {
|
|
2202
|
+
error = error1;
|
|
2203
|
+
console.error('Error processing hakuban connection:', error);
|
|
2204
|
+
if (this.socket != null) {
|
|
2205
|
+
this.socket.close();
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
return resolve();
|
|
2209
|
+
});
|
|
2210
|
+
return this._status_change({
|
|
2211
|
+
connected: true
|
|
2212
|
+
});
|
|
2554
2213
|
};
|
|
2555
|
-
this
|
|
2556
|
-
|
|
2557
|
-
|
|
2214
|
+
// this may fire even if onopen never did
|
|
2215
|
+
this.socket.onclose = async(event) => {
|
|
2216
|
+
if (this.options.debug && (this.remote_exchange != null)) {
|
|
2217
|
+
console.debug('Disconnected from hakuban remote exchange');
|
|
2558
2218
|
}
|
|
2559
|
-
if (this.
|
|
2560
|
-
|
|
2219
|
+
if (this.options.debug && (this.remote_exchange == null)) {
|
|
2220
|
+
console.debug('Failed to connect to hakuban remote exchange');
|
|
2561
2221
|
}
|
|
2562
|
-
this.
|
|
2222
|
+
this._status_change({
|
|
2223
|
+
connected: false,
|
|
2224
|
+
disconnect_reason: event.reason,
|
|
2225
|
+
clean_disconnect: event.wasClean
|
|
2226
|
+
});
|
|
2563
2227
|
this.socket = void 0;
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
this.
|
|
2228
|
+
if (this.keep_alive_interval != null) {
|
|
2229
|
+
clearInterval(this.keep_alive_interval);
|
|
2230
|
+
this.keep_alive_interval = null;
|
|
2567
2231
|
}
|
|
2568
2232
|
if (this.reconnection_timer != null) {
|
|
2569
2233
|
clearTimeout(this.reconnection_timer);
|
|
2234
|
+
this.reconnection_timer = null;
|
|
2235
|
+
}
|
|
2236
|
+
if (this.remote_exchange != null) {
|
|
2237
|
+
await this.remote_exchange.drop();
|
|
2238
|
+
await this.forwarding_to_network_stopped;
|
|
2239
|
+
this.forwarding_to_network_stopped = null;
|
|
2240
|
+
this.remote_exchange = null;
|
|
2570
2241
|
}
|
|
2571
|
-
this.reconnection_timer = null;
|
|
2572
2242
|
if (this.reconnect_on_close) {
|
|
2573
2243
|
return this.reconnection_timer = setTimeout(this.connect, 1000);
|
|
2574
2244
|
}
|
|
2575
2245
|
};
|
|
2576
|
-
this.socket.
|
|
2577
|
-
if (this.
|
|
2578
|
-
|
|
2246
|
+
return this.socket.onmessage = async(event) => {
|
|
2247
|
+
if (this.remote_exchange == null) {
|
|
2248
|
+
return;
|
|
2579
2249
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
this.send(bytes_to_send);
|
|
2589
|
-
if (this.ack_timer != null) {
|
|
2590
|
-
clearTimeout(this.ack_timer);
|
|
2250
|
+
try {
|
|
2251
|
+
return (await this.remote_exchange.send(event.data));
|
|
2252
|
+
} catch (error1) {
|
|
2253
|
+
error = error1;
|
|
2254
|
+
console.error('Error processing hakuban connection:', error);
|
|
2255
|
+
if (this.socket != null) {
|
|
2256
|
+
return this.socket.close();
|
|
2257
|
+
}
|
|
2591
2258
|
}
|
|
2592
|
-
this.ack_timer = setTimeout(this.ack, 1000);
|
|
2593
|
-
return null;
|
|
2594
2259
|
};
|
|
2595
2260
|
}
|
|
2596
2261
|
|
|
@@ -2610,62 +2275,14 @@ var WebsocketConnector = class WebsocketConnector {
|
|
|
2610
2275
|
}
|
|
2611
2276
|
}
|
|
2612
2277
|
|
|
2613
|
-
ack() {
|
|
2614
|
-
var bytes_to_send;
|
|
2615
|
-
if (this.socket != null) {
|
|
2616
|
-
bytes_to_send = hakuban_remote_node_ack(this.remote_node_pointer);
|
|
2617
|
-
if (bytes_to_send.length > 0) {
|
|
2618
|
-
return this.send(bytes_to_send);
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
async event_loop() {
|
|
2624
|
-
var cancel_waiting_promise, cancel_waiting_resolve, event, next_local_node_event, promise;
|
|
2625
|
-
next_local_node_event = false;
|
|
2626
|
-
cancel_waiting_resolve = null;
|
|
2627
|
-
cancel_waiting_promise = new Promise(function(resolve) {
|
|
2628
|
-
return cancel_waiting_resolve = resolve;
|
|
2629
|
-
});
|
|
2630
|
-
while (true) {
|
|
2631
|
-
if (!next_local_node_event) {
|
|
2632
|
-
next_local_node_event = hakuban_remote_node_next_local_node_event(this.remote_node_pointer, cancel_waiting_promise).then(function(event) {
|
|
2633
|
-
return ["local_node_event", event];
|
|
2634
|
-
});
|
|
2635
|
-
}
|
|
2636
|
-
[promise, event] = (await Promise.any([this.event_loop_stop, next_local_node_event]));
|
|
2637
|
-
if (promise === "local_node_event") {
|
|
2638
|
-
next_local_node_event = false;
|
|
2639
|
-
setTimeout(((event) => {
|
|
2640
|
-
var bytes_to_send;
|
|
2641
|
-
if (this.connected) {
|
|
2642
|
-
bytes_to_send = hakuban_remote_node_received_local_node_event(this.remote_node_pointer, event);
|
|
2643
|
-
return this.send(bytes_to_send);
|
|
2644
|
-
}
|
|
2645
|
-
}), 0, event);
|
|
2646
|
-
} else {
|
|
2647
|
-
break;
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
if (next_local_node_event) {
|
|
2651
|
-
cancel_waiting_resolve(true);
|
|
2652
|
-
return (await next_local_node_event);
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
onstatuschange(proc) {
|
|
2657
|
-
this.onstatuschange_proc = proc;
|
|
2658
|
-
if (this.onstatuschange_proc != null) {
|
|
2659
|
-
this.onstatuschange_proc();
|
|
2660
|
-
}
|
|
2661
|
-
return this;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
2278
|
};
|
|
2665
2279
|
|
|
2666
|
-
var initialize = async function(wasm) {
|
|
2667
|
-
|
|
2280
|
+
var initialize = async function(wasm, log_level) {
|
|
2281
|
+
var result;
|
|
2282
|
+
result = (await init(wasm));
|
|
2283
|
+
logger_initialize(log_level);
|
|
2284
|
+
return result;
|
|
2668
2285
|
};
|
|
2669
2286
|
|
|
2670
|
-
export {
|
|
2287
|
+
export { LocalExchange, ObjectDescriptor, ObjectExposeContract, ObjectObserveContract, ObjectState, TagDescriptor, TagExposeContract, TagObserveContract, WebsocketConnector, initialize };
|
|
2671
2288
|
//# sourceMappingURL=hakuban.js.map
|