@orchestr-sh/orchestr 1.11.1 → 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 +2 -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.mjs.map +1 -1
- 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.mjs +1 -1
- package/dist/Events/Dispatcher.mjs.map +1 -1
- package/dist/Events/EventServiceProvider.cjs +1 -1
- package/dist/Events/EventServiceProvider.mjs.map +1 -1
- 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.mjs.map +1 -1
- package/dist/Facades/Queue.mjs.map +1 -1
- package/dist/Facades/Route.mjs.map +1 -1
- package/dist/Facades/View.mjs.map +1 -1
- package/dist/Foundation/Application.mjs.map +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/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.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/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaggedCache.mjs","names":[],"sources":["../../../src/Cache/Tags/TaggedCache.ts"],"sourcesContent":["/**\n * TaggedCache\n *\n * Wraps a cache store to add tagging capabilities.\n * Tagged entries can be flushed as a group by tag name.\n *\n * Mirrors Laravel's Illuminate\\Cache\\TaggedCache.\n *\n * @example\n * ```typescript\n * // Store tagged entries\n * await Cache.tags(['people', 'artists']).put('John', data, 3600);\n * await Cache.tags(['people', 'authors']).put('Jane', data, 3600);\n *\n * // Retrieve tagged entries\n * const john = await Cache.tags(['people', 'artists']).get('John');\n *\n * // Flush by tag\n * await Cache.tags('people').flush(); // removes all 'people' entries\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\nimport { TagSet } from './TagSet';\n\nexport class TaggedCache {\n constructor(\n protected store: Store,\n protected tags: TagSet\n ) {}\n\n async get<T = any>(key: string): Promise<T | null> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.get<T>(taggedKey);\n }\n\n async many<T = any>(keys: string[]): Promise<Record<string, T | null>> {\n const result: Record<string, T | null> = {};\n for (const key of keys) {\n result[key] = await this.get<T>(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.put<T>(taggedKey, value, seconds);\n }\n\n async putMany<T = any>(values: Record<string, T>, seconds: number): Promise<boolean> {\n let success = true;\n for (const [key, value] of Object.entries(values)) {\n if (!(await this.put(key, value, seconds))) {\n success = false;\n }\n }\n return success;\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.increment(taggedKey, value);\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.decrement(taggedKey, value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.forever<T>(taggedKey, value);\n }\n\n async forget(key: string): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.forget(taggedKey);\n }\n\n /**\n * Flush all entries for these tags.\n * Resets the tag namespace so old tagged keys become unreachable.\n */\n async flush(): Promise<boolean> {\n await this.tags.flush();\n return true;\n }\n\n async has(key: string): Promise<boolean> {\n const value = await this.get(key);\n return value !== null;\n }\n\n async pull<T = any>(key: string, defaultValue?: T): Promise<T | null> {\n const value = await this.get(key);\n if (value !== null) {\n await this.forget(key);\n return value;\n }\n return defaultValue ?? null;\n }\n\n async remember<T = any>(key: string, ttl: number, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.get(key);\n\n if (value !== null) {\n return value;\n }\n\n const result = await callback();\n await this.put(key, result, ttl);\n return result;\n }\n\n async rememberForever<T = any>(key: string, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.get(key);\n\n if (value !== null) {\n return value;\n }\n\n const result = await callback();\n await this.forever(key, result);\n return result;\n }\n\n /**\n * Get the prefixed key for a tagged item\n */\n protected async taggedItemKey(key: string): Promise<string> {\n const namespace = await this.tags.getNamespace();\n return `${namespace}:${key}`;\n }\n\n /**\n * Get the tag set\n */\n getTags(): TagSet {\n return this.tags;\n }\n}\n"],"mappings":"AAyBA,IAAa,EAAb,KAAyB,
|
|
1
|
+
{"version":3,"file":"TaggedCache.mjs","names":[],"sources":["../../../src/Cache/Tags/TaggedCache.ts"],"sourcesContent":["/**\n * TaggedCache\n *\n * Wraps a cache store to add tagging capabilities.\n * Tagged entries can be flushed as a group by tag name.\n *\n * Mirrors Laravel's Illuminate\\Cache\\TaggedCache.\n *\n * @example\n * ```typescript\n * // Store tagged entries\n * await Cache.tags(['people', 'artists']).put('John', data, 3600);\n * await Cache.tags(['people', 'authors']).put('Jane', data, 3600);\n *\n * // Retrieve tagged entries\n * const john = await Cache.tags(['people', 'artists']).get('John');\n *\n * // Flush by tag\n * await Cache.tags('people').flush(); // removes all 'people' entries\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\nimport { TagSet } from './TagSet';\n\nexport class TaggedCache {\n constructor(\n protected store: Store,\n protected tags: TagSet\n ) {}\n\n async get<T = any>(key: string): Promise<T | null> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.get<T>(taggedKey);\n }\n\n async many<T = any>(keys: string[]): Promise<Record<string, T | null>> {\n const result: Record<string, T | null> = {};\n for (const key of keys) {\n result[key] = await this.get<T>(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.put<T>(taggedKey, value, seconds);\n }\n\n async putMany<T = any>(values: Record<string, T>, seconds: number): Promise<boolean> {\n let success = true;\n for (const [key, value] of Object.entries(values)) {\n if (!(await this.put(key, value, seconds))) {\n success = false;\n }\n }\n return success;\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.increment(taggedKey, value);\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.decrement(taggedKey, value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.forever<T>(taggedKey, value);\n }\n\n async forget(key: string): Promise<boolean> {\n const taggedKey = await this.taggedItemKey(key);\n return this.store.forget(taggedKey);\n }\n\n /**\n * Flush all entries for these tags.\n * Resets the tag namespace so old tagged keys become unreachable.\n */\n async flush(): Promise<boolean> {\n await this.tags.flush();\n return true;\n }\n\n async has(key: string): Promise<boolean> {\n const value = await this.get(key);\n return value !== null;\n }\n\n async pull<T = any>(key: string, defaultValue?: T): Promise<T | null> {\n const value = await this.get(key);\n if (value !== null) {\n await this.forget(key);\n return value;\n }\n return defaultValue ?? null;\n }\n\n async remember<T = any>(key: string, ttl: number, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.get(key);\n\n if (value !== null) {\n return value;\n }\n\n const result = await callback();\n await this.put(key, result, ttl);\n return result;\n }\n\n async rememberForever<T = any>(key: string, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.get(key);\n\n if (value !== null) {\n return value;\n }\n\n const result = await callback();\n await this.forever(key, result);\n return result;\n }\n\n /**\n * Get the prefixed key for a tagged item\n */\n protected async taggedItemKey(key: string): Promise<string> {\n const namespace = await this.tags.getNamespace();\n return `${namespace}:${key}`;\n }\n\n /**\n * Get the tag set\n */\n getTags(): TagSet {\n return this.tags;\n }\n}\n"],"mappings":"AAyBA,IAAa,EAAb,KAAyB,CAEX,MACA,KAFZ,YACE,EACA,EACA,CAFU,KAAA,MAAA,EACA,KAAA,KAAA,EAGZ,MAAM,IAAa,EAAgC,CACjD,IAAM,EAAY,MAAM,KAAK,cAAc,EAAI,CAC/C,OAAO,KAAK,MAAM,IAAO,EAAU,CAGrC,MAAM,KAAc,EAAmD,CACrE,IAAM,EAAmC,EAAE,CAC3C,IAAK,IAAM,KAAO,EAChB,EAAO,GAAO,MAAM,KAAK,IAAO,EAAI,CAEtC,OAAO,EAGT,MAAM,IAAa,EAAa,EAAU,EAAmC,CAC3E,IAAM,EAAY,MAAM,KAAK,cAAc,EAAI,CAC/C,OAAO,KAAK,MAAM,IAAO,EAAW,EAAO,EAAQ,CAGrD,MAAM,QAAiB,EAA2B,EAAmC,CACnF,IAAI,EAAU,GACd,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,EAAO,CACzC,MAAM,KAAK,IAAI,EAAK,EAAO,EAAQ,GACvC,EAAU,IAGd,OAAO,EAGT,MAAM,UAAU,EAAa,EAAgB,EAA8B,CACzE,IAAM,EAAY,MAAM,KAAK,cAAc,EAAI,CAC/C,OAAO,KAAK,MAAM,UAAU,EAA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command{signature=`cache:clear [store]`;description=`Flush the application cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=this.app.make(`cache`),r=e[0]||void 0;await n.store(r).flush()?this.info(`Application cache cleared successfully${r?` [${r}]`:``}.`):this.error(`Failed to clear the application cache.`)}};exports.CacheClearCommand=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.Command{app;signature=`cache:clear [store]`;description=`Flush the application cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=this.app.make(`cache`),r=e[0]||void 0;await n.store(r).flush()?this.info(`Application cache cleared successfully${r?` [${r}]`:``}.`):this.error(`Failed to clear the application cache.`)}};exports.CacheClearCommand=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";var t=class extends e{signature=`cache:clear [store]`;description=`Flush the application cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=this.app.make(`cache`),r=e[0]||void 0;await n.store(r).flush()?this.info(`Application cache cleared successfully${r?` [${r}]`:``}.`):this.error(`Failed to clear the application cache.`)}};export{t as CacheClearCommand};
|
|
1
|
+
import{Command as e}from"../Command.mjs";var t=class extends e{app;signature=`cache:clear [store]`;description=`Flush the application cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=this.app.make(`cache`),r=e[0]||void 0;await n.store(r).flush()?this.info(`Application cache cleared successfully${r?` [${r}]`:``}.`):this.error(`Failed to clear the application cache.`)}};export{t as CacheClearCommand};
|
|
2
2
|
//# sourceMappingURL=CacheClearCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheClearCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheClearCommand.ts"],"sourcesContent":["/**\n * CacheClearCommand\n *\n * Flush the application cache.\n * Mirrors Laravel's `php artisan cache:clear`.\n */\n\nimport type { CacheManager } from '@/Cache/CacheManager';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheClearCommand extends Command {\n signature = 'cache:clear [store]';\n description = 'Flush the application cache';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], _options: CommandOptions): Promise<void> {\n const manager = this.app.make<CacheManager>('cache');\n const storeName = args[0] || undefined;\n\n const store = manager.store(storeName);\n const success = await store.flush();\n\n if (success) {\n this.info(`Application cache cleared successfully${storeName ? ` [${storeName}]` : ''}.`);\n } else {\n this.error('Failed to clear the application cache.');\n }\n }\n}\n"],"mappings":"yCAWA,IAAa,EAAb,cAAuC,CAAQ,
|
|
1
|
+
{"version":3,"file":"CacheClearCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheClearCommand.ts"],"sourcesContent":["/**\n * CacheClearCommand\n *\n * Flush the application cache.\n * Mirrors Laravel's `php artisan cache:clear`.\n */\n\nimport type { CacheManager } from '@/Cache/CacheManager';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheClearCommand extends Command {\n signature = 'cache:clear [store]';\n description = 'Flush the application cache';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], _options: CommandOptions): Promise<void> {\n const manager = this.app.make<CacheManager>('cache');\n const storeName = args[0] || undefined;\n\n const store = manager.store(storeName);\n const success = await store.flush();\n\n if (success) {\n this.info(`Application cache cleared successfully${storeName ? ` [${storeName}]` : ''}.`);\n } else {\n this.error('Failed to clear the application cache.');\n }\n }\n}\n"],"mappings":"yCAWA,IAAa,EAAb,cAAuC,CAAQ,CAIvB,IAHtB,UAAY,sBACZ,YAAc,8BAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAgB,EAAyC,CACpE,IAAM,EAAU,KAAK,IAAI,KAAmB,QAAQ,CAC9C,EAAY,EAAK,IAAM,IAAA,GAKzB,MAHU,EAAQ,MAAM,EACD,CAAC,OAAO,CAGjC,KAAK,KAAK,yCAAyC,EAAY,KAAK,EAAU,GAAK,GAAG,GAAG,CAEzF,KAAK,MAAM,yCAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.Command{signature=`cache:forget <key> [store]`;description=`Remove an item from the cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=e[0],r=e[1]||void 0;if(!n){this.error(`Cache key is required.`),this.line(`Usage: cache:forget <key> [store]`);return}await this.app.make(`cache`).store(r).forget(n)?this.info(`The [${n}] key has been removed from the cache.`):this.comment(`The [${n}] key was not found in the cache.`)}};exports.CacheForgetCommand=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.Command{app;signature=`cache:forget <key> [store]`;description=`Remove an item from the cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=e[0],r=e[1]||void 0;if(!n){this.error(`Cache key is required.`),this.line(`Usage: cache:forget <key> [store]`);return}await this.app.make(`cache`).store(r).forget(n)?this.info(`The [${n}] key has been removed from the cache.`):this.comment(`The [${n}] key was not found in the cache.`)}};exports.CacheForgetCommand=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";var t=class extends e{signature=`cache:forget <key> [store]`;description=`Remove an item from the cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=e[0],r=e[1]||void 0;if(!n){this.error(`Cache key is required.`),this.line(`Usage: cache:forget <key> [store]`);return}await this.app.make(`cache`).store(r).forget(n)?this.info(`The [${n}] key has been removed from the cache.`):this.comment(`The [${n}] key was not found in the cache.`)}};export{t as CacheForgetCommand};
|
|
1
|
+
import{Command as e}from"../Command.mjs";var t=class extends e{app;signature=`cache:forget <key> [store]`;description=`Remove an item from the cache`;constructor(e){super(),this.app=e}async handle(e,t){let n=e[0],r=e[1]||void 0;if(!n){this.error(`Cache key is required.`),this.line(`Usage: cache:forget <key> [store]`);return}await this.app.make(`cache`).store(r).forget(n)?this.info(`The [${n}] key has been removed from the cache.`):this.comment(`The [${n}] key was not found in the cache.`)}};export{t as CacheForgetCommand};
|
|
2
2
|
//# sourceMappingURL=CacheForgetCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheForgetCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheForgetCommand.ts"],"sourcesContent":["/**\n * CacheForgetCommand\n *\n * Remove an item from the cache.\n * Mirrors Laravel's `php artisan cache:forget`.\n */\n\nimport type { CacheManager } from '@/Cache/CacheManager';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheForgetCommand extends Command {\n signature = 'cache:forget <key> [store]';\n description = 'Remove an item from the cache';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], _options: CommandOptions): Promise<void> {\n const key = args[0];\n const storeName = args[1] || undefined;\n\n if (!key) {\n this.error('Cache key is required.');\n this.line('Usage: cache:forget <key> [store]');\n return;\n }\n\n const manager = this.app.make<CacheManager>('cache');\n const store = manager.store(storeName);\n\n const forgotten = await store.forget(key);\n\n if (forgotten) {\n this.info(`The [${key}] key has been removed from the cache.`);\n } else {\n this.comment(`The [${key}] key was not found in the cache.`);\n }\n }\n}\n"],"mappings":"yCAWA,IAAa,EAAb,cAAwC,CAAQ,
|
|
1
|
+
{"version":3,"file":"CacheForgetCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheForgetCommand.ts"],"sourcesContent":["/**\n * CacheForgetCommand\n *\n * Remove an item from the cache.\n * Mirrors Laravel's `php artisan cache:forget`.\n */\n\nimport type { CacheManager } from '@/Cache/CacheManager';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheForgetCommand extends Command {\n signature = 'cache:forget <key> [store]';\n description = 'Remove an item from the cache';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], _options: CommandOptions): Promise<void> {\n const key = args[0];\n const storeName = args[1] || undefined;\n\n if (!key) {\n this.error('Cache key is required.');\n this.line('Usage: cache:forget <key> [store]');\n return;\n }\n\n const manager = this.app.make<CacheManager>('cache');\n const store = manager.store(storeName);\n\n const forgotten = await store.forget(key);\n\n if (forgotten) {\n this.info(`The [${key}] key has been removed from the cache.`);\n } else {\n this.comment(`The [${key}] key was not found in the cache.`);\n }\n }\n}\n"],"mappings":"yCAWA,IAAa,EAAb,cAAwC,CAAQ,CAIxB,IAHtB,UAAY,6BACZ,YAAc,gCAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAgB,EAAyC,CACpE,IAAM,EAAM,EAAK,GACX,EAAY,EAAK,IAAM,IAAA,GAE7B,GAAI,CAAC,EAAK,CACR,KAAK,MAAM,yBAAyB,CACpC,KAAK,KAAK,oCAAoC,CAC9C,OAQE,MALY,KAAK,IAAI,KAAmB,QACvB,CAAC,MAAM,EAEC,CAAC,OAAO,EAAI,CAGvC,KAAK,KAAK,QAAQ,EAAI,wCAAwC,CAE9D,KAAK,QAAQ,QAAQ,EAAI,mCAAmC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class extends t.Command{signature=`cache:table`;description=`Create a migration for the cache database table`;constructor(e){super(),this.app=e}async handle(e,t){let i=t.path||this.app.databasePath(`migrations`);await n.mkdir(i,{recursive:!0});let a=`${new Date().toISOString().replace(/[-:T]/g,``).slice(0,14)}_create_cache_table.ts`,o=r.join(i,a);await n.writeFile(o,this.getStub()),this.info(`Migration created successfully: ${o}`),this.comment(`Run "npx orchestr migrate" to create the table.`)}getStub(){return`import { Migration } from '@orchestr-sh/orchestr';
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class extends t.Command{app;signature=`cache:table`;description=`Create a migration for the cache database table`;constructor(e){super(),this.app=e}async handle(e,t){let i=t.path||this.app.databasePath(`migrations`);await n.mkdir(i,{recursive:!0});let a=`${new Date().toISOString().replace(/[-:T]/g,``).slice(0,14)}_create_cache_table.ts`,o=r.join(i,a);await n.writeFile(o,this.getStub()),this.info(`Migration created successfully: ${o}`),this.comment(`Run "npx orchestr migrate" to create the table.`)}getStub(){return`import { Migration } from '@orchestr-sh/orchestr';
|
|
2
2
|
import type { SchemaBuilder } from '@orchestr-sh/orchestr';
|
|
3
3
|
|
|
4
4
|
export default class CreateCacheTable extends Migration {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{signature=`cache:table`;description=`Create a migration for the cache database table`;constructor(e){super(),this.app=e}async handle(e,r){let i=r.path||this.app.databasePath(`migrations`);await t.mkdir(i,{recursive:!0});let a=`${new Date().toISOString().replace(/[-:T]/g,``).slice(0,14)}_create_cache_table.ts`,o=n.join(i,a);await t.writeFile(o,this.getStub()),this.info(`Migration created successfully: ${o}`),this.comment(`Run "npx orchestr migrate" to create the table.`)}getStub(){return`import { Migration } from '@orchestr-sh/orchestr';
|
|
1
|
+
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{app;signature=`cache:table`;description=`Create a migration for the cache database table`;constructor(e){super(),this.app=e}async handle(e,r){let i=r.path||this.app.databasePath(`migrations`);await t.mkdir(i,{recursive:!0});let a=`${new Date().toISOString().replace(/[-:T]/g,``).slice(0,14)}_create_cache_table.ts`,o=n.join(i,a);await t.writeFile(o,this.getStub()),this.info(`Migration created successfully: ${o}`),this.comment(`Run "npx orchestr migrate" to create the table.`)}getStub(){return`import { Migration } from '@orchestr-sh/orchestr';
|
|
2
2
|
import type { SchemaBuilder } from '@orchestr-sh/orchestr';
|
|
3
3
|
|
|
4
4
|
export default class CreateCacheTable extends Migration {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheTableCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheTableCommand.ts"],"sourcesContent":["/**\n * CacheTableCommand\n *\n * Create a migration for the cache database table.\n * Mirrors Laravel's `php artisan cache:table`.\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheTableCommand extends Command {\n signature = 'cache:table';\n description = 'Create a migration for the cache database table';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const migrationsPath = (options.path as string) || this.app.databasePath('migrations');\n await fs.mkdir(migrationsPath, { recursive: true });\n\n const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14);\n const fileName = `${timestamp}_create_cache_table.ts`;\n const filePath = path.join(migrationsPath, fileName);\n\n await fs.writeFile(filePath, this.getStub());\n\n this.info(`Migration created successfully: ${filePath}`);\n this.comment('Run \"npx orchestr migrate\" to create the table.');\n }\n\n protected getStub(): string {\n return `import { Migration } from '@orchestr-sh/orchestr';\nimport type { SchemaBuilder } from '@orchestr-sh/orchestr';\n\nexport default class CreateCacheTable extends Migration {\n async up(schema: SchemaBuilder): Promise<void> {\n await schema.create('cache', (table) => {\n table.string('key').primary();\n table.text('value');\n table.integer('expiration');\n });\n\n await schema.create('cache_locks', (table) => {\n table.string('key').primary();\n table.string('owner');\n table.integer('expiration');\n });\n }\n\n async down(schema: SchemaBuilder): Promise<void> {\n await schema.drop('cache_locks');\n await schema.drop('cache');\n }\n}\n`;\n }\n}\n"],"mappings":"8FAYA,IAAa,EAAb,cAAuC,CAAQ,
|
|
1
|
+
{"version":3,"file":"CacheTableCommand.mjs","names":[],"sources":["../../../src/Console/Commands/CacheTableCommand.ts"],"sourcesContent":["/**\n * CacheTableCommand\n *\n * Create a migration for the cache database table.\n * Mirrors Laravel's `php artisan cache:table`.\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class CacheTableCommand extends Command {\n signature = 'cache:table';\n description = 'Create a migration for the cache database table';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const migrationsPath = (options.path as string) || this.app.databasePath('migrations');\n await fs.mkdir(migrationsPath, { recursive: true });\n\n const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14);\n const fileName = `${timestamp}_create_cache_table.ts`;\n const filePath = path.join(migrationsPath, fileName);\n\n await fs.writeFile(filePath, this.getStub());\n\n this.info(`Migration created successfully: ${filePath}`);\n this.comment('Run \"npx orchestr migrate\" to create the table.');\n }\n\n protected getStub(): string {\n return `import { Migration } from '@orchestr-sh/orchestr';\nimport type { SchemaBuilder } from '@orchestr-sh/orchestr';\n\nexport default class CreateCacheTable extends Migration {\n async up(schema: SchemaBuilder): Promise<void> {\n await schema.create('cache', (table) => {\n table.string('key').primary();\n table.text('value');\n table.integer('expiration');\n });\n\n await schema.create('cache_locks', (table) => {\n table.string('key').primary();\n table.string('owner');\n table.integer('expiration');\n });\n }\n\n async down(schema: SchemaBuilder): Promise<void> {\n await schema.drop('cache_locks');\n await schema.drop('cache');\n }\n}\n`;\n }\n}\n"],"mappings":"8FAYA,IAAa,EAAb,cAAuC,CAAQ,CAIvB,IAHtB,UAAY,cACZ,YAAc,kDAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAkB,EAAQ,MAAmB,KAAK,IAAI,aAAa,aAAa,CACtF,MAAM,EAAG,MAAM,EAAgB,CAAE,UAAW,GAAM,CAAC,CAGnD,IAAM,EAAW,GADC,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,SAAU,GAAG,CAAC,MAAM,EAAG,GAC7C,CAAC,wBACxB,EAAW,EAAK,KAAK,EAAgB,EAAS,CAEpD,MAAM,EAAG,UAAU,EAAU,KAAK,SAAS,CAAC,CAE5C,KAAK,KAAK,mCAAmC,IAAW,CACxD,KAAK,QAAQ,kDAAkD,CAGjE,SAA4B,CAC1B,MAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployCommand.ts"],"sourcesContent":["/**\n * DeployCommand\n *\n * The main deployment command. Runs the full deployment pipeline.\n * Signature: deploy\n * Options: --server=<name> --migrate --no-build\n */\n\nimport { execSync } from 'child_process';\nimport { unlinkSync } from 'fs';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { Deployer } from '@/Deploy/Deployer';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\nimport { TarBuilder } from '@/Deploy/TarBuilder';\n\nexport class DeployCommand extends Command {\n signature = 'deploy';\n description = 'Deploy the current project to configured servers';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n // 1. Build (unless --no-build)\n if (!options['no-build']) {\n this.info('Building project...');\n try {\n execSync('npm run build', { stdio: 'inherit' });\n } catch {\n this.error('Build failed.');\n process.exit(1);\n }\n }\n\n // 2. Create tarball\n this.info('Creating deployment artifact...');\n let tarResult: { path: string; timestamp: string };\n try {\n tarResult = TarBuilder.build();\n this.comment(` Archive: ${tarResult.path}`);\n } catch (error: any) {\n this.error(`Failed to create tarball: ${error.message}`);\n process.exit(1);\n }\n\n // 3. Fetch server list\n let servers: Awaited<ReturnType<typeof client.listServers>>['servers'];\n try {\n const result = await client.listServers(config.project);\n servers = result.servers;\n } catch (error: any) {\n this.error(`Failed to fetch servers: ${error.message}`);\n process.exit(1);\n }\n\n if (servers.length === 0) {\n this.error('No servers configured. Run `orchestr deploy:server add` first.');\n process.exit(1);\n }\n\n // Filter by --server if provided\n const serverFilter: string | undefined = options.server;\n const targetServers = serverFilter ? servers.filter((s) => s.name === serverFilter) : servers;\n\n if (targetServers.length === 0) {\n this.error(`No server named \"${serverFilter}\" found.`);\n process.exit(1);\n }\n\n // Get current git info\n const commitHash = this.getGitHash();\n const commitMessage = this.getGitMessage();\n\n // Deploy to each server\n const deployer = new Deployer(client);\n let anyFailed = false;\n\n for (const server of targetServers) {\n this.newLine();\n this.info(`Deploying to ${server.name} (${server.host})...`);\n\n // 4. Create deployment record\n let deploymentUuid: string;\n try {\n const dep = await client.createDeployment(config.project, {\n server_id: server.id,\n commit_hash: commitHash,\n commit_message: commitMessage,\n });\n deploymentUuid = dep.deployment.uuid;\n } catch (error: any) {\n this.error(`Failed to create deployment record: ${error.message}`);\n anyFailed = true;\n continue;\n }\n\n // 5. SSH deploy\n try {\n await deployer.deployToServer(server, {\n projectSlug: config.project,\n tarPath: tarResult.path,\n timestamp: tarResult.timestamp,\n deploymentUuid,\n keyPath: options.key,\n migrate: !!options.migrate,\n });\n\n this.info(`✓ ${server.name} deployed successfully`);\n } catch (error: any) {\n this.error(`✗ ${server.name} deployment failed`);\n if (error?.message) {\n this.error(error.message);\n }\n anyFailed = true;\n }\n }\n\n // Cleanup tarball\n try {\n unlinkSync(tarResult.path);\n } catch {}\n\n this.newLine();\n if (anyFailed) {\n this.error('Deployment completed with errors.');\n process.exit(1);\n } else {\n this.info('Deployment complete.');\n }\n }\n\n private getGitHash(): string | undefined {\n try {\n return execSync('git rev-parse --short HEAD', { stdio: 'pipe', encoding: 'utf-8' }).trim();\n } catch {\n return undefined;\n }\n }\n\n private getGitMessage(): string | undefined {\n try {\n return execSync('git log -1 --pretty=%s', { stdio: 'pipe', encoding: 'utf-8' }).trim();\n } catch {\n return undefined;\n }\n }\n}\n"],"mappings":"maAiBA,IAAa,EAAb,cAAmC,CAAQ,CACzC,UAAY,SACZ,YAAc,mDAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAGrE,GAAI,CAAC,EAAQ,YAAa,CACxB,KAAK,KAAK,sBAAsB,CAChC,GAAI,CACF,EAAS,gBAAiB,CAAE,MAAO,UAAW,CAAC,MACzC,CACN,KAAK,MAAM,gBAAgB,CAC3B,QAAQ,KAAK,EAAE,EAKnB,KAAK,KAAK,kCAAkC,CAC5C,IAAI,EACJ,GAAI,CACF,EAAY,EAAW,OAAO,CAC9B,KAAK,QAAQ,cAAc,EAAU,OAAO,OACrC,EAAY,CACnB,KAAK,MAAM,6BAA6B,EAAM,UAAU,CACxD,QAAQ,KAAK,EAAE,CAIjB,IAAI,EACJ,GAAI,CAEF,
|
|
1
|
+
{"version":3,"file":"DeployCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployCommand.ts"],"sourcesContent":["/**\n * DeployCommand\n *\n * The main deployment command. Runs the full deployment pipeline.\n * Signature: deploy\n * Options: --server=<name> --migrate --no-build\n */\n\nimport { execSync } from 'child_process';\nimport { unlinkSync } from 'fs';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { Deployer } from '@/Deploy/Deployer';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\nimport { TarBuilder } from '@/Deploy/TarBuilder';\n\nexport class DeployCommand extends Command {\n signature = 'deploy';\n description = 'Deploy the current project to configured servers';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n // 1. Build (unless --no-build)\n if (!options['no-build']) {\n this.info('Building project...');\n try {\n execSync('npm run build', { stdio: 'inherit' });\n } catch {\n this.error('Build failed.');\n process.exit(1);\n }\n }\n\n // 2. Create tarball\n this.info('Creating deployment artifact...');\n let tarResult: { path: string; timestamp: string };\n try {\n tarResult = TarBuilder.build();\n this.comment(` Archive: ${tarResult.path}`);\n } catch (error: any) {\n this.error(`Failed to create tarball: ${error.message}`);\n process.exit(1);\n }\n\n // 3. Fetch server list\n let servers: Awaited<ReturnType<typeof client.listServers>>['servers'];\n try {\n const result = await client.listServers(config.project);\n servers = result.servers;\n } catch (error: any) {\n this.error(`Failed to fetch servers: ${error.message}`);\n process.exit(1);\n }\n\n if (servers.length === 0) {\n this.error('No servers configured. Run `orchestr deploy:server add` first.');\n process.exit(1);\n }\n\n // Filter by --server if provided\n const serverFilter: string | undefined = options.server;\n const targetServers = serverFilter ? servers.filter((s) => s.name === serverFilter) : servers;\n\n if (targetServers.length === 0) {\n this.error(`No server named \"${serverFilter}\" found.`);\n process.exit(1);\n }\n\n // Get current git info\n const commitHash = this.getGitHash();\n const commitMessage = this.getGitMessage();\n\n // Deploy to each server\n const deployer = new Deployer(client);\n let anyFailed = false;\n\n for (const server of targetServers) {\n this.newLine();\n this.info(`Deploying to ${server.name} (${server.host})...`);\n\n // 4. Create deployment record\n let deploymentUuid: string;\n try {\n const dep = await client.createDeployment(config.project, {\n server_id: server.id,\n commit_hash: commitHash,\n commit_message: commitMessage,\n });\n deploymentUuid = dep.deployment.uuid;\n } catch (error: any) {\n this.error(`Failed to create deployment record: ${error.message}`);\n anyFailed = true;\n continue;\n }\n\n // 5. SSH deploy\n try {\n await deployer.deployToServer(server, {\n projectSlug: config.project,\n tarPath: tarResult.path,\n timestamp: tarResult.timestamp,\n deploymentUuid,\n keyPath: options.key,\n migrate: !!options.migrate,\n });\n\n this.info(`✓ ${server.name} deployed successfully`);\n } catch (error: any) {\n this.error(`✗ ${server.name} deployment failed`);\n if (error?.message) {\n this.error(error.message);\n }\n anyFailed = true;\n }\n }\n\n // Cleanup tarball\n try {\n unlinkSync(tarResult.path);\n } catch {}\n\n this.newLine();\n if (anyFailed) {\n this.error('Deployment completed with errors.');\n process.exit(1);\n } else {\n this.info('Deployment complete.');\n }\n }\n\n private getGitHash(): string | undefined {\n try {\n return execSync('git rev-parse --short HEAD', { stdio: 'pipe', encoding: 'utf-8' }).trim();\n } catch {\n return undefined;\n }\n }\n\n private getGitMessage(): string | undefined {\n try {\n return execSync('git log -1 --pretty=%s', { stdio: 'pipe', encoding: 'utf-8' }).trim();\n } catch {\n return undefined;\n }\n }\n}\n"],"mappings":"maAiBA,IAAa,EAAb,cAAmC,CAAQ,CACzC,UAAY,SACZ,YAAc,mDAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAGrE,GAAI,CAAC,EAAQ,YAAa,CACxB,KAAK,KAAK,sBAAsB,CAChC,GAAI,CACF,EAAS,gBAAiB,CAAE,MAAO,UAAW,CAAC,MACzC,CACN,KAAK,MAAM,gBAAgB,CAC3B,QAAQ,KAAK,EAAE,EAKnB,KAAK,KAAK,kCAAkC,CAC5C,IAAI,EACJ,GAAI,CACF,EAAY,EAAW,OAAO,CAC9B,KAAK,QAAQ,cAAc,EAAU,OAA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EAAW,EAAU,KAAK,MACpB,EAER,KAAK,SAAS,CACV,GACF,KAAK,MAAM,oCAAoC,CAC/C,QAAQ,KAAK,EAAE,EAEf,KAAK,KAAK,uBAAuB,CAIrC,YAAyC,CACvC,GAAI,CACF,OAAO,EAAS,6BAA8B,CAAE,MAAO,OAAQ,SAAU,QAAS,CAAC,CAAC,MAAM,MACpF,CACN,QAIJ,eAA4C,CAC1C,GAAI,CACF,OAAO,EAAS,yBAA0B,CAAE,MAAO,OAAQ,SAAU,QAAS,CAAC,CAAC,MAAM,MAChF,CACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployEnvCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployEnvCommand.ts"],"sourcesContent":["/**\n * DeployEnvCommand\n *\n * Get and set environment variables for the current project via the Symphony API.\n * Signature: deploy:env [action]\n * Actions: list (default), set, unset, push (from local .env file)\n * Options: --key=<key> --value=<value> --file=<path>\n */\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join } from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployEnvCommand extends Command {\n signature = 'deploy:env [action]';\n description = 'Manage environment variables for the current project (list, set, unset, push)';\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const action = args[0] ?? 'list';\n\n if (!['list', 'set', 'unset', 'push'].includes(action)) {\n this.error('Usage: orchestr deploy:env [list|set|unset|push]');\n process.exit(1);\n }\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n switch (action) {\n case 'list':\n await this.list(client, config.project);\n break;\n case 'set':\n await this.set(client, config.project, options);\n break;\n case 'unset':\n await this.unset(client, config.project, options);\n break;\n case 'push':\n await this.push(client, config.project, options);\n break;\n }\n }\n\n private async list(client: SymphonyClient, slug: string): Promise<void> {\n try {\n const result = await client.getEnvVars(slug);\n\n if (result.variables.length === 0) {\n this.comment('No environment variables set.');\n return;\n }\n\n this.info(`Environment variables for: ${slug}`);\n this.newLine();\n\n result.variables.forEach(({ key, value }) => {\n // Mask values longer than 4 chars\n const masked = value.length > 4 ? value.slice(0, 4) + '*'.repeat(Math.min(value.length - 4, 20)) : '****';\n this.line(` ${key}=${masked}`);\n });\n } catch (error: any) {\n this.error(`Failed to fetch env vars: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async set(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const key: string = options.key ?? (await prompt('Variable name: '));\n const value: string = options.value ?? (await prompt('Value: ', true));\n\n if (!key.trim()) {\n this.error('Variable name is required.');\n process.exit(1);\n }\n\n try {\n // Fetch existing vars, merge in the new one\n const existing = await client.getEnvVars(slug);\n const updated = existing.variables.filter((v) => v.key !== key.trim());\n updated.push({ key: key.trim(), value });\n\n await client.putEnvVars(slug, updated);\n this.info(`Set ${key.trim()}`);\n } catch (error: any) {\n this.error(`Failed to set env var: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async unset(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const key: string = options.key ?? (await prompt('Variable name to remove: '));\n\n if (!key.trim()) {\n this.error('Variable name is required.');\n process.exit(1);\n }\n\n try {\n const existing = await client.getEnvVars(slug);\n const updated = existing.variables.filter((v) => v.key !== key.trim());\n\n if (updated.length === existing.variables.length) {\n this.warn(`Variable \"${key.trim()}\" not found.`);\n return;\n }\n\n await client.putEnvVars(slug, updated);\n this.info(`Unset ${key.trim()}`);\n } catch (error: any) {\n this.error(`Failed to unset env var: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async push(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const filePath: string = options.file ?? join(process.cwd(), '.env');\n\n if (!existsSync(filePath)) {\n this.error(`.env file not found at: ${filePath}`);\n process.exit(1);\n }\n\n const variables = this.parseEnvFile(filePath);\n\n if (variables.length === 0) {\n this.warn('No variables found in .env file.');\n return;\n }\n\n try {\n await client.putEnvVars(slug, variables);\n this.info(`Pushed ${variables.length} variable(s) from ${filePath}`);\n } catch (error: any) {\n this.error(`Failed to push env vars: ${error.message}`);\n process.exit(1);\n }\n }\n\n private parseEnvFile(filePath: string): Array<{ key: string; value: string }> {\n const content = readFileSync(filePath, 'utf-8');\n const variables: Array<{ key: string; value: string }> = [];\n\n for (const line of content.split('\\n')) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith('#')) continue;\n\n const eqIndex = trimmed.indexOf('=');\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Strip surrounding quotes\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n value = value.slice(1, -1);\n }\n\n if (key) {\n variables.push({ key, value });\n }\n }\n\n return variables;\n }\n}\n"],"mappings":"2WAiBA,IAAa,EAAb,cAAsC,CAAQ,CAC5C,UAAY,sBACZ,YAAc,gFAEd,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAS,EAAK,IAAM,OAErB,CAAC,OAAQ,MAAO,QAAS,OAAO,CAAC,SAAS,EAAO,GACpD,KAAK,MAAM,mDAAmD,CAC9D,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,OAAQ,EAAR,CACE,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAQ,CACvC,MACF,IAAK,MACH,MAAM,KAAK,IAAI,EAAQ,EAAO,QAAS,EAAQ,CAC/C,MACF,IAAK,QACH,MAAM,KAAK,MAAM,EAAQ,EAAO,QAAS,EAAQ,CACjD,MACF,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAS,EAAQ,CAChD,OAIN,MAAc,KAAK,EAAwB,EAA6B,CACtE,GAAI,CACF,IAAM,EAAS,MAAM,EAAO,WAAW,EAAK,CAE5C,GAAI,EAAO,UAAU,SAAW,EAAG,CACjC,KAAK,QAAQ,gCAAgC,CAC7C,OAGF,KAAK,KAAK,8BAA8B,IAAO,CAC/C,KAAK,SAAS,CAEd,EAAO,UAAU,SAAS,CAAE,MAAK,WAAY,CAE3C,IAAM,EAAS,EAAM,OAAS,EAAI,EAAM,MAAM,EAAG,EAAE,CAAG,IAAI,OAAO,KAAK,IAAI,EAAM,OAAS,EAAG,GAAG,CAAC,CAAG,OACnG,KAAK,KAAK,KAAK,EAAI,GAAG,IAAS,EAC/B,OACK,EAAY,CACnB,KAAK,MAAM,6BAA6B,EAAM,UAAU,CACxD,QAAQ,KAAK,EAAE,EAInB,MAAc,IAAI,EAAwB,EAAc,EAAwC,CAC9F,IAAM,EAAc,EAAQ,KAAQ,MAAM,EAAO,kBAAkB,CAC7D,EAAgB,EAAQ,OAAU,MAAM,EAAO,UAAW,GAAK,CAEhE,EAAI,MAAM,GACb,KAAK,MAAM,6BAA6B,CACxC,QAAQ,KAAK,EAAE,EAGjB,GAAI,CAGF,IAAM,
|
|
1
|
+
{"version":3,"file":"DeployEnvCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployEnvCommand.ts"],"sourcesContent":["/**\n * DeployEnvCommand\n *\n * Get and set environment variables for the current project via the Symphony API.\n * Signature: deploy:env [action]\n * Actions: list (default), set, unset, push (from local .env file)\n * Options: --key=<key> --value=<value> --file=<path>\n */\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join } from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployEnvCommand extends Command {\n signature = 'deploy:env [action]';\n description = 'Manage environment variables for the current project (list, set, unset, push)';\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const action = args[0] ?? 'list';\n\n if (!['list', 'set', 'unset', 'push'].includes(action)) {\n this.error('Usage: orchestr deploy:env [list|set|unset|push]');\n process.exit(1);\n }\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n switch (action) {\n case 'list':\n await this.list(client, config.project);\n break;\n case 'set':\n await this.set(client, config.project, options);\n break;\n case 'unset':\n await this.unset(client, config.project, options);\n break;\n case 'push':\n await this.push(client, config.project, options);\n break;\n }\n }\n\n private async list(client: SymphonyClient, slug: string): Promise<void> {\n try {\n const result = await client.getEnvVars(slug);\n\n if (result.variables.length === 0) {\n this.comment('No environment variables set.');\n return;\n }\n\n this.info(`Environment variables for: ${slug}`);\n this.newLine();\n\n result.variables.forEach(({ key, value }) => {\n // Mask values longer than 4 chars\n const masked = value.length > 4 ? value.slice(0, 4) + '*'.repeat(Math.min(value.length - 4, 20)) : '****';\n this.line(` ${key}=${masked}`);\n });\n } catch (error: any) {\n this.error(`Failed to fetch env vars: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async set(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const key: string = options.key ?? (await prompt('Variable name: '));\n const value: string = options.value ?? (await prompt('Value: ', true));\n\n if (!key.trim()) {\n this.error('Variable name is required.');\n process.exit(1);\n }\n\n try {\n // Fetch existing vars, merge in the new one\n const existing = await client.getEnvVars(slug);\n const updated = existing.variables.filter((v) => v.key !== key.trim());\n updated.push({ key: key.trim(), value });\n\n await client.putEnvVars(slug, updated);\n this.info(`Set ${key.trim()}`);\n } catch (error: any) {\n this.error(`Failed to set env var: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async unset(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const key: string = options.key ?? (await prompt('Variable name to remove: '));\n\n if (!key.trim()) {\n this.error('Variable name is required.');\n process.exit(1);\n }\n\n try {\n const existing = await client.getEnvVars(slug);\n const updated = existing.variables.filter((v) => v.key !== key.trim());\n\n if (updated.length === existing.variables.length) {\n this.warn(`Variable \"${key.trim()}\" not found.`);\n return;\n }\n\n await client.putEnvVars(slug, updated);\n this.info(`Unset ${key.trim()}`);\n } catch (error: any) {\n this.error(`Failed to unset env var: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async push(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const filePath: string = options.file ?? join(process.cwd(), '.env');\n\n if (!existsSync(filePath)) {\n this.error(`.env file not found at: ${filePath}`);\n process.exit(1);\n }\n\n const variables = this.parseEnvFile(filePath);\n\n if (variables.length === 0) {\n this.warn('No variables found in .env file.');\n return;\n }\n\n try {\n await client.putEnvVars(slug, variables);\n this.info(`Pushed ${variables.length} variable(s) from ${filePath}`);\n } catch (error: any) {\n this.error(`Failed to push env vars: ${error.message}`);\n process.exit(1);\n }\n }\n\n private parseEnvFile(filePath: string): Array<{ key: string; value: string }> {\n const content = readFileSync(filePath, 'utf-8');\n const variables: Array<{ key: string; value: string }> = [];\n\n for (const line of content.split('\\n')) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith('#')) continue;\n\n const eqIndex = trimmed.indexOf('=');\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Strip surrounding quotes\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n value = value.slice(1, -1);\n }\n\n if (key) {\n variables.push({ key, value });\n }\n }\n\n return variables;\n }\n}\n"],"mappings":"2WAiBA,IAAa,EAAb,cAAsC,CAAQ,CAC5C,UAAY,sBACZ,YAAc,gFAEd,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAS,EAAK,IAAM,OAErB,CAAC,OAAQ,MAAO,QAAS,OAAO,CAAC,SAAS,EAAO,GACpD,KAAK,MAAM,mDAAmD,CAC9D,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,OAAQ,EAAR,CACE,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAQ,CACvC,MACF,IAAK,MACH,MAAM,KAAK,IAAI,EAAQ,EAAO,QAAS,EAAQ,CAC/C,MACF,IAAK,QACH,MAAM,KAAK,MAAM,EAAQ,EAAO,QAAS,EAAQ,CACjD,MACF,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAS,EAAQ,CAChD,OAIN,MAAc,KAAK,EAAwB,EAA6B,CACtE,GAAI,CACF,IAAM,EAAS,MAAM,EAAO,WAAW,EAAK,CAE5C,GAAI,EAAO,UAAU,SAAW,EAAG,CACjC,KAAK,QAAQ,gCAAgC,CAC7C,OAGF,KAAK,KAAK,8BAA8B,IAAO,CAC/C,KAAK,SAAS,CAEd,EAAO,UAAU,SAAS,CAAE,MAAK,WAAY,CAE3C,IAAM,EAAS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":["/**\n * DeployInitCommand\n *\n * Interactive setup: authenticate if needed, prompt for project name,\n * create project via API, write symphony.json to project root.\n * Signature: deploy:init\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployInitCommand extends Command {\n signature = 'deploy:init [--name=] [--repository=] [--yes]';\n description = 'Initialise a Symphony deployment for this project';\n\n options: { name?: string; repository?: string; yes?: boolean } = {};\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n this.options = {\n name: options.name as string | undefined,\n repository: options.repository as string | undefined,\n yes: options.yes as boolean | undefined,\n };\n\n this.info('Symphony — Initialise Project');\n this.newLine();\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n if (ProjectConfig.exists()) {\n const existing = ProjectConfig.load();\n if (!this.options.yes) {\n this.warn(`symphony.json already exists (project: ${existing?.project}).`);\n const overwrite = await prompt('Overwrite? (y/N): ');\n if (overwrite.toLowerCase() !== 'y') {\n this.comment('Aborted.');\n return;\n }\n }\n }\n\n let name: string;\n if (this.options.name) {\n name = this.options.name;\n } else {\n name = await prompt('Project name: ');\n }\n if (!name.trim()) {\n this.error('Project name is required.');\n process.exit(1);\n }\n\n let repository: string = '';\n if (this.options.repository) {\n repository = this.options.repository;\n } else if (!this.options.name) {\n repository = await prompt('Git repository URL (optional): ');\n }\n\n try {\n this.comment('Creating project...');\n const result = await client.createProject(name.trim(), repository.trim() || undefined);\n\n ProjectConfig.save({\n project: result.project.slug,\n api: credentials.api,\n });\n\n this.newLine();\n this.info(`Project \"${result.project.name}\" created (slug: ${result.project.slug})`);\n this.comment('symphony.json written to project root.');\n this.newLine();\n this.comment('Next steps:');\n this.comment(' orchestr deploy:server add --host=<ip> --name=<name>');\n this.comment(' orchestr deploy');\n } catch (error: any) {\n if (error.status === 409) {\n this.error(`A project with that name already exists.`);\n } else {\n this.error(`Failed to create project: ${error.message}`);\n }\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAcA,IAAa,EAAb,cAAuC,CAAQ,CAC7C,UAAY,gDACZ,YAAc,oDAEd,QAAiE,EAAE,CAEnE,MAAM,OAAO,EAAiB,EAAwC,CACpE,KAAK,QAAU,CACb,KAAM,EAAQ,KACd,WAAY,EAAQ,WACpB,IAAK,EAAQ,IACd,CAED,KAAK,KAAK,gCAAgC,CAC1C,KAAK,SAAS,CAEd,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,GAAI,EAAc,QAAQ,CAAE,CAC1B,IAAM,EAAW,EAAc,MAAM,CACrC,GAAI,CAAC,KAAK,QAAQ,MAChB,KAAK,KAAK,0CAA0C,GAAU,QAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"DeployInitCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployInitCommand.ts"],"sourcesContent":["/**\n * DeployInitCommand\n *\n * Interactive setup: authenticate if needed, prompt for project name,\n * create project via API, write symphony.json to project root.\n * Signature: deploy:init\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployInitCommand extends Command {\n signature = 'deploy:init [--name=] [--repository=] [--yes]';\n description = 'Initialise a Symphony deployment for this project';\n\n options: { name?: string; repository?: string; yes?: boolean } = {};\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n this.options = {\n name: options.name as string | undefined,\n repository: options.repository as string | undefined,\n yes: options.yes as boolean | undefined,\n };\n\n this.info('Symphony — Initialise Project');\n this.newLine();\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n if (ProjectConfig.exists()) {\n const existing = ProjectConfig.load();\n if (!this.options.yes) {\n this.warn(`symphony.json already exists (project: ${existing?.project}).`);\n const overwrite = await prompt('Overwrite? (y/N): ');\n if (overwrite.toLowerCase() !== 'y') {\n this.comment('Aborted.');\n return;\n }\n }\n }\n\n let name: string;\n if (this.options.name) {\n name = this.options.name;\n } else {\n name = await prompt('Project name: ');\n }\n if (!name.trim()) {\n this.error('Project name is required.');\n process.exit(1);\n }\n\n let repository: string = '';\n if (this.options.repository) {\n repository = this.options.repository;\n } else if (!this.options.name) {\n repository = await prompt('Git repository URL (optional): ');\n }\n\n try {\n this.comment('Creating project...');\n const result = await client.createProject(name.trim(), repository.trim() || undefined);\n\n ProjectConfig.save({\n project: result.project.slug,\n api: credentials.api,\n });\n\n this.newLine();\n this.info(`Project \"${result.project.name}\" created (slug: ${result.project.slug})`);\n this.comment('symphony.json written to project root.');\n this.newLine();\n this.comment('Next steps:');\n this.comment(' orchestr deploy:server add --host=<ip> --name=<name>');\n this.comment(' orchestr deploy');\n } catch (error: any) {\n if (error.status === 409) {\n this.error(`A project with that name already exists.`);\n } else {\n this.error(`Failed to create project: ${error.message}`);\n }\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAcA,IAAa,EAAb,cAAuC,CAAQ,CAC7C,UAAY,gDACZ,YAAc,oDAEd,QAAiE,EAAE,CAEnE,MAAM,OAAO,EAAiB,EAAwC,CACpE,KAAK,QAAU,CACb,KAAM,EAAQ,KACd,WAAY,EAAQ,WACpB,IAAK,EAAQ,IACd,CAED,KAAK,KAAK,gCAAgC,CAC1C,KAAK,SAAS,CAEd,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM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ts"],"sourcesContent":["/**\n * DeployProvisionCommand\n *\n * Provision a fresh Ubuntu server for Orchestr deployments.\n * Signature: deploy:provision\n * Options: --host=<ip> --user=<root-user> --port=<port> --key=<path>\n * --domain=<domain> --email=<email> --name=<project-name>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { prompt } from '@/Deploy/prompt';\nimport { Provisioner } from '@/Deploy/Provisioner';\n\nexport class DeployProvisionCommand extends Command {\n signature = 'deploy:provision';\n description = 'Provision a fresh Ubuntu server for Orchestr deployments';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n this.info('Symphony — Server Provisioner');\n this.newLine();\n this.warn('This command will install software on a remote server.');\n this.warn('Ensure you have root/sudo SSH access before continuing.');\n this.newLine();\n\n // Gather required inputs\n const host: string = options.host ?? (await prompt('Server IP or hostname: '));\n if (!host.trim()) {\n this.error('Host is required.');\n process.exit(1);\n }\n\n const rootUserRaw = options.user ?? (await prompt('SSH user [root]: '));\n const rootUser: string = rootUserRaw || 'root';\n const portRaw = options.port ?? (await prompt('SSH port [22]: '));\n const portStr: string = portRaw || '22';\n const port = parseInt(portStr, 10) || 22;\n const keyPath: string | undefined = options.key ?? undefined;\n const domainRaw = options.domain ?? (await prompt('Domain name (optional, for SSL): '));\n const domain: string | undefined = domainRaw || undefined;\n const certEmailRaw = domain ? (options.email ?? (await prompt('Email for SSL certificate: '))) : undefined;\n const certEmail: string | undefined = certEmailRaw || undefined;\n const projectNameRaw = options.name ?? (await prompt('Project name [app]: '));\n const projectName: string = projectNameRaw || 'app';\n\n const provisioner = new Provisioner({\n host: host.trim(),\n port,\n rootUser: rootUser.trim(),\n keyPath: keyPath?.trim(),\n domain: domain?.trim(),\n email: certEmail?.trim(),\n projectName: projectName.trim(),\n });\n\n // Test connectivity first\n this.comment('Testing SSH connection...');\n if (!provisioner.testConnection()) {\n this.error('Cannot connect to server. Check host, port, and SSH key.');\n process.exit(1);\n }\n this.info('Connection successful.');\n this.newLine();\n\n const confirm = await prompt('Proceed with provisioning? (y/N): ');\n if (confirm.toLowerCase() !== 'y') {\n this.comment('Provisioning cancelled.');\n return;\n }\n\n this.newLine();\n this.info('Provisioning server...');\n this.newLine();\n\n try {\n await provisioner.provision((step) => {\n this.comment(` ▶ ${step}`);\n });\n\n this.newLine();\n this.info('Server provisioned successfully.');\n this.newLine();\n this.comment('What was installed:');\n this.comment(' ✓ Node.js 22');\n this.comment(' ✓ PM2 (process manager)');\n this.comment(' ✓ Nginx (reverse proxy → port 3000)');\n if (domain) {\n this.comment(` ✓ SSL certificate for ${domain}`);\n }\n this.comment(' ✓ orchestr user + directory structure');\n this.comment(' ✓ UFW firewall (22, 80, 443)');\n this.newLine();\n this.comment('Next steps:');\n this.comment(` 1. Add an SSH key for the orchestr user`);\n this.comment(\n ` 2. orchestr deploy:server add --host=${host.trim()} --user=orchestr --name=${projectName.trim()}`\n );\n this.comment(` 3. orchestr deploy`);\n } catch (error: any) {\n this.error(`Provisioning failed: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"qJAaA,IAAa,EAAb,cAA4C,CAAQ,CAClD,UAAY,mBACZ,YAAc,2DAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,KAAK,KAAK,gCAAgC,CAC1C,KAAK,SAAS,CACd,KAAK,KAAK,yDAAyD,CACnE,KAAK,KAAK,0DAA0D,CACpE,KAAK,SAAS,CAGd,IAAM,EAAe,EAAQ,MAAS,MAAM,EAAO,0BAA0B,CACxE,EAAK,MAAM,GACd,KAAK,MAAM,oBAAoB,CAC/B,QAAQ,KAAK,EAAE,EAIjB,IAAM,GADc,EAAQ,MAAS,MAAM,EAAO,oBAAoB,GAC9B,OAElC,GADU,EAAQ,MAAS,MAAM,EAAO,kBAAkB,GAC7B,KAC7B,EAAO,SAAS,EAAS,GAAG,EAAI,GAChC,EAA8B,EAAQ,KAAO,IAAA,GAE7C,GADY,EAAQ,QAAW,MAAM,EAAO,oCAAoC,GACtC,IAAA,GAE1C,GADe,EAAU,EAAQ,OAAU,MAAM,EAAO,8BAA8B,CAAK,IAAA,KAC3C,IAAA,GAEhD,GADiB,EAAQ,MAAS,MAAM,EAAO,uBAAuB,GAC9B,MAExC,EAAc,IAAI,EAAY,CAClC,KAAM,EAAK,MAAM,CACjB,OACA,SAAU,EAAS,MAAM,CACzB,QAAS,GAAS,MAAM,CACxB,OAAQ,GAAQ,MAAM,CACtB,MAAO,GAAW,MAAM,CACxB,YAAa,EAAY,MAAM,CAChC,CAAC,CAYF,GATA,KAAK,QAAQ,4BAA4B,CACpC,EAAY,gBAAgB,GAC/B,KAAK,MAAM,2DAA2D,CACtE,QAAQ,KAAK,EAAE,EAEjB,KAAK,KAAK,yBAAyB,CACnC,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"DeployProvisionCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployProvisionCommand.ts"],"sourcesContent":["/**\n * DeployProvisionCommand\n *\n * Provision a fresh Ubuntu server for Orchestr deployments.\n * Signature: deploy:provision\n * Options: --host=<ip> --user=<root-user> --port=<port> --key=<path>\n * --domain=<domain> --email=<email> --name=<project-name>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { prompt } from '@/Deploy/prompt';\nimport { Provisioner } from '@/Deploy/Provisioner';\n\nexport class DeployProvisionCommand extends Command {\n signature = 'deploy:provision';\n description = 'Provision a fresh Ubuntu server for Orchestr deployments';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n this.info('Symphony — Server Provisioner');\n this.newLine();\n this.warn('This command will install software on a remote server.');\n this.warn('Ensure you have root/sudo SSH access before continuing.');\n this.newLine();\n\n // Gather required inputs\n const host: string = options.host ?? (await prompt('Server IP or hostname: '));\n if (!host.trim()) {\n this.error('Host is required.');\n process.exit(1);\n }\n\n const rootUserRaw = options.user ?? (await prompt('SSH user [root]: '));\n const rootUser: string = rootUserRaw || 'root';\n const portRaw = options.port ?? (await prompt('SSH port [22]: '));\n const portStr: string = portRaw || '22';\n const port = parseInt(portStr, 10) || 22;\n const keyPath: string | undefined = options.key ?? undefined;\n const domainRaw = options.domain ?? (await prompt('Domain name (optional, for SSL): '));\n const domain: string | undefined = domainRaw || undefined;\n const certEmailRaw = domain ? (options.email ?? (await prompt('Email for SSL certificate: '))) : undefined;\n const certEmail: string | undefined = certEmailRaw || undefined;\n const projectNameRaw = options.name ?? (await prompt('Project name [app]: '));\n const projectName: string = projectNameRaw || 'app';\n\n const provisioner = new Provisioner({\n host: host.trim(),\n port,\n rootUser: rootUser.trim(),\n keyPath: keyPath?.trim(),\n domain: domain?.trim(),\n email: certEmail?.trim(),\n projectName: projectName.trim(),\n });\n\n // Test connectivity first\n this.comment('Testing SSH connection...');\n if (!provisioner.testConnection()) {\n this.error('Cannot connect to server. Check host, port, and SSH key.');\n process.exit(1);\n }\n this.info('Connection successful.');\n this.newLine();\n\n const confirm = await prompt('Proceed with provisioning? (y/N): ');\n if (confirm.toLowerCase() !== 'y') {\n this.comment('Provisioning cancelled.');\n return;\n }\n\n this.newLine();\n this.info('Provisioning server...');\n this.newLine();\n\n try {\n await provisioner.provision((step) => {\n this.comment(` ▶ ${step}`);\n });\n\n this.newLine();\n this.info('Server provisioned successfully.');\n this.newLine();\n this.comment('What was installed:');\n this.comment(' ✓ Node.js 22');\n this.comment(' ✓ PM2 (process manager)');\n this.comment(' ✓ Nginx (reverse proxy → port 3000)');\n if (domain) {\n this.comment(` ✓ SSL certificate for ${domain}`);\n }\n this.comment(' ✓ orchestr user + directory structure');\n this.comment(' ✓ UFW firewall (22, 80, 443)');\n this.newLine();\n this.comment('Next steps:');\n this.comment(` 1. Add an SSH key for the orchestr user`);\n this.comment(\n ` 2. orchestr deploy:server add --host=${host.trim()} --user=orchestr --name=${projectName.trim()}`\n );\n this.comment(` 3. orchestr deploy`);\n } catch (error: any) {\n this.error(`Provisioning failed: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"qJAaA,IAAa,EAAb,cAA4C,CAAQ,CAClD,UAAY,mBACZ,YAAc,2DA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AK,mCAAmC,CAC7C,KAAK,SAAS,CACd,KAAK,QAAQ,sBAAsB,CACnC,KAAK,QAAQ,iBAAiB,CAC9B,KAAK,QAAQ,4BAA4B,CACzC,KAAK,QAAQ,wCAAwC,CACjD,GACF,KAAK,QAAQ,2BAA2B,IAAS,CAEnD,KAAK,QAAQ,0CAA0C,CACvD,KAAK,QAAQ,iCAAiC,CAC9C,KAAK,SAAS,CACd,KAAK,QAAQ,cAAc,CAC3B,KAAK,QAAQ,4CAA4C,CACzD,KAAK,QACH,0CAA0C,EAAK,MAAM,CAAC,0BAA0B,EAAY,MAAM,GACnG,CACD,KAAK,QAAQ,uBAAuB,OAC7B,EAAY,CACnB,KAAK,MAAM,wBAAwB,EAAM,UAAU,CACnD,QAAQ,KAAK,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployRollbackCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployRollbackCommand.ts"],"sourcesContent":["/**\n * DeployRollbackCommand\n *\n * Roll back the current project to its previous active deployment.\n * Signature: deploy:rollback\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployRollbackCommand extends Command {\n signature = 'deploy:rollback';\n description = 'Roll back to the previous active deployment';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n // Confirm unless --force\n if (!options.force) {\n this.warn(`You are about to roll back project \"${config.project}\".`);\n const confirm = await prompt('Are you sure? (y/N): ');\n if (confirm.toLowerCase() !== 'y') {\n this.comment('Rollback cancelled.');\n return;\n }\n }\n\n try {\n this.comment('Initiating rollback...');\n const result = await client.rollback(config.project);\n\n this.newLine();\n this.info('Rollback successful.');\n this.comment(` Rolled back: ${result.rolled_back.uuid}`);\n this.comment(` Restored: ${result.restored.uuid}`);\n this.newLine();\n this.warn('Note: The API record has been updated. If PM2 is running the old release,');\n this.warn('you may need to SSH in and re-symlink the release manually, or redeploy.');\n } catch (error: any) {\n if (error.status === 400) {\n this.error(error.message);\n } else {\n this.error(`Rollback failed: ${error.message}`);\n }\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAaA,IAAa,EAAb,cAA2C,CAAQ,CACjD,UAAY,kBACZ,YAAc,8CAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAGrE,GAAI,CAAC,EAAQ,QACX,KAAK,KAAK,uCAAuC,EAAO,QAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"DeployRollbackCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployRollbackCommand.ts"],"sourcesContent":["/**\n * DeployRollbackCommand\n *\n * Roll back the current project to its previous active deployment.\n * Signature: deploy:rollback\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployRollbackCommand extends Command {\n signature = 'deploy:rollback';\n description = 'Roll back to the previous active deployment';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n // Confirm unless --force\n if (!options.force) {\n this.warn(`You are about to roll back project \"${config.project}\".`);\n const confirm = await prompt('Are you sure? (y/N): ');\n if (confirm.toLowerCase() !== 'y') {\n this.comment('Rollback cancelled.');\n return;\n }\n }\n\n try {\n this.comment('Initiating rollback...');\n const result = await client.rollback(config.project);\n\n this.newLine();\n this.info('Rollback successful.');\n this.comment(` Rolled back: ${result.rolled_back.uuid}`);\n this.comment(` Restored: ${result.restored.uuid}`);\n this.newLine();\n this.warn('Note: The API record has been updated. If PM2 is running the old release,');\n this.warn('you may need to SSH in and re-symlink the release manually, or redeploy.');\n } catch (error: any) {\n if (error.status === 400) {\n this.error(error.message);\n } else {\n this.error(`Rollback failed: ${error.message}`);\n }\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAaA,IAAa,EAAb,cAA2C,CAAQ,CACjD,UAAY,kBACZ,YAAc,8CAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAGrE,GAAI,CAAC,EAAQ,QACX,KAAK,KAAK,uCAAuC,EAAO,QAAQ,IAAI,EAEhE,MADkB,EAAO,wBAAwB,EACzC,aAAa,GAAK,KAAK,CACjC,KAAK,QAAQ,sBAAsB,CACnC,OAIJ,GAAI,CACF,KAAK,QAAQ,yBAAyB,CACtC,IAAM,EAAS,MAAM,EAAO,SAAS,EAAO,QAAQ,CAEpD,KAAK,SAAS,CACd,KAAK,KAAK,uBAAuB,CACjC,KAAK,QAAQ,kBAAkB,EAAO,YAAY,OAAO,CACzD,KAAK,QAAQ,kBAAkB,EAAO,SAAS,OAAO,CACtD,KAAK,SAAS,CACd,KAAK,KAAK,4EAA4E,CACtF,KAAK,KAAK,2EAA2E,OAC9E,EAAY,CACf,EAAM,SAAW,IACnB,KAAK,MAAM,EAAM,QAAQ,CAEzB,KAAK,MAAM,oBAAoB,EAAM,UAAU,CAEjD,QAAQ,KAAK,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployServerCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployServerCommand.ts"],"sourcesContent":["/**\n * DeployServerCommand\n *\n * Manage servers for the current project.\n * Signature: deploy:server <action>\n * Actions: add, list, remove\n * Options: --host=<host> --user=<user> --port=<port> --name=<name>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployServerCommand extends Command {\n signature = 'deploy:server <action>';\n description = 'Manage servers for the current project (add, list, remove)';\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const action = args[0];\n\n if (!action || !['add', 'list', 'remove'].includes(action)) {\n this.error('Usage: orchestr deploy:server <add|list|remove>');\n process.exit(1);\n }\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n switch (action) {\n case 'add':\n await this.add(client, config.project, options);\n break;\n case 'list':\n await this.list(client, config.project);\n break;\n case 'remove':\n await this.remove(client, config.project, options);\n break;\n }\n }\n\n private async add(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const name: string = options.name ?? (await prompt('Server name: '));\n const host: string = options.host ?? (await prompt('Host (IP or hostname): '));\n const sshUserRaw = options.user ?? (await prompt('SSH user [orchestr]: '));\n const sshUser: string = sshUserRaw || 'orchestr';\n const portRaw = options.port ?? (await prompt('SSH port [22]: '));\n const portStr: string = portRaw || '22';\n const port = parseInt(portStr, 10) || 22;\n const deployPathRaw = options['deploy-path'] ?? (await prompt('Deploy path [/home/orchestr]: '));\n const deployPath: string = deployPathRaw || '/home/orchestr';\n\n if (!name.trim() || !host.trim()) {\n this.error('Server name and host are required.');\n process.exit(1);\n }\n\n try {\n const result = await client.addServer(slug, {\n name: name.trim(),\n host: host.trim(),\n port,\n ssh_user: sshUser.trim(),\n deploy_path: deployPath.trim(),\n });\n\n this.newLine();\n this.info(`Server \"${result.server.name}\" added (ID: ${result.server.id})`);\n this.comment(` Host: ${result.server.host}:${result.server.port}`);\n this.comment(` User: ${result.server.ssh_user}`);\n this.comment(` Path: ${result.server.deploy_path}`);\n } catch (error: any) {\n this.error(`Failed to add server: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async list(client: SymphonyClient, slug: string): Promise<void> {\n try {\n const result = await client.listServers(slug);\n\n if (result.servers.length === 0) {\n this.comment('No servers configured. Use `orchestr deploy:server add` to add one.');\n return;\n }\n\n this.info(`Servers for project: ${slug}`);\n this.newLine();\n\n const rows = result.servers.map((s) => [\n s.id.toString(),\n s.name,\n `${s.host}:${s.port}`,\n s.ssh_user,\n s.deploy_path,\n s.status ?? 'unknown',\n s.last_deployed_at ? new Date(s.last_deployed_at).toLocaleString() : 'never',\n ]);\n\n this.table(['ID', 'Name', 'Host', 'User', 'Deploy Path', 'Status', 'Last Deployed'], rows);\n } catch (error: any) {\n this.error(`Failed to list servers: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async remove(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const nameOrId: string = options.name ?? options.id ?? (await prompt('Server name or ID: '));\n\n if (!nameOrId.trim()) {\n this.error('Server name or ID is required.');\n process.exit(1);\n }\n\n try {\n // Fetch servers to resolve name → id\n const result = await client.listServers(slug);\n const server = result.servers.find((s) => s.name === nameOrId.trim() || s.id.toString() === nameOrId.trim());\n\n if (!server) {\n this.error(`Server \"${nameOrId}\" not found.`);\n process.exit(1);\n }\n\n await client.deleteServer(slug, server.id);\n this.info(`Server \"${server.name}\" removed.`);\n } catch (error: any) {\n this.error(`Failed to remove server: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAeA,IAAa,EAAb,cAAyC,CAAQ,CAC/C,UAAY,yBACZ,YAAc,6DAEd,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAS,EAAK,IAEhB,CAAC,GAAU,CAAC,CAAC,MAAO,OAAQ,SAAS,CAAC,SAAS,EAAO,IACxD,KAAK,MAAM,kDAAkD,CAC7D,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,OAAQ,EAAR,CACE,IAAK,MACH,MAAM,KAAK,IAAI,EAAQ,EAAO,QAAS,EAAQ,CAC/C,MACF,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAQ,CACvC,MACF,IAAK,SACH,MAAM,KAAK,OAAO,EAAQ,EAAO,QAAS,EAAQ,CAClD,OAIN,MAAc,IAAI,EAAwB,EAAc,EAAwC,CAC9F,IAAM,EAAe,EAAQ,MAAS,MAAM,EAAO,gBAAgB,CAC7D,EAAe,EAAQ,MAAS,MAAM,EAAO,0BAA0B,CAEvE,GADa,EAAQ,MAAS,MAAM,EAAO,wBAAwB,GAC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Q,cAAe,SAAU,gBAAgB,CAAE,EAAK,OACnF,EAAY,CACnB,KAAK,MAAM,2BAA2B,EAAM,UAAU,CACtD,QAAQ,KAAK,EAAE,EAInB,MAAc,OAAO,EAAwB,EAAc,EAAwC,CACjG,IAAM,EAAmB,EAAQ,MAAQ,EAAQ,IAAO,MAAM,EAAO,sBAAsB,CAEtF,EAAS,MAAM,GAClB,KAAK,MAAM,iCAAiC,CAC5C,QAAQ,KAAK,EAAE,EAGjB,GAAI,CAGF,IAAM,
|
|
1
|
+
{"version":3,"file":"DeployServerCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployServerCommand.ts"],"sourcesContent":["/**\n * DeployServerCommand\n *\n * Manage servers for the current project.\n * Signature: deploy:server <action>\n * Actions: add, list, remove\n * Options: --host=<host> --user=<user> --port=<port> --name=<name>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { prompt } from '@/Deploy/prompt';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nexport class DeployServerCommand extends Command {\n signature = 'deploy:server <action>';\n description = 'Manage servers for the current project (add, list, remove)';\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const action = args[0];\n\n if (!action || !['add', 'list', 'remove'].includes(action)) {\n this.error('Usage: orchestr deploy:server <add|list|remove>');\n process.exit(1);\n }\n\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n switch (action) {\n case 'add':\n await this.add(client, config.project, options);\n break;\n case 'list':\n await this.list(client, config.project);\n break;\n case 'remove':\n await this.remove(client, config.project, options);\n break;\n }\n }\n\n private async add(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const name: string = options.name ?? (await prompt('Server name: '));\n const host: string = options.host ?? (await prompt('Host (IP or hostname): '));\n const sshUserRaw = options.user ?? (await prompt('SSH user [orchestr]: '));\n const sshUser: string = sshUserRaw || 'orchestr';\n const portRaw = options.port ?? (await prompt('SSH port [22]: '));\n const portStr: string = portRaw || '22';\n const port = parseInt(portStr, 10) || 22;\n const deployPathRaw = options['deploy-path'] ?? (await prompt('Deploy path [/home/orchestr]: '));\n const deployPath: string = deployPathRaw || '/home/orchestr';\n\n if (!name.trim() || !host.trim()) {\n this.error('Server name and host are required.');\n process.exit(1);\n }\n\n try {\n const result = await client.addServer(slug, {\n name: name.trim(),\n host: host.trim(),\n port,\n ssh_user: sshUser.trim(),\n deploy_path: deployPath.trim(),\n });\n\n this.newLine();\n this.info(`Server \"${result.server.name}\" added (ID: ${result.server.id})`);\n this.comment(` Host: ${result.server.host}:${result.server.port}`);\n this.comment(` User: ${result.server.ssh_user}`);\n this.comment(` Path: ${result.server.deploy_path}`);\n } catch (error: any) {\n this.error(`Failed to add server: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async list(client: SymphonyClient, slug: string): Promise<void> {\n try {\n const result = await client.listServers(slug);\n\n if (result.servers.length === 0) {\n this.comment('No servers configured. Use `orchestr deploy:server add` to add one.');\n return;\n }\n\n this.info(`Servers for project: ${slug}`);\n this.newLine();\n\n const rows = result.servers.map((s) => [\n s.id.toString(),\n s.name,\n `${s.host}:${s.port}`,\n s.ssh_user,\n s.deploy_path,\n s.status ?? 'unknown',\n s.last_deployed_at ? new Date(s.last_deployed_at).toLocaleString() : 'never',\n ]);\n\n this.table(['ID', 'Name', 'Host', 'User', 'Deploy Path', 'Status', 'Last Deployed'], rows);\n } catch (error: any) {\n this.error(`Failed to list servers: ${error.message}`);\n process.exit(1);\n }\n }\n\n private async remove(client: SymphonyClient, slug: string, options: CommandOptions): Promise<void> {\n const nameOrId: string = options.name ?? options.id ?? (await prompt('Server name or ID: '));\n\n if (!nameOrId.trim()) {\n this.error('Server name or ID is required.');\n process.exit(1);\n }\n\n try {\n // Fetch servers to resolve name → id\n const result = await client.listServers(slug);\n const server = result.servers.find((s) => s.name === nameOrId.trim() || s.id.toString() === nameOrId.trim());\n\n if (!server) {\n this.error(`Server \"${nameOrId}\" not found.`);\n process.exit(1);\n }\n\n await client.deleteServer(slug, server.id);\n this.info(`Server \"${server.name}\" removed.`);\n } catch (error: any) {\n this.error(`Failed to remove server: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"6RAeA,IAAa,EAAb,cAAyC,CAAQ,CAC/C,UAAY,yBACZ,YAAc,6DAEd,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAS,EAAK,IAEhB,CAAC,GAAU,CAAC,CAAC,MAAO,OAAQ,SAAS,CAAC,SAAS,EAAO,IACxD,KAAK,MAAM,kDAAkD,CAC7D,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,OAAQ,EAAR,CACE,IAAK,MACH,MAAM,KAAK,IAAI,EAAQ,EAAO,QAAS,EAAQ,CAC/C,MACF,IAAK,OACH,MAAM,KAAK,KAAK,EAAQ,EAAO,QAAQ,CACvC,MACF,IAAK,SACH,MAAM,KAAK,OAAO,EAAQ,EAAO,QAAS,EAAQ,CAClD,OAIN,MAAc,IAAI,EAAwB,EAAc,EAAwC,CAC9F,IAAM,EAAe,EAAQ,MAAS,MAAM,EAAO,gBAAgB,CAC7D,EAAe,EAAQ,MAAS,MAAM,EAAO,0BAA0B,CAEvE,GADa,EAAQ,MAAS,MAAM,EAAO,wBAAwB,GACnC,WAEhC,GADU,EAAQ,MAAS,MAAM,EA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ACnF,EAAY,CACnB,KAAK,MAAM,2BAA2B,EAAM,UAAU,CACtD,QAAQ,KAAK,EAAE,EAInB,MAAc,OAAO,EAAwB,EAAc,EAAwC,CACjG,IAAM,EAAmB,EAAQ,MAAQ,EAAQ,IAAO,MAAM,EAAO,sBAAsB,CAEtF,EAAS,MAAM,GAClB,KAAK,MAAM,iCAAiC,CAC5C,QAAQ,KAAK,EAAE,EAGjB,GAAI,CAGF,IAAM,GAAS,MADM,EAAO,YAAY,EAAK,EACvB,QAAQ,KAAM,GAAM,EAAE,OAAS,EAAS,MAAM,EAAI,EAAE,GAAG,UAAU,GAAK,EAAS,MAAM,CAAC,CAEvG,IACH,KAAK,MAAM,WAAW,EAAS,cAAc,CAC7C,QAAQ,KAAK,EAAE,EAGjB,MAAM,EAAO,aAAa,EAAM,EAAO,GAAG,CAC1C,KAAK,KAAK,WAAW,EAAO,KAAK,YAAY,OACtC,EAAY,CACnB,KAAK,MAAM,4BAA4B,EAAM,UAAU,CACvD,QAAQ,KAAK,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployStatusCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployStatusCommand.ts"],"sourcesContent":["/**\n * DeployStatusCommand\n *\n * List recent deployments for the current project.\n * Signature: deploy:status\n * Options: --limit=<n>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nconst STATUS_COLORS: Record<string, string> = {\n active: '\\x1b[32m', // green\n failed: '\\x1b[31m', // red\n rolled_back: '\\x1b[33m', // yellow\n pending: '\\x1b[90m', // grey\n building: '\\x1b[36m', // cyan\n uploading: '\\x1b[36m',\n deploying: '\\x1b[36m',\n};\nconst RESET = '\\x1b[0m';\n\nexport class DeployStatusCommand extends Command {\n signature = 'deploy:status';\n description = 'Show recent deployments for the current project';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const limit = parseInt(options.limit ?? '10', 10);\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n try {\n const result = await client.listDeployments(config.project, 1, limit);\n const { deployments, pagination } = result;\n\n if (deployments.length === 0) {\n this.comment('No deployments yet.');\n return;\n }\n\n this.info(`Deployments for project: ${config.project}`);\n this.newLine();\n\n // Header\n this.line(` ${'UUID'.padEnd(10)} ${'Status'.padEnd(14)} ${'Date'.padEnd(22)} ${'Commit'.padEnd(10)} Message`);\n this.line(` ${'-'.repeat(80)}`);\n\n for (const d of deployments) {\n const status = d.status ?? 'unknown';\n const color = STATUS_COLORS[status] ?? '';\n const coloredStatus = `${color}${status.padEnd(12)}${RESET}`;\n const date = new Date(d.created_at).toLocaleString().padEnd(22);\n const hash = (d.commit_hash ?? '-').padEnd(10);\n const msg = d.commit_message ? d.commit_message.slice(0, 35) + (d.commit_message.length > 35 ? '…' : '') : '-';\n this.line(` ${d.uuid.slice(0, 8).padEnd(10)} ${coloredStatus} ${date} ${hash} ${msg}`);\n }\n\n this.newLine();\n this.comment(`Showing ${deployments.length} of ${pagination.total} deployments.`);\n } catch (error: any) {\n this.error(`Failed to fetch deployments: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"4OAaA,MAAM,EAAwC,CAC5C,OAAQ,WACR,OAAQ,WACR,YAAa,WACb,QAAS,WACT,SAAU,WACV,UAAW,WACX,UAAW,WACZ,CAGD,IAAa,EAAb,cAAyC,CAAQ,CAC/C,UAAY,gBACZ,YAAc,kDAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAQ,SAAS,EAAQ,OAAS,KAAM,GAAG,CAC3C,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,GAAI,CAEF,GAAM,CAAE,cAAa,
|
|
1
|
+
{"version":3,"file":"DeployStatusCommand.mjs","names":[],"sources":["../../../src/Console/Commands/DeployStatusCommand.ts"],"sourcesContent":["/**\n * DeployStatusCommand\n *\n * List recent deployments for the current project.\n * Signature: deploy:status\n * Options: --limit=<n>\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { CredentialStore } from '@/Deploy/CredentialStore';\nimport { ProjectConfig } from '@/Deploy/ProjectConfig';\nimport { SymphonyClient } from '@/Deploy/SymphonyClient';\n\nconst STATUS_COLORS: Record<string, string> = {\n active: '\\x1b[32m', // green\n failed: '\\x1b[31m', // red\n rolled_back: '\\x1b[33m', // yellow\n pending: '\\x1b[90m', // grey\n building: '\\x1b[36m', // cyan\n uploading: '\\x1b[36m',\n deploying: '\\x1b[36m',\n};\nconst RESET = '\\x1b[0m';\n\nexport class DeployStatusCommand extends Command {\n signature = 'deploy:status';\n description = 'Show recent deployments for the current project';\n\n async handle(_args: string[], options: CommandOptions): Promise<void> {\n const credentials = CredentialStore.load();\n if (!credentials) {\n this.error('Not authenticated. Run `orchestr deploy:login` first.');\n process.exit(1);\n }\n\n const config = ProjectConfig.load();\n if (!config) {\n this.error('No symphony.json found. Run `orchestr deploy:init` first.');\n process.exit(1);\n }\n\n const limit = parseInt(options.limit ?? '10', 10);\n const client = new SymphonyClient(credentials.api, credentials.token);\n\n try {\n const result = await client.listDeployments(config.project, 1, limit);\n const { deployments, pagination } = result;\n\n if (deployments.length === 0) {\n this.comment('No deployments yet.');\n return;\n }\n\n this.info(`Deployments for project: ${config.project}`);\n this.newLine();\n\n // Header\n this.line(` ${'UUID'.padEnd(10)} ${'Status'.padEnd(14)} ${'Date'.padEnd(22)} ${'Commit'.padEnd(10)} Message`);\n this.line(` ${'-'.repeat(80)}`);\n\n for (const d of deployments) {\n const status = d.status ?? 'unknown';\n const color = STATUS_COLORS[status] ?? '';\n const coloredStatus = `${color}${status.padEnd(12)}${RESET}`;\n const date = new Date(d.created_at).toLocaleString().padEnd(22);\n const hash = (d.commit_hash ?? '-').padEnd(10);\n const msg = d.commit_message ? d.commit_message.slice(0, 35) + (d.commit_message.length > 35 ? '…' : '') : '-';\n this.line(` ${d.uuid.slice(0, 8).padEnd(10)} ${coloredStatus} ${date} ${hash} ${msg}`);\n }\n\n this.newLine();\n this.comment(`Showing ${deployments.length} of ${pagination.total} deployments.`);\n } catch (error: any) {\n this.error(`Failed to fetch deployments: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":"4OAaA,MAAM,EAAwC,CAC5C,OAAQ,WACR,OAAQ,WACR,YAAa,WACb,QAAS,WACT,SAAU,WACV,UAAW,WACX,UAAW,WACZ,CAGD,IAAa,EAAb,cAAyC,CAAQ,CAC/C,UAAY,gBACZ,YAAc,kDAEd,MAAM,OAAO,EAAiB,EAAwC,CACpE,IAAM,EAAc,EAAgB,MAAM,CACrC,IACH,KAAK,MAAM,wDAAwD,CACnE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAS,EAAc,MAAM,CAC9B,IACH,KAAK,MAAM,4DAA4D,CACvE,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAQ,SAAS,EAAQ,OAAS,KAAM,GAAG,CAC3C,EAAS,IAAI,EAAe,EAAY,IAAK,EAAY,MAAM,CAErE,GAAI,CAEF,GAAM,CAAE,cAAa,cAAe,MADf,EAAO,gBAAgB,EAAO,QAAS,EAAG,EAAM,CAGrE,GAAI,EAAY,SAAW,EAAG,CAC5B,KAAK,QAAQ,sBAAsB,CACnC,OAGF,KAAK,KAAK,4BAA4B,EAAO,UAAU,CACvD,KAAK,SAAS,CAGd,KAAK,KAAK,KAAK,OAAO,OAAO,GAAG,CAAC,GAAG,SAAS,OAAO,GAAG,CAAC,GAAG,OAAO,OAAO,GAAG,CAAC,GAAG,SAAS,OAAO,GAAG,CAAC,UAAU,CAC9G,KAAK,KAAK,KAAK,IAAI,OAAO,GAAG,GAAG,CAEhC,IAAK,IAAM,KAAK,EAAa,CAC3B,IAAM,EAAS,EAAE,QAAU,UAErB,EAAgB,GADR,EAAc,IAAW,KACN,EAAO,OAAO,GAAG,OAC5C,EAAO,IAAI,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,OAAO,GAAG,CACzD,GAAQ,EAAE,aAAe,KAAK,OAAO,GAAG,CACxC,EAAM,EAAE,eAAiB,EAAE,eAAe,MAAM,EAAG,GAAG,EAAI,EAAE,eAAe,OAAS,GAAK,IAAM,IAAM,IAC3G,KAAK,KAAK,KAAK,EAAE,KAAK,MAAM,EAAG,EAAE,CAAC,OAAO,GAAG,CAAC,GAAG,EAAc,GAAG,EAAK,GAAG,EAAK,GAAG,IAAM,CAGzF,KAAK,SAAS,CACd,KAAK,QAAQ,WAAW,EAAY,OAAO,MAAM,EAAW,MAAM,eAAe,OAC1E,EAAY,CACnB,KAAK,MAAM,gCAAgC,EAAM,UAAU,CAC3D,QAAQ,KAAK,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class extends t.Command{signature=`event:cache`;description=`Discover and cache the application's events and listeners`;constructor(e){super(),this.app=e}async handle(){this.info(`Discovering events and listeners...`);try{let{EventDiscovery:e}=await Promise.resolve().then(()=>require(`../../Support/EventDiscovery.cjs`)),t=new e(this.app),i=this.app.getEventDiscoveryPaths();this.comment(`Scanning directories:`),i.forEach(e=>this.comment(` - ${e}`)),this.newLine();let a=await t.discover(i);if(a.size===0){this.warn(`No events discovered.`);return}let o=Array.from(a.entries()),s=this.app.storagePath(`framework/events.json`);await n.mkdir(r.dirname(s),{recursive:!0}),await n.writeFile(s,JSON.stringify(o,null,2)),this.info(`Events cached successfully!`),this.newLine(),this.comment(`Cached ${a.size} events to: ${s}`);let c=0;for(let[,e]of a)c+=e.length;this.comment(`Total listeners: ${c}`)}catch(e){if(e.code===`MODULE_NOT_FOUND`&&e.message?.includes(`EventDiscovery`))this.error(`EventDiscovery module not found.`),this.comment(`The EventDiscovery system (Task 6) must be implemented first.`),this.comment(`This command will work once EventDiscovery is available.`);else throw this.error(`Failed to cache events: ${e.message}`),e}}};exports.EventCacheCommand=i;
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class extends t.Command{app;signature=`event:cache`;description=`Discover and cache the application's events and listeners`;constructor(e){super(),this.app=e}async handle(){this.info(`Discovering events and listeners...`);try{let{EventDiscovery:e}=await Promise.resolve().then(()=>require(`../../Support/EventDiscovery.cjs`)),t=new e(this.app),i=this.app.getEventDiscoveryPaths();this.comment(`Scanning directories:`),i.forEach(e=>this.comment(` - ${e}`)),this.newLine();let a=await t.discover(i);if(a.size===0){this.warn(`No events discovered.`);return}let o=Array.from(a.entries()),s=this.app.storagePath(`framework/events.json`);await n.mkdir(r.dirname(s),{recursive:!0}),await n.writeFile(s,JSON.stringify(o,null,2)),this.info(`Events cached successfully!`),this.newLine(),this.comment(`Cached ${a.size} events to: ${s}`);let c=0;for(let[,e]of a)c+=e.length;this.comment(`Total listeners: ${c}`)}catch(e){if(e.code===`MODULE_NOT_FOUND`&&e.message?.includes(`EventDiscovery`))this.error(`EventDiscovery module not found.`),this.comment(`The EventDiscovery system (Task 6) must be implemented first.`),this.comment(`This command will work once EventDiscovery is available.`);else throw this.error(`Failed to cache events: ${e.message}`),e}}};exports.EventCacheCommand=i;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{signature=`event:cache`;description=`Discover and cache the application's events and listeners`;constructor(e){super(),this.app=e}async handle(){this.info(`Discovering events and listeners...`);try{let{EventDiscovery:e}=await import(`../../Support/EventDiscovery.mjs`),r=new e(this.app),i=this.app.getEventDiscoveryPaths();this.comment(`Scanning directories:`),i.forEach(e=>this.comment(` - ${e}`)),this.newLine();let a=await r.discover(i);if(a.size===0){this.warn(`No events discovered.`);return}let o=Array.from(a.entries()),s=this.app.storagePath(`framework/events.json`);await t.mkdir(n.dirname(s),{recursive:!0}),await t.writeFile(s,JSON.stringify(o,null,2)),this.info(`Events cached successfully!`),this.newLine(),this.comment(`Cached ${a.size} events to: ${s}`);let c=0;for(let[,e]of a)c+=e.length;this.comment(`Total listeners: ${c}`)}catch(e){if(e.code===`MODULE_NOT_FOUND`&&e.message?.includes(`EventDiscovery`))this.error(`EventDiscovery module not found.`),this.comment(`The EventDiscovery system (Task 6) must be implemented first.`),this.comment(`This command will work once EventDiscovery is available.`);else throw this.error(`Failed to cache events: ${e.message}`),e}}};export{r as EventCacheCommand};
|
|
1
|
+
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{app;signature=`event:cache`;description=`Discover and cache the application's events and listeners`;constructor(e){super(),this.app=e}async handle(){this.info(`Discovering events and listeners...`);try{let{EventDiscovery:e}=await import(`../../Support/EventDiscovery.mjs`),r=new e(this.app),i=this.app.getEventDiscoveryPaths();this.comment(`Scanning directories:`),i.forEach(e=>this.comment(` - ${e}`)),this.newLine();let a=await r.discover(i);if(a.size===0){this.warn(`No events discovered.`);return}let o=Array.from(a.entries()),s=this.app.storagePath(`framework/events.json`);await t.mkdir(n.dirname(s),{recursive:!0}),await t.writeFile(s,JSON.stringify(o,null,2)),this.info(`Events cached successfully!`),this.newLine(),this.comment(`Cached ${a.size} events to: ${s}`);let c=0;for(let[,e]of a)c+=e.length;this.comment(`Total listeners: ${c}`)}catch(e){if(e.code===`MODULE_NOT_FOUND`&&e.message?.includes(`EventDiscovery`))this.error(`EventDiscovery module not found.`),this.comment(`The EventDiscovery system (Task 6) must be implemented first.`),this.comment(`This command will work once EventDiscovery is available.`);else throw this.error(`Failed to cache events: ${e.message}`),e}}};export{r as EventCacheCommand};
|
|
2
2
|
//# sourceMappingURL=EventCacheCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCacheCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventCacheCommand.ts"],"sourcesContent":["/**\n * EventCacheCommand\n *\n * Discover and cache the application's events and listeners following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventCacheCommand extends Command {\n signature = 'event:cache';\n description = \"Discover and cache the application's events and listeners\";\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(): Promise<void> {\n this.info('Discovering events and listeners...');\n\n try {\n // Try to dynamically import EventDiscovery (Task 6 dependency)\n const { EventDiscovery } = await import('@/Support/EventDiscovery');\n\n const discovery = new EventDiscovery(this.app);\n const directories = this.app.getEventDiscoveryPaths();\n\n this.comment(`Scanning directories:`);\n directories.forEach((dir) => this.comment(` - ${dir}`));\n this.newLine();\n\n const listeners = await discovery.discover(directories);\n\n if (listeners.size === 0) {\n this.warn('No events discovered.');\n return;\n }\n\n // Convert Map to array for JSON serialization\n const listenersArray = Array.from(listeners.entries());\n\n // Create cache directory\n const cachePath = this.app.storagePath('framework/events.json');\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n\n // Write cache file\n await fs.writeFile(cachePath, JSON.stringify(listenersArray, null, 2));\n\n this.info(`Events cached successfully!`);\n this.newLine();\n this.comment(`Cached ${listeners.size} events to: ${cachePath}`);\n\n // Show summary\n let totalListeners = 0;\n for (const [, listenerList] of listeners) {\n totalListeners += listenerList.length;\n }\n\n this.comment(`Total listeners: ${totalListeners}`);\n } catch (error: any) {\n if (error.code === 'MODULE_NOT_FOUND' && error.message?.includes('EventDiscovery')) {\n this.error('EventDiscovery module not found.');\n this.comment('The EventDiscovery system (Task 6) must be implemented first.');\n this.comment('This command will work once EventDiscovery is available.');\n } else {\n this.error(`Failed to cache events: ${error.message}`);\n throw error;\n }\n }\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAAuC,CAAQ,
|
|
1
|
+
{"version":3,"file":"EventCacheCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventCacheCommand.ts"],"sourcesContent":["/**\n * EventCacheCommand\n *\n * Discover and cache the application's events and listeners following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventCacheCommand extends Command {\n signature = 'event:cache';\n description = \"Discover and cache the application's events and listeners\";\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(): Promise<void> {\n this.info('Discovering events and listeners...');\n\n try {\n // Try to dynamically import EventDiscovery (Task 6 dependency)\n const { EventDiscovery } = await import('@/Support/EventDiscovery');\n\n const discovery = new EventDiscovery(this.app);\n const directories = this.app.getEventDiscoveryPaths();\n\n this.comment(`Scanning directories:`);\n directories.forEach((dir) => this.comment(` - ${dir}`));\n this.newLine();\n\n const listeners = await discovery.discover(directories);\n\n if (listeners.size === 0) {\n this.warn('No events discovered.');\n return;\n }\n\n // Convert Map to array for JSON serialization\n const listenersArray = Array.from(listeners.entries());\n\n // Create cache directory\n const cachePath = this.app.storagePath('framework/events.json');\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n\n // Write cache file\n await fs.writeFile(cachePath, JSON.stringify(listenersArray, null, 2));\n\n this.info(`Events cached successfully!`);\n this.newLine();\n this.comment(`Cached ${listeners.size} events to: ${cachePath}`);\n\n // Show summary\n let totalListeners = 0;\n for (const [, listenerList] of listeners) {\n totalListeners += listenerList.length;\n }\n\n this.comment(`Total listeners: ${totalListeners}`);\n } catch (error: any) {\n if (error.code === 'MODULE_NOT_FOUND' && error.message?.includes('EventDiscovery')) {\n this.error('EventDiscovery module not found.');\n this.comment('The EventDiscovery system (Task 6) must be implemented first.');\n this.comment('This command will work once EventDiscovery is available.');\n } else {\n this.error(`Failed to cache events: ${error.message}`);\n throw error;\n }\n }\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAAuC,CAAQ,CAIvB,IAHtB,UAAY,cACZ,YAAc,4DAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,QAAwB,CAC5B,KAAK,KAAK,sCAAsC,CAEhD,GAAI,CAEF,GAAM,CAAE,kBAAmB,MAAM,OAAO,oCAElC,EAAY,IAAI,EAAe,KAAK,IAAI,CACxC,EAAc,KAAK,IAAI,wBAAwB,CAErD,KAAK,QAAQ,wBAAwB,CACrC,EAAY,QAAS,GAAQ,KAAK,QAAQ,OAAO,IAAM,CAAC,CACxD,KAAK,SAAS,CAEd,IAAM,EAAY,MAAM,EAAU,SAAS,EAAY,CAEvD,GAAI,EAAU,OAAS,EAAG,CACxB,KAAK,KAAK,wBAAwB,CAClC,OAIF,IAAM,EAAiB,MAAM,KAAK,EAAU,SAAS,CAAC,CAGhD,EAAY,KAAK,IAAI,YAAY,wBAAwB,CAC/D,MAAM,EAAG,MAAM,EAAK,QAAQ,EAAU,CAAE,CAAE,UAAW,GAAM,CAAC,CAG5D,MAAM,EAAG,UAAU,EAAW,KAAK,UAAU,EAAgB,KAAM,EAAE,CAAC,CAEtE,KAAK,KAAK,8BAA8B,CACxC,KAAK,SAAS,CACd,KAAK,QAAQ,UAAU,EAAU,KAAK,cAAc,IAAY,CAGhE,IAAI,EAAiB,EACrB,IAAK,GAAM,EAAG,KAAiB,EAC7B,GAAkB,EAAa,OAGjC,KAAK,QAAQ,oBAAoB,IAAiB,OAC3C,EAAY,CACnB,GAAI,EAAM,OAAS,oBAAsB,EAAM,SAAS,SAAS,iBAAiB,CAChF,KAAK,MAAM,mCAAmC,CAC9C,KAAK,QAAQ,gEAAgE,CAC7E,KAAK,QAAQ,2DAA2D,MAGxE,MADA,KAAK,MAAM,2BAA2B,EAAM,UAAU,CAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);var r=class extends t.Command{signature=`event:clear`;description=`Clear all cached events and listeners`;constructor(e){super(),this.app=e}async handle(){let e=this.app.storagePath(`framework/events.json`);try{await n.access(e),await n.unlink(e),this.info(`Cached events cleared successfully.`)}catch(e){if(e.code===`ENOENT`)this.comment(`No cached events found.`);else throw this.error(`Failed to clear cached events: ${e.message}`),e}}};exports.EventClearCommand=r;
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);var r=class extends t.Command{app;signature=`event:clear`;description=`Clear all cached events and listeners`;constructor(e){super(),this.app=e}async handle(){let e=this.app.storagePath(`framework/events.json`);try{await n.access(e),await n.unlink(e),this.info(`Cached events cleared successfully.`)}catch(e){if(e.code===`ENOENT`)this.comment(`No cached events found.`);else throw this.error(`Failed to clear cached events: ${e.message}`),e}}};exports.EventClearCommand=r;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";var n=class extends e{signature=`event:clear`;description=`Clear all cached events and listeners`;constructor(e){super(),this.app=e}async handle(){let e=this.app.storagePath(`framework/events.json`);try{await t.access(e),await t.unlink(e),this.info(`Cached events cleared successfully.`)}catch(e){if(e.code===`ENOENT`)this.comment(`No cached events found.`);else throw this.error(`Failed to clear cached events: ${e.message}`),e}}};export{n as EventClearCommand};
|
|
1
|
+
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";var n=class extends e{app;signature=`event:clear`;description=`Clear all cached events and listeners`;constructor(e){super(),this.app=e}async handle(){let e=this.app.storagePath(`framework/events.json`);try{await t.access(e),await t.unlink(e),this.info(`Cached events cleared successfully.`)}catch(e){if(e.code===`ENOENT`)this.comment(`No cached events found.`);else throw this.error(`Failed to clear cached events: ${e.message}`),e}}};export{n as EventClearCommand};
|
|
2
2
|
//# sourceMappingURL=EventClearCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventClearCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventClearCommand.ts"],"sourcesContent":["/**\n * EventClearCommand\n *\n * Clear all cached events and listeners following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport { Command } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventClearCommand extends Command {\n signature = 'event:clear';\n description = 'Clear all cached events and listeners';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(): Promise<void> {\n const cachePath = this.app.storagePath('framework/events.json');\n\n try {\n await fs.access(cachePath);\n await fs.unlink(cachePath);\n this.info('Cached events cleared successfully.');\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n this.comment('No cached events found.');\n } else {\n this.error(`Failed to clear cached events: ${error.message}`);\n throw error;\n }\n }\n }\n}\n"],"mappings":"uEAUA,IAAa,EAAb,cAAuC,CAAQ,
|
|
1
|
+
{"version":3,"file":"EventClearCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventClearCommand.ts"],"sourcesContent":["/**\n * EventClearCommand\n *\n * Clear all cached events and listeners following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport { Command } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventClearCommand extends Command {\n signature = 'event:clear';\n description = 'Clear all cached events and listeners';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(): Promise<void> {\n const cachePath = this.app.storagePath('framework/events.json');\n\n try {\n await fs.access(cachePath);\n await fs.unlink(cachePath);\n this.info('Cached events cleared successfully.');\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n this.comment('No cached events found.');\n } else {\n this.error(`Failed to clear cached events: ${error.message}`);\n throw error;\n }\n }\n }\n}\n"],"mappings":"uEAUA,IAAa,EAAb,cAAuC,CAAQ,CAIvB,IAHtB,UAAY,cACZ,YAAc,wCAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,QAAwB,CAC5B,IAAM,EAAY,KAAK,IAAI,YAAY,wBAAwB,CAE/D,GAAI,CACF,MAAM,EAAG,OAAO,EAAU,CAC1B,MAAM,EAAG,OAAO,EAAU,CAC1B,KAAK,KAAK,sCAAsC,OACzC,EAAY,CACnB,GAAI,EAAM,OAAS,SACjB,KAAK,QAAQ,0BAA0B,MAGvC,MADA,KAAK,MAAM,kCAAkC,EAAM,UAAU,CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.Command{signature=`event:list [--event=]`;description=`List the application's events and listeners`;constructor(e){super(),this.app=e}async handle(e,t){try{let e=this.app.make(`events`).getRawListeners();if(e.size===0){this.comment(`No events have been registered.`);return}let n=t.event,r=[];for(let[t,i]of e)n&&!t.includes(n)||(i.length===0?r.push([t,`No listeners`]):i.forEach((e,n)=>{r.push([n===0?t:``,this.formatListener(e)])}),r.length>0&&r[r.length-1][0]!==``&&r.push([``,``]));if(r.length>0&&r[r.length-1][0]===``&&r.pop(),r.length===0){this.comment(`No events found matching: ${n}`);return}this.newLine(),this.info(`Registered Events and Listeners:`),this.newLine();let i=Math.max(...r.map(e=>e[0].length),5),a=Math.max(...r.map(e=>e[1].length),9);this.line(`${`Event`.padEnd(i+2)} ${`Listeners`.padEnd(a)}`),this.line(`-`.repeat(i+a+3));for(let[e,t]of r)e===``&&t===``?this.line(``):this.line(`${e.padEnd(i+2)} ${t}`);this.newLine(),this.comment(`Total events: ${e.size}`)}catch(e){if(e.message?.includes(`events`))this.error(`Event dispatcher not registered.`),this.comment(`Make sure the EventServiceProvider is registered in your application.`);else throw e}}formatListener(e){return typeof e==`string`?e:typeof e==`function`?e.name||`<Closure>`:typeof e==`object`&&e.constructor?e.constructor.name:`<Unknown>`}};exports.EventListCommand=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.Command{app;signature=`event:list [--event=]`;description=`List the application's events and listeners`;constructor(e){super(),this.app=e}async handle(e,t){try{let e=this.app.make(`events`).getRawListeners();if(e.size===0){this.comment(`No events have been registered.`);return}let n=t.event,r=[];for(let[t,i]of e)n&&!t.includes(n)||(i.length===0?r.push([t,`No listeners`]):i.forEach((e,n)=>{r.push([n===0?t:``,this.formatListener(e)])}),r.length>0&&r[r.length-1][0]!==``&&r.push([``,``]));if(r.length>0&&r[r.length-1][0]===``&&r.pop(),r.length===0){this.comment(`No events found matching: ${n}`);return}this.newLine(),this.info(`Registered Events and Listeners:`),this.newLine();let i=Math.max(...r.map(e=>e[0].length),5),a=Math.max(...r.map(e=>e[1].length),9);this.line(`${`Event`.padEnd(i+2)} ${`Listeners`.padEnd(a)}`),this.line(`-`.repeat(i+a+3));for(let[e,t]of r)e===``&&t===``?this.line(``):this.line(`${e.padEnd(i+2)} ${t}`);this.newLine(),this.comment(`Total events: ${e.size}`)}catch(e){if(e.message?.includes(`events`))this.error(`Event dispatcher not registered.`),this.comment(`Make sure the EventServiceProvider is registered in your application.`);else throw e}}formatListener(e){return typeof e==`string`?e:typeof e==`function`?e.name||`<Closure>`:typeof e==`object`&&e.constructor?e.constructor.name:`<Unknown>`}};exports.EventListCommand=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";var t=class extends e{signature=`event:list [--event=]`;description=`List the application's events and listeners`;constructor(e){super(),this.app=e}async handle(e,t){try{let e=this.app.make(`events`).getRawListeners();if(e.size===0){this.comment(`No events have been registered.`);return}let n=t.event,r=[];for(let[t,i]of e)n&&!t.includes(n)||(i.length===0?r.push([t,`No listeners`]):i.forEach((e,n)=>{r.push([n===0?t:``,this.formatListener(e)])}),r.length>0&&r[r.length-1][0]!==``&&r.push([``,``]));if(r.length>0&&r[r.length-1][0]===``&&r.pop(),r.length===0){this.comment(`No events found matching: ${n}`);return}this.newLine(),this.info(`Registered Events and Listeners:`),this.newLine();let i=Math.max(...r.map(e=>e[0].length),5),a=Math.max(...r.map(e=>e[1].length),9);this.line(`${`Event`.padEnd(i+2)} ${`Listeners`.padEnd(a)}`),this.line(`-`.repeat(i+a+3));for(let[e,t]of r)e===``&&t===``?this.line(``):this.line(`${e.padEnd(i+2)} ${t}`);this.newLine(),this.comment(`Total events: ${e.size}`)}catch(e){if(e.message?.includes(`events`))this.error(`Event dispatcher not registered.`),this.comment(`Make sure the EventServiceProvider is registered in your application.`);else throw e}}formatListener(e){return typeof e==`string`?e:typeof e==`function`?e.name||`<Closure>`:typeof e==`object`&&e.constructor?e.constructor.name:`<Unknown>`}};export{t as EventListCommand};
|
|
1
|
+
import{Command as e}from"../Command.mjs";var t=class extends e{app;signature=`event:list [--event=]`;description=`List the application's events and listeners`;constructor(e){super(),this.app=e}async handle(e,t){try{let e=this.app.make(`events`).getRawListeners();if(e.size===0){this.comment(`No events have been registered.`);return}let n=t.event,r=[];for(let[t,i]of e)n&&!t.includes(n)||(i.length===0?r.push([t,`No listeners`]):i.forEach((e,n)=>{r.push([n===0?t:``,this.formatListener(e)])}),r.length>0&&r[r.length-1][0]!==``&&r.push([``,``]));if(r.length>0&&r[r.length-1][0]===``&&r.pop(),r.length===0){this.comment(`No events found matching: ${n}`);return}this.newLine(),this.info(`Registered Events and Listeners:`),this.newLine();let i=Math.max(...r.map(e=>e[0].length),5),a=Math.max(...r.map(e=>e[1].length),9);this.line(`${`Event`.padEnd(i+2)} ${`Listeners`.padEnd(a)}`),this.line(`-`.repeat(i+a+3));for(let[e,t]of r)e===``&&t===``?this.line(``):this.line(`${e.padEnd(i+2)} ${t}`);this.newLine(),this.comment(`Total events: ${e.size}`)}catch(e){if(e.message?.includes(`events`))this.error(`Event dispatcher not registered.`),this.comment(`Make sure the EventServiceProvider is registered in your application.`);else throw e}}formatListener(e){return typeof e==`string`?e:typeof e==`function`?e.name||`<Closure>`:typeof e==`object`&&e.constructor?e.constructor.name:`<Unknown>`}};export{t as EventListCommand};
|
|
2
2
|
//# sourceMappingURL=EventListCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventListCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventListCommand.ts"],"sourcesContent":["/**\n * EventListCommand\n *\n * List all registered events and their listeners following Laravel's Artisan pattern\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventListCommand extends Command {\n signature = 'event:list [--event=]';\n description = \"List the application's events and listeners\";\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n try {\n // Try to get the dispatcher - will fail gracefully if not available yet\n const dispatcher = this.app.make<any>('events');\n const listeners = dispatcher.getRawListeners();\n\n if (listeners.size === 0) {\n this.comment('No events have been registered.');\n return;\n }\n\n const filter = options.event as string | undefined;\n\n const rows: string[][] = [];\n\n for (const [event, listenerList] of listeners) {\n // Filter if event option provided\n if (filter && !event.includes(filter)) {\n continue;\n }\n\n if (listenerList.length === 0) {\n rows.push([event, 'No listeners']);\n } else {\n listenerList.forEach((listener: any, index: number) => {\n rows.push([index === 0 ? event : '', this.formatListener(listener)]);\n });\n }\n\n // Add separator between events\n if (rows.length > 0 && rows[rows.length - 1][0] !== '') {\n rows.push(['', '']);\n }\n }\n\n // Remove trailing separator\n if (rows.length > 0 && rows[rows.length - 1][0] === '') {\n rows.pop();\n }\n\n if (rows.length === 0) {\n this.comment(`No events found matching: ${filter}`);\n return;\n }\n\n this.newLine();\n this.info('Registered Events and Listeners:');\n this.newLine();\n\n // Display results in a formatted table\n const maxEventLength = Math.max(...rows.map((row) => row[0].length), 'Event'.length);\n const maxListenerLength = Math.max(...rows.map((row) => row[1].length), 'Listeners'.length);\n\n // Header\n this.line(`${'Event'.padEnd(maxEventLength + 2)} ${'Listeners'.padEnd(maxListenerLength)}`);\n this.line('-'.repeat(maxEventLength + maxListenerLength + 3));\n\n // Rows\n for (const [event, listener] of rows) {\n if (event === '' && listener === '') {\n this.line('');\n } else {\n this.line(`${event.padEnd(maxEventLength + 2)} ${listener}`);\n }\n }\n\n this.newLine();\n this.comment(`Total events: ${listeners.size}`);\n } catch (error: any) {\n if (error.message?.includes('events')) {\n this.error('Event dispatcher not registered.');\n this.comment('Make sure the EventServiceProvider is registered in your application.');\n } else {\n throw error;\n }\n }\n }\n\n /**\n * Format a listener for display\n */\n protected formatListener(listener: any): string {\n if (typeof listener === 'string') {\n return listener;\n }\n\n if (typeof listener === 'function') {\n return listener.name || '<Closure>';\n }\n\n if (typeof listener === 'object' && listener.constructor) {\n return listener.constructor.name;\n }\n\n return '<Unknown>';\n }\n}\n"],"mappings":"yCASA,IAAa,EAAb,cAAsC,CAAQ,
|
|
1
|
+
{"version":3,"file":"EventListCommand.mjs","names":[],"sources":["../../../src/Console/Commands/EventListCommand.ts"],"sourcesContent":["/**\n * EventListCommand\n *\n * List all registered events and their listeners following Laravel's Artisan pattern\n */\n\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class EventListCommand extends Command {\n signature = 'event:list [--event=]';\n description = \"List the application's events and listeners\";\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n try {\n // Try to get the dispatcher - will fail gracefully if not available yet\n const dispatcher = this.app.make<any>('events');\n const listeners = dispatcher.getRawListeners();\n\n if (listeners.size === 0) {\n this.comment('No events have been registered.');\n return;\n }\n\n const filter = options.event as string | undefined;\n\n const rows: string[][] = [];\n\n for (const [event, listenerList] of listeners) {\n // Filter if event option provided\n if (filter && !event.includes(filter)) {\n continue;\n }\n\n if (listenerList.length === 0) {\n rows.push([event, 'No listeners']);\n } else {\n listenerList.forEach((listener: any, index: number) => {\n rows.push([index === 0 ? event : '', this.formatListener(listener)]);\n });\n }\n\n // Add separator between events\n if (rows.length > 0 && rows[rows.length - 1][0] !== '') {\n rows.push(['', '']);\n }\n }\n\n // Remove trailing separator\n if (rows.length > 0 && rows[rows.length - 1][0] === '') {\n rows.pop();\n }\n\n if (rows.length === 0) {\n this.comment(`No events found matching: ${filter}`);\n return;\n }\n\n this.newLine();\n this.info('Registered Events and Listeners:');\n this.newLine();\n\n // Display results in a formatted table\n const maxEventLength = Math.max(...rows.map((row) => row[0].length), 'Event'.length);\n const maxListenerLength = Math.max(...rows.map((row) => row[1].length), 'Listeners'.length);\n\n // Header\n this.line(`${'Event'.padEnd(maxEventLength + 2)} ${'Listeners'.padEnd(maxListenerLength)}`);\n this.line('-'.repeat(maxEventLength + maxListenerLength + 3));\n\n // Rows\n for (const [event, listener] of rows) {\n if (event === '' && listener === '') {\n this.line('');\n } else {\n this.line(`${event.padEnd(maxEventLength + 2)} ${listener}`);\n }\n }\n\n this.newLine();\n this.comment(`Total events: ${listeners.size}`);\n } catch (error: any) {\n if (error.message?.includes('events')) {\n this.error('Event dispatcher not registered.');\n this.comment('Make sure the EventServiceProvider is registered in your application.');\n } else {\n throw error;\n }\n }\n }\n\n /**\n * Format a listener for display\n */\n protected formatListener(listener: any): string {\n if (typeof listener === 'string') {\n return listener;\n }\n\n if (typeof listener === 'function') {\n return listener.name || '<Closure>';\n }\n\n if (typeof listener === 'object' && listener.constructor) {\n return listener.constructor.name;\n }\n\n return '<Unknown>';\n }\n}\n"],"mappings":"yCASA,IAAa,EAAb,cAAsC,CAAQ,CAItB,IAHtB,UAAY,wBACZ,YAAc,8CAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAgB,EAAwC,CACnE,GAAI,CAGF,IAAM,EADa,KAAK,IAAI,KAAU,SACV,CAAC,iBAAiB,CAE9C,GAAI,EAAU,OAAS,EAAG,CACxB,KAAK,QAAQ,kCAAkC,CAC/C,OAGF,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F,MAAM,GAQZ,eAAyB,EAAuB,CAa9C,OAZI,OAAO,GAAa,SACf,EAGL,OAAO,GAAa,WACf,EAAS,MAAQ,YAGtB,OAAO,GAAa,UAAY,EAAS,YACpC,EAAS,YAAY,KAGvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class extends t.Command{signature=`make:controller <name>`;description=`Create a new controller class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Controller name is required.`),this.line(`Usage: make:controller <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Controller already exists: ${o}`);return}await n.mkdir(a,{recursive:!0}),await this.ensureBaseController(a);let s=this.getStub().replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Controller created successfully: ${o}`),this.newLine(),this.comment(`Use it in your routes or register in your HTTP layer.`)}getPath(e){return e.path||this.app.path(`Http/Controllers`)}async ensureBaseController(e){let t=r.join(e,`Controller.ts`);await this.fileExists(t)||(await n.writeFile(t,this.getBaseControllerStub()),this.info(`Base controller created: ${t}`))}getBaseControllerStub(){return`/**
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class extends t.Command{app;signature=`make:controller <name>`;description=`Create a new controller class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Controller name is required.`),this.line(`Usage: make:controller <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Controller already exists: ${o}`);return}await n.mkdir(a,{recursive:!0}),await this.ensureBaseController(a);let s=this.getStub().replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Controller created successfully: ${o}`),this.newLine(),this.comment(`Use it in your routes or register in your HTTP layer.`)}getPath(e){return e.path||this.app.path(`Http/Controllers`)}async ensureBaseController(e){let t=r.join(e,`Controller.ts`);await this.fileExists(t)||(await n.writeFile(t,this.getBaseControllerStub()),this.info(`Base controller created: ${t}`))}getBaseControllerStub(){return`/**
|
|
2
2
|
* Base Controller
|
|
3
3
|
*
|
|
4
4
|
* All application controllers should extend this class.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{signature=`make:controller <name>`;description=`Create a new controller class`;constructor(e){super(),this.app=e}async handle(e,r){let i=e[0];if(!i){this.error(`Controller name is required.`),this.line(`Usage: make:controller <name>`);return}let a=this.getPath(r),o=n.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Controller already exists: ${o}`);return}await t.mkdir(a,{recursive:!0}),await this.ensureBaseController(a);let s=this.getStub().replace(/\{\{className\}\}/g,i);await t.writeFile(o,s),this.info(`Controller created successfully: ${o}`),this.newLine(),this.comment(`Use it in your routes or register in your HTTP layer.`)}getPath(e){return e.path||this.app.path(`Http/Controllers`)}async ensureBaseController(e){let r=n.join(e,`Controller.ts`);await this.fileExists(r)||(await t.writeFile(r,this.getBaseControllerStub()),this.info(`Base controller created: ${r}`))}getBaseControllerStub(){return`/**
|
|
1
|
+
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{app;signature=`make:controller <name>`;description=`Create a new controller class`;constructor(e){super(),this.app=e}async handle(e,r){let i=e[0];if(!i){this.error(`Controller name is required.`),this.line(`Usage: make:controller <name>`);return}let a=this.getPath(r),o=n.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Controller already exists: ${o}`);return}await t.mkdir(a,{recursive:!0}),await this.ensureBaseController(a);let s=this.getStub().replace(/\{\{className\}\}/g,i);await t.writeFile(o,s),this.info(`Controller created successfully: ${o}`),this.newLine(),this.comment(`Use it in your routes or register in your HTTP layer.`)}getPath(e){return e.path||this.app.path(`Http/Controllers`)}async ensureBaseController(e){let r=n.join(e,`Controller.ts`);await this.fileExists(r)||(await t.writeFile(r,this.getBaseControllerStub()),this.info(`Base controller created: ${r}`))}getBaseControllerStub(){return`/**
|
|
2
2
|
* Base Controller
|
|
3
3
|
*
|
|
4
4
|
* All application controllers should extend this class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeControllerCommand.mjs","names":[],"sources":["../../../src/Console/Commands/MakeControllerCommand.ts"],"sourcesContent":["/**\n * MakeControllerCommand\n *\n * Create a new controller class following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Application } from '../../Foundation/Application';\nimport { Command, CommandOptions } from '../Command';\n\nexport class MakeControllerCommand extends Command {\n signature = 'make:controller <name>';\n description = 'Create a new controller class';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const name = args[0];\n\n if (!name) {\n this.error('Controller name is required.');\n this.line('Usage: make:controller <name>');\n return;\n }\n\n const controllersPath = this.getPath(options);\n const filePath = path.join(controllersPath, `${name}.ts`);\n\n // Check if file already exists\n if (await this.fileExists(filePath)) {\n this.error(`Controller already exists: ${filePath}`);\n return;\n }\n\n // Create directory if it doesn't exist\n await fs.mkdir(controllersPath, { recursive: true });\n\n // Ensure base Controller exists at app/Http/Controllers/Controller.ts\n await this.ensureBaseController(controllersPath);\n\n // Generate file content\n const content = this.getStub().replace(/\\{\\{className\\}\\}/g, name);\n\n // Write file\n await fs.writeFile(filePath, content);\n\n this.info(`Controller created successfully: ${filePath}`);\n this.newLine();\n this.comment('Use it in your routes or register in your HTTP layer.');\n }\n\n /**\n * Get the destination path for the controller class\n */\n protected getPath(options: CommandOptions): string {\n return (options.path as string) || this.app.path('Http/Controllers');\n }\n\n /**\n * Ensure the base Controller exists at app/Http/Controllers/Controller.ts\n */\n protected async ensureBaseController(controllersPath: string): Promise<void> {\n const basePath = path.join(controllersPath, 'Controller.ts');\n if (await this.fileExists(basePath)) {\n return;\n }\n await fs.writeFile(basePath, this.getBaseControllerStub());\n this.info(`Base controller created: ${basePath}`);\n }\n\n /**\n * Stub for the base Controller at app/Http/Controllers/Controller.ts\n */\n protected getBaseControllerStub(): string {\n return `/**\n * Base Controller\n *\n * All application controllers should extend this class.\n */\n\nimport { Controller as BaseController } from '@orchestr-sh/orchestr';\n\nexport class Controller extends BaseController {\n //\n}\n`;\n }\n\n /**\n * Check if a file exists\n */\n protected async fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Get the stub template for the controller class\n */\n protected getStub(): string {\n return `/**\n * {{className}} Controller\n *\n * Handle HTTP requests for...\n */\n\nimport { Controller } from './Controller';\n\nexport class {{className}} extends Controller {\n // Add your controller methods here\n // Example: index(), store(), show(), update(), destroy()\n}\n`;\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAA2C,CAAQ,
|
|
1
|
+
{"version":3,"file":"MakeControllerCommand.mjs","names":[],"sources":["../../../src/Console/Commands/MakeControllerCommand.ts"],"sourcesContent":["/**\n * MakeControllerCommand\n *\n * Create a new controller class following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Application } from '../../Foundation/Application';\nimport { Command, CommandOptions } from '../Command';\n\nexport class MakeControllerCommand extends Command {\n signature = 'make:controller <name>';\n description = 'Create a new controller class';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const name = args[0];\n\n if (!name) {\n this.error('Controller name is required.');\n this.line('Usage: make:controller <name>');\n return;\n }\n\n const controllersPath = this.getPath(options);\n const filePath = path.join(controllersPath, `${name}.ts`);\n\n // Check if file already exists\n if (await this.fileExists(filePath)) {\n this.error(`Controller already exists: ${filePath}`);\n return;\n }\n\n // Create directory if it doesn't exist\n await fs.mkdir(controllersPath, { recursive: true });\n\n // Ensure base Controller exists at app/Http/Controllers/Controller.ts\n await this.ensureBaseController(controllersPath);\n\n // Generate file content\n const content = this.getStub().replace(/\\{\\{className\\}\\}/g, name);\n\n // Write file\n await fs.writeFile(filePath, content);\n\n this.info(`Controller created successfully: ${filePath}`);\n this.newLine();\n this.comment('Use it in your routes or register in your HTTP layer.');\n }\n\n /**\n * Get the destination path for the controller class\n */\n protected getPath(options: CommandOptions): string {\n return (options.path as string) || this.app.path('Http/Controllers');\n }\n\n /**\n * Ensure the base Controller exists at app/Http/Controllers/Controller.ts\n */\n protected async ensureBaseController(controllersPath: string): Promise<void> {\n const basePath = path.join(controllersPath, 'Controller.ts');\n if (await this.fileExists(basePath)) {\n return;\n }\n await fs.writeFile(basePath, this.getBaseControllerStub());\n this.info(`Base controller created: ${basePath}`);\n }\n\n /**\n * Stub for the base Controller at app/Http/Controllers/Controller.ts\n */\n protected getBaseControllerStub(): string {\n return `/**\n * Base Controller\n *\n * All application controllers should extend this class.\n */\n\nimport { Controller as BaseController } from '@orchestr-sh/orchestr';\n\nexport class Controller extends BaseController {\n //\n}\n`;\n }\n\n /**\n * Check if a file exists\n */\n protected async fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Get the stub template for the controller class\n */\n protected getStub(): string {\n return `/**\n * {{className}} Controller\n *\n * Handle HTTP requests for...\n */\n\nimport { Controller } from './Controller';\n\nexport class {{className}} extends Controller {\n // Add your controller methods here\n // Example: index(), store(), show(), update(), destroy()\n}\n`;\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAA2C,CAAQ,CAI3B,IAHtB,UAAY,yBACZ,YAAc,gCAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAO,EAAK,GAElB,GAAI,CAAC,EAAM,CACT,KAAK,MAAM,+BAA+B,CAC1C,KAAK,KAAK,gCAAgC,CAC1C,OAGF,IAAM,EAAkB,KAAK,QAAQ,EAAQ,CACvC,EAAW,EAAK,KAAK,EAAiB,GAAG,EAAK,KAAK,CAGzD,GAAI,MAAM,KAAK,WAAW,EAAS,CAAE,CACnC,KAAK,MAAM,8BAA8B,IAAW,CACpD,OAIF,MAAM,EAAG,MAAM,EAAiB,CAAE,UAAW,GAAM,CAAC,CAGpD,MAAM,KAAK,qBAAqB,EAAgB,CAGhD,IAAM,EAAU,KAAK,SAAS,CAAC,QAAQ,qBAAsB,EAAK,CAGlE,MAAM,EAAG,UAAU,EAAU,EAAQ,CAErC,KAAK,KAAK,oCAAoC,IAAW,CACzD,KAAK,SAAS,CACd,KAAK,QAAQ,wDAAwD,CAMvE,QAAkB,EAAiC,CACjD,OAAQ,EAAQ,MAAmB,KAAK,IAAI,KAAK,mBAAmB,CAMtE,MAAgB,qBAAqB,EAAwC,CAC3E,IAAM,EAAW,EAAK,KAAK,EAAiB,gBAAgB,CACxD,MAAM,KAAK,WAAW,EAAS,GAGnC,MAAM,EAAG,UAAU,EAAU,KAAK,uBAAuB,CAAC,CAC1D,KAAK,KAAK,4BAA4B,IAAW,EAMnD,uBAA0C,CACxC,MAAO;;;;;;;;;;;EAiBT,MAAgB,WAAW,EAAoC,CAC7D,GAAI,CAEF,OADA,MAAM,EAAG,OAAO,EAAS,CAClB,QACD,CACN,MAAO,IAOX,SAA4B,CAC1B,MAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class extends t.Command{signature=`make:event <name>`;description=`Create a new event class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Event name is required.`),this.line(`Usage: make:event <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Event already exists: ${o}`);return}await n.mkdir(a,{recursive:!0});let s=this.getStub().replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Event created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add properties to the event constructor`),this.comment(`2. Create a listener with: make:listener <name> --event=${i}`)}getPath(e){return e.path||this.app.path(`Events`)}async fileExists(e){try{return await n.access(e),!0}catch{return!1}}getStub(){return`/**
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class extends t.Command{app;signature=`make:event <name>`;description=`Create a new event class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Event name is required.`),this.line(`Usage: make:event <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Event already exists: ${o}`);return}await n.mkdir(a,{recursive:!0});let s=this.getStub().replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Event created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add properties to the event constructor`),this.comment(`2. Create a listener with: make:listener <name> --event=${i}`)}getPath(e){return e.path||this.app.path(`Events`)}async fileExists(e){try{return await n.access(e),!0}catch{return!1}}getStub(){return`/**
|
|
2
2
|
* {{className}} Event
|
|
3
3
|
*
|
|
4
4
|
* This event is dispatched when...
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{signature=`make:event <name>`;description=`Create a new event class`;constructor(e){super(),this.app=e}async handle(e,r){let i=e[0];if(!i){this.error(`Event name is required.`),this.line(`Usage: make:event <name>`);return}let a=this.getPath(r),o=n.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Event already exists: ${o}`);return}await t.mkdir(a,{recursive:!0});let s=this.getStub().replace(/\{\{className\}\}/g,i);await t.writeFile(o,s),this.info(`Event created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add properties to the event constructor`),this.comment(`2. Create a listener with: make:listener <name> --event=${i}`)}getPath(e){return e.path||this.app.path(`Events`)}async fileExists(e){try{return await t.access(e),!0}catch{return!1}}getStub(){return`/**
|
|
1
|
+
import{Command as e}from"../Command.mjs";import*as t from"fs/promises";import*as n from"path";var r=class extends e{app;signature=`make:event <name>`;description=`Create a new event class`;constructor(e){super(),this.app=e}async handle(e,r){let i=e[0];if(!i){this.error(`Event name is required.`),this.line(`Usage: make:event <name>`);return}let a=this.getPath(r),o=n.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Event already exists: ${o}`);return}await t.mkdir(a,{recursive:!0});let s=this.getStub().replace(/\{\{className\}\}/g,i);await t.writeFile(o,s),this.info(`Event created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add properties to the event constructor`),this.comment(`2. Create a listener with: make:listener <name> --event=${i}`)}getPath(e){return e.path||this.app.path(`Events`)}async fileExists(e){try{return await t.access(e),!0}catch{return!1}}getStub(){return`/**
|
|
2
2
|
* {{className}} Event
|
|
3
3
|
*
|
|
4
4
|
* This event is dispatched when...
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeEventCommand.mjs","names":[],"sources":["../../../src/Console/Commands/MakeEventCommand.ts"],"sourcesContent":["/**\n * MakeEventCommand\n *\n * Create a new event class following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class MakeEventCommand extends Command {\n signature = 'make:event <name>';\n description = 'Create a new event class';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const name = args[0];\n\n if (!name) {\n this.error('Event name is required.');\n this.line('Usage: make:event <name>');\n return;\n }\n\n const eventsPath = this.getPath(options);\n const filePath = path.join(eventsPath, `${name}.ts`);\n\n // Check if file already exists\n if (await this.fileExists(filePath)) {\n this.error(`Event already exists: ${filePath}`);\n return;\n }\n\n // Create directory if it doesn't exist\n await fs.mkdir(eventsPath, { recursive: true });\n\n // Generate file content\n const content = this.getStub().replace(/\\{\\{className\\}\\}/g, name);\n\n // Write file\n await fs.writeFile(filePath, content);\n\n this.info(`Event created successfully: ${filePath}`);\n this.newLine();\n this.comment('Next steps:');\n this.comment('1. Add properties to the event constructor');\n this.comment(`2. Create a listener with: make:listener <name> --event=${name}`);\n }\n\n /**\n * Get the destination path for the event class\n */\n protected getPath(options: CommandOptions): string {\n return (options.path as string) || this.app.path('Events');\n }\n\n /**\n * Check if a file exists\n */\n protected async fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Get the stub template for the event class\n */\n protected getStub(): string {\n return `/**\n * {{className}} Event\n *\n * This event is dispatched when...\n */\nexport class {{className}} {\n constructor(\n // Add your event properties here\n // Example: public readonly user: User\n ) {}\n}\n`;\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAAsC,CAAQ,
|
|
1
|
+
{"version":3,"file":"MakeEventCommand.mjs","names":[],"sources":["../../../src/Console/Commands/MakeEventCommand.ts"],"sourcesContent":["/**\n * MakeEventCommand\n *\n * Create a new event class following Laravel's Artisan pattern\n */\n\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { Command, CommandOptions } from '@/Console/Command';\nimport { Application } from '@/Foundation/Application';\n\nexport class MakeEventCommand extends Command {\n signature = 'make:event <name>';\n description = 'Create a new event class';\n\n constructor(protected app: Application) {\n super();\n }\n\n async handle(args: string[], options: CommandOptions): Promise<void> {\n const name = args[0];\n\n if (!name) {\n this.error('Event name is required.');\n this.line('Usage: make:event <name>');\n return;\n }\n\n const eventsPath = this.getPath(options);\n const filePath = path.join(eventsPath, `${name}.ts`);\n\n // Check if file already exists\n if (await this.fileExists(filePath)) {\n this.error(`Event already exists: ${filePath}`);\n return;\n }\n\n // Create directory if it doesn't exist\n await fs.mkdir(eventsPath, { recursive: true });\n\n // Generate file content\n const content = this.getStub().replace(/\\{\\{className\\}\\}/g, name);\n\n // Write file\n await fs.writeFile(filePath, content);\n\n this.info(`Event created successfully: ${filePath}`);\n this.newLine();\n this.comment('Next steps:');\n this.comment('1. Add properties to the event constructor');\n this.comment(`2. Create a listener with: make:listener <name> --event=${name}`);\n }\n\n /**\n * Get the destination path for the event class\n */\n protected getPath(options: CommandOptions): string {\n return (options.path as string) || this.app.path('Events');\n }\n\n /**\n * Check if a file exists\n */\n protected async fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Get the stub template for the event class\n */\n protected getStub(): string {\n return `/**\n * {{className}} Event\n *\n * This event is dispatched when...\n */\nexport class {{className}} {\n constructor(\n // Add your event properties here\n // Example: public readonly user: User\n ) {}\n}\n`;\n }\n}\n"],"mappings":"8FAWA,IAAa,EAAb,cAAsC,CAAQ,CAItB,IAHtB,UAAY,oBACZ,YAAc,2BAEd,YAAY,EAA4B,CACtC,OAAO,CADa,KAAA,IAAA,EAItB,MAAM,OAAO,EAAgB,EAAwC,CACnE,IAAM,EAAO,EAAK,GAElB,GAAI,CAAC,EAAM,CACT,KAAK,MAAM,0BAA0B,CACrC,KAAK,KAAK,2BAA2B,CACrC,OAGF,IAAM,EAAa,KAAK,QAAQ,EAAQ,CAClC,EAAW,EAAK,KAAK,EAAY,GAAG,EAAK,KAAK,CAGpD,GAAI,MAAM,KAAK,WAAW,EAAS,CAAE,CACnC,KAAK,MAAM,yBAAyB,IAAW,CAC/C,OAIF,MAAM,EAAG,MAAM,EAAY,CAAE,UAAW,GAAM,CAAC,CAG/C,IAAM,EAAU,KAAK,SAAS,CAAC,QAAQ,qBAAsB,EAAK,CAGlE,MAAM,EAAG,UAAU,EAAU,EAAQ,CAErC,KAAK,KAAK,+BAA+B,IAAW,CACpD,KAAK,SAAS,CACd,KAAK,QAAQ,cAAc,CAC3B,KAAK,QAAQ,6CAA6C,CAC1D,KAAK,QAAQ,2DAA2D,IAAO,CAMjF,QAAkB,EAAiC,CACjD,OAAQ,EAAQ,MAAmB,KAAK,IAAI,KAAK,SAAS,CAM5D,MAAgB,WAAW,EAAoC,CAC7D,GAAI,CAEF,OADA,MAAM,EAAG,OAAO,EAAS,CAClB,QACD,CACN,MAAO,IAOX,SAA4B,CAC1B,MAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class extends t.Command{signature=`make:job <name>`;description=`Create a new job class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Job name is required.`),this.line(`Usage: make:job <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Job already exists: ${o}`);return}await n.mkdir(a,{recursive:!0});let s=(t.sync===!0||t.sync===`true`?this.getSyncStub():this.getStub()).replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Job created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add your job logic to the handle() method`),this.comment(`2. Dispatch the job:`),this.comment(` await ${i}.dispatch();`)}getPath(e){return e.path||this.app.path(`Jobs`)}async fileExists(e){try{return await n.access(e),!0}catch{return!1}}getStub(){return`import { Job } from '@orchestr-sh/orchestr';
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Command.cjs`);let n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class extends t.Command{app;signature=`make:job <name>`;description=`Create a new job class`;constructor(e){super(),this.app=e}async handle(e,t){let i=e[0];if(!i){this.error(`Job name is required.`),this.line(`Usage: make:job <name>`);return}let a=this.getPath(t),o=r.join(a,`${i}.ts`);if(await this.fileExists(o)){this.error(`Job already exists: ${o}`);return}await n.mkdir(a,{recursive:!0});let s=(t.sync===!0||t.sync===`true`?this.getSyncStub():this.getStub()).replace(/\{\{className\}\}/g,i);await n.writeFile(o,s),this.info(`Job created successfully: ${o}`),this.newLine(),this.comment(`Next steps:`),this.comment(`1. Add your job logic to the handle() method`),this.comment(`2. Dispatch the job:`),this.comment(` await ${i}.dispatch();`)}getPath(e){return e.path||this.app.path(`Jobs`)}async fileExists(e){try{return await n.access(e),!0}catch{return!1}}getStub(){return`import { Job } from '@orchestr-sh/orchestr';
|
|
2
2
|
|
|
3
3
|
export class {{className}} extends Job {
|
|
4
4
|
/**
|