Constructor
new Session(params)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
params |
object
|
Parameters
Properties
Name |
Type |
Attributes |
Default |
Description |
url |
string
|
|
|
Base URL of the Simplicite application |
scheme |
string
|
|
|
URL scheme (e.g. 'https' ) of the Simplicite application (not needed if url is set) |
host |
string
|
|
|
Hostname or IP address (e.g. 'myhost.mydomain.com' ) of the Simplicite application (not needed if url is set) |
port |
number
|
|
|
Port (e.g. 443 ) of the Simplicite application (not needed if url is set) |
root |
string
|
|
|
Root context URL (e.g. '/myapp' ) the Simplicite application (not needed if url is set) |
endpoint |
boolean
|
<optional>
|
'api'
|
Endpoint ('api'|'ui'|'uipublic' ) |
username |
string
|
<optional>
|
|
Username (not needed for the public UI endpoint) |
password |
string
|
<optional>
|
|
Password (not needed for the public UI endpoint) |
authtoken |
string
|
<optional>
|
|
Authentication token (if set, username and password are not needed; not needed for the public UI endpoint) |
authheader |
string
|
<optional>
|
|
Authorization HTTP header name (defaults to the standard Authorization , the alternative is the value of the SIMPLICITE_AUTH_HEADER constant, not needed for public endpoint) |
ajaxkey |
string
|
<optional>
|
|
Ajax key (only usefull for usage from the generic UI) |
debug |
boolean
|
<optional>
|
false
|
Debug mode? |
debugHandler |
function
|
<optional>
|
|
Debug handler function |
infoHandler |
function
|
<optional>
|
|
Info handler function |
warningHandler |
function
|
<optional>
|
|
Warning handler function |
errorHandler |
function
|
<optional>
|
|
Error handler function |
logHandler |
function
|
<optional>
|
|
Log handler function |
|
Members
constants
- Description:
- Source:
Constants
Methods
changePassword(pwd, optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
pwd |
string
|
|
Password |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
error |
function
|
<optional>
|
Error handler function |
businessCase |
string
|
<optional>
|
Business case label |
|
Returns:
A promise to the change password result
-
Type
-
promise.<object>
clear()
- Description:
- Clears all data (credentials, objects, ...)
- Source:
compressData(data) → {Promise.<Blob>}
- Description:
- Source:
Parameters:
Name |
Type |
Description |
data |
string
|
any
|
Data to compress |
Returns:
Promise to the compressed data blob
-
Type
-
Promise.<Blob>
getAppInfo(optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
error |
function
|
<optional>
|
Error handler function |
businessCase |
string
|
<optional>
|
Business case label |
|
Returns:
A promise to the application info (also avialable as the appinfo
member)
-
Type
-
promise.<object>
- Description:
- Basic HTTP authorization header value
- Source:
Returns:
HTTP authorization header value
-
Type
-
string
- Description:
- Get bearer token header value
- Source:
Returns:
Bearer token header value
-
Type
-
string
getBusinessObject(name, instanceopt) → {BusinessObject}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
name |
string
|
|
Business object name |
instance |
string
|
<optional>
|
Business object instance name, defaults to js_<object name> |
Returns:
Business object
-
Type
-
BusinessObject
getBusinessObjectCacheKey(name, instanceopt) → {object}
- Description:
- Get business object cache key
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
name |
string
|
|
Business object name |
instance |
string
|
<optional>
|
Business object instance name, defaults to js_<object name> |
Returns:
Business object cache key
-
Type
-
object
getDevInfo(moduleopt, optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
module |
string
|
<optional>
|
Module name |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
error |
function
|
<optional>
|
Error handler function |
businessCase |
string
|
<optional>
|
Business case label |
|
Returns:
A promise to the develoment info (also avialable as the devinfo
member)
-
Type
-
promise.<object>
getError(err, statusopt, originopt) → {object}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
err |
string
|
object
|
|
Error
Properties
Name |
Type |
Description |
message |
string
|
Error message |
|
status |
number
|
<optional>
|
Optional error status (defaults to 200) |
origin |
string
|
<optional>
|
Optional error origin |
Returns:
Error object
-
Type
-
object
getExternalObject(name)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
name |
string
|
External object name |
getGrant(optsopt) → {promise.<Grant>}
- Description:
- Get grant (current user data)
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Default |
Description |
inlinePicture |
boolean
|
<optional>
|
false
|
Inline user picture? |
includeTexts |
boolean
|
<optional>
|
false
|
Include texts? |
includeSysparams |
boolean
|
<optional>
|
false
|
Include system parameters? |
error |
function
|
<optional>
|
|
Error handler function |
businessCase |
string
|
<optional>
|
|
Business case label |
|
Returns:
A promise to the grant (also available as the grant
member)
-
Type
-
promise.<Grant>
getHealth(optsopt) → {promise.<object>}
- Description:
- Get health check (no need to be authenticated)
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Default |
Description |
full |
boolean
|
<optional>
|
false
|
Full health check? |
error |
function
|
<optional>
|
|
Error handler function |
|
Returns:
Promise to the health data
-
Type
-
promise.<object>
getNews(optsopt) → {promise.<array>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Default |
Description |
inlineImages |
boolean
|
<optional>
|
false
|
Inline news images? |
error |
function
|
<optional>
|
|
Error handler function |
businessCase |
string
|
<optional>
|
|
Business case label |
|
Returns:
A promise to the list of news (also avialable as the news
member)
-
Type
-
promise.<array>
getPath(action, optsopt)
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
action |
string
|
|
Action |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
businessCase |
string
|
<optional>
|
Business case label |
|
getResourceURL(code, typeopt, objectopt, objIdopt)
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Default |
Description |
code |
string
|
|
|
Resource code |
type |
string
|
<optional>
|
IMG
|
Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML) |
object |
string
|
<optional>
|
|
Object name (not required for global resources) |
objId |
string
|
<optional>
|
|
Object ID (not required for global resources) |
getSysInfo(optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
error |
function
|
<optional>
|
Error handler function |
businessCase |
string
|
<optional>
|
Business case label |
|
Returns:
A promise to the system info (also avialable as the sysinfo
member)
-
Type
-
promise.<object>
health(optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Default |
Description |
full |
boolean
|
<optional>
|
false
|
Full health check? |
error |
function
|
<optional>
|
|
Error handler function |
|
Returns:
Promise to the health data
-
Type
-
promise.<object>
indexSearch(query, objectopt, optsopt) → {promise.<array>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
query |
string
|
|
Index search query |
object |
string
|
<optional>
|
Object |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Default |
Description |
metadata |
boolean
|
<optional>
|
false
|
Add meta data for each result |
context |
number
|
<optional>
|
|
Context |
error |
function
|
<optional>
|
|
Error handler function |
businessCase |
string
|
<optional>
|
|
Business case label |
|
Returns:
A promise to a list of index search records
-
Type
-
promise.<array>
isAuthTokenExpired() → {boolean}
- Description:
- Is the auth token expired?
- Source:
Returns:
true if the auth token is expired
-
Type
-
boolean
login(optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
username |
string
|
<optional>
|
Username (exclusive with authentication token) |
password |
string
|
<optional>
|
Password (required if username is set) |
authtoken |
string
|
<optional>
|
Authentication token ((exclusive with username) |
error |
function
|
<optional>
|
Error handler function |
|
Returns:
Promise to the login result
-
Type
-
promise.<object>
logout(callback, optsopt) → {promise.<object>}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
callback |
function
|
|
Callback (called upon success) |
opts |
object
|
<optional>
|
Options
Properties
Name |
Type |
Attributes |
Description |
error |
function
|
<optional>
|
Error handler function |
|
Returns:
Promise to the logout result
-
Type
-
promise.<object>
parseResponse(res, statusopt) → {object}
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Default |
Description |
res |
object
|
|
|
Response to parse |
status |
number
|
<optional>
|
200
|
HTTP status |
Returns:
Error object
-
Type
-
object
sendRequest(path, dataopt, callbackopt, errorHandleropt)
- Description:
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
path |
string
|
|
Path |
data |
object
|
<optional>
|
Data |
callback |
function
|
<optional>
|
Callback |
errorHandler |
function
|
<optional>
|
Error handler |
setAjaxKey(key)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
key |
string
|
Ajax key |
setAuthToken(token)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
token |
string
|
Auth token |
setAuthTokenExpiryDate(expiry)
- Description:
- Set auth token expiry date
- Source:
Parameters:
Name |
Type |
Description |
expiry |
Date
|
Auth token expiry |
setPassword(pwd)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
pwd |
string
|
Password |
setUsername(usr)
- Description:
- Source:
Parameters:
Name |
Type |
Description |
usr |
string
|
Username |
uncompressData(blob) → {Promise.<string>}
- Description:
- Source:
Parameters:
Name |
Type |
Description |
blob |
Blob
|
Compressed data blob |
Returns:
Promise to the uncompressed string
-
Type
-
Promise.<string>