Members
(constant) defer :function
Type:
Properties:
Name | Type | Description |
---|---|---|
defer |
- Source:
(constant) defer :defer
Type:
Properties:
Name | Type | Description |
---|---|---|
Deferred |
- Source:
(constant) Deferred
{Deferred}
- Source:
(constant) TokenKind
notFound|constant|fieldName|operator|openPar|closedPar|endOfString|comma|openEnvironment|closeEnvironment
Properties:
Name | Type | Description |
---|---|---|
notFound |
unknown token | |
constant |
numeric or string, for now we ignore date constants | |
fieldName |
Field name | |
operator |
Operator | |
openPar |
||
closedPar |
||
endOfString |
||
comma |
||
openEnvironment |
||
closeEnvironment |
- Source:
Methods
as(fieldName) → {sqlFun}
Establish the output name for an expression
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
Returns:
- Type
- sqlFun
assureMasterKey()
Assures there that a masterKey is set, creates it if does not already exists
- Source:
build() → {sqlFun}
- Source:
Returns:
- Type
- sqlFun
checkToken(req, res, next) → {*}
Middleware that assures there is a syntactical valid token, eventually an anonymous one, attached
to the request. Decodes the token into request.auth or whatever property specified in config
Parameters:
Name | Type | Description |
---|---|---|
req |
||
res |
||
next |
- Source:
Returns:
- Type
- *
createExpressApplication() → {Express}
- Source:
Returns:
- Type
- Express
createServicesRoutes(router, folder,, routePrefix,)
Adds all routes in a folder to a router. Convention is that every file must expose a router itself
Parameters:
Name | Type | Description |
---|---|---|
router |
Router | |
folder, |
string | ex. "routes/data/" |
routePrefix, |
string | ex. "/data/" |
- Source:
deserializeMessage(msg) → {BusinessMessage}
Deserialize a message
Parameters:
Name | Type | Description |
---|---|---|
msg |
BusinessMessageData |
- Source:
Returns:
- Type
- BusinessMessage
doGet(ctx, primaryTable, onlyPeripherals, oneRowopt)
Gets all data of the DataSet cascate-related to the primary table.
The first relations considered are child of primary, then
proper child / parent relations are called in cascade style.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ctx |
Context | ||
primaryTable |
DataTable | ||
onlyPeripherals |
boolean | if true, only peripheral (not primary or secondary) tables are refilled | |
oneRow |
DataRow |
<optional> |
The (eventually) only primary table row on which get the entire sub-graph. Can be null if PrimaryDataTable already contains rows. R is not required to belong to PrimaryDataTable. |
- Source:
edgeClose() → {*}
Closes the phisical connection
- Source:
Returns:
- Type
- *
fillDataSetByFilter(ctx, table, filter) → {Array.<DataRow>}
Fill a dataset starting with a set of filtered rows in a table
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | |
table |
DataTable | main table |
filter |
sqlFun |
- Source:
Returns:
DataRow obtained with the given filter
- Type
- Array.<DataRow>
fillDataSetByKey(ctx, ds, table, keyValues) → {*}
Fills a DataSet given the key of a row
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | |
ds |
DataSet | |
table |
DataTable | |
keyValues |
Array.<object> | object |
- Source:
Returns:
- Type
- *
generateMasterKey()
- Source:
getByFilter(ctx, table, filter, orderByopt) → {Array.<DataRow>}
Gets an array of datarow given a filter
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ctx |
Context | ||
table |
DataTable | ||
filter |
sqlFun | ||
orderBy |
string |
<optional> |
- Source:
Returns:
DataRow obtained with the given filter
- Type
- Array.<DataRow>
GetDataSet()
Retrieves dataset from repository
getFilterByExample(context, tableName, example, useLikeopt) → {sqlFun}
Gets a a filter comparing all example fields
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
context |
Context | |||
tableName |
string | |||
example |
object | |||
useLike |
boolean |
<optional> |
false | -if true, uses 'like' for any string comparisons, otherwise uses equal comparison |
- Source:
Returns:
DataRow obtained with the given filter
- Type
- sqlFun
getIdentityFromRequest(req) → {Identity}
If request has a token, it returns it's identity otherwise returns an anonymous identity
Parameters:
Name | Type | Description |
---|---|---|
req |
- Source:
Returns:
- Type
- Identity
(async) getMappingWebListRedir(ctx, tableName, listType) → {Promise.<{newTableName:string, newListType:string}>}
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | |
tableName |
string | |
listType |
string |
- Source:
Returns:
- Type
- Promise.<{newTableName:string, newListType:string}>
GetMeta()
getStartingFrom(ctx, primaryTable) → {promise}
Assuming that primaryTable has ALREADY been filled with data, read all childs and parents starting from
rows present in primaryTable.
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | |
primaryTable |
DataTable |
- Source:
Returns:
- Type
- promise
getVisited(ds, visited, toVisit, primaryTable)
Parameters:
Name | Type | Description |
---|---|---|
ds |
DataSet | |
visited |
Set | |
toVisit |
Set | |
primaryTable |
DataTable |
- Source:
isNullOrUndefined(o) → {boolean}
Check if an object is the null or undefined constant
Parameters:
Name | Type | Description |
---|---|---|
o |
sqlFun | undefined | null | object |
Returns:
true if o is null or undefined
- Type
- boolean
JsDataQueryParser()
Class able to transform a string into a jsDataQuery
- Source:
(async) login(req, res, next) → {Promise.<void>}
Login: reads user and password from body, then calls the _doLogin route
Parameters:
Name | Type | Description |
---|---|---|
req |
||
res |
||
next |
- Source:
Returns:
- Type
- Promise.<void>
middleware(req, res, next)
Parameters:
Name | Type | Description |
---|---|---|
req |
||
res |
||
next |
- Source:
queryBatch(query, rawopt, timeoutopt) → {defer}
Executes a sql command and returns all sets of results. Each Results is given via a notify or resolve
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
query |
string | |||
raw |
boolean |
<optional> |
if true, data are left in raw state and will be objectified by the client | |
timeout |
int |
<optional> |
this.defaultTimeout |
- Source:
Returns:
a sequence of {[array of plain objects]} or {meta:[column names],rows:[arrays of raw data]}
- Type
- defer
queryLines(query, rawopt, timeoutopt) → {*}
Gets a table and returns each SINGLE row by notification. Could eventually return more than a table indeed
For each table read emits a {meta:[column descriptors]} notification, and for each row of data emits a
if raw= false: {row:object read from db}
if raw= true: {row: [array of values read from db]}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
query |
string | |||
raw |
boolean |
<optional> |
false | |
timeout |
number |
<optional> |
this.defaultTimeout |
- Source:
Returns:
- Type
- *
queryPackets(query, rawopt, packSizeopt, timeoutopt) → {*}
Gets data packets row at a time
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
query |
string | |||
raw |
boolean |
<optional> |
false | |
packSize |
number |
<optional> |
0 | |
timeout |
number |
<optional> |
this.defaultTimeout |
- Source:
Returns:
- Type
- *
read() → {null|*}
Read data from file
- Source:
Returns:
- Type
- null | *
recursivelyMarkSubEntityAsVisited(table, visited, toVisit)
Parameters:
Name | Type | Description |
---|---|---|
table |
DataTable | |
visited |
Object | |
toVisit |
Object |
- Source:
recursivelyMarkSubEntityAsVisited(ds, mainTable, visited, toVisit)
Parameters:
Name | Type | Description |
---|---|---|
ds |
DataSet | |
mainTable |
DataTable | |
visited |
Set | |
toVisit |
Set |
- Source:
run(script, timeoutopt) → {*}
Runs a sql script, eventually composed of multiple blocks separed by GO lines
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
script |
string | |||
timeout |
number |
<optional> |
this.defaultTimeout |
- Source:
Returns:
- Type
- *
serializeMessage(msg) → {BusinessMessageData}
Parameters:
Name | Type | Description |
---|---|---|
msg |
BusinessMessage |
- Source:
Returns:
- Type
- BusinessMessageData
setDefaultSecret(secret)
Set default secret for subsequent invocation of the constructor
Parameters:
Name | Type | Description |
---|---|---|
secret |
- Source:
Example
setDefaultSecret({key: C.enc.Hex.parse('0001020304050607'),
iv: C.enc.Hex.parse('08090a0b0c0d0e0f'),
pwd: 'abs!sds28a'
});
(async) setMasterKey(key)
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
- Source:
Returns:
*
toSql(formatter, env) → {string}
Converts a SqlFun into a string
Parameters:
Name | Type | Description |
---|---|---|
formatter |
sqlFormatter | used to obtain details about making the expression, see sqlFormatter for an example |
env |
Environment | is the environment into which the expression have to be evaluated |
Returns:
//the sql representation of the expression
- Type
- string
updateBatch(query, timeoutopt) → {*}
Executes a series of sql update/insert/delete commands
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
query |
string | |||
timeout |
int |
<optional> |
this.defaultTimeout |
- Source:
Returns:
- Type
- *
validSessionSSO(session, userName) → {null|*}
Check that a session SSO exists.
Parameters:
Name | Type | Description |
---|---|---|
session |
||
userName |
- Source:
Returns:
- Type
- null | *
write() → {null|*}
Persist the data writing it in the linked file
- Source:
Returns:
- Type
- null | *
Type Definitions
BusinessMessageData
Properties:
Name | Type | Description |
---|---|---|
id:string |
||
description:string |
||
audit:string |
||
severity:string |
||
table:string |
||
canIgnore:bool |
- Source:
Deferred
- Source:
function
- Source:
stringPos
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
res |
string | null | |
currPos |
int |
- Source: