@orchestr-sh/orchestr 1.11.0 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +274 -0
- package/dist/Cache/CacheManager.cjs +1 -1
- package/dist/Cache/CacheManager.mjs +1 -1
- package/dist/Cache/CacheManager.mjs.map +1 -1
- package/dist/Cache/Events/CacheFlushed.cjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs.map +1 -1
- package/dist/Cache/Events/CacheHit.cjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs.map +1 -1
- package/dist/Cache/Events/CacheMissed.cjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs.map +1 -1
- package/dist/Cache/Events/KeyForgotten.cjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs.map +1 -1
- package/dist/Cache/Events/KeyWritten.cjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs.map +1 -1
- package/dist/Cache/Locks/CacheLock.cjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs.map +1 -1
- package/dist/Cache/Locks/Lock.cjs +1 -1
- package/dist/Cache/Locks/Lock.mjs +1 -1
- package/dist/Cache/Locks/Lock.mjs.map +1 -1
- package/dist/Cache/Repository.cjs +1 -1
- package/dist/Cache/Repository.mjs +1 -1
- package/dist/Cache/Repository.mjs.map +1 -1
- package/dist/Cache/Stores/ArrayStore.cjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs.map +1 -1
- package/dist/Cache/Stores/DatabaseStore.cjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs.map +1 -1
- package/dist/Cache/Stores/FileStore.cjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs.map +1 -1
- package/dist/Cache/Tags/TagSet.cjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs.map +1 -1
- package/dist/Cache/Tags/TaggedCache.cjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs.map +1 -1
- package/dist/Console/Commands/CacheClearCommand.cjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheForgetCommand.cjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheTableCommand.cjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployEnvCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployInitCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployProvisionCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployServerCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventCacheCommand.cjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventClearCommand.cjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventListCommand.cjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeControllerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeEventCommand.cjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeJobCommand.cjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeListenerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.cjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeSeederCommand.cjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeViewCommand.cjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateResetCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueClearCommand.cjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFlushCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueForgetCommand.cjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.cjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRestartCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRetryCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueWorkCommand.cjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs.map +1 -1
- package/dist/Console/Commands/SeedCommand.cjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs.map +1 -1
- package/dist/Console/ConsoleKernel.cjs +1 -1
- package/dist/Console/ConsoleKernel.mjs +1 -1
- package/dist/Console/ConsoleKernel.mjs.map +1 -1
- package/dist/Console/orchestr.cjs +2 -0
- package/dist/Console/orchestr.d.cts +1 -0
- package/dist/Console/orchestr.d.mts +1 -0
- package/dist/Console/orchestr.mjs +3 -0
- package/dist/Console/orchestr.mjs.map +1 -0
- package/dist/Container/Container.mjs.map +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.cjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs.map +1 -1
- package/dist/Database/Connection.cjs +1 -1
- package/dist/Database/Connection.mjs +1 -1
- package/dist/Database/Connection.mjs.map +1 -1
- package/dist/Database/DatabaseManager.cjs +1 -1
- package/dist/Database/DatabaseManager.mjs +1 -1
- package/dist/Database/DatabaseManager.mjs.map +1 -1
- package/dist/Database/Ensemble/Ensemble.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleBuilder.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.cjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.cjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/HasMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphToMany.mjs.map +1 -1
- package/dist/Database/Migrations/Blueprint.cjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationCreator.cjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationRepository.cjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs.map +1 -1
- package/dist/Database/Migrations/Migrator.cjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs.map +1 -1
- package/dist/Database/Migrations/SchemaBuilder.cjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs.map +1 -1
- package/dist/Database/Query/Builder.cjs +1 -1
- package/dist/Database/Query/Builder.mjs +1 -1
- package/dist/Database/Query/Builder.mjs.map +1 -1
- package/dist/Database/Query/Expression.cjs +1 -1
- package/dist/Database/Query/Expression.mjs +1 -1
- package/dist/Database/Query/Expression.mjs.map +1 -1
- package/dist/Database/Seeders/SeederRunner.cjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs.map +1 -1
- package/dist/Deploy/Deployer.cjs +1 -1
- package/dist/Deploy/Deployer.mjs +1 -1
- package/dist/Deploy/Deployer.mjs.map +1 -1
- package/dist/Deploy/ProjectConfig.mjs.map +1 -1
- package/dist/Deploy/Provisioner.cjs +1 -1
- package/dist/Deploy/Provisioner.mjs +1 -1
- package/dist/Deploy/Provisioner.mjs.map +1 -1
- package/dist/Deploy/SSHConnection.mjs.map +1 -1
- package/dist/Deploy/SymphonyClient.cjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs.map +1 -1
- package/dist/Deploy/TarBuilder.mjs.map +1 -1
- package/dist/Deploy/prompt.mjs.map +1 -1
- package/dist/Events/Dispatcher.cjs +1 -1
- package/dist/Events/Dispatcher.d.cts +1 -1
- package/dist/Events/Dispatcher.d.mts +1 -1
- package/dist/Events/Dispatcher.mjs +1 -1
- package/dist/Events/Dispatcher.mjs.map +1 -1
- package/dist/Events/EventServiceProvider.cjs +1 -1
- package/dist/Events/EventServiceProvider.d.cts +1 -1
- package/dist/Events/EventServiceProvider.d.mts +1 -1
- package/dist/Events/EventServiceProvider.mjs.map +1 -1
- package/dist/Events/index.cjs +1 -0
- package/dist/Events/index.d.cts +7 -0
- package/dist/Events/index.d.mts +7 -0
- package/dist/Events/index.mjs +1 -0
- package/dist/Facades/Bus.mjs.map +1 -1
- package/dist/Facades/Cache.mjs.map +1 -1
- package/dist/Facades/Config.mjs.map +1 -1
- package/dist/Facades/DB.mjs.map +1 -1
- package/dist/Facades/Event.d.cts +1 -1
- package/dist/Facades/Event.d.mts +1 -1
- package/dist/Facades/Event.mjs.map +1 -1
- package/dist/Facades/Queue.mjs.map +1 -1
- package/dist/Facades/Route.d.cts +1 -1
- package/dist/Facades/Route.d.mts +1 -1
- package/dist/Facades/Route.mjs.map +1 -1
- package/dist/Facades/View.mjs.map +1 -1
- package/dist/Facades/index.cjs +1 -0
- package/dist/Facades/index.d.cts +9 -0
- package/dist/Facades/index.d.mts +9 -0
- package/dist/Facades/index.mjs +1 -0
- package/dist/Foundation/Application.mjs.map +1 -1
- package/dist/Foundation/Config/ConfigServiceProvider.d.cts +1 -1
- package/dist/Foundation/Config/ConfigServiceProvider.d.mts +1 -1
- package/dist/Foundation/Http/FormRequest.d.cts +1 -1
- package/dist/Foundation/Http/FormRequest.d.mts +1 -1
- package/dist/Foundation/Http/FormRequest.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/AnyOfRule.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/ImageFileRule.mjs.map +1 -1
- package/dist/Foundation/Http/Validator.mjs.map +1 -1
- package/dist/Queue/Batching/Batch.cjs +1 -1
- package/dist/Queue/Batching/Batch.mjs +1 -1
- package/dist/Queue/Batching/Batch.mjs.map +1 -1
- package/dist/Queue/Batching/PendingBatch.cjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs.map +1 -1
- package/dist/Queue/Concerns/Dispatchable.mjs.map +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.cjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/NullDriver.cjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/SyncDriver.cjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs.map +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.cjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs.map +1 -1
- package/dist/Queue/Events/JobFailed.cjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessed.cjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessing.cjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs.map +1 -1
- package/dist/Queue/Events/JobQueued.cjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs.map +1 -1
- package/dist/Queue/Events/JobRetryRequested.cjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs.map +1 -1
- package/dist/Queue/Events/WorkerStopping.cjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs.map +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.cjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs.map +1 -1
- package/dist/Queue/Middleware/RateLimited.cjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs.map +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.cjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs.map +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.cjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs.map +1 -1
- package/dist/Queue/PendingChain.cjs +1 -1
- package/dist/Queue/PendingChain.mjs +1 -1
- package/dist/Queue/PendingChain.mjs.map +1 -1
- package/dist/Queue/PendingDispatch.cjs +1 -1
- package/dist/Queue/PendingDispatch.mjs +1 -1
- package/dist/Queue/PendingDispatch.mjs.map +1 -1
- package/dist/Queue/QueueManager.cjs +1 -1
- package/dist/Queue/QueueManager.mjs +1 -1
- package/dist/Queue/QueueManager.mjs.map +1 -1
- package/dist/Queue/QueueServiceProvider.mjs.map +1 -1
- package/dist/Queue/Workers/Worker.cjs +1 -1
- package/dist/Queue/Workers/Worker.mjs +1 -1
- package/dist/Queue/Workers/Worker.mjs.map +1 -1
- package/dist/Routing/Request.mjs.map +1 -1
- package/dist/Routing/Response.mjs.map +1 -1
- package/dist/Routing/Route.d.cts +1 -1
- package/dist/Routing/Route.d.mts +1 -1
- package/dist/Routing/Router.d.cts +1 -1
- package/dist/Routing/Router.d.mts +1 -1
- package/dist/Support/EventDiscovery.cjs +1 -1
- package/dist/Support/EventDiscovery.mjs +1 -1
- package/dist/Support/EventDiscovery.mjs.map +1 -1
- package/dist/Support/Testing/Fakes/EventFake.cjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.cts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.mts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs.map +1 -1
- package/dist/Support/helpers.mjs.map +1 -1
- package/dist/View/Engines/TemplateEngine.mjs.map +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.mts +19 -19
- package/docs/events-typescript-usage.md +126 -0
- package/docs/future-improvements.md +49 -0
- package/docs/validation.md +201 -0
- package/package.json +65 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../src/Cache/Repository.ts"],"sourcesContent":["/**\n * Repository\n *\n * High-level cache API that wraps a Store implementation.\n * Provides convenience methods like remember(), pull(), has(),\n * lock(), tags(), and TTL normalization.\n *\n * Mirrors Laravel's Illuminate\\Cache\\Repository.\n *\n * @example\n * ```typescript\n * const repo = new Repository(new ArrayStore());\n *\n * await repo.put('key', 'value', 3600);\n * const value = await repo.get('key', 'default');\n *\n * const user = await repo.remember('user:1', 3600, async () => {\n * return await fetchUser(1);\n * });\n * ```\n */\n\nimport type { LockContract } from './Contracts/Lock';\nimport type { RepositoryContract } from './Contracts/Repository';\nimport type { Store } from './Contracts/Store';\nimport { CacheLock } from './Locks/CacheLock';\nimport { TaggedCache } from './Tags/TaggedCache';\nimport { TagSet } from './Tags/TagSet';\n\nexport class Repository implements RepositoryContract {\n protected defaultCacheTime: number | null = null;\n protected storeName: string = '';\n\n constructor(\n protected store: Store,\n protected config: Record<string, any> = {}\n ) {}\n\n /**\n * Set the store name (used for events)\n */\n setStoreName(name: string): this {\n this.storeName = name;\n return this;\n }\n\n async get<T = any>(key: string, defaultValue?: T | (() => T)): Promise<T | null> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n if (typeof defaultValue === 'function') {\n return (defaultValue as () => T)();\n }\n\n return defaultValue ?? null;\n }\n\n async many<T = any>(keys: string[]): Promise<Record<string, T | null>> {\n return this.store.many(keys);\n }\n\n async put<T = any>(key: string, value: T, ttl?: number | Date): Promise<boolean> {\n const seconds = this.getSeconds(ttl);\n\n if (seconds === null) {\n return this.forever(key, value);\n }\n\n if (seconds <= 0) {\n return this.forget(key);\n }\n\n return this.store.put(key, value, seconds);\n }\n\n async putMany<T = any>(values: Record<string, T>, ttl?: number | Date): Promise<boolean> {\n const seconds = this.getSeconds(ttl) ?? 0;\n return this.store.putMany(values, seconds);\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n return this.store.increment(key, value);\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.store.decrement(key, value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.store.forever(key, value);\n }\n\n async forget(key: string): Promise<boolean> {\n return this.store.forget(key);\n }\n\n async flush(): Promise<boolean> {\n return this.store.flush();\n }\n\n getPrefix(): string {\n return this.store.getPrefix();\n }\n\n // --- High-level Repository methods ---\n\n async has(key: string): Promise<boolean> {\n const value = await this.store.get(key);\n return value !== null && value !== undefined;\n }\n\n async missing(key: string): Promise<boolean> {\n return !(await this.has(key));\n }\n\n async pull<T = any>(key: string, defaultValue?: T): Promise<T | null> {\n const value = await this.get(key, defaultValue);\n\n if (value !== null && value !== undefined && value !== defaultValue) {\n await this.forget(key);\n }\n\n return value;\n }\n\n async add<T = any>(key: string, value: T, ttl?: number | Date): Promise<boolean> {\n if (await this.has(key)) {\n return false;\n }\n\n return this.put(key, value, ttl);\n }\n\n async remember<T = any>(key: string, ttl: number | Date, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n const result = await callback();\n const seconds = this.getSeconds(ttl);\n\n if (seconds !== null && seconds > 0) {\n await this.store.put(key, result, seconds);\n } else {\n await this.store.forever(key, result);\n }\n\n return result;\n }\n\n async rememberForever<T = any>(key: string, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n const result = await callback();\n await this.store.forever(key, result);\n\n return result;\n }\n\n async flexible<T = any>(key: string, ttl: [number, number], callback: () => T | Promise<T>): Promise<T> {\n const [freshTtl, staleTtl] = ttl;\n\n // Try to get the cached value with its freshness\n const metaKey = `${key}:flexible_meta`;\n const value = await this.store.get(key);\n const meta = await this.store.get(metaKey);\n\n if (value !== null && value !== undefined) {\n // Check if still fresh\n if (meta && typeof meta === 'object' && meta.freshUntil) {\n const now = Math.floor(Date.now() / 1000);\n if (now < meta.freshUntil) {\n // Still fresh\n return value;\n }\n // Stale but within total TTL - revalidate in background\n setImmediate(async () => {\n try {\n const newValue = await callback();\n const freshUntil = Math.floor(Date.now() / 1000) + freshTtl;\n await this.store.put(key, newValue, staleTtl);\n await this.store.put(metaKey, { freshUntil }, staleTtl);\n } catch {\n // Silently fail background refresh\n }\n });\n return value;\n }\n }\n\n // Cache miss - fetch and store\n const result = await callback();\n const freshUntil = Math.floor(Date.now() / 1000) + freshTtl;\n await this.store.put(key, result, staleTtl);\n await this.store.put(metaKey, { freshUntil }, staleTtl);\n\n return result;\n }\n\n // --- Locks ---\n\n lock(name: string, seconds: number = 0, owner?: string): LockContract {\n return new CacheLock(this.store, name, seconds, owner);\n }\n\n restoreLock(name: string, owner: string): LockContract {\n return new CacheLock(this.store, name, 0, owner);\n }\n\n // --- Tags ---\n\n tags(names: string | string[]): TaggedCache {\n const tagNames = Array.isArray(names) ? names : [names];\n const tagSet = new TagSet(this.store, tagNames);\n return new TaggedCache(this.store, tagSet);\n }\n\n // --- Accessors ---\n\n getStore(): Store {\n return this.store;\n }\n\n getDefaultCacheTime(): number | null {\n return this.defaultCacheTime;\n }\n\n setDefaultCacheTime(seconds: number | null): this {\n this.defaultCacheTime = seconds;\n return this;\n }\n\n // --- TTL helpers ---\n\n protected getSeconds(ttl?: number | Date | null): number | null {\n if (ttl === undefined || ttl === null) {\n return this.defaultCacheTime;\n }\n\n if (ttl instanceof Date) {\n const seconds = Math.floor((ttl.getTime() - Date.now()) / 1000);\n return Math.max(0, seconds);\n }\n\n return ttl;\n }\n}\n"],"mappings":"kJA6BA,IAAa,EAAb,KAAsD,CACpD,iBAA4C,KAC5C,UAA8B,GAE9B,YACE,EACA,EAAwC,EAAE,CAC1C,CAFU,KAAA,MAAA,EACA,KAAA,OAAA,EAMZ,aAAa,EAAoB,CAE/B,MADA,MAAK,UAAY,EACV,KAGT,MAAM,IAAa,EAAa,EAAiD,CAW/E,OAVc,MAAM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AK,EAAQ,EAAS,CAC3C,MAAM,KAAK,MAAM,IAAI,EAAS,CAAE,aAAY,CAAE,EAAS,CAEhD,EAKT,KAAK,EAAc,EAAkB,EAAG,EAA8B,CACpE,OAAO,IAAI,EAAU,KAAK,MAAO,EAAM,EAAS,EAAM,CAGxD,YAAY,EAAc,EAA6B,CACrD,OAAO,IAAI,EAAU,KAAK,MAAO,EAAM,EAAG,EAAM,CAKlD,KAAK,EAAuC,CAC1C,IAAM,EAAW,MAAM,QAAQ,EAAM,CAAG,EAAQ,CAAC,EAAM,CACjD,EAAS,IAAI,EAAO,KAAK,MAAO,EAAS,CAC/C,OAAO,IAAI,EAAY,KAAK,MAAO,EAAO,CAK5C,UAAkB,CAChB,OAAO,KAAK,MAGd,qBAAqC,CACnC,OAAO,KAAK,iBAGd,oBAAoB,EAA8B,CAEhD,MADA,MAAK,iBAAmB,EACjB,KAKT,WAAqB,EAA2C,CAC9D,GAAI,GAA6B,KAC/B,OAAO,KAAK,iBAGd,GAAI,aAAe,KAAM,CACvB,IAAM,EAAU,KAAK,OAAO,EAAI,SAAS,CAAG,KAAK,KAAK,EAAI,IAAK,CAC/D,OAAO,KAAK,IAAI,EAAG,EAAQ,CAG7B,OAAO"}
|
|
1
|
+
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../src/Cache/Repository.ts"],"sourcesContent":["/**\n * Repository\n *\n * High-level cache API that wraps a Store implementation.\n * Provides convenience methods like remember(), pull(), has(),\n * lock(), tags(), and TTL normalization.\n *\n * Mirrors Laravel's Illuminate\\Cache\\Repository.\n *\n * @example\n * ```typescript\n * const repo = new Repository(new ArrayStore());\n *\n * await repo.put('key', 'value', 3600);\n * const value = await repo.get('key', 'default');\n *\n * const user = await repo.remember('user:1', 3600, async () => {\n * return await fetchUser(1);\n * });\n * ```\n */\n\nimport type { LockContract } from './Contracts/Lock';\nimport type { RepositoryContract } from './Contracts/Repository';\nimport type { Store } from './Contracts/Store';\nimport { CacheLock } from './Locks/CacheLock';\nimport { TaggedCache } from './Tags/TaggedCache';\nimport { TagSet } from './Tags/TagSet';\n\nexport class Repository implements RepositoryContract {\n protected defaultCacheTime: number | null = null;\n protected storeName: string = '';\n\n constructor(\n protected store: Store,\n protected config: Record<string, any> = {}\n ) {}\n\n /**\n * Set the store name (used for events)\n */\n setStoreName(name: string): this {\n this.storeName = name;\n return this;\n }\n\n async get<T = any>(key: string, defaultValue?: T | (() => T)): Promise<T | null> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n if (typeof defaultValue === 'function') {\n return (defaultValue as () => T)();\n }\n\n return defaultValue ?? null;\n }\n\n async many<T = any>(keys: string[]): Promise<Record<string, T | null>> {\n return this.store.many(keys);\n }\n\n async put<T = any>(key: string, value: T, ttl?: number | Date): Promise<boolean> {\n const seconds = this.getSeconds(ttl);\n\n if (seconds === null) {\n return this.forever(key, value);\n }\n\n if (seconds <= 0) {\n return this.forget(key);\n }\n\n return this.store.put(key, value, seconds);\n }\n\n async putMany<T = any>(values: Record<string, T>, ttl?: number | Date): Promise<boolean> {\n const seconds = this.getSeconds(ttl) ?? 0;\n return this.store.putMany(values, seconds);\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n return this.store.increment(key, value);\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.store.decrement(key, value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.store.forever(key, value);\n }\n\n async forget(key: string): Promise<boolean> {\n return this.store.forget(key);\n }\n\n async flush(): Promise<boolean> {\n return this.store.flush();\n }\n\n getPrefix(): string {\n return this.store.getPrefix();\n }\n\n // --- High-level Repository methods ---\n\n async has(key: string): Promise<boolean> {\n const value = await this.store.get(key);\n return value !== null && value !== undefined;\n }\n\n async missing(key: string): Promise<boolean> {\n return !(await this.has(key));\n }\n\n async pull<T = any>(key: string, defaultValue?: T): Promise<T | null> {\n const value = await this.get(key, defaultValue);\n\n if (value !== null && value !== undefined && value !== defaultValue) {\n await this.forget(key);\n }\n\n return value;\n }\n\n async add<T = any>(key: string, value: T, ttl?: number | Date): Promise<boolean> {\n if (await this.has(key)) {\n return false;\n }\n\n return this.put(key, value, ttl);\n }\n\n async remember<T = any>(key: string, ttl: number | Date, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n const result = await callback();\n const seconds = this.getSeconds(ttl);\n\n if (seconds !== null && seconds > 0) {\n await this.store.put(key, result, seconds);\n } else {\n await this.store.forever(key, result);\n }\n\n return result;\n }\n\n async rememberForever<T = any>(key: string, callback: () => T | Promise<T>): Promise<T> {\n const value = await this.store.get(key);\n\n if (value !== null && value !== undefined) {\n return value;\n }\n\n const result = await callback();\n await this.store.forever(key, result);\n\n return result;\n }\n\n async flexible<T = any>(key: string, ttl: [number, number], callback: () => T | Promise<T>): Promise<T> {\n const [freshTtl, staleTtl] = ttl;\n\n // Try to get the cached value with its freshness\n const metaKey = `${key}:flexible_meta`;\n const value = await this.store.get(key);\n const meta = await this.store.get(metaKey);\n\n if (value !== null && value !== undefined) {\n // Check if still fresh\n if (meta && typeof meta === 'object' && meta.freshUntil) {\n const now = Math.floor(Date.now() / 1000);\n if (now < meta.freshUntil) {\n // Still fresh\n return value;\n }\n // Stale but within total TTL - revalidate in background\n setImmediate(async () => {\n try {\n const newValue = await callback();\n const freshUntil = Math.floor(Date.now() / 1000) + freshTtl;\n await this.store.put(key, newValue, staleTtl);\n await this.store.put(metaKey, { freshUntil }, staleTtl);\n } catch {\n // Silently fail background refresh\n }\n });\n return value;\n }\n }\n\n // Cache miss - fetch and store\n const result = await callback();\n const freshUntil = Math.floor(Date.now() / 1000) + freshTtl;\n await this.store.put(key, result, staleTtl);\n await this.store.put(metaKey, { freshUntil }, staleTtl);\n\n return result;\n }\n\n // --- Locks ---\n\n lock(name: string, seconds: number = 0, owner?: string): LockContract {\n return new CacheLock(this.store, name, seconds, owner);\n }\n\n restoreLock(name: string, owner: string): LockContract {\n return new CacheLock(this.store, name, 0, owner);\n }\n\n // --- Tags ---\n\n tags(names: string | string[]): TaggedCache {\n const tagNames = Array.isArray(names) ? names : [names];\n const tagSet = new TagSet(this.store, tagNames);\n return new TaggedCache(this.store, tagSet);\n }\n\n // --- Accessors ---\n\n getStore(): Store {\n return this.store;\n }\n\n getDefaultCacheTime(): number | null {\n return this.defaultCacheTime;\n }\n\n setDefaultCacheTime(seconds: number | null): this {\n this.defaultCacheTime = seconds;\n return this;\n }\n\n // --- TTL helpers ---\n\n protected getSeconds(ttl?: number | Date | null): number | null {\n if (ttl === undefined || ttl === null) {\n return this.defaultCacheTime;\n }\n\n if (ttl instanceof Date) {\n const seconds = Math.floor((ttl.getTime() - Date.now()) / 1000);\n return Math.max(0, seconds);\n }\n\n return ttl;\n }\n}\n"],"mappings":"kJA6BA,IAAa,EAAb,KAAsD,CAKxC,MACA,OALZ,iBAA4C,KAC5C,UAA8B,GAE9B,YACE,EACA,EAAwC,EAAE,CAC1C,CAFU,KAAA,MAAA,EACA,KAAA,OAAA,EAMZ,aAAa,EAAoB,CAE/B,MADA,MAAK,UAAY,EACV,KAGT,MAAM,IAAa,EAAa,EAAiD,CAW/E,OARI,MAFgB,KAAK,MAAM,IAAI,EAAI,GAMnC,OAAO,GAAiB,WAClB,GAA0B,CAG7B,GAAgB,MAGzB,MAAM,KAAc,EAAmD,CACrE,OAAO,KAAK,MAAM,KAAK,EAAK,CAG9B,MAAM,IAAa,EAAa,EAAU,EAAuC,CAC/E,IAAM,EAAU,KAAK,WAAW,EAAI,CAUpC,OARI,IAAY,KACP,KAAK,QAAQ,EAAK,EAAM,CAG7B,GAAW,EACN,KAAK,OAAO,EAAI,CAGlB,KAAK,MAAM,IAAI,EAAK,EAAO,EAAQ,CAG5C,MAAM,QAAiB,EAA2B,EAAuC,CACvF,IAAM,EAAU,KAAK,WAAW,EAAI,EAAI,EACxC,OAAO,KAAK,MAAM,QAAQ,EAAQ,EAAQ,CAG5C,MAAM,UAAU,EAA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,KAAK,iBAGd,oBAAoB,EAA8B,CAEhD,MADA,MAAK,iBAAmB,EACjB,KAKT,WAAqB,EAA2C,CAC9D,GAAI,GAA6B,KAC/B,OAAO,KAAK,iBAGd,GAAI,aAAe,KAAM,CACvB,IAAM,EAAU,KAAK,OAAO,EAAI,SAAS,CAAG,KAAK,KAAK,EAAI,IAAK,CAC/D,OAAO,KAAK,IAAI,EAAG,EAAQ,CAG7B,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{storage=new Map;shouldSerialize;constructor(e={},t=``){this.config=e,this.prefix=t,this.shouldSerialize=e.serialize!==!1}async get(e){let t=this.prefixedKey(e),n=this.storage.get(t);return n?this.isExpired(n.expiration)?(this.storage.delete(t),null):this.shouldSerialize?this.unserialize(n.value):n.value:null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.shouldSerialize?this.serialize(t):t;return this.storage.set(r,{value:i,expiration:n>0?this.currentTime()+n:0}),!0}async putMany(e,t){for(let[n,r]of Object.entries(e))await this.put(n,r,t);return!0}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.storage.get(i),o=a?a.expiration:0;return this.storage.set(i,{value:this.shouldSerialize?this.serialize(r):r,expiration:o}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e);return this.storage.delete(t)}async flush(){return this.storage.clear(),!0}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}isExpired(e){return e===0?!1:this.currentTime()>=e}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};exports.ArrayStore=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{config;prefix;storage=new Map;shouldSerialize;constructor(e={},t=``){this.config=e,this.prefix=t,this.shouldSerialize=e.serialize!==!1}async get(e){let t=this.prefixedKey(e),n=this.storage.get(t);return n?this.isExpired(n.expiration)?(this.storage.delete(t),null):this.shouldSerialize?this.unserialize(n.value):n.value:null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.shouldSerialize?this.serialize(t):t;return this.storage.set(r,{value:i,expiration:n>0?this.currentTime()+n:0}),!0}async putMany(e,t){for(let[n,r]of Object.entries(e))await this.put(n,r,t);return!0}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.storage.get(i),o=a?a.expiration:0;return this.storage.set(i,{value:this.shouldSerialize?this.serialize(r):r,expiration:o}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e);return this.storage.delete(t)}async flush(){return this.storage.clear(),!0}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}isExpired(e){return e===0?!1:this.currentTime()>=e}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};exports.ArrayStore=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{storage=new Map;shouldSerialize;constructor(e={},t=``){this.config=e,this.prefix=t,this.shouldSerialize=e.serialize!==!1}async get(e){let t=this.prefixedKey(e),n=this.storage.get(t);return n?this.isExpired(n.expiration)?(this.storage.delete(t),null):this.shouldSerialize?this.unserialize(n.value):n.value:null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.shouldSerialize?this.serialize(t):t;return this.storage.set(r,{value:i,expiration:n>0?this.currentTime()+n:0}),!0}async putMany(e,t){for(let[n,r]of Object.entries(e))await this.put(n,r,t);return!0}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.storage.get(i),o=a?a.expiration:0;return this.storage.set(i,{value:this.shouldSerialize?this.serialize(r):r,expiration:o}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e);return this.storage.delete(t)}async flush(){return this.storage.clear(),!0}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}isExpired(e){return e===0?!1:this.currentTime()>=e}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};export{e as ArrayStore};
|
|
1
|
+
var e=class{config;prefix;storage=new Map;shouldSerialize;constructor(e={},t=``){this.config=e,this.prefix=t,this.shouldSerialize=e.serialize!==!1}async get(e){let t=this.prefixedKey(e),n=this.storage.get(t);return n?this.isExpired(n.expiration)?(this.storage.delete(t),null):this.shouldSerialize?this.unserialize(n.value):n.value:null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.shouldSerialize?this.serialize(t):t;return this.storage.set(r,{value:i,expiration:n>0?this.currentTime()+n:0}),!0}async putMany(e,t){for(let[n,r]of Object.entries(e))await this.put(n,r,t);return!0}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.storage.get(i),o=a?a.expiration:0;return this.storage.set(i,{value:this.shouldSerialize?this.serialize(r):r,expiration:o}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e);return this.storage.delete(t)}async flush(){return this.storage.clear(),!0}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}isExpired(e){return e===0?!1:this.currentTime()>=e}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};export{e as ArrayStore};
|
|
2
2
|
//# sourceMappingURL=ArrayStore.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayStore.mjs","names":[],"sources":["../../../src/Cache/Stores/ArrayStore.ts"],"sourcesContent":["/**\n * ArrayStore\n *\n * In-memory cache store. Perfect for testing and short-lived caching.\n * Supports tags via TaggableStore.\n *\n * Mirrors Laravel's Illuminate\\Cache\\ArrayStore.\n *\n * @example\n * ```typescript\n * const store = new ArrayStore({ serialize: false }, 'app_');\n * await store.put('key', 'value', 3600);\n * const value = await store.get('key');\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\n\ninterface CacheEntry {\n value: any;\n expiration: number; // Unix timestamp in seconds, 0 = forever\n}\n\nexport class ArrayStore implements Store {\n protected storage: Map<string, CacheEntry> = new Map();\n protected shouldSerialize: boolean;\n\n constructor(\n protected config: Record<string, any> = {},\n protected prefix: string = ''\n ) {\n this.shouldSerialize = config.serialize !== false;\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n const prefixed = this.prefixedKey(key);\n const entry = this.storage.get(prefixed);\n\n if (!entry) return null;\n\n if (this.isExpired(entry.expiration)) {\n this.storage.delete(prefixed);\n return null;\n }\n\n return this.shouldSerialize ? this.unserialize(entry.value) : entry.value;\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const stored = this.shouldSerialize ? this.serialize(value) : value;\n\n this.storage.set(prefixed, {\n value: stored,\n expiration: seconds > 0 ? this.currentTime() + seconds : 0,\n });\n\n return true;\n }\n\n async putMany<T = any>(values: Record<string, T>, seconds: number): Promise<boolean> {\n for (const [key, value] of Object.entries(values)) {\n await this.put(key, value, seconds);\n }\n return true;\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n const current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n\n const prefixed = this.prefixedKey(key);\n const entry = this.storage.get(prefixed);\n const expiration = entry ? entry.expiration : 0;\n\n this.storage.set(prefixed, {\n value: this.shouldSerialize ? this.serialize(newValue) : newValue,\n expiration,\n });\n\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n return this.storage.delete(prefixed);\n }\n\n async flush(): Promise<boolean> {\n this.storage.clear();\n return true;\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n protected prefixedKey(key: string): string {\n return `${this.prefix}${key}`;\n }\n\n protected isExpired(expiration: number): boolean {\n if (expiration === 0) return false;\n return this.currentTime() >= expiration;\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): any {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n return value;\n }\n}\n"],"mappings":"AAuBA,IAAa,EAAb,KAAyC,
|
|
1
|
+
{"version":3,"file":"ArrayStore.mjs","names":[],"sources":["../../../src/Cache/Stores/ArrayStore.ts"],"sourcesContent":["/**\n * ArrayStore\n *\n * In-memory cache store. Perfect for testing and short-lived caching.\n * Supports tags via TaggableStore.\n *\n * Mirrors Laravel's Illuminate\\Cache\\ArrayStore.\n *\n * @example\n * ```typescript\n * const store = new ArrayStore({ serialize: false }, 'app_');\n * await store.put('key', 'value', 3600);\n * const value = await store.get('key');\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\n\ninterface CacheEntry {\n value: any;\n expiration: number; // Unix timestamp in seconds, 0 = forever\n}\n\nexport class ArrayStore implements Store {\n protected storage: Map<string, CacheEntry> = new Map();\n protected shouldSerialize: boolean;\n\n constructor(\n protected config: Record<string, any> = {},\n protected prefix: string = ''\n ) {\n this.shouldSerialize = config.serialize !== false;\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n const prefixed = this.prefixedKey(key);\n const entry = this.storage.get(prefixed);\n\n if (!entry) return null;\n\n if (this.isExpired(entry.expiration)) {\n this.storage.delete(prefixed);\n return null;\n }\n\n return this.shouldSerialize ? this.unserialize(entry.value) : entry.value;\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const stored = this.shouldSerialize ? this.serialize(value) : value;\n\n this.storage.set(prefixed, {\n value: stored,\n expiration: seconds > 0 ? this.currentTime() + seconds : 0,\n });\n\n return true;\n }\n\n async putMany<T = any>(values: Record<string, T>, seconds: number): Promise<boolean> {\n for (const [key, value] of Object.entries(values)) {\n await this.put(key, value, seconds);\n }\n return true;\n }\n\n async increment(key: string, value: number = 1): Promise<number | boolean> {\n const current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n\n const prefixed = this.prefixedKey(key);\n const entry = this.storage.get(prefixed);\n const expiration = entry ? entry.expiration : 0;\n\n this.storage.set(prefixed, {\n value: this.shouldSerialize ? this.serialize(newValue) : newValue,\n expiration,\n });\n\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n return this.storage.delete(prefixed);\n }\n\n async flush(): Promise<boolean> {\n this.storage.clear();\n return true;\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n protected prefixedKey(key: string): string {\n return `${this.prefix}${key}`;\n }\n\n protected isExpired(expiration: number): boolean {\n if (expiration === 0) return false;\n return this.currentTime() >= expiration;\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): any {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n return value;\n }\n}\n"],"mappings":"AAuBA,IAAa,EAAb,KAAyC,CAK3B,OACA,OALZ,QAA6C,IAAI,IACjD,gBAEA,YACE,EAAwC,EAAE,CAC1C,EAA2B,GAC3B,CAFU,KAAA,OAAA,EACA,KAAA,OAAA,EAEV,KAAK,gBAAkB,EAAO,YAAc,GAG9C,MAAM,IAAa,EAAgC,CACjD,IAAM,EAAW,KAAK,YAAY,EAAI,CAChC,EAAQ,KAAK,QAAQ,IAAI,EAAS,CASxC,OAPK,EAED,KAAK,UAAU,EAAM,WAAW,EAClC,KAAK,QAAQ,OAAO,EAAS,CACtB,MAGF,KAAK,gBAAkB,KAAK,YAAY,EAAM,MAAM,CAAG,EAAM,MAPjD,KAUrB,MAAM,KAAc,EAAmD,CACrE,IAAM,EAAmC,EAAE,CAC3C,IAAK,IAAM,KAAO,EAChB,EAAO,GAAO,MAAM,KAAK,IAAI,EAAI,CAEnC,OAAO,EAGT,MAAM,IAAa,EAAa,EAAU,EAAmC,CAC3E,IAAM,EAAW,KAAK,YAAY,EAAI,CAChC,EAAS,KAAK,gBAAkB,KAAK,UAAU,EAAM,CAAG,EAO9D,OALA,KAAK,QAAQ,IAAI,EAAU,CACzB,MAAO,EACP,WAAY,EAAU,EAAI,KAAK,aAAa,CAAG,EAAU,EAC1D,CAAC,CAEK,GAGT,MAAM,QAAiB,EAA2B,EAAmC,CACnF,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,EAAO,CAC/C,MAAM,KAAK,IAAI,EAAK,EAAO,EAAQ,CAErC,MAAO,GAGT,MAAM,UAAU,EAAa,EAAgB,EAA8B,CACzE,IAAM,EAAU,MAAM,KAAK,IAAI,EAAI,CAC7B,GAAY,OAAO,GAAY,SAAW,EAAU,GAAK,EAEzD,EAAW,KAAK,YAAY,EAAI,CAChC,EAAQ,KAAK,QAAQ,IAAI,EAAS,CAClC,EAAa,EAAQ,EAAM,WAAa,EAO9C,OALA,KAAK,QAAQ,IAAI,EAAU,CACzB,MAAO,KAAK,gBAAkB,KAAK,UAAU,EAAS,CAAG,EACzD,aACD,CAAC,CAEK,EAGT,MAAM,UAAU,EAAa,EAAgB,EAA8B,CACzE,OAAO,KAAK,UAAU,EAAK,CAAC,EAAM,CAGpC,MAAM,QAAiB,EAAa,EAA4B,CAC9D,OAAO,KAAK,IAAI,EAAK,EAAO,EAAE,CAGhC,MAAM,OAAO,EAA+B,CAC1C,IAAM,EAAW,KAAK,YAAY,EAAI,CACtC,OAAO,KAAK,QAAQ,OAAO,EAAS,CAGtC,MAAM,OAA0B,CAE9B,OADA,KAAK,QAAQ,OAAO,CACb,GAGT,WAAoB,CAClB,OAAO,KAAK,OAGd,YAAsB,EAAqB,CACzC,MAAO,GAAG,KAAK,SAAS,IAG1B,UAAoB,EAA6B,CAE/C,OADI,IAAe,EAAU,GACtB,KAAK,aAAa,EAAI,EAG/B,aAAgC,CAC9B,OAAO,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGtC,UAAoB,EAAiB,CACnC,OAAO,KAAK,UAAU,EAAM,CAG9B,YAAsB,EAAiB,CACrC,GAAI,OAAO,GAAU,SACnB,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO,EAGX,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{tableName;connectionName;constructor(e,t=``,n){this.config=e,this.prefix=t,this.app=n,this.tableName=e.table||`cache`,this.connectionName=e.connection||void 0}getConnection(){return this.app.make(`db`).connection(this.connectionName)}async get(e){let t=this.prefixedKey(e),n=this.getConnection(),r=this.currentTime(),i=await n.table(this.tableName).where(`key`,`=`,t).first();return i?i.expiration!==0&&r>=i.expiration?(await this.forget(e),null):this.unserialize(i.value):null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.serialize(t),a=n>0?this.currentTime()+n:0,o=this.getConnection();try{return await o.table(this.tableName).where(`key`,`=`,r).first()?await o.table(this.tableName).where(`key`,`=`,r).update({value:i,expiration:a}):await o.table(this.tableName).insert({key:r,value:i,expiration:a}),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.getConnection();return await a.table(this.tableName).where(`key`,`=`,i).first()?await a.table(this.tableName).where(`key`,`=`,i).update({value:this.serialize(r)}):await a.table(this.tableName).insert({key:i,value:this.serialize(r),expiration:0}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e),n=this.getConnection();try{return await n.table(this.tableName).where(`key`,`=`,t).delete(),!0}catch{return!1}}async flush(){let e=this.getConnection();try{return await e.table(this.tableName).delete(),!0}catch{return!1}}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){try{return JSON.parse(e)}catch{return e}}};exports.DatabaseStore=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{config;prefix;app;tableName;connectionName;constructor(e,t=``,n){this.config=e,this.prefix=t,this.app=n,this.tableName=e.table||`cache`,this.connectionName=e.connection||void 0}getConnection(){return this.app.make(`db`).connection(this.connectionName)}async get(e){let t=this.prefixedKey(e),n=this.getConnection(),r=this.currentTime(),i=await n.table(this.tableName).where(`key`,`=`,t).first();return i?i.expiration!==0&&r>=i.expiration?(await this.forget(e),null):this.unserialize(i.value):null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.serialize(t),a=n>0?this.currentTime()+n:0,o=this.getConnection();try{return await o.table(this.tableName).where(`key`,`=`,r).first()?await o.table(this.tableName).where(`key`,`=`,r).update({value:i,expiration:a}):await o.table(this.tableName).insert({key:r,value:i,expiration:a}),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.getConnection();return await a.table(this.tableName).where(`key`,`=`,i).first()?await a.table(this.tableName).where(`key`,`=`,i).update({value:this.serialize(r)}):await a.table(this.tableName).insert({key:i,value:this.serialize(r),expiration:0}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e),n=this.getConnection();try{return await n.table(this.tableName).where(`key`,`=`,t).delete(),!0}catch{return!1}}async flush(){let e=this.getConnection();try{return await e.table(this.tableName).delete(),!0}catch{return!1}}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){try{return JSON.parse(e)}catch{return e}}};exports.DatabaseStore=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{tableName;connectionName;constructor(e,t=``,n){this.config=e,this.prefix=t,this.app=n,this.tableName=e.table||`cache`,this.connectionName=e.connection||void 0}getConnection(){return this.app.make(`db`).connection(this.connectionName)}async get(e){let t=this.prefixedKey(e),n=this.getConnection(),r=this.currentTime(),i=await n.table(this.tableName).where(`key`,`=`,t).first();return i?i.expiration!==0&&r>=i.expiration?(await this.forget(e),null):this.unserialize(i.value):null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.serialize(t),a=n>0?this.currentTime()+n:0,o=this.getConnection();try{return await o.table(this.tableName).where(`key`,`=`,r).first()?await o.table(this.tableName).where(`key`,`=`,r).update({value:i,expiration:a}):await o.table(this.tableName).insert({key:r,value:i,expiration:a}),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.getConnection();return await a.table(this.tableName).where(`key`,`=`,i).first()?await a.table(this.tableName).where(`key`,`=`,i).update({value:this.serialize(r)}):await a.table(this.tableName).insert({key:i,value:this.serialize(r),expiration:0}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e),n=this.getConnection();try{return await n.table(this.tableName).where(`key`,`=`,t).delete(),!0}catch{return!1}}async flush(){let e=this.getConnection();try{return await e.table(this.tableName).delete(),!0}catch{return!1}}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){try{return JSON.parse(e)}catch{return e}}};export{e as DatabaseStore};
|
|
1
|
+
var e=class{config;prefix;app;tableName;connectionName;constructor(e,t=``,n){this.config=e,this.prefix=t,this.app=n,this.tableName=e.table||`cache`,this.connectionName=e.connection||void 0}getConnection(){return this.app.make(`db`).connection(this.connectionName)}async get(e){let t=this.prefixedKey(e),n=this.getConnection(),r=this.currentTime(),i=await n.table(this.tableName).where(`key`,`=`,t).first();return i?i.expiration!==0&&r>=i.expiration?(await this.forget(e),null):this.unserialize(i.value):null}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=this.prefixedKey(e),i=this.serialize(t),a=n>0?this.currentTime()+n:0,o=this.getConnection();try{return await o.table(this.tableName).where(`key`,`=`,r).first()?await o.table(this.tableName).where(`key`,`=`,r).update({value:i,expiration:a}):await o.table(this.tableName).insert({key:r,value:i,expiration:a}),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t,i=this.prefixedKey(e),a=this.getConnection();return await a.table(this.tableName).where(`key`,`=`,i).first()?await a.table(this.tableName).where(`key`,`=`,i).update({value:this.serialize(r)}):await a.table(this.tableName).insert({key:i,value:this.serialize(r),expiration:0}),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.prefixedKey(e),n=this.getConnection();try{return await n.table(this.tableName).where(`key`,`=`,t).delete(),!0}catch{return!1}}async flush(){let e=this.getConnection();try{return await e.table(this.tableName).delete(),!0}catch{return!1}}getPrefix(){return this.prefix}prefixedKey(e){return`${this.prefix}${e}`}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){try{return JSON.parse(e)}catch{return e}}};export{e as DatabaseStore};
|
|
2
2
|
//# sourceMappingURL=DatabaseStore.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseStore.mjs","names":[],"sources":["../../../src/Cache/Stores/DatabaseStore.ts"],"sourcesContent":["/**\n * DatabaseStore\n *\n * Database-backed cache store. Stores cache entries in a database table.\n * Requires a `cache` table with columns: key (PK), value (text), expiration (int).\n *\n * Mirrors Laravel's Illuminate\\Cache\\DatabaseStore.\n *\n * @example\n * ```typescript\n * const store = new DatabaseStore({\n * driver: 'database',\n * connection: null,\n * table: 'cache',\n * }, 'app_', application);\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\n\nexport class DatabaseStore implements Store {\n protected tableName: string;\n protected connectionName?: string;\n\n constructor(\n protected config: Record<string, any>,\n protected prefix: string = '',\n protected app: Application\n ) {\n this.tableName = config.table || 'cache';\n this.connectionName = config.connection || undefined;\n }\n\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.connectionName);\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n const now = this.currentTime();\n\n const row = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (!row) return null;\n\n // Check expiration\n if (row.expiration !== 0 && now >= row.expiration) {\n await this.forget(key);\n return null;\n }\n\n return this.unserialize(row.value);\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const serialized = this.serialize(value);\n const expiration = seconds > 0 ? this.currentTime() + seconds : 0;\n const conn = this.getConnection();\n\n try {\n // Try update first\n const existing = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (existing) {\n await conn.table(this.tableName).where('key', '=', prefixed).update({ value: serialized, expiration });\n } else {\n await conn.table(this.tableName).insert({ key: prefixed, value: serialized, expiration });\n }\n\n return true;\n } catch {\n return false;\n }\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 current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n\n const existing = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (existing) {\n await conn\n .table(this.tableName)\n .where('key', '=', prefixed)\n .update({ value: this.serialize(newValue) });\n } else {\n await conn.table(this.tableName).insert({ key: prefixed, value: this.serialize(newValue), expiration: 0 });\n }\n\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n\n try {\n await conn.table(this.tableName).where('key', '=', prefixed).delete();\n return true;\n } catch {\n return false;\n }\n }\n\n async flush(): Promise<boolean> {\n const conn = this.getConnection();\n\n try {\n await conn.table(this.tableName).delete();\n return true;\n } catch {\n return false;\n }\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n protected prefixedKey(key: string): string {\n return `${this.prefix}${key}`;\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): string {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: string): any {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n}\n"],"mappings":"AAuBA,IAAa,EAAb,KAA4C,
|
|
1
|
+
{"version":3,"file":"DatabaseStore.mjs","names":[],"sources":["../../../src/Cache/Stores/DatabaseStore.ts"],"sourcesContent":["/**\n * DatabaseStore\n *\n * Database-backed cache store. Stores cache entries in a database table.\n * Requires a `cache` table with columns: key (PK), value (text), expiration (int).\n *\n * Mirrors Laravel's Illuminate\\Cache\\DatabaseStore.\n *\n * @example\n * ```typescript\n * const store = new DatabaseStore({\n * driver: 'database',\n * connection: null,\n * table: 'cache',\n * }, 'app_', application);\n * ```\n */\n\nimport type { Store } from '@/Cache/Contracts/Store';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\n\nexport class DatabaseStore implements Store {\n protected tableName: string;\n protected connectionName?: string;\n\n constructor(\n protected config: Record<string, any>,\n protected prefix: string = '',\n protected app: Application\n ) {\n this.tableName = config.table || 'cache';\n this.connectionName = config.connection || undefined;\n }\n\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.connectionName);\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n const now = this.currentTime();\n\n const row = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (!row) return null;\n\n // Check expiration\n if (row.expiration !== 0 && now >= row.expiration) {\n await this.forget(key);\n return null;\n }\n\n return this.unserialize(row.value);\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const serialized = this.serialize(value);\n const expiration = seconds > 0 ? this.currentTime() + seconds : 0;\n const conn = this.getConnection();\n\n try {\n // Try update first\n const existing = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (existing) {\n await conn.table(this.tableName).where('key', '=', prefixed).update({ value: serialized, expiration });\n } else {\n await conn.table(this.tableName).insert({ key: prefixed, value: serialized, expiration });\n }\n\n return true;\n } catch {\n return false;\n }\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 current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n\n const existing = await conn.table(this.tableName).where('key', '=', prefixed).first();\n\n if (existing) {\n await conn\n .table(this.tableName)\n .where('key', '=', prefixed)\n .update({ value: this.serialize(newValue) });\n } else {\n await conn.table(this.tableName).insert({ key: prefixed, value: this.serialize(newValue), expiration: 0 });\n }\n\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const prefixed = this.prefixedKey(key);\n const conn = this.getConnection();\n\n try {\n await conn.table(this.tableName).where('key', '=', prefixed).delete();\n return true;\n } catch {\n return false;\n }\n }\n\n async flush(): Promise<boolean> {\n const conn = this.getConnection();\n\n try {\n await conn.table(this.tableName).delete();\n return true;\n } catch {\n return false;\n }\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n protected prefixedKey(key: string): string {\n return `${this.prefix}${key}`;\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): string {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: string): any {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n}\n"],"mappings":"AAuBA,IAAa,EAAb,KAA4C,CAK9B,OACA,OACA,IANZ,UACA,eAEA,YACE,EACA,EAA2B,GAC3B,EACA,CAHU,KAAA,OAAA,EACA,KAAA,OAAA,EACA,KAAA,IAAA,EAEV,KAAK,UAAY,EAAO,OAAS,QACjC,KAAK,eAAiB,EAAO,YAAc,IAAA,GAG7C,eAAsC,CAEpC,OADW,KAAK,IAAI,KAAsB,KACjC,CAAC,WAAW,KAAK,eAAe,CAG3C,MAAM,IAAa,EAAgC,CACjD,IAAM,EAAW,KAAK,YAAY,EAAI,CAChC,EAAO,KAAK,eAAe,CAC3B,EAAM,KAAK,aAAa,CAExB,EAAM,MAAM,EAAK,MAAM,KAAK,UAAU,CAAC,MAAM,MAAO,IAAK,EAAS,CAAC,OAAO,CAUhF,OARK,EAGD,EAAI,aAAe,GAAK,GAAO,EAAI,YACrC,MAAM,KAAK,OAAO,EAAI,CACf,MAGF,KAAK,YAAY,EAAI,MAAM,CARjB,KAWnB,MAAM,KAAc,EAAmD,CACrE,IAAM,EAAmC,EAAE,CAC3C,IAAK,IAAM,KAAO,EAChB,EAAO,GAAO,MAAM,KAAK,IAAI,EAAI,CAEnC,OAAO,EAGT,MAAM,IAAa,EAAa,EAAU,EAAmC,CAC3E,IAAM,EAAW,KAAK,YAAY,EAAI,CAChC,EAAa,KAAK,UAAU,EAAM,CAClC,EAAa,EAAU,EAAI,KAAK,aAA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,IAAM,EAAW,KAAK,YAAY,EAAI,CAChC,EAAO,KAAK,eAAe,CAEjC,GAAI,CAEF,OADA,MAAM,EAAK,MAAM,KAAK,UAAU,CAAC,MAAM,MAAO,IAAK,EAAS,CAAC,QAAQ,CAC9D,QACD,CACN,MAAO,IAIX,MAAM,OAA0B,CAC9B,IAAM,EAAO,KAAK,eAAe,CAEjC,GAAI,CAEF,OADA,MAAM,EAAK,MAAM,KAAK,UAAU,CAAC,QAAQ,CAClC,QACD,CACN,MAAO,IAIX,WAAoB,CAClB,OAAO,KAAK,OAGd,YAAsB,EAAqB,CACzC,MAAO,GAAG,KAAK,SAAS,IAG1B,aAAgC,CAC9B,OAAO,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGtC,UAAoB,EAAoB,CACtC,OAAO,KAAK,UAAU,EAAM,CAG9B,YAAsB,EAAoB,CACxC,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`crypto`),n=require(`fs/promises`);n=e.__toESM(n);let r=require(`path`);r=e.__toESM(r);var i=class{cachePath;constructor(e,t=``){this.config=e,this.prefix=t,this.cachePath=e.path||`storage/framework/cache/data`}async get(e){return this.getPayload(e)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,i){let a=this.path(e);await this.ensureDirectory(r.dirname(a));let o=i>0?this.currentTime()+i:9999999999,s=JSON.stringify({expiration:o,value:this.serialize(t)});try{return await n.writeFile(a,s,`utf-8`),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t;return await this.forever(e,r),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.path(e);try{return await n.unlink(t),!0}catch{return!1}}async flush(){try{return await n.rm(this.cachePath,{recursive:!0,force:!0}),await n.mkdir(this.cachePath,{recursive:!0}),!0}catch{return!1}}getPrefix(){return this.prefix}path(e){let t=`${this.prefix}${e}`,n=this.hash(t),i=[n.substring(0,2),n.substring(2,4)];return r.join(this.cachePath,...i,n)}hash(e){return(0,t.createHash)(`sha256`).update(e).digest(`hex`)}async getPayload(e){let t=this.path(e);try{let r=await n.readFile(t,`utf-8`),i=JSON.parse(r);return i.expiration!==0&&this.currentTime()>=i.expiration?(await this.forget(e),null):this.unserialize(i.value)}catch{return null}}async ensureDirectory(e){await n.mkdir(e,{recursive:!0})}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};exports.FileStore=i;
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`crypto`),n=require(`fs/promises`);n=e.__toESM(n,1);let r=require(`path`);r=e.__toESM(r,1);var i=class{config;prefix;cachePath;constructor(e,t=``){this.config=e,this.prefix=t,this.cachePath=e.path||`storage/framework/cache/data`}async get(e){return this.getPayload(e)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,i){let a=this.path(e);await this.ensureDirectory(r.dirname(a));let o=i>0?this.currentTime()+i:9999999999,s=JSON.stringify({expiration:o,value:this.serialize(t)});try{return await n.writeFile(a,s,`utf-8`),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t;return await this.forever(e,r),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let t=this.path(e);try{return await n.unlink(t),!0}catch{return!1}}async flush(){try{return await n.rm(this.cachePath,{recursive:!0,force:!0}),await n.mkdir(this.cachePath,{recursive:!0}),!0}catch{return!1}}getPrefix(){return this.prefix}path(e){let t=`${this.prefix}${e}`,n=this.hash(t),i=[n.substring(0,2),n.substring(2,4)];return r.join(this.cachePath,...i,n)}hash(e){return(0,t.createHash)(`sha256`).update(e).digest(`hex`)}async getPayload(e){let t=this.path(e);try{let r=await n.readFile(t,`utf-8`),i=JSON.parse(r);return i.expiration!==0&&this.currentTime()>=i.expiration?(await this.forget(e),null):this.unserialize(i.value)}catch{return null}}async ensureDirectory(e){await n.mkdir(e,{recursive:!0})}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};exports.FileStore=i;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createHash as e}from"crypto";import*as t from"fs/promises";import*as n from"path";var r=class{cachePath;constructor(e,t=``){this.config=e,this.prefix=t,this.cachePath=e.path||`storage/framework/cache/data`}async get(e){return this.getPayload(e)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,r,i){let a=this.path(e);await this.ensureDirectory(n.dirname(a));let o=i>0?this.currentTime()+i:9999999999,s=JSON.stringify({expiration:o,value:this.serialize(r)});try{return await t.writeFile(a,s,`utf-8`),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t;return await this.forever(e,r),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let n=this.path(e);try{return await t.unlink(n),!0}catch{return!1}}async flush(){try{return await t.rm(this.cachePath,{recursive:!0,force:!0}),await t.mkdir(this.cachePath,{recursive:!0}),!0}catch{return!1}}getPrefix(){return this.prefix}path(e){let t=`${this.prefix}${e}`,r=this.hash(t),i=[r.substring(0,2),r.substring(2,4)];return n.join(this.cachePath,...i,r)}hash(t){return e(`sha256`).update(t).digest(`hex`)}async getPayload(e){let n=this.path(e);try{let r=await t.readFile(n,`utf-8`),i=JSON.parse(r);return i.expiration!==0&&this.currentTime()>=i.expiration?(await this.forget(e),null):this.unserialize(i.value)}catch{return null}}async ensureDirectory(e){await t.mkdir(e,{recursive:!0})}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};export{r as FileStore};
|
|
1
|
+
import{createHash as e}from"crypto";import*as t from"fs/promises";import*as n from"path";var r=class{config;prefix;cachePath;constructor(e,t=``){this.config=e,this.prefix=t,this.cachePath=e.path||`storage/framework/cache/data`}async get(e){return this.getPayload(e)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,r,i){let a=this.path(e);await this.ensureDirectory(n.dirname(a));let o=i>0?this.currentTime()+i:9999999999,s=JSON.stringify({expiration:o,value:this.serialize(r)});try{return await t.writeFile(a,s,`utf-8`),!0}catch{return!1}}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.get(e),r=(typeof n==`number`?n:0)+t;return await this.forever(e,r),r}async decrement(e,t=1){return this.increment(e,-t)}async forever(e,t){return this.put(e,t,0)}async forget(e){let n=this.path(e);try{return await t.unlink(n),!0}catch{return!1}}async flush(){try{return await t.rm(this.cachePath,{recursive:!0,force:!0}),await t.mkdir(this.cachePath,{recursive:!0}),!0}catch{return!1}}getPrefix(){return this.prefix}path(e){let t=`${this.prefix}${e}`,r=this.hash(t),i=[r.substring(0,2),r.substring(2,4)];return n.join(this.cachePath,...i,r)}hash(t){return e(`sha256`).update(t).digest(`hex`)}async getPayload(e){let n=this.path(e);try{let r=await t.readFile(n,`utf-8`),i=JSON.parse(r);return i.expiration!==0&&this.currentTime()>=i.expiration?(await this.forget(e),null):this.unserialize(i.value)}catch{return null}}async ensureDirectory(e){await t.mkdir(e,{recursive:!0})}currentTime(){return Math.floor(Date.now()/1e3)}serialize(e){return JSON.stringify(e)}unserialize(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};export{r as FileStore};
|
|
2
2
|
//# sourceMappingURL=FileStore.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileStore.mjs","names":[],"sources":["../../../src/Cache/Stores/FileStore.ts"],"sourcesContent":["/**\n * FileStore\n *\n * File-based cache store. Stores each cache entry as a JSON file\n * on the filesystem, organized by a two-character hash prefix.\n *\n * Mirrors Laravel's Illuminate\\Cache\\FileStore.\n *\n * @example\n * ```typescript\n * const store = new FileStore({\n * driver: 'file',\n * path: 'storage/framework/cache/data',\n * }, 'app_');\n * ```\n */\n\nimport { createHash } from 'crypto';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport type { Store } from '@/Cache/Contracts/Store';\n\nexport class FileStore implements Store {\n protected cachePath: string;\n\n constructor(\n protected config: Record<string, any>,\n protected prefix: string = ''\n ) {\n this.cachePath = config.path || 'storage/framework/cache/data';\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n return this.getPayload(key);\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const filePath = this.path(key);\n\n await this.ensureDirectory(path.dirname(filePath));\n\n const expiration = seconds > 0 ? this.currentTime() + seconds : 9999999999; // ~2286, effectively forever\n\n const content = JSON.stringify({\n expiration,\n value: this.serialize(value),\n });\n\n try {\n await fs.writeFile(filePath, content, 'utf-8');\n return true;\n } catch {\n return false;\n }\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 current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n await this.forever(key, newValue);\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const filePath = this.path(key);\n try {\n await fs.unlink(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n async flush(): Promise<boolean> {\n try {\n await fs.rm(this.cachePath, { recursive: true, force: true });\n await fs.mkdir(this.cachePath, { recursive: true });\n return true;\n } catch {\n return false;\n }\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n /**\n * Get the full file path for a cache key\n */\n protected path(key: string): string {\n const prefixed = `${this.prefix}${key}`;\n const hash = this.hash(prefixed);\n // Two-level directory structure using first 2+2 chars of hash\n const parts = [hash.substring(0, 2), hash.substring(2, 4)];\n return path.join(this.cachePath, ...parts, hash);\n }\n\n /**\n * Get the hashed key\n */\n protected hash(key: string): string {\n return createHash('sha256').update(key).digest('hex');\n }\n\n /**\n * Read and validate the cache payload\n */\n protected async getPayload(key: string): Promise<any> {\n const filePath = this.path(key);\n\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n const data = JSON.parse(content);\n\n // Check expiration\n if (data.expiration !== 0 && this.currentTime() >= data.expiration) {\n await this.forget(key);\n return null;\n }\n\n return this.unserialize(data.value);\n } catch {\n return null;\n }\n }\n\n protected async ensureDirectory(dir: string): Promise<void> {\n await fs.mkdir(dir, { recursive: true });\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): any {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n return value;\n }\n}\n"],"mappings":"yFAsBA,IAAa,EAAb,KAAwC,
|
|
1
|
+
{"version":3,"file":"FileStore.mjs","names":[],"sources":["../../../src/Cache/Stores/FileStore.ts"],"sourcesContent":["/**\n * FileStore\n *\n * File-based cache store. Stores each cache entry as a JSON file\n * on the filesystem, organized by a two-character hash prefix.\n *\n * Mirrors Laravel's Illuminate\\Cache\\FileStore.\n *\n * @example\n * ```typescript\n * const store = new FileStore({\n * driver: 'file',\n * path: 'storage/framework/cache/data',\n * }, 'app_');\n * ```\n */\n\nimport { createHash } from 'crypto';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport type { Store } from '@/Cache/Contracts/Store';\n\nexport class FileStore implements Store {\n protected cachePath: string;\n\n constructor(\n protected config: Record<string, any>,\n protected prefix: string = ''\n ) {\n this.cachePath = config.path || 'storage/framework/cache/data';\n }\n\n async get<T = any>(key: string): Promise<T | null> {\n return this.getPayload(key);\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(key);\n }\n return result;\n }\n\n async put<T = any>(key: string, value: T, seconds: number): Promise<boolean> {\n const filePath = this.path(key);\n\n await this.ensureDirectory(path.dirname(filePath));\n\n const expiration = seconds > 0 ? this.currentTime() + seconds : 9999999999; // ~2286, effectively forever\n\n const content = JSON.stringify({\n expiration,\n value: this.serialize(value),\n });\n\n try {\n await fs.writeFile(filePath, content, 'utf-8');\n return true;\n } catch {\n return false;\n }\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 current = await this.get(key);\n const newValue = (typeof current === 'number' ? current : 0) + value;\n await this.forever(key, newValue);\n return newValue;\n }\n\n async decrement(key: string, value: number = 1): Promise<number | boolean> {\n return this.increment(key, -value);\n }\n\n async forever<T = any>(key: string, value: T): Promise<boolean> {\n return this.put(key, value, 0);\n }\n\n async forget(key: string): Promise<boolean> {\n const filePath = this.path(key);\n try {\n await fs.unlink(filePath);\n return true;\n } catch {\n return false;\n }\n }\n\n async flush(): Promise<boolean> {\n try {\n await fs.rm(this.cachePath, { recursive: true, force: true });\n await fs.mkdir(this.cachePath, { recursive: true });\n return true;\n } catch {\n return false;\n }\n }\n\n getPrefix(): string {\n return this.prefix;\n }\n\n /**\n * Get the full file path for a cache key\n */\n protected path(key: string): string {\n const prefixed = `${this.prefix}${key}`;\n const hash = this.hash(prefixed);\n // Two-level directory structure using first 2+2 chars of hash\n const parts = [hash.substring(0, 2), hash.substring(2, 4)];\n return path.join(this.cachePath, ...parts, hash);\n }\n\n /**\n * Get the hashed key\n */\n protected hash(key: string): string {\n return createHash('sha256').update(key).digest('hex');\n }\n\n /**\n * Read and validate the cache payload\n */\n protected async getPayload(key: string): Promise<any> {\n const filePath = this.path(key);\n\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n const data = JSON.parse(content);\n\n // Check expiration\n if (data.expiration !== 0 && this.currentTime() >= data.expiration) {\n await this.forget(key);\n return null;\n }\n\n return this.unserialize(data.value);\n } catch {\n return null;\n }\n }\n\n protected async ensureDirectory(dir: string): Promise<void> {\n await fs.mkdir(dir, { recursive: true });\n }\n\n protected currentTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n protected serialize(value: any): any {\n return JSON.stringify(value);\n }\n\n protected unserialize(value: any): any {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n return value;\n }\n}\n"],"mappings":"yFAsBA,IAAa,EAAb,KAAwC,CAI1B,OACA,OAJZ,UAEA,YACE,EACA,EAA2B,GAC3B,CAFU,KAAA,OAAA,EACA,KAAA,OAAA,EAEV,KAAK,UAAY,EAAO,MAAQ,+BAGlC,MAAM,IAAa,EAAgC,CACjD,OAAO,KAAK,WAAW,EAAI,CAG7B,MAAM,KAAc,EAAmD,CACrE,IAAM,EAAmC,EAAE,CAC3C,IAAK,IAAM,KAAO,EAChB,EAAO,GAAO,MAAM,KAAK,IAAI,EAAI,CAEnC,OAAO,EAGT,MAAM,IAAa,EAAa,EAAU,EAAmC,CAC3E,IAAM,EAAW,KAAK,KAAK,EAAI,CAE/B,MAA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AAU,EAAG,EAAE,CAAE,EAAK,UAAU,EAAG,EAAE,CAAC,CAC1D,OAAO,EAAK,KAAK,KAAK,UAAW,GAAG,EAAO,EAAK,CAMlD,KAAe,EAAqB,CAClC,OAAO,EAAW,SAAS,CAAC,OAAO,EAAI,CAAC,OAAO,MAAM,CAMvD,MAAgB,WAAW,EAA2B,CACpD,IAAM,EAAW,KAAK,KAAK,EAAI,CAE/B,GAAI,CACF,IAAM,EAAU,MAAM,EAAG,SAAS,EAAU,QAAQ,CAC9C,EAAO,KAAK,MAAM,EAAQ,CAQhC,OALI,EAAK,aAAe,GAAK,KAAK,aAAa,EAAI,EAAK,YACtD,MAAM,KAAK,OAAO,EAAI,CACf,MAGF,KAAK,YAAY,EAAK,MAAM,MAC7B,CACN,OAAO,MAIX,MAAgB,gBAAgB,EAA4B,CAC1D,MAAM,EAAG,MAAM,EAAK,CAAE,UAAW,GAAM,CAAC,CAG1C,aAAgC,CAC9B,OAAO,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGtC,UAAoB,EAAiB,CACnC,OAAO,KAAK,UAAU,EAAM,CAG9B,YAAsB,EAAiB,CACrC,GAAI,OAAO,GAAU,SACnB,GAAI,CACF,OAAO,KAAK,MAAM,EAAM,MAClB,CACN,OAAO,EAGX,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`crypto`);var t=class{constructor(e,t){this.store=e,this.names=t}async getNamespace(){let e=[];for(let t of this.names)e.push(await this.tagId(t));return e.join(`|`)}async tagId(t){let n=this.tagKey(t),r=await this.store.get(n);if(r)return r;let i=(0,e.randomUUID)().replace(/-/g,``).substring(0,12);return await this.store.forever(n,i),i}tagKey(e){return`tag:${e}:key`}async reset(){for(let t of this.names)await this.store.forever(this.tagKey(t),(0,e.randomUUID)().replace(/-/g,``).substring(0,12))}async flush(){await this.reset()}getNames(){return this.names}};exports.TagSet=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`crypto`);var t=class{store;names;constructor(e,t){this.store=e,this.names=t}async getNamespace(){let e=[];for(let t of this.names)e.push(await this.tagId(t));return e.join(`|`)}async tagId(t){let n=this.tagKey(t),r=await this.store.get(n);if(r)return r;let i=(0,e.randomUUID)().replace(/-/g,``).substring(0,12);return await this.store.forever(n,i),i}tagKey(e){return`tag:${e}:key`}async reset(){for(let t of this.names)await this.store.forever(this.tagKey(t),(0,e.randomUUID)().replace(/-/g,``).substring(0,12))}async flush(){await this.reset()}getNames(){return this.names}};exports.TagSet=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{randomUUID as e}from"crypto";var t=class{constructor(e,t){this.store=e,this.names=t}async getNamespace(){let e=[];for(let t of this.names)e.push(await this.tagId(t));return e.join(`|`)}async tagId(t){let n=this.tagKey(t),r=await this.store.get(n);if(r)return r;let i=e().replace(/-/g,``).substring(0,12);return await this.store.forever(n,i),i}tagKey(e){return`tag:${e}:key`}async reset(){for(let t of this.names)await this.store.forever(this.tagKey(t),e().replace(/-/g,``).substring(0,12))}async flush(){await this.reset()}getNames(){return this.names}};export{t as TagSet};
|
|
1
|
+
import{randomUUID as e}from"crypto";var t=class{store;names;constructor(e,t){this.store=e,this.names=t}async getNamespace(){let e=[];for(let t of this.names)e.push(await this.tagId(t));return e.join(`|`)}async tagId(t){let n=this.tagKey(t),r=await this.store.get(n);if(r)return r;let i=e().replace(/-/g,``).substring(0,12);return await this.store.forever(n,i),i}tagKey(e){return`tag:${e}:key`}async reset(){for(let t of this.names)await this.store.forever(this.tagKey(t),e().replace(/-/g,``).substring(0,12))}async flush(){await this.reset()}getNames(){return this.names}};export{t as TagSet};
|
|
2
2
|
//# sourceMappingURL=TagSet.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagSet.mjs","names":[],"sources":["../../../src/Cache/Tags/TagSet.ts"],"sourcesContent":["/**\n * TagSet\n *\n * Manages a set of cache tags and their namespaces.\n * Used by TaggedCache to prefix keys with tag identifiers.\n *\n * Mirrors Laravel's Illuminate\\Cache\\TagSet.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Store } from '@/Cache/Contracts/Store';\n\nexport class TagSet {\n constructor(\n protected store: Store,\n protected names: string[]\n ) {}\n\n /**\n * Get the tag namespace for all tags combined\n */\n async getNamespace(): Promise<string> {\n const ids: string[] = [];\n\n for (const name of this.names) {\n ids.push(await this.tagId(name));\n }\n\n return ids.join('|');\n }\n\n /**\n * Get the unique tag identifier for a tag name\n */\n protected async tagId(name: string): Promise<string> {\n const tagKey = this.tagKey(name);\n const existing = await this.store.get(tagKey);\n\n if (existing) {\n return existing;\n }\n\n // Create a new tag ID\n const id = randomUUID().replace(/-/g, '').substring(0, 12);\n await this.store.forever(tagKey, id);\n return id;\n }\n\n /**\n * Get the tag identifier key\n */\n tagKey(name: string): string {\n return `tag:${name}:key`;\n }\n\n /**\n * Reset all tag identifiers (used for flushing)\n */\n async reset(): Promise<void> {\n for (const name of this.names) {\n await this.store.forever(this.tagKey(name), randomUUID().replace(/-/g, '').substring(0, 12));\n }\n }\n\n /**\n * Flush all tag identifier keys\n */\n async flush(): Promise<void> {\n await this.reset();\n }\n\n /**\n * Get the tag names\n */\n getNames(): string[] {\n return this.names;\n }\n}\n"],"mappings":"oCAYA,IAAa,EAAb,KAAoB,
|
|
1
|
+
{"version":3,"file":"TagSet.mjs","names":[],"sources":["../../../src/Cache/Tags/TagSet.ts"],"sourcesContent":["/**\n * TagSet\n *\n * Manages a set of cache tags and their namespaces.\n * Used by TaggedCache to prefix keys with tag identifiers.\n *\n * Mirrors Laravel's Illuminate\\Cache\\TagSet.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Store } from '@/Cache/Contracts/Store';\n\nexport class TagSet {\n constructor(\n protected store: Store,\n protected names: string[]\n ) {}\n\n /**\n * Get the tag namespace for all tags combined\n */\n async getNamespace(): Promise<string> {\n const ids: string[] = [];\n\n for (const name of this.names) {\n ids.push(await this.tagId(name));\n }\n\n return ids.join('|');\n }\n\n /**\n * Get the unique tag identifier for a tag name\n */\n protected async tagId(name: string): Promise<string> {\n const tagKey = this.tagKey(name);\n const existing = await this.store.get(tagKey);\n\n if (existing) {\n return existing;\n }\n\n // Create a new tag ID\n const id = randomUUID().replace(/-/g, '').substring(0, 12);\n await this.store.forever(tagKey, id);\n return id;\n }\n\n /**\n * Get the tag identifier key\n */\n tagKey(name: string): string {\n return `tag:${name}:key`;\n }\n\n /**\n * Reset all tag identifiers (used for flushing)\n */\n async reset(): Promise<void> {\n for (const name of this.names) {\n await this.store.forever(this.tagKey(name), randomUUID().replace(/-/g, '').substring(0, 12));\n }\n }\n\n /**\n * Flush all tag identifier keys\n */\n async flush(): Promise<void> {\n await this.reset();\n }\n\n /**\n * Get the tag names\n */\n getNames(): string[] {\n return this.names;\n }\n}\n"],"mappings":"oCAYA,IAAa,EAAb,KAAoB,CAEN,MACA,MAFZ,YACE,EACA,EACA,CAFU,KAAA,MAAA,EACA,KAAA,MAAA,EAMZ,MAAM,cAAgC,CACpC,IAAM,EAAgB,EAAE,CAExB,IAAK,IAAM,KAAQ,KAAK,MACtB,EAAI,KAAK,MAAM,KAAK,MAAM,EAAK,CAAC,CAGlC,OAAO,EAAI,KAAK,IAAI,CAMtB,MAAgB,MAAM,EAA+B,CACnD,IAAM,EAAS,KAAK,OAAO,EAAK,CAC1B,EAAW,MAAM,KAAK,MAAM,IAAI,EAAO,CAE7C,GAAI,EACF,OAAO,EAIT,IAAM,EAAK,GAAY,CAAC,QAAQ,KAAM,GAAG,CAAC,UAAU,EAAG,GAAG,CAE1D,OADA,MAAM,KAAK,MAAM,QAAQ,EAAQ,EAAG,CAC7B,EAMT,OAAO,EAAsB,CAC3B,MAAO,OAAO,EAAK,MAMrB,MAAM,OAAuB,CAC3B,IAAK,IAAM,KAAQ,KAAK,MACtB,MAAM,KAAK,MAAM,QAAQ,KAAK,OAAO,EAAK,CAAE,GAAY,CAAC,QAAQ,KAAM,GAAG,CAAC,UAAU,EAAG,GAAG,CAAC,CAOhG,MAAM,OAAuB,CAC3B,MAAM,KAAK,OAAO,CAMpB,UAAqB,CACnB,OAAO,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t){this.store=e,this.tags=t}async get(e){let t=await this.taggedItemKey(e);return this.store.get(t)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=await this.taggedItemKey(e);return this.store.put(r,t,n)}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.taggedItemKey(e);return this.store.increment(n,t)}async decrement(e,t=1){let n=await this.taggedItemKey(e);return this.store.decrement(n,t)}async forever(e,t){let n=await this.taggedItemKey(e);return this.store.forever(n,t)}async forget(e){let t=await this.taggedItemKey(e);return this.store.forget(t)}async flush(){return await this.tags.flush(),!0}async has(e){return await this.get(e)!==null}async pull(e,t){let n=await this.get(e);return n===null?t??null:(await this.forget(e),n)}async remember(e,t,n){let r=await this.get(e);if(r!==null)return r;let i=await n();return await this.put(e,i,t),i}async rememberForever(e,t){let n=await this.get(e);if(n!==null)return n;let r=await t();return await this.forever(e,r),r}async taggedItemKey(e){return`${await this.tags.getNamespace()}:${e}`}getTags(){return this.tags}};exports.TaggedCache=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{store;tags;constructor(e,t){this.store=e,this.tags=t}async get(e){let t=await this.taggedItemKey(e);return this.store.get(t)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=await this.taggedItemKey(e);return this.store.put(r,t,n)}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.taggedItemKey(e);return this.store.increment(n,t)}async decrement(e,t=1){let n=await this.taggedItemKey(e);return this.store.decrement(n,t)}async forever(e,t){let n=await this.taggedItemKey(e);return this.store.forever(n,t)}async forget(e){let t=await this.taggedItemKey(e);return this.store.forget(t)}async flush(){return await this.tags.flush(),!0}async has(e){return await this.get(e)!==null}async pull(e,t){let n=await this.get(e);return n===null?t??null:(await this.forget(e),n)}async remember(e,t,n){let r=await this.get(e);if(r!==null)return r;let i=await n();return await this.put(e,i,t),i}async rememberForever(e,t){let n=await this.get(e);if(n!==null)return n;let r=await t();return await this.forever(e,r),r}async taggedItemKey(e){return`${await this.tags.getNamespace()}:${e}`}getTags(){return this.tags}};exports.TaggedCache=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t){this.store=e,this.tags=t}async get(e){let t=await this.taggedItemKey(e);return this.store.get(t)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=await this.taggedItemKey(e);return this.store.put(r,t,n)}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.taggedItemKey(e);return this.store.increment(n,t)}async decrement(e,t=1){let n=await this.taggedItemKey(e);return this.store.decrement(n,t)}async forever(e,t){let n=await this.taggedItemKey(e);return this.store.forever(n,t)}async forget(e){let t=await this.taggedItemKey(e);return this.store.forget(t)}async flush(){return await this.tags.flush(),!0}async has(e){return await this.get(e)!==null}async pull(e,t){let n=await this.get(e);return n===null?t??null:(await this.forget(e),n)}async remember(e,t,n){let r=await this.get(e);if(r!==null)return r;let i=await n();return await this.put(e,i,t),i}async rememberForever(e,t){let n=await this.get(e);if(n!==null)return n;let r=await t();return await this.forever(e,r),r}async taggedItemKey(e){return`${await this.tags.getNamespace()}:${e}`}getTags(){return this.tags}};export{e as TaggedCache};
|
|
1
|
+
var e=class{store;tags;constructor(e,t){this.store=e,this.tags=t}async get(e){let t=await this.taggedItemKey(e);return this.store.get(t)}async many(e){let t={};for(let n of e)t[n]=await this.get(n);return t}async put(e,t,n){let r=await this.taggedItemKey(e);return this.store.put(r,t,n)}async putMany(e,t){let n=!0;for(let[r,i]of Object.entries(e))await this.put(r,i,t)||(n=!1);return n}async increment(e,t=1){let n=await this.taggedItemKey(e);return this.store.increment(n,t)}async decrement(e,t=1){let n=await this.taggedItemKey(e);return this.store.decrement(n,t)}async forever(e,t){let n=await this.taggedItemKey(e);return this.store.forever(n,t)}async forget(e){let t=await this.taggedItemKey(e);return this.store.forget(t)}async flush(){return await this.tags.flush(),!0}async has(e){return await this.get(e)!==null}async pull(e,t){let n=await this.get(e);return n===null?t??null:(await this.forget(e),n)}async remember(e,t,n){let r=await this.get(e);if(r!==null)return r;let i=await n();return await this.put(e,i,t),i}async rememberForever(e,t){let n=await this.get(e);if(n!==null)return n;let r=await t();return await this.forever(e,r),r}async taggedItemKey(e){return`${await this.tags.getNamespace()}:${e}`}getTags(){return this.tags}};export{e as TaggedCache};
|
|
2
2
|
//# sourceMappingURL=TaggedCache.mjs.map
|
|
@@ -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,EA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AM,gBAAyB,EAAa,EAA4C,CACtF,IAAM,EAAQ,MAAM,KAAK,IAAI,EAAI,CAEjC,GAAI,IAAU,KACZ,OAAO,EAGT,IAAM,EAAS,MAAM,GAAU,CAE/B,OADA,MAAM,KAAK,QAAQ,EAAK,EAAO,CACxB,EAMT,MAAgB,cAAc,EAA8B,CAE1D,MAAO,GAAG,MADc,KAAK,KAAK,cAAc,CAC5B,GAAG,IAMzB,SAAkB,CAChB,OAAO,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Command.cjs`);var t=class extends e.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,I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K,MAAM,uCAAuC,EAAM,UAAU,CAClE,EAAY,GACZ,SAIF,GAAI,CACF,MAAM,EAAS,eAAe,EAAQ,CACpC,YAAa,EAAO,QACpB,QAAS,EAAU,KACnB,UAAW,EAAU,UACrB,iBACA,QAAS,EAAQ,IACjB,QAAS,CAAC,CAAC,EAAQ,QACpB,CAAC,CAEF,KAAK,KAAK,KAAK,EAAO,KAAK,wBAAwB,OAC5C,EAAY,CACnB,KAAK,MAAM,KAAK,EAAO,KAAK,oBAAoB,CAC5C,GAAO,SACT,KAAK,MAAM,EAAM,QAAQ,CAE3B,EAAY,IAKhB,GAAI,CACF,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,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,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,QAC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AM,EAAG,EAAQ,CAAC,MAAM,CACxC,EAAQ,EAAQ,MAAM,EAAU,EAAE,CAAC,MAAM,EAGxC,EAAM,WAAW,IAAI,EAAI,EAAM,SAAS,IAAI,EAAM,EAAM,WAAW,IAAI,EAAI,EAAM,SAAS,IAAI,IACjG,EAAQ,EAAM,MAAM,EAAG,GAAG,EAGxB,GACF,EAAU,KAAK,CAAE,MAAK,QAAO,CAAC,CAIlC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
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,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,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,EAEtE,MADoB,EAAO,qBAAqB,EACtC,aAAa,GAAK,KAAK,CACnC,KAAK,QAAQ,WAAW,CACxB,QAKN,IAAI,EACJ,AAGE,EAHE,KAAK,QAAQ,KACR,KAAK,QAAQ,KAEb,MAAM,EAAO,iBAAiB,CAElC,EAAK,MAAM,GACd,KAAK,MAAM,4BAA4B,CACvC,QAAQ,KAAK,EAAE,EAGjB,IAAI,EAAqB,GACrB,KAAK,QAAQ,WACf,EAAa,KAAK,QAAQ,WAChB,KAAK,QAAQ,OACvB,EAAa,MAAM,EAAO,kCAAkC,EAG9D,GAAI,CACF,KAAK,QAAQ,sBAAsB,CACnC,IAAM,EAAS,MAAM,EAAO,cAAc,EAAK,MAAM,CAAE,EAAW,MAAM,EAAI,IAAA,GAAU,CAEtF,EAAc,KAAK,CACjB,QAAS,EAAO,QAAQ,KACxB,IAAK,EAAY,IAClB,CAAC,CAEF,KAAK,SAAS,CACd,KAAK,KAAK,YAAY,EAAO,QAAQ,KAAK,mBAAmB,EAAO,QAAQ,KAAK,GAAG,CACpF,KAAK,QAAQ,yCAAyC,CACtD,KAAK,SAAS,CACd,KAAK,QAAQ,cAAc,CAC3B,KAAK,QAAQ,yDAAyD,CACtE,KAAK,QAAQ,oBAAoB,OAC1B,EAAY,CACf,EAAM,SAAW,IACnB,KAAK,MAAM,2CAA2C,CAEtD,KAAK,MAAM,6BAA6B,EAAM,UAAU,CAE1D,QAAQ,KAAK,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
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,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,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,EAGV,MADkB,EAAO,qCAAqC,EACtD,aAAa,GAAK,IAAK,CACjC,KAAK,QAAQ,0BAA0B,CACvC,OAGF,KAAK,SAAS,CACd,KAAK,KAAK,yBAAyB,CACnC,KAAK,SAAS,CAEd,GAAI,CACF,MAAM,EAAY,UAAW,GAAS,CACpC,KAAK,QAAQ,OAAO,IAAO,EAC3B,CAEF,KAAK,SAAS,CACd,KAAK,KAAK,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"}
|