mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-03 23:07:53 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { getJSON, returnDefaultIfNotFound } from '@datahub/utils/api/fetcher';
|
|
import { DatasetLineageList } from '@datahub/metadata-types/types/entity/dataset/lineage';
|
|
import { datasetUrlByUrn } from '@datahub/data-models/api/dataset/dataset';
|
|
|
|
// TODO: [META-8686] These lineage API items are still in place here as there is some difference
|
|
// in the typings and the actual handling that make the two currently incompatible with a simple
|
|
// reference change. Refer to @datahub/data-models/api/dataset/lineage for the maintained version
|
|
// that these should be migrated to
|
|
|
|
/**
|
|
* Constructs the url for a datasets upstreams
|
|
* @param {string} urn the urn for the child dataset
|
|
* @return {string}
|
|
*/
|
|
const datasetUpstreamUrlByUrn = (urn: string): string => `${datasetUrlByUrn(urn)}/upstreams`;
|
|
|
|
/**
|
|
* Constructs the url for a datasets downstreams
|
|
* @param {string} urn
|
|
* @return {string}
|
|
*/
|
|
const datasetDownstreamUrlByUrn = (urn: string): string => `${datasetUrlByUrn(urn)}/downstreams`;
|
|
|
|
/**
|
|
* Fetches the list of upstream datasets for a dataset by urn
|
|
* @param {string} urn urn for the child dataset
|
|
* @return {Promise<Array<IDatasetEntity>>}
|
|
*/
|
|
const readUpstreamDatasetsByUrn = (urn: string): Promise<DatasetLineageList> =>
|
|
returnDefaultIfNotFound(
|
|
getJSON<DatasetLineageList>({ url: datasetUpstreamUrlByUrn(urn) }),
|
|
[]
|
|
);
|
|
|
|
/**
|
|
* Requests the downstream datasets for the dataset identified by urn
|
|
* @param {string} urn string urn for the dataset
|
|
* @return {Promise<Array<IDatasetEntity>>}
|
|
*/
|
|
const readDownstreamDatasetsByUrn = (urn: string): Promise<DatasetLineageList> =>
|
|
returnDefaultIfNotFound(
|
|
getJSON<DatasetLineageList>({ url: datasetDownstreamUrlByUrn(urn) }),
|
|
[]
|
|
);
|
|
|
|
export { readUpstreamDatasetsByUrn, readDownstreamDatasetsByUrn };
|