Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
24 changes: 12 additions & 12 deletions plugins/array/crates/model/src/entity/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
12 changes: 6 additions & 6 deletions plugins/array/crates/model/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
12 changes: 6 additions & 6 deletions plugins/array/crates/plugin/src/behaviour/entity/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 6 additions & 6 deletions plugins/array/crates/plugin/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 0 additions & 4 deletions plugins/flow/crates/plugin/types/components/flow_2d.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@
}
],
"extensions": [
{
"name": "component_category",
"extension": "flow"
}
]
}
4 changes: 0 additions & 4 deletions plugins/flow/crates/plugin/types/components/flow_3d.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,5 @@
}
],
"extensions": [
{
"name": "component_category",
"extension": "flow"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
16 changes: 8 additions & 8 deletions plugins/object/crates/model/src/entity/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
8 changes: 4 additions & 4 deletions plugins/object/crates/model/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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<Uuid, ReactiveEntity> 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<Uuid, ReactiveEntity> 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<Uuid, ReactiveEntity> for ObjectGetPropertyBehaviourTransitions {}
impl BehaviourTransitions<Uuid, ReactiveEntity> for ObjectGetPropertyBehaviourTransitions {}

fn get_property_by_name(object: &Value, property_name: &Value) -> Option<Value> {
match property_name.as_str() {
Some(property_name) => match object.as_object() {
Some(object) => object.get(property_name).cloned(),
None => None,
},
_ => None,
}
}
8 changes: 4 additions & 4 deletions plugins/object/crates/plugin/src/behaviour/entity/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Loading
Loading