Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Latest commit

 

History

History
496 lines (355 loc) · 19.1 KB

DOCS.md

File metadata and controls

496 lines (355 loc) · 19.1 KB

Modules

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

app

A application type module

app.exports.Operation

Operation Class handles outputs for app layer

Kind: static class of app

config

A module for config functions

config.exports.getRedisPrefix(environment, app) ⇒ string

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

config.exports.certs(ev) ⇒ object

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

config~winston.config

The winston config object

Kind: inner external of config
See: https://github.com/winstonjs/winston#creating-your-own-logger

config~redis.config

The redis config object

Kind: inner external of config
See: https://github.com/NodeRedis/node-redis#rediscreateclient

domain

A domain type module

domain.BaseDomain

Kind: static class of domain

new BaseDomain()

Creates an domain layer Base class

BaseDomain.BaseDomain#addUserId(id) ⇒ void

add userId

Kind: static method of BaseDomain

Param Type Description
id string user uuid

BaseDomain.BaseDomain#setMasked(number)

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

BaseDomain.BaseDomain#sanitize(fields) ⇒ object

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

BaseDomain.BaseDomain#setMeta() ⇒ object

sets the meta field

Kind: static method of BaseDomain

helpers

A module for config functions

helpers.CustomException(message, code) ⇒ Error

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

infra

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

infra~winston.transport

The winston transport object

Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme

infra~winston.format

The winston format object

Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme

infra~winston.transport

The winston transport object

Kind: inner external of infra
See: https://github.com/winstonjs/winston#readme

infra~sequelize.loaded

The sequelize loaded model object

Kind: inner external of infra
See: https://sequelize.org/

interface

A module for common interfaces

interface.exports.Server

Server class

Kind: static class of interface

interface.exports.standardError ⇒ Error

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

interface.exports.deviceMiddleware ⇒ void

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

interface.exports.originEncoder ⇒ string

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

interface.exports.originDecoder ⇒ void

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

interface~Server

Kind: inner class of interface

new Server(input)

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

interface~ErrorInfo : Object

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

interface~express.req

The express request object

Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/request.js

interface~express.res

The express response object

Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/response.js

interface~express.err

The express err object

Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js

interface~express.next

The express next object

Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js

interface~express.router

The express router object

Kind: inner external of interface
See: https://github.com/expressjs/express/blob/master/lib/router/index.js