From 6506a3e0de96d51d7d0e3dfa1c65c489c9206d35 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Fri, 27 Oct 2023 23:52:29 +0800 Subject: [PATCH] Updated validate --- packages/auth_twitter/CHANGELOG.md | 5 ++++ packages/auth_twitter/LICENSE | 2 +- packages/auth_twitter/pubspec.yaml | 33 +++++++++++++------------- packages/test/README.md | 6 ++--- packages/validate/README.md | 23 +++++++----------- packages/validate/pubspec.yaml | 2 +- packages/validate/test/basic_test.dart | 3 +-- packages/validate/web/index.html | 2 +- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/packages/auth_twitter/CHANGELOG.md b/packages/auth_twitter/CHANGELOG.md index 1fba24f8..80e655a6 100644 --- a/packages/auth_twitter/CHANGELOG.md +++ b/packages/auth_twitter/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 8.0.0 + +* Require Dart >= 3.0 +* Updated `oauth1` to `belatuk_oauth1` + ## 7.0.0 * Require Dart >= 2.17 diff --git a/packages/auth_twitter/LICENSE b/packages/auth_twitter/LICENSE index df5e0635..2bcd0235 100644 --- a/packages/auth_twitter/LICENSE +++ b/packages/auth_twitter/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021, dukefirehawk.com +Copyright (c) 2023, dukefirehawk.com All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/packages/auth_twitter/pubspec.yaml b/packages/auth_twitter/pubspec.yaml index efe2fae9..6032b8a4 100644 --- a/packages/auth_twitter/pubspec.yaml +++ b/packages/auth_twitter/pubspec.yaml @@ -6,29 +6,28 @@ repository: https://github.com/dukefirehawk/angel/tree/master/packages/auth_twit publish_to: none environment: sdk: ">=3.0.0 <4.0.0" -published_to: none dependencies: angel3_auth: ^8.0.0 angel3_framework: ^8.0.0 http: ^1.0.0 path: ^1.0.0 - oauth1: ^2.0.0 + belatuk_oauth1: ^3.0.0 dart_twitter_api: ^0.5.6+1 dev_dependencies: logging: ^1.2.0 lints: ^2.1.0 -dependency_overrides: - angel3_container: - path: ../container/angel_container - angel3_framework: - path: ../framework - angel3_http_exception: - path: ../http_exception - angel3_model: - path: ../model - angel3_route: - path: ../route - angel3_mock_request: - path: ../mock_request - angel3_auth: - path: ../auth \ No newline at end of file +# dependency_overrides: +# angel3_container: +# path: ../container/angel_container +# angel3_framework: +# path: ../framework +# angel3_http_exception: +# path: ../http_exception +# angel3_model: +# path: ../model +# angel3_route: +# path: ../route +# angel3_mock_request: +# path: ../mock_request +# angel3_auth: +# path: ../auth \ No newline at end of file diff --git a/packages/test/README.md b/packages/test/README.md index ec25181a..b2b66bd3 100644 --- a/packages/test/README.md +++ b/packages/test/README.md @@ -1,11 +1,11 @@ -# Angel3 Testing Library +# Angel3 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) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/test/LICENSE) -Testing utility library for the Angel3 framework. +Testing utility library for Angel3 framework. ## TestClient @@ -51,7 +51,7 @@ void test('error', () async { ```dart test('validate response', () async { var res = await client.get('/bar'); - expect(res, hasValidBody(new Validator({ + expect(res, hasValidBody(Validator({ 'foo': isBoolean, 'bar': [isString, equals('baz')], 'age*': [], diff --git a/packages/validate/README.md b/packages/validate/README.md index 81e0fd0f..e13ce601 100644 --- a/packages/validate/README.md +++ b/packages/validate/README.md @@ -1,17 +1,15 @@ -# Angel3 Request Validator +# Angel3 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) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) [![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/master/packages/validate/LICENSE) -Validation library based on the `matcher` library, with Angel3 support. Why re-invent the wheel, when you can use the same validators you already use for tests? - -This library runs both on the server, and on the client. Thus, you can use the same validation rules for forms on the server, and on the frontend. +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. For convenience's sake, this library also exports `matcher`. -- [Angel3 Request Validator](#angel3-request-validator) +- [Angel3 Validate](#angel3-validate) - [Examples](#examples) - [Creating a Validator](#creating-a-validator) - [Validating data](#validating-data) @@ -25,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 Angel](#use-with-angel) + - [Use with Angel3](#use-with-angel3) ## Examples @@ -82,9 +80,7 @@ main() { ### Required Fields -Fields are optional by default. - -Suffix a field name with a `'*'` to mark it as required, and to throw an error if it is not present. +Fields are optional by default. Suffix a field name with a `'*'` to mark it as required, and to throw an error if it is not present. ```dart main() { @@ -118,9 +114,7 @@ Default values can also be parameterless, *synchronous* functions that return a ### Custom Validator Functions -Creating a whole `Matcher` class is sometimes cumbersome, but if you pass a function to the constructor, it will be wrapped in a `Matcher` instance. - -(It simply returns the value of calling [`predicate`](https://pub.dev/documentation/matcher/latest/matcher/predicate.html).) +Creating a whole `Matcher` class is sometimes cumbersome, but if you pass a function to the constructor, it will be wrapped in a `Matcher` instance. (It simply returns the value of calling [`predicate`](https://pub.dev/documentation/matcher/latest/matcher/predicate.html).) The function must *synchronously* return a `bool`. @@ -151,8 +145,7 @@ The string `{{value}}` will be replaced inside your error message automatically. ### autoParse -Oftentimes, fields that we want to validate as numbers are passed as strings. -Calling `autoParse` will correct this before validation. +Oftentimes, fields that we want to validate as numbers are passed as strings. Calling `autoParse` will correct this before validation. ```dart main() { @@ -263,7 +256,7 @@ main() { } ``` -### Use with Angel +### Use with Angel3 `server.dart` exposes seven helper middleware: diff --git a/packages/validate/pubspec.yaml b/packages/validate/pubspec.yaml index c9869a5b..06b946e6 100644 --- a/packages/validate/pubspec.yaml +++ b/packages/validate/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_validate -description: Cross-platform request body validation library based on `matcher`. +description: Cross-platform HTTP request body validator library based on `matcher`. version: 8.0.0 homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/validate diff --git a/packages/validate/test/basic_test.dart b/packages/validate/test/basic_test.dart index c40a6a41..68ea10e1 100644 --- a/packages/validate/test/basic_test.dart +++ b/packages/validate/test/basic_test.dart @@ -31,8 +31,7 @@ void main() { expect(() { todoSchema .enforce({'id': 'fool', 'text': 'Hello, world!', 'completed': 4}); - // ignore: deprecated_member_use - }, throwsA(isInstanceOf())); + }, throwsA(isA())); }); test('filter', () { diff --git a/packages/validate/web/index.html b/packages/validate/web/index.html index f3621c7a..803aef06 100644 --- a/packages/validate/web/index.html +++ b/packages/validate/web/index.html @@ -2,7 +2,7 @@ - angel_validate + angel3_validate