github rajnandan1/kener 3.2.0

latest release: 3.2.1
4 days ago

v3.2.0

Features

  • Improved Monitor Evaluation Functions

    • Replaced unsafe eval() with secure Function() constructors across all monitor types
    • Added support for using modules (like cheerio) directly in evaluation functions
  • Enhanced API Monitors

    • Raw response data is now passed directly to eval functions instead of base64 encoded
    • Added modules parameter with access to cheerio for HTML parsing
    • Updated default evaluation function to use the new parameter structure
  • Improved TCP & Ping Monitors

    • Simplified evaluation functions with direct access to ping/TCP data
    • Removed unnecessary base64 encoding/decoding steps
    • Better error handling for invalid evaluation functions
  • Documentation Updates

    • Updated all examples and documentation for the new evaluation function signatures
    • Added more detailed explanations of input parameters
    • Improved examples showing usage with the new parameter structure

Breaking Changes

  • Monitor Evaluation Functions
    • Custom evaluation functions will need to be updated to the new parameter structure
    • API monitors: (statusCode, responseTime, responseRaw, modules) instead of (statusCode, responseTime, responseDataBase64)
    • TCP/Ping monitors: (arrayOfPings) instead of (responseDataBase64)

Fixes

  • Fixed "cheerio is undefined" errors in API monitor evaluations
  • Improved error handling and logging for monitor evaluation failures
  • Security enhancements by removing eval() usage

Migration

If you're using custom evaluation functions in your monitors, you'll need to update them to the new format:

API Monitors

// Old format
(async function (statusCode, responseTime, responseDataBase64) {
    const resp = atob(responseDataBase64)
    // Your logic here
})
// New format
(async function (statusCode, responseTime, responseRaw, modules) {
    // responseRaw is the direct response - no need to decode
    // Access cheerio with modules.cheerio
    // Your logic here
})

TCP/Ping Monitors

// Old format
(async function (responseDataBase64) {
    let arrayOfPings = JSON.parse(atob(responseDataBase64))
    // Your logic here
})
// New format
(async function (arrayOfPings) {
    // arrayOfPings is directly available - no need to decode
    // Your logic here
})

Don't miss a new kener release

NewReleases is sending notifications on new releases.