open-lineage-client
Version:
TypeScript/JavaScript client for creating and sending OpenLineage standard events.
100 lines • 3.28 kB
JavaScript
import { BaseFacet } from './BaseFacet.js';
import validator from 'validator';
// Owner class
export class Owner {
constructor(name, type) {
this.name = name;
this.type = type;
}
}
// JobFacet class
export class JobFacet extends BaseFacet {
constructor(producer, schemaURL, deleted = null) {
super(producer, schemaURL);
this._deleted = deleted;
}
}
// JobType class
export class JobType extends JobFacet {
constructor(producer, schemaURL, processingType, integration, jobType, deleted = null) {
super(producer, schemaURL, deleted);
this.processingType = processingType;
this.integration = integration;
this.jobType = jobType;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/JobTypeJobFacet.json';
}
}
// Ownership class
export class Ownership extends JobFacet {
constructor(producer, schemaURL, owners, deleted = null) {
super(producer, schemaURL, deleted);
this.ownership = owners;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/OwnershipJobFacet.json';
}
}
// SourceCode class
export class SourceCode extends JobFacet {
constructor(producer, schemaURL, language, sourceCode, deleted = null) {
super(producer, schemaURL, deleted);
this.language = language;
this.sourceCode = sourceCode;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/SourceCodeJobFacet.json';
}
}
// SourceCodeLocation class
export class SourceCodeLocation extends JobFacet {
constructor(producer, schemaURL, type, url, repoUrl, path, version, tag, branch, deleted = null) {
super(producer, schemaURL, deleted);
if (!validator.isURL(url) || !validator.isURL(repoUrl)) {
throw new Error('URL and repoUrl must be valid URLs');
}
this.type = type;
this.url = url;
this.repoUrl = repoUrl;
this.path = path;
this.version = version;
this.tag = tag;
this.branch = branch;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/SourceCodeLocationJobFacet.json';
}
}
// Sql class
export class Sql extends JobFacet {
constructor(producer, schemaURL, query, deleted = null) {
super(producer, schemaURL, deleted);
this.query = query;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/SqlJobFacet.json';
}
}
// Documentation class
export class Documentation extends JobFacet {
constructor(producer, schemaURL, description, deleted = null) {
super(producer, schemaURL, deleted);
this.description = description;
}
getSchema() {
return 'https://openlineage.io/spec/facets/1-0-0/DocumentationJobFacet.json';
}
}
// JobFacets class
export class JobFacets {
constructor(documentation = null, ownership = null, sourceCode = null, sourceCodeLocation = null, sql = null, jobType = null) {
this.documentation = documentation;
this.ownership = ownership;
this.sourceCode = sourceCode;
this.sourceCodeLocation = sourceCodeLocation;
this.sql = sql;
this.jobType = jobType;
}
}
//# sourceMappingURL=JobFacets.js.map