UNPKG

open-lineage-client

Version:

TypeScript/JavaScript client for creating and sending OpenLineage standard events.

40 lines 1.19 kB
import { RunEvent } from '../events/RunEvent.js'; import { validateEvent } from '../utils/utils.js'; /** * Builder for creating RunEvent instances. */ export class RunEventBuilder { constructor(eventTime, producer, schemaURL, eventType) { this.eventTime = eventTime; this.producer = producer; this.schemaURL = schemaURL; this.eventType = eventType; } setRun(run) { this.run = run; return this; } setJob(job) { this.job = job; return this; } setInputs(inputs) { this.inputs = inputs; return this; } setOutputs(outputs) { this.outputs = outputs; return this; } build() { if (!this.run || !this.job || !this.inputs || !this.outputs) { throw new Error('RunEventBuilder: Required fields are missing'); } const event = new RunEvent(this.eventTime, this.producer, this.schemaURL, this.eventType, this.run, this.job, this.inputs, this.outputs); if (validateEvent(event)) { return event; } throw new Error('RunEvent validation failed'); } } //# sourceMappingURL=RunEventBuilder.js.map