Function: validateCmcdEvents()
ts
function validateCmcdEvents(cmcd, options?): CmcdEventsValidationResult;Defined in: validateCmcdEvents.ts:32
Validates a raw CMCD string as an event-mode payload.
This function decodes the string internally and validates it with reportingMode set to 'event'. The input may contain multiple newline-separated events, for example an application/cmcd POST body. The function validates each line independently and merges the results.
Parameters
cmcd
string
The raw CMCD-encoded string to validate. May contain multiple newline-separated event lines.
options?
Omit<CmcdValidationOptions, "reportingMode">
Validation options (excluding reportingMode).
Returns
The validation result including decoded data per event line.
Example
ts
const body = `e=ps,sid="session-1",ts=1700000000000,sta=p,v=2
e=t,sid="session-1",ts=1700000001000,bl=(5000),v=2`
const result = validateCmcdEvents(body)
equal(result.valid, true)
deepStrictEqual(result.issues, [])