UNPKG

@statezero/core

Version:

The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate

58 lines (57 loc) 2.08 kB
/** * Sets the entire configuration, validating it before storing. * If the configuration is invalid, it throws a ConfigError. */ export function setConfig(newConfig: any): void; /** * Retrieves the validated configuration. * If no configuration has been set, it throws a ConfigError. */ export function getConfig(): any; /** * Merges a partial override into an existing backend config. */ export function setBackendConfig(backendKey: any, newConfig: any): void; /** * Initializes the event receiver based on the configuration. */ export function initializeEventReceiver(backendKey?: string): PusherEventReceiver | null; /** * Initializes event receivers for all configured backends. * * @returns {Object} Map of backend keys to their initialized event receivers * @throws {ConfigError} If configuration is not set or if initialization fails */ export function initializeAllEventReceivers(): Object; /** * Registers the function used to retrieve model classes. * This should be called once during application setup after setConfig. * @param {Function} getterFn - The getModelClass function imported from model-registry.js */ export function registerModelGetter(getterFn: Function): void; /** * Helper function to build file URLs */ export function buildFileUrl(fileUrl: any, backendKey?: string): any; /** * Get a model class by name using the registered getter. * * @param {string} modelName - The model name (e.g., 'app.MyModel') * @param {string} configKey - The config key (backend name) * @returns {Function|null} - The model class or null if not found */ export function getModelClass(modelName: string, configKey: string): Function | null; export namespace liveConfig { let backendConfigs: {}; } export namespace configInstance { export { setConfig }; export { getConfig }; export { setBackendConfig }; export { initializeEventReceiver }; export { registerModelGetter }; export { getModelClass }; export { buildFileUrl }; } export default configInstance; import { PusherEventReceiver } from './core/eventReceivers.js';