UNPKG

openhim-core

Version:

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

351 lines (350 loc) 11.5 kB
<!doctype html> <html lang="en"> <head> <title>Code coverage report for src/model/channels.coffee</title> <meta charset="utf-8" /> <link rel="stylesheet" href="../../prettify.css" /> <link rel="stylesheet" href="../../base.css" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type='text/css'> .coverage-summary .sorter { background-image: url(../../sort-arrow-sprite.png); } </style> </head> <body> <div class='wrapper'> <div class='pad1'> <h1> <a href="../../index.html">All files</a> / <a href="index.html">src/model</a> channels.coffee </h1> <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">100% </span> <span class="quiet">Statements</span> <span class='fraction'>11/11</span> </div> <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="quiet">Branches</span> <span class='fraction'>0/2</span> </div> <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="quiet">Functions</span> <span class='fraction'>0/1</span> </div> <div class='fl pad1y space-right2'> <span class="strong">100% </span> <span class="quiet">Lines</span> <span class='fraction'>11/11</span> </div> </div> </div> <div class='status-line high'></div> <pre><table class="coverage"> <tr><td class="line-count quiet">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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">mongoose = require "mongoose" server = require "../server" connectionDefault = server.connectionDefault Schema = mongoose.Schema ContactUserDef = require('./contactGroups').ContactUserDef &nbsp; RouteDef = "name": type: String, required: true "secured": Boolean "host": type: String, required: true "port": type: Number, required: true, min: 0, max: 65536 "path": String "pathTransform": String "primary": Boolean "username": String "password": String "type": type: String, default: 'http', enum: ['http', 'tcp', 'mllp'] "cert": Schema.Types.ObjectId "status": type: String, default: 'enabled', enum: ['enabled', 'disabled'] "forwardAuthHeader": type: Boolean, default: false &nbsp; # Channel alerts # # The following alert conditions are supported: # * status: match on a specific transaction status (404, 5xx). Supports failure rates. # * auto-retry-max-attempted: triggers when a failing transaction has reach the max number of auto retries # AlertsDef = "condition": type: String, default: 'status', enum: ['status', 'auto-retry-max-attempted'] "status": type: String "failureRate": Number "groups": [Schema.Types.ObjectId] "users": [ContactUserDef] &nbsp; RewriteRuleDef = "fromHost": type: String, required: true "toHost": type: String, required: true "fromPort": type: Number, required: true, default: 80 "toPort": type: Number, required: true, default: 80 "pathTransform": String &nbsp; ChannelDef = "name": type: String, required: true "description": String "urlPattern": type: String, required: true "type": type: String, default: 'http', enum: ['http', 'tcp', 'tls', 'polling'] "priority": type: Number, min: 1 "tcpPort": type: Number, min: 0, max: 65536 "tcpHost": String "pollingSchedule": String "requestBody": Boolean "responseBody": Boolean "allow": [type: String, required: true] "whitelist" : [String] "authType": type: String, default: 'private', enum: ['private', 'public'] "routes": [RouteDef] "matchContentTypes": [String] "matchContentRegex": String "matchContentXpath": String "matchContentJson": String "matchContentValue": String "properties": [Object] "txViewAcl": [String] "txViewFullAcl": [String] "txRerunAcl": [String] "alerts": [AlertsDef] "status": type: String, default: 'enabled', enum: ['enabled', 'disabled', 'deleted'] "rewriteUrls": type: Boolean, default: false "addAutoRewriteRules": type: Boolean, default: true "rewriteUrlsConfig": [RewriteRuleDef] "autoRetryEnabled": type: Boolean, default: false "autoRetryPeriodMinutes": type: Number, default: 60, min: 1 "autoRetryMaxAttempts": type: Number, min: 0 # 0 means unlimited &nbsp; # Expose the route schema exports.RouteDef = RouteDef &nbsp; ### # The Channel object that describes a specific channel within the OpenHIM. # It provides some metadata describing a channel and contians a number of # route objects. If a request matches the urlPattern of a channel it should # be routed to each of the routes described in that channel. # # A channel also has an allow property. This property should contain a list # of users or group that are authroised to send messages to this channel. ### ChannelSchema = new Schema ChannelDef ChannelSchema.index "name", unique: true &nbsp; exports.Channel = connectionDefault.model 'Channel', ChannelSchema exports.ChannelDef = ChannelDef &nbsp; # Is the channel enabled? # If there is no status field then the channel IS enabled exports.isChannelEnabled = <span class="fstat-no" title="function not covered" >(</span>channel) -&gt; not channel.status or channel.status is 'enabled' &nbsp;</pre></td></tr> </table></pre> <div class='push'></div><!-- for sticky footer --> </div><!-- /wrapper --> <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 10 2016 13:39:22 GMT+0200 (SAST) </div> </div> <script src="../../prettify.js"></script> <script> window.onload = function () { if (typeof prettyPrint === 'function') { prettyPrint(); } }; </script> <script src="../../sorter.js"></script> </body> </html>