UNPKG

open-lineage-client

Version:

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

50 lines 1.3 kB
import { Dataset } from '../entities/Dataset.js'; /** * Builder for creating Dataset instances. */ export class DatasetBuilder { constructor() { this.name = null; this.namespace = null; this.facets = {}; } /** * Sets the name of the dataset. * @param name - The name of the dataset. * @returns {DatasetBuilder} */ setName(name) { this.name = name; return this; } /** * Sets the namespace of the dataset. * @param namespace - The namespace of the dataset. * @returns {DatasetBuilder} */ setNamespace(namespace) { this.namespace = namespace; return this; } /** * Sets the facets of the dataset. * @param facets - The facets of the dataset. * @returns {DatasetBuilder} */ setFacets(facets) { this.facets = facets; return this; } /** * Builds and returns a Dataset instance. * @returns {Dataset} * @throws {Error} If required fields are missing. */ build() { if (!this.name || !this.namespace) { throw new Error('Name and Namespace are required'); } return new Dataset(this.name, this.namespace, this.facets); } } //# sourceMappingURL=DatasetBuilder.js.map