decord/source/919_getNotificationAttributes.js

141 lines
4.6 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 919
2026-07-24 07:16:23 +00:00
// Function ID: 10053
2026-07-20 16:05:17 +00:00
// Name: getNotificationAttributes
2026-07-23 10:11:24 +00:00
// Dependencies: [77, 916, 876, 918]
2026-07-20 16:05:17 +00:00
// Exports: buildTypeSpecificAttributes
// Module 919 (getNotificationAttributes)
2026-07-23 10:11:24 +00:00
import _defineProperty from "_defineProperty";
2026-07-20 16:05:17 +00:00
function getNotificationAttributes(arg0, requestId) {
const obj = {};
if ("notifications/cancelled" === arg0) {
if (tmp32) {
const _String7 = String;
2026-07-23 10:11:24 +00:00
obj["mcp.cancelled.request_id"] = String(requestId.requestId);
2026-07-20 16:05:17 +00:00
}
if (tmp34) {
const _String8 = String;
2026-07-23 10:11:24 +00:00
obj["mcp.cancelled.reason"] = String(requestId.reason);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
tmp32 = null != requestId && requestId.requestId;
tmp34 = null != requestId && requestId.reason;
2026-07-20 16:05:17 +00:00
} else if ("notifications/message" === arg0) {
if (tmp18) {
const _String5 = String;
2026-07-23 10:11:24 +00:00
obj[require(916).MCP_LOGGING_LEVEL_ATTRIBUTE] = String(requestId.level);
2026-07-20 16:05:17 +00:00
}
if (tmp22) {
const _String6 = String;
2026-07-23 10:11:24 +00:00
obj[require(916).MCP_LOGGING_LOGGER_ATTRIBUTE] = String(requestId.logger);
2026-07-20 16:05:17 +00:00
}
let data;
if (null != requestId) {
data = requestId.data;
}
if (undefined !== data) {
2026-07-23 10:11:24 +00:00
obj[require(916).MCP_LOGGING_DATA_TYPE_ATTRIBUTE] = typeof requestId.data;
2026-07-20 16:05:17 +00:00
if (arg2) {
data = requestId.data;
let json = data;
if ("string" !== typeof data) {
const _JSON = JSON;
json = JSON.stringify(data);
}
2026-07-23 10:11:24 +00:00
obj[require(916).MCP_LOGGING_MESSAGE_ATTRIBUTE] = json;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
tmp18 = null != requestId && requestId.level;
tmp22 = null != requestId && requestId.logger;
2026-07-20 16:05:17 +00:00
} else if ("notifications/progress" === arg0) {
if (tmp10) {
const _String3 = String;
2026-07-23 10:11:24 +00:00
obj["mcp.progress.token"] = String(requestId.progressToken);
2026-07-20 16:05:17 +00:00
}
let progress;
if (null != requestId) {
progress = requestId.progress;
}
if ("number" === typeof progress) {
2026-07-23 10:11:24 +00:00
obj["mcp.progress.current"] = requestId.progress;
2026-07-20 16:05:17 +00:00
}
let total;
if (null != requestId) {
total = requestId.total;
}
if ("number" === typeof total) {
2026-07-23 10:11:24 +00:00
obj["mcp.progress.total"] = requestId.total;
2026-07-20 16:05:17 +00:00
let progress1;
if (null != requestId) {
progress1 = requestId.progress;
}
if ("number" === typeof progress1) {
2026-07-23 10:11:24 +00:00
obj["mcp.progress.percentage"] = requestId.progress / requestId.total * 100;
2026-07-20 16:05:17 +00:00
}
}
if (tmp15) {
const _String4 = String;
2026-07-23 10:11:24 +00:00
obj["mcp.progress.message"] = String(requestId.message);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
tmp10 = null != requestId && requestId.progressToken;
tmp15 = null != requestId && requestId.message;
2026-07-20 16:05:17 +00:00
} else if ("notifications/resources/updated" === arg0) {
if (null != requestId) {
if (requestId.uri) {
const _String = String;
2026-07-23 10:11:24 +00:00
obj[require(916).MCP_RESOURCE_URI_ATTRIBUTE] = String(requestId.uri);
2026-07-20 16:05:17 +00:00
const _String2 = String;
2026-07-23 10:11:24 +00:00
const result = require(876) /* isURLObjectRelative */.parseStringToURLObject(String(requestId.uri));
2026-07-20 16:05:17 +00:00
let tmp6 = result;
if (result) {
2026-07-23 10:11:24 +00:00
tmp6 = !require(876) /* isURLObjectRelative */.isURLObjectRelative(result);
const obj3 = require(876) /* isURLObjectRelative */;
2026-07-20 16:05:17 +00:00
}
if (tmp6) {
2026-07-23 10:11:24 +00:00
obj["mcp.resource.protocol"] = result.protocol.replace(":", "");
2026-07-20 16:05:17 +00:00
const str2 = result.protocol;
}
2026-07-23 10:11:24 +00:00
const obj2 = require(876) /* isURLObjectRelative */;
2026-07-20 16:05:17 +00:00
}
}
} else if ("notifications/initialized" === arg0) {
2026-07-23 10:11:24 +00:00
obj["mcp.lifecycle.phase"] = "initialization_complete";
obj["mcp.protocol.ready"] = 1;
2026-07-20 16:05:17 +00:00
}
return obj;
}
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
export const buildTypeSpecificAttributes = function buildTypeSpecificAttributes(request, message, params, recordInputs) {
let obj = params;
if ("request" === request) {
if (!obj) {
obj = {};
}
const _Object = Object;
let tmp6 = undefined !== message.id;
2026-07-23 10:11:24 +00:00
const obj3 = require(918) /* extractTargetInfo */;
2026-07-20 16:05:17 +00:00
if (tmp6) {
const _String = String;
2026-07-23 10:11:24 +00:00
tmp6 = _defineProperty({}, require(916).MCP_REQUEST_ID_ATTRIBUTE, String(message.id));
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const attributes = require(918) /* extractTargetInfo */.extractTargetInfo(message.method, obj).attributes;
2026-07-20 16:05:17 +00:00
if (recordInputs) {
if (!obj) {
obj = {};
}
2026-07-23 10:11:24 +00:00
let requestArguments = require(918) /* extractTargetInfo */.getRequestArguments(message.method, obj);
const obj6 = require(918) /* extractTargetInfo */;
2026-07-20 16:05:17 +00:00
} else {
requestArguments = {};
}
return Object.assign({}, tmp6, attributes, requestArguments);
} else {
if (!obj) {
obj = {};
}
return getNotificationAttributes(message.method, obj, recordInputs);
}
};
export { getNotificationAttributes };