@diaryx/wasm 1.0.1-dev.65c1d5d → 1.1.0-dev.4c342c8
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 +66 -0
- package/diaryx_wasm.d.ts +70 -12
- package/diaryx_wasm.js +150 -10
- package/diaryx_wasm_bg.wasm.d.ts +16 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -360,6 +360,72 @@ CRDT operations use `doc_type` to specify which document to operate on:
|
|
|
360
360
|
| `body` | file path | Per-file body content (e.g., `notes/a.md`) |
|
|
361
361
|
|
|
362
362
|
|
|
363
|
+
## Node.js / Obsidian / Electron Usage
|
|
364
|
+
|
|
365
|
+
The `@diaryx/wasm-node` npm package is a build of this crate without browser-specific storage backends. It's published automatically by CI and works in any JavaScript environment that supports WebAssembly.
|
|
366
|
+
|
|
367
|
+
### Setup
|
|
368
|
+
|
|
369
|
+
```javascript
|
|
370
|
+
import init, { DiaryxBackend } from '@diaryx/wasm-node';
|
|
371
|
+
import fs from 'fs';
|
|
372
|
+
|
|
373
|
+
// Load WASM binary and initialize
|
|
374
|
+
const wasmPath = new URL('./diaryx_wasm_bg.wasm', import.meta.url);
|
|
375
|
+
await init(fs.readFileSync(wasmPath));
|
|
376
|
+
|
|
377
|
+
// Create backend with JavaScript filesystem callbacks
|
|
378
|
+
const backend = DiaryxBackend.createFromJsFileSystem({
|
|
379
|
+
readToString: (path) => fs.promises.readFile(path, 'utf8'),
|
|
380
|
+
writeFile: (path, content) => fs.promises.writeFile(path, content),
|
|
381
|
+
exists: (path) => fs.promises.access(path).then(() => true).catch(() => false),
|
|
382
|
+
isDir: (path) => fs.promises.stat(path).then(s => s.isDirectory()).catch(() => false),
|
|
383
|
+
listFiles: (dir) => fs.promises.readdir(dir),
|
|
384
|
+
listMdFiles: (dir) => fs.promises.readdir(dir).then(f => f.filter(n => n.endsWith('.md'))),
|
|
385
|
+
createDirAll: (path) => fs.promises.mkdir(path, { recursive: true }),
|
|
386
|
+
moveFile: (from, to) => fs.promises.rename(from, to),
|
|
387
|
+
deleteFile: (path) => fs.promises.unlink(path),
|
|
388
|
+
readBinary: (path) => fs.promises.readFile(path),
|
|
389
|
+
writeBinary: (path, data) => fs.promises.writeFile(path, data),
|
|
390
|
+
});
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Obsidian Plugin Integration
|
|
394
|
+
|
|
395
|
+
For Obsidian plugins, bridge the Vault adapter API:
|
|
396
|
+
|
|
397
|
+
```javascript
|
|
398
|
+
const backend = DiaryxBackend.createFromJsFileSystem({
|
|
399
|
+
readToString: (path) => app.vault.adapter.read(path),
|
|
400
|
+
writeFile: (path, content) => app.vault.adapter.write(path, content),
|
|
401
|
+
exists: (path) => app.vault.adapter.exists(path),
|
|
402
|
+
isDir: (path) => app.vault.adapter.stat(path).then(s => s?.type === 'folder'),
|
|
403
|
+
listFiles: (dir) => app.vault.adapter.list(dir).then(r => [...r.files, ...r.folders]),
|
|
404
|
+
listMdFiles: (dir) => app.vault.adapter.list(dir).then(r => r.files.filter(f => f.endsWith('.md'))),
|
|
405
|
+
createDirAll: (path) => app.vault.adapter.mkdir(path),
|
|
406
|
+
moveFile: (from, to) => app.vault.adapter.rename(from, to),
|
|
407
|
+
deleteFile: (path) => app.vault.adapter.remove(path),
|
|
408
|
+
readBinary: (path) => app.vault.adapter.readBinary(path),
|
|
409
|
+
writeBinary: (path, data) => app.vault.adapter.writeBinary(path, data),
|
|
410
|
+
});
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Reacting to External File Moves
|
|
414
|
+
|
|
415
|
+
When an external tool (Obsidian, VS Code, etc.) has already moved a file, use `SyncMoveMetadata` to update the workspace hierarchy metadata without re-doing the filesystem move:
|
|
416
|
+
|
|
417
|
+
```javascript
|
|
418
|
+
// Obsidian fires this after a file is moved/renamed
|
|
419
|
+
app.vault.on('rename', async (file, oldPath) => {
|
|
420
|
+
await backend.executeJs({
|
|
421
|
+
type: 'SyncMoveMetadata',
|
|
422
|
+
params: { old_path: oldPath, new_path: file.path }
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
This updates `contents` in the old and new parent indexes and `part_of` in the moved file.
|
|
428
|
+
|
|
363
429
|
## Error Handling
|
|
364
430
|
|
|
365
431
|
All methods return `Result<T, JsValue>` for JavaScript interop. Errors are converted to JavaScript exceptions with descriptive messages.
|
package/diaryx_wasm.d.ts
CHANGED
|
@@ -140,6 +140,24 @@ export class DiaryxBackend {
|
|
|
140
140
|
* ```
|
|
141
141
|
*/
|
|
142
142
|
static createFromDirectoryHandle(handle: FileSystemDirectoryHandle): DiaryxBackend;
|
|
143
|
+
/**
|
|
144
|
+
* Create a new DiaryxBackend backed by JavaScript filesystem callbacks.
|
|
145
|
+
*
|
|
146
|
+
* This is the primary way to use diaryx from non-browser environments
|
|
147
|
+
* (Node.js, Obsidian, Electron). The `callbacks` object must implement
|
|
148
|
+
* the `JsFileSystemCallbacks` interface.
|
|
149
|
+
*
|
|
150
|
+
* ## Example
|
|
151
|
+
* ```javascript
|
|
152
|
+
* const backend = DiaryxBackend.createFromJsFileSystem({
|
|
153
|
+
* readToString: async (path) => fs.readFile(path, 'utf8'),
|
|
154
|
+
* writeFile: async (path, content) => fs.writeFile(path, content),
|
|
155
|
+
* exists: async (path) => fs.access(path).then(() => true).catch(() => false),
|
|
156
|
+
* // ... other callbacks
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
static createFromJsFileSystem(callbacks: any): DiaryxBackend;
|
|
143
161
|
/**
|
|
144
162
|
* Create a new DiaryxBackend with in-memory storage.
|
|
145
163
|
*
|
|
@@ -321,6 +339,35 @@ export class DiaryxBackend {
|
|
|
321
339
|
* ```
|
|
322
340
|
*/
|
|
323
341
|
onFileSystemEvent(callback: Function): bigint;
|
|
342
|
+
/**
|
|
343
|
+
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
344
|
+
*
|
|
345
|
+
* Auto-detects the format: ZIP files (with media directories) have
|
|
346
|
+
* attachments populated with binary data. Plain JSON files are parsed
|
|
347
|
+
* with empty attachment data (backward compatible).
|
|
348
|
+
*
|
|
349
|
+
* ## Example
|
|
350
|
+
* ```javascript
|
|
351
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
352
|
+
* const result = backend.parseDayOneJson(bytes);
|
|
353
|
+
* const { entries, errors } = JSON.parse(result);
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
parseDayOneJson(bytes: Uint8Array): string;
|
|
357
|
+
/**
|
|
358
|
+
* Parse a single markdown file and return the entry as JSON.
|
|
359
|
+
*
|
|
360
|
+
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
361
|
+
* a JSON-serialized `ImportedEntry`.
|
|
362
|
+
*
|
|
363
|
+
* ## Example
|
|
364
|
+
* ```javascript
|
|
365
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
366
|
+
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
367
|
+
* const entry = JSON.parse(entryJson);
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
parseMarkdownFile(bytes: Uint8Array, filename: string): string;
|
|
324
371
|
/**
|
|
325
372
|
* Read binary file.
|
|
326
373
|
*
|
|
@@ -547,6 +594,13 @@ export class WasmSyncClient {
|
|
|
547
594
|
* Call this before connecting to join a share session.
|
|
548
595
|
*/
|
|
549
596
|
setSessionCode(code: string): void;
|
|
597
|
+
/**
|
|
598
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
599
|
+
*
|
|
600
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
601
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
602
|
+
*/
|
|
603
|
+
syncBodyFiles(file_paths: string[]): Promise<any>;
|
|
550
604
|
/**
|
|
551
605
|
* Send an unfocus message for specific files.
|
|
552
606
|
*/
|
|
@@ -572,6 +626,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
572
626
|
|
|
573
627
|
export interface InitOutput {
|
|
574
628
|
readonly memory: WebAssembly.Memory;
|
|
629
|
+
readonly init: () => void;
|
|
575
630
|
readonly __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
|
|
576
631
|
readonly __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
577
632
|
readonly jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
@@ -592,21 +647,16 @@ export interface InitOutput {
|
|
|
592
647
|
readonly wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
593
648
|
readonly wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
594
649
|
readonly wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
650
|
+
readonly wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
595
651
|
readonly wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
596
|
-
readonly __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
597
|
-
readonly opfsfilesystem_create: () => any;
|
|
598
|
-
readonly opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
599
|
-
readonly __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
600
|
-
readonly __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
601
|
-
readonly fsafilesystem_fromHandle: (a: any) => number;
|
|
602
|
-
readonly indexeddbfilesystem_create: () => any;
|
|
603
|
-
readonly indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
604
|
-
readonly init: () => void;
|
|
605
652
|
readonly now_timestamp: () => [number, number];
|
|
606
653
|
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
654
|
+
readonly __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
655
|
+
readonly fsafilesystem_fromHandle: (a: any) => number;
|
|
607
656
|
readonly __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
608
657
|
readonly diaryxbackend_create: (a: number, b: number) => any;
|
|
609
658
|
readonly diaryxbackend_createFromDirectoryHandle: (a: any) => [number, number, number];
|
|
659
|
+
readonly diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
|
|
610
660
|
readonly diaryxbackend_createInMemory: () => [number, number, number];
|
|
611
661
|
readonly diaryxbackend_createIndexedDb: (a: number, b: number) => any;
|
|
612
662
|
readonly diaryxbackend_createOpfs: (a: number, b: number) => any;
|
|
@@ -620,16 +670,24 @@ export interface InitOutput {
|
|
|
620
670
|
readonly diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
621
671
|
readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
622
672
|
readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
673
|
+
readonly diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
674
|
+
readonly diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
623
675
|
readonly diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
624
676
|
readonly diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
625
677
|
readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
626
678
|
readonly diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
627
|
-
readonly
|
|
679
|
+
readonly __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
680
|
+
readonly __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
681
|
+
readonly indexeddbfilesystem_create: () => any;
|
|
682
|
+
readonly indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
683
|
+
readonly opfsfilesystem_create: () => any;
|
|
684
|
+
readonly opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
685
|
+
readonly wasm_bindgen__closure__destroy__h69e812187e252c40: (a: number, b: number) => void;
|
|
628
686
|
readonly wasm_bindgen__closure__destroy__h54a6b627d1123dca: (a: number, b: number) => void;
|
|
629
687
|
readonly wasm_bindgen__closure__destroy__h440f08373ff30a05: (a: number, b: number) => void;
|
|
630
|
-
readonly
|
|
688
|
+
readonly wasm_bindgen__convert__closures_____invoke__hcf4d64747f079306: (a: number, b: number, c: any) => [number, number];
|
|
631
689
|
readonly wasm_bindgen__convert__closures_____invoke__h4e796b59e8c15a06: (a: number, b: number, c: any, d: any) => void;
|
|
632
|
-
readonly
|
|
690
|
+
readonly wasm_bindgen__convert__closures_____invoke__h6e05bfdb5936502e: (a: number, b: number, c: any) => void;
|
|
633
691
|
readonly wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3: (a: number, b: number, c: any) => void;
|
|
634
692
|
readonly wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746: (a: number, b: number, c: any) => void;
|
|
635
693
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
package/diaryx_wasm.js
CHANGED
|
@@ -76,6 +76,32 @@ export class DiaryxBackend {
|
|
|
76
76
|
}
|
|
77
77
|
return DiaryxBackend.__wrap(ret[0]);
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a new DiaryxBackend backed by JavaScript filesystem callbacks.
|
|
81
|
+
*
|
|
82
|
+
* This is the primary way to use diaryx from non-browser environments
|
|
83
|
+
* (Node.js, Obsidian, Electron). The `callbacks` object must implement
|
|
84
|
+
* the `JsFileSystemCallbacks` interface.
|
|
85
|
+
*
|
|
86
|
+
* ## Example
|
|
87
|
+
* ```javascript
|
|
88
|
+
* const backend = DiaryxBackend.createFromJsFileSystem({
|
|
89
|
+
* readToString: async (path) => fs.readFile(path, 'utf8'),
|
|
90
|
+
* writeFile: async (path, content) => fs.writeFile(path, content),
|
|
91
|
+
* exists: async (path) => fs.access(path).then(() => true).catch(() => false),
|
|
92
|
+
* // ... other callbacks
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
* @param {any} callbacks
|
|
96
|
+
* @returns {DiaryxBackend}
|
|
97
|
+
*/
|
|
98
|
+
static createFromJsFileSystem(callbacks) {
|
|
99
|
+
const ret = wasm.diaryxbackend_createFromJsFileSystem(callbacks);
|
|
100
|
+
if (ret[2]) {
|
|
101
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
102
|
+
}
|
|
103
|
+
return DiaryxBackend.__wrap(ret[0]);
|
|
104
|
+
}
|
|
79
105
|
/**
|
|
80
106
|
* Create a new DiaryxBackend with in-memory storage.
|
|
81
107
|
*
|
|
@@ -337,6 +363,80 @@ export class DiaryxBackend {
|
|
|
337
363
|
const ret = wasm.diaryxbackend_onFileSystemEvent(this.__wbg_ptr, callback);
|
|
338
364
|
return BigInt.asUintN(64, ret);
|
|
339
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
368
|
+
*
|
|
369
|
+
* Auto-detects the format: ZIP files (with media directories) have
|
|
370
|
+
* attachments populated with binary data. Plain JSON files are parsed
|
|
371
|
+
* with empty attachment data (backward compatible).
|
|
372
|
+
*
|
|
373
|
+
* ## Example
|
|
374
|
+
* ```javascript
|
|
375
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
376
|
+
* const result = backend.parseDayOneJson(bytes);
|
|
377
|
+
* const { entries, errors } = JSON.parse(result);
|
|
378
|
+
* ```
|
|
379
|
+
* @param {Uint8Array} bytes
|
|
380
|
+
* @returns {string}
|
|
381
|
+
*/
|
|
382
|
+
parseDayOneJson(bytes) {
|
|
383
|
+
let deferred3_0;
|
|
384
|
+
let deferred3_1;
|
|
385
|
+
try {
|
|
386
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
387
|
+
const len0 = WASM_VECTOR_LEN;
|
|
388
|
+
const ret = wasm.diaryxbackend_parseDayOneJson(this.__wbg_ptr, ptr0, len0);
|
|
389
|
+
var ptr2 = ret[0];
|
|
390
|
+
var len2 = ret[1];
|
|
391
|
+
if (ret[3]) {
|
|
392
|
+
ptr2 = 0; len2 = 0;
|
|
393
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
394
|
+
}
|
|
395
|
+
deferred3_0 = ptr2;
|
|
396
|
+
deferred3_1 = len2;
|
|
397
|
+
return getStringFromWasm0(ptr2, len2);
|
|
398
|
+
} finally {
|
|
399
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Parse a single markdown file and return the entry as JSON.
|
|
404
|
+
*
|
|
405
|
+
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
406
|
+
* a JSON-serialized `ImportedEntry`.
|
|
407
|
+
*
|
|
408
|
+
* ## Example
|
|
409
|
+
* ```javascript
|
|
410
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
411
|
+
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
412
|
+
* const entry = JSON.parse(entryJson);
|
|
413
|
+
* ```
|
|
414
|
+
* @param {Uint8Array} bytes
|
|
415
|
+
* @param {string} filename
|
|
416
|
+
* @returns {string}
|
|
417
|
+
*/
|
|
418
|
+
parseMarkdownFile(bytes, filename) {
|
|
419
|
+
let deferred4_0;
|
|
420
|
+
let deferred4_1;
|
|
421
|
+
try {
|
|
422
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
424
|
+
const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
425
|
+
const len1 = WASM_VECTOR_LEN;
|
|
426
|
+
const ret = wasm.diaryxbackend_parseMarkdownFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
427
|
+
var ptr3 = ret[0];
|
|
428
|
+
var len3 = ret[1];
|
|
429
|
+
if (ret[3]) {
|
|
430
|
+
ptr3 = 0; len3 = 0;
|
|
431
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
432
|
+
}
|
|
433
|
+
deferred4_0 = ptr3;
|
|
434
|
+
deferred4_1 = len3;
|
|
435
|
+
return getStringFromWasm0(ptr3, len3);
|
|
436
|
+
} finally {
|
|
437
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
340
440
|
/**
|
|
341
441
|
* Read binary file.
|
|
342
442
|
*
|
|
@@ -807,6 +907,20 @@ export class WasmSyncClient {
|
|
|
807
907
|
const len0 = WASM_VECTOR_LEN;
|
|
808
908
|
wasm.wasmsyncclient_setSessionCode(this.__wbg_ptr, ptr0, len0);
|
|
809
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
912
|
+
*
|
|
913
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
914
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
915
|
+
* @param {string[]} file_paths
|
|
916
|
+
* @returns {Promise<any>}
|
|
917
|
+
*/
|
|
918
|
+
syncBodyFiles(file_paths) {
|
|
919
|
+
const ptr0 = passArrayJsValueToWasm0(file_paths, wasm.__wbindgen_malloc);
|
|
920
|
+
const len0 = WASM_VECTOR_LEN;
|
|
921
|
+
const ret = wasm.wasmsyncclient_syncBodyFiles(this.__wbg_ptr, ptr0, len0);
|
|
922
|
+
return ret;
|
|
923
|
+
}
|
|
810
924
|
/**
|
|
811
925
|
* Send an unfocus message for specific files.
|
|
812
926
|
* @param {string[]} files
|
|
@@ -966,6 +1080,10 @@ function __wbg_get_imports() {
|
|
|
966
1080
|
const ret = Reflect.apply(arg0, arg1, arg2);
|
|
967
1081
|
return ret;
|
|
968
1082
|
}, arguments); },
|
|
1083
|
+
__wbg_apply_ada2ee1a60ac7b3c: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1084
|
+
const ret = arg0.apply(arg1, arg2);
|
|
1085
|
+
return ret;
|
|
1086
|
+
}, arguments); },
|
|
969
1087
|
__wbg_arrayBuffer_05ce1af23e9064e8: function(arg0) {
|
|
970
1088
|
const ret = arg0.arrayBuffer();
|
|
971
1089
|
return ret;
|
|
@@ -978,6 +1096,14 @@ function __wbg_get_imports() {
|
|
|
978
1096
|
const ret = arg0.call(arg1, arg2);
|
|
979
1097
|
return ret;
|
|
980
1098
|
}, arguments); },
|
|
1099
|
+
__wbg_call_812d25f1510c13c8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1100
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1101
|
+
return ret;
|
|
1102
|
+
}, arguments); },
|
|
1103
|
+
__wbg_call_e8c868596c950cf6: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1104
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
1105
|
+
return ret;
|
|
1106
|
+
}, arguments); },
|
|
981
1107
|
__wbg_close_83fb809aca3de7f9: function(arg0) {
|
|
982
1108
|
const ret = arg0.close();
|
|
983
1109
|
return ret;
|
|
@@ -1190,6 +1316,16 @@ function __wbg_get_imports() {
|
|
|
1190
1316
|
const ret = result;
|
|
1191
1317
|
return ret;
|
|
1192
1318
|
},
|
|
1319
|
+
__wbg_instanceof_Object_1c6af87502b733ed: function(arg0) {
|
|
1320
|
+
let result;
|
|
1321
|
+
try {
|
|
1322
|
+
result = arg0 instanceof Object;
|
|
1323
|
+
} catch (_) {
|
|
1324
|
+
result = false;
|
|
1325
|
+
}
|
|
1326
|
+
const ret = result;
|
|
1327
|
+
return ret;
|
|
1328
|
+
},
|
|
1193
1329
|
__wbg_instanceof_Promise_0094681e3519d6ec: function(arg0) {
|
|
1194
1330
|
let result;
|
|
1195
1331
|
try {
|
|
@@ -1514,6 +1650,10 @@ function __wbg_get_imports() {
|
|
|
1514
1650
|
const ret = arg0.then(arg1);
|
|
1515
1651
|
return ret;
|
|
1516
1652
|
},
|
|
1653
|
+
__wbg_toString_964ff7fe6eca8362: function(arg0) {
|
|
1654
|
+
const ret = arg0.toString();
|
|
1655
|
+
return ret;
|
|
1656
|
+
},
|
|
1517
1657
|
__wbg_transaction_5124caf7db668498: function(arg0) {
|
|
1518
1658
|
const ret = arg0.transaction;
|
|
1519
1659
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
@@ -1538,22 +1678,22 @@ function __wbg_get_imports() {
|
|
|
1538
1678
|
return ret;
|
|
1539
1679
|
}, arguments); },
|
|
1540
1680
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1541
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1542
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1681
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 652, function: Function { arguments: [NamedExternref("Event")], shim_idx: 640, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1682
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h69e812187e252c40, wasm_bindgen__convert__closures_____invoke__hcf4d64747f079306);
|
|
1543
1683
|
return ret;
|
|
1544
1684
|
},
|
|
1545
1685
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1546
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1547
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1686
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 652, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 641, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1687
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h69e812187e252c40, wasm_bindgen__convert__closures_____invoke__h6e05bfdb5936502e);
|
|
1548
1688
|
return ret;
|
|
1549
1689
|
},
|
|
1550
1690
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1551
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1691
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 836, function: Function { arguments: [NamedExternref("Event")], shim_idx: 837, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1552
1692
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h54a6b627d1123dca, wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3);
|
|
1553
1693
|
return ret;
|
|
1554
1694
|
},
|
|
1555
1695
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1556
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1696
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 862, function: Function { arguments: [Externref], shim_idx: 863, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1557
1697
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h440f08373ff30a05, wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746);
|
|
1558
1698
|
return ret;
|
|
1559
1699
|
},
|
|
@@ -1598,8 +1738,8 @@ function __wbg_get_imports() {
|
|
|
1598
1738
|
};
|
|
1599
1739
|
}
|
|
1600
1740
|
|
|
1601
|
-
function
|
|
1602
|
-
wasm.
|
|
1741
|
+
function wasm_bindgen__convert__closures_____invoke__h6e05bfdb5936502e(arg0, arg1, arg2) {
|
|
1742
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h6e05bfdb5936502e(arg0, arg1, arg2);
|
|
1603
1743
|
}
|
|
1604
1744
|
|
|
1605
1745
|
function wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3(arg0, arg1, arg2) {
|
|
@@ -1610,8 +1750,8 @@ function wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746(arg0, arg
|
|
|
1610
1750
|
wasm.wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746(arg0, arg1, arg2);
|
|
1611
1751
|
}
|
|
1612
1752
|
|
|
1613
|
-
function
|
|
1614
|
-
const ret = wasm.
|
|
1753
|
+
function wasm_bindgen__convert__closures_____invoke__hcf4d64747f079306(arg0, arg1, arg2) {
|
|
1754
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hcf4d64747f079306(arg0, arg1, arg2);
|
|
1615
1755
|
if (ret[1]) {
|
|
1616
1756
|
throw takeFromExternrefTable0(ret[0]);
|
|
1617
1757
|
}
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const init: () => void;
|
|
4
5
|
export const __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
|
|
5
6
|
export const __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
6
7
|
export const jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
@@ -21,21 +22,16 @@ export const wasmsyncclient_pollOutgoingBinary: (a: number) => any;
|
|
|
21
22
|
export const wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
22
23
|
export const wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
23
24
|
export const wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
25
|
+
export const wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
24
26
|
export const wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
25
|
-
export const __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
26
|
-
export const opfsfilesystem_create: () => any;
|
|
27
|
-
export const opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
28
|
-
export const __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
29
|
-
export const __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
30
|
-
export const fsafilesystem_fromHandle: (a: any) => number;
|
|
31
|
-
export const indexeddbfilesystem_create: () => any;
|
|
32
|
-
export const indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
33
|
-
export const init: () => void;
|
|
34
27
|
export const now_timestamp: () => [number, number];
|
|
35
28
|
export const today_formatted: (a: number, b: number) => [number, number];
|
|
29
|
+
export const __wbg_fsafilesystem_free: (a: number, b: number) => void;
|
|
30
|
+
export const fsafilesystem_fromHandle: (a: any) => number;
|
|
36
31
|
export const __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
37
32
|
export const diaryxbackend_create: (a: number, b: number) => any;
|
|
38
33
|
export const diaryxbackend_createFromDirectoryHandle: (a: any) => [number, number, number];
|
|
34
|
+
export const diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
|
|
39
35
|
export const diaryxbackend_createInMemory: () => [number, number, number];
|
|
40
36
|
export const diaryxbackend_createIndexedDb: (a: number, b: number) => any;
|
|
41
37
|
export const diaryxbackend_createOpfs: (a: number, b: number) => any;
|
|
@@ -49,16 +45,24 @@ export const diaryxbackend_hasNativeSync: (a: number) => number;
|
|
|
49
45
|
export const diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
50
46
|
export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
51
47
|
export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
48
|
+
export const diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
49
|
+
export const diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
52
50
|
export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
53
51
|
export const diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
54
52
|
export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
55
53
|
export const diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
56
|
-
export const
|
|
54
|
+
export const __wbg_indexeddbfilesystem_free: (a: number, b: number) => void;
|
|
55
|
+
export const __wbg_opfsfilesystem_free: (a: number, b: number) => void;
|
|
56
|
+
export const indexeddbfilesystem_create: () => any;
|
|
57
|
+
export const indexeddbfilesystem_createWithName: (a: number, b: number) => any;
|
|
58
|
+
export const opfsfilesystem_create: () => any;
|
|
59
|
+
export const opfsfilesystem_createWithName: (a: number, b: number) => any;
|
|
60
|
+
export const wasm_bindgen__closure__destroy__h69e812187e252c40: (a: number, b: number) => void;
|
|
57
61
|
export const wasm_bindgen__closure__destroy__h54a6b627d1123dca: (a: number, b: number) => void;
|
|
58
62
|
export const wasm_bindgen__closure__destroy__h440f08373ff30a05: (a: number, b: number) => void;
|
|
59
|
-
export const
|
|
63
|
+
export const wasm_bindgen__convert__closures_____invoke__hcf4d64747f079306: (a: number, b: number, c: any) => [number, number];
|
|
60
64
|
export const wasm_bindgen__convert__closures_____invoke__h4e796b59e8c15a06: (a: number, b: number, c: any, d: any) => void;
|
|
61
|
-
export const
|
|
65
|
+
export const wasm_bindgen__convert__closures_____invoke__h6e05bfdb5936502e: (a: number, b: number, c: any) => void;
|
|
62
66
|
export const wasm_bindgen__convert__closures_____invoke__h7d21c95eeb3011e3: (a: number, b: number, c: any) => void;
|
|
63
67
|
export const wasm_bindgen__convert__closures_____invoke__h359356b1e0b37746: (a: number, b: number, c: any) => void;
|
|
64
68
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
package/package.json
CHANGED