1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/interfaces/action.ts

70 lines
1.5 KiB
TypeScript
Raw Normal View History

import { IConstraint } from './strategy';
export interface IActionSet {
id: number;
enabled: boolean;
name: string;
project: string;
actorId: number;
match: IMatch;
actions: IAction[];
createdAt: string;
createdByUserId: number;
}
type MatchSource = 'incoming-webhook';
export type ParameterMatch = Pick<
IConstraint,
'inverted' | 'operator' | 'caseInsensitive' | 'value' | 'values'
>;
export interface IMatch {
source: MatchSource;
sourceId: number;
payload: Record<string, ParameterMatch>;
}
export interface IAction {
id: number;
action: string;
sortOrder: number;
executionParams: Record<string, unknown>;
createdAt: string;
createdByUserId: number;
}
export type ObservableEventSource = 'incoming-webhook';
export interface IObservableEvent {
id: number;
source: ObservableEventSource;
sourceId: number;
createdAt: string;
createdByIncomingWebhookTokenId: number;
payload: Record<string, unknown>;
}
type ActionSetState = 'started' | 'success' | 'failed';
type ActionState = ActionSetState | 'not started';
export interface IActionEvent extends IAction {
state: ActionState;
details?: string;
}
interface IActionSetEventActionSet extends IActionSet {
actions: IActionEvent[];
}
export interface IActionSetEvent {
id: number;
actionSetId: number;
observableEventId: number;
createdAt: string;
state: ActionSetState;
observableEvent: IObservableEvent;
actionSet: IActionSetEventActionSet;
}