directus-monorepo ( Readme | API )
directus-monorepo > GraphQLService
new GraphQLService(
options):GraphQLService
| Parameter | Type |
|---|---|
options |
AbstractServiceOptions & {scope: "items" | "system";} |
api/src/services/graphql/index.ts:111
accountability:
any
api/src/services/graphql/index.ts:106
knex:
Knex<any,any[] >
api/src/services/graphql/index.ts:107
schema:
SchemaOverview
api/src/services/graphql/index.ts:108
scope:
"items"|"system"
api/src/services/graphql/index.ts:109
execute(
__namedParameters):Promise<FormattedExecutionResult<ObjMap<unknown>,ObjMap<unknown> > >
Execute a GraphQL structure
| Parameter | Type |
|---|---|
__namedParameters |
GraphQLParams |
Promise< FormattedExecutionResult< ObjMap< unknown >, ObjMap< unknown > > >
api/src/services/graphql/index.ts:121
formatError(
error):GraphQLError
Convert Directus-Exception into a GraphQL format, so it can be returned by GraphQL properly.
| Parameter | Type |
|---|---|
error |
any |
GraphQLError
api/src/services/graphql/index.ts:1803
getAggregateQuery(
rawQuery,selections):Query
Resolve the aggregation query based on the requested aggregated fields
| Parameter | Type |
|---|---|
rawQuery |
Query |
selections |
readonly SelectionNode[] |
Query
api/src/services/graphql/index.ts:1743
getQuery(
rawQuery,selections,variableValues):Query
Get a Directus Query object from the parsed arguments (rawQuery) and GraphQL AST selectionSet. Converts SelectionSet
into Directus' fields query for use in the resolver. Also applies variables where appropriate.
| Parameter | Type |
|---|---|
rawQuery |
Query |
selections |
readonly SelectionNode[] |
variableValues |
object |
Query
api/src/services/graphql/index.ts:1617
getSchema():
GraphQLSchema
Generate the GraphQL schema. Pulls from the schema information generated by the get-schema util.
GraphQLSchema
api/src/services/graphql/index.ts:167
getSchema(
type):GraphQLSchema
| Parameter | Type |
|---|---|
type |
"schema" |
GraphQLSchema
api/src/services/graphql/index.ts:168
getSchema(
type):string|GraphQLSchema
| Parameter | Type |
|---|---|
type |
"sdl" |
string | GraphQLSchema
api/src/services/graphql/index.ts:169
injectSystemResolvers(
schemaComposer,__namedParameters,schema):SchemaComposer<any>
| Parameter | Type |
|---|---|
schemaComposer |
SchemaComposer< {req: Request< ParamsDictionary, any, any, ParsedQs, Record< string, any > >; res: Response< any, Record< string, any > >;} > |
__namedParameters |
object |
__namedParameters.CreateCollectionTypes |
Record< string, ObjectTypeComposer< any, any > > |
__namedParameters.DeleteCollectionTypes |
Record< string, ObjectTypeComposer< any, any > > |
__namedParameters.ReadCollectionTypes |
Record< string, ObjectTypeComposer< any, any > > |
__namedParameters.UpdateCollectionTypes |
Record< string, ObjectTypeComposer< any, any > > |
schema |
object |
schema.create |
SchemaOverview |
schema.delete |
SchemaOverview |
schema.read |
SchemaOverview |
schema.update |
SchemaOverview |
SchemaComposer< any >
api/src/services/graphql/index.ts:1845
parseArgs(
args,variableValues):Record<string,any>
GraphQL's regular resolver args variable only contains the "top-level" arguments. Seeing that we convert the whole
nested tree into one big query using Directus' own query resolver, we want to have a nested structure of arguments for
the whole resolving tree, which can later be transformed into Directus' AST using deep. In order to do that, we'll
parse over all ArgumentNodes and ObjectFieldNodes to manually recreate an object structure of arguments
| Parameter | Type |
|---|---|
args |
readonly ArgumentNode[] |
variableValues |
object |
Record< string, any >
api/src/services/graphql/index.ts:1582
read(
collection,query):Promise<Partial<Item> >
Execute the read action on the correct service. Checks for singleton as well.
| Parameter | Type |
|---|---|
collection |
string |
query |
Query |
Promise< Partial< Item > >
api/src/services/graphql/index.ts:1533
replaceFragmentsInSelections(
selections,fragments):null| readonlySelectionNode[]
Replace all fragments in a selectionset for the actual selection set as defined in the fragment Effectively merges the selections with the fragments used in those selections
| Parameter | Type |
|---|---|
selections |
undefined | readonly SelectionNode[] |
fragments |
Record< string, FragmentDefinitionNode > |
null | readonly SelectionNode[]
api/src/services/graphql/index.ts:1817
replaceFuncs(
filter):Filter
Replace functions from GraphQL format to Directus-Filter format
| Parameter | Type |
|---|---|
filter |
Filter |
Filter
api/src/services/graphql/index.ts:1780
resolveMutation(
args,info):Promise<undefined|boolean|Partial<Item> >
| Parameter | Type |
|---|---|
args |
Record< string, any > |
info |
GraphQLResolveInfo |
Promise< undefined | boolean | Partial< Item > >
api/src/services/graphql/index.ts:1446
resolveQuery(
info):Promise<null|Partial<Item> >
Generic resolver that's used for every "regular" items/system query. Converts the incoming GraphQL AST / fragments into Directus' query structure which is then executed by the services.
| Parameter | Type |
|---|---|
info |
GraphQLResolveInfo |
Promise< null | Partial< Item > >
api/src/services/graphql/index.ts:1368
upsertSingleton(
collection,body,query):Promise<boolean|Partial<Item> >
Upsert and read singleton item
| Parameter | Type |
|---|---|
collection |
string |
body |
Record< string, any > | Record< string, any >[] |
query |
Query |
Promise< boolean | Partial< Item > >
api/src/services/graphql/index.ts:1550
Generated using TypeDoc and typedoc-plugin-markdown