donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
71 lines • 3.14 kB
TypeScript
import { FlowsPersistence, PaginatedFlowsResult } from './FlowsPersistence';
import { FlowMetadata } from '../models/FlowMetadata';
import { ToolCall } from '../models/ToolCall';
import { VideoSegment } from '../models/VideoSegment';
import { BrowserStorageState } from '../models/BrowserStorageState';
import { FlowsQuery } from '../models/FlowsQuery';
/**
* A persistence implementation that uses AWS S3.
* Ensure AWS credentials are properly configured in your environment,
* or provide them directly in the constructor.
*/
export declare class FlowsPersistenceAwsS3 implements FlowsPersistence {
private static readonly NAME_INDEX_PREFIX;
private static readonly RUN_MODE_INDEX_PREFIX;
private static readonly STATE_INDEX_PREFIX;
private static readonly RUN_MODE_STATE_INDEX_PREFIX;
private static readonly METADATA_FILENAME;
private static readonly BROWSER_STATE_FILENAME;
private static readonly SCREENSHOT_FILENAME_SUFFIX;
private static readonly TOOL_CALL_FILENAME_SUFFIX;
private static readonly VIDEO_FILENAME;
private readonly s3Client;
private readonly bucketName;
/**
* Creates a new instance of the AWS S3 persistence layer.
*
* @param bucketName The name of the S3 bucket to use for storage
* @param region AWS region (defaults to 'us-east-1')
* @param credentials Optional AWS credentials (if not provided, will use environment variables)
*/
constructor(bucketName: string, region: string, credentials?: {
accessKeyId: string;
secretAccessKey: string;
});
saveMetadata(flowMetadata: FlowMetadata): Promise<void>;
getMetadataByFlowId(flowId: string): Promise<FlowMetadata>;
getMetadataByFlowName(flowName: string): Promise<FlowMetadata>;
savePngScreenShot(flowId: string, bytes: Buffer): Promise<string>;
getPngScreenShot(flowId: string, screenShotId: string): Promise<Buffer | null>;
saveToolCall(flowId: string, toolCall: ToolCall): Promise<void>;
getToolCalls(flowId: string): Promise<ToolCall[]>;
getFlows(query: FlowsQuery): Promise<PaginatedFlowsResult>;
setVideo(flowId: string, bytes: Buffer): Promise<void>;
getVideoSegment(flowId: string, startOffset: number, length: number): Promise<VideoSegment | null>;
getFlowFile(flowId: string, fileId: string): Promise<Buffer | null>;
setFlowFile(flowId: string, fileId: string, fileBytes: Buffer): Promise<void>;
setBrowserState(flowId: string, browserState: BrowserStorageState): Promise<void>;
getBrowserState(flowId: string): Promise<BrowserStorageState | null>;
deleteFlow(flowId: string): Promise<void>;
/**
* Utility method to stream S3 object data to a Buffer
*/
private streamToBuffer;
/**
* Update name-to-id index.
*/
private updateNameIndex;
/**
* Update runMode-to-id index.
*/
private updateRunModeIndex;
/**
* Update state-to-id index.
*/
private updateStateIndex;
/**
* Update combined runMode+state-to-id index.
*/
private updateRunModeStateIndex;
}
//# sourceMappingURL=FlowsPersistenceAwsS3.d.ts.map