diff --git a/packages/contracts/lib/src/cache/lock_provider.dart b/packages/contracts/lib/src/cache/lock_provider.dart index a87d964..a6f42a4 100644 --- a/packages/contracts/lib/src/cache/lock_provider.dart +++ b/packages/contracts/lib/src/cache/lock_provider.dart @@ -1,3 +1,4 @@ +import 'lock.dart'; abstract class LockProvider { /// Get a lock instance. /// @@ -14,7 +15,3 @@ abstract class LockProvider { /// @return Lock Lock restoreLock(String name, String owner); } - -abstract class Lock { - // Define the methods and properties that the Lock class should have -} diff --git a/packages/contracts/lib/src/container/container.dart b/packages/contracts/lib/src/container/container.dart index c632c95..f7b4225 100644 --- a/packages/contracts/lib/src/container/container.dart +++ b/packages/contracts/lib/src/container/container.dart @@ -1,5 +1,4 @@ -import 'package:meta/meta.dart'; - +import 'contextual_binding_builder.dart'; abstract class Container { /// Determine if the given abstract type has been bound. /// @@ -166,14 +165,6 @@ abstract class Container { void afterResolving(dynamic abstract, [Function? callback]); } -class ContextualBindingBuilder { - // Implementation for ContextualBindingBuilder -} - -class BindingResolutionException implements Exception { - // Implementation for BindingResolutionException -} - class InvalidArgumentException implements Exception { // Implementation for InvalidArgumentException } diff --git a/packages/contracts/lib/src/cookie/factory.dart b/packages/contracts/lib/src/cookie/factory.dart index e69de29..e2b2589 100644 --- a/packages/contracts/lib/src/cookie/factory.dart +++ b/packages/contracts/lib/src/cookie/factory.dart @@ -0,0 +1,40 @@ +import 'package:symfony_http_foundation/symfony_http_foundation.dart'; + +// TODO: Replace missing import with dart equivelant. + +abstract class Factory { + /// Create a new cookie instance. + /// + /// @param String name + /// @param String value + /// @param int minutes + /// @param String? path + /// @param String? domain + /// @param bool? secure + /// @param bool httpOnly + /// @param bool raw + /// @param String? sameSite + /// @return Cookie + Cookie make(String name, String value, {int minutes = 0, String? path, String? domain, bool? secure, bool httpOnly = true, bool raw = false, String? sameSite}); + + /// Create a cookie that lasts "forever" (five years). + /// + /// @param String name + /// @param String value + /// @param String? path + /// @param String? domain + /// @param bool? secure + /// @param bool httpOnly + /// @param bool raw + /// @param String? sameSite + /// @return Cookie + Cookie forever(String name, String value, {String? path, String? domain, bool? secure, bool httpOnly = true, bool raw = false, String? sameSite}); + + /// Expire the given cookie. + /// + /// @param String name + /// @param String? path + /// @param String? domain + /// @return Cookie + Cookie forget(String name, {String? path, String? domain}); +} diff --git a/packages/contracts/lib/src/cookie/queueing_factory.dart b/packages/contracts/lib/src/cookie/queueing_factory.dart index e69de29..547ee7c 100644 --- a/packages/contracts/lib/src/cookie/queueing_factory.dart +++ b/packages/contracts/lib/src/cookie/queueing_factory.dart @@ -0,0 +1,12 @@ +import 'factory.dart'; + +abstract class QueueingFactory extends Factory { + /// Queue a cookie to send with the next response. + void queue(List parameters); + + /// Remove a cookie from the queue. + void unqueue(String name, [String? path]); + + /// Get the cookies which have been queued for the next request. + List> getQueuedCookies(); +} diff --git a/packages/contracts/lib/src/database/eloquent/builder.dart b/packages/contracts/lib/src/database/eloquent/builder.dart index e69de29..76f8c21 100644 --- a/packages/contracts/lib/src/database/eloquent/builder.dart +++ b/packages/contracts/lib/src/database/eloquent/builder.dart @@ -0,0 +1,9 @@ +import 'package:illuminate_database/eloquent/builder.dart'; +import 'package:illuminate_database/query/builder.dart' as BaseContract; + +/// This interface is intentionally empty and exists to improve IDE support. +/// +/// @mixin Illuminate\Database\Eloquent\Builder +abstract class Builder implements BaseContract { + // Intentionally left empty +} diff --git a/packages/contracts/lib/src/database/eloquent/castable.dart b/packages/contracts/lib/src/database/eloquent/castable.dart index e69de29..ea009d4 100644 --- a/packages/contracts/lib/src/database/eloquent/castable.dart +++ b/packages/contracts/lib/src/database/eloquent/castable.dart @@ -0,0 +1,7 @@ +abstract class Castable { + /// Get the name of the caster class to use when casting from / to this cast target. + /// + /// @param List arguments + /// @return Type + static Type castUsing(List arguments); +} diff --git a/packages/contracts/lib/src/database/eloquent/casts_attributes.dart b/packages/contracts/lib/src/database/eloquent/casts_attributes.dart index e69de29..8529899 100644 --- a/packages/contracts/lib/src/database/eloquent/casts_attributes.dart +++ b/packages/contracts/lib/src/database/eloquent/casts_attributes.dart @@ -0,0 +1,30 @@ +import 'model.dart'; + +/// A generic type parameter for the get method. +typedef TGet = dynamic; + +/// A generic type parameter for the set method. +typedef TSet = dynamic; + +/// An abstract class representing a contract for casting attributes. +abstract class CastsAttributes { + /// Transforms the attribute from the underlying model values. + /// + /// [model] - The model instance. + /// [key] - The attribute key. + /// [value] - The attribute value. + /// [attributes] - The attributes array. + /// + /// Returns the transformed attribute value. + TGet? get(Model model, String key, dynamic value, Map attributes); + + /// Transforms the attribute to its underlying model values. + /// + /// [model] - The model instance. + /// [key] - The attribute key. + /// [value] - The attribute value to be set. + /// [attributes] - The attributes array. + /// + /// Returns the transformed attribute value. + dynamic set(Model model, String key, TSet? value, Map attributes); +} diff --git a/packages/contracts/lib/src/database/eloquent/casts_inbound_attributes.dart b/packages/contracts/lib/src/database/eloquent/casts_inbound_attributes.dart index e69de29..0993b26 100644 --- a/packages/contracts/lib/src/database/eloquent/casts_inbound_attributes.dart +++ b/packages/contracts/lib/src/database/eloquent/casts_inbound_attributes.dart @@ -0,0 +1,12 @@ +import 'package:your_package/database/model.dart'; + +abstract class CastsInboundAttributes { + /// Transform the attribute to its underlying model values. + /// + /// @param Model model + /// @param String key + /// @param dynamic value + /// @param Map attributes + /// @return dynamic + dynamic set(Model model, String key, dynamic value, Map attributes); +} diff --git a/packages/contracts/lib/src/database/eloquent/deviates_castable_attributes.dart b/packages/contracts/lib/src/database/eloquent/deviates_castable_attributes.dart index e69de29..73bbe64 100644 --- a/packages/contracts/lib/src/database/eloquent/deviates_castable_attributes.dart +++ b/packages/contracts/lib/src/database/eloquent/deviates_castable_attributes.dart @@ -0,0 +1,19 @@ +abstract class DeviatesCastableAttributes { + /// Increment the attribute. + /// + /// @param Model model + /// @param String key + /// @param dynamic value + /// @param Map attributes + /// @return dynamic + dynamic increment(Model model, String key, dynamic value, Map attributes); + + /// Decrement the attribute. + /// + /// @param Model model + /// @param String key + /// @param dynamic value + /// @param Map attributes + /// @return dynamic + dynamic decrement(Model model, String key, dynamic value, Map attributes); +} diff --git a/packages/contracts/lib/src/database/eloquent/serializes_castable_attributes.dart b/packages/contracts/lib/src/database/eloquent/serializes_castable_attributes.dart index e69de29..8219a9e 100644 --- a/packages/contracts/lib/src/database/eloquent/serializes_castable_attributes.dart +++ b/packages/contracts/lib/src/database/eloquent/serializes_castable_attributes.dart @@ -0,0 +1,12 @@ +import 'package:your_package_name/eloquent/model.dart'; + +abstract class SerializesCastableAttributes { + /// Serialize the attribute when converting the model to an array. + /// + /// @param \Illuminate\Database\Eloquent\Model $model + /// @param string $key + /// @param mixed $value + /// @param array $attributes + /// @return mixed + dynamic serialize(Model model, String key, dynamic value, Map attributes); +} diff --git a/packages/contracts/lib/src/database/eloquent/supports_partial_relations.dart b/packages/contracts/lib/src/database/eloquent/supports_partial_relations.dart index e69de29..f791390 100644 --- a/packages/contracts/lib/src/database/eloquent/supports_partial_relations.dart +++ b/packages/contracts/lib/src/database/eloquent/supports_partial_relations.dart @@ -0,0 +1,24 @@ +abstract class SupportsPartialRelations { + /// Indicate that the relation is a single result of a larger one-to-many relationship. + /// + /// [column] is the column to aggregate, defaults to 'id'. + /// [aggregate] is the aggregate function, defaults to 'MAX'. + /// [relation] is the relation name. + /// + /// Returns the instance of the class. + SupportsPartialRelations ofMany( + String? column = 'id', + dynamic aggregate = 'MAX', + String? relation, + ); + + /// Determine whether the relationship is a one-of-many relationship. + /// + /// Returns a boolean value indicating whether the relationship is one-of-many. + bool isOneOfMany(); + + /// Get the one of many inner join subselect query builder instance. + /// + /// Returns an instance of the query builder or null. + dynamic getOneOfManySubQuery(); +} diff --git a/packages/contracts/lib/src/database/events/migration_event.dart b/packages/contracts/lib/src/database/events/migration_event.dart index e69de29..9c04f25 100644 --- a/packages/contracts/lib/src/database/events/migration_event.dart +++ b/packages/contracts/lib/src/database/events/migration_event.dart @@ -0,0 +1,4 @@ + +abstract class MigrationEvent { + // Add any common functionality or properties if needed +} diff --git a/packages/contracts/lib/src/database/model_identifier.dart b/packages/contracts/lib/src/database/model_identifier.dart index e69de29..e935deb 100644 --- a/packages/contracts/lib/src/database/model_identifier.dart +++ b/packages/contracts/lib/src/database/model_identifier.dart @@ -0,0 +1,32 @@ +class ModelIdentifier { + /// The class name of the model. + final String className; + + /// The unique identifier of the model. + /// + /// This may be either a single ID or an array of IDs. + final dynamic id; + + /// The relationships loaded on the model. + final List relations; + + /// The connection name of the model. + final String? connection; + + /// The class name of the model collection. + String? collectionClass; + + /// Create a new model identifier. + ModelIdentifier({ + required this.className, + required this.id, + required this.relations, + this.connection, + }); + + /// Specify the collection class that should be used when serializing / restoring collections. + ModelIdentifier useCollectionClass(String? collectionClass) { + this.collectionClass = collectionClass; + return this; + } +} diff --git a/packages/contracts/lib/src/database/query/builder.dart b/packages/contracts/lib/src/database/query/builder.dart index e69de29..6048c34 100644 --- a/packages/contracts/lib/src/database/query/builder.dart +++ b/packages/contracts/lib/src/database/query/builder.dart @@ -0,0 +1,8 @@ +//import 'package:laravel_framework/database/query/builder.dart'; + +/// This interface is intentionally empty and exists to improve IDE support. +/// +/// @mixin Builder +abstract class Builder { + // This is intentionally left empty to match the PHP interface. +} diff --git a/packages/contracts/lib/src/database/query/condition_expression.dart b/packages/contracts/lib/src/database/query/condition_expression.dart index e69de29..308e37b 100644 --- a/packages/contracts/lib/src/database/query/condition_expression.dart +++ b/packages/contracts/lib/src/database/query/condition_expression.dart @@ -0,0 +1,6 @@ +// lib/Illuminate/Contracts/Database/Query/ConditionExpression.dart + +import 'expression.dart'; + +abstract class ConditionExpression implements Expression { +} diff --git a/packages/contracts/lib/src/database/query/expression.dart b/packages/contracts/lib/src/database/query/expression.dart index e69de29..37995d7 100644 --- a/packages/contracts/lib/src/database/query/expression.dart +++ b/packages/contracts/lib/src/database/query/expression.dart @@ -0,0 +1,11 @@ +// File path: lib/Illuminate/Contracts/Database/Query/expression.dart + +import 'package:your_project/Illuminate/Database/grammar.dart'; + +abstract class Expression { + /// Get the value of the expression. + /// + /// @param Grammar grammar + /// @return String|int|double + dynamic getValue(Grammar grammar); +} diff --git a/pubspec.yaml b/pubspec.yaml index 535bcb8..9be697d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ -name: vieofabric_framework -description: The VieoFabric Framework +name: fabric_framework +description: The Fabric Framework version: 1.0.0 homepage: https://vieo.dev/fabric documentation: https://vieo.dev/fabric/docs