mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-27 19:39:52 +00:00
22 lines
751 B
TypeScript
22 lines
751 B
TypeScript
![]() |
import { datasetUrlByUrn } from 'wherehows-web/utils/api/datasets/shared';
|
||
|
import { getJSON } from 'wherehows-web/utils/api/fetcher';
|
||
|
import { encodeUrn } from 'wherehows-web/utils/validators/urn';
|
||
|
import { Fabric } from 'wherehows-web/constants';
|
||
|
|
||
|
/**
|
||
|
* Constructs the url to retrieve fabrics for a dataset
|
||
|
* @param {string} urn
|
||
|
* @return {string}
|
||
|
*/
|
||
|
const datasetFabricsUrlByUrn = (urn: string): string => `${datasetUrlByUrn(urn)}/fabrics`;
|
||
|
|
||
|
/**
|
||
|
* Fetches the list of fabrics for a given dataset
|
||
|
* @param {string} urn
|
||
|
* @return {Promise<Array<Fabric>>}
|
||
|
*/
|
||
|
const readDatasetFabricsByUrn = (urn: string): Promise<Array<Fabric>> =>
|
||
|
getJSON<Array<Fabric>>({ url: datasetFabricsUrlByUrn(encodeUrn(urn)) });
|
||
|
|
||
|
export { readDatasetFabricsByUrn };
|