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- GraphbackCRUDService‹Type›
#
Index#
Constructors#
Properties#
Methods- batchLoadData
- buildEventPayload
- create
- delete
- findBy
- findOne
- subscribeToCreate
- subscribeToDelete
- subscribeToUpdate
- subscriptionTopicMapping
- update
#
Constructors#
constructor+ new CRUDService(modelName
: string, db
: GraphbackDataProvider, config
: CRUDServiceConfig): CRUDService
Defined in packages/graphback-core/src/runtime/CRUDService.ts:32
Parameters:
Name | Type |
---|---|
modelName | string |
db | GraphbackDataProvider |
config | CRUDServiceConfig |
Returns: CRUDService
#
PropertiesPrivate
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:
Name | Type |
---|---|
relationField | string |
id | string | number |
filter | any |
context | GraphbackContext |
Returns: any
Private
buildEventPayload#
▸ buildEventPayload(action
: string, result
: any): object
Defined in packages/graphback-core/src/runtime/CRUDService.ts:181
Parameters:
Name | Type |
---|---|
action | string |
result | any |
Returns: object
#
create▸ create(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/CRUDService.ts:41
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
Returns: Promise‹Type›
#
delete▸ delete(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/CRUDService.ts:76
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
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:
Name | Type |
---|---|
filter | QueryFilter‹Type› |
context | GraphbackContext |
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:
Name | Type |
---|---|
args | Partial‹Type› |
context | GraphbackContext |
Returns: Promise‹Type›
#
subscribeToCreate▸ subscribeToCreate(filter
: any, _context?
: GraphbackContext): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/CRUDService.ts:119
Parameters:
Name | Type |
---|---|
filter | any |
_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:
Name | Type |
---|---|
filter | any |
context | GraphbackContext |
Returns: AsyncIterator‹Type› | undefined
#
subscribeToUpdate▸ subscribeToUpdate(filter
: any, context
: GraphbackContext): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/CRUDService.ts:133
Parameters:
Name | Type |
---|---|
filter | any |
context | GraphbackContext |
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:
Name | Type |
---|---|
triggerType | GraphbackOperationType |
objectName | string |
Returns: string
#
update▸ update(data
: Type, context
: GraphbackContext): Promise‹Type›
Defined in packages/graphback-core/src/runtime/CRUDService.ts:58
Parameters:
Name | Type |
---|---|
data | Type |
context | GraphbackContext |
Returns: Promise‹Type›