UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 808 B
import{McpConnectionClient}from"#runtime/connections/mcp-client.js";import{OpenApiConnectionClient}from"#runtime/connections/openapi-client.js";var ConnectionRegistryImpl=class{#e=new Map;#t;constructor(e){this.#t=e}getClient(n){let r=this.#e.get(n);if(r!==void 0)return r;let i=this.#t.find(e=>e.connectionName===n);if(i===void 0)throw Error(`Connection "${n}" is not registered.`);let a=i.protocol===`openapi`?new OpenApiConnectionClient(i):new McpConnectionClient(i);return this.#e.set(n,a),a}getConnectionApproval(e){return this.#t.find(t=>t.connectionName===e)?.approval}getConnectionNames(){return this.#t.map(e=>e.connectionName)}getConnections(){return this.#t}async dispose(){let e=[...this.#e.values()].map(e=>e.close());await Promise.allSettled(e),this.#e.clear()}};export{ConnectionRegistryImpl};