"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.createMetricAnomalyRuleType = createMetricAnomalyRuleType; var _i18n = require("@kbn/i18n"); var _react = _interopRequireDefault(require("react")); var _metrics = require("../../../common/alerting/metrics"); var _validation = require("./components/validation"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function createMetricAnomalyRuleType() { return { id: _metrics.METRIC_ANOMALY_ALERT_TYPE_ID, description: _i18n.i18n.translate('xpack.infra.metrics.anomaly.alertFlyout.alertDescription', { defaultMessage: 'Alert when the anomaly score exceeds a defined threshold.' }), iconClass: 'bell', documentationUrl(docLinks) { return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/observability/${docLinks.DOC_LINK_VERSION}/infrastructure-anomaly-alert.html`; }, ruleParamsExpression: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./components/expression')))), validate: _validation.validateMetricAnomaly, defaultActionMessage: _i18n.i18n.translate('xpack.infra.metrics.alerting.anomaly.defaultActionMessage', { defaultMessage: `\\{\\{alertName\\}\\} is in a state of \\{\\{context.alertState\\}\\} \\{\\{context.metric\\}\\} was \\{\\{context.summary\\}\\} than normal at \\{\\{context.timestamp\\}\\} Typical value: \\{\\{context.typical\\}\\} Actual value: \\{\\{context.actual\\}\\} ` }), requiresAppContext: false }; }