Version: 0.15.x

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(modelName: string, db: GraphbackDataProvider, config: CRUDServiceConfig): CRUDService

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

Parameters:

NameType
modelNamestring
dbGraphbackDataProvider
configCRUDServiceConfig

Returns: CRUDService

Properties

Private crudOptions

crudOptions: GraphbackCRUDGeneratorConfig

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


Protected db

db: GraphbackDataProvider

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


Private modelName

modelName: string

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


Private pubSub

pubSub: PubSubEngine

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

Methods

batchLoadData

batchLoadData(relationField: string, id: string | number, filter: any, context: GraphbackContext): any

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

Parameters:

NameType
relationFieldstring
idstring | number
filterany
contextGraphbackContext

Returns: any


Private buildEventPayload

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

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

Parameters:

NameType
actionstring
resultany

Returns: object


create

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

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

Parameters:

NameType
dataType
contextGraphbackContext

Returns: Promise‹Type›


delete

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

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

Parameters:

NameType
dataType
contextGraphbackContext

Returns: Promise‹Type›


findBy

findBy(filter: QueryFilter‹Type›, context: GraphbackContext, page?: GraphbackPage, orderBy?: GraphbackOrderBy): Promise‹ResultList‹Type››

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

Parameters:

NameType
filterQueryFilter‹Type›
contextGraphbackContext
page?GraphbackPage
orderBy?GraphbackOrderBy

Returns: Promise‹ResultList‹Type››


findOne

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

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

Parameters:

NameType
argsPartial‹Type›
contextGraphbackContext

Returns: Promise‹Type›


subscribeToCreate

subscribeToCreate(filter: any, _context?: GraphbackContext): AsyncIterator‹Type› | undefined

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

Parameters:

NameType
filterany
_context?GraphbackContext

Returns: AsyncIterator‹Type› | undefined


subscribeToDelete

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

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

Parameters:

NameType
filterany
contextGraphbackContext

Returns: AsyncIterator‹Type› | undefined


subscribeToUpdate

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

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

Parameters:

NameType
filterany
contextGraphbackContext

Returns: AsyncIterator‹Type› | undefined


Protected subscriptionTopicMapping

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

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

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): Promise‹Type›

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

Parameters:

NameType
dataType
contextGraphbackContext

Returns: Promise‹Type›