UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

31 lines (30 loc) 1.31 kB
import type { AbstractServiceOptions, Accountability, GQLScope, GraphQLParams, Item, PrimaryKey, Query, SchemaOverview } from '@directus/types'; import type { FormattedExecutionResult, GraphQLSchema } from 'graphql'; import type { Knex } from 'knex'; export declare class GraphQLService { accountability: Accountability | null; knex: Knex; schema: SchemaOverview; scope: GQLScope; constructor(options: AbstractServiceOptions & { scope: GQLScope; }); /** * Execute a GraphQL structure */ execute({ document, variables, operationName, contextValue, }: GraphQLParams): Promise<FormattedExecutionResult>; /** * Generate the GraphQL schema. Pulls from the schema information generated by the get-schema util. */ getSchema(): Promise<GraphQLSchema>; getSchema(type: 'schema'): Promise<GraphQLSchema>; getSchema(type: 'sdl'): Promise<GraphQLSchema | string>; /** * Execute the read action on the correct service. Checks for singleton as well. */ read(collection: string, query: Query, id?: PrimaryKey): Promise<Partial<Item>>; /** * Upsert and read singleton item */ upsertSingleton(collection: string, body: Record<string, any> | Record<string, any>[], query: Query): Promise<Partial<Item> | boolean>; }