Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* 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
2020-08-26 15:44:50 -07:00

33 lines
1.3 KiB
TypeScript

import { IFeatureSnapshot } from '@datahub/metadata-types/types/metadata/feature-snapshot';
import { getJSON } from '@datahub/utils/api/fetcher';
import { featureUrlByUrn } from '@datahub/data-models/api/feature/feature';
import { featureUrlRoot } from '@datahub/data-models/api/feature';
import { ApiVersion } from '@datahub/utils/api/shared';
/**
* Constructs the Feature instance snapshot url from the urn
* @param {string} urn string urn value for the feature snapshot required
* @returns {string}
*/
const featureSnapshotUrlByUrn = (urn: string): string => `${featureUrlByUrn(urn)}/snapshot`;
/**
* Queries the endpoint at the url to request feature snapshot information
* @param {string} urn
* @returns {Promise<IFeatureSnapshot>}
*/
export const readFeatureSnapshot = (urn: string): Promise<IFeatureSnapshot> =>
getJSON({ url: featureSnapshotUrlByUrn(urn) });
/**
* Constructs the url for the batch GET endpoint for Feature Snapshots
*/
const featureSnapshotsUrl = (urns: Array<string>): string =>
`${featureUrlRoot(ApiVersion.v2)}/snapshots/${urns.join(';')}`;
/**
* Reads the list of snapshots at the batch GET endpoint for Feature Entities
*/
export const readFeatureSnapshots = (urns: Array<string>): Promise<Array<IFeatureSnapshot>> =>
getJSON<Array<IFeatureSnapshot>>({ url: featureSnapshotsUrl(urns) });