Implement implicit object references and capability query foundations
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
GraphQLNonNull,
|
||||
GraphQLSchema,
|
||||
specifiedDirectives,
|
||||
visit,
|
||||
type GraphQLOutputType,
|
||||
type GraphQLInputType,
|
||||
type GraphQLFieldConfigMap,
|
||||
@@ -261,6 +262,19 @@ export function querySchema(
|
||||
};
|
||||
const schema = new GraphQLSchema({
|
||||
directives: specifiedDirectives,
|
||||
// Nominal projections can mention an interface not reached by a relation.
|
||||
types: (() => {
|
||||
const requested = new Set<string>();
|
||||
if (document)
|
||||
visit(document, {
|
||||
NamedType(node) {
|
||||
requested.add(node.name.value);
|
||||
},
|
||||
});
|
||||
return [...contracts.values()]
|
||||
.filter((contract) => !contract.template && requested.has(name(contract.revisionId)))
|
||||
.map((contract) => object(contract.revisionId));
|
||||
})(),
|
||||
query: new GraphQLObjectType({
|
||||
name: "QxQuery",
|
||||
fields: { root: { type: new GraphQLNonNull(object(root.interface)) } },
|
||||
|
||||
Reference in New Issue
Block a user