diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d00c99e9..d7011c2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -228,7 +228,7 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: stable - target: ${{ matrix.target }} + target: ${{ matrix.target == 'universal-apple-darwin' && 'aarch64-apple-darwin,x86_64-apple-darwin' || matrix.target }} - name: Install bindgen-cli uses: taiki-e/cache-cargo-install-action@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index e44515fb..081e4028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Renamed / removed prefixes array_ and object_ + ### Fixed ### Distribution diff --git a/plugins/array/crates/model/src/entity/array_contains.rs b/plugins/array/crates/model/src/entity/contains.rs similarity index 90% rename from plugins/array/crates/model/src/entity/array_contains.rs rename to plugins/array/crates/model/src/entity/contains.rs index 0b80bc76..f7fe2cfe 100644 --- a/plugins/array/crates/model/src/entity/array_contains.rs +++ b/plugins/array/crates/model/src/entity/contains.rs @@ -11,8 +11,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayContainsProperties, (ARRAY, "array", json!([])), (SEARCH, "search", false)); -entity_ty!(ENTITY_TYPE_ARRAY_CONTAINS, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_CONTAINS, "array_contains"); -behaviour_ty!(BEHAVIOUR_ARRAY_CONTAINS, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_CONTAINS, "array_contains"); +entity_ty!(ENTITY_TYPE_ARRAY_CONTAINS, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_CONTAINS, "contains"); +behaviour_ty!(BEHAVIOUR_ARRAY_CONTAINS, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_CONTAINS, "contains"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_CONTAINS, ENTITY_TYPE_ARRAY_CONTAINS, BEHAVIOUR_ARRAY_CONTAINS); entity_model!( diff --git a/plugins/array/crates/model/src/entity/array_get_by_index.rs b/plugins/array/crates/model/src/entity/get_by_index.rs similarity index 87% rename from plugins/array/crates/model/src/entity/array_get_by_index.rs rename to plugins/array/crates/model/src/entity/get_by_index.rs index f831aaff..ba2c9ed8 100644 --- a/plugins/array/crates/model/src/entity/array_get_by_index.rs +++ b/plugins/array/crates/model/src/entity/get_by_index.rs @@ -11,8 +11,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayGetByIndexProperties, (ARRAY, "array", json!([])), (INDEX, "index", 0)); -entity_ty!(ENTITY_TYPE_ARRAY_GET_BY_INDEX, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_GET_BY_INDEX, "array_get_by_index"); -behaviour_ty!(BEHAVIOUR_ARRAY_GET_BY_INDEX, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_GET_BY_INDEX, "array_get_by_index"); +entity_ty!(ENTITY_TYPE_ARRAY_GET_BY_INDEX, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_GET_BY_INDEX, "get_by_index"); +behaviour_ty!(BEHAVIOUR_ARRAY_GET_BY_INDEX, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_GET_BY_INDEX, "get_by_index"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_GET_BY_INDEX, ENTITY_TYPE_ARRAY_GET_BY_INDEX, BEHAVIOUR_ARRAY_GET_BY_INDEX); entity_model!( diff --git a/plugins/array/crates/model/src/entity/array_length.rs b/plugins/array/crates/model/src/entity/length.rs similarity index 90% rename from plugins/array/crates/model/src/entity/array_length.rs rename to plugins/array/crates/model/src/entity/length.rs index 9e07ce26..47860505 100644 --- a/plugins/array/crates/model/src/entity/array_length.rs +++ b/plugins/array/crates/model/src/entity/length.rs @@ -9,8 +9,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayLengthProperties, (ARRAY, "array", json!([])), (LENGTH, "length", 0)); -entity_ty!(ENTITY_TYPE_ARRAY_LENGTH, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_LENGTH, "array_length"); -behaviour_ty!(BEHAVIOUR_ARRAY_LENGTH, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_LENGTH, "array_length"); +entity_ty!(ENTITY_TYPE_ARRAY_LENGTH, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_LENGTH, "length"); +behaviour_ty!(BEHAVIOUR_ARRAY_LENGTH, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_LENGTH, "length"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_LENGTH, ENTITY_TYPE_ARRAY_LENGTH, BEHAVIOUR_ARRAY_LENGTH); entity_model!( diff --git a/plugins/array/crates/model/src/entity/mod.rs b/plugins/array/crates/model/src/entity/mod.rs index 5b04636f..a9a9e9bb 100644 --- a/plugins/array/crates/model/src/entity/mod.rs +++ b/plugins/array/crates/model/src/entity/mod.rs @@ -1,13 +1,13 @@ -pub use array_contains::*; -pub use array_get_by_index::*; -pub use array_length::*; -pub use array_pop::*; -pub use array_push::*; -pub use array_reverse::*; +pub use contains::*; +pub use get_by_index::*; +pub use length::*; +pub use pop::*; +pub use push::*; +pub use reverse::*; -pub mod array_contains; -pub mod array_get_by_index; -pub mod array_length; -pub mod array_pop; -pub mod array_push; -pub mod array_reverse; +pub mod contains; +pub mod get_by_index; +pub mod length; +pub mod pop; +pub mod push; +pub mod reverse; diff --git a/plugins/array/crates/model/src/entity/array_pop.rs b/plugins/array/crates/model/src/entity/pop.rs similarity index 93% rename from plugins/array/crates/model/src/entity/array_pop.rs rename to plugins/array/crates/model/src/entity/pop.rs index 61cb5820..cf750e31 100644 --- a/plugins/array/crates/model/src/entity/array_pop.rs +++ b/plugins/array/crates/model/src/entity/pop.rs @@ -12,8 +12,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayPopProperties, (ARRAY, "array", json!([])), (VALUE, "value", Value::Null)); -entity_ty!(ENTITY_TYPE_ARRAY_POP, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_POP, "array_pop"); -behaviour_ty!(BEHAVIOUR_ARRAY_POP, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_POP, "array_pop"); +entity_ty!(ENTITY_TYPE_ARRAY_POP, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_POP, "pop"); +behaviour_ty!(BEHAVIOUR_ARRAY_POP, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_POP, "pop"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_POP, ENTITY_TYPE_ARRAY_POP, BEHAVIOUR_ARRAY_POP); entity_model!( diff --git a/plugins/array/crates/model/src/entity/array_push.rs b/plugins/array/crates/model/src/entity/push.rs similarity index 92% rename from plugins/array/crates/model/src/entity/array_push.rs rename to plugins/array/crates/model/src/entity/push.rs index 7688fa70..a2790e06 100644 --- a/plugins/array/crates/model/src/entity/array_push.rs +++ b/plugins/array/crates/model/src/entity/push.rs @@ -12,8 +12,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayPushProperties, (ARRAY, "array", json!([])), (VALUE, "value", Value::Null)); -entity_ty!(ENTITY_TYPE_ARRAY_PUSH, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_PUSH, "array_push"); -behaviour_ty!(BEHAVIOUR_ARRAY_PUSH, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_PUSH, "array_push"); +entity_ty!(ENTITY_TYPE_ARRAY_PUSH, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_PUSH, "push"); +behaviour_ty!(BEHAVIOUR_ARRAY_PUSH, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_PUSH, "push"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_PUSH, ENTITY_TYPE_ARRAY_PUSH, BEHAVIOUR_ARRAY_PUSH); entity_model!( diff --git a/plugins/array/crates/model/src/entity/array_reverse.rs b/plugins/array/crates/model/src/entity/reverse.rs similarity index 90% rename from plugins/array/crates/model/src/entity/array_reverse.rs rename to plugins/array/crates/model/src/entity/reverse.rs index e89af4bd..0830f91f 100644 --- a/plugins/array/crates/model/src/entity/array_reverse.rs +++ b/plugins/array/crates/model/src/entity/reverse.rs @@ -11,8 +11,8 @@ use reactive_graph_behaviour_model_api::entity_behaviour_ty; properties!(ArrayReverseProperties, (ARRAY, "array", json!([]))); -entity_ty!(ENTITY_TYPE_ARRAY_REVERSE, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_REVERSE, "array_reverse"); -behaviour_ty!(BEHAVIOUR_ARRAY_REVERSE, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_REVERSE, "array_reverse"); +entity_ty!(ENTITY_TYPE_ARRAY_REVERSE, NAMESPACE_ARRAY, ENTITY_TYPE_NAME_ARRAY_REVERSE, "reverse"); +behaviour_ty!(BEHAVIOUR_ARRAY_REVERSE, NAMESPACE_ARRAY, BEHAVIOUR_NAME_ARRAY_REVERSE, "reverse"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_ARRAY_REVERSE, ENTITY_TYPE_ARRAY_REVERSE, BEHAVIOUR_ARRAY_REVERSE); entity_model!( diff --git a/plugins/array/crates/model/src/lib.rs b/plugins/array/crates/model/src/lib.rs index 52de8c82..7747212a 100644 --- a/plugins/array/crates/model/src/lib.rs +++ b/plugins/array/crates/model/src/lib.rs @@ -1,9 +1,9 @@ -pub use entity::array_contains::*; -pub use entity::array_get_by_index::*; -pub use entity::array_length::*; -pub use entity::array_pop::*; -pub use entity::array_push::*; -pub use entity::array_reverse::*; +pub use entity::contains::*; +pub use entity::get_by_index::*; +pub use entity::length::*; +pub use entity::pop::*; +pub use entity::push::*; +pub use entity::reverse::*; pub mod entity; diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_contains.rs b/plugins/array/crates/plugin/src/behaviour/entity/contains.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_contains.rs rename to plugins/array/crates/plugin/src/behaviour/entity/contains.rs diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_get_by_index.rs b/plugins/array/crates/plugin/src/behaviour/entity/get_by_index.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_get_by_index.rs rename to plugins/array/crates/plugin/src/behaviour/entity/get_by_index.rs diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_length.rs b/plugins/array/crates/plugin/src/behaviour/entity/length.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_length.rs rename to plugins/array/crates/plugin/src/behaviour/entity/length.rs diff --git a/plugins/array/crates/plugin/src/behaviour/entity/mod.rs b/plugins/array/crates/plugin/src/behaviour/entity/mod.rs index da5d9c62..a7885e80 100644 --- a/plugins/array/crates/plugin/src/behaviour/entity/mod.rs +++ b/plugins/array/crates/plugin/src/behaviour/entity/mod.rs @@ -1,6 +1,6 @@ -pub mod array_contains; -pub mod array_get_by_index; -pub mod array_length; -pub mod array_pop; -pub mod array_push; -pub mod array_reverse; +pub mod contains; +pub mod get_by_index; +pub mod length; +pub mod pop; +pub mod push; +pub mod reverse; diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_pop.rs b/plugins/array/crates/plugin/src/behaviour/entity/pop.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_pop.rs rename to plugins/array/crates/plugin/src/behaviour/entity/pop.rs diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_push.rs b/plugins/array/crates/plugin/src/behaviour/entity/push.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_push.rs rename to plugins/array/crates/plugin/src/behaviour/entity/push.rs diff --git a/plugins/array/crates/plugin/src/behaviour/entity/array_reverse.rs b/plugins/array/crates/plugin/src/behaviour/entity/reverse.rs similarity index 100% rename from plugins/array/crates/plugin/src/behaviour/entity/array_reverse.rs rename to plugins/array/crates/plugin/src/behaviour/entity/reverse.rs diff --git a/plugins/array/crates/plugin/src/plugin.rs b/plugins/array/crates/plugin/src/plugin.rs index 6125b4f3..c54c2e54 100644 --- a/plugins/array/crates/plugin/src/plugin.rs +++ b/plugins/array/crates/plugin/src/plugin.rs @@ -2,12 +2,12 @@ use reactive_graph_plugin_api::EntityBehaviourRegistry; use reactive_graph_plugin_api::prelude::plugin::*; use reactive_graph_plugin_api::prelude::providers::*; -use crate::behaviour::entity::array_contains::ArrayContainsFactory; -use crate::behaviour::entity::array_get_by_index::ArrayGetByIndexFactory; -use crate::behaviour::entity::array_length::ArrayLengthFactory; -use crate::behaviour::entity::array_pop::ArrayPopFactory; -use crate::behaviour::entity::array_push::ArrayPushFactory; -use crate::behaviour::entity::array_reverse::ArrayReverseFactory; +use crate::behaviour::entity::contains::ArrayContainsFactory; +use crate::behaviour::entity::get_by_index::ArrayGetByIndexFactory; +use crate::behaviour::entity::length::ArrayLengthFactory; +use crate::behaviour::entity::pop::ArrayPopFactory; +use crate::behaviour::entity::push::ArrayPushFactory; +use crate::behaviour::entity::reverse::ArrayReverseFactory; use reactive_graph_std_array_model::BEHAVIOUR_ARRAY_CONTAINS; use reactive_graph_std_array_model::BEHAVIOUR_ARRAY_GET_BY_INDEX; use reactive_graph_std_array_model::BEHAVIOUR_ARRAY_LENGTH; diff --git a/plugins/array/crates/plugin/types/entities/array_contains.json b/plugins/array/crates/plugin/types/entities/contains.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_contains.json rename to plugins/array/crates/plugin/types/entities/contains.json diff --git a/plugins/array/crates/plugin/types/entities/array_get_by_index.json b/plugins/array/crates/plugin/types/entities/get_by_index.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_get_by_index.json rename to plugins/array/crates/plugin/types/entities/get_by_index.json diff --git a/plugins/array/crates/plugin/types/entities/array_length.json b/plugins/array/crates/plugin/types/entities/length.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_length.json rename to plugins/array/crates/plugin/types/entities/length.json diff --git a/plugins/array/crates/plugin/types/entities/array_pop.json b/plugins/array/crates/plugin/types/entities/pop.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_pop.json rename to plugins/array/crates/plugin/types/entities/pop.json diff --git a/plugins/array/crates/plugin/types/entities/array_push.json b/plugins/array/crates/plugin/types/entities/push.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_push.json rename to plugins/array/crates/plugin/types/entities/push.json diff --git a/plugins/array/crates/plugin/types/entities/array_reverse.json b/plugins/array/crates/plugin/types/entities/reverse.json similarity index 100% rename from plugins/array/crates/plugin/types/entities/array_reverse.json rename to plugins/array/crates/plugin/types/entities/reverse.json diff --git a/plugins/date-time/crates/plugin/types/relations/first_day.json b/plugins/date-time/crates/plugin/types/relations/first_day.json index 87db01e6..c96c5f30 100644 --- a/plugins/date-time/crates/plugin/types/relations/first_day.json +++ b/plugins/date-time/crates/plugin/types/relations/first_day.json @@ -1,6 +1,6 @@ { "$id": "https://schema.reactive-graph.io/schema/json/relation-type.schema.json", -v "namespace": "date_time", + "namespace": "date_time", "type_name": "first_day", "description": "The first day of the month", "outbound": { diff --git a/plugins/flow/crates/plugin/types/components/flow_2d.json b/plugins/flow/crates/plugin/types/components/flow_2d.json index 0b7586b8..7cdce603 100644 --- a/plugins/flow/crates/plugin/types/components/flow_2d.json +++ b/plugins/flow/crates/plugin/types/components/flow_2d.json @@ -30,9 +30,5 @@ } ], "extensions": [ - { - "name": "component_category", - "extension": "flow" - } ] } diff --git a/plugins/flow/crates/plugin/types/components/flow_3d.json b/plugins/flow/crates/plugin/types/components/flow_3d.json index f29ac39e..8512d578 100644 --- a/plugins/flow/crates/plugin/types/components/flow_3d.json +++ b/plugins/flow/crates/plugin/types/components/flow_3d.json @@ -42,9 +42,5 @@ } ], "extensions": [ - { - "name": "component_category", - "extension": "flow" - } ] } diff --git a/plugins/object/crates/model/src/entity/object_get_property.rs b/plugins/object/crates/model/src/entity/get_property.rs similarity index 87% rename from plugins/object/crates/model/src/entity/object_get_property.rs rename to plugins/object/crates/model/src/entity/get_property.rs index cac65ff4..5433200f 100644 --- a/plugins/object/crates/model/src/entity/object_get_property.rs +++ b/plugins/object/crates/model/src/entity/get_property.rs @@ -8,8 +8,8 @@ use reactive_graph_std_result_model::ResultAny; properties!(ObjectGetPropertyProperties, (OBJECT, "object", {}), (PROPERTY_NAME, "property_name", "")); -entity_ty!(ENTITY_TYPE_OBJECT_GET_PROPERTY, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_GET_PROPERTY, "object_get_property"); -behaviour_ty!(BEHAVIOUR_OBJECT_GET_PROPERTY, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_GET_PROPERTY, "object_get_property"); +entity_ty!(ENTITY_TYPE_OBJECT_GET_PROPERTY, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_GET_PROPERTY, "get_property"); +behaviour_ty!(BEHAVIOUR_OBJECT_GET_PROPERTY, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_GET_PROPERTY, "get_property"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_OBJECT_GET_PROPERTY, ENTITY_TYPE_OBJECT_GET_PROPERTY, BEHAVIOUR_OBJECT_GET_PROPERTY); entity_model!( diff --git a/plugins/object/crates/model/src/entity/object_keys.rs b/plugins/object/crates/model/src/entity/keys.rs similarity index 90% rename from plugins/object/crates/model/src/entity/object_keys.rs rename to plugins/object/crates/model/src/entity/keys.rs index 5a68b447..bf9cb450 100644 --- a/plugins/object/crates/model/src/entity/object_keys.rs +++ b/plugins/object/crates/model/src/entity/keys.rs @@ -8,8 +8,8 @@ use serde_json::json; properties!(ObjectKeysProperties, (OBJECT, "object", {}), (KEYS, "keys", json!([]))); -entity_ty!(ENTITY_TYPE_OBJECT_KEYS, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_KEYS, "object_keys"); -behaviour_ty!(BEHAVIOUR_OBJECT_KEYS, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_KEYS, "object_keys"); +entity_ty!(ENTITY_TYPE_OBJECT_KEYS, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_KEYS, "keys"); +behaviour_ty!(BEHAVIOUR_OBJECT_KEYS, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_KEYS, "keys"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_OBJECT_KEYS, ENTITY_TYPE_OBJECT_KEYS, BEHAVIOUR_OBJECT_KEYS); entity_model!( diff --git a/plugins/object/crates/model/src/entity/mod.rs b/plugins/object/crates/model/src/entity/mod.rs index 48806408..a5a24851 100644 --- a/plugins/object/crates/model/src/entity/mod.rs +++ b/plugins/object/crates/model/src/entity/mod.rs @@ -1,9 +1,9 @@ -pub use object_get_property::*; -pub use object_keys::*; -pub use object_remove_property::*; -pub use object_set_property::*; +pub use get_property::*; +pub use keys::*; +pub use remove_property::*; +pub use set_property::*; -pub mod object_get_property; -pub mod object_keys; -pub mod object_remove_property; -pub mod object_set_property; +pub mod get_property; +pub mod keys; +pub mod remove_property; +pub mod set_property; diff --git a/plugins/object/crates/model/src/entity/object_remove_property.rs b/plugins/object/crates/model/src/entity/remove_property.rs similarity index 82% rename from plugins/object/crates/model/src/entity/object_remove_property.rs rename to plugins/object/crates/model/src/entity/remove_property.rs index 8a6224b1..103c9580 100644 --- a/plugins/object/crates/model/src/entity/object_remove_property.rs +++ b/plugins/object/crates/model/src/entity/remove_property.rs @@ -12,14 +12,9 @@ entity_ty!( ENTITY_TYPE_OBJECT_REMOVE_PROPERTY, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_REMOVE_PROPERTY, - "object_remove_property" -); -behaviour_ty!( - BEHAVIOUR_OBJECT_REMOVE_PROPERTY, - NAMESPACE_OBJECT, - BEHAVIOUR_NAME_OBJECT_REMOVE_PROPERTY, - "object_remove_property" + "remove_property" ); +behaviour_ty!(BEHAVIOUR_OBJECT_REMOVE_PROPERTY, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_REMOVE_PROPERTY, "remove_property"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_OBJECT_REMOVE_PROPERTY, ENTITY_TYPE_OBJECT_REMOVE_PROPERTY, BEHAVIOUR_OBJECT_REMOVE_PROPERTY); entity_model!( diff --git a/plugins/object/crates/model/src/entity/object_set_property.rs b/plugins/object/crates/model/src/entity/set_property.rs similarity index 88% rename from plugins/object/crates/model/src/entity/object_set_property.rs rename to plugins/object/crates/model/src/entity/set_property.rs index ef7bf3f4..873ca408 100644 --- a/plugins/object/crates/model/src/entity/object_set_property.rs +++ b/plugins/object/crates/model/src/entity/set_property.rs @@ -13,8 +13,8 @@ properties!( (VALUE, "value", "") ); -entity_ty!(ENTITY_TYPE_OBJECT_SET_PROPERTY, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_SET_PROPERTY, "object_set_property"); -behaviour_ty!(BEHAVIOUR_OBJECT_SET_PROPERTY, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_SET_PROPERTY, "object_set_property"); +entity_ty!(ENTITY_TYPE_OBJECT_SET_PROPERTY, NAMESPACE_OBJECT, ENTITY_TYPE_NAME_OBJECT_SET_PROPERTY, "set_property"); +behaviour_ty!(BEHAVIOUR_OBJECT_SET_PROPERTY, NAMESPACE_OBJECT, BEHAVIOUR_NAME_OBJECT_SET_PROPERTY, "set_property"); entity_behaviour_ty!(ENTITY_BEHAVIOUR_OBJECT_SET_PROPERTY, ENTITY_TYPE_OBJECT_SET_PROPERTY, BEHAVIOUR_OBJECT_SET_PROPERTY); entity_model!( diff --git a/plugins/object/crates/model/src/lib.rs b/plugins/object/crates/model/src/lib.rs index 68b59b6a..71d4e499 100644 --- a/plugins/object/crates/model/src/lib.rs +++ b/plugins/object/crates/model/src/lib.rs @@ -1,7 +1,7 @@ -pub use entity::object_get_property::*; -pub use entity::object_keys::*; -pub use entity::object_remove_property::*; -pub use entity::object_set_property::*; +pub use entity::get_property::*; +pub use entity::keys::*; +pub use entity::remove_property::*; +pub use entity::set_property::*; pub mod entity; diff --git a/plugins/object/crates/plugin/src/behaviour/entity/get_property.rs b/plugins/object/crates/plugin/src/behaviour/entity/get_property.rs new file mode 100644 index 00000000..5ef68d8a --- /dev/null +++ b/plugins/object/crates/plugin/src/behaviour/entity/get_property.rs @@ -0,0 +1,70 @@ +use reactive_graph_behaviour_model_api::behaviour_validator; +use reactive_graph_behaviour_model_api::prelude::*; +use reactive_graph_behaviour_model_impl::entity_behaviour; +use reactive_graph_graph::prelude::*; +use reactive_graph_reactive_model_impl::ReactiveEntity; +use serde_json::Value; +use uuid::Uuid; + +use reactive_graph_std_object_model::ObjectGetPropertyProperties::OBJECT; +use reactive_graph_std_object_model::ObjectGetPropertyProperties::PROPERTY_NAME; +use reactive_graph_std_result_model::ResultAnyProperties::RESULT; + +entity_behaviour!( + ObjectGetProperty, + ObjectGetPropertyFactory, + ObjectGetPropertyFsm, + ObjectGetPropertyBehaviourTransitions, + ObjectGetPropertyValidator +); + +behaviour_validator!(ObjectGetPropertyValidator, Uuid, ReactiveEntity, OBJECT.as_ref(), RESULT.as_ref(), PROPERTY_NAME.as_ref()); + +impl BehaviourInit for ObjectGetPropertyBehaviourTransitions { + fn init(&self) -> Result<(), BehaviourInitializationFailed> { + if let Some(object) = self.reactive_instance.get(OBJECT) { + if let Some(property_name) = self.reactive_instance.get(PROPERTY_NAME) { + if let Some(result) = get_property_by_name(&object, &property_name) { + self.reactive_instance.set(RESULT, result); + } + } + } + Ok(()) + } +} + +impl BehaviourConnect for ObjectGetPropertyBehaviourTransitions { + fn connect(&self) -> Result<(), BehaviourConnectFailed> { + let reactive_instance = self.reactive_instance.clone(); + self.property_observers.observe_with_handle(OBJECT.as_ref(), move |object: &Value| { + if let Some(property_name) = reactive_instance.get(PROPERTY_NAME) { + if let Some(result) = get_property_by_name(object, &property_name) { + reactive_instance.set(RESULT, result); + } + } + }); + let reactive_instance = self.reactive_instance.clone(); + self.property_observers + .observe_with_handle(PROPERTY_NAME.as_ref(), move |property_name: &Value| { + if let Some(object) = reactive_instance.get(OBJECT) { + if let Some(result) = get_property_by_name(&object, property_name) { + reactive_instance.set(RESULT, result); + } + } + }); + Ok(()) + } +} + +impl BehaviourShutdown for ObjectGetPropertyBehaviourTransitions {} +impl BehaviourTransitions for ObjectGetPropertyBehaviourTransitions {} + +fn get_property_by_name(object: &Value, property_name: &Value) -> Option { + match property_name.as_str() { + Some(property_name) => match object.as_object() { + Some(object) => object.get(property_name).cloned(), + None => None, + }, + _ => None, + } +} diff --git a/plugins/object/crates/plugin/src/behaviour/entity/object_keys.rs b/plugins/object/crates/plugin/src/behaviour/entity/keys.rs similarity index 100% rename from plugins/object/crates/plugin/src/behaviour/entity/object_keys.rs rename to plugins/object/crates/plugin/src/behaviour/entity/keys.rs diff --git a/plugins/object/crates/plugin/src/behaviour/entity/mod.rs b/plugins/object/crates/plugin/src/behaviour/entity/mod.rs index 1db3e1bb..63345de0 100644 --- a/plugins/object/crates/plugin/src/behaviour/entity/mod.rs +++ b/plugins/object/crates/plugin/src/behaviour/entity/mod.rs @@ -1,4 +1,4 @@ -pub mod object_get_property; -pub mod object_keys; -pub mod object_remove_property; -pub mod object_set_property; +pub mod get_property; +pub mod keys; +pub mod remove_property; +pub mod set_property; diff --git a/plugins/object/crates/plugin/src/behaviour/entity/object_get_property.rs b/plugins/object/crates/plugin/src/behaviour/entity/object_get_property.rs deleted file mode 100644 index 747fc12d..00000000 --- a/plugins/object/crates/plugin/src/behaviour/entity/object_get_property.rs +++ /dev/null @@ -1,174 +0,0 @@ -use reactive_graph_behaviour_model_api::behaviour_validator; -use reactive_graph_behaviour_model_api::prelude::*; -use reactive_graph_behaviour_model_impl::entity_behaviour; -use reactive_graph_graph::prelude::*; -use reactive_graph_reactive_model_impl::ReactiveEntity; -use serde_json::Value; -use uuid::Uuid; - -use reactive_graph_std_object_model::ObjectGetPropertyProperties::OBJECT; -use reactive_graph_std_object_model::ObjectGetPropertyProperties::PROPERTY_NAME; -use reactive_graph_std_result_model::ResultAnyProperties::RESULT; - -entity_behaviour!( - ObjectGetProperty, - ObjectGetPropertyFactory, - ObjectGetPropertyFsm, - ObjectGetPropertyBehaviourTransitions, - ObjectGetPropertyValidator -); - -behaviour_validator!(ObjectGetPropertyValidator, Uuid, ReactiveEntity, OBJECT.as_ref(), RESULT.as_ref(), PROPERTY_NAME.as_ref()); - -impl BehaviourInit for ObjectGetPropertyBehaviourTransitions { - fn init(&self) -> Result<(), BehaviourInitializationFailed> { - if let Some(object) = self.reactive_instance.get(OBJECT) { - if let Some(property_name) = self.reactive_instance.get(PROPERTY_NAME) { - if let Some(result) = get_property_by_name(&object, &property_name) { - self.reactive_instance.set(RESULT, result); - } - } - } - Ok(()) - } -} - -impl BehaviourConnect for ObjectGetPropertyBehaviourTransitions { - fn connect(&self) -> Result<(), BehaviourConnectFailed> { - let reactive_instance = self.reactive_instance.clone(); - self.property_observers.observe_with_handle(OBJECT.as_ref(), move |object: &Value| { - if let Some(property_name) = reactive_instance.get(PROPERTY_NAME) { - if let Some(result) = get_property_by_name(object, &property_name) { - reactive_instance.set(RESULT, result); - } - } - }); - let reactive_instance = self.reactive_instance.clone(); - self.property_observers - .observe_with_handle(PROPERTY_NAME.as_ref(), move |property_name: &Value| { - if let Some(object) = reactive_instance.get(OBJECT) { - if let Some(result) = get_property_by_name(&object, property_name) { - reactive_instance.set(RESULT, result); - } - } - }); - Ok(()) - } -} - -impl BehaviourShutdown for ObjectGetPropertyBehaviourTransitions {} -impl BehaviourTransitions for ObjectGetPropertyBehaviourTransitions {} - -fn get_property_by_name(object: &Value, property_name: &Value) -> Option { - match property_name.as_str() { - Some(property_name) => match object.as_object() { - Some(object) => object.get(property_name).cloned(), - None => None, - }, - _ => None, - } -} - -// use std::convert::AsRef; -// use std::sync::Arc; -// -// use reactive_graph_graph::{PropertyInstanceGetter, PropertyInstanceSetter}; -// use crate::reactive::BehaviourCreationError; -// use log::{error, trace}; -// use serde_json::Value; -// -// use crate::behaviour::entity::ObjectGetPropertyProperties; -// use reactive_graph_graph::ReactiveEntityInstance; -// use crate::reactive::entity::Disconnectable; -// -// pub const OBJECT_GET_PROPERTY: &'static str = "object_get_property"; -// -// pub struct ObjectGetProperty { -// pub entity: Arc, -// -// pub property_name_handle_id: u128, -// -// pub object_handle_id: u128, -// } -// -// impl ObjectGetProperty { -// pub fn new<'a>(e: Arc) -> Result { -// let property_name = e.properties.get(ObjectGetPropertyProperties::PROPERTY_NAME.as_ref()); -// if property_name.is_none() { -// error!("Missing property {}", ObjectGetPropertyProperties::PROPERTY_NAME.as_ref()); -// return Err(BehaviourCreationError.into()); -// } -// let property_name_handle_id = property_name.unwrap().id.as_u128(); -// -// let object = e.properties.get(ObjectGetPropertyProperties::OBJECT.as_ref()); -// if object.is_none() { -// error!("Missing property {}", ObjectGetPropertyProperties::OBJECT.as_ref()); -// return Err(BehaviourCreationError.into()); -// } -// let object_handle_id = object.unwrap().id.as_u128(); -// -// let o_entity = e.clone(); -// e.properties -// .get(ObjectGetPropertyProperties::OBJECT.as_ref()) -// .unwrap() -// .stream -// .read() -// .unwrap() -// .observe_with_handle( -// move |object| match get_property_by_name(object, &o_entity.get(ObjectGetPropertyProperties::PROPERTY_NAME.as_ref()).unwrap()) { -// Some(result) => { -// o_entity.set(ObjectGetPropertyProperties::RESULT.as_ref(), result); -// } -// None => {} -// }, -// object_handle_id, -// ); -// let p_entity = e.clone(); -// e.properties -// .get(ObjectGetPropertyProperties::PROPERTY_NAME.as_ref()) -// .unwrap() -// .stream -// .read() -// .unwrap() -// .observe_with_handle( -// move |property_name| match get_property_by_name(&p_entity.get(ObjectGetPropertyProperties::OBJECT.as_ref()).unwrap(), property_name) { -// Some(result) => { -// p_entity.set(ObjectGetPropertyProperties::RESULT.as_ref(), result); -// } -// None => {} -// }, -// property_name_handle_id, -// ); -// Ok(ObjectGetProperty { -// entity: e.clone(), -// property_name_handle_id, -// object_handle_id, -// }) -// } -// -// pub fn type_name(&self) -> String { -// self.entity.type_name.clone() -// } -// } -// -// impl Disconnectable for ObjectGetProperty { -// fn disconnect(&self) { -// trace!("Disconnecting {} with id {}", OBJECT_GET_PROPERTY, self.object_handle_id); -// match self.entity.properties.get(ObjectGetPropertyProperties::OBJECT.as_ref()) { -// Some(property) => property.stream.read().unwrap().remove(self.object_handle_id), -// _ => {} -// } -// trace!("Disconnecting {} with id {}", OBJECT_GET_PROPERTY, self.property_name_handle_id); -// match self.entity.properties.get(ObjectGetPropertyProperties::PROPERTY_NAME.as_ref()) { -// Some(property) => property.stream.read().unwrap().remove(self.property_name_handle_id), -// _ => {} -// } -// } -// } -// -// /// Automatically disconnect streams on destruction -// impl Drop for ObjectGetProperty { -// fn drop(&mut self) { -// self.disconnect(); -// } -// } diff --git a/plugins/object/crates/plugin/src/behaviour/entity/object_remove_property.rs b/plugins/object/crates/plugin/src/behaviour/entity/remove_property.rs similarity index 100% rename from plugins/object/crates/plugin/src/behaviour/entity/object_remove_property.rs rename to plugins/object/crates/plugin/src/behaviour/entity/remove_property.rs diff --git a/plugins/object/crates/plugin/src/behaviour/entity/object_set_property.rs b/plugins/object/crates/plugin/src/behaviour/entity/set_property.rs similarity index 100% rename from plugins/object/crates/plugin/src/behaviour/entity/object_set_property.rs rename to plugins/object/crates/plugin/src/behaviour/entity/set_property.rs diff --git a/plugins/object/crates/plugin/src/plugin.rs b/plugins/object/crates/plugin/src/plugin.rs index e550bfa5..9f4a2794 100644 --- a/plugins/object/crates/plugin/src/plugin.rs +++ b/plugins/object/crates/plugin/src/plugin.rs @@ -2,10 +2,10 @@ use reactive_graph_plugin_api::EntityBehaviourRegistry; use reactive_graph_plugin_api::prelude::plugin::*; use reactive_graph_plugin_api::prelude::providers::*; -use crate::behaviour::entity::object_get_property::ObjectGetPropertyFactory; -use crate::behaviour::entity::object_keys::ObjectKeysFactory; -use crate::behaviour::entity::object_remove_property::ObjectRemovePropertyFactory; -use crate::behaviour::entity::object_set_property::ObjectSetPropertyFactory; +use crate::behaviour::entity::get_property::ObjectGetPropertyFactory; +use crate::behaviour::entity::keys::ObjectKeysFactory; +use crate::behaviour::entity::remove_property::ObjectRemovePropertyFactory; +use crate::behaviour::entity::set_property::ObjectSetPropertyFactory; use reactive_graph_std_object_model::BEHAVIOUR_OBJECT_GET_PROPERTY; use reactive_graph_std_object_model::BEHAVIOUR_OBJECT_KEYS; use reactive_graph_std_object_model::BEHAVIOUR_OBJECT_REMOVE_PROPERTY; diff --git a/plugins/object/crates/plugin/types/entities/object_get_property.json b/plugins/object/crates/plugin/types/entities/get_property.json similarity index 100% rename from plugins/object/crates/plugin/types/entities/object_get_property.json rename to plugins/object/crates/plugin/types/entities/get_property.json diff --git a/plugins/object/crates/plugin/types/entities/object_keys.json b/plugins/object/crates/plugin/types/entities/keys.json similarity index 100% rename from plugins/object/crates/plugin/types/entities/object_keys.json rename to plugins/object/crates/plugin/types/entities/keys.json diff --git a/plugins/object/crates/plugin/types/entities/object_remove_property.json b/plugins/object/crates/plugin/types/entities/remove_property.json similarity index 100% rename from plugins/object/crates/plugin/types/entities/object_remove_property.json rename to plugins/object/crates/plugin/types/entities/remove_property.json diff --git a/plugins/object/crates/plugin/types/entities/object_set_property.json b/plugins/object/crates/plugin/types/entities/set_property.json similarity index 100% rename from plugins/object/crates/plugin/types/entities/object_set_property.json rename to plugins/object/crates/plugin/types/entities/set_property.json