@diaryx/wasm-node 1.4.3-dev.698d97e → 1.4.3-dev.88275aa

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
@@ -100,11 +100,11 @@ console.log(
100
100
  `Fixed: ${fixSummary.total_fixed}, Failed: ${fixSummary.total_failed}`,
101
101
  );
102
102
 
103
- // Fix individual issues
104
- validation.fix_broken_part_of("workspace/broken.md");
105
- validation.fix_broken_contents_ref("workspace/index.md", "missing.md");
106
- validation.fix_unlisted_file("workspace/index.md", "workspace/unlisted.md");
107
- validation.fix_missing_part_of("workspace/orphan.md", "workspace/index.md");
103
+ // Fix an individual warning or error by handing the variant straight from
104
+ // a prior `validate_workspace` / `validate_file` result back to the generic
105
+ // fixer. New warning/error kinds Just Work without a frontend patch.
106
+ validation.fix_validation_warning(result.warnings[0]);
107
+ validation.fix_validation_error(result.errors[0]);
108
108
  ```
109
109
 
110
110
  #### Validation Errors
package/diaryx_wasm.d.ts CHANGED
@@ -93,6 +93,50 @@ export interface JsFileSystemCallbacks {
93
93
 
94
94
 
95
95
 
96
+ /**
97
+ * Auth client exposed to JavaScript.
98
+ *
99
+ * Wraps [`AuthService`] with a [`WasmAuthenticatedClient`] backend. All
100
+ * methods return JSON strings on success and throw a JavaScript `Error`
101
+ * carrying `statusCode` and `devices` properties on failure.
102
+ */
103
+ export class AuthClient {
104
+ free(): void;
105
+ [Symbol.dispose](): void;
106
+ createWorkspace(name: string): Promise<any>;
107
+ deleteAccount(): Promise<void>;
108
+ deleteDevice(device_id: string): Promise<void>;
109
+ deleteWorkspace(workspace_id: string): Promise<void>;
110
+ getDevices(): Promise<any>;
111
+ getMe(): Promise<any>;
112
+ /**
113
+ * Load non-secret session metadata as a JSON string (or `null`).
114
+ */
115
+ getMetadata(): Promise<any>;
116
+ /**
117
+ * Whether a session is currently established (per the `hasSession` callback).
118
+ */
119
+ isAuthenticated(): Promise<boolean>;
120
+ logout(): Promise<void>;
121
+ /**
122
+ * Create a new auth client targeting the given server URL.
123
+ *
124
+ * `callbacks` is a JavaScript object implementing the `AuthCallbacks`
125
+ * interface (see module docs for the expected shape).
126
+ */
127
+ constructor(server_url: string, callbacks: AuthCallbacks);
128
+ refreshToken(): Promise<any>;
129
+ renameDevice(device_id: string, new_name: string): Promise<void>;
130
+ renameWorkspace(workspace_id: string, new_name: string): Promise<void>;
131
+ requestMagicLink(email: string): Promise<any>;
132
+ verifyCode(code: string, email: string, device_name?: string | null, replace_device_id?: string | null): Promise<any>;
133
+ verifyMagicLink(token: string, device_name?: string | null, replace_device_id?: string | null): Promise<any>;
134
+ /**
135
+ * Server URL this client targets.
136
+ */
137
+ readonly serverUrl: string;
138
+ }
139
+
96
140
  /**
97
141
  * Unified async backend with native storage.
98
142
  *
@@ -280,8 +324,26 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
280
324
 
281
325
  export interface InitOutput {
282
326
  readonly memory: WebAssembly.Memory;
327
+ readonly __wbg_authclient_free: (a: number, b: number) => void;
283
328
  readonly __wbg_diaryxbackend_free: (a: number, b: number) => void;
284
329
  readonly __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
330
+ readonly authclient_createWorkspace: (a: number, b: number, c: number) => any;
331
+ readonly authclient_deleteAccount: (a: number) => any;
332
+ readonly authclient_deleteDevice: (a: number, b: number, c: number) => any;
333
+ readonly authclient_deleteWorkspace: (a: number, b: number, c: number) => any;
334
+ readonly authclient_getDevices: (a: number) => any;
335
+ readonly authclient_getMe: (a: number) => any;
336
+ readonly authclient_getMetadata: (a: number) => any;
337
+ readonly authclient_isAuthenticated: (a: number) => any;
338
+ readonly authclient_logout: (a: number) => any;
339
+ readonly authclient_new: (a: number, b: number, c: any) => number;
340
+ readonly authclient_refreshToken: (a: number) => any;
341
+ readonly authclient_renameDevice: (a: number, b: number, c: number, d: number, e: number) => any;
342
+ readonly authclient_renameWorkspace: (a: number, b: number, c: number, d: number, e: number) => any;
343
+ readonly authclient_requestMagicLink: (a: number, b: number, c: number) => any;
344
+ readonly authclient_serverUrl: (a: number) => [number, number];
345
+ readonly authclient_verifyCode: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
346
+ readonly authclient_verifyMagicLink: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
285
347
  readonly diaryxbackend_create: (a: number, b: number) => any;
286
348
  readonly diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
287
349
  readonly diaryxbackend_createInMemory: () => [number, number, number];
@@ -308,8 +370,8 @@ export interface InitOutput {
308
370
  readonly __externref_table_alloc: () => number;
309
371
  readonly __wbindgen_externrefs: WebAssembly.Table;
310
372
  readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
311
- readonly __externref_table_dealloc: (a: number) => void;
312
373
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
374
+ readonly __externref_table_dealloc: (a: number) => void;
313
375
  readonly __wbindgen_start: () => void;
314
376
  }
315
377
 
package/diaryx_wasm.js CHANGED
@@ -1,5 +1,210 @@
1
1
  /* @ts-self-types="./diaryx_wasm.d.ts" */
2
2
 
3
+ /**
4
+ * Auth client exposed to JavaScript.
5
+ *
6
+ * Wraps [`AuthService`] with a [`WasmAuthenticatedClient`] backend. All
7
+ * methods return JSON strings on success and throw a JavaScript `Error`
8
+ * carrying `statusCode` and `devices` properties on failure.
9
+ */
10
+ export class AuthClient {
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ AuthClientFinalization.unregister(this);
15
+ return ptr;
16
+ }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_authclient_free(ptr, 0);
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
+ /**
32
+ * @returns {Promise<void>}
33
+ */
34
+ deleteAccount() {
35
+ const ret = wasm.authclient_deleteAccount(this.__wbg_ptr);
36
+ return ret;
37
+ }
38
+ /**
39
+ * @param {string} device_id
40
+ * @returns {Promise<void>}
41
+ */
42
+ deleteDevice(device_id) {
43
+ const ptr0 = passStringToWasm0(device_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
44
+ const len0 = WASM_VECTOR_LEN;
45
+ const ret = wasm.authclient_deleteDevice(this.__wbg_ptr, ptr0, len0);
46
+ return ret;
47
+ }
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
+ /**
59
+ * @returns {Promise<any>}
60
+ */
61
+ getDevices() {
62
+ const ret = wasm.authclient_getDevices(this.__wbg_ptr);
63
+ return ret;
64
+ }
65
+ /**
66
+ * @returns {Promise<any>}
67
+ */
68
+ getMe() {
69
+ const ret = wasm.authclient_getMe(this.__wbg_ptr);
70
+ return ret;
71
+ }
72
+ /**
73
+ * Load non-secret session metadata as a JSON string (or `null`).
74
+ * @returns {Promise<any>}
75
+ */
76
+ getMetadata() {
77
+ const ret = wasm.authclient_getMetadata(this.__wbg_ptr);
78
+ return ret;
79
+ }
80
+ /**
81
+ * Whether a session is currently established (per the `hasSession` callback).
82
+ * @returns {Promise<boolean>}
83
+ */
84
+ isAuthenticated() {
85
+ const ret = wasm.authclient_isAuthenticated(this.__wbg_ptr);
86
+ return ret;
87
+ }
88
+ /**
89
+ * @returns {Promise<void>}
90
+ */
91
+ logout() {
92
+ const ret = wasm.authclient_logout(this.__wbg_ptr);
93
+ return ret;
94
+ }
95
+ /**
96
+ * Create a new auth client targeting the given server URL.
97
+ *
98
+ * `callbacks` is a JavaScript object implementing the `AuthCallbacks`
99
+ * interface (see module docs for the expected shape).
100
+ * @param {string} server_url
101
+ * @param {AuthCallbacks} callbacks
102
+ */
103
+ constructor(server_url, callbacks) {
104
+ const ptr0 = passStringToWasm0(server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ const ret = wasm.authclient_new(ptr0, len0, callbacks);
107
+ this.__wbg_ptr = ret >>> 0;
108
+ AuthClientFinalization.register(this, this.__wbg_ptr, this);
109
+ return this;
110
+ }
111
+ /**
112
+ * @returns {Promise<any>}
113
+ */
114
+ refreshToken() {
115
+ const ret = wasm.authclient_refreshToken(this.__wbg_ptr);
116
+ return ret;
117
+ }
118
+ /**
119
+ * @param {string} device_id
120
+ * @param {string} new_name
121
+ * @returns {Promise<void>}
122
+ */
123
+ renameDevice(device_id, new_name) {
124
+ const ptr0 = passStringToWasm0(device_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
125
+ const len0 = WASM_VECTOR_LEN;
126
+ const ptr1 = passStringToWasm0(new_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
127
+ const len1 = WASM_VECTOR_LEN;
128
+ const ret = wasm.authclient_renameDevice(this.__wbg_ptr, ptr0, len0, ptr1, len1);
129
+ return ret;
130
+ }
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
+ /**
145
+ * @param {string} email
146
+ * @returns {Promise<any>}
147
+ */
148
+ requestMagicLink(email) {
149
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
150
+ const len0 = WASM_VECTOR_LEN;
151
+ const ret = wasm.authclient_requestMagicLink(this.__wbg_ptr, ptr0, len0);
152
+ return ret;
153
+ }
154
+ /**
155
+ * Server URL this client targets.
156
+ * @returns {string}
157
+ */
158
+ get serverUrl() {
159
+ let deferred1_0;
160
+ let deferred1_1;
161
+ try {
162
+ const ret = wasm.authclient_serverUrl(this.__wbg_ptr);
163
+ deferred1_0 = ret[0];
164
+ deferred1_1 = ret[1];
165
+ return getStringFromWasm0(ret[0], ret[1]);
166
+ } finally {
167
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
168
+ }
169
+ }
170
+ /**
171
+ * @param {string} code
172
+ * @param {string} email
173
+ * @param {string | null} [device_name]
174
+ * @param {string | null} [replace_device_id]
175
+ * @returns {Promise<any>}
176
+ */
177
+ verifyCode(code, email, device_name, replace_device_id) {
178
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
179
+ const len0 = WASM_VECTOR_LEN;
180
+ const ptr1 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
181
+ const len1 = WASM_VECTOR_LEN;
182
+ var ptr2 = isLikeNone(device_name) ? 0 : passStringToWasm0(device_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
183
+ var len2 = WASM_VECTOR_LEN;
184
+ var ptr3 = isLikeNone(replace_device_id) ? 0 : passStringToWasm0(replace_device_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
185
+ var len3 = WASM_VECTOR_LEN;
186
+ const ret = wasm.authclient_verifyCode(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
187
+ return ret;
188
+ }
189
+ /**
190
+ * @param {string} token
191
+ * @param {string | null} [device_name]
192
+ * @param {string | null} [replace_device_id]
193
+ * @returns {Promise<any>}
194
+ */
195
+ verifyMagicLink(token, device_name, replace_device_id) {
196
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
+ const len0 = WASM_VECTOR_LEN;
198
+ var ptr1 = isLikeNone(device_name) ? 0 : passStringToWasm0(device_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
199
+ var len1 = WASM_VECTOR_LEN;
200
+ var ptr2 = isLikeNone(replace_device_id) ? 0 : passStringToWasm0(replace_device_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
201
+ var len2 = WASM_VECTOR_LEN;
202
+ const ret = wasm.authclient_verifyMagicLink(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
203
+ return ret;
204
+ }
205
+ }
206
+ if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
207
+
3
208
  /**
4
209
  * Unified async backend with native storage.
5
210
  *
@@ -338,6 +543,10 @@ function __wbg_get_imports() {
338
543
  const ret = typeof(arg0) === 'function';
339
544
  return ret;
340
545
  },
546
+ __wbg___wbindgen_is_null_344c8750a8525473: function(arg0) {
547
+ const ret = arg0 === null;
548
+ return ret;
549
+ },
341
550
  __wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
342
551
  const ret = arg0 === undefined;
343
552
  return ret;
@@ -464,6 +673,14 @@ function __wbg_get_imports() {
464
673
  const ret = new Date(arg0);
465
674
  return ret;
466
675
  },
676
+ __wbg_new_4f9fafbb3909af72: function() {
677
+ const ret = new Object();
678
+ return ret;
679
+ },
680
+ __wbg_new_e3b04b4d53d1b593: function(arg0, arg1) {
681
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
682
+ return ret;
683
+ },
467
684
  __wbg_new_f3c9df4f38f3f798: function() {
468
685
  const ret = new Array();
469
686
  return ret;
@@ -494,6 +711,10 @@ function __wbg_get_imports() {
494
711
  const ret = new Uint8Array(arg0 >>> 0);
495
712
  return ret;
496
713
  },
714
+ __wbg_parse_545d11396395fbbd: function() { return handleError(function (arg0, arg1) {
715
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
716
+ return ret;
717
+ }, arguments); },
497
718
  __wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
498
719
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
499
720
  },
@@ -515,6 +736,10 @@ function __wbg_get_imports() {
515
736
  __wbg_set_16a9c1a07b3d38ec: function(arg0, arg1, arg2) {
516
737
  arg0.set(getArrayU8FromWasm0(arg1, arg2));
517
738
  },
739
+ __wbg_set_8ee2d34facb8466e: function() { return handleError(function (arg0, arg1, arg2) {
740
+ const ret = Reflect.set(arg0, arg1, arg2);
741
+ return ret;
742
+ }, arguments); },
518
743
  __wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f: function() {
519
744
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
520
745
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -547,7 +772,7 @@ function __wbg_get_imports() {
547
772
  console.warn(arg0, arg1, arg2, arg3);
548
773
  },
549
774
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
550
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 504, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
775
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 597, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
551
776
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h31e41fe17a163321);
552
777
  return ret;
553
778
  },
@@ -588,6 +813,9 @@ function wasm_bindgen__convert__closures_____invoke__h186c6127932ad571(arg0, arg
588
813
  wasm.wasm_bindgen__convert__closures_____invoke__h186c6127932ad571(arg0, arg1, arg2, arg3);
589
814
  }
590
815
 
816
+ const AuthClientFinalization = (typeof FinalizationRegistry === 'undefined')
817
+ ? { register: () => {}, unregister: () => {} }
818
+ : new FinalizationRegistry(ptr => wasm.__wbg_authclient_free(ptr >>> 0, 1));
591
819
  const DiaryxBackendFinalization = (typeof FinalizationRegistry === 'undefined')
592
820
  ? { register: () => {}, unregister: () => {} }
593
821
  : new FinalizationRegistry(ptr => wasm.__wbg_diaryxbackend_free(ptr >>> 0, 1));
Binary file
@@ -1,8 +1,26 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_authclient_free: (a: number, b: number) => void;
4
5
  export const __wbg_diaryxbackend_free: (a: number, b: number) => void;
5
6
  export const __wbg_jsasyncfilesystem_free: (a: number, b: number) => void;
7
+ export const authclient_createWorkspace: (a: number, b: number, c: number) => any;
8
+ export const authclient_deleteAccount: (a: number) => any;
9
+ export const authclient_deleteDevice: (a: number, b: number, c: number) => any;
10
+ export const authclient_deleteWorkspace: (a: number, b: number, c: number) => any;
11
+ export const authclient_getDevices: (a: number) => any;
12
+ export const authclient_getMe: (a: number) => any;
13
+ export const authclient_getMetadata: (a: number) => any;
14
+ export const authclient_isAuthenticated: (a: number) => any;
15
+ export const authclient_logout: (a: number) => any;
16
+ export const authclient_new: (a: number, b: number, c: any) => number;
17
+ export const authclient_refreshToken: (a: number) => any;
18
+ 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
+ export const authclient_requestMagicLink: (a: number, b: number, c: number) => any;
21
+ export const authclient_serverUrl: (a: number) => [number, number];
22
+ export const authclient_verifyCode: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
23
+ export const authclient_verifyMagicLink: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
6
24
  export const diaryxbackend_create: (a: number, b: number) => any;
7
25
  export const diaryxbackend_createFromJsFileSystem: (a: any) => [number, number, number];
8
26
  export const diaryxbackend_createInMemory: () => [number, number, number];
@@ -29,6 +47,6 @@ export const __wbindgen_exn_store: (a: number) => void;
29
47
  export const __externref_table_alloc: () => number;
30
48
  export const __wbindgen_externrefs: WebAssembly.Table;
31
49
  export const __wbindgen_destroy_closure: (a: number, b: number) => void;
32
- export const __externref_table_dealloc: (a: number) => void;
33
50
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
51
+ export const __externref_table_dealloc: (a: number) => void;
34
52
  export const __wbindgen_start: () => 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.4.3-dev.698d97e",
5
+ "version": "1.4.3-dev.88275aa",
6
6
  "license": "SEE LICENSE IN ../../LICENSE.md",
7
7
  "repository": {
8
8
  "type": "git",