- app
A application type module
- config
A module for config functions
- domain
A domain type module
- helpers
A module for config functions
- infra
A infra type module
- interface
A module for common interfaces
A application type module
Operation Class handles outputs for app layer
Kind: static class of app
A module for config functions
Gets the allowed prefix for redis
Kind: static method of config
Returns: string - string value with concat of environment:app
Throws:
- Will throw an error if the environment or app are incorrect
| Param | Type | Description |
|---|---|---|
| environment | string |
the environment the app is running, ex: development, dev, stage, production |
| app | string |
the app. This refers to the package, payments, identity |
Reads the ca and cert for runtime decryption. Expects files in /app/tls/
Kind: static method of config
Returns: object - object with location of ca and cert
Throws:
- Will throw an error if the environment is incorrect
| Param | Type | Description |
|---|---|---|
| ev | string |
the environment the app is running, ex: development, dev, stage, production |
config.exports.redisConf(config, env, app) ⇒ redis.config
Sets up the common redis config object time out is 1000 * 60 * 60 connection attempts > 10 reconnect after attempts * 100 every 3000ms
Kind: static method of config
Returns: redis.config - the redis configuration object
Throws:
- Will throw an error if the connection fails
| Param | Type | Description |
|---|---|---|
| config | object |
the object with redis host and port |
| env | string |
the environment the app is running, ex: development, dev, stage, production |
| app | string |
the app. This refers to the package, payments, identity |
config.exports.logging(env, app) ⇒ winston.config
Get the Winston configuration object https://github.com/winstonjs/winston#readme
Kind: static method of config
Returns: winston.config - the winston configuration object
| Param | Type | Description |
|---|---|---|
| env | string |
the environment the app is running, ex: development, dev, stage, production |
| app | string |
the app. This refers to the package, payments, identity |
The winston config object
Kind: inner external of config
See: https://github.com/winstonjs/winston#creating-your-own-logger
The redis config object
Kind: inner external of config
See: https://github.com/NodeRedis/node-redis#rediscreateclient
A domain type module
Kind: static class of domain
Creates an domain layer Base class
add userId
Kind: static method of BaseDomain
| Param | Type | Description |
|---|---|---|
| id | string |
user uuid |
Sets the masked field by x'ing out all digits except last 4
Kind: static method of BaseDomain
| Param | Type | Default | Description |
|---|---|---|---|
| number | string |
"1234567890" |
the account number as a string |
sanitizes an object with values to update to prevent updating a value that is not allowed to be updated
Kind: static method of BaseDomain
| Param | Type | Description |
|---|---|---|
| fields | object |
the object with the fields to update |
sets the meta field
Kind: static method of BaseDomain
A module for config functions
Extend the Error object
Kind: static method of helpers
| Param | Type | Default | Description |
|---|---|---|---|
| message | string |
"undefined exception" |
the message for the exception |
| code | string |
"undefined code" |
the code for the exception |
A infra type module
infra.logFormat() ⇒ winston.format
Creates winston format object
Kind: static method of infra
Returns: winston.format - the winston format object
infra.exports.LoggerStreamAdapter(env) ⇒ winston.transport
Creates winston transport namespaced to environment
Kind: static method of infra
Returns: winston.transport - the winston transport object
| Param | Type | Description |
|---|---|---|
| env | string |
the environment the app is running, ex: development, dev, stage, production |
infra.exports.ModelLoader() ⇒ sequelize.loaded
Creates winston transport namespaced to environment
Kind: static method of infra
Returns: sequelize.loaded - the sequelize loaded model object
The winston transport object
Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme
The winston format object
Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme
The winston transport object
Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme
The sequelize loaded model object
Kind: inner external of infra
See: https://sequelize.org/
A module for common interfaces
- interface
- static
- .exports.Server
- .exports.standardError ⇒
Error - .exports.devErrorHandler ⇒
express.res - .exports.deviceMiddleware ⇒
void - .exports.notFoundErrorHandler ⇒
express.res - .exports.validate ⇒
express.res - .exports.originEncoder ⇒
string - .exports.originDecoder ⇒
void - .exports.createControllerRoutes ⇒
express.res
- inner
- static
Server class
Kind: static class of interface
Standard error function
Kind: static constant of interface
| Param | Type | Description |
|---|---|---|
| input | Object |
The input object |
| input.type | string |
The error type |
| input.message | string |
The error message |
| input.errors | Array.<ErrorInfo> |
The errors array |
interface.exports.devErrorHandler ⇒ express.res
Dev error handler
Kind: static constant of interface
Returns: express.res - the express res object
| Param | Type |
|---|---|
| err | express.err |
| req | express.req |
| res | express.res |
| next | express.next |
Sets device info available in req.origin for access in controllers
Kind: static constant of interface
| Param | Type |
|---|---|
| req | express.req |
| res | express.res |
| next | express.next |
interface.exports.notFoundErrorHandler ⇒ express.res
Not found error handler
Kind: static constant of interface
Returns: express.res - the express res object
| Param | Type |
|---|---|
| req | express.req |
| res | express.res |
| next | express.next |
interface.exports.validate ⇒ express.res
Validate request handler
Kind: static constant of interface
Returns: express.res - the express res object
| Param | Type |
|---|---|
| req | express.req |
| res | express.res |
| next | express.next |
Base64 encode an input This is used to encode req.origin so it can be set to the header x-origin as a string in the api-gateway proxy for a given request
Kind: static constant of interface
| Param | Type | Description |
|---|---|---|
| origin | object |
the req.origin object to encode |
Base64 decode the x-origin header and set it to req.origin This is used to decode the encoded header coming from the api-gateway
Kind: static constant of interface
| Param | Type |
|---|---|
| req | express.req |
| res | express.res |
| next | express.next |
interface.exports.createControllerRoutes ⇒ express.res
Creates a controller path for the router
Kind: static constant of interface
Returns: express.res - the express res object
| Param | Type | Description |
|---|---|---|
| controllerUri | string |
the path to the controller |
Kind: inner class of interface
starts the server based on environment
Returns: express.router - the express router object
| Param | Type | Description |
|---|---|---|
| input | Object |
The input object as injected by src/container.js |
| input.config | Object |
The config object |
| input.logger | Object |
The logger function |
Kind: inner typedef of interface
Properties
| Name | Type | Description |
|---|---|---|
| param | string |
The error param name |
| msg | string |
The error message |
| location | string |
The error location |
The express request object
Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/request.js
The express response object
Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/response.js
The express err object
Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js
The express next object
Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js
The express router object
Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js