Version: Next

CRUDService

Default implementation of the CRUD service offering following capabilities:

  • Subscriptions: using default publish subscribe method
  • Logging: using logging abstraction

Type parameters

Type

Hierarchy

  • CRUDService

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new CRUDService(model: ModelDefinition, db: GraphbackDataProvider, config: CRUDServiceConfig): CRUDService

Defined in packages/graphback-core/src/runtime/CRUDService.ts:37

Parameters:

NameType
modelModelDefinition
dbGraphbackDataProvider
configCRUDServiceConfig

Returns: CRUDService

Properties

Protected crudOptions

crudOptions: GraphbackCRUDGeneratorConfig

Defined in packages/graphback-core/src/runtime/CRUDService.ts:37


Protected db

db: GraphbackDataProvider

Defined in packages/graphback-core/src/runtime/CRUDService.ts:34


Protected model

model: ModelDefinition

Defined in packages/graphback-core/src/runtime/CRUDService.ts:35


Protected pubSub

pubSub: PubSubEngine

Defined in packages/graphback-core/src/runtime/CRUDService.ts:36

Methods

batchLoadData

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:196

Parameters:

NameType
relationFieldstring
idstring | number
filterQueryFilter
contextGraphbackContext
info?GraphQLResolveInfo

Returns: any


Private buildEventPayload

buildEventPayload(action: string, result: any): object

Defined in packages/graphback-core/src/runtime/CRUDService.ts:232

Parameters:

NameType
actionstring
resultany

Returns: object


create

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:46

Parameters:

NameType
dataType
context?GraphbackContext
info?GraphQLResolveInfo

Returns: Promise‹Type›


delete

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:89

Parameters:

NameType
dataType
context?GraphbackContext
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/CRUDService.ts:119

Parameters:

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

Returns: Promise‹ResultList‹Type››


findOne

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:110

Parameters:

NameType
argsPartial‹Type›
context?GraphbackContext
info?GraphQLResolveInfo

Returns: Promise‹Type›


subscribeToCreate

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:148

Parameters:

NameType
filter?QueryFilter

Returns: AsyncIterator‹Type› | undefined


subscribeToDelete

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:180

Parameters:

NameType
filter?QueryFilter

Returns: AsyncIterator‹Type› | undefined


subscribeToUpdate

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:164

Parameters:

NameType
filter?QueryFilter

Returns: AsyncIterator‹Type› | undefined


Protected subscriptionTopicMapping

subscriptionTopicMapping(triggerType: GraphbackOperationType, objectName: string): string

Defined in packages/graphback-core/src/runtime/CRUDService.ts:228

Provides way to map runtime topics for subscriptions for specific types and object names

Parameters:

NameType
triggerTypeGraphbackOperationType
objectNamestring

Returns: string


update

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

Defined in packages/graphback-core/src/runtime/CRUDService.ts:67

Parameters:

NameType
dataType
context?GraphbackContext
info?GraphQLResolveInfo

Returns: Promise‹Type›