From 3970b6f2946bed5edd962afd8ddc0c257a3b64bc Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sun, 17 Mar 2024 10:54:37 -0400 Subject: [PATCH] fix flutter/dart wasm --- .../operations/operation_inspect_value.rs | 10 +- .../src/storage_manager/inspect_value.rs | 2 +- veilid-core/src/storage_manager/mod.rs | 6 +- .../example/integration_test/fixtures.dart | 1 + .../integration_test/test_table_db.dart | 2 +- .../example/test_driver/integration_test.dart | 3 + veilid-flutter/lib/veilid_state.dart | 4 +- veilid-flutter/lib/veilid_state.freezed.dart | 254 +++++++++++------- veilid-flutter/lib/veilid_state.g.dart | 12 +- veilid-flutter/run_integration_tests_web.sh | 5 + veilid-wasm/src/lib.rs | 3 +- 11 files changed, 195 insertions(+), 107 deletions(-) create mode 100644 veilid-flutter/example/test_driver/integration_test.dart create mode 100755 veilid-flutter/run_integration_tests_web.sh diff --git a/veilid-core/src/rpc_processor/coders/operations/operation_inspect_value.rs b/veilid-core/src/rpc_processor/coders/operations/operation_inspect_value.rs index 7d1ce70a..197943e9 100644 --- a/veilid-core/src/rpc_processor/coders/operations/operation_inspect_value.rs +++ b/veilid-core/src/rpc_processor/coders/operations/operation_inspect_value.rs @@ -156,10 +156,12 @@ impl RPCOperationInspectValueA { // Ensure seqs returned does not exceeed subkeys requested #[allow(clippy::unnecessary_cast)] - if self.seqs.len() > inspect_value_context.subkeys.len() as usize { - return Err(RPCError::protocol( - "InspectValue seqs length is greater than subkeys requested", - )); + if self.seqs.len() as u64 > inspect_value_context.subkeys.len() as u64 { + return Err(RPCError::protocol(format!( + "InspectValue seqs length is greater than subkeys requested: {} > {}", + self.seqs.len(), + inspect_value_context.subkeys.len() + ))); } // Validate descriptor diff --git a/veilid-core/src/storage_manager/inspect_value.rs b/veilid-core/src/storage_manager/inspect_value.rs index 29a1824e..5a907098 100644 --- a/veilid-core/src/storage_manager/inspect_value.rs +++ b/veilid-core/src/storage_manager/inspect_value.rs @@ -156,7 +156,7 @@ impl StorageManager { // Get number of subkeys from schema and ensure we are getting the // right number of sequence numbers betwen that and what we asked for #[allow(clippy::unnecessary_cast)] - if answer.seqs.len() != descriptor_info.subkeys.len() as usize { + if answer.seqs.len() as u64 != descriptor_info.subkeys.len() as u64 { // Not the right number of sequence numbers // Move to the next node return Ok(NetworkResult::invalid_message(format!( diff --git a/veilid-core/src/storage_manager/mod.rs b/veilid-core/src/storage_manager/mod.rs index 09f4af44..6e02c6f1 100644 --- a/veilid-core/src/storage_manager/mod.rs +++ b/veilid-core/src/storage_manager/mod.rs @@ -771,7 +771,7 @@ impl StorageManager { #[allow(clippy::unnecessary_cast)] { assert!( - local_inspect_result.subkeys.len() as usize == local_inspect_result.seqs.len(), + local_inspect_result.subkeys.len() as u64 == local_inspect_result.seqs.len() as u64, "mismatch between local subkeys returned and sequence number list returned" ); } @@ -824,8 +824,8 @@ impl StorageManager { #[allow(clippy::unnecessary_cast)] { assert_eq!( - result.inspect_result.subkeys.len() as usize, - result.fanout_results.len(), + result.inspect_result.subkeys.len() as u64, + result.fanout_results.len() as u64, "mismatch between subkeys returned and fanout results returned" ); } diff --git a/veilid-flutter/example/integration_test/fixtures.dart b/veilid-flutter/example/integration_test/fixtures.dart index 11617932..703e9a00 100644 --- a/veilid-flutter/example/integration_test/fixtures.dart +++ b/veilid-flutter/example/integration_test/fixtures.dart @@ -76,6 +76,7 @@ class DefaultFixture { _veilidUpdateSubscription = us.listen((update) { if (update is VeilidLog) { + // print(update.message); } else if (update is VeilidUpdateAttachment) { } else if (update is VeilidUpdateConfig) { } else if (update is VeilidUpdateNetwork) { diff --git a/veilid-flutter/example/integration_test/test_table_db.dart b/veilid-flutter/example/integration_test/test_table_db.dart index 136f667d..56674adf 100644 --- a/veilid-flutter/example/integration_test/test_table_db.dart +++ b/veilid-flutter/example/integration_test/test_table_db.dart @@ -16,7 +16,7 @@ Future testOpenDeleteTableDb() async { final tdb = await Veilid.instance.openTableDB(testDb, 1); try { - expect(() async => await Veilid.instance.deleteTableDB(testDb), + await expectLater(() async => await Veilid.instance.deleteTableDB(testDb), throwsA(isA())); } finally { tdb.close(); diff --git a/veilid-flutter/example/test_driver/integration_test.dart b/veilid-flutter/example/test_driver/integration_test.dart new file mode 100644 index 00000000..b38629cc --- /dev/null +++ b/veilid-flutter/example/test_driver/integration_test.dart @@ -0,0 +1,3 @@ +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); diff --git a/veilid-flutter/lib/veilid_state.dart b/veilid-flutter/lib/veilid_state.dart index d5d2f366..f45cd07e 100644 --- a/veilid-flutter/lib/veilid_state.dart +++ b/veilid-flutter/lib/veilid_state.dart @@ -144,12 +144,12 @@ sealed class VeilidUpdate with _$VeilidUpdate { String? backtrace, }) = VeilidLog; const factory VeilidUpdate.appMessage({ - @Uint8ListJsonConverter() required Uint8List message, + @Uint8ListJsonConverter.jsIsArray() required Uint8List message, TypedKey? sender, String? routeId, }) = VeilidAppMessage; const factory VeilidUpdate.appCall({ - @Uint8ListJsonConverter() required Uint8List message, + @Uint8ListJsonConverter.jsIsArray() required Uint8List message, required String callId, TypedKey? sender, String? routeId, diff --git a/veilid-flutter/lib/veilid_state.freezed.dart b/veilid-flutter/lib/veilid_state.freezed.dart index 5759ae7b..4bba1f1d 100644 --- a/veilid-flutter/lib/veilid_state.freezed.dart +++ b/veilid-flutter/lib/veilid_state.freezed.dart @@ -1338,11 +1338,16 @@ mixin _$VeilidUpdate { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -1364,11 +1369,11 @@ mixin _$VeilidUpdate { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -1392,11 +1397,14 @@ mixin _$VeilidUpdate { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -1568,11 +1576,16 @@ class _$VeilidLogImpl implements VeilidLog { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -1597,11 +1610,11 @@ class _$VeilidLogImpl implements VeilidLog { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -1628,11 +1641,14 @@ class _$VeilidLogImpl implements VeilidLog { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -1735,7 +1751,7 @@ abstract class _$$VeilidAppMessageImplCopyWith<$Res> { __$$VeilidAppMessageImplCopyWithImpl<$Res>; @useResult $Res call( - {@Uint8ListJsonConverter() Uint8List message, + {@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId}); } @@ -1776,7 +1792,7 @@ class __$$VeilidAppMessageImplCopyWithImpl<$Res> @JsonSerializable() class _$VeilidAppMessageImpl implements VeilidAppMessage { const _$VeilidAppMessageImpl( - {@Uint8ListJsonConverter() required this.message, + {@Uint8ListJsonConverter.jsIsArray() required this.message, this.sender, this.routeId, final String? $type}) @@ -1786,7 +1802,7 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage { _$$VeilidAppMessageImplFromJson(json); @override - @Uint8ListJsonConverter() + @Uint8ListJsonConverter.jsIsArray() final Uint8List message; @override final Typed? sender; @@ -1829,11 +1845,16 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -1858,11 +1879,11 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -1889,11 +1910,14 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -1974,14 +1998,14 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage { abstract class VeilidAppMessage implements VeilidUpdate { const factory VeilidAppMessage( - {@Uint8ListJsonConverter() required final Uint8List message, + {@Uint8ListJsonConverter.jsIsArray() required final Uint8List message, final Typed? sender, final String? routeId}) = _$VeilidAppMessageImpl; factory VeilidAppMessage.fromJson(Map json) = _$VeilidAppMessageImpl.fromJson; - @Uint8ListJsonConverter() + @Uint8ListJsonConverter.jsIsArray() Uint8List get message; Typed? get sender; String? get routeId; @@ -1997,7 +2021,7 @@ abstract class _$$VeilidAppCallImplCopyWith<$Res> { __$$VeilidAppCallImplCopyWithImpl<$Res>; @useResult $Res call( - {@Uint8ListJsonConverter() Uint8List message, + {@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId}); @@ -2044,7 +2068,7 @@ class __$$VeilidAppCallImplCopyWithImpl<$Res> @JsonSerializable() class _$VeilidAppCallImpl implements VeilidAppCall { const _$VeilidAppCallImpl( - {@Uint8ListJsonConverter() required this.message, + {@Uint8ListJsonConverter.jsIsArray() required this.message, required this.callId, this.sender, this.routeId, @@ -2055,7 +2079,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall { _$$VeilidAppCallImplFromJson(json); @override - @Uint8ListJsonConverter() + @Uint8ListJsonConverter.jsIsArray() final Uint8List message; @override final String callId; @@ -2100,11 +2124,16 @@ class _$VeilidAppCallImpl implements VeilidAppCall { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -2129,11 +2158,11 @@ class _$VeilidAppCallImpl implements VeilidAppCall { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -2160,11 +2189,14 @@ class _$VeilidAppCallImpl implements VeilidAppCall { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -2245,7 +2277,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall { abstract class VeilidAppCall implements VeilidUpdate { const factory VeilidAppCall( - {@Uint8ListJsonConverter() required final Uint8List message, + {@Uint8ListJsonConverter.jsIsArray() required final Uint8List message, required final String callId, final Typed? sender, final String? routeId}) = _$VeilidAppCallImpl; @@ -2253,7 +2285,7 @@ abstract class VeilidAppCall implements VeilidUpdate { factory VeilidAppCall.fromJson(Map json) = _$VeilidAppCallImpl.fromJson; - @Uint8ListJsonConverter() + @Uint8ListJsonConverter.jsIsArray() Uint8List get message; String get callId; Typed? get sender; @@ -2367,11 +2399,16 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -2396,11 +2433,11 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -2427,11 +2464,14 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -2640,11 +2680,16 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -2669,11 +2714,11 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -2700,11 +2745,14 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -2888,11 +2936,16 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -2917,11 +2970,11 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -2948,11 +3001,14 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -3152,11 +3208,16 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -3181,11 +3242,11 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -3212,11 +3273,14 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? @@ -3440,11 +3504,16 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange { required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + Typed? sender, + String? routeId) appMessage, - required TResult Function(@Uint8ListJsonConverter() Uint8List message, - String callId, Typed? sender, String? routeId) + required TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId) appCall, required TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady) @@ -3469,11 +3538,11 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange { TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult? Function(@Uint8ListJsonConverter() Uint8List message, + TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, TResult? Function( - @Uint8ListJsonConverter() Uint8List message, + @Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, Typed? sender, String? routeId)? @@ -3500,11 +3569,14 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange { TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log, - TResult Function(@Uint8ListJsonConverter() Uint8List message, + TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, Typed? sender, String? routeId)? appMessage, - TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, - Typed? sender, String? routeId)? + TResult Function( + @Uint8ListJsonConverter.jsIsArray() Uint8List message, + String callId, + Typed? sender, + String? routeId)? appCall, TResult Function(AttachmentState state, bool publicInternetReady, bool localNetworkReady)? diff --git a/veilid-flutter/lib/veilid_state.g.dart b/veilid-flutter/lib/veilid_state.g.dart index b23f7504..4f454466 100644 --- a/veilid-flutter/lib/veilid_state.g.dart +++ b/veilid-flutter/lib/veilid_state.g.dart @@ -133,7 +133,8 @@ Map _$$VeilidLogImplToJson(_$VeilidLogImpl instance) => _$VeilidAppMessageImpl _$$VeilidAppMessageImplFromJson( Map json) => _$VeilidAppMessageImpl( - message: const Uint8ListJsonConverter().fromJson(json['message']), + message: + const Uint8ListJsonConverter.jsIsArray().fromJson(json['message']), sender: json['sender'] == null ? null : Typed.fromJson(json['sender']), @@ -144,7 +145,8 @@ _$VeilidAppMessageImpl _$$VeilidAppMessageImplFromJson( Map _$$VeilidAppMessageImplToJson( _$VeilidAppMessageImpl instance) => { - 'message': const Uint8ListJsonConverter().toJson(instance.message), + 'message': + const Uint8ListJsonConverter.jsIsArray().toJson(instance.message), 'sender': instance.sender?.toJson(), 'route_id': instance.routeId, 'kind': instance.$type, @@ -152,7 +154,8 @@ Map _$$VeilidAppMessageImplToJson( _$VeilidAppCallImpl _$$VeilidAppCallImplFromJson(Map json) => _$VeilidAppCallImpl( - message: const Uint8ListJsonConverter().fromJson(json['message']), + message: + const Uint8ListJsonConverter.jsIsArray().fromJson(json['message']), callId: json['call_id'] as String, sender: json['sender'] == null ? null @@ -163,7 +166,8 @@ _$VeilidAppCallImpl _$$VeilidAppCallImplFromJson(Map json) => Map _$$VeilidAppCallImplToJson(_$VeilidAppCallImpl instance) => { - 'message': const Uint8ListJsonConverter().toJson(instance.message), + 'message': + const Uint8ListJsonConverter.jsIsArray().toJson(instance.message), 'call_id': instance.callId, 'sender': instance.sender?.toJson(), 'route_id': instance.routeId, diff --git a/veilid-flutter/run_integration_tests_web.sh b/veilid-flutter/run_integration_tests_web.sh new file mode 100755 index 00000000..c74f9fdf --- /dev/null +++ b/veilid-flutter/run_integration_tests_web.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo Ensure chromedriver is running on port 4444 and you have compiled veilid-wasm with wasm_build.sh +pushd example 2>/dev/null +flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d chrome $@ +popd 2>/dev/null diff --git a/veilid-wasm/src/lib.rs b/veilid-wasm/src/lib.rs index ee439284..c2a9b6ca 100644 --- a/veilid-wasm/src/lib.rs +++ b/veilid-wasm/src/lib.rs @@ -644,6 +644,7 @@ pub fn routing_context_inspect_dht_record( let res = routing_context .inspect_dht_record(key, subkeys, scope) .await?; + APIResult::Ok(res) }) } @@ -695,7 +696,7 @@ pub fn import_remote_private_route(blob: String) -> Promise { #[wasm_bindgen()] pub fn release_private_route(route_id: String) -> Promise { - let route_id: veilid_core::RouteId = veilid_core::deserialize_json(&route_id).unwrap(); + let route_id: veilid_core::RouteId = veilid_core::RouteId::try_decode(&route_id).unwrap(); wrap_api_future_void(async move { let veilid_api = get_veilid_api()?; veilid_api.release_private_route(route_id)?;