UNPKG

@altostra/core

Version:

Core library for shared types and logic

1 lines 2.75 kB
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),__exportStar=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||__createBinding(t,e,n)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isKnownLogShippingIntegration=exports.isAnyLogShippingIntegration=exports.logShippingIntegrationValidationByType=exports.isLogShippingVendor=exports.LOG_SHIPPING_INTEGRATION_TYPE=exports.LogShippingIntegrationType=exports.LogShippingIntegrationData=void 0;const type_validations_1=require("@altostra/type-validations"),RejectionReasons_1=require("@altostra/type-validations/lib/RejectionReasons"),NonEmptyString_1=require("../../../CustomTypes/NonEmptyString"),Object_1=require("../../../Utils/Object"),Integration_1=require("../Integration"),common_1=require("./common"),DatadogLogShipping_1=require("./DatadogLogShipping"),SplunkLogShipping_1=require("./SplunkLogShipping");var common_2=require("./common");Object.defineProperty(exports,"LogShippingIntegrationData",{enumerable:!0,get:function(){return common_2.LogShippingIntegrationData}}),Object.defineProperty(exports,"LogShippingIntegrationType",{enumerable:!0,get:function(){return common_2.LogShippingIntegrationType}}),Object.defineProperty(exports,"LOG_SHIPPING_INTEGRATION_TYPE",{enumerable:!0,get:function(){return common_2.LOG_SHIPPING_INTEGRATION_TYPE}}),__exportStar(require("./DatadogLogShipping"),exports),__exportStar(require("./SplunkLogShipping"),exports),exports.isLogShippingVendor=(0,type_validations_1.enumOf)("datadog","splunk"),exports.logShippingIntegrationValidationByType={datadog:DatadogLogShipping_1.isDatadogIntegration,splunk:SplunkLogShipping_1.isSplunkIntegration},exports.isAnyLogShippingIntegration=(0,Integration_1.createIntegrationValidation)(common_1.LOG_SHIPPING_INTEGRATION_TYPE,(0,type_validations_1.objectOf)({vendor:NonEmptyString_1.isNonEmptyString,vendorData:Object_1.isSimpleObject})),exports.isKnownLogShippingIntegration=(0,RejectionReasons_1.registerRejectingValidator)((function(e,t){if(!(0,exports.isAnyLogShippingIntegration)(e,t))return!1;if(!(e.data.vendor in exports.logShippingIntegrationValidationByType))return null==t||t((0,RejectionReasons_1.createRejection)("Log shipping vendor is unknown",exports.isLogShippingVendor[RejectionReasons_1.typeValidatorType],["vendor","data"])),!1;return(0,exports.logShippingIntegrationValidationByType[e.data.vendor])(e,t)}),"LogShippingIntegration");