@diaryx/wasm 0.14.1-dev.edddcd2 → 1.0.1-dev.241bbf9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -23
- package/diaryx_wasm.d.ts +17 -9
- package/diaryx_wasm.js +24 -10
- package/diaryx_wasm_bg.wasm.d.ts +10 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,16 +5,15 @@ part_of: '[README](/crates/README.md)'
|
|
|
5
5
|
audience:
|
|
6
6
|
- developers
|
|
7
7
|
contents:
|
|
8
|
-
|
|
8
|
+
- '[README](/crates/diaryx_wasm/src/README.md)'
|
|
9
9
|
attachments:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- '[Cargo.toml](/crates/diaryx_wasm/Cargo.toml)'
|
|
11
|
+
- '[build.rs](/crates/diaryx_wasm/build.rs)'
|
|
12
12
|
exclude:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- '*.lock'
|
|
14
|
+
- '*.db'
|
|
15
|
+
- pkg/**
|
|
16
16
|
---
|
|
17
|
-
|
|
18
17
|
# diaryx_wasm
|
|
19
18
|
|
|
20
19
|
WebAssembly bindings for `diaryx_core`, used by the web frontend in `apps/web`.
|
|
@@ -50,19 +49,21 @@ Current filesystem test suites live in:
|
|
|
50
49
|
|
|
51
50
|
The crate provides typed class-based APIs that wrap `diaryx_core` functionality:
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
52
|
+
|
|
53
|
+
| Class | Purpose |
|
|
54
|
+
| ----------------------- | ----------------------------------------- |
|
|
55
|
+
| `DiaryxWorkspace` | Workspace tree operations |
|
|
56
|
+
| `DiaryxEntry` | Entry CRUD operations |
|
|
57
|
+
| `DiaryxFrontmatter` | Frontmatter manipulation |
|
|
58
|
+
| `DiaryxSearch` | Workspace search |
|
|
59
|
+
| `DiaryxTemplate` | Template management |
|
|
60
|
+
| `DiaryxValidation` | Link integrity validation and fixing |
|
|
61
|
+
| `DiaryxExport` | Export with audience filtering |
|
|
62
|
+
| `DiaryxAttachment` | Attachment upload/download |
|
|
63
|
+
| `DiaryxFilesystem` | Low-level filesystem operations (sync) |
|
|
64
|
+
| `DiaryxAsyncFilesystem` | Async filesystem operations with Promises |
|
|
65
|
+
| `Diaryx` | Unified command API (includes CRDT ops) |
|
|
66
|
+
|
|
66
67
|
|
|
67
68
|
### In-Memory Filesystem
|
|
68
69
|
|
|
@@ -352,11 +353,13 @@ await diaryx.executeJs({
|
|
|
352
353
|
|
|
353
354
|
CRDT operations use `doc_type` to specify which document to operate on:
|
|
354
355
|
|
|
355
|
-
|
|
356
|
-
|
|
|
357
|
-
|
|
|
356
|
+
|
|
357
|
+
| doc_type | doc_name | Description |
|
|
358
|
+
| ----------- | --------- | ------------------------------------------ |
|
|
359
|
+
| `workspace` | `null` | The workspace file hierarchy metadata |
|
|
358
360
|
| `body` | file path | Per-file body content (e.g., `notes/a.md`) |
|
|
359
361
|
|
|
362
|
+
|
|
360
363
|
## Error Handling
|
|
361
364
|
|
|
362
365
|
All methods return `Result<T, JsValue>` for JavaScript interop. Errors are converted to JavaScript exceptions with descriptive messages.
|
package/diaryx_wasm.d.ts
CHANGED
|
@@ -547,6 +547,13 @@ export class WasmSyncClient {
|
|
|
547
547
|
* Call this before connecting to join a share session.
|
|
548
548
|
*/
|
|
549
549
|
setSessionCode(code: string): void;
|
|
550
|
+
/**
|
|
551
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
552
|
+
*
|
|
553
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
554
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
555
|
+
*/
|
|
556
|
+
syncBodyFiles(file_paths: string[]): Promise<any>;
|
|
550
557
|
/**
|
|
551
558
|
* Send an unfocus message for specific files.
|
|
552
559
|
*/
|
|
@@ -576,8 +583,6 @@ export interface InitOutput {
|
|
|
576
583
|
readonly __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
577
584
|
readonly jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
578
585
|
readonly jsasyncfilesystem_new: (a: any) => number;
|
|
579
|
-
readonly now_timestamp: () => [number, number];
|
|
580
|
-
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
581
586
|
readonly wasmsyncclient_focusFiles: (a: number, b: number, c: number) => void;
|
|
582
587
|
readonly wasmsyncclient_getServerUrl: (a: number) => [number, number];
|
|
583
588
|
readonly wasmsyncclient_getWorkspaceId: (a: number) => [number, number];
|
|
@@ -594,8 +599,8 @@ export interface InitOutput {
|
|
|
594
599
|
readonly wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
595
600
|
readonly wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
596
601
|
readonly wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
602
|
+
readonly wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
597
603
|
readonly wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
598
|
-
readonly init: () => void;
|
|
599
604
|
readonly __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
600
605
|
readonly diaryxbackend_create: (a: number, b: number) => any;
|
|
601
606
|
readonly diaryxbackend_createFromDirectoryHandle: (a: any) => [number, number, number];
|
|
@@ -616,20 +621,23 @@ export interface InitOutput {
|
|
|
616
621
|
readonly diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
617
622
|
readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
618
623
|
readonly diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
619
|
-
readonly
|
|
620
|
-
readonly opfsfilesystem_create: () => any;
|
|
621
|
-
readonly opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
624
|
+
readonly init: () => void;
|
|
622
625
|
readonly __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
623
626
|
readonly __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
624
627
|
readonly fsafilesystem_fromHandle: (a: any) => number;
|
|
625
628
|
readonly indexeddbfilesystem_create: () => any;
|
|
626
629
|
readonly indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
627
|
-
readonly
|
|
630
|
+
readonly now_timestamp: () => [number, number];
|
|
631
|
+
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
632
|
+
readonly __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
633
|
+
readonly opfsfilesystem_create: () => any;
|
|
634
|
+
readonly opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
635
|
+
readonly wasm_bindgen__closure__destroy__h9e9f624a5c8a6473: (a: number, b: number) => void;
|
|
628
636
|
readonly wasm_bindgen__closure__destroy__h54a6b627d1123dca: (a: number, b: number) => void;
|
|
629
637
|
readonly wasm_bindgen__closure__destroy__h440f08373ff30a05: (a: number, b: number) => void;
|
|
630
|
-
readonly
|
|
638
|
+
readonly wasm_bindgen__convert__closures_____invoke__h087382e1a24f6ffe: (a: number, b: number, c: any) => [number, number];
|
|
631
639
|
readonly wasm_bindgen__convert__closures_____invoke__h4e796b59e8c15a06: (a: number, b: number, c: any, d: any) => void;
|
|
632
|
-
readonly
|
|
640
|
+
readonly wasm_bindgen__convert__closures_____invoke__h7219f39dd5b80c81: (a: number, b: number, c: any) => void;
|
|
633
641
|
readonly wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3: (a: number, b: number, c: any) => void;
|
|
634
642
|
readonly wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746: (a: number, b: number, c: any) => void;
|
|
635
643
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
package/diaryx_wasm.js
CHANGED
|
@@ -807,6 +807,20 @@ export class WasmSyncClient {
|
|
|
807
807
|
const len0 = WASM_VECTOR_LEN;
|
|
808
808
|
wasm.wasmsyncclient_setSessionCode(this.__wbg_ptr, ptr0, len0);
|
|
809
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
812
|
+
*
|
|
813
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
814
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
815
|
+
* @param {string[]} file_paths
|
|
816
|
+
* @returns {Promise<any>}
|
|
817
|
+
*/
|
|
818
|
+
syncBodyFiles(file_paths) {
|
|
819
|
+
const ptr0 = passArrayJsValueToWasm0(file_paths, wasm.__wbindgen_malloc);
|
|
820
|
+
const len0 = WASM_VECTOR_LEN;
|
|
821
|
+
const ret = wasm.wasmsyncclient_syncBodyFiles(this.__wbg_ptr, ptr0, len0);
|
|
822
|
+
return ret;
|
|
823
|
+
}
|
|
810
824
|
/**
|
|
811
825
|
* Send an unfocus message for specific files.
|
|
812
826
|
* @param {string[]} files
|
|
@@ -1538,22 +1552,22 @@ function __wbg_get_imports() {
|
|
|
1538
1552
|
return ret;
|
|
1539
1553
|
}, arguments); },
|
|
1540
1554
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1541
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1542
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1555
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 612, function: Function { arguments: [NamedExternref("Event")], shim_idx: 614, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1556
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9e9f624a5c8a6473, wasm_bindgen__convert__closures_____invoke__h087382e1a24f6ffe);
|
|
1543
1557
|
return ret;
|
|
1544
1558
|
},
|
|
1545
1559
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1546
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1547
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1560
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 612, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 613, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1561
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9e9f624a5c8a6473, wasm_bindgen__convert__closures_____invoke__h7219f39dd5b80c81);
|
|
1548
1562
|
return ret;
|
|
1549
1563
|
},
|
|
1550
1564
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1551
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1565
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 796, function: Function { arguments: [NamedExternref("Event")], shim_idx: 797, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1552
1566
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h54a6b627d1123dca, wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3);
|
|
1553
1567
|
return ret;
|
|
1554
1568
|
},
|
|
1555
1569
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1556
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1570
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 822, function: Function { arguments: [Externref], shim_idx: 823, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1557
1571
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h440f08373ff30a05, wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746);
|
|
1558
1572
|
return ret;
|
|
1559
1573
|
},
|
|
@@ -1598,8 +1612,8 @@ function __wbg_get_imports() {
|
|
|
1598
1612
|
};
|
|
1599
1613
|
}
|
|
1600
1614
|
|
|
1601
|
-
function
|
|
1602
|
-
wasm.
|
|
1615
|
+
function wasm_bindgen__convert__closures_____invoke__h7219f39dd5b80c81(arg0, arg1, arg2) {
|
|
1616
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h7219f39dd5b80c81(arg0, arg1, arg2);
|
|
1603
1617
|
}
|
|
1604
1618
|
|
|
1605
1619
|
function wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3(arg0, arg1, arg2) {
|
|
@@ -1610,8 +1624,8 @@ function wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746(arg0, arg
|
|
|
1610
1624
|
wasm.wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746(arg0, arg1, arg2);
|
|
1611
1625
|
}
|
|
1612
1626
|
|
|
1613
|
-
function
|
|
1614
|
-
const ret = wasm.
|
|
1627
|
+
function wasm_bindgen__convert__closures_____invoke__h087382e1a24f6ffe(arg0, arg1, arg2) {
|
|
1628
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h087382e1a24f6ffe(arg0, arg1, arg2);
|
|
1615
1629
|
if (ret[1]) {
|
|
1616
1630
|
throw takeFromExternrefTable0(ret[0]);
|
|
1617
1631
|
}
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ export const __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
|
|
|
5
5
|
export const __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
6
6
|
export const jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
7
7
|
export const jsasyncfilesystem_new: (a: any) => number;
|
|
8
|
-
export const now_timestamp: () => [number, number];
|
|
9
|
-
export const today_formatted: (a: number, b: number) => [number, number];
|
|
10
8
|
export const wasmsyncclient_focusFiles: (a: number, b: number, c: number) => void;
|
|
11
9
|
export const wasmsyncclient_getServerUrl: (a: number) => [number, number];
|
|
12
10
|
export const wasmsyncclient_getWorkspaceId: (a: number) => [number, number];
|
|
@@ -23,8 +21,8 @@ export const wasmsyncclient_pollOutgoingBinary: (a: number) => any;
|
|
|
23
21
|
export const wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
24
22
|
export const wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
25
23
|
export const wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
24
|
+
export const wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
26
25
|
export const wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
27
|
-
export const init: () => void;
|
|
28
26
|
export const __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
29
27
|
export const diaryxbackend_create: (a: number, b: number) => any;
|
|
30
28
|
export const diaryxbackend_createFromDirectoryHandle: (a: any) => [number, number, number];
|
|
@@ -45,20 +43,23 @@ export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
|
45
43
|
export const diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
46
44
|
export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
47
45
|
export const diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
48
|
-
export const
|
|
49
|
-
export const opfsfilesystem_create: () => any;
|
|
50
|
-
export const opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
46
|
+
export const init: () => void;
|
|
51
47
|
export const __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
52
48
|
export const __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
53
49
|
export const fsafilesystem_fromHandle: (a: any) => number;
|
|
54
50
|
export const indexeddbfilesystem_create: () => any;
|
|
55
51
|
export const indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
56
|
-
export const
|
|
52
|
+
export const now_timestamp: () => [number, number];
|
|
53
|
+
export const today_formatted: (a: number, b: number) => [number, number];
|
|
54
|
+
export const __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
55
|
+
export const opfsfilesystem_create: () => any;
|
|
56
|
+
export const opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
57
|
+
export const wasm_bindgen__closure__destroy__h9e9f624a5c8a6473: (a: number, b: number) => void;
|
|
57
58
|
export const wasm_bindgen__closure__destroy__h54a6b627d1123dca: (a: number, b: number) => void;
|
|
58
59
|
export const wasm_bindgen__closure__destroy__h440f08373ff30a05: (a: number, b: number) => void;
|
|
59
|
-
export const
|
|
60
|
+
export const wasm_bindgen__convert__closures_____invoke__h087382e1a24f6ffe: (a: number, b: number, c: any) => [number, number];
|
|
60
61
|
export const wasm_bindgen__convert__closures_____invoke__h4e796b59e8c15a06: (a: number, b: number, c: any, d: any) => void;
|
|
61
|
-
export const
|
|
62
|
+
export const wasm_bindgen__convert__closures_____invoke__h7219f39dd5b80c81: (a: number, b: number, c: any) => void;
|
|
62
63
|
export const wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3: (a: number, b: number, c: any) => void;
|
|
63
64
|
export const wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746: (a: number, b: number, c: any) => void;
|
|
64
65
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@diaryx/wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for Diaryx core functionality",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "1.0.1-dev.241bbf9",
|
|
6
6
|
"license": "SEE LICENSE IN ../../LICENSE.md",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|