Members
environments :Object.<string, Environment>
Collection of all user environments of the application, the key is the sessionID
Type:
- Object.<string, Environment>
- Source:
Methods
createConnectionPool(dbCode) → {JsConnectionPool}
Creates the connection pool, it is supposed to be overridden in derived classes
Parameters:
Name | Type | Description |
---|---|---|
dbCode |
string |
- Source:
Returns:
- Type
- JsConnectionPool
createContext(pooledConn, env, req, res, next)
Creates a context and attach it to req.app.local
Also adds the
Parameters:
Name | Type | Description |
---|---|---|
pooledConn |
||
env |
||
req |
Request | |
res |
Response | |
next |
Middleware |
- Source:
createEnvironment(identity, conn) → {Environment}
Meant to be redefined in subclasses, creates an Environment class
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity | |
conn |
DataAccess |
- Source:
Returns:
- Type
- Environment
createPostData(ctx) → {BusinessPostData}
Function that must create a PostData class, this is meant to be overridden in derived classes
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context |
- Source:
Returns:
- Type
- BusinessPostData
createSession(identity, conn) → {Promise.<Environment>}
Create a Session for the user represented by the token.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity | |
conn |
DataAccess |
- Source:
Returns:
- Type
- Promise.<Environment>
getContext(req, res, next, env)
Creates a context object in req.app.local.context, when environment already exists
Parameters:
Name | Type | Description |
---|---|---|
req |
Request | |
res |
Response | |
next |
Middleware | |
env |
Environment |
- Source:
getDataAccess() → {Promise.<JsPooledConnection>}
returns an open connection to db
- Source:
Returns:
- Type
- Promise.<JsPooledConnection>
getDataSet(tableName, editType) → {DataSet}
Parameters:
Name | Type | Description |
---|---|---|
tableName |
||
editType |
- Source:
Returns:
- Type
- DataSet
getOrCreateContext(req, res, next)
Creates a context object in req.app.local.context. If the token is not provided in the header, creates
an anonymous connection.
Parameters:
Name | Type | Description |
---|---|---|
req |
Request | |
res |
Response | |
next |
Middleware |
- Source:
init(dbCode) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
dbCode |
string |
- Source:
Returns:
- Type
- Promise
releaseConnection(req, ctx)
Attaches a release event on close/finish of the request (the one which fires first)
releases the pool connection after a request has been processed
Parameters:
Name | Type | Description |
---|---|---|
req |
||
ctx |
- Source: