import { DataType } from "../data-utilities/types.js"; import { NavigationConfig, NavigationConfigDictionary } from "./navigation.props.js"; import { Data, DataDictionary, LinkedData } from "./data.props.js"; import { SchemaDictionary } from "./schema.props.js"; import { MessageSystemType } from "./types.js"; import { Validation, ValidationError } from "./validation.props.js"; import { History } from "./history.props.js"; /** * Note on nomenclature: incoming messages are being sent to, and recieved, by the message system * while outgoing messages are being sent from the message system to any registered service. These * terms are from the POV of the message system. */ export declare enum MessageSystemDataTypeAction { update = "update", remove = "remove", add = "add", duplicate = "duplicate", removeLinkedData = "remove-linked-data", addLinkedData = "add-linked-data", reorderLinkedData = "reorder-linked-data" } export declare enum MessageSystemNavigationTypeAction { update = "update", get = "get" } export declare enum MessageSystemValidationTypeAction { update = "update", get = "get" } export declare enum MessageSystemHistoryTypeAction { get = "get", previous = "previous", next = "next" } export declare enum MessageSystemSchemaDictionaryTypeAction { add = "add" } interface ArbitraryMessageIncoming { /** * Additional arbitrary options to be passed with the message */ options?: TConfig; } interface ArbitraryMessageOutgoing { /** * Additional arbitrary options to be passed with the message */ options?: TConfig; activeHistoryIndex: number; dataDictionary: DataDictionary; navigationDictionary: NavigationConfigDictionary; activeNavigationConfigId: string; activeDictionaryId: string; /** * @deprecated */ dictionaryId: string; schemaDictionary: SchemaDictionary; validation: Validation; historyId: string; } export interface InternalIncomingMessage { /** * The message to be sent */ 0: Message; /** * The internal ID of the message */ 1: string; } export interface InternalOutgoingMessage { /** * The message to be sent */ 0: Message; /** * The internal ID of the message */ 1: string; } /** * The message to initialize the message system * * A message system can be initialized without a data dictionary or schema dictionary * if asynchronous services are being added to the message system and the initialization * must happen at a later stage once the asynchronous services have initialized. */ export interface InitializeMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.initialize; /** * This is deprecated in favor of the dataDictionary * property * @deprecated */ data?: DataDictionary; /** * This is required when data is not provided */ dataDictionary?: DataDictionary; /** * Set the dictionary id, otherwise default to the root */ dictionaryId?: string; schemaDictionary: SchemaDictionary; historyLimit?: number; } /** * The message that the message system has been initialized */ export interface InitializeMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.initialize; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; /** * @deprecated */ schema: any; /** * @deprecated */ historyLimit: number; } /** * The message that the validation should be updated */ export interface UpdateValidationMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.validation; action: MessageSystemValidationTypeAction.update; dictionaryId: string; validationErrors: ValidationError[]; } /** * The message that the validation has been updated */ export interface UpdateValidationMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.validation; action: MessageSystemValidationTypeAction.update; /** * @deprecated */ validationErrors: ValidationError[]; } /** * The message to get the validation */ export interface GetValidationMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.validation; action: MessageSystemValidationTypeAction.get; dictionaryId: string; } /** * The message that the validation has been given */ export interface GetValidationMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.validation; action: MessageSystemValidationTypeAction.get; /** * @deprecated */ validationErrors: ValidationError[]; } /** * The message to update data */ export interface UpdateDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.update; /** * Dictionary ID to use if it is different from the current * active dictionary ID */ dictionaryId?: string; dataLocation: string; data: unknown; } /** * The message that the data has been updated */ export interface UpdateDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.update; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to add a linked data */ export interface AddLinkedDataDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.addLinkedData; /** * Dictionary ID to use if it is different from the current * active dictionary ID */ dictionaryId?: string; /** * The index to insert the linked data to, if this is not provided * the linked data will be added to the end of the list */ index?: number; dataLocation: string; linkedData: Array>; /** * If there is a list of previous IDs used for this linked data, * utilize these instead of generated them. * * Warning: this should only be used internally or if the user has a self * curated ID system they would prefer to use over the auto-generated one. */ originalLinkedDataIds?: Array; } /** * The message that linked data has been added */ export interface AddLinkedDataDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.addLinkedData; /** * @deprecated */ linkedDataIds: LinkedData[]; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to remove linked data */ export interface RemoveLinkedDataDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.removeLinkedData; /** * Dictionary ID to use if it is different from the current * active dictionary ID */ dictionaryId?: string; dataLocation?: string; linkedData?: LinkedData[]; } /** * The message that linked data has been removed */ export interface RemoveLinkedDataDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.removeLinkedData; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; /** * An array of linked data ids that were removed from * the data dictionary * @deprecated */ linkedDataIds: string[]; } /** * The message to reorder linked data */ export interface ReorderLinkedDataDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.reorderLinkedData; dataLocation: string; linkedData: LinkedData[]; } /** * The message that linked data has been reordered */ export interface ReorderLinkedDataDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.reorderLinkedData; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to duplicate data */ export interface DuplicateDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.duplicate; sourceDataLocation: string; } /** * The message that the data has been duplicated * with updated data */ export interface DuplicateDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.duplicate; /** * @deprecated */ sourceDataLocation: string; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to remove data */ export interface RemoveDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.remove; dictionaryId?: string; dataLocation: string; } /** * The message that the data has been removed * with updated data */ export interface RemoveDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.remove; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to add data */ export interface AddDataMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.data; action: MessageSystemDataTypeAction.add; dataLocation: string; data: unknown; dataType: DataType; } /** * The message that the data has been added * with updated data */ export interface AddDataMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.data; action: MessageSystemDataTypeAction.add; /** * @deprecated */ data: unknown; /** * @deprecated */ navigation: NavigationConfig; } /** * Incoming data messages to the message system */ export declare type DataMessageIncoming = UpdateDataMessageIncoming | DuplicateDataMessageIncoming | RemoveDataMessageIncoming | AddDataMessageIncoming | AddLinkedDataDataMessageIncoming | RemoveLinkedDataDataMessageIncoming | ReorderLinkedDataDataMessageIncoming; /** * Outgoing data messages to the message system */ export declare type DataMessageOutgoing = DuplicateDataMessageOutgoing | RemoveDataMessageOutgoing | AddDataMessageOutgoing | UpdateDataMessageOutgoing | AddLinkedDataDataMessageOutgoing | RemoveLinkedDataDataMessageOutgoing | ReorderLinkedDataDataMessageOutgoing; /** * The message to update navigation */ export interface UpdateNavigationMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.navigation; action: MessageSystemNavigationTypeAction.update; activeDictionaryId: string; activeNavigationConfigId: string; } /** * The message that the navigation has been updated */ export interface UpdateNavigationMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.navigation; action: MessageSystemNavigationTypeAction.update; } /** * The message to get navigation */ export interface GetNavigationMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.navigation; action: MessageSystemNavigationTypeAction.get; } /** * The message that the navigation has been given */ export interface GetNavigationMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.navigation; action: MessageSystemNavigationTypeAction.get; /** * @deprecated */ navigation: NavigationConfig; } /** * The message to get history */ export interface GetHistoryMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.history; action: MessageSystemHistoryTypeAction.get; } /** * The message that the history has been given */ export interface GetHistoryMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.history; action: MessageSystemHistoryTypeAction.get; history: History; activeHistoryIndex: number; } /** * The message to move to the next item in history * Note: This message does not have an outgoing message as the outgoing message * is the next message stored in the history item */ export interface NextHistoryMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.history; action: MessageSystemHistoryTypeAction.next; } /** * The message to move to the previous item in history */ export interface PreviousHistoryMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.history; action: MessageSystemHistoryTypeAction.previous; } /** * The message to add schemas to the schema dictionary */ export interface AddSchemaDictionaryMessageIncoming extends ArbitraryMessageIncoming { type: MessageSystemType.schemaDictionary; action: MessageSystemSchemaDictionaryTypeAction.add; schemas: any[]; } /** * The message that schemas have been added to the schema dictionary */ export interface AddSchemaDictionaryMessageOutgoing extends ArbitraryMessageOutgoing { type: MessageSystemType.schemaDictionary; action: MessageSystemSchemaDictionaryTypeAction.add; } export interface CustomMessageIncomingOutgoing extends ArbitraryMessageIncoming { type: MessageSystemType.custom; } /** * The message that an error occured when attempting to perform an action */ export interface ErrorMessageOutgoing { type: MessageSystemType.error; message: string; } /** * The custom message interface */ export declare type CustomMessage = CustomMessageIncomingOutgoing & T; /** * Incoming navigation messages to the message system */ export declare type NavigationMessageIncoming = UpdateNavigationMessageIncoming | GetNavigationMessageIncoming; /** * Outgoing navigation messages to the message system */ export declare type NavigationMessageOutgoing = UpdateNavigationMessageOutgoing | GetNavigationMessageOutgoing; /** * Incoming validation messages to the message system */ export declare type ValidationMessageIncoming = UpdateValidationMessageIncoming | GetValidationMessageIncoming; /** * Outgoing validation messages to the message system */ export declare type ValidationMessageOutgoing = UpdateValidationMessageOutgoing | GetValidationMessageOutgoing; /** * Incoming history messages to the message system */ export declare type HistoryMessageIncoming = GetHistoryMessageIncoming | NextHistoryMessageIncoming | PreviousHistoryMessageIncoming; /** * Outgoing history messages from the message system */ export declare type HistoryMessageOutgoing = GetHistoryMessageOutgoing; /** * Incoming schema dictionary messages to the message system */ export declare type SchemaDictionaryMessageIncoming = AddSchemaDictionaryMessageIncoming; /** * Outgoing schema dictionary messages from the message system */ export declare type SchemaDictionaryMessageOutgoing = AddSchemaDictionaryMessageOutgoing; /** * Incoming messages to the message system */ export declare type MessageSystemIncoming = InitializeMessageIncoming | DataMessageIncoming | HistoryMessageIncoming | SchemaDictionaryMessageIncoming | NavigationMessageIncoming | ValidationMessageIncoming | CustomMessage; /** * Outgoing message to the message system after passing * through the internal MessageSystem instance */ export declare type InternalMessageSystemIncoming = InternalIncomingMessage | InternalIncomingMessage | InternalIncomingMessage | InternalIncomingMessage | InternalIncomingMessage | InternalIncomingMessage | InternalOutgoingMessage>; /** * Outgoing messages from the message system */ export declare type MessageSystemOutgoing = InitializeMessageOutgoing | DataMessageOutgoing | ErrorMessageOutgoing | HistoryMessageOutgoing | SchemaDictionaryMessageOutgoing | NavigationMessageOutgoing | ValidationMessageOutgoing | CustomMessage; /** * Outgoing message to the message system after passing * through the internal MessageSystem instance */ export declare type InternalMessageSystemOutgoing = InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage | InternalOutgoingMessage>; export {};