Libraries

A library is a CommonJS library that can be loaded by triggers, jobs, routes, and other library scripts. The format follows that of a common js module. A library is configured with an Export property, the name that will be used to import into other scripts. The name follows the same c_ naming convention as the rest of the api.

For example, a library script with the Export name of c_utils could look like the following:

With the following script:

/**
 * Utility Library
 */

module.exports = {
  
    foo: function() {
        return 'bar';
    },
  
    baz: function() {
        return 'qux';
    }
  
}

And could then be imported into other scripts like the following

/**
 * My Script
 */

import utils from 'c_utils'
  
return utils.foo() // returns 'bar'