Version: 0.16.x

GraphbackCRUDService

Graphback layered architecture component that can be called from the resolver layer in GraphQL and Middlerware layer in RESTfull approach.

Graphback implements server side procesing using following flow:

GraphQL Resolvers -> GraphbackCRUDService [1-*] -> GraphbackDataProvider

Services can be composable (each service can reference multiple layers of other services). For data abstraction Graphback GraphbackDataProvider can be being used.

see GraphbackDataProvider

Type parameters#

Type

GraphbackContext

Hierarchy#

  • GraphbackCRUDService

Implemented by#

Index#

Methods#

Methods#

batchLoadData#

batchLoadData(relationField: string, id: string | number, filter: QueryFilter, context: GraphbackContext, info?: GraphQLResolveInfo): any

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:106

Specialized function that can utilize batching the data basing on DataLoader library

Parameters:

NameTypeDescription
relationFieldstringname of the field that will be used to match ids
idstring | numberid of the object we want to load
filterQueryFilter-
contextGraphbackContextresolver context object that will be used to apply new loader
info?GraphQLResolveInfoGraphQL resolver info

Returns: any


create#

create(data: Type, context?: GraphbackContext, info?: GraphQLResolveInfo): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:33

Implementation for object creation

Parameters:

NameTypeDescription
dataTypeinput data
context?GraphbackContextcontext object passed from graphql or rest layer
info?GraphQLResolveInfo-

Returns: Promise‹Type›


delete#

delete(data: Partial‹Type›, context?: GraphbackContext, info?: GraphQLResolveInfo): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:49

Implementation for object deletes

Parameters:

NameTypeDescription
dataPartial‹Type›data used for consistency reasons
context?GraphbackContextcontext object passed from graphql or rest layer
info?GraphQLResolveInfo-

Returns: Promise‹Type›


findBy#

findBy(args?: FindByArgs, context?: GraphbackContext, info?: GraphQLResolveInfo, path?: string): Promise‹ResultList‹Type››

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:70

Implementation for reading objects with filtering capabilities

Parameters:

NameType
args?FindByArgs
context?GraphbackContext
info?GraphQLResolveInfo
path?string

Returns: Promise‹ResultList‹Type››


findOne#

findOne(filter: Partial‹Type›, context?: GraphbackContext, info?: GraphQLResolveInfo): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:57

Fetch a single record by its unique attribute(s)

Parameters:

NameTypeDescription
filterPartial‹Type›the unique attributes to fetch the record with
context?GraphbackContextcontext object from GraphQL/REST layer
info?GraphQLResolveInfo-

Returns: Promise‹Type›


subscribeToCreate#

subscribeToCreate(filter?: QueryFilter, context?: GraphbackContext): AsyncIterator‹Type› | undefined

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:78

Subscription for all creation events

Parameters:

NameTypeDescription
filter?QueryFilterfilter used in subscription
context?GraphbackContextadditional context

Returns: AsyncIterator‹Type› | undefined


subscribeToDelete#

subscribeToDelete(filter?: QueryFilter, context?: GraphbackContext): AsyncIterator‹Type› | undefined

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:94

Subscription for all deletion events

Parameters:

NameTypeDescription
filter?QueryFilterfilter used in subscription
context?GraphbackContextadditional context

Returns: AsyncIterator‹Type› | undefined


subscribeToUpdate#

subscribeToUpdate(filter?: QueryFilter, context?: GraphbackContext): AsyncIterator‹Type› | undefined

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:86

Subscription for all update events

Parameters:

NameTypeDescription
filter?QueryFilterfilter used in subscription
context?GraphbackContextadditional context

Returns: AsyncIterator‹Type› | undefined


update#

update(data: Partial‹Type›, context?: GraphbackContext, info?: GraphQLResolveInfo): Promise‹Type›

Defined in packages/graphback-core/src/runtime/GraphbackCRUDService.ts:41

Implementation for object updates

Parameters:

NameTypeDescription
dataPartial‹Type›input data including id
context?GraphbackContextcontext object passed from graphql or rest layer
info?GraphQLResolveInfo-

Returns: Promise‹Type›