@blaze-cache/core 0.3.0 → 0.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ export class BlazeCache {
35
35
  */
36
36
  deleteMany(keys) {
37
37
  try {
38
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
38
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
39
39
  const ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
40
40
  const len0 = WASM_VECTOR_LEN;
41
41
  wasm.blazecache_deleteMany(retptr, this.__wbg_ptr, ptr0, len0);
@@ -82,7 +82,7 @@ export class BlazeCache {
82
82
  */
83
83
  drainDrops() {
84
84
  const ret = wasm.blazecache_drainDrops(this.__wbg_ptr);
85
- return takeObject(ret);
85
+ return ret;
86
86
  }
87
87
  /**
88
88
  * `true` while the drop log is being collected.
@@ -101,7 +101,7 @@ export class BlazeCache {
101
101
  */
102
102
  entries() {
103
103
  const ret = wasm.blazecache_entries(this.__wbg_ptr);
104
- return takeObject(ret);
104
+ return ret;
105
105
  }
106
106
  /**
107
107
  * Full view of one key — value, remaining TTL (ms) and tags — or `undefined` when the key
@@ -113,7 +113,7 @@ export class BlazeCache {
113
113
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
114
114
  const len0 = WASM_VECTOR_LEN;
115
115
  const ret = wasm.blazecache_entry(this.__wbg_ptr, ptr0, len0);
116
- return takeObject(ret);
116
+ return ret;
117
117
  }
118
118
  /**
119
119
  * Batch get: looks up every key in one boundary crossing. Returns `JsValue::UNDEFINED`
@@ -123,7 +123,7 @@ export class BlazeCache {
123
123
  */
124
124
  getMany(keys) {
125
125
  try {
126
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
126
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
127
127
  const ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
128
128
  const len0 = WASM_VECTOR_LEN;
129
129
  wasm.blazecache_getMany(retptr, this.__wbg_ptr, ptr0, len0);
@@ -155,7 +155,7 @@ export class BlazeCache {
155
155
  */
156
156
  getRaw(ptr, len) {
157
157
  const ret = wasm.blazecache_getRaw(this.__wbg_ptr, ptr, len);
158
- return takeObject(ret);
158
+ return ret;
159
159
  }
160
160
  /**
161
161
  * Returns the value stored under `key`, or `undefined` when it is missing/expired.
@@ -168,7 +168,7 @@ export class BlazeCache {
168
168
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
169
169
  const len0 = WASM_VECTOR_LEN;
170
170
  const ret = wasm.blazecache_get(this.__wbg_ptr, ptr0, len0);
171
- return takeObject(ret);
171
+ return ret;
172
172
  }
173
173
  /**
174
174
  * Batch has: returns `1` for each key that is present and not expired, `0` otherwise.
@@ -177,7 +177,7 @@ export class BlazeCache {
177
177
  */
178
178
  hasMany(keys) {
179
179
  try {
180
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
180
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
181
181
  const ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
182
182
  const len0 = WASM_VECTOR_LEN;
183
183
  wasm.blazecache_hasMany(retptr, this.__wbg_ptr, ptr0, len0);
@@ -197,10 +197,17 @@ export class BlazeCache {
197
197
  * @returns {boolean}
198
198
  */
199
199
  hasTag(key, tag) {
200
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
201
- const len0 = WASM_VECTOR_LEN;
202
- const ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
203
- const len1 = WASM_VECTOR_LEN;
200
+ let ptr0, len0, ptr1, len1;
201
+ try {
202
+ ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
203
+ len0 = WASM_VECTOR_LEN;
204
+ ptr1 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
205
+ len1 = WASM_VECTOR_LEN;
206
+ } catch (e) {
207
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 1, 1); }
208
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
209
+ throw e;
210
+ }
204
211
  const ret = wasm.blazecache_hasTag(this.__wbg_ptr, ptr0, len0, ptr1, len1);
205
212
  return ret !== 0;
206
213
  }
@@ -223,7 +230,7 @@ export class BlazeCache {
223
230
  */
224
231
  invalidateTags(tags) {
225
232
  try {
226
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
233
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
227
234
  const ptr0 = passArrayJsValueToWasm0(tags, wasm.__wbindgen_export);
228
235
  const len0 = WASM_VECTOR_LEN;
229
236
  wasm.blazecache_invalidateTags(retptr, this.__wbg_ptr, ptr0, len0);
@@ -243,7 +250,7 @@ export class BlazeCache {
243
250
  */
244
251
  keysWithTag(tag) {
245
252
  try {
246
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
253
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
247
254
  const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
248
255
  const len0 = WASM_VECTOR_LEN;
249
256
  wasm.blazecache_keysWithTag(retptr, this.__wbg_ptr, ptr0, len0);
@@ -262,7 +269,7 @@ export class BlazeCache {
262
269
  */
263
270
  keys() {
264
271
  try {
265
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
272
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
266
273
  wasm.blazecache_keys(retptr, this.__wbg_ptr);
267
274
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
268
275
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -307,7 +314,7 @@ export class BlazeCache {
307
314
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
308
315
  const len0 = WASM_VECTOR_LEN;
309
316
  const ret = wasm.blazecache_peek(this.__wbg_ptr, ptr0, len0);
310
- return takeObject(ret);
317
+ return ret;
311
318
  }
312
319
  /**
313
320
  * Removes every expired entry, returning the removed keys.
@@ -315,7 +322,7 @@ export class BlazeCache {
315
322
  */
316
323
  prune() {
317
324
  try {
318
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
325
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
319
326
  wasm.blazecache_prune(retptr, this.__wbg_ptr);
320
327
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
328
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -354,20 +361,29 @@ export class BlazeCache {
354
361
  * for that entry instead of panicking and trapping the wasm instance.
355
362
  * @param {string[]} keys
356
363
  * @param {any} values
357
- * @param {Float64Array} ttl_ms
364
+ * @param {Float64Array | number[]} ttl_ms
358
365
  * @param {string[]} tags_flat
359
- * @param {Uint32Array} tag_offsets
366
+ * @param {Uint32Array | number[]} tag_offsets
360
367
  */
361
368
  setMany(keys, values, ttl_ms, tags_flat, tag_offsets) {
362
- const ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
363
- const len0 = WASM_VECTOR_LEN;
364
- const ptr1 = passArrayF64ToWasm0(ttl_ms, wasm.__wbindgen_export);
365
- const len1 = WASM_VECTOR_LEN;
366
- const ptr2 = passArrayJsValueToWasm0(tags_flat, wasm.__wbindgen_export);
367
- const len2 = WASM_VECTOR_LEN;
368
- const ptr3 = passArray32ToWasm0(tag_offsets, wasm.__wbindgen_export);
369
- const len3 = WASM_VECTOR_LEN;
370
- wasm.blazecache_setMany(this.__wbg_ptr, ptr0, len0, addHeapObject(values), ptr1, len1, ptr2, len2, ptr3, len3);
369
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3;
370
+ try {
371
+ ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
372
+ len0 = WASM_VECTOR_LEN;
373
+ ptr1 = passArrayF64ToWasm0(ttl_ms, wasm.__wbindgen_export);
374
+ len1 = WASM_VECTOR_LEN;
375
+ ptr2 = passArrayJsValueToWasm0(tags_flat, wasm.__wbindgen_export);
376
+ len2 = WASM_VECTOR_LEN;
377
+ ptr3 = passArray32ToWasm0(tag_offsets, wasm.__wbindgen_export);
378
+ len3 = WASM_VECTOR_LEN;
379
+ } catch (e) {
380
+ if (ptr3) { wasm.__wbindgen_export3(ptr3, len3 * 4, 4); }
381
+ if (ptr2) { wasm.__wbindgen_export6(ptr2, len2); wasm.__wbindgen_export3(ptr2, len2 * 4, 4); }
382
+ if (ptr1) { wasm.__wbindgen_export3(ptr1, len1 * 8, 8); }
383
+ if (ptr0) { wasm.__wbindgen_export6(ptr0, len0); wasm.__wbindgen_export3(ptr0, len0 * 4, 4); }
384
+ throw e;
385
+ }
386
+ wasm.blazecache_setMany(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2, ptr3, len3);
371
387
  }
372
388
  /**
373
389
  * [`set`](Self::set) with a pre-encoded key and **no tags** — the untagged write fast
@@ -379,7 +395,7 @@ export class BlazeCache {
379
395
  * @param {number | null} [ttl_ms]
380
396
  */
381
397
  setRaw(ptr, len, value, ttl_ms) {
382
- wasm.blazecache_setRaw(this.__wbg_ptr, ptr, len, addHeapObject(value), !isLikeNone(ttl_ms), isLikeNone(ttl_ms) ? 0 : ttl_ms);
398
+ wasm.blazecache_setRaw(this.__wbg_ptr, ptr, len, value, !isLikeNone(ttl_ms), isLikeNone(ttl_ms) ? 0 : ttl_ms);
383
399
  }
384
400
  /**
385
401
  * Stores `value` under `key`.
@@ -397,11 +413,19 @@ export class BlazeCache {
397
413
  * @param {string[]} tags
398
414
  */
399
415
  set(key, value, ttl_ms, tags) {
400
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
401
- const len0 = WASM_VECTOR_LEN;
402
- const ptr1 = passArrayJsValueToWasm0(tags, wasm.__wbindgen_export);
403
- const len1 = WASM_VECTOR_LEN;
404
- wasm.blazecache_set(this.__wbg_ptr, ptr0, len0, addHeapObject(value), !isLikeNone(ttl_ms), isLikeNone(ttl_ms) ? 0 : ttl_ms, ptr1, len1);
416
+ const val3 = +(isLikeNone(ttl_ms) ? 0 : ttl_ms);
417
+ let ptr0, len0, ptr1, len1;
418
+ try {
419
+ ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
420
+ len0 = WASM_VECTOR_LEN;
421
+ ptr1 = passArrayJsValueToWasm0(tags, wasm.__wbindgen_export);
422
+ len1 = WASM_VECTOR_LEN;
423
+ } catch (e) {
424
+ if (ptr1) { wasm.__wbindgen_export6(ptr1, len1); wasm.__wbindgen_export3(ptr1, len1 * 4, 4); }
425
+ if (ptr0) { wasm.__wbindgen_export3(ptr0, len0 * 1, 1); }
426
+ throw e;
427
+ }
428
+ wasm.blazecache_set(this.__wbg_ptr, ptr0, len0, value, !isLikeNone(ttl_ms), val3, ptr1, len1);
405
429
  }
406
430
  /**
407
431
  * Number of stored entries that are present **and** not expired — expired-but-unpruned
@@ -420,15 +444,15 @@ export class BlazeCache {
420
444
  */
421
445
  stats() {
422
446
  try {
423
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
424
448
  wasm.blazecache_stats(retptr, this.__wbg_ptr);
425
449
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
426
450
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
427
451
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
428
452
  if (r2) {
429
- throw takeObject(r1);
453
+ throw takeFromExternrefTable0(r1);
430
454
  }
431
- return takeObject(r0);
455
+ return takeFromExternrefTable0(r0);
432
456
  } finally {
433
457
  wasm.__wbindgen_add_to_stack_pointer(16);
434
458
  }
@@ -440,7 +464,7 @@ export class BlazeCache {
440
464
  */
441
465
  tagsOf(key) {
442
466
  try {
443
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
467
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
444
468
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
445
469
  const len0 = WASM_VECTOR_LEN;
446
470
  wasm.blazecache_tagsOf(retptr, this.__wbg_ptr, ptr0, len0);
@@ -465,9 +489,10 @@ export class BlazeCache {
465
489
  * @returns {boolean}
466
490
  */
467
491
  touch(key, ttl_ms) {
492
+ const val2 = +(isLikeNone(ttl_ms) ? 0 : ttl_ms);
468
493
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
469
494
  const len0 = WASM_VECTOR_LEN;
470
- const ret = wasm.blazecache_touch(this.__wbg_ptr, ptr0, len0, !isLikeNone(ttl_ms), isLikeNone(ttl_ms) ? 0 : ttl_ms);
495
+ const ret = wasm.blazecache_touch(this.__wbg_ptr, ptr0, len0, !isLikeNone(ttl_ms), val2);
471
496
  return ret !== 0;
472
497
  }
473
498
  /**
@@ -478,7 +503,7 @@ export class BlazeCache {
478
503
  */
479
504
  ttl(key) {
480
505
  try {
481
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16) >>> 0;
482
507
  const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
483
508
  const len0 = WASM_VECTOR_LEN;
484
509
  wasm.blazecache_ttl(retptr, this.__wbg_ptr, ptr0, len0);
@@ -523,30 +548,30 @@ export function setPanicHook() {
523
548
  function __wbg_get_imports() {
524
549
  const import0 = {
525
550
  __proto__: null,
526
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
551
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
527
552
  const ret = Error(getStringFromWasm0(arg0, arg1));
528
- return addHeapObject(ret);
553
+ return ret;
529
554
  },
530
555
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
531
- const ret = String(getObject(arg1));
556
+ const ret = String(arg1);
532
557
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
533
558
  const len1 = WASM_VECTOR_LEN;
534
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
535
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
559
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
560
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
536
561
  },
537
- __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
538
- const ret = getObject(arg0) === undefined;
562
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
563
+ const ret = arg0 === undefined;
539
564
  return ret;
540
565
  },
541
- __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
542
- const obj = getObject(arg1);
566
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
567
+ const obj = arg1;
543
568
  const ret = typeof(obj) === 'string' ? obj : undefined;
544
569
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
545
570
  var len1 = WASM_VECTOR_LEN;
546
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
547
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
571
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
572
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
548
573
  },
549
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
574
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
550
575
  throw new Error(getStringFromWasm0(arg0, arg1));
551
576
  },
552
577
  __wbg_error_757e9472f8410341: function(arg0, arg1) {
@@ -560,93 +585,94 @@ function __wbg_get_imports() {
560
585
  wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
561
586
  }
562
587
  },
563
- __wbg_from_296ca31f8d0f1c52: function(arg0) {
564
- const ret = Array.from(getObject(arg0));
565
- return addHeapObject(ret);
588
+ __wbg_from_eac91875c8a5ffa4: function(arg0) {
589
+ const ret = Array.from(arg0);
590
+ return ret;
566
591
  },
567
- __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
568
- const ret = getObject(arg0)[arg1 >>> 0];
569
- return addHeapObject(ret);
592
+ __wbg_get_d7176cfb76d71114: function(arg0, arg1) {
593
+ const ret = arg0[arg1 >>> 0];
594
+ return ret;
570
595
  },
571
- __wbg_length_d4bdea10311bd9cf: function(arg0) {
572
- const ret = getObject(arg0).length;
596
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
597
+ const ret = arg0.length;
573
598
  return ret;
574
599
  },
575
- __wbg_new_227d7c05414eb861: function() {
600
+ __wbg_new_37eb45aaf5eeb820: function() {
601
+ const ret = new Array();
602
+ return ret;
603
+ },
604
+ __wbg_new_bb74001155cb8ca8: function() {
576
605
  const ret = new Error();
577
- return addHeapObject(ret);
606
+ return ret;
578
607
  },
579
- __wbg_new_617a8cdb8bb1130e: function() {
608
+ __wbg_new_cd4348290afae586: function() {
580
609
  const ret = new Object();
581
- return addHeapObject(ret);
582
- },
583
- __wbg_new_ee2291f50781bf1d: function() {
584
- const ret = new Array();
585
- return addHeapObject(ret);
610
+ return ret;
586
611
  },
587
612
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
588
- const ret = getObject(arg0).now();
613
+ const ret = arg0.now();
589
614
  return ret;
590
615
  },
591
- __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
592
- const ret = getObject(arg0).performance;
593
- return addHeapObject(ret);
616
+ __wbg_performance_7e4e4494fdc9d07a: function(arg0) {
617
+ const ret = arg0.performance;
618
+ return ret;
594
619
  },
595
- __wbg_push_2baf45db356cf468: function(arg0, arg1) {
596
- const ret = getObject(arg0).push(getObject(arg1));
620
+ __wbg_push_c9f4893fc209f768: function(arg0, arg1) {
621
+ const ret = arg0.push(arg1);
597
622
  return ret;
598
623
  },
599
- __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
600
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
624
+ __wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
625
+ const ret = Reflect.set(arg0, arg1, arg2);
601
626
  return ret;
602
627
  }, arguments); },
603
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
604
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
628
+ __wbg_set_e4b9a833d288759a: function(arg0, arg1, arg2) {
629
+ arg0[arg1] = arg2;
605
630
  },
606
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
607
- const ret = getObject(arg1).stack;
631
+ __wbg_stack_575c4e0918581b9c: function(arg0, arg1) {
632
+ const ret = arg1.stack;
608
633
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
609
634
  const len1 = WASM_VECTOR_LEN;
610
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
611
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
635
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
636
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
612
637
  },
613
- __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
614
- const ret = typeof global === 'undefined' ? null : global;
615
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
638
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
639
+ const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
640
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
616
641
  },
617
- __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
618
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
619
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
642
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
643
+ const ret = typeof global === 'undefined' ? undefined : global;
644
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
620
645
  },
621
- __wbg_static_accessor_SELF_0b583911f537483a: function() {
622
- const ret = typeof self === 'undefined' ? null : self;
623
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
646
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
647
+ const ret = typeof self === 'undefined' ? undefined : self;
648
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
624
649
  },
625
- __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
626
- const ret = typeof window === 'undefined' ? null : window;
627
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
650
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
651
+ const ret = typeof window === 'undefined' ? undefined : window;
652
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
628
653
  },
629
654
  __wbindgen_generic_0000000000000001: function(arg0) {
630
655
  // Cast intrinsic for `F64 -> Externref`.
631
656
  const ret = arg0;
632
- return addHeapObject(ret);
657
+ return ret;
633
658
  },
634
659
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
635
660
  // Cast intrinsic for `Ref(String) -> Externref`.
636
661
  const ret = getStringFromWasm0(arg0, arg1);
637
- return addHeapObject(ret);
662
+ return ret;
638
663
  },
639
664
  __wbindgen_generic_0000000000000003: function(arg0) {
640
665
  // Cast intrinsic for `U64 -> Externref`.
641
666
  const ret = BigInt.asUintN(64, arg0);
642
- return addHeapObject(ret);
643
- },
644
- __wbindgen_object_clone_ref: function(arg0) {
645
- const ret = getObject(arg0);
646
- return addHeapObject(ret);
667
+ return ret;
647
668
  },
648
- __wbindgen_object_drop_ref: function(arg0) {
649
- takeObject(arg0);
669
+ __wbindgen_init_externref_table: function() {
670
+ const table = wasm.__wbindgen_externrefs;
671
+ table.set(0, undefined);
672
+ table.set(1024, undefined);
673
+ table.set(1025, null);
674
+ table.set(1026, true);
675
+ table.set(1027, false);
650
676
  },
651
677
  };
652
678
  return {
@@ -659,28 +685,20 @@ const BlazeCacheFinalization = (typeof FinalizationRegistry === 'undefined')
659
685
  ? { register: () => {}, unregister: () => {} }
660
686
  : new FinalizationRegistry(ptr => wasm.__wbg_blazecache_free(ptr, 1));
661
687
 
662
- function addHeapObject(obj) {
663
- if (heap_next === heap.length) heap.push(heap.length + 1);
664
- const idx = heap_next;
665
- heap_next = heap[idx];
666
-
667
- heap[idx] = obj;
688
+ function addToExternrefTable0(obj) {
689
+ const idx = wasm.__wbindgen_export5();
690
+ wasm.__wbindgen_externrefs.set(idx, obj);
668
691
  return idx;
669
692
  }
670
693
 
671
- function dropObject(idx) {
672
- if (idx < 1028) return;
673
- heap[idx] = heap_next;
674
- heap_next = idx;
675
- }
676
-
677
694
  function getArrayJsValueFromWasm0(ptr, len) {
678
695
  ptr = ptr >>> 0;
679
696
  const mem = getDataViewMemory0();
680
697
  const result = [];
681
698
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
682
- result.push(takeObject(mem.getUint32(i, true)));
699
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
683
700
  }
701
+ wasm.__wbindgen_export6(ptr, len);
684
702
  return result;
685
703
  }
686
704
 
@@ -706,7 +724,8 @@ function getFloat64ArrayMemory0() {
706
724
  }
707
725
 
708
726
  function getStringFromWasm0(ptr, len) {
709
- return decodeText(ptr >>> 0, len);
727
+ ptr = ptr >>> 0;
728
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
710
729
  }
711
730
 
712
731
  let cachedUint32ArrayMemory0 = null;
@@ -725,21 +744,15 @@ function getUint8ArrayMemory0() {
725
744
  return cachedUint8ArrayMemory0;
726
745
  }
727
746
 
728
- function getObject(idx) { return heap[idx]; }
729
-
730
747
  function handleError(f, args) {
731
748
  try {
732
749
  return f.apply(this, args);
733
750
  } catch (e) {
734
- wasm.__wbindgen_export4(addHeapObject(e));
751
+ const idx = addToExternrefTable0(e);
752
+ wasm.__wbindgen_export4(idx);
735
753
  }
736
754
  }
737
755
 
738
- let heap = new Array(1024).fill(undefined);
739
- heap.push(undefined, null, true, false);
740
-
741
- let heap_next = heap.length;
742
-
743
756
  function isLikeNone(x) {
744
757
  return x === undefined || x === null;
745
758
  }
@@ -760,9 +773,9 @@ function passArrayF64ToWasm0(arg, malloc) {
760
773
 
761
774
  function passArrayJsValueToWasm0(array, malloc) {
762
775
  const ptr = malloc(array.length * 4, 4) >>> 0;
763
- const mem = getDataViewMemory0();
764
776
  for (let i = 0; i < array.length; i++) {
765
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
777
+ const add = addToExternrefTable0(array[i]);
778
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
766
779
  }
767
780
  WASM_VECTOR_LEN = array.length;
768
781
  return ptr;
@@ -805,24 +818,24 @@ function passStringToWasm0(arg, malloc, realloc) {
805
818
  return ptr;
806
819
  }
807
820
 
808
- function takeObject(idx) {
809
- const ret = getObject(idx);
810
- dropObject(idx);
811
- return ret;
821
+ function takeFromExternrefTable0(idx) {
822
+ const value = wasm.__wbindgen_externrefs.get(idx);
823
+ wasm.__wbindgen_export7(idx);
824
+ return value;
812
825
  }
813
826
 
814
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
827
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
815
828
  cachedTextDecoder.decode();
816
829
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
817
830
  let numBytesDecoded = 0;
818
- function decodeText(ptr, len) {
819
- numBytesDecoded += len;
831
+ function decodeText(bytes) {
832
+ numBytesDecoded += bytes.length;
820
833
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
821
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
834
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
822
835
  cachedTextDecoder.decode();
823
- numBytesDecoded = len;
836
+ numBytesDecoded = bytes.length;
824
837
  }
825
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
838
+ return cachedTextDecoder.decode(bytes);
826
839
  }
827
840
 
828
841
  const cachedTextEncoder = new TextEncoder();
@@ -849,6 +862,7 @@ function __wbg_finalize_init(instance, module) {
849
862
  cachedFloat64ArrayMemory0 = null;
850
863
  cachedUint32ArrayMemory0 = null;
851
864
  cachedUint8ArrayMemory0 = null;
865
+ wasm.__wbindgen_start();
852
866
  return wasm;
853
867
  }
854
868
 
@@ -911,9 +925,17 @@ function initSync(module) {
911
925
  return __wbg_finalize_init(instance, module);
912
926
  }
913
927
 
928
+ let __wbg_init_promise;
914
929
  async function __wbg_init(module_or_path) {
915
930
  if (wasm !== undefined) return wasm;
931
+ if (__wbg_init_promise === undefined) {
932
+ __wbg_init_promise = __wbg_init_once(module_or_path);
933
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
934
+ }
935
+ return __wbg_init_promise;
936
+ }
916
937
 
938
+ async function __wbg_init_once(module_or_path) {
917
939
 
918
940
  if (module_or_path !== undefined) {
919
941
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
Binary file
@@ -7,13 +7,13 @@ export const blazecache_clear: (a: number) => void;
7
7
  export const blazecache_delete: (a: number, b: number, c: number) => number;
8
8
  export const blazecache_deleteMany: (a: number, b: number, c: number, d: number) => void;
9
9
  export const blazecache_deleteRaw: (a: number, b: number, c: number) => number;
10
- export const blazecache_drainDrops: (a: number) => number;
10
+ export const blazecache_drainDrops: (a: number) => any;
11
11
  export const blazecache_dropTracking: (a: number) => number;
12
- export const blazecache_entries: (a: number) => number;
13
- export const blazecache_entry: (a: number, b: number, c: number) => number;
14
- export const blazecache_get: (a: number, b: number, c: number) => number;
12
+ export const blazecache_entries: (a: number) => any;
13
+ export const blazecache_entry: (a: number, b: number, c: number) => any;
14
+ export const blazecache_get: (a: number, b: number, c: number) => any;
15
15
  export const blazecache_getMany: (a: number, b: number, c: number, d: number) => void;
16
- export const blazecache_getRaw: (a: number, b: number, c: number) => number;
16
+ export const blazecache_getRaw: (a: number, b: number, c: number) => any;
17
17
  export const blazecache_has: (a: number, b: number, c: number) => number;
18
18
  export const blazecache_hasMany: (a: number, b: number, c: number, d: number) => void;
19
19
  export const blazecache_hasTag: (a: number, b: number, c: number, d: number, e: number) => number;
@@ -21,13 +21,13 @@ export const blazecache_invalidateTags: (a: number, b: number, c: number, d: num
21
21
  export const blazecache_keys: (a: number, b: number) => void;
22
22
  export const blazecache_keysWithTag: (a: number, b: number, c: number, d: number) => void;
23
23
  export const blazecache_new: (a: number) => number;
24
- export const blazecache_peek: (a: number, b: number, c: number) => number;
24
+ export const blazecache_peek: (a: number, b: number, c: number) => any;
25
25
  export const blazecache_prune: (a: number, b: number) => void;
26
26
  export const blazecache_resetStats: (a: number) => void;
27
- export const blazecache_set: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
27
+ export const blazecache_set: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => void;
28
28
  export const blazecache_setDropTracking: (a: number, b: number) => void;
29
- export const blazecache_setMany: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
30
- export const blazecache_setRaw: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
29
+ export const blazecache_setMany: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number, i: number, j: number) => void;
30
+ export const blazecache_setRaw: (a: number, b: number, c: number, d: any, e: number, f: number) => void;
31
31
  export const blazecache_size: (a: number) => number;
32
32
  export const blazecache_stats: (a: number, b: number) => void;
33
33
  export const blazecache_tagsOf: (a: number, b: number, c: number, d: number) => void;
@@ -39,4 +39,9 @@ export const __wbindgen_export: (a: number, b: number) => number;
39
39
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
40
40
  export const __wbindgen_export3: (a: number, b: number, c: number) => void;
41
41
  export const __wbindgen_export4: (a: number) => void;
42
+ export const __wbindgen_export5: () => number;
43
+ export const __wbindgen_externrefs: WebAssembly.Table;
42
44
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
45
+ export const __wbindgen_export6: (a: number, b: number) => void;
46
+ export const __wbindgen_export7: (a: number) => void;
47
+ export const __wbindgen_start: () => void;
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "blaze-cache-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for the Blaze Cache engine",
5
- "version": "0.3.0",
5
+ "version": "0.4.0-beta.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",