{"version":3,"file":"spanKind.js","sources":["../../src/spanKind.ts"],"sourcesContent":["/**\n * The kind of a span, mirroring OpenTelemetry's `SpanKind` enum values.\n *\n * Exported as a plain const object so SDK code can set a span's kind without\n * importing `@opentelemetry/api` just for the enum. The numeric values must\n * stay in sync with OpenTelemetry's `SpanKind` since they are passed through to\n * the underlying OTel span and sampler.\n */\nexport const SPAN_KIND = {\n INTERNAL: 0,\n SERVER: 1,\n CLIENT: 2,\n PRODUCER: 3,\n CONSUMER: 4,\n} as const;\n\nexport type SpanKindValue = (typeof SPAN_KIND)[keyof typeof SPAN_KIND];\n\n// Reverse of SPAN_KIND (value → name), for the `otel.kind` attribute. The numeric keys come from\n// SPAN_KIND so they stay in sync; `satisfies` ensures every kind has a name.\nconst SPAN_KIND_NAME = {\n [SPAN_KIND.INTERNAL]: 'INTERNAL',\n [SPAN_KIND.SERVER]: 'SERVER',\n [SPAN_KIND.CLIENT]: 'CLIENT',\n [SPAN_KIND.PRODUCER]: 'PRODUCER',\n [SPAN_KIND.CONSUMER]: 'CONSUMER',\n} as const satisfies Record;\n\n/**\n * Resolve the string name of a span kind value (e.g. `1` → `'SERVER'`), mirroring the reverse\n * mapping of OpenTelemetry's `SpanKind` enum. Used for the `otel.kind` span attribute, so SDK\n * code doesn't need to import `@opentelemetry/api` just for that reverse lookup.\n */\nexport function spanKindToName(kind: number): (typeof SPAN_KIND_NAME)[SpanKindValue] | undefined {\n return SPAN_KIND_NAME[kind as SpanKindValue];\n}\n"],"names":[],"mappings":";;AAQO,MAAM,SAAA,GAAY;AAAA,EACvB,QAAA,EAAU,CAAA;AAAA,EACV,MAAA,EAAQ,CAAA;AAAA,EACR,MAAA,EAAQ,CAAA;AAAA,EACR,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU;AACZ;AAMA,MAAM,cAAA,GAAiB;AAAA,EACrB,CAAC,SAAA,CAAU,QAAQ,GAAG,UAAA;AAAA,EACtB,CAAC,SAAA,CAAU,MAAM,GAAG,QAAA;AAAA,EACpB,CAAC,SAAA,CAAU,MAAM,GAAG,QAAA;AAAA,EACpB,CAAC,SAAA,CAAU,QAAQ,GAAG,UAAA;AAAA,EACtB,CAAC,SAAA,CAAU,QAAQ,GAAG;AACxB,CAAA;AAOO,SAAS,eAAe,IAAA,EAAkE;AAC/F,EAAA,OAAO,eAAe,IAAqB,CAAA;AAC7C;;;;;"}