UNPKG

@hexadrop/query

Version:

Hexagonal architecture utils library

2 lines 752 B
import{a as y,c as n}from"./chunk-FJNOTJLN.js";import{a as p}from"./chunk-MZHAKUPB.js";import"./chunk-UAV2XQCZ.js";var u=class a extends p{queryHandlersMap;constructor(){super(),this.queryHandlersMap=new Map}static merge(...r){let e=new a;for(let s of r)for(let[t,o]of s.queryHandlersMap.entries())e.queryHandlersMap.set(t,o);return e}register(r,e){"run"in e?this.queryHandlersMap.set(r.QUERY_NAME,e.run.bind(e)):this.queryHandlersMap.set(r.QUERY_NAME,e)}search(r){let e;if("QUERY_NAME"in r?e=r.QUERY_NAME:"queryName"in r&&(e=r.queryName),!e)throw new y;let s=this.queryHandlersMap.get(e);if(!s)throw new n(e);return s}unregister(r){this.queryHandlersMap.delete(r.QUERY_NAME)}};export{u as default}; //# sourceMappingURL=in-memory.query-handlers.js.map