@orchestr-sh/orchestr 1.11.0 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +274 -0
- package/dist/Cache/CacheManager.cjs +1 -1
- package/dist/Cache/CacheManager.mjs +1 -1
- package/dist/Cache/CacheManager.mjs.map +1 -1
- package/dist/Cache/Events/CacheFlushed.cjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs.map +1 -1
- package/dist/Cache/Events/CacheHit.cjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs.map +1 -1
- package/dist/Cache/Events/CacheMissed.cjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs.map +1 -1
- package/dist/Cache/Events/KeyForgotten.cjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs.map +1 -1
- package/dist/Cache/Events/KeyWritten.cjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs.map +1 -1
- package/dist/Cache/Locks/CacheLock.cjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs.map +1 -1
- package/dist/Cache/Locks/Lock.cjs +1 -1
- package/dist/Cache/Locks/Lock.mjs +1 -1
- package/dist/Cache/Locks/Lock.mjs.map +1 -1
- package/dist/Cache/Repository.cjs +1 -1
- package/dist/Cache/Repository.mjs +1 -1
- package/dist/Cache/Repository.mjs.map +1 -1
- package/dist/Cache/Stores/ArrayStore.cjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs.map +1 -1
- package/dist/Cache/Stores/DatabaseStore.cjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs.map +1 -1
- package/dist/Cache/Stores/FileStore.cjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs.map +1 -1
- package/dist/Cache/Tags/TagSet.cjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs.map +1 -1
- package/dist/Cache/Tags/TaggedCache.cjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs.map +1 -1
- package/dist/Console/Commands/CacheClearCommand.cjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheForgetCommand.cjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheTableCommand.cjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployEnvCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployInitCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployProvisionCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployServerCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventCacheCommand.cjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventClearCommand.cjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventListCommand.cjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeControllerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeEventCommand.cjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeJobCommand.cjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeListenerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.cjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeSeederCommand.cjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeViewCommand.cjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateResetCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueClearCommand.cjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFlushCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueForgetCommand.cjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.cjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRestartCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRetryCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueWorkCommand.cjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs.map +1 -1
- package/dist/Console/Commands/SeedCommand.cjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs.map +1 -1
- package/dist/Console/ConsoleKernel.cjs +1 -1
- package/dist/Console/ConsoleKernel.mjs +1 -1
- package/dist/Console/ConsoleKernel.mjs.map +1 -1
- package/dist/Console/orchestr.cjs +2 -0
- package/dist/Console/orchestr.d.cts +1 -0
- package/dist/Console/orchestr.d.mts +1 -0
- package/dist/Console/orchestr.mjs +3 -0
- package/dist/Console/orchestr.mjs.map +1 -0
- package/dist/Container/Container.mjs.map +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.cjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs.map +1 -1
- package/dist/Database/Connection.cjs +1 -1
- package/dist/Database/Connection.mjs +1 -1
- package/dist/Database/Connection.mjs.map +1 -1
- package/dist/Database/DatabaseManager.cjs +1 -1
- package/dist/Database/DatabaseManager.mjs +1 -1
- package/dist/Database/DatabaseManager.mjs.map +1 -1
- package/dist/Database/Ensemble/Ensemble.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleBuilder.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.cjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.cjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/HasMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphToMany.mjs.map +1 -1
- package/dist/Database/Migrations/Blueprint.cjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationCreator.cjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationRepository.cjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs.map +1 -1
- package/dist/Database/Migrations/Migrator.cjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs.map +1 -1
- package/dist/Database/Migrations/SchemaBuilder.cjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs.map +1 -1
- package/dist/Database/Query/Builder.cjs +1 -1
- package/dist/Database/Query/Builder.mjs +1 -1
- package/dist/Database/Query/Builder.mjs.map +1 -1
- package/dist/Database/Query/Expression.cjs +1 -1
- package/dist/Database/Query/Expression.mjs +1 -1
- package/dist/Database/Query/Expression.mjs.map +1 -1
- package/dist/Database/Seeders/SeederRunner.cjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs.map +1 -1
- package/dist/Deploy/Deployer.cjs +1 -1
- package/dist/Deploy/Deployer.mjs +1 -1
- package/dist/Deploy/Deployer.mjs.map +1 -1
- package/dist/Deploy/ProjectConfig.mjs.map +1 -1
- package/dist/Deploy/Provisioner.cjs +1 -1
- package/dist/Deploy/Provisioner.mjs +1 -1
- package/dist/Deploy/Provisioner.mjs.map +1 -1
- package/dist/Deploy/SSHConnection.mjs.map +1 -1
- package/dist/Deploy/SymphonyClient.cjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs.map +1 -1
- package/dist/Deploy/TarBuilder.mjs.map +1 -1
- package/dist/Deploy/prompt.mjs.map +1 -1
- package/dist/Events/Dispatcher.cjs +1 -1
- package/dist/Events/Dispatcher.d.cts +1 -1
- package/dist/Events/Dispatcher.d.mts +1 -1
- package/dist/Events/Dispatcher.mjs +1 -1
- package/dist/Events/Dispatcher.mjs.map +1 -1
- package/dist/Events/EventServiceProvider.cjs +1 -1
- package/dist/Events/EventServiceProvider.d.cts +1 -1
- package/dist/Events/EventServiceProvider.d.mts +1 -1
- package/dist/Events/EventServiceProvider.mjs.map +1 -1
- package/dist/Events/index.cjs +1 -0
- package/dist/Events/index.d.cts +7 -0
- package/dist/Events/index.d.mts +7 -0
- package/dist/Events/index.mjs +1 -0
- package/dist/Facades/Bus.mjs.map +1 -1
- package/dist/Facades/Cache.mjs.map +1 -1
- package/dist/Facades/Config.mjs.map +1 -1
- package/dist/Facades/DB.mjs.map +1 -1
- package/dist/Facades/Event.d.cts +1 -1
- package/dist/Facades/Event.d.mts +1 -1
- package/dist/Facades/Event.mjs.map +1 -1
- package/dist/Facades/Queue.mjs.map +1 -1
- package/dist/Facades/Route.d.cts +1 -1
- package/dist/Facades/Route.d.mts +1 -1
- package/dist/Facades/Route.mjs.map +1 -1
- package/dist/Facades/View.mjs.map +1 -1
- package/dist/Facades/index.cjs +1 -0
- package/dist/Facades/index.d.cts +9 -0
- package/dist/Facades/index.d.mts +9 -0
- package/dist/Facades/index.mjs +1 -0
- package/dist/Foundation/Application.mjs.map +1 -1
- package/dist/Foundation/Config/ConfigServiceProvider.d.cts +1 -1
- package/dist/Foundation/Config/ConfigServiceProvider.d.mts +1 -1
- package/dist/Foundation/Http/FormRequest.d.cts +1 -1
- package/dist/Foundation/Http/FormRequest.d.mts +1 -1
- package/dist/Foundation/Http/FormRequest.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/AnyOfRule.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/ImageFileRule.mjs.map +1 -1
- package/dist/Foundation/Http/Validator.mjs.map +1 -1
- package/dist/Queue/Batching/Batch.cjs +1 -1
- package/dist/Queue/Batching/Batch.mjs +1 -1
- package/dist/Queue/Batching/Batch.mjs.map +1 -1
- package/dist/Queue/Batching/PendingBatch.cjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs.map +1 -1
- package/dist/Queue/Concerns/Dispatchable.mjs.map +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.cjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/NullDriver.cjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/SyncDriver.cjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs.map +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.cjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs.map +1 -1
- package/dist/Queue/Events/JobFailed.cjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessed.cjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessing.cjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs.map +1 -1
- package/dist/Queue/Events/JobQueued.cjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs.map +1 -1
- package/dist/Queue/Events/JobRetryRequested.cjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs.map +1 -1
- package/dist/Queue/Events/WorkerStopping.cjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs.map +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.cjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs.map +1 -1
- package/dist/Queue/Middleware/RateLimited.cjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs.map +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.cjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs.map +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.cjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs.map +1 -1
- package/dist/Queue/PendingChain.cjs +1 -1
- package/dist/Queue/PendingChain.mjs +1 -1
- package/dist/Queue/PendingChain.mjs.map +1 -1
- package/dist/Queue/PendingDispatch.cjs +1 -1
- package/dist/Queue/PendingDispatch.mjs +1 -1
- package/dist/Queue/PendingDispatch.mjs.map +1 -1
- package/dist/Queue/QueueManager.cjs +1 -1
- package/dist/Queue/QueueManager.mjs +1 -1
- package/dist/Queue/QueueManager.mjs.map +1 -1
- package/dist/Queue/QueueServiceProvider.mjs.map +1 -1
- package/dist/Queue/Workers/Worker.cjs +1 -1
- package/dist/Queue/Workers/Worker.mjs +1 -1
- package/dist/Queue/Workers/Worker.mjs.map +1 -1
- package/dist/Routing/Request.mjs.map +1 -1
- package/dist/Routing/Response.mjs.map +1 -1
- package/dist/Routing/Route.d.cts +1 -1
- package/dist/Routing/Route.d.mts +1 -1
- package/dist/Routing/Router.d.cts +1 -1
- package/dist/Routing/Router.d.mts +1 -1
- package/dist/Support/EventDiscovery.cjs +1 -1
- package/dist/Support/EventDiscovery.mjs +1 -1
- package/dist/Support/EventDiscovery.mjs.map +1 -1
- package/dist/Support/Testing/Fakes/EventFake.cjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.cts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.mts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs.map +1 -1
- package/dist/Support/helpers.mjs.map +1 -1
- package/dist/View/Engines/TemplateEngine.mjs.map +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.mts +19 -19
- package/docs/events-typescript-usage.md +126 -0
- package/docs/future-improvements.md +49 -0
- package/docs/validation.md +201 -0
- package/package.json +65 -31
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Events/Event.cjs";
|
|
1
2
|
import { Abstract, Binding, Concrete, Container } from "./Container/Container.cjs";
|
|
2
|
-
import {
|
|
3
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.cjs";
|
|
4
|
+
import { DispatcherContract } from "./Events/Contracts/Dispatcher.cjs";
|
|
5
|
+
import { Dispatcher } from "./Events/Dispatcher.cjs";
|
|
3
6
|
import { Application } from "./Foundation/Application.cjs";
|
|
4
|
-
import {
|
|
7
|
+
import { ServiceProvider } from "./Foundation/ServiceProvider.cjs";
|
|
8
|
+
import { EventServiceProvider } from "./Events/EventServiceProvider.cjs";
|
|
9
|
+
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.cjs";
|
|
10
|
+
import { Config as Config$1 } from "./Foundation/Config/Config.cjs";
|
|
11
|
+
import { Facade } from "./Support/Facade.cjs";
|
|
12
|
+
import { Config } from "./Facades/Config.cjs";
|
|
13
|
+
import { DB } from "./Facades/DB.cjs";
|
|
5
14
|
import { CookieOptions, Response } from "./Routing/Response.cjs";
|
|
6
15
|
import { HttpMethod, Middleware, Route as Route$1, RouteAction } from "./Routing/Route.cjs";
|
|
16
|
+
import { Request } from "./Routing/Request.cjs";
|
|
7
17
|
import { Router } from "./Routing/Router.cjs";
|
|
8
|
-
import { Kernel } from "./Foundation/Http/Kernel.cjs";
|
|
9
|
-
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.cjs";
|
|
10
|
-
import { ValidationException } from "./Foundation/Http/ValidationException.cjs";
|
|
11
|
-
import { FormRequest } from "./Foundation/Http/FormRequest.cjs";
|
|
12
|
-
import { Rule } from "./Foundation/Http/Rule.cjs";
|
|
13
|
-
import { Config as Config$1 } from "./Foundation/Config/Config.cjs";
|
|
14
|
-
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.cjs";
|
|
15
|
-
import { Controller } from "./Routing/Controller.cjs";
|
|
16
|
-
import { Facade } from "./Support/Facade.cjs";
|
|
17
18
|
import { Route } from "./Facades/Route.cjs";
|
|
18
|
-
import { Config } from "./Facades/Config.cjs";
|
|
19
|
-
import { Event, EventClass } from "./Events/Event.cjs";
|
|
20
|
-
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.cjs";
|
|
21
|
-
import { DispatcherContract } from "./Events/Contracts/Dispatcher.cjs";
|
|
22
|
-
import { Dispatcher } from "./Events/Dispatcher.cjs";
|
|
23
19
|
import { Event as Event$1 } from "./Facades/Event.cjs";
|
|
24
20
|
import { PendingDispatch } from "./Queue/PendingDispatch.cjs";
|
|
25
21
|
import { JobMiddleware } from "./Queue/Middleware/JobMiddleware.cjs";
|
|
@@ -40,6 +36,13 @@ import { TaggedCache } from "./Cache/Tags/TaggedCache.cjs";
|
|
|
40
36
|
import { Repository } from "./Cache/Repository.cjs";
|
|
41
37
|
import { CacheConfig, CacheManager, StoreConfig, StoreFactory } from "./Cache/CacheManager.cjs";
|
|
42
38
|
import { Cache } from "./Facades/Cache.cjs";
|
|
39
|
+
import { Kernel } from "./Foundation/Http/Kernel.cjs";
|
|
40
|
+
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.cjs";
|
|
41
|
+
import { ValidationException } from "./Foundation/Http/ValidationException.cjs";
|
|
42
|
+
import { FormRequest } from "./Foundation/Http/FormRequest.cjs";
|
|
43
|
+
import { Rule } from "./Foundation/Http/Rule.cjs";
|
|
44
|
+
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.cjs";
|
|
45
|
+
import { Controller } from "./Routing/Controller.cjs";
|
|
43
46
|
import { ViewEngine } from "./View/Engines/ViewEngine.cjs";
|
|
44
47
|
import { TemplateEngine, TemplateEngineResolver } from "./View/Engines/TemplateEngine.cjs";
|
|
45
48
|
import { View } from "./View/View.cjs";
|
|
@@ -60,7 +63,6 @@ import { Connection } from "./Database/Connection.cjs";
|
|
|
60
63
|
import { DatabaseConnectionConfig, DatabaseManager, DatabaseManagerConfig } from "./Database/DatabaseManager.cjs";
|
|
61
64
|
import { Expression, raw } from "./Database/Query/Expression.cjs";
|
|
62
65
|
import { DrizzleAdapter } from "./Database/Adapters/DrizzleAdapter.cjs";
|
|
63
|
-
import { DB } from "./Facades/DB.cjs";
|
|
64
66
|
import { EnsembleCollection } from "./Database/Ensemble/EnsembleCollection.cjs";
|
|
65
67
|
import { Relation } from "./Database/Ensemble/Relations/Relation.cjs";
|
|
66
68
|
import { HasOne } from "./Database/Ensemble/Relations/HasOne.cjs";
|
|
@@ -142,8 +144,6 @@ import { DeployEnvCommand } from "./Console/Commands/DeployEnvCommand.cjs";
|
|
|
142
144
|
import { DeployRollbackCommand } from "./Console/Commands/DeployRollbackCommand.cjs";
|
|
143
145
|
import { DeployProvisionCommand } from "./Console/Commands/DeployProvisionCommand.cjs";
|
|
144
146
|
import { ProvisionOptions, Provisioner } from "./Deploy/Provisioner.cjs";
|
|
145
|
-
import { EventServiceProvider } from "./Events/EventServiceProvider.cjs";
|
|
146
|
-
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.cjs";
|
|
147
147
|
import { ModelEvent } from "./Database/Ensemble/Events/ModelEvent.cjs";
|
|
148
148
|
import { ModelRetrieved } from "./Database/Ensemble/Events/ModelRetrieved.cjs";
|
|
149
149
|
import { ModelCreating } from "./Database/Ensemble/Events/ModelCreating.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Events/Event.mjs";
|
|
1
2
|
import { Abstract, Binding, Concrete, Container } from "./Container/Container.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.mjs";
|
|
4
|
+
import { DispatcherContract } from "./Events/Contracts/Dispatcher.mjs";
|
|
5
|
+
import { Dispatcher } from "./Events/Dispatcher.mjs";
|
|
3
6
|
import { Application } from "./Foundation/Application.mjs";
|
|
4
|
-
import {
|
|
7
|
+
import { ServiceProvider } from "./Foundation/ServiceProvider.mjs";
|
|
8
|
+
import { EventServiceProvider } from "./Events/EventServiceProvider.mjs";
|
|
9
|
+
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.mjs";
|
|
10
|
+
import { Config as Config$1 } from "./Foundation/Config/Config.mjs";
|
|
11
|
+
import { Facade } from "./Support/Facade.mjs";
|
|
12
|
+
import { Config } from "./Facades/Config.mjs";
|
|
13
|
+
import { DB } from "./Facades/DB.mjs";
|
|
5
14
|
import { CookieOptions, Response } from "./Routing/Response.mjs";
|
|
6
15
|
import { HttpMethod, Middleware, Route as Route$1, RouteAction } from "./Routing/Route.mjs";
|
|
16
|
+
import { Request } from "./Routing/Request.mjs";
|
|
7
17
|
import { Router } from "./Routing/Router.mjs";
|
|
8
|
-
import { Kernel } from "./Foundation/Http/Kernel.mjs";
|
|
9
|
-
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.mjs";
|
|
10
|
-
import { ValidationException } from "./Foundation/Http/ValidationException.mjs";
|
|
11
|
-
import { FormRequest } from "./Foundation/Http/FormRequest.mjs";
|
|
12
|
-
import { Rule } from "./Foundation/Http/Rule.mjs";
|
|
13
|
-
import { Config as Config$1 } from "./Foundation/Config/Config.mjs";
|
|
14
|
-
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.mjs";
|
|
15
|
-
import { Controller } from "./Routing/Controller.mjs";
|
|
16
|
-
import { Facade } from "./Support/Facade.mjs";
|
|
17
18
|
import { Route } from "./Facades/Route.mjs";
|
|
18
|
-
import { Config } from "./Facades/Config.mjs";
|
|
19
|
-
import { Event, EventClass } from "./Events/Event.mjs";
|
|
20
|
-
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.mjs";
|
|
21
|
-
import { DispatcherContract } from "./Events/Contracts/Dispatcher.mjs";
|
|
22
|
-
import { Dispatcher } from "./Events/Dispatcher.mjs";
|
|
23
19
|
import { Event as Event$1 } from "./Facades/Event.mjs";
|
|
24
20
|
import { PendingDispatch } from "./Queue/PendingDispatch.mjs";
|
|
25
21
|
import { JobMiddleware } from "./Queue/Middleware/JobMiddleware.mjs";
|
|
@@ -40,6 +36,13 @@ import { TaggedCache } from "./Cache/Tags/TaggedCache.mjs";
|
|
|
40
36
|
import { Repository } from "./Cache/Repository.mjs";
|
|
41
37
|
import { CacheConfig, CacheManager, StoreConfig, StoreFactory } from "./Cache/CacheManager.mjs";
|
|
42
38
|
import { Cache } from "./Facades/Cache.mjs";
|
|
39
|
+
import { Kernel } from "./Foundation/Http/Kernel.mjs";
|
|
40
|
+
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.mjs";
|
|
41
|
+
import { ValidationException } from "./Foundation/Http/ValidationException.mjs";
|
|
42
|
+
import { FormRequest } from "./Foundation/Http/FormRequest.mjs";
|
|
43
|
+
import { Rule } from "./Foundation/Http/Rule.mjs";
|
|
44
|
+
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.mjs";
|
|
45
|
+
import { Controller } from "./Routing/Controller.mjs";
|
|
43
46
|
import { ViewEngine } from "./View/Engines/ViewEngine.mjs";
|
|
44
47
|
import { TemplateEngine, TemplateEngineResolver } from "./View/Engines/TemplateEngine.mjs";
|
|
45
48
|
import { View } from "./View/View.mjs";
|
|
@@ -60,7 +63,6 @@ import { Connection } from "./Database/Connection.mjs";
|
|
|
60
63
|
import { DatabaseConnectionConfig, DatabaseManager, DatabaseManagerConfig } from "./Database/DatabaseManager.mjs";
|
|
61
64
|
import { Expression, raw } from "./Database/Query/Expression.mjs";
|
|
62
65
|
import { DrizzleAdapter } from "./Database/Adapters/DrizzleAdapter.mjs";
|
|
63
|
-
import { DB } from "./Facades/DB.mjs";
|
|
64
66
|
import { EnsembleCollection } from "./Database/Ensemble/EnsembleCollection.mjs";
|
|
65
67
|
import { Relation } from "./Database/Ensemble/Relations/Relation.mjs";
|
|
66
68
|
import { HasOne } from "./Database/Ensemble/Relations/HasOne.mjs";
|
|
@@ -142,8 +144,6 @@ import { DeployEnvCommand } from "./Console/Commands/DeployEnvCommand.mjs";
|
|
|
142
144
|
import { DeployRollbackCommand } from "./Console/Commands/DeployRollbackCommand.mjs";
|
|
143
145
|
import { DeployProvisionCommand } from "./Console/Commands/DeployProvisionCommand.mjs";
|
|
144
146
|
import { ProvisionOptions, Provisioner } from "./Deploy/Provisioner.mjs";
|
|
145
|
-
import { EventServiceProvider } from "./Events/EventServiceProvider.mjs";
|
|
146
|
-
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.mjs";
|
|
147
147
|
import { ModelEvent } from "./Database/Ensemble/Events/ModelEvent.mjs";
|
|
148
148
|
import { ModelRetrieved } from "./Database/Ensemble/Events/ModelRetrieved.mjs";
|
|
149
149
|
import { ModelCreating } from "./Database/Ensemble/Events/ModelCreating.mjs";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Events TypeScript Usage Guide
|
|
2
|
+
|
|
3
|
+
## Problem: TypeScript doesn't recognize static dispatch methods
|
|
4
|
+
|
|
5
|
+
When you create an event class that extends `Event`, TypeScript may not automatically recognize the static `dispatch()`, `dispatchIf()`, `dispatchUnless()`, and `until()` methods that are added by the Dispatchable mixin.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Event } from '@orchestr-sh/orchestr';
|
|
9
|
+
|
|
10
|
+
class UserRegistered extends Event {
|
|
11
|
+
constructor(public user: User) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// TypeScript error: Property 'dispatch' does not exist on type 'typeof UserRegistered'
|
|
17
|
+
UserRegistered.dispatch(user);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Solution 1: Use type assertion (Quick Fix)
|
|
21
|
+
|
|
22
|
+
The simplest solution is to cast your event class to the `EventClass` type:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { Event, type EventClass } from '@orchestr-sh/orchestr';
|
|
26
|
+
|
|
27
|
+
class UserRegistered extends Event {
|
|
28
|
+
constructor(public user: User) {
|
|
29
|
+
super();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Cast to EventClass to get proper typing
|
|
34
|
+
const UserRegisteredEvent = UserRegistered as EventClass<UserRegistered>;
|
|
35
|
+
|
|
36
|
+
// Now TypeScript recognizes the static methods
|
|
37
|
+
UserRegisteredEvent.dispatch(user);
|
|
38
|
+
UserRegisteredEvent.dispatchIf(condition, user);
|
|
39
|
+
UserRegisteredEvent.dispatchUnless(condition, user);
|
|
40
|
+
await UserRegisteredEvent.until(user);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Solution 2: Use Event facade (Recommended)
|
|
44
|
+
|
|
45
|
+
The recommended approach is to use the Event facade for dispatching. You can import it in two ways:
|
|
46
|
+
|
|
47
|
+
**Option A: Subpath import (cleaner)**
|
|
48
|
+
```typescript
|
|
49
|
+
import { Event } from '@orchestr-sh/orchestr/Facades';
|
|
50
|
+
|
|
51
|
+
class UserRegistered extends Event {
|
|
52
|
+
constructor(public user: User) {
|
|
53
|
+
super();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Dispatch through the facade - fully typed
|
|
58
|
+
Event.dispatch(new UserRegistered(user));
|
|
59
|
+
Event.dispatchIf(condition, new UserRegistered(user));
|
|
60
|
+
Event.dispatchUnless(condition, new UserRegistered(user));
|
|
61
|
+
await Event.until(new UserRegistered(user));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Option B: Named import from main package**
|
|
65
|
+
```typescript
|
|
66
|
+
import { EventFacade } from '@orchestr-sh/orchestr';
|
|
67
|
+
|
|
68
|
+
// Use EventFacade to avoid naming conflict with Event base class
|
|
69
|
+
EventFacade.dispatch(new UserRegistered(user));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Solution 3: Export with proper typing
|
|
73
|
+
|
|
74
|
+
Export your event classes with the proper type in your event files:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// UserRegistered.ts
|
|
78
|
+
import { Event, type EventClass } from '@orchestr-sh/orchestr';
|
|
79
|
+
|
|
80
|
+
class UserRegisteredClass extends Event {
|
|
81
|
+
constructor(public user: User) {
|
|
82
|
+
super();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Export with proper typing
|
|
87
|
+
export const UserRegistered = UserRegisteredClass as EventClass<UserRegisteredClass>;
|
|
88
|
+
export type UserRegistered = InstanceType<typeof UserRegistered>;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Then use it elsewhere:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { UserRegistered } from './Events/UserRegistered';
|
|
95
|
+
|
|
96
|
+
// Full TypeScript support
|
|
97
|
+
UserRegistered.dispatch(user);
|
|
98
|
+
UserRegistered.dispatchIf(condition, user);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Why This Happens
|
|
102
|
+
|
|
103
|
+
The static methods (`dispatch`, `dispatchIf`, etc.) are added to the Event class at runtime by the `applyDispatchable()` function, which uses JavaScript's `Object.defineProperty`. TypeScript's type system doesn't automatically detect these runtime-added methods.
|
|
104
|
+
|
|
105
|
+
The `EventClass<T>` type helper provides the correct type information to TypeScript, telling it that these static methods exist on your event class.
|
|
106
|
+
|
|
107
|
+
## Best Practice Recommendation
|
|
108
|
+
|
|
109
|
+
For most use cases, we recommend **Solution 2** (using the Event facade):
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
Event.dispatch(new UserRegistered(user));
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This approach:
|
|
116
|
+
- ✅ Has full TypeScript support out of the box
|
|
117
|
+
- ✅ Is more explicit and easier to understand
|
|
118
|
+
- ✅ Works consistently across all event classes
|
|
119
|
+
- ✅ Follows Laravel's recommended pattern
|
|
120
|
+
- ✅ Makes testing easier (Event.fake() works seamlessly)
|
|
121
|
+
|
|
122
|
+
Reserve the static class methods for cases where you want the syntactic sugar:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
UserRegistered.dispatch(user); // Shorter, but requires type casting
|
|
126
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Future Improvements
|
|
2
|
+
|
|
3
|
+
## Traits Refactoring (Deferred)
|
|
4
|
+
|
|
5
|
+
**Goal:** Refactor all mixins to use `@orchestr-sh/traits` for better PHP-like syntax and automatic TypeScript support.
|
|
6
|
+
|
|
7
|
+
### Current Mixins to Migrate
|
|
8
|
+
1. **Dispatchable** (Events) - Low risk, good starting point
|
|
9
|
+
2. **HasDynamicRelations** (Ensemble) - Medium risk, uses Proxies
|
|
10
|
+
3. **HasRelationships** (Ensemble) - High risk, core ORM functionality
|
|
11
|
+
|
|
12
|
+
### Benefits
|
|
13
|
+
- Eliminate need for `EventClass` type helper
|
|
14
|
+
- More PHP-like trait syntax
|
|
15
|
+
- Better TypeScript inference
|
|
16
|
+
- Cleaner, more maintainable code
|
|
17
|
+
|
|
18
|
+
### Prerequisites Before Starting
|
|
19
|
+
1. ✅ Validate `@orchestr-sh/traits` handles:
|
|
20
|
+
- Static methods (e.g., `Dispatchable.dispatch()`)
|
|
21
|
+
- Property conflicts between traits
|
|
22
|
+
- Interaction with existing decorators (@DynamicRelation)
|
|
23
|
+
- Proxy objects (HasDynamicRelations)
|
|
24
|
+
2. ✅ Create POC with Dispatchable trait only
|
|
25
|
+
3. ✅ Verify test coverage is sufficient to catch regressions
|
|
26
|
+
4. ✅ Gather user feedback on current DX - is this actually a pain point?
|
|
27
|
+
|
|
28
|
+
### Migration Strategy (When Ready)
|
|
29
|
+
**Phase 1:** Dispatchable trait (lowest risk)
|
|
30
|
+
- Migrate Events/Concerns/Dispatchable to use traits
|
|
31
|
+
- Ship and validate in production
|
|
32
|
+
- Measure DX improvement
|
|
33
|
+
|
|
34
|
+
**Phase 2:** HasDynamicRelations (if Phase 1 succeeds)
|
|
35
|
+
- More complex due to Proxy usage
|
|
36
|
+
- Test thoroughly with all relationship types
|
|
37
|
+
|
|
38
|
+
**Phase 3:** HasRelationships (highest risk, save for last)
|
|
39
|
+
- Core ORM functionality
|
|
40
|
+
- Affects all models and relationships
|
|
41
|
+
- Extensive testing required
|
|
42
|
+
|
|
43
|
+
### Decision: Deferred
|
|
44
|
+
**Reason:** Current implementation is production-ready (9.9/10 code review). The TypeScript typing issue has documented workarounds. No user pain point driving this change. Premature to refactor stable code.
|
|
45
|
+
|
|
46
|
+
**Revisit when:**
|
|
47
|
+
- Users report DX friction with current approach
|
|
48
|
+
- `@orchestr-sh/traits` is proven in production
|
|
49
|
+
- We have capacity for the migration effort
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Validation Usage
|
|
2
|
+
|
|
3
|
+
This guide shows how to validate request data using the Validator and the Rule builder. It covers defining rules, conditional logic, arrays, dates, numbers, networks and files, plus customizing error messages.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
- Create a Validator with input data and a rules object.
|
|
8
|
+
- Use the Rule builder to compose rule instances.
|
|
9
|
+
- Call `validate()` to run rules; read `errors()` for messages.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Validator } from '@/Foundation/Http/Validator';
|
|
13
|
+
import { Rule } from '@/Foundation/Http/Rule';
|
|
14
|
+
|
|
15
|
+
const data = { email: 'user@example.com', age: 18 };
|
|
16
|
+
const rules = {
|
|
17
|
+
email: [Rule.required(), Rule.email()],
|
|
18
|
+
age: [Rule.required(), Rule.integer(), Rule.min(18)],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const v = new Validator(data, rules);
|
|
22
|
+
const ok = await v.validate(); // true/false
|
|
23
|
+
const errs = v.errors(); // { email?: string[], age?: string[] }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Rule Builder
|
|
27
|
+
|
|
28
|
+
Use `Rule.*()` methods to construct validation rules. Every call returns a rule object. Common examples:
|
|
29
|
+
|
|
30
|
+
- Presence: `required()`, `present()`, `filled()`, `nullable()`, `sometimes()`
|
|
31
|
+
- Strings: `string()`, `alpha()`, `alphaNum()`, `alphaDash()`, `lowercase()`, `uppercase()`, `ascii()`
|
|
32
|
+
- Patterns: `regex(/.../)`, `notRegex(/.../)`, `email()`, `json()`
|
|
33
|
+
- Numbers: `numeric()`, `integer()`, `decimal(places?)`, `min(n)`, `max(n)`, `between(min,max)`, `size(n)`
|
|
34
|
+
- Digits: `digits(n)`, `digitsBetween(min,max)`, `minDigits(n)`, `maxDigits(n)`, `multipleOf(n)`
|
|
35
|
+
- Comparison: `gt(fieldOrValue)`, `gte(fieldOrValue)`, `lt(fieldOrValue)`, `lte(fieldOrValue)`
|
|
36
|
+
- Arrays: `array()`, `distinct()`, `in([...])`, `notIn([...])`, `inArray(field)`
|
|
37
|
+
- Dates: `date()`, `dateEquals(date)`, `after(dateOrField)`, `afterOrEqual(...)`, `before(...)`, `beforeOrEqual(...)`
|
|
38
|
+
- Network: `url()`, `activeUrl()`, `ip()`, `ipv4()`, `ipv6()`, `macAddress()`, `uuid()`, `timezone()`
|
|
39
|
+
- Files: `file()`, `image()`, `mimetypes([...])`, `mimes([...])`
|
|
40
|
+
- Conditionals: `accepted()`, `acceptedIf(field,val)`, `declined()`, `declinedIf(field,val)`
|
|
41
|
+
|
|
42
|
+
## Conditional Presence
|
|
43
|
+
|
|
44
|
+
Require a field based on other inputs:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const rules = {
|
|
48
|
+
type: [Rule.required(), Rule.string()],
|
|
49
|
+
cc: [Rule.requiredIf('type', 'card')], // required when type == 'card'
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Other variants:
|
|
54
|
+
|
|
55
|
+
- `requiredUnless(field, val)`
|
|
56
|
+
- `requiredWith(...fields)`
|
|
57
|
+
- `requiredWithAll(...fields)`
|
|
58
|
+
- `requiredWithout(...fields)`
|
|
59
|
+
- `requiredWithoutAll(...fields)`
|
|
60
|
+
|
|
61
|
+
Prohibited variants:
|
|
62
|
+
|
|
63
|
+
- `prohibited()`
|
|
64
|
+
- `prohibitedIf(field, val)`
|
|
65
|
+
- `prohibitedUnless(field, val)`
|
|
66
|
+
- `prohibits(...fields)` (current field prohibits the listed fields)
|
|
67
|
+
|
|
68
|
+
## Starts/Ends With
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const rules = {
|
|
72
|
+
slug: [Rule.startsWith(['user']), Rule.endsWith(['admin'])],
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Comparisons
|
|
77
|
+
|
|
78
|
+
Compare against another field or literal:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const rules = {
|
|
82
|
+
max: [Rule.gt('min')], // max > min
|
|
83
|
+
threshold: [Rule.gte(10)], // threshold >= 10
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Arrays
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const rules = {
|
|
91
|
+
tags: [Rule.array(), Rule.distinct()],
|
|
92
|
+
choice: [Rule.inArray('choices')],
|
|
93
|
+
status: [Rule.in(['open', 'closed'])],
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Dates
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const rules = {
|
|
101
|
+
start: [Rule.date(), Rule.after('2020-01-01')],
|
|
102
|
+
end: [Rule.date(), Rule.afterOrEqual('start')],
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Files
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const rules = {
|
|
110
|
+
avatar: [Rule.file(), Rule.image(), Rule.mimes(['png','jpg'])],
|
|
111
|
+
doc: [Rule.file(), Rule.mimetypes(['application/pdf'])],
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Custom Messages
|
|
116
|
+
|
|
117
|
+
Pass per-field messages via the Validator:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const messages = {
|
|
121
|
+
'email.required': 'Email is required',
|
|
122
|
+
'email.email': 'Email must be valid',
|
|
123
|
+
};
|
|
124
|
+
const v = new Validator(data, rules, messages);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Rule classes may also provide tailored messages when they are invokable; otherwise messages fall back to defaults.
|
|
128
|
+
|
|
129
|
+
## Form Requests
|
|
130
|
+
|
|
131
|
+
Encapsulate validation by extending `FormRequest`. Define `rules()` and `messages()` then call `validated()`:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { FormRequest } from '@/Foundation/Http/FormRequest';
|
|
135
|
+
import { Rule } from '@/Foundation/Http/Rule';
|
|
136
|
+
|
|
137
|
+
class CreateUserRequest extends FormRequest {
|
|
138
|
+
rules() {
|
|
139
|
+
return {
|
|
140
|
+
email: [Rule.required(), Rule.email()],
|
|
141
|
+
password: [Rule.required(), Rule.string(), Rule.min(8)],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
messages() {
|
|
145
|
+
return {
|
|
146
|
+
'password.min': 'Password must be at least 8 characters',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use it in your controller/handler to validate and access sanitized inputs.
|
|
153
|
+
|
|
154
|
+
## Auth Validation
|
|
155
|
+
|
|
156
|
+
Some rules interact with authentication and require app-specific wiring:
|
|
157
|
+
|
|
158
|
+
- current_password
|
|
159
|
+
- Recognized as a token; by default it passes until you connect it to your auth system.
|
|
160
|
+
- Use as a string rule:
|
|
161
|
+
```ts
|
|
162
|
+
const rules = { current_password: 'current_password' };
|
|
163
|
+
```
|
|
164
|
+
- Integration options:
|
|
165
|
+
- Prefer user identity checks in `FormRequest.authorize()`.
|
|
166
|
+
- Or provide a custom invokable rule that verifies the password:
|
|
167
|
+
```ts
|
|
168
|
+
import { BaseRule } from '@/Foundation/Http/Rules';
|
|
169
|
+
import { Auth } from '@/Auth'; // your auth API
|
|
170
|
+
class CurrentPasswordRule extends BaseRule {
|
|
171
|
+
constructor() { super('current_password'); this.invokable = true; }
|
|
172
|
+
async passes(_attr: string, value: any): Promise<boolean> {
|
|
173
|
+
const user = Auth.user();
|
|
174
|
+
if (!user) return false;
|
|
175
|
+
return Auth.verify(user, String(value));
|
|
176
|
+
}
|
|
177
|
+
messageFor(attribute: string) { return `The ${attribute} is incorrect.`; }
|
|
178
|
+
}
|
|
179
|
+
const rules = { current_password: [new CurrentPasswordRule()] };
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- password
|
|
183
|
+
- Builder: `Rule.password()`; enforcement is application-defined.
|
|
184
|
+
- Recommended: express policy via built-in tokens (`string|min|max|confirmed|regex`) or a custom invokable rule that centralizes password policy checks.
|
|
185
|
+
|
|
186
|
+
- can:ability
|
|
187
|
+
- Builder: `Rule.can('update-post')` returns a token.
|
|
188
|
+
- Recommended: perform authorization in `FormRequest.authorize()`; use validation for data constraints. If you need field-level gating, implement an invokable rule that queries your Gate/Policy and returns an error message when unauthorized.
|
|
189
|
+
|
|
190
|
+
## Error Handling
|
|
191
|
+
|
|
192
|
+
- `validate()` returns `true/false`
|
|
193
|
+
- `errors()` returns a map of field → error messages
|
|
194
|
+
- Throw `ValidationException` or handle manually depending on your flow
|
|
195
|
+
|
|
196
|
+
## Tips
|
|
197
|
+
|
|
198
|
+
- Chain rules in arrays to compose complex constraints
|
|
199
|
+
- Prefer field comparisons (gt/gte/lt/lte) for relational checks
|
|
200
|
+
- Use conditional presence for dynamic forms
|
|
201
|
+
- Keep messages clear and domain-specific for better UX
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestr-sh/orchestr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.2",
|
|
5
5
|
"description": "A 1:1 Laravel replica in TypeScript - Brings Laravel's elegant syntax and architecture to Node.js",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -24,19 +24,57 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"bin": {
|
|
27
|
-
"orchestr": "dist/Console/orchestr.
|
|
27
|
+
"orchestr": "dist/Console/orchestr.mjs"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"docs",
|
|
32
|
+
"CODE_OF_CONDUCT.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"CONTRIBUTING.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"README.md"
|
|
33
37
|
],
|
|
34
38
|
"release": {
|
|
35
39
|
"branches": [
|
|
36
40
|
"main"
|
|
37
41
|
],
|
|
38
42
|
"plugins": [
|
|
39
|
-
|
|
43
|
+
[
|
|
44
|
+
"@semantic-release/commit-analyzer",
|
|
45
|
+
{
|
|
46
|
+
"releaseRules": [
|
|
47
|
+
{
|
|
48
|
+
"type": "build",
|
|
49
|
+
"release": "patch"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "ci",
|
|
53
|
+
"release": "patch"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "chore",
|
|
57
|
+
"release": "patch"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "docs",
|
|
61
|
+
"release": "patch"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "refactor",
|
|
65
|
+
"release": "patch"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "style",
|
|
69
|
+
"release": "patch"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "test",
|
|
73
|
+
"release": "patch"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
40
78
|
"@semantic-release/release-notes-generator",
|
|
41
79
|
[
|
|
42
80
|
"@semantic-release/changelog",
|
|
@@ -46,21 +84,17 @@
|
|
|
46
84
|
],
|
|
47
85
|
"@semantic-release/npm",
|
|
48
86
|
[
|
|
49
|
-
"@semantic-release/
|
|
87
|
+
"@semantic-release/git",
|
|
50
88
|
{
|
|
51
89
|
"assets": [
|
|
52
|
-
"dist",
|
|
53
|
-
"docs",
|
|
54
90
|
"package.json",
|
|
55
91
|
"package-lock.json",
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"LICENSE",
|
|
60
|
-
"README.md"
|
|
61
|
-
]
|
|
92
|
+
"CHANGELOG.md"
|
|
93
|
+
],
|
|
94
|
+
"message": "chore(version): release ${nextRelease.version} [skip ci]"
|
|
62
95
|
}
|
|
63
|
-
]
|
|
96
|
+
],
|
|
97
|
+
"@semantic-release/github"
|
|
64
98
|
]
|
|
65
99
|
},
|
|
66
100
|
"commitlint": {
|
|
@@ -73,12 +107,12 @@
|
|
|
73
107
|
"prepublishOnly": "npm run build",
|
|
74
108
|
"dev": "tsx watch examples/basic-app/server.ts",
|
|
75
109
|
"prepare": "husky",
|
|
76
|
-
"lint": "oxlint
|
|
77
|
-
"format": "oxfmt --write
|
|
78
|
-
"format:check": "oxfmt --check
|
|
110
|
+
"lint": "oxlint --type-aware --fix src && oxfmt --write src",
|
|
111
|
+
"format": "oxfmt --write src",
|
|
112
|
+
"format:check": "oxfmt --check src",
|
|
79
113
|
"test": "vitest run",
|
|
80
|
-
"test:lint": "oxlint
|
|
81
|
-
"test:types": "oxlint
|
|
114
|
+
"test:lint": "oxlint --type-aware src && oxfmt --check src",
|
|
115
|
+
"test:types": "oxlint --type-aware --type-check src",
|
|
82
116
|
"test:watch": "vitest",
|
|
83
117
|
"test:coverage": "vitest run --coverage"
|
|
84
118
|
},
|
|
@@ -114,27 +148,27 @@
|
|
|
114
148
|
},
|
|
115
149
|
"homepage": "https://github.com/orchestr-sh/orchestr#readme",
|
|
116
150
|
"engines": {
|
|
117
|
-
"node": "
|
|
151
|
+
"node": "^22.18.0 || >=24.0.0"
|
|
118
152
|
},
|
|
119
153
|
"dependencies": {
|
|
120
154
|
"drizzle-orm": ">=0.30.0",
|
|
121
155
|
"reflect-metadata": "^0.2.2"
|
|
122
156
|
},
|
|
123
157
|
"devDependencies": {
|
|
124
|
-
"@commitlint/cli": "^20.
|
|
125
|
-
"@commitlint/config-conventional": "^20.
|
|
158
|
+
"@commitlint/cli": "^20.5.3",
|
|
159
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
126
160
|
"@types/better-sqlite3": "^7.6.13",
|
|
127
|
-
"@types/node": "^25.
|
|
128
|
-
"@vitest/coverage-v8": "^4.1.
|
|
161
|
+
"@types/node": "^25.6.2",
|
|
162
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
129
163
|
"husky": "^9.1.7",
|
|
130
|
-
"lint-staged": "^
|
|
131
|
-
"oxfmt": "^0.
|
|
132
|
-
"oxlint": "^1.
|
|
133
|
-
"oxlint-tsgolint": "^0.
|
|
134
|
-
"tsdown": "^0.
|
|
164
|
+
"lint-staged": "^17.0.2",
|
|
165
|
+
"oxfmt": "^0.48.0",
|
|
166
|
+
"oxlint": "^1.63.0",
|
|
167
|
+
"oxlint-tsgolint": "^0.22.1",
|
|
168
|
+
"tsdown": "^0.22.0",
|
|
135
169
|
"tsx": "^4.21.0",
|
|
136
170
|
"typescript": "^6.0.2",
|
|
137
|
-
"vitest": "^4.1.
|
|
171
|
+
"vitest": "^4.1.5"
|
|
138
172
|
},
|
|
139
173
|
"peerDependencies": {
|
|
140
174
|
"drizzle-orm": ">=0.30.0",
|