@diaryx/wasm-node 1.4.1-dev.adede70 → 1.4.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/diaryx_wasm.d.ts +7 -0
- package/diaryx_wasm.js +227 -2
- package/diaryx_wasm_bg.wasm +0 -0
- package/diaryx_wasm_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
package/diaryx_wasm.d.ts
CHANGED
|
@@ -164,6 +164,12 @@ export class DiaryxBackend {
|
|
|
164
164
|
* ```
|
|
165
165
|
*/
|
|
166
166
|
execute(command_json: string): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Execute a command from a JavaScript object directly.
|
|
169
|
+
*
|
|
170
|
+
* This avoids JSON serialization overhead for better performance.
|
|
171
|
+
*/
|
|
172
|
+
executeJs(command: any): Promise<any>;
|
|
167
173
|
/**
|
|
168
174
|
* Check if this backend has native sync support.
|
|
169
175
|
* Always false — sync is handled by the Extism sync plugin loaded at runtime.
|
|
@@ -288,6 +294,7 @@ export interface InitOutput {
|
|
|
288
294
|
readonly diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
289
295
|
readonly diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
290
296
|
readonly diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
297
|
+
readonly diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
291
298
|
readonly diaryxbackend_hasNativeSync: (a: number) => number;
|
|
292
299
|
readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
293
300
|
readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
package/diaryx_wasm.js
CHANGED
|
@@ -126,6 +126,17 @@ export class DiaryxBackend {
|
|
|
126
126
|
const ret = wasm.diaryxbackend_execute(this.__wbg_ptr, ptr0, len0);
|
|
127
127
|
return ret;
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Execute a command from a JavaScript object directly.
|
|
131
|
+
*
|
|
132
|
+
* This avoids JSON serialization overhead for better performance.
|
|
133
|
+
* @param {any} command
|
|
134
|
+
* @returns {Promise<any>}
|
|
135
|
+
*/
|
|
136
|
+
executeJs(command) {
|
|
137
|
+
const ret = wasm.diaryxbackend_executeJs(this.__wbg_ptr, command);
|
|
138
|
+
return ret;
|
|
139
|
+
}
|
|
129
140
|
/**
|
|
130
141
|
* Check if this backend has native sync support.
|
|
131
142
|
* Always false — sync is handled by the Extism sync plugin loaded at runtime.
|
|
@@ -329,19 +340,72 @@ export function today_formatted(format) {
|
|
|
329
340
|
function __wbg_get_imports() {
|
|
330
341
|
const import0 = {
|
|
331
342
|
__proto__: null,
|
|
343
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
344
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
345
|
+
return ret;
|
|
346
|
+
},
|
|
347
|
+
__wbg_Number_a5a435bd7bbec835: function(arg0) {
|
|
348
|
+
const ret = Number(arg0);
|
|
349
|
+
return ret;
|
|
350
|
+
},
|
|
351
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
352
|
+
const ret = String(arg1);
|
|
353
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
354
|
+
const len1 = WASM_VECTOR_LEN;
|
|
355
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
356
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
357
|
+
},
|
|
358
|
+
__wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
|
|
359
|
+
const v = arg1;
|
|
360
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
361
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
362
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
363
|
+
},
|
|
332
364
|
__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
|
|
333
365
|
const v = arg0;
|
|
334
366
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
335
367
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
336
368
|
},
|
|
369
|
+
__wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
|
|
370
|
+
const ret = debugString(arg1);
|
|
371
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
372
|
+
const len1 = WASM_VECTOR_LEN;
|
|
373
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
374
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
375
|
+
},
|
|
376
|
+
__wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
|
|
377
|
+
const ret = arg0 in arg1;
|
|
378
|
+
return ret;
|
|
379
|
+
},
|
|
380
|
+
__wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
|
|
381
|
+
const ret = typeof(arg0) === 'bigint';
|
|
382
|
+
return ret;
|
|
383
|
+
},
|
|
337
384
|
__wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
|
|
338
385
|
const ret = typeof(arg0) === 'function';
|
|
339
386
|
return ret;
|
|
340
387
|
},
|
|
388
|
+
__wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
|
|
389
|
+
const val = arg0;
|
|
390
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
391
|
+
return ret;
|
|
392
|
+
},
|
|
393
|
+
__wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
|
|
394
|
+
const ret = typeof(arg0) === 'string';
|
|
395
|
+
return ret;
|
|
396
|
+
},
|
|
341
397
|
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
342
398
|
const ret = arg0 === undefined;
|
|
343
399
|
return ret;
|
|
344
400
|
},
|
|
401
|
+
__wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
|
|
402
|
+
const ret = arg0 === arg1;
|
|
403
|
+
return ret;
|
|
404
|
+
},
|
|
405
|
+
__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
|
|
406
|
+
const ret = arg0 == arg1;
|
|
407
|
+
return ret;
|
|
408
|
+
},
|
|
345
409
|
__wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
|
|
346
410
|
const obj = arg1;
|
|
347
411
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -389,9 +453,21 @@ function __wbg_get_imports() {
|
|
|
389
453
|
const ret = DiaryxBackend.__wrap(arg0);
|
|
390
454
|
return ret;
|
|
391
455
|
},
|
|
456
|
+
__wbg_done_08ce71ee07e3bd17: function(arg0) {
|
|
457
|
+
const ret = arg0.done;
|
|
458
|
+
return ret;
|
|
459
|
+
},
|
|
460
|
+
__wbg_entries_e8a20ff8c9757101: function(arg0) {
|
|
461
|
+
const ret = Object.entries(arg0);
|
|
462
|
+
return ret;
|
|
463
|
+
},
|
|
392
464
|
__wbg_error_1eece6b0039034ce: function(arg0, arg1, arg2, arg3) {
|
|
393
465
|
console.error(arg0, arg1, arg2, arg3);
|
|
394
466
|
},
|
|
467
|
+
__wbg_fromCodePoint_4a02c6dcced1d233: function() { return handleError(function (arg0) {
|
|
468
|
+
const ret = String.fromCodePoint(arg0 >>> 0);
|
|
469
|
+
return ret;
|
|
470
|
+
}, arguments); },
|
|
395
471
|
__wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
|
|
396
472
|
const ret = arg0.getTime();
|
|
397
473
|
return ret;
|
|
@@ -400,6 +476,10 @@ function __wbg_get_imports() {
|
|
|
400
476
|
const ret = arg0.getTimezoneOffset();
|
|
401
477
|
return ret;
|
|
402
478
|
},
|
|
479
|
+
__wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
|
|
480
|
+
const ret = Reflect.get(arg0, arg1);
|
|
481
|
+
return ret;
|
|
482
|
+
}, arguments); },
|
|
403
483
|
__wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
|
|
404
484
|
const ret = Reflect.get(arg0, arg1);
|
|
405
485
|
return ret;
|
|
@@ -408,9 +488,37 @@ function __wbg_get_imports() {
|
|
|
408
488
|
const ret = arg0[arg1 >>> 0];
|
|
409
489
|
return ret;
|
|
410
490
|
},
|
|
491
|
+
__wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
|
|
492
|
+
const ret = arg0[arg1 >>> 0];
|
|
493
|
+
return ret;
|
|
494
|
+
},
|
|
495
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
496
|
+
const ret = arg0[arg1];
|
|
497
|
+
return ret;
|
|
498
|
+
},
|
|
411
499
|
__wbg_info_0194681687b5ab04: function(arg0, arg1, arg2, arg3) {
|
|
412
500
|
console.info(arg0, arg1, arg2, arg3);
|
|
413
501
|
},
|
|
502
|
+
__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
|
|
503
|
+
let result;
|
|
504
|
+
try {
|
|
505
|
+
result = arg0 instanceof ArrayBuffer;
|
|
506
|
+
} catch (_) {
|
|
507
|
+
result = false;
|
|
508
|
+
}
|
|
509
|
+
const ret = result;
|
|
510
|
+
return ret;
|
|
511
|
+
},
|
|
512
|
+
__wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
|
|
513
|
+
let result;
|
|
514
|
+
try {
|
|
515
|
+
result = arg0 instanceof Map;
|
|
516
|
+
} catch (_) {
|
|
517
|
+
result = false;
|
|
518
|
+
}
|
|
519
|
+
const ret = result;
|
|
520
|
+
return ret;
|
|
521
|
+
},
|
|
414
522
|
__wbg_instanceof_Object_be1962063fcc0c9f: function(arg0) {
|
|
415
523
|
let result;
|
|
416
524
|
try {
|
|
@@ -445,6 +553,14 @@ function __wbg_get_imports() {
|
|
|
445
553
|
const ret = Array.isArray(arg0);
|
|
446
554
|
return ret;
|
|
447
555
|
},
|
|
556
|
+
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
557
|
+
const ret = Number.isSafeInteger(arg0);
|
|
558
|
+
return ret;
|
|
559
|
+
},
|
|
560
|
+
__wbg_iterator_d8f549ec8fb061b1: function() {
|
|
561
|
+
const ret = Symbol.iterator;
|
|
562
|
+
return ret;
|
|
563
|
+
},
|
|
448
564
|
__wbg_length_b3416cf66a5452c8: function(arg0) {
|
|
449
565
|
const ret = arg0.length;
|
|
450
566
|
return ret;
|
|
@@ -460,10 +576,22 @@ function __wbg_get_imports() {
|
|
|
460
576
|
const ret = new Date();
|
|
461
577
|
return ret;
|
|
462
578
|
},
|
|
579
|
+
__wbg_new_49d5571bd3f0c4d4: function() {
|
|
580
|
+
const ret = new Map();
|
|
581
|
+
return ret;
|
|
582
|
+
},
|
|
583
|
+
__wbg_new_5f486cdf45a04d78: function(arg0) {
|
|
584
|
+
const ret = new Uint8Array(arg0);
|
|
585
|
+
return ret;
|
|
586
|
+
},
|
|
463
587
|
__wbg_new_a70fbab9066b301f: function() {
|
|
464
588
|
const ret = new Array();
|
|
465
589
|
return ret;
|
|
466
590
|
},
|
|
591
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
592
|
+
const ret = new Object();
|
|
593
|
+
return ret;
|
|
594
|
+
},
|
|
467
595
|
__wbg_new_fd94ca5c9639abd2: function(arg0) {
|
|
468
596
|
const ret = new Date(arg0);
|
|
469
597
|
return ret;
|
|
@@ -494,6 +622,14 @@ function __wbg_get_imports() {
|
|
|
494
622
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
495
623
|
return ret;
|
|
496
624
|
},
|
|
625
|
+
__wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
|
|
626
|
+
const ret = arg0.next();
|
|
627
|
+
return ret;
|
|
628
|
+
}, arguments); },
|
|
629
|
+
__wbg_next_e01a967809d1aa68: function(arg0) {
|
|
630
|
+
const ret = arg0.next;
|
|
631
|
+
return ret;
|
|
632
|
+
},
|
|
497
633
|
__wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
|
|
498
634
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
499
635
|
},
|
|
@@ -512,9 +648,19 @@ function __wbg_get_imports() {
|
|
|
512
648
|
const ret = Promise.resolve(arg0);
|
|
513
649
|
return ret;
|
|
514
650
|
},
|
|
651
|
+
__wbg_set_282384002438957f: function(arg0, arg1, arg2) {
|
|
652
|
+
arg0[arg1 >>> 0] = arg2;
|
|
653
|
+
},
|
|
654
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
655
|
+
arg0[arg1] = arg2;
|
|
656
|
+
},
|
|
515
657
|
__wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
|
|
516
658
|
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
517
659
|
},
|
|
660
|
+
__wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
|
|
661
|
+
const ret = arg0.set(arg1, arg2);
|
|
662
|
+
return ret;
|
|
663
|
+
},
|
|
518
664
|
__wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
|
|
519
665
|
const ret = typeof global === 'undefined' ? null : global;
|
|
520
666
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
@@ -543,11 +689,15 @@ function __wbg_get_imports() {
|
|
|
543
689
|
const ret = arg0.toString();
|
|
544
690
|
return ret;
|
|
545
691
|
},
|
|
692
|
+
__wbg_value_21fc78aab0322612: function(arg0) {
|
|
693
|
+
const ret = arg0.value;
|
|
694
|
+
return ret;
|
|
695
|
+
},
|
|
546
696
|
__wbg_warn_809cad1bfc2b3a42: function(arg0, arg1, arg2, arg3) {
|
|
547
697
|
console.warn(arg0, arg1, arg2, arg3);
|
|
548
698
|
},
|
|
549
699
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
550
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
700
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 439, function: Function { arguments: [Externref], shim_idx: 440, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
551
701
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hc0ecfed3f77ea255, wasm_bindgen__convert__closures_____invoke__h2b2515b80a4dcf5e);
|
|
552
702
|
return ret;
|
|
553
703
|
},
|
|
@@ -556,11 +706,21 @@ function __wbg_get_imports() {
|
|
|
556
706
|
const ret = arg0;
|
|
557
707
|
return ret;
|
|
558
708
|
},
|
|
559
|
-
__wbindgen_cast_0000000000000003: function(arg0
|
|
709
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
710
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
711
|
+
const ret = arg0;
|
|
712
|
+
return ret;
|
|
713
|
+
},
|
|
714
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
560
715
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
561
716
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
562
717
|
return ret;
|
|
563
718
|
},
|
|
719
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
720
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
721
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
722
|
+
return ret;
|
|
723
|
+
},
|
|
564
724
|
__wbindgen_init_externref_table: function() {
|
|
565
725
|
const table = wasm.__wbindgen_externrefs;
|
|
566
726
|
const offset = table.grow(4);
|
|
@@ -605,6 +765,71 @@ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
|
605
765
|
? { register: () => {}, unregister: () => {} }
|
|
606
766
|
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
607
767
|
|
|
768
|
+
function debugString(val) {
|
|
769
|
+
// primitive types
|
|
770
|
+
const type = typeof val;
|
|
771
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
772
|
+
return `${val}`;
|
|
773
|
+
}
|
|
774
|
+
if (type == 'string') {
|
|
775
|
+
return `"${val}"`;
|
|
776
|
+
}
|
|
777
|
+
if (type == 'symbol') {
|
|
778
|
+
const description = val.description;
|
|
779
|
+
if (description == null) {
|
|
780
|
+
return 'Symbol';
|
|
781
|
+
} else {
|
|
782
|
+
return `Symbol(${description})`;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (type == 'function') {
|
|
786
|
+
const name = val.name;
|
|
787
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
788
|
+
return `Function(${name})`;
|
|
789
|
+
} else {
|
|
790
|
+
return 'Function';
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
// objects
|
|
794
|
+
if (Array.isArray(val)) {
|
|
795
|
+
const length = val.length;
|
|
796
|
+
let debug = '[';
|
|
797
|
+
if (length > 0) {
|
|
798
|
+
debug += debugString(val[0]);
|
|
799
|
+
}
|
|
800
|
+
for(let i = 1; i < length; i++) {
|
|
801
|
+
debug += ', ' + debugString(val[i]);
|
|
802
|
+
}
|
|
803
|
+
debug += ']';
|
|
804
|
+
return debug;
|
|
805
|
+
}
|
|
806
|
+
// Test for built-in
|
|
807
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
808
|
+
let className;
|
|
809
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
810
|
+
className = builtInMatches[1];
|
|
811
|
+
} else {
|
|
812
|
+
// Failed to match the standard '[object ClassName]'
|
|
813
|
+
return toString.call(val);
|
|
814
|
+
}
|
|
815
|
+
if (className == 'Object') {
|
|
816
|
+
// we're a user defined class or Object
|
|
817
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
818
|
+
// easier than looping through ownProperties of `val`.
|
|
819
|
+
try {
|
|
820
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
821
|
+
} catch (_) {
|
|
822
|
+
return 'Object';
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
// errors
|
|
826
|
+
if (val instanceof Error) {
|
|
827
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
828
|
+
}
|
|
829
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
830
|
+
return className;
|
|
831
|
+
}
|
|
832
|
+
|
|
608
833
|
function getArrayU8FromWasm0(ptr, len) {
|
|
609
834
|
ptr = ptr >>> 0;
|
|
610
835
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
package/diaryx_wasm_bg.wasm
CHANGED
|
Binary file
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const diaryxbackend_createInMemory: () => [number, number, number];
|
|
|
9
9
|
export const diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
10
10
|
export const diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
11
11
|
export const diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
12
|
+
export const diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
12
13
|
export const diaryxbackend_hasNativeSync: (a: number) => number;
|
|
13
14
|
export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
14
15
|
export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
package/package.json
CHANGED