From 8b2d9bf7254cebd6e083061b3d999adc6976018e Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 28 Nov 2021 12:15:56 +0800 Subject: [PATCH 01/28] Updated framework --- packages/auth_twitter/pubspec.yaml | 4 +- packages/framework/CHANGELOG.md | 4 ++ .../framework/lib/src/core/controller.dart | 16 +++++--- .../lib/src/core/hooked_service.dart | 40 ++++++++++--------- .../framework/lib/src/core/injection.dart | 6 +-- .../lib/src/core/response_context.dart | 2 +- packages/framework/lib/src/core/routable.dart | 13 +++--- packages/framework/lib/src/core/server.dart | 17 ++++---- packages/framework/lib/src/core/service.dart | 14 +++---- .../framework/lib/src/http/angel_http.dart | 8 ++-- .../lib/src/http/http_request_context.dart | 2 +- .../lib/src/http2/http2_request_context.dart | 4 +- packages/framework/pubspec.yaml | 2 +- packages/framework/test/controller_test.dart | 8 ++-- packages/framework/test/di_test.dart | 4 +- packages/production/CHANGELOG.md | 4 ++ packages/production/example/main.dart | 8 ++-- packages/production/lib/src/runner.dart | 6 +-- packages/production/pubspec.yaml | 2 +- packages/shelf/CHANGELOG.md | 4 ++ packages/shelf/lib/src/shelf_driver.dart | 2 +- packages/shelf/pubspec.yaml | 2 +- 22 files changed, 99 insertions(+), 73 deletions(-) diff --git a/packages/auth_twitter/pubspec.yaml b/packages/auth_twitter/pubspec.yaml index 2ba132bd..c2d96d5a 100644 --- a/packages/auth_twitter/pubspec.yaml +++ b/packages/auth_twitter/pubspec.yaml @@ -6,8 +6,8 @@ publish_to: none environment: sdk: ">=2.10.0 <3.0.0" dependencies: - angel_auth: - angel_framework: + angel_auth: ^2.0.0 + angel_framework: ^2.0.0 http: ^0.13.0 path: ^1.0.0 twitter: diff --git a/packages/framework/CHANGELOG.md b/packages/framework/CHANGELOG.md index 33cc0c4d..8b968b76 100644 --- a/packages/framework/CHANGELOG.md +++ b/packages/framework/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 4.3.0 + +* Updated `container` to non nullable + ## 4.2.2 * Added `Date` to response header diff --git a/packages/framework/lib/src/core/controller.dart b/packages/framework/lib/src/core/controller.dart index 62cdcc46..c72644bd 100644 --- a/packages/framework/lib/src/core/controller.dart +++ b/packages/framework/lib/src/core/controller.dart @@ -12,7 +12,13 @@ class Controller { Angel? _app; /// The [Angel] application powering this controller. - Angel? get app => _app; + Angel get app { + if (_app == null) { + throw ArgumentError("Angel is not instantiated."); + } + + return _app!; + } /// If `true` (default), this class will inject itself as a singleton into the [app]'s container when bootstrapped. final bool injectSingleton; @@ -36,14 +42,14 @@ class Controller { _app = app; if (injectSingleton != false) { - if (!app.container!.has(runtimeType)) { - _app!.container!.registerSingleton(this, as: runtimeType); + if (!app.container.has(runtimeType)) { + _app!.container.registerSingleton(this, as: runtimeType); } } - var name = await applyRoutes(app, app.container!.reflector); + var name = await applyRoutes(app, app.container.reflector); app.controllers[name] = this; - return null; + //return null; } /// Applies the routes from this [Controller] to some [router]. diff --git a/packages/framework/lib/src/core/hooked_service.dart b/packages/framework/lib/src/core/hooked_service.dart index 9b70723a..ccf5c718 100644 --- a/packages/framework/lib/src/core/hooked_service.dart +++ b/packages/framework/lib/src/core/hooked_service.dart @@ -76,7 +76,9 @@ class HookedService> /// Closes any open [StreamController]s on this instance. **Internal use only**. @override Future close() { - _ctrl.forEach((c) => c.close()); + for (var c in _ctrl) { + c.close(); + } beforeIndexed._close(); beforeRead._close(); beforeCreated._close(); @@ -95,7 +97,7 @@ class HookedService> /// Adds hooks to this instance. void addHooks(Angel app) { - var hooks = getAnnotation(inner, app.container!.reflector); + var hooks = getAnnotation(inner, app.container.reflector); var before = >[]; var after = >[]; @@ -107,7 +109,7 @@ class HookedService> void applyListeners( Function fn, HookedServiceEventDispatcher dispatcher, [bool? isAfter]) { - var hooks = getAnnotation(fn, app.container!.reflector); + var hooks = getAnnotation(fn, app.container.reflector); final listeners = >[ ...isAfter == true ? after : before ]; @@ -144,8 +146,8 @@ class HookedService> }); @override - void addRoutes([Service? s]) { - super.addRoutes(s ?? inner); + void addRoutes([Service? service]) { + super.addRoutes(service ?? inner); } /// Runs the [listener] before every service method specified. @@ -274,26 +276,26 @@ class HookedService> } @override - Future> index([Map? _params]) { - var params = _stripReq(_params); + Future> index([Map? params]) { + var localParams = _stripReq(params); return beforeIndexed - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.indexed, - params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.indexed, + params: localParams)) .then((before) { if (before._canceled) { return afterIndexed - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.indexed, - params: params, result: before.result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.indexed, + params: localParams, result: before.result)) .then((after) => after.result as List); } - return inner.index(params).then((result) { + return inner.index(localParams).then((result) { return afterIndexed - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.indexed, - params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.indexed, + params: localParams, result: result)) .then((after) => after.result as List); }); }); @@ -557,7 +559,9 @@ class HookedServiceEventDispatcher> { final List> listeners = []; void _close() { - _ctrl.forEach((c) => c.close()); + for (var c in _ctrl) { + c.close(); + } listeners.clear(); } diff --git a/packages/framework/lib/src/core/injection.dart b/packages/framework/lib/src/core/injection.dart index 8e65511a..70aee136 100644 --- a/packages/framework/lib/src/core/injection.dart +++ b/packages/framework/lib/src/core/injection.dart @@ -12,7 +12,7 @@ RequestHandler ioc(Function handler, {Iterable optional = const []}) { RequestHandler? contained; if (req.app?.container != null) { - var injection = preInject(handler, req.app!.container!.reflector); + var injection = preInject(handler, req.app!.container.reflector); //if (injection != null) { injection.optional.addAll(optional); contained = handleContained(handler, injection); @@ -70,7 +70,7 @@ Future resolveInjection(requirement, InjectionRequest injection, } } else if (requirement is Type && requirement != dynamic) { try { - var futureType = container!.reflector.reflectFutureOf(requirement); + var futureType = container.reflector.reflectFutureOf(requirement); if (container.has(futureType.reflectedType)) { return await container.make(futureType.reflectedType); } @@ -78,7 +78,7 @@ Future resolveInjection(requirement, InjectionRequest injection, // Ignore. } - return await container!.make(requirement); + return await container.make(requirement); } else if (throwOnUnresolved) { throw ArgumentError( '$requirement cannot be injected into a request handler.'); diff --git a/packages/framework/lib/src/core/response_context.dart b/packages/framework/lib/src/core/response_context.dart index de41610d..f29dbdbe 100644 --- a/packages/framework/lib/src/core/response_context.dart +++ b/packages/framework/lib/src/core/response_context.dart @@ -288,7 +288,7 @@ abstract class ResponseContext } final head = controller - .findExpose(app!.container!.reflector)! + .findExpose(app!.container.reflector)! .path .toString() .replaceAll(_straySlashes, ''); diff --git a/packages/framework/lib/src/core/routable.dart b/packages/framework/lib/src/core/routable.dart index 67e83925..09e8464e 100644 --- a/packages/framework/lib/src/core/routable.dart +++ b/packages/framework/lib/src/core/routable.dart @@ -48,14 +48,15 @@ class Routable extends Router { final Map _serviceLookups = {}; final Map configuration = {}; - final Container? _container; + final Container _container; Routable([Reflector? reflector]) - : _container = reflector == null ? null : Container(reflector), +// : _container = reflector == null ? null : Container(reflector), + : _container = Container(reflector ?? ThrowingReflector()), super(); /// A [Container] used to inject dependencies. - Container? get container => _container; + Container get container => _container; void close() { _services.clear(); @@ -99,10 +100,10 @@ class Routable extends Router { {Iterable middleware = const {}}) { final handlers = []; // Merge @Middleware declaration, if any - var reflector = _container?.reflector; - if (reflector != null && reflector is! ThrowingReflector) { + var reflector = _container.reflector; + if (reflector is! ThrowingReflector) { var middlewareDeclaration = - getAnnotation(handler, _container?.reflector); + getAnnotation(handler, _container.reflector); if (middlewareDeclaration != null) { handlers.addAll(middlewareDeclaration.handlers); } diff --git a/packages/framework/lib/src/core/server.dart b/packages/framework/lib/src/core/server.dart index e04cf2c8..e0975319 100644 --- a/packages/framework/lib/src/core/server.dart +++ b/packages/framework/lib/src/core/server.dart @@ -4,6 +4,7 @@ import 'dart:async'; import 'dart:collection' show HashMap; import 'dart:convert'; import 'package:angel3_container/angel3_container.dart'; +import 'package:angel3_container/mirrors.dart'; import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:angel3_route/angel3_route.dart'; import 'package:belatuk_combinator/belatuk_combinator.dart'; @@ -184,12 +185,12 @@ class Angel extends Routable { /// Loads some base dependencies into the service container. void bootstrapContainer() { if (runtimeType != Angel) { - container?.registerSingleton(this); + container.registerSingleton(this); } - container?.registerSingleton(this); - container?.registerSingleton(this); - container?.registerSingleton(this); + container.registerSingleton(this); + container.registerSingleton(this); + container.registerSingleton(this); } /// Shuts down the server, and closes any open [StreamController]s. @@ -315,6 +316,7 @@ class Angel extends Routable { /// the execution will be faster, as the injection requirements were stored beforehand. Future runContained(Function handler, RequestContext req, ResponseContext res, [Container? container]) { + container ??= Container(MirrorsReflector()); return Future.sync(() { if (_preContained.containsKey(handler)) { return handleContained(handler, _preContained[handler]!, container)( @@ -328,10 +330,11 @@ class Angel extends Routable { /// Runs with DI, and *always* reflects. Prefer [runContained]. Future runReflected(Function handler, RequestContext req, ResponseContext res, [Container? container]) { - container ??= req.container ?? res.app!.container; + container ??= + req.container ?? res.app?.container ?? Container(ThrowingReflector()); var h = handleContained( handler, - _preContained[handler] = preInject(handler, container!.reflector), + _preContained[handler] = preInject(handler, container.reflector), container); return Future.sync(() => h(req, res)); // return closureMirror.apply(args).reflectee; @@ -350,7 +353,7 @@ class Angel extends Routable { /// /// If you are on `Dart >=2.0.0`, simply call `mountController()`. Future mountController([Type? type]) { - var controller = container!.make(type); + var controller = container.make(type); return configure(controller.configureServer).then((_) => controller); } diff --git a/packages/framework/lib/src/core/service.dart b/packages/framework/lib/src/core/service.dart index a109e91c..71febd2b 100644 --- a/packages/framework/lib/src/core/service.dart +++ b/packages/framework/lib/src/core/service.dart @@ -223,12 +223,12 @@ class Service extends Routable { var handlers = List.from(handlerss); // Add global middleware if declared on the instance itself - var before = getAnnotation(service, app!.container!.reflector); + var before = getAnnotation(service, app!.container.reflector); if (before != null) handlers.addAll(before.handlers); var indexMiddleware = - getAnnotation(service.index, app!.container!.reflector); + getAnnotation(service.index, app!.container.reflector); get('/', (req, res) { return index(mergeMap([ {'query': req.queryParameters}, @@ -241,7 +241,7 @@ class Service extends Routable { ]); var createMiddleware = - getAnnotation(service.create, app!.container!.reflector); + getAnnotation(service.create, app!.container.reflector); post('/', (req, ResponseContext res) { return req.parseBody().then((_) async { return await create( @@ -261,7 +261,7 @@ class Service extends Routable { ]); var readMiddleware = - getAnnotation(service.read, app!.container!.reflector); + getAnnotation(service.read, app!.container.reflector); get('/:id', (req, res) { return read( @@ -277,7 +277,7 @@ class Service extends Routable { ]); var modifyMiddleware = - getAnnotation(service.modify, app!.container!.reflector); + getAnnotation(service.modify, app!.container.reflector); patch('/:id', (req, res) { return req.parseBody().then((_) async { @@ -296,7 +296,7 @@ class Service extends Routable { ]); var updateMiddleware = - getAnnotation(service.update, app!.container!.reflector); + getAnnotation(service.update, app!.container.reflector); post('/:id', (req, res) { return req.parseBody().then((_) async { return await update( @@ -330,7 +330,7 @@ class Service extends Routable { ]); var removeMiddleware = - getAnnotation(service.remove, app!.container!.reflector); + getAnnotation(service.remove, app!.container.reflector); delete('/', (req, res) { return remove( '' as Id, diff --git a/packages/framework/lib/src/http/angel_http.dart b/packages/framework/lib/src/http/angel_http.dart index a43c85fc..dd389634 100644 --- a/packages/framework/lib/src/http/angel_http.dart +++ b/packages/framework/lib/src/http/angel_http.dart @@ -15,6 +15,8 @@ import 'http_response_context.dart'; final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); +typedef ServerGeneratorType = Future Function(dynamic, int); + /// Adapts `dart:io`'s [HttpServer] to serve Angel. class AngelHttp extends Driver { @@ -27,8 +29,7 @@ class AngelHttp extends Driver Function(dynamic, int) serverGenerator, bool useZone) + AngelHttp._(Angel app, ServerGeneratorType serverGenerator, bool useZone) : super(app, serverGenerator, useZone: useZone); factory AngelHttp(Angel app, {bool useZone = true}) { @@ -36,8 +37,7 @@ class AngelHttp extends Driver Function(dynamic, int) serverGenerator, + factory AngelHttp.custom(Angel app, ServerGeneratorType serverGenerator, {bool useZone = true}) { return AngelHttp._(app, serverGenerator, useZone); } diff --git a/packages/framework/lib/src/http/http_request_context.dart b/packages/framework/lib/src/http/http_request_context.dart index 63edaaeb..cafaa391 100644 --- a/packages/framework/lib/src/http/http_request_context.dart +++ b/packages/framework/lib/src/http/http_request_context.dart @@ -77,7 +77,7 @@ class HttpRequestContext extends RequestContext { /// Magically transforms an [HttpRequest] into a [RequestContext]. static Future from( HttpRequest request, Angel app, String path) { - var ctx = HttpRequestContext().._container = app.container!.createChild(); + var ctx = HttpRequestContext().._container = app.container.createChild(); var override = request.method; diff --git a/packages/framework/lib/src/http2/http2_request_context.dart b/packages/framework/lib/src/http2/http2_request_context.dart index 64fc8227..d5cdcfcf 100644 --- a/packages/framework/lib/src/http2/http2_request_context.dart +++ b/packages/framework/lib/src/http2/http2_request_context.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:angel3_container/src/container.dart'; +import 'package:angel3_container/angel3_container.dart'; import 'package:angel3_framework/angel3_framework.dart'; import 'package:collection/collection.dart' show IterableExtension; import 'package:http2/transport.dart'; @@ -35,7 +35,7 @@ class Http2RequestContext extends RequestContext { Map sessions, Uuid uuid) { var c = Completer(); - var req = Http2RequestContext._(app.container!.createChild()) + var req = Http2RequestContext._(app.container.createChild()) ..app = app .._socket = socket .._stream = stream; diff --git a/packages/framework/pubspec.yaml b/packages/framework/pubspec.yaml index bfd8739b..f9351e6e 100644 --- a/packages/framework/pubspec.yaml +++ b/packages/framework/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_framework -version: 4.2.2 +version: 4.3.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 diff --git a/packages/framework/test/controller_test.dart b/packages/framework/test/controller_test.dart index db29bce3..59c45c9b 100644 --- a/packages/framework/test/controller_test.dart +++ b/packages/framework/test/controller_test.dart @@ -85,8 +85,8 @@ void main() { res.redirectToAction('TodoController@foo', {'foo': 'world'})); // Register as a singleton, just for the purpose of this test - if (!app.container!.has()) { - app.container!.registerSingleton(todoController = TodoController()); + if (!app.container.has()) { + app.container.registerSingleton(todoController = TodoController()); } // Using mountController(); @@ -98,7 +98,7 @@ void main() { // Until https://github.com/angel-dart/route/issues/28 is closed, // this will need to be done by manually mounting the router. var subRouter = Router(); - await todoController.applyRoutes(subRouter, app.container!.reflector); + await todoController.applyRoutes(subRouter, app.container.reflector); app.mount('/ctrl_group', subRouter); print(app.controllers); @@ -165,7 +165,7 @@ void main() { test('named actions', () async { var response = await client.get(Uri.parse('$url/redirect')); print('Response: ${response.body}'); - expect(response.body, equals('Hello, \"world!\"')); + expect(response.body, equals('Hello, "world!"')); }); group('optional expose', () { diff --git a/packages/framework/test/di_test.dart b/packages/framework/test/di_test.dart index a8c511f4..b47ecf10 100644 --- a/packages/framework/test/di_test.dart +++ b/packages/framework/test/di_test.dart @@ -25,8 +25,8 @@ void main() { client = http.Client(); // Inject some todos - app.container!.registerSingleton(Todo(text: TEXT, over: OVER)); - app.container!.registerFactory>((container) async { + app.container.registerSingleton(Todo(text: TEXT, over: OVER)); + app.container.registerFactory>((container) async { var req = container.make(); var text = await utf8.decoder.bind(req.body!).join(); return Foo(text); diff --git a/packages/production/CHANGELOG.md b/packages/production/CHANGELOG.md index e0748c35..9c798f0e 100644 --- a/packages/production/CHANGELOG.md +++ b/packages/production/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 3.1.2 + +* Fixed null safety warnings + ## 3.1.1 * Fixed license link diff --git a/packages/production/example/main.dart b/packages/production/example/main.dart index 19871d48..0b2ebeb6 100644 --- a/packages/production/example/main.dart +++ b/packages/production/example/main.dart @@ -8,15 +8,15 @@ void main(List args) => Runner('example', configureServer).run(args); Future configureServer(Angel app) async { // Use the injected `pub_sub.Client` to send messages. - var client = app.container?.make(); + var client = app.container.make(); var greeting = 'Hello! This is the default greeting.'; // We can listen for an event to perform some behavior. // // Here, we use message passing to synchronize some common state. - var onGreetingChanged = await client?.subscribe('greeting_changed'); + var onGreetingChanged = await client.subscribe('greeting_changed'); onGreetingChanged - ?.cast() + .cast() .listen((newGreeting) => greeting = newGreeting); // Add some routes... @@ -33,7 +33,7 @@ Future configureServer(Angel app) async { // This route will push a new value for `greeting`. app.get('/change_greeting/:newGreeting', (req, res) { greeting = (req.params['newGreeting'] as String? ?? ''); - client?.publish('greeting_changed', greeting); + client.publish('greeting_changed', greeting); return 'Changed greeting -> $greeting'; }); diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index ad7154f7..8617a7e4 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -50,7 +50,7 @@ ____________ ________________________ ___ |__ | / /_ ____/__ ____/__ / __ /| |_ |/ /_ / __ __ __/ __ / _ ___ | /| / / /_/ / _ /___ _ /___ -/_/ |_/_/ |_/ \____/ /_____/ /_____/ +/_/ |_/_/ |_/ ____/ /_____/ /_____/ '''; @@ -233,8 +233,8 @@ _ ___ | /| / / /_/ / _ /___ _ /___ pub_sub.IsolateClient('client${argsWithId.id}', args.pubSubSendPort); var app = Angel(reflector: args.reflector) - ..container!.registerSingleton(client) - ..container!.registerSingleton(InstanceInfo(id: argsWithId.id)); + ..container.registerSingleton(client) + ..container.registerSingleton(InstanceInfo(id: argsWithId.id)); app.shutdownHooks.add((_) => client.close()); diff --git a/packages/production/pubspec.yaml b/packages/production/pubspec.yaml index 7248068b..10956a50 100644 --- a/packages/production/pubspec.yaml +++ b/packages/production/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_production -version: 3.1.1 +version: 3.1.2 description: Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Angel3. homepage: https://angel3-framework.web.app repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/production diff --git a/packages/shelf/CHANGELOG.md b/packages/shelf/CHANGELOG.md index 2dbbe3fe..9793e29c 100644 --- a/packages/shelf/CHANGELOG.md +++ b/packages/shelf/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 3.0.0-dev.3 + +* Fixed null safety warnings + ## 3.0.0-dev.2 * Updated to use `package:belatuk_pretty_logging` diff --git a/packages/shelf/lib/src/shelf_driver.dart b/packages/shelf/lib/src/shelf_driver.dart index 2775bfb7..a889f458 100644 --- a/packages/shelf/lib/src/shelf_driver.dart +++ b/packages/shelf/lib/src/shelf_driver.dart @@ -106,7 +106,7 @@ class AngelShelf extends Driver Date: Mon, 29 Nov 2021 09:04:50 +0800 Subject: [PATCH 02/28] Updated framework --- packages/framework/CHANGELOG.md | 1 + .../lib/src/core/hooked_service.dart | 134 +++++++++--------- packages/framework/lib/src/core/service.dart | 29 ++-- packages/framework/performance/hello/raw.dart | 2 +- packages/framework/test/hooked_test.dart | 4 +- 5 files changed, 93 insertions(+), 77 deletions(-) diff --git a/packages/framework/CHANGELOG.md b/packages/framework/CHANGELOG.md index 8b968b76..fb5a242e 100644 --- a/packages/framework/CHANGELOG.md +++ b/packages/framework/CHANGELOG.md @@ -3,6 +3,7 @@ ## 4.3.0 * Updated `container` to non nullable +* Updated `angel` to non nullable ## 4.2.2 diff --git a/packages/framework/lib/src/core/hooked_service.dart b/packages/framework/lib/src/core/hooked_service.dart index ccf5c718..e6e949f9 100644 --- a/packages/framework/lib/src/core/hooked_service.dart +++ b/packages/framework/lib/src/core/hooked_service.dart @@ -45,7 +45,9 @@ class HookedService> HookedService(this.inner) { // Clone app instance - if (inner.app != null) app = inner.app; + if (inner.isAppActive) { + app = inner.app; + } } @override @@ -62,9 +64,9 @@ class HookedService> return params['__responsectx'] as ResponseContext?; } - Map? _stripReq(Map? params) { + Map _stripReq(Map? params) { if (params == null) { - return params; + return {}; } else { return params.keys .where((key) => key != '__requestctx' && key != '__responsectx') @@ -302,136 +304,136 @@ class HookedService> } @override - Future read(Id id, [Map? _params]) { - var params = _stripReq(_params); + Future read(Id id, [Map? params]) { + var localParams = _stripReq(params); return beforeRead - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.read, - id: id, params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.read, + id: id, params: localParams)) .then((before) { if (before._canceled) { return afterRead - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.read, - id: id, params: params, result: before.result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.read, + id: id, params: localParams, result: before.result)) .then((after) => after.result as Data); } - return inner.read(id, params).then((result) { + return inner.read(id, localParams).then((result) { return afterRead - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.read, - id: id, params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.read, + id: id, params: localParams, result: result)) .then((after) => after.result as Data); }); }); } @override - Future create(Data data, [Map? _params]) { - var params = _stripReq(_params); + Future create(Data data, [Map? params]) { + var localParams = _stripReq(params); return beforeCreated - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.created, - data: data, params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.created, + data: data, params: localParams)) .then((before) { if (before._canceled) { return afterCreated - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.created, - data: before.data, params: params, result: before.result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.created, + data: before.data, params: localParams, result: before.result)) .then((after) => after.result as Data); } - return inner.create(before.data!, params).then((result) { + return inner.create(before.data!, localParams).then((result) { return afterCreated - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.created, - data: before.data, params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.created, + data: before.data, params: localParams, result: result)) .then((after) => after.result as Data); }); }); } @override - Future modify(Id id, Data data, [Map? _params]) { - var params = _stripReq(_params); + Future modify(Id id, Data data, [Map? params]) { + var localParams = _stripReq(params); return beforeModified - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.modified, - id: id, data: data, params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.modified, + id: id, data: data, params: localParams)) .then((before) { if (before._canceled) { return afterModified - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.modified, + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.modified, id: id, data: before.data, - params: params, + params: localParams, result: before.result)) .then((after) => after.result as Data); } - return inner.modify(id, before.data!, params).then((result) { + return inner.modify(id, before.data!, localParams).then((result) { return afterModified - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.created, - id: id, data: before.data, params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.created, + id: id, data: before.data, params: localParams, result: result)) .then((after) => after.result as Data); }); }); } @override - Future update(Id id, Data data, [Map? _params]) { - var params = _stripReq(_params); + Future update(Id id, Data data, [Map? params]) { + var localParams = _stripReq(params); return beforeUpdated - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.updated, - id: id, data: data, params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.updated, + id: id, data: data, params: localParams)) .then((before) { if (before._canceled) { return afterUpdated - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.updated, + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.updated, id: id, data: before.data, - params: params, + params: localParams, result: before.result)) .then((after) => after.result as Data); } - return inner.update(id, before.data!, params).then((result) { + return inner.update(id, before.data!, localParams).then((result) { return afterUpdated - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.updated, - id: id, data: before.data, params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.updated, + id: id, data: before.data, params: localParams, result: result)) .then((after) => after.result as Data); }); }); } @override - Future remove(Id id, [Map? _params]) { - var params = _stripReq(_params); + Future remove(Id id, [Map? params]) { + var localParams = _stripReq(params); return beforeRemoved - ._emit(HookedServiceEvent(false, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.removed, - id: id, params: params)) + ._emit(HookedServiceEvent(false, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.removed, + id: id, params: localParams)) .then((before) { if (before._canceled) { return afterRemoved - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.removed, - id: id, params: params, result: before.result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.removed, + id: id, params: localParams, result: before.result)) .then((after) => after.result) as Data; } - return inner.remove(id, params).then((result) { + return inner.remove(id, localParams).then((result) { return afterRemoved - ._emit(HookedServiceEvent(true, _getRequest(_params), - _getResponse(_params), inner, HookedServiceEvent.removed, - id: id, params: params, result: result)) + ._emit(HookedServiceEvent(true, _getRequest(params), + _getResponse(params), inner, HookedServiceEvent.removed, + id: id, params: localParams, result: result)) .then((after) => after.result as Data); }); }); @@ -512,7 +514,7 @@ class HookedServiceEvent> { /// Resolves a service from the application. /// /// Shorthand for `e.service.app.service(...)`. - Service? getService(Pattern path) => service.app!.findService(path); + Service? getService(Pattern path) => service.app.findService(path); bool _canceled = false; final String _eventName; @@ -522,7 +524,7 @@ class HookedServiceEvent> { Map? _params; final RequestContext? _request; final ResponseContext? _response; - var result; + dynamic result; String get eventName => _eventName; @@ -532,7 +534,7 @@ class HookedServiceEvent> { bool get isBefore => !isAfter; - Map? get params => _params; + Map get params => _params ?? {}; RequestContext? get request => _request; diff --git a/packages/framework/lib/src/core/service.dart b/packages/framework/lib/src/core/service.dart index 71febd2b..8db6996c 100644 --- a/packages/framework/lib/src/core/service.dart +++ b/packages/framework/lib/src/core/service.dart @@ -68,7 +68,20 @@ class Service extends Routable { List get bootstrappers => []; /// The [Angel] app powering this service. - Angel? app; + Angel? _app; + + Angel get app { + if (_app == null) { + throw ArgumentError("Angel is not initialized"); + } + return _app!; + } + + set app(Angel angel) { + _app = angel; + } + + bool get isAppActive => _app != null; /// Closes this service, including any database connections or stream controllers. @override @@ -223,12 +236,12 @@ class Service extends Routable { var handlers = List.from(handlerss); // Add global middleware if declared on the instance itself - var before = getAnnotation(service, app!.container.reflector); + var before = getAnnotation(service, app.container.reflector); if (before != null) handlers.addAll(before.handlers); var indexMiddleware = - getAnnotation(service.index, app!.container.reflector); + getAnnotation(service.index, app.container.reflector); get('/', (req, res) { return index(mergeMap([ {'query': req.queryParameters}, @@ -241,7 +254,7 @@ class Service extends Routable { ]); var createMiddleware = - getAnnotation(service.create, app!.container.reflector); + getAnnotation(service.create, app.container.reflector); post('/', (req, ResponseContext res) { return req.parseBody().then((_) async { return await create( @@ -261,7 +274,7 @@ class Service extends Routable { ]); var readMiddleware = - getAnnotation(service.read, app!.container.reflector); + getAnnotation(service.read, app.container.reflector); get('/:id', (req, res) { return read( @@ -277,7 +290,7 @@ class Service extends Routable { ]); var modifyMiddleware = - getAnnotation(service.modify, app!.container.reflector); + getAnnotation(service.modify, app.container.reflector); patch('/:id', (req, res) { return req.parseBody().then((_) async { @@ -296,7 +309,7 @@ class Service extends Routable { ]); var updateMiddleware = - getAnnotation(service.update, app!.container.reflector); + getAnnotation(service.update, app.container.reflector); post('/:id', (req, res) { return req.parseBody().then((_) async { return await update( @@ -330,7 +343,7 @@ class Service extends Routable { ]); var removeMiddleware = - getAnnotation(service.remove, app!.container.reflector); + getAnnotation(service.remove, app.container.reflector); delete('/', (req, res) { return remove( '' as Id, diff --git a/packages/framework/performance/hello/raw.dart b/packages/framework/performance/hello/raw.dart index ebbe2432..33a08ffc 100644 --- a/packages/framework/performance/hello/raw.dart +++ b/packages/framework/performance/hello/raw.dart @@ -3,7 +3,7 @@ library performance.hello; import 'dart:io'; -Future main() { +Future main() { return HttpServer.bind('127.0.0.1', 3000, shared: true).then((server) { print('Listening at http://${server.address.address}:${server.port}'); diff --git a/packages/framework/test/hooked_test.dart b/packages/framework/test/hooked_test.dart index 622860e4..7a752e67 100644 --- a/packages/framework/test/hooked_test.dart +++ b/packages/framework/test/hooked_test.dart @@ -135,8 +135,8 @@ void main() { var type = e.isBefore ? 'before' : 'after'; print('Params to $type ${e.eventName}: ${e.params}'); expect(e.params, isMap); - expect(e.params?.keys, contains('provider')); - expect(e.params?['provider'], const IsInstanceOf()); + expect(e.params.keys, contains('provider')); + expect(e.params['provider'], const IsInstanceOf()); } svc From cd31c040baab50e553dc54c74ac4f22ce1d17662 Mon Sep 17 00:00:00 2001 From: thomashii Date: Thu, 3 Feb 2022 17:47:36 +0800 Subject: [PATCH 03/28] Updated ORM insert for MySQL --- packages/framework/pubspec.yaml | 6 +- packages/orm/angel_orm/example/main.dart | 10 ++- packages/orm/angel_orm/lib/angel3_orm.dart | 1 + .../angel_orm/lib/src/dialect/dialect.dart | 25 ++++++++ packages/orm/angel_orm/lib/src/query.dart | 26 +++++--- .../orm/angel_orm/lib/src/query_base.dart | 4 +- .../orm/angel_orm/lib/src/query_executor.dart | 12 +++- .../orm/angel_orm_mysql/example/main.dart | 18 ++++-- .../orm/angel_orm_mysql/example/main.g.dart | 2 +- .../angel_orm_mysql/lib/angel3_orm_mysql.dart | 63 +++++++++++++++++-- packages/orm/angel_orm_mysql/pubspec.yaml | 3 +- .../orm/angel_orm_mysql/test/all_test.dart | 2 +- packages/orm/angel_orm_mysql/test/common.dart | 14 ++--- .../test/migrations/author.sql | 2 +- .../angel_orm_mysql/test/migrations/book.sql | 2 +- .../angel_orm_mysql/test/migrations/car.sql | 2 +- .../angel_orm_mysql/test/migrations/foot.sql | 2 +- .../angel_orm_mysql/test/migrations/fruit.sql | 12 ++-- .../test/migrations/has_car.sql | 2 +- .../test/migrations/has_map.sql | 2 +- .../angel_orm_mysql/test/migrations/leg.sql | 2 +- .../angel_orm_mysql/test/migrations/numba.sql | 6 +- .../angel_orm_mysql/test/migrations/role.sql | 10 +-- .../angel_orm_mysql/test/migrations/song.sql | 8 +-- .../angel_orm_mysql/test/migrations/tree.sql | 11 ++-- .../test/migrations/unorthodox.sql | 4 +- .../angel_orm_mysql/test/migrations/user.sql | 14 ++--- .../test/migrations/user_role.sql | 12 ++-- .../test/migrations/weird_join.sql | 20 +++--- .../lib/src/orm_postgres.dart | 20 ++++-- .../lib/src/orm_postgres_pool.dart | 7 ++- 31 files changed, 226 insertions(+), 98 deletions(-) create mode 100644 packages/orm/angel_orm/lib/src/dialect/dialect.dart diff --git a/packages/framework/pubspec.yaml b/packages/framework/pubspec.yaml index 9a6af199..4ea7b9c0 100644 --- a/packages/framework/pubspec.yaml +++ b/packages/framework/pubspec.yaml @@ -35,6 +35,6 @@ dev_dependencies: io: ^1.0.0 test: ^1.17.5 lints: ^1.0.0 -dependency_overrides: - angel3_container: - path: ../container/angel_container +#dependency_overrides: +# angel3_container: +# path: ../container/angel_container diff --git a/packages/orm/angel_orm/example/main.dart b/packages/orm/angel_orm/example/main.dart index 088df150..7f175aeb 100644 --- a/packages/orm/angel_orm/example/main.dart +++ b/packages/orm/angel_orm/example/main.dart @@ -26,8 +26,9 @@ class _FakeExecutor extends QueryExecutor { @override Future> query( - String tableName, String? query, Map substitutionValues, - [returningFields = const []]) async { + String tableName, String query, Map substitutionValues, + {String returningQuery = '', + List returningFields = const []}) async { var now = DateTime.now(); print( '_FakeExecutor received query: $query and values: $substitutionValues'); @@ -40,6 +41,11 @@ class _FakeExecutor extends QueryExecutor { Future transaction(FutureOr Function(QueryExecutor) f) { throw UnsupportedError('Transactions are not supported.'); } + + final Dialect _dialect = const PostgreSQLDialect(); + + @override + Dialect get dialect => _dialect; } @orm diff --git a/packages/orm/angel_orm/lib/angel3_orm.dart b/packages/orm/angel_orm/lib/angel3_orm.dart index 91952278..9a4c39bc 100644 --- a/packages/orm/angel_orm/lib/angel3_orm.dart +++ b/packages/orm/angel_orm/lib/angel3_orm.dart @@ -13,3 +13,4 @@ export 'src/query.dart'; export 'src/relations.dart'; export 'src/union.dart'; export 'src/util.dart'; +export 'src/dialect/dialect.dart'; diff --git a/packages/orm/angel_orm/lib/src/dialect/dialect.dart b/packages/orm/angel_orm/lib/src/dialect/dialect.dart new file mode 100644 index 00000000..dd68a6d1 --- /dev/null +++ b/packages/orm/angel_orm/lib/src/dialect/dialect.dart @@ -0,0 +1,25 @@ +abstract class Dialect { + bool get cteSupport; + + bool get writableCteSupport; +} + +class MySQLDialect implements Dialect { + const MySQLDialect(); + + @override + bool get cteSupport => true; + + @override + bool get writableCteSupport => false; +} + +class PostgreSQLDialect implements Dialect { + const PostgreSQLDialect(); + + @override + bool get cteSupport => true; + + @override + bool get writableCteSupport => true; +} diff --git a/packages/orm/angel_orm/lib/src/query.dart b/packages/orm/angel_orm/lib/src/query.dart index 1e4f6e81..9529e057 100644 --- a/packages/orm/angel_orm/lib/src/query.dart +++ b/packages/orm/angel_orm/lib/src/query.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'package:angel3_orm/angel3_orm.dart'; import 'package:logging/logging.dart'; import 'annotations.dart'; @@ -298,7 +299,7 @@ abstract class Query extends QueryBase { } return ss; })); - _joins.forEach((j) { + for (var j in _joins) { var c = compiledJoins[j] = j.compile(trampoline); //if (c != null) { if (c != '') { @@ -310,7 +311,7 @@ abstract class Query extends QueryBase { f.add('NULL'); } } - }); + } } if (withFields) b.write(f.join(', ')); fromQuery ??= tableName; @@ -354,7 +355,7 @@ abstract class Query extends QueryBase { if (_joins.isEmpty) { return executor .query(tableName, sql, substitutionValues, - fields.map(adornWithTableName).toList()) + returningFields: fields.map(adornWithTableName).toList()) .then((it) => deserializeList(it)); } else { return executor.transaction((tx) async { @@ -379,14 +380,23 @@ abstract class Query extends QueryBase { if (insertion == '') { throw StateError('No values have been specified for update.'); } else { - // TODO: How to do this in a non-Postgres DB? - var returning = fields.map(adornWithTableName).join(', '); var sql = compile({}); - sql = 'WITH $tableName as ($insertion RETURNING $returning) ' + sql; + var returningSql = sql; + if (executor.dialect is PostgreSQLDialect) { + var returning = fields.map(adornWithTableName).join(', '); + sql = 'WITH $tableName as ($insertion RETURNING $returning) ' + sql; + } else if (executor.dialect is MySQLDialect) { + sql = '$insertion'; + } else { + _log.fine("Unsupported database dialect."); + } - //_log.fine("Insert Query = $sql"); + _log.fine("Insert Query = $sql"); - return executor.query(tableName, sql, substitutionValues).then((it) { + return executor + .query(tableName, sql, substitutionValues, + returningQuery: returningSql) + .then((it) { // Return SQL execution results return it.isEmpty ? Optional.empty() : deserialize(it.first); }); diff --git a/packages/orm/angel_orm/lib/src/query_base.dart b/packages/orm/angel_orm/lib/src/query_base.dart index 17a62159..e6b3aab0 100644 --- a/packages/orm/angel_orm/lib/src/query_base.dart +++ b/packages/orm/angel_orm/lib/src/query_base.dart @@ -45,11 +45,11 @@ abstract class QueryBase { List deserializeList(List> it) { var optResult = it.map(deserialize).toList(); var result = []; - optResult.forEach((element) { + for (var element in optResult) { element.ifPresent((item) { result.add(item); }); - }); + } return result; } diff --git a/packages/orm/angel_orm/lib/src/query_executor.dart b/packages/orm/angel_orm/lib/src/query_executor.dart index fac6195f..1cd95d2c 100644 --- a/packages/orm/angel_orm/lib/src/query_executor.dart +++ b/packages/orm/angel_orm/lib/src/query_executor.dart @@ -1,15 +1,23 @@ import 'dart:async'; +import '../angel3_orm.dart'; + /// An abstract interface that performs queries. /// /// This class should be implemented. abstract class QueryExecutor { const QueryExecutor(); + Dialect get dialect; + /// Executes a single query. Future> query( - String tableName, String query, Map substitutionValues, - [List returningFields = const []]); + String tableName, + String query, + Map substitutionValues, { + String returningQuery = '', + List returningFields = const [], + }); /// Enters a database transaction, performing the actions within, /// and returning the results of [f]. diff --git a/packages/orm/angel_orm_mysql/example/main.dart b/packages/orm/angel_orm_mysql/example/main.dart index e9837d77..7c371612 100644 --- a/packages/orm/angel_orm_mysql/example/main.dart +++ b/packages/orm/angel_orm_mysql/example/main.dart @@ -1,10 +1,10 @@ import 'package:angel3_migration/angel3_migration.dart'; -import 'package:angel3_model/angel3_model.dart'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:angel3_orm_mysql/angel3_orm_mysql.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; +//import 'package:galileo_sqljocky5/sqljocky.dart'; import 'package:logging/logging.dart'; -import 'package:galileo_sqljocky5/sqljocky.dart'; +import 'package:mysql1/mysql1.dart'; import 'package:optional/optional.dart'; part 'main.g.dart'; @@ -15,9 +15,19 @@ void main() async { ..onRecord.listen(print); var settings = ConnectionSettings( - db: 'angel_orm_test', user: 'angel_orm_test', password: 'angel_orm_test'); + host: 'localhost', + port: 3306, + db: 'orm_test', + user: 'Test', + password: 'Test123*'); var connection = await MySqlConnection.connect(settings); - var logger = Logger('angel_orm_mysql'); + + var results = await connection.query('select name, is_complete from todos'); + //await connection.close(); + + print("End"); + + var logger = Logger('orm_mysql'); var executor = MySqlExecutor(connection, logger: logger); var query = TodoQuery(); diff --git a/packages/orm/angel_orm_mysql/example/main.g.dart b/packages/orm/angel_orm_mysql/example/main.g.dart index 3261e6d2..cb28a7ab 100644 --- a/packages/orm/angel_orm_mysql/example/main.g.dart +++ b/packages/orm/angel_orm_mysql/example/main.g.dart @@ -69,7 +69,7 @@ class TodoQuery extends Query { if (row.every((x) => x == null)) return null; var model = Todo( id: row[0].toString(), - isComplete: (row[1] as bool?), + isComplete: (row[1] as int?) != 0, text: (row[2] as String?), createdAt: (row[3] as DateTime?), updatedAt: (row[4] as DateTime?)); diff --git a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart index b13fd52c..147afaff 100644 --- a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart +++ b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart @@ -1,26 +1,33 @@ import 'dart:async'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:logging/logging.dart'; -// import 'package:pool/pool.dart'; -import 'package:galileo_sqljocky5/public/connection/connection.dart'; -import 'package:galileo_sqljocky5/sqljocky.dart'; +import 'package:mysql1/mysql1.dart'; class MySqlExecutor extends QueryExecutor { /// An optional [Logger] to write to. final Logger? logger; - final Querier? _connection; + final MySqlConnection _connection; MySqlExecutor(this._connection, {this.logger}); + final Dialect _dialect = const MySQLDialect(); + + @override + Dialect get dialect => _dialect; + Future close() { + return _connection.close(); + /* if (_connection is MySqlConnection) { return (_connection as MySqlConnection).close(); } else { return Future.value(); } + */ } + /* Future _startTransaction() { if (_connection is Transaction) { return Future.value(_connection as Transaction?); @@ -30,7 +37,7 @@ class MySqlExecutor extends QueryExecutor { throw StateError('Connection must be transaction or connection'); } } - + @override Future> query( String tableName, String query, Map substitutionValues, @@ -69,7 +76,52 @@ class MySqlExecutor extends QueryExecutor { }); } } + */ + @override + Future> query( + String tableName, String query, Map substitutionValues, + {String returningQuery = '', + List returningFields = const []}) async { + // Change @id -> ? + for (var name in substitutionValues.keys) { + query = query.replaceAll('@$name', '?'); + } + + var params = substitutionValues.values.toList(); + + logger?.fine('Query: $query'); + logger?.fine('Values: $params'); + logger?.fine('Returning Query: $returningQuery'); + + if (returningQuery.isNotEmpty) { + // Handle insert, update and delete + // Retrieve back the inserted record + var result = await _connection.query(query, params); + query = '$returningQuery where id = ?'; + params = [result.insertId]; + } + + // Handle select + return _connection.query(query, params).then((results) { + return results.map((r) => r.toList()).toList(); + }); + } + + @override + Future transaction(FutureOr Function(QueryExecutor) f) async { + return f(this); + /* + if (_connection is! MySqlConnection) { + return await f(this); + } + + await _connection.transaction((context) async { + var executor = MySqlExecutor(context, logger: logger); + }); + */ + } + /* @override Future transaction(FutureOr Function(QueryExecutor) f) async { if (_connection is Transaction) { @@ -88,4 +140,5 @@ class MySqlExecutor extends QueryExecutor { rethrow; } } + */ } diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index 6371ee19..7393bc90 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -8,8 +8,7 @@ environment: dependencies: angel3_orm: ^4.0.0 logging: ^1.0.0 - pool: ^1.5.0 - galileo_sqljocky5: ^3.0.0 + mysql1: ^0.19.0 optional: ^6.0.0 dev_dependencies: angel3_migration: ^4.0.0 diff --git a/packages/orm/angel_orm_mysql/test/all_test.dart b/packages/orm/angel_orm_mysql/test/all_test.dart index 71673988..e7bd1f89 100644 --- a/packages/orm/angel_orm_mysql/test/all_test.dart +++ b/packages/orm/angel_orm_mysql/test/all_test.dart @@ -10,7 +10,7 @@ void main() { if (rec.stackTrace != null) print(rec.stackTrace); }); - group('postgresql', () { + group('mysql', () { group('belongsTo', () => belongsToTests(my(['author', 'book']), close: closeMy)); group( diff --git a/packages/orm/angel_orm_mysql/test/common.dart b/packages/orm/angel_orm_mysql/test/common.dart index ae3b1e36..e8afba19 100644 --- a/packages/orm/angel_orm_mysql/test/common.dart +++ b/packages/orm/angel_orm_mysql/test/common.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:angel3_orm_mysql/angel3_orm_mysql.dart'; import 'package:logging/logging.dart'; -import 'package:galileo_sqljocky5/sqljocky.dart'; +import 'package:mysql1/mysql1.dart'; FutureOr Function() my(Iterable schemas) { return () => connectToMySql(schemas); @@ -14,15 +14,15 @@ Future closeMy(QueryExecutor executor) => Future connectToMySql(Iterable schemas) async { var settings = ConnectionSettings( - db: 'angel_orm_test', - user: Platform.environment['MYSQL_USERNAME'] ?? 'angel_orm_test', - password: Platform.environment['MYSQL_PASSWORD'] ?? 'angel_orm_test'); + db: 'orm_test', + host: "localhost", + user: Platform.environment['MYSQL_USERNAME'] ?? 'Test', + password: Platform.environment['MYSQL_PASSWORD'] ?? 'Test123*'); var connection = await MySqlConnection.connect(settings); - var logger = Logger('angel_orm_mysql'); + var logger = Logger('orm_mysql'); for (var s in schemas) { - await connection - .execute(await File('test/migrations/$s.sql').readAsString()); + await connection.query(await File('test/migrations/$s.sql').readAsString()); } return MySqlExecutor(connection, logger: logger); diff --git a/packages/orm/angel_orm_mysql/test/migrations/author.sql b/packages/orm/angel_orm_mysql/test/migrations/author.sql index 97f0f00f..7ae6477a 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/author.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/author.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "authors" ( +CREATE TEMPORARY TABLE authors ( id serial PRIMARY KEY, name varchar(255) UNIQUE NOT NULL, created_at timestamp, diff --git a/packages/orm/angel_orm_mysql/test/migrations/book.sql b/packages/orm/angel_orm_mysql/test/migrations/book.sql index 925c1b1d..1cc39baa 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/book.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/book.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "books" ( +CREATE TEMPORARY TABLE books ( id serial PRIMARY KEY, author_id int NOT NULL, partner_author_id int, diff --git a/packages/orm/angel_orm_mysql/test/migrations/car.sql b/packages/orm/angel_orm_mysql/test/migrations/car.sql index 239d285d..c27b953e 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/car.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/car.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "cars" ( +CREATE TEMPORARY TABLE cars ( id serial PRIMARY KEY, make varchar(255) NOT NULL, description TEXT NOT NULL, diff --git a/packages/orm/angel_orm_mysql/test/migrations/foot.sql b/packages/orm/angel_orm_mysql/test/migrations/foot.sql index af8bfc1a..d25733e0 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/foot.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/foot.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "feet" ( +CREATE TEMPORARY TABLE feet ( id serial PRIMARY KEY, leg_id int NOT NULL, n_toes int NOT NULL, diff --git a/packages/orm/angel_orm_mysql/test/migrations/fruit.sql b/packages/orm/angel_orm_mysql/test/migrations/fruit.sql index ecb6f838..88f12969 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/fruit.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/fruit.sql @@ -1,8 +1,8 @@ -CREATE TEMPORARY TABLE "fruits" ( - "id" serial, - "tree_id" int, - "common_name" varchar, - "created_at" timestamp, - "updated_at" timestamp, +CREATE TEMPORARY TABLE fruits ( + id serial, + tree_id int, + common_name varchar(255), + created_at timestamp, + updated_at timestamp, PRIMARY KEY(id) ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/has_car.sql b/packages/orm/angel_orm_mysql/test/migrations/has_car.sql index 67794aed..d4b47b42 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/has_car.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/has_car.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "has_cars" ( +CREATE TEMPORARY TABLE has_cars ( id serial PRIMARY KEY, type int not null, created_at timestamp, diff --git a/packages/orm/angel_orm_mysql/test/migrations/has_map.sql b/packages/orm/angel_orm_mysql/test/migrations/has_map.sql index b05eec1c..046b8145 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/has_map.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/has_map.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "has_maps" ( +CREATE TEMPORARY TABLE has_maps ( id serial PRIMARY KEY, value jsonb not null, list jsonb not null, diff --git a/packages/orm/angel_orm_mysql/test/migrations/leg.sql b/packages/orm/angel_orm_mysql/test/migrations/leg.sql index abc00d39..46b19092 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/leg.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/leg.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "legs" ( +CREATE TEMPORARY TABLE legs ( id serial PRIMARY KEY, name varchar(255) NOT NULL, created_at timestamp, diff --git a/packages/orm/angel_orm_mysql/test/migrations/numba.sql b/packages/orm/angel_orm_mysql/test/migrations/numba.sql index 5a69fbc2..32fbc339 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/numba.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/numba.sql @@ -1,6 +1,6 @@ -CREATE TEMPORARY TABLE "numbas" ( - "i" int, - "parent" int references weird_joins(id), +CREATE TEMPORARY TABLE numbas ( + i int, + parent int, created_at TIMESTAMP, updated_at TIMESTAMP, PRIMARY KEY(i) diff --git a/packages/orm/angel_orm_mysql/test/migrations/role.sql b/packages/orm/angel_orm_mysql/test/migrations/role.sql index 5dac21f0..7eeeb950 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/role.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/role.sql @@ -1,6 +1,6 @@ -CREATE TEMPORARY TABLE "roles" ( - "id" serial PRIMARY KEY, - "name" varchar(255), - "created_at" timestamp, - "updated_at" timestamp +CREATE TEMPORARY TABLE roles ( + id serial PRIMARY KEY, + name varchar(255), + created_at timestamp, + updated_at timestamp ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/song.sql b/packages/orm/angel_orm_mysql/test/migrations/song.sql index 9683209a..98e0ebb2 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/song.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/song.sql @@ -1,7 +1,7 @@ -CREATE TEMPORARY TABLE "songs" ( - "id" serial, - "weird_join_id" int references weird_joins(id), - "title" varchar(255), +CREATE TEMPORARY TABLE songs ( + id serial, + weird_join_id int, + title varchar(255), created_at TIMESTAMP, updated_at TIMESTAMP, PRIMARY KEY(id) diff --git a/packages/orm/angel_orm_mysql/test/migrations/tree.sql b/packages/orm/angel_orm_mysql/test/migrations/tree.sql index e4ddd439..08ec4d84 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/tree.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/tree.sql @@ -1,8 +1,7 @@ -CREATE TEMPORARY TABLE "trees" ( - "id" serial, - "rings" smallint UNIQUE, - "created_at" timestamp, - "updated_at" timestamp, - UNIQUE(rings), +CREATE TEMPORARY TABLE trees ( + id serial, + rings smallint UNIQUE, + created_at timestamp, + updated_at timestamp, PRIMARY KEY(id) ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql b/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql index a448fdd3..fc02b49f 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql @@ -1,4 +1,4 @@ -CREATE TEMPORARY TABLE "unorthodoxes" ( - "name" varchar(255), +CREATE TEMPORARY TABLE unorthodoxes ( + name varchar(255), PRIMARY KEY(name) ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/user.sql b/packages/orm/angel_orm_mysql/test/migrations/user.sql index cdd0abbe..9b95b734 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/user.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/user.sql @@ -1,8 +1,8 @@ -CREATE TEMPORARY TABLE "users" ( - "id" serial PRIMARY KEY, - "username" varchar(255), - "password" varchar(255), - "email" varchar(255), - "created_at" timestamp, - "updated_at" timestamp +CREATE TEMPORARY TABLE users ( + id serial PRIMARY KEY, + username varchar(255), + password varchar(255), + email varchar(255), + created_at timestamp, + updated_at timestamp ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/user_role.sql b/packages/orm/angel_orm_mysql/test/migrations/user_role.sql index e4995189..cc03240c 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/user_role.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/user_role.sql @@ -1,7 +1,7 @@ -CREATE TEMPORARY TABLE "role_users" ( - "id" serial PRIMARY KEY, - "user_id" int NOT NULL, - "role_id" int NOT NULL, - "created_at" timestamp, - "updated_at" timestamp +CREATE TEMPORARY TABLE role_users ( + id serial PRIMARY KEY, + user_id int NOT NULL, + role_id int NOT NULL, + created_at timestamp, + updated_at timestamp ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/migrations/weird_join.sql b/packages/orm/angel_orm_mysql/test/migrations/weird_join.sql index fd9de7ea..9e4ceee6 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/weird_join.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/weird_join.sql @@ -1,13 +1,15 @@ -CREATE TEMPORARY TABLE "weird_joins" ( - "id" serial, - "join_name" varchar(255) references unorthodoxes(name), +CREATE TEMPORARY TABLE weird_joins ( + id serial, + join_name varchar(255), PRIMARY KEY(id) ); -CREATE TEMPORARY TABLE "foos" ( - "bar" varchar(255), + +CREATE TEMPORARY TABLE foos ( + bar varchar(255) not null UNIQUE, PRIMARY KEY(bar) ); -CREATE TEMPORARY TABLE "foo_pivots" ( - "weird_join_id" int references weird_joins(id), - "foo_bar" varchar(255) references foos(bar) -); \ No newline at end of file + +CREATE TEMPORARY TABLE foo_pivots ( + weird_join_id int, + foo_bar varchar(255) +); diff --git a/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart b/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart index 26707124..1314afec 100644 --- a/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart +++ b/packages/orm/angel_orm_postgres/lib/src/orm_postgres.dart @@ -16,6 +16,11 @@ class PostgreSqlExecutor extends QueryExecutor { this.logger = logger ?? Logger('PostgreSqlExecutor'); } + final Dialect _dialect = const PostgreSQLDialect(); + + @override + Dialect get dialect => _dialect; + /// The underlying connection. PostgreSQLExecutionContext get connection => _connection; @@ -31,8 +36,8 @@ class PostgreSqlExecutor extends QueryExecutor { @override Future query( String tableName, String query, Map substitutionValues, - [List? returningFields]) { - if (returningFields != null && returningFields.isNotEmpty) { + {String returningQuery = '', List returningFields = const []}) { + if (returningFields.isNotEmpty) { var fields = returningFields.join(', '); var returning = 'RETURNING $fields'; query = '$query $returning'; @@ -119,6 +124,11 @@ class PostgreSqlExecutorPool extends QueryExecutor { assert(size > 0, 'Connection pool cannot be empty.'); } + final Dialect _dialect = const PostgreSQLDialect(); + + @override + Dialect get dialect => _dialect; + /// Closes all connections. Future close() async { await _pool.close(); @@ -151,11 +161,11 @@ class PostgreSqlExecutorPool extends QueryExecutor { @override Future query( String tableName, String query, Map substitutionValues, - [List? returningFields]) { + {String returningQuery = '', List returningFields = const []}) { return _pool.withResource(() async { var executor = await _next(); - return executor.query( - tableName, query, substitutionValues, returningFields); + return executor.query(tableName, query, substitutionValues, + returningFields: returningFields); }); } diff --git a/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart b/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart index 3af1f3ff..9032e945 100644 --- a/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart +++ b/packages/orm/angel_orm_postgres/lib/src/orm_postgres_pool.dart @@ -17,6 +17,11 @@ class PostgreSqlPoolExecutor extends QueryExecutor { this.logger = logger ?? Logger('PostgreSqlPoolExecutor'); } + final Dialect _dialect = const PostgreSQLDialect(); + + @override + Dialect get dialect => _dialect; + /// The underlying connection pooling. PgPool get pool => _pool; @@ -29,7 +34,7 @@ class PostgreSqlPoolExecutor extends QueryExecutor { @override Future query( String tableName, String query, Map substitutionValues, - [List returningFields = const []]) { + {String returningQuery = '', List returningFields = const []}) { if (returningFields.isNotEmpty) { var fields = returningFields.join(', '); var returning = 'RETURNING $fields'; From f28ba22bb4de1854e830b1d5220a19f1fb249513 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 6 Feb 2022 15:27:19 +0800 Subject: [PATCH 04/28] Fixed insert into table without primary key --- packages/orm/angel_orm/lib/src/builder.dart | 2 +- packages/orm/angel_orm/lib/src/query.dart | 57 ++++++++++--------- .../orm/angel_orm/lib/src/query_base.dart | 4 +- .../orm/angel_orm/lib/src/query_values.dart | 14 +++++ packages/orm/angel_orm/lib/src/util.dart | 18 ++++++ .../orm/angel_orm_mysql/example/main.dart | 5 -- .../angel_orm_mysql/lib/angel3_orm_mysql.dart | 24 ++++++-- packages/orm/angel_orm_mysql/test/common.dart | 13 ++++- .../angel_orm_mysql/test/migrations/numba.sql | 2 +- .../test/migrations/unorthodox.sql | 2 +- .../orm/angel_orm_mysql/test/orm_debug.dart | 21 +++++++ .../angel_orm_postgres/test/orm_debug.dart | 18 ++++++ .../lib/src/edge_case_test.dart | 28 ++++----- .../angel_orm_test/lib/src/models/car.g.dart | 5 +- 14 files changed, 151 insertions(+), 62 deletions(-) create mode 100644 packages/orm/angel_orm_mysql/test/orm_debug.dart create mode 100644 packages/orm/angel_orm_postgres/test/orm_debug.dart diff --git a/packages/orm/angel_orm/lib/src/builder.dart b/packages/orm/angel_orm/lib/src/builder.dart index 313d1257..4810987a 100644 --- a/packages/orm/angel_orm/lib/src/builder.dart +++ b/packages/orm/angel_orm/lib/src/builder.dart @@ -238,7 +238,7 @@ class StringSqlExpressionBuilder extends SqlExpressionBuilder { void like(String pattern, {String Function(String)? sanitize}) { sanitize ??= (s) => pattern; _raw = 'LIKE \'' + sanitize('@$substitution') + '\''; - query.substitutionValues[substitution] = pattern; + //query.substitutionValues[substitution] = pattern; _hasValue = true; _value = null; } diff --git a/packages/orm/angel_orm/lib/src/query.dart b/packages/orm/angel_orm/lib/src/query.dart index 9529e057..0a2a5bb6 100644 --- a/packages/orm/angel_orm/lib/src/query.dart +++ b/packages/orm/angel_orm/lib/src/query.dart @@ -2,13 +2,6 @@ import 'dart:async'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:logging/logging.dart'; -import 'annotations.dart'; -import 'join_builder.dart'; -import 'order_by.dart'; -import 'query_base.dart'; -import 'query_executor.dart'; -import 'query_values.dart'; -import 'query_where.dart'; import 'package:optional/optional.dart'; /// A SQL `SELECT` query builder. @@ -71,7 +64,7 @@ abstract class Query extends QueryBase { nn++; _names[name] = nn; } else { - _names[name] = 1; + _names[name] = 0; //1; } return n == 0 ? name : '$name$n'; } @@ -381,17 +374,19 @@ abstract class Query extends QueryBase { throw StateError('No values have been specified for update.'); } else { var sql = compile({}); - var returningSql = sql; + var returningSql = ''; if (executor.dialect is PostgreSQLDialect) { var returning = fields.map(adornWithTableName).join(', '); sql = 'WITH $tableName as ($insertion RETURNING $returning) ' + sql; } else if (executor.dialect is MySQLDialect) { + var returningSelect = values?.compileInsertSelect(this, tableName); + returningSql = '$sql where $returningSelect'; sql = '$insertion'; } else { - _log.fine("Unsupported database dialect."); + throw ArgumentError("Unsupported database dialect."); } - _log.fine("Insert Query = $sql"); + _log.warning("Insert Query = $sql"); return executor .query(tableName, sql, substitutionValues, @@ -409,24 +404,30 @@ abstract class Query extends QueryBase { if (valuesClause == '') { throw StateError('No values have been specified for update.'); - } else { - updateSql.write(' $valuesClause'); - var whereClause = where?.compile(); - if (whereClause?.isNotEmpty == true) { - updateSql.write(' WHERE $whereClause'); - } - if (_limit != null) updateSql.write(' LIMIT $_limit'); - - var returning = fields.map(adornWithTableName).join(', '); - var sql = compile({}); - sql = 'WITH $tableName as ($updateSql RETURNING $returning) ' + sql; - - //_log.fine("Update Query = $sql"); - - return executor - .query(tableName, sql, substitutionValues) - .then((it) => deserializeList(it)); } + updateSql.write(' $valuesClause'); + var whereClause = where?.compile(); + if (whereClause?.isNotEmpty == true) { + updateSql.write(' WHERE $whereClause'); + } + if (_limit != null) updateSql.write(' LIMIT $_limit'); + + var returning = fields.map(adornWithTableName).join(', '); + var sql = compile({}); + var returningSql = ''; + if (executor.dialect is PostgreSQLDialect) { + sql = 'WITH $tableName as ($updateSql RETURNING $returning) ' + sql; + } else if (executor.dialect is MySQLDialect) { + returningSql = sql; + sql = '$updateSql'; + } else { + throw ArgumentError("Unsupported database dialect."); + } + //_log.fine("Update Query = $sql"); + + return executor + .query(tableName, sql, substitutionValues, returningQuery: returningSql) + .then((it) => deserializeList(it)); } Future> updateOne(QueryExecutor executor) { diff --git a/packages/orm/angel_orm/lib/src/query_base.dart b/packages/orm/angel_orm/lib/src/query_base.dart index e6b3aab0..a7e8644a 100644 --- a/packages/orm/angel_orm/lib/src/query_base.dart +++ b/packages/orm/angel_orm/lib/src/query_base.dart @@ -57,8 +57,8 @@ abstract class QueryBase { Future> get(QueryExecutor executor) async { var sql = compile({}); - //_log.fine('sql = $sql'); - //_log.fine('substitutionValues = $substitutionValues'); + print('sql = $sql'); + print('substitutionValues = $substitutionValues'); return executor.query(tableName, sql, substitutionValues).then((it) { return deserializeList(it); diff --git a/packages/orm/angel_orm/lib/src/query_values.dart b/packages/orm/angel_orm/lib/src/query_values.dart index 2b265cf4..0748dacb 100644 --- a/packages/orm/angel_orm/lib/src/query_values.dart +++ b/packages/orm/angel_orm/lib/src/query_values.dart @@ -52,6 +52,20 @@ abstract class QueryValues { return b.toString(); } + String compileInsertSelect(Query query, String tableName) { + var data = Map.from(toMap()); + + var b = StringBuffer(); + var i = 0; + + for (var entry in data.entries) { + if (i++ > 0) b.write(' AND '); + b.write('$tableName.${entry.key} = ?'); + } + + return b.toString(); + } + String compileForUpdate(Query query) { var data = toMap(); if (data.isEmpty) { diff --git a/packages/orm/angel_orm/lib/src/util.dart b/packages/orm/angel_orm/lib/src/util.dart index 939b36c8..3a4352c6 100644 --- a/packages/orm/angel_orm/lib/src/util.dart +++ b/packages/orm/angel_orm/lib/src/util.dart @@ -1,3 +1,21 @@ import 'package:charcode/ascii.dart'; bool isAscii(int ch) => ch >= $nul && ch <= $del; + +bool mapToBool(dynamic value) { + if (value is int) { + return value != 0; + } + + return value != null ? value as bool : false; +} + +String mapToText(dynamic value) { + if (value == null) { + return ''; + } + if (value is! String) { + return value.toString(); + } + return value; +} diff --git a/packages/orm/angel_orm_mysql/example/main.dart b/packages/orm/angel_orm_mysql/example/main.dart index 7c371612..e2a8d9fc 100644 --- a/packages/orm/angel_orm_mysql/example/main.dart +++ b/packages/orm/angel_orm_mysql/example/main.dart @@ -22,11 +22,6 @@ void main() async { password: 'Test123*'); var connection = await MySqlConnection.connect(settings); - var results = await connection.query('select name, is_complete from todos'); - //await connection.close(); - - print("End"); - var logger = Logger('orm_mysql'); var executor = MySqlExecutor(connection, logger: logger); diff --git a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart index 147afaff..55334902 100644 --- a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart +++ b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart @@ -90,16 +90,28 @@ class MySqlExecutor extends QueryExecutor { var params = substitutionValues.values.toList(); - logger?.fine('Query: $query'); - logger?.fine('Values: $params'); - logger?.fine('Returning Query: $returningQuery'); + logger?.warning('Query: $query'); + logger?.warning('Values: $params'); + logger?.warning('Returning Query: $returningQuery'); if (returningQuery.isNotEmpty) { // Handle insert, update and delete // Retrieve back the inserted record - var result = await _connection.query(query, params); - query = '$returningQuery where id = ?'; - params = [result.insertId]; + if (query.startsWith("INSERT")) { + var result = await _connection.query(query, params); + + query = returningQuery; + logger?.warning('Result.insertId: ${result.insertId}'); + + // No primary key + //if (result.insertId != 0) { + // params = [result.insertId]; + //} + } else if (query.startsWith("UPDATE")) { + await _connection.query(query, params); + query = returningQuery; + params = []; + } } // Handle select diff --git a/packages/orm/angel_orm_mysql/test/common.dart b/packages/orm/angel_orm_mysql/test/common.dart index e8afba19..7a2111f7 100644 --- a/packages/orm/angel_orm_mysql/test/common.dart +++ b/packages/orm/angel_orm_mysql/test/common.dart @@ -17,12 +17,21 @@ Future connectToMySql(Iterable schemas) async { db: 'orm_test', host: "localhost", user: Platform.environment['MYSQL_USERNAME'] ?? 'Test', - password: Platform.environment['MYSQL_PASSWORD'] ?? 'Test123*'); + password: Platform.environment['MYSQL_PASSWORD'] ?? 'Test123*', + timeout: Duration(minutes: 10)); var connection = await MySqlConnection.connect(settings); var logger = Logger('orm_mysql'); for (var s in schemas) { - await connection.query(await File('test/migrations/$s.sql').readAsString()); + // MySQL driver does not support multiple sql queries + var data = await File('test/migrations/$s.sql').readAsString(); + var queries = data.split(";"); + for (var q in queries) { + //print("Table: [$q]"); + if (q.trim().isNotEmpty) { + await connection.query(q); + } + } } return MySqlExecutor(connection, logger: logger); diff --git a/packages/orm/angel_orm_mysql/test/migrations/numba.sql b/packages/orm/angel_orm_mysql/test/migrations/numba.sql index 32fbc339..41fe7c4d 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/numba.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/numba.sql @@ -1,5 +1,5 @@ CREATE TEMPORARY TABLE numbas ( - i int, + i int NOT NULL UNIQUE, parent int, created_at TIMESTAMP, updated_at TIMESTAMP, diff --git a/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql b/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql index fc02b49f..24eaa397 100644 --- a/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql +++ b/packages/orm/angel_orm_mysql/test/migrations/unorthodox.sql @@ -1,4 +1,4 @@ CREATE TEMPORARY TABLE unorthodoxes ( - name varchar(255), + name varchar(255) NOT NULL UNIQUE, PRIMARY KEY(name) ); \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/test/orm_debug.dart b/packages/orm/angel_orm_mysql/test/orm_debug.dart new file mode 100644 index 00000000..96b21778 --- /dev/null +++ b/packages/orm/angel_orm_mysql/test/orm_debug.dart @@ -0,0 +1,21 @@ +import 'package:angel3_orm_test/angel3_orm_test.dart'; +import 'package:logging/logging.dart'; + +import 'common.dart'; + +void main() async { + //hierarchicalLoggingEnabled = true; + Logger.root + ..level = Level.INFO + ..onRecord.listen(print); + //Logger.root.onRecord.listen((rec) { + // print(rec); + // if (rec.error != null) print(rec.error); + // if (rec.stackTrace != null) print(rec.stackTrace); + //}); + + belongsToTests(my(['author', 'book']), close: closeMy); + + //edgeCaseTests(my(['unorthodox', 'weird_join', 'song', 'numba']), + // close: closeMy); +} diff --git a/packages/orm/angel_orm_postgres/test/orm_debug.dart b/packages/orm/angel_orm_postgres/test/orm_debug.dart new file mode 100644 index 00000000..eac9395f --- /dev/null +++ b/packages/orm/angel_orm_postgres/test/orm_debug.dart @@ -0,0 +1,18 @@ +import 'package:angel3_orm_test/angel3_orm_test.dart'; +import 'package:logging/logging.dart'; + +import 'common.dart'; + +void main() async { + hierarchicalLoggingEnabled = true; + Logger.root + ..level = Level.ALL + ..onRecord.listen(print); + //Logger.root.onRecord.listen((rec) { + // print(rec); + // if (rec.error != null) print(rec.error); + // if (rec.stackTrace != null) print(rec.stackTrace); + //}); + + belongsToTests(pg(['author', 'book']), close: closePg); +} diff --git a/packages/orm/angel_orm_test/lib/src/edge_case_test.dart b/packages/orm/angel_orm_test/lib/src/edge_case_test.dart index 11ab1b2f..2ed01d4a 100644 --- a/packages/orm/angel_orm_test/lib/src/edge_case_test.dart +++ b/packages/orm/angel_orm_test/lib/src/edge_case_test.dart @@ -5,18 +5,20 @@ import 'models/unorthodox.dart'; void edgeCaseTests(FutureOr Function() createExecutor, {FutureOr Function(QueryExecutor)? close}) { - late QueryExecutor executor; + QueryExecutor? executor; close ??= (_) => null; setUp(() async { executor = await createExecutor(); }); - tearDown(() => close!(executor)); + tearDown(() async { + //await close!(executor!); + }); test('can create object with no id', () async { var query = UnorthodoxQuery()..values.name = 'World'; - var modelOpt = await query.insert(executor); + var modelOpt = await query.insert(executor!); expect(modelOpt.isPresent, true); modelOpt.ifPresent((model) { expect(model, Unorthodox(name: 'World')); @@ -30,7 +32,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, //if (unorthodox == null) { var query = UnorthodoxQuery()..values.name = 'Hey'; - var unorthodoxOpt = await query.insert(executor); + var unorthodoxOpt = await query.insert(executor!); unorthodoxOpt.ifPresent((value) { unorthodox = value; }); @@ -39,7 +41,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, test('belongs to', () async { var query = WeirdJoinQuery()..values.joinName = unorthodox!.name; - var modelOpt = await query.insert(executor); + var modelOpt = await query.insert(executor!); expect(modelOpt.isPresent, true); modelOpt.ifPresent((model) { //print(model.toJson()); @@ -55,7 +57,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, setUp(() async { var wjQuery = WeirdJoinQuery()..values.joinName = unorthodox!.name; - var weirdJoinOpt = await wjQuery.insert(executor); + var weirdJoinOpt = await wjQuery.insert(executor!); //weirdJoin = (await wjQuery.insert(executor)).value; weirdJoinOpt.ifPresent((value1) async { weirdJoin = value1; @@ -63,7 +65,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, ..values.weirdJoinId = value1.id ..values.title = 'Girl Blue'; - var girlBlueOpt = await gbQuery.insert(executor); + var girlBlueOpt = await gbQuery.insert(executor!); girlBlueOpt.ifPresent((value2) { girlBlue = value2; }); @@ -72,7 +74,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, test('has one', () async { var query = WeirdJoinQuery()..where!.id.equals(weirdJoin!.id!); - var wjOpt = await query.getOne(executor); + var wjOpt = await query.getOne(executor!); expect(wjOpt.isPresent, true); wjOpt.ifPresent((wj) { //print(wj.toJson()); @@ -87,7 +89,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, var query = NumbaQuery() ..values.parent = weirdJoin!.id ..values.i = i; - var modelObj = await query.insert(executor); + var modelObj = await query.insert(executor!); expect(modelObj.isPresent, true); modelObj.ifPresent((model) { numbas.add(model); @@ -95,7 +97,7 @@ void edgeCaseTests(FutureOr Function() createExecutor, } var query = WeirdJoinQuery()..where!.id.equals(weirdJoin!.id!); - var wjObj = await query.getOne(executor); + var wjObj = await query.getOne(executor!); expect(wjObj.isPresent, true); wjObj.ifPresent((wj) { //print(wj.toJson()); @@ -106,14 +108,14 @@ void edgeCaseTests(FutureOr Function() createExecutor, test('many to many', () async { var fooQuery = FooQuery()..values.bar = 'baz'; var fooBar = - await fooQuery.insert(executor).then((foo) => foo.value.bar); + await fooQuery.insert(executor!).then((foo) => foo.value.bar); var pivotQuery = FooPivotQuery() ..values.weirdJoinId = weirdJoin!.id ..values.fooBar = fooBar; - await pivotQuery.insert(executor); + await pivotQuery.insert(executor!); fooQuery = FooQuery()..where!.bar.equals('baz'); - var fooOpt = await fooQuery.getOne(executor); + var fooOpt = await fooQuery.getOne(executor!); expect(fooOpt.isPresent, true); fooOpt.ifPresent((foo) { //print(foo.toJson()); diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index e7329ddc..2287dd49 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -94,10 +94,9 @@ class CarQuery extends Query { createdAt: fields.contains('created_at') ? (row[1] as DateTime?) : null, updatedAt: fields.contains('updated_at') ? (row[2] as DateTime?) : null, make: fields.contains('make') ? (row[3] as String?) : null, - description: - fields.contains('description') ? (row[4] as String?) : null, + description: fields.contains('description') ? mapToText(row[4]) : null, familyFriendly: - fields.contains('family_friendly') ? (row[5] as bool?) : null, + fields.contains('family_friendly') ? mapToBool(row[5]) : null, recalledAt: fields.contains('recalled_at') ? (row[6] as DateTime?) : null); return Optional.of(model); From f9b07b247794821138fcf860a41fd56061de81a7 Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 7 Feb 2022 20:42:32 +0800 Subject: [PATCH 05/28] Updated ORM generator --- packages/orm/angel_migration/CHANGELOG.md | 5 ++++ packages/orm/angel_migration/README.md | 4 ++-- .../orm/angel_migration/lib/src/table.dart | 4 ++-- packages/orm/angel_migration/pubspec.yaml | 7 ++++-- .../orm/angel_migration_runner/CHANGELOG.md | 4 ++++ packages/orm/angel_migration_runner/README.md | 4 ++-- .../orm/angel_migration_runner/pubspec.yaml | 12 ++++++---- packages/orm/angel_orm/CHANGELOG.md | 5 ++++ packages/orm/angel_orm/README.md | 3 ++- packages/orm/angel_orm/lib/src/query.dart | 14 +++++++---- packages/orm/angel_orm/pubspec.yaml | 2 +- packages/orm/angel_orm_generator/CHANGELOG.md | 5 ++++ .../orm/angel_orm_generator/example/main.dart | 12 ++++++++-- .../lib/src/orm_generator.dart | 3 ++- packages/orm/angel_orm_generator/pubspec.yaml | 14 ++++++----- .../angel_orm_mysql/lib/angel3_orm_mysql.dart | 16 ++++++------- packages/orm/angel_orm_mysql/pubspec.yaml | 5 +--- .../orm/angel_orm_mysql/test/all_test.dart | 6 +++-- .../orm/angel_orm_mysql/test/orm_debug.dart | 4 ++-- .../angel_orm_test/lib/src/models/leg.g.dart | 2 +- .../lib/src/standalone_test.dart | 2 +- .../serialize/angel_serialize/CHANGELOG.md | 9 ++++++++ .../angel_serialize/lib/angel3_serialize.dart | 23 ------------------- .../serialize/angel_serialize/pubspec.yaml | 4 ++-- .../angel_serialize_generator/CHANGELOG.md | 5 ++++ .../lib/angel3_serialize_generator.dart | 1 - .../lib/build_context.dart | 1 - .../angel_serialize_generator/pubspec.yaml | 8 +++---- 28 files changed, 108 insertions(+), 76 deletions(-) diff --git a/packages/orm/angel_migration/CHANGELOG.md b/packages/orm/angel_migration/CHANGELOG.md index 9e56275d..b1005bb5 100755 --- a/packages/orm/angel_migration/CHANGELOG.md +++ b/packages/orm/angel_migration/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 4.0.4 + +* Updated README +* Removed deprecated + ## 4.0.3 * Updated README diff --git a/packages/orm/angel_migration/README.md b/packages/orm/angel_migration/README.md index c15aa515..4b5c0e73 100755 --- a/packages/orm/angel_migration/README.md +++ b/packages/orm/angel_migration/README.md @@ -10,5 +10,5 @@ A database migration framework built for Angel3 ORM. ## Supported database * PostgreSQL version 10 or later -* MySQL 8.0 or later -* MariaDB 10.2.1 or later +* MySQL 8.0.x +* MariaDB 10.2.x diff --git a/packages/orm/angel_migration/lib/src/table.dart b/packages/orm/angel_migration/lib/src/table.dart index 084a9c62..15deb5c3 100755 --- a/packages/orm/angel_migration/lib/src/table.dart +++ b/packages/orm/angel_migration/lib/src/table.dart @@ -19,8 +19,8 @@ abstract class Table { MigrationColumn date(String name) => declare(name, ColumnType.date); - @deprecated - MigrationColumn dateTime(String name) => timeStamp(name, timezone: true); + //@deprecated + //MigrationColumn dateTime(String name) => timeStamp(name, timezone: true); MigrationColumn timeStamp(String name, {bool timezone = false}) { if (timezone != true) return declare(name, ColumnType.timeStamp); diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index bb365806..69fe4f0b 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -1,11 +1,14 @@ name: angel3_migration -version: 4.0.3 +version: 4.1.0 description: Database migration runtime for Angel3 ORM. Use this package to define schemas. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_orm: ^4.0.0 + angel3_orm: ^4.1.0 dev_dependencies: lints: ^1.0.0 +dependency_overrides: + angel3_orm: + path: ../angel_orm \ No newline at end of file diff --git a/packages/orm/angel_migration_runner/CHANGELOG.md b/packages/orm/angel_migration_runner/CHANGELOG.md index a6fc43b0..39cbd741 100755 --- a/packages/orm/angel_migration_runner/CHANGELOG.md +++ b/packages/orm/angel_migration_runner/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 4.1.2 + +* Updated README + ## 4.1.1 * Updated README diff --git a/packages/orm/angel_migration_runner/README.md b/packages/orm/angel_migration_runner/README.md index 6490ea41..9e70ff49 100755 --- a/packages/orm/angel_migration_runner/README.md +++ b/packages/orm/angel_migration_runner/README.md @@ -10,5 +10,5 @@ Command-line based database migration runner for Angel3 ORM. Supported database: * PostgreSQL version 10 or later -* MySQL 8.0 or later -* MariaDB 10.2.1 or later +* MySQL 8.0.x +* MariaDB 10.2.x diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index c9d453c6..3a24cbee 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,13 +1,13 @@ name: angel3_migration_runner -version: 4.1.1 +version: 4.1.2 description: Command-line based database migration runner for Angel3's ORM. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_migration: ^4.0.0 - angel3_orm: ^4.0.0 + angel3_migration: ^4.1.0 + angel3_orm: ^4.1.0 args: ^2.1.0 charcode: ^1.2.0 postgres: ^2.4.0 @@ -15,4 +15,8 @@ dependencies: logging: ^1.0.0 dev_dependencies: lints: ^1.0.0 - +dependency_overrides: + angel3_orm: + path: ../angel_orm + angel3_migration: + path: ../angel_migration diff --git a/packages/orm/angel_orm/CHANGELOG.md b/packages/orm/angel_orm/CHANGELOG.md index 58f1887d..f8d60f70 100644 --- a/packages/orm/angel_orm/CHANGELOG.md +++ b/packages/orm/angel_orm/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 4.1.0 + +* Added `MySQLDialect` to handle MySQL database specific features +* Updated `insert` and `update` query to support database without writable CTE + ## 4.0.6 * Fixed multiple `orderBy` error diff --git a/packages/orm/angel_orm/README.md b/packages/orm/angel_orm/README.md index 43f12ff6..f8c32a55 100644 --- a/packages/orm/angel_orm/README.md +++ b/packages/orm/angel_orm/README.md @@ -10,6 +10,7 @@ Runtime support for Angel3 ORM. Includes a clean, database-agnostic query builde ## Supported database * PostgreSQL version 10, 11, 12, 13 and 14 -* MySQL 8.0 or later +* MariaDB 10.2.x +* MySQL 8.0.x For documentation about the ORM, see [Developer Guide](https://angel3-docs.dukefirehawk.com/guides/orm) diff --git a/packages/orm/angel_orm/lib/src/query.dart b/packages/orm/angel_orm/lib/src/query.dart index 0a2a5bb6..b96f359e 100644 --- a/packages/orm/angel_orm/lib/src/query.dart +++ b/packages/orm/angel_orm/lib/src/query.dart @@ -343,7 +343,7 @@ abstract class Query extends QueryBase { Future> delete(QueryExecutor executor) { var sql = compile({}, preamble: 'DELETE', withFields: false); - //_log.fine("Delete Query = $sql"); + //_log.warning("Delete Query = $sql"); if (_joins.isEmpty) { return executor @@ -379,14 +379,20 @@ abstract class Query extends QueryBase { var returning = fields.map(adornWithTableName).join(', '); sql = 'WITH $tableName as ($insertion RETURNING $returning) ' + sql; } else if (executor.dialect is MySQLDialect) { - var returningSelect = values?.compileInsertSelect(this, tableName); - returningSql = '$sql where $returningSelect'; + // Default to using 'id' as primary key in model + if (fields.contains("id")) { + returningSql = '$sql where $tableName.id=?'; + } else { + var returningSelect = values?.compileInsertSelect(this, tableName); + returningSql = '$sql where $returningSelect'; + } + sql = '$insertion'; } else { throw ArgumentError("Unsupported database dialect."); } - _log.warning("Insert Query = $sql"); + //_log.warning("Insert Query = $sql"); return executor .query(tableName, sql, substitutionValues, diff --git a/packages/orm/angel_orm/pubspec.yaml b/packages/orm/angel_orm/pubspec.yaml index 5f2b1d13..860f8b12 100644 --- a/packages/orm/angel_orm/pubspec.yaml +++ b/packages/orm/angel_orm/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_orm -version: 4.0.6 +version: 4.1.0 description: Runtime support for Angel3 ORM. Includes base classes for queries. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm diff --git a/packages/orm/angel_orm_generator/CHANGELOG.md b/packages/orm/angel_orm_generator/CHANGELOG.md index d9447e1a..3eb98587 100644 --- a/packages/orm/angel_orm_generator/CHANGELOG.md +++ b/packages/orm/angel_orm_generator/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 5.0.0 + +* Updated `analyzer` to version 3.x +* Updated min SDK to 2.14.x + ## 4.3.0 * Added `where.raw()` diff --git a/packages/orm/angel_orm_generator/example/main.dart b/packages/orm/angel_orm_generator/example/main.dart index 434ad9f1..cc2e1b7e 100644 --- a/packages/orm/angel_orm_generator/example/main.dart +++ b/packages/orm/angel_orm_generator/example/main.dart @@ -21,8 +21,12 @@ class _FakeExecutor extends QueryExecutor { @override Future> query( - String tableName, String? query, Map substitutionValues, - [returningFields = const []]) async { + String tableName, + String? query, + Map substitutionValues, { + String returningQuery = '', + List returningFields = const [], + }) async { var now = DateTime.now(); print( '_FakeExecutor received query: $query and values: $substitutionValues'); @@ -35,6 +39,10 @@ class _FakeExecutor extends QueryExecutor { Future transaction(FutureOr Function(QueryExecutor) f) { throw UnsupportedError('Transactions are not supported.'); } + + @override + // TODO: implement dialect + Dialect get dialect => PostgreSQLDialect(); } @orm diff --git a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart index eb75ef9b..0d6dd376 100644 --- a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart +++ b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart @@ -110,7 +110,8 @@ class OrmGenerator extends GeneratorForAnnotation { var type = ctx.columns[field.name]?.type; if (type == null) continue; if (floatTypes.contains(type)) { - args[name] = literalString('text'); + //args[name] = literalString('text'); + args[name] = literalString('char'); } } diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index e3b9451a..84914431 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -1,16 +1,16 @@ name: angel3_orm_generator -version: 4.3.0 +version: 5.0.0 description: Code generators for Angel3 ORM. Generates query builder classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: - analyzer: ^2.0.0 + analyzer: ^3.0.0 angel3_model: ^3.0.0 angel3_serialize: ^4.0.0 - angel3_orm: ^4.0.0 - angel3_serialize_generator: ^4.0.0 + angel3_orm: ^4.1.0 + angel3_serialize_generator: ^5.0.0 inflection3: ^0.5.3+1 build: ^2.0.1 build_config: ^1.0.0 @@ -25,7 +25,7 @@ dependencies: optional: ^6.0.0 dev_dependencies: angel3_framework: ^4.2.0 - angel3_migration: ^4.0.0 + angel3_migration: ^4.1.0 build_runner: ^2.0.1 postgres: ^2.4.0 test: ^1.17.3 @@ -35,4 +35,6 @@ dependency_overrides: path: ../angel_orm angel3_migration: path: ../angel_migration + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart index 55334902..914068ec 100644 --- a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart +++ b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart @@ -90,9 +90,9 @@ class MySqlExecutor extends QueryExecutor { var params = substitutionValues.values.toList(); - logger?.warning('Query: $query'); - logger?.warning('Values: $params'); - logger?.warning('Returning Query: $returningQuery'); + //logger?.warning('Query: $query'); + //logger?.warning('Values: $params'); + //logger?.warning('Returning Query: $returningQuery'); if (returningQuery.isNotEmpty) { // Handle insert, update and delete @@ -101,12 +101,12 @@ class MySqlExecutor extends QueryExecutor { var result = await _connection.query(query, params); query = returningQuery; - logger?.warning('Result.insertId: ${result.insertId}'); - - // No primary key + //logger?.warning('Result.insertId: ${result.insertId}'); + // Has primary key //if (result.insertId != 0) { - // params = [result.insertId]; - //} + if (returningQuery.endsWith('.id=?')) { + params = [result.insertId]; + } } else if (query.startsWith("UPDATE")) { await _connection.query(query, params); query = returningQuery; diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index 7393bc90..bc30de7c 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -11,11 +11,8 @@ dependencies: mysql1: ^0.19.0 optional: ^6.0.0 dev_dependencies: - angel3_migration: ^4.0.0 - angel3_orm_generator: ^4.0.0 - build_runner: ^2.0.0 - test: ^1.17.0 angel3_orm_test: ^3.0.0 + test: ^1.17.0 lints: ^1.0.0 dependency_overrides: angel3_orm_test: diff --git a/packages/orm/angel_orm_mysql/test/all_test.dart b/packages/orm/angel_orm_mysql/test/all_test.dart index e7bd1f89..57849fd9 100644 --- a/packages/orm/angel_orm_mysql/test/all_test.dart +++ b/packages/orm/angel_orm_mysql/test/all_test.dart @@ -20,8 +20,10 @@ void main() { group('enumAndNested', () => enumAndNestedTests(my(['has_car']), close: closeMy)); group('hasMany', () => hasManyTests(my(['tree', 'fruit']), close: closeMy)); - group('hasMap', () => hasMapTests(my(['has_map']), close: closeMy)); - group('hasOne', () => hasOneTests(my(['leg', 'foot']), close: closeMy)); + // NOTE: MySQL/MariaDB do not support jsonb data type + //group('hasMap', () => hasMapTests(my(['has_map']), close: closeMy)); + // NOTE: mysql1 driver do not support CAST(); + //group('hasOne', () => hasOneTests(my(['leg', 'foot']), close: closeMy)); group( 'manyToMany', () => diff --git a/packages/orm/angel_orm_mysql/test/orm_debug.dart b/packages/orm/angel_orm_mysql/test/orm_debug.dart index 96b21778..7ceeadf9 100644 --- a/packages/orm/angel_orm_mysql/test/orm_debug.dart +++ b/packages/orm/angel_orm_mysql/test/orm_debug.dart @@ -16,6 +16,6 @@ void main() async { belongsToTests(my(['author', 'book']), close: closeMy); - //edgeCaseTests(my(['unorthodox', 'weird_join', 'song', 'numba']), - // close: closeMy); + //hasOneTests(my(['leg', 'foot']), close: closeMy); + //standaloneTests(my(['car']), close: closeMy); } diff --git a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart index e2d692dc..1110200f 100644 --- a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart @@ -203,7 +203,7 @@ class FootQuery extends Query { @override Map get casts { - return {'n_toes': 'text'}; + return {'n_toes': 'char'}; } @override diff --git a/packages/orm/angel_orm_test/lib/src/standalone_test.dart b/packages/orm/angel_orm_test/lib/src/standalone_test.dart index f947ac9c..fee387d5 100644 --- a/packages/orm/angel_orm_test/lib/src/standalone_test.dart +++ b/packages/orm/angel_orm_test/lib/src/standalone_test.dart @@ -77,7 +77,7 @@ void standaloneTests(FutureOr Function() createExecutor, var sportsCars = CarQuery()..where!.familyFriendly.isFalse; cars = await sportsCars.get(executor!); - //print(cars.map((c) => c.toJson())); + print(cars.map((c) => c.toJson())); var car = cars.first; expect(car.make, ferrari!.make); diff --git a/packages/serialize/angel_serialize/CHANGELOG.md b/packages/serialize/angel_serialize/CHANGELOG.md index 24f559a4..d59da367 100644 --- a/packages/serialize/angel_serialize/CHANGELOG.md +++ b/packages/serialize/angel_serialize/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 5.0.0 + +* Updated `analyzer` to version 3.x +* Updated min SDK to 2.14.x + +## 4.1.1 + +* Removed deprecated + ## 4.1.0 * Updated README diff --git a/packages/serialize/angel_serialize/lib/angel3_serialize.dart b/packages/serialize/angel_serialize/lib/angel3_serialize.dart index 6b20dbba..cf0fa14a 100644 --- a/packages/serialize/angel_serialize/lib/angel3_serialize.dart +++ b/packages/serialize/angel_serialize/lib/angel3_serialize.dart @@ -87,8 +87,6 @@ class Serializable { const Serializable( {this.serializers = const [Serializers.map, Serializers.json], this.autoSnakeCaseNames = true, - // ignore: deprecated_member_use_from_same_package - //@deprecated this.autoIdAndDateFields = true, this.includeAnnotations = const []}); /// A list of enabled serialization modes. @@ -99,10 +97,6 @@ class Serializable { /// Overrides the setting in `SerializerGenerator`. final bool autoSnakeCaseNames; - /// Overrides the setting in `JsonModelGenerator`. - //@deprecated - //final bool autoIdAndDateFields; - /// A list of constant members to affix to the generated class. final List includeAnnotations; } @@ -130,20 +124,3 @@ abstract class Serializers { /// Generate a TypeScript definition file (`.d.ts`) for use on the client-side. static const int typescript = 2; } - -/* -@deprecated -class DefaultValue { - final value; - - const DefaultValue(this.value); -} - -@deprecated -/// Prefer [SerializableField] instead. -class Alias { - final String name; - - const Alias(this.name); -} -*/ \ No newline at end of file diff --git a/packages/serialize/angel_serialize/pubspec.yaml b/packages/serialize/angel_serialize/pubspec.yaml index aa52f752..9a853785 100644 --- a/packages/serialize/angel_serialize/pubspec.yaml +++ b/packages/serialize/angel_serialize/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_serialize -version: 4.1.0 +version: 4.1.1 description: Static annotations powering Angel3 model serialization. Combine with angel3_serialize_generator for flexible modeling. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize +repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize environment: sdk: '>=2.12.0 <3.0.0' dependencies: diff --git a/packages/serialize/angel_serialize_generator/CHANGELOG.md b/packages/serialize/angel_serialize_generator/CHANGELOG.md index 481f155b..a4991c69 100644 --- a/packages/serialize/angel_serialize_generator/CHANGELOG.md +++ b/packages/serialize/angel_serialize_generator/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 5.0.0 + +* Updated `analyzer` to version 3.x +* Updated min SDK to 2.14.x + ## 4.3.0 * Updated to use `package:belatuk_code_buffer` diff --git a/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart b/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart index fdd1cf29..01ea5ed8 100644 --- a/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart +++ b/packages/serialize/angel_serialize_generator/lib/angel3_serialize_generator.dart @@ -7,7 +7,6 @@ import 'package:analyzer/dart/constant/value.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; -import 'package:angel3_model/angel3_model.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; import 'package:build/build.dart'; import 'package:belatuk_code_buffer/belatuk_code_buffer.dart'; diff --git a/packages/serialize/angel_serialize_generator/lib/build_context.dart b/packages/serialize/angel_serialize_generator/lib/build_context.dart index 2dc8e268..c7dbfb8d 100644 --- a/packages/serialize/angel_serialize_generator/lib/build_context.dart +++ b/packages/serialize/angel_serialize_generator/lib/build_context.dart @@ -5,7 +5,6 @@ import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/src/dart/element/element.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; import 'package:build/build.dart'; -import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; import 'package:recase/recase.dart'; import 'package:source_gen/source_gen.dart'; diff --git a/packages/serialize/angel_serialize_generator/pubspec.yaml b/packages/serialize/angel_serialize_generator/pubspec.yaml index 824634ba..7fa5b0a7 100644 --- a/packages/serialize/angel_serialize_generator/pubspec.yaml +++ b/packages/serialize/angel_serialize_generator/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_serialize_generator -version: 4.3.0 +version: 5.0.0 description: Angel3 model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize_generator +repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize_generator environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: - analyzer: ^2.0.0 + analyzer: ^3.0.0 angel3_model: ^3.0.0 angel3_serialize: ^4.1.0 belatuk_code_buffer: ^3.0.0 From 02350397196c949236f4923c6b473fa4bb24a696 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 13 Feb 2022 21:01:10 +0800 Subject: [PATCH 06/28] Updated pubspec --- packages/orm/angel_orm_mysql/pubspec.yaml | 2 +- packages/orm/angel_orm_postgres/pubspec.yaml | 4 +++- packages/orm/angel_orm_test/lib/src/models/car.g.dart | 5 +++-- .../orm/angel_orm_test/lib/src/models/person_order.g.dart | 4 ++-- packages/orm/angel_orm_test/pubspec.yaml | 8 +++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index bc30de7c..49abe095 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_orm: ^4.0.0 + angel3_orm: ^4.1.0 logging: ^1.0.0 mysql1: ^0.19.0 optional: ^6.0.0 diff --git a/packages/orm/angel_orm_postgres/pubspec.yaml b/packages/orm/angel_orm_postgres/pubspec.yaml index f682fc88..8a17103b 100644 --- a/packages/orm/angel_orm_postgres/pubspec.yaml +++ b/packages/orm/angel_orm_postgres/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_orm: ^4.0.0 + angel3_orm: ^4.1.0 logging: ^1.0.1 pool: ^1.5.0 postgres: ^2.4.1 @@ -21,3 +21,5 @@ dependency_overrides: path: ../angel_orm_test angel3_orm: path: ../angel_orm + angel3_migration: + path: ../angel_migration diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index 2287dd49..e7329ddc 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -94,9 +94,10 @@ class CarQuery extends Query { createdAt: fields.contains('created_at') ? (row[1] as DateTime?) : null, updatedAt: fields.contains('updated_at') ? (row[2] as DateTime?) : null, make: fields.contains('make') ? (row[3] as String?) : null, - description: fields.contains('description') ? mapToText(row[4]) : null, + description: + fields.contains('description') ? (row[4] as String?) : null, familyFriendly: - fields.contains('family_friendly') ? mapToBool(row[5]) : null, + fields.contains('family_friendly') ? (row[5] as bool?) : null, recalledAt: fields.contains('recalled_at') ? (row[6] as DateTime?) : null); return Optional.of(model); diff --git a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart index cac1ac5f..8dddf199 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart @@ -48,7 +48,7 @@ class PersonOrderQuery extends Query { @override Map get casts { - return {'price': 'text'}; + return {'price': 'char'}; } @override @@ -212,7 +212,7 @@ class OrderWithPersonInfoQuery @override Map get casts { - return {'price': 'text'}; + return {'price': 'char'}; } @override diff --git a/packages/orm/angel_orm_test/pubspec.yaml b/packages/orm/angel_orm_test/pubspec.yaml index 976812d6..215180de 100644 --- a/packages/orm/angel_orm_test/pubspec.yaml +++ b/packages/orm/angel_orm_test/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_orm_test -version: 3.1.2 +version: 4.0.0 description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_test environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_migration: ^4.0.0 + angel3_migration: ^4.1.0 angel3_model: ^3.1.0 angel3_orm: ^4.0.0 angel3_serialize: ^4.1.0 @@ -15,7 +15,7 @@ dependencies: collection: ^1.15.0 optional: ^6.0.0 dev_dependencies: - angel3_orm_generator: ^4.1.0 + angel3_orm_generator: ^5.0.0 angel3_framework: ^4.2.0 build_runner: ^2.0.1 lints: ^1.0.0 @@ -26,3 +26,5 @@ dependency_overrides: path: ../angel_orm_generator angel3_migration: path: ../angel_migration + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator From dfd974c106af3e07d88b3fe046ce18ff8850dffe Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 14 Feb 2022 00:48:37 +0800 Subject: [PATCH 07/28] 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 From 6d2be105360a1a70ee71ae80650674010cb3c07e Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 19 Feb 2022 20:24:34 +0800 Subject: [PATCH 08/28] Removed dependency on mirror --- .../container/angel_container_generator/pubspec.yaml | 9 ++++++--- packages/framework/lib/src/core/injection.dart | 8 +++++--- packages/framework/lib/src/core/server.dart | 9 ++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/container/angel_container_generator/pubspec.yaml b/packages/container/angel_container_generator/pubspec.yaml index 831b4be5..c22acfc7 100644 --- a/packages/container/angel_container_generator/pubspec.yaml +++ b/packages/container/angel_container_generator/pubspec.yaml @@ -1,15 +1,18 @@ name: angel3_container_generator -version: 3.0.1 +version: 6.0.0 description: Codegen support for using pkg:reflectable with pkg:angel3_container. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container_generator environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_container: ^3.1.0 + angel3_container: ^6.0.0 reflectable: ^3.0.4 dev_dependencies: build_runner: ^2.1.2 build_test: ^2.1.3 test: ^1.17.5 lints: ^1.0.1 +dependency_overrides: + angel3_container: + path: ../angel_container diff --git a/packages/framework/lib/src/core/injection.dart b/packages/framework/lib/src/core/injection.dart index 08563d0f..1d81a188 100644 --- a/packages/framework/lib/src/core/injection.dart +++ b/packages/framework/lib/src/core/injection.dart @@ -101,7 +101,9 @@ RequestHandler handleContained(Function handler, InjectionRequest injection, return (RequestContext req, ResponseContext res) async { if (injection.parameters.isNotEmpty && injection.parameters.values.any((p) => p.match != null) && - !suitableForInjection(req, res, injection)) return Future.value(true); + !suitableForInjection(req, res, injection)) { + return Future.value(true); + } var args = []; @@ -167,10 +169,10 @@ InjectionRequest preInject(Function handler, Reflector reflector) { var name = parameter.name; var type = parameter.type.reflectedType; - var _Parameter = reflector.reflectType(Parameter); + var _parameter = reflector.reflectType(Parameter); var p = parameter.annotations - .firstWhereOrNull((m) => m.type.isAssignableTo(_Parameter)) + .firstWhereOrNull((m) => m.type.isAssignableTo(_parameter)) ?.reflectee as Parameter?; //print(p); if (p != null) { diff --git a/packages/framework/lib/src/core/server.dart b/packages/framework/lib/src/core/server.dart index 089bb01c..45d6f44f 100644 --- a/packages/framework/lib/src/core/server.dart +++ b/packages/framework/lib/src/core/server.dart @@ -4,7 +4,6 @@ import 'dart:async'; import 'dart:collection' show HashMap; import 'dart:convert'; import 'package:angel3_container/angel3_container.dart'; -import 'package:angel3_container/mirrors.dart'; import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:angel3_route/angel3_route.dart'; import 'package:belatuk_combinator/belatuk_combinator.dart'; @@ -322,7 +321,7 @@ class Angel extends Routable { /// the execution will be faster, as the injection requirements were stored beforehand. Future runContained(Function handler, RequestContext req, ResponseContext res, [Container? container]) { - container ??= Container(MirrorsReflector()); + container ??= Container(EmptyReflector()); return Future.sync(() { if (_preContained.containsKey(handler)) { return handleContained(handler, _preContained[handler]!, container)( @@ -337,7 +336,11 @@ class Angel extends Routable { Future runReflected(Function handler, RequestContext req, ResponseContext res, [Container? container]) { container ??= - req.container ?? res.app?.container ?? Container(ThrowingReflector()); + req.container ?? res.app?.container ?? Container(EmptyReflector()); + + if (container.reflector is EmptyReflector) { + throw ArgumentError("No `reflector` passed"); + } var h = handleContained( handler, _preContained[handler] = preInject(handler, container.reflector), From ff65e13c7556ed04a2c6663d879caf1c442cec35 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 20 Feb 2022 09:48:12 +0800 Subject: [PATCH 09/28] Added default logging --- .../angel_container_generator/CHANGELOG.md | 12 ++++ packages/framework/lib/src/core/driver.dart | 72 ++++++------------- .../lib/src/core/response_context.dart | 5 +- packages/framework/lib/src/core/routable.dart | 5 ++ packages/framework/lib/src/core/server.dart | 64 ++++++++--------- .../framework/lib/src/http/angel_http.dart | 5 -- .../lib/src/http/http_request_context.dart | 42 ++--------- .../lib/src/http/http_response_context.dart | 8 +-- .../framework/lib/src/http2/angel_http2.dart | 4 +- .../lib/src/http2/http2_response_context.dart | 8 +-- .../framework/test/encoders_buffer_test.dart | 1 - packages/framework/test/streaming_test.dart | 3 +- 12 files changed, 85 insertions(+), 144 deletions(-) diff --git a/packages/container/angel_container_generator/CHANGELOG.md b/packages/container/angel_container_generator/CHANGELOG.md index d46070a6..05db9bf7 100644 --- a/packages/container/angel_container_generator/CHANGELOG.md +++ b/packages/container/angel_container_generator/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.0.1 * Updated `package:angel3_container` diff --git a/packages/framework/lib/src/core/driver.dart b/packages/framework/lib/src/core/driver.dart index 9ebdc003..470532d2 100644 --- a/packages/framework/lib/src/core/driver.dart +++ b/packages/framework/lib/src/core/driver.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io' show stderr, Cookie; +import 'dart:io' show Cookie; import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:angel3_route/angel3_route.dart'; import 'package:belatuk_combinator/belatuk_combinator.dart'; @@ -20,10 +20,6 @@ abstract class Driver< final Angel app; final bool useZone; bool _closed = false; - late Server _server; - - // TODO: Ugly fix - bool isServerInitialised = false; StreamSubscription? _sub; //final log = Logger('Driver'); @@ -37,14 +33,7 @@ abstract class Driver< Uri get uri; /// The native server running this instance. - Server? get server { - // TODO: Ugly fix - if (isServerInitialised) { - return _server; - } else { - return null; - } - } + Server? server; Future generateServer(address, int port) => serverGenerator(address, port); @@ -53,24 +42,21 @@ abstract class Driver< Future startServer([address, int port = 0]) { var host = address ?? '127.0.0.1'; return generateServer(host, port).then((server) { - _server = server; - - // TODO: Ugly fix - isServerInitialised = true; + this.server = server; return Future.wait(app.startupHooks.map(app.configure)).then((_) { app.optimizeForProduction(); - _sub = server.listen((request) { + _sub = this.server?.listen((request) { var stream = createResponseStreamFromRawRequest(request); stream.listen((response) { // TODO: To be revisited handleRawRequest(request, response); }); }); - return Future.value(_server); + return Future.value(this.server!); }); }).catchError((error) { - app.logger?.severe('Failed to create server', error); + app.logger.severe('Failed to create server', error); throw ArgumentError('[Driver]Failed to create server'); }); } @@ -163,7 +149,7 @@ abstract class Driver< ..registerSingleton?>(tuple.item3) ..registerSingleton(tuple.item3); - if (!app.environment.isProduction && app.logger != null) { + if (!app.environment.isProduction) { req.container?.registerSingleton(Stopwatch()..start()); } @@ -204,22 +190,16 @@ abstract class Driver< message: ee?.toString() ?? '500 Internal Server Error'); } - if (app.logger != null) { - var error = e.error ?? e; - var trace = Trace.from(StackTrace.current).terse; - app.logger?.severe(e.message, error, trace); - } + var error = e.error ?? e; + var trace = Trace.from(StackTrace.current).terse; + app.logger.severe(e.message, error, trace); return handleAngelHttpException(e, st, req, res, request, response); }); } else { var zoneSpec = ZoneSpecification( print: (self, parent, zone, line) { - if (app.logger != null) { - app.logger?.info(line); - } else { - parent.print(zone, line); - } + app.logger.info(line); }, handleUncaughtError: (self, parent, zone, error, stackTrace) { var trace = Trace.from(stackTrace).terse; @@ -237,9 +217,7 @@ abstract class Driver< stackTrace: stackTrace, message: error.toString()); } - if (app.logger != null) { - app.logger?.severe(e.message, error, trace); - } + app.logger.severe(e.message, error, trace); return handleAngelHttpException( e, trace, req, res, request, response); @@ -248,23 +226,15 @@ abstract class Driver< closeResponse(response); // Ideally, we won't be in a position where an absolutely fatal error occurs, // but if so, we'll need to log it. - if (app.logger != null) { - app.logger!.severe( - 'Fatal error occurred when processing $uri.', e, trace); - } else { - stderr - ..writeln('Fatal error occurred when processing ' - '${req.uri}:') - ..writeln(e) - ..writeln(trace); - } + app.logger.severe( + 'Fatal error occurred when processing $uri.', e, trace); }); }, ); var zone = Zone.current.fork(specification: zoneSpec); - req.container!.registerSingleton(zone); - req.container!.registerSingleton(zoneSpec); + req.container?.registerSingleton(zone); + req.container?.registerSingleton(zoneSpec); // If a synchronous error is thrown, it's not caught by `zone.run`, // so use a try/catch, and recover when need be. @@ -291,12 +261,12 @@ abstract class Driver< {bool ignoreFinalizers = false}) { if (req == null || res == null) { try { - app.logger?.severe('500 Internal Server Error', e, st); + app.logger.severe('500 Internal Server Error', e, st); setStatusCode(response, 500); writeStringToResponse(response, '500 Internal Server Error'); closeResponse(response); } catch (e) { - app.logger?.severe('500 Internal Server Error', e); + app.logger.severe('500 Internal Server Error', e); } return Future.value(); } @@ -322,11 +292,9 @@ abstract class Driver< ResponseContext res, {bool ignoreFinalizers = false}) { Future _cleanup(_) { - if (!app.environment.isProduction && - app.logger != null && - req.container!.has()) { + if (!app.environment.isProduction && req.container!.has()) { var sw = req.container!.make(); - app.logger?.info( + app.logger.info( "${res.statusCode} ${req.method} ${req.uri} (${sw.elapsedMilliseconds} ms)"); } return req.close(); diff --git a/packages/framework/lib/src/core/response_context.dart b/packages/framework/lib/src/core/response_context.dart index 25d97c5d..6fbdfd95 100644 --- a/packages/framework/lib/src/core/response_context.dart +++ b/packages/framework/lib/src/core/response_context.dart @@ -9,7 +9,6 @@ import 'dart:typed_data'; import 'package:angel3_route/angel3_route.dart'; import 'package:file/file.dart'; import 'package:http_parser/http_parser.dart'; -import 'package:logging/logging.dart'; import 'package:mime/mime.dart'; import 'controller.dart'; @@ -25,7 +24,7 @@ abstract class ResponseContext final CaseInsensitiveMap _headers = CaseInsensitiveMap.from( {'content-type': 'text/plain', 'server': 'Angel3'}); - final log = Logger('ResponseContext'); + //final log = Logger('ResponseContext'); Completer? _done; int _statusCode = 200; @@ -351,7 +350,7 @@ abstract class ResponseContext if (stackTrace != null) { Zone.current.handleUncaughtError(error, stackTrace); } else { - log.warning('[ResponseContext] stackTrace is null'); + app?.logger.warning('[ResponseContext] stackTrace is null'); } } } diff --git a/packages/framework/lib/src/core/routable.dart b/packages/framework/lib/src/core/routable.dart index 09e8464e..5543f1ab 100644 --- a/packages/framework/lib/src/core/routable.dart +++ b/packages/framework/lib/src/core/routable.dart @@ -46,6 +46,11 @@ RequestHandler chain(Iterable handlers) { class Routable extends Router { final Map _services = {}; final Map _serviceLookups = {}; + + /// A [Map] of application-specific data that can be accessed. + /// + /// Packages like `package:angel3_configuration` populate this map + /// for you. final Map configuration = {}; final Container _container; diff --git a/packages/framework/lib/src/core/server.dart b/packages/framework/lib/src/core/server.dart index 45d6f44f..dbd77772 100644 --- a/packages/framework/lib/src/core/server.dart +++ b/packages/framework/lib/src/core/server.dart @@ -55,6 +55,18 @@ Future _defaultErrorHandler( } } +Logger _defaultLogger() { + Logger logger = Logger('SERVER') + //..level = Level.WARNING + ..onRecord.listen((rec) { + print(rec); + if (rec.error != null) print(rec.error); + if (rec.stackTrace != null) print(rec.stackTrace); + }); + + return logger; +} + /// A powerful real-time/REST/MVC server class. class Angel extends Routable { static Future _noViewEngineConfigured(String view, [Map? data]) => @@ -99,19 +111,6 @@ class Angel extends Routable { /// A set of [Controller] objects that have been loaded into the application. Map get controllers => _controllers; - /// Now *deprecated*, in favor of [AngelEnv] and [angelEnv]. Use `app.environment.isProduction` - /// instead. - /// - /// Indicates whether the application is running in a production environment. - /// - /// The criteria for this is the `ANGEL_ENV` environment variable being set to - /// `'production'`. - /// - /// This value is memoized the first time you call it, so do not change environment - /// configuration at runtime! - //@deprecated - //bool get isProduction => environment.isProduction; - /// The [AngelEnvironment] in which the application is running. /// /// By default, it is automatically inferred. @@ -121,7 +120,7 @@ class Angel extends Routable { Angel? get parent => _parent; /// Outputs diagnostics and debug messages. - Logger? logger; + Logger logger = _defaultLogger(); /// Plug-ins to be called right before server startup. /// @@ -138,14 +137,6 @@ class Angel extends Routable { /// These will only not run if a response's `willCloseItself` is set to `true`. final List responseFinalizers = []; - /// A [Map] of application-specific data that can be accessed by any - /// piece of code that can see this [Angel] instance. - /// - /// Packages like `package:angel3_configuration` populate this map - /// for you. - @override - final Map configuration = {}; - /// A function that renders views. /// /// Called by [ResponseContext]@`render`. @@ -158,11 +149,10 @@ class Angel extends Routable { Route addRoute( String method, String path, RequestHandler handler, {Iterable middleware = const []}) { - //middleware ??= []; if (_flattened != null) { - logger?.warning( + logger.warning( 'WARNING: You added a route ($method $path) to the router, after it had been optimized.'); - logger?.warning( + logger.warning( 'This route will be ignored, and no requests will ever reach it.'); } @@ -173,9 +163,9 @@ class Angel extends Routable { SymlinkRoute mount( String path, Router router) { if (_flattened != null) { - logger?.warning( + logger.warning( 'WARNING: You added mounted a child router ($path) on the router, after it had been optimized.'); - logger?.warning( + logger.warning( 'This route will be ignored, and no requests will ever reach it.'); } @@ -202,7 +192,7 @@ class Angel extends Routable { /// /// The server will be **COMPLETELY DEFUNCT** after this operation! @override - Future close() { + Future close() { Future.forEach(services.values, (Service service) { service.close(); }); @@ -212,14 +202,13 @@ class Angel extends Routable { _preContained.clear(); handlerCache.clear(); encoders.clear(); - //_serializer = json.encode; _children.clear(); - _parent = null; - logger = null; + //_parent = null; + //logger = null; + //_flattened = null; startupHooks.clear(); shutdownHooks.clear(); responseFinalizers.clear(); - _flattened = null; return Future.value(); } @@ -312,7 +301,7 @@ class Angel extends Routable { void optimizeForProduction({bool force = false}) { if (environment.isProduction || force == true) { _flattened ??= flatten(this); - logger?.info('Angel is running in production mode.'); + logger.info('Angel is running in production mode.'); } } @@ -391,16 +380,21 @@ class Angel extends Routable { {Reflector reflector = const ThrowingReflector(errorMessage: _reflectionErrorMessage), this.environment = angelEnv, - this.logger, + Logger? logger, this.allowMethodOverrides = true, this.serializer, this.viewGenerator}) : super(reflector) { + // Override default logger + if (logger != null) { + this.logger = logger; + } + if (reflector is EmptyReflector || reflector is ThrowingReflector) { var msg = 'No `reflector` was passed to the Angel constructor, so reflection will not be available.\n' + _reflectionInfo; - logger?.warning(msg); + this.logger.warning(msg); } bootstrapContainer(); diff --git a/packages/framework/lib/src/http/angel_http.dart b/packages/framework/lib/src/http/angel_http.dart index dd389634..f56dc5e0 100644 --- a/packages/framework/lib/src/http/angel_http.dart +++ b/packages/framework/lib/src/http/angel_http.dart @@ -103,15 +103,10 @@ class AngelHttp extends Driver createResponseContext( HttpRequest request, HttpResponse response, [HttpRequestContext? correspondingRequest]) { - // TODO: Refactored to overcome NNBD migration error var context = HttpResponseContext(response, app, correspondingRequest); context.serializer = (app.serializer ?? json.encode); context.encoders.addAll(app.encoders); return Future.value(context); -// return Future.value( -// HttpResponseContext(response, app, correspondingRequest) -// ..serializer = (app.serializer ?? json.encode) -// ..encoders.addAll(app.encoders ?? {})); } @override diff --git a/packages/framework/lib/src/http/http_request_context.dart b/packages/framework/lib/src/http/http_request_context.dart index cafaa391..26797dc8 100644 --- a/packages/framework/lib/src/http/http_request_context.dart +++ b/packages/framework/lib/src/http/http_request_context.dart @@ -24,7 +24,7 @@ class HttpRequestContext extends RequestContext { @override List get cookies { - return rawRequest!.cookies; + return rawRequest?.cookies ?? []; } @override @@ -51,7 +51,7 @@ class HttpRequestContext extends RequestContext { @override String get originalMethod { - return rawRequest!.method; + return rawRequest?.method ?? ''; } @override @@ -61,17 +61,18 @@ class HttpRequestContext extends RequestContext { @override InternetAddress get remoteAddress { - return rawRequest!.connectionInfo!.remoteAddress; + return rawRequest?.connectionInfo?.remoteAddress ?? + InternetAddress("127.0.0.1"); } @override - HttpSession get session { - return rawRequest!.session; + HttpSession? get session { + return rawRequest?.session; } @override Uri get uri { - return rawRequest!.uri; + return rawRequest?.uri ?? Uri(); } /// Magically transforms an [HttpRequest] into a [RequestContext]. @@ -92,35 +93,6 @@ class HttpRequestContext extends RequestContext { ? MediaType('text', 'plain') : MediaType.parse(request.headers.contentType.toString()); ctx._override = override; - - /* - // Faster way to get path - List _path = []; - - // Go up until we reach a ? - for (int ch in request.uri.toString().codeUnits) { - if (ch != $question) - _path.add(ch); - else - break; - } - - // Remove trailing slashes - int lastSlash = -1; - - for (int i = _path.length - 1; i >= 0; i--) { - if (_path[i] == $slash) - lastSlash = i; - else - break; - } - - if (lastSlash > -1) - ctx._path = String.fromCharCodes(_path.take(lastSlash)); - else - ctx._path = String.fromCharCodes(_path); - */ - ctx._path = path; ctx._io = request; diff --git a/packages/framework/lib/src/http/http_response_context.dart b/packages/framework/lib/src/http/http_response_context.dart index e7195481..b310061d 100644 --- a/packages/framework/lib/src/http/http_response_context.dart +++ b/packages/framework/lib/src/http/http_response_context.dart @@ -13,15 +13,15 @@ class HttpResponseContext extends ResponseContext { @override final HttpResponse rawResponse; - @override - Angel? app; - LockableBytesBuilder? _buffer; final HttpRequestContext? _correspondingRequest; bool _isDetached = false, _isClosed = false, _streamInitialized = false; - HttpResponseContext(this.rawResponse, this.app, [this._correspondingRequest]); + HttpResponseContext(this.rawResponse, Angel? app, + [this._correspondingRequest]) { + this.app = app; + } @override HttpResponse detach() { diff --git a/packages/framework/lib/src/http2/angel_http2.dart b/packages/framework/lib/src/http2/angel_http2.dart index 30c79b35..67f35bd0 100644 --- a/packages/framework/lib/src/http2/angel_http2.dart +++ b/packages/framework/lib/src/http2/angel_http2.dart @@ -80,7 +80,7 @@ class AngelHttp2 extends Driver close() async { - await _artificial!.close(); + await _artificial?.close(); await _http.close(); return await super.close(); } @@ -211,7 +211,7 @@ class _AngelHttp2ServerSocket extends Stream }, onDone: _ctrl.close, onError: (e, st) { - driver.app.logger!.warning( + driver.app.logger.warning( 'HTTP/2 incoming connection failure: ', e, st as StackTrace); }, ); diff --git a/packages/framework/lib/src/http2/http2_response_context.dart b/packages/framework/lib/src/http2/http2_response_context.dart index 36c01e40..28ec3420 100644 --- a/packages/framework/lib/src/http2/http2_response_context.dart +++ b/packages/framework/lib/src/http2/http2_response_context.dart @@ -6,9 +6,6 @@ import 'package:http2/transport.dart'; import 'http2_request_context.dart'; class Http2ResponseContext extends ResponseContext { - @override - final Angel? app; - final ServerTransportStream stream; @override @@ -25,8 +22,9 @@ class Http2ResponseContext extends ResponseContext { Uri? _targetUri; - Http2ResponseContext(this.app, this.stream, this._req) { - _targetUri = _req!.uri; + Http2ResponseContext(Angel? app, this.stream, this._req) { + this.app = app; + _targetUri = _req?.uri; } final List _pushes = []; diff --git a/packages/framework/test/encoders_buffer_test.dart b/packages/framework/test/encoders_buffer_test.dart index 0b116e38..7b1e3a2b 100644 --- a/packages/framework/test/encoders_buffer_test.dart +++ b/packages/framework/test/encoders_buffer_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io' show BytesBuilder; import 'dart:io'; import 'package:angel3_container/mirrors.dart'; diff --git a/packages/framework/test/streaming_test.dart b/packages/framework/test/streaming_test.dart index bfa435d1..b31a4ab6 100644 --- a/packages/framework/test/streaming_test.dart +++ b/packages/framework/test/streaming_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io' show stderr; import 'dart:io'; import 'package:angel3_container/mirrors.dart'; @@ -92,7 +91,7 @@ void main() { test('cannot write after close', () async { try { var rq = MockHttpRequest('GET', Uri.parse('/overwrite')); - await (rq.close()); + await rq.close(); await http.handleRequest(rq); var body = await rq.response.transform(utf8.decoder).join(); From 6db69d0fb19b96cdbbed69ead3b46e1efcc597bd Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 20 Feb 2022 10:00:51 +0800 Subject: [PATCH 10/28] Upgraded production --- .../framework/example/http2/body_parsing.dart | 2 +- packages/framework/example/http2/main.dart | 2 +- .../framework/example/http2/server_push.dart | 2 +- packages/production/CHANGELOG.md | 12 +++++++++++ packages/production/lib/src/runner.dart | 2 +- packages/production/pubspec.yaml | 21 +++++++++++++++---- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/framework/example/http2/body_parsing.dart b/packages/framework/example/http2/body_parsing.dart index bdb5052b..ec1b3540 100644 --- a/packages/framework/example/http2/body_parsing.dart +++ b/packages/framework/example/http2/body_parsing.dart @@ -29,7 +29,7 @@ void main() async { try { ctx.setAlpnProtocols(['h2'], true); } catch (e, st) { - app.logger!.severe( + app.logger.severe( 'Cannot set ALPN protocol on server to `h2`. The server will only serve HTTP/1.x.', e, st); diff --git a/packages/framework/example/http2/main.dart b/packages/framework/example/http2/main.dart index d0a93e36..a111c059 100644 --- a/packages/framework/example/http2/main.dart +++ b/packages/framework/example/http2/main.dart @@ -25,7 +25,7 @@ void main() async { try { ctx.setAlpnProtocols(['h2'], true); } catch (e, st) { - app.logger!.severe( + app.logger.severe( 'Cannot set ALPN protocol on server to `h2`. The server will only serve HTTP/1.x.', e, st, diff --git a/packages/framework/example/http2/server_push.dart b/packages/framework/example/http2/server_push.dart index 4123e7b6..93290ca4 100644 --- a/packages/framework/example/http2/server_push.dart +++ b/packages/framework/example/http2/server_push.dart @@ -45,7 +45,7 @@ void main() async { try { ctx.setAlpnProtocols(['h2'], true); } catch (e, st) { - app.logger!.severe( + app.logger.severe( 'Cannot set ALPN protocol on server to `h2`. The server will only serve HTTP/1.x.', e, st); diff --git a/packages/production/CHANGELOG.md b/packages/production/CHANGELOG.md index 625aa474..90751266 100644 --- a/packages/production/CHANGELOG.md +++ b/packages/production/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.2 * Updated repo link diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index 8617a7e4..b9112f85 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -240,7 +240,7 @@ _ ___ | /| / / /_/ / _ /___ _ /___ await app.configure(args.configureServer); - app.logger ??= Logger(args.loggerName) + app.logger = Logger(args.loggerName) ..onRecord.listen((rec) => Runner.handleLogRecord(rec, args.options)); AngelHttp http; diff --git a/packages/production/pubspec.yaml b/packages/production/pubspec.yaml index cad19961..dcbb2313 100644 --- a/packages/production/pubspec.yaml +++ b/packages/production/pubspec.yaml @@ -1,16 +1,29 @@ name: angel3_production -version: 3.1.2 +version: 6.0.0 description: Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Angel3. homepage: https://angel3-framework.web.app repository: https://github.com/dukefirehawk/angel/tree/master/packages/production environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_container: ^3.1.0 - angel3_framework: ^4.2.0 + angel3_container: ^6.0.0 + angel3_framework: ^6.0.0 belatuk_pub_sub: ^4.0.0 args: ^2.3.0 io: ^1.0.0 logging: ^1.0.1 dev_dependencies: lints: ^1.0.1 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request From 48a441cf77b39f800bcb632e4fcc883131060607 Mon Sep 17 00:00:00 2001 From: thomashii Date: Mon, 21 Feb 2022 09:17:27 +0800 Subject: [PATCH 11/28] Updated auth, client and validate packages --- packages/auth/CHANGELOG.md | 8 ++++++ packages/auth/lib/src/plugin.dart | 5 ++-- packages/auth/pubspec.yaml | 21 ++++++++++++--- packages/auth/test/callback_test.dart | 2 +- packages/client/CHANGELOG.md | 8 ++++++ packages/client/lib/angel3_client.dart | 11 ++------ packages/client/lib/auth_types.dart | 3 --- packages/client/lib/base_angel_client.dart | 19 ++++--------- packages/client/lib/browser.dart | 5 +--- packages/client/pubspec.yaml | 31 ++++++++++++++++------ packages/static/pubspec.yaml | 4 +-- packages/test/pubspec.yaml | 4 +-- packages/validate/CHANGELOG.md | 8 ++++++ packages/validate/lib/src/async.dart | 1 - packages/validate/lib/src/matchers.dart | 4 --- packages/validate/lib/src/validator.dart | 21 ++++++++++----- packages/validate/pubspec.yaml | 26 +++++++++++++----- 17 files changed, 113 insertions(+), 68 deletions(-) diff --git a/packages/auth/CHANGELOG.md b/packages/auth/CHANGELOG.md index 9c503c7b..01d9d475 100644 --- a/packages/auth/CHANGELOG.md +++ b/packages/auth/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.1.2 * Fixed `requireAuthentication` to work correctly with null-safety type diff --git a/packages/auth/lib/src/plugin.dart b/packages/auth/lib/src/plugin.dart index 25831f8d..1ff5a4a5 100644 --- a/packages/auth/lib/src/plugin.dart +++ b/packages/auth/lib/src/plugin.dart @@ -107,13 +107,14 @@ class AngelAuth { throw StateError( 'An `AngelAuth` plug-in was called without its `deserializer` being set. All authentication will fail.'); } - */ + if (app.container == null) { _log.severe('Angel3 container is null'); throw StateError( 'Angel.container is null. All authentication will fail.'); } - var appContainer = app.container!; + */ + var appContainer = app.container; appContainer.registerSingleton(this); if (runtimeType != AngelAuth) { diff --git a/packages/auth/pubspec.yaml b/packages/auth/pubspec.yaml index 90e1a582..6359e2f7 100644 --- a/packages/auth/pubspec.yaml +++ b/packages/auth/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_auth description: A complete authentication plugin for Angel3. Includes support for stateless JWT tokens, Basic Auth, and more. -version: 4.1.2 +version: 6.0.0 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/auth environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 charcode: ^1.2.0 collection: ^1.15.0 crypto: ^3.0.0 @@ -15,8 +15,21 @@ dependencies: quiver: ^3.0.0 logging: ^1.0.0 dev_dependencies: - angel3_container: ^3.1.0 + angel3_container: ^6.0.0 http: ^0.13.1 io: ^1.0.0 test: ^1.17.4 lints: ^1.0.0 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request \ No newline at end of file diff --git a/packages/auth/test/callback_test.dart b/packages/auth/test/callback_test.dart index ffdf6a0e..9609fcd1 100644 --- a/packages/auth/test/callback_test.dart +++ b/packages/auth/test/callback_test.dart @@ -50,7 +50,7 @@ void main() { var oldErrorHandler = app.errorHandler; app.errorHandler = (e, req, res) { - app.logger?.severe(e.message, e, e.stackTrace ?? StackTrace.current); + app.logger.severe(e.message, e, e.stackTrace ?? StackTrace.current); return oldErrorHandler(e, req, res); }; diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 95995872..7dba9f1f 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/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.0 * Updated `package:build_runner` diff --git a/packages/client/lib/angel3_client.dart b/packages/client/lib/angel3_client.dart index 8f166c21..853dc903 100644 --- a/packages/client/lib/angel3_client.dart +++ b/packages/client/lib/angel3_client.dart @@ -33,10 +33,6 @@ abstract class Angel extends http.BaseClient { Angel(baseUrl) : baseUrl = baseUrl is Uri ? baseUrl : Uri.parse(baseUrl.toString()); - /// Prefer to use [baseUrl] instead. - @deprecated - String get basePath => baseUrl.toString(); - /// Fired whenever a WebSocket is successfully authenticated. Stream get onAuthenticated; @@ -48,10 +44,7 @@ abstract class Angel extends http.BaseClient { /// /// The given [credentials] are sent to server as-is; the request body is sent as JSON. Future authenticate( - {required String type, - credentials, - String authEndpoint = '/auth', - @deprecated String reviveEndpoint = '/auth/token'}); + {required String type, credentials, String authEndpoint = '/auth'}); /// Shorthand for authenticating via a JWT string. Future reviveJwt(String token, @@ -87,7 +80,7 @@ abstract class Angel extends http.BaseClient { /// You can pass a custom [deserializer], which is typically necessary in cases where /// `dart:mirrors` does not exist. Service service(String path, - {@deprecated Type? type, AngelDeserializer? deserializer}); + {AngelDeserializer? deserializer}); //@override //Future delete(url, {Map headers}); diff --git a/packages/client/lib/auth_types.dart b/packages/client/lib/auth_types.dart index 5b98fe57..afca9abd 100644 --- a/packages/client/lib/auth_types.dart +++ b/packages/client/lib/auth_types.dart @@ -1,4 +1 @@ -@deprecated -library auth_types; - const String local = 'local', token = 'token'; diff --git a/packages/client/lib/base_angel_client.dart b/packages/client/lib/base_angel_client.dart index 30dbb6b3..8eb5bfd7 100644 --- a/packages/client/lib/base_angel_client.dart +++ b/packages/client/lib/base_angel_client.dart @@ -1,6 +1,4 @@ import 'dart:async'; -import 'dart:convert' show Encoding; -import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'dart:convert'; import 'package:http/src/base_client.dart' as http; import 'package:http/src/base_request.dart' as http; @@ -32,14 +30,14 @@ AngelHttpException failure(http.Response response, if (v is Map && (v['is_error'] == true) || v['isError'] == true) { return AngelHttpException.fromMap(v as Map); } else { - return AngelHttpException(error, + return AngelHttpException( message: message ?? 'Unhandled exception while connecting to Angel backend.', statusCode: response.statusCode, stackTrace: stack); } } catch (e, st) { - return AngelHttpException(error ?? e, + return AngelHttpException( message: message ?? 'Angel backend did not return JSON - an error likely occurred.', statusCode: response.statusCode, @@ -63,10 +61,7 @@ abstract class BaseAngelClient extends Angel { @override Future authenticate( - {String? type, - credentials, - String authEndpoint = '/auth', - @deprecated String reviveEndpoint = '/auth/token'}) async { + {String? type, credentials, String authEndpoint = '/auth'}) async { type ??= 'token'; var segments = baseUrl.pathSegments @@ -258,10 +253,6 @@ class BaseAngelService extends Service { BaseAngelService(this.client, this.app, baseUrl, {this.deserializer}) : baseUrl = baseUrl is Uri ? baseUrl : Uri.parse(baseUrl.toString()); - /// Use [baseUrl] instead. - @deprecated - String get basePath => baseUrl.toString(); - Data? deserialize(x) { return deserializer != null ? deserializer!(x) : x as Data?; } @@ -296,12 +287,12 @@ class BaseAngelService extends Service { var v = json.decode(response.body) as List; //var r = v.map(deserialize).toList(); var r = []; - v.forEach((element) { + for (var element in v) { var a = deserialize(element); if (a != null) { r.add(a); } - }); + } _onIndexed.add(r); return r; } catch (e, st) { diff --git a/packages/client/lib/browser.dart b/packages/client/lib/browser.dart index 1ae5336b..941fbbb7 100644 --- a/packages/client/lib/browser.dart +++ b/packages/client/lib/browser.dart @@ -17,10 +17,7 @@ class Rest extends BaseAngelClient { @override Future authenticate( - {String? type, - credentials, - String authEndpoint = '/auth', - @deprecated String reviveEndpoint = '/auth/token'}) async { + {String? type, credentials, String authEndpoint = '/auth'}) async { if (type == null || type == 'token') { if (!window.localStorage.containsKey('token')) { throw Exception( diff --git a/packages/client/pubspec.yaml b/packages/client/pubspec.yaml index 69748ef2..23bb1a83 100644 --- a/packages/client/pubspec.yaml +++ b/packages/client/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_client -version: 4.2.0 +version: 6.0.0 description: A browser, mobile and command line based client that supports querying Angel3 servers homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/client environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_http_exception: ^3.0.0 + angel3_http_exception: ^6.0.0 belatuk_json_serializer: ^5.0.0 collection: ^1.15.0 http: ^0.13.1 @@ -14,13 +14,28 @@ dependencies: path: ^1.8.0 logging: ^1.0.0 dev_dependencies: - angel3_framework: ^4.2.0 - angel3_model: ^3.1.0 - angel3_mock_request: ^2.0.0 - angel3_container: ^3.1.0 - angel3_auth: ^4.1.0 + angel3_framework: ^6.0.0 + angel3_model: ^6.0.0 + angel3_mock_request: ^6.0.0 + angel3_container: ^6.0.0 + angel3_auth: ^6.0.0 async: ^2.6.1 build_runner: ^2.1.2 build_web_compilers: ^3.2.1 test: ^1.17.5 lints: ^1.0.0 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth \ No newline at end of file diff --git a/packages/static/pubspec.yaml b/packages/static/pubspec.yaml index 19cfcba5..9a5c8538 100644 --- a/packages/static/pubspec.yaml +++ b/packages/static/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_static -version: 4.1.0 +version: 6.0.0 description: This library provides a virtual directory to serve static files for Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: angel3_framework: ^4.1.0 belatuk_range_header: ^4.0.0 diff --git a/packages/test/pubspec.yaml b/packages/test/pubspec.yaml index d4c14424..97dcb9f2 100644 --- a/packages/test/pubspec.yaml +++ b/packages/test/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_test -version: 4.1.1 +version: 6.0.0 description: Testing utility library for the Angel3 framework. Use with package:test. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/test environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: angel3_client: ^4.1.0 angel3_framework: ^4.2.0 diff --git a/packages/validate/CHANGELOG.md b/packages/validate/CHANGELOG.md index c7c76137..6a71361f 100644 --- a/packages/validate/CHANGELOG.md +++ b/packages/validate/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.1.0 * Updated linter to `package:lints` diff --git a/packages/validate/lib/src/async.dart b/packages/validate/lib/src/async.dart index b3a12435..043d3e71 100644 --- a/packages/validate/lib/src/async.dart +++ b/packages/validate/lib/src/async.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'package:angel3_framework/angel3_framework.dart'; -import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:matcher/matcher.dart'; import 'context_aware.dart'; diff --git a/packages/validate/lib/src/matchers.dart b/packages/validate/lib/src/matchers.dart index 6870d70b..f69eb19b 100644 --- a/packages/validate/lib/src/matchers.dart +++ b/packages/validate/lib/src/matchers.dart @@ -69,10 +69,6 @@ final Matcher isUrl = predicate( (dynamic value) => value is String && _url.hasMatch(value), 'a valid url, starting with http:// or https://'); -/// Use [isUrl] instead. -@deprecated -final Matcher isurl = isUrl; - /// Enforces a minimum length on a string. Matcher minLength(int length) => predicate( (dynamic value) => value is String && value.length >= length, diff --git a/packages/validate/lib/src/validator.dart b/packages/validate/lib/src/validator.dart index 22532452..37afb723 100644 --- a/packages/validate/lib/src/validator.dart +++ b/packages/validate/lib/src/validator.dart @@ -325,7 +325,9 @@ class Validator extends Matcher { /// Adds all given [rules]. void addRules(String key, Iterable rules) { - rules.forEach((rule) => addRule(key, rule)); + for (var rule in rules) { + addRule(key, rule); + } } /// Removes a [rule]. @@ -337,7 +339,9 @@ class Validator extends Matcher { /// Removes all given [rules]. void removeRules(String key, Iterable rules) { - rules.forEach((rule) => removeRule(key, rule)); + for (var rule in rules) { + removeRule(key, rule); + } } @override @@ -367,11 +371,13 @@ class ValidationResult { /// This is empty if validation was successful. List get errors => List.unmodifiable(_errors); - ValidationResult withData(Map data) => - ValidationResult().._data.addAll(data).._errors.addAll(_errors); + ValidationResult withData(Map data) => ValidationResult() + .._data.addAll(data) + .._errors.addAll(_errors); - ValidationResult withErrors(Iterable errors) => - ValidationResult().._data.addAll(_data).._errors.addAll(errors); + ValidationResult withErrors(Iterable errors) => ValidationResult() + .._data.addAll(_data) + .._errors.addAll(errors); } /// Occurs when user-provided data is invalid. @@ -385,7 +391,8 @@ class ValidationException extends AngelHttpException { final String message; ValidationException(this.message, {Iterable errors = const []}) - : super(FormatException(message), + : super( + message: message, statusCode: 400, errors: (errors).toSet().toList(), stackTrace: StackTrace.current) { diff --git a/packages/validate/pubspec.yaml b/packages/validate/pubspec.yaml index fc250135..3e639f12 100644 --- a/packages/validate/pubspec.yaml +++ b/packages/validate/pubspec.yaml @@ -1,19 +1,31 @@ name: angel3_validate description: Cross-platform request body validation library based on `matcher`. -version: 4.1.0 +version: 6.0.0 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/validate environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_http_exception: ^3.0.0 + angel3_framework: ^6.0.0 + angel3_http_exception: ^6.0.0 matcher: ^0.12.0 dev_dependencies: - #angel3_test: - angel3_mock_request: ^2.0.0 + angel3_mock_request: ^6.0.0 build_runner: ^2.1.0 build_web_compilers: ^3.2.0 logging: ^1.0.1 lints: ^1.0.0 - test: ^1.17.4 \ No newline at end of file + test: ^1.17.4 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request \ No newline at end of file From 49da5f76b10f4d58dd9c36932228672fc9515763 Mon Sep 17 00:00:00 2001 From: thomashii Date: Tue, 22 Feb 2022 08:07:01 +0800 Subject: [PATCH 12/28] Updated websocket,test and static --- packages/static/CHANGELOG.md | 8 +++ .../static/lib/src/virtual_directory.dart | 17 ++++--- packages/static/pubspec.yaml | 27 +++++++++- packages/test/CHANGELOG.md | 8 +++ packages/test/lib/src/client.dart | 6 +-- packages/test/lib/src/matchers.dart | 9 ++-- packages/test/pubspec.yaml | 36 ++++++++++--- packages/websocket/CHANGELOG.md | 8 +++ packages/websocket/example/main.dart | 2 +- packages/websocket/lib/angel3_websocket.dart | 8 +-- .../websocket/lib/base_websocket_client.dart | 11 ++-- packages/websocket/lib/browser.dart | 1 - packages/websocket/lib/constants.dart | 51 ------------------- packages/websocket/lib/hooks.dart | 4 +- packages/websocket/lib/server.dart | 40 +++++++-------- packages/websocket/lib/websocket_context.dart | 6 +-- .../websocket/lib/websocket_controller.dart | 2 +- packages/websocket/pubspec.yaml | 34 +++++++++---- 18 files changed, 152 insertions(+), 126 deletions(-) diff --git a/packages/static/CHANGELOG.md b/packages/static/CHANGELOG.md index c8207f95..11c797a6 100644 --- a/packages/static/CHANGELOG.md +++ b/packages/static/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.1.0 * Updated to use `belatuk_range_header` package diff --git a/packages/static/lib/src/virtual_directory.dart b/packages/static/lib/src/virtual_directory.dart index d2e6477f..0bcda945 100644 --- a/packages/static/lib/src/virtual_directory.dart +++ b/packages/static/lib/src/virtual_directory.dart @@ -265,10 +265,11 @@ class VirtualDirectory { if (!acceptable) { _log.severe('Mime type [$value] is not supported'); throw AngelHttpException( - UnsupportedError( - 'Client requested $value, but server wanted to send $mimeType.'), - statusCode: 406, - message: '406 Not Acceptable'); + //UnsupportedError( + // 'Client requested $value, but server wanted to send $mimeType.'), + errors: [ + 'Client requested $value, but server wanted to send $mimeType.' + ], statusCode: 406, message: '406 Not Acceptable'); } } @@ -320,7 +321,8 @@ class VirtualDirectory { if (invalid) { throw AngelHttpException( - Exception('Semantically invalid, or unbounded range.'), + //Exception('Semantically invalid, or unbounded range.'), + errors: ['Semantically invalid, or unbounded range.'], statusCode: 416, message: 'Semantically invalid, or unbounded range.'); } @@ -328,14 +330,15 @@ class VirtualDirectory { // Ensure it's within range. if (item.start >= totalFileSize || item.end >= totalFileSize) { throw AngelHttpException( - Exception('Given range $item is out of bounds.'), + //Exception('Given range $item is out of bounds.'), + errors: ['Given range $item is out of bounds.'], statusCode: 416, message: 'Given range $item is out of bounds.'); } } if (header.items.isEmpty) { - throw AngelHttpException(null, + throw AngelHttpException( statusCode: 416, message: '`Range` header may not be empty.'); } else if (header.items.length == 1) { var item = header.items[0]; diff --git a/packages/static/pubspec.yaml b/packages/static/pubspec.yaml index 9a5c8538..6963401e 100644 --- a/packages/static/pubspec.yaml +++ b/packages/static/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static environment: sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.1.0 + angel3_framework: ^6.0.0 belatuk_range_header: ^4.0.0 convert: ^3.0.0 crypto: ^3.0.1 @@ -15,9 +15,32 @@ dependencies: path: ^1.8.0 logging: ^1.0.1 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 http: ^0.13.2 matcher: ^0.12.10 lints: ^1.0.0 test: ^1.17.4 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth + angel3_client: + path: ../client + angel3_websocket: + path: ../websocket + angel3_validate: + path: ../validate + angel3_test: + path: ../test diff --git a/packages/test/CHANGELOG.md b/packages/test/CHANGELOG.md index 446f118c..32511c31 100644 --- a/packages/test/CHANGELOG.md +++ b/packages/test/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.1.1 * Fixed NNBD issues diff --git a/packages/test/lib/src/client.dart b/packages/test/lib/src/client.dart index 29bf8e19..e7120fbd 100644 --- a/packages/test/lib/src/client.dart +++ b/packages/test/lib/src/client.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:angel3_client/base_angel_client.dart' as client; -import 'package:angel3_client/io.dart' as client; import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; import 'package:angel3_websocket/io.dart' as client; @@ -57,9 +56,6 @@ class TestClient extends client.BaseAngelClient { /// The server instance to mock. final Angel server; - @override - String? authToken; - late AngelHttp _http; TestClient(this.server, {this.autoDecodeGzip = true, bool useZone = false}) @@ -149,7 +145,7 @@ class TestClient extends client.BaseAngelClient { reasonPhrase: rs.reasonPhrase); } - @override + //@override late String basePath; @override diff --git a/packages/test/lib/src/matchers.dart b/packages/test/lib/src/matchers.dart index 86114b9f..9384f84f 100644 --- a/packages/test/lib/src/matchers.dart +++ b/packages/test/lib/src/matchers.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'dart:io'; import 'package:http/http.dart' as http; -import 'package:matcher/matcher.dart'; import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:angel3_validate/angel3_validate.dart'; @@ -43,7 +42,7 @@ Matcher hasStatus(int status) => _HasStatus(status); Matcher hasValidBody(Validator validator) => _HasValidBody(validator); class _IsJson extends Matcher { - var value; + dynamic value; _IsJson(this.value); @@ -59,7 +58,7 @@ class _IsJson extends Matcher { } class _HasBody extends Matcher { - final body; + final dynamic body; _HasBody(this.body); @@ -83,7 +82,7 @@ class _HasBody extends Matcher { } class _HasContentType extends Matcher { - var contentType; + dynamic contentType; _HasContentType(this.contentType); @@ -116,7 +115,7 @@ class _HasContentType extends Matcher { class _HasHeader extends Matcher { final String key; - final value; + final dynamic value; _HasHeader(this.key, this.value); diff --git a/packages/test/pubspec.yaml b/packages/test/pubspec.yaml index 97dcb9f2..1561afe9 100644 --- a/packages/test/pubspec.yaml +++ b/packages/test/pubspec.yaml @@ -6,17 +6,37 @@ repository: https://github.com/dukefirehawk/angel/tree/master/packages/test environment: sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_client: ^4.1.0 - angel3_framework: ^4.2.0 - angel3_http_exception: ^3.0.0 - angel3_validate: ^4.0.0 - angel3_websocket: ^4.1.0 - angel3_mock_request: ^2.0.0 - angel3_container: ^3.1.0 + angel3_client: ^6.0.0 + angel3_framework: ^6.0.0 + angel3_http_exception: ^6.0.0 + angel3_validate: ^6.0.0 + angel3_websocket: ^6.0.0 + angel3_mock_request: ^6.0.0 + angel3_container: ^6.0.0 http: ^0.13.1 matcher: ^0.12.10 web_socket_channel: ^2.0.0 dev_dependencies: test: ^1.17.5 lints: ^1.0.0 - \ No newline at end of file +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth + angel3_client: + path: ../client + angel3_websocket: + path: ../websocket + angel3_validate: + path: ../validate \ No newline at end of file diff --git a/packages/websocket/CHANGELOG.md b/packages/websocket/CHANGELOG.md index 8e1a2c7e..7b0f06ea 100644 --- a/packages/websocket/CHANGELOG.md +++ b/packages/websocket/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.1.2 * Updated `package:angel3_container` diff --git a/packages/websocket/example/main.dart b/packages/websocket/example/main.dart index 6c9502c6..a3b3f721 100644 --- a/packages/websocket/example/main.dart +++ b/packages/websocket/example/main.dart @@ -38,7 +38,7 @@ void main(List args) async { try { ctx.setAlpnProtocols(['h2'], true); } catch (e, st) { - app.logger!.severe( + app.logger.severe( 'Cannot set ALPN protocol on server to `h2`. The server will only serve HTTP/1.x.', e, st, diff --git a/packages/websocket/lib/angel3_websocket.dart b/packages/websocket/lib/angel3_websocket.dart index 5aa38192..8b0979c0 100644 --- a/packages/websocket/lib/angel3_websocket.dart +++ b/packages/websocket/lib/angel3_websocket.dart @@ -28,16 +28,16 @@ class WebSocketEvent { class WebSocketAction { String? id; String? eventName; - var data; - Map? params; + dynamic data; + Map params; - WebSocketAction({this.id, this.eventName, this.data, this.params}); + WebSocketAction({this.id, this.eventName, this.data, this.params = const {}}); factory WebSocketAction.fromJson(Map data) => WebSocketAction( id: data['id'].toString(), eventName: data['eventName'].toString(), data: data['data'], - params: data['params'] as Map?); + params: data['params'] as Map? ?? {}); Map toJson() { return {'id': id, 'eventName': eventName, 'data': data, 'params': params}; diff --git a/packages/websocket/lib/base_websocket_client.dart b/packages/websocket/lib/base_websocket_client.dart index 6615b934..eb35446d 100644 --- a/packages/websocket/lib/base_websocket_client.dart +++ b/packages/websocket/lib/base_websocket_client.dart @@ -3,7 +3,6 @@ import 'dart:collection'; import 'dart:convert'; import 'package:angel3_client/angel3_client.dart'; import 'package:angel3_client/base_angel_client.dart'; -import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:http/src/base_client.dart' as http; import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_socket_channel/status.dart' as status; @@ -219,7 +218,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient { _socket = null; if (reconnectOnClose == true) { Timer.periodic(reconnectInterval!, (Timer timer) async { - var result; + WebSocketChannel? result; try { result = await connect(timeout: reconnectInterval); @@ -434,10 +433,6 @@ class WebSocketsService extends Service { params: params ?? {})); return null; } - - /// No longer necessary. - @deprecated - Service unwrap() => this; } /// Contains a dynamic Map of [WebSocketEvent] streams. @@ -461,6 +456,8 @@ class WebSocketExtraneousEventHandler { } void _close() { - _events.values.forEach((s) => s.close()); + for (var s in _events.values) { + s.close(); + } } } diff --git a/packages/websocket/lib/browser.dart b/packages/websocket/lib/browser.dart index c79a9561..d69a5129 100644 --- a/packages/websocket/lib/browser.dart +++ b/packages/websocket/lib/browser.dart @@ -4,7 +4,6 @@ library angel3_websocket.browser; import 'dart:async'; import 'dart:html'; import 'package:angel3_client/angel3_client.dart'; -import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:http/browser_client.dart' as http; import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_socket_channel/html.dart'; diff --git a/packages/websocket/lib/constants.dart b/packages/websocket/lib/constants.dart index 7d455468..71d935f6 100644 --- a/packages/websocket/lib/constants.dart +++ b/packages/websocket/lib/constants.dart @@ -6,27 +6,6 @@ const String modifyAction = 'modify'; const String updateAction = 'update'; const String removeAction = 'remove'; -@deprecated -const String ACTION_AUTHENTICATE = authenticateAction; - -@deprecated -const String ACTION_INDEX = indexAction; - -@deprecated -const String ACTION_READ = readAction; - -@deprecated -const String ACTION_CREATE = createAction; - -@deprecated -const String ACTION_MODIFY = modifyAction; - -@deprecated -const String ACTION_UPDATE = updateAction; - -@deprecated -const String ACTION_REMOVE = removeAction; - const String authenticatedEvent = 'authenticated'; const String errorEvent = 'error'; const String indexedEvent = 'indexed'; @@ -36,30 +15,6 @@ const String modifiedEvent = 'modified'; const String updatedEvent = 'updated'; const String removedEvent = 'removed'; -@deprecated -const String EVENT_AUTHENTICATED = authenticatedEvent; - -@deprecated -const String EVENT_ERROR = errorEvent; - -@deprecated -const String EVENT_INDEXED = indexedEvent; - -@deprecated -const String EVENT_READ = readEvent; - -@deprecated -const String EVENT_CREATED = createdEvent; - -@deprecated -const String EVENT_MODIFIED = modifiedEvent; - -@deprecated -const String EVENT_UPDATED = updatedEvent; - -@deprecated -const String EVENT_REMOVED = removedEvent; - /// The standard Angel service actions. const List actions = [ indexAction, @@ -70,9 +25,6 @@ const List actions = [ removeAction ]; -@deprecated -const List ACTIONS = actions; - /// The standard Angel service events. const List events = [ indexedEvent, @@ -82,6 +34,3 @@ const List events = [ updatedEvent, removedEvent ]; - -@deprecated -const List EVENTS = events; diff --git a/packages/websocket/lib/hooks.dart b/packages/websocket/lib/hooks.dart index 0a87f931..61b9c307 100644 --- a/packages/websocket/lib/hooks.dart +++ b/packages/websocket/lib/hooks.dart @@ -6,8 +6,8 @@ import 'package:angel3_framework/angel3_framework.dart'; /// If [provider] is `null`, any provider will be blocked. HookedServiceEventListener doNotBroadcast([provider]) { return (HookedServiceEvent e) { - if (e.params != null && e.params!.containsKey('provider')) { - var eParam = e.params!; + if (e.params.containsKey('provider')) { + var eParam = e.params; var deny = false; var providers = provider is Iterable ? provider : [provider]; diff --git a/packages/websocket/lib/server.dart b/packages/websocket/lib/server.dart index fd293cba..c1cad069 100644 --- a/packages/websocket/lib/server.dart +++ b/packages/websocket/lib/server.dart @@ -10,11 +10,11 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; import 'package:angel3_framework/http2.dart'; import 'package:belatuk_merge_map/belatuk_merge_map.dart'; +import 'package:logging/logging.dart'; import 'package:stream_channel/stream_channel.dart'; import 'package:web_socket_channel/io.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:collection/collection.dart' show IterableExtension; -import 'package:logging/logging.dart'; import 'angel3_websocket.dart'; import 'constants.dart'; export 'angel3_websocket.dart'; @@ -27,8 +27,6 @@ typedef WebSocketResponseSerializer = String Function(dynamic data); /// Broadcasts events from [HookedService]s, and handles incoming [WebSocketAction]s. class AngelWebSocket { - final _log = Logger('AngelWebSocket'); - final List _clients = []; final List _servicesAlreadyWired = []; @@ -65,6 +63,8 @@ class AngelWebSocket { List get servicesAlreadyWired => List.unmodifiable(_servicesAlreadyWired); + Logger get _log => app.logger; + /// Used to notify other nodes of an event's firing. Good for scaled applications. final StreamChannel? synchronizationChannel; @@ -152,7 +152,7 @@ class AngelWebSocket { FutureOr Function(HookedServiceEvent e) serviceHook(String path) { return (HookedServiceEvent e) async { - if (e.params != null && e.params!['broadcast'] == false) return; + if (e.params['broadcast'] == false) return; var event = await transformEvent(e); event.eventName = '$path::${event.eventName}'; @@ -160,8 +160,8 @@ class AngelWebSocket { dynamic _filter(WebSocketContext socket) { if (e.service.configuration.containsKey('ws:filter')) { return e.service.configuration['ws:filter'](e, socket); - } else if (e.params != null && e.params!.containsKey('ws:filter')) { - return e.params?['ws:filter'](e, socket); + } else if (e.params.containsKey('ws:filter')) { + return e.params['ws:filter'](e, socket); } else { return true; } @@ -212,11 +212,11 @@ class AngelWebSocket { var actionName = split[1]; - if (action.params is! Map) action.params = {}; + //if (action.params is! Map) action.params = {}; if (allowClientParams != true) { - if (action.params!['query'] is Map) { - action.params = {'query': action.params!['query']}; + if (action.params['query'] is Map) { + action.params = {'query': action.params['query']}; } else { action.params = {}; } @@ -272,11 +272,11 @@ class AngelWebSocket { Future handleAuth(WebSocketAction action, WebSocketContext socket) async { if (allowAuth != false && action.eventName == authenticateAction && - action.params?['query'] is Map && - action.params?['query']['jwt'] is String) { + action.params['query'] is Map && + action.params['query']['jwt'] is String) { try { var auth = socket.request.container!.make(); - var jwt = action.params!['query']['jwt'] as String; + var jwt = action.params['query']['jwt'] as String; AuthToken token; token = AuthToken.validate(jwt, auth.hmac); @@ -330,7 +330,7 @@ class AngelWebSocket { throw AngelHttpException.badRequest(); } - if (fromJson is Map && fromJson.containsKey('eventName')) { + if (fromJson.containsKey('eventName')) { socket._onAction.add(WebSocketAction.fromJson(fromJson)); socket.on ._getStreamForEvent(fromJson['eventName'].toString())! @@ -361,16 +361,16 @@ class AngelWebSocket { // Send an error if (e is AngelHttpException) { socket.sendError(e); - app.logger?.severe(e.message, e.error ?? e, e.stackTrace); + app.logger.severe(e.message, e.error ?? e, e.stackTrace); } else if (sendErrors) { - var err = AngelHttpException(e, + var err = AngelHttpException( message: e.toString(), stackTrace: st, errors: [st.toString()]); socket.sendError(err); - app.logger?.severe(err.message, e, st); + app.logger.severe(err.message, e, st); } else { - var err = AngelHttpException(e); + var err = AngelHttpException(); socket.sendError(err); - app.logger?.severe(e.toString(), e, st); + app.logger.severe(e.toString(), e, st); } } @@ -391,10 +391,10 @@ class AngelWebSocket { /// Configures an [Angel] instance to listen for WebSocket connections. Future configureServer(Angel app) async { - app.container?.registerSingleton(this); + app.container.registerSingleton(this); if (runtimeType != AngelWebSocket) { - app.container?.registerSingleton(this); + app.container.registerSingleton(this); } // Set up services diff --git a/packages/websocket/lib/websocket_context.dart b/packages/websocket/lib/websocket_context.dart index e3681a91..08f9d96d 100644 --- a/packages/websocket/lib/websocket_context.dart +++ b/packages/websocket/lib/websocket_context.dart @@ -20,7 +20,7 @@ class WebSocketContext { final StreamController _onAuthenticated = StreamController(); - final StreamController _onClose = StreamController(); + final StreamController _onClose = StreamController(); final StreamController _onData = StreamController(); @@ -31,7 +31,7 @@ class WebSocketContext { Stream get onAuthenticated => _onAuthenticated.stream; /// Fired once the underlying [WebSocket] closes. - Stream get onClose => _onClose.stream; + Stream get onClose => _onClose.stream; /// Fired when any data is sent through [channel]. Stream get onData => _onData.stream; @@ -45,7 +45,7 @@ class WebSocketContext { await _onAction.close(); await _onAuthenticated.close(); await _onData.close(); - _onClose.add(null); + //_onClose.add(null); await _onClose.close(); }); } diff --git a/packages/websocket/lib/websocket_controller.dart b/packages/websocket/lib/websocket_controller.dart index 03e23b8b..7c683299 100644 --- a/packages/websocket/lib/websocket_controller.dart +++ b/packages/websocket/lib/websocket_controller.dart @@ -38,7 +38,7 @@ class WebSocketController extends Controller { @override Future configureServer(Angel app) async { - if (findExpose(app.container!.reflector) != null) { + if (findExpose(app.container.reflector) != null) { await super.configureServer(app); } diff --git a/packages/websocket/pubspec.yaml b/packages/websocket/pubspec.yaml index a81c298a..ef87d2f9 100644 --- a/packages/websocket/pubspec.yaml +++ b/packages/websocket/pubspec.yaml @@ -1,15 +1,15 @@ name: angel3_websocket -version: 4.1.2 +version: 6.0.0 description: This library provides WebSockets support for Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/websocket environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_auth: ^4.1.0 - angel3_client: ^4.1.0 - angel3_framework: ^4.2.0 - angel3_http_exception: ^3.0.0 + angel3_auth: ^6.0.0 + angel3_client: ^6.0.0 + angel3_framework: ^6.0.0 + angel3_http_exception: ^6.0.0 belatuk_merge_map: ^3.0.0 http: ^0.13.1 meta: ^1.3.0 @@ -18,8 +18,24 @@ dependencies: collection: ^1.15.0 logging: ^1.0.1 dev_dependencies: - angel3_container: ^3.1.0 - angel3_model: ^3.1.0 + angel3_container: ^6.0.0 + angel3_model: ^6.0.0 test: ^1.17.5 lints: ^1.0.0 - \ No newline at end of file +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth + angel3_client: + path: ../client \ No newline at end of file From 510594d96e455ee88cb4470b8cc798ad39b0973d Mon Sep 17 00:00:00 2001 From: thomashii Date: Tue, 22 Feb 2022 19:41:06 +0800 Subject: [PATCH 13/28] Updated JAEL --- packages/hot/CHANGELOG.md | 8 ++++ packages/hot/lib/angel3_hot.dart | 12 +++--- packages/hot/pubspec.yaml | 30 ++++++++++---- packages/jael/angel_jael/CHANGELOG.md | 8 ++++ packages/jael/angel_jael/pubspec.yaml | 40 +++++++++++++++---- packages/jael/jael/CHANGELOG.md | 4 ++ packages/jael/jael/pubspec.yaml | 4 +- packages/jael/jael_preprocessor/CHANGELOG.md | 4 ++ packages/jael/jael_preprocessor/pubspec.yaml | 12 +++--- packages/jael/jael_web/pubspec.yaml | 17 +++++--- packages/orm/angel_migration/CHANGELOG.md | 8 ++++ packages/orm/angel_migration/pubspec.yaml | 6 +-- .../orm/angel_migration_runner/CHANGELOG.md | 8 ++++ packages/orm/angel_orm/CHANGELOG.md | 8 ++++ packages/orm/angel_orm_generator/CHANGELOG.md | 7 +++- packages/orm/angel_orm_mysql/CHANGELOG.md | 16 ++++++++ packages/orm/angel_orm_postgres/CHANGELOG.md | 12 ++++++ packages/orm/angel_orm_service/CHANGELOG.md | 16 ++++++++ packages/orm/angel_orm_test/CHANGELOG.md | 12 ++++++ 19 files changed, 193 insertions(+), 39 deletions(-) diff --git a/packages/hot/CHANGELOG.md b/packages/hot/CHANGELOG.md index 5cb2231c..3e9474fd 100644 --- a/packages/hot/CHANGELOG.md +++ b/packages/hot/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.3.0 * Updated to use `vm_service` 8.1.0 diff --git a/packages/hot/lib/angel3_hot.dart b/packages/hot/lib/angel3_hot.dart index 424c8980..9e53fa70 100644 --- a/packages/hot/lib/angel3_hot.dart +++ b/packages/hot/lib/angel3_hot.dart @@ -11,7 +11,6 @@ import 'package:charcode/ascii.dart'; import 'package:glob/glob.dart'; import 'package:glob/list_local_fs.dart'; import 'package:belatuk_html_builder/elements.dart'; -import 'package:belatuk_html_builder/belatuk_html_builder.dart'; import 'package:io/ansi.dart'; import 'package:path/path.dart' as p; import 'package:vm_service/vm_service.dart' as vm; @@ -140,7 +139,7 @@ class HotReloader { void _logWarning(String msg) { if (_server?.app.logger != null) { - _server?.app.logger?.warning(msg); + _server?.app.logger.warning(msg); } else { print(yellow.wrap('WARNING: $msg')); } @@ -148,7 +147,7 @@ class HotReloader { void _logInfo(String msg) { if (_server?.app.logger != null) { - _server?.app.logger?.info(msg); + _server?.app.logger.info(msg); } else { print(lightGray.wrap(msg)); } @@ -188,7 +187,8 @@ class HotReloader { if (_vmachine != null) { for (var isolate in _vmachine!.isolates ?? []) { if (isolate.id != null) { - await _client.setExceptionPauseMode(isolate.id!, 'None'); + await _client.setIsolatePauseMode(isolate.id!, + exceptionPauseMode: 'None'); } } } @@ -359,7 +359,7 @@ class HotReloader { scheduleMicrotask(() async { // Disconnect active WebSockets try { - var ws = _server!.app.container!.make(); + var ws = _server!.app.container.make(); for (var client in ws.clients) { try { @@ -373,7 +373,7 @@ class HotReloader { // await Future.forEach( // _server.app.shutdownHooks, _server.app.configure); await _server!.app.close(); - _server!.app.logger?.clearListeners(); + _server!.app.logger.clearListeners(); } catch (_) { // Fail silently... } diff --git a/packages/hot/pubspec.yaml b/packages/hot/pubspec.yaml index 583407d2..56c10457 100644 --- a/packages/hot/pubspec.yaml +++ b/packages/hot/pubspec.yaml @@ -1,13 +1,13 @@ name: angel3_hot -version: 4.3.0 +version: 6.0.0 description: Supports hot reloading/hot code push of Angel3 servers on file changes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/hot environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_websocket: ^4.1.0 + angel3_framework: ^6.0.0 + angel3_websocket: ^6.0.0 belatuk_html_builder: ^3.0.0 charcode: ^1.2.0 glob: ^2.0.1 @@ -19,7 +19,23 @@ dev_dependencies: http: ^0.13.2 logging: ^1.0.1 lints: ^1.0.0 -#dependency_overrides: -# angel3_websocket: -# path: ../websocket +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth + angel3_client: + path: ../client + angel3_websocket: + path: ../websocket \ No newline at end of file diff --git a/packages/jael/angel_jael/CHANGELOG.md b/packages/jael/angel_jael/CHANGELOG.md index 1dd58f1e..c3efe449 100644 --- a/packages/jael/angel_jael/CHANGELOG.md +++ b/packages/jael/angel_jael/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.3.1 * Removed debug message diff --git a/packages/jael/angel_jael/pubspec.yaml b/packages/jael/angel_jael/pubspec.yaml index 4d99640e..15dfeded 100644 --- a/packages/jael/angel_jael/pubspec.yaml +++ b/packages/jael/angel_jael/pubspec.yaml @@ -1,21 +1,47 @@ name: angel3_jael -version: 4.3.1 +version: 6.0.0 description: Angel support for the Jael templating engine, similar to Blade or Liquid. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/angel_jael environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 + jael3: ^5.0.0 + jael3_preprocessor: ^5.0.0 belatuk_code_buffer: ^3.0.0 belatuk_symbol_table: ^3.0.0 - jael3: ^4.2.0 - jael3_preprocessor: ^4.2.0 file: ^6.0.0 logging: ^1.0.1 - dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 html: ^0.15.0 test: ^1.17.3 - lints: ^1.0.0 \ No newline at end of file + lints: ^1.0.0 +dependency_overrides: + angel3_container: + path: ../../container/angel_container + angel3_framework: + path: ../../framework + angel3_http_exception: + path: ../../http_exception + angel3_model: + path: ../../model + angel3_route: + path: ../../route + angel3_mock_request: + path: ../../mock_request + angel3_auth: + path: ../../auth + angel3_client: + path: ../../client + angel3_websocket: + path: ../../websocket + angel3_validate: + path: ../../validate + angel3_test: + path: ../../test + jael3: + path: ../jael + jael3_preprocessor: + path: ../jael_preprocessor diff --git a/packages/jael/jael/CHANGELOG.md b/packages/jael/jael/CHANGELOG.md index 1394492a..ad74a60e 100644 --- a/packages/jael/jael/CHANGELOG.md +++ b/packages/jael/jael/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 5.0.0 + +* Updated to min SDK 2.15.x + ## 4.2.0 * Updated to use `package:belatuk_code_buffer` diff --git a/packages/jael/jael/pubspec.yaml b/packages/jael/jael/pubspec.yaml index fafb7e8f..ddcb28e1 100644 --- a/packages/jael/jael/pubspec.yaml +++ b/packages/jael/jael/pubspec.yaml @@ -1,10 +1,10 @@ name: jael3 -version: 4.2.1 +version: 5.0.0 description: A simple server-side HTML templating engine for Dart. Comparable to Blade or Liquid. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/jael environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: args: ^2.0.0 charcode: ^1.0.0 diff --git a/packages/jael/jael_preprocessor/CHANGELOG.md b/packages/jael/jael_preprocessor/CHANGELOG.md index 8d851bec..51c0b20a 100644 --- a/packages/jael/jael_preprocessor/CHANGELOG.md +++ b/packages/jael/jael_preprocessor/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 5.0.0 + +* Updated to min SDK 2.15.x + ## 4.2.0 * Updated to use `package:belatuk_code_buffer` diff --git a/packages/jael/jael_preprocessor/pubspec.yaml b/packages/jael/jael_preprocessor/pubspec.yaml index 5466300d..8e26c38a 100644 --- a/packages/jael/jael_preprocessor/pubspec.yaml +++ b/packages/jael/jael_preprocessor/pubspec.yaml @@ -1,19 +1,19 @@ name: jael3_preprocessor -version: 4.2.0 +version: 5.0.0 description: A pre-processor for resolving blocks and includes within Jael templates. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/jael_preprocessor environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: file: ^6.1.0 - jael3: ^4.2.0 + jael3: ^6.0.0 belatuk_symbol_table: ^3.0.0 collection: ^1.15.0 dev_dependencies: belatuk_code_buffer: ^3.0.0 test: ^1.17.4 lints: ^1.0.0 -#dependency_overrides: -# jael3: -# path: ../jael +dependency_overrides: + jael3: + path: ../jael diff --git a/packages/jael/jael_web/pubspec.yaml b/packages/jael/jael_web/pubspec.yaml index dd02801f..ba068836 100644 --- a/packages/jael/jael_web/pubspec.yaml +++ b/packages/jael/jael_web/pubspec.yaml @@ -1,17 +1,22 @@ name: jael3_web -version: 1.0.0 -description: Experimental virtual DOM/SPA engine built on Jael. Supports SSR. +version: 2.0.0 +description: Experimental virtual DOM/SPA engine built on Jael3. Supports SSR. publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: build: ^2.0.2 build_config: ^1.0.0 code_builder: ^4.0.0 - jael3: ^4.2.0 - jael3_preprocessor: ^4.2.0 + jael3: ^5.0.0 + jael3_preprocessor: ^5.0.0 source_gen: ^1.0.2 dev_dependencies: build_runner: ^2.0.4 build_web_compilers: ^3.0.0 - lints: ^1.0.0 \ No newline at end of file + lints: ^1.0.0 +dependency_overrides: + jael3: + path: ../jael + jael3_preprocessor: + path: ../jael_preprocessor diff --git a/packages/orm/angel_migration/CHANGELOG.md b/packages/orm/angel_migration/CHANGELOG.md index b1005bb5..59a23b12 100755 --- a/packages/orm/angel_migration/CHANGELOG.md +++ b/packages/orm/angel_migration/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.0.4 * Updated README diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index 69fe4f0b..60b17d1e 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_migration -version: 4.1.0 +version: 6.0.0 description: Database migration runtime for Angel3 ORM. Use this package to define schemas. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_orm: ^4.1.0 + angel3_orm: ^6.0.0 dev_dependencies: lints: ^1.0.0 dependency_overrides: diff --git a/packages/orm/angel_migration_runner/CHANGELOG.md b/packages/orm/angel_migration_runner/CHANGELOG.md index 39cbd741..bef452ea 100755 --- a/packages/orm/angel_migration_runner/CHANGELOG.md +++ b/packages/orm/angel_migration_runner/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.1.2 * Updated README diff --git a/packages/orm/angel_orm/CHANGELOG.md b/packages/orm/angel_orm/CHANGELOG.md index f8d60f70..e8f1fea1 100644 --- a/packages/orm/angel_orm/CHANGELOG.md +++ b/packages/orm/angel_orm/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.1.0 * Added `MySQLDialect` to handle MySQL database specific features diff --git a/packages/orm/angel_orm_generator/CHANGELOG.md b/packages/orm/angel_orm_generator/CHANGELOG.md index 3eb98587..675fd0ec 100644 --- a/packages/orm/angel_orm_generator/CHANGELOG.md +++ b/packages/orm/angel_orm_generator/CHANGELOG.md @@ -1,9 +1,12 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + ## 5.0.0 -* Updated `analyzer` to version 3.x -* Updated min SDK to 2.14.x +* No release. Skipped ## 4.3.0 diff --git a/packages/orm/angel_orm_mysql/CHANGELOG.md b/packages/orm/angel_orm_mysql/CHANGELOG.md index d442b785..13305a1a 100644 --- a/packages/orm/angel_orm_mysql/CHANGELOG.md +++ b/packages/orm/angel_orm_mysql/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.0.0-beta.3 * Updated linter to `package:lints` diff --git a/packages/orm/angel_orm_postgres/CHANGELOG.md b/packages/orm/angel_orm_postgres/CHANGELOG.md index a2b11bcf..68c9d060 100644 --- a/packages/orm/angel_orm_postgres/CHANGELOG.md +++ b/packages/orm/angel_orm_postgres/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.3.0 * Updated test cases diff --git a/packages/orm/angel_orm_service/CHANGELOG.md b/packages/orm/angel_orm_service/CHANGELOG.md index fa5fee7a..b78f2d65 100644 --- a/packages/orm/angel_orm_service/CHANGELOG.md +++ b/packages/orm/angel_orm_service/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.0.1 * Updated linter to `package:lints` diff --git a/packages/orm/angel_orm_test/CHANGELOG.md b/packages/orm/angel_orm_test/CHANGELOG.md index 1128bade..95a5e8af 100644 --- a/packages/orm/angel_orm_test/CHANGELOG.md +++ b/packages/orm/angel_orm_test/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.2 * Added multiple `orderBy` test case From e409e195637014f54ddc987198450a0d8b1fac51 Mon Sep 17 00:00:00 2001 From: thomashii Date: Thu, 24 Feb 2022 08:32:54 +0800 Subject: [PATCH 14/28] Updated cors and configuration --- packages/cli/README.md | 3 --- packages/configuration/CHANGELOG.md | 8 ++++++++ packages/configuration/README.md | 2 +- packages/configuration/pubspec.yaml | 22 ++++++++++++++++------ packages/cors/CHANGELOG.md | 8 ++++++++ packages/cors/pubspec.yaml | 29 ++++++++++++++++++++++++++--- 6 files changed, 59 insertions(+), 13 deletions(-) delete mode 100644 packages/cli/README.md diff --git a/packages/cli/README.md b/packages/cli/README.md deleted file mode 100644 index 1f112426..00000000 --- a/packages/cli/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Angel3 CLI - -Moved to [`Angel3 CLI Repository`](https://github.com/dukefirehawk/angel3-cli) diff --git a/packages/configuration/CHANGELOG.md b/packages/configuration/CHANGELOG.md index 7dd61067..53c98f03 100644 --- a/packages/configuration/CHANGELOG.md +++ b/packages/configuration/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.1.0 * Updated to use `package:belatuk_merge_map` diff --git a/packages/configuration/README.md b/packages/configuration/README.md index e6691452..18c42b68 100644 --- a/packages/configuration/README.md +++ b/packages/configuration/README.md @@ -21,7 +21,7 @@ In `pubspec.yaml`: ```yaml dependencies: - angel3_configuration: ^3.0.0 + angel3_configuration: ^6.0.0 ``` ## Usage diff --git a/packages/configuration/pubspec.yaml b/packages/configuration/pubspec.yaml index 464d6f74..c92f2ac9 100644 --- a/packages/configuration/pubspec.yaml +++ b/packages/configuration/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_configuration -version: 4.1.0 +version: 6.0.0 description: Automatic YAML application configuration loader for Angel 3, with .env support. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/configuration environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 belatuk_merge_map: ^3.0.0 dotenv: ^3.0.0 file: ^6.1.0 @@ -17,6 +17,16 @@ dev_dependencies: lints: ^1.0.0 belatuk_pretty_logging: ^4.0.0 test: ^1.17.5 -#dependency_overrides: -# angel3_framework: -# path: ../framework \ No newline at end of file +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request \ No newline at end of file diff --git a/packages/cors/CHANGELOG.md b/packages/cors/CHANGELOG.md index fc4ac49e..734293a0 100644 --- a/packages/cors/CHANGELOG.md +++ b/packages/cors/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.1.0 * Upgraded to `lints` linter diff --git a/packages/cors/pubspec.yaml b/packages/cors/pubspec.yaml index 051266f0..4a9de265 100644 --- a/packages/cors/pubspec.yaml +++ b/packages/cors/pubspec.yaml @@ -1,14 +1,37 @@ name: angel3_cors -version: 4.1.0 +version: 6.0.0 description: Angel3 CORS middleware. Ported from expressjs/cors to Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/cors environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 http: ^0.13.3 lints: ^1.0.0 test: ^1.17.5 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request + angel3_auth: + path: ../auth + angel3_client: + path: ../client + angel3_websocket: + path: ../websocket + angel3_validate: + path: ../validate + angel3_test: + path: ../test From 4466926d31591416d6aaa97682ab2a016469b509 Mon Sep 17 00:00:00 2001 From: thomashii Date: Thu, 24 Feb 2022 08:34:51 +0800 Subject: [PATCH 15/28] Updated ORM --- packages/orm/angel_migration/pubspec.yaml | 2 +- .../orm/angel_migration_runner/pubspec.yaml | 8 ++-- packages/orm/angel_orm/pubspec.yaml | 19 +++++--- packages/orm/angel_orm_generator/pubspec.yaml | 34 +++++++++---- packages/orm/angel_orm_mysql/CHANGELOG.md | 8 +++- packages/orm/angel_orm_mysql/pubspec.yaml | 15 ++++-- packages/orm/angel_orm_postgres/pubspec.yaml | 12 +++-- .../orm/angel_orm_service/example/main.dart | 2 +- packages/orm/angel_orm_service/pubspec.yaml | 48 +++++++++++++++---- packages/orm/angel_orm_test/pubspec.yaml | 42 ++++++++++------ 10 files changed, 135 insertions(+), 55 deletions(-) diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index 60b17d1e..ba7682e2 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -11,4 +11,4 @@ dev_dependencies: lints: ^1.0.0 dependency_overrides: angel3_orm: - path: ../angel_orm \ No newline at end of file + path: ../angel_orm diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index 3a24cbee..00757bc1 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,13 +1,13 @@ name: angel3_migration_runner -version: 4.1.2 +version: 6.0.0 description: Command-line based database migration runner for Angel3's ORM. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_migration: ^4.1.0 - angel3_orm: ^4.1.0 + angel3_migration: ^6.0.0 + angel3_orm: ^6.0.0 args: ^2.1.0 charcode: ^1.2.0 postgres: ^2.4.0 diff --git a/packages/orm/angel_orm/pubspec.yaml b/packages/orm/angel_orm/pubspec.yaml index 860f8b12..dfd4c626 100644 --- a/packages/orm/angel_orm/pubspec.yaml +++ b/packages/orm/angel_orm/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_orm -version: 4.1.0 +version: 6.0.0 description: Runtime support for Angel3 ORM. Includes base classes for queries. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: charcode: ^1.2.0 intl: ^0.17.0 @@ -13,9 +13,16 @@ dependencies: optional: ^6.0.0 logging: ^1.0.0 dev_dependencies: - angel3_model: ^3.0.0 - angel3_serialize: ^4.1.0 - angel3_serialize_generator: ^4.1.0 + angel3_model: ^6.0.0 + angel3_serialize: ^6.0.0 + angel3_serialize_generator: ^6.0.0 build_runner: ^2.1.1 test: ^1.17.4 - lints: ^1.0.0 \ No newline at end of file + lints: ^1.0.0 +dependency_overrides: + angel3_serialize: + path: ../../serialize/angel_serialize + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator + angel3_model: + path: ../../model \ No newline at end of file diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index 84914431..ee8f73a3 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -1,16 +1,16 @@ name: angel3_orm_generator -version: 5.0.0 +version: 6.0.0 description: Code generators for Angel3 ORM. Generates query builder classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: + angel3_model: ^6.0.0 + angel3_serialize: ^6.0.0 + angel3_orm: ^6.0.0 + angel3_serialize_generator: ^6.0.0 analyzer: ^3.0.0 - angel3_model: ^3.0.0 - angel3_serialize: ^4.0.0 - angel3_orm: ^4.1.0 - angel3_serialize_generator: ^5.0.0 inflection3: ^0.5.3+1 build: ^2.0.1 build_config: ^1.0.0 @@ -24,17 +24,31 @@ dependencies: logging: ^1.0.0 optional: ^6.0.0 dev_dependencies: - angel3_framework: ^4.2.0 - angel3_migration: ^4.1.0 + angel3_framework: ^6.0.0 + angel3_migration: ^6.0.0 build_runner: ^2.0.1 postgres: ^2.4.0 test: ^1.17.3 lints: ^1.0.0 dependency_overrides: + angel3_container: + path: ../../container/angel_container + angel3_framework: + path: ../../framework + angel3_http_exception: + path: ../../http_exception + angel3_model: + path: ../../model + angel3_route: + path: ../../route + angel3_mock_request: + path: ../../mock_request + angel3_serialize: + path: ../../serialize/angel_serialize + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator angel3_orm: path: ../angel_orm angel3_migration: path: ../angel_migration - angel3_serialize_generator: - path: ../../serialize/angel_serialize_generator \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/CHANGELOG.md b/packages/orm/angel_orm_mysql/CHANGELOG.md index 13305a1a..9402e700 100644 --- a/packages/orm/angel_orm_mysql/CHANGELOG.md +++ b/packages/orm/angel_orm_mysql/CHANGELOG.md @@ -1,8 +1,10 @@ # Change Log -## 6.0.0 +## 6.0.0-beta.1 * Updated to min SDK 2.15.x +* Upgrade to use `mysql1` driver +* Added support for MariaDB 10.2.x ## 5.0.0 @@ -16,6 +18,10 @@ * No release. Skipped +## 2.0.0 + +* No release. Skipped + ## 2.0.0-beta.3 * Updated linter to `package:lints` diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index 49abe095..28a6a889 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -1,22 +1,29 @@ name: angel3_orm_mysql -version: 2.0.0-beta.3 +version: 6.0.0-beta.1 description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_orm: ^4.1.0 + angel3_orm: ^6.0.0 logging: ^1.0.0 mysql1: ^0.19.0 optional: ^6.0.0 dev_dependencies: - angel3_orm_test: ^3.0.0 + angel3_orm_test: ^6.0.0 test: ^1.17.0 lints: ^1.0.0 dependency_overrides: + angel3_serialize: + path: ../../serialize/angel_serialize + angel3_model: + path: ../../model angel3_orm_test: path: ../angel_orm_test angel3_orm: path: ../angel_orm + angel3_migration: + path: ../angel_migration + diff --git a/packages/orm/angel_orm_postgres/pubspec.yaml b/packages/orm/angel_orm_postgres/pubspec.yaml index 8a17103b..2489f8cc 100644 --- a/packages/orm/angel_orm_postgres/pubspec.yaml +++ b/packages/orm/angel_orm_postgres/pubspec.yaml @@ -1,22 +1,26 @@ name: angel3_orm_postgres -version: 3.3.0 +version: 6.0.0 description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_orm: ^4.1.0 + angel3_orm: ^6.0.0 logging: ^1.0.1 pool: ^1.5.0 postgres: ^2.4.1 postgres_pool: ^2.1.3 dev_dependencies: belatuk_pretty_logging: ^4.0.0 - angel3_orm_test: ^3.1.0 + angel3_orm_test: ^6.0.0 test: ^1.17.5 lints: ^1.0.0 dependency_overrides: + angel3_serialize: + path: ../../serialize/angel_serialize + angel3_model: + path: ../../model angel3_orm_test: path: ../angel_orm_test angel3_orm: diff --git a/packages/orm/angel_orm_service/example/main.dart b/packages/orm/angel_orm_service/example/main.dart index 1def5eed..548007b0 100644 --- a/packages/orm/angel_orm_service/example/main.dart +++ b/packages/orm/angel_orm_service/example/main.dart @@ -11,7 +11,7 @@ void main() async { var app = Angel(logger: Logger.detached('orm_service')); var http = AngelHttp(app); var executor = await connect(); - app.logger!.onRecord.listen((rec) { + app.logger.onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); if (rec.stackTrace != null) print(rec.stackTrace); diff --git a/packages/orm/angel_orm_service/pubspec.yaml b/packages/orm/angel_orm_service/pubspec.yaml index 7d230317..146be94e 100644 --- a/packages/orm/angel_orm_service/pubspec.yaml +++ b/packages/orm/angel_orm_service/pubspec.yaml @@ -1,24 +1,52 @@ name: angel3_orm_service -version: 2.0.1 +version: 6.0.0 description: Service implementation that wraps over Angel3 ORM Query classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_service environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_orm: ^4.0.0 + angel3_framework: ^6.0.0 + angel3_orm: ^6.0.0 postgres: ^2.4.0 optional: ^6.0.0 dev_dependencies: - angel3_migration: ^4.0.0 - angel3_migration_runner: ^4.0.0 - angel3_orm_generator: ^4.0.0 - angel3_orm_postgres: ^3.0.0 - angel3_serialize: ^4.0.0 + angel3_migration: ^6.0.0 + angel3_migration_runner: ^6.0.0 + angel3_orm_generator: ^6.0.0 + angel3_orm_postgres: ^6.0.0 + angel3_serialize: ^6.0.0 #angel3_orm_test: ^3.0.0 build_runner: ^2.0.4 logging: ^1.0.1 test: ^1.17.7 lints: ^1.0.0 - +dependency_overrides: + angel3_container: + path: ../../container/angel_container + angel3_framework: + path: ../../framework + angel3_http_exception: + path: ../../http_exception + angel3_model: + path: ../../model + angel3_route: + path: ../../route + angel3_mock_request: + path: ../../mock_request + angel3_serialize: + path: ../../serialize/angel_serialize + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator + angel3_orm_test: + path: ../angel_orm_test + angel3_orm: + path: ../angel_orm + angel3_orm_generator: + path: ../angel_orm_generator + angel3_orm_postgres: + path: ../angel_orm_postgres + angel3_migration: + path: ../angel_migration + angel3_migration_runner: + path: ../angel_migration_runner diff --git a/packages/orm/angel_orm_test/pubspec.yaml b/packages/orm/angel_orm_test/pubspec.yaml index 215180de..a2dadc70 100644 --- a/packages/orm/angel_orm_test/pubspec.yaml +++ b/packages/orm/angel_orm_test/pubspec.yaml @@ -1,30 +1,44 @@ name: angel3_orm_test -version: 4.0.0 +version: 6.0.0 description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_test environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_migration: ^4.1.0 - angel3_model: ^3.1.0 - angel3_orm: ^4.0.0 - angel3_serialize: ^4.1.0 + angel3_migration: ^6.0.0 + angel3_model: ^6.0.0 + angel3_orm: ^6.0.0 + angel3_serialize: ^6.0.0 io: ^1.0.0 test: ^1.17.4 collection: ^1.15.0 optional: ^6.0.0 dev_dependencies: - angel3_orm_generator: ^5.0.0 - angel3_framework: ^4.2.0 + angel3_orm_generator: ^6.0.0 + angel3_framework: ^6.0.0 build_runner: ^2.0.1 lints: ^1.0.0 dependency_overrides: - angel3_orm: - path: ../angel_orm - angel3_orm_generator: - path: ../angel_orm_generator - angel3_migration: - path: ../angel_migration + angel3_container: + path: ../../container/angel_container + angel3_framework: + path: ../../framework + angel3_http_exception: + path: ../../http_exception + angel3_model: + path: ../../model + angel3_route: + path: ../../route + angel3_mock_request: + path: ../../mock_request + angel3_serialize: + path: ../../serialize/angel_serialize angel3_serialize_generator: path: ../../serialize/angel_serialize_generator + angel3_orm: + path: ../angel_orm + angel3_migration: + path: ../angel_migration + angel3_orm_generator: + path: ../angel_orm_generator From f0255b3cd63831234bd79ce95f6f0de1bd1e7465 Mon Sep 17 00:00:00 2001 From: thomashii Date: Thu, 24 Feb 2022 08:36:51 +0800 Subject: [PATCH 16/28] Updated configuration --- packages/configuration/lib/angel3_configuration.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/configuration/lib/angel3_configuration.dart b/packages/configuration/lib/angel3_configuration.dart index 079239f7..0c65981e 100644 --- a/packages/configuration/lib/angel3_configuration.dart +++ b/packages/configuration/lib/angel3_configuration.dart @@ -135,9 +135,7 @@ AngelConfigurer configuration(FileSystem fileSystem, directoryPath: directoryPath, overrideEnvironmentName: overrideEnvironmentName, envPath: envPath, - onWarning: app.logger == null - ? null - : (msg) => app.logger?.warning('WARNING: $msg'), + onWarning: (msg) => app.logger.warning('WARNING: $msg'), ); app.configuration.addAll(mergeMap( [ From f5c2598cbd19815e3050566728222cca59e89517 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 27 Feb 2022 09:19:15 +0800 Subject: [PATCH 17/28] Updated cors, mongo --- packages/cors/pubspec.yaml | 2 +- packages/mongo/CHANGELOG.md | 12 ++++++++++++ packages/mongo/README.md | 2 +- packages/mongo/lib/model.dart | 14 -------------- packages/mongo/lib/mongo_service.dart | 20 ++++++++------------ packages/mongo/lib/services.dart | 4 ++-- packages/mongo/pubspec.yaml | 26 +++++++++++++++++--------- packages/mongo/test/generic_test.dart | 2 +- 8 files changed, 42 insertions(+), 40 deletions(-) delete mode 100644 packages/mongo/lib/model.dart diff --git a/packages/cors/pubspec.yaml b/packages/cors/pubspec.yaml index 4a9de265..b4ede600 100644 --- a/packages/cors/pubspec.yaml +++ b/packages/cors/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel3 CORS middleware. Ported from expressjs/cors to Angel3 framew homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/cors environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 dev_dependencies: diff --git a/packages/mongo/CHANGELOG.md b/packages/mongo/CHANGELOG.md index cf463b2b..6dbc0d94 100644 --- a/packages/mongo/CHANGELOG.md +++ b/packages/mongo/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.0 * Updated to use `package:belatuk_merge_map` diff --git a/packages/mongo/README.md b/packages/mongo/README.md index 20f2ec84..90f10de9 100644 --- a/packages/mongo/README.md +++ b/packages/mongo/README.md @@ -13,7 +13,7 @@ Add the following to your `pubspec.yaml`: ```yaml dependencies: - angel3_mongo: ^3.1.0 + angel3_mongo: ^6.0.0 ``` ## Usage diff --git a/packages/mongo/lib/model.dart b/packages/mongo/lib/model.dart deleted file mode 100644 index 4891925d..00000000 --- a/packages/mongo/lib/model.dart +++ /dev/null @@ -1,14 +0,0 @@ -library angel3_mongo.model; - -/// Use the `Model` class defined in `package:angel_framework/common.dart` instead. -@deprecated -class Model { - /// This instance's ID. - String? id; - - /// The time at which this instance was created. - DateTime? createdAt; - - /// The time at which this instance was last updated. - DateTime? updatedAt; -} diff --git a/packages/mongo/lib/mongo_service.dart b/packages/mongo/lib/mongo_service.dart index 0a57adb3..acb1a469 100644 --- a/packages/mongo/lib/mongo_service.dart +++ b/packages/mongo/lib/mongo_service.dart @@ -12,12 +12,8 @@ class MongoService extends Service> { /// If set to `true`, parameters in `req.query` are applied to the database query. final bool allowQuery; - /// No longer used. Will be removed by `2.1.0`. - @deprecated - final bool debug; - MongoService(this.collection, - {this.allowRemoveAll = false, this.allowQuery = true, this.debug = true}) + {this.allowRemoveAll = false, this.allowQuery = true}) : super(); SelectorBuilder? _makeQuery([Map? params_]) { @@ -58,7 +54,7 @@ class MongoService extends Service> { query?.forEach((key, v) { var value = v is Map ? _filterNoQuery(v) : v; - if (!_NO_QUERY.contains(key) && + if (!_noQuery.contains(key) && value is! RequestContext && value is! ResponseContext) { result = result.and(where.eq(key as String, value)); @@ -94,7 +90,7 @@ class MongoService extends Service> { .toList(); } - static const String _NONCE_KEY = '__angel__mongo__nonce__key__'; + static const String _nonceKey = '__angel__mongo__nonce__key__'; @override Future> create(Map data, @@ -104,13 +100,13 @@ class MongoService extends Service> { try { var nonce = (await collection.db.getNonce())['nonce'] as String?; var result = await (collection.findAndModify( - query: where.eq(_NONCE_KEY, nonce), + query: where.eq(_nonceKey, nonce), update: item, returnNew: true, upsert: true) as FutureOr>); return _jsonify(result); } catch (e, st) { - throw AngelHttpException(e, stackTrace: st); + throw AngelHttpException(stackTrace: st); } } @@ -179,7 +175,7 @@ class MongoService extends Service> { return result; } catch (e, st) { //printDebug(e, st, 'MODIFY'); - throw AngelHttpException(e, stackTrace: st); + throw AngelHttpException(stackTrace: st); } } @@ -207,7 +203,7 @@ class MongoService extends Service> { return result; } catch (e, st) { //printDebug(e, st, 'UPDATE'); - throw AngelHttpException(e, stackTrace: st); + throw AngelHttpException(stackTrace: st); } } @@ -235,7 +231,7 @@ class MongoService extends Service> { return _jsonify(result); } catch (e, st) { //printDebug(e, st, 'REMOVE'); - throw AngelHttpException(e, stackTrace: st); + throw AngelHttpException(stackTrace: st); } } } diff --git a/packages/mongo/lib/services.dart b/packages/mongo/lib/services.dart index 6b02e55f..4e84194e 100644 --- a/packages/mongo/lib/services.dart +++ b/packages/mongo/lib/services.dart @@ -37,13 +37,13 @@ Map _removeSensitive(Map data) { .fold({}, (map, key) => map..[key] = data[key]); } -const List _NO_QUERY = ['__requestctx', '__responsectx']; +const List _noQuery = ['__requestctx', '__responsectx']; Map _filterNoQuery(Map data) { return data.keys.fold({}, (map, key) { var value = data[key]; - if (_NO_QUERY.contains(key) || + if (_noQuery.contains(key) || value is RequestContext || value is ResponseContext) return map; if (key is! Map) return map..[key] = value; diff --git a/packages/mongo/pubspec.yaml b/packages/mongo/pubspec.yaml index c3c30f8c..a6f62e78 100644 --- a/packages/mongo/pubspec.yaml +++ b/packages/mongo/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_mongo -version: 3.1.0 -description: MongoDB-enabled services for the Angel framework. Well-tested. +version: 6.0.0 +description: MongoDB-enabled services for the Angel3 framework. Well-tested. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/mongo environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 belatuk_json_serializer: ^5.0.0 belatuk_merge_map: ^3.0.0 mongo_dart: ^0.7.0 @@ -14,8 +14,16 @@ dev_dependencies: http: ^0.13.0 test: ^1.17.5 lints: ^1.0.0 -#dependency_overrides: -# angel3_framework: -# path: ../framework -# angel3_route: -# path: ../route \ No newline at end of file +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_http_exception: + path: ../http_exception + angel3_model: + path: ../model + angel3_route: + path: ../route + angel3_mock_request: + path: ../mock_request \ No newline at end of file diff --git a/packages/mongo/test/generic_test.dart b/packages/mongo/test/generic_test.dart index 4c1bd80a..7b0005b5 100644 --- a/packages/mongo/test/generic_test.dart +++ b/packages/mongo/test/generic_test.dart @@ -39,7 +39,7 @@ void main() { // Delete anything before we start await testData.remove({}); - var service = MongoService(testData, debug: true); + var service = MongoService(testData); greetingService = HookedService(service); wireHooked(greetingService!); From 0dc71df45adbaee632aa26e68decbeb4f21bcd65 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 27 Feb 2022 12:16:31 +0800 Subject: [PATCH 18/28] Updated serialise --- .../serialize/angel_serialize/CHANGELOG.md | 7 +- .../angel_serialize/lib/angel3_serialize.dart | 2 +- .../serialize/angel_serialize/pubspec.yaml | 9 +- .../angel_serialize_generator/AUTHORS.md | 2 +- .../angel_serialize_generator/CHANGELOG.md | 9 +- .../example/main.g.dart | 7 +- .../lib/build_context.dart | 26 ----- .../angel_serialize_generator/lib/model.dart | 14 ++- .../lib/serialize.dart | 27 +++-- .../angel_serialize_generator/pubspec.yaml | 13 ++- .../test/book_test.dart | 12 +- .../test/enum_test.dart | 10 +- .../test/models/book.d.ts | 2 +- .../test/models/book.dart | 2 - .../test/models/book.g.dart | 107 +++++++++--------- .../test/models/game_pad_button.g.dart | 24 ++-- .../test/models/goat.dart | 1 - .../test/models/goat.g.dart | 11 +- .../test/models/has_map.dart | 3 - .../test/models/has_map.g.dart | 11 +- .../test/models/subclass.g.dart | 22 +--- .../test/models/with_enum.dart | 1 - .../test/models/with_enum.g.dart | 28 +++-- 23 files changed, 176 insertions(+), 174 deletions(-) diff --git a/packages/serialize/angel_serialize/CHANGELOG.md b/packages/serialize/angel_serialize/CHANGELOG.md index d59da367..ec5800d3 100644 --- a/packages/serialize/angel_serialize/CHANGELOG.md +++ b/packages/serialize/angel_serialize/CHANGELOG.md @@ -1,9 +1,12 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x + ## 5.0.0 -* Updated `analyzer` to version 3.x -* Updated min SDK to 2.14.x +* Skipped release ## 4.1.1 diff --git a/packages/serialize/angel_serialize/lib/angel3_serialize.dart b/packages/serialize/angel_serialize/lib/angel3_serialize.dart index cf0fa14a..577219e7 100644 --- a/packages/serialize/angel_serialize/lib/angel3_serialize.dart +++ b/packages/serialize/angel_serialize/lib/angel3_serialize.dart @@ -38,7 +38,7 @@ class SerializableField { final String? alias; /// A default for this field. - final defaultValue; + final dynamic defaultValue; /// A custom serializer for this field. final Symbol? serializer; diff --git a/packages/serialize/angel_serialize/pubspec.yaml b/packages/serialize/angel_serialize/pubspec.yaml index 9a853785..dec7bda1 100644 --- a/packages/serialize/angel_serialize/pubspec.yaml +++ b/packages/serialize/angel_serialize/pubspec.yaml @@ -1,15 +1,18 @@ name: angel3_serialize -version: 4.1.1 +version: 6.0.0 description: Static annotations powering Angel3 model serialization. Combine with angel3_serialize_generator for flexible modeling. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - angel3_model: ^3.0.0 + angel3_model: ^6.0.0 collection: ^1.15.0 meta: ^1.3.0 quiver: ^3.0.1 dev_dependencies: lints: ^1.0.0 +dependency_overrides: + angel3_model: + path: ../../model diff --git a/packages/serialize/angel_serialize_generator/AUTHORS.md b/packages/serialize/angel_serialize_generator/AUTHORS.md index ac95ab58..6ae218e2 100644 --- a/packages/serialize/angel_serialize_generator/AUTHORS.md +++ b/packages/serialize/angel_serialize_generator/AUTHORS.md @@ -3,7 +3,7 @@ Primary Authors * __[Thomas Hii](dukefirehawk.apps@gmail.com)__ - Thomas is the current maintainer of the code base. He has refactored and migrated the + Thomas is the current maintainer of the code base. He has refactored and migrated the code base to support NNBD. * __[Tobe O](thosakwe@gmail.com)__ diff --git a/packages/serialize/angel_serialize_generator/CHANGELOG.md b/packages/serialize/angel_serialize_generator/CHANGELOG.md index a4991c69..8f8292ad 100644 --- a/packages/serialize/angel_serialize_generator/CHANGELOG.md +++ b/packages/serialize/angel_serialize_generator/CHANGELOG.md @@ -1,9 +1,14 @@ # Change Log +## 6.0.0 + +* Updated to min SDK 2.15.x +* Updated to `analyzer` 3.x.x +* Fixed default value for `List` and `Enum` + ## 5.0.0 -* Updated `analyzer` to version 3.x -* Updated min SDK to 2.14.x +* Skipped release ## 4.3.0 diff --git a/packages/serialize/angel_serialize_generator/example/main.g.dart b/packages/serialize/angel_serialize_generator/example/main.g.dart index e5acf8ad..4a8905ed 100644 --- a/packages/serialize/angel_serialize_generator/example/main.g.dart +++ b/packages/serialize/angel_serialize_generator/example/main.g.dart @@ -66,16 +66,17 @@ class TodoSerializer extends Codec { @override TodoEncoder get encoder => const TodoEncoder(); - @override TodoDecoder get decoder => const TodoDecoder(); - static Todo fromMap(Map map) { return Todo( text: map['text'] as String?, completed: map['completed'] as bool?); } - static Map toMap(_Todo model) { + static Map toMap(_Todo? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return {'text': model.text, 'completed': model.completed}; } } diff --git a/packages/serialize/angel_serialize_generator/lib/build_context.dart b/packages/serialize/angel_serialize_generator/lib/build_context.dart index c7dbfb8d..f8a5b242 100644 --- a/packages/serialize/angel_serialize_generator/lib/build_context.dart +++ b/packages/serialize/angel_serialize_generator/lib/build_context.dart @@ -215,32 +215,6 @@ Future buildContext( } } - // ShimFields are no longer used. - // if (const TypeChecker.fromRuntime(Model).isAssignableFromType(clazz.type)) { - // if (!fieldNames.contains('id')) { - // var idField = ShimFieldImpl('id', lib.context.typeProvider.stringType); - // ctx.fields.insert(0, idField); - // ctx.shimmed['id'] = true; - // } - - // DartType dateTime; - // for (var key in ['createdAt', 'updatedAt']) { - // if (!fieldNames.contains(key)) { - // if (dateTime == null) { - // var coreLib = - // await resolver.libraries.singleWhere((lib) => lib.isDartCore); - // var dt = coreLib.getType('DateTime'); - // dateTime = dt.type; - // } - - // var field = ShimFieldImpl(key, dateTime); - // ctx.aliases[key] = ReCase(key).snakeCase; - // ctx.fields.add(field); - // ctx.shimmed[key] = true; - // } - // } - // } - // Get constructor params, if any ctx.constructorParameters.addAll(clazz.unnamedConstructor!.parameters); diff --git a/packages/serialize/angel_serialize_generator/lib/model.dart b/packages/serialize/angel_serialize_generator/lib/model.dart index e74051ac..3285cb5e 100644 --- a/packages/serialize/angel_serialize_generator/lib/model.dart +++ b/packages/serialize/angel_serialize_generator/lib/model.dart @@ -14,7 +14,7 @@ class JsonModelGenerator extends GeneratorForAnnotation { buildStep.resolver, true); if (ctx == null) { - log.severe('Invalid builder context'); + log.fine('Invalid builder context'); throw 'Invalid builder context'; } @@ -128,8 +128,8 @@ class JsonModelGenerator extends GeneratorForAnnotation { ? 'List' : 'Map'; String? defaultValue = typeName == 'List' ? '[]' : '{}'; - var existingDefault = ctx.defaults[field.name]; + var existingDefault = ctx.defaults[field.name]; if (existingDefault != null) { defaultValue = dartObjectToString(existingDefault); } @@ -173,7 +173,15 @@ class JsonModelGenerator extends GeneratorForAnnotation { if (!b.toThis) { b.type = convertTypeReference(field.type); } - b.defaultTo = Code('const []'); + + // Get the default if presence + var existingDefault = ctx.defaults[field.name]; + if (existingDefault != null) { + var defaultValue = dartObjectToString(existingDefault); + b.defaultTo = Code('$defaultValue'); + } else { + b.defaultTo = Code('const []'); + } } else if (!b.toThis) { b.type = convertTypeReference(field.type); } else { diff --git a/packages/serialize/angel_serialize_generator/lib/serialize.dart b/packages/serialize/angel_serialize_generator/lib/serialize.dart index 390bbbd7..3c91f21e 100644 --- a/packages/serialize/angel_serialize_generator/lib/serialize.dart +++ b/packages/serialize/angel_serialize_generator/lib/serialize.dart @@ -8,14 +8,14 @@ class SerializerGenerator extends GeneratorForAnnotation { @override Future generateForAnnotatedElement( Element element, ConstantReader annotation, BuildStep buildStep) async { - //log.fine('Running SerializerGenerator'); + log.fine('Running SerializerGenerator'); if (element.kind != ElementKind.CLASS) { throw 'Only classes can be annotated with a @Serializable() annotation.'; } var ctx = await buildContext(element as ClassElement, annotation, buildStep, - buildStep.resolver, autoSnakeCaseNames != false); + buildStep.resolver, !autoSnakeCaseNames); if (ctx == null) { log.severe('Invalid builder context'); @@ -25,11 +25,13 @@ class SerializerGenerator extends GeneratorForAnnotation { var serializers = annotation.peek('serializers')?.listValue ?? []; if (serializers.isEmpty) { + log.severe("No Serializers"); return null; } // Check if any serializer is recognized if (!serializers.any((s) => Serializers.all.contains(s.toIntValue()))) { + log.severe("No recognizable Serializers"); return null; } @@ -46,15 +48,17 @@ class SerializerGenerator extends GeneratorForAnnotation { /// Generate a serializer class. void generateClass( List serializers, BuildContext ctx, LibraryBuilder file) { - //log.fine('Generate serializer class'); + log.fine('Generate serializer class'); // Generate canonical codecs, etc. var pascal = ctx.modelClassNameRecase.pascalCase.replaceAll('?', ''); var camel = ctx.modelClassNameRecase.camelCase.replaceAll('?', ''); - log.info('Generating ${pascal}Serializer'); + log.fine('Generating ${pascal}Serializer'); if (ctx.constructorParameters.isEmpty) { + log.fine("Constructor is empty"); + file.body.add(Code(''' const ${pascal}Serializer ${camel}Serializer = ${pascal}Serializer(); @@ -201,7 +205,7 @@ class ${pascal}Decoder extends Converter { type.typeArguments[1].getDisplayString(withNullability: true)); serializedRepresentation = '''model.${field.name}.keys.fold({}, (map, key) { - return (map as Map?)?..[key] = + return (map as Map?)?..[key] = ${serializerToMap(rc, 'model.${field.name}[key]')}; })'''; } else if (type.element.isEnum) { @@ -235,7 +239,8 @@ class ${pascal}Decoder extends Converter { buf.write('};'); method.body = Block.of([ - Code('if (model == null) { return {}; }'), + Code( + 'if (model == null) { throw FormatException("Required field [model] cannot be null"); }'), Code(buf.toString()), ]); })); @@ -305,13 +310,11 @@ class ${pascal}Decoder extends Converter { var deserializedRepresentation = "map['$alias'] as ${typeToString(type)}"; + if (type.nullabilitySuffix == NullabilitySuffix.question) { deserializedRepresentation += '?'; } - //log.fine( - // 'deserializedRepresentation => $deserializedRepresentation, type => $type, nullcheck => ${type.nullabilitySuffix}'); - var defaultValue = 'null'; var existingDefault = ctx.defaults[field.name]; @@ -319,6 +322,10 @@ class ${pascal}Decoder extends Converter { var d = dartObjectToString(existingDefault); if (d != null) { defaultValue = d; + + if (!deserializedRepresentation.endsWith("?")) { + deserializedRepresentation += "?"; + } } deserializedRepresentation = '$deserializedRepresentation ?? $defaultValue'; @@ -372,7 +379,7 @@ class ${pascal}Decoder extends Converter { } else if (type.element.isEnum) { deserializedRepresentation = ''' map['$alias'] is ${type.getDisplayString(withNullability: true)} - ? (map['$alias'] as ${type.getDisplayString(withNullability: true)}) + ? (map['$alias'] as ${type.getDisplayString(withNullability: true)}) ?? $defaultValue : ( map['$alias'] is int diff --git a/packages/serialize/angel_serialize_generator/pubspec.yaml b/packages/serialize/angel_serialize_generator/pubspec.yaml index 7fa5b0a7..01b23c44 100644 --- a/packages/serialize/angel_serialize_generator/pubspec.yaml +++ b/packages/serialize/angel_serialize_generator/pubspec.yaml @@ -1,14 +1,14 @@ name: angel3_serialize_generator -version: 5.0.0 +version: 6.0.0 description: Angel3 model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize_generator environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: analyzer: ^3.0.0 - angel3_model: ^3.0.0 - angel3_serialize: ^4.1.0 + angel3_model: ^6.0.0 + angel3_serialize: ^6.0.0 belatuk_code_buffer: ^3.0.0 build: ^2.0.1 build_config: ^1.0.0 @@ -24,3 +24,8 @@ dev_dependencies: collection: ^1.15.0 lints: ^1.0.0 test: ^1.17.4 +dependency_overrides: + angel3_model: + path: ../../model + angel3_serialize: + path: ../angel_serialize diff --git a/packages/serialize/angel_serialize_generator/test/book_test.dart b/packages/serialize/angel_serialize_generator/test/book_test.dart index 1c12b6df..bb6977d6 100644 --- a/packages/serialize/angel_serialize_generator/test/book_test.dart +++ b/packages/serialize/angel_serialize_generator/test/book_test.dart @@ -31,30 +31,30 @@ void main() { group('serialization', () { test('serialization sets proper fields', () { - expect(serializedDeathlyHallows!['id'], deathlyHallows.id); + expect(serializedDeathlyHallows['id'], deathlyHallows.id); expect(serializedDeathlyHallows['author'], deathlyHallows.author); expect( serializedDeathlyHallows['description'], deathlyHallows.description); expect(serializedDeathlyHallows['page_count'], deathlyHallows.pageCount); expect(serializedDeathlyHallows['created_at'], isNull); expect(serializedDeathlyHallows['updated_at'], - deathlyHallows.updatedAt!.toIso8601String()); + deathlyHallows.updatedAt?.toIso8601String()); }); test('can be mutated', () { var b = deathlyHallows.copyWith(); b.author = 'Hey'; expect(b.author, 'Hey'); - expect(b.toJson()![BookFields.author], 'Hey'); + expect(b.toJson()[BookFields.author], 'Hey'); }); test('heeds @Alias', () { - expect(serializedDeathlyHallows!['page_count'], deathlyHallows.pageCount); + expect(serializedDeathlyHallows['page_count'], deathlyHallows.pageCount); expect(serializedDeathlyHallows.keys, isNot(contains('pageCount'))); }); test('standard list', () { - expect(serializedDeathlyHallows!['not_models'], deathlyHallows.notModels); + expect(serializedDeathlyHallows['not_models'], deathlyHallows.notModels); }); test('heeds @exclude', () { @@ -112,7 +112,7 @@ void main() { group('deserialization', () { test('deserialization sets proper fields', () { - var book = BookSerializer.fromMap(deathlyHallowsMap!); + var book = BookSerializer.fromMap(deathlyHallowsMap); expect(book.id, deathlyHallows.id); expect(book.author, deathlyHallows.author); expect(book.description, deathlyHallows.description); diff --git a/packages/serialize/angel_serialize_generator/test/enum_test.dart b/packages/serialize/angel_serialize_generator/test/enum_test.dart index e3b2b5c3..0be89b36 100644 --- a/packages/serialize/angel_serialize_generator/test/enum_test.dart +++ b/packages/serialize/angel_serialize_generator/test/enum_test.dart @@ -3,8 +3,8 @@ import 'dart:typed_data'; import 'package:test/test.dart'; import 'models/with_enum.dart'; -const WithEnum aWithEnum = WithEnum(type: WithEnumType.a); -const WithEnum aWithEnum2 = WithEnum(type: WithEnumType.a); +WithEnum aWithEnum = WithEnum(type: WithEnumType.a); +WithEnum aWithEnum2 = WithEnum(type: WithEnumType.a); void main() { test('enum serializes to int', () { @@ -44,7 +44,11 @@ void main() { }); test('const', () { - expect(identical(aWithEnum, aWithEnum2), true); + print('aWithEnum ${aWithEnum.hashCode}'); + print('aWithEnum2 ${aWithEnum2.hashCode}'); + + //expect(identical(aWithEnum, aWithEnum2), true); + expect(aWithEnum == aWithEnum2, true); }); test('uint8list', () { diff --git a/packages/serialize/angel_serialize_generator/test/models/book.d.ts b/packages/serialize/angel_serialize_generator/test/models/book.d.ts index c0c01be5..97f19f78 100644 --- a/packages/serialize/angel_serialize_generator/test/models/book.d.ts +++ b/packages/serialize/angel_serialize_generator/test/models/book.d.ts @@ -1,5 +1,5 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -declare module 'angel_serialize_generator' { +declare module 'angel3_serialize_generator' { interface Book { id?: string; created_at?: any; diff --git a/packages/serialize/angel_serialize_generator/test/models/book.dart b/packages/serialize/angel_serialize_generator/test/models/book.dart index 45cfc2e1..db22c5b4 100644 --- a/packages/serialize/angel_serialize_generator/test/models/book.dart +++ b/packages/serialize/angel_serialize_generator/test/models/book.dart @@ -1,8 +1,6 @@ library angel_serialize.test.models.book; -import 'package:angel3_model/angel3_model.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; -import 'package:collection/collection.dart'; part 'book.g.dart'; @Serializable( diff --git a/packages/serialize/angel_serialize_generator/test/models/book.g.dart b/packages/serialize/angel_serialize_generator/test/models/book.g.dart index 05845c2d..bd2f4488 100644 --- a/packages/serialize/angel_serialize_generator/test/models/book.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/book.g.dart @@ -18,7 +18,7 @@ class Book extends _Book { this.title, this.description, this.pageCount, - List? notModels, + List? notModels = const [], this.camelCaseString}) : notModels = List.unmodifiable(notModels ?? []); @@ -110,7 +110,7 @@ class Book extends _Book { return 'Book(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, author=$author, title=$title, description=$description, pageCount=$pageCount, notModels=$notModels, camelCaseString=$camelCaseString)'; } - Map? toJson() { + Map toJson() { return BookSerializer.toMap(this); } } @@ -123,11 +123,11 @@ class Author extends _Author { this.updatedAt, required this.name, required this.age, - List<_Book>? books, + List<_Book> books = const [], this.newestBook, this.secret, this.obscured}) - : books = List.unmodifiable(books ?? []); + : books = List.unmodifiable(books); /// A unique identifier corresponding to this item. @override @@ -142,23 +142,23 @@ class Author extends _Author { DateTime? updatedAt; @override - final String? name; + String? name; @override - final int? age; + int? age; @override - final List<_Book> books; + List<_Book> books; /// The newest book. @override - final _Book? newestBook; + _Book? newestBook; @override - final String? secret; + String? secret; @override - final String? obscured; + String? obscured; Author copyWith( {String? id, @@ -225,8 +225,11 @@ class Author extends _Author { @generatedSerializable class Library extends _Library { Library( - {this.id, this.createdAt, this.updatedAt, Map? collection}) - : collection = Map.unmodifiable(collection ?? {}); + {this.id, + this.createdAt, + this.updatedAt, + required Map collection}) + : collection = Map.unmodifiable(collection); /// A unique identifier corresponding to this item. @override @@ -241,7 +244,7 @@ class Library extends _Library { DateTime? updatedAt; @override - final Map collection; + Map collection; Library copyWith( {String? id, @@ -288,10 +291,10 @@ class Bookmark extends _Bookmark { {this.id, this.createdAt, this.updatedAt, - List? history, + List history = const [], required this.page, this.comment}) - : history = List.unmodifiable(history ?? []), + : history = List.unmodifiable(history), super(book); /// A unique identifier corresponding to this item. @@ -307,13 +310,13 @@ class Bookmark extends _Bookmark { DateTime? updatedAt; @override - final List history; + List history; @override - final int? page; + int? page; @override - final String? comment; + String? comment; Bookmark copyWith(_Book book, {String? id, @@ -364,11 +367,11 @@ class Bookmark extends _Bookmark { const BookSerializer bookSerializer = BookSerializer(); -class BookEncoder extends Converter { +class BookEncoder extends Converter { const BookEncoder(); @override - Map? convert(Book model) => BookSerializer.toMap(model); + Map convert(Book model) => BookSerializer.toMap(model); } class BookDecoder extends Converter { @@ -378,26 +381,24 @@ class BookDecoder extends Converter { Book convert(Map map) => BookSerializer.fromMap(map); } -class BookSerializer extends Codec { +class BookSerializer extends Codec { const BookSerializer(); @override BookEncoder get encoder => const BookEncoder(); - @override BookDecoder get decoder => const BookDecoder(); - static Book fromMap(Map map) { return Book( id: map['id'] as String?, createdAt: map['created_at'] != null ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime?) + ? (map['created_at'] as DateTime) : DateTime.parse(map['created_at'].toString())) : null, updatedAt: map['updated_at'] != null ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime?) + ? (map['updated_at'] as DateTime) : DateTime.parse(map['updated_at'].toString())) : null, author: map['author'] as String?, @@ -406,13 +407,13 @@ class BookSerializer extends Codec { pageCount: map['page_count'] as int?, notModels: map['not_models'] is Iterable ? (map['not_models'] as Iterable).cast().toList() - : null, + : [], camelCaseString: map['camelCase'] as String?); } - static Map? toMap(_Book? model) { + static Map toMap(_Book? model) { if (model == null) { - return null; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -481,10 +482,8 @@ class AuthorSerializer extends Codec { @override AuthorEncoder get encoder => const AuthorEncoder(); - @override AuthorDecoder get decoder => const AuthorDecoder(); - static Author fromMap(Map map) { if (map['name'] == null) { throw FormatException("Missing required field 'name' on Author."); @@ -498,12 +497,12 @@ class AuthorSerializer extends Codec { id: map['id'] as String?, createdAt: map['created_at'] != null ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime?) + ? (map['created_at'] as DateTime) : DateTime.parse(map['created_at'].toString())) : null, updatedAt: map['updated_at'] != null ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime?) + ? (map['updated_at'] as DateTime) : DateTime.parse(map['updated_at'].toString())) : null, name: map['name'] as String?, @@ -511,22 +510,17 @@ class AuthorSerializer extends Codec { books: map['books'] is Iterable ? List.unmodifiable(((map['books'] as Iterable).whereType()) .map(BookSerializer.fromMap)) - : null, + : [], newestBook: map['newest_book'] != null ? BookSerializer.fromMap(map['newest_book'] as Map) : null, obscured: map['obscured'] as String?); } - static Map toMap(_Author model) { - if (model.name == null) { - throw FormatException("Missing required field 'name' on Author."); + static Map toMap(_Author? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - - if (model.age == null) { - throw FormatException('Custom message for missing `age`'); - } - return { 'id': model.id, 'created_at': model.createdAt?.toIso8601String(), @@ -592,21 +586,19 @@ class LibrarySerializer extends Codec { @override LibraryEncoder get encoder => const LibraryEncoder(); - @override LibraryDecoder get decoder => const LibraryDecoder(); - static Library fromMap(Map map) { return Library( id: map['id'] as String?, createdAt: map['created_at'] != null ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime?) + ? (map['created_at'] as DateTime) : DateTime.parse(map['created_at'].toString())) : null, updatedAt: map['updated_at'] != null ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime?) + ? (map['updated_at'] as DateTime) : DateTime.parse(map['updated_at'].toString())) : null, collection: map['collection'] is Map @@ -616,16 +608,20 @@ class LibrarySerializer extends Codec { ..[key] = BookSerializer.fromMap( ((map['collection'] as Map)[key]) as Map); })) - : null); + : {}); } - static Map toMap(_Library model) { + static Map toMap(_Library? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return { 'id': model.id, 'created_at': model.createdAt?.toIso8601String(), 'updated_at': model.updatedAt?.toIso8601String(), - 'collection': model.collection.keys.fold({}, (dynamic map, key) { - return map..[key] = BookSerializer.toMap(model.collection[key]); + 'collection': model.collection.keys.fold({}, (map, key) { + return (map as Map?) + ?..[key] = BookSerializer.toMap(model.collection[key]); }) }; } @@ -658,26 +654,25 @@ abstract class BookmarkSerializer { id: map['id'] as String?, createdAt: map['created_at'] != null ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime?) + ? (map['created_at'] as DateTime) : DateTime.parse(map['created_at'].toString())) : null, updatedAt: map['updated_at'] != null ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime?) + ? (map['updated_at'] as DateTime) : DateTime.parse(map['updated_at'].toString())) : null, history: map['history'] is Iterable ? (map['history'] as Iterable).cast().toList() - : null, + : [], page: map['page'] as int?, comment: map['comment'] as String?); } - static Map toMap(_Bookmark model) { - if (model.page == null) { - throw FormatException("Missing required field 'page' on Bookmark."); + static Map toMap(_Bookmark? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - return { 'id': model.id, 'created_at': model.createdAt?.toIso8601String(), diff --git a/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart b/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart index 2559c257..c0daeb2e 100644 --- a/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/game_pad_button.g.dart @@ -8,13 +8,13 @@ part of 'game_pad_button.dart'; @generatedSerializable class GamepadButton implements _GamepadButton { - const GamepadButton({this.name, this.radius}); + GamepadButton({this.name, this.radius}); @override - final String? name; + String? name; @override - final int? radius; + int? radius; GamepadButton copyWith({String? name, int? radius}) { return GamepadButton( @@ -45,7 +45,9 @@ class GamepadButton implements _GamepadButton { @generatedSerializable class Gamepad extends _Gamepad { - Gamepad({List<_GamepadButton>? buttons, Map? dynamicMap}) + Gamepad( + {List<_GamepadButton>? buttons = const [], + Map? dynamicMap}) : buttons = List.unmodifiable(buttons ?? []), dynamicMap = Map.unmodifiable(dynamicMap ?? {}); @@ -120,7 +122,10 @@ class GamepadButtonSerializer extends Codec { name: map['name'] as String?, radius: map['radius'] as int?); } - static Map toMap(_GamepadButton model) { + static Map toMap(_GamepadButton? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return {'name': model.name, 'radius': model.radius}; } } @@ -161,13 +166,16 @@ class GamepadSerializer extends Codec { buttons: map['buttons'] is Iterable ? List.unmodifiable(((map['buttons'] as Iterable).whereType()) .map(GamepadButtonSerializer.fromMap)) - : null, + : [], dynamicMap: map['dynamic_map'] is Map ? (map['dynamic_map'] as Map).cast() - : null); + : {}); } - static Map toMap(_Gamepad model) { + static Map toMap(_Gamepad? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return { 'buttons': model.buttons?.map((m) => GamepadButtonSerializer.toMap(m)).toList(), diff --git a/packages/serialize/angel_serialize_generator/test/models/goat.dart b/packages/serialize/angel_serialize_generator/test/models/goat.dart index b35ed160..79152280 100644 --- a/packages/serialize/angel_serialize_generator/test/models/goat.dart +++ b/packages/serialize/angel_serialize_generator/test/models/goat.dart @@ -1,5 +1,4 @@ import 'package:angel3_serialize/angel3_serialize.dart'; -import 'package:collection/collection.dart'; part 'goat.g.dart'; @serializable diff --git a/packages/serialize/angel_serialize_generator/test/models/goat.g.dart b/packages/serialize/angel_serialize_generator/test/models/goat.g.dart index ead0a156..4c8c5fb7 100644 --- a/packages/serialize/angel_serialize_generator/test/models/goat.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/goat.g.dart @@ -8,13 +8,13 @@ part of 'goat.dart'; @generatedSerializable class Goat implements _Goat { - const Goat({this.integer = 34, this.list = const [34, 35]}); + Goat({this.integer = 34, this.list = const [34, 35]}); @override - final int integer; + int integer; @override - final List list; + List list; Goat copyWith({int? integer, List? list}) { return Goat(integer: integer ?? this.integer, list: list ?? this.list); @@ -77,7 +77,10 @@ class GoatSerializer extends Codec { : const [34, 35]); } - static Map toMap(_Goat model) { + static Map toMap(_Goat? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return {'integer': model.integer, 'list': model.list}; } } diff --git a/packages/serialize/angel_serialize_generator/test/models/has_map.dart b/packages/serialize/angel_serialize_generator/test/models/has_map.dart index beef7c61..b335c187 100644 --- a/packages/serialize/angel_serialize_generator/test/models/has_map.dart +++ b/packages/serialize/angel_serialize_generator/test/models/has_map.dart @@ -1,7 +1,4 @@ -import 'dart:convert'; import 'package:angel3_serialize/angel3_serialize.dart'; -import 'package:collection/collection.dart'; -//import 'package:meta/meta.dart'; part 'has_map.g.dart'; Map? _fromString(v) => json.decode(v.toString()) as Map?; diff --git a/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart b/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart index 25416576..8f9482d1 100644 --- a/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/has_map.g.dart @@ -8,10 +8,10 @@ part of 'has_map.dart'; @generatedSerializable class HasMap implements _HasMap { - const HasMap({required this.value}); + HasMap({required this.value}); @override - final Map? value; + Map? value; HasMap copyWith({Map? value}) { return HasMap(value: value ?? this.value); @@ -75,11 +75,10 @@ class HasMapSerializer extends Codec { return HasMap(value: _fromString(map['value'])); } - static Map toMap(_HasMap model) { - if (model.value == null) { - throw FormatException("Missing required field 'value' on HasMap."); + static Map toMap(_HasMap? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - return {'value': _toString(model.value)}; } } diff --git a/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart b/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart index 611401f1..d6612fb5 100644 --- a/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/subclass.g.dart @@ -123,15 +123,10 @@ class AnimalSerializer extends Codec { genus: map['genus'] as String?, species: map['species'] as String?); } - static Map toMap(_Animal model) { - if (model.genus == null) { - throw FormatException("Missing required field 'genus' on Animal."); + static Map toMap(_Animal? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - - if (model.species == null) { - throw FormatException("Missing required field 'species' on Animal."); - } - return {'genus': model.genus, 'species': model.species}; } } @@ -182,15 +177,10 @@ class BirdSerializer extends Codec { isSparrow: map['is_sparrow'] as bool? ?? false); } - static Map toMap(_Bird model) { - if (model.genus == null) { - throw FormatException("Missing required field 'genus' on Bird."); + static Map toMap(_Bird? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - - if (model.species == null) { - throw FormatException("Missing required field 'species' on Bird."); - } - return { 'genus': model.genus, 'species': model.species, diff --git a/packages/serialize/angel_serialize_generator/test/models/with_enum.dart b/packages/serialize/angel_serialize_generator/test/models/with_enum.dart index 0ebd8f7c..eb92923a 100644 --- a/packages/serialize/angel_serialize_generator/test/models/with_enum.dart +++ b/packages/serialize/angel_serialize_generator/test/models/with_enum.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'dart:typed_data'; import 'package:angel3_serialize/angel3_serialize.dart'; -import 'package:collection/collection.dart'; part 'with_enum.g.dart'; @serializable diff --git a/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart b/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart index f2446c6c..f85ff650 100644 --- a/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart +++ b/packages/serialize/angel_serialize_generator/test/models/with_enum.g.dart @@ -8,16 +8,17 @@ part of 'with_enum.dart'; @generatedSerializable class WithEnum implements _WithEnum { - const WithEnum({this.type = WithEnumType.b, this.finalList, this.imageBytes}); + WithEnum( + {this.type = WithEnumType.b, this.finalList = const [], this.imageBytes}); @override - final WithEnumType? type; + WithEnumType? type; @override - final List? finalList; + List? finalList; @override - final Uint8List? imageBytes; + Uint8List? imageBytes; WithEnum copyWith( {WithEnumType? type, List? finalList, Uint8List? imageBytes}) { @@ -80,16 +81,16 @@ class WithEnumSerializer extends Codec { WithEnumDecoder get decoder => const WithEnumDecoder(); static WithEnum fromMap(Map map) { return WithEnum( - type: map['type'] is WithEnumType - ? (map['type'] as WithEnumType?) + type: map['type'] is WithEnumType? + ? (map['type'] as WithEnumType?) ?? WithEnumType.b : (map['type'] is int - ? WithEnumType.values[map['type'] as int] + ? WithEnumType?.values[map['type'] as int] : WithEnumType.b), finalList: map['final_list'] is Iterable ? (map['final_list'] as Iterable).cast().toList() - : null, + : [], imageBytes: map['image_bytes'] is Uint8List - ? (map['image_bytes'] as Uint8List?) + ? (map['image_bytes'] as Uint8List) : (map['image_bytes'] is Iterable ? Uint8List.fromList( (map['image_bytes'] as Iterable).toList()) @@ -99,13 +100,16 @@ class WithEnumSerializer extends Codec { : null))); } - static Map toMap(_WithEnum model) { + static Map toMap(_WithEnum? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); + } return { 'type': - model.type == null ? null : WithEnumType.values.indexOf(model.type!), + model.type != null ? WithEnumType.values.indexOf(model.type!) : null, 'final_list': model.finalList, 'image_bytes': - model.imageBytes == null ? null : base64.encode(model.imageBytes!) + model.imageBytes != null ? base64.encode(model.imageBytes!) : null }; } } From 174388e0753930eb8173ffeea5f8e42d7d74b539 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 27 Feb 2022 12:30:22 +0800 Subject: [PATCH 19/28] Updated ORM --- packages/orm/angel_orm_generator/example/main.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/book.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/car.g.dart | 2 +- .../angel_orm_test/lib/src/models/custom_expr.g.dart | 4 ++-- .../lib/src/models/email_indexed.g.dart | 6 +++--- .../orm/angel_orm_test/lib/src/models/fortune.g.dart | 2 +- .../orm/angel_orm_test/lib/src/models/has_car.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/has_map.g.dart | 2 +- .../orm/angel_orm_test/lib/src/models/leg.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/order.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/person.g.dart | 4 ++-- .../lib/src/models/person_order.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/tree.g.dart | 4 ++-- .../angel_orm_test/lib/src/models/unorthodox.g.dart | 12 ++++++------ .../orm/angel_orm_test/lib/src/models/user.g.dart | 6 +++--- .../orm/angel_orm_test/lib/src/models/world.g.dart | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/orm/angel_orm_generator/example/main.g.dart b/packages/orm/angel_orm_generator/example/main.g.dart index e308677b..97d1d0db 100644 --- a/packages/orm/angel_orm_generator/example/main.g.dart +++ b/packages/orm/angel_orm_generator/example/main.g.dart @@ -48,7 +48,7 @@ class EmployeeQuery extends Query { @override Map get casts { - return {'salary': 'text'}; + return {'salary': 'char'}; } @override @@ -324,7 +324,7 @@ class EmployeeSerializer extends Codec { static Map toMap(_Employee? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/book.g.dart b/packages/orm/angel_orm_test/lib/src/models/book.g.dart index 417b84af..e7342120 100644 --- a/packages/orm/angel_orm_test/lib/src/models/book.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/book.g.dart @@ -531,7 +531,7 @@ class BookSerializer extends Codec { static Map toMap(_Book? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -608,7 +608,7 @@ class AuthorSerializer extends Codec { static Map toMap(_Author? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index e7329ddc..6c3c5c91 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -342,7 +342,7 @@ class CarSerializer extends Codec { static Map toMap(_Car? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart index a5335c28..1993d623 100644 --- a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart @@ -467,7 +467,7 @@ class NumbersSerializer extends Codec { static Map toMap(_Numbers? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -534,7 +534,7 @@ class AlphabetSerializer extends Codec { static Map toMap(_Alphabet? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart index ea648f30..be558599 100644 --- a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart @@ -700,7 +700,7 @@ class RoleSerializer extends Codec { static Map toMap(_Role? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': model.role, @@ -752,7 +752,7 @@ class RoleUserSerializer extends Codec { static Map toMap(_RoleUser? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': RoleSerializer.toMap(model.role), @@ -805,7 +805,7 @@ class UserSerializer extends Codec { static Map toMap(_User? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'email': model.email, diff --git a/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart b/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart index dff7bbb5..6e10b252 100644 --- a/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart @@ -197,7 +197,7 @@ class FortuneSerializer extends Codec { static Map toMap(_Fortune? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'id': model.id, 'message': model.message}; } diff --git a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart index 5c6e39ac..fde5d0f6 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart @@ -253,7 +253,7 @@ class HasCarSerializer extends Codec { : DateTime.parse(map['updated_at'].toString())) : null, type: map['type'] is CarType? - ? (map['type'] as CarType?) + ? (map['type'] as CarType?) ?? CarType.sedan : (map['type'] is int ? CarType?.values[map['type'] as int] : CarType.sedan)); @@ -261,7 +261,7 @@ class HasCarSerializer extends Codec { static Map toMap(_HasCar? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart index 5ae1f6a5..470ec728 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart @@ -211,7 +211,7 @@ class HasMapSerializer extends Codec { static Map toMap(_HasMap? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'value': model.value, 'list': model.list}; } diff --git a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart index 1110200f..5117f6b4 100644 --- a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart @@ -492,7 +492,7 @@ class LegSerializer extends Codec { static Map toMap(_Leg? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -566,7 +566,7 @@ class FootSerializer extends Codec { static Map toMap(_Foot? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/order.g.dart b/packages/orm/angel_orm_test/lib/src/models/order.g.dart index 10c7b953..b5845d6b 100644 --- a/packages/orm/angel_orm_test/lib/src/models/order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/order.g.dart @@ -526,7 +526,7 @@ class OrderSerializer extends Codec { static Map toMap(_Order? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -606,7 +606,7 @@ class CustomerSerializer extends Codec { static Map toMap(_Customer? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/person.g.dart b/packages/orm/angel_orm_test/lib/src/models/person.g.dart index 151fe607..2f7ccd44 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person.g.dart @@ -412,7 +412,7 @@ class PersonSerializer extends Codec { static Map toMap(_Person? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -479,7 +479,7 @@ class PersonWithLastOrderSerializer extends Codec { static Map toMap(_PersonWithLastOrder? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'name': model.name, diff --git a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart index 8dddf199..3d11349a 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart @@ -577,7 +577,7 @@ class PersonOrderSerializer extends Codec { static Map toMap(_PersonOrder? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -665,7 +665,7 @@ class OrderWithPersonInfoSerializer extends Codec { static Map toMap(_OrderWithPersonInfo? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart index e0f2086d..c4a34e37 100644 --- a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart @@ -559,7 +559,7 @@ class TreeSerializer extends Codec { static Map toMap(_Tree? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -633,7 +633,7 @@ class FruitSerializer extends Codec { static Map toMap(_Fruit? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart index 3231efef..731da605 100644 --- a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart @@ -1260,7 +1260,7 @@ class UnorthodoxSerializer extends Codec { static Map toMap(_Unorthodox? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'name': model.name}; } @@ -1316,7 +1316,7 @@ class WeirdJoinSerializer extends Codec { static Map toMap(_WeirdJoin? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -1390,7 +1390,7 @@ class SongSerializer extends Codec { static Map toMap(_Song? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -1451,7 +1451,7 @@ class NumbaSerializer extends Codec { static Map toMap(_Numba? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'i': model.i, 'parent': model.parent}; } @@ -1500,7 +1500,7 @@ class FooSerializer extends Codec { static Map toMap(_Foo? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'bar': model.bar, @@ -1553,7 +1553,7 @@ class FooPivotSerializer extends Codec { static Map toMap(_FooPivot? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin), diff --git a/packages/orm/angel_orm_test/lib/src/models/user.g.dart b/packages/orm/angel_orm_test/lib/src/models/user.g.dart index 4c883a9b..f88d37ee 100644 --- a/packages/orm/angel_orm_test/lib/src/models/user.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/user.g.dart @@ -859,7 +859,7 @@ class UserSerializer extends Codec { static Map toMap(_User? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -934,7 +934,7 @@ class RoleUserSerializer extends Codec { static Map toMap(_RoleUser? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': RoleSerializer.toMap(model.role), @@ -996,7 +996,7 @@ class RoleSerializer extends Codec { static Map toMap(_Role? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/world.g.dart b/packages/orm/angel_orm_test/lib/src/models/world.g.dart index da72ec89..5a0e29f7 100644 --- a/packages/orm/angel_orm_test/lib/src/models/world.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/world.g.dart @@ -201,7 +201,7 @@ class WorldSerializer extends Codec { static Map toMap(_World? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'id': model.id, 'random_number': model.randomNumber}; } From 99cf7790a4e59ddf56168e15588ae2a1ff5b3389 Mon Sep 17 00:00:00 2001 From: thomashii Date: Fri, 18 Mar 2022 07:57:20 +0800 Subject: [PATCH 20/28] Updated file_service --- packages/file_service/CHANGELOG.md | 8 ++++++ packages/file_service/pubspec.yaml | 19 ++++++++++-- packages/framework/lib/src/core/server.dart | 32 +++++++++++++++++---- packages/production/lib/src/runner.dart | 23 +++++++++++---- packages/production/pubspec.yaml | 1 + 5 files changed, 69 insertions(+), 14 deletions(-) diff --git a/packages/file_service/CHANGELOG.md b/packages/file_service/CHANGELOG.md index edf3b6c3..5a6b7413 100644 --- a/packages/file_service/CHANGELOG.md +++ b/packages/file_service/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.1.0 * Upgraded to `lints` linter diff --git a/packages/file_service/pubspec.yaml b/packages/file_service/pubspec.yaml index 45d1af20..a9cc1f18 100644 --- a/packages/file_service/pubspec.yaml +++ b/packages/file_service/pubspec.yaml @@ -1,14 +1,27 @@ name: angel3_file_service -version: 4.1.0 +version: 6.0.0 description: Angel service that persists data to a file on disk, stored as a JSON list. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/file_service environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 file: ^6.1.1 pool: ^1.5.0 dev_dependencies: - test: ^1.17.7 + test: ^1.20.0 lints: ^1.0.0 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + 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/lib/src/core/server.dart b/packages/framework/lib/src/core/server.dart index dbd77772..3c302b36 100644 --- a/packages/framework/lib/src/core/server.dart +++ b/packages/framework/lib/src/core/server.dart @@ -55,13 +55,23 @@ Future _defaultErrorHandler( } } +/// Default ROOT level logger Logger _defaultLogger() { - Logger logger = Logger('SERVER') - //..level = Level.WARNING + Logger logger = Logger('ROOT') ..onRecord.listen((rec) { - print(rec); - if (rec.error != null) print(rec.error); - if (rec.stackTrace != null) print(rec.stackTrace); + if (rec.error == null) { + print(rec.message); + } + + if (rec.error != null) { + var err = rec.error; + if (err is AngelHttpException && err.statusCode != 500) return; + print('${rec.message} \n'); + print(rec.error); + if (rec.stackTrace != null) { + print(rec.stackTrace); + } + } }); return logger; @@ -120,7 +130,17 @@ class Angel extends Routable { Angel? get parent => _parent; /// Outputs diagnostics and debug messages. - Logger logger = _defaultLogger(); + Logger _logger = _defaultLogger(); + + Logger get logger => _logger; + + /// Assign a custom logger. + /// Passing null will reset to default logger + set logger(Logger? log) { + _logger.clearListeners(); + + _logger = log ?? _defaultLogger(); + } /// Plug-ins to be called right before server startup. /// diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index b9112f85..9b97d238 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:io'; import 'dart:isolate'; +import 'package:intl/intl.dart'; import 'package:angel3_container/angel3_container.dart'; import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; @@ -54,21 +55,33 @@ _ ___ | /| / / /_/ / _ /___ _ /___ '''; + static DateFormat _defaultDateFormat = DateFormat('yyyy-MM-dd HH:mm:ss'); + /// LogRecord handler static void handleLogRecord(LogRecord? record, RunnerOptions options) { if (options.quiet || record == null) return; var code = chooseLogColor(record.level); - if (record.error == null) print(code.wrap(record.toString())); + var now = _defaultDateFormat.format(DateTime.now()); + + if (record.error == null) { + //print(code.wrap(record.message)); + print(code.wrap( + '$now ${record.level.name} [${record.loggerName}]: ${record.message}')); + } if (record.error != null) { var err = record.error; if (err is AngelHttpException && err.statusCode != 500) return; - print(code.wrap(record.toString() + '\n')); - print(code.wrap(err.toString())); + //print(code.wrap(record.message + '\n')); + print(code.wrap( + '$now ${record.level.name} [${record.loggerName}]: ${record.message} \n')); + print(code.wrap( + '$now ${record.level.name} [${record.loggerName}]: ${err.toString()}')); if (record.stackTrace != null) { - print(code.wrap(record.stackTrace.toString())); + print(code.wrap( + '$now ${record.level.name} [${record.loggerName}]: ${record.stackTrace.toString()}')); } } } @@ -220,7 +233,7 @@ _ ___ | /| / / /_/ / _ /___ _ /___ /// Run with main isolate static void isolateMain(_RunnerArgsWithId argsWithId) { var args = argsWithId.args; - hierarchicalLoggingEnabled = true; + hierarchicalLoggingEnabled = false; var zone = Zone.current.fork(specification: ZoneSpecification( print: (self, parent, zone, msg) { diff --git a/packages/production/pubspec.yaml b/packages/production/pubspec.yaml index dcbb2313..fa9b9b75 100644 --- a/packages/production/pubspec.yaml +++ b/packages/production/pubspec.yaml @@ -12,6 +12,7 @@ dependencies: args: ^2.3.0 io: ^1.0.0 logging: ^1.0.1 + intl: ^0.17.0 dev_dependencies: lints: ^1.0.1 dependency_overrides: From 5616303535103e20cb6ad1d69c6ed7879d21e915 Mon Sep 17 00:00:00 2001 From: thomashii Date: Fri, 18 Mar 2022 08:00:20 +0800 Subject: [PATCH 21/28] Updated file_service --- packages/file_service/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/file_service/pubspec.yaml b/packages/file_service/pubspec.yaml index a9cc1f18..1ea91b49 100644 --- a/packages/file_service/pubspec.yaml +++ b/packages/file_service/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel service that persists data to a file on disk, stored as a JSO homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/file_service environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 file: ^6.1.1 From 28aa31a89b3d587a414bd8fbfe49767f12a89c1e Mon Sep 17 00:00:00 2001 From: thomashii Date: Fri, 18 Mar 2022 09:25:36 +0800 Subject: [PATCH 22/28] Updated log message --- packages/production/lib/src/runner.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index 9b97d238..2a210a20 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -67,7 +67,7 @@ _ ___ | /| / / /_/ / _ /___ _ /___ if (record.error == null) { //print(code.wrap(record.message)); print(code.wrap( - '$now ${record.level.name} [${record.loggerName}]: ${record.message}')); + '$now ${record.level.name} ${record.loggerName}: ${record.message}')); } if (record.error != null) { From de299e9c99af8977e7b3c29d477cc87657818866 Mon Sep 17 00:00:00 2001 From: thomashii Date: Fri, 18 Mar 2022 09:27:52 +0800 Subject: [PATCH 23/28] Updated log message --- packages/production/lib/src/runner.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index 2a210a20..9b97d238 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -67,7 +67,7 @@ _ ___ | /| / / /_/ / _ /___ _ /___ if (record.error == null) { //print(code.wrap(record.message)); print(code.wrap( - '$now ${record.level.name} ${record.loggerName}: ${record.message}')); + '$now ${record.level.name} [${record.loggerName}]: ${record.message}')); } if (record.error != null) { From 5f07290573e3cc22c6d3c0d6bb42e2e3c64c37fa Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 19 Mar 2022 09:37:28 +0800 Subject: [PATCH 24/28] Added melos --- .../auth_twitter/.gitignore | 0 .../auth_twitter/CHANGELOG.md | 0 .../auth_twitter/LICENSE | 0 .../auth_twitter/README.md | 0 .../auth_twitter/analysis_options.yaml | 0 .../auth_twitter/example/main.dart | 0 .../auth_twitter/lib/angel_auth_twitter.dart | 0 .../auth_twitter/pubspec.yaml | 0 .../eventsource/.gitignore | 0 .../eventsource/LICENSE | 0 .../eventsource/README.md | 0 .../eventsource/analysis_options.yaml | 0 .../eventsource/eventsource.iml | 0 .../eventsource/example/main.dart | 0 .../eventsource/example/pretty_logging.dart | 0 .../eventsource/lib/angel_eventsource.dart | 0 .../eventsource/lib/server.dart | 0 .../eventsource/pubspec.yaml | 0 .../orm/angel_orm_sqlite/LICENSE | 0 .../orm/angel_orm_sqlite/mono_pkg.yaml | 0 .../orm/angel_orm_sqlite/pubspec.yaml | 0 {packages => archived_packages}/poll/.gitignore | 0 .../poll/.travis.yml | 0 {packages => archived_packages}/poll/AUTHORS.md | 0 .../poll/CHANGELOG.md | 0 {packages => archived_packages}/poll/LICENSE | 0 {packages => archived_packages}/poll/README.md | 0 .../poll/analysis_options.yaml | 0 .../poll/example/main.dart | 0 .../poll/lib/angel_poll.dart | 0 {packages => archived_packages}/poll/poll.iml | 0 .../poll/pubspec.yaml | 0 .../poll/test/all_test.dart | 0 .../relations/.gitignore | 0 .../relations/.travis.yml | 0 .../relations/AUTHORS.md | 0 .../relations/CHANGELOG.md | 0 .../relations/LICENSE | 0 .../relations/README.md | 0 .../relations/analysis_options.yaml | 0 .../relations/lib/angel_relations.dart | 0 .../relations/lib/src/belongs_to.dart | 0 .../relations/lib/src/belongs_to_many.dart | 0 .../relations/lib/src/has_many.dart | 0 .../relations/lib/src/has_many_through.dart | 0 .../relations/lib/src/has_one.dart | 0 .../relations/lib/src/no_service.dart | 0 .../relations/lib/src/plural.dart | 0 .../relations/pubspec.yaml | 0 .../relations/test/belongs_to_test.dart | 0 .../relations/test/common.dart | 0 .../relations/test/has_many_test.dart | 0 .../relations/test/has_one_test.dart | 0 .../rethink/.gitignore | 0 .../rethink/.travis.yml | 0 .../rethink/AUTHORS.md | 0 .../rethink/CHANGELOG.md | 0 {packages => archived_packages}/rethink/LICENSE | 0 .../rethink/README.md | 0 .../rethink/analysis_options.yaml | 0 .../rethink/lib/angel_rethink.dart | 0 .../rethink/lib/src/rethink_service.dart | 0 .../rethink/pubspec.yaml | 0 .../rethink/test/README.md | 0 .../rethink/test/bootstrap.dart | 0 .../rethink/test/common.dart | 0 .../rethink/test/generic_test.dart | 0 .../seeder/.gitignore | 0 .../seeder/.travis.yml | 0 .../seeder/AUTHORS.md | 0 .../seeder/CHANGELOG.md | 0 {packages => archived_packages}/seeder/LICENSE | 0 .../seeder/README.md | 0 .../seeder/analysis_options.yaml | 0 .../seeder/lib/angel_seeder.dart | 0 .../seeder/pubspec.yaml | 0 .../seeder/test/all_test.dart | 0 .../typed_service/.gitignore | 0 .../typed_service/AUTHORS.md | 0 .../typed_service/CHANGELOG.md | 0 .../typed_service/LICENSE | 0 .../typed_service/README.md | 0 .../typed_service/analysis_options.yaml | 0 .../typed_service/example/README.md | 0 .../typed_service/example/data.json | 0 .../typed_service/example/main.dart | 0 .../typed_service/lib/angel_typed_service.dart | 0 .../typed_service/pubspec.yaml | 0 .../typed_service/test/typed_service_test.dart | 0 .../wings/.clang-format | 0 .../wings/.gitignore | 0 .../wings/.gitmodules | 0 .../wings/CMakeLists.txt | 0 {packages => archived_packages}/wings/LICENSE | 0 {packages => archived_packages}/wings/README.md | 0 .../wings/Vagrantfile | 0 .../wings/analysis_options.yaml | 0 .../wings/benchmark/empty.dart | 0 .../wings/benchmark/util.dart | 0 .../wings/example/main.dart | 0 .../wings/example/shared.dart | 0 .../wings/example/socket.dart | 0 .../wings/lib/angel_wings.dart | 0 .../wings/lib/src/CMakeLists.txt | 0 .../wings/lib/src/angel_wings.cc | 0 .../wings/lib/src/angel_wings.h | 0 .../wings/lib/src/bind.cc | 0 .../wings/lib/src/http.cc | 0 .../wings/lib/src/libangel_wings.dylib | Bin .../wings/lib/src/libangel_wings.so | Bin .../wings/lib/src/util.cc | 0 .../wings/lib/src/wings_driver.dart | 0 .../wings/lib/src/wings_request.dart | 0 .../wings/lib/src/wings_response.dart | 0 .../wings/lib/src/wings_socket.cc | 0 .../wings/lib/src/wings_socket.dart | 0 .../wings/lib/src/wings_socket.h | 0 .../wings/libangel_wings.dylib | Bin .../wings/libangel_wings.so | Bin .../wings/provision.sh | 0 .../wings/pubspec.yaml | 0 .../ubuntu-bionic-18.04-cloudimg-console.log | 0 .../wings/web/index.html | 0 .../wings/web/site.css | 0 melos.yaml | 10 ++++++++++ melos_angel3.iml | 12 ++++++++++++ packages/auth/melos_angel3_auth.iml | 16 ++++++++++++++++ .../auth_oauth2/melos_angel3_auth_oauth2.iml | 16 ++++++++++++++++ packages/cache/melos_angel3_cache.iml | 16 ++++++++++++++++ packages/client/melos_angel3_client.iml | 16 ++++++++++++++++ .../melos_angel3_configuration.iml | 16 ++++++++++++++++ .../angel_container/melos_angel3_container.iml | 16 ++++++++++++++++ .../melos_angel3_container_generator.iml | 16 ++++++++++++++++ packages/cors/melos_angel3_cors.iml | 16 ++++++++++++++++ packages/eventsource/.idea/misc.xml | 6 ------ packages/eventsource/.idea/modules.xml | 8 -------- .../.idea/runConfigurations/build_dart.xml | 7 ------- .../.idea/runConfigurations/main_dart.xml | 7 ------- .../.idea/runConfigurations/watch_dart.xml | 7 ------- packages/eventsource/.idea/vcs.xml | 6 ------ .../eventsource/melos_angel_eventsource.iml | 16 ++++++++++++++++ .../file_service/melos_angel3_file_service.iml | 16 ++++++++++++++++ packages/framework/melos_angel3_framework.iml | 16 ++++++++++++++++ packages/hot/melos_angel3_hot.iml | 16 ++++++++++++++++ packages/html/melos_angel3_html.iml | 16 ++++++++++++++++ .../melos_angel3_http_exception.iml | 16 ++++++++++++++++ packages/jael/angel_jael/melos_angel3_jael.iml | 16 ++++++++++++++++ packages/jael/jael/melos_jael3.iml | 16 ++++++++++++++++ .../melos_jael3_language_server.iml | 16 ++++++++++++++++ .../melos_jael3_preprocessor.iml | 16 ++++++++++++++++ packages/jael/jael_web/melos_jael3_web.iml | 16 ++++++++++++++++ packages/jinja/melos_angel3_jinja.iml | 16 ++++++++++++++++ packages/markdown/melos_angel3_markdown.iml | 16 ++++++++++++++++ .../mock_request/melos_angel3_mock_request.iml | 16 ++++++++++++++++ packages/model/melos_angel3_model.iml | 16 ++++++++++++++++ packages/mongo/melos_angel3_mongo.iml | 16 ++++++++++++++++ packages/mustache/melos_angel3_mustache.iml | 16 ++++++++++++++++ packages/oauth2/melos_angel3_oauth2.iml | 16 ++++++++++++++++ .../angel_migration/melos_angel3_migration.iml | 16 ++++++++++++++++ .../melos_angel3_migration_runner.iml | 16 ++++++++++++++++ packages/orm/angel_orm/melos_angel3_orm.iml | 16 ++++++++++++++++ .../melos_angel3_orm_generator.iml | 16 ++++++++++++++++ .../angel_orm_mysql/melos_angel3_orm_mysql.iml | 16 ++++++++++++++++ .../melos_angel3_orm_postgres.iml | 16 ++++++++++++++++ .../melos_angel3_orm_service.iml | 16 ++++++++++++++++ .../angel_orm_test/melos_angel3_orm_test.iml | 16 ++++++++++++++++ packages/paginate/melos_angel3_paginate.iml | 16 ++++++++++++++++ packages/poll/.idea/misc.xml | 6 ------ packages/poll/.idea/modules.xml | 8 -------- .../fires_modified_in_all_test_dart.xml | 8 -------- .../fires_removed_in_all_test_dart.xml | 8 -------- .../tests_in_all_test_dart.xml | 6 ------ packages/poll/.idea/vcs.xml | 6 ------ packages/production/lib/src/runner.dart | 3 ++- packages/production/melos_angel3_production.iml | 16 ++++++++++++++++ packages/proxy/melos_angel3_proxy.iml | 16 ++++++++++++++++ packages/redis/melos_angel3_redis.iml | 16 ++++++++++++++++ packages/rethink/melos_angel_rethink.iml | 16 ++++++++++++++++ packages/route/melos_angel3_route.iml | 16 ++++++++++++++++ packages/security/melos_angel3_security.iml | 16 ++++++++++++++++ packages/sembast/melos_angel3_sembast.iml | 16 ++++++++++++++++ packages/seo/melos_angel3_seo.iml | 16 ++++++++++++++++ .../angel_serialize/melos_angel3_serialize.iml | 16 ++++++++++++++++ .../melos_angel3_serialize_generator.iml | 16 ++++++++++++++++ packages/shelf/melos_angel3_shelf.iml | 16 ++++++++++++++++ packages/static/melos_angel3_static.iml | 16 ++++++++++++++++ packages/sync/melos_angel3_sync.iml | 16 ++++++++++++++++ packages/test/melos_angel3_test.iml | 16 ++++++++++++++++ .../melos_angel3_user_agent.iml | 16 ++++++++++++++++ packages/validate/melos_angel3_validate.iml | 16 ++++++++++++++++ packages/websocket/melos_angel3_websocket.iml | 16 ++++++++++++++++ packages/wings/cmake_dart_utils | 1 - packages/wings/lib/src/http-parser | 1 - 193 files changed, 856 insertions(+), 86 deletions(-) rename {packages => archived_packages}/auth_twitter/.gitignore (100%) rename {packages => archived_packages}/auth_twitter/CHANGELOG.md (100%) rename {packages => archived_packages}/auth_twitter/LICENSE (100%) rename {packages => archived_packages}/auth_twitter/README.md (100%) rename {packages => archived_packages}/auth_twitter/analysis_options.yaml (100%) rename {packages => archived_packages}/auth_twitter/example/main.dart (100%) rename {packages => archived_packages}/auth_twitter/lib/angel_auth_twitter.dart (100%) rename {packages => archived_packages}/auth_twitter/pubspec.yaml (100%) rename {packages => archived_packages}/eventsource/.gitignore (100%) rename {packages => archived_packages}/eventsource/LICENSE (100%) rename {packages => archived_packages}/eventsource/README.md (100%) rename {packages => archived_packages}/eventsource/analysis_options.yaml (100%) rename {packages => archived_packages}/eventsource/eventsource.iml (100%) rename {packages => archived_packages}/eventsource/example/main.dart (100%) rename {packages => archived_packages}/eventsource/example/pretty_logging.dart (100%) rename {packages => archived_packages}/eventsource/lib/angel_eventsource.dart (100%) rename {packages => archived_packages}/eventsource/lib/server.dart (100%) rename {packages => archived_packages}/eventsource/pubspec.yaml (100%) rename {packages => archived_packages}/orm/angel_orm_sqlite/LICENSE (100%) rename {packages => archived_packages}/orm/angel_orm_sqlite/mono_pkg.yaml (100%) rename {packages => archived_packages}/orm/angel_orm_sqlite/pubspec.yaml (100%) mode change 100755 => 100644 rename {packages => archived_packages}/poll/.gitignore (100%) rename {packages => archived_packages}/poll/.travis.yml (100%) rename {packages => archived_packages}/poll/AUTHORS.md (100%) rename {packages => archived_packages}/poll/CHANGELOG.md (100%) rename {packages => archived_packages}/poll/LICENSE (100%) rename {packages => archived_packages}/poll/README.md (100%) rename {packages => archived_packages}/poll/analysis_options.yaml (100%) rename {packages => archived_packages}/poll/example/main.dart (100%) rename {packages => archived_packages}/poll/lib/angel_poll.dart (100%) rename {packages => archived_packages}/poll/poll.iml (100%) rename {packages => archived_packages}/poll/pubspec.yaml (100%) rename {packages => archived_packages}/poll/test/all_test.dart (100%) rename {packages => archived_packages}/relations/.gitignore (100%) rename {packages => archived_packages}/relations/.travis.yml (100%) rename {packages => archived_packages}/relations/AUTHORS.md (100%) rename {packages => archived_packages}/relations/CHANGELOG.md (100%) rename {packages => archived_packages}/relations/LICENSE (100%) rename {packages => archived_packages}/relations/README.md (100%) rename {packages => archived_packages}/relations/analysis_options.yaml (100%) rename {packages => archived_packages}/relations/lib/angel_relations.dart (100%) rename {packages => archived_packages}/relations/lib/src/belongs_to.dart (100%) rename {packages => archived_packages}/relations/lib/src/belongs_to_many.dart (100%) rename {packages => archived_packages}/relations/lib/src/has_many.dart (100%) rename {packages => archived_packages}/relations/lib/src/has_many_through.dart (100%) rename {packages => archived_packages}/relations/lib/src/has_one.dart (100%) rename {packages => archived_packages}/relations/lib/src/no_service.dart (100%) rename {packages => archived_packages}/relations/lib/src/plural.dart (100%) rename {packages => archived_packages}/relations/pubspec.yaml (100%) rename {packages => archived_packages}/relations/test/belongs_to_test.dart (100%) rename {packages => archived_packages}/relations/test/common.dart (100%) rename {packages => archived_packages}/relations/test/has_many_test.dart (100%) rename {packages => archived_packages}/relations/test/has_one_test.dart (100%) rename {packages => archived_packages}/rethink/.gitignore (100%) rename {packages => archived_packages}/rethink/.travis.yml (100%) rename {packages => archived_packages}/rethink/AUTHORS.md (100%) rename {packages => archived_packages}/rethink/CHANGELOG.md (100%) rename {packages => archived_packages}/rethink/LICENSE (100%) rename {packages => archived_packages}/rethink/README.md (100%) rename {packages => archived_packages}/rethink/analysis_options.yaml (100%) rename {packages => archived_packages}/rethink/lib/angel_rethink.dart (100%) rename {packages => archived_packages}/rethink/lib/src/rethink_service.dart (100%) rename {packages => archived_packages}/rethink/pubspec.yaml (100%) rename {packages => archived_packages}/rethink/test/README.md (100%) rename {packages => archived_packages}/rethink/test/bootstrap.dart (100%) rename {packages => archived_packages}/rethink/test/common.dart (100%) rename {packages => archived_packages}/rethink/test/generic_test.dart (100%) rename {packages => archived_packages}/seeder/.gitignore (100%) rename {packages => archived_packages}/seeder/.travis.yml (100%) rename {packages => archived_packages}/seeder/AUTHORS.md (100%) rename {packages => archived_packages}/seeder/CHANGELOG.md (100%) rename {packages => archived_packages}/seeder/LICENSE (100%) rename {packages => archived_packages}/seeder/README.md (100%) rename {packages => archived_packages}/seeder/analysis_options.yaml (100%) rename {packages => archived_packages}/seeder/lib/angel_seeder.dart (100%) rename {packages => archived_packages}/seeder/pubspec.yaml (100%) rename {packages => archived_packages}/seeder/test/all_test.dart (100%) rename {packages => archived_packages}/typed_service/.gitignore (100%) rename {packages => archived_packages}/typed_service/AUTHORS.md (100%) rename {packages => archived_packages}/typed_service/CHANGELOG.md (100%) rename {packages => archived_packages}/typed_service/LICENSE (100%) rename {packages => archived_packages}/typed_service/README.md (100%) rename {packages => archived_packages}/typed_service/analysis_options.yaml (100%) rename {packages => archived_packages}/typed_service/example/README.md (100%) rename {packages => archived_packages}/typed_service/example/data.json (100%) rename {packages => archived_packages}/typed_service/example/main.dart (100%) rename {packages => archived_packages}/typed_service/lib/angel_typed_service.dart (100%) rename {packages => archived_packages}/typed_service/pubspec.yaml (100%) rename {packages => archived_packages}/typed_service/test/typed_service_test.dart (100%) rename {packages => archived_packages}/wings/.clang-format (100%) rename {packages => archived_packages}/wings/.gitignore (100%) rename {packages => archived_packages}/wings/.gitmodules (100%) rename {packages => archived_packages}/wings/CMakeLists.txt (100%) rename {packages => archived_packages}/wings/LICENSE (100%) rename {packages => archived_packages}/wings/README.md (100%) rename {packages => archived_packages}/wings/Vagrantfile (100%) rename {packages => archived_packages}/wings/analysis_options.yaml (100%) rename {packages => archived_packages}/wings/benchmark/empty.dart (100%) rename {packages => archived_packages}/wings/benchmark/util.dart (100%) rename {packages => archived_packages}/wings/example/main.dart (100%) rename {packages => archived_packages}/wings/example/shared.dart (100%) rename {packages => archived_packages}/wings/example/socket.dart (100%) rename {packages => archived_packages}/wings/lib/angel_wings.dart (100%) rename {packages => archived_packages}/wings/lib/src/CMakeLists.txt (100%) rename {packages => archived_packages}/wings/lib/src/angel_wings.cc (100%) rename {packages => archived_packages}/wings/lib/src/angel_wings.h (100%) rename {packages => archived_packages}/wings/lib/src/bind.cc (100%) rename {packages => archived_packages}/wings/lib/src/http.cc (100%) rename {packages => archived_packages}/wings/lib/src/libangel_wings.dylib (100%) mode change 100755 => 100644 rename {packages => archived_packages}/wings/lib/src/libangel_wings.so (100%) rename {packages => archived_packages}/wings/lib/src/util.cc (100%) rename {packages => archived_packages}/wings/lib/src/wings_driver.dart (100%) rename {packages => archived_packages}/wings/lib/src/wings_request.dart (100%) rename {packages => archived_packages}/wings/lib/src/wings_response.dart (100%) rename {packages => archived_packages}/wings/lib/src/wings_socket.cc (100%) rename {packages => archived_packages}/wings/lib/src/wings_socket.dart (100%) rename {packages => archived_packages}/wings/lib/src/wings_socket.h (100%) rename {packages => archived_packages}/wings/libangel_wings.dylib (100%) mode change 100755 => 100644 rename {packages => archived_packages}/wings/libangel_wings.so (100%) rename {packages => archived_packages}/wings/provision.sh (100%) mode change 100755 => 100644 rename {packages => archived_packages}/wings/pubspec.yaml (100%) rename {packages => archived_packages}/wings/ubuntu-bionic-18.04-cloudimg-console.log (100%) rename {packages => archived_packages}/wings/web/index.html (100%) rename {packages => archived_packages}/wings/web/site.css (100%) create mode 100644 melos.yaml create mode 100644 melos_angel3.iml create mode 100644 packages/auth/melos_angel3_auth.iml create mode 100644 packages/auth_oauth2/melos_angel3_auth_oauth2.iml create mode 100644 packages/cache/melos_angel3_cache.iml create mode 100644 packages/client/melos_angel3_client.iml create mode 100644 packages/configuration/melos_angel3_configuration.iml create mode 100644 packages/container/angel_container/melos_angel3_container.iml create mode 100644 packages/container/angel_container_generator/melos_angel3_container_generator.iml create mode 100644 packages/cors/melos_angel3_cors.iml delete mode 100644 packages/eventsource/.idea/misc.xml delete mode 100644 packages/eventsource/.idea/modules.xml delete mode 100644 packages/eventsource/.idea/runConfigurations/build_dart.xml delete mode 100644 packages/eventsource/.idea/runConfigurations/main_dart.xml delete mode 100644 packages/eventsource/.idea/runConfigurations/watch_dart.xml delete mode 100644 packages/eventsource/.idea/vcs.xml create mode 100644 packages/eventsource/melos_angel_eventsource.iml create mode 100644 packages/file_service/melos_angel3_file_service.iml create mode 100644 packages/framework/melos_angel3_framework.iml create mode 100644 packages/hot/melos_angel3_hot.iml create mode 100644 packages/html/melos_angel3_html.iml create mode 100644 packages/http_exception/melos_angel3_http_exception.iml create mode 100644 packages/jael/angel_jael/melos_angel3_jael.iml create mode 100644 packages/jael/jael/melos_jael3.iml create mode 100644 packages/jael/jael_language_server/melos_jael3_language_server.iml create mode 100644 packages/jael/jael_preprocessor/melos_jael3_preprocessor.iml create mode 100644 packages/jael/jael_web/melos_jael3_web.iml create mode 100644 packages/jinja/melos_angel3_jinja.iml create mode 100644 packages/markdown/melos_angel3_markdown.iml create mode 100644 packages/mock_request/melos_angel3_mock_request.iml create mode 100644 packages/model/melos_angel3_model.iml create mode 100644 packages/mongo/melos_angel3_mongo.iml create mode 100644 packages/mustache/melos_angel3_mustache.iml create mode 100644 packages/oauth2/melos_angel3_oauth2.iml create mode 100644 packages/orm/angel_migration/melos_angel3_migration.iml create mode 100644 packages/orm/angel_migration_runner/melos_angel3_migration_runner.iml create mode 100644 packages/orm/angel_orm/melos_angel3_orm.iml create mode 100644 packages/orm/angel_orm_generator/melos_angel3_orm_generator.iml create mode 100644 packages/orm/angel_orm_mysql/melos_angel3_orm_mysql.iml create mode 100644 packages/orm/angel_orm_postgres/melos_angel3_orm_postgres.iml create mode 100644 packages/orm/angel_orm_service/melos_angel3_orm_service.iml create mode 100644 packages/orm/angel_orm_test/melos_angel3_orm_test.iml create mode 100644 packages/paginate/melos_angel3_paginate.iml delete mode 100644 packages/poll/.idea/misc.xml delete mode 100644 packages/poll/.idea/modules.xml delete mode 100644 packages/poll/.idea/runConfigurations/fires_modified_in_all_test_dart.xml delete mode 100644 packages/poll/.idea/runConfigurations/fires_removed_in_all_test_dart.xml delete mode 100644 packages/poll/.idea/runConfigurations/tests_in_all_test_dart.xml delete mode 100644 packages/poll/.idea/vcs.xml create mode 100644 packages/production/melos_angel3_production.iml create mode 100644 packages/proxy/melos_angel3_proxy.iml create mode 100644 packages/redis/melos_angel3_redis.iml create mode 100644 packages/rethink/melos_angel_rethink.iml create mode 100644 packages/route/melos_angel3_route.iml create mode 100644 packages/security/melos_angel3_security.iml create mode 100644 packages/sembast/melos_angel3_sembast.iml create mode 100644 packages/seo/melos_angel3_seo.iml create mode 100644 packages/serialize/angel_serialize/melos_angel3_serialize.iml create mode 100644 packages/serialize/angel_serialize_generator/melos_angel3_serialize_generator.iml create mode 100644 packages/shelf/melos_angel3_shelf.iml create mode 100644 packages/static/melos_angel3_static.iml create mode 100644 packages/sync/melos_angel3_sync.iml create mode 100644 packages/test/melos_angel3_test.iml create mode 100644 packages/user_agent/angel_user_agent/melos_angel3_user_agent.iml create mode 100644 packages/validate/melos_angel3_validate.iml create mode 100644 packages/websocket/melos_angel3_websocket.iml delete mode 160000 packages/wings/cmake_dart_utils delete mode 160000 packages/wings/lib/src/http-parser diff --git a/packages/auth_twitter/.gitignore b/archived_packages/auth_twitter/.gitignore similarity index 100% rename from packages/auth_twitter/.gitignore rename to archived_packages/auth_twitter/.gitignore diff --git a/packages/auth_twitter/CHANGELOG.md b/archived_packages/auth_twitter/CHANGELOG.md similarity index 100% rename from packages/auth_twitter/CHANGELOG.md rename to archived_packages/auth_twitter/CHANGELOG.md diff --git a/packages/auth_twitter/LICENSE b/archived_packages/auth_twitter/LICENSE similarity index 100% rename from packages/auth_twitter/LICENSE rename to archived_packages/auth_twitter/LICENSE diff --git a/packages/auth_twitter/README.md b/archived_packages/auth_twitter/README.md similarity index 100% rename from packages/auth_twitter/README.md rename to archived_packages/auth_twitter/README.md diff --git a/packages/auth_twitter/analysis_options.yaml b/archived_packages/auth_twitter/analysis_options.yaml similarity index 100% rename from packages/auth_twitter/analysis_options.yaml rename to archived_packages/auth_twitter/analysis_options.yaml diff --git a/packages/auth_twitter/example/main.dart b/archived_packages/auth_twitter/example/main.dart similarity index 100% rename from packages/auth_twitter/example/main.dart rename to archived_packages/auth_twitter/example/main.dart diff --git a/packages/auth_twitter/lib/angel_auth_twitter.dart b/archived_packages/auth_twitter/lib/angel_auth_twitter.dart similarity index 100% rename from packages/auth_twitter/lib/angel_auth_twitter.dart rename to archived_packages/auth_twitter/lib/angel_auth_twitter.dart diff --git a/packages/auth_twitter/pubspec.yaml b/archived_packages/auth_twitter/pubspec.yaml similarity index 100% rename from packages/auth_twitter/pubspec.yaml rename to archived_packages/auth_twitter/pubspec.yaml diff --git a/packages/eventsource/.gitignore b/archived_packages/eventsource/.gitignore similarity index 100% rename from packages/eventsource/.gitignore rename to archived_packages/eventsource/.gitignore diff --git a/packages/eventsource/LICENSE b/archived_packages/eventsource/LICENSE similarity index 100% rename from packages/eventsource/LICENSE rename to archived_packages/eventsource/LICENSE diff --git a/packages/eventsource/README.md b/archived_packages/eventsource/README.md similarity index 100% rename from packages/eventsource/README.md rename to archived_packages/eventsource/README.md diff --git a/packages/eventsource/analysis_options.yaml b/archived_packages/eventsource/analysis_options.yaml similarity index 100% rename from packages/eventsource/analysis_options.yaml rename to archived_packages/eventsource/analysis_options.yaml diff --git a/packages/eventsource/eventsource.iml b/archived_packages/eventsource/eventsource.iml similarity index 100% rename from packages/eventsource/eventsource.iml rename to archived_packages/eventsource/eventsource.iml diff --git a/packages/eventsource/example/main.dart b/archived_packages/eventsource/example/main.dart similarity index 100% rename from packages/eventsource/example/main.dart rename to archived_packages/eventsource/example/main.dart diff --git a/packages/eventsource/example/pretty_logging.dart b/archived_packages/eventsource/example/pretty_logging.dart similarity index 100% rename from packages/eventsource/example/pretty_logging.dart rename to archived_packages/eventsource/example/pretty_logging.dart diff --git a/packages/eventsource/lib/angel_eventsource.dart b/archived_packages/eventsource/lib/angel_eventsource.dart similarity index 100% rename from packages/eventsource/lib/angel_eventsource.dart rename to archived_packages/eventsource/lib/angel_eventsource.dart diff --git a/packages/eventsource/lib/server.dart b/archived_packages/eventsource/lib/server.dart similarity index 100% rename from packages/eventsource/lib/server.dart rename to archived_packages/eventsource/lib/server.dart diff --git a/packages/eventsource/pubspec.yaml b/archived_packages/eventsource/pubspec.yaml similarity index 100% rename from packages/eventsource/pubspec.yaml rename to archived_packages/eventsource/pubspec.yaml diff --git a/packages/orm/angel_orm_sqlite/LICENSE b/archived_packages/orm/angel_orm_sqlite/LICENSE similarity index 100% rename from packages/orm/angel_orm_sqlite/LICENSE rename to archived_packages/orm/angel_orm_sqlite/LICENSE diff --git a/packages/orm/angel_orm_sqlite/mono_pkg.yaml b/archived_packages/orm/angel_orm_sqlite/mono_pkg.yaml similarity index 100% rename from packages/orm/angel_orm_sqlite/mono_pkg.yaml rename to archived_packages/orm/angel_orm_sqlite/mono_pkg.yaml diff --git a/packages/orm/angel_orm_sqlite/pubspec.yaml b/archived_packages/orm/angel_orm_sqlite/pubspec.yaml old mode 100755 new mode 100644 similarity index 100% rename from packages/orm/angel_orm_sqlite/pubspec.yaml rename to archived_packages/orm/angel_orm_sqlite/pubspec.yaml diff --git a/packages/poll/.gitignore b/archived_packages/poll/.gitignore similarity index 100% rename from packages/poll/.gitignore rename to archived_packages/poll/.gitignore diff --git a/packages/poll/.travis.yml b/archived_packages/poll/.travis.yml similarity index 100% rename from packages/poll/.travis.yml rename to archived_packages/poll/.travis.yml diff --git a/packages/poll/AUTHORS.md b/archived_packages/poll/AUTHORS.md similarity index 100% rename from packages/poll/AUTHORS.md rename to archived_packages/poll/AUTHORS.md diff --git a/packages/poll/CHANGELOG.md b/archived_packages/poll/CHANGELOG.md similarity index 100% rename from packages/poll/CHANGELOG.md rename to archived_packages/poll/CHANGELOG.md diff --git a/packages/poll/LICENSE b/archived_packages/poll/LICENSE similarity index 100% rename from packages/poll/LICENSE rename to archived_packages/poll/LICENSE diff --git a/packages/poll/README.md b/archived_packages/poll/README.md similarity index 100% rename from packages/poll/README.md rename to archived_packages/poll/README.md diff --git a/packages/poll/analysis_options.yaml b/archived_packages/poll/analysis_options.yaml similarity index 100% rename from packages/poll/analysis_options.yaml rename to archived_packages/poll/analysis_options.yaml diff --git a/packages/poll/example/main.dart b/archived_packages/poll/example/main.dart similarity index 100% rename from packages/poll/example/main.dart rename to archived_packages/poll/example/main.dart diff --git a/packages/poll/lib/angel_poll.dart b/archived_packages/poll/lib/angel_poll.dart similarity index 100% rename from packages/poll/lib/angel_poll.dart rename to archived_packages/poll/lib/angel_poll.dart diff --git a/packages/poll/poll.iml b/archived_packages/poll/poll.iml similarity index 100% rename from packages/poll/poll.iml rename to archived_packages/poll/poll.iml diff --git a/packages/poll/pubspec.yaml b/archived_packages/poll/pubspec.yaml similarity index 100% rename from packages/poll/pubspec.yaml rename to archived_packages/poll/pubspec.yaml diff --git a/packages/poll/test/all_test.dart b/archived_packages/poll/test/all_test.dart similarity index 100% rename from packages/poll/test/all_test.dart rename to archived_packages/poll/test/all_test.dart diff --git a/packages/relations/.gitignore b/archived_packages/relations/.gitignore similarity index 100% rename from packages/relations/.gitignore rename to archived_packages/relations/.gitignore diff --git a/packages/relations/.travis.yml b/archived_packages/relations/.travis.yml similarity index 100% rename from packages/relations/.travis.yml rename to archived_packages/relations/.travis.yml diff --git a/packages/relations/AUTHORS.md b/archived_packages/relations/AUTHORS.md similarity index 100% rename from packages/relations/AUTHORS.md rename to archived_packages/relations/AUTHORS.md diff --git a/packages/relations/CHANGELOG.md b/archived_packages/relations/CHANGELOG.md similarity index 100% rename from packages/relations/CHANGELOG.md rename to archived_packages/relations/CHANGELOG.md diff --git a/packages/relations/LICENSE b/archived_packages/relations/LICENSE similarity index 100% rename from packages/relations/LICENSE rename to archived_packages/relations/LICENSE diff --git a/packages/relations/README.md b/archived_packages/relations/README.md similarity index 100% rename from packages/relations/README.md rename to archived_packages/relations/README.md diff --git a/packages/relations/analysis_options.yaml b/archived_packages/relations/analysis_options.yaml similarity index 100% rename from packages/relations/analysis_options.yaml rename to archived_packages/relations/analysis_options.yaml diff --git a/packages/relations/lib/angel_relations.dart b/archived_packages/relations/lib/angel_relations.dart similarity index 100% rename from packages/relations/lib/angel_relations.dart rename to archived_packages/relations/lib/angel_relations.dart diff --git a/packages/relations/lib/src/belongs_to.dart b/archived_packages/relations/lib/src/belongs_to.dart similarity index 100% rename from packages/relations/lib/src/belongs_to.dart rename to archived_packages/relations/lib/src/belongs_to.dart diff --git a/packages/relations/lib/src/belongs_to_many.dart b/archived_packages/relations/lib/src/belongs_to_many.dart similarity index 100% rename from packages/relations/lib/src/belongs_to_many.dart rename to archived_packages/relations/lib/src/belongs_to_many.dart diff --git a/packages/relations/lib/src/has_many.dart b/archived_packages/relations/lib/src/has_many.dart similarity index 100% rename from packages/relations/lib/src/has_many.dart rename to archived_packages/relations/lib/src/has_many.dart diff --git a/packages/relations/lib/src/has_many_through.dart b/archived_packages/relations/lib/src/has_many_through.dart similarity index 100% rename from packages/relations/lib/src/has_many_through.dart rename to archived_packages/relations/lib/src/has_many_through.dart diff --git a/packages/relations/lib/src/has_one.dart b/archived_packages/relations/lib/src/has_one.dart similarity index 100% rename from packages/relations/lib/src/has_one.dart rename to archived_packages/relations/lib/src/has_one.dart diff --git a/packages/relations/lib/src/no_service.dart b/archived_packages/relations/lib/src/no_service.dart similarity index 100% rename from packages/relations/lib/src/no_service.dart rename to archived_packages/relations/lib/src/no_service.dart diff --git a/packages/relations/lib/src/plural.dart b/archived_packages/relations/lib/src/plural.dart similarity index 100% rename from packages/relations/lib/src/plural.dart rename to archived_packages/relations/lib/src/plural.dart diff --git a/packages/relations/pubspec.yaml b/archived_packages/relations/pubspec.yaml similarity index 100% rename from packages/relations/pubspec.yaml rename to archived_packages/relations/pubspec.yaml diff --git a/packages/relations/test/belongs_to_test.dart b/archived_packages/relations/test/belongs_to_test.dart similarity index 100% rename from packages/relations/test/belongs_to_test.dart rename to archived_packages/relations/test/belongs_to_test.dart diff --git a/packages/relations/test/common.dart b/archived_packages/relations/test/common.dart similarity index 100% rename from packages/relations/test/common.dart rename to archived_packages/relations/test/common.dart diff --git a/packages/relations/test/has_many_test.dart b/archived_packages/relations/test/has_many_test.dart similarity index 100% rename from packages/relations/test/has_many_test.dart rename to archived_packages/relations/test/has_many_test.dart diff --git a/packages/relations/test/has_one_test.dart b/archived_packages/relations/test/has_one_test.dart similarity index 100% rename from packages/relations/test/has_one_test.dart rename to archived_packages/relations/test/has_one_test.dart diff --git a/packages/rethink/.gitignore b/archived_packages/rethink/.gitignore similarity index 100% rename from packages/rethink/.gitignore rename to archived_packages/rethink/.gitignore diff --git a/packages/rethink/.travis.yml b/archived_packages/rethink/.travis.yml similarity index 100% rename from packages/rethink/.travis.yml rename to archived_packages/rethink/.travis.yml diff --git a/packages/rethink/AUTHORS.md b/archived_packages/rethink/AUTHORS.md similarity index 100% rename from packages/rethink/AUTHORS.md rename to archived_packages/rethink/AUTHORS.md diff --git a/packages/rethink/CHANGELOG.md b/archived_packages/rethink/CHANGELOG.md similarity index 100% rename from packages/rethink/CHANGELOG.md rename to archived_packages/rethink/CHANGELOG.md diff --git a/packages/rethink/LICENSE b/archived_packages/rethink/LICENSE similarity index 100% rename from packages/rethink/LICENSE rename to archived_packages/rethink/LICENSE diff --git a/packages/rethink/README.md b/archived_packages/rethink/README.md similarity index 100% rename from packages/rethink/README.md rename to archived_packages/rethink/README.md diff --git a/packages/rethink/analysis_options.yaml b/archived_packages/rethink/analysis_options.yaml similarity index 100% rename from packages/rethink/analysis_options.yaml rename to archived_packages/rethink/analysis_options.yaml diff --git a/packages/rethink/lib/angel_rethink.dart b/archived_packages/rethink/lib/angel_rethink.dart similarity index 100% rename from packages/rethink/lib/angel_rethink.dart rename to archived_packages/rethink/lib/angel_rethink.dart diff --git a/packages/rethink/lib/src/rethink_service.dart b/archived_packages/rethink/lib/src/rethink_service.dart similarity index 100% rename from packages/rethink/lib/src/rethink_service.dart rename to archived_packages/rethink/lib/src/rethink_service.dart diff --git a/packages/rethink/pubspec.yaml b/archived_packages/rethink/pubspec.yaml similarity index 100% rename from packages/rethink/pubspec.yaml rename to archived_packages/rethink/pubspec.yaml diff --git a/packages/rethink/test/README.md b/archived_packages/rethink/test/README.md similarity index 100% rename from packages/rethink/test/README.md rename to archived_packages/rethink/test/README.md diff --git a/packages/rethink/test/bootstrap.dart b/archived_packages/rethink/test/bootstrap.dart similarity index 100% rename from packages/rethink/test/bootstrap.dart rename to archived_packages/rethink/test/bootstrap.dart diff --git a/packages/rethink/test/common.dart b/archived_packages/rethink/test/common.dart similarity index 100% rename from packages/rethink/test/common.dart rename to archived_packages/rethink/test/common.dart diff --git a/packages/rethink/test/generic_test.dart b/archived_packages/rethink/test/generic_test.dart similarity index 100% rename from packages/rethink/test/generic_test.dart rename to archived_packages/rethink/test/generic_test.dart diff --git a/packages/seeder/.gitignore b/archived_packages/seeder/.gitignore similarity index 100% rename from packages/seeder/.gitignore rename to archived_packages/seeder/.gitignore diff --git a/packages/seeder/.travis.yml b/archived_packages/seeder/.travis.yml similarity index 100% rename from packages/seeder/.travis.yml rename to archived_packages/seeder/.travis.yml diff --git a/packages/seeder/AUTHORS.md b/archived_packages/seeder/AUTHORS.md similarity index 100% rename from packages/seeder/AUTHORS.md rename to archived_packages/seeder/AUTHORS.md diff --git a/packages/seeder/CHANGELOG.md b/archived_packages/seeder/CHANGELOG.md similarity index 100% rename from packages/seeder/CHANGELOG.md rename to archived_packages/seeder/CHANGELOG.md diff --git a/packages/seeder/LICENSE b/archived_packages/seeder/LICENSE similarity index 100% rename from packages/seeder/LICENSE rename to archived_packages/seeder/LICENSE diff --git a/packages/seeder/README.md b/archived_packages/seeder/README.md similarity index 100% rename from packages/seeder/README.md rename to archived_packages/seeder/README.md diff --git a/packages/seeder/analysis_options.yaml b/archived_packages/seeder/analysis_options.yaml similarity index 100% rename from packages/seeder/analysis_options.yaml rename to archived_packages/seeder/analysis_options.yaml diff --git a/packages/seeder/lib/angel_seeder.dart b/archived_packages/seeder/lib/angel_seeder.dart similarity index 100% rename from packages/seeder/lib/angel_seeder.dart rename to archived_packages/seeder/lib/angel_seeder.dart diff --git a/packages/seeder/pubspec.yaml b/archived_packages/seeder/pubspec.yaml similarity index 100% rename from packages/seeder/pubspec.yaml rename to archived_packages/seeder/pubspec.yaml diff --git a/packages/seeder/test/all_test.dart b/archived_packages/seeder/test/all_test.dart similarity index 100% rename from packages/seeder/test/all_test.dart rename to archived_packages/seeder/test/all_test.dart diff --git a/packages/typed_service/.gitignore b/archived_packages/typed_service/.gitignore similarity index 100% rename from packages/typed_service/.gitignore rename to archived_packages/typed_service/.gitignore diff --git a/packages/typed_service/AUTHORS.md b/archived_packages/typed_service/AUTHORS.md similarity index 100% rename from packages/typed_service/AUTHORS.md rename to archived_packages/typed_service/AUTHORS.md diff --git a/packages/typed_service/CHANGELOG.md b/archived_packages/typed_service/CHANGELOG.md similarity index 100% rename from packages/typed_service/CHANGELOG.md rename to archived_packages/typed_service/CHANGELOG.md diff --git a/packages/typed_service/LICENSE b/archived_packages/typed_service/LICENSE similarity index 100% rename from packages/typed_service/LICENSE rename to archived_packages/typed_service/LICENSE diff --git a/packages/typed_service/README.md b/archived_packages/typed_service/README.md similarity index 100% rename from packages/typed_service/README.md rename to archived_packages/typed_service/README.md diff --git a/packages/typed_service/analysis_options.yaml b/archived_packages/typed_service/analysis_options.yaml similarity index 100% rename from packages/typed_service/analysis_options.yaml rename to archived_packages/typed_service/analysis_options.yaml diff --git a/packages/typed_service/example/README.md b/archived_packages/typed_service/example/README.md similarity index 100% rename from packages/typed_service/example/README.md rename to archived_packages/typed_service/example/README.md diff --git a/packages/typed_service/example/data.json b/archived_packages/typed_service/example/data.json similarity index 100% rename from packages/typed_service/example/data.json rename to archived_packages/typed_service/example/data.json diff --git a/packages/typed_service/example/main.dart b/archived_packages/typed_service/example/main.dart similarity index 100% rename from packages/typed_service/example/main.dart rename to archived_packages/typed_service/example/main.dart diff --git a/packages/typed_service/lib/angel_typed_service.dart b/archived_packages/typed_service/lib/angel_typed_service.dart similarity index 100% rename from packages/typed_service/lib/angel_typed_service.dart rename to archived_packages/typed_service/lib/angel_typed_service.dart diff --git a/packages/typed_service/pubspec.yaml b/archived_packages/typed_service/pubspec.yaml similarity index 100% rename from packages/typed_service/pubspec.yaml rename to archived_packages/typed_service/pubspec.yaml diff --git a/packages/typed_service/test/typed_service_test.dart b/archived_packages/typed_service/test/typed_service_test.dart similarity index 100% rename from packages/typed_service/test/typed_service_test.dart rename to archived_packages/typed_service/test/typed_service_test.dart diff --git a/packages/wings/.clang-format b/archived_packages/wings/.clang-format similarity index 100% rename from packages/wings/.clang-format rename to archived_packages/wings/.clang-format diff --git a/packages/wings/.gitignore b/archived_packages/wings/.gitignore similarity index 100% rename from packages/wings/.gitignore rename to archived_packages/wings/.gitignore diff --git a/packages/wings/.gitmodules b/archived_packages/wings/.gitmodules similarity index 100% rename from packages/wings/.gitmodules rename to archived_packages/wings/.gitmodules diff --git a/packages/wings/CMakeLists.txt b/archived_packages/wings/CMakeLists.txt similarity index 100% rename from packages/wings/CMakeLists.txt rename to archived_packages/wings/CMakeLists.txt diff --git a/packages/wings/LICENSE b/archived_packages/wings/LICENSE similarity index 100% rename from packages/wings/LICENSE rename to archived_packages/wings/LICENSE diff --git a/packages/wings/README.md b/archived_packages/wings/README.md similarity index 100% rename from packages/wings/README.md rename to archived_packages/wings/README.md diff --git a/packages/wings/Vagrantfile b/archived_packages/wings/Vagrantfile similarity index 100% rename from packages/wings/Vagrantfile rename to archived_packages/wings/Vagrantfile diff --git a/packages/wings/analysis_options.yaml b/archived_packages/wings/analysis_options.yaml similarity index 100% rename from packages/wings/analysis_options.yaml rename to archived_packages/wings/analysis_options.yaml diff --git a/packages/wings/benchmark/empty.dart b/archived_packages/wings/benchmark/empty.dart similarity index 100% rename from packages/wings/benchmark/empty.dart rename to archived_packages/wings/benchmark/empty.dart diff --git a/packages/wings/benchmark/util.dart b/archived_packages/wings/benchmark/util.dart similarity index 100% rename from packages/wings/benchmark/util.dart rename to archived_packages/wings/benchmark/util.dart diff --git a/packages/wings/example/main.dart b/archived_packages/wings/example/main.dart similarity index 100% rename from packages/wings/example/main.dart rename to archived_packages/wings/example/main.dart diff --git a/packages/wings/example/shared.dart b/archived_packages/wings/example/shared.dart similarity index 100% rename from packages/wings/example/shared.dart rename to archived_packages/wings/example/shared.dart diff --git a/packages/wings/example/socket.dart b/archived_packages/wings/example/socket.dart similarity index 100% rename from packages/wings/example/socket.dart rename to archived_packages/wings/example/socket.dart diff --git a/packages/wings/lib/angel_wings.dart b/archived_packages/wings/lib/angel_wings.dart similarity index 100% rename from packages/wings/lib/angel_wings.dart rename to archived_packages/wings/lib/angel_wings.dart diff --git a/packages/wings/lib/src/CMakeLists.txt b/archived_packages/wings/lib/src/CMakeLists.txt similarity index 100% rename from packages/wings/lib/src/CMakeLists.txt rename to archived_packages/wings/lib/src/CMakeLists.txt diff --git a/packages/wings/lib/src/angel_wings.cc b/archived_packages/wings/lib/src/angel_wings.cc similarity index 100% rename from packages/wings/lib/src/angel_wings.cc rename to archived_packages/wings/lib/src/angel_wings.cc diff --git a/packages/wings/lib/src/angel_wings.h b/archived_packages/wings/lib/src/angel_wings.h similarity index 100% rename from packages/wings/lib/src/angel_wings.h rename to archived_packages/wings/lib/src/angel_wings.h diff --git a/packages/wings/lib/src/bind.cc b/archived_packages/wings/lib/src/bind.cc similarity index 100% rename from packages/wings/lib/src/bind.cc rename to archived_packages/wings/lib/src/bind.cc diff --git a/packages/wings/lib/src/http.cc b/archived_packages/wings/lib/src/http.cc similarity index 100% rename from packages/wings/lib/src/http.cc rename to archived_packages/wings/lib/src/http.cc diff --git a/packages/wings/lib/src/libangel_wings.dylib b/archived_packages/wings/lib/src/libangel_wings.dylib old mode 100755 new mode 100644 similarity index 100% rename from packages/wings/lib/src/libangel_wings.dylib rename to archived_packages/wings/lib/src/libangel_wings.dylib diff --git a/packages/wings/lib/src/libangel_wings.so b/archived_packages/wings/lib/src/libangel_wings.so similarity index 100% rename from packages/wings/lib/src/libangel_wings.so rename to archived_packages/wings/lib/src/libangel_wings.so diff --git a/packages/wings/lib/src/util.cc b/archived_packages/wings/lib/src/util.cc similarity index 100% rename from packages/wings/lib/src/util.cc rename to archived_packages/wings/lib/src/util.cc diff --git a/packages/wings/lib/src/wings_driver.dart b/archived_packages/wings/lib/src/wings_driver.dart similarity index 100% rename from packages/wings/lib/src/wings_driver.dart rename to archived_packages/wings/lib/src/wings_driver.dart diff --git a/packages/wings/lib/src/wings_request.dart b/archived_packages/wings/lib/src/wings_request.dart similarity index 100% rename from packages/wings/lib/src/wings_request.dart rename to archived_packages/wings/lib/src/wings_request.dart diff --git a/packages/wings/lib/src/wings_response.dart b/archived_packages/wings/lib/src/wings_response.dart similarity index 100% rename from packages/wings/lib/src/wings_response.dart rename to archived_packages/wings/lib/src/wings_response.dart diff --git a/packages/wings/lib/src/wings_socket.cc b/archived_packages/wings/lib/src/wings_socket.cc similarity index 100% rename from packages/wings/lib/src/wings_socket.cc rename to archived_packages/wings/lib/src/wings_socket.cc diff --git a/packages/wings/lib/src/wings_socket.dart b/archived_packages/wings/lib/src/wings_socket.dart similarity index 100% rename from packages/wings/lib/src/wings_socket.dart rename to archived_packages/wings/lib/src/wings_socket.dart diff --git a/packages/wings/lib/src/wings_socket.h b/archived_packages/wings/lib/src/wings_socket.h similarity index 100% rename from packages/wings/lib/src/wings_socket.h rename to archived_packages/wings/lib/src/wings_socket.h diff --git a/packages/wings/libangel_wings.dylib b/archived_packages/wings/libangel_wings.dylib old mode 100755 new mode 100644 similarity index 100% rename from packages/wings/libangel_wings.dylib rename to archived_packages/wings/libangel_wings.dylib diff --git a/packages/wings/libangel_wings.so b/archived_packages/wings/libangel_wings.so similarity index 100% rename from packages/wings/libangel_wings.so rename to archived_packages/wings/libangel_wings.so diff --git a/packages/wings/provision.sh b/archived_packages/wings/provision.sh old mode 100755 new mode 100644 similarity index 100% rename from packages/wings/provision.sh rename to archived_packages/wings/provision.sh diff --git a/packages/wings/pubspec.yaml b/archived_packages/wings/pubspec.yaml similarity index 100% rename from packages/wings/pubspec.yaml rename to archived_packages/wings/pubspec.yaml diff --git a/packages/wings/ubuntu-bionic-18.04-cloudimg-console.log b/archived_packages/wings/ubuntu-bionic-18.04-cloudimg-console.log similarity index 100% rename from packages/wings/ubuntu-bionic-18.04-cloudimg-console.log rename to archived_packages/wings/ubuntu-bionic-18.04-cloudimg-console.log diff --git a/packages/wings/web/index.html b/archived_packages/wings/web/index.html similarity index 100% rename from packages/wings/web/index.html rename to archived_packages/wings/web/index.html diff --git a/packages/wings/web/site.css b/archived_packages/wings/web/site.css similarity index 100% rename from packages/wings/web/site.css rename to archived_packages/wings/web/site.css diff --git a/melos.yaml b/melos.yaml new file mode 100644 index 00000000..f44da0aa --- /dev/null +++ b/melos.yaml @@ -0,0 +1,10 @@ +name: angel3 + +packages: + - packages/** + +ignore: + - "packages/auth_twitter" + +#scripts: +# analyze: melos exec -- "dart analyze ." \ No newline at end of file diff --git a/melos_angel3.iml b/melos_angel3.iml new file mode 100644 index 00000000..96815595 --- /dev/null +++ b/melos_angel3.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/packages/auth/melos_angel3_auth.iml b/packages/auth/melos_angel3_auth.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/auth/melos_angel3_auth.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/auth_oauth2/melos_angel3_auth_oauth2.iml b/packages/auth_oauth2/melos_angel3_auth_oauth2.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/auth_oauth2/melos_angel3_auth_oauth2.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/cache/melos_angel3_cache.iml b/packages/cache/melos_angel3_cache.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/cache/melos_angel3_cache.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/client/melos_angel3_client.iml b/packages/client/melos_angel3_client.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/client/melos_angel3_client.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/configuration/melos_angel3_configuration.iml b/packages/configuration/melos_angel3_configuration.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/configuration/melos_angel3_configuration.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/container/angel_container/melos_angel3_container.iml b/packages/container/angel_container/melos_angel3_container.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/container/angel_container/melos_angel3_container.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/container/angel_container_generator/melos_angel3_container_generator.iml b/packages/container/angel_container_generator/melos_angel3_container_generator.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/container/angel_container_generator/melos_angel3_container_generator.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/cors/melos_angel3_cors.iml b/packages/cors/melos_angel3_cors.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/cors/melos_angel3_cors.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/eventsource/.idea/misc.xml b/packages/eventsource/.idea/misc.xml deleted file mode 100644 index 639900d1..00000000 --- a/packages/eventsource/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/eventsource/.idea/modules.xml b/packages/eventsource/.idea/modules.xml deleted file mode 100644 index 2e3efb43..00000000 --- a/packages/eventsource/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/packages/eventsource/.idea/runConfigurations/build_dart.xml b/packages/eventsource/.idea/runConfigurations/build_dart.xml deleted file mode 100644 index 7bbffc56..00000000 --- a/packages/eventsource/.idea/runConfigurations/build_dart.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/packages/eventsource/.idea/runConfigurations/main_dart.xml b/packages/eventsource/.idea/runConfigurations/main_dart.xml deleted file mode 100644 index 750f7262..00000000 --- a/packages/eventsource/.idea/runConfigurations/main_dart.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/eventsource/.idea/runConfigurations/watch_dart.xml b/packages/eventsource/.idea/runConfigurations/watch_dart.xml deleted file mode 100644 index 7cd7173c..00000000 --- a/packages/eventsource/.idea/runConfigurations/watch_dart.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/packages/eventsource/.idea/vcs.xml b/packages/eventsource/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/packages/eventsource/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/eventsource/melos_angel_eventsource.iml b/packages/eventsource/melos_angel_eventsource.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/eventsource/melos_angel_eventsource.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/file_service/melos_angel3_file_service.iml b/packages/file_service/melos_angel3_file_service.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/file_service/melos_angel3_file_service.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/framework/melos_angel3_framework.iml b/packages/framework/melos_angel3_framework.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/framework/melos_angel3_framework.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/hot/melos_angel3_hot.iml b/packages/hot/melos_angel3_hot.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/hot/melos_angel3_hot.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/html/melos_angel3_html.iml b/packages/html/melos_angel3_html.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/html/melos_angel3_html.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/http_exception/melos_angel3_http_exception.iml b/packages/http_exception/melos_angel3_http_exception.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/http_exception/melos_angel3_http_exception.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jael/angel_jael/melos_angel3_jael.iml b/packages/jael/angel_jael/melos_angel3_jael.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jael/angel_jael/melos_angel3_jael.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jael/jael/melos_jael3.iml b/packages/jael/jael/melos_jael3.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jael/jael/melos_jael3.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jael/jael_language_server/melos_jael3_language_server.iml b/packages/jael/jael_language_server/melos_jael3_language_server.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jael/jael_language_server/melos_jael3_language_server.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jael/jael_preprocessor/melos_jael3_preprocessor.iml b/packages/jael/jael_preprocessor/melos_jael3_preprocessor.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jael/jael_preprocessor/melos_jael3_preprocessor.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jael/jael_web/melos_jael3_web.iml b/packages/jael/jael_web/melos_jael3_web.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jael/jael_web/melos_jael3_web.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jinja/melos_angel3_jinja.iml b/packages/jinja/melos_angel3_jinja.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/jinja/melos_angel3_jinja.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/markdown/melos_angel3_markdown.iml b/packages/markdown/melos_angel3_markdown.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/markdown/melos_angel3_markdown.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/mock_request/melos_angel3_mock_request.iml b/packages/mock_request/melos_angel3_mock_request.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/mock_request/melos_angel3_mock_request.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/model/melos_angel3_model.iml b/packages/model/melos_angel3_model.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/model/melos_angel3_model.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/mongo/melos_angel3_mongo.iml b/packages/mongo/melos_angel3_mongo.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/mongo/melos_angel3_mongo.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/mustache/melos_angel3_mustache.iml b/packages/mustache/melos_angel3_mustache.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/mustache/melos_angel3_mustache.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/oauth2/melos_angel3_oauth2.iml b/packages/oauth2/melos_angel3_oauth2.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/oauth2/melos_angel3_oauth2.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_migration/melos_angel3_migration.iml b/packages/orm/angel_migration/melos_angel3_migration.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_migration/melos_angel3_migration.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_migration_runner/melos_angel3_migration_runner.iml b/packages/orm/angel_migration_runner/melos_angel3_migration_runner.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_migration_runner/melos_angel3_migration_runner.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm/melos_angel3_orm.iml b/packages/orm/angel_orm/melos_angel3_orm.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm/melos_angel3_orm.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm_generator/melos_angel3_orm_generator.iml b/packages/orm/angel_orm_generator/melos_angel3_orm_generator.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm_generator/melos_angel3_orm_generator.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm_mysql/melos_angel3_orm_mysql.iml b/packages/orm/angel_orm_mysql/melos_angel3_orm_mysql.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm_mysql/melos_angel3_orm_mysql.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm_postgres/melos_angel3_orm_postgres.iml b/packages/orm/angel_orm_postgres/melos_angel3_orm_postgres.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm_postgres/melos_angel3_orm_postgres.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm_service/melos_angel3_orm_service.iml b/packages/orm/angel_orm_service/melos_angel3_orm_service.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm_service/melos_angel3_orm_service.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/orm/angel_orm_test/melos_angel3_orm_test.iml b/packages/orm/angel_orm_test/melos_angel3_orm_test.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/orm/angel_orm_test/melos_angel3_orm_test.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/paginate/melos_angel3_paginate.iml b/packages/paginate/melos_angel3_paginate.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/paginate/melos_angel3_paginate.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/poll/.idea/misc.xml b/packages/poll/.idea/misc.xml deleted file mode 100644 index 639900d1..00000000 --- a/packages/poll/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/poll/.idea/modules.xml b/packages/poll/.idea/modules.xml deleted file mode 100644 index f6374af3..00000000 --- a/packages/poll/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/packages/poll/.idea/runConfigurations/fires_modified_in_all_test_dart.xml b/packages/poll/.idea/runConfigurations/fires_modified_in_all_test_dart.xml deleted file mode 100644 index 5f69f16d..00000000 --- a/packages/poll/.idea/runConfigurations/fires_modified_in_all_test_dart.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/poll/.idea/runConfigurations/fires_removed_in_all_test_dart.xml b/packages/poll/.idea/runConfigurations/fires_removed_in_all_test_dart.xml deleted file mode 100644 index cff1a811..00000000 --- a/packages/poll/.idea/runConfigurations/fires_removed_in_all_test_dart.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/poll/.idea/runConfigurations/tests_in_all_test_dart.xml b/packages/poll/.idea/runConfigurations/tests_in_all_test_dart.xml deleted file mode 100644 index dd79afb1..00000000 --- a/packages/poll/.idea/runConfigurations/tests_in_all_test_dart.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/poll/.idea/vcs.xml b/packages/poll/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/packages/poll/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index 9b97d238..f9dd1d4c 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -55,7 +55,8 @@ _ ___ | /| / / /_/ / _ /___ _ /___ '''; - static DateFormat _defaultDateFormat = DateFormat('yyyy-MM-dd HH:mm:ss'); + static final DateFormat _defaultDateFormat = + DateFormat('yyyy-MM-dd HH:mm:ss'); /// LogRecord handler static void handleLogRecord(LogRecord? record, RunnerOptions options) { diff --git a/packages/production/melos_angel3_production.iml b/packages/production/melos_angel3_production.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/production/melos_angel3_production.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/proxy/melos_angel3_proxy.iml b/packages/proxy/melos_angel3_proxy.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/proxy/melos_angel3_proxy.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/redis/melos_angel3_redis.iml b/packages/redis/melos_angel3_redis.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/redis/melos_angel3_redis.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/rethink/melos_angel_rethink.iml b/packages/rethink/melos_angel_rethink.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/rethink/melos_angel_rethink.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/route/melos_angel3_route.iml b/packages/route/melos_angel3_route.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/route/melos_angel3_route.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/security/melos_angel3_security.iml b/packages/security/melos_angel3_security.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/security/melos_angel3_security.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/sembast/melos_angel3_sembast.iml b/packages/sembast/melos_angel3_sembast.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/sembast/melos_angel3_sembast.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/seo/melos_angel3_seo.iml b/packages/seo/melos_angel3_seo.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/seo/melos_angel3_seo.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/serialize/angel_serialize/melos_angel3_serialize.iml b/packages/serialize/angel_serialize/melos_angel3_serialize.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/serialize/angel_serialize/melos_angel3_serialize.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/serialize/angel_serialize_generator/melos_angel3_serialize_generator.iml b/packages/serialize/angel_serialize_generator/melos_angel3_serialize_generator.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/serialize/angel_serialize_generator/melos_angel3_serialize_generator.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/shelf/melos_angel3_shelf.iml b/packages/shelf/melos_angel3_shelf.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/shelf/melos_angel3_shelf.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/static/melos_angel3_static.iml b/packages/static/melos_angel3_static.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/static/melos_angel3_static.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/sync/melos_angel3_sync.iml b/packages/sync/melos_angel3_sync.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/sync/melos_angel3_sync.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/test/melos_angel3_test.iml b/packages/test/melos_angel3_test.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/test/melos_angel3_test.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/user_agent/angel_user_agent/melos_angel3_user_agent.iml b/packages/user_agent/angel_user_agent/melos_angel3_user_agent.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/user_agent/angel_user_agent/melos_angel3_user_agent.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/validate/melos_angel3_validate.iml b/packages/validate/melos_angel3_validate.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/validate/melos_angel3_validate.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/websocket/melos_angel3_websocket.iml b/packages/websocket/melos_angel3_websocket.iml new file mode 100644 index 00000000..389d07a1 --- /dev/null +++ b/packages/websocket/melos_angel3_websocket.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/wings/cmake_dart_utils b/packages/wings/cmake_dart_utils deleted file mode 160000 index 315b1741..00000000 --- a/packages/wings/cmake_dart_utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 315b1741fc59cd18faba32b604edf4eed0bd6e4b diff --git a/packages/wings/lib/src/http-parser b/packages/wings/lib/src/http-parser deleted file mode 160000 index 28f3c35c..00000000 --- a/packages/wings/lib/src/http-parser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 28f3c35c215ffbe0241685901338fad484660454 From d33faeaccedef2505f674f4653db296e41a73127 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 20 Mar 2022 08:38:59 +0800 Subject: [PATCH 25/28] Updated melos --- melos.yaml | 3 --- packages/client/pubspec.yaml | 2 +- packages/html/.idea/vcs.xml | 6 ------ packages/html/.travis.yml | 1 - packages/html/README.md | 14 ++++---------- 5 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 packages/html/.idea/vcs.xml delete mode 100644 packages/html/.travis.yml diff --git a/melos.yaml b/melos.yaml index f44da0aa..f467f0a4 100644 --- a/melos.yaml +++ b/melos.yaml @@ -3,8 +3,5 @@ name: angel3 packages: - packages/** -ignore: - - "packages/auth_twitter" - #scripts: # analyze: melos exec -- "dart analyze ." \ No newline at end of file diff --git a/packages/client/pubspec.yaml b/packages/client/pubspec.yaml index 23bb1a83..5d54add6 100644 --- a/packages/client/pubspec.yaml +++ b/packages/client/pubspec.yaml @@ -22,7 +22,7 @@ dev_dependencies: async: ^2.6.1 build_runner: ^2.1.2 build_web_compilers: ^3.2.1 - test: ^1.17.5 + test: ^1.20.0 lints: ^1.0.0 dependency_overrides: angel3_container: diff --git a/packages/html/.idea/vcs.xml b/packages/html/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/packages/html/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packages/html/.travis.yml b/packages/html/.travis.yml deleted file mode 100644 index de2210c9..00000000 --- a/packages/html/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: dart \ No newline at end of file diff --git a/packages/html/README.md b/packages/html/README.md index 273b8280..3fa79333 100644 --- a/packages/html/README.md +++ b/packages/html/README.md @@ -1,10 +1,9 @@ # Angel3 HTML -[![version](https://img.shields.io/badge/pub-v3.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_html) +![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_html?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) - -[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/html/LICENSE) +[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/html/LICENSE) A plug-in that allows you to return `belatuk_html_builder` AST's from request handlers, and have them sent as HTML automatically. @@ -28,10 +27,7 @@ Node myDom = html(lang: 'en', c: [ ]); ``` -This plug-in means that you can now `return` these AST's, and Angel will automatically send them to -clients. Ultimately, the implication is that you can use `belatuk_html_builder` as a substitute for a -templating system within Dart. With [hot reloading](https://pub.dev/packages/angel3_hot), you won't -even need to reload your server (as it should be). +This plug-in means that you can now `return` these AST's, and Angel will automatically send them to clients. Ultimately, the implication is that you can use `belatuk_html_builder` as a substitute for a templating system within Dart. With [hot reloading](https://pub.dev/packages/angel3_hot), you won't even need to reload your server (as it should be). ## Installation @@ -72,9 +68,7 @@ configureServer(Angel app) async { } ``` -By default, `renderHtml` will ignore the client's `Accept` header. However, if you pass -`enforceAcceptHeader` as `true`, then a `406 Not Acceptable` error will be thrown if the -client doesn't accept `*/*` or `text/html`. +By default, `renderHtml` will ignore the client's `Accept` header. However, if you pass `enforceAcceptHeader` as `true`, then a `406 Not Acceptable` error will be thrown if the client doesn't accept `*/*` or `text/html`. ```dart configureServer(Angel app) async { From 9382529ad771eb92a8f9f585a1ff8eaace3fc9f3 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 20 Mar 2022 08:55:30 +0800 Subject: [PATCH 26/28] Updated README --- README.md | 1 + packages/framework/README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index edbd4a87..32d063c0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/LICENSE) +[![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) **A polished, production-ready backend framework in Dart with NNBD support.** diff --git a/packages/framework/README.md b/packages/framework/README.md index 9163883f..354b6681 100644 --- a/packages/framework/README.md +++ b/packages/framework/README.md @@ -4,6 +4,7 @@ [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/framework/LICENSE) +[![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) **Replacement of Angel Framework with major change to support NNBD.** From 47cbaacef2091e1517c9a2ddc022651321cfc24d Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 23 Apr 2022 12:21:39 +0800 Subject: [PATCH 27/28] Updated to SDK 2.16.x --- packages/auth/CHANGELOG.md | 4 +- packages/auth/pubspec.yaml | 2 +- packages/auth_oauth2/CHANGELOG.md | 8 + packages/auth_oauth2/example/main.dart | 2 +- packages/auth_oauth2/pubspec.yaml | 8 +- packages/cache/.travis.yml | 4 - packages/cache/CHANGELOG.md | 8 + packages/cache/pubspec.yaml | 6 +- packages/client/.travis.yml | 4 - packages/client/CHANGELOG.md | 4 +- packages/client/pubspec.yaml | 2 +- packages/configuration/CHANGELOG.md | 4 +- packages/configuration/pubspec.yaml | 2 +- .../container/angel_container/CHANGELOG.md | 2 +- .../container/angel_container/pubspec.yaml | 2 +- .../angel_container_generator/CHANGELOG.md | 2 +- .../angel_container_generator/pubspec.yaml | 2 +- packages/cors/CHANGELOG.md | 4 +- packages/cors/pubspec.yaml | 2 +- .../eventsource/melos_angel_eventsource.iml | 16 -- packages/file_service/.travis.yml | 4 - packages/file_service/CHANGELOG.md | 4 +- packages/file_service/pubspec.yaml | 2 +- packages/framework/.travis.yml | 6 - packages/framework/CHANGELOG.md | 4 +- packages/framework/pubspec.yaml | 2 +- packages/framework/tool/travis.sh | 4 - packages/hot/CHANGELOG.md | 4 +- packages/hot/pubspec.yaml | 2 +- packages/html/CHANGELOG.md | 12 + packages/html/README.md | 2 +- packages/html/pubspec.yaml | 33 ++- packages/http_exception/CHANGELOG.md | 2 +- packages/http_exception/pubspec.yaml | 2 +- packages/jael/.travis.yml | 2 - packages/jael/angel_jael/CHANGELOG.md | 4 +- packages/jael/angel_jael/pubspec.yaml | 2 +- packages/jael/jael/CHANGELOG.md | 2 +- packages/jael/jael/pubspec.yaml | 2 +- .../jael/jael_language_server/pubspec.yaml | 4 +- packages/jael/jael_preprocessor/CHANGELOG.md | 2 +- packages/jael/jael_preprocessor/pubspec.yaml | 2 +- packages/jael/jael_web/pubspec.yaml | 2 +- packages/jinja/CHANGELOG.md | 16 ++ packages/jinja/pubspec.yaml | 8 +- packages/markdown/CHANGELOG.md | 8 + packages/markdown/pubspec.yaml | 8 +- packages/mock_request/CHANGELOG.md | 8 +- packages/mock_request/pubspec.yaml | 2 +- packages/model/CHANGELOG.md | 6 +- packages/model/pubspec.yaml | 2 +- packages/mongo/CHANGELOG.md | 6 +- packages/mongo/pubspec.yaml | 2 +- packages/mustache/CHANGELOG.md | 12 + packages/mustache/pubspec.yaml | 6 +- packages/oauth2/CHANGELOG.md | 8 + packages/oauth2/pubspec.yaml | 12 +- packages/orm/.travis.yml | 10 - packages/orm/README.md | 8 +- packages/orm/angel_migration/CHANGELOG.md | 4 +- packages/orm/angel_migration/pubspec.yaml | 2 +- .../orm/angel_migration_runner/CHANGELOG.md | 5 +- .../angel_migration_runner/example/main.dart | 51 +++-- .../lib/src/mysql/runner.dart | 48 ++-- .../lib/src/mysql/schema.dart | 12 +- .../orm/angel_migration_runner/mono_pkg.yaml | 0 .../orm/angel_migration_runner/pubspec.yaml | 4 +- packages/orm/angel_orm/CHANGELOG.md | 4 +- .../orm/angel_orm/lib/src/query_values.dart | 4 +- packages/orm/angel_orm/pubspec.yaml | 2 +- packages/orm/angel_orm_generator/CHANGELOG.md | 4 +- .../lib/src/orm_generator.dart | 15 +- packages/orm/angel_orm_generator/pubspec.yaml | 2 +- packages/orm/angel_orm_mysql/CHANGELOG.md | 16 +- packages/orm/angel_orm_mysql/README.md | 48 +++- .../orm/angel_orm_mysql/example/main.dart | 51 ++++- .../orm/angel_orm_mysql/example/main.g.dart | 205 +++++++++++------- .../angel_orm_mysql/lib/angel3_orm_mysql.dart | 158 +------------- .../angel_orm_mysql/lib/src/orm_mariadb.dart | 156 +++++++++++++ .../angel_orm_mysql/lib/src/orm_mysql.dart | 172 +++++++++++++++ packages/orm/angel_orm_mysql/mono_pkg.yaml | 0 packages/orm/angel_orm_mysql/pubspec.yaml | 11 +- packages/orm/angel_orm_mysql/test/common.dart | 43 +++- packages/orm/angel_orm_postgres/CHANGELOG.md | 6 +- packages/orm/angel_orm_postgres/mono_pkg.yaml | 0 packages/orm/angel_orm_postgres/pubspec.yaml | 2 +- packages/orm/angel_orm_service/CHANGELOG.md | 8 +- packages/orm/angel_orm_service/pubspec.yaml | 2 +- packages/orm/angel_orm_test/CHANGELOG.md | 6 +- .../angel_orm_test/lib/src/models/car.g.dart | 2 +- .../lib/src/models/person_order.g.dart | 4 +- .../lib/src/standalone_test.dart | 6 +- packages/orm/angel_orm_test/pubspec.yaml | 2 +- packages/orm/tool/.travis.sh | 18 -- packages/paginate/.travis.yml | 1 - packages/paginate/CHANGELOG.md | 12 + packages/paginate/pubspec.yaml | 8 +- packages/production/CHANGELOG.md | 6 +- packages/production/pubspec.yaml | 2 +- packages/proxy/.travis.yml | 1 - packages/proxy/CHANGELOG.md | 8 + packages/proxy/pubspec.yaml | 10 +- packages/redis/CHANGELOG.md | 16 ++ packages/redis/pubspec.yaml | 8 +- packages/rethink/melos_angel_rethink.iml | 16 -- packages/route/CHANGELOG.md | 2 +- packages/route/pubspec.yaml | 2 +- packages/security/CHANGELOG.md | 12 + .../security/example/rate_limit_redis.dart | 2 +- packages/security/pubspec.yaml | 14 +- packages/sembast/CHANGELOG.md | 12 + packages/sembast/pubspec.yaml | 8 +- packages/seo/.travis.yml | 4 - packages/seo/CHANGELOG.md | 8 + packages/seo/pubspec.yaml | 10 +- .../serialize/angel_serialize/CHANGELOG.md | 2 +- .../serialize/angel_serialize/pubspec.yaml | 2 +- .../angel_serialize_generator/CHANGELOG.md | 2 +- .../angel_serialize_generator/pubspec.yaml | 2 +- packages/shelf/CHANGELOG.md | 12 + packages/shelf/lib/src/shelf_driver.dart | 2 +- packages/shelf/pubspec.yaml | 12 +- packages/static/CHANGELOG.md | 4 +- packages/static/pubspec.yaml | 2 +- packages/sync/CHANGELOG.md | 8 + packages/sync/example/main.dart | 2 +- packages/sync/pubspec.yaml | 10 +- packages/sync/test/all_test.dart | 2 +- packages/test/CHANGELOG.md | 4 +- packages/test/pubspec.yaml | 2 +- .../user_agent/angel_user_agent/CHANGELOG.md | 12 + .../user_agent/angel_user_agent/pubspec.yaml | 6 +- packages/validate/CHANGELOG.md | 4 +- packages/validate/pubspec.yaml | 2 +- packages/websocket/CHANGELOG.md | 4 +- packages/websocket/pubspec.yaml | 2 +- 136 files changed, 1046 insertions(+), 602 deletions(-) delete mode 100644 packages/cache/.travis.yml delete mode 100644 packages/client/.travis.yml delete mode 100644 packages/eventsource/melos_angel_eventsource.iml delete mode 100644 packages/file_service/.travis.yml delete mode 100644 packages/framework/.travis.yml delete mode 100644 packages/framework/tool/travis.sh delete mode 100644 packages/jael/.travis.yml delete mode 100644 packages/orm/.travis.yml delete mode 100755 packages/orm/angel_migration_runner/mono_pkg.yaml create mode 100644 packages/orm/angel_orm_mysql/lib/src/orm_mariadb.dart create mode 100644 packages/orm/angel_orm_mysql/lib/src/orm_mysql.dart delete mode 100644 packages/orm/angel_orm_mysql/mono_pkg.yaml delete mode 100644 packages/orm/angel_orm_postgres/mono_pkg.yaml delete mode 100644 packages/orm/tool/.travis.sh delete mode 100644 packages/paginate/.travis.yml delete mode 100644 packages/proxy/.travis.yml delete mode 100644 packages/rethink/melos_angel_rethink.iml delete mode 100644 packages/seo/.travis.yml diff --git a/packages/auth/CHANGELOG.md b/packages/auth/CHANGELOG.md index 01d9d475..8078fdac 100644 --- a/packages/auth/CHANGELOG.md +++ b/packages/auth/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.2 diff --git a/packages/auth/pubspec.yaml b/packages/auth/pubspec.yaml index 6359e2f7..ed736299 100644 --- a/packages/auth/pubspec.yaml +++ b/packages/auth/pubspec.yaml @@ -4,7 +4,7 @@ version: 6.0.0 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/auth environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 charcode: ^1.2.0 diff --git a/packages/auth_oauth2/CHANGELOG.md b/packages/auth_oauth2/CHANGELOG.md index 82aee860..046df73c 100644 --- a/packages/auth_oauth2/CHANGELOG.md +++ b/packages/auth_oauth2/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.0 * Updated linter to `package:lints` diff --git a/packages/auth_oauth2/example/main.dart b/packages/auth_oauth2/example/main.dart index 9f99b480..8e6f5f4a 100644 --- a/packages/auth_oauth2/example/main.dart +++ b/packages/auth_oauth2/example/main.dart @@ -99,7 +99,7 @@ void main() async { // // Use `confirmPopupAuthentication`, which is bundled with // `package:angel_auth`. - var user = req.container!.make()!; + var user = req.container!.make(); res.write('Your user info: ${user.toJson()}\n\n'); res.write('Your JWT: $jwt'); await res.close(); diff --git a/packages/auth_oauth2/pubspec.yaml b/packages/auth_oauth2/pubspec.yaml index e20d75d4..6738f8f4 100644 --- a/packages/auth_oauth2/pubspec.yaml +++ b/packages/auth_oauth2/pubspec.yaml @@ -1,13 +1,13 @@ name: angel3_auth_oauth2 -version: 4.1.0 +version: 6.0.0 description: Angel3 library for authenticating users with external identity providers via OAuth2. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/auth_oauth2 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_auth: ^4.1.0 - angel3_framework: ^4.2.0 + angel3_auth: ^6.0.0 + angel3_framework: ^6.0.0 http_parser: ^4.0.0 oauth2: ^2.0.0 dev_dependencies: diff --git a/packages/cache/.travis.yml b/packages/cache/.travis.yml deleted file mode 100644 index 2f22c5ce..00000000 --- a/packages/cache/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: dart -dart: - - stable - - dev \ No newline at end of file diff --git a/packages/cache/CHANGELOG.md b/packages/cache/CHANGELOG.md index ec747ba1..513010c6 100644 --- a/packages/cache/CHANGELOG.md +++ b/packages/cache/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.0.3 * Updated linter to `package:lints` diff --git a/packages/cache/pubspec.yaml b/packages/cache/pubspec.yaml index 467804a3..87c3b8c0 100644 --- a/packages/cache/pubspec.yaml +++ b/packages/cache/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_cache -version: 4.0.3 +version: 6.0.0 description: A service that provides HTTP caching to the response data for Angel3 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/cache environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 collection: ^1.15.0 meta: ^1.4.0 pool: ^1.5.0 diff --git a/packages/client/.travis.yml b/packages/client/.travis.yml deleted file mode 100644 index 0eb6fac6..00000000 --- a/packages/client/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: dart -dart: - - dev - - stable diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 7dba9f1f..3d7b4fd6 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.2.0 diff --git a/packages/client/pubspec.yaml b/packages/client/pubspec.yaml index 5d54add6..2d5cca7b 100644 --- a/packages/client/pubspec.yaml +++ b/packages/client/pubspec.yaml @@ -4,7 +4,7 @@ description: A browser, mobile and command line based client that supports query homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/client environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_http_exception: ^6.0.0 belatuk_json_serializer: ^5.0.0 diff --git a/packages/configuration/CHANGELOG.md b/packages/configuration/CHANGELOG.md index 53c98f03..1fe717e2 100644 --- a/packages/configuration/CHANGELOG.md +++ b/packages/configuration/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/configuration/pubspec.yaml b/packages/configuration/pubspec.yaml index c92f2ac9..be33a90b 100644 --- a/packages/configuration/pubspec.yaml +++ b/packages/configuration/pubspec.yaml @@ -4,7 +4,7 @@ description: Automatic YAML application configuration loader for Angel 3, with . homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/configuration environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 belatuk_merge_map: ^3.0.0 diff --git a/packages/container/angel_container/CHANGELOG.md b/packages/container/angel_container/CHANGELOG.md index f1147e25..d44872ea 100644 --- a/packages/container/angel_container/CHANGELOG.md +++ b/packages/container/angel_container/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x * Removed `error` ## 5.0.0 diff --git a/packages/container/angel_container/pubspec.yaml b/packages/container/angel_container/pubspec.yaml index d15f49fa..613466a8 100644 --- a/packages/container/angel_container/pubspec.yaml +++ b/packages/container/angel_container/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel3 hierarchical DI container, and pluggable backends for reflec homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: collection: ^1.15.0 quiver: ^3.0.1 diff --git a/packages/container/angel_container_generator/CHANGELOG.md b/packages/container/angel_container_generator/CHANGELOG.md index 05db9bf7..782c0801 100644 --- a/packages/container/angel_container_generator/CHANGELOG.md +++ b/packages/container/angel_container_generator/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 diff --git a/packages/container/angel_container_generator/pubspec.yaml b/packages/container/angel_container_generator/pubspec.yaml index c22acfc7..2ecead68 100644 --- a/packages/container/angel_container_generator/pubspec.yaml +++ b/packages/container/angel_container_generator/pubspec.yaml @@ -4,7 +4,7 @@ description: Codegen support for using pkg:reflectable with pkg:angel3_container homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container_generator environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_container: ^6.0.0 reflectable: ^3.0.4 diff --git a/packages/cors/CHANGELOG.md b/packages/cors/CHANGELOG.md index 734293a0..9633710e 100644 --- a/packages/cors/CHANGELOG.md +++ b/packages/cors/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/cors/pubspec.yaml b/packages/cors/pubspec.yaml index b4ede600..2ca97dc4 100644 --- a/packages/cors/pubspec.yaml +++ b/packages/cors/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel3 CORS middleware. Ported from expressjs/cors to Angel3 framew homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/cors environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 dev_dependencies: diff --git a/packages/eventsource/melos_angel_eventsource.iml b/packages/eventsource/melos_angel_eventsource.iml deleted file mode 100644 index 389d07a1..00000000 --- a/packages/eventsource/melos_angel_eventsource.iml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/file_service/.travis.yml b/packages/file_service/.travis.yml deleted file mode 100644 index a9e2c109..00000000 --- a/packages/file_service/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: dart -dart: - - dev - - stable \ No newline at end of file diff --git a/packages/file_service/CHANGELOG.md b/packages/file_service/CHANGELOG.md index 5a6b7413..ae414c1c 100644 --- a/packages/file_service/CHANGELOG.md +++ b/packages/file_service/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/file_service/pubspec.yaml b/packages/file_service/pubspec.yaml index 1ea91b49..25758c2e 100644 --- a/packages/file_service/pubspec.yaml +++ b/packages/file_service/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel service that persists data to a file on disk, stored as a JSO homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/file_service environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 file: ^6.1.1 diff --git a/packages/framework/.travis.yml b/packages/framework/.travis.yml deleted file mode 100644 index 14148ad6..00000000 --- a/packages/framework/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: dart -dart: - - dev - - stable -before_script: chmod +x ./tool/travis.sh -script: ./tool/travis.sh \ No newline at end of file diff --git a/packages/framework/CHANGELOG.md b/packages/framework/CHANGELOG.md index 5c96951d..c682a960 100644 --- a/packages/framework/CHANGELOG.md +++ b/packages/framework/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x * Updated `container` to non nullable * Updated `angel` to non nullable * Updated `logger` to non nullable @@ -10,7 +10,7 @@ ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.2.4 diff --git a/packages/framework/pubspec.yaml b/packages/framework/pubspec.yaml index bc376dcc..7a5efff1 100644 --- a/packages/framework/pubspec.yaml +++ b/packages/framework/pubspec.yaml @@ -4,7 +4,7 @@ description: A high-powered HTTP server extensible framework with dependency inj homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/framework environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_container: ^6.0.0 angel3_http_exception: ^6.0.0 diff --git a/packages/framework/tool/travis.sh b/packages/framework/tool/travis.sh deleted file mode 100644 index ac63f578..00000000 --- a/packages/framework/tool/travis.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -e -pub run test --timeout 5s -ANGEL_ENV=production pub run test --timeout 5s \ No newline at end of file diff --git a/packages/hot/CHANGELOG.md b/packages/hot/CHANGELOG.md index 3e9474fd..c43d54ec 100644 --- a/packages/hot/CHANGELOG.md +++ b/packages/hot/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.3.0 diff --git a/packages/hot/pubspec.yaml b/packages/hot/pubspec.yaml index 56c10457..3f597056 100644 --- a/packages/hot/pubspec.yaml +++ b/packages/hot/pubspec.yaml @@ -4,7 +4,7 @@ description: Supports hot reloading/hot code push of Angel3 servers on file chan homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/hot environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 angel3_websocket: ^6.0.0 diff --git a/packages/html/CHANGELOG.md b/packages/html/CHANGELOG.md index 43ec6378..edc26134 100644 --- a/packages/html/CHANGELOG.md +++ b/packages/html/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* No release. Skipped + ## 3.0.0 * Migrated to support Dart SDK 2.12.x NNBD diff --git a/packages/html/README.md b/packages/html/README.md index 3fa79333..89b7d674 100644 --- a/packages/html/README.md +++ b/packages/html/README.md @@ -35,7 +35,7 @@ In your `pubspec.yaml`: ```yaml dependencies: - angel3_html: ^3.0.0 + angel3_html: ^6.0.0 ``` ## Usage diff --git a/packages/html/pubspec.yaml b/packages/html/pubspec.yaml index ec7e0246..43b39194 100644 --- a/packages/html/pubspec.yaml +++ b/packages/html/pubspec.yaml @@ -1,16 +1,39 @@ name: angel3_html -version: 3.0.0 +version: 6.0.0 description: Support for rendering html_builder AST's as responses in Angel. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/html_builder environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.0.0 + angel3_framework: ^6.0.0 belatuk_html_builder: ^3.0.0 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 html: ^0.15.0 logging: ^1.0.1 test: ^1.17.0 - lints: ^1.0.0 \ No newline at end of file + lints: ^1.0.0 +dependency_overrides: + angel3_container: + path: ../container/angel_container + angel3_framework: + path: ../framework + angel3_test: + path: ../test + angel3_websocket: + path: ../websocket + angel3_http_exception: + path: ../http_exception + angel3_client: + path: ../client + angel3_auth: + path: ../auth + angel3_validate: + path: ../validate + angel3_mock_request: + path: ../mock_request + angel3_model: + path: ../model + angel3_route: + path: ../route diff --git a/packages/http_exception/CHANGELOG.md b/packages/http_exception/CHANGELOG.md index 23ff9533..933006c7 100644 --- a/packages/http_exception/CHANGELOG.md +++ b/packages/http_exception/CHANGELOG.md @@ -3,7 +3,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x * Removed `error` ## 5.0.0 diff --git a/packages/http_exception/pubspec.yaml b/packages/http_exception/pubspec.yaml index ad4bd617..25aa61ed 100644 --- a/packages/http_exception/pubspec.yaml +++ b/packages/http_exception/pubspec.yaml @@ -4,6 +4,6 @@ description: Exception class that can be serialized to JSON and serialized to cl homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/http_exception environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dev_dependencies: lints: ^1.0.0 \ No newline at end of file diff --git a/packages/jael/.travis.yml b/packages/jael/.travis.yml deleted file mode 100644 index 58ef8a07..00000000 --- a/packages/jael/.travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -language: dart -script: bash ./travis.sh diff --git a/packages/jael/angel_jael/CHANGELOG.md b/packages/jael/angel_jael/CHANGELOG.md index c3efe449..eb843011 100644 --- a/packages/jael/angel_jael/CHANGELOG.md +++ b/packages/jael/angel_jael/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.3.1 diff --git a/packages/jael/angel_jael/pubspec.yaml b/packages/jael/angel_jael/pubspec.yaml index 15dfeded..0b05451b 100644 --- a/packages/jael/angel_jael/pubspec.yaml +++ b/packages/jael/angel_jael/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel support for the Jael templating engine, similar to Blade or L homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/angel_jael environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 jael3: ^5.0.0 diff --git a/packages/jael/jael/CHANGELOG.md b/packages/jael/jael/CHANGELOG.md index ad74a60e..8ed11410 100644 --- a/packages/jael/jael/CHANGELOG.md +++ b/packages/jael/jael/CHANGELOG.md @@ -2,7 +2,7 @@ ## 5.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 4.2.0 diff --git a/packages/jael/jael/pubspec.yaml b/packages/jael/jael/pubspec.yaml index ddcb28e1..f406ab50 100644 --- a/packages/jael/jael/pubspec.yaml +++ b/packages/jael/jael/pubspec.yaml @@ -4,7 +4,7 @@ description: A simple server-side HTML templating engine for Dart. Comparable t homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/jael environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: args: ^2.0.0 charcode: ^1.0.0 diff --git a/packages/jael/jael_language_server/pubspec.yaml b/packages/jael/jael_language_server/pubspec.yaml index 20f550aa..f8a3921f 100644 --- a/packages/jael/jael_language_server/pubspec.yaml +++ b/packages/jael/jael_language_server/pubspec.yaml @@ -4,14 +4,14 @@ description: Language Server Protocol implementation for the Jael templating eng homepage: https://github.com/angel-dart/vscode publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: args: ^2.1.1 # dart_language_server: ^0.1.16 file: ^6.1.2 io: ^1.0.0 jael3: ^4.2.0 - jael3_preprocessor: ^4.2.0 + jael3_preprocessor: ^5.0.0 json_rpc_2: ^3.0.1 logging: ^1.0.1 path: ^1.8.0 diff --git a/packages/jael/jael_preprocessor/CHANGELOG.md b/packages/jael/jael_preprocessor/CHANGELOG.md index 51c0b20a..0688a045 100644 --- a/packages/jael/jael_preprocessor/CHANGELOG.md +++ b/packages/jael/jael_preprocessor/CHANGELOG.md @@ -2,7 +2,7 @@ ## 5.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 4.2.0 diff --git a/packages/jael/jael_preprocessor/pubspec.yaml b/packages/jael/jael_preprocessor/pubspec.yaml index 8e26c38a..3120b42f 100644 --- a/packages/jael/jael_preprocessor/pubspec.yaml +++ b/packages/jael/jael_preprocessor/pubspec.yaml @@ -4,7 +4,7 @@ description: A pre-processor for resolving blocks and includes within Jael templ homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/jael_preprocessor environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: file: ^6.1.0 jael3: ^6.0.0 diff --git a/packages/jael/jael_web/pubspec.yaml b/packages/jael/jael_web/pubspec.yaml index ba068836..f4230b0d 100644 --- a/packages/jael/jael_web/pubspec.yaml +++ b/packages/jael/jael_web/pubspec.yaml @@ -3,7 +3,7 @@ version: 2.0.0 description: Experimental virtual DOM/SPA engine built on Jael3. Supports SSR. publish_to: none environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: build: ^2.0.2 build_config: ^1.0.0 diff --git a/packages/jinja/CHANGELOG.md b/packages/jinja/CHANGELOG.md index f9b8b445..30618a03 100644 --- a/packages/jinja/CHANGELOG.md +++ b/packages/jinja/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + +## 3.0.0 + +* Skipped release + ## 2.0.1 * Fixed Jinja view rendering issue diff --git a/packages/jinja/pubspec.yaml b/packages/jinja/pubspec.yaml index 90db2617..6254d9e6 100644 --- a/packages/jinja/pubspec.yaml +++ b/packages/jinja/pubspec.yaml @@ -1,14 +1,14 @@ name: angel3_jinja -version: 2.0.1 +version: 6.0.0 description: A service that renders Jinja2 template into HTML view for Angel3. Ported from Python to Dart. homepage: https://github.com/dukefirehawk/angel/tree/master/packages/jinja environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 jinja: ^0.3.4 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 path: ^1.8.0 test: ^1.17.5 lints: ^1.0.0 \ No newline at end of file diff --git a/packages/markdown/CHANGELOG.md b/packages/markdown/CHANGELOG.md index b20fc391..203d595e 100644 --- a/packages/markdown/CHANGELOG.md +++ b/packages/markdown/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.0 * Updated linter to `package:lints` diff --git a/packages/markdown/pubspec.yaml b/packages/markdown/pubspec.yaml index 3d72dae2..246d46ef 100644 --- a/packages/markdown/pubspec.yaml +++ b/packages/markdown/pubspec.yaml @@ -1,15 +1,15 @@ name: angel3_markdown -version: 4.1.0 +version: 6.0.0 description: Angel3 Markdown view generator. Write static sites, with no build step. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/markdown environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 file: ^6.1.2 markdown: ^4.0.0 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 lints: ^1.0.0 test: ^1.17.0 diff --git a/packages/mock_request/CHANGELOG.md b/packages/mock_request/CHANGELOG.md index 02c1e29c..8d1b2568 100644 --- a/packages/mock_request/CHANGELOG.md +++ b/packages/mock_request/CHANGELOG.md @@ -2,19 +2,19 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.0.0 -* No release. Skipped +* Skipped release ## 2.1.0 diff --git a/packages/mock_request/pubspec.yaml b/packages/mock_request/pubspec.yaml index 44bb9891..7afb7676 100644 --- a/packages/mock_request/pubspec.yaml +++ b/packages/mock_request/pubspec.yaml @@ -4,7 +4,7 @@ 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.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: charcode: ^1.2.0 dev_dependencies: diff --git a/packages/model/CHANGELOG.md b/packages/model/CHANGELOG.md index c5f18205..84c131d6 100644 --- a/packages/model/CHANGELOG.md +++ b/packages/model/CHANGELOG.md @@ -2,15 +2,15 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.1.1 diff --git a/packages/model/pubspec.yaml b/packages/model/pubspec.yaml index a8344412..93c3ffa8 100644 --- a/packages/model/pubspec.yaml +++ b/packages/model/pubspec.yaml @@ -4,6 +4,6 @@ description: Angel3 basic data model class, no longer with the added weight of t homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/model environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dev_dependencies: lints: ^1.0.0 diff --git a/packages/mongo/CHANGELOG.md b/packages/mongo/CHANGELOG.md index 6dbc0d94..a5ade756 100644 --- a/packages/mongo/CHANGELOG.md +++ b/packages/mongo/CHANGELOG.md @@ -2,15 +2,15 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.1.0 diff --git a/packages/mongo/pubspec.yaml b/packages/mongo/pubspec.yaml index a6f62e78..ee1d22b6 100644 --- a/packages/mongo/pubspec.yaml +++ b/packages/mongo/pubspec.yaml @@ -4,7 +4,7 @@ description: MongoDB-enabled services for the Angel3 framework. Well-tested. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/mongo environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 belatuk_json_serializer: ^5.0.0 diff --git a/packages/mustache/CHANGELOG.md b/packages/mustache/CHANGELOG.md index 3d3ed4ff..63b3d3ff 100644 --- a/packages/mustache/CHANGELOG.md +++ b/packages/mustache/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.1.1 * Updated README diff --git a/packages/mustache/pubspec.yaml b/packages/mustache/pubspec.yaml index c9f9203c..edaf9c69 100644 --- a/packages/mustache/pubspec.yaml +++ b/packages/mustache/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_mustache -version: 3.1.1 +version: 6.0.0 description: A service that renders Mustache template into HTML view for Angel3 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/mustache environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 file: ^6.1.2 mustache_template: ^2.0.0 path: ^1.8.0 diff --git a/packages/oauth2/CHANGELOG.md b/packages/oauth2/CHANGELOG.md index 8d4c2863..64e07646 100644 --- a/packages/oauth2/CHANGELOG.md +++ b/packages/oauth2/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.1 * Updated README diff --git a/packages/oauth2/pubspec.yaml b/packages/oauth2/pubspec.yaml index 90f8af73..ba04d9f2 100644 --- a/packages/oauth2/pubspec.yaml +++ b/packages/oauth2/pubspec.yaml @@ -1,18 +1,18 @@ name: angel3_oauth2 -version: 4.1.1 +version: 6.0.0 description: A class containing handlers that can be used within Angel to build a spec-compliant OAuth 2.0 server. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/oauth2 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_http_exception: ^3.0.0 + angel3_framework: ^6.0.0 + angel3_http_exception: ^6.0.0 crypto: ^3.0.1 collection: ^1.15.0 dev_dependencies: - angel3_validate: ^4.0.0 - angel3_test: ^4.0.0 + angel3_validate: ^6.0.0 + angel3_test: ^6.0.0 logging: ^1.0.1 oauth2: ^2.0.0 lints: ^1.0.0 diff --git a/packages/orm/.travis.yml b/packages/orm/.travis.yml deleted file mode 100644 index afed7556..00000000 --- a/packages/orm/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: dart -script: bash tool/.travis.sh -before_script: - - psql -c 'create database angel_orm_test;' -U postgres - - psql -c 'create database angel_orm_service_test;' -U postgres - - psql -c "CREATE USER angel_orm WITH PASSWORD 'angel_orm';" -U postgres -services: - - postgresql -addons: - postgresql: "9.4" \ No newline at end of file diff --git a/packages/orm/README.md b/packages/orm/README.md index af52374f..c66af42f 100644 --- a/packages/orm/README.md +++ b/packages/orm/README.md @@ -1,4 +1,4 @@ -# ORM +# Angel3 ORM ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) @@ -10,7 +10,7 @@ Source-generated ORM for use with the [Angel3 framework](https://github.com/duke Documentation for migrations can be found here: [ORM Migration](https://angel3-docs.dukefirehawk.com/guides/orm/migrations) -- [ORM](#orm) +- [Angel3 ORM](#angel3-orm) - [Usage](#usage) - [Models](#models) - [Example](#example) @@ -27,9 +27,9 @@ You'll need these dependencies in your `pubspec.yaml`: ```yaml dependencies: - angel3_orm: ^4.0.0 + angel3_orm: ^6.0.0 dev_dependencies: - angel3_orm_generator: ^4.0.0 + angel3_orm_generator: ^6.0.0 build_runner: ^2.0.0 ``` diff --git a/packages/orm/angel_migration/CHANGELOG.md b/packages/orm/angel_migration/CHANGELOG.md index 59a23b12..375379d2 100755 --- a/packages/orm/angel_migration/CHANGELOG.md +++ b/packages/orm/angel_migration/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.4 diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index ba7682e2..80788ee2 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -4,7 +4,7 @@ description: Database migration runtime for Angel3 ORM. Use this package to defi homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_orm: ^6.0.0 dev_dependencies: diff --git a/packages/orm/angel_migration_runner/CHANGELOG.md b/packages/orm/angel_migration_runner/CHANGELOG.md index bef452ea..8820d8b3 100755 --- a/packages/orm/angel_migration_runner/CHANGELOG.md +++ b/packages/orm/angel_migration_runner/CHANGELOG.md @@ -2,11 +2,12 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x +* Updated to use `mysql_client` package ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.2 diff --git a/packages/orm/angel_migration_runner/example/main.dart b/packages/orm/angel_migration_runner/example/main.dart index bf795df7..75f128d7 100755 --- a/packages/orm/angel_migration_runner/example/main.dart +++ b/packages/orm/angel_migration_runner/example/main.dart @@ -4,35 +4,40 @@ import 'package:angel3_migration_runner/postgres.dart'; import 'package:angel3_migration_runner/mysql.dart'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:postgres/postgres.dart'; -import 'package:mysql1/mysql1.dart'; +import 'package:mysql_client/mysql_client.dart'; import 'todo.dart'; -var postgresqlMigrationRunner = PostgresMigrationRunner( - PostgreSQLConnection('127.0.0.1', 5432, 'demo', - username: 'demouser', password: 'demo123'), - migrations: [ - UserMigration(), - TodoMigration(), - FooMigration(), - ], -); +void main(List args) async { + var postgresqlMigrationRunner = PostgresMigrationRunner( + PostgreSQLConnection('localhost', 5432, 'demo', + username: 'demouser', password: 'demo123'), + migrations: [ + UserMigration(), + TodoMigration(), + FooMigration(), + ], + ); -var mysqlMigrationRunner = MysqlMigrationRunner( - ConnectionSettings( - host: 'localhost', + var mySQLConn = await MySQLConnection.createConnection( + host: "localhost", port: 3306, - user: 'demouser', - password: 'demo123', - db: 'demo'), - migrations: [ - UserMigration(), - TodoMigration(), - FooMigration(), - ], -); + databaseName: "orm_test", + userName: "test", + password: "Test123*", + secure: false); -void main(List args) => runMigrations(postgresqlMigrationRunner, args); + var mysqlMigrationRunner = MysqlMigrationRunner( + mySQLConn, + migrations: [ + UserMigration(), + TodoMigration(), + FooMigration(), + ], + ); + + runMigrations(postgresqlMigrationRunner, args); +} class FooMigration extends Migration { @override diff --git a/packages/orm/angel_migration_runner/lib/src/mysql/runner.dart b/packages/orm/angel_migration_runner/lib/src/mysql/runner.dart index e8444877..e121cbd6 100644 --- a/packages/orm/angel_migration_runner/lib/src/mysql/runner.dart +++ b/packages/orm/angel_migration_runner/lib/src/mysql/runner.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:collection'; import 'package:angel3_migration/angel3_migration.dart'; import 'package:logging/logging.dart'; -import 'package:mysql1/mysql1.dart'; +import 'package:mysql_client/mysql_client.dart'; import '../runner.dart'; import '../util.dart'; import 'schema.dart'; @@ -11,12 +11,11 @@ class MysqlMigrationRunner implements MigrationRunner { final _log = Logger('PostgresMigrationRunner'); final Map migrations = {}; - final ConnectionSettings settings; final Queue _migrationQueue = Queue(); - late MySqlConnection connection; + final MySQLConnection connection; bool _connected = false; - MysqlMigrationRunner(this.settings, + MysqlMigrationRunner(this.connection, {Iterable migrations = const [], bool connected = false}) { if (migrations.isNotEmpty == true) migrations.forEach(addMigration); _connected = connected == true; @@ -35,11 +34,12 @@ class MysqlMigrationRunner implements MigrationRunner { } if (!_connected) { - connection = await MySqlConnection.connect(settings); + //connection = await MySQLConnection.connect(settings); + await connection.connect(); _connected = true; } - await connection.query(''' + await connection.execute(''' CREATE TABLE IF NOT EXISTS "migrations" ( id serial, batch integer, @@ -56,8 +56,8 @@ class MysqlMigrationRunner implements MigrationRunner { @override Future up() async { await _init(); - var r = await connection.query('SELECT path from migrations;'); - var existing = r.expand((x) => x).cast(); + var r = await connection.execute('SELECT path from migrations;'); + var existing = r.rows.cast(); //.expand((x) => x).cast(); var toRun = []; migrations.forEach((k, v) { @@ -65,9 +65,10 @@ class MysqlMigrationRunner implements MigrationRunner { }); if (toRun.isNotEmpty) { - var r = await connection.query('SELECT MAX(batch) from migrations;'); - var rTmp = r.toList(); - var curBatch = (rTmp[0][0] ?? 0) as int; + var r = await connection.execute('SELECT MAX(batch) from migrations;'); + var rTmp = r.rows.first; //r.toList(); + var curBatch = + int.tryParse(rTmp.colAt(0) ?? "0") ?? 0; //(rTmp[0][0] ?? 0) as int; var batch = curBatch + 1; for (var k in toRun) { @@ -76,11 +77,11 @@ class MysqlMigrationRunner implements MigrationRunner { migration.up(schema); _log.info('Added "$k" into "migrations" table.'); await schema.run(connection).then((_) { - return connection.transaction((ctx) async { - var result = await ctx.query( + return connection.transactional((ctx) async { + var result = await ctx.execute( "INSERT INTO MIGRATIONS (batch, path) VALUES ($batch, '$k')"); - return result.affectedRowCount; + return result.affectedRows; }); //return connection.execute( // 'INSERT INTO MIGRATIONS (batch, path) VALUES ($batch, \'$k\');'); @@ -97,13 +98,14 @@ class MysqlMigrationRunner implements MigrationRunner { Future rollback() async { await _init(); - var r = await connection.query('SELECT MAX(batch) from migrations;'); - var rTmp = r.toList(); - var curBatch = (rTmp[0][0] ?? 0) as int; + var r = await connection.execute('SELECT MAX(batch) from migrations;'); + var rTmp = r.rows.first; //r.toList(); + var curBatch = + int.tryParse(rTmp.colAt(0) ?? "0") ?? 0; //(rTmp[0][0] ?? 0) as int; r = await connection - .query('SELECT path from migrations WHERE batch = $curBatch;'); - var existing = r.expand((x) => x).cast(); + .execute('SELECT path from migrations WHERE batch = $curBatch;'); + var existing = r.rows.cast(); //r.expand((x) => x).cast(); var toRun = []; migrations.forEach((k, v) { @@ -118,7 +120,7 @@ class MysqlMigrationRunner implements MigrationRunner { _log.info('Removed "$k" from "migrations" table.'); await schema.run(connection).then((_) { return connection - .query('DELETE FROM migrations WHERE path = \'$k\';'); + .execute('DELETE FROM migrations WHERE path = \'$k\';'); }); } } else { @@ -130,8 +132,8 @@ class MysqlMigrationRunner implements MigrationRunner { Future reset() async { await _init(); var r = await connection - .query('SELECT path from migrations ORDER BY batch DESC;'); - var existing = r.expand((x) => x).cast(); + .execute('SELECT path from migrations ORDER BY batch DESC;'); + var existing = r.rows.cast(); //r.expand((x) => x).cast(); var toRun = existing.where(migrations.containsKey).toList(); if (toRun.isNotEmpty) { @@ -142,7 +144,7 @@ class MysqlMigrationRunner implements MigrationRunner { _log.info('Removed "$k" from "migrations" table.'); await schema.run(connection).then((_) { return connection - .query('DELETE FROM migrations WHERE path = \'$k\';'); + .execute('DELETE FROM migrations WHERE path = \'$k\';'); }); } } else { diff --git a/packages/orm/angel_migration_runner/lib/src/mysql/schema.dart b/packages/orm/angel_migration_runner/lib/src/mysql/schema.dart index fa006691..e4938ca4 100644 --- a/packages/orm/angel_migration_runner/lib/src/mysql/schema.dart +++ b/packages/orm/angel_migration_runner/lib/src/mysql/schema.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:angel3_migration/angel3_migration.dart'; import 'package:angel3_migration_runner/src/mysql/table.dart'; import 'package:logging/logging.dart'; -import 'package:mysql1/mysql1.dart'; +import 'package:mysql_client/mysql_client.dart'; class MysqlSchema extends Schema { final _log = Logger('MysqlSchema'); @@ -14,17 +14,17 @@ class MysqlSchema extends Schema { factory MysqlSchema() => MysqlSchema._(StringBuffer(), 0); - Future run(MySqlConnection connection) async { + Future run(MySQLConnection connection) async { //return connection.execute(compile()); - var result = await connection.transaction((ctx) async { + var result = await connection.transactional((ctx) async { var sql = compile(); - var result = await ctx.query(sql).catchError((e) { + var result = await ctx.execute(sql).catchError((e) { _log.severe('Failed to run query: [ $sql ]', e); }); - return result.affectedRowCount; + return result.affectedRows.toInt(); }); - return (result is int) ? result : 0; + return result; } String compile() => _buf.toString(); diff --git a/packages/orm/angel_migration_runner/mono_pkg.yaml b/packages/orm/angel_migration_runner/mono_pkg.yaml deleted file mode 100755 index e69de29b..00000000 diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index 00757bc1..1a5b9911 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -4,14 +4,14 @@ description: Command-line based database migration runner for Angel3's ORM. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_migration_runner environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_migration: ^6.0.0 angel3_orm: ^6.0.0 args: ^2.1.0 charcode: ^1.2.0 postgres: ^2.4.0 - mysql1: ^0.19.2 + mysql_client: ^0.0.11 logging: ^1.0.0 dev_dependencies: lints: ^1.0.0 diff --git a/packages/orm/angel_orm/CHANGELOG.md b/packages/orm/angel_orm/CHANGELOG.md index e8f1fea1..bebecb69 100644 --- a/packages/orm/angel_orm/CHANGELOG.md +++ b/packages/orm/angel_orm/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/orm/angel_orm/lib/src/query_values.dart b/packages/orm/angel_orm/lib/src/query_values.dart index 0748dacb..09535211 100644 --- a/packages/orm/angel_orm/lib/src/query_values.dart +++ b/packages/orm/angel_orm/lib/src/query_values.dart @@ -16,7 +16,7 @@ abstract class QueryValues { String compileInsert(Query query, String tableName) { var data = Map.from(toMap()); - var now = DateTime.now(); + var now = DateTime.now().toUtc(); if (data.containsKey('created_at') && data['created_at'] == null) { data['created_at'] = now; } @@ -71,7 +71,7 @@ abstract class QueryValues { if (data.isEmpty) { return ''; } - var now = DateTime.now(); + var now = DateTime.now().toUtc(); if (data.containsKey('created_at') && data['created_at'] == null) { data.remove('created_at'); } diff --git a/packages/orm/angel_orm/pubspec.yaml b/packages/orm/angel_orm/pubspec.yaml index dfd4c626..9a752a82 100644 --- a/packages/orm/angel_orm/pubspec.yaml +++ b/packages/orm/angel_orm/pubspec.yaml @@ -4,7 +4,7 @@ description: Runtime support for Angel3 ORM. Includes base classes for queries. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: charcode: ^1.2.0 intl: ^0.17.0 diff --git a/packages/orm/angel_orm_generator/CHANGELOG.md b/packages/orm/angel_orm_generator/CHANGELOG.md index 675fd0ec..7be9b00b 100644 --- a/packages/orm/angel_orm_generator/CHANGELOG.md +++ b/packages/orm/angel_orm_generator/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.3.0 diff --git a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart index 0d6dd376..62eb7cd5 100644 --- a/packages/orm/angel_orm_generator/lib/src/orm_generator.dart +++ b/packages/orm/angel_orm_generator/lib/src/orm_generator.dart @@ -240,8 +240,9 @@ class OrmGenerator extends GeneratorForAnnotation { ..type = refer('List'))) ..body = Block((b) { var i = 0; - var args = {}; + // Build the argurments for model + var args = {}; for (var field in ctx.effectiveFields) { var fType = field.type; Reference type = convertTypeReference(field.type); @@ -249,14 +250,10 @@ class OrmGenerator extends GeneratorForAnnotation { type = refer('int'); } - // Reverted since as `continue` for `RelationshipFieldImp` will - // cause `_index` requires +2 or +3 in order to map to the correct - // fields - // - //literalNum(i++); - //var expr = (refer('row').index(CodeExpression(Code('_index++')))); + // Generated Code: row[i] var expr = (refer('row').index(literalNum(i++))); if (isSpecialId(ctx, field)) { + // Generated Code: row[i].toString() expr = expr.property('toString').call([]); } else if (field is RelationFieldImpl) { continue; @@ -272,7 +269,11 @@ class OrmGenerator extends GeneratorForAnnotation { var isNull = expr.equalTo(literalNull); expr = isNull.conditional(literalNull, type.property('values').index(expr.asA(refer('int')))); + } else if (fType.isDartCoreBool) { + // Generated Code: mapToBool(row[i]) + expr = refer('mapToBool').call([expr]); } else { + // Generated Code: (row[i] as type?) expr = expr.asA(type); } expr = refer('fields').property('contains').call([ diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index ee8f73a3..83801bd3 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -4,7 +4,7 @@ description: Code generators for Angel3 ORM. Generates query builder classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_model: ^6.0.0 angel3_serialize: ^6.0.0 diff --git a/packages/orm/angel_orm_mysql/CHANGELOG.md b/packages/orm/angel_orm_mysql/CHANGELOG.md index 9402e700..60973ee0 100644 --- a/packages/orm/angel_orm_mysql/CHANGELOG.md +++ b/packages/orm/angel_orm_mysql/CHANGELOG.md @@ -1,26 +1,26 @@ # Change Log -## 6.0.0-beta.1 +## 6.0.0 -* Updated to min SDK 2.15.x -* Upgrade to use `mysql1` driver -* Added support for MariaDB 10.2.x +* Updated to SDK 2.16.x +* Added support for MariaDB 10.2.x with `mysql1` driver +* Added support for MySQL 8.x.x with `mysql_client` driver ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.0.0 -* No release. Skipped +* Skipped release ## 2.0.0 -* No release. Skipped +* Skipped release ## 2.0.0-beta.3 diff --git a/packages/orm/angel_orm_mysql/README.md b/packages/orm/angel_orm_mysql/README.md index 2220fe28..3d03e0a9 100644 --- a/packages/orm/angel_orm_mysql/README.md +++ b/packages/orm/angel_orm_mysql/README.md @@ -5,13 +5,49 @@ [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql/LICENSE) -Mysql support for Angel3 ORM. +This package contains the SQL Executor required by Angel3 ORM to work with MySQL and MariaDB respectively. In order to better support the differences in MySQL and MariaDb underlying protocols, two different drives have to be used. For MariaDb 10.2.x, `mysql1` driver provides the best results, while `mysql_client` driver handles MySQL 8.x.x without issues. -## Supported database +* MariaDbExecutor (stable) +* MySqlExecutor (beta) -* MySQL 8.0 or later -* MariaDb 10.2.1 or later +## Supported database version -**Note** ORM for MySQL requires support for `WITH` SQL Syntax +* MySQL 8.x +* MariaDb 10.2.x -For documentation about the ORM, head to the main project repo: +**Note** MySQL below version 8.0 and MariaDB below version 10.2 are not supported as Angel3 ORM requires common table expressions (CTE). + +## Connecting to MySQL database 8.x.x + +```dart + import 'package:mysql_client/mysql_client.dart'; + + var settings = ConnectionSettings( + host: 'localhost', + port: 3306, + db: 'orm_test', + user: 'Test', + password: 'Test123*'); + var connection = await MySqlConnection.connect(settings); + + var logger = Logger('orm_mysql'); + var executor = MariaDbExecutor(connection, logger: logger); +``` + +## Connecting to MariaDB database 10.2.x + +```dart + import 'package:mysql1/mysql1.dart'; + + var connection = await MySQLConnection.createConnection( + host: "localhost", + port: 3306, + databaseName: "orm_test", + userName: "test", + password: "Test123*", + secure: false); + + var logger = Logger('orm_mysql'); + await connection.connect(timeoutMs: 10000); + var executor = MySqlExecutor(connection, logger: logger); +``` diff --git a/packages/orm/angel_orm_mysql/example/main.dart b/packages/orm/angel_orm_mysql/example/main.dart index e2a8d9fc..cf84baa7 100644 --- a/packages/orm/angel_orm_mysql/example/main.dart +++ b/packages/orm/angel_orm_mysql/example/main.dart @@ -1,15 +1,25 @@ +import 'dart:io'; + import 'package:angel3_migration/angel3_migration.dart'; import 'package:angel3_orm/angel3_orm.dart'; import 'package:angel3_orm_mysql/angel3_orm_mysql.dart'; import 'package:angel3_serialize/angel3_serialize.dart'; -//import 'package:galileo_sqljocky5/sqljocky.dart'; -import 'package:logging/logging.dart'; +import 'package:mysql_client/mysql_client.dart'; import 'package:mysql1/mysql1.dart'; +import 'package:logging/logging.dart'; import 'package:optional/optional.dart'; part 'main.g.dart'; void main() async { - hierarchicalLoggingEnabled = true; + //hierarchicalLoggingEnabled = true; + + //await mariaDBExample(); + await mysqlExample(); + + exit(0); +} + +Future mariaDBExample() async { Logger.root ..level = Level.ALL ..onRecord.listen(print); @@ -22,12 +32,47 @@ void main() async { password: 'Test123*'); var connection = await MySqlConnection.connect(settings); + print("Connected to MariaDb"); var logger = Logger('orm_mysql'); + var executor = MariaDbExecutor(connection, logger: logger); + + var query = TodoQuery(); + query.values + ..text = 'Clean your room!' + ..updatedAt = DateTime.now().toUtc() + ..isComplete = false; + + var todo = await query.insert(executor); + print(todo.value.toJson()); + + var query2 = TodoQuery()..where!.id.equals(todo.value.idAsInt); + var todo2 = await query2.getOne(executor); + print(todo2.value.toJson()); + print(todo == todo2); +} + +Future mysqlExample() async { + Logger.root + ..level = Level.ALL + ..onRecord.listen(print); + + var connection = await MySQLConnection.createConnection( + host: "localhost", + port: 3306, + databaseName: "orm_test", + userName: "test", + password: "Test123*", + secure: false); + + print("Connected to MySQL"); + var logger = Logger('orm_mysql'); + await connection.connect(timeoutMs: 10000); var executor = MySqlExecutor(connection, logger: logger); var query = TodoQuery(); query.values ..text = 'Clean your room!' + ..updatedAt = DateTime.now().toUtc() ..isComplete = false; var todo = await query.insert(executor); diff --git a/packages/orm/angel_orm_mysql/example/main.g.dart b/packages/orm/angel_orm_mysql/example/main.g.dart index cb28a7ab..02ae2be8 100644 --- a/packages/orm/angel_orm_mysql/example/main.g.dart +++ b/packages/orm/angel_orm_mysql/example/main.g.dart @@ -11,10 +11,10 @@ class TodoMigration extends Migration { void up(Schema schema) { schema.create('todos', (table) { table.serial('id').primaryKey(); - table.boolean('is_complete').defaultsTo(false); - table.varChar('text'); table.timeStamp('created_at'); table.timeStamp('updated_at'); + table.boolean('is_complete').defaultsTo(false); + table.varChar('text', length: 255); }); } @@ -29,7 +29,7 @@ class TodoMigration extends Migration { // ************************************************************************** class TodoQuery extends Query { - TodoQuery({Set? trampoline}) { + TodoQuery({Query? parent, Set? trampoline}) : super(parent: parent) { trampoline ??= {}; trampoline.add(tableName); _where = TodoQueryWhere(this); @@ -38,6 +38,8 @@ class TodoQuery extends Query { @override final TodoQueryValues values = TodoQueryValues(); + List _selectedFields = []; + TodoQueryWhere? _where; @override @@ -52,7 +54,15 @@ class TodoQuery extends Query { @override List get fields { - return const ['id', 'is_complete', 'text', 'created_at', 'updated_at']; + const _fields = ['id', 'created_at', 'updated_at', 'is_complete', 'text']; + return _selectedFields.isEmpty + ? _fields + : _fields.where((field) => _selectedFields.contains(field)).toList(); + } + + TodoQuery select(List selectedFields) { + _selectedFields = selectedFields; + return this; } @override @@ -65,44 +75,46 @@ class TodoQuery extends Query { return TodoQueryWhere(this); } - static Todo? parseRow(List row) { - if (row.every((x) => x == null)) return null; + Optional parseRow(List row) { + if (row.every((x) => x == null)) { + return Optional.empty(); + } var model = Todo( - id: row[0].toString(), - isComplete: (row[1] as int?) != 0, - text: (row[2] as String?), - createdAt: (row[3] as DateTime?), - updatedAt: (row[4] as DateTime?)); - return model; + id: fields.contains('id') ? row[0].toString() : null, + createdAt: fields.contains('created_at') ? (row[1] as DateTime?) : null, + updatedAt: fields.contains('updated_at') ? (row[2] as DateTime?) : null, + isComplete: fields.contains('is_complete') ? mapToBool(row[3]) : null, + text: fields.contains('text') ? (row[4] as String?) : null); + return Optional.of(model); } @override Optional deserialize(List row) { - return Optional.ofNullable(parseRow(row)); + return parseRow(row); } } class TodoQueryWhere extends QueryWhere { TodoQueryWhere(TodoQuery query) : id = NumericSqlExpressionBuilder(query, 'id'), - isComplete = BooleanSqlExpressionBuilder(query, 'is_complete'), - text = StringSqlExpressionBuilder(query, 'text'), createdAt = DateTimeSqlExpressionBuilder(query, 'created_at'), - updatedAt = DateTimeSqlExpressionBuilder(query, 'updated_at'); + updatedAt = DateTimeSqlExpressionBuilder(query, 'updated_at'), + isComplete = BooleanSqlExpressionBuilder(query, 'is_complete'), + text = StringSqlExpressionBuilder(query, 'text'); final NumericSqlExpressionBuilder id; - final BooleanSqlExpressionBuilder isComplete; - - final StringSqlExpressionBuilder text; - final DateTimeSqlExpressionBuilder createdAt; final DateTimeSqlExpressionBuilder updatedAt; + final BooleanSqlExpressionBuilder isComplete; + + final StringSqlExpressionBuilder text; + @override List get expressionBuilders { - return [id, isComplete, text, createdAt, updatedAt]; + return [id, createdAt, updatedAt, isComplete, text]; } } @@ -112,21 +124,11 @@ class TodoQueryValues extends MapQueryValues { return {}; } - int? get id { - return (values['id'] as int?); + String? get id { + return (values['id'] as String?); } - set id(int? value) => values['id'] = value; - bool? get isComplete { - return (values['is_complete'] as bool?); - } - - set isComplete(bool? value) => values['is_complete'] = value; - String? get text { - return (values['text'] as String?); - } - - set text(String? value) => values['text'] = value; + set id(String? value) => values['id'] = value; DateTime? get createdAt { return (values['created_at'] as DateTime?); } @@ -137,11 +139,21 @@ class TodoQueryValues extends MapQueryValues { } set updatedAt(DateTime? value) => values['updated_at'] = value; + bool? get isComplete { + return (values['is_complete'] as bool?); + } + + set isComplete(bool? value) => values['is_complete'] = value; + String? get text { + return (values['text'] as String?); + } + + set text(String? value) => values['text'] = value; void copyFrom(Todo model) { - isComplete = model.isComplete; - text = model.text; createdAt = model.createdAt; updatedAt = model.updatedAt; + isComplete = model.isComplete; + text = model.text; } } @@ -153,53 +165,61 @@ class TodoQueryValues extends MapQueryValues { class Todo extends _Todo { Todo( {this.id, - this.isComplete = false, - this.text, this.createdAt, - this.updatedAt}); + this.updatedAt, + this.isComplete = false, + this.text}); + + /// A unique identifier corresponding to this item. + @override + String? id; + + /// The time at which this item was created. + @override + DateTime? createdAt; + + /// The last time at which this item was updated. + @override + DateTime? updatedAt; @override - final String? id; + bool? isComplete; @override - final bool? isComplete; - - @override - final String? text; - - @override - final DateTime? createdAt; - - @override - final DateTime? updatedAt; + String? text; Todo copyWith( {String? id, - bool? isComplete, - String? text, DateTime? createdAt, - DateTime? updatedAt}) { + DateTime? updatedAt, + bool? isComplete, + String? text}) { return Todo( id: id ?? this.id, - isComplete: isComplete ?? this.isComplete, - text: text ?? this.text, createdAt: createdAt ?? this.createdAt, - updatedAt: updatedAt ?? this.updatedAt); + updatedAt: updatedAt ?? this.updatedAt, + isComplete: isComplete ?? this.isComplete, + text: text ?? this.text); } @override bool operator ==(other) { return other is _Todo && other.id == id && - other.isComplete == isComplete && - other.text == text && other.createdAt == createdAt && - other.updatedAt == updatedAt; + other.updatedAt == updatedAt && + other.isComplete == isComplete && + other.text == text; } @override int get hashCode { - return hashObjects([id, isComplete, text, createdAt, updatedAt]); + return hashObjects([id, createdAt, updatedAt, isComplete, text]); + } + + @override + String toString() { + return 'Todo(id=$id, createdAt=$createdAt, updatedAt=$updatedAt, isComplete=$isComplete, text=$text)'; } Map toJson() { @@ -211,39 +231,56 @@ class Todo extends _Todo { // SerializerGenerator // ************************************************************************** -abstract class TodoSerializer { - static Todo fromMap(Map map) { - if (map['is_complete'] == null) { - throw FormatException("Missing required field 'is_complete' on Todo."); - } +const TodoSerializer todoSerializer = TodoSerializer(); +class TodoEncoder extends Converter { + const TodoEncoder(); + + @override + Map convert(Todo model) => TodoSerializer.toMap(model); +} + +class TodoDecoder extends Converter { + const TodoDecoder(); + + @override + Todo convert(Map map) => TodoSerializer.fromMap(map); +} + +class TodoSerializer extends Codec { + const TodoSerializer(); + + @override + TodoEncoder get encoder => const TodoEncoder(); + @override + TodoDecoder get decoder => const TodoDecoder(); + static Todo fromMap(Map map) { return Todo( id: map['id'] as String?, - isComplete: map['is_complete'] as bool? ?? false, - text: map['text'] as String?, createdAt: map['created_at'] != null ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime?) + ? (map['created_at'] as DateTime) : DateTime.parse(map['created_at'].toString())) : null, updatedAt: map['updated_at'] != null ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime?) + ? (map['updated_at'] as DateTime) : DateTime.parse(map['updated_at'].toString())) - : null); + : null, + isComplete: map['is_complete'] as bool? ?? false, + text: map['text'] as String?); } - static Map toMap(_Todo model) { - if (model.isComplete == null) { - throw FormatException("Missing required field 'is_complete' on Todo."); + static Map toMap(_Todo? model) { + if (model == null) { + throw FormatException("Required field [model] cannot be null"); } - return { 'id': model.id, - 'is_complete': model.isComplete, - 'text': model.text, 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() + 'updated_at': model.updatedAt?.toIso8601String(), + 'is_complete': model.isComplete, + 'text': model.text }; } } @@ -251,19 +288,19 @@ abstract class TodoSerializer { abstract class TodoFields { static const List allFields = [ id, - isComplete, - text, createdAt, - updatedAt + updatedAt, + isComplete, + text ]; static const String id = 'id'; - static const String isComplete = 'is_complete'; - - static const String text = 'text'; - static const String createdAt = 'created_at'; static const String updatedAt = 'updated_at'; + + static const String isComplete = 'is_complete'; + + static const String text = 'text'; } diff --git a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart index 914068ec..aad5bcc3 100644 --- a/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart +++ b/packages/orm/angel_orm_mysql/lib/angel3_orm_mysql.dart @@ -1,156 +1,2 @@ -import 'dart:async'; -import 'package:angel3_orm/angel3_orm.dart'; -import 'package:logging/logging.dart'; -import 'package:mysql1/mysql1.dart'; - -class MySqlExecutor extends QueryExecutor { - /// An optional [Logger] to write to. - final Logger? logger; - - final MySqlConnection _connection; - - MySqlExecutor(this._connection, {this.logger}); - - final Dialect _dialect = const MySQLDialect(); - - @override - Dialect get dialect => _dialect; - - Future close() { - return _connection.close(); - /* - if (_connection is MySqlConnection) { - return (_connection as MySqlConnection).close(); - } else { - return Future.value(); - } - */ - } - - /* - Future _startTransaction() { - if (_connection is Transaction) { - return Future.value(_connection as Transaction?); - } else if (_connection is MySqlConnection) { - return (_connection as MySqlConnection).begin(); - } else { - throw StateError('Connection must be transaction or connection'); - } - } - - @override - Future> query( - String tableName, String query, Map substitutionValues, - [List returningFields = const []]) { - // Change @id -> ? - for (var name in substitutionValues.keys) { - query = query.replaceAll('@$name', '?'); - } - - logger?.fine('Query: $query'); - logger?.fine('Values: $substitutionValues'); - - if (returningFields.isNotEmpty != true) { - return _connection! - .prepared(query, substitutionValues.values) - .then((results) => results.map((r) => r.toList()).toList()); - } else { - return Future(() async { - var tx = await _startTransaction(); - - try { - var writeResults = - await tx.prepared(query, substitutionValues.values); - var fieldSet = returningFields.map((s) => '`$s`').join(','); - var fetchSql = 'select $fieldSet from $tableName where id = ?;'; - logger?.fine(fetchSql); - var readResults = - await tx.prepared(fetchSql, [writeResults.insertId]); - var mapped = readResults.map((r) => r.toList()).toList(); - await tx.commit(); - return mapped; - } catch (_) { - await tx.rollback(); - rethrow; - } - }); - } - } - */ - - @override - Future> query( - String tableName, String query, Map substitutionValues, - {String returningQuery = '', - List returningFields = const []}) async { - // Change @id -> ? - for (var name in substitutionValues.keys) { - query = query.replaceAll('@$name', '?'); - } - - var params = substitutionValues.values.toList(); - - //logger?.warning('Query: $query'); - //logger?.warning('Values: $params'); - //logger?.warning('Returning Query: $returningQuery'); - - if (returningQuery.isNotEmpty) { - // Handle insert, update and delete - // Retrieve back the inserted record - if (query.startsWith("INSERT")) { - var result = await _connection.query(query, params); - - query = returningQuery; - //logger?.warning('Result.insertId: ${result.insertId}'); - // Has primary key - //if (result.insertId != 0) { - if (returningQuery.endsWith('.id=?')) { - params = [result.insertId]; - } - } else if (query.startsWith("UPDATE")) { - await _connection.query(query, params); - query = returningQuery; - params = []; - } - } - - // Handle select - return _connection.query(query, params).then((results) { - return results.map((r) => r.toList()).toList(); - }); - } - - @override - Future transaction(FutureOr Function(QueryExecutor) f) async { - return f(this); - /* - if (_connection is! MySqlConnection) { - return await f(this); - } - - await _connection.transaction((context) async { - var executor = MySqlExecutor(context, logger: logger); - }); - */ - } - /* - @override - Future transaction(FutureOr Function(QueryExecutor) f) async { - if (_connection is Transaction) { - return await f(this); - } - - Transaction? tx; - try { - tx = await _startTransaction(); - var executor = MySqlExecutor(tx, logger: logger); - var result = await f(executor); - await tx.commit(); - return result; - } catch (_) { - await tx?.rollback(); - rethrow; - } - } - */ -} +export 'src/orm_mariadb.dart'; +export 'src/orm_mysql.dart'; diff --git a/packages/orm/angel_orm_mysql/lib/src/orm_mariadb.dart b/packages/orm/angel_orm_mysql/lib/src/orm_mariadb.dart new file mode 100644 index 00000000..873fa1c8 --- /dev/null +++ b/packages/orm/angel_orm_mysql/lib/src/orm_mariadb.dart @@ -0,0 +1,156 @@ +import 'dart:async'; +import 'package:angel3_orm/angel3_orm.dart'; +import 'package:logging/logging.dart'; +import 'package:mysql1/mysql1.dart'; + +class MariaDbExecutor extends QueryExecutor { + /// An optional [Logger] to write to. + final Logger? logger; + + final MySqlConnection _connection; + + MariaDbExecutor(this._connection, {this.logger}); + + final Dialect _dialect = const MySQLDialect(); + + @override + Dialect get dialect => _dialect; + + Future close() { + return _connection.close(); + /* + if (_connection is MySqlConnection) { + return (_connection as MySqlConnection).close(); + } else { + return Future.value(); + } + */ + } + + /* + Future _startTransaction() { + if (_connection is Transaction) { + return Future.value(_connection as Transaction?); + } else if (_connection is MySqlConnection) { + return (_connection as MySqlConnection).begin(); + } else { + throw StateError('Connection must be transaction or connection'); + } + } + + @override + Future> query( + String tableName, String query, Map substitutionValues, + [List returningFields = const []]) { + // Change @id -> ? + for (var name in substitutionValues.keys) { + query = query.replaceAll('@$name', '?'); + } + + logger?.fine('Query: $query'); + logger?.fine('Values: $substitutionValues'); + + if (returningFields.isNotEmpty != true) { + return _connection! + .prepared(query, substitutionValues.values) + .then((results) => results.map((r) => r.toList()).toList()); + } else { + return Future(() async { + var tx = await _startTransaction(); + + try { + var writeResults = + await tx.prepared(query, substitutionValues.values); + var fieldSet = returningFields.map((s) => '`$s`').join(','); + var fetchSql = 'select $fieldSet from $tableName where id = ?;'; + logger?.fine(fetchSql); + var readResults = + await tx.prepared(fetchSql, [writeResults.insertId]); + var mapped = readResults.map((r) => r.toList()).toList(); + await tx.commit(); + return mapped; + } catch (_) { + await tx.rollback(); + rethrow; + } + }); + } + } + */ + + @override + Future> query( + String tableName, String query, Map substitutionValues, + {String returningQuery = '', + List returningFields = const []}) async { + // Change @id -> ? + for (var name in substitutionValues.keys) { + query = query.replaceAll('@$name', '?'); + } + + var params = substitutionValues.values.toList(); + + //logger?.warning('Query: $query'); + //logger?.warning('Values: $params'); + //logger?.warning('Returning Query: $returningQuery'); + + if (returningQuery.isNotEmpty) { + // Handle insert, update and delete + // Retrieve back the inserted record + if (query.startsWith("INSERT")) { + var result = await _connection.query(query, params); + + query = returningQuery; + //logger?.warning('Result.insertId: ${result.insertId}'); + // Has primary key + //if (result.insertId != 0) { + if (returningQuery.endsWith('.id=?')) { + params = [result.insertId]; + } + } else if (query.startsWith("UPDATE")) { + await _connection.query(query, params); + query = returningQuery; + params = []; + } + } + + // Handle select + return _connection.query(query, params).then((results) { + return results.map((r) => r.toList()).toList(); + }); + } + + @override + Future transaction(FutureOr Function(QueryExecutor) f) async { + return f(this); + /* + if (_connection is! MySqlConnection) { + return await f(this); + } + + await _connection.transaction((context) async { + var executor = MySqlExecutor(context, logger: logger); + }); + */ + } + /* + @override + Future transaction(FutureOr Function(QueryExecutor) f) async { + if (_connection is Transaction) { + return await f(this); + } + + Transaction? tx; + try { + tx = await _startTransaction(); + var executor = MySqlExecutor(tx, logger: logger); + var result = await f(executor); + await tx.commit(); + return result; + } catch (_) { + await tx?.rollback(); + rethrow; + } + } + */ +} diff --git a/packages/orm/angel_orm_mysql/lib/src/orm_mysql.dart b/packages/orm/angel_orm_mysql/lib/src/orm_mysql.dart new file mode 100644 index 00000000..e8e112e0 --- /dev/null +++ b/packages/orm/angel_orm_mysql/lib/src/orm_mysql.dart @@ -0,0 +1,172 @@ +import 'dart:async'; +import 'package:angel3_orm/angel3_orm.dart'; +import 'package:logging/logging.dart'; +import 'package:mysql_client/mysql_client.dart'; + +class MySqlExecutor extends QueryExecutor { + /// An optional [Logger] to write to. + final Logger? logger; + + final MySQLConnection _connection; + + MySqlExecutor(this._connection, {this.logger}); + + final Dialect _dialect = const MySQLDialect(); + + @override + Dialect get dialect => _dialect; + + Future close() { + return _connection.close(); + /* + if (_connection is MySqlConnection) { + return (_connection as MySqlConnection).close(); + } else { + return Future.value(); + } + */ + } + + /* + Future _startTransaction() { + if (_connection is Transaction) { + return Future.value(_connection as Transaction?); + } else if (_connection is MySqlConnection) { + return (_connection as MySqlConnection).begin(); + } else { + throw StateError('Connection must be transaction or connection'); + } + } + + @override + Future> query( + String tableName, String query, Map substitutionValues, + [List returningFields = const []]) { + // Change @id -> ? + for (var name in substitutionValues.keys) { + query = query.replaceAll('@$name', '?'); + } + + logger?.fine('Query: $query'); + logger?.fine('Values: $substitutionValues'); + + if (returningFields.isNotEmpty != true) { + return _connection! + .prepared(query, substitutionValues.values) + .then((results) => results.map((r) => r.toList()).toList()); + } else { + return Future(() async { + var tx = await _startTransaction(); + + try { + var writeResults = + await tx.prepared(query, substitutionValues.values); + var fieldSet = returningFields.map((s) => '`$s`').join(','); + var fetchSql = 'select $fieldSet from $tableName where id = ?;'; + logger?.fine(fetchSql); + var readResults = + await tx.prepared(fetchSql, [writeResults.insertId]); + var mapped = readResults.map((r) => r.toList()).toList(); + await tx.commit(); + return mapped; + } catch (_) { + await tx.rollback(); + rethrow; + } + }); + } + } + */ + + @override + Future> query( + String tableName, String query, Map substitutionValues, + {String returningQuery = '', + List returningFields = const []}) async { + // Change @id -> ? + for (var name in substitutionValues.keys) { + query = query.replaceAll('@$name', ':$name'); + } + + //var params = substitutionValues.values.toList(); + var params = []; + + logger?.warning('Query: $query'); + logger?.warning('Values: $substitutionValues'); + //logger?.warning('Returning Query: $returningQuery'); + + if (returningQuery.isNotEmpty) { + // Handle insert, update and delete + // Retrieve back the inserted record + if (query.startsWith("INSERT")) { + var result = await _connection.execute(query, substitutionValues); + + logger?.warning(result.lastInsertID); + + query = returningQuery; + //logger?.warning('Result.insertId: ${result.insertId}'); + // Has primary key + //if (result.insertId != 0) { + if (returningQuery.endsWith('.id=?')) { + query = query.replaceAll("?", ":id"); + //params = [result.lastInsertID]; + substitutionValues.clear(); + substitutionValues['id'] = result.lastInsertID; + } + } else if (query.startsWith("UPDATE")) { + await _connection.execute(query, substitutionValues); + query = returningQuery; + params = []; + } + } + + logger?.warning('Query 2: $query'); + logger?.warning('Values 2: $substitutionValues'); + + // Handle select + return _connection.execute(query, substitutionValues).then((results) { + logger?.warning("SELECT"); + //for (var element in results.cols) { + // print( + // '${element.name} ${element.type.toString()} ${element.runtimeType.toString()}'); + //} + + return results.rows.map((r) => r.typedAssoc().values.toList()).toList(); + }); + } + + @override + Future transaction(FutureOr Function(QueryExecutor) f) async { + logger?.warning("Transaction"); + return f(this); + /* + if (_connection is! MySqlConnection) { + return await f(this); + } + + await _connection.transaction((context) async { + var executor = MySqlExecutor(context, logger: logger); + }); + */ + } + /* + @override + Future transaction(FutureOr Function(QueryExecutor) f) async { + if (_connection is Transaction) { + return await f(this); + } + + Transaction? tx; + try { + tx = await _startTransaction(); + var executor = MySqlExecutor(tx, logger: logger); + var result = await f(executor); + await tx.commit(); + return result; + } catch (_) { + await tx?.rollback(); + rethrow; + } + } + */ +} diff --git a/packages/orm/angel_orm_mysql/mono_pkg.yaml b/packages/orm/angel_orm_mysql/mono_pkg.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index 28a6a889..e706a2fa 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -4,19 +4,24 @@ description: MySQL support for Angel3 ORM. Includes functionality for querying a homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_mysql environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_orm: ^6.0.0 logging: ^1.0.0 mysql1: ^0.19.0 + mysql_client: ^0.0.11 optional: ^6.0.0 dev_dependencies: + angel3_orm_generator: ^6.0.0 angel3_orm_test: ^6.0.0 + build_runner: ^2.0.1 test: ^1.17.0 lints: ^1.0.0 dependency_overrides: angel3_serialize: path: ../../serialize/angel_serialize + angel3_serialize_generator: + path: ../../serialize/angel_serialize_generator angel3_model: path: ../../model angel3_orm_test: @@ -25,5 +30,5 @@ dependency_overrides: path: ../angel_orm angel3_migration: path: ../angel_migration - - + angel3_orm_generator: + path: ../angel_orm_generator diff --git a/packages/orm/angel_orm_mysql/test/common.dart b/packages/orm/angel_orm_mysql/test/common.dart index 7a2111f7..3c342b49 100644 --- a/packages/orm/angel_orm_mysql/test/common.dart +++ b/packages/orm/angel_orm_mysql/test/common.dart @@ -4,6 +4,7 @@ import 'package:angel3_orm/angel3_orm.dart'; import 'package:angel3_orm_mysql/angel3_orm_mysql.dart'; import 'package:logging/logging.dart'; import 'package:mysql1/mysql1.dart'; +import 'package:mysql_client/mysql_client.dart'; FutureOr Function() my(Iterable schemas) { return () => connectToMySql(schemas); @@ -12,14 +13,16 @@ FutureOr Function() my(Iterable schemas) { Future closeMy(QueryExecutor executor) => (executor as MySqlExecutor).close(); -Future connectToMySql(Iterable schemas) async { +// Executor for MariaDB 10.2.x +Future connectToMariaDb(Iterable schemas) async { var settings = ConnectionSettings( + host: 'localhost', + port: 3306, db: 'orm_test', - host: "localhost", - user: Platform.environment['MYSQL_USERNAME'] ?? 'Test', - password: Platform.environment['MYSQL_PASSWORD'] ?? 'Test123*', - timeout: Duration(minutes: 10)); + user: 'Test', + password: 'Test123*'); var connection = await MySqlConnection.connect(settings); + var logger = Logger('orm_mysql'); for (var s in schemas) { @@ -29,10 +32,40 @@ Future connectToMySql(Iterable schemas) async { for (var q in queries) { //print("Table: [$q]"); if (q.trim().isNotEmpty) { + //await connection.execute(q); await connection.query(q); } } } + return MariaDbExecutor(connection, logger: logger); +} + +// Executor for MySQL 8.x.x +Future connectToMySql(Iterable schemas) async { + var connection = await MySQLConnection.createConnection( + databaseName: 'orm_test', + port: 3306, + host: "localhost", + userName: Platform.environment['MYSQL_USERNAME'] ?? 'test', + password: Platform.environment['MYSQL_PASSWORD'] ?? 'Test123*', + ); + + await connection.connect(); + + var logger = Logger('orm_mysql'); + + for (var s in schemas) { + // MySQL driver does not support multiple sql queries + var data = await File('test/migrations/$s.sql').readAsString(); + var queries = data.split(";"); + for (var q in queries) { + //print("Table: [$q]"); + if (q.trim().isNotEmpty) { + await connection.execute(q); + } + } + } + return MySqlExecutor(connection, logger: logger); } diff --git a/packages/orm/angel_orm_postgres/CHANGELOG.md b/packages/orm/angel_orm_postgres/CHANGELOG.md index 68c9d060..55c462e6 100644 --- a/packages/orm/angel_orm_postgres/CHANGELOG.md +++ b/packages/orm/angel_orm_postgres/CHANGELOG.md @@ -2,15 +2,15 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.3.0 diff --git a/packages/orm/angel_orm_postgres/mono_pkg.yaml b/packages/orm/angel_orm_postgres/mono_pkg.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/orm/angel_orm_postgres/pubspec.yaml b/packages/orm/angel_orm_postgres/pubspec.yaml index 2489f8cc..5461fa27 100644 --- a/packages/orm/angel_orm_postgres/pubspec.yaml +++ b/packages/orm/angel_orm_postgres/pubspec.yaml @@ -4,7 +4,7 @@ description: PostgreSQL support for Angel3 ORM. Includes functionality for query homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_postgres environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_orm: ^6.0.0 logging: ^1.0.1 diff --git a/packages/orm/angel_orm_service/CHANGELOG.md b/packages/orm/angel_orm_service/CHANGELOG.md index b78f2d65..29d48277 100644 --- a/packages/orm/angel_orm_service/CHANGELOG.md +++ b/packages/orm/angel_orm_service/CHANGELOG.md @@ -2,19 +2,19 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.0.0 -* No release. Skipped +* Skipped release ## 2.0.1 diff --git a/packages/orm/angel_orm_service/pubspec.yaml b/packages/orm/angel_orm_service/pubspec.yaml index 146be94e..34fd76d5 100644 --- a/packages/orm/angel_orm_service/pubspec.yaml +++ b/packages/orm/angel_orm_service/pubspec.yaml @@ -4,7 +4,7 @@ description: Service implementation that wraps over Angel3 ORM Query classes. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_service environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 angel3_orm: ^6.0.0 diff --git a/packages/orm/angel_orm_test/CHANGELOG.md b/packages/orm/angel_orm_test/CHANGELOG.md index 95a5e8af..15099c77 100644 --- a/packages/orm/angel_orm_test/CHANGELOG.md +++ b/packages/orm/angel_orm_test/CHANGELOG.md @@ -2,15 +2,15 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.1.2 diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index 6c3c5c91..fa0a8333 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -97,7 +97,7 @@ class CarQuery extends Query { description: fields.contains('description') ? (row[4] as String?) : null, familyFriendly: - fields.contains('family_friendly') ? (row[5] as bool?) : null, + fields.contains('family_friendly') ? mapToBool(row[5]) : null, recalledAt: fields.contains('recalled_at') ? (row[6] as DateTime?) : null); return Optional.of(model); diff --git a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart index 3d11349a..0f73ca95 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart @@ -100,7 +100,7 @@ class PersonOrderQuery extends Query { price: fields.contains('price') ? double.tryParse(row[5].toString()) : null, - deleted: fields.contains('deleted') ? (row[6] as bool?) : null); + deleted: fields.contains('deleted') ? mapToBool(row[6]) : null); return Optional.of(model); } @@ -264,7 +264,7 @@ class OrderWithPersonInfoQuery price: fields.contains('price') ? double.tryParse(row[4].toString()) : null, - deleted: fields.contains('deleted') ? (row[5] as bool?) : null, + deleted: fields.contains('deleted') ? mapToBool(row[5]) : null, personName: fields.contains('person_name') ? (row[6] as String?) : null, personAge: fields.contains('person_age') ? (row[7] as int?) : null); return Optional.of(model); diff --git a/packages/orm/angel_orm_test/lib/src/standalone_test.dart b/packages/orm/angel_orm_test/lib/src/standalone_test.dart index fee387d5..66097910 100644 --- a/packages/orm/angel_orm_test/lib/src/standalone_test.dart +++ b/packages/orm/angel_orm_test/lib/src/standalone_test.dart @@ -173,9 +173,9 @@ void standaloneTests(FutureOr Function() createExecutor, }); test('insert', () async { - var recalledAt = DateTime.now(); + var recalledAt = DateTime.now().toUtc(); var query = CarQuery(); - var now = DateTime.now(); + var now = DateTime.now().toUtc(); query.values ..make = 'Honda' ..description = 'Hello' @@ -198,7 +198,7 @@ void standaloneTests(FutureOr Function() createExecutor, }); test('insert car', () async { - var recalledAt = DateTime.now(); + var recalledAt = DateTime.now().toUtc(); var beetle = Car( make: 'Beetle', description: 'Herbie', diff --git a/packages/orm/angel_orm_test/pubspec.yaml b/packages/orm/angel_orm_test/pubspec.yaml index a2dadc70..3a010492 100644 --- a/packages/orm/angel_orm_test/pubspec.yaml +++ b/packages/orm/angel_orm_test/pubspec.yaml @@ -4,7 +4,7 @@ description: Common tests for Angel3 ORM. Reference implmentation of the generat homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_test environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_migration: ^6.0.0 angel3_model: ^6.0.0 diff --git a/packages/orm/tool/.travis.sh b/packages/orm/tool/.travis.sh deleted file mode 100644 index 014ab75f..00000000 --- a/packages/orm/tool/.travis.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -export POSTGRES_USERNAME="angel_orm" -export POSTGRES_PASSWORD="angel_orm" -set -ex - -function angel_orm_test () { - cd $1; - pub get; - pub run test; - cd .. -} - -cd angel_orm_generator; -pub get; -echo 1 | pub run build_runner build --delete-conflicting-outputs; -cd ..; -angel_orm_test angel_orm_postgres -angel_orm_test angel_orm_service diff --git a/packages/paginate/.travis.yml b/packages/paginate/.travis.yml deleted file mode 100644 index de2210c9..00000000 --- a/packages/paginate/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: dart \ No newline at end of file diff --git a/packages/paginate/CHANGELOG.md b/packages/paginate/CHANGELOG.md index f2c76b8d..c47ecc55 100644 --- a/packages/paginate/CHANGELOG.md +++ b/packages/paginate/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.1.0 * Updated linter to `package:lints` diff --git a/packages/paginate/pubspec.yaml b/packages/paginate/pubspec.yaml index f518ae72..54e4d2d3 100644 --- a/packages/paginate/pubspec.yaml +++ b/packages/paginate/pubspec.yaml @@ -1,14 +1,14 @@ name: angel3_paginate -version: 3.1.0 +version: 6.0.0 description: Platform-agnostic pagination library, with custom support for the Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/paginate environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 dev_dependencies: - angel3_test: ^4.1.0 + angel3_test: ^6.0.0 logging: ^1.0.1 test: ^1.17.8 lints: ^1.0.0 \ No newline at end of file diff --git a/packages/production/CHANGELOG.md b/packages/production/CHANGELOG.md index 90751266..749f41f3 100644 --- a/packages/production/CHANGELOG.md +++ b/packages/production/CHANGELOG.md @@ -2,15 +2,15 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.0.0 -* No release. Skipped +* Skipped release ## 3.1.2 diff --git a/packages/production/pubspec.yaml b/packages/production/pubspec.yaml index fa9b9b75..f08d3dcf 100644 --- a/packages/production/pubspec.yaml +++ b/packages/production/pubspec.yaml @@ -4,7 +4,7 @@ description: Helpers for concurrency, message-passing, rotating loggers, and oth homepage: https://angel3-framework.web.app repository: https://github.com/dukefirehawk/angel/tree/master/packages/production environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_container: ^6.0.0 angel3_framework: ^6.0.0 diff --git a/packages/proxy/.travis.yml b/packages/proxy/.travis.yml deleted file mode 100644 index de2210c9..00000000 --- a/packages/proxy/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: dart \ No newline at end of file diff --git a/packages/proxy/CHANGELOG.md b/packages/proxy/CHANGELOG.md index 14785bc2..8b363afc 100644 --- a/packages/proxy/CHANGELOG.md +++ b/packages/proxy/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.0 * Updated linter to `package:lints` diff --git a/packages/proxy/pubspec.yaml b/packages/proxy/pubspec.yaml index 734cc29d..6dda34c0 100644 --- a/packages/proxy/pubspec.yaml +++ b/packages/proxy/pubspec.yaml @@ -1,18 +1,18 @@ name: angel3_proxy -version: 4.1.0 +version: 6.0.0 description: Angel middleware to forward requests to another server (i.e. pub serve). homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/proxy environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 http: ^0.13.3 http_parser: ^4.0.0 path: ^1.8.0 dev_dependencies: - angel3_test: ^4.1.0 - angel3_mock_request: ^2.1.0 + angel3_test: ^6.0.0 + angel3_mock_request: ^6.0.0 logging: ^1.0.1 lints: ^1.0.0 test: ^1.17.7 diff --git a/packages/redis/CHANGELOG.md b/packages/redis/CHANGELOG.md index 02bd0bb3..c78aa990 100644 --- a/packages/redis/CHANGELOG.md +++ b/packages/redis/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + +## 3.0.0 + +* Skipped release + ## 2.0.1 * Updated linter to `package:lints` diff --git a/packages/redis/pubspec.yaml b/packages/redis/pubspec.yaml index 7ae4dbf0..7f329eda 100644 --- a/packages/redis/pubspec.yaml +++ b/packages/redis/pubspec.yaml @@ -1,13 +1,13 @@ name: angel3_redis -version: 2.0.1 +version: 6.0.0 description: An Angel3 service provider for Redis. Works well for caching volatile data. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/redis environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_http_exception: ^3.0.0 + angel3_framework: ^6.0.0 + angel3_http_exception: ^6.0.0 resp_client: ^1.2.0 dev_dependencies: test: ^1.17.8 diff --git a/packages/rethink/melos_angel_rethink.iml b/packages/rethink/melos_angel_rethink.iml deleted file mode 100644 index 389d07a1..00000000 --- a/packages/rethink/melos_angel_rethink.iml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/route/CHANGELOG.md b/packages/route/CHANGELOG.md index 1cbf795c..a4cb21c4 100644 --- a/packages/route/CHANGELOG.md +++ b/packages/route/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to 2.16.x ## 5.2.0 diff --git a/packages/route/pubspec.yaml b/packages/route/pubspec.yaml index 5ffe78ca..de40ed9f 100644 --- a/packages/route/pubspec.yaml +++ b/packages/route/pubspec.yaml @@ -4,7 +4,7 @@ description: A powerful, isomorphic routing library for Dart. It is mainly used homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/route environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: belatuk_combinator: ^3.0.0 string_scanner: ^1.1.0 diff --git a/packages/security/CHANGELOG.md b/packages/security/CHANGELOG.md index e32f8924..b860569c 100644 --- a/packages/security/CHANGELOG.md +++ b/packages/security/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.1.0 * Updated linter to `package:lints` diff --git a/packages/security/example/rate_limit_redis.dart b/packages/security/example/rate_limit_redis.dart index 63f1cc1c..1b57ba57 100644 --- a/packages/security/example/rate_limit_redis.dart +++ b/packages/security/example/rate_limit_redis.dart @@ -33,7 +33,7 @@ void configureServer(Angel app) async { // Basic routes. app ..get('/', (req, res) { - var instance = req.container!.make()!; + var instance = req.container!.make(); res.writeln('This is instance ${instance.id}.'); }) ..fallback((req, res) => throw AngelHttpException.notFound()); diff --git a/packages/security/pubspec.yaml b/packages/security/pubspec.yaml index 53cc88e3..799d0646 100644 --- a/packages/security/pubspec.yaml +++ b/packages/security/pubspec.yaml @@ -1,18 +1,18 @@ name: angel3_security -version: 3.1.0 +version: 6.0.0 description: Angel3 infrastructure for improving security, rate limiting, and more homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/security environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 crypto: ^3.0.1 dev_dependencies: - angel3_auth: ^4.0.0 - angel3_production: ^3.1.0 - angel3_redis: ^2.0.0 - angel3_test: ^4.1.0 + angel3_auth: ^6.0.0 + angel3_production: ^6.0.0 + angel3_redis: ^6.0.0 + angel3_test: ^6.0.0 angel3_validate: ^4.0.0 belatuk_pretty_logging: ^4.0.0 test: ^1.17.5 diff --git a/packages/sembast/CHANGELOG.md b/packages/sembast/CHANGELOG.md index 2474542a..013e7c96 100644 --- a/packages/sembast/CHANGELOG.md +++ b/packages/sembast/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.0.1 * Updated README diff --git a/packages/sembast/pubspec.yaml b/packages/sembast/pubspec.yaml index 8d29e54f..75f5530e 100644 --- a/packages/sembast/pubspec.yaml +++ b/packages/sembast/pubspec.yaml @@ -1,15 +1,15 @@ name: angel3_sembast -version: 3.0.1 +version: 6.0.0 description: A plugin service that persist data to Sembast for Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/sembast environment: - sdk: '>=2.14.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 + angel3_framework: ^6.0.0 sembast: ^3.1.1 dev_dependencies: - angel3_http_exception: ^3.1.0 + angel3_http_exception: ^6.0.0 logging: ^1.0.1 lints: ^1.0.0 test: ^1.17.8 diff --git a/packages/seo/.travis.yml b/packages/seo/.travis.yml deleted file mode 100644 index a9e2c109..00000000 --- a/packages/seo/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: dart -dart: - - dev - - stable \ No newline at end of file diff --git a/packages/seo/CHANGELOG.md b/packages/seo/CHANGELOG.md index 2857785a..0acc38f1 100644 --- a/packages/seo/CHANGELOG.md +++ b/packages/seo/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.0 * Updated linter to `package:lints` diff --git a/packages/seo/pubspec.yaml b/packages/seo/pubspec.yaml index 731a5b14..9dd3d5ba 100644 --- a/packages/seo/pubspec.yaml +++ b/packages/seo/pubspec.yaml @@ -1,19 +1,19 @@ name: angel3_seo -version: 4.1.0 +version: 6.0.0 description: Helper infrastructure for building SEO-friendly Web backends in Angel3. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/seo environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_static: ^4.0.0 + angel3_framework: ^6.0.0 + angel3_static: ^6.0.0 file: ^6.1.2 html: ^0.15.0 http_parser: ^4.0.0 path: ^1.8.0 dev_dependencies: - angel3_test: ^4.0.0 + angel3_test: ^6.0.0 logging: ^1.0.1 test: ^1.17.8 lints: ^1.0.0 \ No newline at end of file diff --git a/packages/serialize/angel_serialize/CHANGELOG.md b/packages/serialize/angel_serialize/CHANGELOG.md index ec5800d3..7c943b8f 100644 --- a/packages/serialize/angel_serialize/CHANGELOG.md +++ b/packages/serialize/angel_serialize/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 diff --git a/packages/serialize/angel_serialize/pubspec.yaml b/packages/serialize/angel_serialize/pubspec.yaml index dec7bda1..94820335 100644 --- a/packages/serialize/angel_serialize/pubspec.yaml +++ b/packages/serialize/angel_serialize/pubspec.yaml @@ -4,7 +4,7 @@ description: Static annotations powering Angel3 model serialization. Combine wit homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_model: ^6.0.0 collection: ^1.15.0 diff --git a/packages/serialize/angel_serialize_generator/CHANGELOG.md b/packages/serialize/angel_serialize_generator/CHANGELOG.md index 8f8292ad..c64dc2fa 100644 --- a/packages/serialize/angel_serialize_generator/CHANGELOG.md +++ b/packages/serialize/angel_serialize_generator/CHANGELOG.md @@ -2,7 +2,7 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x * Updated to `analyzer` 3.x.x * Fixed default value for `List` and `Enum` diff --git a/packages/serialize/angel_serialize_generator/pubspec.yaml b/packages/serialize/angel_serialize_generator/pubspec.yaml index 01b23c44..10cf6afe 100644 --- a/packages/serialize/angel_serialize_generator/pubspec.yaml +++ b/packages/serialize/angel_serialize_generator/pubspec.yaml @@ -4,7 +4,7 @@ description: Angel3 model serialization generators, designed for use with Angel. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize_generator environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: analyzer: ^3.0.0 angel3_model: ^6.0.0 diff --git a/packages/shelf/CHANGELOG.md b/packages/shelf/CHANGELOG.md index 9793e29c..3bfd2188 100644 --- a/packages/shelf/CHANGELOG.md +++ b/packages/shelf/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0-beta.1 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.0.0-dev.3 * Fixed null safety warnings diff --git a/packages/shelf/lib/src/shelf_driver.dart b/packages/shelf/lib/src/shelf_driver.dart index a889f458..2775bfb7 100644 --- a/packages/shelf/lib/src/shelf_driver.dart +++ b/packages/shelf/lib/src/shelf_driver.dart @@ -106,7 +106,7 @@ class AngelShelf extends Driver=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_container: ^3.1.0 - angel3_mock_request: ^2.0.0 + angel3_framework: ^6.0.0 + angel3_container: ^6.0.0 + angel3_mock_request: ^6.0.0 path: ^1.8.0 shelf: ^1.1.4 stream_channel: ^2.1.0 @@ -16,7 +16,7 @@ dependencies: charcode: ^1.3.0 http: ^0.13.0 dev_dependencies: - angel3_test: ^4.1.0 + angel3_test: ^6.0.0 belatuk_pretty_logging: ^4.0.0 shelf_static: ^1.0.0 test: ^1.17.5 diff --git a/packages/static/CHANGELOG.md b/packages/static/CHANGELOG.md index 11c797a6..17d9f98e 100644 --- a/packages/static/CHANGELOG.md +++ b/packages/static/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/static/pubspec.yaml b/packages/static/pubspec.yaml index 6963401e..b2578f75 100644 --- a/packages/static/pubspec.yaml +++ b/packages/static/pubspec.yaml @@ -4,7 +4,7 @@ description: This library provides a virtual directory to serve static files for homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/static environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 belatuk_range_header: ^4.0.0 diff --git a/packages/sync/CHANGELOG.md b/packages/sync/CHANGELOG.md index f7393147..514f8137 100644 --- a/packages/sync/CHANGELOG.md +++ b/packages/sync/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 6.0.0 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + ## 4.1.1 * Fixed license link diff --git a/packages/sync/example/main.dart b/packages/sync/example/main.dart index 9699bfa5..f11908ff 100644 --- a/packages/sync/example/main.dart +++ b/packages/sync/example/main.dart @@ -32,7 +32,7 @@ void main() { app1.post('/message', (req, res) async { // Manually broadcast. Even though app1 has no clients, it *should* // propagate to app2. - var ws = req.container!.make()!; + var ws = req.container!.make(); // TODO: body retuns void //var body = await req.parseBody(); diff --git a/packages/sync/pubspec.yaml b/packages/sync/pubspec.yaml index dc16994e..093ed1bf 100644 --- a/packages/sync/pubspec.yaml +++ b/packages/sync/pubspec.yaml @@ -1,17 +1,17 @@ name: angel3_sync -version: 4.1.1 +version: 6.0.0 description: Easily synchronize and scale WebSockets using belatuk_pub_sub in Angel3. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/sync environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.2.0 - angel3_websocket: ^4.1.0 + angel3_framework: ^6.0.0 + angel3_websocket: ^6.0.0 belatuk_pub_sub: ^4.0.0 stream_channel: ^2.1.0 dev_dependencies: - angel3_test: ^4.1.0 + angel3_test: ^6.0.0 test: ^1.17.5 lints: ^1.0.0 #dependency_overrides: diff --git a/packages/sync/test/all_test.dart b/packages/sync/test/all_test.dart index e732e841..7fca039d 100644 --- a/packages/sync/test/all_test.dart +++ b/packages/sync/test/all_test.dart @@ -32,7 +32,7 @@ void main() { app1.post('/message', (req, res) async { // Manually broadcast. Even though app1 has no clients, it *should* // propagate to app2. - var ws = req.container!.make()!; + var ws = req.container!.make(); // TODO: body is void //var body = await req.parseBody(); diff --git a/packages/test/CHANGELOG.md b/packages/test/CHANGELOG.md index 32511c31..69a64c44 100644 --- a/packages/test/CHANGELOG.md +++ b/packages/test/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.1 diff --git a/packages/test/pubspec.yaml b/packages/test/pubspec.yaml index 1561afe9..88eef80a 100644 --- a/packages/test/pubspec.yaml +++ b/packages/test/pubspec.yaml @@ -4,7 +4,7 @@ description: Testing utility library for the Angel3 framework. Use with package: homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/test environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_client: ^6.0.0 angel3_framework: ^6.0.0 diff --git a/packages/user_agent/angel_user_agent/CHANGELOG.md b/packages/user_agent/angel_user_agent/CHANGELOG.md index fecf791f..58b1fc57 100644 --- a/packages/user_agent/angel_user_agent/CHANGELOG.md +++ b/packages/user_agent/angel_user_agent/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.0.0-beta.1 + +* Updated to SDK 2.16.x + +## 5.0.0 + +* Skipped release + +## 4.0.0 + +* Skipped release + ## 3.0.0-beta.1 * Migrated to support Dart SDK 2.12.x NNBD diff --git a/packages/user_agent/angel_user_agent/pubspec.yaml b/packages/user_agent/angel_user_agent/pubspec.yaml index 74a0ad54..4a94f8b5 100644 --- a/packages/user_agent/angel_user_agent/pubspec.yaml +++ b/packages/user_agent/angel_user_agent/pubspec.yaml @@ -1,11 +1,11 @@ name: angel3_user_agent -version: 3.0.0-beta.1 +version: 6.0.0-beta.1 description: Angel3 middleware to parse and inject a User Agent object into requests. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/user_agent/angel_user_agent environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: - angel3_framework: ^4.1.0 + angel3_framework: ^6.0.0 user_agent_analyzer: ^3.0.0 lints: ^1.0.0 \ No newline at end of file diff --git a/packages/validate/CHANGELOG.md b/packages/validate/CHANGELOG.md index 6a71361f..993c8378 100644 --- a/packages/validate/CHANGELOG.md +++ b/packages/validate/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.0 diff --git a/packages/validate/pubspec.yaml b/packages/validate/pubspec.yaml index 3e639f12..f39d62f4 100644 --- a/packages/validate/pubspec.yaml +++ b/packages/validate/pubspec.yaml @@ -4,7 +4,7 @@ version: 6.0.0 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/validate environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_framework: ^6.0.0 angel3_http_exception: ^6.0.0 diff --git a/packages/websocket/CHANGELOG.md b/packages/websocket/CHANGELOG.md index 7b0f06ea..fb1d920b 100644 --- a/packages/websocket/CHANGELOG.md +++ b/packages/websocket/CHANGELOG.md @@ -2,11 +2,11 @@ ## 6.0.0 -* Updated to min SDK 2.15.x +* Updated to SDK 2.16.x ## 5.0.0 -* No release. Skipped +* Skipped release ## 4.1.2 diff --git a/packages/websocket/pubspec.yaml b/packages/websocket/pubspec.yaml index ef87d2f9..382a4144 100644 --- a/packages/websocket/pubspec.yaml +++ b/packages/websocket/pubspec.yaml @@ -4,7 +4,7 @@ description: This library provides WebSockets support for Angel3 framework. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/websocket environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.16.0 <3.0.0' dependencies: angel3_auth: ^6.0.0 angel3_client: ^6.0.0 From 2ee12efedef3e4e2dcb3ee2e04fd096a06c219e9 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 23 Apr 2022 13:40:31 +0800 Subject: [PATCH 28/28] Updated SDK --- .github/workflows/dart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 33ffc28c..df020a9f 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -21,7 +21,7 @@ jobs: - uses: dart-lang/setup-dart@v1 with: - sdk: "2.15.1" + sdk: "2.16.2" - id: angel3_container_upgrade name: angel3_container; Upgrade depedencies @@ -87,7 +87,7 @@ jobs: - uses: dart-lang/setup-dart@v1 with: - sdk: "2.15.1" + sdk: "2.16.2" # Angel3 ORM - id: angel3_orm_upgrade