This commit is contained in:
AlephCubed 2025-07-17 22:01:04 -07:00 committed by GitHub
commit 91f5a5fe2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 226 additions and 187 deletions

View File

@ -35,66 +35,66 @@ use crate::{
#[cfg(all(feature = "http", not(target_family = "wasm")))] #[cfg(all(feature = "http", not(target_family = "wasm")))]
use {crate::schemas::open_rpc::ServerObject, bevy_utils::default}; use {crate::schemas::open_rpc::ServerObject, bevy_utils::default};
/// The method path for a `bevy/get` request. /// The method path for a `world.get_components` request.
pub const BRP_GET_METHOD: &str = "bevy/get"; pub const BRP_GET_COMPONENTS_METHOD: &str = "world.get_components";
/// The method path for a `bevy/query` request. /// The method path for a `world.query` request.
pub const BRP_QUERY_METHOD: &str = "bevy/query"; pub const BRP_QUERY_METHOD: &str = "world.query";
/// The method path for a `bevy/spawn` request. /// The method path for a `world.spawn_entity` request.
pub const BRP_SPAWN_METHOD: &str = "bevy/spawn"; pub const BRP_SPAWN_ENTITY_METHOD: &str = "world.spawn_entity";
/// The method path for a `bevy/insert` request. /// The method path for a `world.insert_components` request.
pub const BRP_INSERT_METHOD: &str = "bevy/insert"; pub const BRP_INSERT_COMPONENTS_METHOD: &str = "world.insert_components";
/// The method path for a `bevy/remove` request. /// The method path for a `world.remove_components` request.
pub const BRP_REMOVE_METHOD: &str = "bevy/remove"; pub const BRP_REMOVE_COMPONENTS_METHOD: &str = "world.remove_components";
/// The method path for a `bevy/destroy` request. /// The method path for a `world.despawn_entity` request.
pub const BRP_DESTROY_METHOD: &str = "bevy/destroy"; pub const BRP_DESPAWN_COMPONENTS_METHOD: &str = "world.despawn_entity";
/// The method path for a `bevy/reparent` request. /// The method path for a `world.reparent_entities` request.
pub const BRP_REPARENT_METHOD: &str = "bevy/reparent"; pub const BRP_REPARENT_ENTITIES_METHOD: &str = "world.reparent_entities";
/// The method path for a `bevy/list` request. /// The method path for a `world.list_components` request.
pub const BRP_LIST_METHOD: &str = "bevy/list"; pub const BRP_LIST_COMPONENTS_METHOD: &str = "world.list_components";
/// The method path for a `bevy/mutate_component` request. /// The method path for a `world.mutate_components` request.
pub const BRP_MUTATE_COMPONENT_METHOD: &str = "bevy/mutate_component"; pub const BRP_MUTATE_COMPONENTS_METHOD: &str = "world.mutate_components";
/// The method path for a `bevy/get+watch` request. /// The method path for a `world.get_components+watch` request.
pub const BRP_GET_AND_WATCH_METHOD: &str = "bevy/get+watch"; pub const BRP_GET_COMPONENTS_AND_WATCH_METHOD: &str = "world.get_components+watch";
/// The method path for a `bevy/list+watch` request. /// The method path for a `world.list_components+watch` request.
pub const BRP_LIST_AND_WATCH_METHOD: &str = "bevy/list+watch"; pub const BRP_LIST_COMPONENTS_AND_WATCH_METHOD: &str = "world.list_components+watch";
/// The method path for a `bevy/get_resource` request. /// The method path for a `world.get_resources` request.
pub const BRP_GET_RESOURCE_METHOD: &str = "bevy/get_resource"; pub const BRP_GET_RESOURCE_METHOD: &str = "world.get_resources";
/// The method path for a `bevy/insert_resource` request. /// The method path for a `world.insert_resources` request.
pub const BRP_INSERT_RESOURCE_METHOD: &str = "bevy/insert_resource"; pub const BRP_INSERT_RESOURCE_METHOD: &str = "world.insert_resources";
/// The method path for a `bevy/remove_resource` request. /// The method path for a `world.remove_resources` request.
pub const BRP_REMOVE_RESOURCE_METHOD: &str = "bevy/remove_resource"; pub const BRP_REMOVE_RESOURCE_METHOD: &str = "world.remove_resources";
/// The method path for a `bevy/mutate_resource` request. /// The method path for a `world.mutate_resources` request.
pub const BRP_MUTATE_RESOURCE_METHOD: &str = "bevy/mutate_resource"; pub const BRP_MUTATE_RESOURCE_METHOD: &str = "world.mutate_resources";
/// The method path for a `bevy/list_resources` request. /// The method path for a `world.list_resources` request.
pub const BRP_LIST_RESOURCES_METHOD: &str = "bevy/list_resources"; pub const BRP_LIST_RESOURCES_METHOD: &str = "world.list_resources";
/// The method path for a `bevy/registry/schema` request. /// The method path for a `registry.schema` request.
pub const BRP_REGISTRY_SCHEMA_METHOD: &str = "bevy/registry/schema"; pub const BRP_REGISTRY_SCHEMA_METHOD: &str = "registry.schema";
/// The method path for a `rpc.discover` request. /// The method path for a `rpc.discover` request.
pub const RPC_DISCOVER_METHOD: &str = "rpc.discover"; pub const RPC_DISCOVER_METHOD: &str = "rpc.discover";
/// `bevy/get`: Retrieves one or more components from the entity with the given /// `world.get_components`: Retrieves one or more components from the entity with the given
/// ID. /// ID.
/// ///
/// The server responds with a [`BrpGetResponse`]. /// The server responds with a [`BrpGetComponentsResponse`].
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpGetParams { pub struct BrpGetComponentsParams {
/// The ID of the entity from which components are to be requested. /// The ID of the entity from which components are to be requested.
pub entity: Entity, pub entity: Entity,
@ -114,16 +114,16 @@ pub struct BrpGetParams {
pub strict: bool, pub strict: bool,
} }
/// `bevy/get_resource`: Retrieves the value of a given resource. /// `world.get_resources`: Retrieves the value of a given resource.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpGetResourceParams { pub struct BrpGetResourcesParams {
/// The [full path] of the resource type being requested. /// The [full path] of the resource type being requested.
/// ///
/// [full path]: bevy_reflect::TypePath::type_path /// [full path]: bevy_reflect::TypePath::type_path
pub resource: String, pub resource: String,
} }
/// `bevy/query`: Performs a query over components in the ECS, returning entities /// `world.query`: Performs a query over components in the ECS, returning entities
/// and component values that match. /// and component values that match.
/// ///
/// The server responds with a [`BrpQueryResponse`]. /// The server responds with a [`BrpQueryResponse`].
@ -143,12 +143,12 @@ pub struct BrpQueryParams {
pub strict: bool, pub strict: bool,
} }
/// `bevy/spawn`: Creates a new entity with the given components and responds /// `world.spawn_entity`: Creates a new entity with the given components and responds
/// with its ID. /// with its ID.
/// ///
/// The server responds with a [`BrpSpawnResponse`]. /// The server responds with a [`BrpSpawnEntityResponse`].
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpSpawnParams { pub struct BrpSpawnEntityParams {
/// A map from each component's full path to its serialized value. /// A map from each component's full path to its serialized value.
/// ///
/// These components will be added to the entity. /// These components will be added to the entity.
@ -161,20 +161,20 @@ pub struct BrpSpawnParams {
pub components: HashMap<String, Value>, pub components: HashMap<String, Value>,
} }
/// `bevy/destroy`: Given an ID, despawns the entity with that ID. /// `world.despawn_entity`: Given an ID, despawns the entity with that ID.
/// ///
/// The server responds with an okay. /// The server responds with an okay.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpDestroyParams { pub struct BrpDespawnEntityParams {
/// The ID of the entity to despawn. /// The ID of the entity to despawn.
pub entity: Entity, pub entity: Entity,
} }
/// `bevy/remove`: Deletes one or more components from an entity. /// `world.remove_components`: Deletes one or more components from an entity.
/// ///
/// The server responds with a null. /// The server responds with a null.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpRemoveParams { pub struct BrpRemoveComponentsParams {
/// The ID of the entity from which components are to be removed. /// The ID of the entity from which components are to be removed.
pub entity: Entity, pub entity: Entity,
@ -189,20 +189,20 @@ pub struct BrpRemoveParams {
pub components: Vec<String>, pub components: Vec<String>,
} }
/// `bevy/remove_resource`: Removes the given resource from the world. /// `world.remove_resources`: Removes the given resource from the world.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpRemoveResourceParams { pub struct BrpRemoveResourcesParams {
/// The [full path] of the resource type to remove. /// The [full path] of the resource type to remove.
/// ///
/// [full path]: bevy_reflect::TypePath::type_path /// [full path]: bevy_reflect::TypePath::type_path
pub resource: String, pub resource: String,
} }
/// `bevy/insert`: Adds one or more components to an entity. /// `world.insert_components`: Adds one or more components to an entity.
/// ///
/// The server responds with a null. /// The server responds with a null.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpInsertParams { pub struct BrpInsertComponentsParams {
/// The ID of the entity that components are to be added to. /// The ID of the entity that components are to be added to.
pub entity: Entity, pub entity: Entity,
@ -218,10 +218,10 @@ pub struct BrpInsertParams {
pub components: HashMap<String, Value>, pub components: HashMap<String, Value>,
} }
/// `bevy/insert_resource`: Inserts a resource into the world with a given /// `world.insert_resources`: Inserts a resource into the world with a given
/// value. /// value.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpInsertResourceParams { pub struct BrpInsertResourcesParams {
/// The [full path] of the resource type to insert. /// The [full path] of the resource type to insert.
/// ///
/// [full path]: bevy_reflect::TypePath::type_path /// [full path]: bevy_reflect::TypePath::type_path
@ -231,11 +231,11 @@ pub struct BrpInsertResourceParams {
pub value: Value, pub value: Value,
} }
/// `bevy/reparent`: Assign a new parent to one or more entities. /// `world.reparent_entities`: Assign a new parent to one or more entities.
/// ///
/// The server responds with a null. /// The server responds with a null.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpReparentParams { pub struct BrpReparentEntitiesParams {
/// The IDs of the entities that are to become the new children of the /// The IDs of the entities that are to become the new children of the
/// `parent`. /// `parent`.
pub entities: Vec<Entity>, pub entities: Vec<Entity>,
@ -248,21 +248,21 @@ pub struct BrpReparentParams {
pub parent: Option<Entity>, pub parent: Option<Entity>,
} }
/// `bevy/list`: Returns a list of all type names of registered components in the /// `world.list_components`: Returns a list of all type names of registered components in the
/// system (no params provided), or those on an entity (params provided). /// system (no params provided), or those on an entity (params provided).
/// ///
/// The server responds with a [`BrpListResponse`] /// The server responds with a [`BrpListComponentsResponse`]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpListParams { pub struct BrpListComponentsParams {
/// The entity to query. /// The entity to query.
pub entity: Entity, pub entity: Entity,
} }
/// `bevy/mutate_component`: /// `world.mutate_components`:
/// ///
/// The server responds with a null. /// The server responds with a null.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpMutateComponentParams { pub struct BrpMutateComponentsParams {
/// The entity of the component to mutate. /// The entity of the component to mutate.
pub entity: Entity, pub entity: Entity,
@ -280,11 +280,11 @@ pub struct BrpMutateComponentParams {
pub value: Value, pub value: Value,
} }
/// `bevy/mutate_resource`: /// `world.mutate_resources`:
/// ///
/// The server responds with a null. /// The server responds with a null.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpMutateResourceParams { pub struct BrpMutateResourcesParams {
/// The [full path] of the resource to mutate. /// The [full path] of the resource to mutate.
/// ///
/// [full path]: bevy_reflect::TypePath::type_path /// [full path]: bevy_reflect::TypePath::type_path
@ -377,17 +377,17 @@ pub struct JsonSchemaTypeLimit {
/// A response from the world to the client that specifies a single entity. /// A response from the world to the client that specifies a single entity.
/// ///
/// This is sent in response to `bevy/spawn`. /// This is sent in response to `world.spawn_entity`.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpSpawnResponse { pub struct BrpSpawnEntityResponse {
/// The ID of the entity in question. /// The ID of the entity in question.
pub entity: Entity, pub entity: Entity,
} }
/// The response to a `bevy/get` request. /// The response to a `world.get_components` request.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged)] #[serde(untagged)]
pub enum BrpGetResponse { pub enum BrpGetComponentsResponse {
/// The non-strict response that reports errors separately without failing the entire request. /// The non-strict response that reports errors separately without failing the entire request.
Lenient { Lenient {
/// A map of successful components with their values. /// A map of successful components with their values.
@ -400,17 +400,17 @@ pub enum BrpGetResponse {
Strict(HashMap<String, Value>), Strict(HashMap<String, Value>),
} }
/// The response to a `bevy/get_resource` request. /// The response to a `world.get_resources` request.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpGetResourceResponse { pub struct BrpGetResourcesResponse {
/// The value of the requested resource. /// The value of the requested resource.
pub value: Value, pub value: Value,
} }
/// A single response from a `bevy/get+watch` request. /// A single response from a `world.get_components+watch` request.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged)] #[serde(untagged)]
pub enum BrpGetWatchingResponse { pub enum BrpGetComponentsWatchingResponse {
/// The non-strict response that reports errors separately without failing the entire request. /// The non-strict response that reports errors separately without failing the entire request.
Lenient { Lenient {
/// A map of successful components with their values that were added or changes in the last /// A map of successful components with their values that were added or changes in the last
@ -432,20 +432,20 @@ pub enum BrpGetWatchingResponse {
}, },
} }
/// The response to a `bevy/list` request. /// The response to a `world.list_components` request.
pub type BrpListResponse = Vec<String>; pub type BrpListComponentsResponse = Vec<String>;
/// The response to a `bevy/list_resources` request. /// The response to a `world.list_resources` request.
pub type BrpListResourcesResponse = Vec<String>; pub type BrpListResourcesResponse = Vec<String>;
/// A single response from a `bevy/list+watch` request. /// A single response from a `world.list_components+watch` request.
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)] #[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct BrpListWatchingResponse { pub struct BrpListComponentsWatchingResponse {
added: Vec<String>, added: Vec<String>,
removed: Vec<String>, removed: Vec<String>,
} }
/// The response to a `bevy/query` request. /// The response to a `world.query` request.
pub type BrpQueryResponse = Vec<BrpQueryRow>; pub type BrpQueryResponse = Vec<BrpQueryRow>;
/// One query match result: a single entity paired with the requested components. /// One query match result: a single entity paired with the requested components.
@ -483,9 +483,12 @@ fn parse_some<T: for<'de> Deserialize<'de>>(value: Option<Value>) -> Result<T, B
} }
} }
/// Handles a `bevy/get` request coming from a client. /// Handles a `world.get_components` request coming from a client.
pub fn process_remote_get_request(In(params): In<Option<Value>>, world: &World) -> BrpResult { pub fn process_remote_get_components_request(
let BrpGetParams { In(params): In<Option<Value>>,
world: &World,
) -> BrpResult {
let BrpGetComponentsParams {
entity, entity,
components, components,
strict, strict,
@ -500,12 +503,12 @@ pub fn process_remote_get_request(In(params): In<Option<Value>>, world: &World)
serde_json::to_value(response).map_err(BrpError::internal) serde_json::to_value(response).map_err(BrpError::internal)
} }
/// Handles a `bevy/get_resource` request coming from a client. /// Handles a `world.get_resources` request coming from a client.
pub fn process_remote_get_resource_request( pub fn process_remote_get_resources_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &World, world: &World,
) -> BrpResult { ) -> BrpResult {
let BrpGetResourceParams { let BrpGetResourcesParams {
resource: resource_path, resource: resource_path,
} = parse_some(params)?; } = parse_some(params)?;
@ -535,17 +538,17 @@ pub fn process_remote_get_resource_request(
let value = serialized_object.into_values().next().ok_or_else(|| { let value = serialized_object.into_values().next().ok_or_else(|| {
BrpError::internal(anyhow!("Unexpected format of serialized resource value")) BrpError::internal(anyhow!("Unexpected format of serialized resource value"))
})?; })?;
let response = BrpGetResourceResponse { value }; let response = BrpGetResourcesResponse { value };
serde_json::to_value(response).map_err(BrpError::internal) serde_json::to_value(response).map_err(BrpError::internal)
} }
/// Handles a `bevy/get+watch` request coming from a client. /// Handles a `world.get_components+watch` request coming from a client.
pub fn process_remote_get_watching_request( pub fn process_remote_get_components_watching_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &World, world: &World,
mut removal_cursors: Local<HashMap<ComponentId, EventCursor<RemovedComponentEntity>>>, mut removal_cursors: Local<HashMap<ComponentId, EventCursor<RemovedComponentEntity>>>,
) -> BrpResult<Option<Value>> { ) -> BrpResult<Option<Value>> {
let BrpGetParams { let BrpGetComponentsParams {
entity, entity,
components, components,
strict, strict,
@ -616,10 +619,10 @@ pub fn process_remote_get_watching_request(
reflect_components_to_response(changed, strict, entity, entity_ref, &type_registry)?; reflect_components_to_response(changed, strict, entity, entity_ref, &type_registry)?;
let response = match response { let response = match response {
BrpGetResponse::Lenient { BrpGetComponentsResponse::Lenient {
components, components,
errors: mut errs, errors: mut errs,
} => BrpGetWatchingResponse::Lenient { } => BrpGetComponentsWatchingResponse::Lenient {
components, components,
removed, removed,
errors: { errors: {
@ -627,7 +630,7 @@ pub fn process_remote_get_watching_request(
errs errs
}, },
}, },
BrpGetResponse::Strict(components) => BrpGetWatchingResponse::Strict { BrpGetComponentsResponse::Strict(components) => BrpGetComponentsWatchingResponse::Strict {
components, components,
removed, removed,
}, },
@ -638,18 +641,18 @@ pub fn process_remote_get_watching_request(
)) ))
} }
/// Reflect a list of components on an entity into a [`BrpGetResponse`]. /// Reflect a list of components on an entity into a [`BrpGetComponentsResponse`].
fn reflect_components_to_response( fn reflect_components_to_response(
components: Vec<String>, components: Vec<String>,
strict: bool, strict: bool,
entity: Entity, entity: Entity,
entity_ref: EntityRef, entity_ref: EntityRef,
type_registry: &TypeRegistry, type_registry: &TypeRegistry,
) -> BrpResult<BrpGetResponse> { ) -> BrpResult<BrpGetComponentsResponse> {
let mut response = if strict { let mut response = if strict {
BrpGetResponse::Strict(Default::default()) BrpGetComponentsResponse::Strict(Default::default())
} else { } else {
BrpGetResponse::Lenient { BrpGetComponentsResponse::Lenient {
components: Default::default(), components: Default::default(),
errors: Default::default(), errors: Default::default(),
} }
@ -658,16 +661,16 @@ fn reflect_components_to_response(
for component_path in components { for component_path in components {
match reflect_component(&component_path, entity, entity_ref, type_registry) { match reflect_component(&component_path, entity, entity_ref, type_registry) {
Ok(serialized_object) => match response { Ok(serialized_object) => match response {
BrpGetResponse::Strict(ref mut components) BrpGetComponentsResponse::Strict(ref mut components)
| BrpGetResponse::Lenient { | BrpGetComponentsResponse::Lenient {
ref mut components, .. ref mut components, ..
} => { } => {
components.extend(serialized_object.into_iter()); components.extend(serialized_object.into_iter());
} }
}, },
Err(err) => match response { Err(err) => match response {
BrpGetResponse::Strict(_) => return Err(err), BrpGetComponentsResponse::Strict(_) => return Err(err),
BrpGetResponse::Lenient { ref mut errors, .. } => { BrpGetComponentsResponse::Lenient { ref mut errors, .. } => {
let err_value = serde_json::to_value(err).map_err(BrpError::internal)?; let err_value = serde_json::to_value(err).map_err(BrpError::internal)?;
errors.insert(component_path, err_value); errors.insert(component_path, err_value);
} }
@ -734,7 +737,7 @@ impl Default for ComponentSelector {
} }
} }
/// Handles a `bevy/query` request coming from a client. /// Handles a `world.query` request coming from a client.
pub fn process_remote_query_request(In(params): In<Option<Value>>, world: &mut World) -> BrpResult { pub fn process_remote_query_request(In(params): In<Option<Value>>, world: &mut World) -> BrpResult {
let BrpQueryParams { let BrpQueryParams {
data: BrpQuery { data: BrpQuery {
@ -934,9 +937,12 @@ fn serialize_components(
components_map components_map
} }
/// Handles a `bevy/spawn` request coming from a client. /// Handles a `world.spawn_entity` request coming from a client.
pub fn process_remote_spawn_request(In(params): In<Option<Value>>, world: &mut World) -> BrpResult { pub fn process_remote_spawn_entity_request(
let BrpSpawnParams { components } = parse_some(params)?; In(params): In<Option<Value>>,
world: &mut World,
) -> BrpResult {
let BrpSpawnEntityParams { components } = parse_some(params)?;
let app_type_registry = world.resource::<AppTypeRegistry>().clone(); let app_type_registry = world.resource::<AppTypeRegistry>().clone();
let type_registry = app_type_registry.read(); let type_registry = app_type_registry.read();
@ -949,7 +955,7 @@ pub fn process_remote_spawn_request(In(params): In<Option<Value>>, world: &mut W
insert_reflected_components(&type_registry, entity, reflect_components) insert_reflected_components(&type_registry, entity, reflect_components)
.map_err(BrpError::component_error)?; .map_err(BrpError::component_error)?;
let response = BrpSpawnResponse { entity: entity_id }; let response = BrpSpawnEntityResponse { entity: entity_id };
serde_json::to_value(response).map_err(BrpError::internal) serde_json::to_value(response).map_err(BrpError::internal)
} }
@ -991,12 +997,12 @@ pub fn process_remote_list_methods_request(
serde_json::to_value(doc).map_err(BrpError::internal) serde_json::to_value(doc).map_err(BrpError::internal)
} }
/// Handles a `bevy/insert` request (insert components) coming from a client. /// Handles a `world.insert_components` request (insert components) coming from a client.
pub fn process_remote_insert_request( pub fn process_remote_insert_components_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpInsertParams { entity, components } = parse_some(params)?; let BrpInsertComponentsParams { entity, components } = parse_some(params)?;
let app_type_registry = world.resource::<AppTypeRegistry>().clone(); let app_type_registry = world.resource::<AppTypeRegistry>().clone();
let type_registry = app_type_registry.read(); let type_registry = app_type_registry.read();
@ -1014,12 +1020,12 @@ pub fn process_remote_insert_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/insert_resource` request coming from a client. /// Handles a `world.insert_resources` request coming from a client.
pub fn process_remote_insert_resource_request( pub fn process_remote_insert_resources_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpInsertResourceParams { let BrpInsertResourcesParams {
resource: resource_path, resource: resource_path,
value, value,
} = parse_some(params)?; } = parse_some(params)?;
@ -1037,15 +1043,15 @@ pub fn process_remote_insert_resource_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/mutate_component` request coming from a client. /// Handles a `world.mutate_components` request coming from a client.
/// ///
/// This method allows you to mutate a single field inside an Entity's /// This method allows you to mutate a single field inside an Entity's
/// component. /// component.
pub fn process_remote_mutate_component_request( pub fn process_remote_mutate_components_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpMutateComponentParams { let BrpMutateComponentsParams {
entity, entity,
component, component,
path, path,
@ -1101,12 +1107,12 @@ pub fn process_remote_mutate_component_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/mutate_resource` request coming from a client. /// Handles a `world.mutate_resources` request coming from a client.
pub fn process_remote_mutate_resource_request( pub fn process_remote_mutate_resources_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpMutateResourceParams { let BrpMutateResourcesParams {
resource: resource_path, resource: resource_path,
path: field_path, path: field_path,
value, value,
@ -1152,12 +1158,12 @@ pub fn process_remote_mutate_resource_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/remove` request (remove components) coming from a client. /// Handles a `world.remove_components` request (remove components) coming from a client.
pub fn process_remote_remove_request( pub fn process_remote_remove_components_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpRemoveParams { entity, components } = parse_some(params)?; let BrpRemoveComponentsParams { entity, components } = parse_some(params)?;
let app_type_registry = world.resource::<AppTypeRegistry>().clone(); let app_type_registry = world.resource::<AppTypeRegistry>().clone();
let type_registry = app_type_registry.read(); let type_registry = app_type_registry.read();
@ -1181,12 +1187,12 @@ pub fn process_remote_remove_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/remove_resource` request coming from a client. /// Handles a `world.remove_resources` request coming from a client.
pub fn process_remote_remove_resource_request( pub fn process_remote_remove_resources_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpRemoveResourceParams { let BrpRemoveResourcesParams {
resource: resource_path, resource: resource_path,
} = parse_some(params)?; } = parse_some(params)?;
@ -1200,24 +1206,24 @@ pub fn process_remote_remove_resource_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/destroy` (despawn entity) request coming from a client. /// Handles a `world.despawn_entity` (despawn entity) request coming from a client.
pub fn process_remote_destroy_request( pub fn process_remote_despawn_entity_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpDestroyParams { entity } = parse_some(params)?; let BrpDespawnEntityParams { entity } = parse_some(params)?;
get_entity_mut(world, entity)?.despawn(); get_entity_mut(world, entity)?.despawn();
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/reparent` request coming from a client. /// Handles a `world.reparent_entities` request coming from a client.
pub fn process_remote_reparent_request( pub fn process_remote_reparent_entities_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &mut World, world: &mut World,
) -> BrpResult { ) -> BrpResult {
let BrpReparentParams { let BrpReparentEntitiesParams {
entities, entities,
parent: maybe_parent, parent: maybe_parent,
} = parse_some(params)?; } = parse_some(params)?;
@ -1243,15 +1249,18 @@ pub fn process_remote_reparent_request(
Ok(Value::Null) Ok(Value::Null)
} }
/// Handles a `bevy/list` request (list all components) coming from a client. /// Handles a `world.list_components` request (list all components) coming from a client.
pub fn process_remote_list_request(In(params): In<Option<Value>>, world: &World) -> BrpResult { pub fn process_remote_list_components_request(
In(params): In<Option<Value>>,
world: &World,
) -> BrpResult {
let app_type_registry = world.resource::<AppTypeRegistry>(); let app_type_registry = world.resource::<AppTypeRegistry>();
let type_registry = app_type_registry.read(); let type_registry = app_type_registry.read();
let mut response = BrpListResponse::default(); let mut response = BrpListComponentsResponse::default();
// If `Some`, return all components of the provided entity. // If `Some`, return all components of the provided entity.
if let Some(BrpListParams { entity }) = params.map(parse).transpose()? { if let Some(BrpListComponentsParams { entity }) = params.map(parse).transpose()? {
let entity = get_entity(world, entity)?; let entity = get_entity(world, entity)?;
for component_id in entity.archetype().components() { for component_id in entity.archetype().components() {
let Some(component_info) = world.components().get_info(component_id) else { let Some(component_info) = world.components().get_info(component_id) else {
@ -1276,7 +1285,7 @@ pub fn process_remote_list_request(In(params): In<Option<Value>>, world: &World)
serde_json::to_value(response).map_err(BrpError::internal) serde_json::to_value(response).map_err(BrpError::internal)
} }
/// Handles a `bevy/list_resources` request coming from a client. /// Handles a `world.list_resources` request coming from a client.
pub fn process_remote_list_resources_request( pub fn process_remote_list_resources_request(
In(_params): In<Option<Value>>, In(_params): In<Option<Value>>,
world: &World, world: &World,
@ -1297,15 +1306,15 @@ pub fn process_remote_list_resources_request(
serde_json::to_value(response).map_err(BrpError::internal) serde_json::to_value(response).map_err(BrpError::internal)
} }
/// Handles a `bevy/list+watch` request coming from a client. /// Handles a `world.list_components+watch` request coming from a client.
pub fn process_remote_list_watching_request( pub fn process_remote_list_components_watching_request(
In(params): In<Option<Value>>, In(params): In<Option<Value>>,
world: &World, world: &World,
mut removal_cursors: Local<HashMap<ComponentId, EventCursor<RemovedComponentEntity>>>, mut removal_cursors: Local<HashMap<ComponentId, EventCursor<RemovedComponentEntity>>>,
) -> BrpResult<Option<Value>> { ) -> BrpResult<Option<Value>> {
let BrpListParams { entity } = parse_some(params)?; let BrpListComponentsParams { entity } = parse_some(params)?;
let entity_ref = get_entity(world, entity)?; let entity_ref = get_entity(world, entity)?;
let mut response = BrpListWatchingResponse::default(); let mut response = BrpListComponentsWatchingResponse::default();
for component_id in entity_ref.archetype().components() { for component_id in entity_ref.archetype().components() {
let ticks = entity_ref let ticks = entity_ref
@ -1343,7 +1352,7 @@ pub fn process_remote_list_watching_request(
} }
} }
/// Handles a `bevy/registry/schema` request (list all registry types in form of schema) coming from a client. /// Handles a `registry.schema` request (list all registry types in form of schema) coming from a client.
pub fn export_registry_types(In(params): In<Option<Value>>, world: &World) -> BrpResult { pub fn export_registry_types(In(params): In<Option<Value>>, world: &World) -> BrpResult {
let filter: BrpJsonSchemaQueryFilter = match params { let filter: BrpJsonSchemaQueryFilter = match params {
None => Default::default(), None => Default::default(),
@ -1634,7 +1643,7 @@ mod tests {
entity: Entity::from_raw_u32(0).unwrap(), entity: Entity::from_raw_u32(0).unwrap(),
has: Default::default(), has: Default::default(),
}); });
test_serialize_deserialize(BrpListWatchingResponse::default()); test_serialize_deserialize(BrpListComponentsWatchingResponse::default());
test_serialize_deserialize(BrpQuery::default()); test_serialize_deserialize(BrpQuery::default());
test_serialize_deserialize(BrpJsonSchemaQueryFilter::default()); test_serialize_deserialize(BrpJsonSchemaQueryFilter::default());
test_serialize_deserialize(BrpJsonSchemaQueryFilter { test_serialize_deserialize(BrpJsonSchemaQueryFilter {
@ -1644,7 +1653,7 @@ mod tests {
}, },
..Default::default() ..Default::default()
}); });
test_serialize_deserialize(BrpListParams { test_serialize_deserialize(BrpListComponentsParams {
entity: Entity::from_raw_u32(0).unwrap(), entity: Entity::from_raw_u32(0).unwrap(),
}); });
} }

View File

@ -14,7 +14,7 @@
//! //!
//! ```json //! ```json
//! { //! {
//! "method": "bevy/get", //! "method": world.get_components",
//! "id": 0, //! "id": 0,
//! "params": { //! "params": {
//! "entity": 4294967298, //! "entity": 4294967298,
@ -35,7 +35,7 @@
//! response. //! response.
//! //!
//! * `method` is a string that specifies one of the possible [`BrpRequest`] //! * `method` is a string that specifies one of the possible [`BrpRequest`]
//! variants: `bevy/query`, `bevy/get`, `bevy/insert`, etc. It's case-sensitive. //! variants: `world.query`, `world.get_components`, `world.insert_components`, etc. It's case-sensitive.
//! //!
//! * `params` is parameter data specific to the request. //! * `params` is parameter data specific to the request.
//! //!
@ -99,10 +99,9 @@
//! ## Built-in methods //! ## Built-in methods
//! //!
//! The Bevy Remote Protocol includes a number of built-in methods for accessing and modifying data //! The Bevy Remote Protocol includes a number of built-in methods for accessing and modifying data
//! in the ECS. Each of these methods uses the `bevy/` prefix, which is a namespace reserved for //! in the ECS.
//! BRP built-in methods.
//! //!
//! ### `bevy/get` //! ### `world.get_components`
//! //!
//! Retrieve the values of one or more components from an entity. //! Retrieve the values of one or more components from an entity.
//! //!
@ -123,7 +122,7 @@
//! //!
//! `result`: A map associating each type name to its value on the requested entity. //! `result`: A map associating each type name to its value on the requested entity.
//! //!
//! ### `bevy/query` //! ### `world.query`
//! //!
//! Perform a query over components in the ECS, returning all matching entities and their associated //! Perform a query over components in the ECS, returning all matching entities and their associated
//! component values. //! component values.
@ -290,7 +289,7 @@
//!}, //!},
//! ``` //! ```
//! //!
//! ### `bevy/spawn` //! ### `world.spawn_entity`
//! //!
//! Create a new entity with the provided components and return the resulting entity ID. //! Create a new entity with the provided components and return the resulting entity ID.
//! //!
@ -300,7 +299,7 @@
//! `result`: //! `result`:
//! - `entity`: The ID of the newly spawned entity. //! - `entity`: The ID of the newly spawned entity.
//! //!
//! ### `bevy/destroy` //! ### `world.despawn_entity`
//! //!
//! Despawn the entity with the given ID. //! Despawn the entity with the given ID.
//! //!
@ -309,7 +308,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/remove` //! ### `world.remove_components`
//! //!
//! Delete one or more components from an entity. //! Delete one or more components from an entity.
//! //!
@ -319,7 +318,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/insert` //! ### `world.insert_components`
//! //!
//! Insert one or more components into an entity. //! Insert one or more components into an entity.
//! //!
@ -329,7 +328,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/mutate_component` //! ### `world.mutate_components`
//! //!
//! Mutate a field in a component. //! Mutate a field in a component.
//! //!
@ -342,7 +341,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/reparent` //! ### `world.reparent_entities`
//! //!
//! Assign a new parent to one or more entities. //! Assign a new parent to one or more entities.
//! //!
@ -353,7 +352,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/list` //! ### `world.list_components`
//! //!
//! List all registered components or all components present on an entity. //! List all registered components or all components present on an entity.
//! //!
@ -365,7 +364,7 @@
//! //!
//! `result`: An array of fully-qualified type names of components. //! `result`: An array of fully-qualified type names of components.
//! //!
//! ### `bevy/get+watch` //! ### `world.get_components+watch`
//! //!
//! Watch the values of one or more components from an entity. //! Watch the values of one or more components from an entity.
//! //!
@ -393,7 +392,7 @@
//! - `removed`: An array of fully-qualified type names of components removed from the entity //! - `removed`: An array of fully-qualified type names of components removed from the entity
//! in the last tick. //! in the last tick.
//! //!
//! ### `bevy/list+watch` //! ### `world.list_components+watch`
//! //!
//! Watch all components present on an entity. //! Watch all components present on an entity.
//! //!
@ -409,7 +408,7 @@
//! - `removed`: An array of fully-qualified type names of components removed from the entity //! - `removed`: An array of fully-qualified type names of components removed from the entity
//! in the last tick. //! in the last tick.
//! //!
//! ### `bevy/get_resource` //! ### `world.get_resources`
//! //!
//! Extract the value of a given resource from the world. //! Extract the value of a given resource from the world.
//! //!
@ -419,7 +418,7 @@
//! `result`: //! `result`:
//! - `value`: The value of the resource in the world. //! - `value`: The value of the resource in the world.
//! //!
//! ### `bevy/insert_resource` //! ### `world.insert_resources`
//! //!
//! Insert the given resource into the world with the given value. //! Insert the given resource into the world with the given value.
//! //!
@ -429,7 +428,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/remove_resource` //! ### `world.remove_resources`
//! //!
//! Remove the given resource from the world. //! Remove the given resource from the world.
//! //!
@ -438,7 +437,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/mutate_resource` //! ### `world.mutate_resources`
//! //!
//! Mutate a field in a resource. //! Mutate a field in a resource.
//! //!
@ -450,7 +449,7 @@
//! //!
//! `result`: null. //! `result`: null.
//! //!
//! ### `bevy/list_resources` //! ### `world.list_resources`
//! //!
//! List all reflectable registered resource types. This method has no parameters. //! List all reflectable registered resource types. This method has no parameters.
//! //!
@ -577,68 +576,68 @@ impl Default for RemotePlugin {
fn default() -> Self { fn default() -> Self {
Self::empty() Self::empty()
.with_method( .with_method(
builtin_methods::BRP_GET_METHOD, builtin_methods::BRP_GET_COMPONENTS_METHOD,
builtin_methods::process_remote_get_request, builtin_methods::process_remote_get_components_request,
) )
.with_method( .with_method(
builtin_methods::BRP_QUERY_METHOD, builtin_methods::BRP_QUERY_METHOD,
builtin_methods::process_remote_query_request, builtin_methods::process_remote_query_request,
) )
.with_method( .with_method(
builtin_methods::BRP_SPAWN_METHOD, builtin_methods::BRP_SPAWN_ENTITY_METHOD,
builtin_methods::process_remote_spawn_request, builtin_methods::process_remote_spawn_entity_request,
) )
.with_method( .with_method(
builtin_methods::BRP_INSERT_METHOD, builtin_methods::BRP_INSERT_COMPONENTS_METHOD,
builtin_methods::process_remote_insert_request, builtin_methods::process_remote_insert_components_request,
) )
.with_method( .with_method(
builtin_methods::BRP_REMOVE_METHOD, builtin_methods::BRP_REMOVE_COMPONENTS_METHOD,
builtin_methods::process_remote_remove_request, builtin_methods::process_remote_remove_components_request,
) )
.with_method( .with_method(
builtin_methods::BRP_DESTROY_METHOD, builtin_methods::BRP_DESPAWN_COMPONENTS_METHOD,
builtin_methods::process_remote_destroy_request, builtin_methods::process_remote_despawn_entity_request,
) )
.with_method( .with_method(
builtin_methods::BRP_REPARENT_METHOD, builtin_methods::BRP_REPARENT_ENTITIES_METHOD,
builtin_methods::process_remote_reparent_request, builtin_methods::process_remote_reparent_entities_request,
) )
.with_method( .with_method(
builtin_methods::BRP_LIST_METHOD, builtin_methods::BRP_LIST_COMPONENTS_METHOD,
builtin_methods::process_remote_list_request, builtin_methods::process_remote_list_components_request,
) )
.with_method( .with_method(
builtin_methods::BRP_MUTATE_COMPONENT_METHOD, builtin_methods::BRP_MUTATE_COMPONENTS_METHOD,
builtin_methods::process_remote_mutate_component_request, builtin_methods::process_remote_mutate_components_request,
) )
.with_method( .with_method(
builtin_methods::RPC_DISCOVER_METHOD, builtin_methods::RPC_DISCOVER_METHOD,
builtin_methods::process_remote_list_methods_request, builtin_methods::process_remote_list_methods_request,
) )
.with_watching_method( .with_watching_method(
builtin_methods::BRP_GET_AND_WATCH_METHOD, builtin_methods::BRP_GET_COMPONENTS_AND_WATCH_METHOD,
builtin_methods::process_remote_get_watching_request, builtin_methods::process_remote_get_components_watching_request,
) )
.with_watching_method( .with_watching_method(
builtin_methods::BRP_LIST_AND_WATCH_METHOD, builtin_methods::BRP_LIST_COMPONENTS_AND_WATCH_METHOD,
builtin_methods::process_remote_list_watching_request, builtin_methods::process_remote_list_components_watching_request,
) )
.with_method( .with_method(
builtin_methods::BRP_GET_RESOURCE_METHOD, builtin_methods::BRP_GET_RESOURCE_METHOD,
builtin_methods::process_remote_get_resource_request, builtin_methods::process_remote_get_resources_request,
) )
.with_method( .with_method(
builtin_methods::BRP_INSERT_RESOURCE_METHOD, builtin_methods::BRP_INSERT_RESOURCE_METHOD,
builtin_methods::process_remote_insert_resource_request, builtin_methods::process_remote_insert_resources_request,
) )
.with_method( .with_method(
builtin_methods::BRP_REMOVE_RESOURCE_METHOD, builtin_methods::BRP_REMOVE_RESOURCE_METHOD,
builtin_methods::process_remote_remove_resource_request, builtin_methods::process_remote_remove_resources_request,
) )
.with_method( .with_method(
builtin_methods::BRP_MUTATE_RESOURCE_METHOD, builtin_methods::BRP_MUTATE_RESOURCE_METHOD,
builtin_methods::process_remote_mutate_resource_request, builtin_methods::process_remote_mutate_resources_request,
) )
.with_method( .with_method(
builtin_methods::BRP_LIST_RESOURCES_METHOD, builtin_methods::BRP_LIST_RESOURCES_METHOD,
@ -723,7 +722,7 @@ pub enum RemoteMethodHandler {
Watching(Box<dyn System<In = In<Option<Value>>, Out = BrpResult<Option<Value>>>>), Watching(Box<dyn System<In = In<Option<Value>>, Out = BrpResult<Option<Value>>>>),
} }
/// The [`SystemId`] of a function that implements a remote instant method (`bevy/get`, `bevy/query`, etc.) /// The [`SystemId`] of a function that implements a remote instant method (`world.get_components`, `world.query`, etc.)
/// ///
/// The first parameter is the JSON value of the `params`. Typically, an /// The first parameter is the JSON value of the `params`. Typically, an
/// implementation will deserialize these as the first thing they do. /// implementation will deserialize these as the first thing they do.
@ -732,7 +731,7 @@ pub enum RemoteMethodHandler {
/// automatically populate the `id` field before sending. /// automatically populate the `id` field before sending.
pub type RemoteInstantMethodSystemId = SystemId<In<Option<Value>>, BrpResult>; pub type RemoteInstantMethodSystemId = SystemId<In<Option<Value>>, BrpResult>;
/// The [`SystemId`] of a function that implements a remote watching method (`bevy/get+watch`, `bevy/list+watch`, etc.) /// The [`SystemId`] of a function that implements a remote watching method (`world.get_components+watch`, `world.list_components+watch`, etc.)
/// ///
/// The first parameter is the JSON value of the `params`. Typically, an /// The first parameter is the JSON value of the `params`. Typically, an
/// implementation will deserialize these as the first thing they do. /// implementation will deserialize these as the first thing they do.
@ -797,7 +796,7 @@ pub struct RemoteWatchingRequests(Vec<(BrpMessage, RemoteWatchingMethodSystemId)
/// ```json /// ```json
/// { /// {
/// "jsonrpc": "2.0", /// "jsonrpc": "2.0",
/// "method": "bevy/get", /// "method": "world.get_components",
/// "id": 0, /// "id": 0,
/// "params": { /// "params": {
/// "entity": 4294967298, /// "entity": 4294967298,
@ -812,7 +811,7 @@ pub struct RemoteWatchingRequests(Vec<(BrpMessage, RemoteWatchingMethodSystemId)
/// ```json /// ```json
/// { /// {
/// "jsonrpc": "2.0", /// "jsonrpc": "2.0",
/// "method": "bevy/list", /// "method": "world.list_components",
/// "id": 0, /// "id": 0,
/// "params": null /// "params": null
///} ///}

View File

@ -69,7 +69,11 @@ pub struct ServerObject {
#[derive(Serialize, Deserialize, Debug, Default)] #[derive(Serialize, Deserialize, Debug, Default)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MethodObject { pub struct MethodObject {
/// The method name (e.g., "/bevy/get") #[expect(
clippy::doc_markdown,
reason = "In this case, we are referring to a string, so using quotes instead of backticks makes sense."
)]
/// The method name (e.g., "world.get_components")
pub name: String, pub name: String,
/// An optional short summary of the method. /// An optional short summary of the method.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -0,0 +1,27 @@
---
title: Renamed BRP methods
pull_requests: [19377]
---
Most Bevy Remote Protocol methods have been renamed to be more explicit.
The word `destroy` has also been replaced with `despawn` to match the rest of the engine.
| Old | New |
|------------------------|-------------------------------|
| `bevy/query` | `world.query` |
| `bevy/spawn` | `world.spawn_entity` |
| `bevy/destroy` | `world.despawn_entity` |
| `bevy/reparent` | `world.reparent_entities` |
| `bevy/get` | `world.get_components` |
| `bevy/insert` | `world.insert_components` |
| `bevy/remove` | `world.remove_components` |
| `bevy/list` | `world.list_components` |
| `bevy/mutate` | `world.mutate_components` |
| `bevy/get+watch` | `world.get_components+watch` |
| `bevy/list+watch` | `world.list_components+watch` |
| `bevy/get_resource` | `world.get_resources` |
| `bevy/insert_resource` | `world.insert_resources` |
| `bevy/remove_resource` | `world.remove_resources` |
| `bevy/list_resources` | `world.list_resources` |
| `bevy/mutate_resource` | `world.mutate_resources` |
| `registry/schema` | `registry.schema` |