Skip to content

Commit de67bd4

Browse files
authored
chore(api)!: Removed deprecated members … (#4772)
1 parent 1119a4b commit de67bd4

File tree

9 files changed

+5
-454
lines changed

9 files changed

+5
-454
lines changed

packages/amplify_core/lib/src/types/api/graphql/graphql_request.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class GraphQLRequest<T> with AWSSerializable<Map<String, Object?>> {
5959
/// See https://docs.amplify.aws/lib/graphqlapi/advanced-workflows/q/platform/flutter/.
6060
final ModelType? modelType;
6161

62-
@Deprecated('Use toJson instead')
63-
Map<String, dynamic> serializeAsMap() => toJson();
64-
6562
@override
6663
Map<String, Object?> toJson() => {
6764
'id': id,

packages/amplify_core/lib/src/types/exception/api/http_status_exception.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
part of '../amplify_exception.dart';
55

6-
@Deprecated('Use HttpStatusException instead')
7-
typedef RestException = HttpStatusException;
8-
96
/// {@template amplify_core.api.http_status_exception}
107
/// An HTTP error encountered during a REST API call, i.e. for calls returning
118
/// non-2xx status codes.

packages/amplify_core/lib/src/types/query/query_field.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
library query_field;
55

66
import 'package:amplify_core/amplify_core.dart';
7-
import 'package:amplify_core/src/types/temporal/datetime_parse.dart';
87

98
part 'query_field_operators.dart';
109
part 'query_pagination.dart';

packages/amplify_core/lib/src/types/query/query_field_operators.dart

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ abstract class QueryFieldOperator<T> {
3232
/// where [other] is a field on the model.
3333
bool evaluate(T? other);
3434

35-
/// Similar to `evaluate`, except `other` should be the
36-
/// *serialized* value of a field on the model.
37-
///
38-
/// This should be used to support comparisons with models
39-
/// that were generated prior to `toMap()` being added.
40-
// TODO(Jordan-Nelson): remove at next major version bump
41-
@Deprecated('Regenerate models with latest CLI and use `evaluate` instead.')
42-
bool evaluateSerialized(T? other);
43-
4435
Map<String, dynamic> serializeAsMap();
4536

4637
Map<String, dynamic> serializeAsMapWithOperator(
@@ -55,16 +46,7 @@ abstract class QueryFieldOperator<T> {
5546

5647
/// check the type of [value] and invoke corresponding serialize method
5748
dynamic serializeDynamicValue(dynamic value) {
58-
// DateTime is deprecated and will be removed in the next major version
59-
if (value is DateTime) {
60-
if (zDebugMode) {
61-
safePrint(
62-
'WARNING: Using DateTime types in a QueryPredicate is deprecated. '
63-
'Use a Temporal Date/Time Type instead.',
64-
);
65-
}
66-
return value.toDateTimeIso8601String();
67-
} else if (value is TemporalDate) {
49+
if (value is TemporalDate) {
6850
return value.format();
6951
} else if (value is TemporalDateTime) {
7052
return value.format();
@@ -117,18 +99,6 @@ class EqualQueryOperator<T> extends QueryFieldOperatorSingleValue<T> {
11799

118100
return value == other;
119101
}
120-
121-
@override
122-
bool evaluateSerialized(T? other) {
123-
// if `other` is a Map and has an "id" field, the query predicate is on a
124-
// nested model, such as `Post.BLOG.eq(myBlog.modelIdentifier))`,
125-
// and the value should be compared against the model ID.
126-
if (other is Map && other['id'] != null && value is String) {
127-
return value == other['id'];
128-
}
129-
final serializedValue = serializeDynamicValue(value);
130-
return other == serializedValue;
131-
}
132102
}
133103

134104
class EqualModelIdentifierQueryOperator<T extends ModelIdentifier>
@@ -141,13 +111,6 @@ class EqualModelIdentifierQueryOperator<T extends ModelIdentifier>
141111
return other == value;
142112
}
143113

144-
@override
145-
bool evaluateSerialized(T? other) {
146-
throw UnimplementedError(
147-
'evaluateSerialized is not implemented for EqualModelIdentifierQueryOperator',
148-
);
149-
}
150-
151114
@override
152115
Map<String, dynamic> serializeAsMap() {
153116
return serializeAsMapWithOperator(type.toShortString(), value);
@@ -175,18 +138,6 @@ class NotEqualQueryOperator<T> extends QueryFieldOperatorSingleValue<T> {
175138
}
176139
return other != value;
177140
}
178-
179-
@override
180-
bool evaluateSerialized(T? other) {
181-
// if `other` is a Map and has an "id" field, the query predicate is on a
182-
// nested model, such as `Post.BLOG.eq(myBlog.modelIdentifier))`,
183-
// and the value should be compared against the model ID.
184-
if (other is Map && other['id'] != null && value is String) {
185-
return value != other['id'];
186-
}
187-
final serializedValue = serializeDynamicValue(value);
188-
return other != serializedValue;
189-
}
190141
}
191142

192143
class NotEqualModelIdentifierQueryOperator<T extends ModelIdentifier>
@@ -199,13 +150,6 @@ class NotEqualModelIdentifierQueryOperator<T extends ModelIdentifier>
199150
return other != value;
200151
}
201152

202-
@override
203-
bool evaluateSerialized(T? other) {
204-
throw UnimplementedError(
205-
'evaluateSerialized is not implemented for NotEqualModelIdentifierQueryOperator',
206-
);
207-
}
208-
209153
@override
210154
Map<String, dynamic> serializeAsMap() {
211155
return serializeAsMapWithOperator(type.toShortString(), value);
@@ -224,15 +168,6 @@ class LessOrEqualQueryOperator<T extends Comparable<Object?>>
224168
}
225169
return other.compareTo(value) <= 0;
226170
}
227-
228-
@override
229-
bool evaluateSerialized(T? other) {
230-
if (other == null) {
231-
return false;
232-
}
233-
final serializedValue = serializeDynamicValue(value);
234-
return other.compareTo(serializedValue) <= 0;
235-
}
236171
}
237172

238173
class LessThanQueryOperator<T extends Comparable<Object?>>
@@ -247,15 +182,6 @@ class LessThanQueryOperator<T extends Comparable<Object?>>
247182
}
248183
return other.compareTo(value) < 0;
249184
}
250-
251-
@override
252-
bool evaluateSerialized(T? other) {
253-
if (other == null) {
254-
return false;
255-
}
256-
final serializedValue = serializeDynamicValue(value);
257-
return other.compareTo(serializedValue) < 0;
258-
}
259185
}
260186

261187
class GreaterOrEqualQueryOperator<T extends Comparable<Object?>>
@@ -270,15 +196,6 @@ class GreaterOrEqualQueryOperator<T extends Comparable<Object?>>
270196
}
271197
return other.compareTo(value) >= 0;
272198
}
273-
274-
@override
275-
bool evaluateSerialized(T? other) {
276-
if (other == null) {
277-
return false;
278-
}
279-
final serializedValue = serializeDynamicValue(value);
280-
return other.compareTo(serializedValue) >= 0;
281-
}
282199
}
283200

284201
class GreaterThanQueryOperator<T extends Comparable<Object?>>
@@ -293,15 +210,6 @@ class GreaterThanQueryOperator<T extends Comparable<Object?>>
293210
}
294211
return other.compareTo(value) > 0;
295212
}
296-
297-
@override
298-
bool evaluateSerialized(T? other) {
299-
if (other == null) {
300-
return false;
301-
}
302-
final serializedValue = serializeDynamicValue(value);
303-
return other.compareTo(serializedValue) > 0;
304-
}
305213
}
306214

307215
class ContainsQueryOperator extends QueryFieldOperatorSingleValue<String> {
@@ -323,9 +231,6 @@ class ContainsQueryOperator extends QueryFieldOperatorSingleValue<String> {
323231
);
324232
}
325233
}
326-
327-
@override
328-
bool evaluateSerialized(dynamic other) => evaluate(other);
329234
}
330235

331236
class BetweenQueryOperator<T extends Comparable<Object?>>
@@ -344,17 +249,6 @@ class BetweenQueryOperator<T extends Comparable<Object?>>
344249
return other.compareTo(start) >= 0 && other.compareTo(end) <= 0;
345250
}
346251

347-
@override
348-
bool evaluateSerialized(T? other) {
349-
if (other == null) {
350-
return false;
351-
}
352-
final serializedStart = serializeDynamicValue(start);
353-
final serializedEnd = serializeDynamicValue(end);
354-
return other.compareTo(serializedStart) >= 0 &&
355-
other.compareTo(serializedEnd) <= 0;
356-
}
357-
358252
@override
359253
Map<String, dynamic> serializeAsMap() {
360254
return <String, dynamic>{
@@ -376,7 +270,4 @@ class BeginsWithQueryOperator extends QueryFieldOperatorSingleValue<String> {
376270
}
377271
return other.startsWith(value);
378272
}
379-
380-
@override
381-
bool evaluateSerialized(String? other) => evaluate(other);
382273
}

packages/amplify_core/lib/src/types/query/query_predicate.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,8 @@ class QueryPredicateOperation extends QueryPredicate {
5858
@override
5959
bool evaluate(Model model) {
6060
final fieldName = getFieldName(field);
61-
// TODO(Jordan-Nelson): Remove try/catch at next major version bump
62-
try {
63-
final value = model.toMap()[fieldName];
64-
return queryFieldOperator.evaluate(value);
65-
} on UnimplementedError {
66-
final value = model.toJson()[fieldName];
67-
// ignore: deprecated_member_use_from_same_package
68-
return queryFieldOperator.evaluateSerialized(value);
69-
}
61+
final value = model.toMap()[fieldName];
62+
return queryFieldOperator.evaluate(value);
7063
}
7164

7265
@override

0 commit comments

Comments
 (0)