All files / proxy/utils traffic.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  10x 10x             10x 40x                 40x    
// This is replaced during build with the actual lambda version
const LAMBDA_FUNC_VERSION = '__lambda_func_version__'
const PARAM_NAME = 'ii'
 
/**
 * Appends traffic monitoring search parameters to the given URL.
 *
 * @param {URL} url - The URL object to which the traffic monitoring search parameters will be added.
 */
export function addTrafficMonitoring(url: URL) {
  url.searchParams.append(PARAM_NAME, getTrafficMonitoringValue())
}
 
/**
 * Generates a traffic monitoring value based on the provided type.
 *
 * @return {string} The formatted traffic monitoring value
 */
function getTrafficMonitoringValue(): string {
  return `fingerprintjs-pro-cloudfront/${LAMBDA_FUNC_VERSION}/ingress`
}