3.0.0 • Published 7 years ago
apeman-service-entity v3.0.0
apeman-service-entity
Apemna service for entity
Installation
$ npm install apeman-service-entity --save
Usage
#!/usr/bin/env node
'use strict'
const { ApEntityService } = require('apeman-service-entity')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')
co(function * () {
let store = createStore(reducer)
let service = new ApEntityService(store)
}).catch((err) => console.error(err))
API
apeman-service-entity@2.2.1
Apemna service for entity
- Functions
- ApEntityService Class
- new ApEntityService(store, options)
- service.getEntityList(entityName)
- service.getEntityOne(entityName)
- service.getEntityResources(entityName)
- service.updateEntityResources(entityName, entities)
- service.setEntityList(entityName, entities, counts)
- service.pushEntityList(entityName, entities, counts)
- service.unshiftEntityList(entityName, entities, counts)
- service.setEntityOne(entityName, entity)
- service.clearEntityList(entityName)
- service.clearEntityOne(entityName)
- service.clearEntityResource(entityName)
- service.purgeEntity(entityName)
- service.invalidateEntityCache(entityName)
Functions
create(args) -> ApEntityService
Create the service instance
Param | Type | Description |
---|---|---|
args | * |
ApEntityService Class
Service
new ApEntityService(store, options)
Constructor of ApEntityService class
Param | Type | Description |
---|---|---|
store | Object | Redux store |
options | Object | Optional settings |
service.getEntityList(entityName) -> Object
Get entity as list
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.getEntityOne(entityName) -> *
Get detailed entity
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.getEntityResources(entityName) -> Object
Get entity resources.
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.updateEntityResources(entityName, entities) -> Promise
Update entity resources.
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
entities | Array.<Object>,Object | Entities to push |
service.setEntityList(entityName, entities, counts) -> Promise
Set entity list.
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
entities | Array.<Object> | Entities to push |
counts | Object | Count info |
service.pushEntityList(entityName, entities, counts) -> Promise
Push to entity list.
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
entities | Array.<Object> | Entities to push |
counts | Object | Count info |
service.unshiftEntityList(entityName, entities, counts) -> Promise
Unshift to entity list.
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
entities | Array.<Object> | Entities to unshift |
counts | Object | Count info |
service.setEntityOne(entityName, entity) -> Promise
Set entity one
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
entity | Object | Entity to set. |
service.clearEntityList(entityName) -> Promise
Clear entity list
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.clearEntityOne(entityName) -> Promise
Clear entity one
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.clearEntityResource(entityName) -> Promise
Clear entity resource
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.purgeEntity(entityName) -> Promise
Clear entity one
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
service.invalidateEntityCache(entityName) -> Promise
Invalidate entity cache
Param | Type | Description |
---|---|---|
entityName | string | Name of entity. |
License
This software is released under the MIT License.