2020-02-11 23:53:06 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
|
|
*/
|
|
|
|
import * as t from 'io-ts';
|
|
|
|
import { DateFromString } from './date_from_string';
|
|
|
|
|
|
|
|
const metaSchema = t.partial({
|
2020-12-10 16:16:42 +01:00
|
|
|
lastScheduledActions: t.intersection([
|
|
|
|
t.partial({
|
|
|
|
subgroup: t.string,
|
|
|
|
}),
|
|
|
|
t.type({
|
|
|
|
group: t.string,
|
|
|
|
date: DateFromString,
|
|
|
|
}),
|
|
|
|
]),
|
2020-02-11 23:53:06 +01:00
|
|
|
});
|
|
|
|
export type AlertInstanceMeta = t.TypeOf<typeof metaSchema>;
|
|
|
|
|
|
|
|
const stateSchema = t.record(t.string, t.unknown);
|
|
|
|
export type AlertInstanceState = t.TypeOf<typeof stateSchema>;
|
|
|
|
|
2020-08-14 18:52:42 +02:00
|
|
|
const contextSchema = t.record(t.string, t.unknown);
|
|
|
|
export type AlertInstanceContext = t.TypeOf<typeof contextSchema>;
|
|
|
|
|
2020-02-11 23:53:06 +01:00
|
|
|
export const rawAlertInstance = t.partial({
|
|
|
|
state: stateSchema,
|
|
|
|
meta: metaSchema,
|
|
|
|
});
|
|
|
|
export type RawAlertInstance = t.TypeOf<typeof rawAlertInstance>;
|