Guard Event Bus Payload
Payload-shape validator for b.agent.eventBus events. Bus owners declare a schema per topic (flat key→type map); operators publishing events validate against the schema before pubsub dispatch; subscribers re-validate at delivery in case the payload was tampered in-flight.
Per-topic schema is a flat object:
bus.registerTopic("mail.scan.malware-detected", {
schema: {
source: "string",
confidence: "number",
detectedAt: "isoDateTime",
sampleId: "string",
},
...
});
Types: string / number / boolean / integer / isoDateTime / array / object. Optional fields suffix-marked with ? (e.g. "reason?": "string").
Payload byte cap (default 64 KiB) — events are metadata, NOT bulk data; publishers move bulk data through b.objectStore / b.mailStore and reference IDs in events.
b.guardEventBusPayload.validate(payload, schema, opts?) #
{
profile: "strict" | "balanced" | "permissive",
posture: "hipaa" | "pci-dss" | "gdpr" | "soc2",
}
Validate an event payload against its declared schema. Returns the payload on success; throws on type mismatch / missing required field / oversize.
b.guardEventBusPayload.validate(
{ source: "1.2.3.4", confidence: 0.95 },
{ source: "string", confidence: "number" }
);
b.guardEventBusPayload.compliancePosture(name) #
Return the effective profile NAME for a compliance posture, or null for a name this parser does not map. Unlike the content-guard variant this returns the resolved profile string (every line-protocol parser composes gateContract.ALL_STRICT_POSTURES, so "hipaa" / "pci-dss" / "gdpr" / "soc2" all resolve to "strict") and never throws — the parser shape carries no overlay-clone, no buildProfile, and no loadRulePack. Wired by gateContract.defineParser.
b.guardEventBusPayload.compliancePosture("hipaa"); // → "strict"
b.guardEventBusPayload.compliancePosture("not-a-regime"); // → null
Last updated 2026-08-08T16:39:49.652Z by seeder.