add: adding laravel style collections, macroable, support packages

This commit is contained in:
Patrick Stewart 2024-12-15 18:34:28 -07:00
parent 7ed14cef1e
commit a96ec3a301
467 changed files with 32715 additions and 665 deletions

View file

@ -1,6 +1,7 @@
name: protevus_platform
repository: https://github.com/protevus/platform
packages:
- fig/**
- common/**
- drivers/**
- packages/**

7
fig/cache/.gitignore vendored Normal file
View file

@ -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

3
fig/cache/CHANGELOG.md vendored Normal file
View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

10
fig/cache/LICENSE.md vendored Normal file
View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
fig/cache/README.md vendored Normal file
View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

30
fig/cache/analysis_options.yaml vendored Normal file
View file

@ -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

0
fig/cache/doc/.gitkeep vendored Normal file
View file

0
fig/cache/example/.gitkeep vendored Normal file
View file

9
fig/cache/lib/cache.dart vendored Normal file
View file

@ -0,0 +1,9 @@
/// A PSR-6 compatible caching library for Dart.
///
/// This library provides interfaces for caching implementations following
/// the PSR-6 Cache Interface specification.
library cache;
export 'src/cache_item_interface.dart';
export 'src/cache_item_pool_interface.dart';
export 'src/exceptions.dart';

View file

@ -0,0 +1,31 @@
/// A cache item interface representing a single cache entry.
abstract class CacheItemInterface {
/// The key for this cache item.
String get key;
/// Retrieves the value of the item from the cache.
///
/// Returns null if the item does not exist or has expired.
dynamic get();
/// Confirms if the cache item lookup resulted in a cache hit.
bool get isHit;
/// Sets the value represented by this cache item.
///
/// [value] The serializable value to be stored.
/// Returns the invoked object.
CacheItemInterface set(dynamic value);
/// Sets the expiration time for this cache item.
///
/// [expiration] The point in time after which the item MUST be considered expired.
/// Returns the invoked object.
CacheItemInterface expiresAt(DateTime? expiration);
/// Sets the expiration time for this cache item relative to the current time.
///
/// [time] The period of time from now after which the item MUST be considered expired.
/// Returns the invoked object.
CacheItemInterface expiresAfter(Duration? time);
}

View file

@ -0,0 +1,61 @@
import 'cache_item_interface.dart';
/// A cache pool interface for managing cache items.
abstract class CacheItemPoolInterface {
/// Returns a Cache Item representing the specified key.
///
/// [key] The key for which to return the corresponding Cache Item.
/// Returns The corresponding Cache Item.
/// Throws InvalidArgumentException if the [key] string is not valid.
CacheItemInterface getItem(String key);
/// Returns a list of Cache Items keyed by the cache keys provided.
///
/// [keys] A list of keys that can be obtained in a single operation.
/// Returns A list of Cache Items indexed by the cache keys.
/// Throws InvalidArgumentException if any of the keys in [keys] is not valid.
Map<String, CacheItemInterface> getItems(List<String> keys);
/// Confirms if the cache contains specified cache item.
///
/// [key] The key for which to check existence.
/// Returns true if item exists in the cache and false otherwise.
/// Throws InvalidArgumentException if the [key] string is not valid.
bool hasItem(String key);
/// Deletes all items in the pool.
///
/// Returns true if the pool was successfully cleared. False if there was an error.
bool clear();
/// Removes the item from the pool.
///
/// [key] The key to delete.
/// Returns true if the item was successfully removed. False if there was an error.
/// Throws InvalidArgumentException if the [key] string is not valid.
bool deleteItem(String key);
/// Removes multiple items from the pool.
///
/// [keys] A list of keys that should be removed.
/// Returns true if the items were successfully removed. False if there was an error.
/// Throws InvalidArgumentException if any of the keys in [keys] is not valid.
bool deleteItems(List<String> keys);
/// Persists a cache item immediately.
///
/// [item] The cache item to save.
/// Returns true if the item was successfully persisted. False if there was an error.
bool save(CacheItemInterface item);
/// Persists multiple cache items immediately.
///
/// [items] A list of cache items to save.
/// Returns true if all items were successfully persisted. False if there was an error.
bool saveDeferred(CacheItemInterface item);
/// Persists any deferred cache items.
///
/// Returns true if all not-yet-saved items were successfully persisted. False if there was an error.
bool commit();
}

23
fig/cache/lib/src/exceptions.dart vendored Normal file
View file

@ -0,0 +1,23 @@
/// Base exception interface for cache exceptions.
class CacheException implements Exception {
/// The error message.
final String message;
/// Creates a new cache exception.
const CacheException([this.message = '']);
@override
String toString() =>
message.isEmpty ? 'CacheException' : 'CacheException: $message';
}
/// Exception interface for invalid cache arguments.
class InvalidArgumentException extends CacheException {
/// Creates a new invalid argument exception.
const InvalidArgumentException([String message = '']) : super(message);
@override
String toString() => message.isEmpty
? 'InvalidArgumentException'
: 'InvalidArgumentException: $message';
}

13
fig/cache/pubspec.yaml vendored Normal file
View file

@ -0,0 +1,13 @@
name: dsr_cache
description: A PSR-6 compatible caching interface for Dart. Provides standardized interfaces for cache implementations including CacheItemInterface and CacheItemPoolInterface.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

0
fig/cache/test/.gitkeep vendored Normal file
View file

7
fig/clock/.gitignore vendored Normal file
View file

@ -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

3
fig/clock/CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

10
fig/clock/LICENSE.md Normal file
View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
fig/clock/README.md Normal file
View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

0
fig/clock/doc/.gitkeep Normal file
View file

View file

7
fig/clock/lib/clock.dart Normal file
View file

@ -0,0 +1,7 @@
/// A PSR-20 compatible clock interface for Dart.
///
/// This library provides a minimal interface for reading the current time,
/// following the PSR-20 Clock Interface specification.
library clock;
export 'src/clock_interface.dart';

View file

@ -0,0 +1,10 @@
/// A minimal interface for reading the current time.
///
/// This interface follows PSR-20 Clock Interface specification.
abstract class ClockInterface {
/// Returns the current time as a DateTime instance.
///
/// The returned DateTime MUST be an immutable value object.
/// The timezone of the returned value is not guaranteed and should not be relied upon.
DateTime now();
}

13
fig/clock/pubspec.yaml Normal file
View file

@ -0,0 +1,13 @@
name: dsr_clock
description: A PSR-20 compatible clock interface for Dart. Provides a minimal, standardized interface for reading the current time across different implementations.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

0
fig/clock/test/.gitkeep Normal file
View file

7
fig/container/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

10
fig/container/LICENSE.md Normal file
View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
fig/container/README.md Normal file
View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,8 @@
/// A PSR-11 compatible container interface for Dart.
///
/// This library provides interfaces for dependency injection containers
/// following the PSR-11 Container Interface specification.
library container;
export 'src/container_interface.dart';
export 'src/exceptions.dart';

View file

@ -0,0 +1,25 @@
import 'exceptions.dart';
/// Describes the interface of a container that exposes methods to read its entries.
abstract class ContainerInterface {
/// Finds an entry of the container by its identifier and returns it.
///
/// [id] Identifier of the entry to look for.
///
/// Returns the entry.
///
/// Throws [NotFoundExceptionInterface] if no entry was found for **this** identifier.
/// Throws [ContainerExceptionInterface] if an error occurred while retrieving the entry.
dynamic get(String id);
/// Returns true if the container can return an entry for the given identifier.
/// Returns false otherwise.
///
/// [id] Identifier of the entry to look for.
///
/// Returns true if the container can return an entry for the given identifier.
/// Returns false otherwise.
///
/// Throws [ContainerExceptionInterface] if an error occurred while retrieving the entry.
bool has(String id);
}

View file

@ -0,0 +1,45 @@
/// Base interface representing a generic exception in a container.
abstract class ContainerExceptionInterface implements Exception {
/// The error message.
String get message;
}
/// Interface representing an exception when a requested entry is not found.
abstract class NotFoundExceptionInterface
implements ContainerExceptionInterface {
/// The ID that was not found.
String get id;
}
/// A concrete implementation of ContainerExceptionInterface.
class ContainerException implements ContainerExceptionInterface {
@override
final String message;
/// Creates a new container exception.
const ContainerException([this.message = '']);
@override
String toString() =>
message.isEmpty ? 'ContainerException' : 'ContainerException: $message';
}
/// A concrete implementation of NotFoundExceptionInterface.
class NotFoundException implements NotFoundExceptionInterface {
@override
final String message;
@override
final String id;
/// Creates a new not found exception.
const NotFoundException(this.id, [this.message = '']);
@override
String toString() {
if (message.isEmpty) {
return 'NotFoundException: No entry was found for "$id" identifier';
}
return 'NotFoundException: $message';
}
}

View file

@ -0,0 +1,13 @@
name: dsr_container
description: A PSR-11 compatible container interface for Dart. Provides standardized interfaces for dependency injection containers including ContainerInterface and related exceptions.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View file

7
fig/event_dispatcher/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,9 @@
/// A PSR-14 compatible event dispatcher interface for Dart.
///
/// This library provides interfaces for event dispatching systems
/// following the PSR-14 Event Dispatcher specification.
library event_dispatcher;
export 'src/event_dispatcher_interface.dart';
export 'src/listener_provider_interface.dart';
export 'src/stoppable_event_interface.dart';

View file

@ -0,0 +1,16 @@
/// Interface for event dispatchers.
abstract class EventDispatcherInterface {
/// Provides all relevant listeners with an event to process.
///
/// [event] The object to process.
///
/// Returns the Event that was passed, now modified by listeners.
///
/// The dispatcher should invoke each listener with the supplied event.
/// If a listener returns an Event object, that object should replace the one
/// passed to other listeners.
///
/// The function MUST return an event object, which MAY be the same as the
/// event passed or MAY be a new Event object.
Object dispatch(Object event);
}

View file

@ -0,0 +1,13 @@
/// Interface for event listener providers.
abstract class ListenerProviderInterface {
/// Gets the listeners for a specific event.
///
/// [event] An event for which to return the relevant listeners.
/// Returns an iterable of callables that can handle the event.
///
/// Each callable MUST be type-compatible with the event.
/// Each callable MUST accept a single parameter: the event.
/// Each callable SHOULD have a void return type.
/// Each callable MAY be an instance of a class that implements __invoke().
Iterable<Function> getListenersForEvent(Object event);
}

View file

@ -0,0 +1,8 @@
/// Interface for events that can be stopped from further propagation.
abstract class StoppableEventInterface {
/// Whether no further event listeners should be triggered.
///
/// Returns true if the event is complete and no further listeners should be called.
/// Returns false to continue calling listeners.
bool isPropagationStopped();
}

View file

@ -0,0 +1,13 @@
name: dsr_event_dispatcher
description: A PSR-14 compatible event dispatcher interface for Dart. Provides standardized interfaces for event handling including EventDispatcherInterface, ListenerProviderInterface, and StoppableEventInterface.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View file

7
fig/http_client/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,8 @@
/// A PSR-18 compatible HTTP client interface for Dart.
///
/// This library provides interfaces for HTTP clients following
/// the PSR-18 HTTP Client Interface specification.
library http_client;
export 'src/client_interface.dart';
export 'src/exceptions.dart';

View file

@ -0,0 +1,33 @@
import 'exceptions.dart';
/// Interface for sending HTTP requests.
///
/// Implementations MUST NOT take HTTP method, URI, headers, or body as parameters.
/// Instead, they MUST take a single Request object implementing PSR-7's RequestInterface.
abstract class ClientInterface {
/// Sends a PSR-7 request and returns a PSR-7 response.
///
/// [request] The request object implementing PSR-7's RequestInterface.
///
/// Returns a response object implementing PSR-7's ResponseInterface.
///
/// Throws [ClientExceptionInterface] If an error happens while processing the request.
/// Throws [NetworkExceptionInterface] If the request cannot be sent due to a network error.
/// Throws [RequestExceptionInterface] If the request is not a well-formed HTTP request or cannot be sent.
dynamic sendRequest(dynamic request);
/// Sends multiple PSR-7 requests concurrently.
///
/// [requests] An iterable of request objects implementing PSR-7's RequestInterface.
///
/// Returns a map of responses where the key is the request and the value is either:
/// - A response object implementing PSR-7's ResponseInterface
/// - A ClientExceptionInterface if the request failed
///
/// This method is optional and implementations may throw
/// [UnsupportedError] if they don't support concurrent requests.
Map<dynamic, dynamic> sendConcurrentRequests(Iterable<dynamic> requests) {
throw UnsupportedError(
'Concurrent requests are not supported by this client');
}
}

View file

@ -0,0 +1,62 @@
/// Base interface for HTTP client exceptions.
abstract class ClientExceptionInterface implements Exception {
/// The error message.
String get message;
}
/// Exception for when a request cannot be sent.
abstract class RequestExceptionInterface implements ClientExceptionInterface {
/// The request that caused the exception.
dynamic get request;
}
/// Exception for network-related errors.
abstract class NetworkExceptionInterface implements ClientExceptionInterface {
/// The request that caused the exception.
dynamic get request;
}
/// A concrete implementation of ClientExceptionInterface.
class ClientException implements ClientExceptionInterface {
@override
final String message;
/// Creates a new client exception.
const ClientException([this.message = '']);
@override
String toString() =>
message.isEmpty ? 'ClientException' : 'ClientException: $message';
}
/// A concrete implementation of RequestExceptionInterface.
class RequestException implements RequestExceptionInterface {
@override
final String message;
@override
final dynamic request;
/// Creates a new request exception.
const RequestException(this.request, [this.message = '']);
@override
String toString() =>
message.isEmpty ? 'RequestException' : 'RequestException: $message';
}
/// A concrete implementation of NetworkExceptionInterface.
class NetworkException implements NetworkExceptionInterface {
@override
final String message;
@override
final dynamic request;
/// Creates a new network exception.
const NetworkException(this.request, [this.message = '']);
@override
String toString() =>
message.isEmpty ? 'NetworkException' : 'NetworkException: $message';
}

View file

@ -0,0 +1,13 @@
name: dsr_http_client
description: A PSR-18 compatible HTTP client interface for Dart. Provides standardized interfaces for sending HTTP requests including ClientInterface and related exceptions.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View file

7
fig/http_factory/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,9 @@
/// A PSR-17 compatible HTTP factory interface for Dart.
///
/// This library provides interfaces for HTTP message factories following
/// the PSR-17 HTTP Factory Interface specification.
library http_factory;
export 'src/request_factory_interface.dart';
export 'src/stream_factory_interface.dart';
export 'src/uri_factory_interface.dart';

View file

@ -0,0 +1,38 @@
/// Factory interface for creating PSR-7 Request instances.
abstract class RequestFactoryInterface {
/// Creates a new PSR-7 Request instance.
///
/// [method] The HTTP method associated with the request.
/// [uri] The URI associated with the request, as a string or UriInterface.
///
/// Returns a new PSR-7 Request instance.
dynamic createRequest(String method, dynamic uri);
}
/// Factory interface for creating PSR-7 ServerRequest instances.
abstract class ServerRequestFactoryInterface {
/// Creates a new PSR-7 ServerRequest instance.
///
/// [method] The HTTP method associated with the request.
/// [uri] The URI associated with the request, as a string or UriInterface.
/// [serverParams] Array of SAPI parameters.
///
/// Returns a new PSR-7 ServerRequest instance.
dynamic createServerRequest(
String method,
dynamic uri, [
Map<String, dynamic> serverParams = const {},
]);
}
/// Factory interface for creating PSR-7 Response instances.
abstract class ResponseFactoryInterface {
/// Creates a new PSR-7 Response instance.
///
/// [code] The HTTP status code. The value MUST be between 100 and 599.
/// [reasonPhrase] The reason phrase to associate with the status code.
/// If none is provided, implementations MAY use the defaults.
///
/// Returns a new PSR-7 Response instance.
dynamic createResponse([int code = 200, String? reasonPhrase]);
}

View file

@ -0,0 +1,44 @@
/// Factory interface for creating PSR-7 Stream instances.
abstract class StreamFactoryInterface {
/// Creates a new PSR-7 Stream instance from a string.
///
/// [content] The content with which to populate the stream.
///
/// Returns a new PSR-7 Stream instance.
dynamic createStream([String content = '']);
/// Creates a new PSR-7 Stream instance from an existing file.
///
/// [filename] The filename or stream URI to use as basis of stream.
/// [mode] The mode with which to open the underlying filename/stream.
///
/// Returns a new PSR-7 Stream instance.
dynamic createStreamFromFile(String filename, [String mode = 'r']);
/// Creates a new PSR-7 Stream instance from an existing resource.
///
/// [resource] The PHP resource to use as the basis for the stream.
///
/// Returns a new PSR-7 Stream instance.
dynamic createStreamFromResource(dynamic resource);
}
/// Factory interface for creating PSR-7 UploadedFile instances.
abstract class UploadedFileFactoryInterface {
/// Creates a new PSR-7 UploadedFile instance.
///
/// [stream] The underlying stream representing the uploaded file content.
/// [size] The size of the file in bytes.
/// [errorStatus] The PHP upload error status.
/// [clientFilename] The filename as provided by the client.
/// [clientMediaType] The media type as provided by the client.
///
/// Returns a new PSR-7 UploadedFile instance.
dynamic createUploadedFile(
dynamic stream, [
int? size,
int errorStatus = 0,
String? clientFilename,
String? clientMediaType,
]);
}

View file

@ -0,0 +1,13 @@
/// Factory interface for creating PSR-7 Uri instances.
abstract class UriFactoryInterface {
/// Creates a new PSR-7 Uri instance.
///
/// [uri] The URI to parse.
///
/// Returns a new PSR-7 Uri instance.
/// Implementations MUST support URIs as specified in RFC 3986.
///
/// If the [uri] string is malformed, implementations MUST throw
/// an exception that implements Throwable.
dynamic createUri(String uri);
}

View file

@ -0,0 +1,13 @@
name: dsr_http_factory
description: A PSR-17 compatible HTTP factory interface for Dart. Provides standardized interfaces for creating PSR-7 HTTP message objects including requests, responses, streams, and URIs.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View file

7
fig/http_message/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,12 @@
/// A PSR-7 compatible HTTP message interface for Dart.
///
/// This library provides interfaces for HTTP messages following
/// the PSR-7 HTTP Message Interface specification.
library http_message;
export 'src/message_interface.dart';
export 'src/request_interface.dart';
export 'src/response_interface.dart';
export 'src/stream_interface.dart';
export 'src/uploaded_file_interface.dart';
export 'src/uri_interface.dart';

View file

@ -0,0 +1,75 @@
import 'stream_interface.dart';
/// Base HTTP message interface.
///
/// This interface represents both HTTP requests and responses, providing
/// the methods that are common to both types of messages.
abstract class MessageInterface {
/// Retrieves the HTTP protocol version as a string.
///
/// Returns the HTTP protocol version (e.g., "1.0", "1.1", "2.0").
String getProtocolVersion();
/// Return an instance with the specified HTTP protocol version.
///
/// [version] HTTP protocol version.
///
/// Returns a new instance with the specified version.
MessageInterface withProtocolVersion(String version);
/// Retrieves all message header values.
///
/// Returns an associative array of header names to their values.
Map<String, List<String>> getHeaders();
/// Checks if a header exists by the given case-insensitive name.
///
/// [name] Case-insensitive header field name.
///
/// Returns true if any header names match the given name using a
/// case-insensitive string comparison. Returns false otherwise.
bool hasHeader(String name);
/// Retrieves a message header value by the given case-insensitive name.
///
/// [name] Case-insensitive header field name.
///
/// Returns a list of string values as provided for the header.
/// Returns an empty list if the header does not exist.
List<String> getHeader(String name);
/// Return an instance with the provided value replacing the specified header.
///
/// [name] Case-insensitive header field name.
/// [value] Header value(s).
///
/// Returns a new instance with the specified header.
MessageInterface withHeader(String name, dynamic value);
/// Return an instance with the specified header appended with the given value.
///
/// [name] Case-insensitive header field name.
/// [value] Header value(s).
///
/// Returns a new instance with the appended header values.
MessageInterface withAddedHeader(String name, dynamic value);
/// Return an instance without the specified header.
///
/// [name] Case-insensitive header field name.
///
/// Returns a new instance without the specified header.
MessageInterface withoutHeader(String name);
/// Gets the body of the message.
///
/// Returns the body as a stream.
StreamInterface getBody();
/// Return an instance with the specified message body.
///
/// [body] The new message body.
///
/// Returns a new instance with the specified body.
MessageInterface withBody(StreamInterface body);
}

View file

@ -0,0 +1,142 @@
import 'message_interface.dart';
import 'uri_interface.dart';
/// Representation of an outgoing, client-side request.
abstract class RequestInterface implements MessageInterface {
/// Retrieves the message's request target.
///
/// Returns the message's request target.
String getRequestTarget();
/// Return an instance with the specific request-target.
///
/// [requestTarget] The request target.
///
/// Returns a new instance with the specified request target.
RequestInterface withRequestTarget(String requestTarget);
/// Retrieves the HTTP method of the request.
///
/// Returns the HTTP method.
String getMethod();
/// Return an instance with the provided HTTP method.
///
/// [method] Case-sensitive method.
///
/// Returns a new instance with the specified method.
RequestInterface withMethod(String method);
/// Retrieves the URI instance.
///
/// Returns a UriInterface instance representing the URI of the request.
UriInterface getUri();
/// Returns an instance with the provided URI.
///
/// [uri] New request URI.
/// [preserveHost] Preserve the original state of the Host header.
///
/// Returns a new instance with the specified URI.
RequestInterface withUri(UriInterface uri, [bool preserveHost = false]);
}
/// Representation of an incoming, server-side HTTP request.
///
/// Per the HTTP specification, this interface includes properties for
/// each of the following:
/// - Protocol version
/// - HTTP method
/// - URI
/// - Headers
/// - Message body
///
/// Additionally, it encapsulates all data as it has arrived to the
/// application from the CGI and/or PHP environment, including:
/// - The values represented in $_SERVER.
/// - Any cookies provided (generally via $_COOKIE)
/// - Query string arguments (generally via $_GET, or as parsed via parse_str())
/// - Upload files, if any (as represented by $_FILES)
/// - Deserialized body parameters (generally from $_POST)
abstract class ServerRequestInterface implements RequestInterface {
/// Retrieve server parameters.
///
/// Returns a map of server parameters.
Map<String, String> getServerParams();
/// Retrieve cookies.
///
/// Returns a map of cookie name/value pairs.
Map<String, String> getCookieParams();
/// Return an instance with the specified cookies.
///
/// [cookies] The map of cookie name/value pairs.
///
/// Returns a new instance with the specified cookies.
ServerRequestInterface withCookieParams(Map<String, String> cookies);
/// Retrieve query string arguments.
///
/// Returns a map of query string arguments.
Map<String, dynamic> getQueryParams();
/// Return an instance with the specified query string arguments.
///
/// [query] The map of query string arguments.
///
/// Returns a new instance with the specified query string arguments.
ServerRequestInterface withQueryParams(Map<String, dynamic> query);
/// Retrieve normalized file upload data.
///
/// Returns a normalized tree of file upload data.
Map<String, dynamic> getUploadedFiles();
/// Create a new instance with the specified uploaded files.
///
/// [uploadedFiles] A normalized tree of uploaded file data.
///
/// Returns a new instance with the specified uploaded files.
ServerRequestInterface withUploadedFiles(Map<String, dynamic> uploadedFiles);
/// Retrieve any parameters provided in the request body.
///
/// Returns the deserialized body parameters, if any.
dynamic getParsedBody();
/// Return an instance with the specified body parameters.
///
/// [data] The deserialized body data.
///
/// Returns a new instance with the specified body parameters.
ServerRequestInterface withParsedBody(dynamic data);
/// Retrieve attributes derived from the request.
///
/// Returns a map of attributes.
Map<String, dynamic> getAttributes();
/// Retrieve a single derived request attribute.
///
/// [name] The attribute name.
/// [defaultValue] Default value to return if the attribute does not exist.
///
/// Returns the attribute value or default value.
dynamic getAttribute(String name, [dynamic defaultValue]);
/// Return an instance with the specified derived request attribute.
///
/// [name] The attribute name.
/// [value] The value of the attribute.
///
/// Returns a new instance with the specified attribute.
ServerRequestInterface withAttribute(String name, dynamic value);
/// Return an instance without the specified derived request attribute.
///
/// [name] The attribute name.
///
/// Returns a new instance without the specified attribute.
ServerRequestInterface withoutAttribute(String name);
}

View file

@ -0,0 +1,25 @@
import 'message_interface.dart';
/// Representation of an outgoing, server-side response.
abstract class ResponseInterface implements MessageInterface {
/// Gets the response status code.
///
/// Returns the status code.
int getStatusCode();
/// Return an instance with the specified status code and, optionally, reason phrase.
///
/// [code] The 3-digit integer result code to set.
/// [reasonPhrase] The reason phrase to use with the
/// provided status code; if none is provided, implementations MAY
/// use the defaults as suggested in the HTTP specification.
///
/// Returns a new instance with the specified status code and, optionally, reason phrase.
/// Throws ArgumentError for invalid status code arguments.
ResponseInterface withStatus(int code, [String? reasonPhrase]);
/// Gets the response reason phrase associated with the status code.
///
/// Returns the reason phrase; must return an empty string if none present.
String getReasonPhrase();
}

View file

@ -0,0 +1,86 @@
/// Interface for representing a data stream.
abstract class StreamInterface {
/// Reads all data from the stream into a string.
///
/// Returns the data from the stream as a string.
/// Throws Exception if an error occurs.
String toString();
/// Closes the stream and any underlying resources.
void close();
/// Separates any underlying resources from the stream.
///
/// After the stream has been detached, the stream is in an unusable state.
/// Returns underlying PHP stream if one is available.
dynamic detach();
/// Get the size of the stream if known.
///
/// Returns the size in bytes if known, or null if unknown.
int? getSize();
/// Returns the current position of the file read/write pointer.
///
/// Returns the position as int.
/// Throws Exception on error.
int tell();
/// Returns true if the stream is at the end of the stream.
bool isEof();
/// Returns whether or not the stream is seekable.
bool isSeekable();
/// Seek to a position in the stream.
///
/// [offset] Stream offset.
/// [whence] Specifies how the cursor position will be calculated.
///
/// Throws Exception on failure.
void seek(int offset, [int whence = 0]);
/// Seek to the beginning of the stream.
///
/// If the stream is not seekable, this method will raise an exception;
/// otherwise, it will perform a seek(0).
///
/// Throws Exception on failure.
void rewind();
/// Returns whether or not the stream is writable.
bool isWritable();
/// Write data to the stream.
///
/// [string] The string that is to be written.
///
/// Returns the number of bytes written to the stream.
/// Throws Exception on failure.
int write(String string);
/// Returns whether or not the stream is readable.
bool isReadable();
/// Read data from the stream.
///
/// [length] Read up to [length] bytes from the object and return them.
///
/// Returns the data read from the stream, or null if no bytes are available.
/// Throws Exception if an error occurs.
String? read(int length);
/// Returns the remaining contents in a string.
///
/// Returns the remaining contents of the stream.
/// Throws Exception if unable to read or an error occurs while reading.
String getContents();
/// Get stream metadata as an associative array or retrieve a specific key.
///
/// [key] Specific metadata to retrieve.
///
/// Returns an associative array if no key is provided.
/// Returns null if the key is not found or the metadata cannot be determined.
dynamic getMetadata([String? key]);
}

View file

@ -0,0 +1,41 @@
import 'stream_interface.dart';
/// Value object representing a file uploaded through an HTTP request.
abstract class UploadedFileInterface {
/// Retrieve a stream representing the uploaded file.
///
/// Returns a StreamInterface instance.
/// Throws Exception if the upload was not successful.
StreamInterface getStream();
/// Move the uploaded file to a new location.
///
/// [targetPath] Path to which to move the uploaded file.
///
/// Throws Exception on any error during the move operation.
/// Throws Exception on invalid [targetPath].
void moveTo(String targetPath);
/// Retrieve the file size.
///
/// Returns the file size in bytes or null if unknown.
int? getSize();
/// Retrieve the error associated with the uploaded file.
///
/// Returns one of the UPLOAD_ERR_XXX constants.
/// Returns UPLOAD_ERR_OK if no error occurred.
int getError();
/// Retrieve the filename sent by the client.
///
/// Returns the filename sent by the client or null if none
/// was provided.
String? getClientFilename();
/// Retrieve the media type sent by the client.
///
/// Returns the media type sent by the client or null if none
/// was provided.
String? getClientMediaType();
}

View file

@ -0,0 +1,105 @@
/// Value object representing a URI.
///
/// This interface is meant to represent URIs according to RFC 3986 and to
/// provide methods for most common operations.
abstract class UriInterface {
/// Retrieve the scheme component of the URI.
///
/// Returns the URI scheme or empty string if not present.
String getScheme();
/// Retrieve the authority component of the URI.
///
/// Returns the URI authority in lowercase, or empty string if not present.
String getAuthority();
/// Retrieve the user information component of the URI.
///
/// Returns the URI user information, or empty string if not present.
String getUserInfo();
/// Retrieve the host component of the URI.
///
/// Returns the URI host in lowercase, or empty string if not present.
String getHost();
/// Retrieve the port component of the URI.
///
/// Returns the URI port as an integer, or null if not present.
int? getPort();
/// Retrieve the path component of the URI.
///
/// Returns the URI path.
String getPath();
/// Retrieve the query string of the URI.
///
/// Returns the URI query string, or empty string if not present.
String getQuery();
/// Retrieve the fragment component of the URI.
///
/// Returns the URI fragment, or empty string if not present.
String getFragment();
/// Return an instance with the specified scheme.
///
/// [scheme] The scheme to use with the new instance.
///
/// Returns a new instance with the specified scheme.
/// Throws ArgumentError for invalid schemes.
UriInterface withScheme(String scheme);
/// Return an instance with the specified user information.
///
/// [user] The user name to use for authority.
/// [password] The password associated with [user].
///
/// Returns a new instance with the specified user information.
UriInterface withUserInfo(String user, [String? password]);
/// Return an instance with the specified host.
///
/// [host] The hostname to use with the new instance.
///
/// Returns a new instance with the specified host.
/// Throws ArgumentError for invalid hostnames.
UriInterface withHost(String host);
/// Return an instance with the specified port.
///
/// [port] The port to use with the new instance.
///
/// Returns a new instance with the specified port.
/// Throws ArgumentError for invalid ports.
UriInterface withPort(int? port);
/// Return an instance with the specified path.
///
/// [path] The path to use with the new instance.
///
/// Returns a new instance with the specified path.
/// Throws ArgumentError for invalid paths.
UriInterface withPath(String path);
/// Return an instance with the specified query string.
///
/// [query] The query string to use with the new instance.
///
/// Returns a new instance with the specified query string.
/// Throws ArgumentError for invalid query strings.
UriInterface withQuery(String query);
/// Return an instance with the specified fragment.
///
/// [fragment] The fragment to use with the new instance.
///
/// Returns a new instance with the specified fragment.
UriInterface withFragment(String fragment);
/// Return the string representation of the URI.
///
/// Returns string representation of the URI.
String toString();
}

View file

@ -0,0 +1,13 @@
name: dsr_http_message
description: A PSR-7 compatible HTTP message interface for Dart. Provides standardized interfaces for HTTP messages including requests, responses, streams, URIs, and uploaded files.
version: 0.0.1
homepage: https://dart-fig.org
environment:
sdk: ^3.4.2
dependencies: {}
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View file

7
fig/http_server_handler/.gitignore vendored Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

View file

@ -0,0 +1,10 @@
The MIT License (MIT)
The Laravel Framework is Copyright (c) Taylor Otwell
The Fabric Framework is Copyright (c) Vieo, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1 @@
<p align="center"><a href="https://protevus.com" target="_blank"><img src="https://git.protevus.com/protevus/branding/raw/branch/main/protevus-logo-bg.png"></a></p>

View file

@ -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

View file

View file

View file

@ -0,0 +1,7 @@
/// A PSR-15 compatible HTTP server handler interface for Dart.
///
/// This library provides the interface for HTTP server request handlers
/// following the PSR-15 HTTP Server Handler specification.
library http_server_handler;
export 'src/request_handler_interface.dart';

View file

@ -0,0 +1,15 @@
import 'package:dsr_http_message/http_message.dart';
/// Interface for request handlers.
///
/// A request handler processes an HTTP request and produces an HTTP response.
/// This interface defines the methods required to use the request handler.
abstract class RequestHandlerInterface {
/// Handles a request and produces a response.
///
/// [request] The server request object.
///
/// Returns a response implementing ResponseInterface.
/// May throw any throwable as needed.
ResponseInterface handle(ServerRequestInterface request);
}

Some files were not shown because too many files have changed in this diff Show more