@diaryx/wasm-node 1.4.5-dev.aa93000 → 1.5.0-dev.418999f
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/diaryx_wasm.d.ts +32 -97
- package/diaryx_wasm.js +24 -19
- package/diaryx_wasm_bg.wasm +0 -0
- package/diaryx_wasm_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
package/diaryx_wasm.d.ts
CHANGED
|
@@ -4,91 +4,40 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Callbacks for JsAsyncFileSystem operations.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* the corresponding operation
|
|
7
|
+
* Method names mirror std::fs / tokio::fs. All callbacks return Promises;
|
|
8
|
+
* missing callbacks cause the corresponding operation to fail with
|
|
9
|
+
* `ErrorKind::Unsupported` (except `createDir`, `createDirAll`, `readToString`,
|
|
10
|
+
* and `createNew`, which have fallbacks).
|
|
9
11
|
*/
|
|
10
12
|
export interface JsFileSystemCallbacks {
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @returns Promise resolving to the file content
|
|
15
|
-
*/
|
|
13
|
+
/** Read a file as bytes. */
|
|
14
|
+
read: (path: string) => Promise<Uint8Array>;
|
|
15
|
+
/** Read a file as a UTF-8 string. Optional — falls back to read + UTF-8 decode. */
|
|
16
16
|
readToString?: (path: string) => Promise<string>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Write content to a file, creating or overwriting it.
|
|
20
|
-
* @param path - The file path to write
|
|
21
|
-
* @param content - The content to write
|
|
22
|
-
*/
|
|
23
|
-
writeFile?: (path: string, content: string) => Promise<void>;
|
|
24
|
-
|
|
25
17
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
createNew?: (path: string, content: string) => Promise<void>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Delete a file.
|
|
34
|
-
* @param path - The file path to delete
|
|
35
|
-
*/
|
|
36
|
-
deleteFile?: (path: string) => Promise<void>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Check if a path exists.
|
|
40
|
-
* @param path - The path to check
|
|
41
|
-
* @returns Promise resolving to true if the path exists
|
|
42
|
-
*/
|
|
43
|
-
exists?: (path: string) => Promise<boolean>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Check if a path is a directory.
|
|
47
|
-
* @param path - The path to check
|
|
48
|
-
* @returns Promise resolving to true if the path is a directory
|
|
49
|
-
*/
|
|
50
|
-
isDir?: (path: string) => Promise<boolean>;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* List all files in a directory (not recursive).
|
|
54
|
-
* @param dir - The directory path
|
|
55
|
-
* @returns Promise resolving to array of file paths
|
|
56
|
-
*/
|
|
57
|
-
listFiles?: (dir: string) => Promise<string[]>;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* List markdown files in a directory (not recursive).
|
|
61
|
-
* @param dir - The directory path
|
|
62
|
-
* @returns Promise resolving to array of .md file paths
|
|
63
|
-
*/
|
|
64
|
-
listMdFiles?: (dir: string) => Promise<string[]>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Create a directory and all parent directories.
|
|
68
|
-
* @param path - The directory path to create
|
|
18
|
+
* List entries in a directory (non-recursive). Each entry is either a
|
|
19
|
+
* `{ name, kind }` object (kind: 'file' | 'dir' | 'symlink') or a bare
|
|
20
|
+
* string (treated as a file).
|
|
69
21
|
*/
|
|
22
|
+
readDir: (path: string) => Promise<Array<string | { name: string; kind: 'file' | 'dir' | 'symlink' }>>;
|
|
23
|
+
/** Write a file (create or overwrite). */
|
|
24
|
+
write: (path: string, contents: Uint8Array) => Promise<void>;
|
|
25
|
+
/** Create a single directory. Optional. */
|
|
26
|
+
createDir?: (path: string) => Promise<void>;
|
|
27
|
+
/** Create a directory and all parent directories. Optional. */
|
|
70
28
|
createDirAll?: (path: string) => Promise<void>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*/
|
|
84
|
-
readBinary?: (path: string) => Promise<Uint8Array>;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Write binary content to a file.
|
|
88
|
-
* @param path - The file path to write
|
|
89
|
-
* @param data - The binary content as Uint8Array
|
|
90
|
-
*/
|
|
91
|
-
writeBinary?: (path: string, data: Uint8Array) => Promise<void>;
|
|
29
|
+
/** Remove a regular file. */
|
|
30
|
+
removeFile: (path: string) => Promise<void>;
|
|
31
|
+
/** Remove an empty directory. */
|
|
32
|
+
removeDir: (path: string) => Promise<void>;
|
|
33
|
+
/** Recursively remove a directory and its contents. */
|
|
34
|
+
removeDirAll: (path: string) => Promise<void>;
|
|
35
|
+
/** Rename or move a file or directory. */
|
|
36
|
+
rename: (from: string, to: string) => Promise<void>;
|
|
37
|
+
/** Return metadata about a path. */
|
|
38
|
+
metadata: (path: string) => Promise<{ kind: 'file' | 'dir' | 'symlink'; len?: number }>;
|
|
39
|
+
/** Create a file only if it does not exist. Optional — falls back to metadata + write. */
|
|
40
|
+
createNew?: (path: string, contents: Uint8Array) => Promise<void>;
|
|
92
41
|
}
|
|
93
42
|
|
|
94
43
|
|
|
@@ -272,35 +221,19 @@ export class DiaryxBackend {
|
|
|
272
221
|
}
|
|
273
222
|
|
|
274
223
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* This struct allows Rust code to use the async filesystem interface while
|
|
278
|
-
* delegating actual storage operations to JavaScript. This is useful for:
|
|
279
|
-
*
|
|
280
|
-
* - Using IndexedDB for persistent storage in browsers
|
|
281
|
-
* - Using OPFS (Origin Private File System) for better performance
|
|
282
|
-
* - Integrating with existing JavaScript storage solutions
|
|
283
|
-
* - Testing with mock filesystems
|
|
284
|
-
*
|
|
285
|
-
* ## Thread Safety
|
|
286
|
-
*
|
|
287
|
-
* This type is designed for single-threaded WASM environments. The callbacks
|
|
288
|
-
* JsValue is cloned into each async operation to satisfy Send requirements,
|
|
289
|
-
* but actual execution remains single-threaded.
|
|
224
|
+
* `AsyncFileSystem` impl backed by JavaScript callbacks.
|
|
290
225
|
*/
|
|
291
226
|
export class JsAsyncFileSystem {
|
|
292
227
|
free(): void;
|
|
293
228
|
[Symbol.dispose](): void;
|
|
294
229
|
/**
|
|
295
|
-
*
|
|
230
|
+
* True if the callbacks object provides a function with the given name.
|
|
296
231
|
*/
|
|
297
232
|
has_callback(name: string): boolean;
|
|
298
233
|
/**
|
|
299
234
|
* Create a new JsAsyncFileSystem with the provided callbacks.
|
|
300
235
|
*
|
|
301
236
|
* The callbacks object should implement the `JsFileSystemCallbacks` interface.
|
|
302
|
-
* All callbacks are optional - missing callbacks will cause operations to fail
|
|
303
|
-
* with appropriate errors.
|
|
304
237
|
*/
|
|
305
238
|
constructor(callbacks: any);
|
|
306
239
|
}
|
|
@@ -351,6 +284,7 @@ export class NamespaceClient {
|
|
|
351
284
|
releaseSubdomain(id: string): Promise<void>;
|
|
352
285
|
removeDomain(id: string, domain: string): Promise<void>;
|
|
353
286
|
removeSubscriber(id: string, audience: string, contact_id: string): Promise<void>;
|
|
287
|
+
rotateAudiencePassword(id: string, name: string, password: string): Promise<any>;
|
|
354
288
|
setAudience(id: string, name: string, access: string): Promise<void>;
|
|
355
289
|
/**
|
|
356
290
|
* Replace the `metadata` blob on an existing namespace.
|
|
@@ -429,6 +363,7 @@ export interface InitOutput {
|
|
|
429
363
|
readonly namespaceclient_releaseSubdomain: (a: number, b: number, c: number) => any;
|
|
430
364
|
readonly namespaceclient_removeDomain: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
431
365
|
readonly namespaceclient_removeSubscriber: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
366
|
+
readonly namespaceclient_rotateAudiencePassword: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
432
367
|
readonly namespaceclient_serverUrl: (a: number) => [number, number];
|
|
433
368
|
readonly namespaceclient_setAudience: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
434
369
|
readonly namespaceclient_updateNamespaceMetadata: (a: number, b: number, c: number, d: any) => any;
|
package/diaryx_wasm.js
CHANGED
|
@@ -432,21 +432,7 @@ export class DiaryxBackend {
|
|
|
432
432
|
if (Symbol.dispose) DiaryxBackend.prototype[Symbol.dispose] = DiaryxBackend.prototype.free;
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
* This struct allows Rust code to use the async filesystem interface while
|
|
438
|
-
* delegating actual storage operations to JavaScript. This is useful for:
|
|
439
|
-
*
|
|
440
|
-
* - Using IndexedDB for persistent storage in browsers
|
|
441
|
-
* - Using OPFS (Origin Private File System) for better performance
|
|
442
|
-
* - Integrating with existing JavaScript storage solutions
|
|
443
|
-
* - Testing with mock filesystems
|
|
444
|
-
*
|
|
445
|
-
* ## Thread Safety
|
|
446
|
-
*
|
|
447
|
-
* This type is designed for single-threaded WASM environments. The callbacks
|
|
448
|
-
* JsValue is cloned into each async operation to satisfy Send requirements,
|
|
449
|
-
* but actual execution remains single-threaded.
|
|
435
|
+
* `AsyncFileSystem` impl backed by JavaScript callbacks.
|
|
450
436
|
*/
|
|
451
437
|
export class JsAsyncFileSystem {
|
|
452
438
|
__destroy_into_raw() {
|
|
@@ -460,7 +446,7 @@ export class JsAsyncFileSystem {
|
|
|
460
446
|
wasm.__wbg_jsasyncfilesystem_free(ptr, 0);
|
|
461
447
|
}
|
|
462
448
|
/**
|
|
463
|
-
*
|
|
449
|
+
* True if the callbacks object provides a function with the given name.
|
|
464
450
|
* @param {string} name
|
|
465
451
|
* @returns {boolean}
|
|
466
452
|
*/
|
|
@@ -474,8 +460,6 @@ export class JsAsyncFileSystem {
|
|
|
474
460
|
* Create a new JsAsyncFileSystem with the provided callbacks.
|
|
475
461
|
*
|
|
476
462
|
* The callbacks object should implement the `JsFileSystemCallbacks` interface.
|
|
477
|
-
* All callbacks are optional - missing callbacks will cause operations to fail
|
|
478
|
-
* with appropriate errors.
|
|
479
463
|
* @param {any} callbacks
|
|
480
464
|
*/
|
|
481
465
|
constructor(callbacks) {
|
|
@@ -710,6 +694,22 @@ export class NamespaceClient {
|
|
|
710
694
|
const ret = wasm.namespaceclient_removeSubscriber(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
711
695
|
return ret;
|
|
712
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* @param {string} id
|
|
699
|
+
* @param {string} name
|
|
700
|
+
* @param {string} password
|
|
701
|
+
* @returns {Promise<any>}
|
|
702
|
+
*/
|
|
703
|
+
rotateAudiencePassword(id, name, password) {
|
|
704
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
705
|
+
const len0 = WASM_VECTOR_LEN;
|
|
706
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
707
|
+
const len1 = WASM_VECTOR_LEN;
|
|
708
|
+
const ptr2 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
709
|
+
const len2 = WASM_VECTOR_LEN;
|
|
710
|
+
const ret = wasm.namespaceclient_rotateAudiencePassword(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
711
|
+
return ret;
|
|
712
|
+
}
|
|
713
713
|
/**
|
|
714
714
|
* Server URL this client targets.
|
|
715
715
|
* @returns {string}
|
|
@@ -823,6 +823,11 @@ function __wbg_get_imports() {
|
|
|
823
823
|
const ret = arg0 === null;
|
|
824
824
|
return ret;
|
|
825
825
|
},
|
|
826
|
+
__wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
|
|
827
|
+
const val = arg0;
|
|
828
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
829
|
+
return ret;
|
|
830
|
+
},
|
|
826
831
|
__wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
|
|
827
832
|
const ret = arg0 === undefined;
|
|
828
833
|
return ret;
|
|
@@ -1052,7 +1057,7 @@ function __wbg_get_imports() {
|
|
|
1052
1057
|
console.warn(arg0, arg1, arg2, arg3);
|
|
1053
1058
|
},
|
|
1054
1059
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1055
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1060
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 612, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1056
1061
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h7174ba9de949bff3);
|
|
1057
1062
|
return ret;
|
|
1058
1063
|
},
|
package/diaryx_wasm_bg.wasm
CHANGED
|
Binary file
|
package/diaryx_wasm_bg.wasm.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export const namespaceclient_registerDomain: (a: number, b: number, c: number, d
|
|
|
49
49
|
export const namespaceclient_releaseSubdomain: (a: number, b: number, c: number) => any;
|
|
50
50
|
export const namespaceclient_removeDomain: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
51
51
|
export const namespaceclient_removeSubscriber: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
52
|
+
export const namespaceclient_rotateAudiencePassword: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
52
53
|
export const namespaceclient_serverUrl: (a: number) => [number, number];
|
|
53
54
|
export const namespaceclient_setAudience: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
54
55
|
export const namespaceclient_updateNamespaceMetadata: (a: number, b: number, c: number, d: any) => any;
|
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
|
+
"version": "1.5.0-dev.418999f",
|
|
6
6
|
"license": "SEE LICENSE IN ../../LICENSE.md",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|