Store

class
 new Store()  extends Executor

This class handle NoSQL storage and mapping (duplication) between NoSQL object
TODO Create the mapping documentation

It use basic CRUD, and can expose those 4 to through HTTP

It emits events :
Store.Save: Before saving the object
Store.Saved: After saving the object
Store.Update: Before updating the object
Store.Updated: After updating the object
Store.Delete: Before deleting the object
Store.Deleted: After deleting the object
Store.Get: When getting the object

Mapping:

Parameters

map: { ... }
expose: { // Enable the HTTP exposure
url: '', // The url to expose to by default it is service name in lowercase ( users for example )
restrict: {
create: true, // Don't expose the POST /users
update: true, // Don't expose the PUT /users/{uuid}
delete: true, // Don't expose the DELETE /users/{uuid}
get: true // Don't expose the GET /users/{uuid}
}
}

class Store extends Executor {

save

method
 Store.prototype.save() 

Option name Type Description
Object Object

to save

Uuid String

to use, if not specified take the object.uuid or generate one if not found

return Promise

with saved object

Save an object

save(object, uid) {

update

method
 update() 

Option name Type Description
Object Object

to save

Uuid String

to use, if not specified take the object.uuid or generate one if not found

reverseMap Boolean

internal use only, for disable map resolution

return Promise

with saved object

Update an object

update(object, uid, reverseMap) {

delete

method
 delete() 

Option name Type Description
uuid String

to delete

return Promise

the deletion promise

Delete an object

delete(uid) {

exists

method
 exists() 

Option name Type Description

Check if an object exists

exists(uid) {

get

method
 get() 

Option name Type Description
uuid String

to delete

return Promise

the object retrieved ( can be undefined if not found )

Get an object

get(uid) {