From 3b2c11b3422a4968ab729b28a85eab09150434ed Mon Sep 17 00:00:00 2001 From: "leonardo.gabriel" Date: Fri, 20 Dec 2024 13:22:08 -0300 Subject: [PATCH 1/2] feat: version upgrade --- lib/lime.dart | 65 +++-- lib/src/protocol/client/client_channel.dart | 6 +- lib/src/protocol/command.dart | 27 +- .../enums/notification_event.enum.dart | 3 + .../authentication_schema.extension.dart | 3 +- .../notification_event.extension.dart | 19 +- lib/src/protocol/message.dart | 11 +- lib/src/protocol/node.dart | 34 ++- lib/src/protocol/notification.dart | 16 +- lib/src/protocol/presence.dart | 5 +- lib/src/protocol/session.dart | 32 +- pubspec.lock | 275 +++++++++++------- pubspec.yaml | 6 +- test/protocol/command_test.dart | 15 +- test/protocol/notification_test.dart | 11 +- test/protocol/session_test.dart | 9 +- 16 files changed, 301 insertions(+), 236 deletions(-) diff --git a/lib/lime.dart b/lib/lime.dart index 6fa72e8..a093919 100644 --- a/lib/lime.dart +++ b/lib/lime.dart @@ -1,53 +1,54 @@ -library lime; +library; -export 'src/protocol/guid.dart' show guid; -export 'src/protocol/extensions/string.extension.dart' show StringExtension; -export 'src/protocol/extensions/notification_event.extension.dart' - show NotificationEventExtension; +export 'package:lime/src/protocol/extensions/authentication_schema.extension.dart' + show AuthenticationSchemaExtension; + +export 'src/protocol/client/client_channel.dart' show ClientChannel; export 'src/protocol/command.dart' show Command; export 'src/protocol/document.dart' show Document; -export 'src/protocol/envelope.dart' show Envelope; -export 'src/protocol/lime_uri.dart' show LimeUri; -export 'src/protocol/media_type.dart' show MediaType; -export 'src/protocol/message.dart' show Message; -export 'src/protocol/notification.dart' show Notification; -export 'src/protocol/plain_document.dart' show PlainDocument; -export 'src/protocol/reason_codes.dart' show ReasonCodes; -export 'src/protocol/reason.dart' show Reason; export 'src/protocol/enums/command_method.enum.dart' show CommandMethod; export 'src/protocol/enums/command_status.enum.dart' show CommandStatus; export 'src/protocol/enums/notification_event.enum.dart' show NotificationEvent; +export 'src/protocol/enums/presence_status.enum.dart' show PresenceStatus; +export 'src/protocol/enums/routing_rule.enum.dart' show RoutingRule; export 'src/protocol/enums/session_compression.enum.dart' show SessionCompression; export 'src/protocol/enums/session_encryption.enum.dart' show SessionEncryption; export 'src/protocol/enums/session_state.enum.dart' show SessionState; -export 'src/protocol/enums/presence_status.enum.dart' show PresenceStatus; -export 'src/protocol/enums/routing_rule.enum.dart' show RoutingRule; +export 'src/protocol/envelope.dart' show Envelope; +export 'src/protocol/exceptions/insecure_socket.exception.dart' + show InsecureSocketException; +export 'src/protocol/exceptions/lime.exception.dart' show LimeException; export 'src/protocol/extensions/envelope.extension.dart' show EnvelopeExtension; -export 'src/protocol/types/composite_types.dart' show CompositeTypes; -export 'src/protocol/types/discrete_types.dart' show DiscreteTypes; -export 'src/protocol/types/sub_types.dart' show SubTypes; -export 'src/protocol/node.dart' show Node; +export 'src/protocol/extensions/notification_event.extension.dart' + show NotificationEventExtension; +export 'src/protocol/extensions/string.extension.dart' show StringExtension; +export 'src/protocol/guid.dart' show guid; export 'src/protocol/identity.dart' show Identity; -export 'src/protocol/session.dart' show Session; +export 'src/protocol/lime_uri.dart' show LimeUri; +export 'src/protocol/media_type.dart' show MediaType; +export 'src/protocol/message.dart' show Message; +export 'src/protocol/network/transport.dart' show Transport; +export 'src/protocol/network/web_socket_transport.dart' show WebSocketTransport; +export 'src/protocol/node.dart' show Node; +export 'src/protocol/notification.dart' show Notification; +export 'src/protocol/plain_document.dart' show PlainDocument; export 'src/protocol/presence.dart' show Presence; +export 'src/protocol/reason.dart' show Reason; +export 'src/protocol/reason_codes.dart' show ReasonCodes; export 'src/protocol/security/authentication.dart' show Authentication; +export 'src/protocol/security/enums/authentication_scheme.enum.dart' + show AuthenticationScheme; +export 'src/protocol/security/external_authentication.dart' + show ExternalAuthentication; export 'src/protocol/security/guest_authentication.dart' show GuestAuthentication; export 'src/protocol/security/key_authentication.dart' show KeyAuthentication; -export 'src/protocol/security/external_authentication.dart' - show ExternalAuthentication; export 'src/protocol/security/plain_authentication.dart' show PlainAuthentication; export 'src/protocol/security/transport_authentication.dart' show TransportAuthentication; -export 'src/protocol/security/enums/authentication_scheme.enum.dart' - show AuthenticationScheme; -export 'package:lime/src/protocol/extensions/authentication_schema.extension.dart' - show AuthenticationSchemaExtension; -export 'src/protocol/client/client_channel.dart' show ClientChannel; -export 'src/protocol/network/transport.dart' show Transport; -export 'src/protocol/network/web_socket_transport.dart' show WebSocketTransport; -export 'src/protocol/exceptions/lime.exception.dart' show LimeException; -export 'src/protocol/exceptions/insecure_socket.exception.dart' - show InsecureSocketException; +export 'src/protocol/session.dart' show Session; +export 'src/protocol/types/composite_types.dart' show CompositeTypes; +export 'src/protocol/types/discrete_types.dart' show DiscreteTypes; +export 'src/protocol/types/sub_types.dart' show SubTypes; diff --git a/lib/src/protocol/client/client_channel.dart b/lib/src/protocol/client/client_channel.dart index 80018d6..97d3af6 100644 --- a/lib/src/protocol/client/client_channel.dart +++ b/lib/src/protocol/client/client_channel.dart @@ -14,12 +14,10 @@ import 'channel.dart'; class ClientChannel extends Channel { ClientChannel( Transport transport, { - final bool autoReplyPings = true, - final bool autoNotifyReceipt = false, + super.autoReplyPings = true, + super.autoNotifyReceipt = false, }) : super( transport: transport, - autoReplyPings: autoReplyPings, - autoNotifyReceipt: autoNotifyReceipt, ); /// Exposes a [StreamController] to allow listening when a new [Notification] is received by the channel diff --git a/lib/src/protocol/command.dart b/lib/src/protocol/command.dart index 0202903..1f88308 100644 --- a/lib/src/protocol/command.dart +++ b/lib/src/protocol/command.dart @@ -1,11 +1,9 @@ -import 'package:flutter/foundation.dart'; -import 'guid.dart'; +import 'enums/command_method.enum.dart'; +import 'enums/command_status.enum.dart'; import 'envelope.dart'; +import 'guid.dart'; import 'message.dart'; -import 'node.dart'; import 'reason.dart'; -import 'enums/command_method.enum.dart'; -import 'enums/command_status.enum.dart'; /// Allows the manipulation of node resources, like server session parameters or information related to the network nodes. class Command extends Envelope { @@ -37,24 +35,24 @@ class Command extends Envelope { /// Initializes a new instance of the Command class. Command({ final String? id, - final Node? from, - final Node? to, - final Node? pp, - final Map? metadata, + super.from, + super.to, + super.pp, + super.metadata, this.uri, required this.method, this.reason, this.resource, this.status, this.type, - }) : super(id: id ?? guid(), from: from, to: to, pp: pp, metadata: metadata); + }) : super(id: id ?? guid()); /// Allows converting a [Command] object to a [Map] collection of key/value pairs Map toJson() { Map command = {}; command[Envelope.idKey] = id; - command[methodKey] = describeEnum(method); + command[methodKey] = method.name; if (from != null) { command[Envelope.fromKey] = from.toString(); @@ -73,7 +71,7 @@ class Command extends Envelope { } if (status != null) { - command[statusKey] = describeEnum(status!); + command[statusKey] = status!.name; } if (uri != null) { @@ -106,7 +104,7 @@ class Command extends Envelope { pp: envelope.pp, metadata: envelope.metadata, method: json[methodKey] != null - ? CommandMethod.values.firstWhere((e) => describeEnum(e) == json[methodKey]) + ? CommandMethod.values.firstWhere((e) => e.name == json[methodKey]) : CommandMethod.unknown, ); @@ -115,7 +113,8 @@ class Command extends Envelope { } if (json.containsKey(statusKey)) { - command.status = CommandStatus.values.firstWhere((e) => describeEnum(e) == json[statusKey]); + command.status = + CommandStatus.values.firstWhere((e) => e.name == json[statusKey]); } if (json.containsKey(uriKey)) { diff --git a/lib/src/protocol/enums/notification_event.enum.dart b/lib/src/protocol/enums/notification_event.enum.dart index aaa9273..40e1302 100644 --- a/lib/src/protocol/enums/notification_event.enum.dart +++ b/lib/src/protocol/enums/notification_event.enum.dart @@ -18,6 +18,9 @@ enum NotificationEvent { /// A problem occurred during the processing of the message. failed, + /// The message is being sent + sending, + /// The message format was validated by the server. @Deprecated("This specific event should not be sent anymore") validated, diff --git a/lib/src/protocol/extensions/authentication_schema.extension.dart b/lib/src/protocol/extensions/authentication_schema.extension.dart index 1759751..fff9858 100644 --- a/lib/src/protocol/extensions/authentication_schema.extension.dart +++ b/lib/src/protocol/extensions/authentication_schema.extension.dart @@ -1,8 +1,7 @@ -import 'package:flutter/foundation.dart'; import 'package:lime/lime.dart'; extension AuthenticationSchemaExtension on AuthenticationScheme { AuthenticationScheme getValue(String? value) => - AuthenticationScheme.values.firstWhere((e) => describeEnum(e) == value, + AuthenticationScheme.values.firstWhere((e) => e.name == value, orElse: () => AuthenticationScheme.unknown); } diff --git a/lib/src/protocol/extensions/notification_event.extension.dart b/lib/src/protocol/extensions/notification_event.extension.dart index 5cd641c..45752df 100644 --- a/lib/src/protocol/extensions/notification_event.extension.dart +++ b/lib/src/protocol/extensions/notification_event.extension.dart @@ -1,21 +1,22 @@ -import 'package:flutter/foundation.dart'; - import '../enums/notification_event.enum.dart'; extension NotificationEventExtension on NotificationEvent { NotificationEvent getValue(String? value) => - NotificationEvent.values.firstWhere((e) => describeEnum(e) == value, orElse: () => NotificationEvent.unknown); + NotificationEvent.values.firstWhere((e) => e.name == value, + orElse: () => NotificationEvent.unknown); bool isLowerThan(NotificationEvent? other) { const events = { - NotificationEvent.accepted: 0, - NotificationEvent.dispatched: 1, - NotificationEvent.received: 2, - NotificationEvent.consumed: 3, - NotificationEvent.failed: 4, + NotificationEvent.sending: 0, + NotificationEvent.accepted: 1, + NotificationEvent.dispatched: 2, + NotificationEvent.received: 3, + NotificationEvent.consumed: 4, + NotificationEvent.failed: 5, NotificationEvent.unknown: 99, }; - return (events[this] ?? 99) < (events[other ?? NotificationEvent.unknown] ?? 99); + return (events[this] ?? 99) < + (events[other ?? NotificationEvent.unknown] ?? 99); } } diff --git a/lib/src/protocol/message.dart b/lib/src/protocol/message.dart index f2b78ff..70fe5c5 100644 --- a/lib/src/protocol/message.dart +++ b/lib/src/protocol/message.dart @@ -1,6 +1,5 @@ import 'envelope.dart'; import 'guid.dart'; -import 'node.dart'; /// Provides the transport of a content between nodes in a network. class Message extends Envelope { @@ -10,13 +9,13 @@ class Message extends Envelope { /// Initializes a new instance of the Message class. Message({ final String? id, - final Node? from, - final Node? to, - final Node? pp, - Map? metadata, + super.from, + super.to, + super.pp, + super.metadata, this.content, this.type, - }) : super(id: id ?? guid(), from: from, to: to, pp: pp, metadata: metadata); + }) : super(id: id ?? guid()); /// MIME declaration of the content type of the message. String? type; diff --git a/lib/src/protocol/node.dart b/lib/src/protocol/node.dart index c24f576..019d38f 100644 --- a/lib/src/protocol/node.dart +++ b/lib/src/protocol/node.dart @@ -4,7 +4,11 @@ import 'interfaces/inode.dart'; /// Represents an element of a network. class Node extends Identity implements INode { /// Initializes a new instance of the node class. - Node({String? name, String? domain, this.instance}) : super(name: name, domain: domain); + Node({ + super.name, + super.domain, + this.instance, + }); /// The name of the instance used by the node to connect to the network. @override @@ -20,19 +24,27 @@ class Node extends Identity implements INode { @override String toString() { - return instance == null ? super.toString() : '${super.toString()}/$instance'; + return instance == null + ? super.toString() + : '${super.toString()}/$instance'; } bool _equals(other) { - final node = other as Node?; + final stringNode = other?.toString(); + + final node = tryParse(stringNode) ? parse(stringNode) : null; if (node == null) return false; - return ((name == null && node.name == null) || (name != null && name?.toLowerCase() == node.name?.toLowerCase())) && + return ((name == null && node.name == null) || + (name != null && + name?.toLowerCase() == node.name?.toLowerCase())) && ((domain == null && node.domain == null) || - (domain != null && domain?.toLowerCase() == node.domain?.toLowerCase())) && + (domain != null && + domain?.toLowerCase() == node.domain?.toLowerCase())) && ((instance == null && node.instance == null) || - (instance != null && instance?.toLowerCase() == node.instance?.toLowerCase())); + (instance != null && + instance?.toLowerCase() == node.instance?.toLowerCase())); } /// Parses the string to a valid Node. @@ -47,12 +59,14 @@ class Node extends Identity implements INode { return Node( name: identity.name, domain: identity.domain, - instance: s!.length > identityString.length ? s.substring(identityString.length + 1) : null); + instance: s!.length > identityString.length + ? s.substring(identityString.length + 1) + : null); } /// Tries to parse the string to a valid Node. static bool tryParse( - String s, + String? s, ) { try { parse(s); @@ -69,6 +83,8 @@ class Node extends Identity implements INode { /// Indicates if the node is a complete representation, bool isComplete() { - return !['', null].contains(name) && !['', null].contains(domain) && !['', null].contains(instance); + return !['', null].contains(name) && + !['', null].contains(domain) && + !['', null].contains(instance); } } diff --git a/lib/src/protocol/notification.dart b/lib/src/protocol/notification.dart index 9f9ae84..23a37eb 100644 --- a/lib/src/protocol/notification.dart +++ b/lib/src/protocol/notification.dart @@ -1,8 +1,6 @@ -import 'package:flutter/foundation.dart'; import 'enums/notification_event.enum.dart'; import 'envelope.dart'; import 'guid.dart'; -import 'node.dart'; import 'reason.dart'; /// Transports information about events associated to a message in a session. @@ -13,13 +11,13 @@ class Notification extends Envelope { Notification({ final String? id, - final Node? from, - final Node? to, - final Node? pp, - final Map? metadata, + super.from, + super.to, + super.pp, + super.metadata, this.event, this.reason, - }) : super(id: id ?? guid(), from: from, to: to, pp: pp, metadata: metadata); + }) : super(id: id ?? guid()); /// Related event to the notification NotificationEvent? event; @@ -50,7 +48,7 @@ class Notification extends Envelope { } if (event != null) { - notification[eventKey] = describeEnum(event!); + notification[eventKey] = event!.name; } if (reason != null) { @@ -77,7 +75,7 @@ class Notification extends Envelope { } if (json.containsKey(eventKey)) { notification.event = NotificationEvent.values - .firstWhere((e) => describeEnum(e) == json[eventKey]); + .firstWhere((e) => e.name == json[eventKey]); } return notification; diff --git a/lib/src/protocol/presence.dart b/lib/src/protocol/presence.dart index cc3c3dd..64ab5e3 100644 --- a/lib/src/protocol/presence.dart +++ b/lib/src/protocol/presence.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'document.dart'; import 'media_type.dart'; @@ -45,11 +44,11 @@ class Presence extends Document { Map presence = {}; if (status != null) { - presence['status'] = describeEnum(status!); + presence['status'] = status!.name; } if (routingRule != null) { - presence['routingRule'] = describeEnum(routingRule!); + presence['routingRule'] = routingRule!.name; } if (message != null) { diff --git a/lib/src/protocol/session.dart b/lib/src/protocol/session.dart index af38021..9038290 100644 --- a/lib/src/protocol/session.dart +++ b/lib/src/protocol/session.dart @@ -1,16 +1,14 @@ -import 'package:flutter/foundation.dart'; +import 'enums/session_compression.enum.dart'; +import 'enums/session_encryption.enum.dart'; +import 'enums/session_state.enum.dart'; import 'envelope.dart'; import 'guid.dart'; -import 'node.dart'; import 'reason.dart'; +import 'security/authentication.dart'; import 'security/enums/authentication_scheme.enum.dart'; import 'security/external_authentication.dart'; import 'security/key_authentication.dart'; -import 'security/authentication.dart'; import 'security/plain_authentication.dart'; -import 'enums/session_compression.enum.dart'; -import 'enums/session_encryption.enum.dart'; -import 'enums/session_state.enum.dart'; /// Allows the configuration and establishment of the communication channel between nodes. class Session extends Envelope { @@ -28,19 +26,15 @@ class Session extends Envelope { /// Initializes a new instance of the Session class. Session( {final String? id, - final Node? from, - final Node? to, - final Node? pp, - final Map? metadata, + super.from, + super.to, + super.pp, + Map? super.metadata, this.state, this.scheme, this.authentication}) : super( id: id ?? guid(), - from: from, - to: to, - pp: pp, - metadata: metadata, ); /// Informs or changes the state of a session. @@ -91,7 +85,7 @@ class Session extends Envelope { if (state != null) { session[stateKey] = - describeEnum(state!) == 'isNew' ? 'new' : describeEnum(state!); + state!.name == 'isNew' ? 'new' : state!.name; } session[Envelope.idKey] = id; @@ -113,7 +107,7 @@ class Session extends Envelope { } if (scheme != null) { - session[schemeKey] = describeEnum(scheme!); + session[schemeKey] = scheme!.name; } if (authentication != null) { @@ -125,7 +119,7 @@ class Session extends Envelope { session[authenticationKey] = { "token": externalAuth.token, "issuer": externalAuth.issuer, - "scheme": describeEnum(externalAuth.scheme) + "scheme": externalAuth.scheme.name }; } else if (authentication is PlainAuthentication) { final plainAuth = authentication as PlainAuthentication; @@ -148,14 +142,14 @@ class Session extends Envelope { ); if (json.containsKey(stateKey)) { - session.state = SessionState.values.firstWhere((e) => describeEnum(e) == json[stateKey]); + session.state = SessionState.values.firstWhere((e) => e.name == json[stateKey]); } if (json.containsKey(schemeOptionsKey)) { final schemeOptionsList = json[schemeOptionsKey] as List; final schemeOptions = schemeOptionsList .map((e) => AuthenticationScheme.values - .firstWhere((e2) => describeEnum(e2) == e)) + .firstWhere((e2) => e2.name == e)) .toList(); session.schemeOptions = schemeOptions; } diff --git a/pubspec.lock b/pubspec.lock index 5934894..5559467 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,26 +5,31 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: "88399e291da5f7e889359681a8f64b18c5123e03576b01f32a6a276611e511c3" url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "78.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" analyzer: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + sha256: "62899ef43d0b962b056ed2ebac6b47ec76ffd003d5f7c4e4dc870afe63188e33" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "7.1.0" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.6.0" async: dependency: transitive description: @@ -45,50 +50,50 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" build_config: dependency: transitive description: name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" build_daemon: dependency: transitive description: name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + sha256: "294a2edaf4814a378725bfe6358210196f5ea37af89ecd81bfa32960113d4948" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.3" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "6c4dd11d05d056e76320b828a1db0fc01ccd376922526f8e9d6c796a5adbac20" + sha256: "99d3980049739a985cf9b21f30881f46db3ebc62c5b8d5e60e27440876b1ba1e" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.4.3" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + sha256: "74691599a5bc750dc96a6b4bfd48f7d9d66453eab04c7f4063134800d6a5c573" url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.14" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "8.0.0" built_collection: dependency: transitive description: @@ -101,10 +106,10 @@ packages: dependency: transitive description: name: built_value - sha256: "598a2a682e2a7a90f08ba39c0aaa9374c5112340f0a2e275f61b59389543d166" + sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" url: "https://pub.dev" source: hosted - version: "8.6.1" + version: "8.9.3" characters: dependency: transitive description: @@ -133,42 +138,42 @@ packages: dependency: transitive description: name: code_builder - sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" url: "https://pub.dev" source: hosted - version: "4.5.0" + version: "4.10.1" collection: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.19.0" convert: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" dart_style: dependency: transitive description: name: dart_style - sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + sha256: "64b717484993e85315d0c04081b6fca9ef8bac8c2cb794b2e15810250b335913" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "3.0.0" fake_async: dependency: transitive description: @@ -181,18 +186,18 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" fixnum: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -202,10 +207,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -215,10 +220,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.0.0" glob: dependency: transitive description: @@ -231,122 +236,154 @@ packages: dependency: transitive description: name: graphs - sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" http_multi_server: dependency: transitive description: name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" http_parser: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + sha256: "76d306a1c3afb33fe82e2bbacad62a61f409b5634c915fceb0d799de1a913360" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.1.1" io: dependency: transitive description: name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" js: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.7.1" json_annotation: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "3.0.1" lints: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "5.1.1" logging: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "0.1.3-main.0" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" mime: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "2.0.0" mockito: dependency: "direct dev" description: name: mockito - sha256: "8b46d7eb40abdda92d62edd01546051f0c27365e65608c284de336dccfef88cc" + sha256: f99d8d072e249f719a5531735d146d8cf04c580d93920b04de75bef6dfb2daf6 url: "https://pub.dev" source: hosted - version: "5.4.1" + version: "5.4.5" package_config: dependency: transitive description: name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" pool: dependency: transitive description: @@ -367,55 +404,55 @@ packages: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0" url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.4.0" shelf: dependency: transitive description: name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "2.0.1" simple_logger: dependency: "direct main" description: name: simple_logger - sha256: "0b0006199015a81c30041390b91e4c9561079d631541ffc317f76fd1181c9cc7" + sha256: "1de79f22bf31e5c33b91e9e302394dac02d8269d474848d33153c3a15c08e970" url: "https://pub.dev" source: hosted - version: "1.9.0+2" + version: "1.10.0" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_gen: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "2.0.0" source_span: dependency: transitive description: @@ -424,38 +461,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: name: stream_transform - sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -468,34 +513,34 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.3" timing: dependency: transitive description: name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" uuid: dependency: "direct main" description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.5.1" vector_math: dependency: transitive description: @@ -504,38 +549,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" watcher: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.1" web: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "3.0.1" yaml: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=1.17.0" + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index f06d998..9c5326c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,13 +5,13 @@ homepage: https://limeprotocol.org/ repository: https://github.com/takenet/lime-dart environment: - sdk: ">=2.12.0 <4.0.0" + sdk: ^3.5.1 flutter: ">=1.17.0" dependencies: flutter: sdk: flutter - uuid: ^3.0.5 + uuid: ^4.5.0 simple_logger: ^1.9.0 pretty_json: ^2.0.0 @@ -21,7 +21,7 @@ dev_dependencies: sdk: flutter mockito: ^5.1.0 build_runner: ^2.1.10 - flutter_lints: ^2.0.2 + flutter_lints: ^5.0.0 # The following section is specific to Flutter packages. flutter: diff --git a/test/protocol/command_test.dart b/test/protocol/command_test.dart index eb1ff66..5696c78 100644 --- a/test/protocol/command_test.dart +++ b/test/protocol/command_test.dart @@ -1,10 +1,9 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:lime/lime.dart'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:lime/lime.dart'; + void main() { const String jsonPath = "test_resources/command.json"; Map json = {}; @@ -24,9 +23,9 @@ void main() { final command = Command.fromJson(json); expect(command.metadata, equals(json['metadata'])); - expect(describeEnum(command.method), equals(json['method'])); + expect(command.method.name, equals(json['method'])); expect(command.resource, equals(json['resource'])); - expect(describeEnum(command.status!), equals(json['status'])); + expect(command.status!.name, equals(json['status'])); expect(command.type, equals(json['type'])); expect(command.uri, equals(json['uri'])); expect( @@ -47,9 +46,9 @@ void main() { final jsonDoc = command.toJson(); expect(jsonDoc['metadata'], equals(command.metadata)); - expect(jsonDoc['method'], equals(describeEnum(command.method))); + expect(jsonDoc['method'], equals(command.method.name)); expect(jsonDoc['resource'], equals(command.resource)); - expect(jsonDoc['status'], equals(describeEnum(command.status!))); + expect(jsonDoc['status'], equals(command.status!.name)); expect(jsonDoc['type'], equals(command.type)); expect(jsonDoc['uri'], equals(command.uri)); expect(jsonDoc['reason']['description'], diff --git a/test/protocol/notification_test.dart b/test/protocol/notification_test.dart index 383de32..d05e78c 100644 --- a/test/protocol/notification_test.dart +++ b/test/protocol/notification_test.dart @@ -1,10 +1,9 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:lime/lime.dart'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:lime/lime.dart'; + void main() async { const String jsonPath = "test_resources/notification.json"; Map json = {}; @@ -21,7 +20,7 @@ void main() async { test('should set the Notification properties ', () async { final notification = Notification.fromJson(json); - expect(describeEnum(notification.event!), equals(json['event'])); + expect(notification.event!.name, equals(json['event'])); expect(notification.reason!.description, equals(json['reason']['description'])); expect(notification.reason!.code, equals(json['reason']['code'])); @@ -39,7 +38,7 @@ void main() async { final notification = Notification.fromJson(json); final jsonDoc = notification.toJson(); - expect(jsonDoc['event'], equals(describeEnum(notification.event!))); + expect(jsonDoc['event'], equals(notification.event!.name)); expect(jsonDoc['reason']['description'], equals(notification.reason!.description)); expect(jsonDoc['reason']['code'], equals(notification.reason!.code)); diff --git a/test/protocol/session_test.dart b/test/protocol/session_test.dart index ecd5b85..15d8c89 100644 --- a/test/protocol/session_test.dart +++ b/test/protocol/session_test.dart @@ -1,10 +1,9 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:lime/lime.dart'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:lime/lime.dart'; + void main() async { const String jsonPath = "test_resources/session.json"; Map json = {}; @@ -21,7 +20,7 @@ void main() async { test('should set the Session properties ', () async { final session = Session.fromJson(json); - expect(describeEnum(session.state!), equals(json['state'])); + expect(session.state!.name, equals(json['state'])); expect( session.reason!.description, equals(json['reason']['description'])); expect(session.reason!.code, equals(json['reason']['code'])); From 22d15ac3b2d1914dcc0fc92ab264bffbeefffce9 Mon Sep 17 00:00:00 2001 From: "leonardo.gabriel" Date: Fri, 20 Dec 2024 16:39:25 -0300 Subject: [PATCH 2/2] chore: upgrade workflow flutter version --- .github/workflows/release.yml | 4 ++-- .github/workflows/tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3030dcc..2faeb93 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Install dependencies run: flutter pub get - name: Run tests @@ -95,7 +95,7 @@ jobs: - name: Install Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Check Publish Warnings run: dart pub publish --dry-run - name: Publish diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4b991d..e876bae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.8' + flutter-version: '3.27.0' - name: Install dependencies run: flutter pub get - name: Run tests