import { type IAuditable } from "../base/metadata.js"; import { type IExecutionDefinition } from "../execution/executionDefinition/index.js"; import { type IMeasure } from "../execution/measure/index.js"; import { type IExportDefinitionMetadataObject, type IExportDefinitionMetadataObjectDefinition } from "../exports/index.js"; import { type IMetadataObject, type IMetadataObjectDefinition } from "../ldm/metadata/types.js"; import { type Identifier, type ObjRef } from "../objRef/index.js"; /** * @public */ export interface IAutomationDetails { /** * Name of the widget. */ widgetName?: string; /** * Subject of the email. */ subject?: string; /** * Message of the email. */ message?: string; } /** * @alpha */ export interface IAutomationMetadataObjectBase { /** * Schedule of the automation. * Object with cron expression, timezone and first run timestamp. */ schedule?: IAutomationSchedule; /** * Evaluation mode for the automation. */ evaluationMode?: AutomationEvaluationMode; /** * Alerting configuration of the automation. */ alert?: IAutomationAlert; /** * Last run of the automation. */ lastRun?: { /** * Status of the last run. */ status?: IAutomationLastRunStatus; /** * Timestamp of the last run. */ executedAt?: string; /** * Trace id of the last run. */ traceId?: string; /** * Result of the last run. */ errorMessage?: string; }; /** * State of the automation. */ state?: IAutomationState; /** * Target notificationChannel that automation will trigger. * String with webhook (notificationChannel) id. */ notificationChannel?: string; /** * Title of the notification channel. */ notificationChannelTitle?: string; /** * Export definitions of the automation (attachments). */ exportDefinitions?: IExportDefinitionMetadataObject[]; /** * Recipients of the automation. */ recipients?: IAutomationRecipient[]; /** * Details of the automation. */ details?: IAutomationDetails; /** * Dashboard that automation is related to. */ dashboard?: { /** * Dashboard id. */ id?: Identifier; /** * Dashboard title. */ title?: string; }; /** * Workspace that automation is related to. */ workspace?: { /** * Workspace id. */ id?: Identifier; /** * Workspace title. */ title?: string; }; /** * Additional metadata of the automation. */ metadata?: { /** * Local identifier of the widget, if the automation is alerting * (scheduled exports widget local identifier is stored in exportDefinition) */ widget?: string; /** * Local identifier of the target tab. * Helps to switch to the tab containing the widget when opening the automation */ targetTabIdentifier?: string; /** * Filters that are used in the alerting configuration when creating a condition with some measure. */ filters?: string[]; /** * Filters description used for display in all client-related places (e.g. UI, e-mail, exports, etc.) */ visibleFilters?: IAutomationVisibleFilter[]; /** * Filters description structured by tab ID. * Used for dashboard automations when dashboard tabs are enabled. */ visibleFiltersByTab?: Record; /** * Original schedule of the automation before transformation by alert * anomaly detection, that uses different granularity. */ originalSchedule?: IAutomationSchedule; }; } /** * Evaluation mode for automation. * - SHARED: All recipients receive the same evaluation result * - PER_RECIPIENT: Each recipient receives personalized evaluation results * * @alpha */ export type AutomationEvaluationMode = "SHARED" | "PER_RECIPIENT"; /** * @alpha */ export interface IAutomationVisibleFilter { localIdentifier?: string; title?: string; isAllTimeDateFilter?: boolean; } /** * @alpha */ export interface IAutomationMetadataObject extends IAutomationMetadataObjectBase, IMetadataObject, IAuditable { type: "automation"; } /** * @alpha */ export declare function isAutomationMetadataObject(obj: unknown): obj is IAutomationMetadataObject; /** * @alpha */ export interface IAutomationMetadataObjectDefinition extends Omit, IMetadataObjectDefinition, IAuditable { type: "automation"; exportDefinitions?: (IExportDefinitionMetadataObjectDefinition | IExportDefinitionMetadataObject)[]; } /** * @alpha */ export declare function isAutomationMetadataObjectDefinition(obj: unknown): obj is IAutomationMetadataObjectDefinition; /** * @alpha */ export interface IAutomationSchedule { /** * Cron expression defining the schedule of the automation. * The format is SECOND MINUTE HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK (YEAR). * * Example: 0 *\/30 9-17 ? * MON-FRI (every 30 minutes from 9:00 to 17:00 on workdays) */ cron: string; /** * Human-readable description of the cron expression. */ cronDescription?: string; /** * Timezone in which the schedule is defined. * * Example: Europe/Prague */ timezone?: string; /** * Timestamp of the first scheduled action * If not provided default to the next scheduled time. * It should not include timezone information (use timezone property instead). * * Example: 2024-02-29T10:00:00.000Z */ firstRun?: string; } /** * @alpha */ export type IAutomationRecipientType = "user" | "userGroup" | "externalUser"; /** * @alpha */ export type IAutomationLastRunStatus = "SUCCESS" | "FAILED"; /** * @alpha */ export type IAutomationState = "ACTIVE" | "PAUSED"; /** * @alpha */ export interface IAutomationRecipientBase { /** * Type of the recipient. */ type: IAutomationRecipientType; /** * Id of the recipient. */ id: string; } /** * @alpha */ export interface IAutomationUserRecipient extends IAutomationRecipientBase { /** * Type of the recipient. */ type: "user"; /** * Name of the recipient. */ name?: string; /** * Email of the recipient, if available. */ email?: string; } /** * Type guard checking if the object is of type {@link IAutomationUserRecipient}. * @alpha */ export declare function isAutomationUserRecipient(obj: unknown): obj is IAutomationUserRecipient; /** * @alpha */ export interface IAutomationUserGroupRecipient extends IAutomationRecipientBase { /** * Type of the recipient. */ type: "userGroup"; /** * Name of the group. */ name?: string; } /** * Type guard checking if the object is of type {@link IAutomationUserGroupRecipient}. * @alpha */ export declare function isAutomationUserGroupRecipient(obj: unknown): obj is IAutomationUserGroupRecipient; /** * @alpha */ export interface IAutomationExternalRecipient extends Omit { /** * Type of the recipient. */ type: "externalUser"; } /** * Type guard checking if the object is of type {@link IAutomationExternalRecipient}. * @alpha */ export declare function isAutomationExternalUserRecipient(obj: unknown): obj is IAutomationExternalRecipient; /** * @alpha */ export interface IAutomationUnknownRecipient extends Omit { /** * Type of the recipient. */ type: "unknownUser"; } /** * Type guard checking if the object is of type {@link IAutomationExternalRecipient}. * @alpha */ export declare function isAutomationUnknownUserRecipient(obj: unknown): obj is IAutomationUnknownRecipient; /** * @alpha */ export type IAutomationRecipient = IAutomationUserRecipient | IAutomationUserGroupRecipient | IAutomationExternalRecipient | IAutomationUnknownRecipient; /** * @alpha */ export type IAutomationAlertExecutionDefinition = Pick & { /** * Metrics to be referenced from other AFM objects (e.g. filters) but not included in the result. */ readonly auxMeasures?: IMeasure[]; }; /** * @alpha */ export type IAlertComparisonOperator = "LESS_THAN" | "LESS_THAN_OR_EQUAL_TO" | "GREATER_THAN" | "GREATER_THAN_OR_EQUAL_TO"; /** * @alpha */ export type IAutomationAlertCondition = IAutomationAlertComparisonCondition | IAutomationAlertRelativeCondition | IAutomationAnomalyDetectionCondition; /** * @alpha */ export interface IAutomationAlertComparisonCondition { /** * Type of the condition. */ type: "comparison"; /** * Operator of the condition. */ operator: IAlertComparisonOperator; /** * Identifier of left side of the condition. */ left: { /** * Identifier of the measure. */ id: string; /** * Title of the measure. */ title?: string; /** * Format of the measure. */ format?: string; }; /** * Right side of the condition. */ right: number; } /** * @alpha */ export type IAlertRelativeOperator = "INCREASES_BY" | "DECREASES_BY" | "CHANGES_BY"; /** * @alpha */ export type IAlertRelativeArithmeticOperator = "DIFFERENCE" | "CHANGE"; /** * @alpha */ export interface IAutomationAlertRelativeCondition { /** * Type of the condition. */ type: "relative"; /** * Operator of the condition. */ operator: IAlertRelativeOperator; /** * Identifier of the measures calculated in the condition. */ measure: { /** * Operator of the measure. */ operator: IAlertRelativeArithmeticOperator; /** * Identifier of left side of the condition. */ left: { /** * Identifier of the measure. */ id: string; /** * Title of the measure. */ title?: string; /** * Format of the measure. */ format?: string; }; /** * Identifier of right side of the condition. */ right: { /** * Identifier of the measure. */ id: string; /** * Title of the measure. */ title?: string; /** * Format of the measure. */ format?: string; }; }; /** * Threshold of the condition. */ threshold: number; } /** * @alpha */ export interface IAutomationAnomalyDetectionCondition { /** * Type of the condition. */ type: "anomalyDetection"; /** * Sensitivity of the anomaly detection. */ sensitivity: IAlertAnomalyDetectionSensitivity; /** * Granularity of the anomaly detection. */ granularity: IAlertAnomalyDetectionGranularity; /** * Date dataset to be used for anomaly detection. */ dataset: ObjRef; /** * Identifier of left side of the condition. */ measure: { /** * Identifier of the measure. */ id: string; /** * Title of the measure. */ title?: string; /** * Format of the measure. */ format?: string; }; } /** * @alpha */ export type IAlertAnomalyDetectionSensitivity = "LOW" | "MEDIUM" | "HIGH"; /** * @alpha */ export type IAlertAnomalyDetectionGranularity = "HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR"; /** * @alpha */ export interface IAutomationAlert { /** * Execution definition of the alert. */ execution: IAutomationAlertExecutionDefinition; /** * Condition of the alert. */ condition: IAutomationAlertCondition; /** * Trigger state of the alert. */ trigger: IAutomationAlertTrigger; } /** * @alpha */ export interface IAutomationAlertTrigger { /** * Overrides the default trigger mode, set on organization settings level. */ mode?: IAlertTriggerMode; /** * State of the trigger. */ state: IAlertTriggerState; /** * Interval of the trigger. * Only used when mode is set to ONCE_PER_INTERVAL. */ interval?: IAlertTriggerInterval; } /** * @alpha */ export type IAlertTriggerMode = "ALWAYS" | "ONCE" | "ONCE_PER_INTERVAL"; /** * @alpha */ export type IAlertTriggerState = "ACTIVE" | "PAUSED"; /** * @alpha */ export type IAlertTriggerInterval = "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR"; //# sourceMappingURL=index.d.ts.map