@baruchiro/paperless-mcp
Version:
Model Context Protocol (MCP) server for interacting with Paperless-NGX document management system. Enables AI assistants to manage documents, tags, correspondents, and document types through the Paperless-NGX API.
30 lines (29 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.headersToObject = void 0;
exports.enhanceMatchingAlgorithm = enhanceMatchingAlgorithm;
exports.enhanceMatchingAlgorithmArray = enhanceMatchingAlgorithmArray;
const types_1 = require("./types");
const headersToObject = (headers) => {
if (!headers)
return {};
if (typeof headers.forEach === "function") {
const obj = {};
headers.forEach((value, key) => {
obj[key] = value;
});
return obj;
}
return headers;
};
exports.headersToObject = headersToObject;
function enhanceMatchingAlgorithm(obj) {
return Object.assign(Object.assign({}, obj), { matching_algorithm: {
id: obj.matching_algorithm,
name: types_1.MATCHING_ALGORITHM_OPTIONS[obj.matching_algorithm] ||
String(obj.matching_algorithm),
} });
}
function enhanceMatchingAlgorithmArray(objects) {
return objects.map((obj) => enhanceMatchingAlgorithm(obj));
}