@diaryx/wasm-node 1.0.1-dev.b9c03a2 → 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 +79 -21
- package/diaryx_wasm.js +162 -1
- package/diaryx_wasm_bg.wasm +0 -0
- package/diaryx_wasm_bg.wasm.d.ts +25 -21
- 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
|
@@ -120,6 +120,24 @@ export class DiaryxBackend {
|
|
|
120
120
|
* Create backend with specific storage type.
|
|
121
121
|
*/
|
|
122
122
|
static create(storage_type: string): Promise<DiaryxBackend>;
|
|
123
|
+
/**
|
|
124
|
+
* Create a new DiaryxBackend backed by JavaScript filesystem callbacks.
|
|
125
|
+
*
|
|
126
|
+
* This is the primary way to use diaryx from non-browser environments
|
|
127
|
+
* (Node.js, Obsidian, Electron). The `callbacks` object must implement
|
|
128
|
+
* the `JsFileSystemCallbacks` interface.
|
|
129
|
+
*
|
|
130
|
+
* ## Example
|
|
131
|
+
* ```javascript
|
|
132
|
+
* const backend = DiaryxBackend.createFromJsFileSystem({
|
|
133
|
+
* readToString: async (path) => fs.readFile(path, 'utf8'),
|
|
134
|
+
* writeFile: async (path, content) => fs.writeFile(path, content),
|
|
135
|
+
* exists: async (path) => fs.access(path).then(() => true).catch(() => false),
|
|
136
|
+
* // ... other callbacks
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
static createFromJsFileSystem(callbacks: any): DiaryxBackend;
|
|
123
141
|
/**
|
|
124
142
|
* Create a new DiaryxBackend with in-memory storage.
|
|
125
143
|
*
|
|
@@ -274,6 +292,35 @@ export class DiaryxBackend {
|
|
|
274
292
|
* ```
|
|
275
293
|
*/
|
|
276
294
|
onFileSystemEvent(callback: Function): bigint;
|
|
295
|
+
/**
|
|
296
|
+
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
297
|
+
*
|
|
298
|
+
* Auto-detects the format: ZIP files (with media directories) have
|
|
299
|
+
* attachments populated with binary data. Plain JSON files are parsed
|
|
300
|
+
* with empty attachment data (backward compatible).
|
|
301
|
+
*
|
|
302
|
+
* ## Example
|
|
303
|
+
* ```javascript
|
|
304
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
305
|
+
* const result = backend.parseDayOneJson(bytes);
|
|
306
|
+
* const { entries, errors } = JSON.parse(result);
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
parseDayOneJson(bytes: Uint8Array): string;
|
|
310
|
+
/**
|
|
311
|
+
* Parse a single markdown file and return the entry as JSON.
|
|
312
|
+
*
|
|
313
|
+
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
314
|
+
* a JSON-serialized `ImportedEntry`.
|
|
315
|
+
*
|
|
316
|
+
* ## Example
|
|
317
|
+
* ```javascript
|
|
318
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
319
|
+
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
320
|
+
* const entry = JSON.parse(entryJson);
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
parseMarkdownFile(bytes: Uint8Array, filename: string): string;
|
|
277
324
|
/**
|
|
278
325
|
* Read binary file.
|
|
279
326
|
*
|
|
@@ -434,6 +481,13 @@ export class WasmSyncClient {
|
|
|
434
481
|
* Call this before connecting to join a share session.
|
|
435
482
|
*/
|
|
436
483
|
setSessionCode(code: string): void;
|
|
484
|
+
/**
|
|
485
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
486
|
+
*
|
|
487
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
488
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
489
|
+
*/
|
|
490
|
+
syncBodyFiles(file_paths: string[]): Promise<any>;
|
|
437
491
|
/**
|
|
438
492
|
* Send an unfocus message for specific files.
|
|
439
493
|
*/
|
|
@@ -459,30 +513,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
459
513
|
|
|
460
514
|
export interface InitOutput {
|
|
461
515
|
readonly memory: WebAssembly.Memory;
|
|
462
|
-
readonly now_timestamp: () => [number, number];
|
|
463
|
-
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
464
516
|
readonly __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
|
|
517
|
+
readonly __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
465
518
|
readonly jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
466
519
|
readonly jsasyncfilesystem_new: (a: any) => number;
|
|
467
|
-
readonly
|
|
468
|
-
readonly
|
|
469
|
-
readonly __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
470
|
-
readonly diaryxbackend_create: (a: number, b: number) => any;
|
|
471
|
-
readonly diaryxbackend_createInMemory: () => [number, number, number];
|
|
472
|
-
readonly diaryxbackend_createSyncClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
473
|
-
readonly diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
474
|
-
readonly diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
475
|
-
readonly diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
476
|
-
readonly diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
477
|
-
readonly diaryxbackend_getConfig: (a: number) => any;
|
|
478
|
-
readonly diaryxbackend_hasNativeSync: (a: number) => number;
|
|
479
|
-
readonly diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
480
|
-
readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
481
|
-
readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
482
|
-
readonly diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
483
|
-
readonly diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
484
|
-
readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
485
|
-
readonly diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
520
|
+
readonly now_timestamp: () => [number, number];
|
|
521
|
+
readonly today_formatted: (a: number, b: number) => [number, number];
|
|
486
522
|
readonly wasmsyncclient_focusFiles: (a: number, b: number, c: number) => void;
|
|
487
523
|
readonly wasmsyncclient_getServerUrl: (a: number) => [number, number];
|
|
488
524
|
readonly wasmsyncclient_getWorkspaceId: (a: number) => [number, number];
|
|
@@ -499,7 +535,29 @@ export interface InitOutput {
|
|
|
499
535
|
readonly wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
500
536
|
readonly wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
501
537
|
readonly wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
538
|
+
readonly wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
502
539
|
readonly wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
540
|
+
readonly __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
541
|
+
readonly diaryxbackend_create: (a: number, b: number) => any;
|
|
542
|
+
readonly diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
|
|
543
|
+
readonly diaryxbackend_createInMemory: () => [number, number, number];
|
|
544
|
+
readonly diaryxbackend_createSyncClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
545
|
+
readonly diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
546
|
+
readonly diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
547
|
+
readonly diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
548
|
+
readonly diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
549
|
+
readonly diaryxbackend_getConfig: (a: number) => any;
|
|
550
|
+
readonly diaryxbackend_hasNativeSync: (a: number) => number;
|
|
551
|
+
readonly diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
552
|
+
readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
553
|
+
readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
554
|
+
readonly diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
555
|
+
readonly diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
556
|
+
readonly diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
557
|
+
readonly diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
558
|
+
readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
559
|
+
readonly diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
560
|
+
readonly init: () => void;
|
|
503
561
|
readonly wasm_bindgen__closure__destroy__h358403ff5b31de35: (a: number, b: number) => void;
|
|
504
562
|
readonly wasm_bindgen__convert__closures_____invoke__h9824f9855d7aa260: (a: number, b: number, c: any, d: any) => void;
|
|
505
563
|
readonly wasm_bindgen__convert__closures_____invoke__h4b881ac518a5291a: (a: number, b: number, c: any) => void;
|
package/diaryx_wasm.js
CHANGED
|
@@ -48,6 +48,32 @@ export class DiaryxBackend {
|
|
|
48
48
|
const ret = wasm.diaryxbackend_create(ptr0, len0);
|
|
49
49
|
return ret;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a new DiaryxBackend backed by JavaScript filesystem callbacks.
|
|
53
|
+
*
|
|
54
|
+
* This is the primary way to use diaryx from non-browser environments
|
|
55
|
+
* (Node.js, Obsidian, Electron). The `callbacks` object must implement
|
|
56
|
+
* the `JsFileSystemCallbacks` interface.
|
|
57
|
+
*
|
|
58
|
+
* ## Example
|
|
59
|
+
* ```javascript
|
|
60
|
+
* const backend = DiaryxBackend.createFromJsFileSystem({
|
|
61
|
+
* readToString: async (path) => fs.readFile(path, 'utf8'),
|
|
62
|
+
* writeFile: async (path, content) => fs.writeFile(path, content),
|
|
63
|
+
* exists: async (path) => fs.access(path).then(() => true).catch(() => false),
|
|
64
|
+
* // ... other callbacks
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
* @param {any} callbacks
|
|
68
|
+
* @returns {DiaryxBackend}
|
|
69
|
+
*/
|
|
70
|
+
static createFromJsFileSystem(callbacks) {
|
|
71
|
+
const ret = wasm.diaryxbackend_createFromJsFileSystem(callbacks);
|
|
72
|
+
if (ret[2]) {
|
|
73
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
74
|
+
}
|
|
75
|
+
return DiaryxBackend.__wrap(ret[0]);
|
|
76
|
+
}
|
|
51
77
|
/**
|
|
52
78
|
* Create a new DiaryxBackend with in-memory storage.
|
|
53
79
|
*
|
|
@@ -268,6 +294,80 @@ export class DiaryxBackend {
|
|
|
268
294
|
const ret = wasm.diaryxbackend_onFileSystemEvent(this.__wbg_ptr, callback);
|
|
269
295
|
return BigInt.asUintN(64, ret);
|
|
270
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Parse a Day One export (ZIP or JSON) and return entries as JSON.
|
|
299
|
+
*
|
|
300
|
+
* Auto-detects the format: ZIP files (with media directories) have
|
|
301
|
+
* attachments populated with binary data. Plain JSON files are parsed
|
|
302
|
+
* with empty attachment data (backward compatible).
|
|
303
|
+
*
|
|
304
|
+
* ## Example
|
|
305
|
+
* ```javascript
|
|
306
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
307
|
+
* const result = backend.parseDayOneJson(bytes);
|
|
308
|
+
* const { entries, errors } = JSON.parse(result);
|
|
309
|
+
* ```
|
|
310
|
+
* @param {Uint8Array} bytes
|
|
311
|
+
* @returns {string}
|
|
312
|
+
*/
|
|
313
|
+
parseDayOneJson(bytes) {
|
|
314
|
+
let deferred3_0;
|
|
315
|
+
let deferred3_1;
|
|
316
|
+
try {
|
|
317
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
319
|
+
const ret = wasm.diaryxbackend_parseDayOneJson(this.__wbg_ptr, ptr0, len0);
|
|
320
|
+
var ptr2 = ret[0];
|
|
321
|
+
var len2 = ret[1];
|
|
322
|
+
if (ret[3]) {
|
|
323
|
+
ptr2 = 0; len2 = 0;
|
|
324
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
325
|
+
}
|
|
326
|
+
deferred3_0 = ptr2;
|
|
327
|
+
deferred3_1 = len2;
|
|
328
|
+
return getStringFromWasm0(ptr2, len2);
|
|
329
|
+
} finally {
|
|
330
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Parse a single markdown file and return the entry as JSON.
|
|
335
|
+
*
|
|
336
|
+
* Takes the raw bytes of a `.md` file and its filename, and returns
|
|
337
|
+
* a JSON-serialized `ImportedEntry`.
|
|
338
|
+
*
|
|
339
|
+
* ## Example
|
|
340
|
+
* ```javascript
|
|
341
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
342
|
+
* const entryJson = backend.parseMarkdownFile(bytes, file.name);
|
|
343
|
+
* const entry = JSON.parse(entryJson);
|
|
344
|
+
* ```
|
|
345
|
+
* @param {Uint8Array} bytes
|
|
346
|
+
* @param {string} filename
|
|
347
|
+
* @returns {string}
|
|
348
|
+
*/
|
|
349
|
+
parseMarkdownFile(bytes, filename) {
|
|
350
|
+
let deferred4_0;
|
|
351
|
+
let deferred4_1;
|
|
352
|
+
try {
|
|
353
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
354
|
+
const len0 = WASM_VECTOR_LEN;
|
|
355
|
+
const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
356
|
+
const len1 = WASM_VECTOR_LEN;
|
|
357
|
+
const ret = wasm.diaryxbackend_parseMarkdownFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
358
|
+
var ptr3 = ret[0];
|
|
359
|
+
var len3 = ret[1];
|
|
360
|
+
if (ret[3]) {
|
|
361
|
+
ptr3 = 0; len3 = 0;
|
|
362
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
363
|
+
}
|
|
364
|
+
deferred4_0 = ptr3;
|
|
365
|
+
deferred4_1 = len3;
|
|
366
|
+
return getStringFromWasm0(ptr3, len3);
|
|
367
|
+
} finally {
|
|
368
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
271
371
|
/**
|
|
272
372
|
* Read binary file.
|
|
273
373
|
*
|
|
@@ -600,6 +700,20 @@ export class WasmSyncClient {
|
|
|
600
700
|
const len0 = WASM_VECTOR_LEN;
|
|
601
701
|
wasm.wasmsyncclient_setSessionCode(this.__wbg_ptr, ptr0, len0);
|
|
602
702
|
}
|
|
703
|
+
/**
|
|
704
|
+
* Request body sync for specific files (lazy sync on demand).
|
|
705
|
+
*
|
|
706
|
+
* Sends SyncBodyFiles event through the session to initiate body
|
|
707
|
+
* SyncStep1 for just the requested files, rather than all files.
|
|
708
|
+
* @param {string[]} file_paths
|
|
709
|
+
* @returns {Promise<any>}
|
|
710
|
+
*/
|
|
711
|
+
syncBodyFiles(file_paths) {
|
|
712
|
+
const ptr0 = passArrayJsValueToWasm0(file_paths, wasm.__wbindgen_malloc);
|
|
713
|
+
const len0 = WASM_VECTOR_LEN;
|
|
714
|
+
const ret = wasm.wasmsyncclient_syncBodyFiles(this.__wbg_ptr, ptr0, len0);
|
|
715
|
+
return ret;
|
|
716
|
+
}
|
|
603
717
|
/**
|
|
604
718
|
* Send an unfocus message for specific files.
|
|
605
719
|
* @param {string[]} files
|
|
@@ -745,6 +859,10 @@ function __wbg_get_imports() {
|
|
|
745
859
|
__wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
|
|
746
860
|
arg0._wbg_cb_unref();
|
|
747
861
|
},
|
|
862
|
+
__wbg_apply_ada2ee1a60ac7b3c: function() { return handleError(function (arg0, arg1, arg2) {
|
|
863
|
+
const ret = arg0.apply(arg1, arg2);
|
|
864
|
+
return ret;
|
|
865
|
+
}, arguments); },
|
|
748
866
|
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
749
867
|
const ret = arg0.call(arg1);
|
|
750
868
|
return ret;
|
|
@@ -753,6 +871,14 @@ function __wbg_get_imports() {
|
|
|
753
871
|
const ret = arg0.call(arg1, arg2);
|
|
754
872
|
return ret;
|
|
755
873
|
}, arguments); },
|
|
874
|
+
__wbg_call_812d25f1510c13c8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
875
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
876
|
+
return ret;
|
|
877
|
+
}, arguments); },
|
|
878
|
+
__wbg_call_e8c868596c950cf6: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
879
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
880
|
+
return ret;
|
|
881
|
+
}, arguments); },
|
|
756
882
|
__wbg_crypto_86f2631e91b51511: function(arg0) {
|
|
757
883
|
const ret = arg0.crypto;
|
|
758
884
|
return ret;
|
|
@@ -821,6 +947,26 @@ function __wbg_get_imports() {
|
|
|
821
947
|
const ret = result;
|
|
822
948
|
return ret;
|
|
823
949
|
},
|
|
950
|
+
__wbg_instanceof_Object_1c6af87502b733ed: function(arg0) {
|
|
951
|
+
let result;
|
|
952
|
+
try {
|
|
953
|
+
result = arg0 instanceof Object;
|
|
954
|
+
} catch (_) {
|
|
955
|
+
result = false;
|
|
956
|
+
}
|
|
957
|
+
const ret = result;
|
|
958
|
+
return ret;
|
|
959
|
+
},
|
|
960
|
+
__wbg_instanceof_Promise_0094681e3519d6ec: function(arg0) {
|
|
961
|
+
let result;
|
|
962
|
+
try {
|
|
963
|
+
result = arg0 instanceof Promise;
|
|
964
|
+
} catch (_) {
|
|
965
|
+
result = false;
|
|
966
|
+
}
|
|
967
|
+
const ret = result;
|
|
968
|
+
return ret;
|
|
969
|
+
},
|
|
824
970
|
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
825
971
|
let result;
|
|
826
972
|
try {
|
|
@@ -935,6 +1081,10 @@ function __wbg_get_imports() {
|
|
|
935
1081
|
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
936
1082
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
937
1083
|
},
|
|
1084
|
+
__wbg_push_8ffdcb2063340ba5: function(arg0, arg1) {
|
|
1085
|
+
const ret = arg0.push(arg1);
|
|
1086
|
+
return ret;
|
|
1087
|
+
},
|
|
938
1088
|
__wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
|
|
939
1089
|
const ret = arg0.queueMicrotask;
|
|
940
1090
|
return ret;
|
|
@@ -960,6 +1110,9 @@ function __wbg_get_imports() {
|
|
|
960
1110
|
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
961
1111
|
arg0[arg1] = arg2;
|
|
962
1112
|
},
|
|
1113
|
+
__wbg_set_cc56eefd2dd91957: function(arg0, arg1, arg2) {
|
|
1114
|
+
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
1115
|
+
},
|
|
963
1116
|
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
964
1117
|
arg0[arg1 >>> 0] = arg2;
|
|
965
1118
|
},
|
|
@@ -987,10 +1140,18 @@ function __wbg_get_imports() {
|
|
|
987
1140
|
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
988
1141
|
return ret;
|
|
989
1142
|
},
|
|
1143
|
+
__wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
|
|
1144
|
+
const ret = arg0.then(arg1, arg2);
|
|
1145
|
+
return ret;
|
|
1146
|
+
},
|
|
990
1147
|
__wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
|
|
991
1148
|
const ret = arg0.then(arg1);
|
|
992
1149
|
return ret;
|
|
993
1150
|
},
|
|
1151
|
+
__wbg_toString_964ff7fe6eca8362: function(arg0) {
|
|
1152
|
+
const ret = arg0.toString();
|
|
1153
|
+
return ret;
|
|
1154
|
+
},
|
|
994
1155
|
__wbg_value_0546255b415e96c1: function(arg0) {
|
|
995
1156
|
const ret = arg0.value;
|
|
996
1157
|
return ret;
|
|
@@ -1003,7 +1164,7 @@ function __wbg_get_imports() {
|
|
|
1003
1164
|
console.warn(arg0, arg1, arg2, arg3);
|
|
1004
1165
|
},
|
|
1005
1166
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1006
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1167
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 669, function: Function { arguments: [Externref], shim_idx: 670, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1007
1168
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h358403ff5b31de35, wasm_bindgen__convert__closures_____invoke__h4b881ac518a5291a);
|
|
1008
1169
|
return ret;
|
|
1009
1170
|
},
|
package/diaryx_wasm_bg.wasm
CHANGED
|
Binary file
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const now_timestamp: () => [number, number];
|
|
5
|
-
export const today_formatted: (a: number, b: number) => [number, number];
|
|
6
4
|
export const __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
7
6
|
export const jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
|
|
8
7
|
export const jsasyncfilesystem_new: (a: any) => number;
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const __wbg_wasmsyncclient_free: (a: number, b: number) => void;
|
|
12
|
-
export const diaryxbackend_create: (a: number, b: number) => any;
|
|
13
|
-
export const diaryxbackend_createInMemory: () => [number, number, number];
|
|
14
|
-
export const diaryxbackend_createSyncClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
15
|
-
export const diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
16
|
-
export const diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
17
|
-
export const diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
18
|
-
export const diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
19
|
-
export const diaryxbackend_getConfig: (a: number) => any;
|
|
20
|
-
export const diaryxbackend_hasNativeSync: (a: number) => number;
|
|
21
|
-
export const diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
22
|
-
export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
23
|
-
export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
24
|
-
export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
25
|
-
export const diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
26
|
-
export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
27
|
-
export const diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
8
|
+
export const now_timestamp: () => [number, number];
|
|
9
|
+
export const today_formatted: (a: number, b: number) => [number, number];
|
|
28
10
|
export const wasmsyncclient_focusFiles: (a: number, b: number, c: number) => void;
|
|
29
11
|
export const wasmsyncclient_getServerUrl: (a: number) => [number, number];
|
|
30
12
|
export const wasmsyncclient_getWorkspaceId: (a: number) => [number, number];
|
|
@@ -41,7 +23,29 @@ export const wasmsyncclient_pollOutgoingBinary: (a: number) => any;
|
|
|
41
23
|
export const wasmsyncclient_pollOutgoingText: (a: number) => [number, number];
|
|
42
24
|
export const wasmsyncclient_queueLocalUpdate: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
43
25
|
export const wasmsyncclient_setSessionCode: (a: number, b: number, c: number) => void;
|
|
26
|
+
export const wasmsyncclient_syncBodyFiles: (a: number, b: number, c: number) => any;
|
|
44
27
|
export const wasmsyncclient_unfocusFiles: (a: number, b: number, c: number) => void;
|
|
28
|
+
export const __wbg_diaryxbackend_free: (a: number, b: number) => void;
|
|
29
|
+
export const diaryxbackend_create: (a: number, b: number) => any;
|
|
30
|
+
export const diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
|
|
31
|
+
export const diaryxbackend_createInMemory: () => [number, number, number];
|
|
32
|
+
export const diaryxbackend_createSyncClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
33
|
+
export const diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
|
|
34
|
+
export const diaryxbackend_eventSubscriberCount: (a: number) => number;
|
|
35
|
+
export const diaryxbackend_execute: (a: number, b: number, c: number) => any;
|
|
36
|
+
export const diaryxbackend_executeJs: (a: number, b: any) => any;
|
|
37
|
+
export const diaryxbackend_getConfig: (a: number) => any;
|
|
38
|
+
export const diaryxbackend_hasNativeSync: (a: number) => number;
|
|
39
|
+
export const diaryxbackend_isCrdtEnabled: (a: number) => number;
|
|
40
|
+
export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
|
|
41
|
+
export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
|
|
42
|
+
export const diaryxbackend_parseDayOneJson: (a: number, b: number, c: number) => [number, number, number, number];
|
|
43
|
+
export const diaryxbackend_parseMarkdownFile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
44
|
+
export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
|
|
45
|
+
export const diaryxbackend_saveConfig: (a: number, b: any) => any;
|
|
46
|
+
export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
|
|
47
|
+
export const diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
|
|
48
|
+
export const init: () => void;
|
|
45
49
|
export const wasm_bindgen__closure__destroy__h358403ff5b31de35: (a: number, b: number) => void;
|
|
46
50
|
export const wasm_bindgen__convert__closures_____invoke__h9824f9855d7aa260: (a: number, b: number, c: any, d: any) => void;
|
|
47
51
|
export const wasm_bindgen__convert__closures_____invoke__h4b881ac518a5291a: (a: number, b: number, c: any) => void;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@diaryx/wasm-node",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for Diaryx core functionality",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0-dev.4c342c8",
|
|
6
6
|
"license": "SEE LICENSE IN ../../LICENSE.md",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|