"use strict";
/**
 * Milvus vector DB RAG parser.
 * Detects Milvus spans and returns standard RAGCall[].
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.milvusRagParser = void 0;
const utils_1 = require("../utils");
const SYSTEM_NAME = 'milvus';
const DB_SYSTEM = 'db.system';
const DB_SYSTEM_NAME = 'db.system.name';
function isMilvusSpan(span) {
    const attrs = span.attributes ?? {};
    const res = span.resourceAttributes ?? {};
    const sys = attrs[DB_SYSTEM_NAME] ?? attrs[DB_SYSTEM] ?? res[DB_SYSTEM_NAME] ?? res[DB_SYSTEM];
    if (sys != null && String(sys).toLowerCase().includes('milvus'))
        return true;
    const name = (span.name ?? '').toLowerCase();
    const svc = (span.serviceName ?? '').toLowerCase();
    return name.includes('milvus') || svc.includes('milvus');
}
exports.milvusRagParser = {
    name: 'milvus',
    canParse(spans) {
        return (spans ?? []).some(isMilvusSpan);
    },
    parse(spans) {
        return (spans ?? [])
            .filter(isMilvusSpan)
            .map((span) => (0, utils_1.buildRAGCall)(span, { systemName: SYSTEM_NAME }));
    },
};
//# sourceMappingURL=milvus.js.map