2024-03-18 13:58:05 +01:00
|
|
|
import type { ISignal, SignalSource } from './signal';
|
|
|
|
import type { IConstraint } from './strategy';
|
2024-02-29 13:56:48 +01:00
|
|
|
|
2024-03-04 13:08:05 +01:00
|
|
|
type ActionSetState = 'started' | 'success' | 'failed';
|
|
|
|
|
|
|
|
type ActionState = ActionSetState | 'not started';
|
|
|
|
|
2024-01-22 18:31:04 +01:00
|
|
|
export interface IActionSet {
|
|
|
|
id: number;
|
2024-01-26 09:20:30 +01:00
|
|
|
enabled: boolean;
|
2024-01-22 18:31:04 +01:00
|
|
|
name: string;
|
2024-03-05 12:33:34 +01:00
|
|
|
description: string;
|
2024-01-22 18:31:04 +01:00
|
|
|
project: string;
|
|
|
|
actorId: number;
|
|
|
|
match: IMatch;
|
|
|
|
actions: IAction[];
|
|
|
|
createdAt: string;
|
|
|
|
createdByUserId: number;
|
|
|
|
}
|
|
|
|
|
2024-02-29 13:56:48 +01:00
|
|
|
export type ParameterMatch = Pick<
|
|
|
|
IConstraint,
|
|
|
|
'inverted' | 'operator' | 'caseInsensitive' | 'value' | 'values'
|
|
|
|
>;
|
|
|
|
|
2024-01-22 18:31:04 +01:00
|
|
|
export interface IMatch {
|
2024-03-04 13:08:05 +01:00
|
|
|
source: SignalSource;
|
2024-01-22 18:31:04 +01:00
|
|
|
sourceId: number;
|
2024-02-29 13:56:48 +01:00
|
|
|
payload: Record<string, ParameterMatch>;
|
2024-01-22 18:31:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAction {
|
2024-02-12 18:10:33 +01:00
|
|
|
id: number;
|
2024-01-22 18:31:04 +01:00
|
|
|
action: string;
|
|
|
|
sortOrder: number;
|
|
|
|
executionParams: Record<string, unknown>;
|
2024-02-12 18:10:33 +01:00
|
|
|
createdAt: string;
|
|
|
|
createdByUserId: number;
|
2024-01-22 18:31:04 +01:00
|
|
|
}
|
2024-02-27 14:52:09 +01:00
|
|
|
|
|
|
|
export interface IActionEvent extends IAction {
|
|
|
|
state: ActionState;
|
|
|
|
details?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface IActionSetEventActionSet extends IActionSet {
|
|
|
|
actions: IActionEvent[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IActionSetEvent {
|
|
|
|
id: number;
|
|
|
|
actionSetId: number;
|
2024-03-04 13:08:05 +01:00
|
|
|
signalId: number;
|
2024-02-27 14:52:09 +01:00
|
|
|
createdAt: string;
|
|
|
|
state: ActionSetState;
|
2024-03-04 13:08:05 +01:00
|
|
|
signal: ISignal;
|
2024-02-27 14:52:09 +01:00
|
|
|
actionSet: IActionSetEventActionSet;
|
|
|
|
}
|
2024-03-18 12:09:49 +01:00
|
|
|
|
|
|
|
type BaseParameter = {
|
|
|
|
name: string;
|
|
|
|
label: string;
|
|
|
|
optional?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
type ActionConfigurationHiddenParameter = BaseParameter & {
|
|
|
|
type: 'hidden';
|
|
|
|
};
|
|
|
|
|
|
|
|
type ActionConfigurationSelectParameter = BaseParameter & {
|
|
|
|
type: 'select';
|
|
|
|
options: string[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ActionConfigurationParameter =
|
|
|
|
| ActionConfigurationHiddenParameter
|
|
|
|
| ActionConfigurationSelectParameter;
|
|
|
|
|
|
|
|
export type ActionConfiguration = {
|
|
|
|
label: string;
|
|
|
|
description?: string;
|
|
|
|
category?: string;
|
|
|
|
permissions: string[];
|
|
|
|
parameters: ActionConfigurationParameter[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ActionConfigurations = Map<string, ActionConfiguration>;
|