diff --git a/examples/fullstack/backend/pubspec.yaml b/examples/fullstack/backend/pubspec.yaml index c597b53e..7f8c0daa 100644 --- a/examples/fullstack/backend/pubspec.yaml +++ b/examples/fullstack/backend/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ^3.9.0 dependencies: - functions_framework: ^0.4.0 + functions_framework: ^0.5.0-wip json_annotation: ^4.9.0 shelf: ^1.4.0 @@ -14,7 +14,7 @@ dev_dependencies: build_runner: ^2.10.4 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: ^0.4.7 - http: ^1.1.0 + http: ^1.5.0 json_serializable: ^6.11.3 test: ^1.27.0 test_process: ^2.0.3 diff --git a/examples/fullstack/frontend-cli/pubspec.yaml b/examples/fullstack/frontend-cli/pubspec.yaml index fc1ba08b..e35fef79 100644 --- a/examples/fullstack/frontend-cli/pubspec.yaml +++ b/examples/fullstack/frontend-cli/pubspec.yaml @@ -9,7 +9,7 @@ executables: greet: dependencies: - http: ^1.1.0 + http: ^1.5.0 io: ^1.0.3 json_annotation: ^4.9.0 diff --git a/examples/hello/pubspec.yaml b/examples/hello/pubspec.yaml index 8cadbc27..40ab4b19 100644 --- a/examples/hello/pubspec.yaml +++ b/examples/hello/pubspec.yaml @@ -9,13 +9,13 @@ environment: sdk: ^3.9.0 dependencies: - functions_framework: ^0.4.0 + functions_framework: ^0.5.0-wip shelf: ^1.4.0 dev_dependencies: build_runner: ^2.10.4 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: ^0.4.1 - http: ^1.1.0 + http: ^1.5.0 test: ^1.27.0 test_process: ^2.0.3 diff --git a/examples/json/pubspec.yaml b/examples/json/pubspec.yaml index 9a238f8d..91f53649 100644 --- a/examples/json/pubspec.yaml +++ b/examples/json/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ^3.9.0 dependencies: - functions_framework: ^0.4.0 + functions_framework: ^0.5.0-wip json_annotation: ^4.9.0 shelf: ^1.4.0 @@ -14,7 +14,7 @@ dev_dependencies: build_runner: ^2.10.4 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: ^0.4.7 - http: ^1.1.0 + http: ^1.5.0 json_serializable: ^6.11.3 test: ^1.27.0 test_process: ^2.0.3 diff --git a/examples/protobuf_firestore/pubspec.yaml b/examples/protobuf_firestore/pubspec.yaml index 614c5542..77e8626a 100644 --- a/examples/protobuf_firestore/pubspec.yaml +++ b/examples/protobuf_firestore/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ^3.9.0 dependencies: - functions_framework: ^0.4.3 + functions_framework: ^0.5.0-wip protobuf: ^6.0.0 shelf: ^1.4.0 @@ -14,6 +14,6 @@ dev_dependencies: build_runner: ^2.10.4 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: ^0.4.10 - http: ^1.1.0 + http: ^1.5.0 test: ^1.27.0 test_process: ^2.0.3 diff --git a/examples/raw_cloudevent/pubspec.yaml b/examples/raw_cloudevent/pubspec.yaml index cdff97d4..b03f1095 100644 --- a/examples/raw_cloudevent/pubspec.yaml +++ b/examples/raw_cloudevent/pubspec.yaml @@ -6,13 +6,13 @@ environment: sdk: ^3.9.0 dependencies: - functions_framework: ^0.4.0 + functions_framework: ^0.5.0-wip shelf: ^1.4.0 dev_dependencies: build_runner: ^2.10.4 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: ^0.4.1 - http: ^1.1.0 + http: ^1.5.0 test: ^1.27.0 test_process: ^2.0.3 diff --git a/functions_framework/CHANGELOG.md b/functions_framework/CHANGELOG.md index 28f2be61..086869dd 100644 --- a/functions_framework/CHANGELOG.md +++ b/functions_framework/CHANGELOG.md @@ -1,6 +1,7 @@ -## 0.4.4-wip +## 0.5.0-wip -- Update to `package:google_cloud` `0.3.0-wip`. +- **BREAKING** `RequestLogger` -> `CloudLogger` +- Update to `package:google_cloud` `0.4.0`. - Fix project ID discovery to handle new exception types from `package:google_cloud`. - Require Dart 3.9 diff --git a/functions_framework/lib/functions_framework.dart b/functions_framework/lib/functions_framework.dart index 7e796368..355d92b7 100644 --- a/functions_framework/lib/functions_framework.dart +++ b/functions_framework/lib/functions_framework.dart @@ -25,7 +25,7 @@ library; export 'package:google_cloud/google_cloud.dart' - show BadRequestException, LogSeverity, RequestLogger; + show BadRequestException, CloudLogger, LogSeverity; export 'src/cloud_event.dart' show CloudEvent; export 'src/cloud_function.dart' show CloudFunction; diff --git a/functions_framework/lib/src/request_context.dart b/functions_framework/lib/src/request_context.dart index 62005025..891bd4e3 100644 --- a/functions_framework/lib/src/request_context.dart +++ b/functions_framework/lib/src/request_context.dart @@ -18,13 +18,13 @@ import 'package:shelf/shelf.dart'; import 'cloud_event.dart'; -/// Provides access to a [RequestLogger], the source [Request] and response +/// Provides access to a [CloudLogger], the source [Request] and response /// headers for a typed function handler. /// /// Can be used as an optional second parameter in a function definition that /// accepts a [CloudEvent] or a custom type. class RequestContext { - final RequestLogger logger; + final CloudLogger logger; /// Access to the source [Request] object. /// diff --git a/functions_framework/lib/src/typedefs.dart b/functions_framework/lib/src/typedefs.dart index e5d78e25..4d2f022d 100644 --- a/functions_framework/lib/src/typedefs.dart +++ b/functions_framework/lib/src/typedefs.dart @@ -54,6 +54,6 @@ typedef JsonWithContextHandler = /// The shape of a basic handler that follows the /// [package:shelf](https://pub.dev/packages/shelf) [Handler] pattern while also -/// providing a [RequestLogger]. +/// providing a [CloudLogger]. typedef HandlerWithLogger = - FutureOr Function(Request request, RequestLogger logger); + FutureOr Function(Request request, CloudLogger logger); diff --git a/functions_framework/pubspec.yaml b/functions_framework/pubspec.yaml index ce7d54d0..2cff58e5 100644 --- a/functions_framework/pubspec.yaml +++ b/functions_framework/pubspec.yaml @@ -1,5 +1,5 @@ name: functions_framework -version: 0.4.4-wip +version: 0.5.0-wip description: >- FaaS (Function as a service) framework for writing portable Dart functions repository: https://github.com/GoogleCloudPlatform/functions-framework-dart @@ -9,14 +9,14 @@ environment: sdk: ^3.9.0 dependencies: - args: ^2.5.0 + args: ^2.7.0 collection: ^1.19.0 - google_cloud: ^0.3.0-0 - http: ^1.1.0 + google_cloud: ^0.4.0 + http: ^1.5.0 http_parser: ^4.0.0 io: ^1.0.3 json_annotation: ^4.9.0 - meta: ^1.17.0 + meta: ^1.18.1 shelf: ^1.4.0 stack_trace: ^1.11.0 diff --git a/functions_framework_builder/CHANGELOG.md b/functions_framework_builder/CHANGELOG.md index f6bd1068..92464eb3 100644 --- a/functions_framework_builder/CHANGELOG.md +++ b/functions_framework_builder/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.4.11-wip - Support the latest versions of `analyzer`, `dart_style` and `source_gen`. +- Support `package:functions_framework` `0.5.0`. - Require Dart 3.9 ## 0.4.10 diff --git a/functions_framework_builder/pubspec.yaml b/functions_framework_builder/pubspec.yaml index bbcc5f7b..625c16a3 100644 --- a/functions_framework_builder/pubspec.yaml +++ b/functions_framework_builder/pubspec.yaml @@ -8,16 +8,16 @@ environment: sdk: ^3.9.0 dependencies: - analyzer: '>=9.0.0 <11.0.0' + analyzer: '>=9.0.0 <13.0.0' build: ^4.0.3 build_config: ^1.2.0 collection: ^1.19.0 dart_style: ^3.1.3 # There is a tight version constraint because the builder has a strict # dependency on all features exposed. - functions_framework: ">=0.4.0 <0.4.5" - glob: ^2.1.2 - meta: ^1.17.0 + functions_framework: ">=0.5.0-0 <0.5.1" + glob: ^2.1.3 + meta: ^1.18.1 path: ^1.9.0 shelf: ^1.4.0 source_gen: ^4.1.1 diff --git a/integration_test/lib/functions.dart b/integration_test/lib/functions.dart index a3d245f8..9017fd1b 100644 --- a/integration_test/lib/functions.dart +++ b/integration_test/lib/functions.dart @@ -109,7 +109,7 @@ Future function(Request request) async { } @CloudFunction() -Response loggingHandler(Request request, RequestLogger logger) { +Response loggingHandler(Request request, CloudLogger logger) { logger ..log('default', LogSeverity.defaultSeverity) ..debug('debug') diff --git a/integration_test/pubspec.yaml b/integration_test/pubspec.yaml index eac04154..b4af0680 100644 --- a/integration_test/pubspec.yaml +++ b/integration_test/pubspec.yaml @@ -15,8 +15,8 @@ dev_dependencies: build_verify: ^3.0.0 dart_flutter_team_lints: ^3.2.0 functions_framework_builder: any - google_cloud: any - http: ^1.1.0 + google_cloud: ^0.4.0 + http: ^1.5.0 http_parser: ^4.0.0 io: ^1.0.3 json_serializable: ^6.11.3 diff --git a/integration_test/test/cloud_behavior_test.dart b/integration_test/test/cloud_behavior_test.dart index afbbb430..6a546480 100644 --- a/integration_test/test/cloud_behavior_test.dart +++ b/integration_test/test/cloud_behavior_test.dart @@ -73,7 +73,7 @@ void main() { port = int.parse(split.last); count++; - traceStart = 'trace_start$count'; + traceStart = count.toString().padLeft(32, '0'); headers = { cloud_constants.cloudTraceContextHeader: '$traceStart/trace_end', @@ -124,7 +124,6 @@ void main() { String severity = 'ERROR', bool containsLine = true, }) { - expect(map, hasLength(4)); expect(map, containsPair('severity', severity)); expect(map, containsPair('message', messageMatcher)); expect( @@ -354,30 +353,13 @@ void main() { final trace = 'projects/test_project_id/traces/$traceStart'; Matcher isLog(String message, String severity) { - final severityEnum = LogSeverity.values.firstWhere( - (e) => e.name == severity, - ); - var matcher = allOf( + final matcher = allOf( containsPair('message', message), containsPair('severity', severity), containsPair('logging.googleapis.com/trace', trace), + isNot(contains('logging.googleapis.com/sourceLocation')), ); - if (severityEnum >= LogSeverity.warning) { - matcher = allOf( - matcher, - containsPair( - 'logging.googleapis.com/sourceLocation', - isA>(), - ), - ); - } else { - matcher = allOf( - matcher, - isNot(contains('logging.googleapis.com/sourceLocation')), - ); - } - return isA().having( (e) => jsonDecode(e) as Map, 'json',