Files
sim/apps/sim/executor/execution/snapshot.ts
Vikhyath Mondreti dc3de95c39 fix(logging): hitl + trigger dev crash protection (#2664)
* hitl gaps

* deal with trigger worker crashes

* cleanup import strcuture
2026-01-02 14:01:01 -08:00

36 lines
971 B
TypeScript

import type { ExecutionMetadata, SerializableExecutionState } from '@/executor/execution/types'
export class ExecutionSnapshot {
constructor(
public readonly metadata: ExecutionMetadata,
public readonly workflow: any,
public readonly input: any,
public readonly workflowVariables: Record<string, any>,
public readonly selectedOutputs: string[] = [],
public readonly state?: SerializableExecutionState
) {}
toJSON(): string {
return JSON.stringify({
metadata: this.metadata,
workflow: this.workflow,
input: this.input,
workflowVariables: this.workflowVariables,
selectedOutputs: this.selectedOutputs,
state: this.state,
})
}
static fromJSON(json: string): ExecutionSnapshot {
const data = JSON.parse(json)
return new ExecutionSnapshot(
data.metadata,
data.workflow,
data.input,
data.workflowVariables,
data.selectedOutputs,
data.state
)
}
}