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(model
: ModelDefinition, db
: GraphbackDataProvider, config
: CRUDServiceConfig): CRUDService
Defined in packages/graphback-core/src/runtime/CRUDService.ts:37
Parameters:
Name | Type |
---|---|
model | ModelDefinition |
db | GraphbackDataProvider |
config | CRUDServiceConfig |
Returns: CRUDService
#
PropertiesProtected
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:
Name | Type |
---|---|
relationField | string |
id | string | number |
filter | QueryFilter |
context | GraphbackContext |
info? | GraphQLResolveInfo |
Returns: any
Private
buildEventPayload#
▸ buildEventPayload(action
: string, result
: any): object
Defined in packages/graphback-core/src/runtime/CRUDService.ts:232
Parameters:
Name | Type |
---|---|
action | string |
result | any |
Returns: object
#
create▸ create(data
: Type, context?
: GraphbackContext, info?
: GraphQLResolveInfo): Promise‹Type›
Defined in packages/graphback-core/src/runtime/CRUDService.ts:46
Parameters:
Name | Type |
---|---|
data | Type |
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:
Name | Type |
---|---|
data | Type |
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:
Name | Type |
---|---|
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:
Name | Type |
---|---|
args | Partial‹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:
Name | Type |
---|---|
filter? | QueryFilter |
Returns: AsyncIterator‹Type› | undefined
#
subscribeToDelete▸ subscribeToDelete(filter?
: QueryFilter): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/CRUDService.ts:180
Parameters:
Name | Type |
---|---|
filter? | QueryFilter |
Returns: AsyncIterator‹Type› | undefined
#
subscribeToUpdate▸ subscribeToUpdate(filter?
: QueryFilter): AsyncIterator‹Type› | undefined
Defined in packages/graphback-core/src/runtime/CRUDService.ts:164
Parameters:
Name | Type |
---|---|
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:
Name | Type |
---|---|
triggerType | GraphbackOperationType |
objectName | string |
Returns: string
#
update▸ update(data
: Type, context?
: GraphbackContext, info?
: GraphQLResolveInfo): Promise‹Type›
Defined in packages/graphback-core/src/runtime/CRUDService.ts:67
Parameters:
Name | Type |
---|---|
data | Type |
context? | GraphbackContext |
info? | GraphQLResolveInfo |
Returns: Promise‹Type›