diff --git a/.continuerc.json b/.continuerc.json index c3602db..e6dcd40 100644 --- a/.continuerc.json +++ b/.continuerc.json @@ -10,7 +10,5 @@ "description": "Write unit tests for highlighted code" } ], - "contextProviders": [], - "slashCommands": [], "allowAnonymousTelemetry": false } \ No newline at end of file diff --git a/.pkb/.copies.md b/.pkb/.copies.md new file mode 100644 index 0000000..9853cf7 --- /dev/null +++ b/.pkb/.copies.md @@ -0,0 +1,18 @@ + "reranker": { + "name": "cohere", + "params": { + "apiBase": "https://api.jina.ai/v1/", + "apiKey": "api", + "model": "jina-reranker-v2-base-multilingual" + } + } + + What do you mean here by out of order? One thing you can try first is increasing the "completionOptions.maxTokens" in config.json + + "slashCommands": [ + { + "name": "edit", + "description": "Edit highlighted code" + } + ] + "contextProviders": [], \ No newline at end of file diff --git a/packages/auth/example/.gitkeep b/packages/auth/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/auth/example/protevus_auth_example.dart b/packages/auth/example/protevus_auth_example.dart deleted file mode 100644 index fc427d2..0000000 --- a/packages/auth/example/protevus_auth_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_auth/protevus_auth.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/auth/lib/protevus_auth.dart b/packages/auth/lib/protevus_auth.dart deleted file mode 100644 index 6a6d3cf..0000000 --- a/packages/auth/lib/protevus_auth.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_auth_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/auth/lib/src/.gitkeep b/packages/auth/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/auth/lib/src/protevus_auth_base.dart b/packages/auth/lib/src/protevus_auth_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/auth/lib/src/protevus_auth_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/auth/test/.gitkeep b/packages/auth/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/auth/test/protevus_auth_test.dart b/packages/auth/test/protevus_auth_test.dart deleted file mode 100644 index fe6c46f..0000000 --- a/packages/auth/test/protevus_auth_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_auth/protevus_auth.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/broadcasting/example/.gitkeep b/packages/broadcasting/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/broadcasting/example/protevus_broadcasting_example.dart b/packages/broadcasting/example/protevus_broadcasting_example.dart deleted file mode 100644 index b1fae50..0000000 --- a/packages/broadcasting/example/protevus_broadcasting_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_broadcasting/protevus_broadcasting.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/broadcasting/lib/protevus_broadcasting.dart b/packages/broadcasting/lib/protevus_broadcasting.dart deleted file mode 100644 index 2072374..0000000 --- a/packages/broadcasting/lib/protevus_broadcasting.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_broadcasting_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/broadcasting/lib/src/.gitkeep b/packages/broadcasting/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/broadcasting/lib/src/protevus_broadcasting_base.dart b/packages/broadcasting/lib/src/protevus_broadcasting_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/broadcasting/lib/src/protevus_broadcasting_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/broadcasting/test/.gitkeep b/packages/broadcasting/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/broadcasting/test/protevus_broadcasting_test.dart b/packages/broadcasting/test/protevus_broadcasting_test.dart deleted file mode 100644 index add62ba..0000000 --- a/packages/broadcasting/test/protevus_broadcasting_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_broadcasting/protevus_broadcasting.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/bus/example/.gitkeep b/packages/bus/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/bus/example/protevus_bus_example.dart b/packages/bus/example/protevus_bus_example.dart deleted file mode 100644 index 22ffd0f..0000000 --- a/packages/bus/example/protevus_bus_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_bus/protevus_bus.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/bus/lib/protevus_bus.dart b/packages/bus/lib/protevus_bus.dart deleted file mode 100644 index a201b74..0000000 --- a/packages/bus/lib/protevus_bus.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_bus_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/bus/lib/src/.gitkeep b/packages/bus/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/bus/lib/src/protevus_bus_base.dart b/packages/bus/lib/src/protevus_bus_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/bus/lib/src/protevus_bus_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/bus/test/.gitkeep b/packages/bus/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/bus/test/protevus_bus_test.dart b/packages/bus/test/protevus_bus_test.dart deleted file mode 100644 index c611c89..0000000 --- a/packages/bus/test/protevus_bus_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_bus/protevus_bus.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/cache/example/.gitkeep b/packages/cache/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cache/example/protevus_cache_example.dart b/packages/cache/example/protevus_cache_example.dart deleted file mode 100644 index c2905b8..0000000 --- a/packages/cache/example/protevus_cache_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_cache/protevus_cache.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/cache/lib/protevus_cache.dart b/packages/cache/lib/protevus_cache.dart deleted file mode 100644 index ba35a70..0000000 --- a/packages/cache/lib/protevus_cache.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_cache_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/cache/lib/src/.gitkeep b/packages/cache/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cache/lib/src/protevus_cache_base.dart b/packages/cache/lib/src/protevus_cache_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/cache/lib/src/protevus_cache_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/cache/test/.gitkeep b/packages/cache/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cache/test/protevus_cache_test.dart b/packages/cache/test/protevus_cache_test.dart deleted file mode 100644 index 8ed5e46..0000000 --- a/packages/cache/test/protevus_cache_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_cache/protevus_cache.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/collections/example/.gitkeep b/packages/collections/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/collections/example/protevus_collections_example.dart b/packages/collections/example/protevus_collections_example.dart deleted file mode 100644 index 6c4b917..0000000 --- a/packages/collections/example/protevus_collections_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_collections/protevus_collections.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/collections/lib/protevus_collections.dart b/packages/collections/lib/protevus_collections.dart deleted file mode 100644 index 7c78c2d..0000000 --- a/packages/collections/lib/protevus_collections.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_collections_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/collections/lib/src/.gitkeep b/packages/collections/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/collections/lib/src/protevus_collections_base.dart b/packages/collections/lib/src/protevus_collections_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/collections/lib/src/protevus_collections_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/collections/test/.gitkeep b/packages/collections/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/collections/test/protevus_collections_test.dart b/packages/collections/test/protevus_collections_test.dart deleted file mode 100644 index 7166e4f..0000000 --- a/packages/collections/test/protevus_collections_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_collections/protevus_collections.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/conditionable/example/.gitkeep b/packages/conditionable/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/conditionable/example/protevus_conditionable_example.dart b/packages/conditionable/example/protevus_conditionable_example.dart deleted file mode 100644 index 2f760be..0000000 --- a/packages/conditionable/example/protevus_conditionable_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_conditionable/protevus_conditionable.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/conditionable/lib/protevus_conditionable.dart b/packages/conditionable/lib/protevus_conditionable.dart deleted file mode 100644 index fddd816..0000000 --- a/packages/conditionable/lib/protevus_conditionable.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_conditionable_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/conditionable/lib/src/.gitkeep b/packages/conditionable/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/conditionable/lib/src/protevus_conditionable_base.dart b/packages/conditionable/lib/src/protevus_conditionable_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/conditionable/lib/src/protevus_conditionable_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/conditionable/test/.gitkeep b/packages/conditionable/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/conditionable/test/protevus_conditionable_test.dart b/packages/conditionable/test/protevus_conditionable_test.dart deleted file mode 100644 index b18df17..0000000 --- a/packages/conditionable/test/protevus_conditionable_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_conditionable/protevus_conditionable.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/config/example/.gitkeep b/packages/config/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/config/example/protevus_config_example.dart b/packages/config/example/protevus_config_example.dart deleted file mode 100644 index 85d0662..0000000 --- a/packages/config/example/protevus_config_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_config/protevus_config.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/config/lib/protevus_config.dart b/packages/config/lib/protevus_config.dart deleted file mode 100644 index b77d0e4..0000000 --- a/packages/config/lib/protevus_config.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_config_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/config/lib/src/.gitkeep b/packages/config/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/config/lib/src/protevus_config_base.dart b/packages/config/lib/src/protevus_config_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/config/lib/src/protevus_config_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/config/test/.gitkeep b/packages/config/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/config/test/protevus_config_test.dart b/packages/config/test/protevus_config_test.dart deleted file mode 100644 index 624d28a..0000000 --- a/packages/config/test/protevus_config_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_config/protevus_config.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/console/example/.gitkeep b/packages/console/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/console/example/protevus_console_example.dart b/packages/console/example/protevus_console_example.dart deleted file mode 100644 index 7ed31ef..0000000 --- a/packages/console/example/protevus_console_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_console/protevus_console.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/console/lib/protevus_console.dart b/packages/console/lib/protevus_console.dart deleted file mode 100644 index 6393085..0000000 --- a/packages/console/lib/protevus_console.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_console_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/console/lib/src/.gitkeep b/packages/console/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/console/lib/src/protevus_console_base.dart b/packages/console/lib/src/protevus_console_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/console/lib/src/protevus_console_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/console/test/.gitkeep b/packages/console/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/console/test/protevus_console_test.dart b/packages/console/test/protevus_console_test.dart deleted file mode 100644 index bed7087..0000000 --- a/packages/console/test/protevus_console_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_console/protevus_console.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/container/example/.gitkeep b/packages/container/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/container/example/protevus_container_example.dart b/packages/container/example/protevus_container_example.dart deleted file mode 100644 index fdcbdb7..0000000 --- a/packages/container/example/protevus_container_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_container/protevus_container.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/container/lib/protevus_container.dart b/packages/container/lib/protevus_container.dart deleted file mode 100644 index 481bcae..0000000 --- a/packages/container/lib/protevus_container.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_container_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/container/lib/src/.gitkeep b/packages/container/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/container/lib/src/protevus_container_base.dart b/packages/container/lib/src/protevus_container_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/container/lib/src/protevus_container_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/container/test/.gitkeep b/packages/container/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/container/test/protevus_container_test.dart b/packages/container/test/protevus_container_test.dart deleted file mode 100644 index d1ce118..0000000 --- a/packages/container/test/protevus_container_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_container/protevus_container.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/cookie/example/.gitkeep b/packages/cookie/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cookie/example/protevus_cookie_example.dart b/packages/cookie/example/protevus_cookie_example.dart deleted file mode 100644 index 92816f6..0000000 --- a/packages/cookie/example/protevus_cookie_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_cookie/protevus_cookie.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/cookie/lib/protevus_cookie.dart b/packages/cookie/lib/protevus_cookie.dart deleted file mode 100644 index b75482f..0000000 --- a/packages/cookie/lib/protevus_cookie.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_cookie_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/cookie/lib/src/.gitkeep b/packages/cookie/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cookie/lib/src/protevus_cookie_base.dart b/packages/cookie/lib/src/protevus_cookie_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/cookie/lib/src/protevus_cookie_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/cookie/test/.gitkeep b/packages/cookie/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/cookie/test/protevus_cookie_test.dart b/packages/cookie/test/protevus_cookie_test.dart deleted file mode 100644 index e3946cf..0000000 --- a/packages/cookie/test/protevus_cookie_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_cookie/protevus_cookie.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/database/example/.gitkeep b/packages/database/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/database/example/protevus_database_example.dart b/packages/database/example/protevus_database_example.dart deleted file mode 100644 index cedf03e..0000000 --- a/packages/database/example/protevus_database_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_database/protevus_database.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/database/lib/protevus_database.dart b/packages/database/lib/protevus_database.dart deleted file mode 100644 index c7f0945..0000000 --- a/packages/database/lib/protevus_database.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_database_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/database/lib/src/.gitkeep b/packages/database/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/database/lib/src/protevus_database_base.dart b/packages/database/lib/src/protevus_database_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/database/lib/src/protevus_database_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/database/test/.gitkeep b/packages/database/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/database/test/protevus_database_test.dart b/packages/database/test/protevus_database_test.dart deleted file mode 100644 index 8eda95a..0000000 --- a/packages/database/test/protevus_database_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_database/protevus_database.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/encryption/example/.gitkeep b/packages/encryption/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/encryption/example/protevus_encryption_example.dart b/packages/encryption/example/protevus_encryption_example.dart deleted file mode 100644 index 25a1c71..0000000 --- a/packages/encryption/example/protevus_encryption_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_encryption/protevus_encryption.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/encryption/lib/protevus_encryption.dart b/packages/encryption/lib/protevus_encryption.dart deleted file mode 100644 index 465dffd..0000000 --- a/packages/encryption/lib/protevus_encryption.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_encryption_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/encryption/lib/src/.gitkeep b/packages/encryption/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/encryption/lib/src/protevus_encryption_base.dart b/packages/encryption/lib/src/protevus_encryption_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/encryption/lib/src/protevus_encryption_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/encryption/test/.gitkeep b/packages/encryption/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/encryption/test/protevus_encryption_test.dart b/packages/encryption/test/protevus_encryption_test.dart deleted file mode 100644 index a008e4f..0000000 --- a/packages/encryption/test/protevus_encryption_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_encryption/protevus_encryption.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/events/example/.gitkeep b/packages/events/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/events/example/protevus_events_example.dart b/packages/events/example/protevus_events_example.dart deleted file mode 100644 index db429c4..0000000 --- a/packages/events/example/protevus_events_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_events/protevus_events.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/events/lib/protevus_events.dart b/packages/events/lib/protevus_events.dart deleted file mode 100644 index 369d4b2..0000000 --- a/packages/events/lib/protevus_events.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_events_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/events/lib/src/.gitkeep b/packages/events/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/events/lib/src/protevus_events_base.dart b/packages/events/lib/src/protevus_events_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/events/lib/src/protevus_events_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/events/test/.gitkeep b/packages/events/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/events/test/protevus_events_test.dart b/packages/events/test/protevus_events_test.dart deleted file mode 100644 index 752e18c..0000000 --- a/packages/events/test/protevus_events_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_events/protevus_events.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/filesystem/example/.gitkeep b/packages/filesystem/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/filesystem/example/protevus_filesystem_example.dart b/packages/filesystem/example/protevus_filesystem_example.dart deleted file mode 100644 index 1a0fdfe..0000000 --- a/packages/filesystem/example/protevus_filesystem_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_filesystem/protevus_filesystem.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/filesystem/lib/protevus_filesystem.dart b/packages/filesystem/lib/protevus_filesystem.dart deleted file mode 100644 index ba770ae..0000000 --- a/packages/filesystem/lib/protevus_filesystem.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_filesystem_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/filesystem/lib/src/.gitkeep b/packages/filesystem/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/filesystem/lib/src/protevus_filesystem_base.dart b/packages/filesystem/lib/src/protevus_filesystem_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/filesystem/lib/src/protevus_filesystem_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/filesystem/test/.gitkeep b/packages/filesystem/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/filesystem/test/protevus_filesystem_test.dart b/packages/filesystem/test/protevus_filesystem_test.dart deleted file mode 100644 index 374a6d0..0000000 --- a/packages/filesystem/test/protevus_filesystem_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_filesystem/protevus_filesystem.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/foundation/example/.gitkeep b/packages/foundation/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/foundation/example/protevus_foundation_example.dart b/packages/foundation/example/protevus_foundation_example.dart deleted file mode 100644 index 4d08c4b..0000000 --- a/packages/foundation/example/protevus_foundation_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_foundation/protevus_foundation.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/foundation/lib/protevus_foundation.dart b/packages/foundation/lib/protevus_foundation.dart deleted file mode 100644 index 73377fb..0000000 --- a/packages/foundation/lib/protevus_foundation.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_foundation_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/foundation/lib/src/.gitkeep b/packages/foundation/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/foundation/lib/src/protevus_foundation_base.dart b/packages/foundation/lib/src/protevus_foundation_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/foundation/lib/src/protevus_foundation_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/foundation/test/.gitkeep b/packages/foundation/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/foundation/test/protevus_foundation_test.dart b/packages/foundation/test/protevus_foundation_test.dart deleted file mode 100644 index ee6c5e7..0000000 --- a/packages/foundation/test/protevus_foundation_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_foundation/protevus_foundation.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/hashing/example/.gitkeep b/packages/hashing/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/hashing/example/protevus_hashing_example.dart b/packages/hashing/example/protevus_hashing_example.dart deleted file mode 100644 index 256cf37..0000000 --- a/packages/hashing/example/protevus_hashing_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_hashing/protevus_hashing.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/hashing/lib/protevus_hashing.dart b/packages/hashing/lib/protevus_hashing.dart deleted file mode 100644 index 68a210d..0000000 --- a/packages/hashing/lib/protevus_hashing.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_hashing_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/hashing/lib/src/.gitkeep b/packages/hashing/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/hashing/lib/src/protevus_hashing_base.dart b/packages/hashing/lib/src/protevus_hashing_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/hashing/lib/src/protevus_hashing_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/hashing/test/.gitkeep b/packages/hashing/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/hashing/test/protevus_hashing_test.dart b/packages/hashing/test/protevus_hashing_test.dart deleted file mode 100644 index c607539..0000000 --- a/packages/hashing/test/protevus_hashing_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_hashing/protevus_hashing.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/http/lib/foundation.dart b/packages/http/lib/foundation.dart index 7b52aed..193266d 100644 --- a/packages/http/lib/foundation.dart +++ b/packages/http/lib/foundation.dart @@ -12,25 +12,33 @@ /// Exports: /// - [CountableInterface] from 'src/foundation/countable_interface.dart' /// - [StringableInterface] from 'src/foundation/stringable_interface.dart' +/// - [AcceptHeaderItem] from 'src/foundation/accept_header_item.dart' +/// - [AcceptHeader] from 'src/foundation/accept_header.dart' /// - [Filter] from 'src/foundation/filter.dart' /// - [Cookie] from 'src/foundation/cookie.dart' /// - [HeaderUtils] from 'src/foundation/header_utils.dart' /// - [HeaderBag] from 'src/foundation/header_bag.dart' +/// - [ParameterBagBase] from 'src/foundation/parameter_bag_base.dart' /// - [ParameterBag] from 'src/foundation/parameter_bag.dart' /// - [InputBag] from 'src/foundation/input_bag.dart' /// - [ResponseHeaderBag] from 'src/foundation/response_header_bag.dart' +/// - [ServerBag] from 'src/foundation/server_bag.dart' /// /// These exports provide a comprehensive set of tools for handling various aspects of web development, -/// including countable objects, string manipulation, filtering, cookies, HTTP headers, request parameters, -/// and response handling. +/// including countable objects, string manipulation, HTTP headers, filtering, cookies, request parameters, +/// input handling, response headers, and server-related functionality. library; export 'src/foundation/countable_interface.dart'; export 'src/foundation/stringable_interface.dart'; +export 'src/foundation/accept_header_item.dart'; +export 'src/foundation/accept_header.dart'; export 'src/foundation/filter.dart'; export 'src/foundation/cookie.dart'; export 'src/foundation/header_utils.dart'; export 'src/foundation/header_bag.dart'; +export 'src/foundation/parameter_bag_base.dart'; export 'src/foundation/parameter_bag.dart'; export 'src/foundation/input_bag.dart'; -export 'src/foundation/response_header_bag.dart'; \ No newline at end of file +export 'src/foundation/response_header_bag.dart'; +export 'src/foundation/server_bag.dart'; diff --git a/packages/http/lib/foundation_file.dart b/packages/http/lib/foundation_file.dart new file mode 100644 index 0000000..c0170e2 --- /dev/null +++ b/packages/http/lib/foundation_file.dart @@ -0,0 +1,12 @@ +/* + * This file is part of the Protevus Platform. + * + * (C) Protevus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +library; + +export 'src/foundation/file/upload_file.dart'; diff --git a/packages/http/lib/foundation_file_exception.dart b/packages/http/lib/foundation_file_exception.dart new file mode 100644 index 0000000..ff8e781 --- /dev/null +++ b/packages/http/lib/foundation_file_exception.dart @@ -0,0 +1,20 @@ +/* + * This file is part of the Protevus Platform. + * + * (C) Protevus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +library; + +export 'src/foundation/file/exception/file_exception.dart'; +export 'src/foundation/file/exception/cannot_write_file_exception.dart'; +export 'src/foundation/file/exception/extension_file_exception.dart'; +export 'src/foundation/file/exception/file_not_found_exception.dart'; +export 'src/foundation/file/exception/form_size_file_exception.dart'; +export 'src/foundation/file/exception/ini_size_file_exception.dart'; +export 'src/foundation/file/exception/no_file_exception.dart'; +export 'src/foundation/file/exception/no_tmpdir_file_exception.dart'; +export 'src/foundation/file/exception/partial_file_exception.dart'; diff --git a/packages/http/lib/foundation_session.dart b/packages/http/lib/foundation_session.dart new file mode 100644 index 0000000..d3a8d67 --- /dev/null +++ b/packages/http/lib/foundation_session.dart @@ -0,0 +1,12 @@ +/* + * This file is part of the Protevus Platform. + * + * (C) Protevus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +library; + +export 'src/foundation/session/session_bag_interface.dart'; diff --git a/packages/http/lib/foundation_storage.dart b/packages/http/lib/foundation_storage.dart new file mode 100644 index 0000000..dda4f18 --- /dev/null +++ b/packages/http/lib/foundation_storage.dart @@ -0,0 +1,12 @@ +/* + * This file is part of the Protevus Platform. + * + * (C) Protevus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +library; + +export 'src/foundation/storage/meta_data_bag.dart'; diff --git a/packages/http/lib/src/foundation/accept_header.dart b/packages/http/lib/src/foundation/accept_header.dart new file mode 100644 index 0000000..34818ce --- /dev/null +++ b/packages/http/lib/src/foundation/accept_header.dart @@ -0,0 +1,112 @@ +import 'package:protevus_http/foundation.dart'; + +/// Represents an Accept-* header. +/// +/// An accept header is compound with a list of items, +/// sorted by descending quality. +class AcceptHeader { + /// The list of AcceptHeaderItem objects. + final Map _items = {}; + + /// Indicates whether the items are sorted. + bool _sorted = true; + + /// Constructs an AcceptHeader with the given items. + AcceptHeader(List items) { + for (var item in items) { + add(item); + } + } + + /// Builds an AcceptHeader instance from a string. + static AcceptHeader fromString(String? headerValue) { + var parts = HeaderUtils.split(headerValue ?? '', ',;='); + var index = 0; + + return AcceptHeader(parts.map((subParts) { + var part = subParts.isNotEmpty ? subParts[0] : ''; + + // Convert subParts.sublist(1) to List> + var restParts = subParts.sublist(1).map((item) => [item]).toList(); + var attributes = HeaderUtils.combine(restParts); + + var item = AcceptHeaderItem( + part, + Map.from( + attributes.map((key, value) => MapEntry(key, value.toString()))), + ); + item.setIndex(index++); + return item; + }).toList()); + } + + /// Returns header value's string representation. + @override + String toString() { + return _items.values.join(','); + } + + /// Tests if header has given value. + bool has(String value) { + return _items.containsKey(value); + } + + /// Returns given value's item, if exists. + AcceptHeaderItem? get(String value) { + return _items[value] ?? + _items['${value.split('/')[0]}/*'] ?? + _items['*/*'] ?? + _items['*']; + } + + /// Adds an item. + AcceptHeader add(AcceptHeaderItem item) { + _items[item.getValue()] = item; + _sorted = false; + return this; + } + + /// Returns all items. + List all() { + _sort(); + return _items.values.toList(); + } + + /// Filters items on their value using given regex. + AcceptHeader filter(String pattern) { + var regex = RegExp(pattern); + return AcceptHeader(_items.values + .where((item) => regex.hasMatch(item.getValue())) + .toList()); + } + + /// Returns first item. + AcceptHeaderItem? first() { + _sort(); + return _items.isNotEmpty ? _items.values.first : null; + } + + /// Sorts items by descending quality. + void _sort() { + if (!_sorted) { + var sortedItems = _items.values.toList() + ..sort((a, b) { + var qA = a.getQuality(); + var qB = b.getQuality(); + + if (qA == qB) { + return a.getIndex().compareTo(b.getIndex()); + } + + return qB.compareTo(qA); + }); + + _items.clear(); + for (var item in sortedItems) { + _items[item.getValue()] = item; + } + + _sorted = true; + } + } +} diff --git a/packages/http/lib/src/foundation/accept_header_item.dart b/packages/http/lib/src/foundation/accept_header_item.dart new file mode 100644 index 0000000..5032813 --- /dev/null +++ b/packages/http/lib/src/foundation/accept_header_item.dart @@ -0,0 +1,93 @@ +import 'package:protevus_http/foundation.dart'; + +/// Represents an Accept-* header item. +class AcceptHeaderItem { + String _value; + double _quality = 1.0; + int _index = 0; + final Map _attributes = {}; + + /// Constructs an AcceptHeaderItem with a value and optional attributes. + AcceptHeaderItem(this._value, [Map? attributes]) { + if (attributes != null) { + attributes.forEach((name, value) { + setAttribute(name, value); + }); + } + } + + /// Builds an AcceptHeaderItem instance from a string. + static AcceptHeaderItem fromString(String? itemValue) { + final parts = HeaderUtils.split(itemValue ?? '', ';='); + + if (parts.isEmpty) { + throw ArgumentError('Invalid header value'); + } + + final value = parts[0][0]; + final attributes = HeaderUtils.combine(parts.sublist(1)); + + return AcceptHeaderItem(value, attributes.cast()); + } + + /// Returns header value's string representation. + @override + String toString() { + final attributes = Map.from(_attributes); + if (_quality < 1) { + attributes['q'] = _quality.toString(); + } + return _value + + (attributes.isNotEmpty + ? '; ${HeaderUtils.headerToString(attributes, ';')}' + : ''); + } + + /// Set the item value. + AcceptHeaderItem setValue(String value) { + _value = value; + return this; + } + + /// Returns the item value. + String getValue() => _value; + + /// Set the item quality. + AcceptHeaderItem setQuality(double quality) { + _quality = quality; + return this; + } + + /// Returns the item quality. + double getQuality() => _quality; + + /// Set the item index. + AcceptHeaderItem setIndex(int index) { + _index = index; + return this; + } + + /// Returns the item index. + int getIndex() => _index; + + /// Tests if an attribute exists. + bool hasAttribute(String name) => _attributes.containsKey(name); + + /// Returns an attribute by its name. + dynamic getAttribute(String name, {dynamic defaultValue}) { + return _attributes[name] ?? defaultValue; + } + + /// Returns all attributes. + Map getAttributes() => Map.from(_attributes); + + /// Set an attribute. + AcceptHeaderItem setAttribute(String name, String value) { + if (name == 'q') { + _quality = double.parse(value); + } else { + _attributes[name] = value; + } + return this; + } +} diff --git a/packages/http/lib/src/foundation/file/exception/cannot_write_file_exception.dart b/packages/http/lib/src/foundation/file/exception/cannot_write_file_exception.dart new file mode 100644 index 0000000..4cf88df --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/cannot_write_file_exception.dart @@ -0,0 +1,16 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_CANT_WRITE error occurred with UploadedFile. +/// +/// @author Florent Mata +class CannotWriteFileException extends FileException { + /// Creates a new [CannotWriteFileException] with the given [message]. + CannotWriteFileException([String message = '']) : super(message); +} diff --git a/packages/http/lib/src/foundation/file/exception/extension_file_exception.dart b/packages/http/lib/src/foundation/file/exception/extension_file_exception.dart new file mode 100644 index 0000000..e1bf5cf --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/extension_file_exception.dart @@ -0,0 +1,16 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_EXTENSION error occurred with UploadedFile. +/// +/// @author Florent Mata +class ExtensionFileException extends FileException { + // The constructor is empty as it inherits from FileException + ExtensionFileException([String message = '']) : super(message); +} diff --git a/packages/http/lib/src/foundation/file/exception/file_exception.dart b/packages/http/lib/src/foundation/file/exception/file_exception.dart new file mode 100644 index 0000000..ea6e84f --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/file_exception.dart @@ -0,0 +1,32 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'dart:core'; + +/// Exception thrown when an error occurs during file operations. +/// +/// This exception is used to handle various file-related errors in the component File. +/// +/// Example usage: +/// ```dart +/// try { +/// // File operation that may throw an exception +/// } catch (e) { +/// if (e is FileException) { +/// print('A file error occurred: ${e.message}'); +/// } +/// } +/// ``` +class FileException implements Exception { + final String message; + + /// Creates a new [FileException] with the given [message]. + FileException([this.message = '']); + + @override + String toString() => 'FileException: $message'; +} diff --git a/packages/http/lib/src/foundation/file/exception/file_not_found_exception.dart b/packages/http/lib/src/foundation/file/exception/file_not_found_exception.dart new file mode 100644 index 0000000..7d019c1 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/file_not_found_exception.dart @@ -0,0 +1,18 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when a file was not found. +/// +/// @author Bernhard Schussek +class FileNotFoundException extends FileException { + /// Creates a new [FileNotFoundException] with the given file path. + /// + /// [path] The path to the file that was not found. + FileNotFoundException(String path) : super('The file "$path" does not exist'); +} diff --git a/packages/http/lib/src/foundation/file/exception/form_size_file_exception.dart b/packages/http/lib/src/foundation/file/exception/form_size_file_exception.dart new file mode 100644 index 0000000..24f99f4 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/form_size_file_exception.dart @@ -0,0 +1,15 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_FORM_SIZE error occurred with UploadedFile. +/// +/// @author Florent Mata +class FormSizeFileException extends FileException { + FormSizeFileException([String message = '']) : super(message); +} diff --git a/packages/http/lib/src/foundation/file/exception/ini_size_file_exception.dart b/packages/http/lib/src/foundation/file/exception/ini_size_file_exception.dart new file mode 100644 index 0000000..683f0d6 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/ini_size_file_exception.dart @@ -0,0 +1,15 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_INI_SIZE error occurred with UploadedFile. +/// +/// @author Florent Mata +class IniSizeFileException extends FileException { + // No additional functionality needed, as this exception is just a specific type of FileException +} diff --git a/packages/http/lib/src/foundation/file/exception/no_file_exception.dart b/packages/http/lib/src/foundation/file/exception/no_file_exception.dart new file mode 100644 index 0000000..7c96426 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/no_file_exception.dart @@ -0,0 +1,16 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_NO_FILE error occurred with UploadedFile. +/// +/// @author Florent Mata +class NoFileException extends FileException { + // In Dart, we don't need to explicitly declare an empty class body + // if there are no additional members or methods. +} diff --git a/packages/http/lib/src/foundation/file/exception/no_tmpdir_file_exception.dart b/packages/http/lib/src/foundation/file/exception/no_tmpdir_file_exception.dart new file mode 100644 index 0000000..f3261b1 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/no_tmpdir_file_exception.dart @@ -0,0 +1,8 @@ +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_NO_TMP_DIR error occurred with UploadedFile. +/// +/// @author Florent Mata +class NoTmpDirFileException extends FileException { + // The constructor is implicit in this case, as it doesn't require any additional setup +} diff --git a/packages/http/lib/src/foundation/file/exception/partial_file_exception.dart b/packages/http/lib/src/foundation/file/exception/partial_file_exception.dart new file mode 100644 index 0000000..bff6e99 --- /dev/null +++ b/packages/http/lib/src/foundation/file/exception/partial_file_exception.dart @@ -0,0 +1,19 @@ +// This file is part of the Symfony package. +// +// (c) Fabien Potencier +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +// Note: In Dart, we don't need to explicitly declare namespaces like in PHP. +// The package structure in Dart serves a similar purpose. + +import 'package:protevus_http/foundation_file_exception.dart'; + +/// Thrown when an UPLOAD_ERR_PARTIAL error occurred with UploadedFile. +/// +/// @author Florent Mata +class PartialFileException extends FileException { + // In Dart, we don't need to declare an empty class body if there are no additional + // properties or methods. The class will inherit everything from FileException. +} diff --git a/packages/http/lib/src/foundation/file/upload_file.dart b/packages/http/lib/src/foundation/file/upload_file.dart new file mode 100644 index 0000000..e69de29 diff --git a/packages/http/lib/src/foundation/input_bag.dart b/packages/http/lib/src/foundation/input_bag.dart index 6d6760a..c00cbcd 100644 --- a/packages/http/lib/src/foundation/input_bag.dart +++ b/packages/http/lib/src/foundation/input_bag.dart @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +import 'dart:collection'; + import 'package:protevus_http/foundation.dart'; import 'package:protevus_http/foundation_exception.dart'; @@ -25,8 +27,8 @@ import 'package:protevus_http/foundation_exception.dart'; /// This class implements type-safe operations and throws appropriate exceptions /// for invalid inputs or operations. It's designed to work with various types of /// input data such as GET, POST, REQUEST, and COOKIE parameters. -abstract class InputBag extends ParameterBag { - +final class InputBag extends ParameterBag + with IterableMixin> { /// Retrieves a value from the input bag by its key. /// /// This method overrides the base [ParameterBag.get] method to add additional @@ -62,7 +64,8 @@ abstract class InputBag extends ParameterBag { value is String || value is bool || value is Stringable)) { - throw BadRequestException('Input value "$key" contains a non-scalar value.'); + throw BadRequestException( + 'Input value "$key" contains a non-scalar value.'); } return identical(this, value) ? defaultValue : value; @@ -194,7 +197,8 @@ abstract class InputBag extends ParameterBag { /// - Applies the filter using [Filter.filterVar]. /// - Handles the FILTER_NULL_ON_FAILURE flag. @override - dynamic filter(String key, {dynamic defaultValue, int? filter, dynamic options}) { + dynamic filter(String key, + {dynamic defaultValue, int? filter, dynamic options}) { var value = has(key) ? parameters[key] : defaultValue; // Always turn options into a Map - this allows filter_var option shortcuts. @@ -203,21 +207,26 @@ abstract class InputBag extends ParameterBag { } options ??= {}; - if (value is List && !((options['flags'] ?? 0) & (Filter.FILTER_REQUIRE_ARRAY | Filter.FILTER_FORCE_ARRAY))) { + if (value is List && + !((options['flags'] ?? 0) & + (Filter.FILTER_REQUIRE_ARRAY | Filter.FILTER_FORCE_ARRAY))) { throw BadRequestException( 'Input value "$key" contains a List, but "FILTER_REQUIRE_ARRAY" or "FILTER_FORCE_ARRAY" flags were not set.'); } - if ((filter ?? 0) & Filter.FILTER_CALLBACK != 0 && options['options'] is! Function) { + if ((filter ?? 0) & Filter.FILTER_CALLBACK != 0 && + options['options'] is! Function) { throw FormatException( 'A Function must be passed when FILTER_CALLBACK is used, "${options['options'].runtimeType}" given.'); } options['flags'] ??= 0; - bool nullOnFailure = (options['flags'] & Filter.FILTER_NULL_ON_FAILURE) != 0; + bool nullOnFailure = + (options['flags'] & Filter.FILTER_NULL_ON_FAILURE) != 0; options['flags'] |= Filter.FILTER_NULL_ON_FAILURE; - var filteredValue = Filter.filterVar(value, filter ?? Filter.FILTER_DEFAULT, options); + var filteredValue = + Filter.filterVar(value, filter ?? Filter.FILTER_DEFAULT, options); if (filteredValue != null || nullOnFailure) { return filteredValue; @@ -227,4 +236,3 @@ abstract class InputBag extends ParameterBag { 'Input value "$key" is invalid and flag "FILTER_NULL_ON_FAILURE" was not set.'); } } - diff --git a/packages/http/lib/src/foundation/parameter_bag.dart b/packages/http/lib/src/foundation/parameter_bag.dart index 171983e..2451781 100644 --- a/packages/http/lib/src/foundation/parameter_bag.dart +++ b/packages/http/lib/src/foundation/parameter_bag.dart @@ -1,426 +1,30 @@ -/* - * This file is part of the Protevus Platform. - * This file is a port of the symfony ParameterBag.php class to Dart - * - * (C) Protevus - * (C) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - import 'package:protevus_http/foundation.dart'; -import 'package:protevus_http/foundation_exception.dart'; -/// ParameterBag is an abstract container for key/value pairs. -/// It implements Iterable> and Countable interfaces. -abstract class ParameterBag implements Iterable>, Countable { - /// The underlying map containing the parameters. - /// - /// This getter provides access to the internal map that stores all the key-value pairs - /// of parameters. The keys are of type [String], and the values can be of any type, - /// hence [dynamic]. - /// - /// This map is the core data structure of the ParameterBag, allowing for storage and - /// retrieval of various parameters used throughout the application. - Map get parameters; - - /// Returns all parameters or a specific nested parameter. - /// - /// If [key] is null, this method returns all parameters as a [Map]. - /// If [key] is provided, it returns the value associated with that key, which must be - /// a [Map]. If the value is not a Map, it throws a [BadRequestException]. - /// - /// Parameters: - /// [key] - Optional. The key of the nested parameter to retrieve. - /// - /// Returns: - /// A [Map] containing either all parameters or the nested parameter. - /// - /// Throws: - /// [BadRequestException] if the value for the given key is not a Map. - Map all([String? key]) { - if (key == null) { - return parameters; - } - - final value = parameters[key]; - if (value is! Map) { - throw BadRequestException( - 'Unexpected value for parameter "$key": expecting "Map", got "${value.runtimeType}".'); - } - - return value; - } - - /// Returns a list of all parameter keys. - /// - /// This method retrieves all the keys from the [parameters] map and returns them - /// as a [List]. This can be useful when you need to iterate over or - /// inspect all the keys in the parameter bag without accessing their values. - /// - /// Returns: - /// A [List] containing all the keys from the parameters map. - List keys() { - return parameters.keys.toList(); - } - - /// Replaces the current parameters with a new set of parameters. - /// - /// This method completely replaces the existing parameters in the ParameterBag - /// with the new parameters provided in the [parameters] argument. - /// - /// Parameters: - /// [parameters] - A Map containing the new set of parameters - /// that will replace the existing ones. - /// - /// Example: - /// parameterBag.replace({'key1': 'value1', 'key2': 42}); - void replace(Map parameters); - - /// Adds new parameters to the existing set of parameters. - /// - /// This method merges the provided [parameters] with the existing parameters - /// in the ParameterBag. If a key already exists, its value will be updated - /// with the new value from the provided map. - /// - /// Parameters: - /// [parameters] - A Map containing the new parameters - /// to be added to the existing set. - /// - /// Example: - /// parameterBag.add({'key1': 'newValue', 'key3': 'value3'}); - void add(Map parameters); - - /// Retrieves the value associated with the given key from the parameters. - /// - /// This method searches for the specified [key] in the parameters map. - /// If the key is found, it returns the corresponding value. - /// If the key is not found, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key to look up in the parameters map. - /// [defaultValue] - Optional. The value to return if the key is not found. - /// If not provided, it defaults to null. - /// - /// Returns: - /// The value associated with the key if found, otherwise the defaultValue. - /// - /// Example: - /// var value = parameterBag.get('username', 'guest'); - dynamic get(String key, [dynamic defaultValue]) { - return parameters.containsKey(key) ? parameters[key] : defaultValue; - } - - /// Sets a parameter value for the given key. - /// - /// This method adds or updates a parameter in the ParameterBag. - /// If the key already exists, its value will be updated. - /// If the key doesn't exist, a new key-value pair will be added. - /// - /// Parameters: - /// [key] - The string key for the parameter. - /// [value] - The value to be associated with the key. Can be of any type. - /// - /// Example: - /// parameterBag.set('username', 'john_doe'); - /// parameterBag.set('age', 30); - void set(String key, dynamic value); - - /// Checks if a parameter with the given key exists in the ParameterBag. - /// - /// This method determines whether the specified [key] is present in the - /// parameters map. It returns true if the key exists, and false otherwise. - /// - /// Parameters: - /// [key] - The string key to check for existence in the parameters map. - /// - /// Returns: - /// A boolean value: true if the key exists, false otherwise. - /// - /// Example: - /// if (parameterBag.has('username')) { - /// // Do something with the username parameter - /// } - bool has(String key) { - return parameters.containsKey(key); - } - - /// Removes a parameter from the ParameterBag. - /// - /// This method removes the key-value pair associated with the given [key] - /// from the parameters map. If the key doesn't exist, this method does nothing. - /// - /// Parameters: - /// [key] - The string key of the parameter to be removed. - /// - /// Example: - /// parameterBag.remove('username'); - void remove(String key); - - /// Returns the alphabetic characters of the parameter value. - /// - /// This method retrieves the value associated with the given [key] as a string, - /// and then removes all non-alphabetic characters from it. If the key doesn't - /// exist or its value is empty, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve and process. - /// [defaultValue] - Optional. The value to return if the key is not found - /// or its value is empty. Defaults to an empty string. - /// - /// Returns: - /// A string containing only alphabetic characters (a-z and A-Z) from the - /// original parameter value. - /// - /// Example: - /// parameterBag.set('mixed', 'abc123XYZ!@#'); - /// print(parameterBag.getAlpha('mixed')); // Outputs: 'abcXYZ' - String getAlpha(String key, [String defaultValue = '']) { - return getString(key, defaultValue).replaceAll(RegExp(r'[^a-zA-Z]'), ''); - } - - /// Returns the alphanumeric characters of the parameter value. - /// - /// This method retrieves the value associated with the given [key] as a string, - /// and then removes all non-alphanumeric characters from it. If the key doesn't - /// exist or its value is empty, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve and process. - /// [defaultValue] - Optional. The value to return if the key is not found - /// or its value is empty. Defaults to an empty string. - /// - /// Returns: - /// A string containing only alphanumeric characters (a-z, A-Z, and 0-9) from the - /// original parameter value. - /// - /// Example: - /// parameterBag.set('mixed', 'abc123XYZ!@#'); - /// print(parameterBag.getAlnum('mixed')); // Outputs: 'abc123XYZ' - String getAlnum(String key, [String defaultValue = '']) { - return getString(key, defaultValue).replaceAll(RegExp(r'[^a-zA-Z0-9]'), ''); - } - - /// Returns only the digit characters from the parameter value. - /// - /// This method retrieves the value associated with the given [key] as a string, - /// and then removes all non-digit characters from it. If the key doesn't - /// exist or its value is empty, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve and process. - /// [defaultValue] - Optional. The value to return if the key is not found - /// or its value is empty. Defaults to an empty string. - /// - /// Returns: - /// A string containing only digit characters (0-9) from the original parameter value. - /// - /// Example: - /// parameterBag.set('mixed', 'abc123XYZ!@#'); - /// print(parameterBag.getDigits('mixed')); // Outputs: '123' - String getDigits(String key, [String defaultValue = '']) { - return getString(key, defaultValue).replaceAll(RegExp(r'[^0-9]'), ''); - } - - /// Returns the parameter value as a string. - /// - /// This method retrieves the value associated with the given [key] and converts it to a string. - /// If the key doesn't exist, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve. - /// [defaultValue] - Optional. The value to return if the key is not found. - /// Defaults to an empty string. - /// - /// Returns: - /// A string representation of the parameter value. - /// - /// Throws: - /// [UnexpectedValueException] if the value cannot be converted to a string - /// (i.e., if it's not a String, num, or bool). - /// - /// Example: - /// parameterBag.set('number', 42); - /// print(parameterBag.getString('number')); // Outputs: '42' - String getString(String key, [String defaultValue = '']) { - final value = get(key, defaultValue); - if (value is! String && value is! num && value is! bool) { - throw UnexpectedValueException( - 'Parameter value "$key" cannot be converted to "String".'); - } - return value.toString(); - } - - /// Returns the parameter value converted to an integer. - /// - /// This method retrieves the value associated with the given [key] and attempts to convert it to an integer. - /// If the key doesn't exist or the value cannot be converted to an integer, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve. - /// [defaultValue] - Optional. The value to return if the key is not found or the value cannot be converted to an integer. - /// Defaults to 0. - /// - /// Returns: - /// An integer representation of the parameter value. - /// - /// Example: - /// parameterBag.set('number', '42'); - /// print(parameterBag.getInt('number')); // Outputs: 42 - /// print(parameterBag.getInt('nonexistent', 10)); // Outputs: 10 - int getInt(String key, [int defaultValue = 0]) { - final value = get(key, defaultValue); - if (value is int) return value; - if (value is String) { - return int.tryParse(value) ?? defaultValue; - } - return defaultValue; - } - - /// Returns the parameter value converted to a boolean. - /// - /// This method retrieves the value associated with the given [key] and attempts to convert it to a boolean. - /// If the key doesn't exist, it returns the [defaultValue]. - /// - /// The conversion rules are as follows: - /// - If the value is already a boolean, it is returned as-is. - /// - If the value is a string, it returns true if the string is 'true' (case-insensitive) or '1'. - /// - For all other cases, it returns the [defaultValue]. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve. - /// [defaultValue] - Optional. The value to return if the key is not found or the value cannot be converted to a boolean. - /// Defaults to false. - /// - /// Returns: - /// A boolean representation of the parameter value. - /// - /// Example: - /// parameterBag.set('flag1', 'true'); - /// parameterBag.set('flag2', '1'); - /// parameterBag.set('flag3', 'false'); - /// print(parameterBag.getBoolean('flag1')); // Outputs: true - /// print(parameterBag.getBoolean('flag2')); // Outputs: true - /// print(parameterBag.getBoolean('flag3')); // Outputs: false - /// print(parameterBag.getBoolean('nonexistent')); // Outputs: false - bool getBoolean(String key, [bool defaultValue = false]) { - final value = get(key, defaultValue); - if (value is bool) return value; - if (value is String) { - return value.toLowerCase() == 'true' || value == '1'; - } - return defaultValue; - } - - /// Returns the parameter value converted to an enum. - /// - /// This method retrieves the value associated with the given [key] and attempts to convert it - /// to an enum of type [T]. The method compares the string representation of each enum value - /// (without the enum type prefix) to the parameter value. - /// - /// Parameters: - /// [key] - The key of the parameter to retrieve. - /// [values] - A list of all possible enum values of type [T]. - /// [defaultValue] - Optional. The value to return if the key is not found or the value - /// cannot be converted to an enum. Defaults to null. - /// - /// Returns: - /// An enum value of type [T] if a match is found, otherwise returns the [defaultValue]. - /// - /// Throws: - /// [UnexpectedValueException] if the value exists but cannot be converted to an enum. - /// - /// Example: - /// enum Color { red, green, blue } - /// parameterBag.set('color', 'red'); - /// var color = parameterBag.getEnum('color', Color.values); // Returns Color.red - T? getEnum(String key, List values, [T? defaultValue]) { - final value = get(key); - if (value == null) return defaultValue; - try { - return values.firstWhere((e) => e.toString().split('.').last == value); - } catch (e) { - throw UnexpectedValueException( - 'Parameter "$key" cannot be converted to enum: ${e.toString()}'); - } - } - - /// Filters a parameter value based on the given key. - /// - /// This method retrieves the value associated with the given [key] and applies - /// basic filtering logic. If the key doesn't exist, it returns the [defaultValue]. - /// - /// The current implementation provides a simple string sanitization for string values, - /// trimming whitespace from the beginning and end. For all other types, the value - /// is returned as-is. - /// - /// This method is designed to be overridden or extended in subclasses to provide - /// more sophisticated filtering logic. - /// - /// Parameters: - /// [key] - The key of the parameter to filter. - /// [defaultValue] - Optional. The value to return if the key doesn't exist. - /// [filter] - Optional. An integer representing the filter type (not used in the base implementation). - /// [options] - Optional. Additional options for filtering (not used in the base implementation). - /// - /// Returns: - /// The filtered value if the key exists, otherwise the [defaultValue]. - /// - /// Example: - /// parameterBag.set('name', ' John Doe '); - /// print(parameterBag.filter('name')); // Outputs: 'John Doe' - dynamic filter(String key, {dynamic defaultValue, int? filter, dynamic options}) { - if (!has(key)) { - return defaultValue; - } - - var value = get(key); - - // Basic filtering logic, can be overridden or extended in subclasses - if (value is String) { - // Simple string sanitization as an example - return value.trim(); - } - - // For other types, return as is - return value; - } - - /// Returns an iterator for the entries in the parameters map. - /// - /// This getter provides an iterator that allows for traversing all key-value - /// pairs (entries) in the underlying parameters map. It's particularly useful - /// for iterating over all parameters in the ParameterBag. - /// - /// The iterator yields [MapEntry] objects, where each entry contains a String - /// key and a dynamic value, corresponding to a parameter in the ParameterBag. - /// - /// This implementation is part of the [Iterable] interface, allowing - /// ParameterBag to be used in for-in loops and with other Iterable methods. - /// - /// Returns: - /// An [Iterator] of [MapEntry] for the parameters map. - /// - /// Example: - /// for (var entry in parameterBag) { - /// print('${entry.key}: ${entry.value}'); - /// } +abstract class ParameterBag extends ParameterBagBase { @override - Iterator> get iterator => parameters.entries.iterator; + final Map parameters; + + ParameterBag([Map initialParameters = const {}]) + : parameters = Map.from(initialParameters); - /// Returns the number of parameters in the ParameterBag. - /// - /// This getter provides the count of key-value pairs in the underlying - /// parameters map. It's an implementation of the [Countable] interface. - /// - /// Returns: - /// An integer representing the number of parameters stored in the ParameterBag. - /// - /// Example: - /// int parameterCount = parameterBag.count; - /// print('Number of parameters: $parameterCount'); @override - int get count => parameters.length; + void replace(Map parameters) { + parameters.clear(); + parameters.addAll(parameters); + } + + @override + void add(Map parameters) { + parameters.addAll(parameters); + } + + @override + void set(String key, dynamic value) { + parameters[key] = value; + } + + @override + void remove(String key) { + parameters.remove(key); + } } - diff --git a/packages/http/lib/src/foundation/parameter_bag_base.dart b/packages/http/lib/src/foundation/parameter_bag_base.dart new file mode 100644 index 0000000..6c5d83d --- /dev/null +++ b/packages/http/lib/src/foundation/parameter_bag_base.dart @@ -0,0 +1,428 @@ +/* + * This file is part of the Protevus Platform. + * This file is a port of the symfony ParameterBag.php class to Dart + * + * (C) Protevus + * (C) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import 'package:protevus_http/foundation.dart'; +import 'package:protevus_http/foundation_exception.dart'; + +/// ParameterBag is an abstract container for key/value pairs. +/// It implements Iterable> and Countable interfaces. +abstract class ParameterBagBase + implements Iterable>, Countable { + /// The underlying map containing the parameters. + /// + /// This getter provides access to the internal map that stores all the key-value pairs + /// of parameters. The keys are of type [String], and the values can be of any type, + /// hence [dynamic]. + /// + /// This map is the core data structure of the ParameterBag, allowing for storage and + /// retrieval of various parameters used throughout the application. + Map get parameters; + + /// Returns all parameters or a specific nested parameter. + /// + /// If [key] is null, this method returns all parameters as a [Map]. + /// If [key] is provided, it returns the value associated with that key, which must be + /// a [Map]. If the value is not a Map, it throws a [BadRequestException]. + /// + /// Parameters: + /// [key] - Optional. The key of the nested parameter to retrieve. + /// + /// Returns: + /// A [Map] containing either all parameters or the nested parameter. + /// + /// Throws: + /// [BadRequestException] if the value for the given key is not a Map. + Map all([String? key]) { + if (key == null) { + return parameters; + } + + final value = parameters[key]; + if (value is! Map) { + throw BadRequestException( + 'Unexpected value for parameter "$key": expecting "Map", got "${value.runtimeType}".'); + } + + return value; + } + + /// Returns a list of all parameter keys. + /// + /// This method retrieves all the keys from the [parameters] map and returns them + /// as a [List]. This can be useful when you need to iterate over or + /// inspect all the keys in the parameter bag without accessing their values. + /// + /// Returns: + /// A [List] containing all the keys from the parameters map. + List keys() { + return parameters.keys.toList(); + } + + /// Replaces the current parameters with a new set of parameters. + /// + /// This method completely replaces the existing parameters in the ParameterBag + /// with the new parameters provided in the [parameters] argument. + /// + /// Parameters: + /// [parameters] - A Map containing the new set of parameters + /// that will replace the existing ones. + /// + /// Example: + /// parameterBag.replace({'key1': 'value1', 'key2': 42}); + void replace(Map parameters); + + /// Adds new parameters to the existing set of parameters. + /// + /// This method merges the provided [parameters] with the existing parameters + /// in the ParameterBag. If a key already exists, its value will be updated + /// with the new value from the provided map. + /// + /// Parameters: + /// [parameters] - A Map containing the new parameters + /// to be added to the existing set. + /// + /// Example: + /// parameterBag.add({'key1': 'newValue', 'key3': 'value3'}); + void add(Map parameters); + + /// Retrieves the value associated with the given key from the parameters. + /// + /// This method searches for the specified [key] in the parameters map. + /// If the key is found, it returns the corresponding value. + /// If the key is not found, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key to look up in the parameters map. + /// [defaultValue] - Optional. The value to return if the key is not found. + /// If not provided, it defaults to null. + /// + /// Returns: + /// The value associated with the key if found, otherwise the defaultValue. + /// + /// Example: + /// var value = parameterBag.get('username', 'guest'); + dynamic get(String key, [dynamic defaultValue]) { + return parameters.containsKey(key) ? parameters[key] : defaultValue; + } + + /// Sets a parameter value for the given key. + /// + /// This method adds or updates a parameter in the ParameterBag. + /// If the key already exists, its value will be updated. + /// If the key doesn't exist, a new key-value pair will be added. + /// + /// Parameters: + /// [key] - The string key for the parameter. + /// [value] - The value to be associated with the key. Can be of any type. + /// + /// Example: + /// parameterBag.set('username', 'john_doe'); + /// parameterBag.set('age', 30); + void set(String key, dynamic value); + + /// Checks if a parameter with the given key exists in the ParameterBag. + /// + /// This method determines whether the specified [key] is present in the + /// parameters map. It returns true if the key exists, and false otherwise. + /// + /// Parameters: + /// [key] - The string key to check for existence in the parameters map. + /// + /// Returns: + /// A boolean value: true if the key exists, false otherwise. + /// + /// Example: + /// if (parameterBag.has('username')) { + /// // Do something with the username parameter + /// } + bool has(String key) { + return parameters.containsKey(key); + } + + /// Removes a parameter from the ParameterBag. + /// + /// This method removes the key-value pair associated with the given [key] + /// from the parameters map. If the key doesn't exist, this method does nothing. + /// + /// Parameters: + /// [key] - The string key of the parameter to be removed. + /// + /// Example: + /// parameterBag.remove('username'); + void remove(String key); + + /// Returns the alphabetic characters of the parameter value. + /// + /// This method retrieves the value associated with the given [key] as a string, + /// and then removes all non-alphabetic characters from it. If the key doesn't + /// exist or its value is empty, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve and process. + /// [defaultValue] - Optional. The value to return if the key is not found + /// or its value is empty. Defaults to an empty string. + /// + /// Returns: + /// A string containing only alphabetic characters (a-z and A-Z) from the + /// original parameter value. + /// + /// Example: + /// parameterBag.set('mixed', 'abc123XYZ!@#'); + /// print(parameterBag.getAlpha('mixed')); // Outputs: 'abcXYZ' + String getAlpha(String key, [String defaultValue = '']) { + return getString(key, defaultValue).replaceAll(RegExp(r'[^a-zA-Z]'), ''); + } + + /// Returns the alphanumeric characters of the parameter value. + /// + /// This method retrieves the value associated with the given [key] as a string, + /// and then removes all non-alphanumeric characters from it. If the key doesn't + /// exist or its value is empty, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve and process. + /// [defaultValue] - Optional. The value to return if the key is not found + /// or its value is empty. Defaults to an empty string. + /// + /// Returns: + /// A string containing only alphanumeric characters (a-z, A-Z, and 0-9) from the + /// original parameter value. + /// + /// Example: + /// parameterBag.set('mixed', 'abc123XYZ!@#'); + /// print(parameterBag.getAlnum('mixed')); // Outputs: 'abc123XYZ' + String getAlnum(String key, [String defaultValue = '']) { + return getString(key, defaultValue).replaceAll(RegExp(r'[^a-zA-Z0-9]'), ''); + } + + /// Returns only the digit characters from the parameter value. + /// + /// This method retrieves the value associated with the given [key] as a string, + /// and then removes all non-digit characters from it. If the key doesn't + /// exist or its value is empty, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve and process. + /// [defaultValue] - Optional. The value to return if the key is not found + /// or its value is empty. Defaults to an empty string. + /// + /// Returns: + /// A string containing only digit characters (0-9) from the original parameter value. + /// + /// Example: + /// parameterBag.set('mixed', 'abc123XYZ!@#'); + /// print(parameterBag.getDigits('mixed')); // Outputs: '123' + String getDigits(String key, [String defaultValue = '']) { + return getString(key, defaultValue).replaceAll(RegExp(r'[^0-9]'), ''); + } + + /// Returns the parameter value as a string. + /// + /// This method retrieves the value associated with the given [key] and converts it to a string. + /// If the key doesn't exist, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve. + /// [defaultValue] - Optional. The value to return if the key is not found. + /// Defaults to an empty string. + /// + /// Returns: + /// A string representation of the parameter value. + /// + /// Throws: + /// [UnexpectedValueException] if the value cannot be converted to a string + /// (i.e., if it's not a String, num, or bool). + /// + /// Example: + /// parameterBag.set('number', 42); + /// print(parameterBag.getString('number')); // Outputs: '42' + String getString(String key, [String defaultValue = '']) { + final value = get(key, defaultValue); + if (value is! String && value is! num && value is! bool) { + throw UnexpectedValueException( + 'Parameter value "$key" cannot be converted to "String".'); + } + return value.toString(); + } + + /// Returns the parameter value converted to an integer. + /// + /// This method retrieves the value associated with the given [key] and attempts to convert it to an integer. + /// If the key doesn't exist or the value cannot be converted to an integer, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve. + /// [defaultValue] - Optional. The value to return if the key is not found or the value cannot be converted to an integer. + /// Defaults to 0. + /// + /// Returns: + /// An integer representation of the parameter value. + /// + /// Example: + /// parameterBag.set('number', '42'); + /// print(parameterBag.getInt('number')); // Outputs: 42 + /// print(parameterBag.getInt('nonexistent', 10)); // Outputs: 10 + int getInt(String key, [int defaultValue = 0]) { + final value = get(key, defaultValue); + if (value is int) return value; + if (value is String) { + return int.tryParse(value) ?? defaultValue; + } + return defaultValue; + } + + /// Returns the parameter value converted to a boolean. + /// + /// This method retrieves the value associated with the given [key] and attempts to convert it to a boolean. + /// If the key doesn't exist, it returns the [defaultValue]. + /// + /// The conversion rules are as follows: + /// - If the value is already a boolean, it is returned as-is. + /// - If the value is a string, it returns true if the string is 'true' (case-insensitive) or '1'. + /// - For all other cases, it returns the [defaultValue]. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve. + /// [defaultValue] - Optional. The value to return if the key is not found or the value cannot be converted to a boolean. + /// Defaults to false. + /// + /// Returns: + /// A boolean representation of the parameter value. + /// + /// Example: + /// parameterBag.set('flag1', 'true'); + /// parameterBag.set('flag2', '1'); + /// parameterBag.set('flag3', 'false'); + /// print(parameterBag.getBoolean('flag1')); // Outputs: true + /// print(parameterBag.getBoolean('flag2')); // Outputs: true + /// print(parameterBag.getBoolean('flag3')); // Outputs: false + /// print(parameterBag.getBoolean('nonexistent')); // Outputs: false + bool getBoolean(String key, [bool defaultValue = false]) { + final value = get(key, defaultValue); + if (value is bool) return value; + if (value is String) { + return value.toLowerCase() == 'true' || value == '1'; + } + return defaultValue; + } + + /// Returns the parameter value converted to an enum. + /// + /// This method retrieves the value associated with the given [key] and attempts to convert it + /// to an enum of type [T]. The method compares the string representation of each enum value + /// (without the enum type prefix) to the parameter value. + /// + /// Parameters: + /// [key] - The key of the parameter to retrieve. + /// [values] - A list of all possible enum values of type [T]. + /// [defaultValue] - Optional. The value to return if the key is not found or the value + /// cannot be converted to an enum. Defaults to null. + /// + /// Returns: + /// An enum value of type [T] if a match is found, otherwise returns the [defaultValue]. + /// + /// Throws: + /// [UnexpectedValueException] if the value exists but cannot be converted to an enum. + /// + /// Example: + /// enum Color { red, green, blue } + /// parameterBag.set('color', 'red'); + /// var color = parameterBag.getEnum('color', Color.values); // Returns Color.red + T? getEnum(String key, List values, [T? defaultValue]) { + final value = get(key); + if (value == null) return defaultValue; + try { + return values.firstWhere((e) => e.toString().split('.').last == value); + } catch (e) { + throw UnexpectedValueException( + 'Parameter "$key" cannot be converted to enum: ${e.toString()}'); + } + } + + /// Filters a parameter value based on the given key. + /// + /// This method retrieves the value associated with the given [key] and applies + /// basic filtering logic. If the key doesn't exist, it returns the [defaultValue]. + /// + /// The current implementation provides a simple string sanitization for string values, + /// trimming whitespace from the beginning and end. For all other types, the value + /// is returned as-is. + /// + /// This method is designed to be overridden or extended in subclasses to provide + /// more sophisticated filtering logic. + /// + /// Parameters: + /// [key] - The key of the parameter to filter. + /// [defaultValue] - Optional. The value to return if the key doesn't exist. + /// [filter] - Optional. An integer representing the filter type (not used in the base implementation). + /// [options] - Optional. Additional options for filtering (not used in the base implementation). + /// + /// Returns: + /// The filtered value if the key exists, otherwise the [defaultValue]. + /// + /// Example: + /// parameterBag.set('name', ' John Doe '); + /// print(parameterBag.filter('name')); // Outputs: 'John Doe' + dynamic filter(String key, + {dynamic defaultValue, int? filter, dynamic options}) { + if (!has(key)) { + return defaultValue; + } + + var value = get(key); + + // Basic filtering logic, can be overridden or extended in subclasses + if (value is String) { + // Simple string sanitization as an example + return value.trim(); + } + + // For other types, return as is + return value; + } + + /// Returns an iterator for the entries in the parameters map. + /// + /// This getter provides an iterator that allows for traversing all key-value + /// pairs (entries) in the underlying parameters map. It's particularly useful + /// for iterating over all parameters in the ParameterBag. + /// + /// The iterator yields [MapEntry] objects, where each entry contains a String + /// key and a dynamic value, corresponding to a parameter in the ParameterBag. + /// + /// This implementation is part of the [Iterable] interface, allowing + /// ParameterBag to be used in for-in loops and with other Iterable methods. + /// + /// Returns: + /// An [Iterator] of [MapEntry] for the parameters map. + /// + /// Example: + /// for (var entry in parameterBag) { + /// print('${entry.key}: ${entry.value}'); + /// } + @override + Iterator> get iterator => + parameters.entries.iterator; + + /// Returns the number of parameters in the ParameterBag. + /// + /// This getter provides the count of key-value pairs in the underlying + /// parameters map. It's an implementation of the [Countable] interface. + /// + /// Returns: + /// An integer representing the number of parameters stored in the ParameterBag. + /// + /// Example: + /// int parameterCount = parameterBag.count; + /// print('Number of parameters: $parameterCount'); + @override + int get count => parameters.length; +} diff --git a/packages/http/lib/src/foundation/server_bag.dart b/packages/http/lib/src/foundation/server_bag.dart new file mode 100644 index 0000000..f7577bc --- /dev/null +++ b/packages/http/lib/src/foundation/server_bag.dart @@ -0,0 +1,94 @@ +import 'dart:collection'; +import 'dart:convert'; +import 'package:protevus_http/foundation.dart'; +import 'package:protevus_http/src/foundation/parameter_bag.dart'; + +/// ServerBag is a container for HTTP headers from the server environment. +/// +/// This class extends ParameterBag and provides functionality to handle +/// HTTP headers, including special cases for authentication headers. +class ServerBag extends ParameterBag + with IterableMixin> { + final Map _parameters; + + /// Creates a new ServerBag instance. + /// + /// The constructor takes a map of server parameters and initializes + /// the ParameterBag with these parameters. + ServerBag([Map parameters = const {}]) + : _parameters = Map.from(parameters), + super(); + + // Override the getter from ParameterBag + @override + Map get parameters => _parameters; + + /// Gets the HTTP headers from the server parameters. + /// + /// This method processes the server parameters to extract and normalize + /// HTTP headers, including special handling for authentication headers. + /// + /// Returns: + /// A Map containing the extracted HTTP headers. + Map getHeaders() { + var headers = {}; + + parameters.forEach((key, value) { + if (key.startsWith('HTTP_')) { + headers[key.substring(5)] = value.toString(); + } else if (['CONTENT_TYPE', 'CONTENT_LENGTH', 'CONTENT_MD5'] + .contains(key) && + value.toString().isNotEmpty) { + headers[key] = value.toString(); + } + }); + + if (parameters.containsKey('PHP_AUTH_USER')) { + headers['PHP_AUTH_USER'] = parameters['PHP_AUTH_USER'].toString(); + headers['PHP_AUTH_PW'] = parameters['PHP_AUTH_PW']?.toString() ?? ''; + } else { + String? authorizationHeader; + if (parameters.containsKey('HTTP_AUTHORIZATION')) { + authorizationHeader = parameters['HTTP_AUTHORIZATION'].toString(); + } else if (parameters.containsKey('REDIRECT_HTTP_AUTHORIZATION')) { + authorizationHeader = + parameters['REDIRECT_HTTP_AUTHORIZATION'].toString(); + } + + if (authorizationHeader != null) { + if (authorizationHeader.toLowerCase().startsWith('basic ')) { + // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW + var decoded = + utf8.decode(base64.decode(authorizationHeader.substring(6))); + var exploded = decoded.split(':'); + if (exploded.length == 2) { + headers['PHP_AUTH_USER'] = exploded[0]; + headers['PHP_AUTH_PW'] = exploded[1]; + } + } else if (!parameters.containsKey('PHP_AUTH_DIGEST') && + authorizationHeader.toLowerCase().startsWith('digest ')) { + headers['PHP_AUTH_DIGEST'] = authorizationHeader; + parameters['PHP_AUTH_DIGEST'] = authorizationHeader; + } else if (authorizationHeader.toLowerCase().startsWith('bearer ')) { + headers['AUTHORIZATION'] = authorizationHeader; + } + } + } + + if (headers.containsKey('AUTHORIZATION')) { + return headers; + } + + // PHP_AUTH_USER/PHP_AUTH_PW + if (headers.containsKey('PHP_AUTH_USER')) { + var authUser = headers['PHP_AUTH_USER']!; + var authPw = headers['PHP_AUTH_PW'] ?? ''; + headers['AUTHORIZATION'] = + 'Basic ${base64.encode(utf8.encode('$authUser:$authPw'))}'; + } else if (headers.containsKey('PHP_AUTH_DIGEST')) { + headers['AUTHORIZATION'] = headers['PHP_AUTH_DIGEST']!; + } + + return headers; + } +} diff --git a/packages/http/lib/src/foundation/session/session_bag_interface.dart b/packages/http/lib/src/foundation/session/session_bag_interface.dart new file mode 100644 index 0000000..9e7b337 --- /dev/null +++ b/packages/http/lib/src/foundation/session/session_bag_interface.dart @@ -0,0 +1,51 @@ +/* + * This file is part of the Protevus Platform. + * This file is a port of the symfony SesssionBagInterface.php class to Dart + * + * (C) Protevus + * (C) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/// An abstract class defining the interface for session bags. +/// +/// A session bag is a storage mechanism used to group session attributes together. +/// It provides methods to manage and interact with session data. +abstract class SessionBagInterface { + /// Returns the name of this bag. + /// + /// This method should be implemented to provide a unique identifier for the bag. + /// The name is typically used to distinguish between different types of session bags. + /// + /// @return A string representing the name of the bag. + String getName(); + + /// Initializes the bag with the provided data. + /// + /// This method should be implemented to set up the initial state of the bag + /// using the given array of data. It's typically used when restoring a session + /// from storage or creating a new session with default values. + /// + /// @param array A list of dynamic values to initialize the bag with. + void initialize(List array); + + /// Gets the storage key for this bag. + /// + /// This method should be implemented to return a unique identifier used + /// for storing and retrieving the bag's data in the session storage. + /// The storage key is typically used to organize and access different + /// bags within the session storage mechanism. + /// + /// @return A string representing the storage key for this bag. + String getStorageKey(); + + /// Clears out all data from the bag and returns the cleared data. + /// + /// This method should be implemented to remove all stored attributes from the bag. + /// It's typically used when you want to reset the bag to an empty state. + /// + /// @return A dynamic value representing the data that was contained in the bag before clearing. + dynamic clear(); +} diff --git a/packages/http/lib/src/foundation/session/session_interface.dart b/packages/http/lib/src/foundation/session/session_interface.dart new file mode 100644 index 0000000..0f4da04 --- /dev/null +++ b/packages/http/lib/src/foundation/session/session_interface.dart @@ -0,0 +1,85 @@ +import 'package:protevus_http/foundation_session.dart'; +import 'package:protevus_http/foundation_storage.dart'; + +/// Interface for the session. +abstract class SessionInterface { + /// Starts the session storage. + /// + /// Throws [StateError] if session fails to start. + bool start(); + + /// Returns the session ID. + String getId(); + + /// Sets the session ID. + void setId(String id); + + /// Returns the session name. + String getName(); + + /// Sets the session name. + void setName(String name); + + /// Invalidates the current session. + /// + /// Clears all session attributes and flashes and regenerates the + /// session and deletes the old session from persistence. + /// + /// [lifetime] Sets the cookie lifetime for the session cookie. A null value + /// will leave the system settings unchanged, 0 sets the cookie + /// to expire with browser session. Time is in seconds, and is + /// not a Unix timestamp. + bool invalidate({int? lifetime}); + + /// Migrates the current session to a new session id while maintaining all + /// session attributes. + /// + /// [destroy] Whether to delete the old session or leave it to garbage collection. + /// [lifetime] Sets the cookie lifetime for the session cookie. A null value + /// will leave the system settings unchanged, 0 sets the cookie + /// to expire with browser session. Time is in seconds, and is + /// not a Unix timestamp. + bool migrate({bool destroy = false, int? lifetime}); + + /// Force the session to be saved and closed. + /// + /// This method is generally not required for real sessions as + /// the session will be automatically saved at the end of + /// code execution. + void save(); + + /// Checks if an attribute is defined. + bool has(String name); + + /// Returns an attribute. + T? get(String name, [T? defaultValue]); + + /// Sets an attribute. + void set(String name, dynamic value); + + /// Returns attributes. + Map all(); + + /// Sets attributes. + void replace(Map attributes); + + /// Removes an attribute. + /// + /// Returns the removed value or null when it does not exist. + T? remove(String name); + + /// Clears all attributes. + void clear(); + + /// Checks if the session was started. + bool isStarted(); + + /// Registers a SessionBagInterface with the session. + void registerBag(SessionBagInterface bag); + + /// Gets a bag instance by name. + SessionBagInterface getBag(String name); + + /// Gets session meta. + MetadataBag getMetadataBag(); +} diff --git a/packages/http/lib/src/foundation/storage/meta_data_bag.dart b/packages/http/lib/src/foundation/storage/meta_data_bag.dart new file mode 100644 index 0000000..a3cedeb --- /dev/null +++ b/packages/http/lib/src/foundation/storage/meta_data_bag.dart @@ -0,0 +1,101 @@ +import 'dart:io'; +import 'package:protevus_http/foundation_session.dart'; + +/// Metadata container. +/// +/// Adds metadata to the session. +class MetadataBag implements SessionBagInterface { + static const String CREATED = 'c'; + static const String UPDATED = 'u'; + static const String LIFETIME = 'l'; + + Map _meta = {CREATED: 0, UPDATED: 0, LIFETIME: 0}; + + String _name = '__metadata'; + String _storageKey; + late int _lastUsed; + int _updateThreshold; + + /// Constructor for MetadataBag. + /// + /// @param storageKey The key used to store bag in the session + /// @param updateThreshold The time to wait between two UPDATED updates + MetadataBag({String storageKey = '_sf2_meta', int updateThreshold = 0}) + : _storageKey = storageKey, + _updateThreshold = updateThreshold; + + @override + void initialize(List array) { + // In Dart, we can't use a reference to array directly, + // so we'll copy the data and update it as needed + _meta = Map.from(array.first as Map); + + if (_meta.containsKey(CREATED)) { + _lastUsed = _meta[UPDATED]!; + + int timeStamp = DateTime.now().millisecondsSinceEpoch ~/ 1000; + if (timeStamp - _meta[UPDATED]! >= _updateThreshold) { + _meta[UPDATED] = timeStamp; + } + } else { + _stampCreated(); + } + } + + /// Gets the lifetime that the session cookie was set with. + int getLifetime() { + return _meta[LIFETIME]!; + } + + /// Stamps a new session's metadata. + /// + /// @param lifetime Sets the cookie lifetime for the session cookie. A null value + /// will leave the system settings unchanged, 0 sets the cookie + /// to expire with browser session. Time is in seconds, and is + /// not a Unix timestamp. + void stampNew([int? lifetime]) { + _stampCreated(lifetime); + } + + @override + String getStorageKey() { + return _storageKey; + } + + /// Gets the created timestamp metadata. + /// + /// @return Unix timestamp + int getCreated() { + return _meta[CREATED]!; + } + + /// Gets the last used metadata. + /// + /// @return Unix timestamp + int getLastUsed() { + return _lastUsed; + } + + @override + dynamic clear() { + // nothing to do + return null; + } + + @override + String getName() { + return _name; + } + + /// Sets name. + void setName(String name) { + _name = name; + } + + void _stampCreated([int? lifetime]) { + int timeStamp = DateTime.now().millisecondsSinceEpoch ~/ 1000; + _meta[CREATED] = _meta[UPDATED] = _lastUsed = timeStamp; + _meta[LIFETIME] = lifetime ?? + int.parse(Platform.environment['SESSION_COOKIE_LIFETIME'] ?? '0'); + } +} diff --git a/packages/log/example/.gitkeep b/packages/log/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/log/example/protevus_log_example.dart b/packages/log/example/protevus_log_example.dart deleted file mode 100644 index b4437b2..0000000 --- a/packages/log/example/protevus_log_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_log/protevus_log.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/log/lib/protevus_log.dart b/packages/log/lib/protevus_log.dart deleted file mode 100644 index 49e1b4e..0000000 --- a/packages/log/lib/protevus_log.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_log_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/log/lib/src/.gitkeep b/packages/log/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/log/lib/src/protevus_log_base.dart b/packages/log/lib/src/protevus_log_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/log/lib/src/protevus_log_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/log/test/.gitkeep b/packages/log/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/log/test/protevus_log_test.dart b/packages/log/test/protevus_log_test.dart deleted file mode 100644 index bf2f346..0000000 --- a/packages/log/test/protevus_log_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_log/protevus_log.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/macroable/example/.gitkeep b/packages/macroable/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/macroable/example/protevus_macroable_example.dart b/packages/macroable/example/protevus_macroable_example.dart deleted file mode 100644 index 73acbbf..0000000 --- a/packages/macroable/example/protevus_macroable_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_macroable/protevus_macroable.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/macroable/lib/protevus_macroable.dart b/packages/macroable/lib/protevus_macroable.dart deleted file mode 100644 index d8b24ad..0000000 --- a/packages/macroable/lib/protevus_macroable.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_macroable_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/macroable/lib/src/.gitkeep b/packages/macroable/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/macroable/lib/src/protevus_macroable_base.dart b/packages/macroable/lib/src/protevus_macroable_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/macroable/lib/src/protevus_macroable_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/macroable/test/.gitkeep b/packages/macroable/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/macroable/test/protevus_macroable_test.dart b/packages/macroable/test/protevus_macroable_test.dart deleted file mode 100644 index 9d9c49f..0000000 --- a/packages/macroable/test/protevus_macroable_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_macroable/protevus_macroable.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/mail/example/.gitkeep b/packages/mail/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/mail/example/protevus_mail_example.dart b/packages/mail/example/protevus_mail_example.dart deleted file mode 100644 index 6b112cf..0000000 --- a/packages/mail/example/protevus_mail_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_mail/protevus_mail.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/mail/lib/protevus_mail.dart b/packages/mail/lib/protevus_mail.dart deleted file mode 100644 index 5f45d9b..0000000 --- a/packages/mail/lib/protevus_mail.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_mail_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/mail/lib/src/.gitkeep b/packages/mail/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/mail/lib/src/protevus_mail_base.dart b/packages/mail/lib/src/protevus_mail_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/mail/lib/src/protevus_mail_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/mail/test/.gitkeep b/packages/mail/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/mail/test/protevus_mail_test.dart b/packages/mail/test/protevus_mail_test.dart deleted file mode 100644 index 5cc3b4d..0000000 --- a/packages/mail/test/protevus_mail_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_mail/protevus_mail.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/mime/.gitignore b/packages/mime/.gitignore new file mode 100644 index 0000000..3cceda5 --- /dev/null +++ b/packages/mime/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/packages/mime/CHANGELOG.md b/packages/mime/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/packages/mime/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/packages/mime/README.md b/packages/mime/README.md new file mode 100644 index 0000000..8b55e73 --- /dev/null +++ b/packages/mime/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/packages/mime/analysis_options.yaml b/packages/mime/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/packages/mime/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/packages/mime/example/.gitkeep b/packages/mime/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/mime/lib/src/.gitkeep b/packages/mime/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/mime/pubspec.yaml b/packages/mime/pubspec.yaml new file mode 100644 index 0000000..fbab7dd --- /dev/null +++ b/packages/mime/pubspec.yaml @@ -0,0 +1,15 @@ +name: protevus_mime +description: A starting point for Dart libraries or applications. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: ^3.4.2 + +# Add regular dependencies here. +dependencies: + # path: ^1.8.0 + +dev_dependencies: + lints: ^3.0.0 + test: ^1.24.0 diff --git a/packages/mime/test/.gitkeep b/packages/mime/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/notifications/example/.gitkeep b/packages/notifications/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/notifications/example/protevus_notifications_example.dart b/packages/notifications/example/protevus_notifications_example.dart deleted file mode 100644 index 82567ce..0000000 --- a/packages/notifications/example/protevus_notifications_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_notifications/protevus_notifications.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/notifications/lib/protevus_notifications.dart b/packages/notifications/lib/protevus_notifications.dart deleted file mode 100644 index fb7634f..0000000 --- a/packages/notifications/lib/protevus_notifications.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_notifications_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/notifications/lib/src/.gitkeep b/packages/notifications/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/notifications/lib/src/protevus_notifications_base.dart b/packages/notifications/lib/src/protevus_notifications_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/notifications/lib/src/protevus_notifications_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/notifications/test/.gitkeep b/packages/notifications/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/notifications/test/protevus_notifications_test.dart b/packages/notifications/test/protevus_notifications_test.dart deleted file mode 100644 index d5d356e..0000000 --- a/packages/notifications/test/protevus_notifications_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_notifications/protevus_notifications.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/pagination/example/.gitkeep b/packages/pagination/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pagination/example/protevus_pagination_example.dart b/packages/pagination/example/protevus_pagination_example.dart deleted file mode 100644 index 760ac34..0000000 --- a/packages/pagination/example/protevus_pagination_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_pagination/protevus_pagination.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/pagination/lib/protevus_pagination.dart b/packages/pagination/lib/protevus_pagination.dart deleted file mode 100644 index 5390a80..0000000 --- a/packages/pagination/lib/protevus_pagination.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_pagination_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/pagination/lib/src/.gitkeep b/packages/pagination/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pagination/lib/src/protevus_pagination_base.dart b/packages/pagination/lib/src/protevus_pagination_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/pagination/lib/src/protevus_pagination_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/pagination/test/.gitkeep b/packages/pagination/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pagination/test/protevus_pagination_test.dart b/packages/pagination/test/protevus_pagination_test.dart deleted file mode 100644 index d599ee7..0000000 --- a/packages/pagination/test/protevus_pagination_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_pagination/protevus_pagination.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/pipeline/example/.gitkeep b/packages/pipeline/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pipeline/example/protevus_pipeline_example.dart b/packages/pipeline/example/protevus_pipeline_example.dart deleted file mode 100644 index 9666367..0000000 --- a/packages/pipeline/example/protevus_pipeline_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_pipeline/protevus_pipeline.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/pipeline/lib/protevus_pipeline.dart b/packages/pipeline/lib/protevus_pipeline.dart deleted file mode 100644 index 888ca82..0000000 --- a/packages/pipeline/lib/protevus_pipeline.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_pipeline_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/pipeline/lib/src/.gitkeep b/packages/pipeline/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pipeline/lib/src/protevus_pipeline_base.dart b/packages/pipeline/lib/src/protevus_pipeline_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/pipeline/lib/src/protevus_pipeline_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/pipeline/test/.gitkeep b/packages/pipeline/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/pipeline/test/protevus_pipeline_test.dart b/packages/pipeline/test/protevus_pipeline_test.dart deleted file mode 100644 index c6a3fb3..0000000 --- a/packages/pipeline/test/protevus_pipeline_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_pipeline/protevus_pipeline.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/process/example/.gitkeep b/packages/process/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/process/example/protevus_process_example.dart b/packages/process/example/protevus_process_example.dart deleted file mode 100644 index 665ca24..0000000 --- a/packages/process/example/protevus_process_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_process/protevus_process.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/process/lib/protevus_process.dart b/packages/process/lib/protevus_process.dart deleted file mode 100644 index 1a7cb38..0000000 --- a/packages/process/lib/protevus_process.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_process_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/process/lib/src/.gitkeep b/packages/process/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/process/lib/src/protevus_process_base.dart b/packages/process/lib/src/protevus_process_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/process/lib/src/protevus_process_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/process/test/.gitkeep b/packages/process/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/process/test/protevus_process_test.dart b/packages/process/test/protevus_process_test.dart deleted file mode 100644 index 671fac4..0000000 --- a/packages/process/test/protevus_process_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_process/protevus_process.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/queue/example/.gitkeep b/packages/queue/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/queue/example/protevus_queue_example.dart b/packages/queue/example/protevus_queue_example.dart deleted file mode 100644 index c475d86..0000000 --- a/packages/queue/example/protevus_queue_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_queue/protevus_queue.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/queue/lib/protevus_queue.dart b/packages/queue/lib/protevus_queue.dart deleted file mode 100644 index 1c45d4b..0000000 --- a/packages/queue/lib/protevus_queue.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_queue_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/queue/lib/src/.gitkeep b/packages/queue/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/queue/lib/src/protevus_queue_base.dart b/packages/queue/lib/src/protevus_queue_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/queue/lib/src/protevus_queue_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/queue/test/.gitkeep b/packages/queue/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/queue/test/protevus_queue_test.dart b/packages/queue/test/protevus_queue_test.dart deleted file mode 100644 index e26f56c..0000000 --- a/packages/queue/test/protevus_queue_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_queue/protevus_queue.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/redis/example/.gitkeep b/packages/redis/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/redis/example/protevus_redis_example.dart b/packages/redis/example/protevus_redis_example.dart deleted file mode 100644 index e4a06fc..0000000 --- a/packages/redis/example/protevus_redis_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_redis/protevus_redis.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/redis/lib/protevus_redis.dart b/packages/redis/lib/protevus_redis.dart deleted file mode 100644 index 208a562..0000000 --- a/packages/redis/lib/protevus_redis.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_redis_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/redis/lib/src/.gitkeep b/packages/redis/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/redis/lib/src/protevus_redis_base.dart b/packages/redis/lib/src/protevus_redis_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/redis/lib/src/protevus_redis_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/redis/test/.gitkeep b/packages/redis/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/redis/test/protevus_redis_test.dart b/packages/redis/test/protevus_redis_test.dart deleted file mode 100644 index b0eb1cd..0000000 --- a/packages/redis/test/protevus_redis_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_redis/protevus_redis.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/routing/example/.gitkeep b/packages/routing/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/routing/example/protevus_routing_example.dart b/packages/routing/example/protevus_routing_example.dart deleted file mode 100644 index cc6b41b..0000000 --- a/packages/routing/example/protevus_routing_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_routing/protevus_routing.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/routing/lib/protevus_routing.dart b/packages/routing/lib/protevus_routing.dart deleted file mode 100644 index 8e6c3c3..0000000 --- a/packages/routing/lib/protevus_routing.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_routing_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/routing/lib/src/.gitkeep b/packages/routing/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/routing/lib/src/protevus_routing_base.dart b/packages/routing/lib/src/protevus_routing_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/routing/lib/src/protevus_routing_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/routing/test/.gitkeep b/packages/routing/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/routing/test/protevus_routing_test.dart b/packages/routing/test/protevus_routing_test.dart deleted file mode 100644 index 48137fb..0000000 --- a/packages/routing/test/protevus_routing_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_routing/protevus_routing.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/session/example/.gitkeep b/packages/session/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/session/example/protevus_session_example.dart b/packages/session/example/protevus_session_example.dart deleted file mode 100644 index 796c983..0000000 --- a/packages/session/example/protevus_session_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_session/protevus_session.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/session/lib/protevus_session.dart b/packages/session/lib/protevus_session.dart deleted file mode 100644 index 7fef52c..0000000 --- a/packages/session/lib/protevus_session.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_session_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/session/lib/src/.gitkeep b/packages/session/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/session/lib/src/protevus_session_base.dart b/packages/session/lib/src/protevus_session_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/session/lib/src/protevus_session_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/session/test/.gitkeep b/packages/session/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/session/test/protevus_session_test.dart b/packages/session/test/protevus_session_test.dart deleted file mode 100644 index 5b00910..0000000 --- a/packages/session/test/protevus_session_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_session/protevus_session.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/support/example/.gitkeep b/packages/support/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/support/example/protevus_support_example.dart b/packages/support/example/protevus_support_example.dart deleted file mode 100644 index 8e1e379..0000000 --- a/packages/support/example/protevus_support_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_support/protevus_support.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/support/lib/protevus_support.dart b/packages/support/lib/protevus_support.dart deleted file mode 100644 index ddecc68..0000000 --- a/packages/support/lib/protevus_support.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_support_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/support/lib/src/.gitkeep b/packages/support/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/support/lib/src/protevus_support_base.dart b/packages/support/lib/src/protevus_support_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/support/lib/src/protevus_support_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/support/test/.gitkeep b/packages/support/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/support/test/protevus_support_test.dart b/packages/support/test/protevus_support_test.dart deleted file mode 100644 index 33f1540..0000000 --- a/packages/support/test/protevus_support_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_support/protevus_support.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/testing/example/protevus_testing_example.dart b/packages/testing/example/protevus_testing_example.dart deleted file mode 100644 index 1e97606..0000000 --- a/packages/testing/example/protevus_testing_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_testing/protevus_testing.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/testing/lib/protevus_testing.dart b/packages/testing/lib/protevus_testing.dart deleted file mode 100644 index c07eb9f..0000000 --- a/packages/testing/lib/protevus_testing.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_testing_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/testing/lib/src/.gitkeep b/packages/testing/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/testing/lib/src/protevus_testing_base.dart b/packages/testing/lib/src/protevus_testing_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/testing/lib/src/protevus_testing_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/testing/test/.gitkeep b/packages/testing/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/testing/test/protevus_testing_test.dart b/packages/testing/test/protevus_testing_test.dart deleted file mode 100644 index f7146a4..0000000 --- a/packages/testing/test/protevus_testing_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_testing/protevus_testing.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/translation/example/.gitkeep b/packages/translation/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/translation/example/protevus_translation_example.dart b/packages/translation/example/protevus_translation_example.dart deleted file mode 100644 index 0f23812..0000000 --- a/packages/translation/example/protevus_translation_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_translation/protevus_translation.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/translation/lib/protevus_translation.dart b/packages/translation/lib/protevus_translation.dart deleted file mode 100644 index e28cfd9..0000000 --- a/packages/translation/lib/protevus_translation.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_translation_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/translation/lib/src/.gitkeep b/packages/translation/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/translation/lib/src/protevus_translation_base.dart b/packages/translation/lib/src/protevus_translation_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/translation/lib/src/protevus_translation_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/translation/test/.gitkeep b/packages/translation/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/translation/test/protevus_translation_test.dart b/packages/translation/test/protevus_translation_test.dart deleted file mode 100644 index 5fa4570..0000000 --- a/packages/translation/test/protevus_translation_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_translation/protevus_translation.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/validation/example/.gitkeep b/packages/validation/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/validation/example/protevus_validation_example.dart b/packages/validation/example/protevus_validation_example.dart deleted file mode 100644 index 72c3113..0000000 --- a/packages/validation/example/protevus_validation_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_validation/protevus_validation.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/validation/lib/protevus_validation.dart b/packages/validation/lib/protevus_validation.dart deleted file mode 100644 index 506a8c2..0000000 --- a/packages/validation/lib/protevus_validation.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_validation_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/validation/lib/src/.gitkeep b/packages/validation/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/validation/lib/src/protevus_validation_base.dart b/packages/validation/lib/src/protevus_validation_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/validation/lib/src/protevus_validation_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/validation/test/.gitkeep b/packages/validation/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/validation/test/protevus_validation_test.dart b/packages/validation/test/protevus_validation_test.dart deleted file mode 100644 index b30d75d..0000000 --- a/packages/validation/test/protevus_validation_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_validation/protevus_validation.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/packages/view/example/.gitkeep b/packages/view/example/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/view/example/protevus_view_example.dart b/packages/view/example/protevus_view_example.dart deleted file mode 100644 index 8de3916..0000000 --- a/packages/view/example/protevus_view_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:protevus_view/protevus_view.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/packages/view/lib/protevus_view.dart b/packages/view/lib/protevus_view.dart deleted file mode 100644 index 234be16..0000000 --- a/packages/view/lib/protevus_view.dart +++ /dev/null @@ -1,8 +0,0 @@ -/// Support for doing something awesome. -/// -/// More dartdocs go here. -library; - -export 'src/protevus_view_base.dart'; - -// TODO: Export any libraries intended for clients of this package. diff --git a/packages/view/lib/src/.gitkeep b/packages/view/lib/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/view/lib/src/protevus_view_base.dart b/packages/view/lib/src/protevus_view_base.dart deleted file mode 100644 index e8a6f15..0000000 --- a/packages/view/lib/src/protevus_view_base.dart +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Put public facing types in this file. - -/// Checks if you are awesome. Spoiler: you are. -class Awesome { - bool get isAwesome => true; -} diff --git a/packages/view/test/.gitkeep b/packages/view/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/packages/view/test/protevus_view_test.dart b/packages/view/test/protevus_view_test.dart deleted file mode 100644 index 4fd29b5..0000000 --- a/packages/view/test/protevus_view_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:protevus_view/protevus_view.dart'; -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - expect(awesome.isAwesome, isTrue); - }); - }); -}