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!);