synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
51 lines • 3.26 kB
TypeScript
import { EntityType } from '@sage-bionetworks/synapse-client';
import { Dataset, DatasetCollection, Entity, Entity as Entity_OpenAPI, ENTITY_CONCRETE_TYPE, EntityHeader, EntityView, Hit, MaterializedView, ProjectHeader, SubmissionView, Table, TableEntity, VersionableEntity, View } from '@sage-bionetworks/synapse-types';
export declare function getEntityTypeFromHeader(header: Pick<EntityHeader, 'name' | 'id' | 'type'> | EntityHeader | ProjectHeader | Hit): EntityType;
export declare function isContainerType(type: EntityType): boolean;
export declare function isTableType(type: EntityType): boolean;
export declare function entityTypeToFriendlyName(entityType: EntityType): string;
export declare function convertToEntityType(typeString: string | ENTITY_CONCRETE_TYPE | EntityType): EntityType;
export declare function convertToConcreteEntityType(type: EntityType): Entity_OpenAPI['concreteType'];
/**
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/VersionableEntity.html
* @param type
* @returns
*/
export declare function isVersionableEntityType(type: EntityType): boolean;
export declare const isTable: (object: Entity) => object is Table;
export declare const isView: (object: Entity) => object is View;
export declare const isTableEntity: (object: Entity) => object is TableEntity;
export declare const isSubmissionView: (object: Entity) => object is SubmissionView;
export declare const isMaterializedView: (object: Entity) => object is MaterializedView;
export declare const isDataset: (object: Entity) => object is Dataset;
export declare const isDatasetCollection: (object: Entity) => object is DatasetCollection;
export declare const isEntityRefCollectionView: (entity: Entity) => entity is Dataset | DatasetCollection;
export declare const isEntityView: (object: Entity) => object is EntityView;
/**
* @param entityView
* @returns true iff the viewTypeMask allows files to appear in the view
*/
export declare function hasFilesInView(entityView: EntityView): boolean;
/**
* @param entityView
* @returns true iff the viewTypeMask allows only files to appear in the view
*/
export declare function isFileView(entityView: EntityView): boolean;
export declare function isVersionableEntity(entity: Entity): entity is VersionableEntity;
export declare function getVersionDisplay(entity: Entity): string;
/**
* Given an entityId, returns the entity ID with the `syn` prefix.
* If the entity already has the `syn` prefix, the entityId will not be changed
* @param entityId
*/
export declare function normalizeSynPrefix(entityId: string): string;
/**
* A string array of all possible keys used by Synapse in Entity objects (objects that inherit this interface: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Entity.html).
* This object is used to determine which fields are standard and which are annotations,
* so it's important that this object contains all keys in the objects that implement the linked interface above.
*/
export declare const entityJsonKeys: Record<ENTITY_CONCRETE_TYPE, string[]>;
type EntityTypeGroupKey = 'ALL_TABLES' | 'CONTAINER';
export declare const EntityTypeGroup: Record<EntityTypeGroupKey, EntityType[]>;
export {};
//# sourceMappingURL=EntityTypeUtils.d.ts.map