class t{constructor(t,e,n){this._component=t,this._updateTerminalState=e,this._kvClient=n}async runCommandLine(t){this._updateTerminalState({type:"running",commandLine:t,history:this._component.terminalState.history});try{const{success:e,result:n}=await this._kvClient.sendCommandLine(t);this._updateTerminalState({type:"idle",history:this._component.terminalState.history.concat({commandLine:t,result:n,success:e})})}catch(n){this._updateTerminalState({type:"idle",history:this._component.terminalState.history.concat({commandLine:t,result:[e(n)],success:!1})});const s=function(t){return t?.responseBody?.code}(n);if("clever.redis-http.unknown-command"===s||"clever.redis-http.bad-command-format"===s)throw n}}clear(){this._updateTerminalState({type:"idle",history:[]})}}function e(t){return t?.responseBody?.message}export{t as KvTerminalCtrl};
//# sourceMappingURL=kv-terminal-ctrl.js.map
