added static property constraints using const and enums and fixed formatter ON rendering
This commit is contained in:
@ -211,13 +211,6 @@
|
|||||||
"gender": {},
|
"gender": {},
|
||||||
"gender.condition": {
|
"gender.condition": {
|
||||||
"type": "condition",
|
"type": "condition",
|
||||||
"compiledPropertyNames": [
|
|
||||||
"kind",
|
|
||||||
"$eq",
|
|
||||||
"$ne",
|
|
||||||
"$of",
|
|
||||||
"$nof"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"$eq": {
|
"$eq": {
|
||||||
"type": [
|
"type": [
|
||||||
@ -231,15 +224,6 @@
|
|||||||
"null"
|
"null"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"$nof": {
|
|
||||||
"type": [
|
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
|
||||||
"type": "gender"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$of": {
|
"$of": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
@ -248,11 +232,167 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "gender"
|
"type": "gender"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"$nof": {
|
||||||
|
"type": [
|
||||||
|
"array",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"items": {
|
||||||
|
"type": "gender"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq",
|
||||||
|
"$ne",
|
||||||
|
"$of",
|
||||||
|
"$nof"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"person": {},
|
"person": {},
|
||||||
"person.filter": {
|
"person.filter": {
|
||||||
|
"type": "filter",
|
||||||
|
"properties": {
|
||||||
|
"first_name": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"age": {
|
||||||
|
"type": [
|
||||||
|
"integer.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"billing_address": {
|
||||||
|
"type": [
|
||||||
|
"address.filter",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"city",
|
||||||
|
"$and",
|
||||||
|
"$or"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"type": [
|
||||||
|
"gender.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq",
|
||||||
|
"$ne",
|
||||||
|
"$of",
|
||||||
|
"$nof"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"birth_date": {
|
||||||
|
"type": [
|
||||||
|
"date.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"uuid_field": {
|
||||||
|
"type": [
|
||||||
|
"uuid.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ad_hoc": {
|
||||||
|
"type": [
|
||||||
|
"filter",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"foo": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"foo"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"$and": {
|
||||||
|
"type": [
|
||||||
|
"array",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"items": {
|
||||||
|
"type": "person.filter",
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"first_name",
|
||||||
|
"age",
|
||||||
|
"billing_address",
|
||||||
|
"gender",
|
||||||
|
"birth_date",
|
||||||
|
"uuid_field",
|
||||||
|
"tags",
|
||||||
|
"ad_hoc",
|
||||||
|
"$and",
|
||||||
|
"$or"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$or": {
|
||||||
|
"type": [
|
||||||
|
"array",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"items": {
|
||||||
|
"type": "person.filter",
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"first_name",
|
||||||
|
"age",
|
||||||
|
"billing_address",
|
||||||
|
"gender",
|
||||||
|
"birth_date",
|
||||||
|
"uuid_field",
|
||||||
|
"tags",
|
||||||
|
"ad_hoc",
|
||||||
|
"$and",
|
||||||
|
"$or"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"compiledPropertyNames": [
|
"compiledPropertyNames": [
|
||||||
"first_name",
|
"first_name",
|
||||||
"age",
|
"age",
|
||||||
@ -264,133 +404,34 @@
|
|||||||
"ad_hoc",
|
"ad_hoc",
|
||||||
"$and",
|
"$and",
|
||||||
"$or"
|
"$or"
|
||||||
],
|
]
|
||||||
"properties": {
|
|
||||||
"$and": {
|
|
||||||
"items": {
|
|
||||||
"compiledPropertyNames": [
|
|
||||||
"first_name",
|
|
||||||
"age",
|
|
||||||
"billing_address",
|
|
||||||
"gender",
|
|
||||||
"birth_date",
|
|
||||||
"uuid_field",
|
|
||||||
"tags",
|
|
||||||
"ad_hoc",
|
|
||||||
"$and",
|
|
||||||
"$or"
|
|
||||||
],
|
|
||||||
"type": "person.filter"
|
|
||||||
},
|
|
||||||
"type": [
|
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"$or": {
|
|
||||||
"items": {
|
|
||||||
"compiledPropertyNames": [
|
|
||||||
"first_name",
|
|
||||||
"age",
|
|
||||||
"billing_address",
|
|
||||||
"gender",
|
|
||||||
"birth_date",
|
|
||||||
"uuid_field",
|
|
||||||
"tags",
|
|
||||||
"ad_hoc",
|
|
||||||
"$and",
|
|
||||||
"$or"
|
|
||||||
],
|
|
||||||
"type": "person.filter"
|
|
||||||
},
|
|
||||||
"type": [
|
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"ad_hoc": {
|
|
||||||
"compiledPropertyNames": [
|
|
||||||
"foo"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"foo": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": [
|
|
||||||
"filter",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"age": {
|
|
||||||
"type": [
|
|
||||||
"integer.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"billing_address": {
|
|
||||||
"type": [
|
|
||||||
"address.filter",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"birth_date": {
|
|
||||||
"type": [
|
|
||||||
"date.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"uuid_field": {
|
|
||||||
"type": [
|
|
||||||
"uuid.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"first_name": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"type": [
|
|
||||||
"gender.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tags": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "filter"
|
|
||||||
},
|
},
|
||||||
"address": {},
|
"address": {},
|
||||||
"address.filter": {
|
"address.filter": {
|
||||||
"type": "filter",
|
"type": "filter",
|
||||||
"compiledPropertyNames": [
|
|
||||||
"city",
|
|
||||||
"$and",
|
|
||||||
"$or"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"city": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
"$and": {
|
"$and": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "address.filter",
|
||||||
"compiledPropertyNames": [
|
"compiledPropertyNames": [
|
||||||
"city",
|
"city",
|
||||||
"$and",
|
"$and",
|
||||||
"$or"
|
"$or"
|
||||||
],
|
]
|
||||||
"type": "address.filter"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$or": {
|
"$or": {
|
||||||
@ -399,21 +440,20 @@
|
|||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "address.filter",
|
||||||
"compiledPropertyNames": [
|
"compiledPropertyNames": [
|
||||||
"city",
|
"city",
|
||||||
"$and",
|
"$and",
|
||||||
"$or"
|
"$or"
|
||||||
],
|
]
|
||||||
"type": "address.filter"
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"city",
|
||||||
|
"$and",
|
||||||
|
"$or"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"condition": {},
|
"condition": {},
|
||||||
"filter": {},
|
"filter": {},
|
||||||
@ -424,28 +464,47 @@
|
|||||||
"search": {},
|
"search": {},
|
||||||
"search.filter": {
|
"search.filter": {
|
||||||
"type": "filter",
|
"type": "filter",
|
||||||
"compiledPropertyNames": [
|
|
||||||
"kind",
|
|
||||||
"name",
|
|
||||||
"filter",
|
|
||||||
"$and",
|
|
||||||
"$or"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"kind": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": [
|
||||||
|
"string.condition",
|
||||||
|
"null"
|
||||||
|
],
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"$eq"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"type": [
|
||||||
|
"$kind.filter",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
},
|
||||||
"$and": {
|
"$and": {
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "search.filter",
|
||||||
"compiledPropertyNames": [
|
"compiledPropertyNames": [
|
||||||
"kind",
|
"kind",
|
||||||
"name",
|
"name",
|
||||||
"filter",
|
"filter",
|
||||||
"$and",
|
"$and",
|
||||||
"$or"
|
"$or"
|
||||||
],
|
]
|
||||||
"type": "search.filter"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$or": {
|
"$or": {
|
||||||
@ -454,35 +513,24 @@
|
|||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "search.filter",
|
||||||
"compiledPropertyNames": [
|
"compiledPropertyNames": [
|
||||||
"kind",
|
"kind",
|
||||||
"name",
|
"name",
|
||||||
"filter",
|
"filter",
|
||||||
"$and",
|
"$and",
|
||||||
"$or"
|
"$or"
|
||||||
],
|
]
|
||||||
"type": "search.filter"
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"filter": {
|
|
||||||
"type": [
|
|
||||||
"$kind.filter",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"kind": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": [
|
|
||||||
"string.condition",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"compiledPropertyNames": [
|
||||||
|
"kind",
|
||||||
|
"name",
|
||||||
|
"filter",
|
||||||
|
"$and",
|
||||||
|
"$or"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"description": "Queryer Execution",
|
"description": "Queryer Suite 1",
|
||||||
"database": {
|
"database": {
|
||||||
"puncs": [
|
"puncs": [
|
||||||
{
|
{
|
||||||
@ -2441,7 +2441,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Static relation constraints queries",
|
"description": "Queryer Suite 2",
|
||||||
"database": {
|
"database": {
|
||||||
"puncs": [
|
"puncs": [
|
||||||
{
|
{
|
||||||
@ -2671,6 +2671,7 @@
|
|||||||
" WHERE",
|
" WHERE",
|
||||||
" NOT entity_3.archived",
|
" NOT entity_3.archived",
|
||||||
" AND attachment_4.kind = 'cover'",
|
" AND attachment_4.kind = 'cover'",
|
||||||
|
" AND attachment_4.attachable_id = entity_1.id",
|
||||||
" ),",
|
" ),",
|
||||||
" 'cover_attachments', (",
|
" 'cover_attachments', (",
|
||||||
" SELECT COALESCE(jsonb_agg(jsonb_build_object(",
|
" SELECT COALESCE(jsonb_agg(jsonb_build_object(",
|
||||||
@ -2683,6 +2684,7 @@
|
|||||||
" WHERE",
|
" WHERE",
|
||||||
" NOT entity_5.archived",
|
" NOT entity_5.archived",
|
||||||
" AND attachment_6.kind = 'cover'",
|
" AND attachment_6.kind = 'cover'",
|
||||||
|
" AND attachment_6.attachable_id = entity_1.id",
|
||||||
" ),",
|
" ),",
|
||||||
" 'media_attachments', (",
|
" 'media_attachments', (",
|
||||||
" SELECT COALESCE(jsonb_agg(jsonb_build_object(",
|
" SELECT COALESCE(jsonb_agg(jsonb_build_object(",
|
||||||
@ -2695,6 +2697,7 @@
|
|||||||
" WHERE",
|
" WHERE",
|
||||||
" NOT entity_7.archived",
|
" NOT entity_7.archived",
|
||||||
" AND attachment_8.kind IN ('cover', 'thumbnail')",
|
" AND attachment_8.kind IN ('cover', 'thumbnail')",
|
||||||
|
" AND attachment_8.attachable_id = entity_1.id",
|
||||||
" )",
|
" )",
|
||||||
" )",
|
" )",
|
||||||
" FROM agreego.entity entity_1",
|
" FROM agreego.entity entity_1",
|
||||||
|
|||||||
@ -40,6 +40,7 @@ impl Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut props = IndexMap::new();
|
let mut props = IndexMap::new();
|
||||||
|
let mut inherited_edges = IndexMap::new();
|
||||||
|
|
||||||
// 1. Resolve INHERITANCE dependencies first
|
// 1. Resolve INHERITANCE dependencies first
|
||||||
if let Some(crate::database::object::SchemaTypeOrArray::Single(t)) = &self.obj.type_ {
|
if let Some(crate::database::object::SchemaTypeOrArray::Single(t)) = &self.obj.type_ {
|
||||||
@ -49,6 +50,9 @@ impl Schema {
|
|||||||
if let Some(p_props) = parent.obj.compiled_properties.get() {
|
if let Some(p_props) = parent.obj.compiled_properties.get() {
|
||||||
props.extend(p_props.clone());
|
props.extend(p_props.clone());
|
||||||
}
|
}
|
||||||
|
if let Some(p_edges) = parent.obj.compiled_edges.get() {
|
||||||
|
inherited_edges.extend(p_edges.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,6 +84,9 @@ impl Schema {
|
|||||||
if let Some(p_props) = parent.obj.compiled_properties.get() {
|
if let Some(p_props) = parent.obj.compiled_properties.get() {
|
||||||
props.extend(p_props.clone());
|
props.extend(p_props.clone());
|
||||||
}
|
}
|
||||||
|
if let Some(p_edges) = parent.obj.compiled_edges.get() {
|
||||||
|
inherited_edges.extend(p_edges.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +126,10 @@ impl Schema {
|
|||||||
let _ = self.obj.compiled_property_names.set(names);
|
let _ = self.obj.compiled_property_names.set(names);
|
||||||
|
|
||||||
// 5. Compute Edges natively
|
// 5. Compute Edges natively
|
||||||
let schema_edges = self.compile_edges(db, root_id, &path, &props, errors);
|
let mut schema_edges = self.compile_edges(db, root_id, &path, &props, errors);
|
||||||
|
for (k, v) in inherited_edges {
|
||||||
|
schema_edges.entry(k).or_insert(v);
|
||||||
|
}
|
||||||
let _ = self.obj.compiled_edges.set(schema_edges);
|
let _ = self.obj.compiled_edges.set(schema_edges);
|
||||||
|
|
||||||
// 5. Build our inline children properties recursively NOW! (Depth-first search)
|
// 5. Build our inline children properties recursively NOW! (Depth-first search)
|
||||||
|
|||||||
Reference in New Issue
Block a user