import { IEngineConnectorFactory , OpenAPIEngineConnectorFactory , } from "@/infrastructures/EngineConnector" ; import { ProxyActions , ProxyGetters , ProxyMutations , ProxyStoreState , VoiceVoxStoreOptions , } from "./type" ; export const proxyStoreState = { } ; const proxyStoreCreator = ( _engineFactory ) : VoiceVoxStoreOptions < ProxyGetters , ProxyActions , ProxyMutations > => { const proxyStore = { getters : { } , mutations : { } , actions : { INVOKE_ENGINE_CONNECTOR ( { rootState } , payload ) { const instance = _engineFactory . instance ( rootState . engineHost ) ; const action = payload . action ; const args = payload . payload ; return instance [ action ] ( ... args ) ; } , } , } ; return proxyStore ; } ; export const proxyStore = proxyStoreCreator ( OpenAPIEngineConnectorFactory ) ;