autotel
Version:
Write Once, Observe Anywhere
1 lines • 2.44 kB
Source Map (JSON)
{"version":3,"sources":["../src/validation-attributes.ts"],"names":[],"mappings":";;;AAcO,IAAM,eAAA,GAAkB;AAAA;AAAA,EAE7B,IAAA,EAAM,iBAAA;AAAA;AAAA,EAEN,QAAA,EAAU,qBAAA;AAAA;AAAA,EAEV,IAAA,EAAM,iBAAA;AAAA;AAAA,EAEN,IAAA,EAAM,iBAAA;AAAA;AAAA,EAEN,QAAA,EAAU,qBAAA;AAAA;AAAA,EAEV,UAAA,EAAY,wBAAA;AAAA;AAAA,EAEZ,UAAA,EAAY,wBAAA;AAAA;AAAA,EAEZ,UAAA,EAAY;AACd;AAKO,IAAM,kBAAA,GAAqB;AAAA;AAAA,EAEhC,UAAA,EAAY;AACd;AAGO,IAAM,oBAAA,GAAuB","file":"chunk-T5WRA76K.cjs","sourcesContent":["/**\n * Validation telemetry wire constants — the single source of truth for the\n * `validation.*` span attributes and the `autotel.validation.mismatches` metric\n * emitted when an input payload (HTTP body, event, message) fails to match its\n * declared shape.\n *\n * Dependency-free and side-effect-free by design (mirrors `security-schema.ts`):\n * safe to import from anything that only needs the constant strings — a\n * dashboard, a CLI, an alert rule — without pulling in the OpenTelemetry SDK.\n *\n * These keys are a public API for the agents that query your telemetry. Treat a\n * rename here the way you'd treat a breaking change to any other contract.\n */\n\nexport const VALIDATION_ATTR = {\n /** Contract id of the validated boundary, e.g. `POST /orders`, `order.placed`. */\n name: 'validation.name',\n /** Where validation ran: `http` | `event` | `message` | a custom label. */\n boundary: 'validation.boundary',\n /** `observe` (recorded, request continues) or `reject` (recorded, then failed). */\n mode: 'validation.mode',\n /** Stable hash of the declared shape, when a JSON-schema projection is given. */\n hash: 'validation.hash',\n /** `info` | `warning` | `error`. */\n severity: 'validation.severity',\n /** Number of failing fields. */\n issueCount: 'validation.issue.count',\n /** Comma-separated failing field paths (capped). Never contains values. */\n issuePaths: 'validation.issue.paths',\n /** Comma-separated distinct issue codes (capped). Never contains values. */\n issueCodes: 'validation.issue.codes',\n} as const;\n\nexport type ValidationAttributeKey =\n (typeof VALIDATION_ATTR)[keyof typeof VALIDATION_ATTR];\n\nexport const VALIDATION_METRICS = {\n /** Counter, labelled `{ boundary, validation, mode }`. */\n mismatches: 'autotel.validation.mismatches',\n} as const;\n\n/** Max field paths / codes stamped onto a span, to bound attribute size. */\nexport const VALIDATION_ISSUE_CAP = 20;\n"]}