UNPKG

openhim-core

Version:

The OpenHIM core application that provides logging and routing of http requests

51 lines (44 loc) 1.47 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventModel = exports.EventModelAPI = exports.eventTypes = undefined; var _mongoose = require('mongoose'); var _config = require('../config'); const eventTypes = exports.eventTypes = ['channel', 'primary', 'route', 'orchestration']; // Active transaction events // // A short term collection for functions that require 'live' analysis of transactions // e.g. alerting and the visualizer // // Events are more fine-grained than individual transactions // const EventsSchema = new _mongoose.Schema({ created: { type: Date, default: Date.now, expires: '1h' }, channelID: { type: _mongoose.Schema.Types.ObjectId, required: true }, transactionID: { type: _mongoose.Schema.Types.ObjectId, required: true }, type: { type: String, enum: exports.EventTypes }, event: { type: String, enum: ['start', 'end'] }, name: String, status: Number, statusType: { type: String, enum: ['success', 'error'] }, // status string supported by visualizer (e.g. 'error' is red) normalizedTimestamp: String, mediator: String, autoRetryAttempt: Number }); EventsSchema.index({ created: 1 }, { expireAfterSeconds: 3600 }); const EventModelAPI = exports.EventModelAPI = _config.connectionAPI.model('Event', EventsSchema); const EventModel = exports.EventModel = _config.connectionDefault.model('Event', EventsSchema); //# sourceMappingURL=events.js.map