UNPKG

open-lineage-client

Version:

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

35 lines 1.05 kB
import { JobEvent } from '../events/JobEvent.js'; import { validateEvent } from '../utils/utils.js'; /** * Builder for creating JobEvent instances. */ export class JobEventBuilder { constructor(eventTime, producer, schemaURL) { this.eventTime = eventTime; this.producer = producer; this.schemaURL = schemaURL; } setJob(job) { this.job = job; return this; } setInputs(inputs) { this.inputs = inputs; return this; } setOutputs(outputs) { this.outputs = outputs; return this; } build() { if (!this.job || !this.inputs || !this.outputs) { throw new Error('Job, "inputs" and "outputs" are required fields for JobEvent'); } const event = new JobEvent(this.eventTime, this.producer, this.schemaURL, this.job, this.inputs, this.outputs); if (validateEvent(event)) { return event; } throw new Error('JobEvent validation failed'); } } //# sourceMappingURL=JobEventBuilder.js.map