diff --git a/apps/hash-graph/libs/api/src/rest/entity.rs b/apps/hash-graph/libs/api/src/rest/entity.rs index 03867bda290..b02e1cf552c 100644 --- a/apps/hash-graph/libs/api/src/rest/entity.rs +++ b/apps/hash-graph/libs/api/src/rest/entity.rs @@ -1,6 +1,7 @@ //! Web routes for CRU operations on entities. use alloc::sync::Arc; +use std::collections::HashMap; use authorization::{ backend::{ModifyRelationshipOperation, PermissionAssertion}, @@ -36,6 +37,7 @@ use graph::{ subgraph::{edges::GraphResolveDepths, temporal_axes::QueryTemporalAxesUnresolved}, }; use graph_types::{ + account::{CreatedById, EditionCreatedById}, knowledge::{ entity::{ ActorType, Entity, EntityEditionId, EntityEditionProvenance, EntityEmbedding, EntityId, @@ -58,6 +60,7 @@ use graph_types::{ }; use serde::{Deserialize, Serialize}; use temporal_client::TemporalClient; +use type_system::url::VersionedUrl; use utoipa::{OpenApi, ToSchema}; use validation::ValidateEntityComponents; @@ -483,6 +486,10 @@ fn generate_sorting_paths( #[derive(Debug, Deserialize, ToSchema)] #[serde(rename_all = "camelCase", deny_unknown_fields)] +#[expect( + clippy::struct_excessive_bools, + reason = "Parameter struct deserialized from JSON" +)] struct GetEntitiesRequest<'q, 's, 'p> { #[serde(borrow)] filter: Filter<'q, Entity>, @@ -495,6 +502,14 @@ struct GetEntitiesRequest<'q, 's, 'p> { cursor: Option>, #[serde(default)] include_count: bool, + #[serde(default)] + include_web_ids: bool, + #[serde(default)] + include_created_by_ids: bool, + #[serde(default)] + include_edition_created_by_ids: bool, + #[serde(default)] + include_type_ids: bool, } #[utoipa::path( @@ -564,6 +579,10 @@ where include_drafts: request.include_drafts, include_count: request.include_count, temporal_axes: request.temporal_axes, + include_web_ids: request.include_web_ids, + include_created_by_ids: request.include_created_by_ids, + include_edition_created_by_ids: request.include_edition_created_by_ids, + include_type_ids: request.include_type_ids, }, ) .await @@ -572,6 +591,10 @@ where entities: response.entities, cursor: response.cursor.map(EntityQueryCursor::into_owned), count: response.count, + web_ids: response.web_ids, + created_by_ids: response.created_by_ids, + edition_created_by_ids: response.edition_created_by_ids, + type_ids: response.type_ids, }) }) .map_err(report_to_response) @@ -579,6 +602,10 @@ where #[derive(Debug, Deserialize, ToSchema)] #[serde(rename_all = "camelCase", deny_unknown_fields)] +#[expect( + clippy::struct_excessive_bools, + reason = "Parameter struct deserialized from JSON" +)] struct GetEntitySubgraphRequest<'q, 's, 'p> { #[serde(borrow)] filter: Filter<'q, Entity>, @@ -592,6 +619,14 @@ struct GetEntitySubgraphRequest<'q, 's, 'p> { cursor: Option>, #[serde(default)] include_count: bool, + #[serde(default)] + include_web_ids: bool, + #[serde(default)] + include_created_by_ids: bool, + #[serde(default)] + include_edition_created_by_ids: bool, + #[serde(default)] + include_type_ids: bool, } #[derive(Serialize, ToSchema)] @@ -601,6 +636,18 @@ struct GetEntitySubgraphResponse<'r> { #[serde(borrow)] cursor: Option>, count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + web_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + created_by_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + edition_created_by_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + type_ids: Option>, } #[utoipa::path( @@ -672,6 +719,10 @@ where include_drafts: request.include_drafts, include_count: request.include_count, temporal_axes: request.temporal_axes, + include_web_ids: request.include_web_ids, + include_created_by_ids: request.include_created_by_ids, + include_edition_created_by_ids: request.include_edition_created_by_ids, + include_type_ids: request.include_type_ids, }, ) .await @@ -680,6 +731,10 @@ where subgraph: response.subgraph.into(), cursor: response.cursor.map(EntityQueryCursor::into_owned), count: response.count, + web_ids: response.web_ids, + created_by_ids: response.created_by_ids, + edition_created_by_ids: response.edition_created_by_ids, + type_ids: response.type_ids, }) }) .map_err(report_to_response) diff --git a/apps/hash-graph/libs/api/src/rest/entity_type.rs b/apps/hash-graph/libs/api/src/rest/entity_type.rs index 3440fb9cf68..3fe28bf762e 100644 --- a/apps/hash-graph/libs/api/src/rest/entity_type.rs +++ b/apps/hash-graph/libs/api/src/rest/entity_type.rs @@ -38,6 +38,7 @@ use graph::{ subgraph::identifier::EntityTypeVertexId, }; use graph_types::{ + account::EditionCreatedById, ontology::{ EntityTypeEmbedding, EntityTypeId, EntityTypeMetadata, EntityTypeWithMetadata, OntologyTemporalMetadata, OntologyTypeClassificationMetadata, OntologyTypeMetadata, @@ -749,6 +750,13 @@ where struct GetEntityTypeSubgraphResponse { subgraph: Subgraph, cursor: Option, + count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + web_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[schema(nullable = false)] + edition_created_by_ids: Option>, } #[utoipa::path( @@ -809,6 +817,9 @@ where Json(GetEntityTypeSubgraphResponse { subgraph: Subgraph::from(response.subgraph), cursor: response.cursor, + count: response.count, + web_ids: response.web_ids, + edition_created_by_ids: response.edition_created_by_ids, }) }) } diff --git a/apps/hash-graph/libs/graph/src/store/fetcher.rs b/apps/hash-graph/libs/graph/src/store/fetcher.rs index 931e8b239a0..4cfeec48a2f 100644 --- a/apps/hash-graph/libs/graph/src/store/fetcher.rs +++ b/apps/hash-graph/libs/graph/src/store/fetcher.rs @@ -302,6 +302,8 @@ where limit: None, include_drafts: true, include_count: false, + include_web_ids: false, + include_edition_created_by_ids: false, }, ) .await diff --git a/apps/hash-graph/libs/graph/src/store/knowledge.rs b/apps/hash-graph/libs/graph/src/store/knowledge.rs index a32e80e21dd..6ed14465f25 100644 --- a/apps/hash-graph/libs/graph/src/store/knowledge.rs +++ b/apps/hash-graph/libs/graph/src/store/knowledge.rs @@ -1,12 +1,12 @@ use alloc::borrow::Cow; use core::{error::Error, fmt}; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use authorization::{schema::EntityRelationAndSubject, zanzibar::Consistency}; use error_stack::Report; use futures::TryFutureExt; use graph_types::{ - account::AccountId, + account::{AccountId, CreatedById, EditionCreatedById}, knowledge::{ entity::{Entity, EntityEmbedding, EntityId, EntityUuid, ProvidedEntityEditionProvenance}, link::LinkData, @@ -216,19 +216,19 @@ pub struct ValidateEntityParams<'a> { pub components: ValidateEntityComponents, } -#[derive(Debug, Deserialize)] -#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[derive(Debug)] +#[expect(clippy::struct_excessive_bools, reason = "Parameter struct")] pub struct GetEntitiesParams<'a> { - #[serde(borrow)] pub filter: Filter<'a, Entity>, pub temporal_axes: QueryTemporalAxesUnresolved, - #[serde(borrow)] pub sorting: EntityQuerySorting<'static>, pub limit: Option, pub include_drafts: bool, - #[serde(default)] pub include_count: bool, + pub include_web_ids: bool, + pub include_created_by_ids: bool, + pub include_edition_created_by_ids: bool, + pub include_type_ids: bool, } #[derive(Debug, Serialize)] @@ -238,22 +238,34 @@ pub struct GetEntitiesResponse<'r> { pub entities: Vec, pub cursor: Option>, pub count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub web_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub created_by_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub edition_created_by_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub type_ids: Option>, } -#[derive(Debug, Deserialize)] -#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] -#[serde(rename_all = "camelCase", deny_unknown_fields)] +#[derive(Debug)] +#[expect(clippy::struct_excessive_bools, reason = "Parameter struct")] pub struct GetEntitySubgraphParams<'a> { - #[serde(borrow)] pub filter: Filter<'a, Entity>, pub temporal_axes: QueryTemporalAxesUnresolved, pub graph_resolve_depths: GraphResolveDepths, - #[serde(borrow)] pub sorting: EntityQuerySorting<'static>, pub limit: Option, pub include_drafts: bool, - #[serde(default)] pub include_count: bool, + pub include_web_ids: bool, + pub include_created_by_ids: bool, + pub include_edition_created_by_ids: bool, + pub include_type_ids: bool, } #[derive(Debug)] @@ -261,6 +273,10 @@ pub struct GetEntitySubgraphResponse<'r> { pub subgraph: Subgraph, pub cursor: Option>, pub count: Option, + pub web_ids: Option>, + pub created_by_ids: Option>, + pub edition_created_by_ids: Option>, + pub type_ids: Option>, } #[derive(Debug, Deserialize)] diff --git a/apps/hash-graph/libs/graph/src/store/ontology.rs b/apps/hash-graph/libs/graph/src/store/ontology.rs index 46bdcfb2a5a..f6cef5142b3 100644 --- a/apps/hash-graph/libs/graph/src/store/ontology.rs +++ b/apps/hash-graph/libs/graph/src/store/ontology.rs @@ -7,12 +7,13 @@ use authorization::schema::{ }; use error_stack::Result; use graph_types::{ - account::AccountId, + account::{AccountId, EditionCreatedById}, ontology::{ DataTypeMetadata, DataTypeWithMetadata, EntityTypeMetadata, EntityTypeWithMetadata, OntologyTemporalMetadata, OntologyTypeClassificationMetadata, PropertyTypeMetadata, PropertyTypeWithMetadata, ProvidedOntologyEditionProvenance, }, + owned_by_id::OwnedById, Embedding, }; use serde::{Deserialize, Serialize}; @@ -534,6 +535,7 @@ pub struct CreateEntityTypeParams { #[derive(Debug, Deserialize)] #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] +#[expect(clippy::struct_excessive_bools, reason = "Parameter struct")] pub struct GetEntityTypeSubgraphParams<'p> { #[serde(borrow)] pub filter: Filter<'p, EntityTypeWithMetadata>, @@ -544,6 +546,10 @@ pub struct GetEntityTypeSubgraphParams<'p> { pub include_drafts: bool, #[serde(default)] pub include_count: bool, + #[serde(default)] + pub include_web_ids: bool, + #[serde(default)] + pub include_edition_created_by_ids: bool, } #[derive(Debug)] @@ -551,6 +557,8 @@ pub struct GetEntityTypeSubgraphResponse { pub subgraph: Subgraph, pub cursor: Option, pub count: Option, + pub web_ids: Option>, + pub edition_created_by_ids: Option>, } #[derive(Debug, Deserialize)] @@ -566,6 +574,7 @@ pub struct CountEntityTypesParams<'p> { #[derive(Debug, Deserialize)] #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] +#[expect(clippy::struct_excessive_bools, reason = "Parameter struct")] pub struct GetEntityTypesParams<'p> { #[serde(borrow)] pub filter: Filter<'p, EntityTypeWithMetadata>, @@ -577,6 +586,10 @@ pub struct GetEntityTypesParams<'p> { pub limit: Option, #[serde(default)] pub include_count: bool, + #[serde(default)] + pub include_web_ids: bool, + #[serde(default)] + pub include_edition_created_by_ids: bool, } #[derive(Debug, Serialize)] @@ -586,6 +599,12 @@ pub struct GetEntityTypesResponse { pub entity_types: Vec, pub cursor: Option, pub count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub web_ids: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[cfg_attr(feature = "utoipa", schema(nullable = false))] + pub edition_created_by_ids: Option>, } #[derive(Debug, Deserialize)] diff --git a/apps/hash-graph/libs/graph/src/store/postgres/knowledge/entity/mod.rs b/apps/hash-graph/libs/graph/src/store/postgres/knowledge/entity/mod.rs index 39b694a03cf..bf21e5989b5 100644 --- a/apps/hash-graph/libs/graph/src/store/postgres/knowledge/entity/mod.rs +++ b/apps/hash-graph/libs/graph/src/store/postgres/knowledge/entity/mod.rs @@ -67,7 +67,7 @@ use crate::{ }, InsertStatementBuilder, ReferenceTable, Table, }, - TraversalContext, + ResponseCountMap, TraversalContext, }, query::{Filter, FilterExpression, Parameter}, validation::StoreProvider, @@ -323,45 +323,85 @@ where ) -> Result<(GetEntitiesResponse<'static>, Zookie<'static>), QueryError> { let mut root_entities = Vec::new(); - let (permissions, count) = if params.include_count { - let entity_ids = Read::::read( - self, - ¶ms.filter, - Some(temporal_axes), - params.include_drafts, - ) - .await? - .map_ok(|entity| entity.metadata.record_id.entity_id) - .try_collect::>() - .await?; + let (permissions, count, web_ids, created_by_ids, edition_created_by_ids, type_ids) = + if params.include_count + || params.include_web_ids + || params.include_created_by_ids + || params.include_edition_created_by_ids + || params.include_type_ids + { + let mut web_ids = params.include_web_ids.then(ResponseCountMap::default); + let mut created_by_ids = params + .include_created_by_ids + .then(ResponseCountMap::default); + let mut edition_created_by_ids = params + .include_edition_created_by_ids + .then(ResponseCountMap::default); + let mut include_type_ids = params.include_type_ids.then(ResponseCountMap::default); + + let entity_ids = Read::::read( + self, + ¶ms.filter, + Some(temporal_axes), + params.include_drafts, + ) + .await? + .map_ok(|entity| { + if let Some(web_ids) = &mut web_ids { + web_ids.increment(&entity.metadata.record_id.entity_id.owned_by_id); + } + if let Some(created_by_ids) = &mut created_by_ids { + created_by_ids + .increment(&entity.metadata.provenance.inferred.created_by_id); + } + if let Some(edition_created_by_ids) = &mut edition_created_by_ids { + edition_created_by_ids + .increment(&entity.metadata.provenance.edition.created_by_id); + } + if let Some(include_type_ids) = &mut include_type_ids { + for entity_type_id in &entity.metadata.entity_type_ids { + include_type_ids.increment(entity_type_id); + } + } + entity.metadata.record_id.entity_id + }) + .try_collect::>() + .await?; - let span = tracing::trace_span!("post_filter_entities"); - let _s = span.enter(); + let span = tracing::trace_span!("post_filter_entities"); + let _s = span.enter(); - let (permissions, zookie) = self - .authorization_api - .check_entities_permission( - actor_id, - EntityPermission::View, - entity_ids.iter().copied(), - Consistency::FullyConsistent, - ) - .await - .change_context(QueryError)?; + let (permissions, zookie) = self + .authorization_api + .check_entities_permission( + actor_id, + EntityPermission::View, + entity_ids.iter().copied(), + Consistency::FullyConsistent, + ) + .await + .change_context(QueryError)?; - let permitted_ids = permissions - .into_iter() - .filter_map(|(entity_id, has_permission)| has_permission.then_some(entity_id)) - .collect::>(); + let permitted_ids = permissions + .into_iter() + .filter_map(|(entity_id, has_permission)| has_permission.then_some(entity_id)) + .collect::>(); - let count = entity_ids - .into_iter() - .filter(|id| permitted_ids.contains(&id.entity_uuid)) - .count(); - (Some((permitted_ids, zookie)), Some(count)) - } else { - (None, None) - }; + let count = entity_ids + .into_iter() + .filter(|id| permitted_ids.contains(&id.entity_uuid)) + .count(); + ( + Some((permitted_ids, zookie)), + Some(count), + web_ids.map(HashMap::from), + created_by_ids.map(HashMap::from), + edition_created_by_ids.map(HashMap::from), + include_type_ids.map(HashMap::from), + ) + } else { + (None, None, None, None, None, None) + }; let (latest_zookie, last) = loop { // We query one more than requested to determine if there are more entities to return. @@ -463,6 +503,10 @@ where .collect(), cursor: last, count, + web_ids, + created_by_ids, + edition_created_by_ids, + type_ids, }, latest_zookie.into_owned(), )) @@ -943,6 +987,10 @@ where entities: root_entities, cursor, count, + web_ids, + created_by_ids, + edition_created_by_ids, + type_ids, }, zookie, ) = self @@ -955,6 +1003,10 @@ where limit: params.limit, include_drafts: params.include_drafts, include_count: false, + include_web_ids: params.include_web_ids, + include_created_by_ids: params.include_created_by_ids, + include_edition_created_by_ids: params.include_edition_created_by_ids, + include_type_ids: params.include_type_ids, }, &temporal_axes, ) @@ -1011,6 +1063,10 @@ where subgraph, cursor, count, + web_ids, + created_by_ids, + edition_created_by_ids, + type_ids, }) } diff --git a/apps/hash-graph/libs/graph/src/store/postgres/mod.rs b/apps/hash-graph/libs/graph/src/store/postgres/mod.rs index 424d250cd65..3fce5cd6b83 100644 --- a/apps/hash-graph/libs/graph/src/store/postgres/mod.rs +++ b/apps/hash-graph/libs/graph/src/store/postgres/mod.rs @@ -7,7 +7,8 @@ pub(crate) mod query; mod traversal_context; use alloc::sync::Arc; -use core::fmt::Debug; +use core::{fmt::Debug, hash::Hash}; +use std::collections::HashMap; use async_trait::async_trait; use authorization::{ @@ -71,6 +72,43 @@ enum OntologyLocation { External, } +#[derive(Debug)] +pub struct ResponseCountMap { + map: HashMap, +} + +impl Default for ResponseCountMap { + fn default() -> Self { + Self { + map: HashMap::new(), + } + } +} + +impl ResponseCountMap +where + T: Eq + Hash + Clone, +{ + pub fn increment(&mut self, key: &T) { + *self + .map + .raw_entry_mut() + .from_key(key) + .or_insert(key.clone(), 0) + .1 += 1; + } +} + +#[expect( + clippy::implicit_hasher, + reason = "The hasher should not be exposed from `ResponseCountMap`" +)] +impl From> for HashMap { + fn from(map: ResponseCountMap) -> Self { + map.map + } +} + impl PostgresStore where C: AsClient, diff --git a/apps/hash-graph/libs/graph/src/store/postgres/ontology/entity_type.rs b/apps/hash-graph/libs/graph/src/store/postgres/ontology/entity_type.rs index 55f5d93fcd4..0402d7ea141 100644 --- a/apps/hash-graph/libs/graph/src/store/postgres/ontology/entity_type.rs +++ b/apps/hash-graph/libs/graph/src/store/postgres/ontology/entity_type.rs @@ -49,7 +49,7 @@ use crate::{ PostgresOntologyTypeClassificationMetadata, }, query::{Distinctness, PostgresRecord, ReferenceTable, SelectCompiler, Table}, - TraversalContext, + ResponseCountMap, TraversalContext, }, query::{Filter, FilterExpression, ParameterList}, AsClient, EntityTypeStore, InsertionError, PostgresStore, QueryError, SubgraphRecord, @@ -111,27 +111,74 @@ where })) } + #[expect(clippy::too_many_lines)] async fn get_entity_types_impl( &self, actor_id: AccountId, params: GetEntityTypesParams<'_>, temporal_axes: &QueryTemporalAxes, ) -> Result<(GetEntityTypesResponse, Zookie<'static>), QueryError> { - #[expect(clippy::if_then_some_else_none, reason = "Function is async")] - let count = if params.include_count { - Some( - self.count_entity_types( + let (count, web_ids, edition_created_by_ids) = if params.include_count + || params.include_web_ids + || params.include_edition_created_by_ids + { + let mut web_ids = params.include_web_ids.then(ResponseCountMap::default); + let mut edition_created_by_ids = params + .include_edition_created_by_ids + .then(ResponseCountMap::default); + + let entity_ids = Read::::read( + self, + ¶ms.filter, + Some(temporal_axes), + params.include_drafts, + ) + .await? + .map_ok(|entity_type| { + if let (Some(web_ids), OntologyTypeClassificationMetadata::Owned { owned_by_id }) = + (&mut web_ids, &entity_type.metadata.classification) + { + web_ids.increment(owned_by_id); + } + if let Some(edition_created_by_ids) = &mut edition_created_by_ids { + edition_created_by_ids + .increment(&entity_type.metadata.provenance.edition.created_by_id); + } + EntityTypeId::from_record_id(&entity_type.metadata.record_id) + }) + .try_collect::>() + .await?; + + let span = tracing::trace_span!("post_filter_entities"); + let _s = span.enter(); + + let (permissions, _zookie) = self + .authorization_api + .check_entity_types_permission( actor_id, - CountEntityTypesParams { - filter: params.filter.clone(), - temporal_axes: params.temporal_axes.clone(), - include_drafts: params.include_drafts, - }, + EntityTypePermission::View, + entity_ids.iter().copied(), + Consistency::FullyConsistent, ) - .await?, + .await + .change_context(QueryError)?; + + let permitted_ids = permissions + .into_iter() + .filter_map(|(entity_id, has_permission)| has_permission.then_some(entity_id)) + .collect::>(); + + let count = entity_ids + .into_iter() + .filter(|id| permitted_ids.contains(id)) + .count(); + ( + Some(count), + web_ids.map(HashMap::from), + edition_created_by_ids.map(HashMap::from), ) } else { - None + (None, None, None) }; // TODO: Remove again when subgraph logic was revisited @@ -198,6 +245,8 @@ where }, entity_types, count, + web_ids, + edition_created_by_ids, }, zookie, )) @@ -749,6 +798,8 @@ where entity_types, cursor, count, + web_ids, + edition_created_by_ids, }, zookie, ) = self @@ -761,6 +812,8 @@ where limit: params.limit, include_drafts: params.include_drafts, include_count: params.include_count, + include_web_ids: params.include_web_ids, + include_edition_created_by_ids: params.include_edition_created_by_ids, }, &temporal_axes, ) @@ -817,6 +870,8 @@ where subgraph, cursor, count, + web_ids, + edition_created_by_ids, }) } diff --git a/apps/hash-graph/openapi/openapi.json b/apps/hash-graph/openapi/openapi.json index e99629a351b..f853517d949 100644 --- a/apps/hash-graph/openapi/openapi.json +++ b/apps/hash-graph/openapi/openapi.json @@ -5162,9 +5162,21 @@ "includeCount": { "type": "boolean" }, + "includeCreatedByIds": { + "type": "boolean" + }, "includeDrafts": { "type": "boolean" }, + "includeEditionCreatedByIds": { + "type": "boolean" + }, + "includeTypeIds": { + "type": "boolean" + }, + "includeWebIds": { + "type": "boolean" + }, "limit": { "type": "integer", "nullable": true, @@ -5194,6 +5206,13 @@ "nullable": true, "minimum": 0 }, + "createdByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "cursor": { "allOf": [ { @@ -5202,11 +5221,32 @@ ], "nullable": true }, + "editionCreatedByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "entities": { "type": "array", "items": { "$ref": "#/components/schemas/Entity" } + }, + "typeIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, + "webIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } } } }, @@ -5236,9 +5276,21 @@ "includeCount": { "type": "boolean" }, + "includeCreatedByIds": { + "type": "boolean" + }, "includeDrafts": { "type": "boolean" }, + "includeEditionCreatedByIds": { + "type": "boolean" + }, + "includeTypeIds": { + "type": "boolean" + }, + "includeWebIds": { + "type": "boolean" + }, "limit": { "type": "integer", "nullable": true, @@ -5268,6 +5320,13 @@ "nullable": true, "minimum": 0 }, + "createdByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "cursor": { "allOf": [ { @@ -5276,8 +5335,29 @@ ], "nullable": true }, + "editionCreatedByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "subgraph": { "$ref": "#/components/schemas/Subgraph" + }, + "typeIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, + "webIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } } } }, @@ -5310,6 +5390,12 @@ "includeDrafts": { "type": "boolean" }, + "includeEditionCreatedByIds": { + "type": "boolean" + }, + "includeWebIds": { + "type": "boolean" + }, "limit": { "type": "integer", "nullable": true, @@ -5327,6 +5413,11 @@ "subgraph" ], "properties": { + "count": { + "type": "integer", + "nullable": true, + "minimum": 0 + }, "cursor": { "allOf": [ { @@ -5335,8 +5426,22 @@ ], "nullable": true }, + "editionCreatedByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "subgraph": { "$ref": "#/components/schemas/Subgraph" + }, + "webIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } } } }, @@ -5365,6 +5470,12 @@ "includeDrafts": { "type": "boolean" }, + "includeEditionCreatedByIds": { + "type": "boolean" + }, + "includeWebIds": { + "type": "boolean" + }, "limit": { "type": "integer", "nullable": true, @@ -5395,11 +5506,25 @@ ], "nullable": true }, + "editionCreatedByIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } + }, "entityTypes": { "type": "array", "items": { "$ref": "#/components/schemas/EntityTypeWithMetadata" } + }, + "webIds": { + "type": "object", + "additionalProperties": { + "type": "integer", + "minimum": 0 + } } } }, diff --git a/tests/hash-graph-benches/read_scaling/knowledge/complete/entity.rs b/tests/hash-graph-benches/read_scaling/knowledge/complete/entity.rs index 31052b508d9..5c574d2ab76 100644 --- a/tests/hash-graph-benches/read_scaling/knowledge/complete/entity.rs +++ b/tests/hash-graph-benches/read_scaling/knowledge/complete/entity.rs @@ -231,6 +231,10 @@ pub fn bench_get_entity_by_id( limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-benches/read_scaling/knowledge/linkless/entity.rs b/tests/hash-graph-benches/read_scaling/knowledge/linkless/entity.rs index a8823154bec..39c908ab0f0 100644 --- a/tests/hash-graph-benches/read_scaling/knowledge/linkless/entity.rs +++ b/tests/hash-graph-benches/read_scaling/knowledge/linkless/entity.rs @@ -172,6 +172,10 @@ pub fn bench_get_entity_by_id( limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-benches/representative_read/knowledge/entity.rs b/tests/hash-graph-benches/representative_read/knowledge/entity.rs index 88bc799ed85..a9c8ff6d5c3 100644 --- a/tests/hash-graph-benches/representative_read/knowledge/entity.rs +++ b/tests/hash-graph-benches/representative_read/knowledge/entity.rs @@ -61,6 +61,10 @@ pub fn bench_get_entity_by_id( limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -112,6 +116,10 @@ pub fn bench_get_entities_by_property( limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -165,6 +173,10 @@ pub fn bench_get_link_by_target_by_property( limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-benches/representative_read/ontology/entity_type.rs b/tests/hash-graph-benches/representative_read/ontology/entity_type.rs index 7df0369067f..4625ce08ca7 100644 --- a/tests/hash-graph-benches/representative_read/ontology/entity_type.rs +++ b/tests/hash-graph-benches/representative_read/ontology/entity_type.rs @@ -46,6 +46,8 @@ pub fn bench_get_entity_type_by_id( limit: None, include_drafts: false, include_count: false, + include_web_ids: false, + include_edition_created_by_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/entity.rs b/tests/hash-graph-integration/postgres/entity.rs index 3b2db49dd6f..5d6e7b9bdb8 100644 --- a/tests/hash-graph-integration/postgres/entity.rs +++ b/tests/hash-graph-integration/postgres/entity.rs @@ -100,6 +100,10 @@ async fn insert() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -171,6 +175,10 @@ async fn query() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -284,6 +292,10 @@ async fn update() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -316,6 +328,10 @@ async fn update() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -345,6 +361,10 @@ async fn update() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/entity_type.rs b/tests/hash-graph-integration/postgres/entity_type.rs index 540716efa1c..35c9f7c98ad 100644 --- a/tests/hash-graph-integration/postgres/entity_type.rs +++ b/tests/hash-graph-integration/postgres/entity_type.rs @@ -106,6 +106,8 @@ async fn query() { limit: None, include_drafts: false, include_count: false, + include_web_ids: false, + include_edition_created_by_ids: false, }, ) .await @@ -198,6 +200,8 @@ async fn update() { limit: None, include_drafts: false, include_count: false, + include_web_ids: false, + include_edition_created_by_ids: false, }, ) .await @@ -222,6 +226,8 @@ async fn update() { limit: None, include_drafts: false, include_count: false, + include_web_ids: false, + include_edition_created_by_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/links.rs b/tests/hash-graph-integration/postgres/links.rs index 966dba28311..bc9c0c694f4 100644 --- a/tests/hash-graph-integration/postgres/links.rs +++ b/tests/hash-graph-integration/postgres/links.rs @@ -214,6 +214,10 @@ async fn insert() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -432,6 +436,10 @@ async fn get_entity_links() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/multi_type.rs b/tests/hash-graph-integration/postgres/multi_type.rs index 8f1fa359a72..73989505048 100644 --- a/tests/hash-graph-integration/postgres/multi_type.rs +++ b/tests/hash-graph-integration/postgres/multi_type.rs @@ -145,6 +145,10 @@ async fn initial_person() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -199,6 +203,10 @@ async fn initial_person() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -221,6 +229,10 @@ async fn initial_person() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -293,6 +305,10 @@ async fn create_multi() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -315,6 +331,10 @@ async fn create_multi() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -364,6 +384,10 @@ async fn create_multi() { limit: None, include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/partial_updates.rs b/tests/hash-graph-integration/postgres/partial_updates.rs index bbe7ca070dc..8b0e46e61cf 100644 --- a/tests/hash-graph-integration/postgres/partial_updates.rs +++ b/tests/hash-graph-integration/postgres/partial_updates.rs @@ -160,6 +160,10 @@ async fn properties_add() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -234,6 +238,10 @@ async fn properties_remove() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -314,6 +322,10 @@ async fn properties_replace() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -386,6 +398,10 @@ async fn type_ids() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -433,6 +449,10 @@ async fn type_ids() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await @@ -482,6 +502,10 @@ async fn type_ids() { limit: None, include_count: false, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await diff --git a/tests/hash-graph-integration/postgres/sorting.rs b/tests/hash-graph-integration/postgres/sorting.rs index 7c3047ecd67..9761636f5a3 100644 --- a/tests/hash-graph-integration/postgres/sorting.rs +++ b/tests/hash-graph-integration/postgres/sorting.rs @@ -62,6 +62,10 @@ async fn test_root_sorting( entities: new_entities, count, cursor: new_cursor, + web_ids: _, + created_by_ids: _, + edition_created_by_ids: _, + type_ids: _, } = api .get_entities( api.account_id, @@ -78,6 +82,10 @@ async fn test_root_sorting( limit: Some(chunk_size), include_count: true, include_drafts: false, + include_web_ids: false, + include_created_by_ids: false, + include_edition_created_by_ids: false, + include_type_ids: false, }, ) .await