# All files / src/model mediators.coffee

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 9/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    351x
    1x
    1x
    1x
    1x
    1x

    1x

    1x

    1x
     mongoose = require "mongoose"
    server = require "../server"
    connectionDefault = server.connectionDefault
    Schema = mongoose.Schema
    RouteDef = require('./channels').RouteDef
    ChannelDef = require('./channels').ChannelDef

    exports.configParamTypes = [ 'string', 'bool', 'number', 'option', 'bigstring', 'map', 'struct', 'password' ]

    exports.configDef = configDef =
      "param":        String
      "displayName":  String
      "description":  String
      "type":         type: String, enum: exports.configParamTypes
      "values":       [ type: String ]
      "template":     { type: Array }
      "array":        Boolean

    # The properties prefixed with an '_' are internally used properties and shouldn't be set by the user
    MediatorSchema = new Schema
      "urn":                    type: String, required: true, unique: true
      "version":                type: String, required: true
      "name":                   type: String, required: true
      "description":            String
      "endpoints":              [RouteDef]
      "defaultChannelConfig":   [ChannelDef]
      "configDefs":             [configDef]
      "config":                 Object
      "_configModifiedTS":      Date
      "_uptime":                Number
      "_lastHeartbeat":         Date

    # Model for describing a collection of mediators that have registered themselves with core
    exports.Mediator = connectionDefault.model 'Mediator', MediatorSchema