UNPKG

open-lineage-client

Version:

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

30 lines 1.01 kB
import fs from 'fs'; import yaml from 'js-yaml'; import { HttpTransport } from './HttpTransport.js'; import { ConsoleTransport } from './ConsoleTransport.js'; /** * Loads and parses the YAML file, returning a ClientConfig object. */ function loadClientConfig() { const fileContents = fs.readFileSync('openlineage.yaml', 'utf8'); return yaml.load(fileContents); } /** * Retrieves the appropriate transport based on the configuration file. */ function getTransportFromFile() { const config = loadClientConfig(); if (!config.transport) { throw new Error('No transport configuration found in openlineage.yaml'); } switch (config.transport.type) { case 'http': return HttpTransport.fromFile(config.transport); case 'console': return new ConsoleTransport(); default: throw new Error(`${config.transport.type} is not a valid transport type`); } } export { getTransportFromFile }; //# sourceMappingURL=Factory.js.map