- validate
Used to validate a basic type or schema.
- pipePromise
$pipePromise.
- microservice
Microservices pipeline.
- errors
Error handler module. In order to work , the project must have an error directory in the root folder.
- debug
Debug helper module.
- db
Common DB functionality across different microservices.
- cache
Used to validate a basic type or schema.
- validate
- .joi(objectToValidate, schema) ⇒
Promise
- .joiElement(elementToValidate, type) ⇒
Promise
- .joi(objectToValidate, schema) ⇒
Kind: static method of validate
Fulfil: string
Result of Joi.validate().
Reject: Error
Joi Error.
Param | Type | Description |
---|---|---|
objectToValidate | Object |
An object to validate. |
schema | Object |
Can be a joi type object or a plain object where every key is assigned a joi type object. |
Kind: static method of validate
Fulfil: string
Result of Joi.validate().
Reject: Error
Joi Error.
Param | Type | Description |
---|---|---|
elementToValidate | Object |
An element to validate. |
type | String |
Any of the classic basic primitive types. |
$pipePromise.
Kind: static method of pipePromise
Param | Type | Description |
---|---|---|
fnc | function |
Function to execute in the pipeline. |
state | Object |
Current state of the App. |
[critical] | boolean |
When $critical is present, an exception stop de pipe execution. |
Microservices pipeline.
Wrapper function. If all is ok, the result will be { ok : true , data : {result} } When is an error in business logic, the result will be { ok : false, err : Error }.
Kind: static method of microservice
Param | Type | Description |
---|---|---|
fnc | function |
Command function that must be executed. |
Error handler module. In order to work , the project must have an error directory in the root folder.
Generate custom errors.
Kind: static method of errors
Returns: Error
- Custom Error instance.
Param | Type | Description |
---|---|---|
id | String |
Id to be shown. |
[err] | Error |
Error to be added as oldError in the return object. |
Debug helper module.
Kind: static method of debug
Returns: function
- Pretty Print function.
Param | Description |
---|---|
scope | Scope to be added to the print function. |
Common DB functionality across different microservices.
- db
- .save(element, collection) ⇒
Promise
- .find(where, collection) ⇒
Promise
- .findOne(where, collection) ⇒
Promise
- .findOr(where, collection) ⇒
Promise
- .update(dataRaw, bundle, fields) ⇒
Promise
- .updateNative(where, opFields, collection) ⇒
Promise
- .removeNative(where, collection) ⇒
Promise
- .remove(where, collection) ⇒
Promise
- .populate(object, keyString, select, collection) ⇒
Promise
- .mongoObjectId() ⇒
string
- .save(element, collection) ⇒
Kind: static method of db
Fulfil: Object
{ dataRaw, data }.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
element | Obecjt |
Element to be stored in MongoDB. |
collection | String |
Collection where the element will be stored. |
Kind: static method of db
Fulfil: Object
{ dataRaw, data }.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed. |
collection | String |
Collection to be used. |
Kind: static method of db
Fulfil: Object
{ dataRaw, data }.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed. |
collection | String |
Collection to be used. |
.
Kind: static method of db
Fulfil: Object
{ dataRaw, data }.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed |
collection | String |
Collection to be used. |
Kind: static method of db
Fulfil: Object
Updated Object
Reject: Error
The error name
property will be one of the following:
Param | Type | Description |
---|---|---|
dataRaw | Object |
Seneca Entity |
bundle | Object |
|
fields | Field to be modified |
Kind: static method of db
Fulfil: Number
Elements updated.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed. |
opFields | String |
Field to be modified. |
collection | String |
Collection that will be updated. |
Kind: static method of db
Fulfil: Object
Confirmation.
Reject: Error
Error generated by Seneca Entity.
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed. |
collection | String |
Collection to be used. |
Kind: static method of db
Fulfil: Number
1 to confirm.
Reject: Error
Error
Param | Type | Description |
---|---|---|
where | Object |
Query to be executed. |
collection | String |
Collection to be used. |
Kind: static method of db
Fulfil: Object
The data you wanted.
Reject: Error
The error name
property will be one of the following:
Param | Type | Description |
---|---|---|
object | Object |
Objecto op pupulate |
keyString | String |
Key field |
select | ||
collection | Object |
Collection of the 'object' param |
Kind: static method of db
Returns: string
- Generate a mongoObjectId.
- cache
- .addKey(key, value, timeout)
- .getValue(Key) ⇒
Object
- .removeKey(key) ⇒
Int
Add key to Redis cache. IMPORTANT! The key must include correct namespace to prevent data collisions
Kind: static method of cache
Param | Type | Description |
---|---|---|
key | String |
Key to store |
value | String |
Value to store |
timeout | int |
timeout to expire keys |
Get value from Redis cache.
Kind: static method of cache
Param | Type | Description |
---|---|---|
Key | String |
to obtain value. |
Remove key from Redis cache.
Kind: static method of cache
Param | Type | Description |
---|---|---|
key | String |
Key to remove. |