epha-Model
Overview
API
All the following examples assume that you got a client for a specific endpoint:
var model = "local";
Optionally you can overwrite certain functions:
//replace SEPARATORmodelSEPARATOR = "#"; //defaults to ":" //set your own saltedHash methodmodelsaltedHash = cryptosaltedHash; //set your own uid generatormodeluid = cryptouid;
Unless otherwise stated, all methods return ES6 Promises. See MDN for details.
- identity
- domain
- subject
- model.subject.create()
- model.subject.findById()
- model.subject.findByIdentity()
- model.subject.findByDomain()
- subjectResource
- model.subjectResource.findByType()
- model.subjectResource.findByTypeAndDateRange()
- model.subjectResource.findAll()
- resource
- subResource
- model.subResource.create()
- model.subResource.findByParentResource()
- model.subResource.fetchByParentResource()
client.identity.create(data)
Create a new identity. Adds an id calling client.uid()
.
modelidentity;
client.identity.findByEmail(email)
Finds an identity by email.
modelidentity;
Rejects with an error (err.code = not-found) if no identity exists.
client.identity.findById(id)
Finds an identity by id.
modelidentity;
Rejects with an error (err.code = not-found) if no identity exists.