Skip to content

Commit

Permalink
Run rustfmt again
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDiekmann committed Sep 24, 2024
1 parent e14dc8f commit 074bcbf
Show file tree
Hide file tree
Showing 336 changed files with 4,496 additions and 5,658 deletions.
4 changes: 2 additions & 2 deletions apps/hash-graph/bins/cli/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use clap::{
ColorChoice, CommandFactory, FromArgMatches, Parser,
builder::{
styling::{AnsiColor, Effects},
Styles,
styling::{AnsiColor, Effects},
},
ColorChoice, CommandFactory, FromArgMatches, Parser,
};
use hash_tracing::TracingConfig;

Expand Down
16 changes: 8 additions & 8 deletions apps/hash-graph/bins/cli/src/subcommand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ mod type_fetcher;

use core::time::Duration;

use error_stack::{ensure, Result};
use hash_tracing::{init_tracing, TracingConfig};
use error_stack::{Result, ensure};
use hash_tracing::{TracingConfig, init_tracing};
use tokio::{runtime::Handle, time::sleep};

#[cfg(feature = "test-server")]
pub use self::test_server::{test_server, TestServerArgs};
pub use self::test_server::{TestServerArgs, test_server};
pub use self::{
completions::{completions, CompletionsArgs},
migrate::{migrate, MigrateArgs},
server::{server, ServerArgs},
snapshot::{snapshot, SnapshotArgs},
type_fetcher::{type_fetcher, TypeFetcherArgs},
completions::{CompletionsArgs, completions},
migrate::{MigrateArgs, migrate},
server::{ServerArgs, server},
snapshot::{SnapshotArgs, snapshot},
type_fetcher::{TypeFetcherArgs, type_fetcher},
};
use crate::error::{GraphError, HealthcheckError};

Expand Down
4 changes: 2 additions & 2 deletions apps/hash-graph/bins/cli/src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use core::{
};

use authorization::{
AuthorizationApi, NoAuthorization,
backend::{SpiceDbOpenApi, ZanzibarBackend},
zanzibar::ZanzibarClient,
AuthorizationApi, NoAuthorization,
};
use clap::Parser;
use error_stack::{Report, Result, ResultExt};
Expand All @@ -19,7 +19,7 @@ use graph::{
DatabaseConnectionInfo, DatabasePoolConfig, FetchingPool, PostgresStorePool, StorePool,
},
};
use graph_api::rest::{rest_api_router, RestRouterDependencies};
use graph_api::rest::{RestRouterDependencies, rest_api_router};
use regex::Regex;
use reqwest::{Client, Url};
use temporal_client::TemporalClientConfig;
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/bins/cli/src/subcommand/snapshot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use authorization::{
AuthorizationApi, NoAuthorization,
backend::{SpiceDbOpenApi, ZanzibarBackend},
zanzibar::ZanzibarClient,
AuthorizationApi, NoAuthorization,
};
use clap::Parser;
use error_stack::{Report, ResultExt};
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/bins/cli/src/subcommand/test_server.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::{net::SocketAddr, time::Duration};

use authorization::{
AuthorizationApi,
backend::{SpiceDbOpenApi, ZanzibarBackend},
zanzibar::ZanzibarClient,
AuthorizationApi,
};
use clap::Parser;
use error_stack::{Result, ResultExt};
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/bins/cli/src/subcommand/type_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::time::Duration;

use clap::Parser;
use error_stack::{Result, ResultExt};
use futures::{future, StreamExt};
use futures::{StreamExt, future};
use tarpc::{
serde_transport::Transport,
server::{self, Channel},
Expand Down
6 changes: 3 additions & 3 deletions apps/hash-graph/libs/api/src/rest/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
use alloc::sync::Arc;

use authorization::{
AuthorizationApi, AuthorizationApiPool,
backend::ModifyRelationshipOperation,
schema::{
AccountGroupMemberSubject, AccountGroupPermission, AccountGroupRelationAndSubject,
WebOwnerSubject,
},
zanzibar::Consistency,
AuthorizationApi, AuthorizationApiPool,
};
use axum::{
Extension, Router,
extract::Path,
http::StatusCode,
response::Response,
routing::{get, post},
Extension, Router,
};
use graph::store::StorePool;
use graph_types::{
Expand All @@ -29,7 +29,7 @@ use utoipa::OpenApi;

use super::api_resource::RoutedResource;
use crate::rest::{
json::Json, status::report_to_response, AuthenticatedUserHeader, PermissionResponse,
AuthenticatedUserHeader, PermissionResponse, json::Json, status::report_to_response,
};

#[derive(OpenApi)]
Expand Down
48 changes: 21 additions & 27 deletions apps/hash-graph/libs/api/src/rest/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ use alloc::sync::Arc;
use std::collections::HashMap;

use authorization::{
AuthorizationApi, AuthorizationApiPool,
backend::{ModifyRelationshipOperation, PermissionAssertion},
schema::{
DataTypeOwnerSubject, DataTypePermission, DataTypeRelationAndSubject, DataTypeViewerSubject,
},
zanzibar::Consistency,
AuthorizationApi, AuthorizationApiPool,
};
use axum::{
Extension, Router,
extract::Path,
http::StatusCode,
response::Response,
routing::{get, post, put},
Extension, Router,
};
use error_stack::{Report, ResultExt};
use graph::{
Expand All @@ -25,13 +25,13 @@ use graph::{
patch_id_and_parse,
},
store::{
BaseUrlAlreadyExists, DataTypeStore, OntologyVersionDoesNotExist, StorePool,
error::VersionedUrlAlreadyExists,
ontology::{
ArchiveDataTypeParams, CreateDataTypeParams, GetDataTypeSubgraphParams,
GetDataTypesParams, GetDataTypesResponse, UnarchiveDataTypeParams,
UpdateDataTypeEmbeddingParams, UpdateDataTypesParams,
},
BaseUrlAlreadyExists, DataTypeStore, OntologyVersionDoesNotExist, StorePool,
},
};
use graph_types::{
Expand All @@ -42,7 +42,7 @@ use graph_types::{
},
owned_by_id::OwnedById,
};
use hash_graph_store::{data_type::DataTypeQueryToken, ConflictBehavior};
use hash_graph_store::{ConflictBehavior, data_type::DataTypeQueryToken};
use hash_status::Status;
use serde::{Deserialize, Serialize};
use temporal_client::TemporalClient;
Expand All @@ -58,10 +58,10 @@ use utoipa::{OpenApi, ToSchema};

use super::api_resource::RoutedResource;
use crate::rest::{
AuthenticatedUserHeader, PermissionResponse, RestApiStore,
json::Json,
status::{report_to_response, status_to_response},
utoipa_typedef::{subgraph::Subgraph, ListOrValue, MaybeListOfDataType},
AuthenticatedUserHeader, PermissionResponse, RestApiStore,
utoipa_typedef::{ListOrValue, MaybeListOfDataType, subgraph::Subgraph},
};

#[derive(OpenApi)]
Expand Down Expand Up @@ -372,19 +372,16 @@ where

Ok(Json(
store
.create_data_type(
actor_id,
CreateDataTypeParams {
schema,
classification: OntologyTypeClassificationMetadata::External {
fetched_at: OffsetDateTime::now_utc(),
},
relationships,
conflict_behavior: ConflictBehavior::Fail,
provenance: *provenance,
conversions: conversions.clone(),
.create_data_type(actor_id, CreateDataTypeParams {
schema,
classification: OntologyTypeClassificationMetadata::External {
fetched_at: OffsetDateTime::now_utc(),
},
)
relationships,
conflict_behavior: ConflictBehavior::Fail,
provenance: *provenance,
conversions: conversions.clone(),
})
.await
.map_err(report_to_response)?,
))
Expand Down Expand Up @@ -601,15 +598,12 @@ where
})?;

store
.update_data_type(
actor_id,
UpdateDataTypesParams {
schema: data_type,
relationships,
provenance,
conversions,
},
)
.update_data_type(actor_id, UpdateDataTypesParams {
schema: data_type,
relationships,
provenance,
conversions,
})
.await
.map_err(|report| {
tracing::error!(error=?report, "Could not update data type");
Expand Down
96 changes: 45 additions & 51 deletions apps/hash-graph/libs/api/src/rest/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,38 @@ use alloc::sync::Arc;
use std::collections::HashMap;

use authorization::{
AuthorizationApi, AuthorizationApiPool,
backend::{ModifyRelationshipOperation, PermissionAssertion},
schema::{
EntityAdministratorSubject, EntityEditorSubject, EntityOwnerSubject, EntityPermission,
EntityRelationAndSubject, EntitySetting, EntitySettingSubject, EntitySubjectSet,
EntityViewerSubject, WebOwnerSubject,
},
zanzibar::Consistency,
AuthorizationApi, AuthorizationApiPool,
};
use axum::{
Extension, Router,
extract::Path,
http::StatusCode,
response::Response,
routing::{get, post},
Extension, Router,
};
use error_stack::{Report, ResultExt};
use graph::store::{
EntityQueryCursor, EntityQuerySorting, EntityQuerySortingRecord, EntityStore,
EntityValidationType, NullOrdering, Ordering, StorePool,
error::{EntityDoesNotExist, RaceConditionOnUpdate},
knowledge::{
CountEntitiesParams, CreateEntityRequest, DiffEntityParams, DiffEntityResult,
GetEntitiesParams, GetEntitiesResponse, GetEntitySubgraphParams, PatchEntityParams,
QueryConversion, UpdateEntityEmbeddingsParams, ValidateEntityParams,
},
EntityQueryCursor, EntityQuerySorting, EntityQuerySortingRecord, EntityStore,
EntityValidationType, NullOrdering, Ordering, StorePool,
};
use graph_types::{
Embedding,
account::{CreatedById, EditionCreatedById},
knowledge::{
Confidence, EntityTypeIdDiff,
entity::{
ActorType, Entity, EntityEditionId, EntityEditionProvenance, EntityEmbedding, EntityId,
EntityMetadata, EntityProvenance, EntityRecordId, EntityTemporalMetadata, EntityUuid,
Expand All @@ -48,10 +50,8 @@ use graph_types::{
PropertyWithMetadataArray, PropertyWithMetadataObject, PropertyWithMetadataValue,
ValueMetadata,
},
Confidence, EntityTypeIdDiff,
},
owned_by_id::OwnedById,
Embedding,
};
use hash_graph_store::{
account::AccountStore,
Expand All @@ -66,8 +66,8 @@ use utoipa::{OpenApi, ToSchema};
use validation::ValidateEntityComponents;

use crate::rest::{
api_resource::RoutedResource, json::Json, status::report_to_response,
utoipa_typedef::subgraph::Subgraph, AuthenticatedUserHeader, PermissionResponse,
AuthenticatedUserHeader, PermissionResponse, api_resource::RoutedResource, json::Json,
status::report_to_response, utoipa_typedef::subgraph::Subgraph,
};

#[derive(OpenApi)]
Expand Down Expand Up @@ -597,27 +597,24 @@ where
.map_err(Report::from)
.map_err(report_to_response)?;
store
.get_entities(
actor_id,
GetEntitiesParams {
filter: request.filter,
sorting: generate_sorting_paths(
request.sorting_paths,
request.limit,
request.cursor,
&request.temporal_axes,
),
limit: request.limit,
conversions: request.conversions,
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,
},
)
.get_entities(actor_id, GetEntitiesParams {
filter: request.filter,
sorting: generate_sorting_paths(
request.sorting_paths,
request.limit,
request.cursor,
&request.temporal_axes,
),
limit: request.limit,
conversions: request.conversions,
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
.map(|response| {
Json(GetEntitiesResponse {
Expand Down Expand Up @@ -735,28 +732,25 @@ where
.map_err(Report::from)
.map_err(report_to_response)?;
store
.get_entity_subgraph(
actor_id,
GetEntitySubgraphParams {
filter: request.filter,
sorting: generate_sorting_paths(
request.sorting_paths,
request.limit,
request.cursor,
&request.temporal_axes,
),
limit: request.limit,
conversions: request.conversions,
graph_resolve_depths: request.graph_resolve_depths,
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,
},
)
.get_entity_subgraph(actor_id, GetEntitySubgraphParams {
filter: request.filter,
sorting: generate_sorting_paths(
request.sorting_paths,
request.limit,
request.cursor,
&request.temporal_axes,
),
limit: request.limit,
conversions: request.conversions,
graph_resolve_depths: request.graph_resolve_depths,
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
.map(|response| {
Json(GetEntitySubgraphResponse {
Expand Down
Loading

0 comments on commit 074bcbf

Please sign in to comment.