Skip to content

Commit

Permalink
patch: server action extension (#2)
Browse files Browse the repository at this point in the history
* The ServerAction model has been extended with new properties

* Change executionType type to int

* Upd CHANGELOG.md

* Upd CHANGELOG.md

* Upd pubspec.yaml
  • Loading branch information
lesleysin authored Jan 21, 2024
1 parent 0f4124d commit c7b2963
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.1.1
- The ServerAction model has been extended with new properties to maintain local executed actions
## 1.1.0
- Added classes for implementing Duit components, such as DuitComponentDescription and ValueReference
## 1.0.1
Expand Down
16 changes: 16 additions & 0 deletions lib/src/action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ final class ActionDependency {
}
}

final class LocalExecutionOptions {}

/// Represents a server action.
///
/// The [ServerAction] class encapsulates information about a server action, including its dependencies, event, and metadata.
Expand All @@ -46,10 +48,22 @@ final class ServerAction {
/// The event associated with the server action.
HttpActionMetainfo? meta;

/// Event execution type
///
/// 0 - transport
///
/// 1 - local execution
int executionType;

/// Optional action payload for local execution
Map<String, dynamic>? payload;

ServerAction({
required this.event,
required this.executionType,
this.dependsOn = const [],
this.meta,
this.payload,
});

static ServerAction? fromJSON(Map<String, dynamic>? json) {
Expand All @@ -66,8 +80,10 @@ final class ServerAction {

return ServerAction(
event: json["event"] ?? "",
executionType: json["executionType"],
dependsOn: deps,
meta: HttpActionMetainfo.fromJson(json["meta"]),
payload: json["payload"],
);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: duit_kernel
description: "Core library for flutter_duit package. Contains reusable models for developing third-party packages."
version: 1.1.0
version: 1.1.1
repository: https://github.com/lesleysin/duit_kernel

environment:
Expand Down

0 comments on commit c7b2963

Please sign in to comment.