@rustledger/wasm 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Rustledger Contributors"
6
6
  ],
7
7
  "description": "Beancount WebAssembly bindings for JavaScript/TypeScript",
8
- "version": "0.10.1",
8
+ "version": "0.11.0",
9
9
  "license": "GPL-3.0-only",
10
10
  "repository": {
11
11
  "type": "git",
@@ -303,116 +303,48 @@ export class ParsedLedger {
303
303
  getReferences(line: number, character: number): EditorReferencesResult | null;
304
304
  }
305
305
 
306
+ // =============================================================================
307
+ // Multi-File API (for WASM environments without filesystem access)
308
+ // =============================================================================
306
309
 
310
+ /** Map of file paths to their contents. */
311
+ export type FileMap = Record<string, string>;
307
312
 
308
313
  /**
309
- * A parsed and validated ledger that caches the parse result.
314
+ * Parse multiple Beancount files with include resolution.
310
315
  *
311
- * Use this class when you need to perform multiple operations on the same
312
- * source without re-parsing each time.
316
+ * @param files - Object mapping file paths to their contents
317
+ * @param entryPoint - The main file to start loading from (must exist in files)
318
+ * @returns ParseResult with the combined ledger from all files
313
319
  *
314
- * # Example (JavaScript)
320
+ * @example
321
+ * const result = parseMultiFile({
322
+ * "main.beancount": 'include "accounts.beancount"',
323
+ * "accounts.beancount": "2024-01-01 open Assets:Bank USD"
324
+ * }, "main.beancount");
325
+ */
326
+ export function parseMultiFile(files: FileMap, entryPoint: string): ParseResult;
327
+
328
+ /**
329
+ * Validate multiple Beancount files with include resolution.
315
330
  *
316
- * ```javascript
317
- * const ledger = new ParsedLedger(source);
318
- * if (ledger.isValid()) {
319
- * const balances = ledger.query("BALANCES");
320
- * const formatted = ledger.format();
321
- * }
322
- * ```
331
+ * @param files - Object mapping file paths to their contents
332
+ * @param entryPoint - The main file to start loading from (must exist in files)
333
+ * @returns ValidationResult indicating whether the combined ledger is valid
323
334
  */
324
- export class ParsedLedger {
325
- free(): void;
326
- [Symbol.dispose](): void;
327
- /**
328
- * Get account balances (shorthand for query("BALANCES")).
329
- */
330
- balances(): any;
331
- /**
332
- * Get the number of directives.
333
- */
334
- directiveCount(): number;
335
- /**
336
- * Expand pad directives.
337
- */
338
- expandPads(): any;
339
- /**
340
- * Format the ledger source.
341
- */
342
- format(): any;
343
- /**
344
- * Get completions at the given position.
345
- *
346
- * Returns context-aware completions for accounts, currencies, directives, etc.
347
- * Uses cached account/currency/payee data for efficiency.
348
- */
349
- getCompletions(line: number, character: number): any;
350
- /**
351
- * Get the definition location for the symbol at the given position.
352
- *
353
- * Returns the location of the `open` or `commodity` directive for accounts/currencies.
354
- * Uses cached `LineIndex` for O(log n) position lookups.
355
- */
356
- getDefinition(line: number, character: number): any;
357
- /**
358
- * Get the parsed directives.
359
- */
360
- getDirectives(): any;
361
- /**
362
- * Get all document symbols for the outline view.
363
- *
364
- * Returns a hierarchical list of all directives with their positions.
365
- * Uses cached `LineIndex` for O(log n) position lookups.
366
- */
367
- getDocumentSymbols(): any;
368
- /**
369
- * Get all errors (parse + validation).
370
- */
371
- getErrors(): any;
372
- /**
373
- * Get hover information at the given position.
374
- *
375
- * Returns documentation for accounts, currencies, and directive keywords.
376
- */
377
- getHoverInfo(line: number, character: number): any;
378
- /**
379
- * Get the ledger options.
380
- */
381
- getOptions(): any;
382
- /**
383
- * Get parse errors only.
384
- */
385
- getParseErrors(): any;
386
- /**
387
- * Find all references to the symbol at the given position.
388
- *
389
- * Returns all occurrences of accounts, currencies, or payees in the document.
390
- * Uses cached data for efficient lookup.
391
- */
392
- getReferences(line: number, character: number): any;
393
- /**
394
- * Get validation errors only.
395
- */
396
- getValidationErrors(): any;
397
- /**
398
- * Check if the ledger is valid (no parse or validation errors).
399
- */
400
- isValid(): boolean;
401
- /**
402
- * Create a new `ParsedLedger` from source text.
403
- *
404
- * Parses, interpolates, and validates the source. Call `isValid()` to check for errors.
405
- */
406
- constructor(source: string);
407
- /**
408
- * Run a BQL query on this ledger.
409
- */
410
- query(query_str: string): any;
411
- /**
412
- * Run a native plugin on this ledger.
413
- */
414
- runPlugin(plugin_name: string): any;
415
- }
335
+ export function validateMultiFile(files: FileMap, entryPoint: string): ValidationResult;
336
+
337
+ /**
338
+ * Run a BQL query on multiple Beancount files.
339
+ *
340
+ * @param files - Object mapping file paths to their contents
341
+ * @param entryPoint - The main file to start loading from (must exist in files)
342
+ * @param query - The BQL query string to execute
343
+ * @returns QueryResult with columns, rows, and any errors
344
+ */
345
+ export function queryMultiFile(files: FileMap, entryPoint: string, query: string): QueryResult;
346
+
347
+
416
348
 
417
349
  /**
418
350
  * Calculate account balances.
@@ -465,6 +397,42 @@ export function listPlugins(): any;
465
397
  */
466
398
  export function parse(source: string): any;
467
399
 
400
+ /**
401
+ * Parse multiple Beancount files with include resolution.
402
+ *
403
+ * This function accepts a map of file paths to file contents and an entry point,
404
+ * resolving `include` directives across the files. This enables multi-file ledgers
405
+ * in WASM environments where filesystem access is not available.
406
+ *
407
+ * # Arguments
408
+ *
409
+ * * `files` - A JavaScript object mapping file paths to their contents.
410
+ * Example: `{ "main.beancount": "include \"accounts.beancount\"", "accounts.beancount": "..." }`
411
+ * * `entry_point` - The main file to start loading from (must exist in `files`).
412
+ *
413
+ * # Returns
414
+ *
415
+ * A `ParseResult` with the parsed ledger from all files and any errors.
416
+ *
417
+ * # Example (JavaScript)
418
+ *
419
+ * ```javascript
420
+ * const result = parseMultiFile({
421
+ * "main.beancount": `
422
+ * include "accounts.beancount"
423
+ * 2024-01-15 * "Coffee"
424
+ * Expenses:Food 5.00 USD
425
+ * Assets:Bank
426
+ * `,
427
+ * "accounts.beancount": `
428
+ * 2024-01-01 open Assets:Bank USD
429
+ * 2024-01-01 open Expenses:Food USD
430
+ * `
431
+ * }, "main.beancount");
432
+ * ```
433
+ */
434
+ export function parseMultiFile(files: any, entry_point: string): any;
435
+
468
436
  /**
469
437
  * Run a BQL query on a Beancount source string.
470
438
  *
@@ -473,6 +441,16 @@ export function parse(source: string): any;
473
441
  */
474
442
  export function query(source: string, query_str: string): any;
475
443
 
444
+ /**
445
+ * Run a BQL query on multiple Beancount files.
446
+ *
447
+ * Similar to `query`, but accepts multiple files with include resolution.
448
+ *
449
+ * Note: Glob patterns in `include` directives are not supported in multi-file mode
450
+ * since there is no real filesystem to enumerate. Use explicit file paths instead.
451
+ */
452
+ export function queryMultiFile(files: any, entry_point: string, query_str: string): any;
453
+
476
454
  /**
477
455
  * Run a native plugin on the source.
478
456
  *
@@ -480,6 +458,14 @@ export function query(source: string, query_str: string): any;
480
458
  */
481
459
  export function runPlugin(source: string, plugin_name: string): any;
482
460
 
461
+ /**
462
+ * Validate multiple Beancount files with include resolution.
463
+ *
464
+ * Similar to `parseMultiFile`, but also runs validation.
465
+ * Returns a `ValidationResult` indicating whether the ledger is valid.
466
+ */
467
+ export function validateMultiFile(files: any, entry_point: string): any;
468
+
483
469
  /**
484
470
  * Validate a Beancount source string.
485
471
  *
@@ -506,6 +492,7 @@ export interface InitOutput {
506
492
  readonly format: (a: number, b: number, c: number) => void;
507
493
  readonly listPlugins: (a: number) => void;
508
494
  readonly parse: (a: number, b: number, c: number) => void;
495
+ readonly parseMultiFile: (a: number, b: number, c: number, d: number) => void;
509
496
  readonly parsedledger_balances: (a: number, b: number) => void;
510
497
  readonly parsedledger_directiveCount: (a: number) => number;
511
498
  readonly parsedledger_expandPads: (a: number, b: number) => void;
@@ -525,13 +512,16 @@ export interface InitOutput {
525
512
  readonly parsedledger_query: (a: number, b: number, c: number, d: number) => void;
526
513
  readonly parsedledger_runPlugin: (a: number, b: number, c: number, d: number) => void;
527
514
  readonly query: (a: number, b: number, c: number, d: number, e: number) => void;
515
+ readonly queryMultiFile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
528
516
  readonly runPlugin: (a: number, b: number, c: number, d: number, e: number) => void;
517
+ readonly validateMultiFile: (a: number, b: number, c: number, d: number) => void;
529
518
  readonly validateSource: (a: number, b: number, c: number) => void;
530
519
  readonly version: (a: number) => void;
531
520
  readonly init: () => void;
532
521
  readonly __wbindgen_export: (a: number, b: number) => number;
533
522
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
534
- readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
523
+ readonly __wbindgen_export3: (a: number) => void;
524
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
535
525
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
536
526
  readonly __wbindgen_start: () => void;
537
527
  }
@@ -532,6 +532,61 @@ export function parse(source) {
532
532
  }
533
533
  }
534
534
 
535
+ /**
536
+ * Parse multiple Beancount files with include resolution.
537
+ *
538
+ * This function accepts a map of file paths to file contents and an entry point,
539
+ * resolving `include` directives across the files. This enables multi-file ledgers
540
+ * in WASM environments where filesystem access is not available.
541
+ *
542
+ * # Arguments
543
+ *
544
+ * * `files` - A JavaScript object mapping file paths to their contents.
545
+ * Example: `{ "main.beancount": "include \"accounts.beancount\"", "accounts.beancount": "..." }`
546
+ * * `entry_point` - The main file to start loading from (must exist in `files`).
547
+ *
548
+ * # Returns
549
+ *
550
+ * A `ParseResult` with the parsed ledger from all files and any errors.
551
+ *
552
+ * # Example (JavaScript)
553
+ *
554
+ * ```javascript
555
+ * const result = parseMultiFile({
556
+ * "main.beancount": `
557
+ * include "accounts.beancount"
558
+ * 2024-01-15 * "Coffee"
559
+ * Expenses:Food 5.00 USD
560
+ * Assets:Bank
561
+ * `,
562
+ * "accounts.beancount": `
563
+ * 2024-01-01 open Assets:Bank USD
564
+ * 2024-01-01 open Expenses:Food USD
565
+ * `
566
+ * }, "main.beancount");
567
+ * ```
568
+ * @param {any} files
569
+ * @param {string} entry_point
570
+ * @returns {any}
571
+ */
572
+ export function parseMultiFile(files, entry_point) {
573
+ try {
574
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
575
+ const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export, wasm.__wbindgen_export2);
576
+ const len0 = WASM_VECTOR_LEN;
577
+ wasm.parseMultiFile(retptr, addHeapObject(files), ptr0, len0);
578
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
579
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
580
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
581
+ if (r2) {
582
+ throw takeObject(r1);
583
+ }
584
+ return takeObject(r0);
585
+ } finally {
586
+ wasm.__wbindgen_add_to_stack_pointer(16);
587
+ }
588
+ }
589
+
535
590
  /**
536
591
  * Run a BQL query on a Beancount source string.
537
592
  *
@@ -561,6 +616,38 @@ export function query(source, query_str) {
561
616
  }
562
617
  }
563
618
 
619
+ /**
620
+ * Run a BQL query on multiple Beancount files.
621
+ *
622
+ * Similar to `query`, but accepts multiple files with include resolution.
623
+ *
624
+ * Note: Glob patterns in `include` directives are not supported in multi-file mode
625
+ * since there is no real filesystem to enumerate. Use explicit file paths instead.
626
+ * @param {any} files
627
+ * @param {string} entry_point
628
+ * @param {string} query_str
629
+ * @returns {any}
630
+ */
631
+ export function queryMultiFile(files, entry_point, query_str) {
632
+ try {
633
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
634
+ const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export, wasm.__wbindgen_export2);
635
+ const len0 = WASM_VECTOR_LEN;
636
+ const ptr1 = passStringToWasm0(query_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
637
+ const len1 = WASM_VECTOR_LEN;
638
+ wasm.queryMultiFile(retptr, addHeapObject(files), ptr0, len0, ptr1, len1);
639
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
640
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
641
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
642
+ if (r2) {
643
+ throw takeObject(r1);
644
+ }
645
+ return takeObject(r0);
646
+ } finally {
647
+ wasm.__wbindgen_add_to_stack_pointer(16);
648
+ }
649
+ }
650
+
564
651
  /**
565
652
  * Run a native plugin on the source.
566
653
  *
@@ -589,6 +676,33 @@ export function runPlugin(source, plugin_name) {
589
676
  }
590
677
  }
591
678
 
679
+ /**
680
+ * Validate multiple Beancount files with include resolution.
681
+ *
682
+ * Similar to `parseMultiFile`, but also runs validation.
683
+ * Returns a `ValidationResult` indicating whether the ledger is valid.
684
+ * @param {any} files
685
+ * @param {string} entry_point
686
+ * @returns {any}
687
+ */
688
+ export function validateMultiFile(files, entry_point) {
689
+ try {
690
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
691
+ const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export, wasm.__wbindgen_export2);
692
+ const len0 = WASM_VECTOR_LEN;
693
+ wasm.validateMultiFile(retptr, addHeapObject(files), ptr0, len0);
694
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
695
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
696
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
697
+ if (r2) {
698
+ throw takeObject(r1);
699
+ }
700
+ return takeObject(r0);
701
+ } finally {
702
+ wasm.__wbindgen_add_to_stack_pointer(16);
703
+ }
704
+ }
705
+
592
706
  /**
593
707
  * Validate a Beancount source string.
594
708
  *
@@ -634,14 +748,14 @@ export function version() {
634
748
  return getStringFromWasm0(r0, r1);
635
749
  } finally {
636
750
  wasm.__wbindgen_add_to_stack_pointer(16);
637
- wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
751
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
638
752
  }
639
753
  }
640
754
 
641
755
  function __wbg_get_imports() {
642
756
  const import0 = {
643
757
  __proto__: null,
644
- __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
758
+ __wbg_Error_55538483de6e3abe: function(arg0, arg1) {
645
759
  const ret = Error(getStringFromWasm0(arg0, arg1));
646
760
  return addHeapObject(ret);
647
761
  },
@@ -652,13 +766,64 @@ function __wbg_get_imports() {
652
766
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
653
767
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
654
768
  },
655
- __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
769
+ __wbg___wbindgen_boolean_get_fe2a24fdfdb4064f: function(arg0) {
770
+ const v = getObject(arg0);
771
+ const ret = typeof(v) === 'boolean' ? v : undefined;
772
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
773
+ },
774
+ __wbg___wbindgen_debug_string_d89627202d0155b7: function(arg0, arg1) {
775
+ const ret = debugString(getObject(arg1));
776
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
777
+ const len1 = WASM_VECTOR_LEN;
778
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
779
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
780
+ },
781
+ __wbg___wbindgen_is_function_2a95406423ea8626: function(arg0) {
782
+ const ret = typeof(getObject(arg0)) === 'function';
783
+ return ret;
784
+ },
785
+ __wbg___wbindgen_is_object_59a002e76b059312: function(arg0) {
786
+ const val = getObject(arg0);
787
+ const ret = typeof(val) === 'object' && val !== null;
788
+ return ret;
789
+ },
790
+ __wbg___wbindgen_is_string_624d5244bb2bc87c: function(arg0) {
656
791
  const ret = typeof(getObject(arg0)) === 'string';
657
792
  return ret;
658
793
  },
659
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
794
+ __wbg___wbindgen_jsval_loose_eq_cf851f110c48f9ba: function(arg0, arg1) {
795
+ const ret = getObject(arg0) == getObject(arg1);
796
+ return ret;
797
+ },
798
+ __wbg___wbindgen_number_get_769f3676dc20c1d7: function(arg0, arg1) {
799
+ const obj = getObject(arg1);
800
+ const ret = typeof(obj) === 'number' ? obj : undefined;
801
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
802
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
803
+ },
804
+ __wbg___wbindgen_string_get_f1161390414f9b59: function(arg0, arg1) {
805
+ const obj = getObject(arg1);
806
+ const ret = typeof(obj) === 'string' ? obj : undefined;
807
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
808
+ var len1 = WASM_VECTOR_LEN;
809
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
810
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
811
+ },
812
+ __wbg___wbindgen_throw_5549492daedad139: function(arg0, arg1) {
660
813
  throw new Error(getStringFromWasm0(arg0, arg1));
661
814
  },
815
+ __wbg_call_6ae20895a60069a2: function() { return handleError(function (arg0, arg1) {
816
+ const ret = getObject(arg0).call(getObject(arg1));
817
+ return addHeapObject(ret);
818
+ }, arguments); },
819
+ __wbg_done_19f92cb1f8738aba: function(arg0) {
820
+ const ret = getObject(arg0).done;
821
+ return ret;
822
+ },
823
+ __wbg_entries_28ed7cb892e12eff: function(arg0) {
824
+ const ret = Object.entries(getObject(arg0));
825
+ return addHeapObject(ret);
826
+ },
662
827
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
663
828
  let deferred0_0;
664
829
  let deferred0_1;
@@ -667,48 +832,107 @@ function __wbg_get_imports() {
667
832
  deferred0_1 = arg1;
668
833
  console.error(getStringFromWasm0(arg0, arg1));
669
834
  } finally {
670
- wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
835
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
671
836
  }
672
837
  },
673
- __wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
838
+ __wbg_getTime_c3af35594e283356: function(arg0) {
674
839
  const ret = getObject(arg0).getTime();
675
840
  return ret;
676
841
  },
677
- __wbg_getTimezoneOffset_639bcf2dde21158b: function(arg0) {
842
+ __wbg_getTimezoneOffset_c60f1a836e59b3db: function(arg0) {
678
843
  const ret = getObject(arg0).getTimezoneOffset();
679
844
  return ret;
680
845
  },
681
- __wbg_new_0_1dcafdf5e786e876: function() {
682
- const ret = new Date();
846
+ __wbg_get_94f5fc088edd3138: function(arg0, arg1) {
847
+ const ret = getObject(arg0)[arg1 >>> 0];
683
848
  return addHeapObject(ret);
684
849
  },
685
- __wbg_new_227d7c05414eb861: function() {
686
- const ret = new Error();
850
+ __wbg_get_a50328e7325d7f9b: function() { return handleError(function (arg0, arg1) {
851
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
852
+ return addHeapObject(ret);
853
+ }, arguments); },
854
+ __wbg_get_unchecked_7c6bbabf5b0b1fbf: function(arg0, arg1) {
855
+ const ret = getObject(arg0)[arg1 >>> 0];
687
856
  return addHeapObject(ret);
688
857
  },
689
- __wbg_new_49d5571bd3f0c4d4: function() {
858
+ __wbg_instanceof_ArrayBuffer_8d855993947fc3a2: function(arg0) {
859
+ let result;
860
+ try {
861
+ result = getObject(arg0) instanceof ArrayBuffer;
862
+ } catch (_) {
863
+ result = false;
864
+ }
865
+ const ret = result;
866
+ return ret;
867
+ },
868
+ __wbg_instanceof_Uint8Array_ce24d58a5f4bdcc3: function(arg0) {
869
+ let result;
870
+ try {
871
+ result = getObject(arg0) instanceof Uint8Array;
872
+ } catch (_) {
873
+ result = false;
874
+ }
875
+ const ret = result;
876
+ return ret;
877
+ },
878
+ __wbg_iterator_54661826e186eb6a: function() {
879
+ const ret = Symbol.iterator;
880
+ return addHeapObject(ret);
881
+ },
882
+ __wbg_length_e6e1633fbea6cfa9: function(arg0) {
883
+ const ret = getObject(arg0).length;
884
+ return ret;
885
+ },
886
+ __wbg_length_fae3e439140f48a4: function(arg0) {
887
+ const ret = getObject(arg0).length;
888
+ return ret;
889
+ },
890
+ __wbg_new_0934b88171ef61b0: function() {
690
891
  const ret = new Map();
691
892
  return addHeapObject(ret);
692
893
  },
693
- __wbg_new_a70fbab9066b301f: function() {
894
+ __wbg_new_0_e649c99e7382313f: function() {
895
+ const ret = new Date();
896
+ return addHeapObject(ret);
897
+ },
898
+ __wbg_new_1d96678aaacca32e: function(arg0) {
899
+ const ret = new Uint8Array(getObject(arg0));
900
+ return addHeapObject(ret);
901
+ },
902
+ __wbg_new_227d7c05414eb861: function() {
903
+ const ret = new Error();
904
+ return addHeapObject(ret);
905
+ },
906
+ __wbg_new_4370be21fa2b2f80: function() {
694
907
  const ret = new Array();
695
908
  return addHeapObject(ret);
696
909
  },
697
- __wbg_new_ab79df5bd7c26067: function() {
910
+ __wbg_new_48e1d86cfd30c8e7: function() {
698
911
  const ret = new Object();
699
912
  return addHeapObject(ret);
700
913
  },
701
- __wbg_new_fd94ca5c9639abd2: function(arg0) {
914
+ __wbg_new_d51bf22e953dcfd1: function(arg0) {
702
915
  const ret = new Date(getObject(arg0));
703
916
  return addHeapObject(ret);
704
917
  },
705
- __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
918
+ __wbg_next_55d835fe0ab5b3e7: function(arg0) {
919
+ const ret = getObject(arg0).next;
920
+ return addHeapObject(ret);
921
+ },
922
+ __wbg_next_e34cfb9df1518d7c: function() { return handleError(function (arg0) {
923
+ const ret = getObject(arg0).next();
924
+ return addHeapObject(ret);
925
+ }, arguments); },
926
+ __wbg_prototypesetcall_3875d54d12ef2eec: function(arg0, arg1, arg2) {
927
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
928
+ },
929
+ __wbg_set_4702dfa37c77f492: function(arg0, arg1, arg2) {
706
930
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
707
931
  },
708
932
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
709
933
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
710
934
  },
711
- __wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
935
+ __wbg_set_8c6629931852a4a5: function(arg0, arg1, arg2) {
712
936
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
713
937
  return addHeapObject(ret);
714
938
  },
@@ -719,6 +943,10 @@ function __wbg_get_imports() {
719
943
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
720
944
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
721
945
  },
946
+ __wbg_value_d5b248ce8419bd1b: function(arg0) {
947
+ const ret = getObject(arg0).value;
948
+ return addHeapObject(ret);
949
+ },
722
950
  __wbindgen_cast_0000000000000001: function(arg0) {
723
951
  // Cast intrinsic for `F64 -> Externref`.
724
952
  const ret = arg0;
@@ -761,12 +989,82 @@ function addHeapObject(obj) {
761
989
  return idx;
762
990
  }
763
991
 
992
+ function debugString(val) {
993
+ // primitive types
994
+ const type = typeof val;
995
+ if (type == 'number' || type == 'boolean' || val == null) {
996
+ return `${val}`;
997
+ }
998
+ if (type == 'string') {
999
+ return `"${val}"`;
1000
+ }
1001
+ if (type == 'symbol') {
1002
+ const description = val.description;
1003
+ if (description == null) {
1004
+ return 'Symbol';
1005
+ } else {
1006
+ return `Symbol(${description})`;
1007
+ }
1008
+ }
1009
+ if (type == 'function') {
1010
+ const name = val.name;
1011
+ if (typeof name == 'string' && name.length > 0) {
1012
+ return `Function(${name})`;
1013
+ } else {
1014
+ return 'Function';
1015
+ }
1016
+ }
1017
+ // objects
1018
+ if (Array.isArray(val)) {
1019
+ const length = val.length;
1020
+ let debug = '[';
1021
+ if (length > 0) {
1022
+ debug += debugString(val[0]);
1023
+ }
1024
+ for(let i = 1; i < length; i++) {
1025
+ debug += ', ' + debugString(val[i]);
1026
+ }
1027
+ debug += ']';
1028
+ return debug;
1029
+ }
1030
+ // Test for built-in
1031
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1032
+ let className;
1033
+ if (builtInMatches && builtInMatches.length > 1) {
1034
+ className = builtInMatches[1];
1035
+ } else {
1036
+ // Failed to match the standard '[object ClassName]'
1037
+ return toString.call(val);
1038
+ }
1039
+ if (className == 'Object') {
1040
+ // we're a user defined class or Object
1041
+ // JSON.stringify avoids problems with cycles, and is generally much
1042
+ // easier than looping through ownProperties of `val`.
1043
+ try {
1044
+ return 'Object(' + JSON.stringify(val) + ')';
1045
+ } catch (_) {
1046
+ return 'Object';
1047
+ }
1048
+ }
1049
+ // errors
1050
+ if (val instanceof Error) {
1051
+ return `${val.name}: ${val.message}\n${val.stack}`;
1052
+ }
1053
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1054
+ return className;
1055
+ }
1056
+
764
1057
  function dropObject(idx) {
765
1058
  if (idx < 1028) return;
766
1059
  heap[idx] = heap_next;
767
1060
  heap_next = idx;
768
1061
  }
769
1062
 
1063
+ function getArrayU8FromWasm0(ptr, len) {
1064
+ ptr = ptr >>> 0;
1065
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1066
+ }
1067
+
770
1068
  let cachedDataViewMemory0 = null;
771
1069
  function getDataViewMemory0() {
772
1070
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -790,11 +1088,23 @@ function getUint8ArrayMemory0() {
790
1088
 
791
1089
  function getObject(idx) { return heap[idx]; }
792
1090
 
1091
+ function handleError(f, args) {
1092
+ try {
1093
+ return f.apply(this, args);
1094
+ } catch (e) {
1095
+ wasm.__wbindgen_export3(addHeapObject(e));
1096
+ }
1097
+ }
1098
+
793
1099
  let heap = new Array(1024).fill(undefined);
794
1100
  heap.push(undefined, null, true, false);
795
1101
 
796
1102
  let heap_next = heap.length;
797
1103
 
1104
+ function isLikeNone(x) {
1105
+ return x === undefined || x === null;
1106
+ }
1107
+
798
1108
  function passStringToWasm0(arg, malloc, realloc) {
799
1109
  if (realloc === undefined) {
800
1110
  const buf = cachedTextEncoder.encode(arg);
Binary file