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:
Name | Type | Description |
---|---|---|
relationField | string | name of the field that will be used to match ids |
id | string | number | id of the object we want to load |
filter | QueryFilter | - |
context | GraphbackContext | resolver context object that will be used to apply new loader |
info? | GraphQLResolveInfo | GraphQL 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:
Name | Type | Description |
---|---|---|
data | Type | input data |
context? | GraphbackContext | context 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:
Name | Type | Description |
---|---|---|
data | Partial‹Type› | data used for consistency reasons |
context? | GraphbackContext | context 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:
Name | Type |
---|---|
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:
Name | Type | Description |
---|---|---|
filter | Partial‹Type› | the unique attributes to fetch the record with |
context? | GraphbackContext | context 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:
Name | Type | Description |
---|---|---|
filter? | QueryFilter | filter used in subscription |
context? | GraphbackContext | additional 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:
Name | Type | Description |
---|---|---|
filter? | QueryFilter | filter used in subscription |
context? | GraphbackContext | additional 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:
Name | Type | Description |
---|---|---|
filter? | QueryFilter | filter used in subscription |
context? | GraphbackContext | additional 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:
Name | Type | Description |
---|---|---|
data | Partial‹Type› | input data including id |
context? | GraphbackContext | context object passed from graphql or rest layer |
info? | GraphQLResolveInfo | - |
Returns: Promise‹Type›