import { WorkflowsStorage } from '@mastra/core/storage'; import type { UpdateWorkflowStateOptions, StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, CreateIndexOptions, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage'; import type { StepResult, WorkflowRunState } from '@mastra/core/workflows'; import type { PgDomainConfig } from '../../db/index.js'; import { sanitizeJsonForPg } from '../../db/sanitize-json.js'; export { sanitizeJsonForPg }; export declare class WorkflowsPG extends WorkflowsStorage { #private; /** Tables managed by this domain */ static readonly MANAGED_TABLES: readonly ["mastra_workflow_snapshot"]; /** * Workflow run snapshots accumulate as runs execute. Anchored on the * timezone-aware `updatedAtZ` mirror column (last activity) so suspended or * long-running runs are not pruned by start age. */ static readonly retentionTables: RetentionTablesDescriptor; constructor(config: PgDomainConfig); supportsConcurrentUpdates(): boolean; private parseWorkflowRun; static getDefaultIndexDefs(schemaPrefix: string): CreateIndexOptions[]; /** * Returns all DDL statements for this domain: table with unique constraint. * Used by exportSchemas to produce a complete, reproducible schema export. */ static getExportDDL(schemaName?: string): string[]; /** * Returns default index definitions for the workflows domain tables. */ getDefaultIndexDefinitions(): CreateIndexOptions[]; /** * Creates default indexes for optimal query performance. */ createDefaultIndexes(): Promise; init(): Promise; /** * Lazily ensures a btree index exists on each configured policy's retention * anchor column so age-based `prune()` deletes stay fast on large tables. * Called from the prune path (not init) so only deployments that configure * retention pay the index's write/disk overhead. Best-effort: failures are * logged and pruning proceeds (correct, just slower). * Created even with `skipDefaultIndexes` — retention is an explicit opt-in, * so its supporting index is not part of the default index set. */ private ensureRetentionIndexes; /** Delete workflow run snapshots older than the `workflowSnapshot` policy's `maxAge`, batched. */ prune(policies: Record, options?: PruneOptions): Promise; /** * Creates custom user-defined indexes for this domain's tables. */ createCustomIndexes(): Promise; dangerouslyClearAll(): Promise; updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: { workflowName: string; runId: string; stepId: string; result: StepResult; requestContext: Record; }): Promise>>; updateWorkflowState({ workflowName, runId, opts, }: { workflowName: string; runId: string; opts: UpdateWorkflowStateOptions; }): Promise; persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: { workflowName: string; runId: string; resourceId?: string; snapshot: WorkflowRunState; createdAt?: Date; updatedAt?: Date; }): Promise; loadWorkflowSnapshot({ workflowName, runId, }: { workflowName: string; runId: string; }): Promise; getWorkflowRunById({ runId, workflowName, }: { runId: string; workflowName?: string; }): Promise; deleteWorkflowRunById({ runId, workflowName }: { runId: string; workflowName: string; }): Promise; listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, status, }?: StorageListWorkflowRunsInput): Promise; } //# sourceMappingURL=index.d.ts.map