hakuban 0.8.2 → 0.8.4

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/hakuban.js CHANGED
@@ -15,9 +15,6 @@ function handleError(f, args) {
15
15
  }
16
16
  }
17
17
 
18
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
19
-
20
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
21
18
  let cachedUint8ArrayMemory0 = null;
22
19
 
23
20
  function getUint8ArrayMemory0() {
@@ -27,9 +24,24 @@ function getUint8ArrayMemory0() {
27
24
  return cachedUint8ArrayMemory0;
28
25
  }
29
26
 
27
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
28
+
29
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
30
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
31
+ let numBytesDecoded = 0;
32
+ function decodeText(ptr, len) {
33
+ numBytesDecoded += len;
34
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
35
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
36
+ cachedTextDecoder.decode();
37
+ numBytesDecoded = len;
38
+ }
39
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
40
+ }
41
+
30
42
  function getStringFromWasm0(ptr, len) {
31
43
  ptr = ptr >>> 0;
32
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
44
+ return decodeText(ptr, len);
33
45
  }
34
46
 
35
47
  let WASM_VECTOR_LEN = 0;
@@ -100,20 +112,6 @@ function getDataViewMemory0() {
100
112
  function isLikeNone(x) {
101
113
  return x === undefined || x === null;
102
114
  }
103
- /**
104
- * @returns {WasmResult}
105
- */
106
- function hakuban_exchange_new() {
107
- const ret = wasm.hakuban_exchange_new();
108
- return WasmResult.__wrap(ret);
109
- }
110
-
111
- /**
112
- * @param {number} exchange
113
- */
114
- function hakuban_exchange_drop(exchange) {
115
- wasm.hakuban_exchange_drop(exchange);
116
- }
117
115
 
118
116
  let cachedBigUint64ArrayMemory0 = null;
119
117
 
@@ -124,72 +122,121 @@ function getBigUint64ArrayMemory0() {
124
122
  return cachedBigUint64ArrayMemory0;
125
123
  }
126
124
 
127
- function getArrayU64FromWasm0(ptr, len) {
128
- ptr = ptr >>> 0;
129
- return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
125
+ function passArray64ToWasm0(arg, malloc) {
126
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
127
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
128
+ WASM_VECTOR_LEN = arg.length;
129
+ return ptr;
130
130
  }
131
- /**
132
- * @param {number} exchange
133
- * @returns {BigUint64Array}
134
- */
135
- function hakuban_exchange_notified(exchange) {
136
- const ret = wasm.hakuban_exchange_notified(exchange);
137
- var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
138
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
139
- return v1;
131
+
132
+ function passArrayJsValueToWasm0(array, malloc) {
133
+ const ptr = malloc(array.length * 4, 4) >>> 0;
134
+ for (let i = 0; i < array.length; i++) {
135
+ const add = addToExternrefTable0(array[i]);
136
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
137
+ }
138
+ WASM_VECTOR_LEN = array.length;
139
+ return ptr;
140
140
  }
141
141
 
142
+ function passArray8ToWasm0(arg, malloc) {
143
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
144
+ getUint8ArrayMemory0().set(arg, ptr / 1);
145
+ WASM_VECTOR_LEN = arg.length;
146
+ return ptr;
147
+ }
142
148
  /**
143
- * @param {number} exchange
144
- * @param {number} descriptor
145
- * @param {number} capacity
146
- * @returns {number}
149
+ * @param {BigInt64Array} version
150
+ * @param {any[]} format_jsvalues
151
+ * @param {Uint8Array} data
152
+ * @param {bigint} synchronized_us_ago
153
+ * @returns {WasmResult}
147
154
  */
148
- function hakuban_object_expose_contract_new(exchange, descriptor, capacity) {
149
- const ret = wasm.hakuban_object_expose_contract_new(exchange, descriptor, capacity);
150
- return ret >>> 0;
155
+ function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
156
+ const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
157
+ const len0 = WASM_VECTOR_LEN;
158
+ const ptr1 = passArrayJsValueToWasm0(format_jsvalues, wasm.__wbindgen_malloc);
159
+ const len1 = WASM_VECTOR_LEN;
160
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
161
+ const len2 = WASM_VECTOR_LEN;
162
+ const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
163
+ return WasmResult.__wrap(ret);
151
164
  }
152
165
 
153
166
  /**
154
- * @param {number} object_ptr
167
+ * @param {number} object_state_pointer
155
168
  */
156
- function hakuban_object_expose_contract_drop(object_ptr) {
157
- wasm.hakuban_object_expose_contract_drop(object_ptr);
169
+ function hakuban_object_state_drop(object_state_pointer) {
170
+ wasm.hakuban_object_state_drop(object_state_pointer);
158
171
  }
159
172
 
173
+ let cachedBigInt64ArrayMemory0 = null;
174
+
175
+ function getBigInt64ArrayMemory0() {
176
+ if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
177
+ cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
178
+ }
179
+ return cachedBigInt64ArrayMemory0;
180
+ }
181
+
182
+ function getArrayI64FromWasm0(ptr, len) {
183
+ ptr = ptr >>> 0;
184
+ return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
185
+ }
160
186
  /**
161
- * @param {number} object_expose_pointer
162
- * @returns {number}
187
+ * @param {number} object_state_pointer
188
+ * @returns {BigInt64Array}
163
189
  */
164
- function hakuban_object_expose_contract_next(object_expose_pointer) {
165
- const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
166
- return ret >>> 0;
190
+ function hakuban_object_state_version(object_state_pointer) {
191
+ const ret = wasm.hakuban_object_state_version(object_state_pointer);
192
+ var v1 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
193
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
194
+ return v1;
167
195
  }
168
196
 
169
197
  /**
170
- * @param {number} exchange
171
- * @param {number} descriptor
172
- * @returns {number}
198
+ * @param {number} object_state_pointer
199
+ * @returns {bigint}
173
200
  */
174
- function hakuban_object_observe_contract_new(exchange, descriptor) {
175
- const ret = wasm.hakuban_object_observe_contract_new(exchange, descriptor);
176
- return ret >>> 0;
201
+ function hakuban_object_state_synchronized_ago(object_state_pointer) {
202
+ const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
203
+ return BigInt.asUintN(64, ret);
177
204
  }
178
205
 
206
+ function getArrayJsValueFromWasm0(ptr, len) {
207
+ ptr = ptr >>> 0;
208
+ const mem = getDataViewMemory0();
209
+ const result = [];
210
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
211
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
212
+ }
213
+ wasm.__externref_drop_slice(ptr, len);
214
+ return result;
215
+ }
179
216
  /**
180
- * @param {number} object_ptr
217
+ * @param {number} object_state_pointer
218
+ * @returns {any[]}
181
219
  */
182
- function hakuban_object_observe_contract_drop(object_ptr) {
183
- wasm.hakuban_object_observe_contract_drop(object_ptr);
220
+ function hakuban_object_state_format(object_state_pointer) {
221
+ const ret = wasm.hakuban_object_state_format(object_state_pointer);
222
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
223
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
224
+ return v1;
184
225
  }
185
226
 
227
+ function getArrayU8FromWasm0(ptr, len) {
228
+ ptr = ptr >>> 0;
229
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
230
+ }
186
231
  /**
187
- * @param {number} object_observe_pointer
188
- * @returns {number}
232
+ * @param {number} object_state_pointer
233
+ * @returns {Uint8Array}
189
234
  */
190
- function hakuban_object_observe_contract_next(object_observe_pointer) {
191
- const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
192
- return ret >>> 0;
235
+ function hakuban_object_state_data(object_state_pointer) {
236
+ const ret = wasm.hakuban_object_state_data(object_state_pointer);
237
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
238
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
239
+ return v1;
193
240
  }
194
241
 
195
242
  /**
@@ -235,27 +282,86 @@ function hakuban_object_state_sink_params_drop(object_state_sink_params_pointer)
235
282
  }
236
283
 
237
284
  /**
238
- * @param {number} object_state_stream_pointer
285
+ * @param {number} exchange
286
+ * @param {number} descriptor
287
+ * @param {number} capacity
288
+ * @returns {number}
239
289
  */
240
- function hakuban_object_state_stream_drop(object_state_stream_pointer) {
241
- wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
290
+ function hakuban_tag_expose_contract_new(exchange, descriptor, capacity) {
291
+ const ret = wasm.hakuban_tag_expose_contract_new(exchange, descriptor, capacity);
292
+ return ret >>> 0;
242
293
  }
243
294
 
244
295
  /**
245
- * @param {number} object_state_stream_pointer
296
+ * @param {number} tag_expose_contract_pointer
297
+ */
298
+ function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
299
+ wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
300
+ }
301
+
302
+ /**
303
+ * @param {number} tag_expose_pointer
246
304
  * @returns {number}
247
305
  */
248
- function hakuban_object_state_stream_next(object_state_stream_pointer) {
249
- const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
306
+ function hakuban_tag_expose_contract_next(tag_expose_pointer) {
307
+ const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
250
308
  return ret >>> 0;
251
309
  }
252
310
 
253
311
  /**
254
- * @param {number} object_state_stream_pointer
312
+ * @returns {WasmResult}
313
+ */
314
+ function hakuban_exchange_new() {
315
+ const ret = wasm.hakuban_exchange_new();
316
+ return WasmResult.__wrap(ret);
317
+ }
318
+
319
+ /**
320
+ * @param {number} exchange
321
+ */
322
+ function hakuban_exchange_drop(exchange) {
323
+ wasm.hakuban_exchange_drop(exchange);
324
+ }
325
+
326
+ function getArrayU64FromWasm0(ptr, len) {
327
+ ptr = ptr >>> 0;
328
+ return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
329
+ }
330
+ /**
331
+ * @param {number} exchange
332
+ * @returns {BigUint64Array}
333
+ */
334
+ function hakuban_exchange_notified(exchange) {
335
+ const ret = wasm.hakuban_exchange_notified(exchange);
336
+ var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
337
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
338
+ return v1;
339
+ }
340
+
341
+ /**
342
+ * @param {number} exchange
343
+ * @param {number} descriptor
344
+ * @param {number} capacity
255
345
  * @returns {number}
256
346
  */
257
- function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
258
- const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
347
+ function hakuban_object_expose_contract_new(exchange, descriptor, capacity) {
348
+ const ret = wasm.hakuban_object_expose_contract_new(exchange, descriptor, capacity);
349
+ return ret >>> 0;
350
+ }
351
+
352
+ /**
353
+ * @param {number} object_ptr
354
+ */
355
+ function hakuban_object_expose_contract_drop(object_ptr) {
356
+ wasm.hakuban_object_expose_contract_drop(object_ptr);
357
+ }
358
+
359
+ /**
360
+ * @param {number} object_expose_pointer
361
+ * @returns {number}
362
+ */
363
+ function hakuban_object_expose_contract_next(object_expose_pointer) {
364
+ const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
259
365
  return ret >>> 0;
260
366
  }
261
367
 
@@ -264,24 +370,49 @@ function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
264
370
  * @param {number} descriptor
265
371
  * @returns {number}
266
372
  */
267
- function hakuban_tag_observe_contract_new(exchange, descriptor) {
268
- const ret = wasm.hakuban_tag_observe_contract_new(exchange, descriptor);
373
+ function hakuban_object_observe_contract_new(exchange, descriptor) {
374
+ const ret = wasm.hakuban_object_observe_contract_new(exchange, descriptor);
269
375
  return ret >>> 0;
270
376
  }
271
377
 
272
378
  /**
273
- * @param {number} tag_pointer
379
+ * @param {number} object_ptr
274
380
  */
275
- function hakuban_tag_observe_contract_drop(tag_pointer) {
276
- wasm.hakuban_tag_observe_contract_drop(tag_pointer);
381
+ function hakuban_object_observe_contract_drop(object_ptr) {
382
+ wasm.hakuban_object_observe_contract_drop(object_ptr);
277
383
  }
278
384
 
279
385
  /**
280
- * @param {number} tag_observe_pointer
386
+ * @param {number} object_observe_pointer
281
387
  * @returns {number}
282
388
  */
283
- function hakuban_tag_observe_contract_next(tag_observe_pointer) {
284
- const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
389
+ function hakuban_object_observe_contract_next(object_observe_pointer) {
390
+ const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
391
+ return ret >>> 0;
392
+ }
393
+
394
+ /**
395
+ * @param {number} object_state_stream_pointer
396
+ */
397
+ function hakuban_object_state_stream_drop(object_state_stream_pointer) {
398
+ wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
399
+ }
400
+
401
+ /**
402
+ * @param {number} object_state_stream_pointer
403
+ * @returns {number}
404
+ */
405
+ function hakuban_object_state_stream_next(object_state_stream_pointer) {
406
+ const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
407
+ return ret >>> 0;
408
+ }
409
+
410
+ /**
411
+ * @param {number} object_state_stream_pointer
412
+ * @returns {number}
413
+ */
414
+ function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
415
+ const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
285
416
  return ret >>> 0;
286
417
  }
287
418
 
@@ -316,10 +447,6 @@ function hakuban_upstream_connection_next_message_to_network(wasm_upstream_conne
316
447
  return ret >>> 0;
317
448
  }
318
449
 
319
- function getArrayU8FromWasm0(ptr, len) {
320
- ptr = ptr >>> 0;
321
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
322
- }
323
450
  /**
324
451
  * @param {number} message_pointer
325
452
  * @returns {Uint8Array}
@@ -331,12 +458,6 @@ function hakuban_message_serialize(message_pointer) {
331
458
  return v1;
332
459
  }
333
460
 
334
- function passArray8ToWasm0(arg, malloc) {
335
- const ptr = malloc(arg.length * 1, 1) >>> 0;
336
- getUint8ArrayMemory0().set(arg, ptr / 1);
337
- WASM_VECTOR_LEN = arg.length;
338
- return ptr;
339
- }
340
461
  /**
341
462
  * @param {number} wasm_upstream_connection
342
463
  * @param {Uint8Array} message_data
@@ -367,123 +488,6 @@ function hakuban_future_drop(future) {
367
488
  wasm.hakuban_future_drop(future);
368
489
  }
369
490
 
370
- function passArray64ToWasm0(arg, malloc) {
371
- const ptr = malloc(arg.length * 8, 8) >>> 0;
372
- getBigUint64ArrayMemory0().set(arg, ptr / 8);
373
- WASM_VECTOR_LEN = arg.length;
374
- return ptr;
375
- }
376
-
377
- function passArrayJsValueToWasm0(array, malloc) {
378
- const ptr = malloc(array.length * 4, 4) >>> 0;
379
- for (let i = 0; i < array.length; i++) {
380
- const add = addToExternrefTable0(array[i]);
381
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
382
- }
383
- WASM_VECTOR_LEN = array.length;
384
- return ptr;
385
- }
386
- /**
387
- * @param {BigInt64Array} version
388
- * @param {any[]} format_jsvalues
389
- * @param {Uint8Array} data
390
- * @param {bigint} synchronized_us_ago
391
- * @returns {WasmResult}
392
- */
393
- function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
394
- const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
395
- const len0 = WASM_VECTOR_LEN;
396
- const ptr1 = passArrayJsValueToWasm0(format_jsvalues, wasm.__wbindgen_malloc);
397
- const len1 = WASM_VECTOR_LEN;
398
- const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
399
- const len2 = WASM_VECTOR_LEN;
400
- const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
401
- return WasmResult.__wrap(ret);
402
- }
403
-
404
- /**
405
- * @param {number} object_state_pointer
406
- */
407
- function hakuban_object_state_drop(object_state_pointer) {
408
- wasm.hakuban_object_state_drop(object_state_pointer);
409
- }
410
-
411
- let cachedBigInt64ArrayMemory0 = null;
412
-
413
- function getBigInt64ArrayMemory0() {
414
- if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
415
- cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
416
- }
417
- return cachedBigInt64ArrayMemory0;
418
- }
419
-
420
- function getArrayI64FromWasm0(ptr, len) {
421
- ptr = ptr >>> 0;
422
- return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
423
- }
424
- /**
425
- * @param {number} object_state_pointer
426
- * @returns {BigInt64Array}
427
- */
428
- function hakuban_object_state_version(object_state_pointer) {
429
- const ret = wasm.hakuban_object_state_version(object_state_pointer);
430
- var v1 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
431
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
432
- return v1;
433
- }
434
-
435
- /**
436
- * @param {number} object_state_pointer
437
- * @returns {bigint}
438
- */
439
- function hakuban_object_state_synchronized_ago(object_state_pointer) {
440
- const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
441
- return BigInt.asUintN(64, ret);
442
- }
443
-
444
- function getArrayJsValueFromWasm0(ptr, len) {
445
- ptr = ptr >>> 0;
446
- const mem = getDataViewMemory0();
447
- const result = [];
448
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
449
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
450
- }
451
- wasm.__externref_drop_slice(ptr, len);
452
- return result;
453
- }
454
- /**
455
- * @param {number} object_state_pointer
456
- * @returns {any[]}
457
- */
458
- function hakuban_object_state_format(object_state_pointer) {
459
- const ret = wasm.hakuban_object_state_format(object_state_pointer);
460
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
461
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
462
- return v1;
463
- }
464
-
465
- /**
466
- * @param {number} object_state_pointer
467
- * @returns {Uint8Array}
468
- */
469
- function hakuban_object_state_data(object_state_pointer) {
470
- const ret = wasm.hakuban_object_state_data(object_state_pointer);
471
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
472
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
473
- return v1;
474
- }
475
-
476
- /**
477
- * @param {string} default_log_level
478
- * @returns {WasmResult}
479
- */
480
- function hakuban_logger_initialize(default_log_level) {
481
- const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
482
- const len0 = WASM_VECTOR_LEN;
483
- const ret = wasm.hakuban_logger_initialize(ptr0, len0);
484
- return WasmResult.__wrap(ret);
485
- }
486
-
487
491
  /**
488
492
  * @param {string} json_string
489
493
  * @returns {WasmResult}
@@ -570,30 +574,40 @@ function hakuban_object_descriptor_tags(descriptor_pointer) {
570
574
  return v1;
571
575
  }
572
576
 
577
+ /**
578
+ * @param {string} default_log_level
579
+ * @returns {WasmResult}
580
+ */
581
+ function hakuban_logger_initialize(default_log_level) {
582
+ const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ const ret = wasm.hakuban_logger_initialize(ptr0, len0);
585
+ return WasmResult.__wrap(ret);
586
+ }
587
+
573
588
  /**
574
589
  * @param {number} exchange
575
590
  * @param {number} descriptor
576
- * @param {number} capacity
577
591
  * @returns {number}
578
592
  */
579
- function hakuban_tag_expose_contract_new(exchange, descriptor, capacity) {
580
- const ret = wasm.hakuban_tag_expose_contract_new(exchange, descriptor, capacity);
593
+ function hakuban_tag_observe_contract_new(exchange, descriptor) {
594
+ const ret = wasm.hakuban_tag_observe_contract_new(exchange, descriptor);
581
595
  return ret >>> 0;
582
596
  }
583
597
 
584
598
  /**
585
- * @param {number} tag_expose_contract_pointer
599
+ * @param {number} tag_pointer
586
600
  */
587
- function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
588
- wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
601
+ function hakuban_tag_observe_contract_drop(tag_pointer) {
602
+ wasm.hakuban_tag_observe_contract_drop(tag_pointer);
589
603
  }
590
604
 
591
605
  /**
592
- * @param {number} tag_expose_pointer
606
+ * @param {number} tag_observe_pointer
593
607
  * @returns {number}
594
608
  */
595
- function hakuban_tag_expose_contract_next(tag_expose_pointer) {
596
- const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
609
+ function hakuban_tag_observe_contract_next(tag_observe_pointer) {
610
+ const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
597
611
  return ret >>> 0;
598
612
  }
599
613
 
@@ -686,6 +700,8 @@ class WasmResult {
686
700
  }
687
701
  }
688
702
 
703
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
704
+
689
705
  async function __wbg_load(module, imports) {
690
706
  if (typeof Response === 'function' && module instanceof Response) {
691
707
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -693,7 +709,9 @@ async function __wbg_load(module, imports) {
693
709
  return await WebAssembly.instantiateStreaming(module, imports);
694
710
 
695
711
  } catch (e) {
696
- if (module.headers.get('Content-Type') != 'application/wasm') {
712
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
713
+
714
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
697
715
  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);
698
716
 
699
717
  } else {
@@ -720,14 +738,14 @@ async function __wbg_load(module, imports) {
720
738
  function __wbg_get_imports() {
721
739
  const imports = {};
722
740
  imports.wbg = {};
723
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
741
+ imports.wbg.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
724
742
  const ret = arg0.call(arg1);
725
743
  return ret;
726
744
  }, arguments) };
727
- imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
745
+ imports.wbg.__wbg_debug_58d16ea352cfbca1 = function(arg0) {
728
746
  console.debug(arg0);
729
747
  };
730
- imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
748
+ imports.wbg.__wbg_error_51ecdd39ec054205 = function(arg0) {
731
749
  console.error(arg0);
732
750
  };
733
751
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
@@ -741,17 +759,17 @@ function __wbg_get_imports() {
741
759
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
742
760
  }
743
761
  };
744
- imports.wbg.__wbg_info_3daf2e093e091b66 = function(arg0) {
762
+ imports.wbg.__wbg_info_e56933705c348038 = function(arg0) {
745
763
  console.info(arg0);
746
764
  };
747
- imports.wbg.__wbg_log_c222819a41e063d3 = function(arg0) {
765
+ imports.wbg.__wbg_log_ea240990d83e374e = function(arg0) {
748
766
  console.log(arg0);
749
767
  };
750
768
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
751
769
  const ret = new Error();
752
770
  return ret;
753
771
  };
754
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
772
+ imports.wbg.__wbg_newnoargs_ff528e72d35de39a = function(arg0, arg1) {
755
773
  const ret = new Function(getStringFromWasm0(arg0, arg1));
756
774
  return ret;
757
775
  };
@@ -770,23 +788,23 @@ function __wbg_get_imports() {
770
788
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
771
789
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
772
790
  };
773
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
791
+ imports.wbg.__wbg_static_accessor_GLOBAL_487c52c58d65314d = function() {
774
792
  const ret = typeof global === 'undefined' ? null : global;
775
793
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
776
794
  };
777
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
795
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291 = function() {
778
796
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
779
797
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
780
798
  };
781
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
799
+ imports.wbg.__wbg_static_accessor_SELF_78c9e3071b912620 = function() {
782
800
  const ret = typeof self === 'undefined' ? null : self;
783
801
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
784
802
  };
785
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
803
+ imports.wbg.__wbg_static_accessor_WINDOW_a093d21393777366 = function() {
786
804
  const ret = typeof window === 'undefined' ? null : window;
787
805
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
788
806
  };
789
- imports.wbg.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
807
+ imports.wbg.__wbg_warn_d89f6637da554c8d = function(arg0) {
790
808
  console.warn(arg0);
791
809
  };
792
810
  imports.wbg.__wbindgen_init_externref_table = function() {
@@ -861,6 +879,18 @@ async function __wbg_init(module_or_path) {
861
879
  return __wbg_finalize_init(instance, module);
862
880
  }
863
881
 
882
+ var logger_log_level;
883
+
884
+ logger_log_level = void 0;
885
+
886
+ var log_level = function() {
887
+ return logger_log_level;
888
+ };
889
+
890
+ var log_level_set = function(value) {
891
+ return logger_log_level = value;
892
+ };
893
+
864
894
  var unwrap_pointer = function(result) {
865
895
  if (result.status === 1) {
866
896
  return result.pointer;
@@ -932,29 +962,23 @@ var Future = class Future {
932
962
 
933
963
  };
934
964
 
935
- var logger_initialized, logger_log_level;
965
+ var logger_initialized;
936
966
 
937
967
  logger_initialized = false;
938
968
 
939
- logger_log_level = void 0;
940
-
941
969
  var logger_initialize = function(log_level, skip_if_already_initialized = false) {
942
970
  var result;
943
971
  if (!logger_initialized || !skip_if_already_initialized) {
944
972
  result = hakuban_logger_initialize(log_level);
945
973
  if (result.status === 0) {
946
974
  logger_initialized = true;
947
- return logger_log_level = log_level;
975
+ return log_level_set(log_level);
948
976
  } else {
949
977
  return console.error("Failed to initialize logger, error " + result.error_message);
950
978
  }
951
979
  }
952
980
  };
953
981
 
954
- var log_level = function() {
955
- return logger_log_level;
956
- };
957
-
958
982
  var do_and_drop, do_and_drop_or_return, finalization_registry;
959
983
 
960
984
  finalization_registry = new FinalizationRegistry(function(function_and_arg) {