From dfd974c106af3e07d88b3fe046ce18ff8850dffe Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 14 Feb 2022 00:48:37 +0800 Subject: [PATCH] Updated to 6.0.0 --- .../container/angel_container/CHANGELOG.md | 13 ++++++++ .../container/angel_container/pubspec.yaml | 4 +-- packages/framework/CHANGELOG.md | 10 +++++- packages/framework/lib/src/core/driver.dart | 6 ++-- packages/framework/pubspec.yaml | 10 +++++- packages/framework/test/exception_test.dart | 5 +-- packages/framework/test/server_test.dart | 3 +- packages/http_exception/CHANGELOG.md | 13 ++++++++ .../lib/angel3_http_exception.dart | 33 +++++++++---------- packages/http_exception/pubspec.yaml | 4 +-- packages/mock_request/CHANGELOG.md | 16 +++++++++ packages/mock_request/lib/src/headers.dart | 4 +-- packages/mock_request/lib/src/session.dart | 4 +-- packages/mock_request/pubspec.yaml | 7 ++-- packages/model/CHANGELOG.md | 12 +++++++ packages/model/pubspec.yaml | 4 +-- packages/route/CHANGELOG.md | 4 +++ packages/route/README.md | 8 ++--- .../route/lib/src/middleware_pipeline.dart | 4 +-- packages/route/lib/src/router.dart | 4 +-- packages/route/pubspec.yaml | 8 ++--- 21 files changed, 124 insertions(+), 52 deletions(-) diff --git a/packages/container/angel_container/CHANGELOG.md b/packages/container/angel_container/CHANGELOG.md index b7bcfbcc..f1147e25 100644 --- a/packages/container/angel_container/CHANGELOG.md +++ b/packages/container/angel_container/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x +* Removed `error` + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.1.1 * Updated `_ReflectedMethodMirror` to have optional `returnType` parameter diff --git a/packages/container/angel_container/pubspec.yaml b/packages/container/angel_container/pubspec.yaml index 0cbd658b..d15f49fa 100644 --- a/packages/container/angel_container/pubspec.yaml +++ b/packages/container/angel_container/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_container -version: 3.1.1 +version: 6.0.0 description: Angel3 hierarchical DI container, and pluggable backends for reflection. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: collection: ^1.15.0 quiver: ^3.0.1 diff --git a/packages/framework/CHANGELOG.md b/packages/framework/CHANGELOG.md index f451aee7..ef90f5f5 100644 --- a/packages/framework/CHANGELOG.md +++ b/packages/framework/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + +## 5.0.0 + +* No release. Skipped + ## 4.2.4 * Fixed issue 48. Log not working in development @@ -356,7 +364,7 @@ stable, there'll be a conversion, perhaps. * `Routable`, and all of its subclasses, now extend `Router`, and therefore only take routes in the form of `FutureOr myFunc(RequestContext, ResponseContext res)`. * `@Middleware` now takes an `Iterable` of `RequestHandler`s. -* `@Expose.path` now _must_ be a `String`, not just any `Pattern`. +* `@Expose.path` now *must* be a `String`, not just any `Pattern`. * `@Expose.middleware` now takes `Iterable`, instead of just `List`. * `createDynamicHandler` was renamed to `ioc`, and is now used to run IoC-aware handlers in a type-safe manner. diff --git a/packages/framework/lib/src/core/driver.dart b/packages/framework/lib/src/core/driver.dart index 3aec7edc..9ebdc003 100644 --- a/packages/framework/lib/src/core/driver.dart +++ b/packages/framework/lib/src/core/driver.dart @@ -185,7 +185,7 @@ abstract class Driver< throw AngelHttpException.badRequest(message: e.message) ..stackTrace = st; } - throw AngelHttpException(e, + throw AngelHttpException( stackTrace: st, statusCode: (e is AngelHttpException) ? e.statusCode : 500, message: e?.toString() ?? '500 Internal Server Error'); @@ -198,7 +198,7 @@ abstract class Driver< if (ee is AngelHttpException) { e = ee; } else { - e = AngelHttpException(ee, + e = AngelHttpException( stackTrace: st, statusCode: 500, message: ee?.toString() ?? '500 Internal Server Error'); @@ -233,7 +233,7 @@ abstract class Driver< } else if (error is AngelHttpException) { e = error; } else { - e = AngelHttpException(error, + e = AngelHttpException( stackTrace: stackTrace, message: error.toString()); } diff --git a/packages/framework/pubspec.yaml b/packages/framework/pubspec.yaml index 9a6af199..594cf738 100644 --- a/packages/framework/pubspec.yaml +++ b/packages/framework/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_framework -version: 4.2.4 +version: 6.0.0 description: A high-powered HTTP server extensible framework with dependency injection, routing and much more. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/framework @@ -38,3 +38,11 @@ dev_dependencies: dependency_overrides: angel3_container: path: ../container/angel_container + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request diff --git a/packages/framework/test/exception_test.dart b/packages/framework/test/exception_test.dart index 27340023..20ddc4c4 100644 --- a/packages/framework/test/exception_test.dart +++ b/packages/framework/test/exception_test.dart @@ -1,6 +1,5 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'dart:convert'; -import 'package:matcher/matcher.dart'; import 'package:test/test.dart'; void main() { @@ -41,9 +40,7 @@ void main() { }); test('toString', () { - expect( - AngelHttpException(null, statusCode: 420, message: 'Blaze It') - .toString(), + expect(AngelHttpException(statusCode: 420, message: 'Blaze It').toString(), '420: Blaze It'); }); } diff --git a/packages/framework/test/server_test.dart b/packages/framework/test/server_test.dart index de3175a3..37b137f4 100644 --- a/packages/framework/test/server_test.dart +++ b/packages/framework/test/server_test.dart @@ -5,7 +5,6 @@ import 'dart:io'; import 'package:angel3_container/mirrors.dart'; import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; -import 'package:matcher/matcher.dart'; import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; @@ -46,7 +45,7 @@ void main() { var rs = rq.response; var req = await http.createRequestContext(rq, rs); var res = await http.createResponseContext(rq, rs); - var e = AngelHttpException(null, + var e = AngelHttpException( statusCode: 321, message: 'Hello', errors: ['foo', 'bar']); await app.errorHandler(e, req, res); await http.sendResponse(rq, rs, req, res); diff --git a/packages/http_exception/CHANGELOG.md b/packages/http_exception/CHANGELOG.md index 261c73c4..23ff9533 100644 --- a/packages/http_exception/CHANGELOG.md +++ b/packages/http_exception/CHANGELOG.md @@ -1,6 +1,19 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x +* Removed `error` + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.1.0 * Upgraded to `lints` linter diff --git a/packages/http_exception/lib/angel3_http_exception.dart b/packages/http_exception/lib/angel3_http_exception.dart index 9ef24735..094f3e77 100644 --- a/packages/http_exception/lib/angel3_http_exception.dart +++ b/packages/http_exception/lib/angel3_http_exception.dart @@ -9,11 +9,12 @@ import 'dart:convert'; /// Originally inspired by /// [feathers-errors](https://github.com/feathersjs/feathers-errors). class AngelHttpException implements Exception { - var error; - /// A list of errors that occurred when this exception was thrown. final List errors = []; + /// The cause of this exception. + dynamic error; + /// The cause of this exception. String message; @@ -23,7 +24,7 @@ class AngelHttpException implements Exception { /// An HTTP status code this exception will throw. int statusCode; - AngelHttpException(this.error, + AngelHttpException( {this.message = '500 Internal Server Error', this.stackTrace, this.statusCode = 500, @@ -49,7 +50,6 @@ class AngelHttpException implements Exception { factory AngelHttpException.fromMap(Map data) { return AngelHttpException( - null, statusCode: (data['status_code'] ?? data['statusCode'] ?? 500) as int, message: data['message']?.toString() ?? 'Internal Server Error', errors: data['errors'] is Iterable @@ -66,57 +66,56 @@ class AngelHttpException implements Exception { factory AngelHttpException.badRequest( {String message = '400 Bad Request', List errors = const []}) => - AngelHttpException(null, - message: message, errors: errors, statusCode: 400); + AngelHttpException(message: message, errors: errors, statusCode: 400); /// Throws a 401 Not Authenticated error. factory AngelHttpException.notAuthenticated( {String message = '401 Not Authenticated'}) => - AngelHttpException(null, message: message, statusCode: 401); + AngelHttpException(message: message, statusCode: 401); /// Throws a 402 Payment Required error. factory AngelHttpException.paymentRequired( {String message = '402 Payment Required'}) => - AngelHttpException(null, message: message, statusCode: 402); + AngelHttpException(message: message, statusCode: 402); /// Throws a 403 Forbidden error. factory AngelHttpException.forbidden({String message = '403 Forbidden'}) => - AngelHttpException(null, message: message, statusCode: 403); + AngelHttpException(message: message, statusCode: 403); /// Throws a 404 Not Found error. factory AngelHttpException.notFound({String message = '404 Not Found'}) => - AngelHttpException(null, message: message, statusCode: 404); + AngelHttpException(message: message, statusCode: 404); /// Throws a 405 Method Not Allowed error. factory AngelHttpException.methodNotAllowed( {String message = '405 Method Not Allowed'}) => - AngelHttpException(null, message: message, statusCode: 405); + AngelHttpException(message: message, statusCode: 405); /// Throws a 406 Not Acceptable error. factory AngelHttpException.notAcceptable( {String message = '406 Not Acceptable'}) => - AngelHttpException(null, message: message, statusCode: 406); + AngelHttpException(message: message, statusCode: 406); /// Throws a 408 Timeout error. factory AngelHttpException.methodTimeout({String message = '408 Timeout'}) => - AngelHttpException(null, message: message, statusCode: 408); + AngelHttpException(message: message, statusCode: 408); /// Throws a 409 Conflict error. factory AngelHttpException.conflict({String message = '409 Conflict'}) => - AngelHttpException(null, message: message, statusCode: 409); + AngelHttpException(message: message, statusCode: 409); /// Throws a 422 Not Processable error. factory AngelHttpException.notProcessable( {String message = '422 Not Processable'}) => - AngelHttpException(null, message: message, statusCode: 422); + AngelHttpException(message: message, statusCode: 422); /// Throws a 501 Not Implemented error. factory AngelHttpException.notImplemented( {String message = '501 Not Implemented'}) => - AngelHttpException(null, message: message, statusCode: 501); + AngelHttpException(message: message, statusCode: 501); /// Throws a 503 Unavailable error. factory AngelHttpException.unavailable( {String message = '503 Unavailable'}) => - AngelHttpException(null, message: message, statusCode: 503); + AngelHttpException(message: message, statusCode: 503); } diff --git a/packages/http_exception/pubspec.yaml b/packages/http_exception/pubspec.yaml index 7918ae66..ad4bd617 100644 --- a/packages/http_exception/pubspec.yaml +++ b/packages/http_exception/pubspec.yaml @@ -1,9 +1,9 @@ name: angel3_http_exception -version: 3.1.0 +version: 6.0.0 description: Exception class that can be serialized to JSON and serialized to clients. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/http_exception environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dev_dependencies: lints: ^1.0.0 \ No newline at end of file diff --git a/packages/mock_request/CHANGELOG.md b/packages/mock_request/CHANGELOG.md index ce63ad1a..02c1e29c 100644 --- a/packages/mock_request/CHANGELOG.md +++ b/packages/mock_request/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + +## 5.0.0 + +* No release. Skipped + +## 4.0.0 + +* No release. Skipped + +## 3.0.0 + +* No release. Skipped + ## 2.1.0 * Updated linter to `package:lints` diff --git a/packages/mock_request/lib/src/headers.dart b/packages/mock_request/lib/src/headers.dart index 241cadf5..d2ae30f9 100644 --- a/packages/mock_request/lib/src/headers.dart +++ b/packages/mock_request/lib/src/headers.dart @@ -94,8 +94,8 @@ class MockHttpHeaders extends HttpHeaders { } @override - void forEach(void Function(String name, List values) f) { - _data.forEach(f); + void forEach(void Function(String name, List values) action) { + _data.forEach(action); } @override diff --git a/packages/mock_request/lib/src/session.dart b/packages/mock_request/lib/src/session.dart index 3a0a452d..37663818 100644 --- a/packages/mock_request/lib/src/session.dart +++ b/packages/mock_request/lib/src/session.dart @@ -40,8 +40,8 @@ class MockHttpSession extends MapBase implements HttpSession { } @override - void forEach(void Function(dynamic, dynamic) f) { - _data.forEach(f); + void forEach(void Function(dynamic, dynamic) action) { + _data.forEach(action); } @override diff --git a/packages/mock_request/pubspec.yaml b/packages/mock_request/pubspec.yaml index 08256b33..e2aed889 100644 --- a/packages/mock_request/pubspec.yaml +++ b/packages/mock_request/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_mock_request -version: 2.1.0 +version: 6.0.0 description: Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/mock_request environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: charcode: ^1.2.0 dev_dependencies: @@ -12,3 +12,6 @@ dev_dependencies: http: ^0.13.2 test: ^1.17.4 lints: ^1.0.0 +dependency_overrides: + angel3_framework: + path: ../framework diff --git a/packages/model/CHANGELOG.md b/packages/model/CHANGELOG.md index 6a6c0825..c5f18205 100644 --- a/packages/model/CHANGELOG.md +++ b/packages/model/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + +## 5.0.0 + +* No release. Skipped + +## 4.0.0 + +* No release. Skipped + ## 3.1.1 * Removed `error` diff --git a/packages/model/pubspec.yaml b/packages/model/pubspec.yaml index 3dadc0c6..a8344412 100644 --- a/packages/model/pubspec.yaml +++ b/packages/model/pubspec.yaml @@ -1,9 +1,9 @@ name: angel3_model -version: 3.1.1 +version: 6.0.0 description: Angel3 basic data model class, no longer with the added weight of the whole framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/model environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dev_dependencies: lints: ^1.0.0 diff --git a/packages/route/CHANGELOG.md b/packages/route/CHANGELOG.md index c230474a..1cbf795c 100644 --- a/packages/route/CHANGELOG.md +++ b/packages/route/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + ## 5.2.0 * Updated `package:build_runner` diff --git a/packages/route/README.md b/packages/route/README.md index e4d79fda..fa2ef513 100644 --- a/packages/route/README.md +++ b/packages/route/README.md @@ -26,7 +26,7 @@ A powerful, isomorphic routing library for Dart. ### Routing -If you use [Angel 3](https://pub.dev/packages/angel3_framework), every `Angel` instance is a `Router` in itself. +If you use [Angel3](https://pub.dev/packages/angel3_framework), every `Angel` instance is a `Router` in itself. ```dart void main() { @@ -101,9 +101,9 @@ Supports both hashed routes and pushState. The `BrowserRouter` interface exposes To prevent this for a given anchor, do any of the following: -* Do not provide an `href` -* Provide a `download` or `target` attribute on the element -* Set `rel="external"` +- Do not provide an `href` +- Provide a `download` or `target` attribute on the element +- Set `rel="external"` ## Route State diff --git a/packages/route/lib/src/middleware_pipeline.dart b/packages/route/lib/src/middleware_pipeline.dart index 57c8db02..beccba7d 100644 --- a/packages/route/lib/src/middleware_pipeline.dart +++ b/packages/route/lib/src/middleware_pipeline.dart @@ -4,10 +4,10 @@ import 'router.dart'; class MiddlewarePipeline { /// All the possible routes that matched the given path. final Iterable> routingResults; - final List _handlers = []; + final List _handlers = []; /// An ordered list of every handler delegated to handle this request. - List get handlers { + List get handlers { /* if (_handlers != null) return _handlers; final handlers = []; diff --git a/packages/route/lib/src/router.dart b/packages/route/lib/src/router.dart index d6a94d73..0456283c 100644 --- a/packages/route/lib/src/router.dart +++ b/packages/route/lib/src/router.dart @@ -101,7 +101,7 @@ class Router { for (var route in routes) { if (route is! SymlinkRoute) { router._routes.add(route.clone()); - } else if (route is SymlinkRoute) { + } else { final newRouter = route.router.clone(); newMounted[route.path] = newRouter; final symlink = SymlinkRoute(route.path, newRouter); @@ -141,7 +141,7 @@ class Router { indent(); buf.write('- '); if (route is! SymlinkRoute) buf.write('${route.method} '); - buf.write('${route.path.isNotEmpty ? route.path : '/'}'); + buf.write(route.path.isNotEmpty ? route.path : '/'); if (route is SymlinkRoute) { buf.writeln(); diff --git a/packages/route/pubspec.yaml b/packages/route/pubspec.yaml index 83a5598d..5ffe78ca 100644 --- a/packages/route/pubspec.yaml +++ b/packages/route/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_route -version: 5.2.0 -description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel framework, but can be used in Flutter and on the Web. +version: 6.0.0 +description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel3 framework, but can be used in Flutter and on the Web. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/route environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: belatuk_combinator: ^3.0.0 string_scanner: ^1.1.0 @@ -13,5 +13,5 @@ dev_dependencies: build_runner: ^2.1.2 build_web_compilers: ^3.2.1 http: ^0.13.3 - test: ^1.17.5 + test: ^1.20.0 lints: ^1.0.0