import type { EntityRootType, Subgraph, SubgraphTemporalAxes } from "../../types.js"; import type { DataTypeWithMetadata, Entity, EntityRecordId, EntityTypeWithMetadata, OntologyTypeRecordId, PropertyTypeWithMetadata } from "@blockprotocol/type-system"; /** * Builds a {@link Subgraph} from a given set of graph elements. * * The sets of elements should represent the result of a query on a graph. * The 'roots' and 'depths' used for that query should be provided along with the data. * * The maximum value for any single depth is 255. * * This function does NOT verify that the provided depths are accurate for the data. * This function does NOT verify if provided temporal axes are accurate for the data. * - the caller is responsible for both of the above. * It DOES check that the provided roots are present in the data. * * @param data – the data to build the subgraph from (which becomes the vertices) * @param data.dataTypes – the data types to include in the subgraph * @param data.propertyTypes – the property types to include in the subgraph * @param data.entityTypes – the entity types to include in the subgraph * @param data.entities – the entities to include in the subgraph * @param depths – the depth values to provide in the returned subgraph * @param rootRecordIds – the {@link EntityRecordId}s and {@link OntologyTypeRecordId}s of the root elements to provide * in the returned subgraph * @param {SubgraphTemporalAxes} subgraphTemporalAxes - the sets of temporal axes that were used when originally * selecting the provided data * * @returns a Subgraph containing: * - 'vertices' containing the provided entities * - 'edges' calculated by the function, representing connections between vertices * - 'depths' as provided by the caller * - 'roots' as provided by the caller * - 'temporalAxes' where both the `initial` and `resolved` are as provided by the caller * * @throws if the provided roots are not present in the data */ export declare const buildSubgraph: (data: { entities: Entity[]; entityTypes: EntityTypeWithMetadata[]; propertyTypes: PropertyTypeWithMetadata[]; dataTypes: DataTypeWithMetadata[]; }, rootRecordIds: (EntityRecordId | OntologyTypeRecordId)[], subgraphTemporalAxes: SubgraphTemporalAxes) => Subgraph;