{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Span } from '@opentelemetry/api';\nimport { InstrumentationConfig } from '@opentelemetry/instrumentation';\n\nexport interface KafkajsMessage {\n  key?: Buffer | string | null;\n  value: Buffer | string | null;\n  partition?: number;\n  headers?: Record<string, Buffer | string | (Buffer | string)[] | undefined>;\n  timestamp?: string;\n}\n\nexport interface MessageInfo<T = KafkajsMessage> {\n  topic: string;\n  message: T;\n}\n\nexport interface KafkaProducerCustomAttributeFunction<T = KafkajsMessage> {\n  (span: Span, info: MessageInfo<T>): void;\n}\n\nexport interface KafkaConsumerCustomAttributeFunction<T = KafkajsMessage> {\n  (span: Span, info: MessageInfo<T>): void;\n}\n\nexport interface KafkaJsInstrumentationConfig extends InstrumentationConfig {\n  /** hook for adding custom attributes before producer message is sent */\n  producerHook?: KafkaProducerCustomAttributeFunction;\n\n  /** hook for adding custom attributes before consumer message is processed */\n  consumerHook?: KafkaConsumerCustomAttributeFunction;\n}\n"]}