mstrHyper
Hyper SDK entrypoint class.
Kind: global class
Functions
- start(options) ⇒
Promise<Object>
Start the hyper sdk with configurations. It will init the hyper sdk, and login user with the auth options, then enable cards specified in the configurations, if not specified, it will enable all the certified cards or owned cards by default.
- enableSearch(options)
- init(options)
Init the hyper sdk with configurations
- ssoLogin(authMode) ⇒
Promise<string>
Initiate the authentication process for supported Single Sign On authentication modes(OIDC/SAML/Badge). A new login window will open automatically; when user is authenticated, the login window will be closed automatically.
- exportLogs() ⇒
string
Export logs
- enableCards(cards) ⇒
Promise<Object>
Enable a list of cards
- disableCards(cards)
Disable a list of cards
- searchKeyword(searchTerm) ⇒
Object
Searches all enabled cardsets for a searchTerm and returns the results in an object
- hideCard(nodeToRenderTo)
Hides hyper card in a given node
- showCard(nodeToRenderTo, elementId, cardUID) ⇒
IframeCard
Renders a hyper card to the given node
- mergeSearchResults(searchResultPromises) ⇒
object
Merges search results and returns one object containing concatenated primaryResults and alternateResults
start(options) ⇒ Promise<Object>
Start the hyper sdk with configurations. It will init the hyper sdk, and login user with the auth options, then enable cards specified in the configurations, if not specified, it will enable all the certified cards or owned cards by default. The Hyper SDK is designed to update card data without manual intervention seamlessly. It initiates an automatic refresh every 5 minutes, examining data and card definitions for any modifications. Upon detecting a change, it triggers an automatic refresh to incorporate the updated information. Users can customize this automatic refresh behavior through the available “refresh” options.
Kind: global function Returns: A promise of Object represent which card is enabled and which card meet error when enable it.
{
enabledCards: { cardId: string; projectId: string; name: string }[];
errors: {
cardId: string;
projectId: string;
name: string;
error: { name: string; message: string; type: string };
}[];
}
Param | Type | Default | Description |
---|---|---|---|
options | object |
an configuration object configuring the mstrHyper App | |
[options.server] | string |
server url, for example https://demo.microstrategy.com/MicroStrategyLibrary | |
[options.auth.authMode] | mstrHyper.AUTH_MODES |
authentication mode | |
[options.auth.username] | string |
username | |
[options.auth.password] | string |
password | |
[options.auth.authToken] | string |
authtoken | |
[options.auth.onSessionError] | function |
a callback function that be used to handle session error and recover session | |
[options.cards] | Array |
a list of cards to be enabled when using SDK | |
[options.logLevel] | mstrHyper.LOG_LEVELS |
"error" |
logLevel [“error”, “warn”, “info”] |
[options.highlighting.type] | mstrHyper.HIGHLIGHT_TYPES |
"overlay" |
type [“insertion”, “overlay”] |
[options.highlighting.highlightIframes] | boolean |
true |
whether to highlight iframes |
[options.searching] | object |
optional callback functions for handling search | |
[options.searching.onSearch] | object |
callback for handling incremental search result | |
[options.searching.onSort] | object |
callback for handling sort event | |
[options.searchEnabled] | boolean |
flag to have search feature enabled, false by default | |
[options.refresh.enabled] | boolean |
true |
flag to enable auto refresh, true by default |
[options.refresh.interval] | number |
300000 |
flag to config the auto refresh interval |
[options.refresh.afterRefresh] | function |
()=>{} |
optional callback which will get triggered when refresh finished |
enableSearch(options)
Kind: global function
Param | Type | Description |
---|---|---|
options | object |
an configuration object configuring the mstrHyper App |
[options.searching] | function |
optional callback function for incremental search |
[options.searching.onSearch] | object |
callback for handling incremental search result |
[options.searching.onSort] | object |
callback for handling sort event |
init(options)
Init the hyper sdk with configurations
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
options | object |
an configuration object configuring the mstrHyper App | |
[options.server] | string |
server url, for example https://demo.microstrategy.com/MicroStrategyLibrary | |
[options.logLevel] | mstrHyper.LOG_LEVELS |
"error" |
logLevel [“error”, “warn”, “info”] |
[options.highlighting.type] | mstrHyper.HIGHLIGHT_TYPES |
"overlay" |
type [“insertion”, “overlay”] |
[options.highlighting.highlightIframes] | boolean |
true |
whether to highlight iframes |
ssoLogin(authMode) ⇒ Promise<string>
Initiate the authentication process for supported Single Sign On authentication modes(OIDC/SAML/Badge). A new login window will open automatically; when user is authenticated, the login window will be closed automatically.
Kind: global function
Returns: A promise of the authToken
associated with the opened session.
Params: authMode: specify the single-sign-on authMode to use, see
mstrHyper.AUTH_MODES
.
exportLogs() ⇒ string
Export logs
Kind: global function
Returns: string
- a string contains all the logs
enableCards(cards) ⇒ Promise<Object>
Enable a list of cards
Kind: global function Returns: A promise of Object represent which card is enabled and which card meet error when enable it.
{
enabledCards: { cardId: string; projectId: string; name: string }[];
errors: {
cardId: string;
projectId: string;
name: string;
error: { name: string; message: string; type: string };
}[];
}
Param | Type | Description |
---|---|---|
cards | Array |
a list of cards to be enabled in an array [{id: string, projectId: string}] |
disableCards(cards)
Disable a list of cards
Kind: global function
Param | Type | Description |
---|---|---|
cards | Array |
a list of cards to be disabled |
searchKeyword(searchTerm) ⇒ Object
Searches all enabled cardsets for a searchTerm and returns the results in an object
Kind: global function
Returns: Object
- Containing { searchId, searchPromises}
searchId can be used to handle incremental results in custom callback functions.
searchPromises contains an array of promises that will resolve to search results.
Param | Type | Description |
---|---|---|
searchTerm | String |
a string to search |
hideCard(nodeToRenderTo)
Hides hyper card in a given node
Kind: global function
Param | Type |
---|---|
nodeToRenderTo | ref |
showCard(nodeToRenderTo, elementId, cardUID) ⇒ IframeCard
Renders a hyper card to the given node
Kind: global function
Returns: IframeCard
- Iframe card object for custom manipulation if desired
Param | Type |
---|---|
nodeToRenderTo | ref |
elementId | string |
cardUID | string |
mergeSearchResults(searchResultPromises) ⇒ object
Merges search results and returns one object containing concatenated primaryResults and alternateResults
Kind: global function
Returns: object
- { primaryResults, alternateResults} where primaryResults are all of the cards whose
primary titles match the search term and alternateResults are all of the cards whose alternate titles match
the search term.
Param | Type | Description |
---|---|---|
searchResultPromises | Array.<Promise> |
array of promises containing the search results |