diff --git a/veilid-flutter/lib/veilid.dart b/veilid-flutter/lib/veilid.dart index 3c151479..12c6740a 100644 --- a/veilid-flutter/lib/veilid.dart +++ b/veilid-flutter/lib/veilid.dart @@ -1859,6 +1859,12 @@ abstract class VeilidTableDBTransaction { return store(col, key, utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable))); } + + Future storeStringJson(int col, String key, Object? object, + {Object? Function(Object? nonEncodable)? toEncodable}) { + return storeJson(col, utf8.encoder.convert(key), object, + toEncodable: toEncodable); + } } abstract class VeilidTableDB { @@ -1877,8 +1883,8 @@ abstract class VeilidTableDB { Future storeStringJson(int col, String key, Object? object, {Object? Function(Object? nonEncodable)? toEncodable}) { - return storeJson(col, utf8.encoder.convert(key), - utf8.encoder.convert(jsonEncode(object, toEncodable: toEncodable))); + return storeJson(col, utf8.encoder.convert(key), object, + toEncodable: toEncodable); } Future loadJson(int col, Uint8List key, diff --git a/veilid-flutter/lib/veilid_js.dart b/veilid-flutter/lib/veilid_js.dart index fd30314a..87966390 100644 --- a/veilid-flutter/lib/veilid_js.dart +++ b/veilid-flutter/lib/veilid_js.dart @@ -96,14 +96,14 @@ class VeilidTableDBTransactionJS extends VeilidTableDBTransaction { @override Future commit() { - return _wrapApiPromise(js_util - .callMethod(wasm, "veilid_table_db_transaction_commit", [_tdbt.id])); + return _wrapApiPromise( + js_util.callMethod(wasm, "table_db_transaction_commit", [_tdbt.id])); } @override Future rollback() { - return _wrapApiPromise(js_util - .callMethod(wasm, "veilid_table_db_transaction_rollback", [_tdbt.id])); + return _wrapApiPromise( + js_util.callMethod(wasm, "table_db_transaction_rollback", [_tdbt.id])); } @override @@ -111,10 +111,8 @@ class VeilidTableDBTransactionJS extends VeilidTableDBTransaction { final encodedKey = base64UrlEncode(key); final encodedValue = base64UrlEncode(value); - return _wrapApiPromise(js_util.callMethod( - wasm, - "veilid_table_db_transaction_store", - [_tdbt.id, encodedKey, encodedValue])); + return _wrapApiPromise(js_util.callMethod(wasm, + "table_db_transaction_store", [_tdbt.id, encodedKey, encodedValue])); } @override @@ -122,7 +120,7 @@ class VeilidTableDBTransactionJS extends VeilidTableDBTransaction { final encodedKey = base64UrlEncode(key); return _wrapApiPromise(js_util.callMethod( - wasm, "veilid_table_db_transaction_delete", [_tdbt.id, encodedKey])); + wasm, "table_db_transaction_delete", [_tdbt.id, encodedKey])); } } @@ -172,15 +170,15 @@ class VeilidTableDBJS extends VeilidTableDB { final encodedValue = base64UrlEncode(value); return _wrapApiPromise(js_util.callMethod( - wasm, "veilid_table_db_store", [_tdb.id, encodedKey, encodedValue])); + wasm, "table_db_store", [_tdb.id, encodedKey, encodedValue])); } @override Future load(int col, Uint8List key) async { final encodedKey = base64UrlEncode(key); - String? out = await _wrapApiPromise(js_util - .callMethod(wasm, "veilid_table_db_store", [_tdb.id, encodedKey])); + String? out = await _wrapApiPromise( + js_util.callMethod(wasm, "table_db_load", [_tdb.id, encodedKey])); if (out == null) { return null; } @@ -191,8 +189,8 @@ class VeilidTableDBJS extends VeilidTableDB { Future delete(int col, Uint8List key) { final encodedKey = base64UrlEncode(key); - return _wrapApiPromise(js_util - .callMethod(wasm, "veilid_table_db_delete", [_tdb.id, encodedKey])); + return _wrapApiPromise( + js_util.callMethod(wasm, "table_db_delete", [_tdb.id, encodedKey])); } } @@ -307,10 +305,8 @@ class VeilidJS implements Veilid { @override Future openTableDB(String name, int columnCount) async { - print('shit'); int id = await _wrapApiPromise( js_util.callMethod(wasm, "open_table_db", [name, columnCount])); - print('qwerqwer'); return VeilidTableDBJS._(_TDB(id, this)); } diff --git a/veilid-wasm/src/lib.rs b/veilid-wasm/src/lib.rs index cff5c174..33c965aa 100644 --- a/veilid-wasm/src/lib.rs +++ b/veilid-wasm/src/lib.rs @@ -492,7 +492,6 @@ fn add_table_db(table_db: veilid_core::TableDB) -> u32 { next_id += 1; } tdbs.insert(next_id, table_db); - console_log(&format!("tdb added: {}", next_id)); next_id } @@ -512,7 +511,6 @@ pub fn open_table_db(name: String, column_count: u32) -> Promise { #[wasm_bindgen()] pub fn release_table_db(id: u32) -> i32 { - console_log(&format!("tdb released: {}", id)); let mut tdbs = (*TABLE_DBS).borrow_mut(); if tdbs.remove(&id).is_none() { return 0;