UNPKG

@empathyco/x-components

Version:
42 lines 2.07 kB
import type { Dictionary } from '@empathyco/x-utils'; import type { ExtractGetters, XModuleName } from '../../x-modules/x-modules.types'; import type { AnyXStoreModule } from '../store.types'; /** * Creates or return a proxy object of the getters of the storeModule passed. * * @param getters - The Vuex Store Getters. * @param moduleName - The name of the module. * @param storeModule - The store module. * @returns A {@link GettersTree} object with only the getters of the {@link XModule}. * * @internal * * @remarks This proxy will be used by the stateSelector, of the module. This is done to ensure that * a Vuex stateSelector can only access the getters of the {@link XModule} where it is registered. * This function task can be done with {@link getGettersProxy}, just without passing the * storeModule. But in that case every time we register emitters in a module, it will loop over all * the getters of all the store. This way, passing the moduleNeeded, it only loops over the getters * of that module. It is a performance question to have this two different implementations. * */ export declare function getGettersProxyFromModule<ModuleName extends XModuleName>(getters: Dictionary, moduleName: ModuleName, storeModule: AnyXStoreModule): ExtractGetters<ModuleName>; /** * Creates or return a proxy object of the getters of the module with the moduleName passed. * * @param getters - The Vuex Store Getters. * @param moduleName - The name of the module. * @returns A {@link GettersTree} object with only the getters of the {@link XModule}. * * @internal * * @remarks This proxy will be used wireCommit to pass the module state and getters, to a function * that will return the payload to commit the mutation. */ export declare function getGettersProxy<ModuleName extends XModuleName>(getters: Dictionary, moduleName: ModuleName): ExtractGetters<ModuleName>; /** * Clean the cache (This is for testing purpose). * * @internal */ export declare function cleanGettersProxyCache(): void; //# sourceMappingURL=getters-proxy.utils.d.ts.map