UNPKG

arvo-event-handler

Version:

Type-safe event handler system with versioning, telemetry, and contract validation for distributed Arvo event-driven architectures, featuring routing and multi-handler support.

19 lines (18 loc) 596 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJsonSize = getJsonSize; var arvo_core_1 = require("arvo-core"); function getJsonSize(obj) { try { var jsonString = JSON.stringify(obj); // Use TextEncoder to get actual UTF-8 byte length return new TextEncoder().encode(jsonString).length; } catch (e) { (0, arvo_core_1.logToSpan)({ level: 'WARNING', message: "Error while calculating the size of the machine memory record. Error: ".concat(e.message), }); return -1; } }