import { type EnhancedStore, type Middleware, type Reducer } from "@reduxjs/toolkit"; import { type SagaIterator, type Task } from "redux-saga"; import { type RenderMode } from "../../types.js"; import { type DashboardEventHandler } from "../eventHandlers/eventHandler.js"; import { type DashboardContext, type PrivateDashboardContext } from "../types/commonTypes.js"; import { type IDashboardQueryService } from "./_infra/queryService.js"; import { type DashboardDispatch, type DashboardState } from "./types.js"; /** * @internal */ export type DashboardStore = EnhancedStore; export interface IDashboardStoreEventing { /** * Specify event handlers to register during the initialization. */ initialEventHandlers?: DashboardEventHandler[]; /** * Specify callback that will be called each time the state changes. */ onStateChange?: (state: DashboardState, dispatch: DashboardDispatch) => void; /** * Specify callback that will be called when the dashboard eventing subsystem initializes and * it is possible to register new or unregister existing event handlers. * * @remarks * Note: these callbacks allow modification of event handlers on an existing, initialized dashboard. See * {@link IDashboardEventing.eventHandlers} prop if you want to register handlers _before_ the dashboard * initialization starts. */ onEventingInitialized?: (registerEventHandler: (handler: DashboardEventHandler) => void, unregisterEventHandler: (handler: DashboardEventHandler) => void) => void; } export interface IDashboardStoreConfig { /** * Specifies context that will be hammered into the saga middleware. * * @remarks * All sagas can then access the values from the context. * * Remember: `DashboardContext` is part of the public API. Do not store internals in here. If need * to have internals in the context, then use the privateContext. * * This context is automatically passed to all command handlers, query processors and background workers. * If you need to obtain the context from some other place, use the `getDashboardContext` generator */ dashboardContext: DashboardContext; /** * Specify private context that will be hammered into the saga middleware. * * @remarks * Private context may contain internal global configuration / customization that needs to be available * in the different parts of the model. * * The private context is not passed around by the infrastructure. To obtain it, use the `getPrivateContext` * generator. */ privateContext?: PrivateDashboardContext; /** * Specify redux middleware to register into the store. */ additionalMiddleware?: Middleware; /** * Eventing configuration to apply during store initialization. */ eventing?: IDashboardStoreEventing; /** * Specify query service implementations. * * @remarks * These will be used to override the default implementations and add new services. */ queryServices?: IDashboardQueryService[]; /** * Specify background workers implementations. * * @remarks * Workers are redux-saga iterators that run on the background, they can listen to dashboard events and fire dashboard commands. * All the provided workers will run in parallel on the background. * Background workers are processed last in the chain of all command and event processing. */ backgroundWorkers: ((context: DashboardContext) => SagaIterator)[]; /** * @internal * * Specify which render mode will be used for initial rendering. * * @remarks * If you do not specify initialRenderMode, the dashboard component will be display in view mode. */ initialRenderMode: RenderMode; /** * Preload redux store with particular state. Useful in component testing. */ preloadedState?: DashboardState; } /** * Fully configured and initialized dashboard store realized by redux and with redux-sagas. */ export interface IReduxedDashboardStore { store: DashboardStore; registerEventHandler: (handler: DashboardEventHandler) => void; unregisterEventHandler: (handler: DashboardEventHandler) => void; rootSagaTask: Task; } export declare function createDashboardRootReducer({ queryCache }?: { queryCache?: Reducer; }): Reducer<{ loading: import("./loading/loadingState.js").ILoadingState; saving: import("./saving/savingState.js").SavingState; executed: import("./executed/executedState.js").IExecutedState; backendCapabilities: import("./backendCapabilities/backendCapabilitiesState.js").BackendCapabilitiesState; config: import("./config/configState.js").ConfigState; entitlements: import("./entitlements/entitlementsState.js").IEntitlementsState; permissions: import("./permissions/permissionsState.js").PermissionsState; tabs: import("./tabs/tabsState.js").ITabsState; insights: import("@reduxjs/toolkit").EntityState & object; drillTargets: import("@reduxjs/toolkit").EntityState & object; catalog: import("./catalog/catalogState.js").CatalogState; user: import("./user/userState.js").UserState; meta: import("./meta/metaState.js").IDashboardMetaState; drill: import("./drill/drillState.js").IDrillState; listedDashboards: import("@reduxjs/toolkit").EntityState & object; accessibleDashboards: import("./accessibleDashboards/index.js").IAccessibleDashboardsState; inaccessibleDashboards: import("@reduxjs/toolkit").EntityState & object; executionResults: import("@reduxjs/toolkit").EntityState & object; renderMode: import("./renderMode/renderModeState.js").IRenderModeState; ui: import("./ui/uiState.js").IUiState; dashboardPermissions: import("./dashboardPermissions/dashboardPermissionsState.js").DashboardPermissionsState; showWidgetAsTable: import("./showWidgetAsTable/showWidgetAsTableState.js").IShowWidgetAsTableState; notificationChannels: import("./notificationChannels/notificationChannelsState.js").INotificationChannelsState; automations: import("./automations/automationsState.js").IAutomationsState; users: import("./users/usersState.js").IUsersState; filterViews: import("./filterViews/filterViewsState.js").IFilterViewsState; dashboardSummaryWorkflow: import("./dashboardSummaryWorkflow/dashboardSummaryWorkflowState.js").DashboardSummaryWorkflowState; _queryCache: any; }, import("redux").UnknownAction, Partial<{ loading: import("./loading/loadingState.js").ILoadingState | undefined; saving: import("./saving/savingState.js").SavingState | undefined; executed: import("./executed/executedState.js").IExecutedState | undefined; backendCapabilities: import("./backendCapabilities/backendCapabilitiesState.js").BackendCapabilitiesState | undefined; config: import("./config/configState.js").ConfigState | undefined; entitlements: import("./entitlements/entitlementsState.js").IEntitlementsState | undefined; permissions: import("./permissions/permissionsState.js").PermissionsState | undefined; tabs: import("./tabs/tabsState.js").ITabsState | undefined; insights: (import("@reduxjs/toolkit").EntityState & object) | undefined; drillTargets: (import("@reduxjs/toolkit").EntityState & object) | undefined; catalog: import("./catalog/catalogState.js").CatalogState | undefined; user: import("./user/userState.js").UserState | undefined; meta: import("./meta/metaState.js").IDashboardMetaState | undefined; drill: import("./drill/drillState.js").IDrillState | undefined; listedDashboards: (import("@reduxjs/toolkit").EntityState & object) | undefined; accessibleDashboards: import("./accessibleDashboards/index.js").IAccessibleDashboardsState | undefined; inaccessibleDashboards: (import("@reduxjs/toolkit").EntityState & object) | undefined; executionResults: (import("@reduxjs/toolkit").EntityState & object) | undefined; renderMode: import("./renderMode/renderModeState.js").IRenderModeState | undefined; ui: import("./ui/uiState.js").IUiState | undefined; dashboardPermissions: import("./dashboardPermissions/dashboardPermissionsState.js").DashboardPermissionsState | undefined; showWidgetAsTable: import("./showWidgetAsTable/showWidgetAsTableState.js").IShowWidgetAsTableState | undefined; notificationChannels: import("./notificationChannels/notificationChannelsState.js").INotificationChannelsState | undefined; automations: import("./automations/automationsState.js").IAutomationsState | undefined; users: import("./users/usersState.js").IUsersState | undefined; filterViews: import("./filterViews/filterViewsState.js").IFilterViewsState | undefined; dashboardSummaryWorkflow: import("./dashboardSummaryWorkflow/dashboardSummaryWorkflowState.js").DashboardSummaryWorkflowState | undefined; _queryCache: any; }>>; /** * Creates a new store for a dashboard. * * @param config - runtime configuration to apply on the middlewares and the store */ export declare function createDashboardStore(config: IDashboardStoreConfig): IReduxedDashboardStore; //# sourceMappingURL=dashboardStore.d.ts.map