UNPKG

@kya-os/mcp-i

Version:

COMING SOON:Production-ready MCP Identity with automatic registration, key rotation, and optimized performance

57 lines (56 loc) 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RegistryFactory = exports.REGISTRY_TIERS = void 0; exports.resolveRegistries = resolveRegistries; const knowthat_1 = require("./knowthat"); exports.REGISTRY_TIERS = { verified: ["knowthat"], }; class RegistryFactory { static getAdapter(name) { const factory = this.adapters.get(name); return factory ? factory() : null; } static getAdaptersByTier(tier) { const registries = exports.REGISTRY_TIERS[tier] || []; return registries .map((name) => this.getAdapter(name)) .filter((adapter) => adapter !== null); } static registerAdapter(name, factory) { this.adapters.set(name, factory); } } exports.RegistryFactory = RegistryFactory; RegistryFactory.adapters = new Map([ ["knowthat", () => new knowthat_1.KnowThatRegistry()], ["knowthat.ai", () => new knowthat_1.KnowThatRegistry()], ]); function resolveRegistries(registries) { if (!registries) { return exports.REGISTRY_TIERS.verified; } if (Array.isArray(registries)) { return registries; } if (typeof registries === "string") { return exports.REGISTRY_TIERS[registries] || []; } const config = registries; let included = []; if (config.include) { if (Array.isArray(config.include)) { included = config.include; } else { included = exports.REGISTRY_TIERS[config.include] || []; } } else { included = exports.REGISTRY_TIERS.verified; } if (config.exclude && config.exclude.length > 0) { return included.filter((name) => !config.exclude.includes(name)); } return included; }