@altostra/core
Version:
Core library for shared types and logic
1 lines • 1.15 kB
JavaScript
;var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,i)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ParametersManager=void 0;const Iterable_1=require("../Iterable");class ParametersManager{constructor(...e){this._stores=e}get(e){return __awaiter(this,void 0,void 0,(function*(){for(const t of this._stores){const r=yield t.get(e);if(r)return r}}))}getParameters(e){return __awaiter(this,void 0,void 0,(function*(){const t=new Set(e),r={};for(const e of this._stores){const n=yield e.getParameters(Array.from(t));if((0,Iterable_1.entries)(n).forEach(([e,n])=>{r[e]=n,t.delete(e)}),0===t.size)return r}return r}))}getParametersByPath(e){return __awaiter(this,void 0,void 0,(function*(){for(const t of this._stores){const r=yield t.getParametersByPath(e);if(r&&Object.keys(r).length>0)return r}return{}}))}}exports.ParametersManager=ParametersManager;