StrykeLibrary

The Stryke Library provides access to execution data and methods that can be used by the scripts to interact with Stryke. All scripts will have a global instance of the stryke library ready to use. This instance can be accessed via the global variable "stryke". The stryke library variable is read-only, its methods and properties cannot be modified.

All execution paths within a script must be resolved by calling either stryke.resolve or stryke.error. Failing to resolve a path that is executed will result in the script timing out.

new StrykeLibrary()

Extends events_1.EventEmitter

Properties
user (UserInfo) : The details of the user that is executing the script.
data (ExecutionData) : An object to access data specific to this script execution (example: the trigger record, or request payload).
Instance Members
create(entityName, data, callback)
error(errorFromScript)
find(queryString)
findOne(queryString)
query(queryString, applyAccessControl, callback)
resolve(data)
update(recordId, data, callback)

ExecutionData

The ExecutionData object holds execution data, which can be used by scripts at run time.

For example, the execution context can hold the record in context for the current execution, or the old and new values of a record in a trigger execution.

new ExecutionData()
Properties
record (object) : The record in context for this script execution. This is usually the record from which an action was executed.
recordBefore (object) : When running trigger scripts, recordBefore holds the data of the record that cause the trigger to run, before the update, create or delete actions were executed.
recordAfter (object) : When running trigger scripts, recordAfter holds the data of the record that cause the trigger to run, after the update, create or delete actions were executed.
requestData (object) : Any data that was passed as payload (ie the body of the HTTP request) to the original script or action execution request. This can be used to pass request specific arguments to the script being executed. The payload must be in valid JSON format.

UserInfo

A model containing information about the user that is executing a script.

new UserInfo()
Properties
id (string) : The id of the user executing the script
username (string) : The username of the user executing the script
email (string) : The email of the user executing the script