UNPKG

open-lineage-client

Version:

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

205 lines 6.05 kB
import { BaseFacet } from './BaseFacet.js'; import { isValidURI } from '../utils/utils.js'; /** * Represents the facets of a dataset. */ export class DatasetFacets { constructor(columnLineage = null, dataSource = null, dataQualityAssertions = null, lifecycleStateChange = null, ownership = null, schema = null, storage = null, symlinks = null, version = null) { this.columnLineage = columnLineage; this.dataSource = dataSource; this.dataQualityAssertions = dataQualityAssertions; this.lifecycleStateChange = lifecycleStateChange; this.ownership = ownership; this.schema = schema; this.storage = storage; this.symlinks = symlinks; this.version = version; } } /** * Represents a dataset facet. */ export class DatasetFacet extends BaseFacet { constructor(producer, schemaURL, deleted = null) { super(producer, schemaURL); this.deleted = deleted; } } /** * Represents a column lineage facet. */ export class ColumnLineage extends DatasetFacet { constructor(producer, schemaURL, fields = {}, deleted = null) { super(producer, schemaURL, deleted); this.fields = fields; } addField(key, field) { this.fields = { ...this.fields, [key]: field }; } getSchema() { return 'https://openlineage.io/spec/facets/1-1-0/ColumnLineageDatasetFacet.json'; } } /** * Represents a field in column lineage. */ export class Field { constructor(inputFields, transformationDescription = null, transformationType = null) { this.inputFields = inputFields; this.transformationDescription = transformationDescription; this.transformationType = transformationType; } } /** * Represents an item in a field. */ export class Item { constructor(namespace, name, field, transformations = null) { this.namespace = namespace; this.name = name; this.field = field; this.transformations = transformations; } } /** * Represents a transformation. */ export class Transformation { constructor(type, subtype = null, description = null, masking = null) { this.type = type; this.subtype = subtype; this.description = description; this.masking = masking; } } /** * Represents a data source facet. */ export class DataSource extends DatasetFacet { constructor(producer, schemaURL, name, uri, deleted = null) { super(producer, schemaURL, deleted); if (!isValidURI(uri)) { throw new Error('uri must be a valid URL'); } this.name = name; this.uri = uri; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/DataSourceDatasetFacet.json'; } } /** * Represents data quality assertions. */ export class DataQualityAssertions extends DatasetFacet { constructor(producer, schemaURL, assertions, deleted = null) { super(producer, schemaURL, deleted); this.assertions = assertions; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/DataQualityAssertionsDatasetFacet.json'; } } /** * Represents an assertion. */ export class Assertion { constructor(assertion, success, column) { this.assertion = assertion; this.success = success; this.column = column; } } /** * Represents a lifecycle state change facet. */ export class LifecycleStateChange extends DatasetFacet { constructor(producer, schemaURL, lifecycleStateChange, previousIdentifier = null, deleted = null) { super(producer, schemaURL, deleted); this.lifecycleStateChange = lifecycleStateChange; this.previousIdentifier = previousIdentifier; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/LifecycleStateChangeDatasetFacet.json'; } } /** * Represents a previous identifier. */ export class PreviousIdentifier { constructor(namespace, name) { this.namespace = namespace; this.name = name; } } /** * Represents a schema facet. */ export class Schema extends DatasetFacet { constructor(producer, schemaURL, fields, deleted = null) { super(producer, schemaURL, deleted); this.fields = fields; } getSchema() { return 'https://openlineage.io/spec/facets/1-1-1/SchemaDatasetFacet.json'; } } /** * Represents fields in a schema dataset facet. */ export class SchemaDatasetFacetFields { constructor(name, type = null, description = null, fields = null) { this.name = name; this.type = type; this.description = description; this.fields = fields; } } /** * Represents a storage facet. */ export class Storage extends DatasetFacet { constructor(producer, schemaURL, storageLayer, fileFormat = null, deleted = null) { super(producer, schemaURL, deleted); this.storageLayer = storageLayer; this.fileFormat = fileFormat; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/StorageDatasetFacet.json'; } } /** * Represents a symlinks facet. */ export class Symlinks extends DatasetFacet { constructor(producer, schemaURL, identifiers, deleted = null) { super(producer, schemaURL, deleted); this.identifiers = identifiers; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/SymlinksDatasetFacet.json'; } } /** * Represents an identifier. */ export class Identifier { constructor(namespace, name, type) { this.namespace = namespace; this.name = name; this.type = type; } } /** * Represents a version facet. */ export class Version extends DatasetFacet { constructor(producer, schemaURL, datasetVersion, deleted = null) { super(producer, schemaURL, deleted); this.datasetVersion = datasetVersion; } getSchema() { return 'https://openlineage.io/spec/facets/1-0-0/DatasetVersionDatasetFacet.json'; } } //# sourceMappingURL=DatasetFacets.js.map