Scripting implementation

Metrici uses server-side JavaScript, i.e. JavaScript that runs on the server. This is different from most uses of JavaScript that run in the browser. (Metrici also supports browser-based JavaScript - see Web development.)

JavaScript can access the underlying data only through an API (see Scripting reference) and by Scripting services. These functions are all available through an application object exposed to the script. These only allow the user to perform actions that they are permitted to perform. The JavaScript has no other access to the data or functionality of the application.

Scripts can be run in various ways:

  • Using the run and execute methods on node URLs.
  • Using the Run Script / Execute Script services through the Submit Service Request screen, or through the web services interface.
  • Internally within the NodeController themselves (for validation, derivation and extension scripts).

The different ways of calling scripts all use the same basic conventions for passing data in and out of scripts.

Excessive use of JavaScript could give performance problems. JavaScript is therefore best limited to processes that run infrequently, which interact with the user (where JavaScript is fast enough), or where performance is not critical. However, the derivation process within Metrici caches the results of scripts, and will allow highly performant solutions to be built using relatively inefficient scripting.