Skip to content

Commit

Permalink
Merge branch 'feat/storage-gen-2' into feat/storage-gen-2-remove-prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
khatruong2009 authored Apr 10, 2024
2 parents 0b071ef + 78886e0 commit 257e5bb
Show file tree
Hide file tree
Showing 61 changed files with 329 additions and 151 deletions.
2 changes: 1 addition & 1 deletion canaries/integration_test/main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void main() {
// Upload data to Storage
await Amplify.Storage.uploadData(
data: HttpPayload.string(data),
path: StoragePath.withIdentityId(
path: StoragePath.fromIdentityId(
(String identityId) => 'private/$identityId/hello',
),
).result;
Expand Down
2 changes: 1 addition & 1 deletion packages/aft/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
async: ^2.10.0
aws_common: ">=0.4.2+5 <0.5.0"
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
checked_yaml: ^2.0.0
cli_util: ^0.3.5
code_builder: 4.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ part of 'amplify_categories.dart';
///
/// It comes with default, built-in support for Amazon S3 service
/// leveraging Amplify Auth Category for authorization.
///
/// The Amplify CLI helps you to create and configure the storage category
/// and auth category.
/// {@endtemplate}
class StorageCategory extends AmplifyCategory<StoragePluginInterface> {
@override
Expand Down
14 changes: 7 additions & 7 deletions packages/amplify_core/lib/src/types/storage/storage_path.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'package:amplify_core/src/types/storage/storage_path_with_identity_id.dart';
import 'package:amplify_core/src/types/storage/storage_path_from_identity_id.dart';
import 'package:meta/meta.dart';

/// And Object that represents the full remote path of a storage item.
Expand All @@ -16,8 +16,8 @@ import 'package:meta/meta.dart';
class StoragePath {
/// Creates a [StoragePath] from a static string.
///
/// To create a [StoragePath] with the current user's identity Id, see
/// [StoragePath.withIdentityId]
/// To create a [StoragePath] from the current user's identity Id, see
/// [StoragePath.fromIdentityId]
///
/// ### Example
/// {@template amplify_core.storage.storage_path.from_string.example}
Expand All @@ -27,18 +27,18 @@ class StoragePath {
/// {@endtemplate}
const StoragePath.fromString(String path) : _path = path;

/// {@macro amplify_core.storage.storage_path_with_identity_id}
/// {@macro amplify_core.storage.storage_path_from_identity_id}
///
/// ### Example
/// {@template amplify_core.storage.storage_path.with_identity_id.example}
/// ```
/// const p = StoragePath.withIdentityId((String identityId) => 'users/$identityId/object.png');
/// const p = StoragePath.fromIdentityId((String identityId) => 'users/$identityId/object.png');
/// ```
/// {@endtemplate}
factory StoragePath.withIdentityId(
factory StoragePath.fromIdentityId(
String Function(String identityId) pathBuilder,
) =>
StoragePathWithIdentityId(pathBuilder);
StoragePathFromIdentityId(pathBuilder);

final String _path;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'package:amplify_core/amplify_core.dart';
import 'package:meta/meta.dart';

/// {@template amplify_core.storage.storage_path_from_identity_id}
/// Creates a [StoragePath] from the current user's identityId.
/// {@endtemplate}
class StoragePathFromIdentityId implements StoragePath {
/// {@macro amplify_core.storage.storage_path_from_identity_id}
const StoragePathFromIdentityId(this._pathBuilder);
final String Function(String identityId) _pathBuilder;

@internal
@override
String resolvePath({
String? identityId,
}) {
// identityId has to be optional in order for this to be a valid override.
// This API is internal, and is only invoked with non-null values
assert(identityId != null, 'identityId must be defined.');
return _pathBuilder(identityId!);
}
}
5 changes: 5 additions & 0 deletions packages/analytics/amplify_analytics_pinpoint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.7.1

### Fixes
- fix: correct `package_info_plus` version constraint ([#4583](https://github.com/aws-amplify/amplify-flutter/pull/4583))

## 1.7.0

- Minor bug fixes and improvements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dev_dependencies:
path: ../../../amplify_lints
aws_common: ">=0.4.0 <0.5.0"
build_runner: ^2.4.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
flutter_test:
sdk: flutter
integration_test:
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/amplify_analytics_pinpoint/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: amplify_analytics_pinpoint
description: The Amplify Flutter Analytics category plugin using the AWS Pinpoint provider.
version: 1.7.0
version: 1.7.1
homepage: https://docs.amplify.aws/lib/q/platform/flutter/
repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/analytics/amplify_analytics_pinpoint
issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,24 @@ class EndpointGlobalFieldsManager {

String _processKey(String key) {
if (key.length > maxKeyLength) {
final trimmedKey = key.substring(0, maxKeyLength);
_logger.warn(
'The key: "$key" ',
'The key beginning with: "$trimmedKey" ',
'has been trimmed to a length of $maxKeyLength characters.',
);
return key.substring(0, maxKeyLength);
return trimmedKey;
}
return key;
}

String _processAttributeValue(String value) {
if (value.length > maxAttributeValueLength) {
final trimmedValue = value.substring(0, maxAttributeValueLength);
_logger.warn(
'The attribute value: "$value" ',
'The attribute value beginning with: "$trimmedValue" ',
'has been trimmed to a length of $maxAttributeValueLength characters.',
);
return value.substring(0, maxAttributeValueLength);
return trimmedValue;
}
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
aws_common: ">=0.6.3 <0.7.0"
aws_signature_v4: ">=0.5.1 <0.6.0"
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
collection: ^1.15.0
drift: ">=2.14.0 <2.15.0"
intl: ">=0.18.0 <1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class GraphQLResponseDecoder {
decodePath: request.decodePath,
variables: variablesWithNextToken,
modelType: request.modelType,
authorizationMode: request.authorizationMode,
apiName: request.apiName,
);
}
decodedData = modelType.fromJson(
Expand Down
8 changes: 7 additions & 1 deletion packages/api/amplify_api_dart/test/graphql_helpers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ void main() {
() async {
const limit = 2;
final GraphQLRequest<PaginatedResult<Blog>> req =
ModelQueries.list<Blog>(Blog.classType, limit: limit);
ModelQueries.list<Blog>(
Blog.classType,
limit: limit,
authorizationMode: APIAuthorizationType.iam,
);

const data = '''{
"listBlogs": {
Expand Down Expand Up @@ -263,6 +267,8 @@ void main() {
response.data?.nextToken,
);
expect(resultRequest?.variables['limit'], limit);
expect(resultRequest?.authorizationMode, req.authorizationMode);
expect(resultRequest?.apiName, req.apiName);
});

test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,15 @@ final class ASFDeviceInfoWindows extends ASFDeviceInfoPlatform {
});

@override
// TODO(Jordan-Nelson): Use new enums when min win32 version is v5.4.0 or
// higher
// ignore: deprecated_member_use
Future<int?> get screenHeightPixels async => GetSystemMetrics(SM_CYSCREEN);

@override
// TODO(Jordan-Nelson): Use new enums when min win32 version is v5.4.0 or
// higher
// ignore: deprecated_member_use
Future<int?> get screenWidthPixels async => GetSystemMetrics(SM_CXSCREEN);

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/amplify_auth_cognito_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
aws_common: ">=0.6.3 <0.7.0"
aws_signature_v4: ">=0.5.1 <0.6.0"
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
clock: ^1.1.1
collection: ^1.15.0
convert: ^3.0.1
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/amplify_auth_cognito_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
async: ^2.10.0
aws_common: any
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
collection: ^1.15.0
convert: ^3.0.0
http: ">=0.13.0 <2.0.0"
Expand Down
5 changes: 5 additions & 0 deletions packages/authenticator/amplify_authenticator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.5.5

### Fixes
- fix: correct `package_info_plus` version constraint ([#4583](https://github.com/aws-amplify/amplify-flutter/pull/4583))

## 1.5.4

- Minor bug fixes and improvements## 1.5.3
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/authenticator/amplify_authenticator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: amplify_authenticator
description: A prebuilt Sign In and Sign Up experience for the Amplify Auth category
version: 1.5.4
version: 1.5.5
homepage: https://ui.docs.amplify.aws/flutter/connected-components/authenticator
repository: https://github.com/aws-amplify/amplify-flutter/tree/main/packages/authenticator/amplify_authenticator
issue_tracker: https://github.com/aws-amplify/amplify-flutter/issues
Expand Down
2 changes: 1 addition & 1 deletion packages/aws_common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
dependencies:
async: ^2.10.0
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
collection: ^1.15.0
http2: ^2.0.0
js: ^0.6.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import 'package:win32/win32.dart'
CryptUnprotectData,
CRYPT_INTEGER_BLOB,
GetLastError,
// TODO(Jordan-Nelson): Use new enums when min win32 version is v5.4.0 or
// higher
// ignore: deprecated_member_use
ERROR_SUCCESS;

/// Encrypts the provided string as a [Uint8List].
Expand Down Expand Up @@ -42,6 +45,9 @@ Uint8List encrypt(Uint8List list) {
encryptedPtr,
);
final errorCode = GetLastError();
// TODO(Jordan-Nelson): Use new enums when min win32 version is v5.4.0 or
// higher
// ignore: deprecated_member_use
if (errorCode != ERROR_SUCCESS) {
throw getExceptionFromErrorCode(errorCode);
}
Expand All @@ -68,6 +74,9 @@ Uint8List decrypt(Uint8List list) {
unencryptedPtr,
);
final errorCode = GetLastError();
// TODO(Jordan-Nelson): Use new enums when min win32 version is v5.4.0 or
// higher
// ignore: deprecated_member_use
if (errorCode != ERROR_SUCCESS) {
throw getExceptionFromErrorCode(errorCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
async: ^2.10.0
aws_common: ">=0.6.3 <0.7.0"
built_collection: ^5.0.0
built_value: ">=8.6.0 <8.9.0"
built_value: ^8.6.0
ffi: ^2.0.0
file: ">=6.0.0 <8.0.0"
js: ^0.6.4
Expand Down
2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/awsJson1_0/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/awsJson1_1/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/awsQuery/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/ec2Query/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/restJson1/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib/restXml/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib2/awsJson1_0/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib2/awsJson1_1/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib2/awsQuery/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/smithy/goldens/lib2/custom/pubspec.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 257e5bb

Please sign in to comment.