1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/frontend/src/interfaces/action.ts
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

88 lines
1.9 KiB
TypeScript

import type { ISignal, SignalSource } from './signal';
import type { IConstraint } from './strategy';
type ActionSetState = 'started' | 'success' | 'failed';
type ActionState = ActionSetState | 'not started';
export interface IActionSet {
id: number;
enabled: boolean;
name: string;
description: string;
project: string;
actorId: number;
match: IMatch;
actions: IAction[];
createdAt: string;
createdByUserId: number;
}
export type ParameterMatch = Pick<
IConstraint,
'inverted' | 'operator' | 'caseInsensitive' | 'value' | 'values'
>;
export interface IMatch {
source: SignalSource;
sourceId: number;
payload: Record<string, ParameterMatch>;
}
export interface IAction {
id: number;
action: string;
sortOrder: number;
executionParams: Record<string, unknown>;
createdAt: string;
createdByUserId: number;
}
export interface IActionEvent extends IAction {
state: ActionState;
details?: string;
}
interface IActionSetEventActionSet extends IActionSet {
actions: IActionEvent[];
}
export interface IActionSetEvent {
id: number;
actionSetId: number;
signalId: number;
createdAt: string;
state: ActionSetState;
signal: ISignal;
actionSet: IActionSetEventActionSet;
}
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>;