Built-in Libraries
JetClient provides a set of pre-installed libraries available for use in scripts. These libraries cover data parsing, validation, cryptography, testing, and utility functions.
Available Libraries
The following libraries are supported within JetClient’s scripting sandbox:
| Library | Description | Access Method |
|---|---|---|
| ajv | JSON Schema Validator | require("ajv") |
| atob | Base64 decode | Global atob |
| btoa | Base64 encode | Global btoa |
| chai | Assertion library | require("chai") |
| cheerio | HTML/XML parsing | Global cheerio |
| crypto-js | Cryptography functions | require("crypto-js") |
| csv-parse/lib/sync | CSV parsing | require("csv-parse/lib/sync") |
| lodash | Utility functions | Global _ or require("lodash") |
| moment | Date and time manipulation | require("moment") |
| tv4 | JSON Schema validation | Global tv4 |
| uuid | UUID generator | require("uuid") |
| xml2js | XML to JSON converter | require("xml2js") |
Usage Instructions
Globally Available Libraries
The following libraries are available as global variables and do not require require:
const decoded = atob("U29tZSB0ZXh0")
const parsedHTML = cheerio.load("<h1>Hello</h1>")
const isValid = tv4.validate({ name: "John" }, { type: "object", properties: { name: { type: "string" } } })Libraries Requiring require
Other libraries must be imported using require before use.
const _ = require("lodash")
console.log(_.isEmpty({}))
const crypto = require("crypto-js")
console.log(crypto.MD5("message").toString())
const moment = require("moment")
console.log(moment().format("YYYY-MM-DD"))For additional details on specific libraries, refer to their respective documentation links in the table above.
Importing Additional Libraries
If you need to use a library that is not included in the built-in set, refer to the External Libraries section for instructions on adding and importing custom libraries.