@diaryx/wasm-node 1.5.1-dev.b19eb11 → 1.6.0-dev.288ba5d

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 CHANGED
@@ -79,6 +79,10 @@ Sync and publish functionality are provided by Extism guest plugins
79
79
  plugin manager. CRDT commands are routed to the sync plugin via the frontend
80
80
  command router before reaching the WASM backend.
81
81
 
82
+ `DiaryxBackend` itself does not expose native sync or CRDT compatibility
83
+ methods such as `startSync`, `stopSync`, `hasNativeSync`, `setCrdtEnabled`, or
84
+ `isCrdtEnabled`; the backend surface is storage plus the unified command API.
85
+
82
86
  ### Storage Backends
83
87
 
84
88
  Unlike the CLI and Tauri backends which use `RealFileSystem` (native filesystem),
@@ -196,7 +200,7 @@ const allFiles = await asyncFs.list_all_files_recursive("workspace");
196
200
  const data = await asyncFs.read_binary("workspace/image.png");
197
201
  await asyncFs.write_binary("workspace/copy.png", data);
198
202
 
199
- // Bulk operations for IndexedDB sync
203
+ // Bulk operations for exporting/importing browser storage
200
204
  const backupData = await asyncFs.get_backup_data();
201
205
  // ... persist to IndexedDB ...
202
206
  await asyncFs.restore_from_backup(backupData);
@@ -223,160 +227,60 @@ While the underlying `InMemoryFileSystem` is synchronous, `DiaryxAsyncFilesystem
223
227
  2. Allows for future integration with truly async operations
224
228
  3. Works well with JavaScript's event loop
225
229
 
226
- ### Diaryx (Command API with CRDT)
230
+ ### DiaryxBackend Command API
227
231
 
228
- The `Diaryx` class provides a unified command API that includes CRDT operations for real-time collaboration. Commands are executed via `execute()` (returns typed result) or `executeJs()` (returns JS-friendly object).
232
+ `DiaryxBackend` is the main browser storage entry point. It executes
233
+ `diaryx_core::Command` values through `execute()` and returns serialized
234
+ `diaryx_core::Response` values.
229
235
 
230
236
  ```javascript
231
- import init, { Diaryx } from "./wasm/diaryx_wasm.js";
237
+ import init, { DiaryxBackend } from "./wasm/diaryx_wasm.js";
232
238
 
233
239
  await init();
234
- const diaryx = new Diaryx();
235
-
236
- // All CRDT commands use the execute/executeJs pattern
237
- ```
238
-
239
- #### CRDT Workspace Operations
240
-
241
- ```javascript
242
- // Set file metadata in the CRDT workspace
243
- await diaryx.executeJs({
244
- type: "SetFileMetadata",
245
- path: "notes/my-note.md",
246
- metadata: {
247
- title: "My Note",
248
- audience: ["public"],
249
- part_of: "README.md",
240
+ const backend = await DiaryxBackend.createOpfs("My Journal");
241
+
242
+ const tree = JSON.parse(await backend.execute(JSON.stringify({
243
+ type: "GetWorkspaceTree",
244
+ params: {
245
+ path: ".",
246
+ depth: null,
247
+ audience: null,
250
248
  },
251
- });
252
-
253
- // Get file metadata
254
- const result = await diaryx.executeJs({
255
- type: "GetFileMetadata",
256
- path: "notes/my-note.md",
257
- });
258
- console.log(result.metadata); // { title: "My Note", ... }
259
-
260
- // List all files in workspace
261
- const files = await diaryx.executeJs({ type: "ListFiles" });
262
- console.log(files.files); // ["notes/my-note.md", ...]
263
-
264
- // Remove a file from workspace
265
- await diaryx.executeJs({
266
- type: "RemoveFile",
267
- path: "notes/my-note.md",
268
- });
269
- ```
270
-
271
- #### CRDT Body Document Operations
272
-
273
- ```javascript
274
- // Set document body content
275
- await diaryx.executeJs({
276
- type: "SetBody",
277
- path: "notes/my-note.md",
278
- content: "# Hello World\n\nThis is my note.",
279
- });
280
-
281
- // Get document body
282
- const body = await diaryx.executeJs({
283
- type: "GetBody",
284
- path: "notes/my-note.md",
285
- });
286
- console.log(body.content);
287
-
288
- // Insert text at position (collaborative editing)
289
- await diaryx.executeJs({
290
- type: "InsertAt",
291
- path: "notes/my-note.md",
292
- position: 0,
293
- text: "Prefix: ",
294
- });
249
+ })));
250
+
251
+ await backend.execute(JSON.stringify({
252
+ type: "CreateEntry",
253
+ params: {
254
+ path: "notes/my-note.md",
255
+ options: {
256
+ title: "My Note",
257
+ part_of: null,
258
+ template: null,
259
+ },
260
+ },
261
+ }));
295
262
 
296
- // Delete text range
297
- await diaryx.executeJs({
298
- type: "DeleteRange",
299
- path: "notes/my-note.md",
300
- start: 0,
301
- end: 8,
302
- });
263
+ await backend.writeBinary("_attachments/photo.png", photoBytes);
264
+ const photo = await backend.readBinary("_attachments/photo.png");
303
265
  ```
304
266
 
305
- #### CRDT Sync Operations
306
-
307
- For synchronizing with Hocuspocus or other Y.js-compatible servers:
308
-
309
- ```javascript
310
- // Get sync state (state vector) for initial handshake
311
- const syncState = await diaryx.executeJs({
312
- type: "GetSyncState",
313
- doc_type: "workspace", // or "body"
314
- doc_name: null, // required for "body" type
315
- });
316
- const stateVector = syncState.state_vector; // Uint8Array
317
-
318
- // Apply remote update from server
319
- await diaryx.executeJs({
320
- type: "ApplyRemoteUpdate",
321
- doc_type: "workspace",
322
- doc_name: null,
323
- update: remoteUpdateBytes, // Uint8Array from WebSocket
324
- });
267
+ The frontend normally calls this through `apps/web/src/lib/backend/api.ts` and
268
+ `wasmWorkerNew.ts`, so application code should prefer those host abstractions
269
+ over direct WASM calls.
325
270
 
326
- // Encode full state to send to server
327
- const state = await diaryx.executeJs({
328
- type: "EncodeState",
329
- doc_type: "workspace",
330
- doc_name: null,
331
- });
332
- sendToServer(state.state); // Uint8Array
333
-
334
- // Encode incremental update since a state vector
335
- const diff = await diaryx.executeJs({
336
- type: "EncodeStateAsUpdate",
337
- doc_type: "workspace",
338
- doc_name: null,
339
- state_vector: remoteStateVector, // Uint8Array
340
- });
341
- sendToServer(diff.update); // Uint8Array
342
- ```
271
+ #### Event Subscription
343
272
 
344
- #### Version History
273
+ The backend emits local filesystem events through `onFileSystemEvent()`:
345
274
 
346
275
  ```javascript
347
- // Get version history for a document
348
- const history = await diaryx.executeJs({
349
- type: "GetHistory",
350
- doc_type: "workspace", // or "body"
351
- doc_name: null, // required for "body" type
276
+ const id = backend.onFileSystemEvent((eventJson) => {
277
+ const event = JSON.parse(eventJson);
278
+ console.log("file event", event.type, event.path);
352
279
  });
353
280
 
354
- for (const entry of history.entries) {
355
- console.log(`Version ${entry.version} at ${entry.timestamp}`);
356
- console.log(` Origin: ${entry.origin}`); // "local" or "remote"
357
- console.log(` Size: ${entry.update.length} bytes`);
358
- }
359
-
360
- // Restore to a specific version (time travel)
361
- await diaryx.executeJs({
362
- type: "RestoreToVersion",
363
- doc_type: "workspace",
364
- doc_name: null,
365
- version: 5,
366
- });
281
+ backend.offFileSystemEvent(id);
367
282
  ```
368
283
 
369
- #### Document Types
370
-
371
- CRDT operations use `doc_type` to specify which document to operate on:
372
-
373
-
374
- | doc_type | doc_name | Description |
375
- | ----------- | --------- | ------------------------------------------ |
376
- | `workspace` | `null` | The workspace file hierarchy metadata |
377
- | `body` | file path | Per-file body content (e.g., `notes/a.md`) |
378
-
379
-
380
284
  ## Node.js / Obsidian / Electron Usage
381
285
 
382
286
  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.
package/diaryx_wasm.d.ts CHANGED
@@ -52,10 +52,8 @@ export interface JsFileSystemCallbacks {
52
52
  export class AuthClient {
53
53
  free(): void;
54
54
  [Symbol.dispose](): void;
55
- createWorkspace(name: string): Promise<any>;
56
55
  deleteAccount(): Promise<void>;
57
56
  deleteDevice(device_id: string): Promise<void>;
58
- deleteWorkspace(workspace_id: string): Promise<void>;
59
57
  getDevices(): Promise<any>;
60
58
  getMe(): Promise<any>;
61
59
  /**
@@ -76,7 +74,6 @@ export class AuthClient {
76
74
  constructor(server_url: string, callbacks: AuthCallbacks);
77
75
  refreshToken(): Promise<any>;
78
76
  renameDevice(device_id: string, new_name: string): Promise<void>;
79
- renameWorkspace(workspace_id: string, new_name: string): Promise<void>;
80
77
  requestMagicLink(email: string): Promise<any>;
81
78
  verifyCode(code: string, email: string, device_name?: string | null, replace_device_id?: string | null): Promise<any>;
82
79
  verifyMagicLink(token: string, device_name?: string | null, replace_device_id?: string | null): Promise<any>;
@@ -157,15 +154,6 @@ export class DiaryxBackend {
157
154
  * ```
158
155
  */
159
156
  execute(command_json: string): Promise<string>;
160
- /**
161
- * Check if this backend has native sync support.
162
- * Always false — sync is handled by the Extism sync plugin loaded at runtime.
163
- */
164
- hasNativeSync(): boolean;
165
- /**
166
- * Always returns false — CrdtFs is not used; sync handled by Extism plugin.
167
- */
168
- isCrdtEnabled(): boolean;
169
157
  /**
170
158
  * Unsubscribe from filesystem events.
171
159
  *
@@ -208,10 +196,6 @@ export class DiaryxBackend {
208
196
  * Returns data as Uint8Array for efficient handling without base64 encoding.
209
197
  */
210
198
  readBinary(path: string): Promise<any>;
211
- /**
212
- * No-op — CrdtFs is not used; sync handled by Extism plugin.
213
- */
214
- setCrdtEnabled(_enabled: boolean): void;
215
199
  /**
216
200
  * Write binary file.
217
201
  *
@@ -318,10 +302,8 @@ export interface InitOutput {
318
302
  readonly __wbg_authclient_free: (a: number, b: number) => void;
319
303
  readonly __wbg_diaryxbackend_free: (a: number, b: number) => void;
320
304
  readonly __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
321
- readonly authclient_createWorkspace: (a: number, b: number, c: number) => any;
322
305
  readonly authclient_deleteAccount: (a: number) => any;
323
306
  readonly authclient_deleteDevice: (a: number, b: number, c: number) => any;
324
- readonly authclient_deleteWorkspace: (a: number, b: number, c: number) => any;
325
307
  readonly authclient_getDevices: (a: number) => any;
326
308
  readonly authclient_getMe: (a: number) => any;
327
309
  readonly authclient_getMetadata: (a: number) => any;
@@ -330,7 +312,6 @@ export interface InitOutput {
330
312
  readonly authclient_new: (a: number, b: number, c: any) => number;
331
313
  readonly authclient_refreshToken: (a: number) => any;
332
314
  readonly authclient_renameDevice: (a: number, b: number, c: number, d: number, e: number) => any;
333
- readonly authclient_renameWorkspace: (a: number, b: number, c: number, d: number, e: number) => any;
334
315
  readonly authclient_requestMagicLink: (a: number, b: number, c: number) => any;
335
316
  readonly authclient_serverUrl: (a: number) => [number, number];
336
317
  readonly authclient_verifyCode: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
@@ -341,11 +322,9 @@ export interface InitOutput {
341
322
  readonly diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
342
323
  readonly diaryxbackend_eventSubscriberCount: (a: number) => number;
343
324
  readonly diaryxbackend_execute: (a: number, b: number, c: number) => any;
344
- readonly diaryxbackend_hasNativeSync: (a: number) => number;
345
325
  readonly diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
346
326
  readonly diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
347
327
  readonly diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
348
- readonly diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
349
328
  readonly diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
350
329
  readonly jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
351
330
  readonly jsasyncfilesystem_new: (a: any) => number;
@@ -370,11 +349,10 @@ export interface InitOutput {
370
349
  readonly now_timestamp: () => [number, number];
371
350
  readonly today_formatted: (a: number, b: number) => [number, number];
372
351
  readonly init: () => void;
373
- readonly diaryxbackend_isCrdtEnabled: (a: number) => number;
374
352
  readonly namespaceclient_new: (a: number, b: number, c: any) => number;
375
353
  readonly __wbg_namespaceclient_free: (a: number, b: number) => void;
376
- readonly wasm_bindgen__convert__closures_____invoke__ha36570cafae1e03d: (a: number, b: number, c: any) => [number, number];
377
- readonly wasm_bindgen__convert__closures_____invoke__h728ab8e0de987bd1: (a: number, b: number, c: any, d: any) => void;
354
+ readonly wasm_bindgen__convert__closures_____invoke__h81bafde9f0567339: (a: number, b: number, c: any) => [number, number];
355
+ readonly wasm_bindgen__convert__closures_____invoke__h18406d6ac130c616: (a: number, b: number, c: any, d: any) => void;
378
356
  readonly __wbindgen_malloc: (a: number, b: number) => number;
379
357
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
380
358
  readonly __wbindgen_exn_store: (a: number) => void;
package/diaryx_wasm.js CHANGED
@@ -18,16 +18,6 @@ export class AuthClient {
18
18
  const ptr = this.__destroy_into_raw();
19
19
  wasm.__wbg_authclient_free(ptr, 0);
20
20
  }
21
- /**
22
- * @param {string} name
23
- * @returns {Promise<any>}
24
- */
25
- createWorkspace(name) {
26
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
27
- const len0 = WASM_VECTOR_LEN;
28
- const ret = wasm.authclient_createWorkspace(this.__wbg_ptr, ptr0, len0);
29
- return ret;
30
- }
31
21
  /**
32
22
  * @returns {Promise<void>}
33
23
  */
@@ -45,16 +35,6 @@ export class AuthClient {
45
35
  const ret = wasm.authclient_deleteDevice(this.__wbg_ptr, ptr0, len0);
46
36
  return ret;
47
37
  }
48
- /**
49
- * @param {string} workspace_id
50
- * @returns {Promise<void>}
51
- */
52
- deleteWorkspace(workspace_id) {
53
- const ptr0 = passStringToWasm0(workspace_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
54
- const len0 = WASM_VECTOR_LEN;
55
- const ret = wasm.authclient_deleteWorkspace(this.__wbg_ptr, ptr0, len0);
56
- return ret;
57
- }
58
38
  /**
59
39
  * @returns {Promise<any>}
60
40
  */
@@ -104,7 +84,7 @@ export class AuthClient {
104
84
  const ptr0 = passStringToWasm0(server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
85
  const len0 = WASM_VECTOR_LEN;
106
86
  const ret = wasm.authclient_new(ptr0, len0, callbacks);
107
- this.__wbg_ptr = ret >>> 0;
87
+ this.__wbg_ptr = ret;
108
88
  AuthClientFinalization.register(this, this.__wbg_ptr, this);
109
89
  return this;
110
90
  }
@@ -128,19 +108,6 @@ export class AuthClient {
128
108
  const ret = wasm.authclient_renameDevice(this.__wbg_ptr, ptr0, len0, ptr1, len1);
129
109
  return ret;
130
110
  }
131
- /**
132
- * @param {string} workspace_id
133
- * @param {string} new_name
134
- * @returns {Promise<void>}
135
- */
136
- renameWorkspace(workspace_id, new_name) {
137
- const ptr0 = passStringToWasm0(workspace_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
- const len0 = WASM_VECTOR_LEN;
139
- const ptr1 = passStringToWasm0(new_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
140
- const len1 = WASM_VECTOR_LEN;
141
- const ret = wasm.authclient_renameWorkspace(this.__wbg_ptr, ptr0, len0, ptr1, len1);
142
- return ret;
143
- }
144
111
  /**
145
112
  * @param {string} email
146
113
  * @returns {Promise<any>}
@@ -226,7 +193,6 @@ if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.
226
193
  */
227
194
  export class DiaryxBackend {
228
195
  static __wrap(ptr) {
229
- ptr = ptr >>> 0;
230
196
  const obj = Object.create(DiaryxBackend.prototype);
231
197
  obj.__wbg_ptr = ptr;
232
198
  DiaryxBackendFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -331,23 +297,6 @@ export class DiaryxBackend {
331
297
  const ret = wasm.diaryxbackend_execute(this.__wbg_ptr, ptr0, len0);
332
298
  return ret;
333
299
  }
334
- /**
335
- * Check if this backend has native sync support.
336
- * Always false — sync is handled by the Extism sync plugin loaded at runtime.
337
- * @returns {boolean}
338
- */
339
- hasNativeSync() {
340
- const ret = wasm.diaryxbackend_hasNativeSync(this.__wbg_ptr);
341
- return ret !== 0;
342
- }
343
- /**
344
- * Always returns false — CrdtFs is not used; sync handled by Extism plugin.
345
- * @returns {boolean}
346
- */
347
- isCrdtEnabled() {
348
- const ret = wasm.diaryxbackend_isCrdtEnabled(this.__wbg_ptr);
349
- return ret !== 0;
350
- }
351
300
  /**
352
301
  * Unsubscribe from filesystem events.
353
302
  *
@@ -407,13 +356,6 @@ export class DiaryxBackend {
407
356
  const ret = wasm.diaryxbackend_readBinary(this.__wbg_ptr, ptr0, len0);
408
357
  return ret;
409
358
  }
410
- /**
411
- * No-op — CrdtFs is not used; sync handled by Extism plugin.
412
- * @param {boolean} _enabled
413
- */
414
- setCrdtEnabled(_enabled) {
415
- wasm.diaryxbackend_setCrdtEnabled(this.__wbg_ptr, _enabled);
416
- }
417
359
  /**
418
360
  * Write binary file.
419
361
  *
@@ -464,7 +406,7 @@ export class JsAsyncFileSystem {
464
406
  */
465
407
  constructor(callbacks) {
466
408
  const ret = wasm.jsasyncfilesystem_new(callbacks);
467
- this.__wbg_ptr = ret >>> 0;
409
+ this.__wbg_ptr = ret;
468
410
  JsAsyncFileSystemFinalization.register(this, this.__wbg_ptr, this);
469
411
  return this;
470
412
  }
@@ -635,7 +577,7 @@ export class NamespaceClient {
635
577
  const ptr0 = passStringToWasm0(server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
636
578
  const len0 = WASM_VECTOR_LEN;
637
579
  const ret = wasm.namespaceclient_new(ptr0, len0, callbacks);
638
- this.__wbg_ptr = ret >>> 0;
580
+ this.__wbg_ptr = ret;
639
581
  NamespaceClientFinalization.register(this, this.__wbg_ptr, this);
640
582
  return this;
641
583
  }
@@ -803,42 +745,42 @@ export function today_formatted(format) {
803
745
  function __wbg_get_imports() {
804
746
  const import0 = {
805
747
  __proto__: null,
806
- __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
748
+ __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
807
749
  const v = arg0;
808
750
  const ret = typeof(v) === 'boolean' ? v : undefined;
809
751
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
810
752
  },
811
- __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
753
+ __wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
812
754
  const ret = debugString(arg1);
813
755
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
814
756
  const len1 = WASM_VECTOR_LEN;
815
757
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
816
758
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
817
759
  },
818
- __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
760
+ __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
819
761
  const ret = typeof(arg0) === 'function';
820
762
  return ret;
821
763
  },
822
- __wbg___wbindgen_is_null_52ff4ec04186736f: function(arg0) {
764
+ __wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
823
765
  const ret = arg0 === null;
824
766
  return ret;
825
767
  },
826
- __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
768
+ __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
827
769
  const val = arg0;
828
770
  const ret = typeof(val) === 'object' && val !== null;
829
771
  return ret;
830
772
  },
831
- __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
773
+ __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
832
774
  const ret = arg0 === undefined;
833
775
  return ret;
834
776
  },
835
- __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
777
+ __wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
836
778
  const obj = arg1;
837
779
  const ret = typeof(obj) === 'number' ? obj : undefined;
838
780
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
839
781
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
840
782
  },
841
- __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
783
+ __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
842
784
  const obj = arg1;
843
785
  const ret = typeof(obj) === 'string' ? obj : undefined;
844
786
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -846,62 +788,62 @@ function __wbg_get_imports() {
846
788
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
847
789
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
848
790
  },
849
- __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
791
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
850
792
  throw new Error(getStringFromWasm0(arg0, arg1));
851
793
  },
852
- __wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
794
+ __wbg__wbg_cb_unref_61db23ac97f16c31: function(arg0) {
853
795
  arg0._wbg_cb_unref();
854
796
  },
855
- __wbg_apply_4c35bd236dda9c14: function() { return handleError(function (arg0, arg1, arg2) {
797
+ __wbg_apply_292b6d94e4f92b15: function() { return handleError(function (arg0, arg1, arg2) {
856
798
  const ret = arg0.apply(arg1, arg2);
857
799
  return ret;
858
800
  }, arguments); },
859
- __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
860
- const ret = arg0.call(arg1);
801
+ __wbg_call_40e4174f169eaca7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
802
+ const ret = arg0.call(arg1, arg2, arg3);
861
803
  return ret;
862
804
  }, arguments); },
863
- __wbg_call_86e39d65afc3d9db: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
805
+ __wbg_call_6e37a87ff352da3d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
864
806
  const ret = arg0.call(arg1, arg2, arg3, arg4);
865
807
  return ret;
866
808
  }, arguments); },
867
- __wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
868
- const ret = arg0.call(arg1, arg2);
809
+ __wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
810
+ const ret = arg0.call(arg1);
869
811
  return ret;
870
812
  }, arguments); },
871
- __wbg_call_bb28efe6b2f55b86: function() { return handleError(function (arg0, arg1, arg2, arg3) {
872
- const ret = arg0.call(arg1, arg2, arg3);
813
+ __wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
814
+ const ret = arg0.call(arg1, arg2);
873
815
  return ret;
874
816
  }, arguments); },
875
- __wbg_debug_4e190d233ee2e0d8: function(arg0, arg1, arg2, arg3) {
817
+ __wbg_debug_6d96d354ecb8cdb3: function(arg0, arg1, arg2, arg3) {
876
818
  console.debug(arg0, arg1, arg2, arg3);
877
819
  },
878
820
  __wbg_diaryxbackend_new: function(arg0) {
879
821
  const ret = DiaryxBackend.__wrap(arg0);
880
822
  return ret;
881
823
  },
882
- __wbg_error_a6a4bb2525a88971: function(arg0, arg1, arg2, arg3) {
824
+ __wbg_error_9ad1450feb5d541d: function(arg0, arg1, arg2, arg3) {
883
825
  console.error(arg0, arg1, arg2, arg3);
884
826
  },
885
- __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
827
+ __wbg_getTime_00b3f7db575e4ef5: function(arg0) {
886
828
  const ret = arg0.getTime();
887
829
  return ret;
888
830
  },
889
- __wbg_getTimezoneOffset_31f57a5389d0d57c: function(arg0) {
831
+ __wbg_getTimezoneOffset_08e2892156231088: function(arg0) {
890
832
  const ret = arg0.getTimezoneOffset();
891
833
  return ret;
892
834
  },
893
- __wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
894
- const ret = Reflect.get(arg0, arg1);
895
- return ret;
896
- }, arguments); },
897
- __wbg_get_8360291721e2339f: function(arg0, arg1) {
835
+ __wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
898
836
  const ret = arg0[arg1 >>> 0];
899
837
  return ret;
900
838
  },
901
- __wbg_info_e1c3400f7bf783dc: function(arg0, arg1, arg2, arg3) {
839
+ __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
840
+ const ret = Reflect.get(arg0, arg1);
841
+ return ret;
842
+ }, arguments); },
843
+ __wbg_info_5cfb3f6c22c53cf9: function(arg0, arg1, arg2, arg3) {
902
844
  console.info(arg0, arg1, arg2, arg3);
903
845
  },
904
- __wbg_instanceof_Object_7c99480a1cdfb911: function(arg0) {
846
+ __wbg_instanceof_Object_873c13f9f41aec78: function(arg0) {
905
847
  let result;
906
848
  try {
907
849
  result = arg0 instanceof Object;
@@ -911,7 +853,7 @@ function __wbg_get_imports() {
911
853
  const ret = result;
912
854
  return ret;
913
855
  },
914
- __wbg_instanceof_Promise_78658358a9b27cd4: function(arg0) {
856
+ __wbg_instanceof_Promise_d0db99486956c8e8: function(arg0) {
915
857
  let result;
916
858
  try {
917
859
  result = arg0 instanceof Promise;
@@ -921,7 +863,7 @@ function __wbg_get_imports() {
921
863
  const ret = result;
922
864
  return ret;
923
865
  },
924
- __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
866
+ __wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
925
867
  let result;
926
868
  try {
927
869
  result = arg0 instanceof Uint8Array;
@@ -931,53 +873,53 @@ function __wbg_get_imports() {
931
873
  const ret = result;
932
874
  return ret;
933
875
  },
934
- __wbg_isArray_c3109d14ffc06469: function(arg0) {
876
+ __wbg_isArray_67c2c9c4313f4448: function(arg0) {
935
877
  const ret = Array.isArray(arg0);
936
878
  return ret;
937
879
  },
938
- __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
880
+ __wbg_length_4a591ecaa01354d9: function(arg0) {
939
881
  const ret = arg0.length;
940
882
  return ret;
941
883
  },
942
- __wbg_length_9f1775224cf1d815: function(arg0) {
884
+ __wbg_length_66f1a4b2e9026940: function(arg0) {
943
885
  const ret = arg0.length;
944
886
  return ret;
945
887
  },
946
- __wbg_log_465fe3993e4051bf: function(arg0, arg1, arg2, arg3) {
888
+ __wbg_log_d5e0f90a3ac097e3: function(arg0, arg1, arg2, arg3) {
947
889
  console.log(arg0, arg1, arg2, arg3);
948
890
  },
949
- __wbg_new_0_4d657201ced14de3: function() {
891
+ __wbg_new_0_445c13a750296eb6: function() {
950
892
  const ret = new Date();
951
893
  return ret;
952
894
  },
953
- __wbg_new_5e360d2ff7b9e1c3: function(arg0, arg1) {
895
+ __wbg_new_50bb5ebeecef71a8: function(arg0, arg1) {
954
896
  const ret = new Error(getStringFromWasm0(arg0, arg1));
955
897
  return ret;
956
898
  },
957
- __wbg_new_682678e2f47e32bc: function() {
958
- const ret = new Array();
959
- return ret;
960
- },
961
- __wbg_new_7913666fe5070684: function(arg0) {
899
+ __wbg_new_6d75fd236f920a62: function(arg0) {
962
900
  const ret = new Date(arg0);
963
901
  return ret;
964
902
  },
965
- __wbg_new_aa8d0fa9762c29bd: function() {
903
+ __wbg_new_ce1ab61c1c2b300d: function() {
966
904
  const ret = new Object();
967
905
  return ret;
968
906
  },
969
- __wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
907
+ __wbg_new_d90091b82fdf5b91: function() {
908
+ const ret = new Array();
909
+ return ret;
910
+ },
911
+ __wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
970
912
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
971
913
  return ret;
972
914
  },
973
- __wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
915
+ __wbg_new_typed_bf31d18f92484486: function(arg0, arg1) {
974
916
  try {
975
917
  var state0 = {a: arg0, b: arg1};
976
918
  var cb0 = (arg0, arg1) => {
977
919
  const a = state0.a;
978
920
  state0.a = 0;
979
921
  try {
980
- return wasm_bindgen__convert__closures_____invoke__h728ab8e0de987bd1(a, state0.b, arg0, arg1);
922
+ return wasm_bindgen__convert__closures_____invoke__h18406d6ac130c616(a, state0.b, arg0, arg1);
981
923
  } finally {
982
924
  state0.a = a;
983
925
  }
@@ -988,77 +930,77 @@ function __wbg_get_imports() {
988
930
  state0.a = 0;
989
931
  }
990
932
  },
991
- __wbg_new_with_length_8c854e41ea4dae9b: function(arg0) {
933
+ __wbg_new_with_length_36a4998e27b014c5: function(arg0) {
992
934
  const ret = new Uint8Array(arg0 >>> 0);
993
935
  return ret;
994
936
  },
995
- __wbg_parse_1bbc9c053611d0a7: function() { return handleError(function (arg0, arg1) {
937
+ __wbg_parse_03863847d06c4e89: function() { return handleError(function (arg0, arg1) {
996
938
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
997
939
  return ret;
998
940
  }, arguments); },
999
- __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
941
+ __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
1000
942
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1001
943
  },
1002
- __wbg_push_471a5b068a5295f6: function(arg0, arg1) {
944
+ __wbg_push_a6822215aa43e71c: function(arg0, arg1) {
1003
945
  const ret = arg0.push(arg1);
1004
946
  return ret;
1005
947
  },
1006
- __wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
948
+ __wbg_queueMicrotask_35c611f4a14830b2: function(arg0) {
1007
949
  queueMicrotask(arg0);
1008
950
  },
1009
- __wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
951
+ __wbg_queueMicrotask_404ed0a58e0b63cc: function(arg0) {
1010
952
  const ret = arg0.queueMicrotask;
1011
953
  return ret;
1012
954
  },
1013
- __wbg_resolve_e6c466bc1052f16c: function(arg0) {
955
+ __wbg_resolve_25a7e548d5881dca: function(arg0) {
1014
956
  const ret = Promise.resolve(arg0);
1015
957
  return ret;
1016
958
  },
1017
- __wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
959
+ __wbg_set_29c99a8aac1c01e5: function(arg0, arg1, arg2) {
960
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
961
+ },
962
+ __wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
1018
963
  const ret = Reflect.set(arg0, arg1, arg2);
1019
964
  return ret;
1020
965
  }, arguments); },
1021
- __wbg_set_3d484eb794afec82: function(arg0, arg1, arg2) {
1022
- arg0.set(getArrayU8FromWasm0(arg1, arg2));
1023
- },
1024
- __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
966
+ __wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
1025
967
  const ret = typeof global === 'undefined' ? null : global;
1026
968
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1027
969
  },
1028
- __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
970
+ __wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
1029
971
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
1030
972
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1031
973
  },
1032
- __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
974
+ __wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
1033
975
  const ret = typeof self === 'undefined' ? null : self;
1034
976
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1035
977
  },
1036
- __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
978
+ __wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
1037
979
  const ret = typeof window === 'undefined' ? null : window;
1038
980
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1039
981
  },
1040
- __wbg_stringify_91082ed7a5a5769e: function() { return handleError(function (arg0) {
982
+ __wbg_stringify_8286df6dcc591521: function() { return handleError(function (arg0) {
1041
983
  const ret = JSON.stringify(arg0);
1042
984
  return ret;
1043
985
  }, arguments); },
1044
- __wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
986
+ __wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
1045
987
  const ret = arg0.then(arg1, arg2);
1046
988
  return ret;
1047
989
  },
1048
- __wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
990
+ __wbg_then_ac7b025999b52837: function(arg0, arg1) {
1049
991
  const ret = arg0.then(arg1);
1050
992
  return ret;
1051
993
  },
1052
- __wbg_toString_306ed0b9f320c1ca: function(arg0) {
994
+ __wbg_toString_1fcc5569307bd3f3: function(arg0) {
1053
995
  const ret = arg0.toString();
1054
996
  return ret;
1055
997
  },
1056
- __wbg_warn_ad997e36628bd23a: function(arg0, arg1, arg2, arg3) {
998
+ __wbg_warn_c49a7a9581bf8bea: function(arg0, arg1, arg2, arg3) {
1057
999
  console.warn(arg0, arg1, arg2, arg3);
1058
1000
  },
1059
1001
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1060
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 611, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1061
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha36570cafae1e03d);
1002
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 585, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1003
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h81bafde9f0567339);
1062
1004
  return ret;
1063
1005
  },
1064
1006
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -1087,29 +1029,29 @@ function __wbg_get_imports() {
1087
1029
  };
1088
1030
  }
1089
1031
 
1090
- function wasm_bindgen__convert__closures_____invoke__ha36570cafae1e03d(arg0, arg1, arg2) {
1091
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__ha36570cafae1e03d(arg0, arg1, arg2);
1032
+ function wasm_bindgen__convert__closures_____invoke__h81bafde9f0567339(arg0, arg1, arg2) {
1033
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h81bafde9f0567339(arg0, arg1, arg2);
1092
1034
  if (ret[1]) {
1093
1035
  throw takeFromExternrefTable0(ret[0]);
1094
1036
  }
1095
1037
  }
1096
1038
 
1097
- function wasm_bindgen__convert__closures_____invoke__h728ab8e0de987bd1(arg0, arg1, arg2, arg3) {
1098
- wasm.wasm_bindgen__convert__closures_____invoke__h728ab8e0de987bd1(arg0, arg1, arg2, arg3);
1039
+ function wasm_bindgen__convert__closures_____invoke__h18406d6ac130c616(arg0, arg1, arg2, arg3) {
1040
+ wasm.wasm_bindgen__convert__closures_____invoke__h18406d6ac130c616(arg0, arg1, arg2, arg3);
1099
1041
  }
1100
1042
 
1101
1043
  const AuthClientFinalization = (typeof FinalizationRegistry === 'undefined')
1102
1044
  ? { register: () => {}, unregister: () => {} }
1103
- : new FinalizationRegistry(ptr => wasm.__wbg_authclient_free(ptr >>> 0, 1));
1045
+ : new FinalizationRegistry(ptr => wasm.__wbg_authclient_free(ptr, 1));
1104
1046
  const DiaryxBackendFinalization = (typeof FinalizationRegistry === 'undefined')
1105
1047
  ? { register: () => {}, unregister: () => {} }
1106
- : new FinalizationRegistry(ptr => wasm.__wbg_diaryxbackend_free(ptr >>> 0, 1));
1048
+ : new FinalizationRegistry(ptr => wasm.__wbg_diaryxbackend_free(ptr, 1));
1107
1049
  const JsAsyncFileSystemFinalization = (typeof FinalizationRegistry === 'undefined')
1108
1050
  ? { register: () => {}, unregister: () => {} }
1109
- : new FinalizationRegistry(ptr => wasm.__wbg_jsasyncfilesystem_free(ptr >>> 0, 1));
1051
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsasyncfilesystem_free(ptr, 1));
1110
1052
  const NamespaceClientFinalization = (typeof FinalizationRegistry === 'undefined')
1111
1053
  ? { register: () => {}, unregister: () => {} }
1112
- : new FinalizationRegistry(ptr => wasm.__wbg_namespaceclient_free(ptr >>> 0, 1));
1054
+ : new FinalizationRegistry(ptr => wasm.__wbg_namespaceclient_free(ptr, 1));
1113
1055
 
1114
1056
  function addToExternrefTable0(obj) {
1115
1057
  const idx = wasm.__externref_table_alloc();
@@ -1200,8 +1142,7 @@ function getDataViewMemory0() {
1200
1142
  }
1201
1143
 
1202
1144
  function getStringFromWasm0(ptr, len) {
1203
- ptr = ptr >>> 0;
1204
- return decodeText(ptr, len);
1145
+ return decodeText(ptr >>> 0, len);
1205
1146
  }
1206
1147
 
1207
1148
  let cachedUint8ArrayMemory0 = null;
@@ -1335,8 +1276,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
1335
1276
 
1336
1277
  let WASM_VECTOR_LEN = 0;
1337
1278
 
1338
- let wasmModule, wasm;
1279
+ let wasmModule, wasmInstance, wasm;
1339
1280
  function __wbg_finalize_init(instance, module) {
1281
+ wasmInstance = instance;
1340
1282
  wasm = instance.exports;
1341
1283
  wasmModule = module;
1342
1284
  cachedDataViewMemory0 = null;
Binary file
@@ -4,10 +4,8 @@ export const memory: WebAssembly.Memory;
4
4
  export const __wbg_authclient_free: (a: number, b: number) => void;
5
5
  export const __wbg_diaryxbackend_free: (a: number, b: number) => void;
6
6
  export const __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
7
- export const authclient_createWorkspace: (a: number, b: number, c: number) => any;
8
7
  export const authclient_deleteAccount: (a: number) => any;
9
8
  export const authclient_deleteDevice: (a: number, b: number, c: number) => any;
10
- export const authclient_deleteWorkspace: (a: number, b: number, c: number) => any;
11
9
  export const authclient_getDevices: (a: number) => any;
12
10
  export const authclient_getMe: (a: number) => any;
13
11
  export const authclient_getMetadata: (a: number) => any;
@@ -16,7 +14,6 @@ export const authclient_logout: (a: number) => any;
16
14
  export const authclient_new: (a: number, b: number, c: any) => number;
17
15
  export const authclient_refreshToken: (a: number) => any;
18
16
  export const authclient_renameDevice: (a: number, b: number, c: number, d: number, e: number) => any;
19
- export const authclient_renameWorkspace: (a: number, b: number, c: number, d: number, e: number) => any;
20
17
  export const authclient_requestMagicLink: (a: number, b: number, c: number) => any;
21
18
  export const authclient_serverUrl: (a: number) => [number, number];
22
19
  export const authclient_verifyCode: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
@@ -27,11 +24,9 @@ export const diaryxbackend_createInMemory: () => [number, number, number];
27
24
  export const diaryxbackend_emitFileSystemEvent: (a: number, b: number, c: number) => [number, number];
28
25
  export const diaryxbackend_eventSubscriberCount: (a: number) => number;
29
26
  export const diaryxbackend_execute: (a: number, b: number, c: number) => any;
30
- export const diaryxbackend_hasNativeSync: (a: number) => number;
31
27
  export const diaryxbackend_offFileSystemEvent: (a: number, b: bigint) => number;
32
28
  export const diaryxbackend_onFileSystemEvent: (a: number, b: any) => bigint;
33
29
  export const diaryxbackend_readBinary: (a: number, b: number, c: number) => any;
34
- export const diaryxbackend_setCrdtEnabled: (a: number, b: number) => void;
35
30
  export const diaryxbackend_writeBinary: (a: number, b: number, c: number, d: any) => any;
36
31
  export const jsasyncfilesystem_has_callback: (a: number, b: number, c: number) => number;
37
32
  export const jsasyncfilesystem_new: (a: any) => number;
@@ -56,11 +51,10 @@ export const namespaceclient_updateNamespaceMetadata: (a: number, b: number, c:
56
51
  export const now_timestamp: () => [number, number];
57
52
  export const today_formatted: (a: number, b: number) => [number, number];
58
53
  export const init: () => void;
59
- export const diaryxbackend_isCrdtEnabled: (a: number) => number;
60
54
  export const namespaceclient_new: (a: number, b: number, c: any) => number;
61
55
  export const __wbg_namespaceclient_free: (a: number, b: number) => void;
62
- export const wasm_bindgen__convert__closures_____invoke__ha36570cafae1e03d: (a: number, b: number, c: any) => [number, number];
63
- export const wasm_bindgen__convert__closures_____invoke__h728ab8e0de987bd1: (a: number, b: number, c: any, d: any) => void;
56
+ export const wasm_bindgen__convert__closures_____invoke__h81bafde9f0567339: (a: number, b: number, c: any) => [number, number];
57
+ export const wasm_bindgen__convert__closures_____invoke__h18406d6ac130c616: (a: number, b: number, c: any, d: any) => void;
64
58
  export const __wbindgen_malloc: (a: number, b: number) => number;
65
59
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
66
60
  export const __wbindgen_exn_store: (a: number) => 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.5.1-dev.b19eb11",
5
+ "version": "1.6.0-dev.288ba5d",
6
6
  "license": "SEE LICENSE IN ../../LICENSE.md",
7
7
  "repository": {
8
8
  "type": "git",