95 lines
3.8 KiB
JavaScript
95 lines
3.8 KiB
JavaScript
// Metro module 941 (f942).
|
|
import * as _Module940 from "./Module940";
|
|
import { MCP_METHOD_NAME_ATTRIBUTE, MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE, MCP_NOTIFICATION_ORIGIN_VALUE, MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE, MCP_ROUTE_SOURCE_VALUE } from "./Module940";
|
|
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./Module839";
|
|
import { extractTargetInfo } from "./Module942";
|
|
import { buildTransportAttributes } from "./extractClientInfo";
|
|
import { buildTypeSpecificAttributes } from "./getNotificationAttributes";
|
|
import { getClient } from "./Module848";
|
|
import { filterMcpPiiFromSpanData } from "./Module944";
|
|
import { startSpan } from "./createChildOrRootSpan";
|
|
import { HermesBuiltin } from "../_hermes/prelude";
|
|
const createMcpSpan = function createMcpSpan({ type, message, transport, extra, callback, options }) {
|
|
let MCP_FUNCTION_ORIGIN_VALUE, MCP_SERVER_OP_VALUE;
|
|
const { method, params } = message;
|
|
let name = method;
|
|
if (type === "request") {
|
|
const target = extractTargetInfo(method, params || {}).target;
|
|
name = target ? `${method} ${target}` : method;
|
|
}
|
|
const r34 = {
|
|
...buildTransportAttributes(transport, extra)
|
|
};
|
|
r34[MCP_METHOD_NAME_ATTRIBUTE] = method;
|
|
HermesBuiltin.copyDataProperties(r34, buildTypeSpecificAttributes(type, message, params, options?.recordInputs));
|
|
if (type === "request") {
|
|
MCP_SERVER_OP_VALUE = _Module940.MCP_SERVER_OP_VALUE;
|
|
MCP_FUNCTION_ORIGIN_VALUE = _Module940.MCP_FUNCTION_ORIGIN_VALUE;
|
|
} else if (type === "notification-incoming") {
|
|
MCP_SERVER_OP_VALUE = MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE;
|
|
MCP_FUNCTION_ORIGIN_VALUE = MCP_NOTIFICATION_ORIGIN_VALUE;
|
|
} else {
|
|
MCP_FUNCTION_ORIGIN_VALUE = void 0;
|
|
MCP_SERVER_OP_VALUE = void 0;
|
|
if (type === "notification-outgoing") {
|
|
MCP_SERVER_OP_VALUE = MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE;
|
|
MCP_FUNCTION_ORIGIN_VALUE = MCP_NOTIFICATION_ORIGIN_VALUE;
|
|
}
|
|
}
|
|
const r70 = {};
|
|
r70[SEMANTIC_ATTRIBUTE_SENTRY_OP] = MCP_SERVER_OP_VALUE;
|
|
r70[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = MCP_FUNCTION_ORIGIN_VALUE;
|
|
r70[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = MCP_ROUTE_SOURCE_VALUE;
|
|
HermesBuiltin.copyDataProperties(r34, r70);
|
|
const client = getClient();
|
|
return startSpan({
|
|
name,
|
|
forceTransaction: true,
|
|
attributes: filterMcpPiiFromSpanData(r34, Boolean(client == null ? void 0 : client.getOptions().sendDefaultPii))
|
|
}, callback);
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
export function buildMcpServerSpanConfig(a0, a1, a2, a3) {
|
|
const { method, params } = a0;
|
|
const target = extractTargetInfo(method, params || {}).target;
|
|
const name = target ? `${method} ${target}` : method;
|
|
const r29 = {
|
|
...buildTransportAttributes(a1, a2)
|
|
};
|
|
r29[MCP_METHOD_NAME_ATTRIBUTE] = method;
|
|
HermesBuiltin.copyDataProperties(r29, buildTypeSpecificAttributes("request", a0, params, a3?.recordInputs));
|
|
const r52 = {};
|
|
r52[SEMANTIC_ATTRIBUTE_SENTRY_OP] = _Module940.MCP_SERVER_OP_VALUE;
|
|
r52[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = _Module940.MCP_FUNCTION_ORIGIN_VALUE;
|
|
r52[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = MCP_ROUTE_SOURCE_VALUE;
|
|
HermesBuiltin.copyDataProperties(r29, r52);
|
|
const client = getClient();
|
|
return {
|
|
name,
|
|
op: _Module940.MCP_SERVER_OP_VALUE,
|
|
forceTransaction: true,
|
|
attributes: filterMcpPiiFromSpanData(r29, Boolean(client == null ? void 0 : client.getOptions().sendDefaultPii))
|
|
};
|
|
}
|
|
export function createMcpNotificationSpan(a0, a1, a2, a3, a4) {
|
|
return createMcpSpan({
|
|
type: "notification-incoming",
|
|
message: a0,
|
|
transport: a1,
|
|
extra: a2,
|
|
callback: a4,
|
|
options: a3
|
|
});
|
|
}
|
|
export function createMcpOutgoingNotificationSpan(a0, a1, a2, a3) {
|
|
return createMcpSpan({
|
|
type: "notification-outgoing",
|
|
message: a0,
|
|
transport: a1,
|
|
options: a2,
|
|
callback: a3
|
|
});
|
|
}
|