feat(files): add file storage subsystem with scenario and run artifact support

- add FileEntity, ScenarioFileEntity, ScenarioRunFileEntity with UUID-sharded disk tree
- FileStorageService: write/sha256/expiry, paginated listing, dynamic cleanup cron via SchedulerRegistry
- expose getScenarioFiles() and downloadFile() on ScriptContext for use in exec code
- wire scenarioId, runId, fileService into ExecContextBuilder and scenario scheduler
- add file upload and listing endpoints to ScenarioController
- add FILES_DIR, FILE_RUN_EXPIRATION_DAYS, FILE_CLEANUP_CRON to AppConfig
This commit is contained in:
ars9 committed 2026-04-21 13:01:09 +03:00
1 parent aa3bae9020
commit 6a91ce30e3
15 files changed
+864

No files matched your search

@@ -1,5 +1,6 @@
import type { BrowserContext, Page } from "playwright";
import type { EnvironmentData } from "../environment/environment.entity";
import type { FileStorageService } from "../file/file-storage.service";
import type { ExecContext, ScriptLogger } from "./code-executor.service";
export class ExecContextBuilder {
@@ -50,6 +51,21 @@ export class ExecContextBuilder {
return this;
}
scenarioId(scenarioId: string): this {
this.ctx.scenarioId = scenarioId;
return this;
}
runId(runId: string): this {
this.ctx.runId = runId;
return this;
}
fileService(fileService: FileStorageService): this {
this.ctx.fileService = fileService;
return this;
}
build(): ExecContext {
if (!this.ctx.page) throw new Error("ExecContextBuilder: page is required");
if (!this.ctx.browser)