Skip to content

Commit 7c499c2

Browse files
authored
Return bytesAsIds,declaredEthCalls,aggreagtions,immutableEntities as features on status api (#5582)
* graph,server: add more features on status api * fix: release build err * fix: test cases * refactor: add features from resolver fn
1 parent 60a3c14 commit 7c499c2

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

graph/src/data/subgraph/features.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ pub enum SubgraphFeature {
3333
NonFatalErrors,
3434
Grafting,
3535
FullTextSearch,
36+
Aggregations,
37+
BytesAsIds,
38+
DeclaredEthCalls,
39+
ImmutableEntities,
3640
#[serde(alias = "nonDeterministicIpfs")]
3741
IpfsOnEthereumContracts,
3842
}
@@ -154,11 +158,15 @@ mod tests {
154158
FullTextSearch,
155159
IpfsOnEthereumContracts,
156160
];
157-
const STRING: [&str; 4] = [
161+
const STRING: [&str; 8] = [
158162
"nonFatalErrors",
159163
"grafting",
160164
"fullTextSearch",
161165
"ipfsOnEthereumContracts",
166+
"declaredEthCalls",
167+
"aggregations",
168+
"immutableEntities",
169+
"bytesAsIds",
162170
];
163171

164172
#[test]

server/index-node/src/resolver.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,24 @@ impl<S: Store> IndexNodeResolver<S> {
627627

628628
let subgraph_store = self.store.subgraph_store();
629629
let features = match subgraph_store.subgraph_features(&deployment_hash).await? {
630-
Some(features) => features,
630+
Some(features) => {
631+
let mut deployment_features = features.clone();
632+
let features = &mut deployment_features.features;
633+
634+
if deployment_features.has_declared_calls {
635+
features.push("declaredEthCalls".to_string());
636+
}
637+
if deployment_features.has_aggregations {
638+
features.push("aggregations".to_string());
639+
}
640+
if !deployment_features.immutable_entities.is_empty() {
641+
features.push("immutableEntities".to_string());
642+
}
643+
if deployment_features.has_bytes_as_ids {
644+
features.push("bytesAsIds".to_string());
645+
}
646+
deployment_features
647+
}
631648
None => self.get_features_from_ipfs(&deployment_hash).await?,
632649
};
633650

server/index-node/src/schema.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ enum Feature {
161161
grafting
162162
fullTextSearch
163163
ipfsOnEthereumContracts
164+
aggregations
165+
declaredEthCalls
166+
immutableEntities
167+
bytesAsIds
164168
}
165169

166170
input BlockInput {

store/test-store/tests/postgres/subgraph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fn subgraph_features() {
549549
assert_eq!(
550550
vec![
551551
SubgraphFeature::NonFatalErrors.to_string(),
552-
SubgraphFeature::FullTextSearch.to_string()
552+
SubgraphFeature::FullTextSearch.to_string(),
553553
],
554554
features
555555
);

0 commit comments

Comments
 (0)