diff --git a/TODO.md b/TODO.md deleted file mode 100644 index b4359393..00000000 --- a/TODO.md +++ /dev/null @@ -1,12 +0,0 @@ -# Development Blueprint - -## Short Term Goal - -* Update examples -* Update User Guide - -## Long Term Goal - -* Refactor Angel3 architecture for performance and security - * Improve ORM features - * Improve HTTP performance diff --git a/belatuk.session.sql b/belatuk.session.sql deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/auth/README.md b/packages/auth/README.md index 9ed36a83..ea27ea8e 100644 --- a/packages/auth/README.md +++ b/packages/auth/README.md @@ -1,11 +1,11 @@ -# Angel3 Anthentication +# Protevus Anthentication ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_auth?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/auth/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/auth/LICENSE) -A complete authentication plugin for Angel3. Inspired by Passport. More details in the [User Guide](https://angel3-docs.dukefirehawk.com/guides/authentication). +A complete authentication plugin for Protevus. Inspired by Passport. More details in the [User Guide](https://angel3-docs.dukefirehawk.com/guides/authentication). ## Bundled Strategies diff --git a/packages/auth/example/example.dart b/packages/auth/example/example.dart index 85478101..93111ff3 100644 --- a/packages/auth/example/example.dart +++ b/packages/auth/example/example.dart @@ -4,7 +4,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(); + var app = Protevus(); var auth = AngelAuth( serializer: (user) => user.id ?? '', deserializer: (id) => fetchAUserByIdSomehow(id)); @@ -22,7 +22,7 @@ void main() async { app.post('/auth/local', auth.authenticate('local')); - var http = AngelHttp(app); + var http = ProtevusHttp(app); await http.startServer('127.0.0.1', 3000); print('Listening at http://127.0.0.1:3000'); diff --git a/packages/auth/example/example1.dart b/packages/auth/example/example1.dart index 7f8d901d..b13eb0fc 100644 --- a/packages/auth/example/example1.dart +++ b/packages/auth/example/example1.dart @@ -36,8 +36,8 @@ class User extends Model { void main() async { hierarchicalLoggingEnabled = true; - Angel app = Angel(reflector: MirrorsReflector()); - AngelHttp angelHttp = AngelHttp(app); + Protevus app = Protevus(reflector: MirrorsReflector()); + ProtevusHttp angelHttp = ProtevusHttp(app); app.use('/users', MapService()); var oldErrorHandler = app.errorHandler; diff --git a/packages/auth/example/example2.dart b/packages/auth/example/example2.dart index 77830377..aecb12ec 100644 --- a/packages/auth/example/example2.dart +++ b/packages/auth/example/example2.dart @@ -23,7 +23,7 @@ Future> verifier(String? username, String? password) async { } } -Future wireAuth(Angel app) async { +Future wireAuth(Protevus app) async { //auth.strategies['local'] = LocalAuthStrategy(verifier); auth.strategies['local'] = LocalAuthStrategy(verifier, forceBasic: true, realm: 'test'); @@ -34,8 +34,8 @@ Future wireAuth(Angel app) async { * Backend for local test cases */ void main() async { - Angel app = Angel(reflector: MirrorsReflector()); - AngelHttp angelHttp = AngelHttp(app, useZone: false); + Protevus app = Protevus(reflector: MirrorsReflector()); + ProtevusHttp angelHttp = ProtevusHttp(app, useZone: false); await app.configure(wireAuth); app.get('/hello', (req, res) { diff --git a/packages/auth/lib/src/auth_token.dart b/packages/auth/lib/src/auth_token.dart index be24d29f..e2090b4d 100644 --- a/packages/auth/lib/src/auth_token.dart +++ b/packages/auth/lib/src/auth_token.dart @@ -68,7 +68,7 @@ class AuthToken { if (split.length != 3) { _log.warning('Invalid JWT'); - throw AngelHttpException.notAuthenticated(message: 'Invalid JWT.'); + throw ProtevusHttpException.notAuthenticated(message: 'Invalid JWT.'); } var payloadString = decodeBase64(split[1]); @@ -81,7 +81,7 @@ class AuthToken { if (split.length != 3) { _log.warning('Invalid JWT'); - throw AngelHttpException.notAuthenticated(message: 'Invalid JWT.'); + throw ProtevusHttpException.notAuthenticated(message: 'Invalid JWT.'); } // var headerString = decodeBase64(split[0]); @@ -91,7 +91,7 @@ class AuthToken { if (signature != split[2]) { _log.warning('JWT payload does not match hashed version'); - throw AngelHttpException.notAuthenticated( + throw ProtevusHttpException.notAuthenticated( message: 'JWT payload does not match hashed version.'); } diff --git a/packages/auth/lib/src/middleware/require_auth.dart b/packages/auth/lib/src/middleware/require_auth.dart index 26fcd4e6..2ada1151 100644 --- a/packages/auth/lib/src/middleware/require_auth.dart +++ b/packages/auth/lib/src/middleware/require_auth.dart @@ -17,7 +17,7 @@ RequestHandler forceBasicAuth({String? realm}) { } res.headers['www-authenticate'] = 'Basic realm="${realm ?? 'angel_auth'}"'; - throw AngelHttpException.notAuthenticated(); + throw ProtevusHttpException.notAuthenticated(); }; } @@ -28,7 +28,7 @@ RequestHandler requireAuthentication() { bool reject(ResponseContext res) { if (throwError) { res.statusCode = 403; - throw AngelHttpException.forbidden(); + throw ProtevusHttpException.forbidden(); } else { return false; } diff --git a/packages/auth/lib/src/plugin.dart b/packages/auth/lib/src/plugin.dart index 1ff5a4a5..f263addd 100644 --- a/packages/auth/lib/src/plugin.dart +++ b/packages/auth/lib/src/plugin.dart @@ -97,7 +97,7 @@ class AngelAuth { /// Configures an Angel server to decode and validate JSON Web tokens on demand, /// whenever an instance of [User] is injected. - Future configureServer(Angel app) async { + Future configureServer(Protevus app) async { /* if (serializer == null) { throw StateError( @@ -109,7 +109,7 @@ class AngelAuth { } if (app.container == null) { - _log.severe('Angel3 container is null'); + _log.severe('Protevus container is null'); throw StateError( 'Angel.container is null. All authentication will fail.'); } @@ -136,7 +136,7 @@ class AngelAuth { return result; } else { _log.warning('JWT is null'); - throw AngelHttpException.forbidden(); + throw ProtevusHttpException.forbidden(); } }); @@ -223,7 +223,7 @@ class AngelAuth { if (enforceIp) { if (req.ip != token.ipAddress) { _log.warning('JWT cannot be accessed from this IP address'); - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'JWT cannot be accessed from this IP address.'); } } @@ -234,7 +234,7 @@ class AngelAuth { if (!expiry.isAfter(DateTime.now())) { _log.warning('Expired JWT'); - throw AngelHttpException.forbidden(message: 'Expired JWT.'); + throw ProtevusHttpException.forbidden(message: 'Expired JWT.'); } } @@ -308,13 +308,13 @@ class AngelAuth { if (jwt == null) { _log.warning('No JWT provided'); - throw AngelHttpException.forbidden(message: 'No JWT provided'); + throw ProtevusHttpException.forbidden(message: 'No JWT provided'); } else { var token = AuthToken.validate(jwt, _hs256); if (enforceIp) { if (req.ip != token.ipAddress) { _log.warning('WT cannot be accessed from this IP address'); - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'JWT cannot be accessed from this IP address.'); } } @@ -339,11 +339,11 @@ class AngelAuth { return {'data': data, 'token': token.serialize(_hs256)}; } } catch (e) { - if (e is AngelHttpException) { + if (e is ProtevusHttpException) { rethrow; } _log.warning('Malformed JWT'); - throw AngelHttpException.badRequest(message: 'Malformed JWT'); + throw ProtevusHttpException.badRequest(message: 'Malformed JWT'); } } @@ -452,7 +452,7 @@ class AngelAuth { return false; } else { _log.warning('Not authenticated'); - throw AngelHttpException.notAuthenticated(); + throw ProtevusHttpException.notAuthenticated(); } } } diff --git a/packages/auth/lib/src/strategies/local.dart b/packages/auth/lib/src/strategies/local.dart index ac21ac1d..40b2d699 100644 --- a/packages/auth/lib/src/strategies/local.dart +++ b/packages/auth/lib/src/strategies/local.dart @@ -55,7 +55,7 @@ class LocalAuthStrategy extends AuthStrategy { await verifier(usrPassMatch.group(1), usrPassMatch.group(2)); } else { _log.warning('Bad request: $invalidMessage'); - throw AngelHttpException.badRequest(errors: [invalidMessage]); + throw ProtevusHttpException.badRequest(errors: [invalidMessage]); } if (verificationResult == null) { @@ -108,7 +108,7 @@ class LocalAuthStrategy extends AuthStrategy { } _log.info('Not authenticated'); - throw AngelHttpException.notAuthenticated(); + throw ProtevusHttpException.notAuthenticated(); /* if (verificationResult is Map && verificationResult.isEmpty) { diff --git a/packages/auth/pubspec.yaml b/packages/auth/pubspec.yaml index 33532fbf..b6dd0b76 100644 --- a/packages/auth/pubspec.yaml +++ b/packages/auth/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_auth -description: A complete authentication plugin for Angel3. Includes support for stateless JWT tokens, Basic Auth, and more. +description: A complete authentication plugin for Protevus. Includes support for stateless JWT tokens, Basic Auth, and more. version: 8.2.0 homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/auth +repository: https://github.com/dart-backend/protevus/tree/master/packages/auth environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/auth/test/callback_test.dart b/packages/auth/test/callback_test.dart index f1b8622b..27f3849d 100644 --- a/packages/auth/test/callback_test.dart +++ b/packages/auth/test/callback_test.dart @@ -35,8 +35,8 @@ class User extends Model { } void main() { - late Angel app; - late AngelHttp angelHttp; + late Protevus app; + late ProtevusHttp angelHttp; AngelAuth auth; http.Client? client; HttpServer server; @@ -45,8 +45,8 @@ void main() { setUp(() async { hierarchicalLoggingEnabled = true; - app = Angel(reflector: MirrorsReflector()); - angelHttp = AngelHttp(app); + app = Protevus(reflector: MirrorsReflector()); + angelHttp = ProtevusHttp(app); app.use('/users', MapService()); var oldErrorHandler = app.errorHandler; diff --git a/packages/auth/test/local_test.dart b/packages/auth/test/local_test.dart index f7b9f48a..6a9f8464 100644 --- a/packages/auth/test/local_test.dart +++ b/packages/auth/test/local_test.dart @@ -26,7 +26,7 @@ Future> verifier(String? username, String? password) async { } } -Future wireAuth(Angel app) async { +Future wireAuth(Protevus app) async { //auth.serializer = (user) async => 1337; //auth.deserializer = (id) async => sampleUser; @@ -35,16 +35,16 @@ Future wireAuth(Angel app) async { } void main() async { - Angel app; - late AngelHttp angelHttp; + Protevus app; + late ProtevusHttp angelHttp; late http.Client client; String? url; String? basicAuthUrl; setUp(() async { client = http.Client(); - app = Angel(reflector: MirrorsReflector()); - angelHttp = AngelHttp(app, useZone: false); + app = Protevus(reflector: MirrorsReflector()); + angelHttp = ProtevusHttp(app, useZone: false); await app.configure(wireAuth); app.get('/hello', (req, res) { diff --git a/packages/auth_oauth2/README.md b/packages/auth_oauth2/README.md index 48dba12d..39ea9dd3 100644 --- a/packages/auth_oauth2/README.md +++ b/packages/auth_oauth2/README.md @@ -1,11 +1,11 @@ -# Angel3 OAuth2 Handler +# Protevus OAuth2 Handler ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_auth_oauth2?include_prereleases) ![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)() [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/auth_oauth2/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/auth_oauth2/LICENSE) -Angel3 library for authenticating users with remote identity providers via OAuth2, i.e. Facebook, Google, Azure AD, etc. +Protevus library for authenticating users with remote identity providers via OAuth2, i.e. Facebook, Google, Azure AD, etc. ## Usage diff --git a/packages/auth_oauth2/example/main.dart b/packages/auth_oauth2/example/main.dart index c2071e79..5dd2372f 100644 --- a/packages/auth_oauth2/example/main.dart +++ b/packages/auth_oauth2/example/main.dart @@ -33,9 +33,9 @@ Map parseParamsFromGithub(MediaType contentType, String body) { void main() async { // Create the server instance. - var app = Angel(); - var http = AngelHttp(app); - app.logger = Logger('angel') + var app = Protevus(); + var http = ProtevusHttp(app); + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); diff --git a/packages/auth_oauth2/pubspec.yaml b/packages/auth_oauth2/pubspec.yaml index 1ff11e2a..9a19858b 100644 --- a/packages/auth_oauth2/pubspec.yaml +++ b/packages/auth_oauth2/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_auth_oauth2 version: 8.2.0 -description: Angel3 library for authenticating users with external identity providers via OAuth2. +description: Protevus library for authenticating users with external identity providers via OAuth2. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/auth_oauth2 +repository: https://github.com/dart-backend/protevus/tree/master/packages/auth_oauth2 environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/auth_twitter/README.md b/packages/auth_twitter/README.md index 3e1bead4..bf9a3707 100644 --- a/packages/auth_twitter/README.md +++ b/packages/auth_twitter/README.md @@ -1,11 +1,11 @@ -# Angel3 Twitter OAuth1 +# Protevus Twitter OAuth1 ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_auth_twitter?include_prereleases) ![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)]() [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/auth_twitter/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/auth_twitter/LICENSE) **Not ready for release** -Angel3 authentication strategy using Twitter OAuth 1.0a. +Protevus authentication strategy using Twitter OAuth 1.0a. See the [example](example/example.dart); diff --git a/packages/auth_twitter/example/example.dart b/packages/auth_twitter/example/example.dart index 60d6312f..cc62fcf2 100644 --- a/packages/auth_twitter/example/example.dart +++ b/packages/auth_twitter/example/example.dart @@ -15,8 +15,8 @@ class _User { } void main() async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); var auth = AngelAuth<_User>( jwtKey: 'AUTH_TWITTER_SECRET', allowCookie: false, diff --git a/packages/auth_twitter/pubspec.yaml b/packages/auth_twitter/pubspec.yaml index ba8c10b4..bd1035ee 100644 --- a/packages/auth_twitter/pubspec.yaml +++ b/packages/auth_twitter/pubspec.yaml @@ -1,8 +1,8 @@ name: "angel3_auth_twitter" -description: Angel3 authentication strategy for Twitter login. Auto-signs requests. +description: Protevus authentication strategy for Twitter login. Auto-signs requests. version: 8.0.0 homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/auth_twitter +repository: https://github.com/dart-backend/protevus/tree/master/packages/auth_twitter publish_to: none environment: sdk: ">=3.3.0 <4.0.0" diff --git a/packages/cache/README.md b/packages/cache/README.md index c09f7fe9..38662582 100644 --- a/packages/cache/README.md +++ b/packages/cache/README.md @@ -1,11 +1,11 @@ -# Angel3 HTTP Cache +# Protevus HTTP Cache ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_cache?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/cache/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/cache/LICENSE) -A service that provides HTTP caching to the response data for [Angel3 framework](https://pub.dev/packages/angel3). +A service that provides HTTP caching to the response data for [Protevus framework](https://pub.dev/packages/angel3). ## `CacheService` @@ -40,7 +40,7 @@ void main() async { ## `ResponseCache` -A flexible response cache for Angel3. +A flexible response cache for Protevus. Use this to improve real and perceived response of Web applications, as well as to memorize expensive responses. diff --git a/packages/cache/example/cache_service.dart b/packages/cache/example/cache_service.dart index 8fc4706a..00b501db 100644 --- a/packages/cache/example/cache_service.dart +++ b/packages/cache/example/cache_service.dart @@ -3,7 +3,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(); + var app = Protevus(); app.use( '/api/todos', @@ -18,7 +18,7 @@ void main() async { })), ); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer('127.0.0.1', 3000); print('Listening at http://${server.address.address}:${server.port}'); } diff --git a/packages/cache/example/main.dart b/packages/cache/example/main.dart index f604ff70..b8447fa1 100644 --- a/packages/cache/example/main.dart +++ b/packages/cache/example/main.dart @@ -3,7 +3,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(); + var app = Protevus(); // Cache a glob var cache = ResponseCache() @@ -21,7 +21,7 @@ void main() async { // Support purging the cache. app.addRoute('PURGE', '*', (req, res) { if (req.ip != '127.0.0.1') { - throw AngelHttpException.forbidden(); + throw ProtevusHttpException.forbidden(); } cache.purge(req.uri!.path); @@ -31,7 +31,7 @@ void main() async { // The response finalizer that actually saves the content app.responseFinalizers.add(cache.responseFinalizer); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer('127.0.0.1', 3000); print('Listening at http://${server.address.address}:${server.port}'); } diff --git a/packages/cache/pubspec.yaml b/packages/cache/pubspec.yaml index 8b615739..9383a838 100644 --- a/packages/cache/pubspec.yaml +++ b/packages/cache/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_cache version: 8.2.0 -description: A service that provides HTTP caching to the response data for Angel3 +description: A service that provides HTTP caching to the response data for Protevus homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/cache +repository: https://github.com/dart-backend/protevus/tree/master/packages/cache environment: sdk: '>=3.4.0 <4.0.0' dependencies: diff --git a/packages/cache/test/cache_test.dart b/packages/cache/test/cache_test.dart index f0a01de1..9089de69 100644 --- a/packages/cache/test/cache_test.dart +++ b/packages/cache/test/cache_test.dart @@ -21,7 +21,7 @@ Future main() async { late http.Response response1, response2; setUp(() async { - var app = Angel(); + var app = Protevus(); var cache = ResponseCache() ..patterns.addAll([ //Glob('/*.txt'), // Requires to create folders and files for testing diff --git a/packages/client/README.md b/packages/client/README.md index 5b2ec3d2..7647090b 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -1,11 +1,11 @@ -# Angel3 Client +# Protevus Client ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_client?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/client/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/client/LICENSE) -A browser, mobile and command line based client that supports querying Angel3 backend. +A browser, mobile and command line based client that supports querying Protevus backend. ## Usage diff --git a/packages/client/example/client/example_client.dart b/packages/client/example/client/example_client.dart index 2266d154..a6615044 100644 --- a/packages/client/example/client/example_client.dart +++ b/packages/client/example/client/example_client.dart @@ -1,7 +1,7 @@ import 'package:angel3_client/io.dart' as c; void main() async { - c.Angel client = c.Rest('http://localhost:3000'); + c.Protevus client = c.Rest('http://localhost:3000'); const Map user = {'username': 'foo', 'password': 'bar'}; diff --git a/packages/client/example/example1.dart b/packages/client/example/example1.dart index d63af47c..2e49cb5b 100644 --- a/packages/client/example/example1.dart +++ b/packages/client/example/example1.dart @@ -8,8 +8,8 @@ void main() async { var localOpts = AngelAuthOptions>(canRespondWithJson: true); - Angel app = Angel(); - AngelHttp http = AngelHttp(app, useZone: false); + Protevus app = Protevus(); + ProtevusHttp http = ProtevusHttp(app, useZone: false); var auth = AngelAuth( serializer: (_) async => 'baz', deserializer: (_) async => user); diff --git a/packages/client/example/main.dart b/packages/client/example/main.dart index 3768fd5f..dd868123 100644 --- a/packages/client/example/main.dart +++ b/packages/client/example/main.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:angel3_client/angel3_client.dart'; -Future doSomething(Angel app) async { +Future doSomething(Protevus app) async { var userService = app .service>('api/users') .map(User.fromMap, User.toMap); diff --git a/packages/client/lib/angel3_client.dart b/packages/client/lib/angel3_client.dart index 853dc903..b033ac0e 100644 --- a/packages/client/lib/angel3_client.dart +++ b/packages/client/lib/angel3_client.dart @@ -8,17 +8,17 @@ import 'package:http/http.dart' as http; //import 'package:logging/logging.dart'; export 'package:angel3_http_exception/angel3_http_exception.dart'; -/// A function that configures an [Angel] client in some way. -typedef AngelConfigurer = FutureOr Function(Angel app); +/// A function that configures an [Protevus] client in some way. +typedef ProtevusConfigurer = FutureOr Function(Protevus app); /// A function that deserializes data received from the server. /// /// This is only really necessary in the browser, where `json_god` /// doesn't work. -typedef AngelDeserializer = T? Function(dynamic x); +typedef ProtevusDeserializer = T? Function(dynamic x); /// Represents an Angel server that we are querying. -abstract class Angel extends http.BaseClient { +abstract class Protevus extends http.BaseClient { //final _log = Logger('Angel'); /// A mutable member. When this is set, it holds a JSON Web Token @@ -30,11 +30,11 @@ abstract class Angel extends http.BaseClient { /// The root URL at which the target server. final Uri baseUrl; - Angel(baseUrl) + Protevus(baseUrl) : baseUrl = baseUrl is Uri ? baseUrl : Uri.parse(baseUrl.toString()); /// Fired whenever a WebSocket is successfully authenticated. - Stream get onAuthenticated; + Stream get onAuthenticated; /// Authenticates against the server. /// @@ -43,11 +43,11 @@ abstract class Angel extends http.BaseClient { /// The [type] is appended to the [authEndpoint], ex. `local` becomes `/auth/local`. /// /// The given [credentials] are sent to server as-is; the request body is sent as JSON. - Future authenticate( + Future authenticate( {required String type, credentials, String authEndpoint = '/auth'}); /// Shorthand for authenticating via a JWT string. - Future reviveJwt(String token, + Future reviveJwt(String token, {String authEndpoint = '/auth'}) { return authenticate( type: 'token', @@ -62,8 +62,8 @@ abstract class Angel extends http.BaseClient { @override Future close(); - /// Applies an [AngelConfigurer] to this instance. - Future configure(AngelConfigurer configurer) async { + /// Applies an [ProtevusConfigurer] to this instance. + Future configure(ProtevusConfigurer configurer) async { await configurer(this); } @@ -80,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, - {AngelDeserializer? deserializer}); + {ProtevusDeserializer? deserializer}); //@override //Future delete(url, {Map headers}); @@ -105,21 +105,21 @@ abstract class Angel extends http.BaseClient { } /// Represents the result of authentication with an Angel server. -class AngelAuthResult { +class ProtevusAuthResult { String? _token; final Map data = {}; /// The JSON Web token that was sent with this response. String? get token => _token; - AngelAuthResult({String? token, Map data = const {}}) { + ProtevusAuthResult({String? token, Map data = const {}}) { _token = token; this.data.addAll(data); } /// Attempts to deserialize a response from a [Map]. - factory AngelAuthResult.fromMap(Map? data) { - final result = AngelAuthResult(); + factory ProtevusAuthResult.fromMap(Map? data) { + final result = ProtevusAuthResult(); if (data is Map && data.containsKey('token') && data['token'] is String) { result._token = data['token'].toString(); @@ -141,8 +141,8 @@ class AngelAuthResult { } /// Attempts to deserialize a response from a [String]. - factory AngelAuthResult.fromJson(String s) => - AngelAuthResult.fromMap(json.decode(s) as Map?); + factory ProtevusAuthResult.fromJson(String s) => + ProtevusAuthResult.fromMap(json.decode(s) as Map?); /// Converts this instance into a JSON-friendly representation. Map toJson() { @@ -171,7 +171,7 @@ abstract class Service { Stream get onRemoved; /// The Angel instance powering this service. - Angel get app; + Protevus get app; Future close(); @@ -209,7 +209,7 @@ class _MappedService extends Service { _MappedService(this.inner, this.encoder, this.decoder); @override - Angel get app => inner.app; + Protevus get app => inner.app; @override Future close() => Future.value(); diff --git a/packages/client/lib/base_angel_client.dart b/packages/client/lib/base_angel_client.dart index 5f790758..aa748c0d 100644 --- a/packages/client/lib/base_angel_client.dart +++ b/packages/client/lib/base_angel_client.dart @@ -18,22 +18,22 @@ Map _buildQuery(Map? params) { bool _invalid(Response response) => response.statusCode < 200 || response.statusCode >= 300; -AngelHttpException failure(Response response, +ProtevusHttpException failure(Response response, {error, String? message, StackTrace? stack}) { try { var v = json.decode(response.body); if (v is Map && (v['is_error'] == true) || v['isError'] == true) { - return AngelHttpException.fromMap(v as Map); + return ProtevusHttpException.fromMap(v as Map); } else { - return AngelHttpException( + return ProtevusHttpException( message: message ?? 'Unhandled exception while connecting to Angel backend.', statusCode: response.statusCode, stackTrace: stack); } } catch (e, st) { - return AngelHttpException( + return ProtevusHttpException( message: message ?? 'Angel backend did not return JSON - an error likely occurred.', statusCode: response.statusCode, @@ -41,22 +41,22 @@ AngelHttpException failure(Response response, } } -abstract class BaseAngelClient extends Angel { +abstract class BaseProtevusClient extends Protevus { final _log = Logger('BaseAngelClient'); - final StreamController _onAuthenticated = - StreamController(); + final StreamController _onAuthenticated = + StreamController(); final List _services = []; final BaseClient client; final Context _p = Context(style: Style.url); @override - Stream get onAuthenticated => _onAuthenticated.stream; + Stream get onAuthenticated => _onAuthenticated.stream; - BaseAngelClient(this.client, baseUrl) : super(baseUrl); + BaseProtevusClient(this.client, baseUrl) : super(baseUrl); @override - Future authenticate( + Future authenticate( {String? type, credentials, String authEndpoint = '/auth'}) async { type ??= 'token'; @@ -87,14 +87,14 @@ abstract class BaseAngelClient extends Angel { var v = jsonDecode(response.body); if (v is! Map || !v.containsKey('data') || !v.containsKey('token')) { - throw AngelHttpException.notAuthenticated( + throw ProtevusHttpException.notAuthenticated( message: "Auth endpoint '$url' did not return a proper response."); } - var r = AngelAuthResult.fromMap(v); + var r = ProtevusAuthResult.fromMap(v); _onAuthenticated.add(r); return r; - } on AngelHttpException { + } on ProtevusHttpException { rethrow; } catch (e, st) { _log.severe(st); @@ -153,9 +153,9 @@ abstract class BaseAngelClient extends Angel { @override Service service(String path, - {Type? type, AngelDeserializer? deserializer}) { + {Type? type, ProtevusDeserializer? deserializer}) { var url = baseUrl.replace(path: _p.join(baseUrl.path, path)); - var s = BaseAngelService(client, this, url, + var s = BaseProtevusService(client, this, url, deserializer: deserializer); _services.add(s); return s as Service; @@ -201,14 +201,14 @@ abstract class BaseAngelClient extends Angel { } } -class BaseAngelService extends Service { - final _log = Logger('BaseAngelService'); +class BaseProtevusService extends Service { + final _log = Logger('BaseProtevusService'); @override - final BaseAngelClient app; + final BaseProtevusClient app; final Uri baseUrl; final BaseClient client; - final AngelDeserializer? deserializer; + final ProtevusDeserializer? deserializer; final Context _p = Context(style: Style.url); @@ -247,7 +247,7 @@ class BaseAngelService extends Service { await _onRemoved.close(); } - BaseAngelService(this.client, this.app, baseUrl, {this.deserializer}) + BaseProtevusService(this.client, this.app, baseUrl, {this.deserializer}) : baseUrl = baseUrl is Uri ? baseUrl : Uri.parse(baseUrl.toString()); Data? deserialize(x) { diff --git a/packages/client/lib/browser.dart b/packages/client/lib/browser.dart index 941fbbb7..a9dc1a80 100644 --- a/packages/client/lib/browser.dart +++ b/packages/client/lib/browser.dart @@ -12,11 +12,11 @@ import 'base_angel_client.dart'; export 'angel3_client.dart'; /// Queries an Angel server via REST. -class Rest extends BaseAngelClient { +class Rest extends BaseProtevusClient { Rest(String basePath) : super(http.BrowserClient(), basePath); @override - Future authenticate( + Future authenticate( {String? type, credentials, String authEndpoint = '/auth'}) async { if (type == null || type == 'token') { if (!window.localStorage.containsKey('token')) { @@ -46,7 +46,7 @@ class Rest extends BaseAngelClient { t = Timer.periodic(Duration(milliseconds: 500), (timer) { if (!ctrl.isClosed) { if (wnd.closed!) { - ctrl.addError(AngelHttpException.notAuthenticated( + ctrl.addError(ProtevusHttpException.notAuthenticated( message: errorMessage ?? 'Authentication via popup window failed.')); ctrl.close(); diff --git a/packages/client/lib/flutter.dart b/packages/client/lib/flutter.dart index 0a2bc2cd..9394b400 100644 --- a/packages/client/lib/flutter.dart +++ b/packages/client/lib/flutter.dart @@ -7,7 +7,7 @@ import 'base_angel_client.dart'; export 'angel3_client.dart'; /// Queries an Angel server via REST. -class Rest extends BaseAngelClient { +class Rest extends BaseProtevusClient { Rest(String basePath) : super(http.Client() as http.BaseClient, basePath); @override diff --git a/packages/client/lib/io.dart b/packages/client/lib/io.dart index 49ab641a..745a1b9a 100644 --- a/packages/client/lib/io.dart +++ b/packages/client/lib/io.dart @@ -11,7 +11,7 @@ import 'base_angel_client.dart'; export 'angel3_client.dart'; /// Queries an Angel server via REST. -class Rest extends BaseAngelClient { +class Rest extends BaseProtevusClient { //final _log = Logger('REST'); final List _services = []; @@ -19,7 +19,7 @@ class Rest extends BaseAngelClient { @override Service service(String path, - {Type? type, AngelDeserializer? deserializer}) { + {Type? type, ProtevusDeserializer? deserializer}) { var url = baseUrl.replace(path: p.join(baseUrl.path, path)); var s = RestService(client, this, url, type); _services.add(s); @@ -43,7 +43,7 @@ class Rest extends BaseAngelClient { } /// Queries an Angel service via REST. -class RestService extends BaseAngelService { +class RestService extends BaseProtevusService { final _log = Logger('RestService'); final Type? type; diff --git a/packages/client/package.json b/packages/client/package.json index 70867bee..a1da32d9 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -15,18 +15,18 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/angel-dart/angel_client.git" + "url": "git+https://github.com/protevus-dart/angel_client.git" }, "keywords": [ - "angel", + "protevus", "angel_client" ], "author": "Tobe O ", "license": "MIT", "bugs": { - "url": "https://github.com/angel-dart/angel_client/issues" + "url": "https://github.com/protevus-dart/angel_client/issues" }, - "homepage": "https://github.com/angel-dart/angel_client#readme", + "homepage": "https://github.com/protevus-dart/angel_client#readme", "devDependencies": { "babel-cli": "^6.18.0", "babel-plugin-add-module-exports": "^0.2.1", diff --git a/packages/client/pubspec.yaml b/packages/client/pubspec.yaml index b3594081..d7fa77a3 100644 --- a/packages/client/pubspec.yaml +++ b/packages/client/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_client version: 8.2.0 -description: A browser, mobile and command line based client that supports querying Angel3 servers +description: A browser, mobile and command line based client that supports querying Protevus servers homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/client +repository: https://github.com/dart-backend/protevus/tree/master/packages/client environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/client/test/auth_test.dart b/packages/client/test/auth_test.dart index 7552e7b0..7f75f0d0 100644 --- a/packages/client/test/auth_test.dart +++ b/packages/client/test/auth_test.dart @@ -9,13 +9,13 @@ const Map user = {'username': 'foo', 'password': 'bar'}; var localOpts = AngelAuthOptions>(canRespondWithJson: true); void main() { - late Angel app; - late AngelHttp http; - late c.Angel client; + late Protevus app; + late ProtevusHttp http; + late c.Protevus client; setUp(() async { - app = Angel(); - http = AngelHttp(app, useZone: false); + app = Protevus(); + http = ProtevusHttp(app, useZone: false); var auth = AngelAuth( serializer: (_) async => 'baz', deserializer: (_) async => user); diff --git a/packages/client/test/common.dart b/packages/client/test/common.dart index a48bc0f1..91275614 100644 --- a/packages/client/test/common.dart +++ b/packages/client/test/common.dart @@ -8,7 +8,7 @@ import 'package:http/src/streamed_response.dart' as http; Future read(Stream> stream) => stream.transform(utf8.decoder).join(); -class MockAngel extends BaseAngelClient { +class MockAngel extends BaseProtevusClient { final SpecClient specClient = SpecClient(); @override diff --git a/packages/client/test/list_test.dart b/packages/client/test/list_test.dart index 230e541c..8a7def2a 100644 --- a/packages/client/test/list_test.dart +++ b/packages/client/test/list_test.dart @@ -10,13 +10,13 @@ import 'package:test/test.dart'; void main() { late HttpServer server; - late c.Angel app; + late c.Protevus app; late c.ServiceList list; late StreamQueue queue; setUp(() async { - var serverApp = s.Angel(reflector: MirrorsReflector()); - var http = s.AngelHttp(serverApp); + var serverApp = s.Protevus(reflector: MirrorsReflector()); + var http = s.ProtevusHttp(serverApp); serverApp.use('/api/todos', s.MapService(autoIdAndDateFields: false)); server = await http.startServer(); diff --git a/packages/configuration/CHANGELOG.md b/packages/configuration/CHANGELOG.md index c636f2fb..d8827fd4 100644 --- a/packages/configuration/CHANGELOG.md +++ b/packages/configuration/CHANGELOG.md @@ -76,5 +76,5 @@ but instead throw an exception. ## 1.0.5 * Now using `package:merge_map` to merge configurations. Resolves -[#5](https://github.com/angel-dart/configuration/issues/5). +[#5](https://github.com/protevus-dart/configuration/issues/5). * You can now specify a custom `envPath`. diff --git a/packages/configuration/README.md b/packages/configuration/README.md index ac359610..fdb3352a 100644 --- a/packages/configuration/README.md +++ b/packages/configuration/README.md @@ -1,11 +1,11 @@ -# Angel3 Configuration Loader +# Protevus Configuration Loader ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_configuration?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/configuration/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/configuration/LICENSE) -Automatic YAML configuration loader for [Angel3 framework](https://pub.dev/packages/angel3) +Automatic YAML configuration loader for [Protevus framework](https://pub.dev/packages/angel3) ## About diff --git a/packages/configuration/example/main.dart b/packages/configuration/example/main.dart index 4a9e435b..1d0ec821 100644 --- a/packages/configuration/example/main.dart +++ b/packages/configuration/example/main.dart @@ -5,7 +5,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:file/local.dart'; Future main() async { - var app = Angel(); + var app = Protevus(); var fs = const LocalFileSystem(); await app.configure(configuration(fs)); } diff --git a/packages/configuration/lib/angel3_configuration.dart b/packages/configuration/lib/angel3_configuration.dart index 8dac2876..c6439971 100644 --- a/packages/configuration/lib/angel3_configuration.dart +++ b/packages/configuration/lib/angel3_configuration.dart @@ -124,11 +124,11 @@ Future loadStandaloneConfiguration(FileSystem fileSystem, /// load from a [overrideEnvironmentName]. /// /// You can also specify a custom [envPath] to load system configuration from. -AngelConfigurer configuration(FileSystem fileSystem, +ProtevusConfigurer configuration(FileSystem fileSystem, {String directoryPath = './config', String? overrideEnvironmentName, String? envPath}) { - return (Angel app) async { + return (Protevus app) async { var config = await loadStandaloneConfiguration( fileSystem, directoryPath: directoryPath, diff --git a/packages/configuration/pubspec.yaml b/packages/configuration/pubspec.yaml index 073cc4f2..27a8e4be 100644 --- a/packages/configuration/pubspec.yaml +++ b/packages/configuration/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_configuration version: 8.2.0 description: Automatic YAML application configuration loader for Angel 3, with .env support. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/configuration +repository: https://github.com/dart-backend/protevus/tree/master/packages/configuration environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/configuration/test/all_test.dart b/packages/configuration/test/all_test.dart index fa6df34e..4e6110a6 100644 --- a/packages/configuration/test/all_test.dart +++ b/packages/configuration/test/all_test.dart @@ -12,7 +12,7 @@ Future main() async { Logger.root.onRecord.listen(prettyLog); // Note: Set ANGEL_ENV to 'development' - var app = Angel(logger: Logger('angel_configuration')); + var app = Protevus(logger: Logger('angel_configuration')); var fileSystem = const LocalFileSystem(); await app.configure(configuration( @@ -30,7 +30,7 @@ Future main() async { ); print('Standalone: $config'); expect(config, { - 'angel': {'framework': 'cool'}, + 'protevus': {'framework': 'cool'}, 'must_be_null': null, 'artist': 'Timberlake', 'included': true, @@ -56,7 +56,7 @@ Future main() async { test('will load .env if exists', () { expect(app.configuration['artist'], 'Timberlake'); - expect(app.configuration['angel'], {'framework': 'cool'}); + expect(app.configuration['protevus'], {'framework': 'cool'}); }); test('non-existent environment defaults to null', () { diff --git a/packages/configuration/test/config/default.yaml b/packages/configuration/test/config/default.yaml index 2a7d3954..e6d9f3e3 100644 --- a/packages/configuration/test/config/default.yaml +++ b/packages/configuration/test/config/default.yaml @@ -1,6 +1,6 @@ set_via: default artist: $JUSTIN -angel: +protevus: framework: $ANGEL_FRAMEWORK must_be_null: $NONEXISTENT_KEY_FOO_BAR_BAZ_QUUX merge: diff --git a/packages/core/container/container/README.md b/packages/core/container/container/README.md index b132bb31..eff33d65 100644 --- a/packages/core/container/container/README.md +++ b/packages/core/container/container/README.md @@ -1,11 +1,11 @@ -# Angel3 Container +# Protevus Container ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_container?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/container/angel_container/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/container/angel_container/LICENSE) -A better IoC container for Angel3, ultimately allowing Angel3 to be used with or without `dart:mirrors` package. +A better IoC container for Protevus, ultimately allowing Protevus to be used with or without `dart:mirrors` package. ```dart import 'package:angel3_container/mirrors.dart'; @@ -40,6 +40,6 @@ A better IoC container for Angel3, ultimately allowing Angel3 to be used with or var http = AngelHttp(app); var server = await http.startServer('localhost', 3000); - print("Angel3 server listening at ${http.uri}"); + print("Protevus server listening at ${http.uri}"); } ``` diff --git a/packages/core/container/container/pubspec.yaml b/packages/core/container/container/pubspec.yaml index 5294cf81..a1215b79 100644 --- a/packages/core/container/container/pubspec.yaml +++ b/packages/core/container/container/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_container version: 8.2.0 -description: Angel3 hierarchical DI container, and pluggable backends for reflection. +description: Protevus hierarchical DI container, and pluggable backends for reflection. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/container/angel_container +repository: https://github.com/dart-backend/protevus/tree/master/packages/container/angel_container environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/core/container/container_generator/README.md b/packages/core/container/container_generator/README.md index 85e0db4a..805622fb 100644 --- a/packages/core/container/container_generator/README.md +++ b/packages/core/container/container_generator/README.md @@ -1,11 +1,11 @@ -# Angel3 Container Generator +# Protevus Container Generator ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_container_generator?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/container/angel3_container_generator/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/container/angel3_container_generator/LICENSE) -An alternative container for Angel3 that uses `reflectable` package instead of `dart:mirrors` for reflection. However, `reflectable` has more limited relfection capabilities when compared to `dart:mirrors`. +An alternative container for Protevus that uses `reflectable` package instead of `dart:mirrors` for reflection. However, `reflectable` has more limited relfection capabilities when compared to `dart:mirrors`. ## Usage diff --git a/packages/core/container/container_generator/pubspec.yaml b/packages/core/container/container_generator/pubspec.yaml index dc648cab..3521f871 100644 --- a/packages/core/container/container_generator/pubspec.yaml +++ b/packages/core/container/container_generator/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_container_generator version: 8.2.0 description: Codegen support for using pkg:reflectable with pkg:angel3_container. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/container/angel_container_generator +repository: https://github.com/dart-backend/protevus/tree/master/packages/container/angel_container_generator environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/core/exceptions/README.md b/packages/core/exceptions/README.md index 57b3d22c..1dff85ac 100644 --- a/packages/core/exceptions/README.md +++ b/packages/core/exceptions/README.md @@ -1,8 +1,8 @@ -# Angel3 Http Exception +# Protevus Http Exception ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_http_exception?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/http_exception/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/http_exception/LICENSE) -Exception class that can be serialized to JSON and serialized to clients. Angel3's HTTP exception class. +Exception class that can be serialized to JSON and serialized to clients. Protevus's HTTP exception class. diff --git a/packages/core/exceptions/example/main.dart b/packages/core/exceptions/example/main.dart index 9361bb5e..0e190d5c 100644 --- a/packages/core/exceptions/example/main.dart +++ b/packages/core/exceptions/example/main.dart @@ -1,4 +1,4 @@ import 'package:angel3_http_exception/angel3_http_exception.dart'; void main() => - throw AngelHttpException.notFound(message: "Can't find that page!"); + throw ProtevusHttpException.notFound(message: "Can't find that page!"); diff --git a/packages/core/exceptions/lib/angel3_http_exception.dart b/packages/core/exceptions/lib/angel3_http_exception.dart index e64a2016..3a5f3ecc 100644 --- a/packages/core/exceptions/lib/angel3_http_exception.dart +++ b/packages/core/exceptions/lib/angel3_http_exception.dart @@ -8,7 +8,7 @@ import 'dart:convert'; /// /// Originally inspired by /// [feathers-errors](https://github.com/feathersjs/feathers-errors). -class AngelHttpException implements Exception { +class ProtevusHttpException implements Exception { /// A list of errors that occurred when this exception was thrown. final List errors = []; @@ -24,7 +24,7 @@ class AngelHttpException implements Exception { /// An HTTP status code this exception will throw. int statusCode; - AngelHttpException( + ProtevusHttpException( {this.message = '500 Internal Server Error', this.stackTrace, this.statusCode = 500, @@ -49,8 +49,8 @@ class AngelHttpException implements Exception { return '$statusCode: $message'; } - factory AngelHttpException.fromMap(Map data) { - return AngelHttpException( + factory ProtevusHttpException.fromMap(Map data) { + return ProtevusHttpException( statusCode: (data['status_code'] ?? data['statusCode'] ?? 500) as int, message: data['message']?.toString() ?? 'Internal Server Error', errors: data['errors'] is Iterable @@ -59,64 +59,65 @@ class AngelHttpException implements Exception { ); } - factory AngelHttpException.fromJson(String str) => - AngelHttpException.fromMap(json.decode(str) as Map); + factory ProtevusHttpException.fromJson(String str) => + ProtevusHttpException.fromMap(json.decode(str) as Map); /// Throws a 400 Bad Request error, including an optional arrray of (validation?) /// errors you specify. - factory AngelHttpException.badRequest( + factory ProtevusHttpException.badRequest( {String message = '400 Bad Request', List errors = const []}) => - AngelHttpException(message: message, errors: errors, statusCode: 400); + ProtevusHttpException(message: message, errors: errors, statusCode: 400); /// Throws a 401 Not Authenticated error. - factory AngelHttpException.notAuthenticated( + factory ProtevusHttpException.notAuthenticated( {String message = '401 Not Authenticated'}) => - AngelHttpException(message: message, statusCode: 401); + ProtevusHttpException(message: message, statusCode: 401); /// Throws a 402 Payment Required error. - factory AngelHttpException.paymentRequired( + factory ProtevusHttpException.paymentRequired( {String message = '402 Payment Required'}) => - AngelHttpException(message: message, statusCode: 402); + ProtevusHttpException(message: message, statusCode: 402); /// Throws a 403 Forbidden error. - factory AngelHttpException.forbidden({String message = '403 Forbidden'}) => - AngelHttpException(message: message, statusCode: 403); + factory ProtevusHttpException.forbidden({String message = '403 Forbidden'}) => + ProtevusHttpException(message: message, statusCode: 403); /// Throws a 404 Not Found error. - factory AngelHttpException.notFound({String message = '404 Not Found'}) => - AngelHttpException(message: message, statusCode: 404); + factory ProtevusHttpException.notFound({String message = '404 Not Found'}) => + ProtevusHttpException(message: message, statusCode: 404); /// Throws a 405 Method Not Allowed error. - factory AngelHttpException.methodNotAllowed( + factory ProtevusHttpException.methodNotAllowed( {String message = '405 Method Not Allowed'}) => - AngelHttpException(message: message, statusCode: 405); + ProtevusHttpException(message: message, statusCode: 405); /// Throws a 406 Not Acceptable error. - factory AngelHttpException.notAcceptable( + factory ProtevusHttpException.notAcceptable( {String message = '406 Not Acceptable'}) => - AngelHttpException(message: message, statusCode: 406); + ProtevusHttpException(message: message, statusCode: 406); /// Throws a 408 Timeout error. - factory AngelHttpException.methodTimeout({String message = '408 Timeout'}) => - AngelHttpException(message: message, statusCode: 408); + factory ProtevusHttpException.methodTimeout( + {String message = '408 Timeout'}) => + ProtevusHttpException(message: message, statusCode: 408); /// Throws a 409 Conflict error. - factory AngelHttpException.conflict({String message = '409 Conflict'}) => - AngelHttpException(message: message, statusCode: 409); + factory ProtevusHttpException.conflict({String message = '409 Conflict'}) => + ProtevusHttpException(message: message, statusCode: 409); /// Throws a 422 Not Processable error. - factory AngelHttpException.notProcessable( + factory ProtevusHttpException.notProcessable( {String message = '422 Not Processable'}) => - AngelHttpException(message: message, statusCode: 422); + ProtevusHttpException(message: message, statusCode: 422); /// Throws a 501 Not Implemented error. - factory AngelHttpException.notImplemented( + factory ProtevusHttpException.notImplemented( {String message = '501 Not Implemented'}) => - AngelHttpException(message: message, statusCode: 501); + ProtevusHttpException(message: message, statusCode: 501); /// Throws a 503 Unavailable error. - factory AngelHttpException.unavailable( + factory ProtevusHttpException.unavailable( {String message = '503 Unavailable'}) => - AngelHttpException(message: message, statusCode: 503); + ProtevusHttpException(message: message, statusCode: 503); } diff --git a/packages/core/exceptions/pubspec.yaml b/packages/core/exceptions/pubspec.yaml index a56dd899..cfee513e 100644 --- a/packages/core/exceptions/pubspec.yaml +++ b/packages/core/exceptions/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_http_exception version: 8.2.0 description: Exception class that can be serialized to JSON and serialized to clients. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/http_exception +repository: https://github.com/dart-backend/protevus/tree/master/packages/http_exception environment: sdk: '>=3.3.0 <4.0.0' dev_dependencies: diff --git a/packages/core/framework/CHANGELOG.md b/packages/core/framework/CHANGELOG.md index 614dde5b..64eb5f29 100644 --- a/packages/core/framework/CHANGELOG.md +++ b/packages/core/framework/CHANGELOG.md @@ -61,7 +61,7 @@ * Require Dart >= 2.16 * Updated `container` to non nullable -* Updated `angel` to non nullable +* Updated `protevus` to non nullable * Updated `logger` to non nullable * Refactored error handler @@ -80,7 +80,7 @@ ## 4.2.2 * Added `Date` to response header -* Updated `Server: Angel3` response header +* Updated `Server: Protevus` response header ## 4.2.1 @@ -103,7 +103,7 @@ ## 4.1.1 -* Updated link to `Angel3` home page +* Updated link to `Protevus` home page * Fixed pedantic warnings ## 4.1.0 @@ -145,14 +145,14 @@ * This release was originally planned to be `2.0.5`, but it adds several features, and has therefore been bumped to `2.1.0`. * Fix a new (did not appear before 2.6/2.7) type error causing compilation to fail. - + ## 2.0.5-beta -* Make `@Expose()` in `Controller` optional. -* Add `allowHttp1` to `AngelHttp2` constructors. -* Add `deserializeBody` and `decodeBody` to `RequestContext`. -* Add `HostnameRouter`, which allows for routing based on hostname. +* Make `@Expose()` in `Controller` optional. +* Add `allowHttp1` to `AngelHttp2` constructors. +* Add `deserializeBody` and `decodeBody` to `RequestContext`. +* Add `HostnameRouter`, which allows for routing based on hostname. * Default to using `ThrowingReflector`, instead of `EmptyReflector`. This will give a more descriptive error when trying to use controllers, etc. without reflection enabled. * `mountController` returns the mounted controller. @@ -167,12 +167,12 @@ error when trying to use controllers, etc. without reflection enabled. * Prepare for Dart SDK change to `Stream>` that are now `Stream`. * Accept any content type if accept header is missing. See -[this PR](https://github.com/angel-dart/framework/pull/239). +[this PR](https://github.com/protevus-dart/framework/pull/239). ## 2.0.3 * Patch up a bug caused by an upstream change to Dart's stream semantics. -See more: +See more: ## 2.0.2+1 @@ -195,7 +195,7 @@ handlers to run, even after the response was closed. ## 2.0.0 -* Angel 2! :angel: :rocket: +* Angel 2! :protevus: :rocket: ## 2.0.0-rc.10 diff --git a/packages/core/framework/README.md b/packages/core/framework/README.md index 11921b82..d94a57aa 100644 --- a/packages/core/framework/README.md +++ b/packages/core/framework/README.md @@ -1,16 +1,16 @@ -# Angel3 Framework +# Protevus Framework -[![Angel3 Framework](../../angel3_logo.png)](https://github.com/dart-backend/angel) +[![Protevus Framework](../../angel3_logo.png)](https://github.com/dart-backend/protevus) ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_framework?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/framework/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/framework/LICENSE) [![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) -Angel3 framework is a high-powered HTTP server with support for dependency injection, sophisticated routing, authentication, ORM, graphql etc. It is designed to keep the core minimal but extensible through a series of plugin packages. It won't dictate which features, databases or web templating engine to use. This flexibility enable Angel3 framework to grow with your application as new features can be added to handle the new use cases. +Protevus framework is a high-powered HTTP server with support for dependency injection, sophisticated routing, authentication, ORM, graphql etc. It is designed to keep the core minimal but extensible through a series of plugin packages. It won't dictate which features, databases or web templating engine to use. This flexibility enable Protevus framework to grow with your application as new features can be added to handle the new use cases. -This package is the core package of [Angel3](https://github.com/dart-backend/angel). For more information, visit us at [Angel3 Website](https://angel3-framework.web.app). +This package is the core package of [Protevus](https://github.com/dart-backend/protevus). For more information, visit us at [Protevus Website](https://angel3-framework.web.app). ## Installation and Setup @@ -19,10 +19,10 @@ This package is the core package of [Angel3](https://github.com/dart-backend/ang 1. Download and install [Dart](https://dart.dev/get-dart) 2. Clone one of the following starter projects: - * [Angel3 Basic Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-basic) - * [Angel3 ORM Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-orm) - * [Angel3 ORM MySQL Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-orm-mysql) - * [Angel3 Graphql Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-graphql) + * [Protevus Basic Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-basic) + * [Protevus ORM Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-orm) + * [Protevus ORM MySQL Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-orm-mysql) + * [Protevus Graphql Template](https://github.com/dukefirehawk/boilerplates/tree/v7/angel3-graphql) 3. Run the project in development mode (*hot-reloaded* is enabled on file changes). @@ -38,11 +38,11 @@ This package is the core package of [Angel3](https://github.com/dart-backend/ang 5. Run as docker. Edit and build the image with the provided `Dockerfile` file. -### (Option 2) Create a new project with Angel3 CLI +### (Option 2) Create a new project with Protevus CLI 1. Download and install [Dart](https://dart.dev/get-dart) -2. Install the [Angel3 CLI](https://pub.dev/packages/angel3_cli): +2. Install the [Protevus CLI](https://pub.dev/packages/angel3_cli): ```bash dart pub global activate angel3_cli @@ -74,9 +74,9 @@ The performance benchmark can be found at [TechEmpower Framework Benchmarks Round 21](https://www.techempower.com/benchmarks/#section=data-r21&test=composite) -### Migrating from Angel to Angel3 +### Migrating from Angel to Protevus -Check out [Migrating to Angel3](https://angel3-docs.dukefirehawk.com/migration/angel-2.x.x-to-angel3/migration-guide-3) +Check out [Migrating to Protevus](https://angel3-docs.dukefirehawk.com/migration/protevus-2.x.x-to-angel3/migration-guide-3) ## Donation & Support diff --git a/packages/core/framework/example/controller.dart b/packages/core/framework/example/controller.dart index 7cebbbb4..a01ecfe0 100644 --- a/packages/core/framework/example/controller.dart +++ b/packages/core/framework/example/controller.dart @@ -8,14 +8,14 @@ void main() async { Logger.root.onRecord.listen(print); // Create our server. - var app = Angel(logger: Logger('angel'), reflector: MirrorsReflector()); - var http = AngelHttp(app); + var app = Protevus(logger: Logger('protevus'), reflector: MirrorsReflector()); + var http = ProtevusHttp(app); await app.mountController(); // Simple fallback to throw a 404 on unknown paths. app.fallback((req, res) { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'Unknown path: "${req.uri!.path}"', ); }); diff --git a/packages/core/framework/example/handle_error.dart b/packages/core/framework/example/handle_error.dart index 89da3fbc..93ca9b77 100644 --- a/packages/core/framework/example/handle_error.dart +++ b/packages/core/framework/example/handle_error.dart @@ -6,8 +6,8 @@ import 'package:angel3_framework/http.dart'; import 'package:logging/logging.dart'; void main() async { - var app = Angel(reflector: MirrorsReflector()) - ..logger = (Logger('angel') + var app = Protevus(reflector: MirrorsReflector()) + ..logger = (Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); @@ -18,7 +18,7 @@ void main() async { app.fallback( (req, res) => Future.error('Throwing just because I feel like!')); - var http = AngelHttp(app); + var http = ProtevusHttp(app); HttpServer? server = await http.startServer('127.0.0.1', 3000); var url = 'http://${server.address.address}:${server.port}'; print('Listening at $url'); diff --git a/packages/core/framework/example/hostname.dart b/packages/core/framework/example/hostname.dart index 9f0a9a47..27ce85e3 100644 --- a/packages/core/framework/example/hostname.dart +++ b/packages/core/framework/example/hostname.dart @@ -3,14 +3,14 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; import 'package:logging/logging.dart'; -Future apiConfigurer(Angel app) async { +Future apiConfigurer(Protevus app) async { app.get('/', (req, res) => 'Hello, API!'); app.fallback((req, res) { return 'fallback on ${req.uri} (within the API)'; }); } -Future frontendConfigurer(Angel app) async { +Future frontendConfigurer(Protevus app) async { app.fallback((req, res) => '(usually an index page would be shown here.)'); } @@ -19,8 +19,8 @@ void main() async { hierarchicalLoggingEnabled = true; //Logger.root.onRecord.listen(prettyLog); - var app = Angel(logger: Logger('angel')); - var http = AngelHttp(app); + var app = Protevus(logger: Logger('protevus')); + var http = ProtevusHttp(app); var multiHost = HostnameRouter.configure({ 'api.localhost:3000': apiConfigurer, 'localhost:3000': frontendConfigurer, diff --git a/packages/core/framework/example/http2/body_parsing.dart b/packages/core/framework/example/http2/body_parsing.dart index ec1b3540..d81c24f1 100644 --- a/packages/core/framework/example/http2/body_parsing.dart +++ b/packages/core/framework/example/http2/body_parsing.dart @@ -6,8 +6,8 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; void main() async { - var app = Angel(); - app.logger = Logger('angel') + var app = Protevus(); + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); @@ -35,8 +35,8 @@ void main() async { st); } - var http1 = AngelHttp(app); - var http2 = AngelHttp2(app, ctx); + var http1 = ProtevusHttp(app); + var http2 = ProtevusHttp2(app, ctx); // HTTP/1.x requests will fallback to `AngelHttp` http2.onHttp1.listen(http1.handleRequest); diff --git a/packages/core/framework/example/http2/main.dart b/packages/core/framework/example/http2/main.dart index a111c059..e9583908 100644 --- a/packages/core/framework/example/http2/main.dart +++ b/packages/core/framework/example/http2/main.dart @@ -6,16 +6,16 @@ import 'package:logging/logging.dart'; import 'common.dart'; void main() async { - var app = Angel() + var app = Protevus() ..encoders.addAll({ 'gzip': gzip.encoder, 'deflate': zlib.encoder, }); - app.logger = Logger('angel')..onRecord.listen(dumpError); + app.logger = Logger('protevus')..onRecord.listen(dumpError); app.get('/', (req, res) => 'Hello HTTP/2!!!'); - app.fallback((req, res) => throw AngelHttpException.notFound( + app.fallback((req, res) => throw ProtevusHttpException.notFound( message: 'No file exists at ${req.uri}')); var ctx = SecurityContext() @@ -32,8 +32,8 @@ void main() async { ); } - var http1 = AngelHttp(app); - var http2 = AngelHttp2(app, ctx); + var http1 = ProtevusHttp(app); + var http2 = ProtevusHttp2(app, ctx); // HTTP/1.x requests will fallback to `AngelHttp` http2.onHttp1.listen(http1.handleRequest); diff --git a/packages/core/framework/example/http2/server_push.dart b/packages/core/framework/example/http2/server_push.dart index 93290ca4..eee69ced 100644 --- a/packages/core/framework/example/http2/server_push.dart +++ b/packages/core/framework/example/http2/server_push.dart @@ -6,8 +6,8 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; void main() async { - var app = Angel(); - app.logger = Logger('angel') + var app = Protevus(); + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); @@ -51,8 +51,8 @@ void main() async { st); } - var http1 = AngelHttp(app); - var http2 = AngelHttp2(app, ctx); + var http1 = ProtevusHttp(app); + var http2 = ProtevusHttp2(app, ctx); // HTTP/1.x requests will fallback to `AngelHttp` http2.onHttp1.listen(http1.handleRequest); diff --git a/packages/core/framework/example/json.dart b/packages/core/framework/example/json.dart index 4ca5767a..b8f6067e 100644 --- a/packages/core/framework/example/json.dart +++ b/packages/core/framework/example/json.dart @@ -31,9 +31,9 @@ void main() async { } void serverMain(_) async { - var app = Angel(); + var app = Protevus(); var http = - AngelHttp.custom(app, startShared, useZone: false); // Run a cluster + ProtevusHttp.custom(app, startShared, useZone: false); // Run a cluster app.get('/', (req, res) { return res.serialize({ diff --git a/packages/core/framework/example/main.dart b/packages/core/framework/example/main.dart index 8a43dca9..e5f18853 100644 --- a/packages/core/framework/example/main.dart +++ b/packages/core/framework/example/main.dart @@ -8,8 +8,8 @@ void main() async { //Logger.root.onRecord.listen(prettyLog); // Create our server. - var app = Angel( - logger: Logger('angel'), + var app = Protevus( + logger: Logger('protevus'), reflector: MirrorsReflector(), ); @@ -41,12 +41,12 @@ void main() async { // Simple fallback to throw a 404 on unknown paths. app.fallback((req, res) { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'Unknown path: "${req.uri!.path}"', ); }); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer('127.0.0.1', 3000); var url = 'http://${server.address.address}:${server.port}'; print('Listening at $url'); diff --git a/packages/core/framework/example/map_service.dart b/packages/core/framework/example/map_service.dart index 60ea66c8..3dddbd30 100644 --- a/packages/core/framework/example/map_service.dart +++ b/packages/core/framework/example/map_service.dart @@ -8,15 +8,15 @@ void main() async { Logger.root.onRecord.listen(print); // Create our server. - var app = Angel( - logger: Logger('angel'), + var app = Protevus( + logger: Logger('protevus'), reflector: MirrorsReflector(), ); // Create a RESTful service that manages an in-memory collection. app.use('/api/todos', MapService()); - var http = AngelHttp(app); + var http = ProtevusHttp(app); await http.startServer('127.0.0.1', 0); print('Listening at ${http.uri}'); } diff --git a/packages/core/framework/example/status.dart b/packages/core/framework/example/status.dart index 70fe35c0..8a376863 100644 --- a/packages/core/framework/example/status.dart +++ b/packages/core/framework/example/status.dart @@ -2,8 +2,8 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); app.fallback((req, res) { res.statusCode = 304; diff --git a/packages/core/framework/example/view.dart b/packages/core/framework/example/view.dart index ea933b9d..052d3a38 100644 --- a/packages/core/framework/example/view.dart +++ b/packages/core/framework/example/view.dart @@ -3,7 +3,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); app.viewGenerator = (name, [data]) async => 'View generator invoked with name $name and data: $data'; @@ -11,7 +11,7 @@ void main() async { // Index route. Returns JSON. app.get('/', (req, res) => res.render('index', {'foo': 'bar'})); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer('127.0.0.1', 3000); var url = 'http://${server.address.address}:${server.port}'; print('Listening at $url'); diff --git a/packages/core/framework/lib/src/core/controller.dart b/packages/core/framework/lib/src/core/controller.dart index 5fb6a131..d2b34690 100644 --- a/packages/core/framework/lib/src/core/controller.dart +++ b/packages/core/framework/lib/src/core/controller.dart @@ -9,10 +9,10 @@ import '../core/core.dart'; /// Supports grouping routes with shared functionality. class Controller { - Angel? _app; + Protevus? _app; - /// The [Angel] application powering this controller. - Angel get app { + /// The [Protevus] application powering this controller. + Protevus get app { if (_app == null) { throw ArgumentError("Angel is not instantiated."); } @@ -38,7 +38,7 @@ class Controller { /// Applies routes, DI, and other configuration to an [app]. @mustCallSuper - Future configureServer(Angel app) async { + Future configureServer(Protevus app) async { _app = app; if (injectSingleton != false) { diff --git a/packages/core/framework/lib/src/core/driver.dart b/packages/core/framework/lib/src/core/driver.dart index 47e5e982..3b800354 100644 --- a/packages/core/framework/lib/src/core/driver.dart +++ b/packages/core/framework/lib/src/core/driver.dart @@ -17,7 +17,7 @@ abstract class Driver< Server extends Stream, RequestContextType extends RequestContext, ResponseContextType extends ResponseContext> { - final Angel app; + final Protevus app; final bool useZone; bool _closed = false; @@ -170,23 +170,23 @@ abstract class Driver< return f.catchError((e, StackTrace st) { if (e is FormatException) { - throw AngelHttpException.badRequest(message: e.message) + throw ProtevusHttpException.badRequest(message: e.message) ..stackTrace = st; } - throw AngelHttpException( + throw ProtevusHttpException( stackTrace: st, - statusCode: (e is AngelHttpException) ? e.statusCode : 500, + statusCode: (e is ProtevusHttpException) ? e.statusCode : 500, message: e?.toString() ?? '500 Internal Server Error'); - }, test: (e) => e is AngelHttpException).catchError( + }, test: (e) => e is ProtevusHttpException).catchError( (ee, StackTrace st) { //print(">>>> Framework error: $ee"); //var t = (st).runtimeType; //print(">>>> StackTrace: $t"); - AngelHttpException e; - if (ee is AngelHttpException) { + ProtevusHttpException e; + if (ee is ProtevusHttpException) { e = ee; } else { - e = AngelHttpException( + e = ProtevusHttpException( stackTrace: st, statusCode: 500, message: ee?.toString() ?? '500 Internal Server Error'); @@ -196,7 +196,8 @@ abstract class Driver< var trace = Trace.from(StackTrace.current).terse; app.logger.severe(e.message, error, trace); - return handleAngelHttpException(e, st, req, res, request, response); + return handleProtevusHttpException( + e, st, req, res, request, response); }); } else { var zoneSpec = ZoneSpecification( @@ -208,20 +209,20 @@ abstract class Driver< // TODO: To be revisited Future(() { - AngelHttpException e; + ProtevusHttpException e; if (error is FormatException) { - e = AngelHttpException.badRequest(message: error.message); - } else if (error is AngelHttpException) { + e = ProtevusHttpException.badRequest(message: error.message); + } else if (error is ProtevusHttpException) { e = error; } else { - e = AngelHttpException( + e = ProtevusHttpException( stackTrace: stackTrace, message: error.toString()); } app.logger.severe(e.message, error, trace); - return handleAngelHttpException( + return handleProtevusHttpException( e, trace, req, res, request, response); }).catchError((e, StackTrace st) { var trace = Trace.from(st).terse; @@ -252,9 +253,9 @@ abstract class Driver< }); } - /// Handles an [AngelHttpException]. - Future handleAngelHttpException( - AngelHttpException e, + /// Handles an [ProtevusHttpException]. + Future handleProtevusHttpException( + ProtevusHttpException e, StackTrace st, RequestContext? req, ResponseContext? res, @@ -384,7 +385,7 @@ abstract class Driver< MiddlewarePipelineIterator it, RequestContextType req, ResponseContextType res, - Angel app) async { + Protevus app) async { var broken = false; while (it.moveNext()) { var current = it.current.handlers.iterator; diff --git a/packages/core/framework/lib/src/core/env.dart b/packages/core/framework/lib/src/core/env.dart index 39307b34..8e8097ab 100644 --- a/packages/core/framework/lib/src/core/env.dart +++ b/packages/core/framework/lib/src/core/env.dart @@ -1,15 +1,15 @@ import 'dart:io'; /// A constant instance of [AngelEnv]. -const AngelEnvironment angelEnv = AngelEnvironment(); +const ProtevusEnvironment angelEnv = ProtevusEnvironment(); /// Queries the environment's `ANGEL_ENV` value. -class AngelEnvironment { +class ProtevusEnvironment { final String? _customValue; /// You can optionally provide a custom value, in order to override the system's /// value. - const AngelEnvironment([this._customValue]); + const ProtevusEnvironment([this._customValue]); /// Returns the value of the `ANGEL_ENV` variable; defaults to `'development'`. String get value => diff --git a/packages/core/framework/lib/src/core/hooked_service.dart b/packages/core/framework/lib/src/core/hooked_service.dart index dbb5e6a6..cb920a54 100644 --- a/packages/core/framework/lib/src/core/hooked_service.dart +++ b/packages/core/framework/lib/src/core/hooked_service.dart @@ -98,7 +98,7 @@ class HookedService> } /// Adds hooks to this instance. - void addHooks(Angel app) { + void addHooks(Protevus app) { var hooks = getAnnotation(inner, app.container.reflector); var before = >[]; var after = >[]; diff --git a/packages/core/framework/lib/src/core/hostname_router.dart b/packages/core/framework/lib/src/core/hostname_router.dart index a1c571e5..c3887d94 100644 --- a/packages/core/framework/lib/src/core/hostname_router.dart +++ b/packages/core/framework/lib/src/core/hostname_router.dart @@ -24,13 +24,13 @@ import 'server.dart'; /// * `example.*` -> `/example\./[^$]*` /// * `example.+` -> `/example\./[^$]+` class HostnameRouter { - final Map _apps = {}; - final Map Function()> _creators = {}; + final Map _apps = {}; + final Map Function()> _creators = {}; final List _patterns = []; HostnameRouter( - {Map apps = const {}, - Map Function()> creators = const {}}) { + {Map apps = const {}, + Map Function()> creators = const {}}) { Map parseMap(Map map) { return map.map((p, c) { Pattern pp; @@ -55,16 +55,16 @@ class HostnameRouter { } factory HostnameRouter.configure( - Map Function(Angel)> configurers, + Map Function(Protevus)> configurers, {Reflector reflector = const EmptyReflector(), - AngelEnvironment environment = angelEnv, + ProtevusEnvironment environment = angelEnv, Logger? logger, bool allowMethodOverrides = true, FutureOr Function(dynamic)? serializer, ViewGenerator? viewGenerator}) { var creators = configurers.map((p, c) { return MapEntry(p, () async { - var app = Angel( + var app = Protevus( reflector: reflector, environment: environment, logger: logger, diff --git a/packages/core/framework/lib/src/core/map_service.dart b/packages/core/framework/lib/src/core/map_service.dart index ab7bf928..5ff9a281 100644 --- a/packages/core/framework/lib/src/core/map_service.dart +++ b/packages/core/framework/lib/src/core/map_service.dart @@ -72,7 +72,7 @@ class MapService extends Service> { Future> read(String? id, [Map? params]) { return Future.value(items.firstWhere(_matchesId(id), - orElse: (() => throw AngelHttpException.notFound( + orElse: (() => throw ProtevusHttpException.notFound( message: 'No record found for ID $id')))); } @@ -127,7 +127,7 @@ class MapService extends Service> { return read(id).then((old) { if (!items.remove(old)) { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'No record found for ID $id'); } @@ -152,7 +152,7 @@ class MapService extends Service> { // Remove everything... if (!(allowRemoveAll == true || params?.containsKey('provider') != true)) { - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'Clients are not allowed to delete all items.'); } else { items.clear(); @@ -164,7 +164,7 @@ class MapService extends Service> { if (items.remove(result)) { return result; } else { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'No record found for ID $id'); } }); diff --git a/packages/core/framework/lib/src/core/metadata.dart b/packages/core/framework/lib/src/core/metadata.dart index a96aac5a..4203e20c 100644 --- a/packages/core/framework/lib/src/core/metadata.dart +++ b/packages/core/framework/lib/src/core/metadata.dart @@ -103,15 +103,15 @@ class Parameter { /// Returns an error that can be thrown when the parameter is not present. Object? get error { if (cookie?.isNotEmpty == true) { - return AngelHttpException.badRequest( + return ProtevusHttpException.badRequest( message: 'Missing required cookie "$cookie".'); } if (header?.isNotEmpty == true) { - return AngelHttpException.badRequest( + return ProtevusHttpException.badRequest( message: 'Missing required header "$header".'); } if (query?.isNotEmpty == true) { - return AngelHttpException.badRequest( + return ProtevusHttpException.badRequest( message: 'Missing required query parameter "$query".'); } if (session?.isNotEmpty == true) { diff --git a/packages/core/framework/lib/src/core/request_context.dart b/packages/core/framework/lib/src/core/request_context.dart index 19499af3..f107cd4c 100644 --- a/packages/core/framework/lib/src/core/request_context.dart +++ b/packages/core/framework/lib/src/core/request_context.dart @@ -18,13 +18,13 @@ import 'package:logging/logging.dart'; import 'metadata.dart'; import 'response_context.dart'; import 'routable.dart'; -import 'server.dart' show Angel; +import 'server.dart' show Protevus; part 'injection.dart'; /// A convenience wrapper around an incoming [RawRequest]. abstract class RequestContext { - /// Similar to [Angel.shutdownHooks], allows for logic to be executed + /// Similar to [Protevus.shutdownHooks], allows for logic to be executed /// when a [RequestContext] is done being processed. final _log = Logger('RequestContext'); @@ -46,8 +46,8 @@ abstract class RequestContext { /// Additional params to be passed to services. final Map serviceParams = {}; - /// The [Angel] instance that is responding to this request. - Angel? app; + /// The [Protevus] instance that is responding to this request. + Protevus? app; /// Any cookies sent with this request. List get cookies => []; diff --git a/packages/core/framework/lib/src/core/response_context.dart b/packages/core/framework/lib/src/core/response_context.dart index 97793880..52567b43 100644 --- a/packages/core/framework/lib/src/core/response_context.dart +++ b/packages/core/framework/lib/src/core/response_context.dart @@ -13,7 +13,7 @@ import 'package:mime/mime.dart'; import 'controller.dart'; import 'request_context.dart'; -import 'server.dart' show Angel; +import 'server.dart' show Protevus; final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); @@ -22,15 +22,15 @@ abstract class ResponseContext implements StreamConsumer>, StreamSink>, StringSink { final Map properties = {}; final CaseInsensitiveMap _headers = CaseInsensitiveMap.from( - {'content-type': 'text/plain', 'server': 'Angel3'}); + {'content-type': 'text/plain', 'server': 'Protevus'}); //final log = Logger('ResponseContext'); Completer? _done; int _statusCode = 200; - /// The [Angel] instance that is sending a response. - Angel? app; + /// The [Protevus] instance that is sending a response. + Protevus? app; /// Is `Transfer-Encoding` chunked? bool? chunked; diff --git a/packages/core/framework/lib/src/core/server.dart b/packages/core/framework/lib/src/core/server.dart index c0f1597e..5e579df4 100644 --- a/packages/core/framework/lib/src/core/server.dart +++ b/packages/core/framework/lib/src/core/server.dart @@ -21,20 +21,20 @@ import 'service.dart'; //final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); -/// A function that configures an [Angel] server. -typedef AngelConfigurer = FutureOr Function(Angel app); +/// A function that configures an [Protevus] server. +typedef ProtevusConfigurer = FutureOr Function(Protevus app); /// A function that asynchronously generates a view from the given path and data. typedef ViewGenerator = FutureOr Function(String path, [Map? data]); /// A function that handles error -typedef AngelErrorHandler = dynamic Function( - AngelHttpException e, RequestContext req, ResponseContext res); +typedef ProtevusErrorHandler = dynamic Function( + ProtevusHttpException e, RequestContext req, ResponseContext res); -/// The default error handler for [Angel] server +/// The default error handler for [Protevus] server Future _defaultErrorHandler( - AngelHttpException e, RequestContext req, ResponseContext res) async { + ProtevusHttpException e, RequestContext req, ResponseContext res) async { if (!req.accepts('text/html', strict: true) && (req.accepts('application/json') || req.accepts('application/javascript'))) { @@ -65,7 +65,7 @@ Logger _defaultLogger() { if (rec.error != null) { var err = rec.error; - if (err is AngelHttpException && err.statusCode != 500) return; + if (err is ProtevusHttpException && err.statusCode != 500) return; print('${rec.message} \n'); print(rec.error); if (rec.stackTrace != null) { @@ -78,18 +78,18 @@ Logger _defaultLogger() { } /// A powerful real-time/REST/MVC server class. -class Angel extends Routable { +class Protevus extends Routable { static Future _noViewEngineConfigured(String view, [Map? data]) => Future.value('No view engine has been configured yet.'); - final List _children = []; + final List _children = []; final Map< String, Tuple4, ParseResult, MiddlewarePipeline>> handlerCache = HashMap(); Router? _flattened; - Angel? _parent; + Protevus? _parent; /// A global Map of converters that can transform responses bodies. final Map, List>> encoders = {}; @@ -114,20 +114,20 @@ class Angel extends Routable { bool allowMethodOverrides = true; /// All child application mounted on this instance. - List get children => List.unmodifiable(_children); + List get children => List.unmodifiable(_children); final Map _controllers = {}; /// A set of [Controller] objects that have been loaded into the application. Map get controllers => _controllers; - /// The [AngelEnvironment] in which the application is running. + /// The [ProtevusEnvironment] in which the application is running. /// /// By default, it is automatically inferred. - final AngelEnvironment environment; + final ProtevusEnvironment environment; /// Returns the parent instance of this application, if any. - Angel? get parent => _parent; + Protevus? get parent => _parent; /// Outputs diagnostics and debug messages. Logger _logger = _defaultLogger(); @@ -145,12 +145,12 @@ class Angel extends Routable { /// Plug-ins to be called right before server startup. /// /// If the server is never started, they will never be called. - final List startupHooks = []; + final List startupHooks = []; /// Plug-ins to be called right before server shutdown. /// /// If the server is never [close]d, they will never be called. - final List shutdownHooks = []; + final List shutdownHooks = []; /// Always run before responses are sent. /// @@ -162,8 +162,8 @@ class Angel extends Routable { /// Called by [ResponseContext]@`render`. ViewGenerator? viewGenerator = _noViewEngineConfigured; - /// The handler currently configured to run on [AngelHttpException]s. - AngelErrorHandler errorHandler = _defaultErrorHandler; + /// The handler currently configured to run on [ProtevusHttpException]s. + ProtevusErrorHandler errorHandler = _defaultErrorHandler; @override Route addRoute( @@ -189,7 +189,7 @@ class Angel extends Routable { 'This route will be ignored, and no requests will ever reach it.'); } - if (router is Angel) { + if (router is Protevus) { router._parent = this; _children.add(router); } @@ -199,11 +199,11 @@ class Angel extends Routable { /// Loads some base dependencies into the service container. void bootstrapContainer() { - if (runtimeType != Angel) { + if (runtimeType != Protevus) { container.registerSingleton(this); } - container.registerSingleton(this); + container.registerSingleton(this); container.registerSingleton(this); container.registerSingleton(this); } @@ -358,8 +358,8 @@ class Angel extends Routable { // return closureMirror.apply(args).reflectee; } - /// Applies an [AngelConfigurer] to this instance. - Future configure(AngelConfigurer configurer) { + /// Applies an [ProtevusConfigurer] to this instance. + Future configure(ProtevusConfigurer configurer) { return Future.sync(() => configurer(this)); } @@ -394,9 +394,9 @@ class Angel extends Routable { 'Features like controllers, constructor dependency injection, and `ioc` require reflection, ' 'and will not work without it.\n\n' 'For more, see the documentation:\n' - 'https://docs.angel-dart.dev/guides/dependency-injection#enabling-dart-mirrors-or-other-reflection'; + 'https://docs.protevus-dart.dev/guides/dependency-injection#enabling-dart-mirrors-or-other-reflection'; - Angel( + Protevus( {Reflector reflector = const ThrowingReflector(errorMessage: _reflectionErrorMessage), this.environment = angelEnv, diff --git a/packages/core/framework/lib/src/core/service.dart b/packages/core/framework/lib/src/core/service.dart index 8db6996c..62177ac6 100644 --- a/packages/core/framework/lib/src/core/service.dart +++ b/packages/core/framework/lib/src/core/service.dart @@ -67,18 +67,18 @@ class Service extends Routable { /// Handlers that must run to ensure this service's functionality. List get bootstrappers => []; - /// The [Angel] app powering this service. - Angel? _app; + /// The [Protevus] app powering this service. + Protevus? _app; - Angel get app { + Protevus get app { if (_app == null) { throw ArgumentError("Angel is not initialized"); } return _app!; } - set app(Angel angel) { - _app = angel; + set app(Protevus protevus) { + _app = protevus; } bool get isAppActive => _app != null; @@ -94,7 +94,7 @@ class Service extends Routable { _readData ??= (req, res) { if (req.bodyAsObject is! Data) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Invalid request body. Expected $Data; found ${req.bodyAsObject} instead.'); } else { @@ -123,7 +123,7 @@ class Service extends Routable { String errorMessage = 'No record was found matching the given query.']) { return index(params).then((result) { if (result.isEmpty) { - throw AngelHttpException.notFound(message: errorMessage); + throw ProtevusHttpException.notFound(message: errorMessage); } else { return result.first; } @@ -132,12 +132,12 @@ class Service extends Routable { /// Retrieves all resources. Future> index([Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Retrieves the desired resource. Future read(Id id, [Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Reads multiple resources at once. @@ -150,22 +150,22 @@ class Service extends Routable { /// Creates a resource. Future create(Data data, [Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Modifies a resource. Future modify(Id id, Data data, [Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Overwrites a resource. Future update(Id id, Data data, [Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Removes the given resource. Future remove(Id id, [Map? params]) { - throw AngelHttpException.methodNotAllowed(); + throw ProtevusHttpException.methodNotAllowed(); } /// Creates an [AnonymousService] that wraps over this one, and maps input and output @@ -371,8 +371,8 @@ class Service extends Routable { ]); // REST compliance - put('/', (req, res) => throw AngelHttpException.notFound()); - patch('/', (req, res) => throw AngelHttpException.notFound()); + put('/', (req, res) => throw ProtevusHttpException.notFound()); + patch('/', (req, res) => throw ProtevusHttpException.notFound()); } /// Invoked when this service is wrapped within a [HookedService]. diff --git a/packages/core/framework/lib/src/http/angel_http.dart b/packages/core/framework/lib/src/http/angel_http.dart index 8568acf3..9aefb5b0 100644 --- a/packages/core/framework/lib/src/http/angel_http.dart +++ b/packages/core/framework/lib/src/http/angel_http.dart @@ -18,7 +18,7 @@ final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); typedef ServerGeneratorType = Future Function(dynamic, int); /// Adapts `dart:io`'s [HttpServer] to serve Angel. -class AngelHttp extends Driver { @override Uri get uri { @@ -26,22 +26,23 @@ class AngelHttp extends Driver headers = const {}}) { - return AngelHttp._(app, serverGenerator, useZone); + return ProtevusHttp._(app, serverGenerator, useZone); } - factory AngelHttp.fromSecurityContext(Angel app, SecurityContext context, + factory ProtevusHttp.fromSecurityContext( + Protevus app, SecurityContext context, {bool useZone = true}) { - return AngelHttp._(app, (address, int port) { + return ProtevusHttp._(app, (address, int port) { return HttpServer.bindSecure(address, port, context); }, useZone); } @@ -51,8 +52,8 @@ class AngelHttp extends Driver diff --git a/packages/core/framework/lib/src/http/http_request_context.dart b/packages/core/framework/lib/src/http/http_request_context.dart index b390f0f2..142ab052 100644 --- a/packages/core/framework/lib/src/http/http_request_context.dart +++ b/packages/core/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) { + HttpRequest request, Protevus app, String path) { var ctx = HttpRequestContext().._container = app.container.createChild(); var override = request.method; diff --git a/packages/core/framework/lib/src/http/http_response_context.dart b/packages/core/framework/lib/src/http/http_response_context.dart index 7c40883b..c15bda54 100644 --- a/packages/core/framework/lib/src/http/http_response_context.dart +++ b/packages/core/framework/lib/src/http/http_response_context.dart @@ -18,7 +18,7 @@ class HttpResponseContext extends ResponseContext { final HttpRequestContext? _correspondingRequest; bool _isDetached = false, _isClosed = false, _streamInitialized = false; - HttpResponseContext(this.rawResponse, Angel? app, + HttpResponseContext(this.rawResponse, Protevus? app, [this._correspondingRequest]) { this.app = app; } diff --git a/packages/core/framework/lib/src/http2/angel_http2.dart b/packages/core/framework/lib/src/http2/angel_http2.dart index 67f35bd0..b38825ab 100644 --- a/packages/core/framework/lib/src/http2/angel_http2.dart +++ b/packages/core/framework/lib/src/http2/angel_http2.dart @@ -16,19 +16,19 @@ Future startSharedHttp2( } /// Adapts `package:http2`'s [ServerTransportConnection] to serve Angel. -class AngelHttp2 extends Driver { final ServerSettings? settings; - late AngelHttp _http; + late ProtevusHttp _http; final StreamController _onHttp1 = StreamController(); final Map _sessions = {}; final Uuid _uuid = Uuid(); - _AngelHttp2ServerSocket? _artificial; + _ProtevusHttp2ServerSocket? _artificial; SecureServerSocket? get socket => _artificial; - AngelHttp2._( - Angel app, + ProtevusHttp2._( + Protevus app, Future Function(dynamic, int) serverGenerator, bool useZone, bool allowHttp1, @@ -39,21 +39,21 @@ class AngelHttp2 extends Driver Function( InternetAddress? address, int port, SecurityContext ctx) @@ -61,7 +61,7 @@ class AngelHttp2 extends Driver generateServer([address, int? port]) async { var s = await serverGenerator(address ?? '127.0.0.1', port ?? 0); - return _artificial = _AngelHttp2ServerSocket(s, this); + return _artificial = _ProtevusHttp2ServerSocket(s, this); } @override @@ -158,13 +158,13 @@ class AngelHttp2 extends Driver implements ServerSocket { - final _AngelHttp2ServerSocket angel; + final _ProtevusHttp2ServerSocket protevus; final _ctrl = StreamController(); - _FakeServerSocket(this.angel); + _FakeServerSocket(this.protevus); @override - InternetAddress get address => angel.address; + InternetAddress get address => protevus.address; @override Future close() async { @@ -173,7 +173,7 @@ class _FakeServerSocket extends Stream implements ServerSocket { } @override - int get port => angel.port; + int get port => protevus.port; @override StreamSubscription listen(void Function(Socket event)? onData, @@ -183,15 +183,15 @@ class _FakeServerSocket extends Stream implements ServerSocket { } } -class _AngelHttp2ServerSocket extends Stream +class _ProtevusHttp2ServerSocket extends Stream implements SecureServerSocket { final SecureServerSocket socket; - final AngelHttp2 driver; + final ProtevusHttp2 driver; final _ctrl = StreamController(); late _FakeServerSocket _fake; StreamSubscription? _sub; - _AngelHttp2ServerSocket(this.socket, this.driver) { + _ProtevusHttp2ServerSocket(this.socket, this.driver) { _fake = _FakeServerSocket(this); HttpServer.listenOn(_fake).pipe(driver._onHttp1); _sub = socket.listen( diff --git a/packages/core/framework/lib/src/http2/http2_request_context.dart b/packages/core/framework/lib/src/http2/http2_request_context.dart index d5cdcfcf..6cb6c4bf 100644 --- a/packages/core/framework/lib/src/http2/http2_request_context.dart +++ b/packages/core/framework/lib/src/http2/http2_request_context.dart @@ -31,7 +31,7 @@ class Http2RequestContext extends RequestContext { static Future from( ServerTransportStream stream, Socket socket, - Angel app, + Protevus app, Map sessions, Uuid uuid) { var c = Completer(); diff --git a/packages/core/framework/lib/src/http2/http2_response_context.dart b/packages/core/framework/lib/src/http2/http2_response_context.dart index fc625d34..6dcbb5f9 100644 --- a/packages/core/framework/lib/src/http2/http2_response_context.dart +++ b/packages/core/framework/lib/src/http2/http2_response_context.dart @@ -23,7 +23,7 @@ class Http2ResponseContext extends ResponseContext { Uri? _targetUri; - Http2ResponseContext(Angel? app, this.stream, this._req) { + Http2ResponseContext(Protevus? app, this.stream, this._req) { this.app = app; _targetUri = _req?.uri; } diff --git a/packages/core/framework/performance/hello/main.dart b/packages/core/framework/performance/hello/main.dart index 8f8e559f..eeb2cc5b 100644 --- a/packages/core/framework/performance/hello/main.dart +++ b/packages/core/framework/performance/hello/main.dart @@ -5,8 +5,8 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_framework/http.dart'; void main() async { - var app = Angel(); - var http = AngelHttp.custom(app, startShared, useZone: false); + var app = Protevus(); + var http = ProtevusHttp.custom(app, startShared, useZone: false); app.get('/', (req, res) => res.write('Hello, world!')); app.optimizeForProduction(force: true); diff --git a/packages/core/framework/pubspec.yaml b/packages/core/framework/pubspec.yaml index 5b436e4d..6ab34dee 100644 --- a/packages/core/framework/pubspec.yaml +++ b/packages/core/framework/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_framework version: 8.4.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/dart-backend/angel/tree/master/packages/framework +repository: https://github.com/dart-backend/protevus/tree/master/packages/framework environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/core/framework/test/accepts_test.dart b/packages/core/framework/test/accepts_test.dart index 6f863aa3..ead248e4 100644 --- a/packages/core/framework/test/accepts_test.dart +++ b/packages/core/framework/test/accepts_test.dart @@ -64,7 +64,7 @@ Future acceptContentTypes( var rq = MockHttpRequest('GET', endpoint, persistentConnection: false); rq.headers.set('accept', headerString); rq.close(); - var app = Angel(reflector: MirrorsReflector()); - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector()); + var http = ProtevusHttp(app); return http.createRequestContext(rq, rq.response); } diff --git a/packages/core/framework/test/anonymous_service_test.dart b/packages/core/framework/test/anonymous_service_test.dart index eb83e473..cc94bdf7 100644 --- a/packages/core/framework/test/anonymous_service_test.dart +++ b/packages/core/framework/test/anonymous_service_test.dart @@ -23,21 +23,21 @@ void main() { var svc = AnonymousService(); await svc.read(1); throw 'Should have thrown 405!'; - } on AngelHttpException { + } on ProtevusHttpException { // print('Ok!'); } try { var svc = AnonymousService(); await svc.modify(2, null); throw 'Should have thrown 405!'; - } on AngelHttpException { + } on ProtevusHttpException { // print('Ok!'); } try { var svc = AnonymousService(); await svc.update(3, null); throw 'Should have thrown 405!'; - } on AngelHttpException { + } on ProtevusHttpException { // print('Ok!'); } }); diff --git a/packages/core/framework/test/body_test.dart b/packages/core/framework/test/body_test.dart index 40241baa..1b0b42fc 100644 --- a/packages/core/framework/test/body_test.dart +++ b/packages/core/framework/test/body_test.dart @@ -7,8 +7,8 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; void main() { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); Future request( {bool asJson = true, diff --git a/packages/core/framework/test/controller_test.dart b/packages/core/framework/test/controller_test.dart index 59c45c9b..5224a4c6 100644 --- a/packages/core/framework/test/controller_test.dart +++ b/packages/core/framework/test/controller_test.dart @@ -70,7 +70,7 @@ bool bar(RequestContext req, ResponseContext res) { } void main() { - late Angel app; + late Protevus app; late TodoController todoController; late NoExposeController noExposeCtrl; late HttpServer server; @@ -78,7 +78,7 @@ void main() { String? url; setUp(() async { - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); app.get( '/redirect', (req, res) async => @@ -95,7 +95,7 @@ void main() { noExposeCtrl = await app.mountController(); // Place controller in group. The applyRoutes() call, however, is async. - // Until https://github.com/angel-dart/route/issues/28 is closed, + // Until https://github.com/protevus-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); @@ -104,7 +104,7 @@ void main() { print(app.controllers); app.dumpTree(); - server = await AngelHttp(app).startServer(); + server = await ProtevusHttp(app).startServer(); url = 'http://${server.address.address}:${server.port}'; }); @@ -118,20 +118,20 @@ void main() { }); test('create dynamic handler', () async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); app.get( '/foo', ioc(({String? bar}) { return 2; }, optional: ['bar'])); var rq = MockHttpRequest('GET', Uri(path: 'foo')); - await AngelHttp(app).handleRequest(rq); + await ProtevusHttp(app).handleRequest(rq); var body = await utf8.decoder.bind(rq.response).join(); expect(json.decode(body), 2); }); test('optional name', () async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); await app.configure(NamedController().configureServer); expect(app.controllers['foo'], const IsInstanceOf()); }); diff --git a/packages/core/framework/test/detach_test.dart b/packages/core/framework/test/detach_test.dart index 0e81995f..0303afcc 100644 --- a/packages/core/framework/test/detach_test.dart +++ b/packages/core/framework/test/detach_test.dart @@ -5,11 +5,11 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; void main() { - late AngelHttp http; + late ProtevusHttp http; setUp(() async { - var app = Angel(); - http = AngelHttp(app); + var app = Protevus(); + http = ProtevusHttp(app); app.get('/detach', (req, res) async { if (res is HttpResponseContext) { diff --git a/packages/core/framework/test/di_test.dart b/packages/core/framework/test/di_test.dart index 2d2b3e17..a5ee561b 100644 --- a/packages/core/framework/test/di_test.dart +++ b/packages/core/framework/test/di_test.dart @@ -15,13 +15,13 @@ final String sampleText = 'make your bed'; final String sampleOver = 'never'; void main() { - late Angel app; + late Protevus app; late http.Client client; late HttpServer server; String? url; setUp(() async { - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); client = http.Client(); // Inject some todos @@ -41,7 +41,7 @@ void main() { await app.configure(SingletonController().configureServer); await app.configure(ErrandController().configureServer); - server = await AngelHttp(app).startServer(); + server = await ProtevusHttp(app).startServer(); url = 'http://${server.address.host}:${server.port}'; }); @@ -52,7 +52,7 @@ void main() { }); test('runContained with custom container', () async { - var app = Angel(); + var app = Protevus(); var c = Container(const MirrorsReflector()); c.registerSingleton(Todo(text: 'Hey!')); @@ -63,7 +63,7 @@ void main() { var rq = MockHttpRequest('GET', Uri(path: '/')); await rq.close(); var rs = rq.response; - await AngelHttp(app).handleRequest(rq); + await ProtevusHttp(app).handleRequest(rq); var text = await rs.transform(utf8.decoder).join(); expect(text, json.encode('Hey!')); }); diff --git a/packages/core/framework/test/encoders_buffer_test.dart b/packages/core/framework/test/encoders_buffer_test.dart index b98b8892..296df7ba 100644 --- a/packages/core/framework/test/encoders_buffer_test.dart +++ b/packages/core/framework/test/encoders_buffer_test.dart @@ -17,10 +17,10 @@ Future> getBody(MockHttpResponse rs) async { } void main() { - late Angel app; + late Protevus app; setUp(() { - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); app.encoders.addAll( { 'deflate': zlib.encoder, @@ -40,14 +40,14 @@ void main() { encodingTests(() => app); } -void encodingTests(Angel Function() getApp) { +void encodingTests(Protevus Function() getApp) { group('encoding', () { - Angel app; - late AngelHttp http; + Protevus app; + late ProtevusHttp http; setUp(() { app = getApp(); - http = AngelHttp(app); + http = ProtevusHttp(app); }); test('sends plaintext if no accept-encoding', () async { diff --git a/packages/core/framework/test/env_test.dart b/packages/core/framework/test/env_test.dart index c03ad797..7da50c1f 100644 --- a/packages/core/framework/test/env_test.dart +++ b/packages/core/framework/test/env_test.dart @@ -3,16 +3,17 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:test/test.dart'; void main() { - test('custom value', () => expect(AngelEnvironment('hey').value, 'hey')); + test('custom value', () => expect(ProtevusEnvironment('hey').value, 'hey')); - test('lowercases', () => expect(AngelEnvironment('HeY').value, 'hey')); + test('lowercases', () => expect(ProtevusEnvironment('HeY').value, 'hey')); test( 'default to env or development', - () => expect(AngelEnvironment().value, + () => expect(ProtevusEnvironment().value, (Platform.environment['ANGEL_ENV'] ?? 'development').toLowerCase())); test('isDevelopment', - () => expect(AngelEnvironment('development').isDevelopment, true)); - test('isStaging', () => expect(AngelEnvironment('staging').isStaging, true)); + () => expect(ProtevusEnvironment('development').isDevelopment, true)); + test('isStaging', + () => expect(ProtevusEnvironment('staging').isStaging, true)); test('isDevelopment', - () => expect(AngelEnvironment('production').isProduction, true)); + () => expect(ProtevusEnvironment('production').isProduction, true)); } diff --git a/packages/core/framework/test/exception_test.dart b/packages/core/framework/test/exception_test.dart index 20ddc4c4..77364b73 100644 --- a/packages/core/framework/test/exception_test.dart +++ b/packages/core/framework/test/exception_test.dart @@ -4,43 +4,46 @@ import 'package:test/test.dart'; void main() { test('named constructors', () { - expect( - AngelHttpException.badRequest(), isException(400, '400 Bad Request')); - expect(AngelHttpException.notAuthenticated(), + expect(ProtevusHttpException.badRequest(), + isException(400, '400 Bad Request')); + expect(ProtevusHttpException.notAuthenticated(), isException(401, '401 Not Authenticated')); - expect(AngelHttpException.paymentRequired(), + expect(ProtevusHttpException.paymentRequired(), isException(402, '402 Payment Required')); - expect(AngelHttpException.forbidden(), isException(403, '403 Forbidden')); - expect(AngelHttpException.notFound(), isException(404, '404 Not Found')); - expect(AngelHttpException.methodNotAllowed(), - isException(405, '405 Method Not Allowed')); - expect(AngelHttpException.notAcceptable(), - isException(406, '406 Not Acceptable')); - expect(AngelHttpException.methodTimeout(), isException(408, '408 Timeout')); - expect(AngelHttpException.conflict(), isException(409, '409 Conflict')); - expect(AngelHttpException.notProcessable(), - isException(422, '422 Not Processable')); - expect(AngelHttpException.notImplemented(), - isException(501, '501 Not Implemented')); expect( - AngelHttpException.unavailable(), isException(503, '503 Unavailable')); + ProtevusHttpException.forbidden(), isException(403, '403 Forbidden')); + expect(ProtevusHttpException.notFound(), isException(404, '404 Not Found')); + expect(ProtevusHttpException.methodNotAllowed(), + isException(405, '405 Method Not Allowed')); + expect(ProtevusHttpException.notAcceptable(), + isException(406, '406 Not Acceptable')); + expect( + ProtevusHttpException.methodTimeout(), isException(408, '408 Timeout')); + expect(ProtevusHttpException.conflict(), isException(409, '409 Conflict')); + expect(ProtevusHttpException.notProcessable(), + isException(422, '422 Not Processable')); + expect(ProtevusHttpException.notImplemented(), + isException(501, '501 Not Implemented')); + expect(ProtevusHttpException.unavailable(), + isException(503, '503 Unavailable')); }); test('fromMap', () { - expect(AngelHttpException.fromMap({'status_code': -1, 'message': 'ok'}), + expect(ProtevusHttpException.fromMap({'status_code': -1, 'message': 'ok'}), isException(-1, 'ok')); }); test('toMap = toJson', () { - var exc = AngelHttpException.badRequest(); + var exc = ProtevusHttpException.badRequest(); expect(exc.toMap(), exc.toJson()); var json_ = json.encode(exc.toJson()); - var exc2 = AngelHttpException.fromJson(json_); + var exc2 = ProtevusHttpException.fromJson(json_); expect(exc2.toJson(), exc.toJson()); }); test('toString', () { - expect(AngelHttpException(statusCode: 420, message: 'Blaze It').toString(), + expect( + ProtevusHttpException(statusCode: 420, message: 'Blaze It').toString(), '420: Blaze It'); }); } @@ -60,7 +63,7 @@ class _IsException extends Matcher { @override bool matches(item, Map matchState) { - return item is AngelHttpException && + return item is ProtevusHttpException && item.statusCode == statusCode && item.message == message; } diff --git a/packages/core/framework/test/extension_test.dart b/packages/core/framework/test/extension_test.dart index db3f6c6f..5302c6f9 100644 --- a/packages/core/framework/test/extension_test.dart +++ b/packages/core/framework/test/extension_test.dart @@ -26,7 +26,7 @@ void main() { Future makeRequest(String path) { var rq = MockHttpRequest('GET', endpoint.replace(path: path))..close(); - var app = Angel(reflector: MirrorsReflector()); - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector()); + var http = ProtevusHttp(app); return http.createRequestContext(rq, rq.response); } diff --git a/packages/core/framework/test/find_one_test.dart b/packages/core/framework/test/find_one_test.dart index 4bdb3bcd..082e45b2 100644 --- a/packages/core/framework/test/find_one_test.dart +++ b/packages/core/framework/test/find_one_test.dart @@ -4,7 +4,7 @@ import 'common.dart'; void main() { var throwsAnAngelHttpException = - throwsA(const IsInstanceOf()); + throwsA(const IsInstanceOf()); /* test('throw 404 on null', () { diff --git a/packages/core/framework/test/general_test.dart b/packages/core/framework/test/general_test.dart index 75da5d57..331a6db3 100644 --- a/packages/core/framework/test/general_test.dart +++ b/packages/core/framework/test/general_test.dart @@ -7,18 +7,18 @@ import 'package:http/http.dart' as http; import 'package:test/test.dart'; void main() { - late Angel app; + late Protevus app; late http.Client client; late HttpServer server; late String url; setUp(() async { - app = Angel(reflector: MirrorsReflector()) + app = Protevus(reflector: MirrorsReflector()) ..post('/foo', (req, res) => res.serialize({'hello': 'world'})) - ..all('*', (req, res) => throw AngelHttpException.notFound()); + ..all('*', (req, res) => throw ProtevusHttpException.notFound()); client = http.Client(); - server = await AngelHttp(app).startServer(); + server = await ProtevusHttp(app).startServer(); url = 'http://${server.address.host}:${server.port}'; }); diff --git a/packages/core/framework/test/hooked_test.dart b/packages/core/framework/test/hooked_test.dart index 43667511..09b45a90 100644 --- a/packages/core/framework/test/hooked_test.dart +++ b/packages/core/framework/test/hooked_test.dart @@ -13,14 +13,14 @@ void main() { 'Content-Type': 'application/json' }; - late Angel app; + late Protevus app; late HttpServer server; late String url; late http.Client client; late HookedService todoService; setUp(() async { - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); client = http.Client(); app.use('/todos', MapService()); app.use('/books', BookService()); @@ -36,7 +36,7 @@ void main() { throw e.error as Object; }; - server = await AngelHttp(app).startServer(); + server = await ProtevusHttp(app).startServer(); url = 'http://${server.address.host}:${server.port}'; }); @@ -83,7 +83,7 @@ void main() { ..listen((HookedServiceEvent event) async { // Hooks can be Futures ;) event.cancel([ - {'angel': 'framework'} + {'protevus': 'framework'} ]); }) ..listen((HookedServiceEvent event) { @@ -93,13 +93,13 @@ void main() { var response = await client.get(Uri.parse('$url/todos')); print(response.body); var result = json.decode(response.body) as List; - expect(result[0]['angel'], equals('framework')); + expect(result[0]['protevus'], equals('framework')); }); test('asStream() fires', () async { var stream = todoService.afterCreated.asStream(); - await todoService.create({'angel': 'framework'}); - expect(await stream.first.then((e) => e.result['angel']), 'framework'); + await todoService.create({'protevus': 'framework'}); + expect(await stream.first.then((e) => e.result['protevus']), 'framework'); }); test('metadata', () async { diff --git a/packages/core/framework/test/http2/adapter_test.dart b/packages/core/framework/test/http2/adapter_test.dart index bbb95f08..ec1bd58a 100644 --- a/packages/core/framework/test/http2/adapter_test.dart +++ b/packages/core/framework/test/http2/adapter_test.dart @@ -25,14 +25,15 @@ Stream> jfkStream() { void main() { var client = Http2Client(); late IOClient h1c; - Angel app; - late AngelHttp2 http2; + Protevus app; + late ProtevusHttp2 http2; late Uri serverRoot; setUp(() async { - app = Angel(reflector: MirrorsReflector())..encoders['gzip'] = gzip.encoder; + app = Protevus(reflector: MirrorsReflector()) + ..encoders['gzip'] = gzip.encoder; hierarchicalLoggingEnabled = true; - app.logger = Logger.detached('angel.http2') + app.logger = Logger.detached('protevus.http2') ..onRecord.listen((rec) { print(rec); if (rec.error == null) return; @@ -52,7 +53,7 @@ void main() { app.get('/stream', (req, res) => jfkStream().pipe(res)); app.get('/headers', (req, res) async { - res.headers.addAll({'foo': 'bar', 'x-angel': 'http2'}); + res.headers.addAll({'foo': 'bar', 'x-protevus': 'http2'}); await res.close(); }); @@ -105,7 +106,7 @@ void main() { // Create an HTTP client that trusts our server. h1c = IOClient(HttpClient()..badCertificateCallback = (_, __, ___) => true); - http2 = AngelHttp2(app, ctx, allowHttp1: true); + http2 = ProtevusHttp2(app, ctx, allowHttp1: true); var server = await http2.startServer(); serverRoot = Uri.parse('https://127.0.0.1:${server.port}'); @@ -183,7 +184,7 @@ void main() { test('headers sent', () async { var response = await client.get(serverRoot.replace(path: '/headers')); expect(response.headers['foo'], 'bar'); - expect(response.headers['x-angel'], 'http2'); + expect(response.headers['x-protevus'], 'http2'); }); test('server push', () async { @@ -287,7 +288,7 @@ void main() { rq.fields['foo'] = 'bar'; rq.files.add(http.MultipartFile( 'file', Stream.fromIterable([utf8.encode('hello world')]), 11, - contentType: MediaType('angel', 'framework'))); + contentType: MediaType('protevus', 'framework'))); var response = await client.send(rq); var responseBody = await response.stream.transform(utf8.decoder).join(); @@ -296,7 +297,7 @@ void main() { responseBody, json.encode([ 11, - 'angel/framework', + 'protevus/framework', {'foo': 'bar'} ])); }); diff --git a/packages/core/framework/test/http_404_hole_test.dart b/packages/core/framework/test/http_404_hole_test.dart index 0742b8ff..0ddf8dce 100644 --- a/packages/core/framework/test/http_404_hole_test.dart +++ b/packages/core/framework/test/http_404_hole_test.dart @@ -9,7 +9,7 @@ import 'pretty_log.dart'; void main() { late http.IOClient client; - late AngelHttp driver; + late ProtevusHttp driver; late Logger logger; setUp(() async { @@ -20,7 +20,7 @@ void main() { ..level = Level.ALL ..onRecord.listen(prettyLog); - var app = Angel(logger: logger); + var app = Protevus(logger: logger); app.fallback(hello); app.fallback(throw404); @@ -40,7 +40,7 @@ void main() { } }; - driver = AngelHttp(app); + driver = ProtevusHttp(app); await driver.startServer(); }); @@ -76,5 +76,5 @@ Future hello(RequestContext req, ResponseContext res) { void throw404(RequestContext req, ResponseContext res) { Zone.current .handleUncaughtError('This 404 should not occur.', StackTrace.current); - throw AngelHttpException.notFound(); + throw ProtevusHttpException.notFound(); } diff --git a/packages/core/framework/test/jsonp_test.dart b/packages/core/framework/test/jsonp_test.dart index a38b5a66..033a46e7 100644 --- a/packages/core/framework/test/jsonp_test.dart +++ b/packages/core/framework/test/jsonp_test.dart @@ -7,8 +7,8 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; void main() { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); app.get('/default', (req, res) => res.jsonp({'foo': 'bar'})); diff --git a/packages/core/framework/test/parameter_meta_test.dart b/packages/core/framework/test/parameter_meta_test.dart index 23b7586d..625de5a6 100644 --- a/packages/core/framework/test/parameter_meta_test.dart +++ b/packages/core/framework/test/parameter_meta_test.dart @@ -24,12 +24,12 @@ void main() { } void parameterMetaTests() { - Angel app; - late AngelHttp http; + Protevus app; + late ProtevusHttp http; setUp(() { - app = Angel(reflector: MirrorsReflector()); - http = AngelHttp(app); + app = Protevus(reflector: MirrorsReflector()); + http = ProtevusHttp(app); app.get('/cookie', ioc((@CookieValue('token') String jwt) { return jwt; diff --git a/packages/core/framework/test/precontained_test.dart b/packages/core/framework/test/precontained_test.dart index b3ae98b9..490e3209 100644 --- a/packages/core/framework/test/precontained_test.dart +++ b/packages/core/framework/test/precontained_test.dart @@ -9,7 +9,7 @@ import 'package:test/test.dart'; void main() { test('preinjects functions', () async { - var app = Angel(reflector: MirrorsReflector()) + var app = Protevus(reflector: MirrorsReflector()) ..configuration['foo'] = 'bar' ..get('/foo', ioc(echoAppFoo)); app.optimizeForProduction(force: true); @@ -18,7 +18,7 @@ void main() { var rq = MockHttpRequest('GET', Uri(path: '/foo')); await rq.close(); - await AngelHttp(app).handleRequest(rq); + await ProtevusHttp(app).handleRequest(rq); var rs = rq.response; var body = await rs.transform(utf8.decoder).join(); expect(body, json.encode('bar')); diff --git a/packages/core/framework/test/primitives_test.dart b/packages/core/framework/test/primitives_test.dart index 2d3d92aa..5064935a 100644 --- a/packages/core/framework/test/primitives_test.dart +++ b/packages/core/framework/test/primitives_test.dart @@ -9,13 +9,13 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; void main() { - late Angel app; - late AngelHttp http; + late Protevus app; + late ProtevusHttp http; setUp(() { - app = Angel(reflector: MirrorsReflector()) + app = Protevus(reflector: MirrorsReflector()) ..configuration['global'] = 305; // Pitbull! - http = AngelHttp(app); + http = ProtevusHttp(app); app.get('/string/:string', ioc((String string) => string)); diff --git a/packages/core/framework/test/repeat_request_test.dart b/packages/core/framework/test/repeat_request_test.dart index 9d1e8fd9..5ac49546 100644 --- a/packages/core/framework/test/repeat_request_test.dart +++ b/packages/core/framework/test/repeat_request_test.dart @@ -13,10 +13,10 @@ void main() { } test('can request the same url twice', () async { - var app = Angel(reflector: MirrorsReflector()) + var app = Protevus(reflector: MirrorsReflector()) ..get('/test/:id', ioc((id) => 'Hello $id')); var rq1 = mk(1), rq2 = mk(2), rq3 = mk(1); - await Future.wait([rq1, rq2, rq3].map(AngelHttp(app).handleRequest)); + await Future.wait([rq1, rq2, rq3].map(ProtevusHttp(app).handleRequest)); var body1 = await rq1.response.transform(utf8.decoder).join(), body2 = await rq2.response.transform(utf8.decoder).join(), body3 = await rq3.response.transform(utf8.decoder).join(); diff --git a/packages/core/framework/test/req_shutdown_test.dart b/packages/core/framework/test/req_shutdown_test.dart index d4a00627..cd45b489 100644 --- a/packages/core/framework/test/req_shutdown_test.dart +++ b/packages/core/framework/test/req_shutdown_test.dart @@ -8,7 +8,7 @@ import 'pretty_log.dart'; void main() { late http.IOClient client; - late AngelHttp driver; + late ProtevusHttp driver; late Logger logger; late StringBuffer buf; @@ -21,14 +21,14 @@ void main() { ..level = Level.ALL ..onRecord.listen(prettyLog); - var app = Angel(logger: logger); + var app = Protevus(logger: logger); app.fallback((req, res) { req.shutdownHooks.add(() => buf.write('Hello, ')); req.shutdownHooks.add(() => buf.write('world!')); }); - driver = AngelHttp(app); + driver = ProtevusHttp(app); await driver.startServer(); }); diff --git a/packages/core/framework/test/response_header_test.dart b/packages/core/framework/test/response_header_test.dart index b4762be2..224c5851 100644 --- a/packages/core/framework/test/response_header_test.dart +++ b/packages/core/framework/test/response_header_test.dart @@ -6,13 +6,13 @@ import 'package:angel3_framework/src/http/angel_http.dart'; import 'package:test/test.dart'; void main() { - late Angel app; - late AngelHttp http; + late Protevus app; + late ProtevusHttp http; late HttpClient client; setUp(() async { - app = Angel(reflector: MirrorsReflector()); - http = AngelHttp(app); + app = Protevus(reflector: MirrorsReflector()); + http = ProtevusHttp(app); await http.startServer(); diff --git a/packages/core/framework/test/routing_test.dart b/packages/core/framework/test/routing_test.dart index 404d26cd..67d69ef6 100644 --- a/packages/core/framework/test/routing_test.dart +++ b/packages/core/framework/test/routing_test.dart @@ -36,16 +36,16 @@ bool interceptService(RequestContext req, ResponseContext res) { } void main() { - late Angel app; - late Angel nested; - late Angel todos; + late Protevus app; + late Protevus nested; + late Protevus todos; late String url; late http.Client client; setUp(() async { - app = Angel(reflector: MirrorsReflector()); - nested = Angel(reflector: MirrorsReflector()); - todos = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); + nested = Protevus(reflector: MirrorsReflector()); + todos = Protevus(reflector: MirrorsReflector()); for (var app in [app, nested, todos]) { app.logger = Logger('routing_test') @@ -113,7 +113,7 @@ void main() { //app.dumpTree(header: "DUMPING ROUTES:", showMatchers: true); client = http.Client(); - var server = await AngelHttp(app).startServer('127.0.0.1', 0); + var server = await ProtevusHttp(app).startServer('127.0.0.1', 0); url = 'http://${server.address.host}:${server.port}'; }); @@ -184,9 +184,9 @@ void main() { test('Can name routes', () { Route foo = app.get('/framework/:id', null)..name = 'frm'; print('Foo: $foo'); - String uri = foo.makeUri({'id': 'angel'}); + String uri = foo.makeUri({'id': 'protevus'}); print(uri); - expect(uri, equals('framework/angel')); + expect(uri, equals('framework/protevus')); }); */ diff --git a/packages/core/framework/test/serialize_test.dart b/packages/core/framework/test/serialize_test.dart index 92197227..2f2105eb 100644 --- a/packages/core/framework/test/serialize_test.dart +++ b/packages/core/framework/test/serialize_test.dart @@ -8,13 +8,13 @@ import 'package:http_parser/http_parser.dart'; import 'package:test/test.dart'; void main() { - late Angel app; + late Protevus app; late http.Client client; late HttpServer server; late String url; setUp(() async { - app = Angel(reflector: MirrorsReflector()) + app = Protevus(reflector: MirrorsReflector()) ..get('/foo', ioc(() => {'hello': 'world'})) ..get('/bar', (req, res) async { await res.serialize({'hello': 'world'}, @@ -22,7 +22,7 @@ void main() { }); client = http.Client(); - server = await AngelHttp(app).startServer(); + server = await ProtevusHttp(app).startServer(); url = 'http://${server.address.host}:${server.port}'; }); diff --git a/packages/core/framework/test/server_test.dart b/packages/core/framework/test/server_test.dart index 5cd51718..6da6c9c6 100644 --- a/packages/core/framework/test/server_test.dart +++ b/packages/core/framework/test/server_test.dart @@ -14,8 +14,9 @@ final Uri $foo = Uri.parse('http://localhost:3000/foo'); /// Additional tests to improve coverage of server.dart void main() { group('scoping', () { - var parent = Angel(reflector: MirrorsReflector())..configuration['two'] = 2; - var child = Angel(reflector: MirrorsReflector()); + var parent = Protevus(reflector: MirrorsReflector()) + ..configuration['two'] = 2; + var child = Protevus(reflector: MirrorsReflector()); parent.mount('/child', child); test('sets children', () { @@ -32,20 +33,20 @@ void main() { }); test('custom server generator', () { - var app = Angel(reflector: MirrorsReflector()); - var http = AngelHttp.custom(app, HttpServer.bind); + var app = Protevus(reflector: MirrorsReflector()); + var http = ProtevusHttp.custom(app, HttpServer.bind); expect(http.serverGenerator, HttpServer.bind); }); test('default error handler', () async { - var app = Angel(reflector: MirrorsReflector()); - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector()); + var http = ProtevusHttp(app); var rq = MockHttpRequest('GET', $foo); await (rq.close()); var rs = rq.response; var req = await http.createRequestContext(rq, rs); var res = await http.createResponseContext(rq, rs); - var e = AngelHttpException( + var e = ProtevusHttpException( statusCode: 321, message: 'Hello', errors: ['foo', 'bar']); await app.errorHandler(e, req, res); await http.sendResponse(rq, rs, req, res); @@ -61,10 +62,10 @@ void main() { }); test('plug-ins run on startup', () async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); app.startupHooks.add((app) => app.configuration['two'] = 2); - var http = AngelHttp(app); + var http = ProtevusHttp(app); await http.startServer(); expect(app.configuration['two'], 2); await app.close(); @@ -72,7 +73,7 @@ void main() { }); test('warning when adding routes to flattened router', () { - var app = Angel(reflector: MirrorsReflector()) + var app = Protevus(reflector: MirrorsReflector()) ..optimizeForProduction(force: true); app.dumpTree(); app.get('/', (req, res) => 2); @@ -80,7 +81,7 @@ void main() { }); test('services close on close call', () async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); var svc = CustomCloseService(); expect(svc.value, 2); app.use('/', svc); @@ -89,8 +90,8 @@ void main() { }); test('global injection added to injection map', () async { - var app = Angel(reflector: MirrorsReflector())..configuration['a'] = 'b'; - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector())..configuration['a'] = 'b'; + var http = ProtevusHttp(app); app.get('/', ioc((String a) => a)); var rq = MockHttpRequest('GET', Uri.parse('/')); await (rq.close()); @@ -100,8 +101,8 @@ void main() { }); test('global injected serializer', () async { - var app = Angel(reflector: MirrorsReflector())..serializer = (_) => 'x'; - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector())..serializer = (_) => 'x'; + var http = ProtevusHttp(app); app.get($foo.path, (req, ResponseContext res) => res.serialize(null)); var rq = MockHttpRequest('GET', $foo); await (rq.close()); @@ -111,10 +112,10 @@ void main() { }); group('handler results', () { - var app = Angel(reflector: MirrorsReflector()); - var http = AngelHttp(app); + var app = Protevus(reflector: MirrorsReflector()); + var http = ProtevusHttp(app); app.responseFinalizers - .add((req, res) => throw AngelHttpException.forbidden()); + .add((req, res) => throw ProtevusHttpException.forbidden()); late RequestContext req; late ResponseContext res; @@ -154,14 +155,14 @@ void main() { }); group('handleAngelHttpException', () { - late Angel app; - late AngelHttp http; + late Protevus app; + late ProtevusHttp http; setUp(() async { - app = Angel(reflector: MirrorsReflector()); - app.get('/wtf', (req, res) => throw AngelHttpException.forbidden()); - app.get('/wtf2', (req, res) => throw AngelHttpException.forbidden()); - http = AngelHttp(app); + app = Protevus(reflector: MirrorsReflector()); + app.get('/wtf', (req, res) => throw ProtevusHttpException.forbidden()); + app.get('/wtf2', (req, res) => throw ProtevusHttpException.forbidden()); + http = ProtevusHttp(app); await http.startServer('127.0.0.1', 0); var oldHandler = app.errorHandler; diff --git a/packages/core/framework/test/services_test.dart b/packages/core/framework/test/services_test.dart index 46a34745..87a1f39e 100644 --- a/packages/core/framework/test/services_test.dart +++ b/packages/core/framework/test/services_test.dart @@ -16,20 +16,20 @@ void main() { 'Accept': 'application/json', 'Content-Type': 'application/json' }; - late Angel app; + late Protevus app; late MapService service; late String url; late http.Client client; setUp(() async { - app = Angel(reflector: MirrorsReflector()) + app = Protevus(reflector: MirrorsReflector()) ..use('/todos', service = MapService()) ..errorHandler = (e, req, res) { if (e.error != null) print('Whoops: ${e.error}'); if (e.stackTrace != null) print(Chain.forTrace(e.stackTrace!).terse); }; - var server = await AngelHttp(app).startServer(); + var server = await ProtevusHttp(app).startServer(); client = http.Client(); url = 'http://${server.address.host}:${server.port}'; }); diff --git a/packages/core/framework/test/streaming_test.dart b/packages/core/framework/test/streaming_test.dart index d416fb93..70dfb2ef 100644 --- a/packages/core/framework/test/streaming_test.dart +++ b/packages/core/framework/test/streaming_test.dart @@ -13,12 +13,12 @@ import 'package:test/test.dart'; import 'encoders_buffer_test.dart' show encodingTests; void main() { - late Angel app; - late AngelHttp http; + late Protevus app; + late ProtevusHttp http; setUp(() { - app = Angel(reflector: MirrorsReflector()); - http = AngelHttp(app, useZone: true); + app = Protevus(reflector: MirrorsReflector()); + http = ProtevusHttp(app, useZone: true); app.logger = Logger('streaming_test') ..onRecord.listen((rec) { diff --git a/packages/core/framework/test/view_generator_test.dart b/packages/core/framework/test/view_generator_test.dart index 05fa9e0c..3155783f 100644 --- a/packages/core/framework/test/view_generator_test.dart +++ b/packages/core/framework/test/view_generator_test.dart @@ -3,7 +3,7 @@ import 'package:test/test.dart'; void main() { test('default view generator', () async { - var app = Angel(); + var app = Protevus(); var view = await app.viewGenerator!('foo', {'bar': 'baz'}); expect(view, contains('No view engine')); }); diff --git a/packages/core/mocking/README.md b/packages/core/mocking/README.md index bd52f791..486cbc88 100644 --- a/packages/core/mocking/README.md +++ b/packages/core/mocking/README.md @@ -3,13 +3,13 @@ ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_mock_request?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/mock_request/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/mock_request/LICENSE) **Forked from `mock_request` to support NNBD** Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc. This makes it possible to test server-side Dart applications without having to ever bind to a port. -This package was originally designed to make testing [Angel3](https://angel3-framework.web.app/) applications smoother, but works with any Dart-based server. +This package was originally designed to make testing [Protevus](https://angel3-framework.web.app/) applications smoother, but works with any Dart-based server. ## Usage diff --git a/packages/core/mocking/pubspec.yaml b/packages/core/mocking/pubspec.yaml index c123ff9e..8eb960bf 100644 --- a/packages/core/mocking/pubspec.yaml +++ b/packages/core/mocking/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_mock_request version: 8.2.0 description: Manufacture dart:io HttpRequests, HttpResponses, HttpHeaders, etc. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/mock_request +repository: https://github.com/dart-backend/protevus/tree/master/packages/mock_request environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/core/model/README.md b/packages/core/model/README.md index cfe73ebc..7b8d7139 100644 --- a/packages/core/model/README.md +++ b/packages/core/model/README.md @@ -1,11 +1,11 @@ -# Angel3 Data Model +# Protevus Data Model ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_model?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/model/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/model/LICENSE) -The basic data models for Angel3 framework. +The basic data models for Protevus framework. ```dart import 'package:angel3_model/angel3_model.dart'; diff --git a/packages/core/model/pubspec.yaml b/packages/core/model/pubspec.yaml index 4a02e141..6ee44d37 100644 --- a/packages/core/model/pubspec.yaml +++ b/packages/core/model/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_model version: 8.2.0 -description: Angel3 basic data model class, no longer with the added weight of the whole framework. +description: Protevus basic data model class, no longer with the added weight of the whole framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/model +repository: https://github.com/dart-backend/protevus/tree/master/packages/model environment: sdk: '>=3.3.0 <4.0.0' dev_dependencies: diff --git a/packages/core/route/README.md b/packages/core/route/README.md index 3c44e383..22ad22c1 100644 --- a/packages/core/route/README.md +++ b/packages/core/route/README.md @@ -1,9 +1,9 @@ -# Angel3 Route +# Protevus Route ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_route?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/route/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/route/LICENSE) A powerful, isomorphic routing library for Dart. @@ -13,7 +13,7 @@ A powerful, isomorphic routing library for Dart. ## Contents -- [Angel3 Route](#angel3-route) +- [Protevus Route](#angel3-route) - [Contents](#contents) - [Examples](#examples) - [Routing](#routing) @@ -26,7 +26,7 @@ A powerful, isomorphic routing library for Dart. ### Routing -If you use [Angel3](https://pub.dev/packages/angel3_framework), every `Angel` instance is a `Router` in itself. +If you use [Protevus](https://pub.dev/packages/angel3_framework), every `Angel` instance is a `Router` in itself. ```dart void main() { diff --git a/packages/core/route/pubspec.yaml b/packages/core/route/pubspec.yaml index 10ded011..c155f0aa 100644 --- a/packages/core/route/pubspec.yaml +++ b/packages/core/route/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_route version: 8.2.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. +description: A powerful, isomorphic routing library for Dart. It is mainly used in the Protevus framework, but can be used in Flutter and on the Web. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/route +repository: https://github.com/dart-backend/protevus/tree/master/packages/route environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/cors/README.md b/packages/cors/README.md index 604af9b5..677fcd1c 100644 --- a/packages/cors/README.md +++ b/packages/cors/README.md @@ -1,10 +1,10 @@ -# Angel3 CORS middleware +# Protevus CORS middleware ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_cors?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/cors/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/cors/LICENSE) -CORS headers middleware for Angel3. Ported from [Express CORS middleware](https://github.com/expressjs/cors) to Angel3 framework. +CORS headers middleware for Protevus. Ported from [Express CORS middleware](https://github.com/expressjs/cors) to Protevus framework. For complete example usage, see the [example file](example/example.dart). diff --git a/packages/cors/example/example.dart b/packages/cors/example/example.dart index ab669423..6c2e8e78 100644 --- a/packages/cors/example/example.dart +++ b/packages/cors/example/example.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:angel3_cors/angel3_cors.dart'; import 'package:angel3_framework/angel3_framework.dart'; -Future configureServer(Angel app) async { +Future configureServer(Protevus app) async { // The default options will allow CORS for any request. // Combined with `fallback`, you can enable CORS application-wide. app.fallback(cors()); diff --git a/packages/cors/pubspec.yaml b/packages/cors/pubspec.yaml index d9f9d103..884330f2 100644 --- a/packages/cors/pubspec.yaml +++ b/packages/cors/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_cors version: 8.2.0 -description: Angel3 CORS middleware. Ported from expressjs/cors to Angel3 framework. +description: Protevus CORS middleware. Ported from expressjs/cors to Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/cors +repository: https://github.com/dart-backend/protevus/tree/master/packages/cors environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/cors/test/cors_test.dart b/packages/cors/test/cors_test.dart index bb354a9d..283e3e2a 100644 --- a/packages/cors/test/cors_test.dart +++ b/packages/cors/test/cors_test.dart @@ -5,12 +5,12 @@ import 'package:http/http.dart' as http; import 'package:test/test.dart'; void main() { - Angel? app; - late AngelHttp server; + Protevus? app; + late ProtevusHttp server; http.Client? client; setUp(() async { - app = Angel() + app = Protevus() ..options('/credentials', cors(CorsOptions(credentials: true))) ..options('/credentials_d', dynamicCors((req, res) => CorsOptions(credentials: true))) @@ -55,9 +55,9 @@ void main() { ..post('/', (req, res) async { res.write('hello world'); }) - ..fallback((req, res) => throw AngelHttpException.notFound()); + ..fallback((req, res) => throw ProtevusHttpException.notFound()); - server = AngelHttp(app!); + server = ProtevusHttp(app!); await server.startServer('127.0.0.1', 0); client = http.Client(); }); diff --git a/packages/file_service/README.md b/packages/file_service/README.md index 20b0a207..99f32119 100644 --- a/packages/file_service/README.md +++ b/packages/file_service/README.md @@ -1,9 +1,9 @@ -# File Service for Angel3 +# File Service for Protevus ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_file_service?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/file_service/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/file_service/LICENSE) Angel service that persists data to a file on disk, stored as a JSON list. It uses a simple mutex to prevent race conditions, and caches contents in memory until changes are made. diff --git a/packages/file_service/example/main.dart b/packages/file_service/example/main.dart index e7f42ba1..470b1ca2 100644 --- a/packages/file_service/example/main.dart +++ b/packages/file_service/example/main.dart @@ -2,7 +2,7 @@ import 'package:angel3_file_service/angel3_file_service.dart'; import 'package:angel3_framework/angel3_framework.dart'; import 'package:file/local.dart'; -void configureServer(Angel app) async { +void configureServer(Protevus app) async { // Just like a normal service app.use( '/api/todos', diff --git a/packages/file_service/pubspec.yaml b/packages/file_service/pubspec.yaml index af000f8d..b54b9c16 100644 --- a/packages/file_service/pubspec.yaml +++ b/packages/file_service/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_file_service version: 8.2.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/dart-backend/angel/tree/master/packages/file_service +repository: https://github.com/dart-backend/protevus/tree/master/packages/file_service environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/hot/CHANGELOG.md b/packages/hot/CHANGELOG.md index c4977e99..242ac163 100644 --- a/packages/hot/CHANGELOG.md +++ b/packages/hot/CHANGELOG.md @@ -102,7 +102,7 @@ ## 2.0.1 * Add import of `package:angel_framework/http.dart` - * + * ## 2.0.0 diff --git a/packages/hot/README.md b/packages/hot/README.md index cb0d819d..55c21bd0 100644 --- a/packages/hot/README.md +++ b/packages/hot/README.md @@ -1,13 +1,13 @@ -# Angel3 Hot Reloader +# Protevus Hot Reloader ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_hot?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/hot/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/hot/LICENSE) ![Screenshot of terminal](screenshots/angel3-screenshot.png) -Supports *hot reloading* of Angel3 servers on file changes. This is faster and more reliable than merely reactively restarting a `Process`. This package only works with the [Angel3 framework](https://pub.dev/packages/angel3_framework). +Supports *hot reloading* of Protevus servers on file changes. This is faster and more reliable than merely reactively restarting a `Process`. This package only works with the [Protevus framework](https://pub.dev/packages/angel3_framework). **Not recommended to use in production, unless you are specifically intending for a "hot code push" in production.** @@ -65,7 +65,7 @@ Future createServer() async { 'deflate': zlib.encoder, }); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) { diff --git a/packages/hot/example/server.dart b/packages/hot/example/server.dart index efaa39a3..91a23316 100644 --- a/packages/hot/example/server.dart +++ b/packages/hot/example/server.dart @@ -5,22 +5,22 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:logging/logging.dart'; import 'src/foo.dart'; -Future createServer() async { - var app = Angel()..serializer = json.encode; +Future createServer() async { + var app = Protevus()..serializer = json.encode; hierarchicalLoggingEnabled = true; // Edit this line, and then refresh the page in your browser! app.get('/', (req, res) => {'hello': 'hot world!'}); app.get('/foo', (req, res) => Foo(bar: 'baz')); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); app.encoders.addAll({ 'gzip': gzip.encoder, 'deflate': zlib.encoder, }); - app.logger = Logger.detached('angel') + app.logger = Logger.detached('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) { diff --git a/packages/hot/lib/angel3_hot.dart b/packages/hot/lib/angel3_hot.dart index ee3858f6..dfb99364 100644 --- a/packages/hot/lib/angel3_hot.dart +++ b/packages/hot/lib/angel3_hot.dart @@ -26,7 +26,7 @@ class HotReloader { final StringRenderer _renderer = StringRenderer(pretty: false); final Queue _requestQueue = Queue(); late HttpServer _io; - AngelHttp? _server; + ProtevusHttp? _server; late Duration _timeout; late vm.VmService _client; vm.VM? _vmachine; @@ -37,8 +37,8 @@ class HotReloader { /// This option triggers printing a Flutter-like output to the terminal. final bool enableHotkeys; - /// Invoked to load a new instance of [Angel] on file changes. - final FutureOr Function() generator; + /// Invoked to load a new instance of [Protevus] on file changes. + final FutureOr Function() generator; /// Fires whenever a file change. You might consider using this to trigger /// page reloads in a client. @@ -133,11 +133,11 @@ class HotReloader { Logger? get _appLogger => _server?.app.logger; - Future _generateServer() async { + Future _generateServer() async { var s = await generator(); await Future.forEach(s.startupHooks, s.configure); s.optimizeForProduction(); - return AngelHttp.custom(s, startShared); + return ProtevusHttp.custom(s, startShared); } void _logWarning(String msg) { @@ -365,7 +365,7 @@ class HotReloader { scheduleMicrotask(() async { // Disconnect active WebSockets try { - var ws = _server?.app.container.make(); + var ws = _server?.app.container.make(); if (ws != null) { for (var client in ws.clients) { diff --git a/packages/hot/pubspec.yaml b/packages/hot/pubspec.yaml index 8b988be7..f57cd5b2 100644 --- a/packages/hot/pubspec.yaml +++ b/packages/hot/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_hot version: 8.3.0 -description: Supports hot reloading/hot code push of Angel3 servers on file changes. +description: Supports hot reloading/hot code push of Protevus servers on file changes. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/hot +repository: https://github.com/dart-backend/protevus/tree/master/packages/hot environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/html/README.md b/packages/html/README.md index 4ec9b54f..dd8f732a 100644 --- a/packages/html/README.md +++ b/packages/html/README.md @@ -1,9 +1,9 @@ -# Angel3 HTML +# Protevus 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) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/html/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/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. diff --git a/packages/html/example/main.dart b/packages/html/example/main.dart index 3e9d3f60..ab319a73 100644 --- a/packages/html/example/main.dart +++ b/packages/html/example/main.dart @@ -5,8 +5,8 @@ import 'package:belatuk_html_builder/elements.dart'; import 'package:logging/logging.dart'; void main() async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); app.logger = Logger('angel_html') ..onRecord.listen((rec) { print(rec); @@ -40,7 +40,7 @@ void main() async { ]), ); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); await http.startServer('127.0.0.1', 3000); print('Listening at ${http.uri}'); diff --git a/packages/html/lib/angel3_html.dart b/packages/html/lib/angel3_html.dart index f72506d4..e10ba76f 100644 --- a/packages/html/lib/angel3_html.dart +++ b/packages/html/lib/angel3_html.dart @@ -19,7 +19,7 @@ RequestHandler renderHtml( return oldSerializer(data); } else { if (enforceAcceptHeader == true && !req.accepts('text/html')) { - throw AngelHttpException.notAcceptable(); + throw ProtevusHttpException.notAcceptable(); } var content = renderer!.render(data); diff --git a/packages/html/pubspec.yaml b/packages/html/pubspec.yaml index 6ae5a785..10a9dfa6 100644 --- a/packages/html/pubspec.yaml +++ b/packages/html/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_html version: 8.1.0 description: Support for rendering html_builder AST's as responses in Angel. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/angel3/packages/html_builder +repository: https://github.com/dart-backend/protevus/tree/angel3/packages/html_builder environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/html/test/all_test.dart b/packages/html/test/all_test.dart index 05d72ec7..c3f3611f 100644 --- a/packages/html/test/all_test.dart +++ b/packages/html/test/all_test.dart @@ -5,11 +5,11 @@ import 'package:belatuk_html_builder/elements.dart'; import 'package:test/test.dart'; void main() { - Angel app; + Protevus app; late TestClient client; setUp(() async { - app = Angel(); + app = Protevus(); app.fallback(renderHtml()); @@ -76,8 +76,10 @@ void main() { response = await client.get(Uri.parse('/strict'), headers: {'accept': 'application/json,text/xml'}); print('Response: ${response.body}'); - expect(response, - isAngelHttpException(statusCode: 406, message: '406 Not Acceptable')); + expect( + response, + isProtevusHttpException( + statusCode: 406, message: '406 Not Acceptable')); }); }); } diff --git a/packages/jael/README.md b/packages/jael/README.md index 7efdf02a..7aa5c046 100644 --- a/packages/jael/README.md +++ b/packages/jael/README.md @@ -20,7 +20,7 @@ Jael3 is a good choice for applications of any scale, especially when the develo Each of the [packages within this repository](#this-repository) contains some sort of documentation. -Documentation for Jael syntax and directives has been **moved** to the [Angel3 framework wiki](https://angel3-docs.dukefirehawk.com/packages/front-end/jael). +Documentation for Jael syntax and directives has been **moved** to the [Protevus framework wiki](https://angel3-docs.dukefirehawk.com/packages/front-end/jael). ## This Repository @@ -28,4 +28,4 @@ Within this repository are three packages: * `package:jael3` - Contains the Jael parser, AST, and HTML renderer. * `package:jael3_preprocessor` - Handles template inheritance, and facilitates the use of "compile-time" constructs. -* `package:angel3_jael` - [Angel3](https://angel3-framework.web.app/) support for Jael. +* `package:angel3_jael` - [Protevus](https://angel3-framework.web.app/) support for Jael. diff --git a/packages/jael/angel_jael/README.md b/packages/jael/angel_jael/README.md index be06809d..322108ef 100644 --- a/packages/jael/angel_jael/README.md +++ b/packages/jael/angel_jael/README.md @@ -1,9 +1,9 @@ -# Angel3 Jael +# Protevus Jael ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_jael?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/jael/angel_jael/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/jael/angel_jael/LICENSE) [Angel 3](https://pub.dev/packages/angel3_framework) support for [Jael 3](https://pub.dev/packages/jael3). @@ -64,7 +64,7 @@ void main() async { app.use(() => throw AngelHttpException.notFound()); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); diff --git a/packages/jael/angel_jael/example/main.dart b/packages/jael/angel_jael/example/main.dart index c55e7513..de05400a 100644 --- a/packages/jael/angel_jael/example/main.dart +++ b/packages/jael/angel_jael/example/main.dart @@ -6,8 +6,8 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; main() async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); var fileSystem = const LocalFileSystem(); await app.configure( @@ -30,9 +30,9 @@ main() async { }); }); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); diff --git a/packages/jael/angel_jael/lib/angel3_jael.dart b/packages/jael/angel_jael/lib/angel3_jael.dart index bd358ac6..1d489f0a 100644 --- a/packages/jael/angel_jael/lib/angel3_jael.dart +++ b/packages/jael/angel_jael/lib/angel3_jael.dart @@ -13,7 +13,7 @@ import 'package:belatuk_symbol_table/belatuk_symbol_table.dart'; /// with a function that returns a new instance of [CodeBuffer]. /// /// To apply additional transforms to parsed documents, provide a set of [patch] functions. -AngelConfigurer jael(Directory viewsDirectory, +ProtevusConfigurer jael(Directory viewsDirectory, {String fileExtension = '.jael', bool strictResolution = false, bool cacheViews = true, @@ -30,7 +30,7 @@ AngelConfigurer jael(Directory viewsDirectory, bufferFunc = () => CodeBuffer(space: '', newline: ''); } - return (Angel app) async { + return (Protevus app) async { app.viewGenerator = (String name, [Map? locals]) async { var errors = []; Document? processed; diff --git a/packages/jael/angel_jael/pubspec.yaml b/packages/jael/angel_jael/pubspec.yaml index b7743b2a..47c0dcdc 100644 --- a/packages/jael/angel_jael/pubspec.yaml +++ b/packages/jael/angel_jael/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_jael version: 8.2.0 description: Angel support for the Jael templating engine, similar to Blade or Liquid. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/jael/angel_jael +repository: https://github.com/dart-backend/protevus/tree/master/packages/jael/angel_jael environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/jael/angel_jael/test/all_test.dart b/packages/jael/angel_jael/test/all_test.dart index d3dbc486..78f6f017 100644 --- a/packages/jael/angel_jael/test/all_test.dart +++ b/packages/jael/angel_jael/test/all_test.dart @@ -14,7 +14,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); app.configuration['properties'] = app.configuration; var fileSystem = MemoryFileSystem(); @@ -49,9 +49,9 @@ void main() { jael(viewsDirectory, minified: false), ); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); diff --git a/packages/jael/angel_jael/test/minified_test.dart b/packages/jael/angel_jael/test/minified_test.dart index c2085453..503291f0 100644 --- a/packages/jael/angel_jael/test/minified_test.dart +++ b/packages/jael/angel_jael/test/minified_test.dart @@ -15,7 +15,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); app.configuration['properties'] = app.configuration; var fileSystem = MemoryFileSystem(); @@ -54,9 +54,9 @@ void main() { jael(viewsDirectory, cache: viewCache), ); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); diff --git a/packages/jael/jael/README.md b/packages/jael/jael/README.md index f9ebea1b..8a9b12bb 100644 --- a/packages/jael/jael/README.md +++ b/packages/jael/jael/README.md @@ -3,7 +3,7 @@ ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/jael3?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/jael/jael/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/jael/jael/LICENSE) A simple server-side HTML templating engine for Dart. diff --git a/packages/jael/jael/pubspec.yaml b/packages/jael/jael/pubspec.yaml index 158de297..9cc20b40 100644 --- a/packages/jael/jael/pubspec.yaml +++ b/packages/jael/jael/pubspec.yaml @@ -2,7 +2,7 @@ name: jael3 version: 8.2.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/dart-backend/angel/tree/master/packages/jael/jael +repository: https://github.com/dart-backend/protevus/tree/master/packages/jael/jael environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/jael/jael_language_server/pubspec.yaml b/packages/jael/jael_language_server/pubspec.yaml index 87780a17..6293befd 100644 --- a/packages/jael/jael_language_server/pubspec.yaml +++ b/packages/jael/jael_language_server/pubspec.yaml @@ -1,7 +1,7 @@ name: jael3_language_server version: 8.1.0 description: Language Server Protocol implementation for the Jael templating engine. -homepage: https://github.com/angel-dart/vscode +homepage: https://github.com/protevus-dart/vscode publish_to: none environment: sdk: '>=3.3.0 <4.0.0' diff --git a/packages/jael/jael_preprocessor/README.md b/packages/jael/jael_preprocessor/README.md index 1636b3d0..5f233527 100644 --- a/packages/jael/jael_preprocessor/README.md +++ b/packages/jael/jael_preprocessor/README.md @@ -3,7 +3,7 @@ ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/jael3_preprocessor?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/jael/jael_preprocessor/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/jael/jael_preprocessor/LICENSE) A pre-processor for resolving blocks and includes within [Jael 3](https://pub.dev/packages/jael3) templates. diff --git a/packages/jael/jael_preprocessor/pubspec.yaml b/packages/jael/jael_preprocessor/pubspec.yaml index b0b30d3f..a379758a 100644 --- a/packages/jael/jael_preprocessor/pubspec.yaml +++ b/packages/jael/jael_preprocessor/pubspec.yaml @@ -2,7 +2,7 @@ name: jael3_preprocessor version: 8.2.0 description: A pre-processor for resolving blocks and includes within Jael templates. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/jael/jael_preprocessor +repository: https://github.com/dart-backend/protevus/tree/master/packages/jael/jael_preprocessor environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/jael/jael_web/README.md b/packages/jael/jael_web/README.md index fc85bf5e..ecd3c803 100644 --- a/packages/jael/jael_web/README.md +++ b/packages/jael/jael_web/README.md @@ -1,7 +1,7 @@ # JAEL3 Web [![Pub](https://img.shields.io/pub/v/jael_web.svg)](https://pub.dartlang.org/packages/jael_web) -[![build status](https://travis-ci.org/angel-dart/jael_web.svg)](https://travis-ci.org/angel-dart/jael) +[![build status](https://travis-ci.org/protevus-dart/jael_web.svg)](https://travis-ci.org/protevus-dart/jael) Experimental virtual DOM/SPA engine built on Jael. Supports SSR. **Not ready for production use.** diff --git a/packages/jinja/README.md b/packages/jinja/README.md index 5cb36d08..03432b06 100644 --- a/packages/jinja/README.md +++ b/packages/jinja/README.md @@ -1,11 +1,11 @@ -# Jinja View Template for Angel3 +# Jinja View Template for Protevus ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_jinja?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/jinja/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/jinja/LICENSE) -A service that renders Jinja2 view template into HTML for [Angel3](https://angel3-framework.web.app) framework. Ported from Python to Dart. +A service that renders Jinja2 view template into HTML for [Protevus](https://angel3-framework.web.app) framework. Ported from Python to Dart. ## Example diff --git a/packages/jinja/example/main.dart b/packages/jinja/example/main.dart index 220e3fd5..c1a3e902 100644 --- a/packages/jinja/example/main.dart +++ b/packages/jinja/example/main.dart @@ -5,8 +5,8 @@ import 'package:angel3_jinja/angel3_jinja.dart'; import 'package:path/path.dart' as p; void main() async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); var viewsDir = p.join( p.dirname( p.fromUri(Platform.script), diff --git a/packages/jinja/lib/angel3_jinja.dart b/packages/jinja/lib/angel3_jinja.dart index 10a15fa0..dae3de18 100644 --- a/packages/jinja/lib/angel3_jinja.dart +++ b/packages/jinja/lib/angel3_jinja.dart @@ -9,7 +9,7 @@ import 'package:jinja/loaders.dart'; /// /// All options other than [createLoader] are passed to either [FileSystemLoader] /// or [Environment]. -AngelConfigurer jinja({ +ProtevusConfigurer jinja({ Set ext = const {'html'}, String path = 'lib/src/templates', bool followLinks = true, diff --git a/packages/jinja/pubspec.yaml b/packages/jinja/pubspec.yaml index cfe54254..95ebf4ea 100644 --- a/packages/jinja/pubspec.yaml +++ b/packages/jinja/pubspec.yaml @@ -1,7 +1,7 @@ name: angel3_jinja version: 8.3.1 -description: A service that renders Jinja2 template into HTML view for Angel3. Ported from Python to Dart. -homepage: https://github.com/dart-backend/angel/tree/master/packages/jinja +description: A service that renders Jinja2 template into HTML view for Protevus. Ported from Python to Dart. +homepage: https://github.com/dart-backend/protevus/tree/master/packages/jinja environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/markdown/README.md b/packages/markdown/README.md index 4bb1a711..076f30e0 100644 --- a/packages/markdown/README.md +++ b/packages/markdown/README.md @@ -1,11 +1,11 @@ -# Angel3 Markdown +# Protevus Markdown ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_markdown?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/markdown/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/markdown/LICENSE) -Markdown view generator for Angel3. +Markdown view generator for Protevus. With this plug-in, you can easily serve static sites without doing more than writing simple Markdown. Thus, it is a friendly choice for writing API documentation or other tedious HTML-writing tasks. diff --git a/packages/markdown/example/main.dart b/packages/markdown/example/main.dart index 538f3d5e..c74ddbb6 100644 --- a/packages/markdown/example/main.dart +++ b/packages/markdown/example/main.dart @@ -7,14 +7,14 @@ import 'package:file/local.dart'; void main() async { var app = await createServer(); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer(InternetAddress.loopbackIPv4, 3000); print('Listening at http://${server.address.address}:${server.port}'); } -Future createServer() async { +Future createServer() async { // Create a new server, and install the Markdown renderer. - var app = Angel(); + var app = Protevus(); var fs = LocalFileSystem(); await app .configure(markdown(fs.directory('views'), template: (content, locals) { diff --git a/packages/markdown/example/views/hello.md b/packages/markdown/example/views/hello.md index 3e3ddba3..1101f7c8 100644 --- a/packages/markdown/example/views/hello.md +++ b/packages/markdown/example/views/hello.md @@ -3,7 +3,7 @@ Welcome to a *simple* Markdown-gen site! Do you mind **starring** the -[Angel3 repository](https://github.com/dart-backend/angel)? +[Protevus repository](https://github.com/dart-backend/protevus)? ```text Look, a code block!!! diff --git a/packages/markdown/lib/angel3_markdown.dart b/packages/markdown/lib/angel3_markdown.dart index b95114e7..02a6f82e 100644 --- a/packages/markdown/lib/angel3_markdown.dart +++ b/packages/markdown/lib/angel3_markdown.dart @@ -6,7 +6,7 @@ import 'package:markdown/markdown.dart'; final RegExp _braces = RegExp(r'@?{{(((\\})|([^}]))+)}}'); -/// Configures an [Angel] instance to render Markdown templates from the specified [viewsDirectory]. +/// Configures an [Protevus] instance to render Markdown templates from the specified [viewsDirectory]. /// /// The default [extension] is `.md`. To search for a different file extension, provide a new one. /// By default, an [extensionSet] is provided that renders Github-flavored Markdown. This can also be overridden. @@ -14,7 +14,7 @@ final RegExp _braces = RegExp(r'@?{{(((\\})|([^}]))+)}}'); /// In many cases, Markdown content will be rendered within a larger [template] that styles the entire website. /// To wrap generated Markdown content in a template, provide a function that accepts a generated HTML String, /// and returns a String, or a `Future`. -AngelConfigurer markdown( +ProtevusConfigurer markdown( Directory viewsDirectory, { String? extension, ExtensionSet? extensionSet, @@ -24,7 +24,7 @@ AngelConfigurer markdown( extension ??= '.md'; extensionSet ??= ExtensionSet.gitHubWeb; - return (Angel app) async { + return (Protevus app) async { app.viewGenerator = (String name, [Map? locals]) async { var file = viewsDirectory.childFile( viewsDirectory.fileSystem.path.setExtension(name, extension!)); diff --git a/packages/markdown/pubspec.yaml b/packages/markdown/pubspec.yaml index 800365ad..9a0b88b5 100644 --- a/packages/markdown/pubspec.yaml +++ b/packages/markdown/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_markdown version: 8.2.0 -description: Angel3 Markdown view generator. Write static sites, with no build step. +description: Protevus Markdown view generator. Write static sites, with no build step. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/markdown +repository: https://github.com/dart-backend/protevus/tree/master/packages/markdown environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/mongo/CHANGELOG.md b/packages/mongo/CHANGELOG.md index af474e5f..05f58d1d 100644 --- a/packages/mongo/CHANGELOG.md +++ b/packages/mongo/CHANGELOG.md @@ -55,7 +55,7 @@ ## 2.0.3 -* Add null-coalescing check when processing queries: +* Add null-coalescing check when processing queries: ## 2.0.2 diff --git a/packages/mongo/README.md b/packages/mongo/README.md index 2abfa189..2fb2637a 100644 --- a/packages/mongo/README.md +++ b/packages/mongo/README.md @@ -1,11 +1,11 @@ -# Angel3 Mongo +# Protevus Mongo ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_mongo?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/mongo/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/mongo/LICENSE) -MongoDB-enabled services for the Angel3 framework. +MongoDB-enabled services for the Protevus framework. ## Installation diff --git a/packages/mongo/example/example.dart b/packages/mongo/example/example.dart index 0e54f0f3..f7f786df 100644 --- a/packages/mongo/example/example.dart +++ b/packages/mongo/example/example.dart @@ -4,7 +4,7 @@ import 'package:angel3_mongo/angel3_mongo.dart'; import 'package:mongo_dart/mongo_dart.dart'; void main() async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); var db = Db('mongodb://localhost:27017/testDB'); await db.open(); await db.authenticate("root", "Qwerty", authDb: "admin"); diff --git a/packages/mongo/lib/mongo_service.dart b/packages/mongo/lib/mongo_service.dart index 86fd3900..a28ee87e 100644 --- a/packages/mongo/lib/mongo_service.dart +++ b/packages/mongo/lib/mongo_service.dart @@ -113,7 +113,7 @@ class MongoService extends Service> { return _jsonify(result ?? {}); } } catch (e, st) { - throw AngelHttpException(stackTrace: st); + throw ProtevusHttpException(stackTrace: st); } } @@ -125,7 +125,7 @@ class MongoService extends Service> { var found = await collection.findOne(_makeQuery(params)); if (found == null) { - throw AngelHttpException.notFound(message: errorMessage); + throw ProtevusHttpException.notFound(message: errorMessage); } return _jsonify(found, params); @@ -139,7 +139,7 @@ class MongoService extends Service> { await collection.findOne(where.id(localId).and(_makeQuery(params)!)); if (found == null) { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'No record found for ID ${localId.oid}'); } @@ -161,7 +161,7 @@ class MongoService extends Service> { try { currentDoc = await read(id, params); - } on AngelHttpException catch (e) { + } on ProtevusHttpException catch (e) { if (e.statusCode == 404) { return await create(data, params); } else { @@ -180,7 +180,7 @@ class MongoService extends Service> { return result; } catch (e, st) { //printDebug(e, st, 'MODIFY'); - throw AngelHttpException(stackTrace: st); + throw ProtevusHttpException(stackTrace: st); } } @@ -202,7 +202,7 @@ class MongoService extends Service> { return result; } catch (e, st) { //printDebug(e, st, 'UPDATE'); - throw AngelHttpException(stackTrace: st); + throw ProtevusHttpException(stackTrace: st); } } @@ -213,7 +213,7 @@ class MongoService extends Service> { // Remove everything... if (!(allowRemoveAll == true || params?.containsKey('provider') != true)) { - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'Clients are not allowed to delete all items.'); } else { await collection.remove(null); @@ -229,7 +229,7 @@ class MongoService extends Service> { return _jsonify(result ?? {}); } catch (e, st) { //printDebug(e, st, 'REMOVE'); - throw AngelHttpException(stackTrace: st); + throw ProtevusHttpException(stackTrace: st); } } } diff --git a/packages/mongo/lib/services.dart b/packages/mongo/lib/services.dart index 4e84194e..3ae28052 100644 --- a/packages/mongo/lib/services.dart +++ b/packages/mongo/lib/services.dart @@ -20,7 +20,7 @@ ObjectId _makeId(id) { try { return (id is ObjectId) ? id : ObjectId.fromHexString(id.toString()); } catch (e) { - throw AngelHttpException.badRequest(); + throw ProtevusHttpException.badRequest(); } } diff --git a/packages/mongo/pubspec.yaml b/packages/mongo/pubspec.yaml index 2ff70c04..53ed15d4 100644 --- a/packages/mongo/pubspec.yaml +++ b/packages/mongo/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_mongo version: 8.2.1 -description: This is MongoDB-enabled service for the Angel3 framework. +description: This is MongoDB-enabled service for the Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/mongo +repository: https://github.com/dart-backend/protevus/tree/master/packages/mongo environment: sdk: '>=3.3.0 <4.0.0' diff --git a/packages/mongo/test/generic_test.dart b/packages/mongo/test/generic_test.dart index d6506fcd..df5fa85b 100644 --- a/packages/mongo/test/generic_test.dart +++ b/packages/mongo/test/generic_test.dart @@ -23,8 +23,8 @@ void wireHooked(HookedService hooked) { void main() { group('Generic Tests', () { - Angel app; - late AngelHttp transport; + Protevus app; + late ProtevusHttp transport; late http.Client client; var db = Db('mongodb://localhost:27017/testDB'); @@ -34,8 +34,8 @@ void main() { greetingService; setUp(() async { - app = Angel(reflector: MirrorsReflector()); - transport = AngelHttp(app); + app = Protevus(reflector: MirrorsReflector()); + transport = ProtevusHttp(app); client = http.Client(); await db.open(); await db.authenticate("root", "Qwerty", authDb: "admin"); diff --git a/packages/mustache/README.md b/packages/mustache/README.md index 5547340a..1e38e5cc 100644 --- a/packages/mustache/README.md +++ b/packages/mustache/README.md @@ -1,11 +1,11 @@ -# Mustache View Template for Angel3 +# Mustache View Template for Protevus ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_mustache?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/mustache/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/mustache/LICENSE) -A service that renders Mustache template into HTML view for [Angel3](https://angel3-framework.web.app/) framework. +A service that renders Mustache template into HTML view for [Protevus](https://angel3-framework.web.app/) framework. Thanks so much @c4wrd for his help with bringing this project to life! diff --git a/packages/mustache/example/main.dart b/packages/mustache/example/main.dart index 1da65588..83460997 100644 --- a/packages/mustache/example/main.dart +++ b/packages/mustache/example/main.dart @@ -5,7 +5,7 @@ import 'package:file/local.dart'; const FileSystem fs = LocalFileSystem(); -void configureServer(Angel app) async { +void configureServer(Protevus app) async { // Run the plug-in await app.configure(mustache(fs.directory('views'))); diff --git a/packages/mustache/lib/angel3_mustache.dart b/packages/mustache/lib/angel3_mustache.dart index c387f4c7..0d26cede 100644 --- a/packages/mustache/lib/angel3_mustache.dart +++ b/packages/mustache/lib/angel3_mustache.dart @@ -9,7 +9,7 @@ import 'package:path/path.dart' as p; import 'src/cache.dart'; import 'src/mustache_context.dart'; -Future Function(Angel app) mustache(Directory viewsDirectory, +Future Function(Protevus app) mustache(Directory viewsDirectory, {String fileExtension = '.mustache', String partialsPath = './partials'}) { var partialsDirectory = viewsDirectory.fileSystem .directory(p.join(p.fromUri(viewsDirectory.uri), partialsPath)); @@ -19,7 +19,7 @@ Future Function(Angel app) mustache(Directory viewsDirectory, var cache = MustacheViewCache(context); - return (Angel app) async { + return (Protevus app) async { app.viewGenerator = (String name, [Map? data]) async { //var partialsProvider; partialsProvider(String name) { diff --git a/packages/mustache/lib/src/cache.dart b/packages/mustache/lib/src/cache.dart index f3c3887c..df598d3d 100644 --- a/packages/mustache/lib/src/cache.dart +++ b/packages/mustache/lib/src/cache.dart @@ -15,7 +15,7 @@ class MustacheViewCache { MustacheViewCache([this.context]); - Future getView(String viewName, Angel app) async { + Future getView(String viewName, Protevus app) async { if (app.environment.isProduction) { if (viewCache.containsKey(viewName)) { return viewCache[viewName]; @@ -39,7 +39,7 @@ class MustacheViewCache { } } - String? getPartialSync(String partialName, Angel app) { + String? getPartialSync(String partialName, Protevus app) { if (app.environment.isProduction) { if (partialCache.containsKey(partialName)) { return partialCache[partialName]; diff --git a/packages/mustache/pubspec.yaml b/packages/mustache/pubspec.yaml index 71c474dd..ef090d7c 100644 --- a/packages/mustache/pubspec.yaml +++ b/packages/mustache/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_mustache version: 8.2.0 -description: A service that renders Mustache template into HTML view for Angel3 +description: A service that renders Mustache template into HTML view for Protevus homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/mustache +repository: https://github.com/dart-backend/protevus/tree/master/packages/mustache environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/mustache/test/all_test.dart b/packages/mustache/test/all_test.dart index 5d20d1c1..4b99199c 100644 --- a/packages/mustache/test/all_test.dart +++ b/packages/mustache/test/all_test.dart @@ -6,12 +6,14 @@ import 'package:file/local.dart'; import 'package:test/test.dart'; void main() async { - var angel = Angel(); - await angel.configure(mustache(const LocalFileSystem().directory('./test'))); + var protevus = Protevus(); + await protevus + .configure(mustache(const LocalFileSystem().directory('./test'))); test('can render templates', () async { - var hello = await angel.viewGenerator!('hello', {'name': 'world'}); - var bar = await angel.viewGenerator!('foo/bar', {'framework': 'angel'}); + var hello = await protevus.viewGenerator!('hello', {'name': 'world'}); + var bar = + await protevus.viewGenerator!('foo/bar', {'framework': 'protevus'}); expect(hello, equals('Hello, world!')); expect(bar, equals('angel_framework')); @@ -19,13 +21,14 @@ void main() async { test('throws if view is not found', () { expect(Future(() async { - var fails = await angel.viewGenerator!('fail', {'this_should': 'fail'}); + var fails = + await protevus.viewGenerator!('fail', {'this_should': 'fail'}); print(fails); }), throwsA(isA())); }); test('partials', () async { - var withPartial = await angel.viewGenerator!('with-partial'); + var withPartial = await protevus.viewGenerator!('with-partial'); expect(withPartial, equals('Hello, world!')); }); } diff --git a/packages/oauth2/README.md b/packages/oauth2/README.md index 221ecbdd..911ab16e 100644 --- a/packages/oauth2/README.md +++ b/packages/oauth2/README.md @@ -1,13 +1,13 @@ -# Angel3 OAuth2 Server +# Protevus OAuth2 Server ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_oauth2?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/oauth2/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/oauth2/LICENSE) A class containing handlers that can be used within [Angel](https://angel3-framework.web.app/) to build a spec-compliant OAuth 2.0 server, including PKCE support. -- [Angel3 OAuth2 Server](#angel3-oauth2-server) +- [Protevus OAuth2 Server](#angel3-oauth2-server) - [Installation](#installation) - [Usage](#usage) - [Other Grants](#other-grants) diff --git a/packages/oauth2/example/example1.dart b/packages/oauth2/example/example1.dart index 84142a73..74b2325d 100644 --- a/packages/oauth2/example/example1.dart +++ b/packages/oauth2/example/example1.dart @@ -18,7 +18,7 @@ void main() { // Declae the function void setUp() async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); var oauth2 = _AuthorizationServer(); app.group('/oauth2', (router) { diff --git a/packages/oauth2/example/main.dart b/packages/oauth2/example/main.dart index 04471d72..a8758a9f 100644 --- a/packages/oauth2/example/main.dart +++ b/packages/oauth2/example/main.dart @@ -4,7 +4,7 @@ import 'package:angel3_framework/angel3_framework.dart'; import 'package:angel3_oauth2/angel3_oauth2.dart'; void main() async { - var app = Angel(); + var app = Protevus(); var oauth2 = _ExampleAuthorizationServer(); var rgxBearer = RegExp(r'^[Bb]earer ([^\n\s]+)$'); @@ -20,7 +20,7 @@ void main() async { req.headers!.value('authorization')?.replaceAll(rgxBearer, '').trim(); if (authToken == null) { - throw AngelHttpException.forbidden(); + throw ProtevusHttpException.forbidden(); } else { // TODO: The user has a token, now verify it. // It is up to you how to store and retrieve auth tokens within your application. diff --git a/packages/oauth2/lib/src/exception.dart b/packages/oauth2/lib/src/exception.dart index 278601d0..cf79bb65 100644 --- a/packages/oauth2/lib/src/exception.dart +++ b/packages/oauth2/lib/src/exception.dart @@ -1,7 +1,7 @@ import 'package:angel3_http_exception/angel3_http_exception.dart'; /// An Angel-friendly wrapper around OAuth2 [ErrorResponse] instances. -class AuthorizationException extends AngelHttpException { +class AuthorizationException extends ProtevusHttpException { final ErrorResponse errorResponse; AuthorizationException(this.errorResponse, diff --git a/packages/oauth2/lib/src/server.dart b/packages/oauth2/lib/src/server.dart index 4bc643c1..a4fc84a8 100644 --- a/packages/oauth2/lib/src/server.dart +++ b/packages/oauth2/lib/src/server.dart @@ -291,7 +291,7 @@ abstract class AuthorizationServer { state, ), statusCode: 400); - } on AngelHttpException { + } on ProtevusHttpException { rethrow; } catch (e, st) { throw AuthorizationException( @@ -460,7 +460,7 @@ abstract class AuthorizationServer { ), statusCode: 400, ); - } on AngelHttpException { + } on ProtevusHttpException { rethrow; } catch (e, st) { throw AuthorizationException( diff --git a/packages/oauth2/pubspec.yaml b/packages/oauth2/pubspec.yaml index 75fc371a..bf080fb6 100644 --- a/packages/oauth2/pubspec.yaml +++ b/packages/oauth2/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_oauth2 version: 8.2.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/dart-backend/angel/tree/master/packages/oauth2 +repository: https://github.com/dart-backend/protevus/tree/master/packages/oauth2 environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/oauth2/test/auth_code_test.dart b/packages/oauth2/test/auth_code_test.dart index 2212f18b..ea1850d7 100644 --- a/packages/oauth2/test/auth_code_test.dart +++ b/packages/oauth2/test/auth_code_test.dart @@ -12,12 +12,12 @@ import 'package:uuid/uuid.dart'; import 'common.dart'; void main() { - Angel app; + Protevus app; late Uri authorizationEndpoint, tokenEndpoint, redirectUri; late TestClient testClient; setUp(() async { - app = Angel(); + app = Protevus(); app.configuration['properties'] = app.configuration; app.container.registerSingleton(AuthCodes()); @@ -29,14 +29,14 @@ void main() { ..post('/token', server.tokenEndpoint); }); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); if (rec.stackTrace != null) print(rec.stackTrace); }); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var s = await http.startServer(); var url = 'http://${s.address.address}:${s.port}'; authorizationEndpoint = Uri.parse('$url/oauth2/authorize'); diff --git a/packages/oauth2/test/client_credentials_test.dart b/packages/oauth2/test/client_credentials_test.dart index fa80a0ba..72808147 100644 --- a/packages/oauth2/test/client_credentials_test.dart +++ b/packages/oauth2/test/client_credentials_test.dart @@ -10,7 +10,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); var oauth2 = _AuthorizationServer(); app.group('/oauth2', (router) { diff --git a/packages/oauth2/test/device_code_test.dart b/packages/oauth2/test/device_code_test.dart index a255afc2..c08e0555 100644 --- a/packages/oauth2/test/device_code_test.dart +++ b/packages/oauth2/test/device_code_test.dart @@ -11,7 +11,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(reflector: MirrorsReflector()); + var app = Protevus(reflector: MirrorsReflector()); var oauth2 = _AuthorizationServer(); app.group('/oauth2', (router) { diff --git a/packages/oauth2/test/implicit_grant_test.dart b/packages/oauth2/test/implicit_grant_test.dart index 640725b0..4a4ec8ae 100644 --- a/packages/oauth2/test/implicit_grant_test.dart +++ b/packages/oauth2/test/implicit_grant_test.dart @@ -9,7 +9,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); var oauth2 = _AuthorizationServer(); app.group('/oauth2', (router) { diff --git a/packages/oauth2/test/password_test.dart b/packages/oauth2/test/password_test.dart index 09c53d8d..6d192006 100644 --- a/packages/oauth2/test/password_test.dart +++ b/packages/oauth2/test/password_test.dart @@ -9,11 +9,11 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - late Angel app; + late Protevus app; late Uri tokenEndpoint; setUp(() async { - app = Angel(); + app = Protevus(); var auth = _AuthorizationServer(); app.group('/oauth2', (router) { @@ -28,7 +28,7 @@ void main() { app.logger = Logger('password_test')..onRecord.listen(print); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer(); var url = 'http://${server.address.address}:${server.port}'; tokenEndpoint = Uri.parse('$url/oauth2/token'); diff --git a/packages/oauth2/test/pkce_test.dart b/packages/oauth2/test/pkce_test.dart index 11e3905d..104cf4c2 100644 --- a/packages/oauth2/test/pkce_test.dart +++ b/packages/oauth2/test/pkce_test.dart @@ -10,12 +10,12 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - Angel app; + Protevus app; late Uri authorizationEndpoint, tokenEndpoint; late TestClient testClient; setUp(() async { - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); app.container.registerSingleton(AuthCodes()); var server = _Server(); @@ -26,14 +26,14 @@ void main() { ..post('/token', server.tokenEndpoint); }); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen((rec) { print(rec); if (rec.error != null) print(rec.error); if (rec.stackTrace != null) print(rec.stackTrace); }); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var s = await http.startServer(); var url = 'http://${s.address.address}:${s.port}'; authorizationEndpoint = Uri.parse('$url/oauth2/authorize'); diff --git a/packages/orm/README.md b/packages/orm/README.md index 14efdfa6..504c919a 100644 --- a/packages/orm/README.md +++ b/packages/orm/README.md @@ -1,16 +1,16 @@ -# Angel3 ORM +# Protevus 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) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/LICENSE) -Source-generated ORM for use with the [Angel3 framework](https://github.com/dart-backend/angel). Now you can combine the power and flexibility of Angel3 with a strongly-typed ORM. +Source-generated ORM for use with the [Protevus framework](https://github.com/dart-backend/protevus). Now you can combine the power and flexibility of Protevus with a strongly-typed ORM. Documentation for migrations can be found here: [ORM Migration](https://angel3-docs.dukefirehawk.com/guides/orm/migrations) -- [Angel3 ORM](#angel3-orm) +- [Protevus ORM](#angel3-orm) - [Usage](#usage) - [Models](#models) - [Example](#example) @@ -226,7 +226,7 @@ TLDR: 3. A should have a field: `@ManyToMany(_C) List<_B> get b;` 4. B should have a field: `@ManyToMany(_C) List<_A> get a;` -Test: +Test: ## Columns diff --git a/packages/orm/angel_migration/README.md b/packages/orm/angel_migration/README.md index 3ce74bd9..1e508a23 100755 --- a/packages/orm/angel_migration/README.md +++ b/packages/orm/angel_migration/README.md @@ -1,11 +1,11 @@ -# Angel3 Migration +# Protevus Migration ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_migration?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_migration/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_migration/LICENSE) -This package contains the abstract classes for implementing database migration in Angel3 framework. It is designed to work with Angel3 ORM. Please refer to the implementation in the [ORM Migration Runner]() package for more details. +This package contains the abstract classes for implementing database migration in Protevus framework. It is designed to work with Protevus ORM. Please refer to the implementation in the [ORM Migration Runner]() package for more details. ## Supported Features diff --git a/packages/orm/angel_migration/pubspec.yaml b/packages/orm/angel_migration/pubspec.yaml index e60f8692..72b21d1b 100755 --- a/packages/orm/angel_migration/pubspec.yaml +++ b/packages/orm/angel_migration/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_migration version: 8.3.0 -description: The abstract classes for implementing database migration in Angel3 framework. Designed to work with Angel3 ORM. +description: The abstract classes for implementing database migration in Protevus framework. Designed to work with Protevus ORM. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_migration +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_migration environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_migration_runner/CHANGELOG.md b/packages/orm/angel_migration_runner/CHANGELOG.md index 88bf5001..4e899d68 100755 --- a/packages/orm/angel_migration_runner/CHANGELOG.md +++ b/packages/orm/angel_migration_runner/CHANGELOG.md @@ -21,7 +21,7 @@ Fixed `MariaDbMigrationRunner` migration issues * Require Dart >= 3.3 * Updated `lints` to 4.0.0 -* Fixed MySQL migration column change [PR #127](https://github.com/dart-backend/angel/pull/127) +* Fixed MySQL migration column change [PR #127](https://github.com/dart-backend/protevus/pull/127) ## 8.1.1 diff --git a/packages/orm/angel_migration_runner/README.md b/packages/orm/angel_migration_runner/README.md index e910fa8e..fe0ac105 100755 --- a/packages/orm/angel_migration_runner/README.md +++ b/packages/orm/angel_migration_runner/README.md @@ -1,11 +1,11 @@ -# Angel3 Migration Runner +# Protevus Migration Runner ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_migration_runner?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_migration_runner/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_migration_runner/LICENSE) -This package contains the implementation of the database migration for the following databases. It is designed to work with Angel3 ORM. +This package contains the implementation of the database migration for the following databases. It is designed to work with Protevus ORM. * PostgreSQL 10.x or greater * MariaDB 10.2.x or greater diff --git a/packages/orm/angel_migration_runner/lib/src/cli.dart b/packages/orm/angel_migration_runner/lib/src/cli.dart index b3c5abe7..64ef4804 100755 --- a/packages/orm/angel_migration_runner/lib/src/cli.dart +++ b/packages/orm/angel_migration_runner/lib/src/cli.dart @@ -4,7 +4,7 @@ import 'runner.dart'; /// Runs the Angel Migration CLI. Future runMigrations(MigrationRunner migrationRunner, List args) { - var cmd = CommandRunner('migration_runner', 'Executes Angel3 migrations.') + var cmd = CommandRunner('migration_runner', 'Executes Protevus migrations.') ..addCommand(_UpCommand(migrationRunner)) ..addCommand(_RefreshCommand(migrationRunner)) ..addCommand(_ResetCommand(migrationRunner)) diff --git a/packages/orm/angel_migration_runner/pubspec.yaml b/packages/orm/angel_migration_runner/pubspec.yaml index c14b048e..0a232615 100755 --- a/packages/orm/angel_migration_runner/pubspec.yaml +++ b/packages/orm/angel_migration_runner/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_migration_runner version: 8.3.0 -description: The implementation of database migration for Angel3 framework. Designed to work with Angel3 ORM. +description: The implementation of database migration for Protevus framework. Designed to work with Protevus ORM. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_migration_runner +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_migration_runner environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm/CHANGELOG.md b/packages/orm/angel_orm/CHANGELOG.md index a74f89df..bac6fd81 100644 --- a/packages/orm/angel_orm/CHANGELOG.md +++ b/packages/orm/angel_orm/CHANGELOG.md @@ -266,7 +266,7 @@ target all services. ## 1.0.0-alpha+7 * Added a `@belongsToMany` annotation class. -* Resolved [##20](https://github.com/angel-dart/orm/issues/20). The +* Resolved [##20](https://github.com/protevus-dart/orm/issues/20). The `PostgreSQLConnectionPool` keeps track of which connections have been opened now. ## 1.0.0-alpha+6 diff --git a/packages/orm/angel_orm/README.md b/packages/orm/angel_orm/README.md index 83f25b97..707289f1 100644 --- a/packages/orm/angel_orm/README.md +++ b/packages/orm/angel_orm/README.md @@ -1,11 +1,11 @@ -# Angel3 ORM +# Protevus 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) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm/LICENSE) -Runtime support for Angel3 ORM. Includes a clean, database-agnostic query builder and relationship/join support. +Runtime support for Protevus ORM. Includes a clean, database-agnostic query builder and relationship/join support. ## Supported database diff --git a/packages/orm/angel_orm/pubspec.yaml b/packages/orm/angel_orm/pubspec.yaml index d2763bfd..88b1260f 100644 --- a/packages/orm/angel_orm/pubspec.yaml +++ b/packages/orm/angel_orm/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm version: 8.2.0 -description: Runtime support for Angel3 ORM. Includes base classes for queries. +description: Runtime support for Protevus ORM. Includes base classes for queries. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm_generator/CHANGELOG.md b/packages/orm/angel_orm_generator/CHANGELOG.md index b993bafa..064e1521 100644 --- a/packages/orm/angel_orm_generator/CHANGELOG.md +++ b/packages/orm/angel_orm_generator/CHANGELOG.md @@ -161,7 +161,7 @@ * `OrmBuildContext` caching is now local to a `Builder`, so `watch` *should* finally always run when required. Should resolve -[##85](https://github.com/angel-dart/orm/issues/85). +[##85](https://github.com/protevus-dart/orm/issues/85). ## 2.1.0-beta diff --git a/packages/orm/angel_orm_generator/README.md b/packages/orm/angel_orm_generator/README.md index d2c4d701..9d75dc03 100644 --- a/packages/orm/angel_orm_generator/README.md +++ b/packages/orm/angel_orm_generator/README.md @@ -1,11 +1,11 @@ -# Angel3 ORM Generator +# Protevus ORM Generator ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm_generator?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel3_orm_generator/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel3_orm_generator/LICENSE) -Source code generators for Angel3 ORM. This package can generate: +Source code generators for Protevus ORM. This package can generate: * A strongly-typed ORM * SQL migration scripts @@ -14,7 +14,7 @@ For documentation about the ORM, see [Developer Guide](https://angel3-docs.dukef ## Usage -Run the following command to generate the required `.g.dart` files for Angel3 ORM. +Run the following command to generate the required `.g.dart` files for Protevus ORM. ```bash dart run build_runner build diff --git a/packages/orm/angel_orm_generator/lib/src/migration_generator.dart b/packages/orm/angel_orm_generator/lib/src/migration_generator.dart index 48711489..843b0301 100644 --- a/packages/orm/angel_orm_generator/lib/src/migration_generator.dart +++ b/packages/orm/angel_orm_generator/lib/src/migration_generator.dart @@ -111,7 +111,7 @@ class MigrationGenerator extends GeneratorForAnnotation { // } // } - // Fix from: https://github.com/angel-dart/angel/issues/114#issuecomment-505525729 + // Fix from: https://github.com/protevus-dart/protevus/issues/114#issuecomment-505525729 if (!(col.indexType == IndexType.primaryKey || (autoIdAndDateFields != false && name == 'id'))) { // Check for relationships that might duplicate @@ -291,7 +291,7 @@ class MigrationGenerator extends GeneratorForAnnotation { var relationship = r; if (relationship.type == RelationshipType.belongsTo) { - // Fix from https://github.com/angel-dart/angel/issues/116#issuecomment-505546479 + // Fix from https://github.com/protevus-dart/protevus/issues/116#issuecomment-505546479 // var key = relationship.localKey; // var field = table.property('integer').call([literal(key)]); diff --git a/packages/orm/angel_orm_generator/pubspec.yaml b/packages/orm/angel_orm_generator/pubspec.yaml index 88b8cbf0..3c4542e5 100644 --- a/packages/orm/angel_orm_generator/pubspec.yaml +++ b/packages/orm/angel_orm_generator/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm_generator version: 8.3.2 -description: Code generators for Angel3 ORM. Generates query builder classes. +description: Code generators for Protevus ORM. Generates query builder classes. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_generator +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_generator environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm_mysql/README.md b/packages/orm/angel_orm_mysql/README.md index cafd23bf..c631ef6e 100644 --- a/packages/orm/angel_orm_mysql/README.md +++ b/packages/orm/angel_orm_mysql/README.md @@ -1,18 +1,18 @@ -# Angel3 ORM for MySQL +# Protevus ORM for MySQL ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm_mysql?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_mysql/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_mysql/LICENSE) -This package contains the SQL executor required by Angel3 ORM to work with MySQL or MariaDB. In order to better support both MySQL and MariaDB, two different flavors of drives have been included; `mysql_client` and `mysql1`. They are implmented as `MySqlExecutor` and `MariaDbExecutor` respectively. +This package contains the SQL executor required by Protevus ORM to work with MySQL or MariaDB. In order to better support both MySQL and MariaDB, two different flavors of drives have been included; `mysql_client` and `mysql1`. They are implmented as `MySqlExecutor` and `MariaDbExecutor` respectively. ## Supported databases * MariaDD 10.2.x or greater * MySQL 8.x or greater -**Note** MySQL below version 8.0 and MariaDB below version 10.2.0 are not supported as Angel3 ORM requires common table expressions (CTE) to work. +**Note** MySQL below version 8.0 and MariaDB below version 10.2.0 are not supported as Protevus ORM requires common table expressions (CTE) to work. ## MySqlExecutor diff --git a/packages/orm/angel_orm_mysql/pubspec.yaml b/packages/orm/angel_orm_mysql/pubspec.yaml index 304d8141..2ff72667 100644 --- a/packages/orm/angel_orm_mysql/pubspec.yaml +++ b/packages/orm/angel_orm_mysql/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm_mysql version: 8.2.0 -description: MySQL support for Angel3 ORM. Includes functionality for querying and transactions. +description: MySQL support for Protevus ORM. Includes functionality for querying and transactions. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_mysql +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_mysql environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm_postgres/README.md b/packages/orm/angel_orm_postgres/README.md index d78c9d9c..d8cf7d46 100644 --- a/packages/orm/angel_orm_postgres/README.md +++ b/packages/orm/angel_orm_postgres/README.md @@ -1,11 +1,11 @@ -# Angel3 ORM for PostgreSQL +# Protevus ORM for PostgreSQL ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm_postgres?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_postgres/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_postgres/LICENSE) -PostgreSQL support for Angel3 ORM. +PostgreSQL support for Protevus ORM. ## Supported database diff --git a/packages/orm/angel_orm_postgres/pubspec.yaml b/packages/orm/angel_orm_postgres/pubspec.yaml index 98b8cfde..c9c16b19 100644 --- a/packages/orm/angel_orm_postgres/pubspec.yaml +++ b/packages/orm/angel_orm_postgres/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm_postgres version: 8.2.2 -description: PostgreSQL support for Angel3 ORM. Includes functionality for querying and transactions. +description: PostgreSQL support for Protevus ORM. Includes functionality for querying and transactions. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_postgres +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_postgres environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm_service/README.md b/packages/orm/angel_orm_service/README.md index 81fbcff8..d2741132 100644 --- a/packages/orm/angel_orm_service/README.md +++ b/packages/orm/angel_orm_service/README.md @@ -1,11 +1,11 @@ -# Angel3 ORM Service +# Protevus ORM Service ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm_service?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_service/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_service/LICENSE) -Service implementation that wraps over Angel3 ORM Query classes. +Service implementation that wraps over Protevus ORM Query classes. ## Installation diff --git a/packages/orm/angel_orm_service/example/main.dart b/packages/orm/angel_orm_service/example/main.dart index 548007b0..3d8dfa5d 100644 --- a/packages/orm/angel_orm_service/example/main.dart +++ b/packages/orm/angel_orm_service/example/main.dart @@ -8,8 +8,8 @@ import 'todo.dart'; void main() async { // Logging, connection setup. hierarchicalLoggingEnabled = true; - var app = Angel(logger: Logger.detached('orm_service')); - var http = AngelHttp(app); + var app = Protevus(logger: Logger.detached('orm_service')); + var http = ProtevusHttp(app); var executor = await connect(); app.logger.onRecord.listen((rec) { print(rec); diff --git a/packages/orm/angel_orm_service/lib/angel3_orm_service.dart b/packages/orm/angel_orm_service/lib/angel3_orm_service.dart index 18c79cfc..7dfc6a4f 100644 --- a/packages/orm/angel_orm_service/lib/angel3_orm_service.dart +++ b/packages/orm/angel_orm_service/lib/angel3_orm_service.dart @@ -122,7 +122,7 @@ class OrmService> await _applyQuery(query, params); var result = await query.getOne(executor); if (result.isPresent) return result.value; - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound(message: 'No record found for ID $id'); } @override @@ -134,7 +134,7 @@ class OrmService> await _applyQuery(query, params); var result = await query.getOne(executor); if (result.isPresent) return result.value; - throw AngelHttpException.notFound(message: errorMessage); + throw ProtevusHttpException.notFound(message: errorMessage); } @override @@ -173,7 +173,7 @@ class OrmService> var result = await query.updateOne(executor); if (result.isPresent) return result.value; - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound(message: 'No record found for ID $id'); } @override @@ -184,7 +184,7 @@ class OrmService> // Remove everything... if (!(allowRemoveAll == true || params?.containsKey('provider') != true)) { - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'Clients are not allowed to delete all items.'); } } else { @@ -194,6 +194,6 @@ class OrmService> var result = await query.deleteOne(executor); if (result.isPresent) return result.value; - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound(message: 'No record found for ID $id'); } } diff --git a/packages/orm/angel_orm_service/pubspec.yaml b/packages/orm/angel_orm_service/pubspec.yaml index 88e5a313..0a44d283 100644 --- a/packages/orm/angel_orm_service/pubspec.yaml +++ b/packages/orm/angel_orm_service/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm_service version: 8.2.2 -description: Service implementation that wraps over Angel3 ORM Query classes. +description: Service implementation that wraps over Protevus ORM Query classes. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_service +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_service environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/orm/angel_orm_service/test/all_test.dart b/packages/orm/angel_orm_service/test/all_test.dart index 833d35f2..9d916f2e 100644 --- a/packages/orm/angel_orm_service/test/all_test.dart +++ b/packages/orm/angel_orm_service/test/all_test.dart @@ -169,7 +169,7 @@ void main() { () => pokemonService.findOne({ 'query': {PokemonFields.level: pikachu.level! * 3} }), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); test('nonexistent throws 404', () { @@ -177,7 +177,7 @@ void main() { () => pokemonService.findOne({ 'query': {PokemonFields.type1: PokemonType.poison} }), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); }); @@ -189,7 +189,7 @@ void main() { test('nonexistent throws 404', () { expect(() => pokemonService.read(999), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); }); @@ -213,7 +213,7 @@ void main() { test('nonexistent throws 404', () { expect( () => pokemonService.update(999, giratina.copyWith(name: 'Hello')), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); }); @@ -225,12 +225,12 @@ void main() { test('nonexistent throws 404', () { expect(() => pokemonService.remove(999), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); test('cannot remove all unless explicitly set', () async { expect(() => pokemonService.remove(null, {'provider': Providers.rest}), - throwsA(TypeMatcher())); + throwsA(TypeMatcher())); }); }); }); diff --git a/packages/orm/angel_orm_test/README.md b/packages/orm/angel_orm_test/README.md index 176a740a..153a34b6 100644 --- a/packages/orm/angel_orm_test/README.md +++ b/packages/orm/angel_orm_test/README.md @@ -1,11 +1,11 @@ -# Angel3 ORM Test +# Protevus ORM Test ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_orm_test?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_test/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_test/LICENSE) -Common test cases for Angel3 ORM. Reference implmentation of generated ORM files. +Common test cases for Protevus ORM. Reference implmentation of generated ORM files. ## Supported databases diff --git a/packages/orm/angel_orm_test/lib/src/enum_test.dart b/packages/orm/angel_orm_test/lib/src/enum_test.dart index c70c8356..2e4ec452 100644 --- a/packages/orm/angel_orm_test/lib/src/enum_test.dart +++ b/packages/orm/angel_orm_test/lib/src/enum_test.dart @@ -2,7 +2,7 @@ import 'package:angel3_orm_test/src/models/has_car.dart'; import 'package:test/test.dart'; void main() async { - /// See https://github.com/dart-backend/angel/pull/98 + /// See https://github.com/dart-backend/protevus/pull/98 test('enum field with custom deserializer should be parsed consistently', () { final query = HasCarQuery(); final hasCar = query.parseRow([null, null, null, 'R', null]).value; diff --git a/packages/orm/angel_orm_test/lib/src/models/email_indexed.dart b/packages/orm/angel_orm_test/lib/src/models/email_indexed.dart index 928bb7f4..b30a3e06 100644 --- a/packages/orm/angel_orm_test/lib/src/models/email_indexed.dart +++ b/packages/orm/angel_orm_test/lib/src/models/email_indexed.dart @@ -5,7 +5,7 @@ import 'package:optional/optional.dart'; part 'email_indexed.g.dart'; -// * https://github.com/angel-dart/angel/issues/116 +// * https://github.com/protevus-dart/protevus/issues/116 @serializable @orm diff --git a/packages/orm/angel_orm_test/pubspec.yaml b/packages/orm/angel_orm_test/pubspec.yaml index 57f3c80f..9569724b 100644 --- a/packages/orm/angel_orm_test/pubspec.yaml +++ b/packages/orm/angel_orm_test/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_orm_test version: 8.2.1 -description: Common tests for Angel3 ORM. Reference implmentation of the generated ORM files. +description: Common tests for Protevus ORM. Reference implmentation of the generated ORM files. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/orm/angel_orm_test +repository: https://github.com/dart-backend/protevus/tree/master/packages/orm/angel_orm_test environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/paginate/README.md b/packages/paginate/README.md index 46d9c5bf..a5e0f1e6 100644 --- a/packages/paginate/README.md +++ b/packages/paginate/README.md @@ -1,11 +1,11 @@ -# Angel3 Paginate +# Protevus Paginate ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_paginate?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/paginate/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/paginate/LICENSE) -Platform-agnostic pagination library, with custom support for the [Angel3](https://angel3-framework.web.app/). +Platform-agnostic pagination library, with custom support for the [Protevus](https://angel3-framework.web.app/). ## Installation diff --git a/packages/paginate/pubspec.yaml b/packages/paginate/pubspec.yaml index 6e466161..ad15615f 100644 --- a/packages/paginate/pubspec.yaml +++ b/packages/paginate/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_paginate version: 8.2.0 -description: Platform-agnostic pagination library, with custom support for the Angel3 framework. +description: Platform-agnostic pagination library, with custom support for the Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/paginate +repository: https://github.com/dart-backend/protevus/tree/master/packages/paginate environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/paginate/test/bounds_test.dart b/packages/paginate/test/bounds_test.dart index 69a060e1..c2826808 100644 --- a/packages/paginate/test/bounds_test.dart +++ b/packages/paginate/test/bounds_test.dart @@ -15,7 +15,7 @@ void main() { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); app.get('/api/songs', (req, res) { var p = Paginator(mjAlbums, itemsPerPage: mjAlbums.length); diff --git a/packages/production/README.md b/packages/production/README.md index 95fed6ab..6f2f2f96 100644 --- a/packages/production/README.md +++ b/packages/production/README.md @@ -1,15 +1,15 @@ -# Angel3 Production Runner +# Protevus Production Runner ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_production?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/angel/tree/master/packages/production/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/master/packages/production/LICENSE) -Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Angel3 framework. +Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Protevus framework. ![Screenshot](angel3-screenshot.png) -This will become the de-facto way to run Angel3 applications in deployed environments, as it takes care of inter-isolate communication, respawning dead processes, and other housekeeping for you automatically. Most users will want to use the `Runner` class. +This will become the de-facto way to run Protevus applications in deployed environments, as it takes care of inter-isolate communication, respawning dead processes, and other housekeeping for you automatically. Most users will want to use the `Runner` class. ## `Runner` @@ -38,7 +38,7 @@ Future configureServer(Angel app) async { `Runner` will automatically re-spawn crashed instances, unless `--no-respawn` is passed. This can prevent your server from entirely going down at the first error, and adds a layer of fault tolerance to your infrastructure. -When combined with `systemd`, deploying Angel3 applications on Linux can be very simple. +When combined with `systemd`, deploying Protevus applications on Linux can be very simple. ## Message Passing diff --git a/packages/production/example/main.dart b/packages/production/example/main.dart index 33e9979b..e95152ca 100644 --- a/packages/production/example/main.dart +++ b/packages/production/example/main.dart @@ -8,7 +8,7 @@ void main(List args) { Runner('example', configureServer).run(args); } -Future configureServer(Angel app) async { +Future configureServer(Protevus app) async { // Use the injected `pub_sub.Client` to send messages. var client = app.container.make(); diff --git a/packages/production/lib/src/runner.dart b/packages/production/lib/src/runner.dart index 7a7c4037..8fe7624d 100644 --- a/packages/production/lib/src/runner.dart +++ b/packages/production/lib/src/runner.dart @@ -21,7 +21,7 @@ import 'options.dart'; /// all running instances. class Runner { final String name; - final AngelConfigurer configureServer; + final ProtevusConfigurer configureServer; final Reflector reflector; final Map removeResponseHeaders; @@ -59,7 +59,7 @@ class Runner { if (record.error != null) { var err = record.error; - if (err is AngelHttpException && err.statusCode != 500) return; + if (err is ProtevusHttpException && err.statusCode != 500) return; //print(code.wrap(record.message + '\n')); print(code.wrap( '$now ${record.level.name} [${record.loggerName}]: ${record.message} \n')); @@ -231,7 +231,7 @@ class Runner { zone.run(() async { var client = IsolateClient('client${argsWithId.id}', args.pubSubSendPort); - var app = Angel(reflector: args.reflector) + var app = Protevus(reflector: args.reflector) ..container.registerSingleton(client) ..container.registerSingleton(InstanceInfo(id: argsWithId.id)); @@ -242,7 +242,7 @@ class Runner { app.logger = Logger(args.loggerName) ..onRecord.listen((rec) => Runner.handleLogRecord(rec, args.options)); - AngelHttp http; + ProtevusHttp http; late SecurityContext securityContext; Uri serverUrl; @@ -262,18 +262,18 @@ class Runner { } if (args.options.ssl) { - http = AngelHttp.custom(app, startSharedSecure(securityContext), + http = ProtevusHttp.custom(app, startSharedSecure(securityContext), useZone: args.options.useZone); } else { - http = - AngelHttp.custom(app, startShared, useZone: args.options.useZone); + http = ProtevusHttp.custom(app, startShared, + useZone: args.options.useZone); } Driver driver; if (args.options.http2) { securityContext.setAlpnProtocols(['h2'], true); - var http2 = AngelHttp2.custom(app, securityContext, startSharedHttp2, + var http2 = ProtevusHttp2.custom(app, securityContext, startSharedHttp2, useZone: args.options.useZone); http2.onHttp1.listen(http.handleRequest); driver = http2; @@ -284,7 +284,7 @@ class Runner { await driver.startServer(args.options.hostname, args.options.port); // Only apply the headers to AngelHttp instance - if (driver is AngelHttp) { + if (driver is ProtevusHttp) { driver.addResponseHeader(args.options.responseHeaders); driver.removeResponseHeader(args.options.removeResponseHeaders); } @@ -308,7 +308,7 @@ class RunnerArgsWithId { class RunnerArgs { final String name; - final AngelConfigurer configureServer; + final ProtevusConfigurer configureServer; final RunnerOptions options; diff --git a/packages/production/pubspec.yaml b/packages/production/pubspec.yaml index 3d95abc2..03339780 100644 --- a/packages/production/pubspec.yaml +++ b/packages/production/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_production version: 8.3.0 -description: Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Angel3. +description: Helpers for concurrency, message-passing, rotating loggers, and other production functionality in Protevus. homepage: https://angel3-framework.web.app -repository: https://github.com/dart-backend/angel/tree/master/packages/production +repository: https://github.com/dart-backend/protevus/tree/master/packages/production environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/proxy/README.md b/packages/proxy/README.md index 276a5f1a..17944bb1 100644 --- a/packages/proxy/README.md +++ b/packages/proxy/README.md @@ -1,11 +1,11 @@ -# Angel3 Proxy +# Protevus Proxy ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_proxy?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/proxy/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/proxy/LICENSE) -Angel3 middleware to forward requests to another server (i.e. `webdev serve`). Also supports WebSockets. +Protevus middleware to forward requests to another server (i.e. `webdev serve`). Also supports WebSockets. ```dart import 'package:angel3_proxy/angel3_proxy.dart'; diff --git a/packages/proxy/example/main.dart b/packages/proxy/example/main.dart index 3bb360bf..96dcf97a 100644 --- a/packages/proxy/example/main.dart +++ b/packages/proxy/example/main.dart @@ -7,7 +7,7 @@ import 'package:logging/logging.dart'; final Duration timeout = Duration(seconds: 5); void main() async { - var app = Angel(); + var app = Protevus(); // Forward any /api requests to pub. // By default, if the host throws a 404, the request will fall through to the next handler. @@ -46,7 +46,7 @@ void main() async { app.fallback( (req, res) => res.write('Couldn\'t connect to Pub or dartlang.')); - app.logger = Logger('angel') + app.logger = Logger('protevus') ..onRecord.listen( (rec) { print(rec); @@ -56,7 +56,7 @@ void main() async { ); var server = - await AngelHttp(app).startServer(InternetAddress.loopbackIPv4, 8080); + await ProtevusHttp(app).startServer(InternetAddress.loopbackIPv4, 8080); print('Listening at http://${server.address.address}:${server.port}'); print( 'Check this out! http://${server.address.address}:${server.port}/pub/packages/angel_framework'); diff --git a/packages/proxy/lib/src/proxy_layer.dart b/packages/proxy/lib/src/proxy_layer.dart index 360d1e1f..61559677 100644 --- a/packages/proxy/lib/src/proxy_layer.dart +++ b/packages/proxy/lib/src/proxy_layer.dart @@ -117,7 +117,7 @@ class Proxy { scheduleMicrotask(() => remote.pipe(local)); return false; } catch (e, st) { - throw AngelHttpException( + throw ProtevusHttpException( message: 'Could not connect WebSocket', stackTrace: st); } } @@ -167,14 +167,14 @@ class Proxy { } on TimeoutException catch (e, st) { if (recoverFromDead) return true; - throw AngelHttpException( + throw ProtevusHttpException( stackTrace: st, statusCode: 504, message: 'Connection to remote host "$uri" timed out after ${timeout!.inMilliseconds}ms.', ); } catch (e) { - if (recoverFromDead && e is! AngelHttpException) return true; + if (recoverFromDead && e is! ProtevusHttpException) return true; rethrow; } @@ -188,7 +188,7 @@ class Proxy { } on FormatException catch (e, st) { if (recoverFromDead) return true; - throw AngelHttpException( + throw ProtevusHttpException( stackTrace: st, statusCode: 504, message: 'Host "$uri" returned a malformed content-type', diff --git a/packages/proxy/pubspec.yaml b/packages/proxy/pubspec.yaml index 57e7c0c3..4f121bee 100644 --- a/packages/proxy/pubspec.yaml +++ b/packages/proxy/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_proxy version: 8.2.0 description: Angel middleware to forward requests to another server (i.e. pub serve). homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/proxy +repository: https://github.com/dart-backend/protevus/tree/master/packages/proxy environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/proxy/test/basic_test.dart b/packages/proxy/test/basic_test.dart index 4fe66449..b96d04f0 100644 --- a/packages/proxy/test/basic_test.dart +++ b/packages/proxy/test/basic_test.dart @@ -9,15 +9,15 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - late Angel app; + late Protevus app; var client = http.IOClient(); //late HttpServer server; late HttpServer testServer; String? url; setUp(() async { - app = Angel(); - var appHttp = AngelHttp(app); + app = Protevus(); + var appHttp = ProtevusHttp(app); testServer = await startTestServer(); @@ -41,7 +41,7 @@ void main() { res.write('intercept empty'); }); - app.logger = Logger('angel'); + app.logger = Logger('protevus'); Logger.root.onRecord.listen((rec) { print(rec); diff --git a/packages/proxy/test/common.dart b/packages/proxy/test/common.dart index 44b01432..41c7a123 100644 --- a/packages/proxy/test/common.dart +++ b/packages/proxy/test/common.dart @@ -6,7 +6,7 @@ import 'package:angel3_framework/http.dart'; import 'package:logging/logging.dart'; Future startTestServer() { - final app = Angel(); + final app = Protevus(); app.get('/hello', (req, res) => res.write('world')); app.get('/foo/bar', (req, res) => res.write('baz')); @@ -17,7 +17,7 @@ Future startTestServer() { }); app.logger = Logger('testApp'); - var server = AngelHttp(app); + var server = ProtevusHttp(app); app.dumpTree(); return server.startServer(); diff --git a/packages/proxy/test/pub_serve_test.dart b/packages/proxy/test/pub_serve_test.dart index c1b01880..cc7ecef7 100644 --- a/packages/proxy/test/pub_serve_test.dart +++ b/packages/proxy/test/pub_serve_test.dart @@ -9,12 +9,12 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; void main() { - Angel? app, testApp; + Protevus? app, testApp; late TestClient client; late Proxy layer; setUp(() async { - testApp = Angel(); + testApp = Protevus(); testApp!.get('/foo', (req, res) async { res.useBuffer(); res.write('pub serve'); @@ -27,9 +27,9 @@ void main() { testApp!.encoders.addAll({'gzip': gzip.encoder}); - var server = await AngelHttp(testApp!).startServer(); + var server = await ProtevusHttp(testApp!).startServer(); - app = Angel(); + app = Protevus(); app!.fallback((req, res) { res.useBuffer(); return true; diff --git a/packages/redis/README.md b/packages/redis/README.md index 2bb5d0ce..3e984ada 100644 --- a/packages/redis/README.md +++ b/packages/redis/README.md @@ -1,17 +1,17 @@ -# Angel3 Redis +# Protevus Redis ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_redis?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/redis/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/redis/LICENSE) **Forked from `angel_redis` to support NNBD** -Redis-enabled services for the Angel3 framework. `RedisService` can be used alone, *or* as the backend of a [`CacheService`](https://pub.dev/packages/angel3_cache), and thereby cache the results of calling an upstream database. +Redis-enabled services for the Protevus framework. `RedisService` can be used alone, *or* as the backend of a [`CacheService`](https://pub.dev/packages/angel3_cache), and thereby cache the results of calling an upstream database. ## Installation -`package:angel3_redis` requires Angel3. +`package:angel3_redis` requires Protevus. In your `pubspec.yaml`: diff --git a/packages/redis/lib/src/redis_service.dart b/packages/redis/lib/src/redis_service.dart index 10a4b87b..3d217ee5 100644 --- a/packages/redis/lib/src/redis_service.dart +++ b/packages/redis/lib/src/redis_service.dart @@ -46,7 +46,8 @@ class RedisService extends Service> { var value = await respCommands.get(_applyPrefix(id)!); if (value == null) { - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound( + message: 'No record found for ID $id'); } else { return json.decode(value) as Map; } @@ -96,7 +97,8 @@ class RedisService extends Service> { var str = result.payload[0] as RespBulkString; if (str.payload == null) { - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound( + message: 'No record found for ID $id'); } else { return json.decode(str.payload!) as Map; } diff --git a/packages/redis/pubspec.yaml b/packages/redis/pubspec.yaml index a4050316..db64deca 100644 --- a/packages/redis/pubspec.yaml +++ b/packages/redis/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_redis version: 8.2.0 -description: An Angel3 service provider for Redis. Works well for caching volatile data. +description: An Protevus service provider for Redis. Works well for caching volatile data. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/redis +repository: https://github.com/dart-backend/protevus/tree/master/packages/redis environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/redis/test/all_test.dart b/packages/redis/test/all_test.dart index 34ca1ed0..3cd38257 100644 --- a/packages/redis/test/all_test.dart +++ b/packages/redis/test/all_test.dart @@ -74,6 +74,6 @@ void main() async { test('remove nonexistent', () async { expect(() => service.remove('definitely_does_not_exist'), - throwsA(const TypeMatcher())); + throwsA(const TypeMatcher())); }); } diff --git a/packages/rethinkdb/README.md b/packages/rethinkdb/README.md index 9f31167c..cef8645a 100644 --- a/packages/rethinkdb/README.md +++ b/packages/rethinkdb/README.md @@ -1,11 +1,11 @@ -# Angel3 RethinkDB +# Protevus RethinkDB ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_rethinkdb?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/mongo/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/mongo/LICENSE) -This is RethinkDB service for Angel3 framework. RethinkDB is an open-source database for the realtime web. +This is RethinkDB service for Protevus framework. RethinkDB is an open-source database for the realtime web. ## Installation diff --git a/packages/rethinkdb/example/example.dart b/packages/rethinkdb/example/example.dart index d43d100c..254bf0a8 100644 --- a/packages/rethinkdb/example/example.dart +++ b/packages/rethinkdb/example/example.dart @@ -12,12 +12,12 @@ void main() async { user: "admin", password: ""); - Angel app = Angel(); + Protevus app = Protevus(); app.use('/todos', RethinkService(conn, r.table('todos'))); app.errorHandler = (e, req, res) async { print('Whoops: $e'); }; - app.logger = Logger.detached('angel')..onRecord.listen(print); + app.logger = Logger.detached('protevus')..onRecord.listen(print); } diff --git a/packages/rethinkdb/lib/src/rethink_service.dart b/packages/rethinkdb/lib/src/rethink_service.dart index a200cb21..fe106f0a 100644 --- a/packages/rethinkdb/lib/src/rethink_service.dart +++ b/packages/rethinkdb/lib/src/rethink_service.dart @@ -177,7 +177,8 @@ class RethinkService extends Service> { //print('Found for $id: $found'); if (found == null) { - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound( + message: 'No record found for ID $id'); } else { return found; } @@ -185,7 +186,7 @@ class RethinkService extends Service> { @override Future> create(Map data, [Map? params]) async { - if (table is! Table) throw AngelHttpException.methodNotAllowed(); + if (table is! Table) throw ProtevusHttpException.methodNotAllowed(); var d = _serialize(data); var q = table as Table; @@ -201,7 +202,7 @@ class RethinkService extends Service> { if (d is Map && d.containsKey('id')) { try { await read(d['id'], params); - } on AngelHttpException catch (e) { + } on ProtevusHttpException catch (e) { if (e.statusCode == 404) { return await create(data, params); } else { @@ -223,7 +224,7 @@ class RethinkService extends Service> { if (d is Map && d.containsKey('id')) { try { await read(d['id'], params); - } on AngelHttpException catch (e) { + } on ProtevusHttpException catch (e) { if (e.statusCode == 404) { return await create(data, params); } else { diff --git a/packages/rethinkdb/pubspec.yaml b/packages/rethinkdb/pubspec.yaml index 24d5af56..a0c54105 100644 --- a/packages/rethinkdb/pubspec.yaml +++ b/packages/rethinkdb/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_rethinkdb version: 8.0.1 -description: This is RethinkDB service for Angel3 framework. RethinkDB is an open-source database for the realtime web. +description: This is RethinkDB service for Protevus framework. RethinkDB is an open-source database for the realtime web. environment: sdk: ">=3.3.0 <4.0.0" homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/rethinkdb +repository: https://github.com/dart-backend/protevus/tree/master/packages/rethinkdb dependencies: angel3_framework: ^8.4.0 angel3_container: ^8.2.0 diff --git a/packages/rethinkdb/test/generic_test.dart b/packages/rethinkdb/test/generic_test.dart index a2beaa1d..dea672e9 100644 --- a/packages/rethinkdb/test/generic_test.dart +++ b/packages/rethinkdb/test/generic_test.dart @@ -9,7 +9,7 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - Angel app; + Protevus app; late TestClient client; RethinkDb r; late c.Service todoService; @@ -23,14 +23,14 @@ void main() { user: "admin", password: ""); - app = Angel(reflector: MirrorsReflector()); + app = Protevus(reflector: MirrorsReflector()); app.use('/todos', RethinkService(conn, r.table('todos'))); app.errorHandler = (e, req, res) async { print('Whoops: $e'); }; - app.logger = Logger.detached('angel')..onRecord.listen(print); + app.logger = Logger.detached('protevus')..onRecord.listen(print); client = await connectTo(app); todoService = client.service('todos'); diff --git a/packages/security/README.md b/packages/security/README.md index 362f642f..42216c0f 100644 --- a/packages/security/README.md +++ b/packages/security/README.md @@ -1,10 +1,10 @@ -# Angel3 Security +# Protevus Security ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_security?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/security/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/security/LICENSE) -Angel3 middleware designed to enhance application security by patching common Web security holes. +Protevus middleware designed to enhance application security by patching common Web security holes. **This package will undergo a major refactoring.** diff --git a/packages/security/example/cookie_signer.dart b/packages/security/example/cookie_signer.dart index e83e127f..dadf5169 100644 --- a/packages/security/example/cookie_signer.dart +++ b/packages/security/example/cookie_signer.dart @@ -11,8 +11,8 @@ void main() async { Logger.root.onRecord.listen(prettyLog); // Create an app, and HTTP driver. - var app = Angel(logger: Logger('cookie_signer')); - var http = AngelHttp(app); + var app = Protevus(logger: Logger('cookie_signer')); + var http = ProtevusHttp(app); // Create a cookie signer. Uses an SHA256 Hmac by default. var signer = CookieSigner.fromStringKey( @@ -48,7 +48,7 @@ void main() async { }); // 404 otherwise. - app.fallback((req, res) => throw AngelHttpException.notFound( + app.fallback((req, res) => throw ProtevusHttpException.notFound( message: 'The only valid endpoints are /getid and /cookies.')); // Start the server. diff --git a/packages/security/example/main.dart b/packages/security/example/main.dart index 2b863a99..686b3a44 100644 --- a/packages/security/example/main.dart +++ b/packages/security/example/main.dart @@ -9,8 +9,8 @@ void main() async { Logger.root.onRecord.listen(prettyLog); // Create an app, and HTTP driver. - var app = Angel(logger: Logger('rate_limit')); - var http = AngelHttp(app); + var app = Protevus(logger: Logger('rate_limit')); + var http = ProtevusHttp(app); // Create a simple in-memory rate limiter that limits users to 5 // queries per 30 seconds. @@ -27,7 +27,7 @@ void main() async { // Basic routes. app ..get('/', (req, res) => 'Hello!') - ..fallback((req, res) => throw AngelHttpException.notFound()); + ..fallback((req, res) => throw ProtevusHttpException.notFound()); // Start the server. await http.startServer('127.0.0.1', 3000); diff --git a/packages/security/example/rate_limit_redis.dart b/packages/security/example/rate_limit_redis.dart index 1b57ba57..5934b532 100644 --- a/packages/security/example/rate_limit_redis.dart +++ b/packages/security/example/rate_limit_redis.dart @@ -11,7 +11,7 @@ import 'package:resp_client/resp_server.dart'; void main(List args) => Runner('rate_limit_redis', configureServer).run(args); -void configureServer(Angel app) async { +void configureServer(Protevus app) async { // Create a simple rate limiter that limits users to 10 // queries per 30 seconds. // @@ -36,5 +36,5 @@ void configureServer(Angel app) async { var instance = req.container!.make(); res.writeln('This is instance ${instance.id}.'); }) - ..fallback((req, res) => throw AngelHttpException.notFound()); + ..fallback((req, res) => throw ProtevusHttpException.notFound()); } diff --git a/packages/security/lib/src/rate_limiter.dart b/packages/security/lib/src/rate_limiter.dart index f141d25a..cd98edec 100644 --- a/packages/security/lib/src/rate_limiter.dart +++ b/packages/security/lib/src/rate_limiter.dart @@ -75,7 +75,7 @@ abstract class RateLimiter { /// Signals to a user that they have exceeded the rate limit for the /// current window, and terminates execution of the current [RequestContext]. /// - /// The default implementation is throw an [AngelHttpException] with + /// The default implementation is throw an [ProtevusHttpException] with /// status code `429` and the given `errorMessage`, as well as sending /// a [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) /// header, and then returning `false`. @@ -85,7 +85,7 @@ abstract class RateLimiter { RateLimitingWindow window, DateTime currentTime) { var retryAfter = window.resetTime!.difference(currentTime); res.headers['retry-after'] = retryAfter.inSeconds.toString(); - throw AngelHttpException(message: errorMessage, statusCode: 429); + throw ProtevusHttpException(message: errorMessage, statusCode: 429); } /// A request middleware that returns `true` if the user has not yet diff --git a/packages/security/lib/src/service_rate_limiter.dart b/packages/security/lib/src/service_rate_limiter.dart index ee259059..e287db32 100644 --- a/packages/security/lib/src/service_rate_limiter.dart +++ b/packages/security/lib/src/service_rate_limiter.dart @@ -24,7 +24,7 @@ class ServiceRateLimiter extends RateLimiter { var data = await service.read(id); return RateLimitingWindow.fromJson(data); } catch (e) { - if (e is AngelHttpException) { + if (e is ProtevusHttpException) { if (e.statusCode == 404) { } else { rethrow; diff --git a/packages/security/pubspec.yaml b/packages/security/pubspec.yaml index 873ddd79..979295b5 100644 --- a/packages/security/pubspec.yaml +++ b/packages/security/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_security version: 8.2.0 -description: Angel3 infrastructure for improving security, rate limiting, and more +description: Protevus infrastructure for improving security, rate limiting, and more homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/security +repository: https://github.com/dart-backend/protevus/tree/master/packages/security environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/sembast/README.md b/packages/sembast/README.md index 34f4745a..160cf357 100644 --- a/packages/sembast/README.md +++ b/packages/sembast/README.md @@ -1,11 +1,11 @@ -# Sembast Persistent Service for Angel3 +# Sembast Persistent Service for Protevus ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_sembast?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/sembast/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/sembast/LICENSE) -A plugin service that persist data to Sembast for Angel3 framework. +A plugin service that persist data to Sembast for Protevus framework. ## Installation diff --git a/packages/sembast/example/main.dart b/packages/sembast/example/main.dart index a00a8061..8d1f6269 100644 --- a/packages/sembast/example/main.dart +++ b/packages/sembast/example/main.dart @@ -5,7 +5,7 @@ import 'package:logging/logging.dart'; import 'package:sembast/sembast_io.dart'; void main() async { - var app = Angel(); + var app = Protevus(); var db = await databaseFactoryIo.openDatabase('todos.db'); app @@ -13,7 +13,7 @@ void main() async { ..use('/api/todos', SembastService(db, store: 'todos')) ..shutdownHooks.add((_) => db.close()); - var http = AngelHttp(app); + var http = ProtevusHttp(app); var server = await http.startServer('127.0.0.1', 3000); var uri = Uri(scheme: 'http', host: server.address.address, port: server.port); diff --git a/packages/sembast/lib/angel3_sembast.dart b/packages/sembast/lib/angel3_sembast.dart index fddc464a..d2f9a81a 100644 --- a/packages/sembast/lib/angel3_sembast.dart +++ b/packages/sembast/lib/angel3_sembast.dart @@ -104,7 +104,8 @@ class SembastService extends Service> { var record = await store.record(int.parse(id)).getSnapshot(database); if (record == null) { - throw AngelHttpException.notFound(message: 'No record found for ID $id'); + throw ProtevusHttpException.notFound( + message: 'No record found for ID $id'); } return _withId(record.value, id); @@ -147,7 +148,7 @@ class SembastService extends Service> { // Remove everything... if (!(allowRemoveAll == true || params?.containsKey('provider') != true)) { - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'Clients are not allowed to delete all items.'); } else { await store.delete(database); @@ -160,7 +161,7 @@ class SembastService extends Service> { var snapshot = await record.getSnapshot(txn); if (snapshot == null) { - throw AngelHttpException.notFound( + throw ProtevusHttpException.notFound( message: 'No record found for ID $id'); } else { await record.delete(txn); diff --git a/packages/sembast/pubspec.yaml b/packages/sembast/pubspec.yaml index 9fc91319..14951a24 100644 --- a/packages/sembast/pubspec.yaml +++ b/packages/sembast/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_sembast version: 8.2.0 -description: A plugin service that persist data to Sembast for Angel3 framework. +description: A plugin service that persist data to Sembast for Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/sembast +repository: https://github.com/dart-backend/protevus/tree/master/packages/sembast environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/sembast/test/all_test.dart b/packages/sembast/test/all_test.dart index 49131b7a..9dbdc473 100644 --- a/packages/sembast/test/all_test.dart +++ b/packages/sembast/test/all_test.dart @@ -78,18 +78,18 @@ void main() async { test('cannot remove all unless explicitly set', () async { expect(() => service.remove(null, {'provider': Providers.rest}), - throwsA(const TypeMatcher())); + throwsA(const TypeMatcher())); expect( () => service.remove(null, {'provider': Providers.rest}), throwsA(predicate( - (dynamic x) => x is AngelHttpException && x.statusCode == 403, + (dynamic x) => x is ProtevusHttpException && x.statusCode == 403, 'throws forbidden'))); expect(() => service.remove('null', {'provider': Providers.rest}), - throwsA(const TypeMatcher())); + throwsA(const TypeMatcher())); expect( () => service.remove('null', {'provider': Providers.rest}), throwsA(predicate( - (dynamic x) => x is AngelHttpException && x.statusCode == 403, + (dynamic x) => x is ProtevusHttpException && x.statusCode == 403, 'throws forbidden'))); }); @@ -109,6 +109,6 @@ void main() async { test('remove nonexistent', () async { expect(() => service.remove('440'), - throwsA(const TypeMatcher())); + throwsA(const TypeMatcher())); }); } diff --git a/packages/seo/README.md b/packages/seo/README.md index 39e4dfcf..0c8a4a16 100644 --- a/packages/seo/README.md +++ b/packages/seo/README.md @@ -1,9 +1,9 @@ -# Angel3 SEO +# Protevus SEO ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_seo?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/seo/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/seo/LICENSE) Helpers for building SEO-friendly Web pages in Angel. The goal of `package:angel3_seo` is to speed up perceived client page loads, prevent the infamous [flash of unstyled content](https://en.wikipedia.org/wiki/Flash_of_unstyled_content), and other SEO optimizations that can easily become tedious to perform by hand. diff --git a/packages/seo/example/main.dart b/packages/seo/example/main.dart index 3ca4644b..0affb354 100644 --- a/packages/seo/example/main.dart +++ b/packages/seo/example/main.dart @@ -7,9 +7,9 @@ import 'package:file/local.dart'; import 'package:http_parser/http_parser.dart'; void main() async { - var app = Angel(); + var app = Protevus(); var fs = const LocalFileSystem(); - var http = AngelHttp(app); + var http = ProtevusHttp(app); // You can wrap a [VirtualDirectory] var vDir = inlineAssetsFromVirtualDirectory( @@ -36,7 +36,7 @@ void main() async { ..buffer!.add(utf8.encode(contents)); }); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); var server = await http.startServer('127.0.0.1', 3000); print('Listening at http://${server.address.address}:${server.port}'); diff --git a/packages/seo/pubspec.yaml b/packages/seo/pubspec.yaml index 573b6bdc..323e1bf2 100644 --- a/packages/seo/pubspec.yaml +++ b/packages/seo/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_seo version: 8.2.0 -description: Helper infrastructure for building SEO-friendly Web backends in Angel3. +description: Helper infrastructure for building SEO-friendly Web backends in Protevus. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/angel3/packages/seo +repository: https://github.com/dart-backend/protevus/tree/angel3/packages/seo environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/seo/test/inline_assets_test.dart b/packages/seo/test/inline_assets_test.dart index 79dde2ab..7eab493b 100644 --- a/packages/seo/test/inline_assets_test.dart +++ b/packages/seo/test/inline_assets_test.dart @@ -34,14 +34,14 @@ void main() { } /// Typedef for backwards-compatibility with Dart 1. -typedef InlineAssetTest = void Function(Angel app, Directory dir); +typedef InlineAssetTest = void Function(Protevus app, Directory dir); void Function() inlineAssetsTests(InlineAssetTest f) { return () { late TestClient client; setUp(() async { - var app = Angel(); + var app = Protevus(); var fs = MemoryFileSystem(); var dir = fs.currentDirectory; f(app, dir); diff --git a/packages/serialize/angel_serialize/README.md b/packages/serialize/angel_serialize/README.md index 5bcbe72b..50543dd1 100644 --- a/packages/serialize/angel_serialize/README.md +++ b/packages/serialize/angel_serialize/README.md @@ -1,8 +1,8 @@ -# Angel3 Serialization +# Protevus Serialization ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_serialize?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/serialize/angel_serialize/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/serialize/angel_serialize/LICENSE) -The frontend for Angel3 model serialization. See [`Documentation`](https://angel3-docs.dukefirehawk.com/guides/serialization) +The frontend for Protevus model serialization. See [`Documentation`](https://angel3-docs.dukefirehawk.com/guides/serialization) diff --git a/packages/serialize/angel_serialize/pubspec.yaml b/packages/serialize/angel_serialize/pubspec.yaml index 2f4d11eb..893f451e 100644 --- a/packages/serialize/angel_serialize/pubspec.yaml +++ b/packages/serialize/angel_serialize/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_serialize version: 8.2.0 -description: Static annotations powering Angel3 model serialization. Combine with angel3_serialize_generator for flexible modeling. +description: Static annotations powering Protevus model serialization. Combine with angel3_serialize_generator for flexible modeling. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/serialize/angel_serialize +repository: https://github.com/dart-backend/protevus/tree/master/packages/serialize/angel_serialize environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/serialize/angel_serialize_generator/CHANGELOG.md b/packages/serialize/angel_serialize_generator/CHANGELOG.md index 577d74c4..ceb53309 100644 --- a/packages/serialize/angel_serialize_generator/CHANGELOG.md +++ b/packages/serialize/angel_serialize_generator/CHANGELOG.md @@ -261,7 +261,7 @@ from `const` protection. * Support for using `abstract` to create immutable model classes. * Add support for custom constructor parameters. -* Closed [##21](https://github.com/angel-dart/serialize/issues/21) - better naming +* Closed [##21](https://github.com/protevus-dart/serialize/issues/21) - better naming of `Map` types. * Added overridden `==` operators. diff --git a/packages/serialize/angel_serialize_generator/README.md b/packages/serialize/angel_serialize_generator/README.md index e2407fd6..ffcda90e 100644 --- a/packages/serialize/angel_serialize_generator/README.md +++ b/packages/serialize/angel_serialize_generator/README.md @@ -1,11 +1,11 @@ -# Angel3 Serialize Generator +# Protevus Serialize Generator ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_serialize_generator?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/serialize/angel_serialize_generator/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/serialize/angel_serialize_generator/LICENSE) -The builder for Angel3 serialization. +The builder for Protevus serialization. ## Usage diff --git a/packages/serialize/angel_serialize_generator/pubspec.yaml b/packages/serialize/angel_serialize_generator/pubspec.yaml index 15111325..55fbc386 100644 --- a/packages/serialize/angel_serialize_generator/pubspec.yaml +++ b/packages/serialize/angel_serialize_generator/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_serialize_generator version: 8.3.1 -description: Angel3 model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling. +description: Protevus 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/dart-backend/angel/tree/master/packages/serialize/angel_serialize_generator +repository: https://github.com/dart-backend/protevus/tree/master/packages/serialize/angel_serialize_generator environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/shelf/README.md b/packages/shelf/README.md index 4b57860d..1d2c804f 100644 --- a/packages/shelf/README.md +++ b/packages/shelf/README.md @@ -1,18 +1,18 @@ -# Angel3 Shelf +# Protevus Shelf ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_shelf?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/angel/tree/master/packages/shelf/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/master/packages/shelf/LICENSE) **Replacement of `package:angel_shelf` with breaking changes to support NNBD.** -Shelf interop with Angel3. This package lets you run `package:shelf` handlers via a custom adapter. Use the code in this repo to embed existing Angel/shelf apps into other Angel/shelf applications. This way, you can migrate legacy applications without having to rewrite your business logic. This will make it easy to layer your API over a production application, rather than having to port code. +Shelf interop with Protevus. This package lets you run `package:shelf` handlers via a custom adapter. Use the code in this repo to embed existing Angel/shelf apps into other Angel/shelf applications. This way, you can migrate legacy applications without having to rewrite your business logic. This will make it easy to layer your API over a production application, rather than having to port code. -- [Angel3 Shelf](#angel3-shelf) +- [Protevus Shelf](#angel3-shelf) - [Usage](#usage) - [embedShelf](#embedshelf) - - [Communicating with Angel with embedShelf](#communicating-with-angel-with-embedshelf) + - [Communicating with Angel with embedShelf](#communicating-with-protevus-with-embedshelf) - [AngelShelf](#angelshelf) ## Usage @@ -54,7 +54,7 @@ void main() async { ### Communicating with Angel with embedShelf -You can communicate with Angel3: +You can communicate with Protevus: ```dart handleRequest(shelf.Request request) { @@ -72,7 +72,7 @@ handleRequest(shelf.Request request) { ### AngelShelf -Angel3 brought about the generic `Driver` class, which is implemented by `AngelHttp`, `AngelHttp2`, `AngelGopher`, etc., and provides the core infrastructure for request handling in Angel. `AngelShelf` is an implementation that wraps shelf requests and responses in their Angel equivalents. Using it is as simple using as using `AngelHttp`, or any other driver: +Protevus brought about the generic `Driver` class, which is implemented by `AngelHttp`, `AngelHttp2`, `AngelGopher`, etc., and provides the core infrastructure for request handling in Angel. `AngelShelf` is an implementation that wraps shelf requests and responses in their Angel equivalents. Using it is as simple using as using `AngelHttp`, or any other driver: ```dart // Create an AngelShelf driver. diff --git a/packages/shelf/example/angel_in_shelf.dart b/packages/shelf/example/angel_in_shelf.dart index cc41b81e..681c5d11 100644 --- a/packages/shelf/example/angel_in_shelf.dart +++ b/packages/shelf/example/angel_in_shelf.dart @@ -13,14 +13,14 @@ void main() async { ..level = Level.ALL ..onRecord.listen(prettyLog); - // Create a basic Angel server, with some routes. - var app = Angel( + // Create a basic Protevus server, with some routes. + var app = Protevus( logger: Logger('angel3_shelf_demo'), reflector: MirrorsReflector(), ); - app.get('/angel', (req, res) { - res.write('Angel embedded within shelf!'); + app.get('/protevus', (req, res) { + res.write('Protevus embedded within shelf!'); return false; }); @@ -28,18 +28,18 @@ void main() async { return {'hello': name}; })); - // Next, create an AngelShelf driver. + // Next, create an ProtevusShelf driver. // // If we have startup hooks we want to run, we need to call // `startServer`. Otherwise, it can be omitted. // Of course, if you call `startServer`, know that to run // shutdown/cleanup logic, you need to call `close` eventually, // too. - var angelShelf = AngelShelf(app); + var angelShelf = ProtevusShelf(app); await angelShelf.startServer(); // Create, and mount, a shelf pipeline... - // You can also embed Angel as a middleware... + // You can also embed Protevus as a middleware... var mwHandler = shelf.Pipeline() .addMiddleware(angelShelf.middleware) .addHandler(createStaticHandler('.', @@ -48,6 +48,6 @@ void main() async { // Run the servers. await shelf_io.serve(mwHandler, InternetAddress.loopbackIPv4, 8080); await shelf_io.serve(angelShelf.handler, InternetAddress.loopbackIPv4, 8081); - print('Angel as middleware: http://localhost:8080'); - print('Angel as only handler: http://localhost:8081'); + print('Protevus as middleware: http://localhost:8080'); + print('Protevus as only handler: http://localhost:8081'); } diff --git a/packages/shelf/example/main.dart b/packages/shelf/example/main.dart index 9cd9f7c2..3cce8dad 100644 --- a/packages/shelf/example/main.dart +++ b/packages/shelf/example/main.dart @@ -11,18 +11,18 @@ void main() async { ..level = Level.ALL ..onRecord.listen(prettyLog); - var app = Angel(logger: Logger('angel3_shelf_demo')); - var http = AngelHttp(app); + var app = Protevus(logger: Logger('angel3_shelf_demo')); + var http = ProtevusHttp(app); // `shelf` request handler var shelfHandler = createStaticHandler('.', defaultDocument: 'index.html', listDirectories: true); - // Use `embedShelf` to adapt a `shelf` handler for use within Angel. + // Use `embedShelf` to adapt a `shelf` handler for use within Protevus. var wrappedHandler = embedShelf(shelfHandler); - // A normal Angel route. - app.get('/angel', (req, ResponseContext res) { + // A normal Protevus route. + app.get('/protevus', (req, ResponseContext res) { res.write('Hooray for `package:angel3_shelf`!'); return false; // End execution of handlers, so we don't proxy to dartlang.org when we don't need to. }); diff --git a/packages/shelf/lib/src/embed_shelf.dart b/packages/shelf/lib/src/embed_shelf.dart index b84bb5e7..21f4ab71 100644 --- a/packages/shelf/lib/src/embed_shelf.dart +++ b/packages/shelf/lib/src/embed_shelf.dart @@ -5,7 +5,7 @@ import 'convert.dart'; /// Simply passes an incoming request to a `shelf` handler. /// /// If the handler does not return a [shelf.Response], then the -/// result will be passed down the Angel middleware pipeline, like with +/// result will be passed down the Protevus middleware pipeline, like with /// any other request handler. /// /// If [throwOnNullResponse] is `true` (default: `false`), then a 500 error will be thrown @@ -20,7 +20,7 @@ RequestHandler embedShelf(shelf.Handler handler, try { var result = await handler(shelfRequest); if (throwOnNullResponse == true) { - throw AngelHttpException(message: 'Internal Server Error'); + throw ProtevusHttpException(message: 'Internal Server Error'); } await mergeShelfResponse(result, res); return false; diff --git a/packages/shelf/lib/src/shelf_driver.dart b/packages/shelf/lib/src/shelf_driver.dart index 64ef637c..6b09bda4 100644 --- a/packages/shelf/lib/src/shelf_driver.dart +++ b/packages/shelf/lib/src/shelf_driver.dart @@ -10,13 +10,13 @@ Future> process(dynamic param1, int param2) { return Future.value(Stream.empty()); } -class AngelShelf extends Driver, ShelfRequestContext, ShelfResponseContext> { final StreamController incomingRequests = StreamController(); final FutureOr Function()? notFound; - AngelShelf(Angel app, {FutureOr Function()? notFound}) + ProtevusShelf(Protevus app, {FutureOr Function()? notFound}) : notFound = notFound ?? (() => shelf.Response.notFound('Not Found')), super(app, process, useZone: false) { // Inject a final handler that will keep responses open, if we are using the @@ -40,7 +40,7 @@ class AngelShelf extends Driver incomingRequests.stream; static UnsupportedError _unsupported() => UnsupportedError( - 'AngelShelf cannot mount a standalone server, or return a URI.'); + 'ProtevusShelf cannot mount a standalone server, or return a URI.'); Future handler(shelf.Request request) async { var response = ShelfResponseContext(app); @@ -70,15 +70,15 @@ class AngelShelf extends Driver handleAngelHttpException( - AngelHttpException e, + Future handleProtevusHttpException( + ProtevusHttpException e, StackTrace st, RequestContext? req, ResponseContext? res, shelf.Request request, ShelfResponseContext? response, {bool ignoreFinalizers = false}) async { - await super.handleAngelHttpException(e, st, req, res, request, response, + await super.handleProtevusHttpException(e, st, req, res, request, response, ignoreFinalizers: ignoreFinalizers); return response!.shelfResponse; } diff --git a/packages/shelf/lib/src/shelf_request.dart b/packages/shelf/lib/src/shelf_request.dart index d102a85e..4ee806e6 100644 --- a/packages/shelf/lib/src/shelf_request.dart +++ b/packages/shelf/lib/src/shelf_request.dart @@ -6,7 +6,7 @@ import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:shelf/shelf.dart' as shelf; class ShelfRequestContext extends RequestContext { - final Angel angelApp; + final Protevus angelApp; @override final Container container; diff --git a/packages/shelf/lib/src/shelf_response.dart b/packages/shelf/lib/src/shelf_response.dart index 8a3e91ae..7a31c0f5 100644 --- a/packages/shelf/lib/src/shelf_response.dart +++ b/packages/shelf/lib/src/shelf_response.dart @@ -6,7 +6,7 @@ import 'package:shelf/shelf.dart' as shelf; import 'shelf_request.dart'; class ShelfResponseContext extends ResponseContext { - final Angel angelApp; + final Protevus angelApp; final StreamController> _ctrl = StreamController(); bool _isOpen = true; diff --git a/packages/shelf/pubspec.yaml b/packages/shelf/pubspec.yaml index 6da5f797..5660a886 100644 --- a/packages/shelf/pubspec.yaml +++ b/packages/shelf/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_shelf version: 8.0.0-beta.1 -description: Shelf interop with Angel3. Use this to wrap existing server code. +description: Shelf interop with Protevus. Use this to wrap existing server code. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/shelf +repository: https://github.com/dart-backend/protevus/tree/master/packages/shelf environment: sdk: '>=3.3.0 <4.0.0' publish_to: none diff --git a/packages/shelf/test/embed_shelf_test.dart b/packages/shelf/test/embed_shelf_test.dart index 79df042d..22f48277 100644 --- a/packages/shelf/test/embed_shelf_test.dart +++ b/packages/shelf/test/embed_shelf_test.dart @@ -31,7 +31,7 @@ void main() { if (request.url.path == 'two') { return shelf.Response(200, body: json.encode(2)); } else if (request.url.path == 'error') { - throw AngelHttpException.notFound(); + throw ProtevusHttpException.notFound(); } else if (request.url.path == 'status') { return shelf.Response.notModified(headers: {'foo': 'bar'}); } else if (request.url.path == 'hijack') { @@ -52,9 +52,9 @@ void main() { }); var logger = Logger.detached('angel3_shelf')..onRecord.listen(prettyLog); - var app = Angel(logger: logger, reflector: MirrorsReflector()); - var httpDriver = AngelHttp(app); - app.get('/angel', (req, res) => 'Angel'); + var app = Protevus(logger: logger, reflector: MirrorsReflector()); + var httpDriver = ProtevusHttp(app); + app.get('/protevus', (req, res) => 'Protevus'); app.fallback(embedShelf(handler, throwOnNullResponse: true)); server = await httpDriver.startServer(InternetAddress.loopbackIPv4, 0); @@ -65,9 +65,9 @@ void main() { await server.close(force: true); }); - test('expose angel side', () async { - var response = await client.get(path('/angel')); - expect(json.decode(response.body), equals('Angel')); + test('expose protevus side', () async { + var response = await client.get(path('/protevus')); + expect(json.decode(response.body), equals('Protevus')); }); test('expose shelf side', () async { diff --git a/packages/static/CHANGELOG.md b/packages/static/CHANGELOG.md index d0d9e96a..3185b6b3 100644 --- a/packages/static/CHANGELOG.md +++ b/packages/static/CHANGELOG.md @@ -104,7 +104,7 @@ ## 2.0.0 -* Upgrade dependencies to Angel 2 + file@5. +* Upgrade dependencies to Protevus 2 + file@5. * Replace `useStream` with `useBuffer`. * Remove `package:intl`, just use `HttpDate` instead. @@ -124,12 +124,12 @@ ## 1.3.0-alpha+1 -* ETags once again only encode the first 50 bytes of files. Resolves [#27](https://github.com/angel-dart/static/issues/27). +* ETags once again only encode the first 50 bytes of files. Resolves [#27](https://github.com/protevus-dart/static/issues/27). ## 1.3.0-alpha * Removed file transformers. -* `VirtualDirectory` is no longer an `AngelPlugin`, and instead exposes a `handleRequest` middleware. +* `VirtualDirectory` is no longer an `ProtevusPlugin`, and instead exposes a `handleRequest` middleware. * Added `pushState` to `VirtualDirectory`. ## 1.2.5 @@ -138,7 +138,7 @@ * Fixed another bug where `Accept-Encoding` was not properly adhered to. * Setting `maxAge` to `null` will now prevent a `CachingVirtualDirectory` from sending an `Expires` header. * Pre-built assets can now be mass-deleted with `VirtualDirectory.cleanFromDisk()`. -Resolves [#22](https://github.com/angel-dart/static/issues/22). +Resolves [#22](https://github.com/protevus-dart/static/issues/22). ## 1.2.4+1 @@ -146,7 +146,7 @@ Fixed a bug where `Accept-Encoding` was not properly adhered to. ## 1.2.4 -Fixes . +Fixes . * MIME types will now default to `application/octet-stream`. * When `streamToIO` is `true`, the body will only be sent gzipped if the request explicitly allows it. diff --git a/packages/static/README.md b/packages/static/README.md index c2626b99..a726ad42 100644 --- a/packages/static/README.md +++ b/packages/static/README.md @@ -1,11 +1,11 @@ -# Angel3 Static Files Handler +# Protevus Static Files Handler [![version](https://img.shields.io/badge/pub-v4.1.0-brightgreen)](https://pub.dev/packages/angel3_static) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/angel/tree/angel3/packages/static/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/angel3/packages/static/LICENSE) -This library provides a virtual directory to serve static files such as html, css and js for [Angel3 framework](https://pub.dev/packages/angel3). It can also handle `Range` requests, making it suitable for media streaming, i.e. music, video, etc.* +This library provides a virtual directory to serve static files such as html, css and js for [Protevus framework](https://pub.dev/packages/angel3). It can also handle `Range` requests, making it suitable for media streaming, i.e. music, video, etc.* ## Installation @@ -63,7 +63,7 @@ app.fallback(vDir.pushState('index.html')); The `VirtualDirectory` API accepts a few named parameters: -- **source**: A `Directory` containing the files to be served. If left null, then Angel3 will serve either from `web` (in development) or +- **source**: A `Directory` containing the files to be served. If left null, then Protevus will serve either from `web` (in development) or `build/web` (in production), depending on your `ANGEL_ENV`. - **indexFileNames**: A `List` of filenames that should be served as index pages. Default is `['index.html']`. - **publicPath**: To serve index files, you need to specify the virtual path under which diff --git a/packages/static/example/main.dart b/packages/static/example/main.dart index 638f2b93..37e2bca6 100644 --- a/packages/static/example/main.dart +++ b/packages/static/example/main.dart @@ -5,8 +5,8 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; void main(List args) async { - var app = Angel(); - var http = AngelHttp(app); + var app = Protevus(); + var http = ProtevusHttp(app); var fs = const LocalFileSystem(); var vDir = CachingVirtualDirectory( app, @@ -32,7 +32,7 @@ void main(List args) async { }); app.fallback(vDir.handleRequest); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); var server = await http.startServer('127.0.0.1', 3000); print('Serving from ${vDir.source.path}'); diff --git a/packages/static/lib/src/cache.dart b/packages/static/lib/src/cache.dart index 733e17f3..bc943bdd 100644 --- a/packages/static/lib/src/cache.dart +++ b/packages/static/lib/src/cache.dart @@ -107,7 +107,7 @@ class CachingVirtualDirectory extends VirtualDirectory { } catch (_) { _log.severe( 'Invalid date for ${ifRange ? 'if-range' : 'if-not-modified-since'} header.'); - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Invalid date for ${ifRange ? 'if-range' : 'if-not-modified-since'} header.'); } diff --git a/packages/static/lib/src/virtual_directory.dart b/packages/static/lib/src/virtual_directory.dart index 9adc82bc..696cb68b 100644 --- a/packages/static/lib/src/virtual_directory.dart +++ b/packages/static/lib/src/virtual_directory.dart @@ -40,7 +40,7 @@ class VirtualDirectory { /// An optional callback to run before serving files. final Function(File file, RequestContext req, ResponseContext res)? callback; - final Angel app; + final Protevus app; final FileSystem fileSystem; /// Filenames to be resolved within directories as indices. @@ -115,7 +115,7 @@ class VirtualDirectory { String path, RequestContext req, ResponseContext res) async { if (_prefix.isNotEmpty) { // Only replace the *first* incidence - // Resolve: https://github.com/angel-dart/angel/issues/41 + // Resolve: https://github.com/protevus-dart/protevus/issues/41 path = path.replaceFirst(RegExp('^${_pathify(_prefix)}'), ''); } @@ -263,7 +263,7 @@ class VirtualDirectory { value.contains('*/*') == true; if (!acceptable) { _log.severe('Mime type [$value] is not supported'); - throw AngelHttpException( + throw ProtevusHttpException( //UnsupportedError( // 'Client requested $value, but server wanted to send $mimeType.'), errors: [ @@ -321,7 +321,7 @@ class VirtualDirectory { } if (invalid) { - throw AngelHttpException( + throw ProtevusHttpException( //Exception('Semantically invalid, or unbounded range.'), errors: ['Semantically invalid, or unbounded range.'], statusCode: 416, @@ -330,7 +330,7 @@ class VirtualDirectory { // Ensure it's within range. if (item.start >= totalFileSize || item.end >= totalFileSize) { - throw AngelHttpException( + throw ProtevusHttpException( //Exception('Given range $item is out of bounds.'), errors: ['Given range $item is out of bounds.'], statusCode: 416, @@ -339,7 +339,7 @@ class VirtualDirectory { } if (header.items.isEmpty) { - throw AngelHttpException( + throw ProtevusHttpException( 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 a9758214..0fc14b3d 100644 --- a/packages/static/pubspec.yaml +++ b/packages/static/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_static version: 8.2.1 -description: This library provides a virtual directory to serve static files for Angel3 framework. +description: This library provides a virtual directory to serve static files for Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/angel3/packages/static +repository: https://github.com/dart-backend/protevus/tree/angel3/packages/static environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/static/test/all_test.dart b/packages/static/test/all_test.dart index 9dedd9ed..6ef43f91 100644 --- a/packages/static/test/all_test.dart +++ b/packages/static/test/all_test.dart @@ -7,16 +7,16 @@ import 'package:logging/logging.dart'; import 'package:test/test.dart'; void main() { - Angel app; - late AngelHttp http; + Protevus app; + late ProtevusHttp http; var testDir = const LocalFileSystem().directory('test'); late String url; var client = Client(); setUp(() async { - app = Angel(); - http = AngelHttp(app); - app.logger = Logger('angel')..onRecord.listen(print); + app = Protevus(); + http = ProtevusHttp(app); + app.logger = Logger('protevus')..onRecord.listen(print); app.fallback( VirtualDirectory(app, const LocalFileSystem(), diff --git a/packages/static/test/cache_sample.dart b/packages/static/test/cache_sample.dart index 679ca6ce..29f80b0b 100644 --- a/packages/static/test/cache_sample.dart +++ b/packages/static/test/cache_sample.dart @@ -4,11 +4,11 @@ import 'package:angel3_static/angel3_static.dart'; import 'package:file/local.dart'; void main() async { - Angel app; - AngelHttp http; + Protevus app; + ProtevusHttp http; var testDir = const LocalFileSystem().directory('test'); - app = Angel(); - http = AngelHttp(app); + app = Protevus(); + http = ProtevusHttp(app); app.fallback( CachingVirtualDirectory(app, const LocalFileSystem(), diff --git a/packages/static/test/cache_test.dart b/packages/static/test/cache_test.dart index d3a191f7..6b2a0720 100644 --- a/packages/static/test/cache_test.dart +++ b/packages/static/test/cache_test.dart @@ -8,15 +8,15 @@ import 'package:logging/logging.dart'; import 'package:test/test.dart'; void main() { - Angel app; - late AngelHttp http; + Protevus app; + late ProtevusHttp http; var testDir = const LocalFileSystem().directory('test'); late String url; var client = Client(); setUp(() async { - app = Angel(); - http = AngelHttp(app); + app = Protevus(); + http = ProtevusHttp(app); app.fallback( CachingVirtualDirectory(app, const LocalFileSystem(), diff --git a/packages/static/test/issue41_test.dart b/packages/static/test/issue41_test.dart index b469c408..151460e7 100644 --- a/packages/static/test/issue41_test.dart +++ b/packages/static/test/issue41_test.dart @@ -23,8 +23,8 @@ void main() async { .readAsString(); // Initialize app - var app = Angel(); - app.logger = Logger('angel')..onRecord.listen(print); + var app = Protevus(); + app.logger = Logger('protevus')..onRecord.listen(print); app.fallback( VirtualDirectory(app, const LocalFileSystem(), diff --git a/packages/static/test/push_state_test.dart b/packages/static/test/push_state_test.dart index e32115bb..d8bc5b03 100644 --- a/packages/static/test/push_state_test.dart +++ b/packages/static/test/push_state_test.dart @@ -6,7 +6,7 @@ import 'package:logging/logging.dart'; import 'package:test/test.dart'; void main() { - Angel app; + Protevus app; MemoryFileSystem fileSystem; late TestClient client; @@ -23,7 +23,7 @@ void main() { var indexFile = webDir.childFile('index.html'); await indexFile.writeAsString('index'); - app = Angel(); + app = Protevus(); var vDir = VirtualDirectory( app, diff --git a/packages/sync/README.md b/packages/sync/README.md index f781b03e..651af58e 100644 --- a/packages/sync/README.md +++ b/packages/sync/README.md @@ -1,15 +1,15 @@ -# Angel3 Sync +# Protevus Sync [![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dev/packages/angel3_sync) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/angel/tree/angel3/packages/sync/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/angel3/packages/sync/LICENSE) Easily synchronize and scale WebSockets using [belatuk_pub_sub](). ## Usage -This package exposes `PubSubSynchronizationChannel`, which can simply be dropped into any `AngelWebSocket` constructor. Once you've set that up, instances of your application will automatically fire events in-sync. That's all you have to do to scale a real-time application with Angel3! +This package exposes `PubSubSynchronizationChannel`, which can simply be dropped into any `AngelWebSocket` constructor. Once you've set that up, instances of your application will automatically fire events in-sync. That's all you have to do to scale a real-time application with Protevus! ```dart await app.configure(AngelWebSocket( diff --git a/packages/sync/example/main.dart b/packages/sync/example/main.dart index 341a8e0d..d83b41d9 100644 --- a/packages/sync/example/main.dart +++ b/packages/sync/example/main.dart @@ -10,7 +10,7 @@ import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub; import 'package:test/test.dart'; void main() { - late Angel app1, app2; + late Protevus app1, app2; late TestClient app1Client; late client.WebSockets app2Client; late pub_sub.Server server; @@ -26,13 +26,13 @@ void main() { ..registerClient(const pub_sub.ClientInfo('angel_sync2')) ..start(); - app1 = Angel(); - app2 = Angel(); + app1 = Protevus(); + app2 = Protevus(); 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(); //var body = await req.parseBody(); var body = {}; @@ -44,7 +44,7 @@ void main() { }); app1Port = ReceivePort(); - var ws1 = AngelWebSocket( + var ws1 = ProtevusWebSocket( app1, synchronizationChannel: PubSubSynchronizationChannel( pub_sub.IsolateClient('angel_sync1', adapter.receivePort.sendPort), @@ -55,7 +55,7 @@ void main() { app1Client = await connectTo(app1); app2Port = ReceivePort(); - var ws2 = AngelWebSocket( + var ws2 = ProtevusWebSocket( app2, synchronizationChannel: PubSubSynchronizationChannel( pub_sub.IsolateClient('angel_sync2', adapter.receivePort.sendPort), @@ -64,7 +64,7 @@ void main() { await app2.configure(ws2.configureServer); app2.get('/ws', ws2.handleRequest); - var http = AngelHttp(app2); + var http = ProtevusHttp(app2); await http.startServer(); var wsPath = http.uri.replace(scheme: 'ws', path: '/ws').removeFragment().toString(); diff --git a/packages/sync/pubspec.yaml b/packages/sync/pubspec.yaml index c7e79f66..5057cf44 100644 --- a/packages/sync/pubspec.yaml +++ b/packages/sync/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_sync version: 8.2.0 -description: Easily synchronize and scale WebSockets using belatuk_pub_sub in Angel3. +description: Easily synchronize and scale WebSockets using belatuk_pub_sub in Protevus. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/angel3/packages/sync +repository: https://github.com/dart-backend/protevus/tree/angel3/packages/sync environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/sync/test/all_test.dart b/packages/sync/test/all_test.dart index 7fca039d..3fedf95d 100644 --- a/packages/sync/test/all_test.dart +++ b/packages/sync/test/all_test.dart @@ -10,7 +10,7 @@ import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub; import 'package:test/test.dart'; void main() { - late Angel app1, app2; + late Protevus app1, app2; late TestClient app1Client; late client.WebSockets app2Client; late pub_sub.Server server; @@ -26,13 +26,13 @@ void main() { ..registerClient(const pub_sub.ClientInfo('angel_sync2')) ..start(); - app1 = Angel(); - app2 = Angel(); + app1 = Protevus(); + app2 = Protevus(); 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(); @@ -45,7 +45,7 @@ void main() { }); app1Port = ReceivePort(); - var ws1 = AngelWebSocket( + var ws1 = ProtevusWebSocket( app1, synchronizationChannel: PubSubSynchronizationChannel( pub_sub.IsolateClient('angel_sync1', adapter.receivePort.sendPort), @@ -56,7 +56,7 @@ void main() { app1Client = await connectTo(app1); app2Port = ReceivePort(); - var ws2 = AngelWebSocket( + var ws2 = ProtevusWebSocket( app2, synchronizationChannel: PubSubSynchronizationChannel( pub_sub.IsolateClient('angel_sync2', adapter.receivePort.sendPort), @@ -65,7 +65,7 @@ void main() { await app2.configure(ws2.configureServer); app2.get('/ws', ws2.handleRequest); - var http = AngelHttp(app2); + var http = ProtevusHttp(app2); await http.startServer(); var wsPath = http.uri.replace(scheme: 'ws', path: '/ws').removeFragment().toString(); diff --git a/packages/test/README.md b/packages/test/README.md index ae502030..23ca8044 100644 --- a/packages/test/README.md +++ b/packages/test/README.md @@ -1,11 +1,11 @@ -# Angel3 Test +# Protevus Test ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_test?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/test/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/test/LICENSE) -Testing utility library for Angel3 framework. +Testing utility library for Protevus framework. ## TestClient @@ -32,7 +32,7 @@ void test('foo', () async { hasContentType(ContentType.JSON), hasContentType('application/json'), hasHeader('server'), // Assert header present - hasHeader('server', 'angel'), // Assert header present with value + hasHeader('server', 'protevus'), // Assert header present with value hasHeader('foo', ['bar', 'baz']), // ... Or multiple values hasBody(), // Assert non-empty body hasBody('{"foo":"bar"}') // Assert specific body @@ -46,7 +46,7 @@ void test('error', () async { }); ``` -`hasValidBody` is one of the most powerful `Matcher`s in this library, because it allows you to validate a JSON body against a validation schema. Angel3 provides a comprehensive [validation library]() that integrates tightly with the `matcher` package that you already use for testing. +`hasValidBody` is one of the most powerful `Matcher`s in this library, because it allows you to validate a JSON body against a validation schema. Protevus provides a comprehensive [validation library]() that integrates tightly with the `matcher` package that you already use for testing. ```dart test('validate response', () async { diff --git a/packages/test/example/main.dart b/packages/test/example/main.dart index 4a4dace7..da4382e0 100644 --- a/packages/test/example/main.dart +++ b/packages/test/example/main.dart @@ -6,15 +6,15 @@ import 'package:angel3_websocket/server.dart'; import 'package:test/test.dart'; void main() { - Angel app; + Protevus app; late TestClient client; setUp(() async { - app = Angel() + app = Protevus() ..get('/hello', (req, res) => 'Hello') ..get( '/error', - (req, res) => throw AngelHttpException.forbidden(message: 'Test') + (req, res) => throw ProtevusHttpException.forbidden(message: 'Test') ..errors.addAll(['foo', 'bar'])) ..get('/body', (req, res) { res @@ -45,7 +45,7 @@ void main() { ], create: (dynamic data, [params]) async => {'foo': 'bar'})); - var ws = AngelWebSocket(app); + var ws = ProtevusWebSocket(app); await app.configure(ws.configureServer); app.all('/ws', ws.handleRequest); @@ -72,13 +72,13 @@ void main() { }); }); - test('isAngelHttpException', () async { + test('isProtevusHttpException', () async { var res = await client.get(Uri.parse('/error')); print(res.body); - expect(res, isAngelHttpException()); + expect(res, isProtevusHttpException()); expect( res, - isAngelHttpException( + isProtevusHttpException( statusCode: 403, message: 'Test', errors: ['foo', 'bar'])); }); @@ -91,8 +91,8 @@ void main() { test('hasHeader', () async { var res = await client.get(Uri.parse('/hello')); expect(res, hasHeader('server')); - expect(res, hasHeader('server', 'angel')); - expect(res, hasHeader('server', ['angel'])); + expect(res, hasHeader('server', 'protevus')); + expect(res, hasHeader('server', ['protevus'])); }); test('hasValidBody+hasContentType', () async { diff --git a/packages/test/lib/src/client.dart b/packages/test/lib/src/client.dart index adc90439..0901e42a 100644 --- a/packages/test/lib/src/client.dart +++ b/packages/test/lib/src/client.dart @@ -22,7 +22,7 @@ const Map _writeHeaders = const { final Uuid _uuid = Uuid();*/ /// Shorthand for bootstrapping a [TestClient]. -Future connectTo(Angel app, +Future connectTo(Protevus app, {Map? initialSession, bool autoDecodeGzip = true, bool useZone = false}) async { @@ -41,11 +41,11 @@ Future connectTo(Angel app, } /// An `angel_client` that sends mock requests to a server, rather than actual HTTP transactions. -class TestClient extends client.BaseAngelClient { +class TestClient extends client.BaseProtevusClient { final Map _services = {}; /// Session info to be sent to the server on every request. - final HttpSession session = MockHttpSession(id: 'angel-test-client'); + final HttpSession session = MockHttpSession(id: 'protevus-test-client'); /// A list of cookies to be sent to and received from the server. final List cookies = []; @@ -54,13 +54,13 @@ class TestClient extends client.BaseAngelClient { final bool autoDecodeGzip; /// The server instance to mock. - final Angel server; + final Protevus server; - late AngelHttp _http; + late ProtevusHttp _http; TestClient(this.server, {this.autoDecodeGzip = true, bool useZone = false}) : super(http.IOClient(), '/') { - _http = AngelHttp(server, useZone: useZone); + _http = ProtevusHttp(server, useZone: useZone); } @override @@ -156,12 +156,12 @@ class TestClient extends client.BaseAngelClient { } @override - Future configure(client.AngelConfigurer configurer) => + Future configure(client.ProtevusConfigurer configurer) => Future.sync(() => configurer(this)); @override client.Service service(String path, - {Type? type, client.AngelDeserializer? deserializer}) { + {Type? type, client.ProtevusDeserializer? deserializer}) { var uri = path.toString().replaceAll(_straySlashes, ''); return _services.putIfAbsent(uri, () => _MockService(this, uri, deserializer: deserializer)) @@ -169,11 +169,11 @@ class TestClient extends client.BaseAngelClient { } } -class _MockService extends client.BaseAngelService { +class _MockService extends client.BaseProtevusService { final TestClient _app; _MockService(this._app, String basePath, - {client.AngelDeserializer? deserializer}) + {client.ProtevusDeserializer? deserializer}) : super(_app, _app, basePath, deserializer: deserializer); @override diff --git a/packages/test/lib/src/matchers.dart b/packages/test/lib/src/matchers.dart index 875618a0..c56f3f27 100644 --- a/packages/test/lib/src/matchers.dart +++ b/packages/test/lib/src/matchers.dart @@ -4,14 +4,14 @@ import 'package:http/http.dart' as http; import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:angel3_validate/angel3_validate.dart'; -/// Expects a response to be a JSON representation of an `AngelHttpException`. +/// Expects a response to be a JSON representation of an `ProtevusHttpException`. /// /// You can optionally check for a matching [message], [statusCode] and [errors]. -Matcher isAngelHttpException( +Matcher isProtevusHttpException( {String? message, int? statusCode, Iterable errors = const []}) => - _IsAngelHttpException( + _IsProtevusHttpException( message: message, statusCode: statusCode, errors: errors); /// Expects a given response, when parsed as JSON, @@ -246,12 +246,12 @@ class _HasValidBody extends Matcher { } } -class _IsAngelHttpException extends Matcher { +class _IsProtevusHttpException extends Matcher { String? message; int? statusCode; final List errors = []; - _IsAngelHttpException( + _IsProtevusHttpException( {this.message, this.statusCode, Iterable errors = const []}) { this.errors.addAll(errors); } @@ -259,9 +259,9 @@ class _IsAngelHttpException extends Matcher { @override Description describe(Description description) { if (message?.isNotEmpty != true && statusCode == null && errors.isEmpty) { - return description.add('is an Angel HTTP Exception'); + return description.add('is an Protevus HTTP Exception'); } else { - var buf = StringBuffer('is an Angel HTTP Exception with'); + var buf = StringBuffer('is an Protevus HTTP Exception with'); if (statusCode != null) buf.write(' status code $statusCode'); @@ -292,7 +292,7 @@ class _IsAngelHttpException extends Matcher { final jsons = json.decode(item.body); if (jsons is Map && jsons['isError'] == true) { - var exc = AngelHttpException.fromMap(jsons); + var exc = ProtevusHttpException.fromMap(jsons); print(exc.toJson()); if (message?.isNotEmpty != true && diff --git a/packages/test/pubspec.yaml b/packages/test/pubspec.yaml index 7696aee6..09ce4942 100644 --- a/packages/test/pubspec.yaml +++ b/packages/test/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_test version: 8.2.1 -description: Testing utility library for the Angel3 framework. Use with package:test. +description: Testing utility library for the Protevus framework. Use with package:test. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/test +repository: https://github.com/dart-backend/protevus/tree/master/packages/test environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/test/test/simple_test.dart b/packages/test/test/simple_test.dart index 822364d2..97b45bac 100644 --- a/packages/test/test/simple_test.dart +++ b/packages/test/test/simple_test.dart @@ -8,16 +8,16 @@ import 'package:angel3_websocket/server.dart'; import 'package:test/test.dart'; void main() { - Angel app; + Protevus app; late TestClient client; setUp(() async { - app = Angel(reflector: MirrorsReflector()) + app = Protevus(reflector: MirrorsReflector()) ..get('/hello', (req, res) => 'Hello') ..get('/user_info', (req, res) => {'u': req.uri?.userInfo}) ..get( '/error', - (req, res) => throw AngelHttpException.forbidden(message: 'Test') + (req, res) => throw ProtevusHttpException.forbidden(message: 'Test') ..errors.addAll(['foo', 'bar'])) ..get('/body', (req, res) { res @@ -49,7 +49,7 @@ void main() { create: (data, [params]) async => {'foo': 'bar'})); - var ws = AngelWebSocket(app); + var ws = ProtevusWebSocket(app); await app.configure(ws.configureServer); app.all('/ws', ws.handleRequest); @@ -76,13 +76,13 @@ void main() { }); }); - test('isAngelHttpException', () async { + test('isProtevusHttpException', () async { var res = await client.get(Uri.parse('/error')); print(res.body); - expect(res, isAngelHttpException()); + expect(res, isProtevusHttpException()); expect( res, - isAngelHttpException( + isProtevusHttpException( statusCode: 403, message: 'Test', errors: ['foo', 'bar'])); }, skip: 'This is a bug to be fixed, skip for now'); @@ -115,8 +115,8 @@ void main() { test('hasHeader', () async { var res = await client.get(Uri.parse('/hello')); expect(res, hasHeader('server')); - expect(res, hasHeader('server', 'Angel3')); - expect(res, hasHeader('server', ['Angel3'])); + expect(res, hasHeader('server', 'Protevus')); + expect(res, hasHeader('server', ['Protevus'])); }); test('hasValidBody+hasContentType', () async { diff --git a/packages/user_agent/angel_user_agent/README.md b/packages/user_agent/angel_user_agent/README.md index 25f3e0aa..172660d6 100644 --- a/packages/user_agent/angel_user_agent/README.md +++ b/packages/user_agent/angel_user_agent/README.md @@ -1,9 +1,9 @@ -# Angel3 User Agent +# Protevus User Agent ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_user_agent?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/angel/tree/angel3/packages/user_agent/angel_user_agent/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/angel3/packages/user_agent/angel_user_agent/LICENSE) **Replacement of `package:angel_user_agent` with breaking changes to support NNBD.** diff --git a/packages/user_agent/angel_user_agent/example/example.dart b/packages/user_agent/angel_user_agent/example/example.dart index cf28d5f8..85049bfc 100644 --- a/packages/user_agent/angel_user_agent/example/example.dart +++ b/packages/user_agent/angel_user_agent/example/example.dart @@ -5,9 +5,9 @@ import 'package:angel3_framework/http.dart'; //import 'package:user_agent_analyzer/user_agent_analyzer.dart'; void main() async { - var app = Angel(); + var app = Protevus(); // ignore: unused_local_variable - var http = AngelHttp(app); + var http = ProtevusHttp(app); //TODO: To be reviewed /* diff --git a/packages/user_agent/angel_user_agent/lib/angel3_user_agent.dart b/packages/user_agent/angel_user_agent/lib/angel3_user_agent.dart index cab51971..819f0fca 100644 --- a/packages/user_agent/angel_user_agent/lib/angel3_user_agent.dart +++ b/packages/user_agent/angel_user_agent/lib/angel3_user_agent.dart @@ -10,7 +10,7 @@ bool parseUserAgent(RequestContext req, ResponseContext res) { var agentString = req.headers!.value('user-agent'); if (agentString?.trim().isNotEmpty != true) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'User-Agent header is required.'); } else if (agentString != null) { var userAgent = UserAgent(agentString); diff --git a/packages/user_agent/angel_user_agent/pubspec.yaml b/packages/user_agent/angel_user_agent/pubspec.yaml index 94320d19..34b7372e 100644 --- a/packages/user_agent/angel_user_agent/pubspec.yaml +++ b/packages/user_agent/angel_user_agent/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_user_agent version: 8.2.0 -description: Angel3 middleware to parse and inject a User Agent object into requests. +description: Protevus middleware to parse and inject a User Agent object into requests. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/angel3/packages/user_agent/angel_user_agent +repository: https://github.com/dart-backend/protevus/tree/angel3/packages/user_agent/angel_user_agent environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/validate/README.md b/packages/validate/README.md index 6809263e..93159486 100644 --- a/packages/validate/README.md +++ b/packages/validate/README.md @@ -1,15 +1,15 @@ -# Angel3 Validate +# Protevus Validate ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_validate?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/validate/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/validate/LICENSE) -This validator library is based on the `matcher` library and comes with build in support for Angel3 framework. It can be run on both server and client side. Thus, the same validation rules apply to forms on both backend and frontend code. +This validator library is based on the `matcher` library and comes with build in support for Protevus framework. It can be run on both server and client side. Thus, the same validation rules apply to forms on both backend and frontend code. For convenience's sake, this library also exports `matcher`. -- [Angel3 Validate](#angel3-validate) +- [Protevus Validate](#angel3-validate) - [Examples](#examples) - [Creating a Validator](#creating-a-validator) - [Validating data](#validating-data) @@ -23,7 +23,7 @@ For convenience's sake, this library also exports `matcher`. - [Extending Validators](#extending-validators) - [Bundled Matchers](#bundled-matchers) - [Nested Validators](#nested-validators) - - [Use with Angel3](#use-with-angel3) + - [Use with Protevus](#use-with-angel3) ## Examples @@ -256,7 +256,7 @@ main() { } ``` -### Use with Angel3 +### Use with Protevus `server.dart` exposes seven helper middleware: diff --git a/packages/validate/lib/server.dart b/packages/validate/lib/server.dart index dea30ad6..2c9dd866 100644 --- a/packages/validate/lib/server.dart +++ b/packages/validate/lib/server.dart @@ -60,7 +60,7 @@ RequestHandler validate(Validator validator, var result = await asyncApplyValidator(validator, req.bodyAsMap, app); if (result.errors.isNotEmpty) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: errorMessage, errors: result.errors); } @@ -83,7 +83,7 @@ RequestHandler validateQuery(Validator validator, await asyncApplyValidator(validator, req.queryParameters, app); if (result.errors.isNotEmpty) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: errorMessage, errors: result.errors); } @@ -104,7 +104,7 @@ HookedServiceEventListener validateEvent(Validator validator, var result = await asyncApplyValidator(validator, e.data as Map, app); if (result.errors.isNotEmpty) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: errorMessage, errors: result.errors); } @@ -116,7 +116,7 @@ HookedServiceEventListener validateEvent(Validator validator, /// Asynchronously apply a [validator], running any [AngelMatcher]s. Future asyncApplyValidator( - Validator validator, Map data, Angel app) async { + Validator validator, Map data, Protevus app) async { var result = validator.check(data); if (result.errors.isNotEmpty) return result; diff --git a/packages/validate/lib/src/async.dart b/packages/validate/lib/src/async.dart index 043d3e71..410b0e5f 100644 --- a/packages/validate/lib/src/async.dart +++ b/packages/validate/lib/src/async.dart @@ -8,7 +8,7 @@ import 'context_aware.dart'; /// /// Analogous to the synchronous [predicate] matcher. AngelMatcher predicateWithAngel( - FutureOr Function(String, Object, Angel) f, + FutureOr Function(String, Object, Protevus) f, [String description = 'satisfies function']) => _PredicateWithAngel(f, description); @@ -16,18 +16,18 @@ AngelMatcher predicateWithAngel( /// to the input. /// /// Use this to match values against configuration, injections, etc. -AngelMatcher matchWithAngel(FutureOr Function(Object, Map, Angel) f, +AngelMatcher matchWithAngel(FutureOr Function(Object, Map, Protevus) f, [String description = 'satisfies asynchronously created matcher']) => _MatchWithAngel(f, description); /// Calls [matchWithAngel] without the initial parameter. AngelMatcher matchWithAngelBinary( - FutureOr Function(Map context, Angel) f, + FutureOr Function(Map context, Protevus) f, [String description = 'satisfies asynchronously created matcher']) => matchWithAngel((_, context, app) => f(context, app)); /// Calls [matchWithAngel] without the initial two parameters. -AngelMatcher matchWithAngelUnary(FutureOr Function(Angel) f, +AngelMatcher matchWithAngelUnary(FutureOr Function(Protevus) f, [String description = 'satisfies asynchronously created matcher']) => matchWithAngelBinary((_, app) => f(app)); @@ -61,7 +61,7 @@ AngelMatcher idExistsInService(String servicePath, try { var result = await app.findService(servicePath)?.read(item); return result != null; - } on AngelHttpException catch (e) { + } on ProtevusHttpException catch (e) { if (e.statusCode == 404) { return false; } else { @@ -73,10 +73,10 @@ AngelMatcher idExistsInService(String servicePath, ); } -/// An asynchronous [Matcher] that runs in the context of an [Angel] app. +/// An asynchronous [Matcher] that runs in the context of an [Protevus] app. abstract class AngelMatcher extends ContextAwareMatcher { Future matchesWithAngel( - item, String key, Map context, Map matchState, Angel app); + item, String key, Map context, Map matchState, Protevus app); @override bool matchesWithContext(item, String key, Map context, Map matchState) { @@ -95,13 +95,13 @@ class _WrappedAngelMatcher extends AngelMatcher { @override Future matchesWithAngel( - item, String key, Map context, Map matchState, Angel app) async { + item, String key, Map context, Map matchState, Protevus app) async { return matcher.matchesWithContext(item, key, context, matchState); } } class _MatchWithAngel extends AngelMatcher { - final FutureOr Function(Object, Map, Angel) f; + final FutureOr Function(Object, Map, Protevus) f; final String description; _MatchWithAngel(this.f, this.description); @@ -112,7 +112,7 @@ class _MatchWithAngel extends AngelMatcher { @override Future matchesWithAngel( - item, String key, Map context, Map matchState, Angel app) { + item, String key, Map context, Map matchState, Protevus app) { return Future.sync(() => f(item as Object, context, app)).then((result) { return result.matches(item, matchState); }); @@ -120,7 +120,7 @@ class _MatchWithAngel extends AngelMatcher { } class _PredicateWithAngel extends AngelMatcher { - final FutureOr Function(String, Object, Angel) predicate; + final FutureOr Function(String, Object, Protevus) predicate; final String description; _PredicateWithAngel(this.predicate, this.description); @@ -131,7 +131,7 @@ class _PredicateWithAngel extends AngelMatcher { @override Future matchesWithAngel( - item, String key, Map context, Map matchState, Angel app) { + item, String key, Map context, Map matchState, Protevus app) { return Future.sync(() => predicate(key, item as Object, app)); } } @@ -149,7 +149,7 @@ class _MatchAsync extends AngelMatcher { @override Future matchesWithAngel( - item, String key, Map context, Map matchState, Angel app) async { + item, String key, Map context, Map matchState, Protevus app) async { var f = await feature(); var m = await matcher(key, f as Object); var c = wrapAngelMatcher(m); diff --git a/packages/validate/lib/src/validator.dart b/packages/validate/lib/src/validator.dart index f39470db..e09ec043 100644 --- a/packages/validate/lib/src/validator.dart +++ b/packages/validate/lib/src/validator.dart @@ -394,7 +394,7 @@ class ValidationResult { } /// Occurs when user-provided data is invalid. -class ValidationException extends AngelHttpException { +class ValidationException extends ProtevusHttpException { /// A list of errors that resulted in the given data being marked invalid. //@override //final List errors = []; diff --git a/packages/validate/pubspec.yaml b/packages/validate/pubspec.yaml index ebca90ba..77a7a173 100644 --- a/packages/validate/pubspec.yaml +++ b/packages/validate/pubspec.yaml @@ -2,7 +2,7 @@ name: angel3_validate description: Cross-platform HTTP request body validator library based on `matcher`. version: 8.2.0 homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/validate +repository: https://github.com/dart-backend/protevus/tree/master/packages/validate environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/validate/test/server_test.dart b/packages/validate/test/server_test.dart index 467c3f37..3591e901 100644 --- a/packages/validate/test/server_test.dart +++ b/packages/validate/test/server_test.dart @@ -18,13 +18,13 @@ void printRecord(LogRecord rec) { } void main() { - late Angel app; - late AngelHttp http; + late Protevus app; + late ProtevusHttp http; //TestClient client; setUp(() async { - app = Angel(); - http = AngelHttp(app, useZone: false); + app = Protevus(); + http = ProtevusHttp(app, useZone: false); app.chain([validate(echoSchema)]).post('/echo', (RequestContext req, res) async { diff --git a/packages/websocket/README.md b/packages/websocket/README.md index eaa750a1..f8718b80 100644 --- a/packages/websocket/README.md +++ b/packages/websocket/README.md @@ -1,11 +1,11 @@ -# Angel3 Websocket +# Protevus Websocket ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/angel3_websocket?include_prereleases) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM) -[![License](https://img.shields.io/github/license/dart-backend/angel)](https://github.com/dart-backend/angel/tree/master/packages/websocket/LICENSE) +[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/websocket/LICENSE) -WebSocket plugin for Angel3 framework. This plugin broadcasts events from hooked services via WebSockets. In addition, it adds itself to the app's IoC container as `AngelWebSocket`, so that it can be used in controllers as well. +WebSocket plugin for Protevus framework. This plugin broadcasts events from hooked services via WebSockets. In addition, it adds itself to the app's IoC container as `AngelWebSocket`, so that it can be used in controllers as well. WebSocket contexts are add to `req.properties` as `'socket'`. diff --git a/packages/websocket/example/main.dart b/packages/websocket/example/main.dart index 3049d218..4426bd72 100644 --- a/packages/websocket/example/main.dart +++ b/packages/websocket/example/main.dart @@ -7,9 +7,9 @@ import 'package:file/local.dart'; import 'package:logging/logging.dart'; void main(List args) async { - var app = Angel(); - var http = AngelHttp(app); - var ws = AngelWebSocket(app, sendErrors: !app.environment.isProduction); + var app = Protevus(); + var http = ProtevusHttp(app); + var ws = ProtevusWebSocket(app, sendErrors: !app.environment.isProduction); var fs = const LocalFileSystem(); app.logger = Logger('angel3_websocket'); @@ -22,7 +22,7 @@ void main(List args) async { // Listen for requests at `/ws`. app.get('/ws', ws.handleRequest); - app.fallback((req, res) => throw AngelHttpException.notFound()); + app.fallback((req, res) => throw ProtevusHttpException.notFound()); ws.onConnection.listen((socket) { var h = socket.request.headers; @@ -48,7 +48,7 @@ void main(List args) async { ); } - var http2 = AngelHttp2(app, ctx); + var http2 = ProtevusHttp2(app, ctx); http2.onHttp1.listen(http.handleRequest); await http2.startServer('127.0.0.1', 3000); print('Listening at ${http2.uri}'); diff --git a/packages/websocket/lib/base_websocket_client.dart b/packages/websocket/lib/base_websocket_client.dart index 9a54c5ff..9bfb4331 100644 --- a/packages/websocket/lib/base_websocket_client.dart +++ b/packages/websocket/lib/base_websocket_client.dart @@ -10,8 +10,8 @@ import 'constants.dart'; final RegExp _straySlashes = RegExp(r'(^/)|(/+$)'); -/// An [Angel] client that operates across WebSockets. -abstract class BaseWebSocketClient extends BaseAngelClient { +/// An [Protevus] client that operates across WebSockets. +abstract class BaseWebSocketClient extends BaseProtevusClient { Duration? _reconnectInterval; WebSocketChannel? _socket; final Queue _queue = Queue(); @@ -19,10 +19,10 @@ abstract class BaseWebSocketClient extends BaseAngelClient { final StreamController _onData = StreamController(); final StreamController _onAllEvents = StreamController(); - final StreamController _onAuthenticated = - StreamController(); - final StreamController _onError = - StreamController(); + final StreamController _onAuthenticated = + StreamController(); + final StreamController _onError = + StreamController(); final StreamController> _onServiceEvent = StreamController>.broadcast(); final StreamController @@ -37,7 +37,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient { /// Fired whenever a WebSocket is successfully authenticated. @override - Stream get onAuthenticated => _onAuthenticated.stream; + Stream get onAuthenticated => _onAuthenticated.stream; /// A broadcast stream of data coming from the [socket]. /// @@ -45,7 +45,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient { Stream get onData => _onData.stream; /// Fired on errors. - Stream get onError => _onError.stream; + Stream get onError => _onError.stream; /// Fired whenever an event is fired by a service. Stream> get onServiceEvent => @@ -163,7 +163,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient { @override Service service(String path, - {Type? type, AngelDeserializer? deserializer}) { + {Type? type, ProtevusDeserializer? deserializer}) { var uri = path.toString().replaceAll(_straySlashes, ''); var wsService = WebSocketsService(socket, this, uri, deserializer: deserializer); @@ -191,10 +191,10 @@ abstract class BaseWebSocketClient extends BaseAngelClient { if (event.eventName == errorEvent) { var error = - AngelHttpException.fromMap((event.data ?? {}) as Map); + ProtevusHttpException.fromMap((event.data ?? {}) as Map); _onError.add(error); } else if (event.eventName == authenticatedEvent) { - var authResult = AngelAuthResult.fromMap(event.data as Map?); + var authResult = ProtevusAuthResult.fromMap(event.data as Map?); _onAuthenticated.add(authResult); } else if (event.eventName?.isNotEmpty == true) { var split = event.eventName! @@ -260,7 +260,7 @@ class WebSocketsService extends Service { final BaseWebSocketClient app; /// Used to deserialize JSON into typed data. - final AngelDeserializer? deserializer; + final ProtevusDeserializer? deserializer; /// The [WebSocketChannel] to listen to, and send data across. final WebSocketChannel? socket; diff --git a/packages/websocket/lib/browser.dart b/packages/websocket/lib/browser.dart index cd280862..1f2858b3 100644 --- a/packages/websocket/lib/browser.dart +++ b/packages/websocket/lib/browser.dart @@ -42,7 +42,7 @@ class WebSockets extends BaseWebSocketClient { t = Timer.periodic(Duration(milliseconds: 500), (timer) { if (!ctrl.isClosed) { if (wnd.closed == true) { - ctrl.addError(AngelHttpException.notAuthenticated( + ctrl.addError(ProtevusHttpException.notAuthenticated( message: errorMessage ?? 'Authentication via popup window failed.')); ctrl.close(); @@ -96,7 +96,7 @@ class WebSockets extends BaseWebSocketClient { @override Service service(String path, - {Type? type, AngelDeserializer? deserializer}) { + {Type? type, ProtevusDeserializer? deserializer}) { var uri = path.replaceAll(_straySlashes, ''); return BrowserWebSocketsService(socket, this, uri, deserializer: deserializer) as Service; diff --git a/packages/websocket/lib/io.dart b/packages/websocket/lib/io.dart index aba5fc4b..5ac56598 100644 --- a/packages/websocket/lib/io.dart +++ b/packages/websocket/lib/io.dart @@ -50,7 +50,7 @@ class WebSockets extends BaseWebSocketClient { @override Service service(String path, - {Type? type, AngelDeserializer? deserializer}) { + {Type? type, ProtevusDeserializer? deserializer}) { var uri = path.replaceAll(_straySlashes, ''); return IoWebSocketsService(socket, this, uri, type) as Service; diff --git a/packages/websocket/lib/server.dart b/packages/websocket/lib/server.dart index b66c7a52..057d4ca9 100644 --- a/packages/websocket/lib/server.dart +++ b/packages/websocket/lib/server.dart @@ -26,7 +26,7 @@ part 'websocket_controller.dart'; typedef WebSocketResponseSerializer = String Function(dynamic data); /// Broadcasts events from [HookedService]s, and handles incoming [WebSocketAction]s. -class AngelWebSocket { +class ProtevusWebSocket { final List _clients = []; final List _servicesAlreadyWired = []; @@ -38,7 +38,7 @@ class AngelWebSocket { final StreamController _onDisconnect = StreamController.broadcast(); - final Angel app; + final Protevus app; /// If this is not `true`, then all client-side service parameters will be /// discarded, other than `params['query']`. @@ -86,7 +86,7 @@ class AngelWebSocket { /// Deserializes data from WebSockets. Function? deserializer; - AngelWebSocket(this.app, + ProtevusWebSocket(this.app, {this.sendErrors = false, this.allowClientParams = false, this.allowAuth = true, @@ -198,14 +198,14 @@ class AngelWebSocket { var split = action.eventName!.split('::'); if (split.length < 2) { - socket.sendError(AngelHttpException.badRequest()); + socket.sendError(ProtevusHttpException.badRequest()); return null; } var service = app.findService(split[0]); if (service == null) { - socket.sendError(AngelHttpException.notFound( + socket.sendError(ProtevusHttpException.notFound( message: 'No service "${split[0]}" exists.')); return null; } @@ -257,7 +257,7 @@ class AngelWebSocket { eventName: '${split[0]}::$removedEvent', data: await service.remove(action.id, params)); } else { - socket.sendError(AngelHttpException.methodNotAllowed( + socket.sendError(ProtevusHttpException.methodNotAllowed( message: 'Method Not Allowed: $actionName')); return null; } @@ -291,7 +291,7 @@ class AngelWebSocket { catchError(e, st, socket); } } else { - socket.sendError(AngelHttpException.badRequest( + socket.sendError(ProtevusHttpException.badRequest( message: 'No JWT provided for authentication.')); } } @@ -326,7 +326,7 @@ class AngelWebSocket { if (action.eventName == null || action.eventName is! String || action.eventName!.isEmpty) { - throw AngelHttpException.badRequest(); + throw ProtevusHttpException.badRequest(); } if (fromJson.containsKey('eventName')) { @@ -358,16 +358,16 @@ class AngelWebSocket { void catchError(e, StackTrace st, WebSocketContext socket) { // Send an error - if (e is AngelHttpException) { + if (e is ProtevusHttpException) { socket.sendError(e); app.logger.severe(e.message, e.error ?? e, e.stackTrace); } else if (sendErrors) { - var err = AngelHttpException( + var err = ProtevusHttpException( message: e.toString(), stackTrace: st, errors: [st.toString()]); socket.sendError(err); app.logger.severe(err.message, e, st); } else { - var err = AngelHttpException(); + var err = ProtevusHttpException(); socket.sendError(err); app.logger.severe(e.toString(), e, st); } @@ -379,7 +379,7 @@ class AngelWebSocket { } /// Hooks any [HookedService]s that are not being broadcasted yet. - void wireAllServices(Angel app) { + void wireAllServices(Protevus app) { for (var key in app.services.keys.where((x) { return !_servicesAlreadyWired.contains(x) && app.services[x] is HookedService; @@ -388,12 +388,12 @@ class AngelWebSocket { } } - /// Configures an [Angel] instance to listen for WebSocket connections. - Future configureServer(Angel app) async { + /// Configures an [Protevus] instance to listen for WebSocket connections. + Future configureServer(Protevus app) async { app.container.registerSingleton(this); - if (runtimeType != AngelWebSocket) { - app.container.registerSingleton(this); + if (runtimeType != ProtevusWebSocket) { + app.container.registerSingleton(this); } // Set up services @@ -415,7 +415,7 @@ class AngelWebSocket { Future handleClient(WebSocketContext socket) async { var origin = socket.request.headers?.value('origin'); if (allowedOrigins.isNotEmpty && !allowedOrigins.contains(origin)) { - throw AngelHttpException.forbidden( + throw ProtevusHttpException.forbidden( message: 'WebSocket connections are not allowed from the origin "$origin".'); } @@ -448,7 +448,7 @@ class AngelWebSocket { Future handleRequest(RequestContext req, ResponseContext res) async { if (req is HttpRequestContext && res is HttpResponseContext) { if (!WebSocketTransformer.isUpgradeRequest(req.rawRequest!)) { - throw AngelHttpException.badRequest(); + throw ProtevusHttpException.badRequest(); } res.detach(); var ws = await WebSocketTransformer.upgrade(req.rawRequest!); @@ -465,24 +465,24 @@ class AngelWebSocket { var protocol = req.headers?.value('sec-websocket-protocol'); if (connection == null) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Missing `connection` header.'); } else if (!connection.contains('upgrade')) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Missing "upgrade" in `connection` header.'); } else if (upgrade != 'websocket') { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'The `upgrade` header must equal "websocket".'); } else if (version != '13') { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'The `sec-websocket-version` header must equal "13".'); } else if (key == null) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Missing `sec-websocket-key` header.'); } else if (protocol != null && allowedProtocols.isNotEmpty && !allowedProtocols.contains(protocol)) { - throw AngelHttpException.badRequest( + throw ProtevusHttpException.badRequest( message: 'Disallowed `sec-websocket-protocol` header "$protocol".'); } else { var stream = res.detach(); diff --git a/packages/websocket/lib/websocket_context.dart b/packages/websocket/lib/websocket_context.dart index 54a59e83..19fa95e8 100644 --- a/packages/websocket/lib/websocket_context.dart +++ b/packages/websocket/lib/websocket_context.dart @@ -57,7 +57,8 @@ class WebSocketContext { } /// Sends an error event. - void sendError(AngelHttpException error) => send(errorEvent, error.toJson()); + void sendError(ProtevusHttpException error) => + send(errorEvent, error.toJson()); } class WebSocketEventTable { diff --git a/packages/websocket/lib/websocket_controller.dart b/packages/websocket/lib/websocket_controller.dart index 178641b8..77cac3b3 100644 --- a/packages/websocket/lib/websocket_controller.dart +++ b/packages/websocket/lib/websocket_controller.dart @@ -10,7 +10,7 @@ class ExposeWs { /// A special controller that also supports WebSockets. class WebSocketController extends Controller { /// The plug-in instance powering this controller. - final AngelWebSocket ws; + final ProtevusWebSocket ws; final Map _handlers = {}; final Map _handlerSymbols = {}; @@ -37,7 +37,7 @@ class WebSocketController extends Controller { dynamic onData(data, WebSocketContext socket) {} @override - Future configureServer(Angel app) async { + Future configureServer(Protevus app) async { if (findExpose(app.container.reflector) != null) { await super.configureServer(app); } diff --git a/packages/websocket/pubspec.yaml b/packages/websocket/pubspec.yaml index 50d0c2c1..d8d4e818 100644 --- a/packages/websocket/pubspec.yaml +++ b/packages/websocket/pubspec.yaml @@ -1,8 +1,8 @@ name: angel3_websocket version: 8.2.0 -description: This library provides WebSockets support for Angel3 framework. +description: This library provides WebSockets support for Protevus framework. homepage: https://angel3-framework.web.app/ -repository: https://github.com/dart-backend/angel/tree/master/packages/websocket +repository: https://github.com/dart-backend/protevus/tree/master/packages/websocket environment: sdk: '>=3.3.0 <4.0.0' dependencies: diff --git a/packages/websocket/test/auth_test.dart b/packages/websocket/test/auth_test.dart index 3bc8f64a..d9f42744 100644 --- a/packages/websocket/test/auth_test.dart +++ b/packages/websocket/test/auth_test.dart @@ -10,14 +10,14 @@ import 'package:test/test.dart'; const Map user = {'username': 'foo', 'password': 'bar'}; void main() { - Angel app; - late AngelHttp http; - late c.Angel client; + Protevus app; + late ProtevusHttp http; + late c.Protevus client; late c.WebSockets ws; setUp(() async { - app = Angel(); - http = AngelHttp(app, useZone: false); + app = Protevus(); + http = ProtevusHttp(app, useZone: false); var auth = AngelAuth( serializer: (_) async => 'baz', deserializer: (_) async => user); @@ -34,7 +34,7 @@ void main() { app.post('/auth/local', auth.authenticate('local')); await app.configure(auth.configureServer); - var sock = AngelWebSocket(app); + var sock = ProtevusWebSocket(app); await app.configure(sock.configureServer); diff --git a/packages/websocket/test/controller/io_test.dart b/packages/websocket/test/controller/io_test.dart index 13967685..2e65ff77 100644 --- a/packages/websocket/test/controller/io_test.dart +++ b/packages/websocket/test/controller/io_test.dart @@ -9,18 +9,18 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - srv.Angel app; - late srv.AngelHttp http; + srv.Protevus app; + late srv.ProtevusHttp http; late ws.WebSockets client; - srv.AngelWebSocket websockets; + srv.ProtevusWebSocket websockets; HttpServer? server; String? url; setUp(() async { - app = srv.Angel(reflector: const MirrorsReflector()); - http = srv.AngelHttp(app, useZone: false); + app = srv.Protevus(reflector: const MirrorsReflector()); + http = srv.ProtevusHttp(app, useZone: false); - websockets = srv.AngelWebSocket(app) + websockets = srv.ProtevusWebSocket(app) ..onData.listen((data) { print('Received by server: $data'); }); diff --git a/packages/websocket/test/service/io_test.dart b/packages/websocket/test/service/io_test.dart index bf1bdaf0..9e1daced 100644 --- a/packages/websocket/test/service/io_test.dart +++ b/packages/websocket/test/service/io_test.dart @@ -9,19 +9,19 @@ import 'package:test/test.dart'; import 'common.dart'; void main() { - srv.Angel app; - late srv.AngelHttp http; + srv.Protevus app; + late srv.ProtevusHttp http; ws.WebSockets? client; - srv.AngelWebSocket websockets; + srv.ProtevusWebSocket websockets; HttpServer? server; String? url; setUp(() async { - app = srv.Angel(reflector: MirrorsReflector()) + app = srv.Protevus(reflector: MirrorsReflector()) ..use('/api/todos', TodoService()); - http = srv.AngelHttp(app, useZone: false); + http = srv.ProtevusHttp(app, useZone: false); - websockets = srv.AngelWebSocket(app) + websockets = srv.ProtevusWebSocket(app) ..onData.listen((data) { print('Received by server: $data'); }); diff --git a/s b/s deleted file mode 100644 index e69de29b..00000000