UNPKG

@magnetarjs/core

Version:
48 lines (47 loc) 2.43 kB
import type { GlobalConfig, ModuleConfig, PluginModuleConfig } from '@magnetarjs/types'; /** * Extracts the PluginModuleConfig from the ModuleConfig * * @export * @param {ModuleConfig} moduleConfig * @param {string} storeName * @returns {PluginModuleConfig} */ export declare function getPluginModuleConfig(moduleConfig: ModuleConfig, storeName: string): PluginModuleConfig; /** * Executes 'setupModule' function per store, when the collection or doc is instantiated. * * @export * @param {GlobalConfig['stores']} globalConfigStores * @param {[string, string | undefined]} [collectionPath, docId] * @param {ModuleConfig} moduleConfig */ export declare function executeSetupModulePerStore(globalConfigStores: GlobalConfig['stores'], [collectionPath, docId]: [string, string | undefined], moduleConfig: ModuleConfig): undefined; /** Executes the `getModuleData` function from the store specified as 'cache' */ export declare function getDataFromDataStore(moduleConfig: ModuleConfig, globalConfig: GlobalConfig, collectionPath: string): Map<string, { [key: string]: any; }>; /** Executes the `getModuleData` function from the store specified as 'cache' */ export declare function getDataFromDataStore(moduleConfig: ModuleConfig, globalConfig: GlobalConfig, collectionPath: string, docId: string): { [key: string]: any; }; /** Executes the `getModuleData` function from the store specified as 'cache' */ export declare function getExistsFromDataStore(globalConfig: GlobalConfig, collectionPath: string, docId: string): undefined | 'error' | boolean; /** Executes the `getModuleCount` function from the store specified as 'cache' */ export declare function getCountFromDataStore(moduleConfig: ModuleConfig, globalConfig: GlobalConfig, collectionPath: string): number; /** Executes the `getModuleAggregate` function from the store specified as 'cache' */ export declare function getAggregateFromDataStore(kind: 'sum' | 'average', moduleConfig: ModuleConfig, globalConfig: GlobalConfig, collectionPath: string): { [key in string]: number | { [key in string]: unknown; }; }; /** * Returns an object as proxy which will execute the given functions upon prop access for the params passed here */ export declare function proxify<T extends { [key: string]: unknown; }, P extends { [key: string]: () => any; }>(target: T, propExecutionDic: P): T & { [key in keyof P]: ReturnType<P[key]>; };