From f5f8b7232835d85e9305ea42326933182fdb7878 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Tue, 23 Jul 2024 17:42:56 -0400 Subject: [PATCH] feat: add isRolledBack to ReleasePatch model (#2376) --- packages/shorebird_cli/pubspec.lock | 2 +- .../test/src/code_push_client_wrapper_test.dart | 1 + .../test/src/commands/patches/promote_command_test.dart | 2 ++ packages/shorebird_code_push_client/lib/src/version.dart | 2 +- packages/shorebird_code_push_client/pubspec.yaml | 2 +- .../test/src/code_push_client_test.dart | 1 + .../lib/src/models/release_patch.dart | 7 ++++++- .../lib/src/models/release_patch.g.dart | 3 +++ .../get_release_patches_response_test.dart | 2 ++ .../test/src/models/release_patch_test.dart | 2 ++ 10 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/shorebird_cli/pubspec.lock b/packages/shorebird_cli/pubspec.lock index b418f454..c5597973 100644 --- a/packages/shorebird_cli/pubspec.lock +++ b/packages/shorebird_cli/pubspec.lock @@ -619,7 +619,7 @@ packages: path: "../shorebird_code_push_client" relative: true source: path - version: "0.7.2+1" + version: "0.8.0+1" shorebird_code_push_protocol: dependency: "direct main" description: diff --git a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart index f5c719ed..b66d4ff3 100644 --- a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart +++ b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart @@ -769,6 +769,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' id: 0, number: 1, channel: DeploymentTrack.production.channel, + isRolledBack: false, artifacts: const [], ); diff --git a/packages/shorebird_cli/test/src/commands/patches/promote_command_test.dart b/packages/shorebird_cli/test/src/commands/patches/promote_command_test.dart index 954f637a..7acd6ab9 100644 --- a/packages/shorebird_cli/test/src/commands/patches/promote_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patches/promote_command_test.dart @@ -42,6 +42,7 @@ void main() { id: 0, number: 1, channel: DeploymentTrack.staging.channel, + isRolledBack: false, artifacts: const [], ); @@ -135,6 +136,7 @@ void main() { id: 0, number: 1, channel: DeploymentTrack.production.channel, + isRolledBack: false, artifacts: const [], ); when( diff --git a/packages/shorebird_code_push_client/lib/src/version.dart b/packages/shorebird_code_push_client/lib/src/version.dart index 4d124834..d184ce42 100644 --- a/packages/shorebird_code_push_client/lib/src/version.dart +++ b/packages/shorebird_code_push_client/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '0.7.2+1'; +const packageVersion = '0.8.0+1'; diff --git a/packages/shorebird_code_push_client/pubspec.yaml b/packages/shorebird_code_push_client/pubspec.yaml index 901867c4..1b0bd4ca 100644 --- a/packages/shorebird_code_push_client/pubspec.yaml +++ b/packages/shorebird_code_push_client/pubspec.yaml @@ -1,6 +1,6 @@ name: shorebird_code_push_client description: Library which allows Dart applications to interact with the Shorebird CodePush API -version: 0.7.2+1 +version: 0.8.0+1 repository: https://github.com/shorebirdtech/shorebird publish_to: none diff --git a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart index f9667088..b064d7b4 100644 --- a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart +++ b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart @@ -1686,6 +1686,7 @@ void main() { id: 0, number: 1, channel: 'stable', + isRolledBack: false, artifacts: const [], ); response = GetReleasePatchesResponse(patches: [patch]); diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_patch.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_patch.dart index 8c249f47..28f1f8c7 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/release_patch.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_patch.dart @@ -7,6 +7,7 @@ part 'release_patch.g.dart'; /// {@template release_patch} /// A patch for a given release. /// {@endtemplate} +// TODO(bryanoltman): consolidate this with [Patch] @JsonSerializable() class ReleasePatch extends Equatable { /// {@macro release_patch} @@ -15,6 +16,7 @@ class ReleasePatch extends Equatable { required this.number, required this.channel, required this.artifacts, + required this.isRolledBack, }); /// Converts a Map to a [ReleasePatch] @@ -36,6 +38,9 @@ class ReleasePatch extends Equatable { /// The associated patch artifacts. final List artifacts; + /// Whether the patch has been rolled back. + final bool isRolledBack; + @override - List get props => [id, number, channel, artifacts]; + List get props => [id, number, channel, artifacts, isRolledBack]; } diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_patch.g.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_patch.g.dart index 2376f4d6..0dfb624a 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/release_patch.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_patch.g.dart @@ -22,9 +22,11 @@ ReleasePatch _$ReleasePatchFromJson(Map json) => (v) => (v as List) .map((e) => PatchArtifact.fromJson(e as Map)) .toList()), + isRolledBack: $checkedConvert('is_rolled_back', (v) => v as bool), ); return val; }, + fieldKeyMap: const {'isRolledBack': 'is_rolled_back'}, ); Map _$ReleasePatchToJson(ReleasePatch instance) => @@ -33,4 +35,5 @@ Map _$ReleasePatchToJson(ReleasePatch instance) => 'number': instance.number, 'channel': instance.channel, 'artifacts': instance.artifacts.map((e) => e.toJson()).toList(), + 'is_rolled_back': instance.isRolledBack, }; diff --git a/packages/shorebird_code_push_protocol/test/src/messages/get_release_patches/get_release_patches_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/get_release_patches/get_release_patches_response_test.dart index 252de28b..292af611 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/get_release_patches/get_release_patches_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/get_release_patches/get_release_patches_response_test.dart @@ -10,6 +10,7 @@ void main() { id: 42, number: 1, channel: 'stable', + isRolledBack: true, artifacts: [ PatchArtifact( id: 1, @@ -35,6 +36,7 @@ void main() { id: 43, number: 2, channel: null, + isRolledBack: false, artifacts: [ PatchArtifact( id: 3, diff --git a/packages/shorebird_code_push_protocol/test/src/models/release_patch_test.dart b/packages/shorebird_code_push_protocol/test/src/models/release_patch_test.dart index eaf10ed1..3102dbce 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/release_patch_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/release_patch_test.dart @@ -11,6 +11,7 @@ void main() { id: 0, number: 1, channel: 'channel', + isRolledBack: false, artifacts: const [], ), equals( @@ -18,6 +19,7 @@ void main() { id: 0, number: 1, channel: 'channel', + isRolledBack: false, artifacts: const [], ), ),