Merge pull request #107 from dukefirehawk/feature/upgrade_sdk
Feature/upgrade sdk
This commit is contained in:
commit
811e68de70
72 changed files with 453 additions and 11583 deletions
|
@ -1,6 +1,6 @@
|
|||
# Angel3 Framework
|
||||
|
||||
[![Angel3 Framework](./logo3.png)](https://github.com/dukefirehawk/angel)
|
||||
[![Angel3 Framework](./angel3_logo.svg)](https://github.com/dukefirehawk/angel)
|
||||
|
||||
![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)
|
||||
|
|
148
angel3_logo.svg
Normal file
148
angel3_logo.svg
Normal file
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="128"
|
||||
height="128"
|
||||
viewBox="0 0 128 128"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.3 (0e150ed, 2023-07-21)"
|
||||
sodipodi:docname="angel3_logo128.svg"
|
||||
inkscape:export-filename="logo_icon_128.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
showgrid="true"
|
||||
inkscape:zoom="1.5862247"
|
||||
inkscape:cx="58.314563"
|
||||
inkscape:cy="90.466376"
|
||||
inkscape:window-width="1312"
|
||||
inkscape:window-height="738"
|
||||
inkscape:window-x="128"
|
||||
inkscape:window-y="89"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="layer1">
|
||||
<inkscape:grid
|
||||
id="grid1"
|
||||
units="px"
|
||||
originx="0"
|
||||
originy="0"
|
||||
spacingx="1"
|
||||
spacingy="1"
|
||||
empcolor="#0099e5"
|
||||
empopacity="0.30196078"
|
||||
color="#0099e5"
|
||||
opacity="0.14901961"
|
||||
empspacing="5"
|
||||
dotted="false"
|
||||
gridanglex="30"
|
||||
gridanglez="30"
|
||||
visible="true" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs1">
|
||||
<linearGradient
|
||||
id="swatch6">
|
||||
<stop
|
||||
style="stop-color:#d81c1c;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient15"
|
||||
inkscape:collect="always">
|
||||
<stop
|
||||
style="stop-color:#d81c1c;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop15" />
|
||||
<stop
|
||||
style="stop-color:#d81c1c;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop16" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="swatch13"
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#d81c1c;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop14" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="swatch7"
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#d81c1c;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop7" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#swatch13"
|
||||
id="linearGradient14"
|
||||
x1="76.307388"
|
||||
y1="264.40897"
|
||||
x2="425.84061"
|
||||
y2="264.40897"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient15"
|
||||
id="linearGradient16"
|
||||
x1="185.07693"
|
||||
y1="354.51111"
|
||||
x2="296.18161"
|
||||
y2="354.51111"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:137.557px;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;opacity:1;fill:#000000;fill-opacity:1;stroke-width:0.716443"
|
||||
x="-115.63483"
|
||||
y="107.96973"
|
||||
id="text1"
|
||||
transform="matrix(-0.01157892,-1.0160496,0.98407611,-0.01121455,0,0)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1"
|
||||
x="-115.63483"
|
||||
y="107.96973"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:137.557px;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke-width:0.716443">A</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:74.3369px;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;opacity:1;fill:#d81c1c;fill-opacity:1;stroke:#ffffff;stroke-width:0.980329;stroke-dasharray:none;stroke-opacity:1"
|
||||
x="-100.58853"
|
||||
y="107.32352"
|
||||
id="text2"
|
||||
transform="matrix(-1.1771598,0.04030269,0.03112649,0.84843667,0,0)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2"
|
||||
x="-100.58853"
|
||||
y="107.32352"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:74.3369px;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#d81c1c;fill-opacity:1;stroke:#ffffff;stroke-width:0.980329;stroke-dasharray:none;stroke-opacity:1">3</tspan></text>
|
||||
<circle
|
||||
style="fill:#d81c1c;fill-opacity:1;stroke:#ffffff;stroke-width:3.00094488;stroke-dasharray:none"
|
||||
id="path6"
|
||||
cx="25.217106"
|
||||
cy="52.325504"
|
||||
r="3.7825663" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
@ -1 +0,0 @@
|
|||
include: package:lints/recommended.yaml
|
|
@ -1,27 +0,0 @@
|
|||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
void main() async {
|
||||
print("Starting up");
|
||||
//Logger.root.onRecord.listen(print);
|
||||
|
||||
var app = Angel(logger: Logger('example'), reflector: MirrorsReflector());
|
||||
var http = AngelHttp(app);
|
||||
|
||||
app.get("/", (req, res) => "Hello, world!");
|
||||
|
||||
// Simple fallback to throw a 404 on unknown paths.
|
||||
/*
|
||||
app.fallback((req, res) {
|
||||
throw AngelHttpException.notFound(
|
||||
message: 'Unknown path: "${req.uri?.path}"',
|
||||
);
|
||||
});
|
||||
*/
|
||||
|
||||
await http.startServer('localhost', 3000);
|
||||
|
||||
print("End");
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
import 'dart:mirrors';
|
||||
import 'package:example1/src/models.dart';
|
||||
|
||||
void main() {
|
||||
final stopwatch = Stopwatch()..start();
|
||||
|
||||
var reflectedClass = reflect(Shape());
|
||||
|
||||
reflectedClass.invoke(#draw, []);
|
||||
|
||||
//reflectedClass.invoke(Symbol('draw'), []);
|
||||
|
||||
print('Reflection executed in ${stopwatch.elapsed.inMilliseconds} ms');
|
||||
stopwatch.stop();
|
||||
|
||||
printAnnotationValue(String);
|
||||
printAnnotationValue(Shape);
|
||||
printAnnotationValue(Square);
|
||||
}
|
||||
|
||||
class Shape {
|
||||
void draw() => print("Draw Shape");
|
||||
}
|
||||
|
||||
@Person('Will', 'Tom')
|
||||
class Square {
|
||||
void greetHii() {
|
||||
print("Hii Welcome to flutter agency");
|
||||
}
|
||||
}
|
||||
|
||||
void printAnnotationValue(final Type clazz) {
|
||||
final DeclarationMirror clazzDeclaration = reflectClass(clazz);
|
||||
final ClassMirror someAnnotationMirror = reflectClass(Person);
|
||||
final annotationInstsanceMirror =
|
||||
clazzDeclaration.metadata.where((d) => d.type == someAnnotationMirror);
|
||||
if (annotationInstsanceMirror.isEmpty) {
|
||||
print('No annotated class found');
|
||||
return;
|
||||
}
|
||||
final someAnnotationInstance =
|
||||
(annotationInstsanceMirror.first.reflectee as Person);
|
||||
print(someAnnotationInstance.firstName);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
class Person {
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
const Person(this.firstName, this.lastName);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
name: example1
|
||||
version: 0.0.1
|
||||
description: Example 1.
|
||||
environment:
|
||||
sdk: '>=2.18.0 <3.0.0'
|
||||
dependencies:
|
||||
angel3_container: ^7.0.0
|
||||
angel3_http_exception: ^7.0.0
|
||||
angel3_framework: ^7.0.0
|
||||
angel3_model: ^7.0.0
|
||||
angel3_route: ^7.0.0
|
||||
angel3_mock_request: ^7.0.0
|
||||
belatuk_merge_map: ^4.0.0
|
||||
belatuk_combinator: ^4.0.0
|
||||
belatuk_http_server: ^3.0.0
|
||||
charcode: ^1.2.0
|
||||
file: ^6.1.0
|
||||
http_parser: ^4.0.0
|
||||
http2: ^2.0.0
|
||||
logging: ^1.0.0
|
||||
matcher: ^0.12.10
|
||||
meta: ^1.3.0
|
||||
mime: ^1.0.0
|
||||
path: ^1.8.0
|
||||
quiver: ^3.0.1
|
||||
recase: ^4.0.0
|
||||
stack_trace: ^1.10.0
|
||||
string_scanner: ^1.1.0
|
||||
tuple: ^2.0.0
|
||||
uuid: ^3.0.1
|
||||
collection: ^1.15.0
|
||||
dev_dependencies:
|
||||
http: ^0.13.1
|
||||
io: ^1.0.0
|
||||
test: ^1.21.0
|
||||
lints: ^2.0.0
|
||||
# dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../container/angel_container
|
||||
# angel3_http_exception:
|
||||
# path: ../http_exception
|
||||
# angel3_model:
|
||||
# path: ../model
|
||||
# angel3_route:
|
||||
# path: ../route
|
||||
# angel3_mock_request:
|
||||
# path: ../mock_request
|
||||
|
|
@ -1 +0,0 @@
|
|||
include: package:lints/recommended.yaml
|
|
@ -1,46 +0,0 @@
|
|||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
|
||||
@Expose('/controller', method: 'GET')
|
||||
class MyController extends Controller {
|
||||
@Expose('/', method: 'GET')
|
||||
Future<String> route1(RequestContext req, ResponseContext res) async {
|
||||
return "My route";
|
||||
}
|
||||
}
|
||||
|
||||
@Expose('/sales', middleware: [process1])
|
||||
class SalesController extends Controller {
|
||||
@Expose('/', middleware: [process2])
|
||||
Future<String> route1(RequestContext req, ResponseContext res) async {
|
||||
return "Sales route";
|
||||
}
|
||||
}
|
||||
|
||||
bool process1(RequestContext req, ResponseContext res) {
|
||||
res.write('Hello, ');
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process2(RequestContext req, ResponseContext res) {
|
||||
res.write('From Sales, ');
|
||||
return true;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
// Using Mirror Reflector
|
||||
var app = Angel(reflector: MirrorsReflector());
|
||||
|
||||
// My Controller
|
||||
app.container.registerSingleton<MyController>(MyController());
|
||||
await app.mountController<MyController>();
|
||||
|
||||
// Sales Controller
|
||||
app.container.registerSingleton<SalesController>(SalesController());
|
||||
await app.mountController<SalesController>();
|
||||
|
||||
var http = AngelHttp(app);
|
||||
var server = await http.startServer('localhost', 3000);
|
||||
print("Angel server listening at ${http.uri}");
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
|
||||
class Todo extends Model {
|
||||
String? text;
|
||||
String? over;
|
||||
|
||||
Todo({this.text, this.over});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'text': text,
|
||||
'over': over,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Expose('/todo', method: 'GET')
|
||||
class TodoController extends Controller {
|
||||
@Expose('/')
|
||||
Todo todo(Todo singleton) => singleton;
|
||||
}
|
||||
|
||||
@Expose('/controller', method: 'GET')
|
||||
class MyController extends Controller {
|
||||
@Expose('/', method: 'GET')
|
||||
Future<String> route1(RequestContext req, ResponseContext res) async {
|
||||
return "My route";
|
||||
}
|
||||
|
||||
//Todo todo(Todo singleton) => singleton;
|
||||
}
|
||||
|
||||
@Expose('/sales', middleware: [process1])
|
||||
class SalesController extends Controller {
|
||||
@Expose('/', middleware: [process2])
|
||||
Future<String> route1(RequestContext req, ResponseContext res) async {
|
||||
return "Sales route";
|
||||
}
|
||||
}
|
||||
|
||||
bool process1(RequestContext req, ResponseContext res) {
|
||||
res.write('Hello, ');
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process2(RequestContext req, ResponseContext res) {
|
||||
res.write('From Sales, ');
|
||||
return true;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
// Using Mirror Reflector
|
||||
var app = Angel(reflector: MirrorsReflector());
|
||||
|
||||
await app.configure(MyController().configureServer);
|
||||
await app.configure(SalesController().configureServer);
|
||||
|
||||
var http = AngelHttp(app);
|
||||
var server = await http.startServer('localhost', 3000);
|
||||
print("Angel server listening at ${http.uri}");
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
import 'package:angel3_container_generator/angel3_container_generator.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
|
||||
import 'example3_controller.reflectable.dart';
|
||||
|
||||
@contained
|
||||
@Expose('/controller', method: 'GET')
|
||||
class MyController extends Controller {
|
||||
@Expose('/')
|
||||
Order order(Order singleton) => singleton;
|
||||
|
||||
//Todo todo(Todo singleton) => singleton;
|
||||
}
|
||||
|
||||
class Todo extends Model {
|
||||
String? text;
|
||||
String? over;
|
||||
|
||||
Todo({this.text, this.over});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'text': text,
|
||||
'over': over,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class FoodItem {
|
||||
final String name;
|
||||
final num price;
|
||||
final num qty;
|
||||
|
||||
FoodItem(this.name, this.price, this.qty);
|
||||
}
|
||||
|
||||
class Order {
|
||||
FoodItem item;
|
||||
|
||||
String? get name => item.name;
|
||||
|
||||
Order(this.item);
|
||||
}
|
||||
|
||||
void main() async {
|
||||
//var reflector = const GeneratedReflector();
|
||||
//Container container = Container(reflector);
|
||||
//container.registerSingleton<SalesController>(SalesController());
|
||||
|
||||
// Using GeneratedReflector
|
||||
initializeReflectable();
|
||||
var app = Angel(reflector: GeneratedReflector());
|
||||
|
||||
// Using MirrorReflector
|
||||
//var app = Angel(reflector: MirrorsReflector());
|
||||
//await app.configure(MyController().configureServer);
|
||||
|
||||
// My Controller
|
||||
//app.container.registerSingleton<MyController>(MyController());
|
||||
//await app.mountController<MyController>();
|
||||
await app.configure(MyController().configureServer);
|
||||
|
||||
// Sales Controller
|
||||
//app.container.registerSingleton<SalesController>(SalesController());
|
||||
//await app.mountController<SalesController>();
|
||||
|
||||
var http = AngelHttp(app);
|
||||
|
||||
var server = await http.startServer('localhost', 3000);
|
||||
print("Angel server listening at ${http.uri}");
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,44 +0,0 @@
|
|||
import 'package:example2/src/models.dart';
|
||||
|
||||
void main() {
|
||||
final stopwatch = Stopwatch()..start();
|
||||
|
||||
//var reflectedClass = reflect(Shape());
|
||||
|
||||
//reflectedClass.invoke(#draw, []);
|
||||
|
||||
//reflectedClass.invoke(Symbol('draw'), []);
|
||||
|
||||
print('Reflection executed in ${stopwatch.elapsed.inMilliseconds} ms');
|
||||
stopwatch.stop();
|
||||
|
||||
//printAnnotationValue(String);
|
||||
//printAnnotationValue(Shape);
|
||||
//printAnnotationValue(Square);
|
||||
}
|
||||
|
||||
class Shape {
|
||||
void draw() => print("Draw Shape");
|
||||
}
|
||||
|
||||
@Person('Will', 'Tom')
|
||||
class Square {
|
||||
void greetHii() {
|
||||
print("Hii Welcome to flutter agency");
|
||||
}
|
||||
}
|
||||
/*
|
||||
void printAnnotationValue(final Type clazz) {
|
||||
final DeclarationMirror clazzDeclaration = reflectClass(clazz);
|
||||
final ClassMirror someAnnotationMirror = reflectClass(Person);
|
||||
final annotationInstsanceMirror =
|
||||
clazzDeclaration.metadata.where((d) => d.type == someAnnotationMirror);
|
||||
if (annotationInstsanceMirror.isEmpty) {
|
||||
print('No annotated class found');
|
||||
return;
|
||||
}
|
||||
final someAnnotationInstance =
|
||||
(annotationInstsanceMirror.first.reflectee as Person);
|
||||
print(someAnnotationInstance.firstName);
|
||||
}
|
||||
*/
|
|
@ -1,9 +0,0 @@
|
|||
targets:
|
||||
$default:
|
||||
builders:
|
||||
reflectable:
|
||||
generate_for:
|
||||
#- lib/**_controller.dart
|
||||
- bin/**_controller.dart
|
||||
options:
|
||||
formatted: true
|
|
@ -1,15 +0,0 @@
|
|||
import 'package:angel3_container_generator/angel3_container_generator.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
|
||||
@Expose('/hr')
|
||||
class HrController extends Controller {
|
||||
@Expose('/')
|
||||
landingPage() => "Hello, world!";
|
||||
}
|
||||
|
||||
@contained
|
||||
class SalesController extends Controller {
|
||||
landingPage() => "Hello, world!";
|
||||
}
|
||||
|
||||
void main() {}
|
|
@ -1,5 +0,0 @@
|
|||
class Person {
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
const Person(this.firstName, this.lastName);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
name: example2
|
||||
version: 0.0.1
|
||||
description: Example 2.
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
dependencies:
|
||||
angel3_container: ^7.1.0-beta.1
|
||||
angel3_container_generator: ^7.1.0-beta.1
|
||||
angel3_http_exception: ^7.0.0
|
||||
angel3_framework: ^7.0.0
|
||||
angel3_model: ^7.0.0
|
||||
angel3_route: ^7.0.0
|
||||
angel3_mock_request: ^7.0.0
|
||||
belatuk_merge_map: ^4.0.0
|
||||
belatuk_combinator: ^4.0.0
|
||||
belatuk_http_server: ^3.0.0
|
||||
charcode: ^1.2.0
|
||||
file: ^6.1.0
|
||||
http_parser: ^4.0.0
|
||||
http2: ^2.0.0
|
||||
logging: ^1.0.0
|
||||
matcher: ^0.12.10
|
||||
meta: ^1.3.0
|
||||
mime: ^1.0.0
|
||||
path: ^1.8.0
|
||||
quiver: ^3.0.1
|
||||
recase: ^4.0.0
|
||||
stack_trace: ^1.10.0
|
||||
string_scanner: ^1.1.0
|
||||
tuple: ^2.0.0
|
||||
uuid: ^3.0.1
|
||||
collection: ^1.15.0
|
||||
reflectable: ^4.0.2
|
||||
dev_dependencies:
|
||||
build_runner: ^2.1.2
|
||||
http: ^0.13.1
|
||||
io: ^1.0.0
|
||||
test: ^1.21.0
|
||||
lints: ^2.0.0
|
||||
# dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../../../packages/container/angel_container
|
||||
# angel3_container_generator:
|
||||
# path: ../../../packages/container/angel_container_generator
|
||||
# angel3_framework:
|
||||
# path: ../../../packages/framework
|
||||
# angel3_model:
|
||||
# path: ../model
|
||||
# angel3_route:
|
||||
# path: ../route
|
||||
# angel3_mock_request:
|
||||
# path: ../mock_request
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import 'package:angel3_container_generator/angel3_container_generator.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
|
||||
@Expose('/hr')
|
||||
class HrController extends Controller {
|
||||
@Expose('/')
|
||||
landingPage() => "Hello, world!";
|
||||
}
|
||||
|
||||
@contained
|
||||
class SalesController extends Controller {
|
||||
|
||||
landingPage() => "Hello, world!";
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
Primary Authors
|
||||
===============
|
||||
|
||||
* __[Thomas Hii](dukefirehawk.apps@gmail.com)__
|
||||
|
||||
The current main maintainer of the code base.
|
|
@ -1,29 +0,0 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, dukefirehawk.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1 +0,0 @@
|
|||
include: package:lints/recommended.yaml
|
|
@ -1,93 +0,0 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:mysql_client/mysql_client.dart';
|
||||
import 'package:mysql1/mysql1.dart';
|
||||
|
||||
void main() async {
|
||||
print("=== Start 'mysql1' driver test");
|
||||
await testMySQL1Driver().catchError((error, stackTrace) {
|
||||
print(error);
|
||||
});
|
||||
print("=== End test");
|
||||
print(" ");
|
||||
|
||||
print("=== Start 'mysql_client' driver test");
|
||||
await testMySQLClientDriver().catchError((error, stackTrace) {
|
||||
print(error);
|
||||
});
|
||||
print("=== End test");
|
||||
print(" ");
|
||||
|
||||
//sleep(Duration(seconds: 5));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Future<void> testMySQLClientDriver() async {
|
||||
var connection = await MySQLConnection.createConnection(
|
||||
host: "localhost",
|
||||
port: 3306,
|
||||
databaseName: "orm_test",
|
||||
userName: "test",
|
||||
password: "test123",
|
||||
secure: false);
|
||||
await connection.connect(timeoutMs: 30000);
|
||||
|
||||
print(">Test Select All");
|
||||
var result = await connection.execute("SELECT * from users");
|
||||
print("Total records: ${result.rows.length}");
|
||||
|
||||
print(">Test Insert");
|
||||
var params = {
|
||||
"username": "test",
|
||||
"password": "test123",
|
||||
"email": "test@demo.com",
|
||||
"updatedAt": DateTime.parse("1970-01-01 00:00:00")
|
||||
};
|
||||
|
||||
result = await connection.execute(
|
||||
"INSERT INTO users (username, password, email, updated_at) VALUES (:username, :password, :email, :updatedAt)",
|
||||
params);
|
||||
print("Last inserted ID: ${result.lastInsertID}");
|
||||
|
||||
print(">Test Select By ID");
|
||||
result = await connection.execute(
|
||||
"SELECT * from users where id=:id", {"id": result.lastInsertID.toInt()});
|
||||
print("Read record: ${result.rows.first.assoc()}");
|
||||
}
|
||||
|
||||
Future<void> testMySQL1Driver() async {
|
||||
var settings = ConnectionSettings(
|
||||
host: 'localhost',
|
||||
port: 3306,
|
||||
db: 'orm_test',
|
||||
user: 'test',
|
||||
password: 'test123',
|
||||
timeout: Duration(seconds: 60));
|
||||
var connection = await MySqlConnection.connect(settings);
|
||||
|
||||
print(">Test Select All");
|
||||
var result = await connection.query("SELECT * from users");
|
||||
print("Total records: ${result.length}");
|
||||
|
||||
print(">Test Insert");
|
||||
var params = [
|
||||
"test",
|
||||
"test123",
|
||||
"test@demo.com",
|
||||
DateTime.parse("1970-01-01 00:00:00").toUtc()
|
||||
];
|
||||
|
||||
// DateTime.parse("1970-01-01 00:00:01").toUtc()
|
||||
result = await connection.query(
|
||||
"INSERT INTO users (username, password, email, updated_at) VALUES (?, ?, ?, ?)",
|
||||
params);
|
||||
print("Last inserted ID: ${result.insertId}");
|
||||
|
||||
print(">Test Select By ID");
|
||||
result = await connection
|
||||
.query("SELECT * from users where id=?", [result.insertId]);
|
||||
print("Read record: ${result.first.values}");
|
||||
|
||||
var d = DateTime.parse("1970-01-01 00:00:00").toUtc();
|
||||
print("Local time: ${d.toLocal()}");
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:postgres/postgres.dart';
|
||||
|
||||
void main() async {
|
||||
/*
|
||||
* Granting permission in postgres
|
||||
* grant all privileges on database orm_test to test;
|
||||
* grant all privileges on sequence users_id_seq to test;
|
||||
*/
|
||||
print("=== Start 'postgres' driver test");
|
||||
await testPgDriver().catchError((error, stackTrace) {
|
||||
print(error);
|
||||
});
|
||||
print("=== End test");
|
||||
print(" ");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Future<void> testPgDriver() async {
|
||||
var conn = PostgreSQLConnection('localhost', 5432, 'orm_test',
|
||||
username: 'test', password: 'test123');
|
||||
await conn.open();
|
||||
|
||||
print(">Test Select All");
|
||||
var result = await conn.query("SELECT * from users");
|
||||
print("Total records: ${result.length}");
|
||||
for (var row in result) {
|
||||
print(row[0]);
|
||||
for (var element in row) {
|
||||
print(element);
|
||||
}
|
||||
}
|
||||
|
||||
print(">Test Insert");
|
||||
var params = {
|
||||
"username": "test",
|
||||
"password": "test123",
|
||||
"email": "test@demo.com",
|
||||
"updatedAt": DateTime.parse("1970-01-01 00:00:00")
|
||||
};
|
||||
|
||||
result = await conn.query(
|
||||
"INSERT INTO users (username, password, email, updated_at) VALUES (@username, @password, @email, @updatedAt)",
|
||||
substitutionValues: params);
|
||||
//print("Last inserted ID: ${result.}");
|
||||
|
||||
//print(">Test Select By ID");
|
||||
//result = await conn.query("SELECT * from users where id=@id",
|
||||
// substitutionValues: {"id": result});
|
||||
//print("Read record: ${result.length}");
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
name: performance_tool
|
||||
version: 1.0.0
|
||||
description: Angel3 performance testing tool
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
published_to: none
|
||||
dependencies:
|
||||
mysql1: ^0.20.0
|
||||
mysql_client: ^0.0.24
|
||||
postgres: ^2.4.1
|
||||
postgres_pool: ^2.1.3
|
||||
dev_dependencies:
|
||||
lints: ^2.0.0
|
|
@ -1,6 +0,0 @@
|
|||
Primary Authors
|
||||
===============
|
||||
|
||||
* __[Thomas Hii](dukefirehawk.apps@gmail.com)__
|
||||
|
||||
The current main maintainer of the code base.
|
|
@ -1,29 +0,0 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, dukefirehawk.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1 +0,0 @@
|
|||
include: package:lints/recommended.yaml
|
|
@ -1,22 +0,0 @@
|
|||
import 'dart:isolate';
|
||||
|
||||
Future<void> runApp(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
// Do something
|
||||
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
}
|
||||
|
||||
void main() async {
|
||||
var concurrency = 6000;
|
||||
|
||||
for (var i = 0; i < concurrency; i++) {
|
||||
Isolate.spawn(runApp, 'Instance_$i');
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 10));
|
||||
|
||||
//print("Exit");
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
name: performance_tool
|
||||
version: 1.0.0
|
||||
description: Angel3 performance testing tool
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
published_to: none
|
||||
dependencies:
|
||||
http: ^0.13.4
|
||||
dev_dependencies:
|
||||
lints: ^2.0.0
|
|
@ -1,6 +0,0 @@
|
|||
Primary Authors
|
||||
===============
|
||||
|
||||
* __[Thomas Hii](dukefirehawk.apps@gmail.com)__
|
||||
|
||||
The current main maintainer of the code base.
|
|
@ -1,29 +0,0 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2021, dukefirehawk.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1 +0,0 @@
|
|||
include: package:lints/recommended.yaml
|
|
@ -1,104 +0,0 @@
|
|||
import 'dart:isolate';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
Future<void> fortunes(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/fortunes');
|
||||
var response = await http.get(url);
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): success');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> plaintext(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/plaintext');
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): ${response.body}.');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
}
|
||||
|
||||
Future<void> json(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/json');
|
||||
var response = await http.get(url);
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): success');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> dbUpdate(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/updates', {'queries': "5"});
|
||||
var response = await http.get(url);
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): success');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> dbSingleQuery(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/db');
|
||||
var response = await http.get(url);
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): success');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> dbMultipleQuery(var message) async {
|
||||
var stopwatch = Stopwatch()..start();
|
||||
|
||||
var url = Uri.http('localhost:8080', '/query', {'queries': "5"});
|
||||
var response = await http.get(url);
|
||||
print('Execution($message) Time: ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
stopwatch.stop();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print('Execution($message): success');
|
||||
} else {
|
||||
print('Execution($message): error');
|
||||
}
|
||||
}
|
||||
|
||||
void main() async {
|
||||
var concurrency = 2000;
|
||||
|
||||
for (var i = 0; i < concurrency; i++) {
|
||||
Isolate.spawn(dbSingleQuery, 'Instance_$i');
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 10));
|
||||
|
||||
//print("Exit");
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
name: performance_tool
|
||||
version: 1.0.0
|
||||
description: Angel3 performance testing tool
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
published_to: none
|
||||
dependencies:
|
||||
http: ^0.13.4
|
||||
dev_dependencies:
|
||||
lints: ^2.0.0
|
|
@ -1,19 +0,0 @@
|
|||
### JSON Test
|
||||
GET http://localhost:8080/json HTTP/1.1
|
||||
|
||||
### Plaintext Test
|
||||
GET http://localhost:8080/plaintext HTTP/1.1
|
||||
|
||||
### Fortunes Test
|
||||
GET http://localhost:8080/fortunes HTTP/1.1
|
||||
|
||||
### Db Test
|
||||
GET http://localhost:8080/db HTTP/1.1
|
||||
|
||||
### Query test
|
||||
GET http://localhost:8080/query?queries=20 HTTP/1.1
|
||||
|
||||
### Update Test
|
||||
GET http://localhost:8080/updates?queries=20 HTTP/1.1
|
||||
|
||||
|
BIN
logo3.xcf
BIN
logo3.xcf
Binary file not shown.
BIN
logo_icon_512.png
Normal file
BIN
logo_icon_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Updated `uuid` to 4.0.0
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
|
|
|
@ -108,6 +108,8 @@ abstract class Driver<
|
|||
|
||||
/// Handles a single request.
|
||||
Future handleRawRequest(Request request, Response response) {
|
||||
app.logger.info('[Server] Called handleRawRequest');
|
||||
|
||||
return createRequestContext(request, response).then((req) {
|
||||
return createResponseContext(request, response, req).then((res) {
|
||||
Future handle() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_framework
|
||||
version: 8.0.0
|
||||
version: 8.1.0
|
||||
description: A high-powered HTTP server extensible framework with dependency injection, routing and much more.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/framework
|
||||
|
@ -28,7 +28,7 @@ dependencies:
|
|||
stack_trace: ^1.11.0
|
||||
string_scanner: ^1.2.0
|
||||
tuple: ^2.0.0
|
||||
uuid: ^3.0.0
|
||||
uuid: ^4.0.0
|
||||
collection: ^1.17.0
|
||||
dev_dependencies:
|
||||
http: ^1.0.0
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Upgraded to `analyzer` 6.2.x
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
name: jael3_web
|
||||
version: 8.0.0
|
||||
version: 8.1.0
|
||||
description: Experimental virtual DOM/SPA engine built on Jael3. Supports SSR.
|
||||
publish_to: none
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
dependencies:
|
||||
analyzer: ^5.0.0
|
||||
analyzer: ^6.2.0
|
||||
build: ^2.0.2
|
||||
build_config: ^1.0.0
|
||||
code_builder: ^4.0.0
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Update `jinja` to 0.5.0
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
name: angel3_jinja
|
||||
version: 8.0.0
|
||||
version: 8.1.0
|
||||
description: A service that renders Jinja2 template into HTML view for Angel3. Ported from Python to Dart.
|
||||
homepage: https://github.com/dukefirehawk/angel/tree/master/packages/jinja
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
dependencies:
|
||||
angel3_framework: ^8.0.0
|
||||
jinja: ^0.4.2
|
||||
jinja: ^0.5.0
|
||||
dev_dependencies:
|
||||
angel3_test: ^8.0.0
|
||||
path: ^1.8.0
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
# Change Log
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
* Upgraded `mongo_dart` to 0.9.3
|
||||
|
||||
## 7.0.0
|
||||
|
||||
* Require Dart >= 2.17
|
||||
|
|
|
@ -9,21 +9,21 @@ dependencies:
|
|||
angel3_framework: ^8.0.0
|
||||
belatuk_json_serializer: ^7.0.0
|
||||
belatuk_merge_map: ^5.0.0
|
||||
mongo_dart: ^0.7.0
|
||||
mongo_dart: ^0.9.0
|
||||
dev_dependencies:
|
||||
http: ^1.0.0
|
||||
test: ^1.24.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
|
||||
# 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
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Updated to `uuid`
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
|
|
|
@ -20,8 +20,8 @@ In your `pubspec.yaml`:
|
|||
|
||||
```yaml
|
||||
dependencies:
|
||||
angel3_framework: ^6.0.0
|
||||
angel3_oauth2: ^6.0.0
|
||||
angel3_framework: ^8.0.0
|
||||
angel3_oauth2: ^8.0.0
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
94
packages/oauth2/example/example1.dart
Normal file
94
packages/oauth2/example/example1.dart
Normal file
|
@ -0,0 +1,94 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_oauth2/angel3_oauth2.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
import '../test/common.dart';
|
||||
|
||||
void main() {
|
||||
Logger.root.level = Level.ALL;
|
||||
Logger.root.onRecord.listen((record) {
|
||||
print(
|
||||
'${record.time} ${record.level.name.padLeft(6, ' ')} [${record.loggerName}] : ${record.message}');
|
||||
if (record.error != null) print(record.error);
|
||||
if (record.stackTrace != null) print(record.stackTrace);
|
||||
});
|
||||
|
||||
// Declae the function
|
||||
void setUp() async {
|
||||
var app = Angel(reflector: MirrorsReflector());
|
||||
var oauth2 = _AuthorizationServer();
|
||||
|
||||
app.group('/oauth2', (router) {
|
||||
router
|
||||
..get('/authorize', oauth2.authorizationEndpoint)
|
||||
..post('/token', oauth2.tokenEndpoint);
|
||||
});
|
||||
|
||||
//app.logger.level = Level.ALL;
|
||||
app.logger = Logger("oauth2")
|
||||
..onRecord.listen((rec) {
|
||||
print(rec);
|
||||
if (rec.error != null) print(rec.error);
|
||||
if (rec.stackTrace != null) print(rec.stackTrace);
|
||||
});
|
||||
|
||||
app.errorHandler = (e, req, res) async {
|
||||
res.json(e.toJson());
|
||||
};
|
||||
}
|
||||
|
||||
setUp();
|
||||
}
|
||||
|
||||
class _AuthorizationServer
|
||||
extends AuthorizationServer<PseudoApplication, PseudoUser> {
|
||||
var logger = Logger('AuthorizationServer');
|
||||
|
||||
@override
|
||||
PseudoApplication? findClient(String? clientId) {
|
||||
return clientId == pseudoApplication.id ? pseudoApplication : null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> verifyClient(
|
||||
PseudoApplication client, String? clientSecret) async {
|
||||
return client.secret == clientSecret;
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<DeviceCodeResponse> requestDeviceCode(PseudoApplication client,
|
||||
Iterable<String> scopes, RequestContext req, ResponseContext res) {
|
||||
return DeviceCodeResponse(
|
||||
'foo',
|
||||
'bar',
|
||||
Uri.parse('https://regiostech.com')
|
||||
.replace(queryParameters: {'scopes': scopes.join(',')}),
|
||||
3600);
|
||||
}
|
||||
|
||||
@override
|
||||
FutureOr<AuthorizationTokenResponse> exchangeDeviceCodeForToken(
|
||||
PseudoApplication client,
|
||||
String? deviceCode,
|
||||
String state,
|
||||
RequestContext req,
|
||||
ResponseContext res) {
|
||||
print("[Server] exchangeDeviceCodeForToken");
|
||||
print("[Server] $deviceCode");
|
||||
print("[Server] $client");
|
||||
|
||||
if (deviceCode == 'brute') {
|
||||
print("[Server] Throws AuthorizationException");
|
||||
|
||||
throw AuthorizationException(ErrorResponse(
|
||||
ErrorResponse.slowDown,
|
||||
'Ho, brother! Ho, whoa, whoa, whoa now! You got too much dip on your chip!',
|
||||
state));
|
||||
}
|
||||
|
||||
return AuthorizationTokenResponse('foo');
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'exception.dart';
|
||||
import 'pkce.dart';
|
||||
import 'response.dart';
|
||||
|
@ -51,6 +52,8 @@ Future<Iterable<String>> _getScopes(RequestContext req,
|
|||
|
||||
/// An OAuth2 authorization server, which issues access tokens to third parties.
|
||||
abstract class AuthorizationServer<Client, User> {
|
||||
static Logger logger = Logger('AuthorizationServer');
|
||||
|
||||
const AuthorizationServer();
|
||||
|
||||
static const String _internalServerError =
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_oauth2
|
||||
version: 8.0.0
|
||||
version: 8.1.0
|
||||
description: A class containing handlers that can be used within Angel to build a spec-compliant OAuth 2.0 server.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/oauth2
|
||||
|
@ -11,14 +11,15 @@ dependencies:
|
|||
angel3_http_exception: ^8.0.0
|
||||
crypto: ^3.0.1
|
||||
collection: ^1.17.0
|
||||
logging: ^1.2.0
|
||||
dev_dependencies:
|
||||
angel3_validate: ^8.0.0
|
||||
angel3_test: ^8.0.0
|
||||
logging: ^1.2.0
|
||||
angel3_container: ^8.0.0
|
||||
oauth2: ^2.0.0
|
||||
lints: ^2.1.0
|
||||
test: ^1.24.0
|
||||
uuid: ^3.0.0
|
||||
uuid: ^4.0.0
|
||||
dependency_overrides:
|
||||
angel3_container:
|
||||
path: ../container/angel_container
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_test/angel3_test.dart';
|
||||
import 'package:angel3_oauth2/angel3_oauth2.dart';
|
||||
|
@ -10,7 +11,7 @@ void main() {
|
|||
late TestClient client;
|
||||
|
||||
setUp(() async {
|
||||
var app = Angel();
|
||||
var app = Angel(reflector: MirrorsReflector());
|
||||
var oauth2 = _AuthorizationServer();
|
||||
|
||||
app.group('/oauth2', (router) {
|
||||
|
@ -19,7 +20,8 @@ void main() {
|
|||
..post('/token', oauth2.tokenEndpoint);
|
||||
});
|
||||
|
||||
app.logger = Logger('angel_oauth2')
|
||||
//app.logger.level = Level.ALL;
|
||||
app.logger = Logger("oauth2")
|
||||
..onRecord.listen((rec) {
|
||||
print(rec);
|
||||
if (rec.error != null) print(rec.error);
|
||||
|
@ -113,7 +115,8 @@ void main() {
|
|||
'device_code': 'brute',
|
||||
});
|
||||
|
||||
print(response.body);
|
||||
print("[Client] ${response.headers}");
|
||||
print("[Client] ${response.body}");
|
||||
expect(
|
||||
response,
|
||||
allOf(
|
||||
|
@ -130,6 +133,8 @@ void main() {
|
|||
|
||||
class _AuthorizationServer
|
||||
extends AuthorizationServer<PseudoApplication, PseudoUser> {
|
||||
var logger = Logger('AuthorizationServer');
|
||||
|
||||
@override
|
||||
PseudoApplication? findClient(String? clientId) {
|
||||
return clientId == pseudoApplication.id ? pseudoApplication : null;
|
||||
|
@ -159,7 +164,13 @@ class _AuthorizationServer
|
|||
String state,
|
||||
RequestContext req,
|
||||
ResponseContext res) {
|
||||
print("[Server] exchangeDeviceCodeForToken");
|
||||
print("[Server] $deviceCode");
|
||||
print("[Server] $client");
|
||||
|
||||
if (deviceCode == 'brute') {
|
||||
print("[Server] Throws AuthorizationException");
|
||||
|
||||
throw AuthorizationException(ErrorResponse(
|
||||
ErrorResponse.slowDown,
|
||||
'Ho, brother! Ho, whoa, whoa, whoa now! You got too much dip on your chip!',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_framework/angel3_framework.dart';
|
||||
import 'package:angel3_framework/http.dart';
|
||||
import 'package:angel3_oauth2/angel3_oauth2.dart';
|
||||
|
@ -14,7 +15,7 @@ void main() {
|
|||
late TestClient testClient;
|
||||
|
||||
setUp(() async {
|
||||
app = Angel();
|
||||
app = Angel(reflector: MirrorsReflector());
|
||||
app.container.registerSingleton(AuthCodes());
|
||||
|
||||
var server = _Server();
|
||||
|
|
|
@ -27,6 +27,7 @@ void main(List<String> args) async {
|
|||
password: "Test123*",
|
||||
secure: false);
|
||||
|
||||
// ignore: unused_local_variable
|
||||
var mysqlMigrationRunner = MySqlMigrationRunner(
|
||||
mySQLConn,
|
||||
migrations: [
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Upgraded to `analyzer` 6.2.x
|
||||
|
||||
## 8.0.0
|
||||
|
||||
* Require Dart >= 3.0
|
||||
|
|
|
@ -9,15 +9,29 @@ part of 'main.dart';
|
|||
class EmployeeMigration extends Migration {
|
||||
@override
|
||||
void up(Schema schema) {
|
||||
schema.create('employees', (table) {
|
||||
schema.create(
|
||||
'employees',
|
||||
(table) {
|
||||
table.serial('id').primaryKey();
|
||||
table.timeStamp('created_at');
|
||||
table.timeStamp('updated_at');
|
||||
table.varChar('unique_id', length: 255).unique();
|
||||
table.varChar('first_name', length: 255);
|
||||
table.varChar('last_name', length: 255);
|
||||
table
|
||||
.varChar(
|
||||
'unique_id',
|
||||
length: 255,
|
||||
)
|
||||
.unique();
|
||||
table.varChar(
|
||||
'first_name',
|
||||
length: 255,
|
||||
);
|
||||
table.varChar(
|
||||
'last_name',
|
||||
length: 255,
|
||||
);
|
||||
table.double('salary');
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -31,8 +45,10 @@ class EmployeeMigration extends Migration {
|
|||
// **************************************************************************
|
||||
|
||||
class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
|
||||
EmployeeQuery({Query? parent, Set<String>? trampoline})
|
||||
: super(parent: parent) {
|
||||
EmployeeQuery({
|
||||
Query? parent,
|
||||
Set<String>? trampoline,
|
||||
}) : super(parent: parent) {
|
||||
trampoline ??= <String>{};
|
||||
trampoline.add(tableName);
|
||||
_where = EmployeeQueryWhere(this);
|
||||
|
@ -47,7 +63,7 @@ class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
|
|||
|
||||
@override
|
||||
Map<String, String> get casts {
|
||||
return {'salary': 'char'};
|
||||
return {};
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -64,7 +80,7 @@ class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
|
|||
'unique_id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'salary'
|
||||
'salary',
|
||||
];
|
||||
return _selectedFields.isEmpty
|
||||
? _fields
|
||||
|
@ -92,16 +108,15 @@ class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
|
|||
}
|
||||
var model = Employee(
|
||||
id: fields.contains('id') ? row[0].toString() : null,
|
||||
createdAt: fields.contains('created_at')
|
||||
? mapToNullableDateTime(row[1])
|
||||
: null,
|
||||
updatedAt: fields.contains('updated_at')
|
||||
? mapToNullableDateTime(row[2])
|
||||
: null,
|
||||
createdAt:
|
||||
fields.contains('created_at') ? mapToNullableDateTime(row[1]) : null,
|
||||
updatedAt:
|
||||
fields.contains('updated_at') ? mapToNullableDateTime(row[2]) : null,
|
||||
uniqueId: fields.contains('unique_id') ? (row[3] as String?) : null,
|
||||
firstName: fields.contains('first_name') ? (row[4] as String?) : null,
|
||||
lastName: fields.contains('last_name') ? (row[5] as String?) : null,
|
||||
salary: fields.contains('salary') ? mapToDouble(row[6]) : null);
|
||||
salary: fields.contains('salary') ? mapToDouble(row[6]) : null,
|
||||
);
|
||||
return Optional.of(model);
|
||||
}
|
||||
|
||||
|
@ -113,13 +128,34 @@ class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
|
|||
|
||||
class EmployeeQueryWhere extends QueryWhere {
|
||||
EmployeeQueryWhere(EmployeeQuery query)
|
||||
: id = NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||
createdAt = DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||
updatedAt = DateTimeSqlExpressionBuilder(query, 'updated_at'),
|
||||
uniqueId = StringSqlExpressionBuilder(query, 'unique_id'),
|
||||
firstName = StringSqlExpressionBuilder(query, 'first_name'),
|
||||
lastName = StringSqlExpressionBuilder(query, 'last_name'),
|
||||
salary = NumericSqlExpressionBuilder<double>(query, 'salary');
|
||||
: id = NumericSqlExpressionBuilder<int>(
|
||||
query,
|
||||
'id',
|
||||
),
|
||||
createdAt = DateTimeSqlExpressionBuilder(
|
||||
query,
|
||||
'created_at',
|
||||
),
|
||||
updatedAt = DateTimeSqlExpressionBuilder(
|
||||
query,
|
||||
'updated_at',
|
||||
),
|
||||
uniqueId = StringSqlExpressionBuilder(
|
||||
query,
|
||||
'unique_id',
|
||||
),
|
||||
firstName = StringSqlExpressionBuilder(
|
||||
query,
|
||||
'first_name',
|
||||
),
|
||||
lastName = StringSqlExpressionBuilder(
|
||||
query,
|
||||
'last_name',
|
||||
),
|
||||
salary = NumericSqlExpressionBuilder<double>(
|
||||
query,
|
||||
'salary',
|
||||
);
|
||||
|
||||
final NumericSqlExpressionBuilder<int> id;
|
||||
|
||||
|
@ -137,14 +173,22 @@ class EmployeeQueryWhere extends QueryWhere {
|
|||
|
||||
@override
|
||||
List<SqlExpressionBuilder> get expressionBuilders {
|
||||
return [id, createdAt, updatedAt, uniqueId, firstName, lastName, salary];
|
||||
return [
|
||||
id,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
uniqueId,
|
||||
firstName,
|
||||
lastName,
|
||||
salary,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class EmployeeQueryValues extends MapQueryValues {
|
||||
@override
|
||||
Map<String, String> get casts {
|
||||
return {'salary': 'double precision'};
|
||||
return {};
|
||||
}
|
||||
|
||||
String? get id {
|
||||
|
@ -198,14 +242,15 @@ class EmployeeQueryValues extends MapQueryValues {
|
|||
|
||||
@generatedSerializable
|
||||
class Employee extends _Employee {
|
||||
Employee(
|
||||
{this.id,
|
||||
Employee({
|
||||
this.id,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.uniqueId,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
this.salary});
|
||||
this.salary,
|
||||
});
|
||||
|
||||
/// A unique identifier corresponding to this item.
|
||||
@override
|
||||
|
@ -231,14 +276,15 @@ class Employee extends _Employee {
|
|||
@override
|
||||
double? salary;
|
||||
|
||||
Employee copyWith(
|
||||
{String? id,
|
||||
Employee copyWith({
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
String? uniqueId,
|
||||
String? firstName,
|
||||
String? lastName,
|
||||
double? salary}) {
|
||||
double? salary,
|
||||
}) {
|
||||
return Employee(
|
||||
id: id ?? this.id,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
|
@ -263,8 +309,15 @@ class Employee extends _Employee {
|
|||
|
||||
@override
|
||||
int get hashCode {
|
||||
return hashObjects(
|
||||
[id, createdAt, updatedAt, uniqueId, firstName, lastName, salary]);
|
||||
return hashObjects([
|
||||
id,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
uniqueId,
|
||||
firstName,
|
||||
lastName,
|
||||
salary,
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -347,7 +400,7 @@ abstract class EmployeeFields {
|
|||
uniqueId,
|
||||
firstName,
|
||||
lastName,
|
||||
salary
|
||||
salary,
|
||||
];
|
||||
|
||||
static const String id = 'id';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_orm_generator
|
||||
version: 8.0.0
|
||||
version: 8.1.0
|
||||
description: Code generators for Angel3 ORM. Generates query builder classes.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/orm/angel_orm_generator
|
||||
|
@ -10,7 +10,7 @@ dependencies:
|
|||
angel3_serialize: ^8.0.0
|
||||
angel3_orm: ^8.0.0
|
||||
angel3_serialize_generator: ^8.0.0
|
||||
analyzer: ^5.13.0
|
||||
analyzer: ^6.2.0
|
||||
inflection3: ^0.5.3+2
|
||||
build: ^2.4.0
|
||||
build_config: ^1.1.0
|
||||
|
@ -30,7 +30,7 @@ dev_dependencies:
|
|||
postgres: ^2.4.0
|
||||
test: ^1.24.0
|
||||
lints: ^2.1.0
|
||||
# dependency_overrides:
|
||||
dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../../container/angel_container
|
||||
# angel3_framework:
|
||||
|
@ -45,8 +45,8 @@ dev_dependencies:
|
|||
# path: ../../mock_request
|
||||
# angel3_serialize:
|
||||
# path: ../../serialize/angel_serialize
|
||||
# angel3_serialize_generator:
|
||||
# path: ../../serialize/angel_serialize_generator
|
||||
angel3_serialize_generator:
|
||||
path: ../../serialize/angel_serialize_generator
|
||||
# angel3_orm:
|
||||
# path: ../angel_orm
|
||||
# angel3_migration:
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 8.1.0
|
||||
|
||||
* Upgraded to `analyzer` 6.2.x
|
||||
|
||||
## 8.0.1
|
||||
|
||||
* Fixed `JsonModelGenerator` from generating duplicated fields
|
||||
|
|
|
@ -5,6 +5,25 @@
|
|||
[![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/serialize/angel_serialize_generator/LICENSE)
|
||||
|
||||
The builder for Angel3 model serialization.
|
||||
The builder for Angel3 serialization.
|
||||
|
||||
Find documentation in the main [serialize project repo](https://github.com/dukefirehawk/angel/tree/master/packages/serialize)
|
||||
## Usage
|
||||
|
||||
1. Create a model class in `todo.dart` and annotate it with `@serializable`
|
||||
|
||||
```dart
|
||||
import 'package:angel3_serialize/angel3_serialize.dart';
|
||||
part 'todo.g.dart';
|
||||
|
||||
@serializable
|
||||
class _Todo {
|
||||
String? text;
|
||||
bool? completed;
|
||||
}
|
||||
```
|
||||
|
||||
2. Run the following command to generate the associated `todo.g.dart` file for serialization.
|
||||
|
||||
```bash
|
||||
dart run build_runner build
|
||||
```
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
name: angel3_serialize_generator
|
||||
version: 8.0.1
|
||||
version: 8.1.0
|
||||
description: Angel3 model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/serialize/angel_serialize_generator
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
dependencies:
|
||||
analyzer: ^5.0.0
|
||||
analyzer: ^6.2.0
|
||||
angel3_model: ^8.0.0
|
||||
angel3_serialize: ^8.0.0
|
||||
belatuk_code_buffer: ^5.0.0
|
||||
|
|
Loading…
Reference in a new issue