@hakodb/client 0.5.18 → 0.5.20
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 +2 -0
- package/package.json +4 -1
- package/src/client.ts +2 -2
- package/src/native.ts +5 -5
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@ FFI bindings over koffi/Bun (`native.ts`). Tauri lives in `@hakodb/tauri`
|
|
|
16
16
|
| 0.5.16 | `hakodb v0.13.3` (`createVectorIndex` + `findNear` KNN over `hk_engine_find_near`) |
|
|
17
17
|
| 0.5.17 | `hakodb v0.14.0` (`createTraverseIndex` + `findPaths` graph BFS over `hk_engine_find_paths`) |
|
|
18
18
|
| 0.5.18 | `hakodb v0.15.0` (Phase B: `createEdgeIndex` + `shortestPaths` Dijkstra over `hk_engine_shortest_paths`) |
|
|
19
|
+
| 0.5.19 | `hakodb v0.15.3` (native DLL refresh: ring-only TLS + shared sync framing) |
|
|
20
|
+
| 0.5.20 | `hakodb v0.16.0` (`createCloudSyncServer` room params: `roomName`/`roomKey`) |
|
|
19
21
|
|
|
20
22
|
## Setup — native library
|
|
21
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hakodb/client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"description": "High-level HakoDB JavaScript/TypeScript client for Node.js and Bun",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,5 +27,8 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^26.1.2",
|
|
29
29
|
"typescript": "^7.0.2"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "tsc --noEmit -p tsconfig.json"
|
|
30
33
|
}
|
|
31
34
|
}
|
package/src/client.ts
CHANGED
|
@@ -432,9 +432,9 @@ export class HakoClient {
|
|
|
432
432
|
* room's collections under its own storage prefix and relaying sync only to
|
|
433
433
|
* the members of that room.
|
|
434
434
|
*/
|
|
435
|
-
createCloudSyncServer(serverId: string | null = null, authToken: string | null = null): CloudSync {
|
|
435
|
+
createCloudSyncServer(serverId: string | null = null, authToken: string | null = null, roomName: string | null = null, roomKey: string | null = null): CloudSync {
|
|
436
436
|
this.assertOpen();
|
|
437
|
-
const handle = this.native.cloudSyncServerNew(this.engine, serverId, authToken);
|
|
437
|
+
const handle = this.native.cloudSyncServerNew(this.engine, serverId, authToken, roomName, roomKey);
|
|
438
438
|
if (!handle) {
|
|
439
439
|
throw new Error(`cloudSyncServerNew failed: ${this.native.lastError()}`);
|
|
440
440
|
}
|
package/src/native.ts
CHANGED
|
@@ -168,7 +168,7 @@ export interface NativeBindings {
|
|
|
168
168
|
|
|
169
169
|
// Cloud Sync (bi-directional WebSocket replication)
|
|
170
170
|
cloudSyncNew(engine: Handle, mode: number, clientId: string | null, roomName: string | null, roomKey: string | null, authToken: string | null): Handle;
|
|
171
|
-
cloudSyncServerNew(engine: Handle, serverId: string | null, authToken: string | null): Handle;
|
|
171
|
+
cloudSyncServerNew(engine: Handle, serverId: string | null, authToken: string | null, roomName: string | null, roomKey: string | null): Handle;
|
|
172
172
|
cloudSyncClientNew(engine: Handle, clientId: string | null, roomName: string | null, roomKey: string | null, authToken: string | null): Handle;
|
|
173
173
|
cloudSyncStart(cloudSync: Handle, address: string): number;
|
|
174
174
|
cloudSyncStatus(cloudSync: Handle): string | null;
|
|
@@ -400,7 +400,7 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
|
|
|
400
400
|
hk_doc_insert_reference: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.i32 },
|
|
401
401
|
|
|
402
402
|
hk_cloud_sync_new: { args: [FFIType.ptr, FFIType.i32, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
403
|
-
hk_cloud_sync_server_new: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
403
|
+
hk_cloud_sync_server_new: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
404
404
|
hk_cloud_sync_client_new: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
405
405
|
hk_cloud_sync_start: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.i32 },
|
|
406
406
|
hk_cloud_sync_status: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
@@ -578,7 +578,7 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
|
|
|
578
578
|
netSyncerFree: (syncer) => symbols.hk_net_syncer_free(syncer),
|
|
579
579
|
|
|
580
580
|
cloudSyncNew: (engine, mode, clientId, roomName, roomKey, authToken) => symbols.hk_cloud_sync_new(engine, mode, toC(clientId), toC(roomName), toC(roomKey), toC(authToken)),
|
|
581
|
-
cloudSyncServerNew: (engine, serverId, authToken) => symbols.hk_cloud_sync_server_new(engine, toC(serverId), toC(authToken)),
|
|
581
|
+
cloudSyncServerNew: (engine, serverId, authToken, roomName, roomKey) => symbols.hk_cloud_sync_server_new(engine, toC(serverId), toC(authToken), toC(roomName), toC(roomKey)),
|
|
582
582
|
cloudSyncClientNew: (engine, clientId, roomName, roomKey, authToken) => symbols.hk_cloud_sync_client_new(engine, toC(clientId), toC(roomName), toC(roomKey), toC(authToken)),
|
|
583
583
|
cloudSyncStart: (cs, address) => symbols.hk_cloud_sync_start(cs, toC(address)),
|
|
584
584
|
cloudSyncStatus: (cs) => ptrToStringAndFree(symbols.hk_cloud_sync_status(cs)),
|
|
@@ -826,7 +826,7 @@ async function createNodeBindings(libPath: string): Promise<NativeBindings> {
|
|
|
826
826
|
hk_doc_insert_reference: lib.func('int hk_doc_insert_reference(HK_Doc* doc, const char* key, const char* target_collection, const char* target_id)'),
|
|
827
827
|
|
|
828
828
|
hk_cloud_sync_new: lib.func('HK_CloudSync* hk_cloud_sync_new(HK_Engine* engine, int32_t mode, const char* client_id, const char* room_name, const char* room_key, const char* auth_token)'),
|
|
829
|
-
hk_cloud_sync_server_new: lib.func('HK_CloudSync* hk_cloud_sync_server_new(HK_Engine* engine, const char* server_id, const char* auth_token)'),
|
|
829
|
+
hk_cloud_sync_server_new: lib.func('HK_CloudSync* hk_cloud_sync_server_new(HK_Engine* engine, const char* server_id, const char* auth_token, const char* room_name, const char* room_key)'),
|
|
830
830
|
hk_cloud_sync_client_new: lib.func('HK_CloudSync* hk_cloud_sync_client_new(HK_Engine* engine, const char* client_id, const char* room_name, const char* room_key, const char* auth_token)'),
|
|
831
831
|
hk_cloud_sync_start: lib.func('int hk_cloud_sync_start(HK_CloudSync* cloud_sync, const char* address)'),
|
|
832
832
|
hk_cloud_sync_status: lib.func('HeapStr hk_cloud_sync_status(HK_CloudSync* cloud_sync)'),
|
|
@@ -994,7 +994,7 @@ async function createNodeBindings(libPath: string): Promise<NativeBindings> {
|
|
|
994
994
|
netSyncerFree: (syncer) => fn.hk_net_syncer_free(syncer),
|
|
995
995
|
|
|
996
996
|
cloudSyncNew: (engine, mode, clientId, roomName, roomKey, authToken) => fn.hk_cloud_sync_new(engine, mode, clientId, roomName, roomKey, authToken),
|
|
997
|
-
cloudSyncServerNew: (engine, serverId, authToken) => fn.hk_cloud_sync_server_new(engine, serverId, authToken),
|
|
997
|
+
cloudSyncServerNew: (engine, serverId, authToken, roomName, roomKey) => fn.hk_cloud_sync_server_new(engine, serverId, authToken, roomName, roomKey),
|
|
998
998
|
cloudSyncClientNew: (engine, clientId, roomName, roomKey, authToken) => fn.hk_cloud_sync_client_new(engine, clientId, roomName, roomKey, authToken),
|
|
999
999
|
cloudSyncStart: (cs, address) => fn.hk_cloud_sync_start(cs, address),
|
|
1000
1000
|
cloudSyncStatus: (cs) => ptrToStringAndFree(fn.hk_cloud_sync_status(cs)),
|